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/module.h>
15 #include <linux/platform_device.h>
16
17 #include <linux/platform_data/x86/intel_scu_ipc.h>
18
intel_scu_platform_probe(struct platform_device * pdev)19 static int intel_scu_platform_probe(struct platform_device *pdev)
20 {
21 struct intel_scu_ipc_data scu_data = {};
22 struct intel_scu_ipc_dev *scu;
23 const struct resource *res;
24
25 scu_data.irq = platform_get_irq_optional(pdev, 0);
26 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
27 if (!res)
28 return -ENOMEM;
29
30 scu_data.mem = *res;
31
32 scu = devm_intel_scu_ipc_register(&pdev->dev, &scu_data);
33 if (IS_ERR(scu))
34 return PTR_ERR(scu);
35
36 platform_set_drvdata(pdev, scu);
37 return 0;
38 }
39
40 static const struct acpi_device_id intel_scu_acpi_ids[] = {
41 { "INTC1026" },
42 {}
43 };
44 MODULE_DEVICE_TABLE(acpi, intel_scu_acpi_ids);
45
46 static struct platform_driver intel_scu_platform_driver = {
47 .probe = intel_scu_platform_probe,
48 .driver = {
49 .name = "intel_scu",
50 .acpi_match_table = intel_scu_acpi_ids,
51 },
52 };
53 module_platform_driver(intel_scu_platform_driver);
54
55 MODULE_AUTHOR("Divya Sasidharan <divya.s.sasidharan@intel.com>");
56 MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com");
57 MODULE_AUTHOR("Rajmohan Mani <rajmohan.mani@intel.com>");
58 MODULE_DESCRIPTION("Intel SCU platform driver");
59 MODULE_LICENSE("GPL v2");
60