Skip to content

Commit cb063a8

Browse files
linuswEduardo Valentin
authored andcommitted
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 <[email protected]> Acked-by: Lee Jones <[email protected]> Reviewed-by: Daniel Lezcano <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Signed-off-by: Eduardo Valentin <[email protected]>
1 parent dd89d82 commit cb063a8

File tree

4 files changed

+17
-97
lines changed

4 files changed

+17
-97
lines changed

drivers/mfd/db8500-prcmu.c

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
#include <linux/regulator/db8500-prcmu.h>
3737
#include <linux/regulator/machine.h>
3838
#include <linux/platform_data/ux500_wdt.h>
39-
#include <linux/platform_data/db8500_thermal.h>
4039
#include "dbx500-prcmu-regs.h"
4140

4241
/* Index of different voltages to be used when accessing AVSData */
@@ -2984,53 +2983,6 @@ static struct ux500_wdt_data db8500_wdt_pdata = {
29842983
.timeout = 600, /* 10 minutes */
29852984
.has_28_bits_resolution = true,
29862985
};
2987-
/*
2988-
* Thermal Sensor
2989-
*/
2990-
2991-
static 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-
3006-
static 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-
};
30342986

30352987
static const struct mfd_cell common_prcmu_devs[] = {
30362988
{
@@ -3054,10 +3006,7 @@ static const struct mfd_cell db8500_prcmu_devs[] = {
30543006
},
30553007
{
30563008
.name = "db8500-thermal",
3057-
.num_resources = ARRAY_SIZE(db8500_thsens_resources),
3058-
.resources = db8500_thsens_resources,
3059-
.platform_data = &db8500_thsens_data,
3060-
.pdata_size = sizeof(db8500_thsens_data),
3009+
.of_compatible = "stericsson,db8500-thermal",
30613010
},
30623011
};
30633012

drivers/thermal/Kconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ config DOVE_THERMAL
310310

311311
config DB8500_THERMAL
312312
tristate "DB8500 thermal management"
313-
depends on MFD_DB8500_PRCMU
313+
depends on MFD_DB8500_PRCMU && OF
314314
default y
315315
help
316316
Adds DB8500 thermal management implementation according to the thermal

drivers/thermal/db8500_thermal.c

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,24 @@
1313
#include <linux/mfd/dbx500-prcmu.h>
1414
#include <linux/module.h>
1515
#include <linux/of.h>
16-
#include <linux/platform_data/db8500_thermal.h>
1716
#include <linux/platform_device.h>
1817
#include <linux/slab.h>
1918
#include <linux/thermal.h>
2019

2120
#define PRCMU_DEFAULT_MEASURE_TIME 0xFFF
2221
#define PRCMU_DEFAULT_LOW_TEMP 0
22+
#define COOLING_DEV_MAX 8
23+
24+
struct 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+
30+
struct db8500_thsens_platform_data {
31+
struct db8500_trip_point trip_points[THERMAL_MAX_TRIPS];
32+
int num_trips;
33+
};
2334

2435
struct db8500_thermal_zone {
2536
struct thermal_zone_device *therm_dev;
@@ -301,7 +312,6 @@ static void db8500_thermal_work(struct work_struct *work)
301312
dev_dbg(&pzone->therm_dev->device, "thermal work finished.\n");
302313
}
303314

304-
#ifdef CONFIG_OF
305315
static struct db8500_thsens_platform_data*
306316
db8500_thermal_parse_dt(struct platform_device *pdev)
307317
{
@@ -370,13 +380,6 @@ static struct db8500_thsens_platform_data*
370380
dev_err(&pdev->dev, "Parsing device tree data error.\n");
371381
return NULL;
372382
}
373-
#else
374-
static inline struct db8500_thsens_platform_data*
375-
db8500_thermal_parse_dt(struct platform_device *pdev)
376-
{
377-
return NULL;
378-
}
379-
#endif
380383

381384
static int db8500_thermal_probe(struct platform_device *pdev)
382385
{
@@ -386,11 +389,10 @@ static int db8500_thermal_probe(struct platform_device *pdev)
386389
int low_irq, high_irq, ret = 0;
387390
unsigned long dft_low, dft_high;
388391

389-
if (np)
390-
ptrips = db8500_thermal_parse_dt(pdev);
391-
else
392-
ptrips = dev_get_platdata(&pdev->dev);
392+
if (!np)
393+
return -EINVAL;
393394

395+
ptrips = db8500_thermal_parse_dt(pdev);
394396
if (!ptrips)
395397
return -EINVAL;
396398

@@ -498,13 +500,11 @@ static int db8500_thermal_resume(struct platform_device *pdev)
498500
return 0;
499501
}
500502

501-
#ifdef CONFIG_OF
502503
static const struct of_device_id db8500_thermal_match[] = {
503504
{ .compatible = "stericsson,db8500-thermal" },
504505
{},
505506
};
506507
MODULE_DEVICE_TABLE(of, db8500_thermal_match);
507-
#endif
508508

509509
static struct platform_driver db8500_thermal_driver = {
510510
.driver = {

include/linux/platform_data/db8500_thermal.h

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)