summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/intel_scu_pltdrv.c
blob: 56ec6ae4c824a28c4b5009b42edb50b23e3bc25c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
// SPDX-License-Identifier: GPL-2.0
/*
 * Platform driver for the Intel SCU.
 *
 * Copyright (C) 2019, Intel Corporation
 * Authors: Divya Sasidharan <divya.s.sasidharan@intel.com>
 *	    Mika Westerberg <mika.westerberg@linux.intel.com>
 *	    Rajmohan Mani <rajmohan.mani@intel.com>
 */

#include <linux/err.h>
#include <linux/errno.h>
#include <linux/ioport.h>
#include <linux/mod_devicetable.h>
#include <linux/module.h>
#include <linux/platform_device.h>

#include <asm/intel_scu_ipc.h>

static int intel_scu_platform_probe(struct platform_device *pdev)
{
	struct intel_scu_ipc_data scu_data = {};
	struct intel_scu_ipc_dev *scu;
	const struct resource *res;

	scu_data.irq = platform_get_irq_optional(pdev, 0);
	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
	if (!res)
		return -ENOMEM;

	scu_data.mem = *res;

	scu = devm_intel_scu_ipc_register(&pdev->dev, &scu_data);
	if (IS_ERR(scu))
		return PTR_ERR(scu);

	platform_set_drvdata(pdev, scu);
	return 0;
}

static const struct acpi_device_id intel_scu_acpi_ids[] = {
	{ "INTC1026" },
	{}
};
MODULE_DEVICE_TABLE(acpi, intel_scu_acpi_ids);

static struct platform_driver intel_scu_platform_driver = {
	.probe = intel_scu_platform_probe,
	.driver = {
		.name = "intel_scu",
		.acpi_match_table = intel_scu_acpi_ids,
	},
};
module_platform_driver(intel_scu_platform_driver);

MODULE_AUTHOR("Divya Sasidharan <divya.s.sasidharan@intel.com>");
MODULE_AUTHOR("Mika Westerberg <mika.westerberg@linux.intel.com");
MODULE_AUTHOR("Rajmohan Mani <rajmohan.mani@intel.com>");
MODULE_DESCRIPTION("Intel SCU platform driver");
MODULE_LICENSE("GPL v2");