Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Amit Daniel Kachhap and committed by
Zhang Rui
c48cbba6 02361418

+19 -156
+3 -32
Documentation/hwmon/exynos4_tmu Documentation/thermal/exynos_thermal
··· 46 46 The threshold and each trigger_level are set 47 47 through the corresponding registers. 48 48 49 - When an interrupt occurs, this driver notify user space of 50 - one of four threshold levels for the interrupt 51 - through kobject_uevent_env and sysfs_notify functions. 49 + When an interrupt occurs, this driver notify kernel thermal framework 50 + with the function exynos4_report_trigger. 52 51 Although an interrupt condition for level_0 can be set, 53 - it is not notified to user space through sysfs_notify function. 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 52 + it can be used to synchronize the cooling action.
-10
drivers/hwmon/Kconfig
··· 324 324 This driver can also be built as module. If so, the module 325 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 327 config SENSORS_I5K_AMB 338 328 tristate "FB-DIMM AMB temperature sensor on Intel 5000 series chipsets" 339 329 depends on PCI && EXPERIMENTAL
-1
drivers/hwmon/Makefile
··· 49 49 obj-$(CONFIG_SENSORS_EMC1403) += emc1403.o 50 50 obj-$(CONFIG_SENSORS_EMC2103) += emc2103.o 51 51 obj-$(CONFIG_SENSORS_EMC6W201) += emc6w201.o 52 - obj-$(CONFIG_SENSORS_EXYNOS4_TMU) += exynos4_tmu.o 53 52 obj-$(CONFIG_SENSORS_F71805F) += f71805f.o 54 53 obj-$(CONFIG_SENSORS_F71882FG) += f71882fg.o 55 54 obj-$(CONFIG_SENSORS_F75375S) += f75375s.o
+4 -109
drivers/hwmon/exynos4_tmu.c drivers/thermal/exynos_thermal.c
··· 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 4 * Copyright (C) 2011 Samsung Electronics 5 5 * Donggeun Kim <dg77.kim@samsung.com> 6 + * Amit Daniel Kachhap <amit.kachhap@linaro.org> 6 7 * 7 8 * This program is free software; you can redistribute it and/or modify 8 9 * it under the terms of the GNU General Public License as published by ··· 34 33 #include <linux/io.h> 35 34 #include <linux/mutex.h> 36 35 37 - #include <linux/hwmon.h> 38 - #include <linux/hwmon-sysfs.h> 39 - 40 - #include <linux/platform_data/exynos4_tmu.h> 36 + #include <linux/platform_data/exynos_thermal.h> 41 37 42 38 #define EXYNOS4_TMU_REG_TRIMINFO 0x0 43 39 #define EXYNOS4_TMU_REG_CONTROL 0x20 ··· 68 70 69 71 struct exynos4_tmu_data { 70 72 struct exynos4_tmu_platform_data *pdata; 71 - struct device *hwmon_dev; 72 73 struct resource *mem; 73 74 void __iomem *base; 74 75 int irq; ··· 243 246 244 247 writel(EXYNOS4_TMU_INTCLEAR_VAL, data->base + EXYNOS4_TMU_REG_INTCLEAR); 245 248 246 - kobject_uevent(&data->hwmon_dev->kobj, KOBJ_CHANGE); 247 - 248 249 enable_irq(data->irq); 249 250 250 251 clk_disable(data->clk); ··· 258 263 259 264 return IRQ_HANDLED; 260 265 } 261 - 262 - static ssize_t exynos4_tmu_show_name(struct device *dev, 263 - struct device_attribute *attr, char *buf) 264 - { 265 - return sprintf(buf, "exynos4-tmu\n"); 266 - } 267 - 268 - static ssize_t exynos4_tmu_show_temp(struct device *dev, 269 - struct device_attribute *attr, char *buf) 270 - { 271 - struct exynos4_tmu_data *data = dev_get_drvdata(dev); 272 - int ret; 273 - 274 - ret = exynos4_tmu_read(data); 275 - if (ret < 0) 276 - return ret; 277 - 278 - /* convert from degree Celsius to millidegree Celsius */ 279 - return sprintf(buf, "%d\n", ret * 1000); 280 - } 281 - 282 - static ssize_t exynos4_tmu_show_alarm(struct device *dev, 283 - struct device_attribute *devattr, char *buf) 284 - { 285 - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 286 - struct exynos4_tmu_data *data = dev_get_drvdata(dev); 287 - struct exynos4_tmu_platform_data *pdata = data->pdata; 288 - int temp; 289 - unsigned int trigger_level; 290 - 291 - temp = exynos4_tmu_read(data); 292 - if (temp < 0) 293 - return temp; 294 - 295 - trigger_level = pdata->threshold + pdata->trigger_levels[attr->index]; 296 - 297 - return sprintf(buf, "%d\n", !!(temp > trigger_level)); 298 - } 299 - 300 - static ssize_t exynos4_tmu_show_level(struct device *dev, 301 - struct device_attribute *devattr, char *buf) 302 - { 303 - struct sensor_device_attribute *attr = to_sensor_dev_attr(devattr); 304 - struct exynos4_tmu_data *data = dev_get_drvdata(dev); 305 - struct exynos4_tmu_platform_data *pdata = data->pdata; 306 - unsigned int temp = pdata->threshold + 307 - pdata->trigger_levels[attr->index]; 308 - 309 - return sprintf(buf, "%u\n", temp * 1000); 310 - } 311 - 312 - static DEVICE_ATTR(name, S_IRUGO, exynos4_tmu_show_name, NULL); 313 - static SENSOR_DEVICE_ATTR(temp1_input, S_IRUGO, exynos4_tmu_show_temp, NULL, 0); 314 - 315 - static SENSOR_DEVICE_ATTR(temp1_max_alarm, S_IRUGO, 316 - exynos4_tmu_show_alarm, NULL, 1); 317 - static SENSOR_DEVICE_ATTR(temp1_crit_alarm, S_IRUGO, 318 - exynos4_tmu_show_alarm, NULL, 2); 319 - static SENSOR_DEVICE_ATTR(temp1_emergency_alarm, S_IRUGO, 320 - exynos4_tmu_show_alarm, NULL, 3); 321 - 322 - static SENSOR_DEVICE_ATTR(temp1_max, S_IRUGO, exynos4_tmu_show_level, NULL, 1); 323 - static SENSOR_DEVICE_ATTR(temp1_crit, S_IRUGO, exynos4_tmu_show_level, NULL, 2); 324 - static SENSOR_DEVICE_ATTR(temp1_emergency, S_IRUGO, 325 - exynos4_tmu_show_level, NULL, 3); 326 - 327 - static struct attribute *exynos4_tmu_attributes[] = { 328 - &dev_attr_name.attr, 329 - &sensor_dev_attr_temp1_input.dev_attr.attr, 330 - &sensor_dev_attr_temp1_max_alarm.dev_attr.attr, 331 - &sensor_dev_attr_temp1_crit_alarm.dev_attr.attr, 332 - &sensor_dev_attr_temp1_emergency_alarm.dev_attr.attr, 333 - &sensor_dev_attr_temp1_max.dev_attr.attr, 334 - &sensor_dev_attr_temp1_crit.dev_attr.attr, 335 - &sensor_dev_attr_temp1_emergency.dev_attr.attr, 336 - NULL, 337 - }; 338 - 339 - static const struct attribute_group exynos4_tmu_attr_group = { 340 - .attrs = exynos4_tmu_attributes, 341 - }; 342 266 343 267 static int __devinit exynos4_tmu_probe(struct platform_device *pdev) 344 268 { ··· 332 418 goto err_clk; 333 419 } 334 420 335 - ret = sysfs_create_group(&pdev->dev.kobj, &exynos4_tmu_attr_group); 336 - if (ret) { 337 - dev_err(&pdev->dev, "Failed to create sysfs group\n"); 338 - goto err_clk; 339 - } 340 - 341 - data->hwmon_dev = hwmon_device_register(&pdev->dev); 342 - if (IS_ERR(data->hwmon_dev)) { 343 - ret = PTR_ERR(data->hwmon_dev); 344 - dev_err(&pdev->dev, "Failed to register hwmon device\n"); 345 - goto err_create_group; 346 - } 347 - 348 421 exynos4_tmu_control(pdev, true); 349 422 350 423 return 0; 351 - 352 - err_create_group: 353 - sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group); 354 424 err_clk: 355 425 platform_set_drvdata(pdev, NULL); 356 426 clk_put(data->clk); ··· 355 457 struct exynos4_tmu_data *data = platform_get_drvdata(pdev); 356 458 357 459 exynos4_tmu_control(pdev, false); 358 - 359 - hwmon_device_unregister(data->hwmon_dev); 360 - sysfs_remove_group(&pdev->dev.kobj, &exynos4_tmu_attr_group); 361 460 362 461 clk_put(data->clk); 363 462 ··· 390 495 391 496 static SIMPLE_DEV_PM_OPS(exynos4_tmu_pm, 392 497 exynos4_tmu_suspend, exynos4_tmu_resume); 393 - #define EXYNOS4_TMU_PM &exynos4_tmu_pm 498 + #define EXYNOS4_TMU_PM (&exynos4_tmu_pm) 394 499 #else 395 500 #define EXYNOS4_TMU_PM NULL 396 501 #endif
+7
drivers/thermal/Kconfig
··· 46 46 help 47 47 Enable this to plug the R-Car thermal sensor driver into the Linux 48 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.
+1
drivers/thermal/Makefile
··· 6 6 obj-$(CONFIG_CPU_THERMAL) += cpu_cooling.o 7 7 obj-$(CONFIG_SPEAR_THERMAL) += spear_thermal.o 8 8 obj-$(CONFIG_RCAR_THERMAL) += rcar_thermal.o 9 + obj-$(CONFIG_EXYNOS_THERMAL) += exynos_thermal.o
+4 -4
include/linux/platform_data/exynos4_tmu.h include/linux/platform_data/exynos_thermal.h
··· 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 4 * Copyright (C) 2011 Samsung Electronics 5 5 * Donggeun Kim <dg77.kim@samsung.com> ··· 19 19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 20 */ 21 21 22 - #ifndef _LINUX_EXYNOS4_TMU_H 23 - #define _LINUX_EXYNOS4_TMU_H 22 + #ifndef _LINUX_EXYNOS_THERMAL_H 23 + #define _LINUX_EXYNOS_THERMAL_H 24 24 25 25 enum calibration_type { 26 26 TYPE_ONE_POINT_TRIMMING, ··· 80 80 81 81 enum calibration_type cal_type; 82 82 }; 83 - #endif /* _LINUX_EXYNOS4_TMU_H */ 83 + #endif /* _LINUX_EXYNOS_THERMAL_H */