xref: /linux/drivers/acpi/dptf/int340x_thermal.c (revision c11dd70fd7f50fca7dc05520ec8075f12d93cb63)
1*c11dd70fSSrinivas Pandruvada /*
2*c11dd70fSSrinivas Pandruvada  * ACPI support for int340x thermal drivers
3*c11dd70fSSrinivas Pandruvada  *
4*c11dd70fSSrinivas Pandruvada  * Copyright (C) 2014, Intel Corporation
5*c11dd70fSSrinivas Pandruvada  * Authors: Zhang Rui <rui.zhang@intel.com>
6*c11dd70fSSrinivas Pandruvada  *
7*c11dd70fSSrinivas Pandruvada  * This program is free software; you can redistribute it and/or modify
8*c11dd70fSSrinivas Pandruvada  * it under the terms of the GNU General Public License version 2 as
9*c11dd70fSSrinivas Pandruvada  * published by the Free Software Foundation.
10*c11dd70fSSrinivas Pandruvada  */
11*c11dd70fSSrinivas Pandruvada 
12*c11dd70fSSrinivas Pandruvada #include <linux/acpi.h>
13*c11dd70fSSrinivas Pandruvada #include <linux/module.h>
14*c11dd70fSSrinivas Pandruvada 
15*c11dd70fSSrinivas Pandruvada #include "internal.h"
16*c11dd70fSSrinivas Pandruvada 
17*c11dd70fSSrinivas Pandruvada #define INT3401_DEVICE 0X01
18*c11dd70fSSrinivas Pandruvada static const struct acpi_device_id int340x_thermal_device_ids[] = {
19*c11dd70fSSrinivas Pandruvada 	{"INT3400"},
20*c11dd70fSSrinivas Pandruvada 	{"INT3401", INT3401_DEVICE},
21*c11dd70fSSrinivas Pandruvada 	{"INT3402"},
22*c11dd70fSSrinivas Pandruvada 	{"INT3403"},
23*c11dd70fSSrinivas Pandruvada 	{"INT3404"},
24*c11dd70fSSrinivas Pandruvada 	{"INT3406"},
25*c11dd70fSSrinivas Pandruvada 	{"INT3407"},
26*c11dd70fSSrinivas Pandruvada 	{"INT3408"},
27*c11dd70fSSrinivas Pandruvada 	{"INT3409"},
28*c11dd70fSSrinivas Pandruvada 	{"INT340A"},
29*c11dd70fSSrinivas Pandruvada 	{"INT340B"},
30*c11dd70fSSrinivas Pandruvada 	{""},
31*c11dd70fSSrinivas Pandruvada };
32*c11dd70fSSrinivas Pandruvada 
33*c11dd70fSSrinivas Pandruvada static int int340x_thermal_handler_attach(struct acpi_device *adev,
34*c11dd70fSSrinivas Pandruvada 					const struct acpi_device_id *id)
35*c11dd70fSSrinivas Pandruvada {
36*c11dd70fSSrinivas Pandruvada 	if (IS_ENABLED(CONFIG_INT340X_THERMAL))
37*c11dd70fSSrinivas Pandruvada 		acpi_create_platform_device(adev);
38*c11dd70fSSrinivas Pandruvada 	/* Intel SoC DTS thermal driver needs INT3401 to set IRQ descriptor */
39*c11dd70fSSrinivas Pandruvada 	else if (IS_ENABLED(CONFIG_INTEL_SOC_DTS_THERMAL) &&
40*c11dd70fSSrinivas Pandruvada 		 id->driver_data == INT3401_DEVICE)
41*c11dd70fSSrinivas Pandruvada 		acpi_create_platform_device(adev);
42*c11dd70fSSrinivas Pandruvada 	return 1;
43*c11dd70fSSrinivas Pandruvada }
44*c11dd70fSSrinivas Pandruvada 
45*c11dd70fSSrinivas Pandruvada static struct acpi_scan_handler int340x_thermal_handler = {
46*c11dd70fSSrinivas Pandruvada 	.ids = int340x_thermal_device_ids,
47*c11dd70fSSrinivas Pandruvada 	.attach = int340x_thermal_handler_attach,
48*c11dd70fSSrinivas Pandruvada };
49*c11dd70fSSrinivas Pandruvada 
50*c11dd70fSSrinivas Pandruvada void __init acpi_int340x_thermal_init(void)
51*c11dd70fSSrinivas Pandruvada {
52*c11dd70fSSrinivas Pandruvada 	acpi_scan_add_handler(&int340x_thermal_handler);
53*c11dd70fSSrinivas Pandruvada }
54