summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-08-28 09:03:18 -0400
committerEduardo Valentin <edubezval@gmail.com>2019-09-25 01:54:49 -0400
commitcb063a83ca321fbf0cb2b4044186f241d89f3dc1 (patch)
tree4a1c2b8095b53ed6dd1b9220fbb0f44842c2fd5b
parentdd89d82e751473d13da0daea1bfb15d5634071c4 (diff)
thermal: db8500: Finalize device tree conversion
At some point there was an attempt to convert the DB8500 thermal sensor to device tree: a probe path was added and the device tree was augmented for the Snowball board. The switchover was never completed: instead the thermal devices came from from the PRCMU MFD device and the probe on the Snowball was confused as another set of configuration appeared from the device tree. Move over to a device-tree only approach, as we fixed up the device trees. Cc: Vincent Guittot <vincent.guittot@linaro.org> Acked-by: Lee Jones <lee.jones@linaro.org> Reviewed-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
-rw-r--r--drivers/mfd/db8500-prcmu.c53
-rw-r--r--drivers/thermal/Kconfig2
-rw-r--r--drivers/thermal/db8500_thermal.c30
-rw-r--r--include/linux/platform_data/db8500_thermal.h29
4 files changed, 17 insertions, 97 deletions
diff --git a/drivers/mfd/db8500-prcmu.c b/drivers/mfd/db8500-prcmu.c
index 90e0f21bc49c..518439c79826 100644
--- a/drivers/mfd/db8500-prcmu.c
+++ b/drivers/mfd/db8500-prcmu.c
@@ -36,7 +36,6 @@
36#include <linux/regulator/db8500-prcmu.h> 36#include <linux/regulator/db8500-prcmu.h>
37#include <linux/regulator/machine.h> 37#include <linux/regulator/machine.h>
38#include <linux/platform_data/ux500_wdt.h> 38#include <linux/platform_data/ux500_wdt.h>
39#include <linux/platform_data/db8500_thermal.h>
40#include "dbx500-prcmu-regs.h" 39#include "dbx500-prcmu-regs.h"
41 40
42/* Index of different voltages to be used when accessing AVSData */ 41/* Index of different voltages to be used when accessing AVSData */
@@ -2984,53 +2983,6 @@ static struct ux500_wdt_data db8500_wdt_pdata = {
2984 .timeout = 600, /* 10 minutes */ 2983 .timeout = 600, /* 10 minutes */
2985 .has_28_bits_resolution = true, 2984 .has_28_bits_resolution = true,
2986}; 2985};
2987/*
2988 * Thermal Sensor
2989 */
2990
2991static struct resource db8500_thsens_resources[] = {
2992 {
2993 .name = "IRQ_HOTMON_LOW",
2994 .start = IRQ_PRCMU_HOTMON_LOW,
2995 .end = IRQ_PRCMU_HOTMON_LOW,
2996 .flags = IORESOURCE_IRQ,
2997 },
2998 {
2999 .name = "IRQ_HOTMON_HIGH",
3000 .start = IRQ_PRCMU_HOTMON_HIGH,
3001 .end = IRQ_PRCMU_HOTMON_HIGH,
3002 .flags = IORESOURCE_IRQ,
3003 },
3004};
3005
3006static struct db8500_thsens_platform_data db8500_thsens_data = {
3007 .trip_points[0] = {
3008 .temp = 70000,
3009 .type = THERMAL_TRIP_ACTIVE,
3010 .cdev_name = {
3011 [0] = "thermal-cpufreq-0",
3012 },
3013 },
3014 .trip_points[1] = {
3015 .temp = 75000,
3016 .type = THERMAL_TRIP_ACTIVE,
3017 .cdev_name = {
3018 [0] = "thermal-cpufreq-0",
3019 },
3020 },
3021 .trip_points[2] = {
3022 .temp = 80000,
3023 .type = THERMAL_TRIP_ACTIVE,
3024 .cdev_name = {
3025 [0] = "thermal-cpufreq-0",
3026 },
3027 },
3028 .trip_points[3] = {
3029 .temp = 85000,
3030 .type = THERMAL_TRIP_CRITICAL,
3031 },
3032 .num_trips = 4,
3033};
3034 2986
3035static const struct mfd_cell common_prcmu_devs[] = { 2987static const struct mfd_cell common_prcmu_devs[] = {
3036 { 2988 {
@@ -3054,10 +3006,7 @@ static const struct mfd_cell db8500_prcmu_devs[] = {
3054 }, 3006 },
3055 { 3007 {
3056 .name = "db8500-thermal", 3008 .name = "db8500-thermal",
3057 .num_resources = ARRAY_SIZE(db8500_thsens_resources), 3009 .of_compatible = "stericsson,db8500-thermal",
3058 .resources = db8500_thsens_resources,
3059 .platform_data = &db8500_thsens_data,
3060 .pdata_size = sizeof(db8500_thsens_data),
3061 }, 3010 },
3062}; 3011};
3063 3012
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 9966364a6deb..001a21abcc28 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -310,7 +310,7 @@ config DOVE_THERMAL
310 310
311config DB8500_THERMAL 311config DB8500_THERMAL
312 tristate "DB8500 thermal management" 312 tristate "DB8500 thermal management"
313 depends on MFD_DB8500_PRCMU 313 depends on MFD_DB8500_PRCMU && OF
314 default y 314 default y
315 help 315 help
316 Adds DB8500 thermal management implementation according to the thermal 316 Adds DB8500 thermal management implementation according to the thermal
diff --git a/drivers/thermal/db8500_thermal.c b/drivers/thermal/db8500_thermal.c
index b71a999d17d6..d650ae5fdf2a 100644
--- a/drivers/thermal/db8500_thermal.c
+++ b/drivers/thermal/db8500_thermal.c
@@ -13,13 +13,24 @@
13#include <linux/mfd/dbx500-prcmu.h> 13#include <linux/mfd/dbx500-prcmu.h>
14#include <linux/module.h> 14#include <linux/module.h>
15#include <linux/of.h> 15#include <linux/of.h>
16#include <linux/platform_data/db8500_thermal.h>
17#include <linux/platform_device.h> 16#include <linux/platform_device.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <linux/thermal.h> 18#include <linux/thermal.h>
20 19
21#define PRCMU_DEFAULT_MEASURE_TIME 0xFFF 20#define PRCMU_DEFAULT_MEASURE_TIME 0xFFF
22#define PRCMU_DEFAULT_LOW_TEMP 0 21#define PRCMU_DEFAULT_LOW_TEMP 0
22#define COOLING_DEV_MAX 8
23
24struct db8500_trip_point {
25 unsigned long temp;
26 enum thermal_trip_type type;
27 char cdev_name[COOLING_DEV_MAX][THERMAL_NAME_LENGTH];
28};
29
30struct db8500_thsens_platform_data {
31 struct db8500_trip_point trip_points[THERMAL_MAX_TRIPS];
32 int num_trips;
33};
23 34
24struct db8500_thermal_zone { 35struct db8500_thermal_zone {
25 struct thermal_zone_device *therm_dev; 36 struct thermal_zone_device *therm_dev;
@@ -301,7 +312,6 @@ static void db8500_thermal_work(struct work_struct *work)
301 dev_dbg(&pzone->therm_dev->device, "thermal work finished.\n"); 312 dev_dbg(&pzone->therm_dev->device, "thermal work finished.\n");
302} 313}
303 314
304#ifdef CONFIG_OF
305static struct db8500_thsens_platform_data* 315static struct db8500_thsens_platform_data*
306 db8500_thermal_parse_dt(struct platform_device *pdev) 316 db8500_thermal_parse_dt(struct platform_device *pdev)
307{ 317{
@@ -370,13 +380,6 @@ err_parse_dt:
370 dev_err(&pdev->dev, "Parsing device tree data error.\n"); 380 dev_err(&pdev->dev, "Parsing device tree data error.\n");
371 return NULL; 381 return NULL;
372} 382}
373#else
374static inline struct db8500_thsens_platform_data*
375 db8500_thermal_parse_dt(struct platform_device *pdev)
376{
377 return NULL;
378}
379#endif
380 383
381static int db8500_thermal_probe(struct platform_device *pdev) 384static int db8500_thermal_probe(struct platform_device *pdev)
382{ 385{
@@ -386,11 +389,10 @@ static int db8500_thermal_probe(struct platform_device *pdev)
386 int low_irq, high_irq, ret = 0; 389 int low_irq, high_irq, ret = 0;
387 unsigned long dft_low, dft_high; 390 unsigned long dft_low, dft_high;
388 391
389 if (np) 392 if (!np)
390 ptrips = db8500_thermal_parse_dt(pdev); 393 return -EINVAL;
391 else
392 ptrips = dev_get_platdata(&pdev->dev);
393 394
395 ptrips = db8500_thermal_parse_dt(pdev);
394 if (!ptrips) 396 if (!ptrips)
395 return -EINVAL; 397 return -EINVAL;
396 398
@@ -498,13 +500,11 @@ static int db8500_thermal_resume(struct platform_device *pdev)
498 return 0; 500 return 0;
499} 501}
500 502
501#ifdef CONFIG_OF
502static const struct of_device_id db8500_thermal_match[] = { 503static const struct of_device_id db8500_thermal_match[] = {
503 { .compatible = "stericsson,db8500-thermal" }, 504 { .compatible = "stericsson,db8500-thermal" },
504 {}, 505 {},
505}; 506};
506MODULE_DEVICE_TABLE(of, db8500_thermal_match); 507MODULE_DEVICE_TABLE(of, db8500_thermal_match);
507#endif
508 508
509static struct platform_driver db8500_thermal_driver = { 509static struct platform_driver db8500_thermal_driver = {
510 .driver = { 510 .driver = {
diff --git a/include/linux/platform_data/db8500_thermal.h b/include/linux/platform_data/db8500_thermal.h
deleted file mode 100644
index 55e55750a165..000000000000
--- a/include/linux/platform_data/db8500_thermal.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/* SPDX-License-Identifier: GPL-2.0-or-later */
2/*
3 * db8500_thermal.h - DB8500 Thermal Management Implementation
4 *
5 * Copyright (C) 2012 ST-Ericsson
6 * Copyright (C) 2012 Linaro Ltd.
7 *
8 * Author: Hongbo Zhang <hongbo.zhang@linaro.com>
9 */
10
11#ifndef _DB8500_THERMAL_H_
12#define _DB8500_THERMAL_H_
13
14#include <linux/thermal.h>
15
16#define COOLING_DEV_MAX 8
17
18struct db8500_trip_point {
19 unsigned long temp;
20 enum thermal_trip_type type;
21 char cdev_name[COOLING_DEV_MAX][THERMAL_NAME_LENGTH];
22};
23
24struct db8500_thsens_platform_data {
25 struct db8500_trip_point trip_points[THERMAL_MAX_TRIPS];
26 int num_trips;
27};
28
29#endif /* _DB8500_THERMAL_H_ */