1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2c11dd70fSSrinivas Pandruvada /*
3c11dd70fSSrinivas Pandruvada * ACPI support for int340x thermal drivers
4c11dd70fSSrinivas Pandruvada *
5c11dd70fSSrinivas Pandruvada * Copyright (C) 2014, Intel Corporation
6c11dd70fSSrinivas Pandruvada * Authors: Zhang Rui <rui.zhang@intel.com>
7c11dd70fSSrinivas Pandruvada */
8c11dd70fSSrinivas Pandruvada
9c11dd70fSSrinivas Pandruvada #include <linux/acpi.h>
10c11dd70fSSrinivas Pandruvada #include <linux/module.h>
11c11dd70fSSrinivas Pandruvada
12580d0382SMasahiro Yamada #include "../internal.h"
13c11dd70fSSrinivas Pandruvada
14c11dd70fSSrinivas Pandruvada #define INT3401_DEVICE 0X01
15c11dd70fSSrinivas Pandruvada static const struct acpi_device_id int340x_thermal_device_ids[] = {
16c11dd70fSSrinivas Pandruvada {"INT3400"},
17c11dd70fSSrinivas Pandruvada {"INT3401", INT3401_DEVICE},
18c11dd70fSSrinivas Pandruvada {"INT3402"},
19c11dd70fSSrinivas Pandruvada {"INT3403"},
20c11dd70fSSrinivas Pandruvada {"INT3404"},
21c11dd70fSSrinivas Pandruvada {"INT3406"},
22c11dd70fSSrinivas Pandruvada {"INT3407"},
23c11dd70fSSrinivas Pandruvada {"INT3408"},
24c11dd70fSSrinivas Pandruvada {"INT3409"},
25c11dd70fSSrinivas Pandruvada {"INT340A"},
26c11dd70fSSrinivas Pandruvada {"INT340B"},
277d966119SSumeet Pawnikar {"INT3532"},
28b62c770fSGayatri Kammela {"INTC1040"},
2938748bcbSSrinivas Pandruvada {"INTC1041"},
30657b95d3SSumeet Pawnikar {"INTC1042"},
31b62c770fSGayatri Kammela {"INTC1043"},
32b62c770fSGayatri Kammela {"INTC1044"},
332ce6324eSSrinivas Pandruvada {"INTC1045"},
3438748bcbSSrinivas Pandruvada {"INTC1046"},
35b62c770fSGayatri Kammela {"INTC1047"},
3638748bcbSSrinivas Pandruvada {"INTC1048"},
3738748bcbSSrinivas Pandruvada {"INTC1049"},
387d966119SSumeet Pawnikar {"INTC1050"},
3938748bcbSSrinivas Pandruvada {"INTC1060"},
4038748bcbSSrinivas Pandruvada {"INTC1061"},
41657b95d3SSumeet Pawnikar {"INTC1062"},
42657b95d3SSumeet Pawnikar {"INTC1063"},
43657b95d3SSumeet Pawnikar {"INTC1064"},
44657b95d3SSumeet Pawnikar {"INTC1065"},
45657b95d3SSumeet Pawnikar {"INTC1066"},
46*79b510c4SSumeet Pawnikar {"INTC1068"},
47*79b510c4SSumeet Pawnikar {"INTC1069"},
48*79b510c4SSumeet Pawnikar {"INTC106A"},
49*79b510c4SSumeet Pawnikar {"INTC106B"},
50*79b510c4SSumeet Pawnikar {"INTC106C"},
51*79b510c4SSumeet Pawnikar {"INTC106D"},
52a510c78eSSrinivas Pandruvada {"INTC10A0"},
53a510c78eSSrinivas Pandruvada {"INTC10A1"},
54a510c78eSSrinivas Pandruvada {"INTC10A2"},
55a510c78eSSrinivas Pandruvada {"INTC10A3"},
56a510c78eSSrinivas Pandruvada {"INTC10A4"},
57a510c78eSSrinivas Pandruvada {"INTC10A5"},
58c11dd70fSSrinivas Pandruvada {""},
59c11dd70fSSrinivas Pandruvada };
60c11dd70fSSrinivas Pandruvada
int340x_thermal_handler_attach(struct acpi_device * adev,const struct acpi_device_id * id)61c11dd70fSSrinivas Pandruvada static int int340x_thermal_handler_attach(struct acpi_device *adev,
62c11dd70fSSrinivas Pandruvada const struct acpi_device_id *id)
63c11dd70fSSrinivas Pandruvada {
64c11dd70fSSrinivas Pandruvada if (IS_ENABLED(CONFIG_INT340X_THERMAL))
651571875bSHeikki Krogerus acpi_create_platform_device(adev, NULL);
66c11dd70fSSrinivas Pandruvada /* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */
67c11dd70fSSrinivas Pandruvada else if (IS_ENABLED(CONFIG_INTEL_SOC_DTS_THERMAL) &&
68c11dd70fSSrinivas Pandruvada id->driver_data == INT3401_DEVICE)
691571875bSHeikki Krogerus acpi_create_platform_device(adev, NULL);
70c11dd70fSSrinivas Pandruvada return 1;
71c11dd70fSSrinivas Pandruvada }
72c11dd70fSSrinivas Pandruvada
73c11dd70fSSrinivas Pandruvada static struct acpi_scan_handler int340x_thermal_handler = {
74c11dd70fSSrinivas Pandruvada .ids = int340x_thermal_device_ids,
75c11dd70fSSrinivas Pandruvada .attach = int340x_thermal_handler_attach,
76c11dd70fSSrinivas Pandruvada };
77c11dd70fSSrinivas Pandruvada
acpi_int340x_thermal_init(void)78c11dd70fSSrinivas Pandruvada void __init acpi_int340x_thermal_init(void)
79c11dd70fSSrinivas Pandruvada {
80c11dd70fSSrinivas Pandruvada acpi_scan_add_handler(&int340x_thermal_handler);
81c11dd70fSSrinivas Pandruvada }
82