1 // SPDX-License-Identifier: GPL-2.0
2 /*
3 * Platform driver for the Intel SCU.
4 *
5 * Copyright (C) 2019, Intel Corporation
6 * Authors: Divya Sasidharan <divya.s.sasidharan@intel.com>
7 * Mika Westerberg <mika.westerberg@linux.intel.com>
8 * Rajmohan Mani <rajmohan.mani@intel.com>
9 */
10
11 #include <linux/err.h>
12 #include <linux/errno.h>
13 #include <linux/ioport.h>
14 #include <linux/mod_devicetable.h>
15 #include <linux/module.h>
16 #include <linux/platform_device.h>
17
18 #include <asm/intel_scu_ipc.h>
19
intel_scu_platform_probe(struct platform_device * pdev)20 static int intel_scu_platform_probe(struct platform_device *pdev)
21 {
22 struct intel_scu_ipc_data scu_data = {};
23 struct intel_scu_ipc_dev *scu;
24 const struct resource *res;
25
26 scu_data.irq = platform_get_irq_optional(pdev, 0);
27 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
28 if (!res)
29 return -ENOMEM;
30
31 scu_data.mem = *res;
32
33 scu = devm_intel_scu_ipc_register(&pdev->dev, &scu_data);
34 if (IS_ERR(scu))
35 return PTR_ERR(scu);
36
37 platform_set_drvdata(pdev, scu);
38 return 0;
39 }
40
41 static const struct acpi_device_id intel_scu_acpi_ids[] = {
42 { "INTC1026" },
43 {}
44 };
45 MODULE_DEVICE_TABLE(acpi, intel_scu_acpi_ids);
46
47 static struct platform_driver intel_scu_platform_driver = {
48 .probe = intel_scu_platform_probe,
49 .driver = {
50 .name = "intel_scu",
51 .acpi_match_table = intel_scu_acpi_ids,
52 },
53 };
54 module_platform_driver(intel_scu_platform_driver);
55
56 MODULE_AUTHOR("Divya Sasidharan <divya.s.sasidharan@intel.com>");
57 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com");
58 MODULE_AUTHOR("Rajmohan Mani <rajmohan.mani@intel.com>");
59 MODULE_DESCRIPTION("Intel SCU platform driver");
60 MODULE_LICENSE("GPL v2");
61