History

hwmon: exynos4: move thermal sensor driver to driver/thermal directory

This movement is needed because the hwmon entries and corresponding sysfs interface is a duplicate of utilities already provided by driver/thermal/thermal_sys.c. The goal is to place it in thermal folder and add necessary functions to use the in-kernel thermal interfaces.

Amit Daniel Kachhap committed 14 years ago

Commit c48cbba1 parent 02361417 files · +19 −156Browse files

Unified · Split

7 files
  1. Documentation/thermal/exynos_thermal +3 −32
  2. drivers/hwmon/Kconfig +0 −10
  3. drivers/hwmon/Makefile +0 −1
  4. drivers/thermal/Kconfig +7 −0
  5. drivers/thermal/Makefile +1 −0
  6. drivers/thermal/exynos_thermal.c +4 −109
  7. include/linux/platform_data/exynos_thermal.h +4 −4
Documentation/thermal/exynos_thermalrenamed from Documentation/hwmon/exynos4_tmu+3−32
@@ -46,36 +46,7 @@ The threshold levels are defined as follows: · 45 unmodified lines
46 The threshold and each trigger_level are set46 The threshold and each trigger_level are set
47 through the corresponding registers.47 through the corresponding registers.
48 48
49When an interrupt occurs, this driver notify user space of49When an interrupt occurs, this driver notify kernel thermal framework
50one of four threshold levels for the interrupt50with the function exynos4_report_trigger.
51through kobject_uevent_env and sysfs_notify functions.
52Although an interrupt condition for level_0 can be set,51Although an interrupt condition for level_0 can be set,
53it is not notified to user space through sysfs_notify function.52it can be used to synchronize the cooling action.
54
55Sysfs Interface
56---------------
57name name of the temperature sensor
58 RO
59
60temp1_input temperature
61 RO
62
63temp1_max temperature for level_1 interrupt
64 RO
65
66temp1_crit temperature for level_2 interrupt
67 RO
68
69temp1_emergency temperature for level_3 interrupt
70 RO
71
72temp1_max_alarm alarm for level_1 interrupt
73 RO
74
75temp1_crit_alarm
76 alarm for level_2 interrupt
77 RO
78
79temp1_emergency_alarm
80 alarm for level_3 interrupt
81 RO
drivers/hwmon/Kconfig+0−10
@@ -324,16 +324,6 @@ config SENSORS_DA9052_ADC · 323 unmodified lines
324 This driver can also be built as module. If so, the module324 This driver can also be built as module. If so, the module
325 will be called da9052-hwmon.325 will be called da9052-hwmon.
326 326
327config SENSORS_EXYNOS4_TMU
328 tristate "Temperature sensor on Samsung EXYNOS4"
329 depends on ARCH_EXYNOS4
330 help
331 If you say yes here you get support for TMU (Thermal Management
332 Unit) on SAMSUNG EXYNOS4 series of SoC.
333
334 This driver can also be built as a module. If so, the module
335 will be called exynos4-tmu.
336
337config SENSORS_I5K_AMB327config SENSORS_I5K_AMB
338 tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets"328 tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets"
339 depends on PCI && EXPERIMENTAL329 depends on PCI && EXPERIMENTAL
drivers/hwmon/Makefile+0−1
@@ -49,7 +49,6 @@ obj-$(CONFIG_SENSORS_DS1621) += ds1621.o · 48 unmodified lines
49obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o49obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o
50obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o50obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o
51obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o51obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o
52obj-$(CONFIG_SENSORS_EXYNOS4_TMU) += exynos4_tmu.o
53obj-$(CONFIG_SENSORS_F71805F) += f71805f.o52obj-$(CONFIG_SENSORS_F71805F) += f71805f.o
54obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o53obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o
55obj-$(CONFIG_SENSORS_F75375S) += f75375s.o54obj-$(CONFIG_SENSORS_F75375S) += f75375s.o
drivers/thermal/Kconfig+7−0
@@ -46,3 +46,10 @@ config RCAR_THERMAL · 45 unmodified lines
46 help46 help
47 Enable this to plug the R-Car thermal sensor driver into the Linux47 Enable this to plug the R-Car thermal sensor driver into the Linux
48 thermal framework48 thermal framework
49
50config EXYNOS_THERMAL
51 tristate "Temperature sensor on Samsung EXYNOS"
52 depends on ARCH_EXYNOS4 && THERMAL
53 help
54 If you say yes here you get support for TMU (Thermal Managment
55 Unit) on SAMSUNG EXYNOS series of SoC.
drivers/thermal/Makefile+1−0
@@ -6,3 +6,4 @@ obj-$(CONFIG_THERMAL) += thermal_sys.o · 5 unmodified lines
6obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o6obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o
7obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o7obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o
8obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o8obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o
9obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o
drivers/thermal/exynos_thermal.crenamed from drivers/hwmon/exynos4_tmu.c+4−109
@@ -1,8 +1,9 @@
1/*1/*
2 * exynos4_tmu.c - Samsung EXYNOS4 TMU (Thermal Management Unit)2 * exynos_thermal.c - Samsung EXYNOS TMU (Thermal Management Unit)
3 *3 *
4 * Copyright (C) 2011 Samsung Electronics4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com>5 * Donggeun Kim <dg77.kim@samsung.com>
6 * Amit Daniel Kachhap <amit.kachhap@linaro.org>
6 *7 *
7 * This program is free software; you can redistribute it and/or modify8 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by9 * it under the terms of the GNU General Public License as published by
@@ -33,10 +34,7 @@ · 24 unmodified lines
33#include <linux/io.h>34#include <linux/io.h>
34#include <linux/mutex.h>35#include <linux/mutex.h>
35 36
36#include <linux/hwmon.h>37#include <linux/platform_data/exynos_thermal.h>
37#include <linux/hwmon-sysfs.h>
38
39#include <linux/platform_data/exynos4_tmu.h>
40 38
41#define EXYNOS4_TMU_REG_TRIMINFO 0x039#define EXYNOS4_TMU_REG_TRIMINFO 0x0
42#define EXYNOS4_TMU_REG_CONTROL 0x2040#define EXYNOS4_TMU_REG_CONTROL 0x20
@@ -70,7 +68,6 @@ · 27 unmodified lines
70 68
71struct exynos4_tmu_data {69struct exynos4_tmu_data {
72 struct exynos4_tmu_platform_data *pdata;70 struct exynos4_tmu_platform_data *pdata;
73 struct device *hwmon_dev;
74 struct resource *mem;71 struct resource *mem;
75 void __iomem *base;72 void __iomem *base;
76 int irq;73 int irq;
@@ -246,8 +243,6 @@ static void exynos4_tmu_work(struct work_struct *work) · 169 unmodified lines
246 243
247 writel(EXYNOS4_TMU_INTCLEAR_VAL, data->base + EXYNOS4_TMU_REG_INTCLEAR);244 writel(EXYNOS4_TMU_INTCLEAR_VAL, data->base + EXYNOS4_TMU_REG_INTCLEAR);
248 245
249 kobject_uevent(&data->hwmon_dev->kobj, KOBJ_CHANGE);
250
251 enable_irq(data->irq);246 enable_irq(data->irq);
252 247
253 clk_disable(data->clk);248 clk_disable(data->clk);
@@ -264,87 +259,6 @@ static irqreturn_t exynos4_tmu_irq(int irq, void *id) · 10 unmodified lines
264 return IRQ_HANDLED;259 return IRQ_HANDLED;
265}260}
266 261
267static ssize_t exynos4_tmu_show_name(struct device *dev,
268 struct device_attribute *attr, char *buf)
269{
270 return sprintf(buf, "exynos4-tmu\n");
271}
272
273static ssize_t exynos4_tmu_show_temp(struct device *dev,
274 struct device_attribute *attr, char *buf)
275{
276 struct exynos4_tmu_data *data = dev_get_drvdata(dev);
277 int ret;
278
279 ret = exynos4_tmu_read(data);
280 if (ret < 0)
281 return ret;
282
283 /* convert from degree Celsius to millidegree Celsius */
284 return sprintf(buf, "%d\n", ret * 1000);
285}
286
287static ssize_t exynos4_tmu_show_alarm(struct device *dev,
288 struct device_attribute *devattr, char *buf)
289{
290 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
291 struct exynos4_tmu_data *data = dev_get_drvdata(dev);
292 struct exynos4_tmu_platform_data *pdata = data->pdata;
293 int temp;
294 unsigned int trigger_level;
295
296 temp = exynos4_tmu_read(data);
297 if (temp < 0)
298 return temp;
299
300 trigger_level = pdata->threshold + pdata->trigger_levels[attr->index];
301
302 return sprintf(buf, "%d\n", !!(temp > trigger_level));
303}
304
305static ssize_t exynos4_tmu_show_level(struct device *dev,
306 struct device_attribute *devattr, char *buf)
307{
308 struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr);
309 struct exynos4_tmu_data *data = dev_get_drvdata(dev);
310 struct exynos4_tmu_platform_data *pdata = data->pdata;
311 unsigned int temp = pdata->threshold +
312 pdata->trigger_levels[attr->index];
313
314 return sprintf(buf, "%u\n", temp * 1000);
315}
316
317static DEVICE_ATTR(name, S_IRUGO, exynos4_tmu_show_name, NULL);
318static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, exynos4_tmu_show_temp, NULL, 0);
319
320static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO,
321 exynos4_tmu_show_alarm, NULL, 1);
322static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO,
323 exynos4_tmu_show_alarm, NULL, 2);
324static SENSOR_DEVICE_ATTR(temp1_emergency_alarm, S_IRUGO,
325 exynos4_tmu_show_alarm, NULL, 3);
326
327static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, exynos4_tmu_show_level, NULL, 1);
328static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, exynos4_tmu_show_level, NULL, 2);
329static SENSOR_DEVICE_ATTR(temp1_emergency, S_IRUGO,
330 exynos4_tmu_show_level, NULL, 3);
331
332static struct attribute *exynos4_tmu_attributes[] = {
333 &dev_attr_name.attr,
334 &sensor_dev_attr_temp1_input.dev_attr.attr,
335 &sensor_dev_attr_temp1_max_alarm.dev_attr.attr,
336 &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr,
337 &sensor_dev_attr_temp1_emergency_alarm.dev_attr.attr,
338 &sensor_dev_attr_temp1_max.dev_attr.attr,
339 &sensor_dev_attr_temp1_crit.dev_attr.attr,
340 &sensor_dev_attr_temp1_emergency.dev_attr.attr,
341 NULL,
342};
343
344static const struct attribute_group exynos4_tmu_attr_group = {
345 .attrs = exynos4_tmu_attributes,
346};
347
348static int __devinit exynos4_tmu_probe(struct platform_device *pdev)262static int __devinit exynos4_tmu_probe(struct platform_device *pdev)
349{263{
350 struct exynos4_tmu_data *data;264 struct exynos4_tmu_data *data;
@@ -418,25 +332,9 @@ static int __devinit exynos4_tmu_probe(struct platform_device *pdev) · 67 unmodified lines
418 goto err_clk;332 goto err_clk;
419 }333 }
420 334
421 ret = sysfs_create_group(&pdev->dev.kobj, &exynos4_tmu_attr_group);
422 if (ret) {
423 dev_err(&pdev->dev, "Failed to create sysfs group\n");
424 goto err_clk;
425 }
426
427 data->hwmon_dev = hwmon_device_register(&pdev->dev);
428 if (IS_ERR(data->hwmon_dev)) {
429 ret = PTR_ERR(data->hwmon_dev);
430 dev_err(&pdev->dev, "Failed to register hwmon device\n");
431 goto err_create_group;
432 }
433
434 exynos4_tmu_control(pdev, true);335 exynos4_tmu_control(pdev, true);
435 336
436 return 0;337 return 0;
437
438err_create_group:
439 sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group);
440err_clk:338err_clk:
441 platform_set_drvdata(pdev, NULL);339 platform_set_drvdata(pdev, NULL);
442 clk_put(data->clk);340 clk_put(data->clk);
@@ -458,9 +356,6 @@ static int __devexit exynos4_tmu_remove(struct platform_device *pdev) · 15 unmodified lines
458 356
459 exynos4_tmu_control(pdev, false);357 exynos4_tmu_control(pdev, false);
460 358
461 hwmon_device_unregister(data->hwmon_dev);
462 sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group);
463
464 clk_put(data->clk);359 clk_put(data->clk);
465 360
466 free_irq(data->irq, data);361 free_irq(data->irq, data);
@@ -495,7 +390,7 @@ static int exynos4_tmu_resume(struct device *dev) · 28 unmodified lines
495 390
496static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,391static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm,
497 exynos4_tmu_suspend, exynos4_tmu_resume);392 exynos4_tmu_suspend, exynos4_tmu_resume);
498#define EXYNOS4_TMU_PM &exynos4_tmu_pm393#define EXYNOS4_TMU_PM (&exynos4_tmu_pm)
499#else394#else
500#define EXYNOS4_TMU_PM NULL395#define EXYNOS4_TMU_PM NULL
501#endif396#endif
include/linux/platform_data/exynos_thermal.hrenamed from include/linux/platform_data/exynos4_tmu.h+4−4
@@ -1,5 +1,5 @@
1/*1/*
2 * exynos4_tmu.h - Samsung EXYNOS4 TMU (Thermal Management Unit)2 * exynos_thermal.h - Samsung EXYNOS4 TMU (Thermal Management Unit)
3 *3 *
4 * Copyright (C) 2011 Samsung Electronics4 * Copyright (C) 2011 Samsung Electronics
5 * Donggeun Kim <dg77.kim@samsung.com>5 * Donggeun Kim <dg77.kim@samsung.com>
@@ -19,8 +19,8 @@ · 13 unmodified lines
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */20 */
21 21
22#ifndef _LINUX_EXYNOS4_TMU_H22#ifndef _LINUX_EXYNOS_THERMAL_H
23#define _LINUX_EXYNOS4_TMU_H23#define _LINUX_EXYNOS_THERMAL_H
24 24
25enum calibration_type {25enum calibration_type {
26 TYPE_ONE_POINT_TRIMMING,26 TYPE_ONE_POINT_TRIMMING,
@@ -80,4 +80,4 @@ struct exynos4_tmu_platform_data { · 53 unmodified lines
80 80
81 enum calibration_type cal_type;81 enum calibration_type cal_type;
82};82};
83#endif /* _LINUX_EXYNOS4_TMU_H */83#endif /* _LINUX_EXYNOS_THERMAL_H */

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t