diff options
| author | Amit Daniel Kachhap <amit.kachhap@linaro.org> | 2012-08-16 07:41:41 -0400 |
|---|---|---|
| committer | Zhang Rui <rui.zhang@intel.com> | 2012-09-24 02:44:38 -0400 |
| commit | c48cbba6fee3587bdfe77ef850a1a0aa30a2a60f (patch) | |
| tree | 43a342f501ce99e0b44b5a9346dd3edcf1b255d9 | |
| parent | 023614183768a7ac62898bded5ec6c0c9fecbdd9 (diff) | |
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.
Signed-off-by: Amit Daniel Kachhap <amit.kachhap@linaro.org>
Acked-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: SangWook Ju <sw.ju@samsung.com>
Cc: Durgadoss <durgadoss.r@intel.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Kyungmin Park <kmpark@infradead.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Amit Daniel Kachhap <amit.daniel@samsung.com>
Signed-off-by: Zhang Rui <rui.zhang@intel.com>
| -rw-r--r-- | Documentation/thermal/exynos_thermal (renamed from Documentation/hwmon/exynos4_tmu) | 35 | ||||
| -rw-r--r-- | drivers/hwmon/Kconfig | 10 | ||||
| -rw-r--r-- | drivers/hwmon/Makefile | 1 | ||||
| -rw-r--r-- | drivers/thermal/Kconfig | 7 | ||||
| -rw-r--r-- | drivers/thermal/Makefile | 1 | ||||
| -rw-r--r-- | drivers/thermal/exynos_thermal.c (renamed from drivers/hwmon/exynos4_tmu.c) | 113 | ||||
| -rw-r--r-- | include/linux/platform_data/exynos_thermal.h (renamed from include/linux/platform_data/exynos4_tmu.h) | 8 |
7 files changed, 19 insertions, 156 deletions
diff --git a/Documentation/hwmon/exynos4_tmu b/Documentation/thermal/exynos_thermal index c3c6b41db607..2b46f67b1ccb 100644 --- a/Documentation/hwmon/exynos4_tmu +++ b/Documentation/thermal/exynos_thermal | |||
| @@ -46,36 +46,7 @@ The threshold levels are defined as follows: | |||
| 46 | The threshold and each trigger_level are set | 46 | The threshold and each trigger_level are set |
| 47 | through the corresponding registers. | 47 | through the corresponding registers. |
| 48 | 48 | ||
| 49 | When an interrupt occurs, this driver notify user space of | 49 | When an interrupt occurs, this driver notify kernel thermal framework |
| 50 | one of four threshold levels for the interrupt | 50 | with the function exynos4_report_trigger. |
| 51 | through kobject_uevent_env and sysfs_notify functions. | ||
| 52 | Although an interrupt condition for level_0 can be set, | 51 | Although an interrupt condition for level_0 can be set, |
| 53 | it is not notified to user space through sysfs_notify function. | 52 | it can be used to synchronize the cooling action. |
| 54 | |||
| 55 | Sysfs Interface | ||
| 56 | --------------- | ||
| 57 | name name of the temperature sensor | ||
| 58 | RO | ||
| 59 | |||
| 60 | temp1_input temperature | ||
| 61 | RO | ||
| 62 | |||
| 63 | temp1_max temperature for level_1 interrupt | ||
| 64 | RO | ||
| 65 | |||
| 66 | temp1_crit temperature for level_2 interrupt | ||
| 67 | RO | ||
| 68 | |||
| 69 | temp1_emergency temperature for level_3 interrupt | ||
| 70 | RO | ||
| 71 | |||
| 72 | temp1_max_alarm alarm for level_1 interrupt | ||
| 73 | RO | ||
| 74 | |||
| 75 | temp1_crit_alarm | ||
| 76 | alarm for level_2 interrupt | ||
| 77 | RO | ||
| 78 | |||
| 79 | temp1_emergency_alarm | ||
| 80 | alarm for level_3 interrupt | ||
| 81 | RO | ||
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index b0a2e4c37e12..84e02b416a4a 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig | |||
| @@ -324,16 +324,6 @@ config SENSORS_DA9052_ADC | |||
| 324 | This driver can also be built as module. If so, the module | 324 | 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 | ||
| 327 | config 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 | |||
| 337 | config SENSORS_I5K_AMB | 327 | config 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 && EXPERIMENTAL | 329 | depends on PCI && EXPERIMENTAL |
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile index 7aa98119c4ab..3eafe483f36a 100644 --- a/drivers/hwmon/Makefile +++ b/drivers/hwmon/Makefile | |||
| @@ -49,7 +49,6 @@ obj-$(CONFIG_SENSORS_DS1621) += ds1621.o | |||
| 49 | obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o | 49 | obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o |
| 50 | obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o | 50 | obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o |
| 51 | obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o | 51 | obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o |
| 52 | obj-$(CONFIG_SENSORS_EXYNOS4_TMU) += exynos4_tmu.o | ||
| 53 | obj-$(CONFIG_SENSORS_F71805F) += f71805f.o | 52 | obj-$(CONFIG_SENSORS_F71805F) += f71805f.o |
| 54 | obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o | 53 | obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o |
| 55 | obj-$(CONFIG_SENSORS_F75375S) += f75375s.o | 54 | obj-$(CONFIG_SENSORS_F75375S) += f75375s.o |
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index 996003b3438a..8f2b6eaf46b8 100644 --- a/drivers/thermal/Kconfig +++ b/drivers/thermal/Kconfig | |||
| @@ -46,3 +46,10 @@ config RCAR_THERMAL | |||
| 46 | help | 46 | help |
| 47 | Enable this to plug the R-Car thermal sensor driver into the Linux | 47 | Enable this to plug the R-Car thermal sensor driver into the Linux |
| 48 | thermal framework | 48 | thermal framework |
| 49 | |||
| 50 | config 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. | ||
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile index aae59ad57c42..885550dc64b7 100644 --- a/drivers/thermal/Makefile +++ b/drivers/thermal/Makefile | |||
| @@ -6,3 +6,4 @@ obj-$(CONFIG_THERMAL) += thermal_sys.o | |||
| 6 | obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o | 6 | obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o |
| 7 | obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o | 7 | obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o |
| 8 | obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o | 8 | obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o |
| 9 | obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o | ||
diff --git a/drivers/hwmon/exynos4_tmu.c b/drivers/thermal/exynos_thermal.c index e912059140cd..556d15b4b029 100644 --- a/drivers/hwmon/exynos4_tmu.c +++ b/drivers/thermal/exynos_thermal.c | |||
| @@ -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 Electronics | 4 | * 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 modify | 8 | * 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 by | 9 | * it under the terms of the GNU General Public License as published by |
| @@ -33,10 +34,7 @@ | |||
| 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 0x0 | 39 | #define EXYNOS4_TMU_REG_TRIMINFO 0x0 |
| 42 | #define EXYNOS4_TMU_REG_CONTROL 0x20 | 40 | #define EXYNOS4_TMU_REG_CONTROL 0x20 |
| @@ -70,7 +68,6 @@ | |||
| 70 | 68 | ||
| 71 | struct exynos4_tmu_data { | 69 | struct 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) | |||
| 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) | |||
| 264 | return IRQ_HANDLED; | 259 | return IRQ_HANDLED; |
| 265 | } | 260 | } |
| 266 | 261 | ||
| 267 | static 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 | |||
| 273 | static 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 | |||
| 287 | static 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; | ||
