Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / drivers / thermal / intel / int340x_thermal / int3401_thermal.c
blob96d6277a5a8c4757081b2d85a7282e31377574cb
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * INT3401 processor thermal device
4 * Copyright (c) 2020, Intel Corporation.
5 */
6 #include <linux/acpi.h>
7 #include <linux/kernel.h>
8 #include <linux/module.h>
9 #include <linux/platform_device.h>
10 #include <linux/thermal.h>
12 #include "int340x_thermal_zone.h"
13 #include "processor_thermal_device.h"
15 static const struct acpi_device_id int3401_device_ids[] = {
16 {"INT3401", 0},
17 {"", 0},
19 MODULE_DEVICE_TABLE(acpi, int3401_device_ids);
21 static int int3401_add(struct platform_device *pdev)
23 struct proc_thermal_device *proc_priv;
24 int ret;
26 proc_priv = devm_kzalloc(&pdev->dev, sizeof(*proc_priv), GFP_KERNEL);
27 if (!proc_priv)
28 return -ENOMEM;
30 ret = proc_thermal_add(&pdev->dev, proc_priv);
31 if (ret)
32 return ret;
34 platform_set_drvdata(pdev, proc_priv);
36 return ret;
39 static void int3401_remove(struct platform_device *pdev)
41 proc_thermal_remove(platform_get_drvdata(pdev));
44 #ifdef CONFIG_PM_SLEEP
45 static int int3401_thermal_suspend(struct device *dev)
47 return proc_thermal_suspend(dev);
49 static int int3401_thermal_resume(struct device *dev)
51 return proc_thermal_resume(dev);
53 #else
54 #define int3401_thermal_suspend NULL
55 #define int3401_thermal_resume NULL
56 #endif
58 static SIMPLE_DEV_PM_OPS(int3401_proc_thermal_pm, int3401_thermal_suspend,
59 int3401_thermal_resume);
61 static struct platform_driver int3401_driver = {
62 .probe = int3401_add,
63 .remove = int3401_remove,
64 .driver = {
65 .name = "int3401 thermal",
66 .acpi_match_table = int3401_device_ids,
67 .pm = &int3401_proc_thermal_pm,
71 module_platform_driver(int3401_driver);
73 MODULE_AUTHOR("Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>");
74 MODULE_DESCRIPTION("Processor Thermal Reporting Device Driver");
75 MODULE_LICENSE("GPL v2");