0001
0002
0003
0004
0005
0006 #include <linux/acpi.h>
0007 #include <linux/kernel.h>
0008 #include <linux/module.h>
0009 #include <linux/platform_device.h>
0010 #include <linux/thermal.h>
0011
0012 #include "int340x_thermal_zone.h"
0013 #include "processor_thermal_device.h"
0014
0015 static const struct acpi_device_id int3401_device_ids[] = {
0016 {"INT3401", 0},
0017 {"", 0},
0018 };
0019 MODULE_DEVICE_TABLE(acpi, int3401_device_ids);
0020
0021 static int int3401_add(struct platform_device *pdev)
0022 {
0023 struct proc_thermal_device *proc_priv;
0024 int ret;
0025
0026 proc_priv = devm_kzalloc(&pdev->dev, sizeof(*proc_priv), GFP_KERNEL);
0027 if (!proc_priv)
0028 return -ENOMEM;
0029
0030 ret = proc_thermal_add(&pdev->dev, proc_priv);
0031 if (ret)
0032 return ret;
0033
0034 platform_set_drvdata(pdev, proc_priv);
0035
0036 return ret;
0037 }
0038
0039 static int int3401_remove(struct platform_device *pdev)
0040 {
0041 proc_thermal_remove(platform_get_drvdata(pdev));
0042
0043 return 0;
0044 }
0045
0046 #ifdef CONFIG_PM_SLEEP
0047 static int int3401_thermal_suspend(struct device *dev)
0048 {
0049 return proc_thermal_suspend(dev);
0050 }
0051 static int int3401_thermal_resume(struct device *dev)
0052 {
0053 return proc_thermal_resume(dev);
0054 }
0055 #else
0056 #define int3401_thermal_suspend NULL
0057 #define int3401_thermal_resume NULL
0058 #endif
0059
0060 static SIMPLE_DEV_PM_OPS(int3401_proc_thermal_pm, int3401_thermal_suspend,
0061 int3401_thermal_resume);
0062
0063 static struct platform_driver int3401_driver = {
0064 .probe = int3401_add,
0065 .remove = int3401_remove,
0066 .driver = {
0067 .name = "int3401 thermal",
0068 .acpi_match_table = int3401_device_ids,
0069 .pm = &int3401_proc_thermal_pm,
0070 },
0071 };
0072
0073 static int __init proc_thermal_init(void)
0074 {
0075 return platform_driver_register(&int3401_driver);
0076 }
0077
0078 static void __exit proc_thermal_exit(void)
0079 {
0080 platform_driver_unregister(&int3401_driver);
0081 }
0082
0083 module_init(proc_thermal_init);
0084 module_exit(proc_thermal_exit);
0085
0086 MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
0087 MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
0088 MODULE_LICENSE("GPL v2");