ocfs2: fix several issues of append dio
[linux/fpc-iii.git] / drivers / thermal / db8500_cpufreq_cooling.c
blob607b62c7e6114cc005ccf597e4f0ccb804e0e99b
1 /*
2 * db8500_cpufreq_cooling.c - DB8500 cpufreq works as cooling device.
4 * Copyright (C) 2012 ST-Ericsson
5 * Copyright (C) 2012 Linaro Ltd.
7 * Author: Hongbo Zhang <hongbo.zhang@linaro.com>
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
20 #include <linux/cpu_cooling.h>
21 #include <linux/err.h>
22 #include <linux/module.h>
23 #include <linux/of.h>
24 #include <linux/platform_device.h>
25 #include <linux/slab.h>
27 static int db8500_cpufreq_cooling_probe(struct platform_device *pdev)
29 struct thermal_cooling_device *cdev;
31 cdev = cpufreq_cooling_register(cpu_present_mask);
32 if (IS_ERR(cdev)) {
33 int ret = PTR_ERR(cdev);
35 if (ret != -EPROBE_DEFER)
36 dev_err(&pdev->dev,
37 "Failed to register cooling device %d\n",
38 ret);
40 return ret;
43 platform_set_drvdata(pdev, cdev);
45 dev_info(&pdev->dev, "Cooling device registered: %s\n", cdev->type);
47 return 0;
50 static int db8500_cpufreq_cooling_remove(struct platform_device *pdev)
52 struct thermal_cooling_device *cdev = platform_get_drvdata(pdev);
54 cpufreq_cooling_unregister(cdev);
56 return 0;
59 static int db8500_cpufreq_cooling_suspend(struct platform_device *pdev,
60 pm_message_t state)
62 return -ENOSYS;
65 static int db8500_cpufreq_cooling_resume(struct platform_device *pdev)
67 return -ENOSYS;
70 #ifdef CONFIG_OF
71 static const struct of_device_id db8500_cpufreq_cooling_match[] = {
72 { .compatible = "stericsson,db8500-cpufreq-cooling" },
73 {},
75 #endif
77 static struct platform_driver db8500_cpufreq_cooling_driver = {
78 .driver = {
79 .name = "db8500-cpufreq-cooling",
80 .of_match_table = of_match_ptr(db8500_cpufreq_cooling_match),
82 .probe = db8500_cpufreq_cooling_probe,
83 .suspend = db8500_cpufreq_cooling_suspend,
84 .resume = db8500_cpufreq_cooling_resume,
85 .remove = db8500_cpufreq_cooling_remove,
88 static int __init db8500_cpufreq_cooling_init(void)
90 return platform_driver_register(&db8500_cpufreq_cooling_driver);
93 static void __exit db8500_cpufreq_cooling_exit(void)
95 platform_driver_unregister(&db8500_cpufreq_cooling_driver);
98 /* Should be later than db8500_cpufreq_register */
99 late_initcall(db8500_cpufreq_cooling_init);
100 module_exit(db8500_cpufreq_cooling_exit);
102 MODULE_AUTHOR("Hongbo Zhang <hongbo.zhang@stericsson.com>");
103 MODULE_DESCRIPTION("DB8500 cpufreq cooling driver");
104 MODULE_LICENSE("GPL");