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