Skip to content

Commit 81f05fe

Browse files
committed
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management updates from Zhang Rui: "The top merge commit was re-generated yesterday because two topic branches were dropped from this pull request in the last minute due to some unaddressed comments. All the other material has been in linux-next for quite a while. Specifics: - Enhance thermal core to handle unexpected device cooling states after fresh boot and system resume. From Zhang Rui and Chen Yu. - Several fixes and cleanups on Rockchip and RCAR thermal drivers. From Caesar Wang and Kuninori Morimoto. - Add Broxton support for Intel processor thermal reporting device driver. From Amy Wiles" * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: thermal: trip_point_temp_store() calls thermal_zone_device_update() thermal: rcar: rcar_thermal_get_temp() return error if strange temp thermal: rcar: check irq possibility in rcar_thermal_irq_xxx() thermal: rcar: check every rcar_thermal_update_temp() return value thermal: rcar: move rcar_thermal_dt_ids to upside thermal: rockchip: Support the RK3399 SoCs in thermal driver thermal: rockchip: Support the RK3228 SoCs in thermal driver dt-bindings: rockchip-thermal: Support the RK3228/RK3399 SoCs compatible thermal: rockchip: fix a trivial typo Thermal: Enable Broxton SoC thermal reporting device thermal: constify pch_dev_ops structure Thermal: do thermal zone update after a cooling device registered Thermal: handle thermal zone device properly during system sleep Thermal: initialize thermal zone device correctly
2 parents c52cb43 + 98d9450 commit 81f05fe

File tree

9 files changed

+304
-39
lines changed

9 files changed

+304
-39
lines changed

Documentation/devicetree/bindings/thermal/rockchip-thermal.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
Required properties:
44
- compatible : should be "rockchip,<name>-tsadc"
5+
"rockchip,rk3228-tsadc": found on RK3228 SoCs
56
"rockchip,rk3288-tsadc": found on RK3288 SoCs
67
"rockchip,rk3368-tsadc": found on RK3368 SoCs
8+
"rockchip,rk3399-tsadc": found on RK3399 SoCs
79
- reg : physical base address of the controller and length of memory mapped
810
region.
911
- interrupts : The interrupt number to the cpu. The interrupt specifier format

drivers/thermal/int340x_thermal/processor_thermal_device.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
/* Braswell thermal reporting device */
3434
#define PCI_DEVICE_ID_PROC_BSW_THERMAL 0x22DC
3535

36+
/* Broxton thermal reporting device */
37+
#define PCI_DEVICE_ID_PROC_BXT0_THERMAL 0x0A8C
38+
#define PCI_DEVICE_ID_PROC_BXT1_THERMAL 0x1A8C
39+
#define PCI_DEVICE_ID_PROC_BXTX_THERMAL 0x4A8C
40+
#define PCI_DEVICE_ID_PROC_BXTP_THERMAL 0x5A8C
41+
3642
struct power_config {
3743
u32 index;
3844
u32 min_uw;
@@ -404,6 +410,10 @@ static const struct pci_device_id proc_thermal_pci_ids[] = {
404410
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_HSB_THERMAL)},
405411
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_SKL_THERMAL)},
406412
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BSW_THERMAL)},
413+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXT0_THERMAL)},
414+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXT1_THERMAL)},
415+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXTX_THERMAL)},
416+
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXTP_THERMAL)},
407417
{ 0, },
408418
};
409419

drivers/thermal/intel_pch_thermal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct pch_dev_ops {
136136

137137

138138
/* dev ops for Wildcat Point */
139-
static struct pch_dev_ops pch_dev_ops_wpt = {
139+
static const struct pch_dev_ops pch_dev_ops_wpt = {
140140
.hw_init = pch_wpt_init,
141141
.get_temp = pch_wpt_get_temp,
142142
};

drivers/thermal/rcar_thermal.c

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ struct rcar_thermal_priv {
7575
#define rcar_has_irq_support(priv) ((priv)->common->base)
7676
#define rcar_id_to_shift(priv) ((priv)->id * 8)
7777

78-
#ifdef DEBUG
79-
# define rcar_force_update_temp(priv) 1
80-
#else
81-
# define rcar_force_update_temp(priv) 0
82-
#endif
78+
static const struct of_device_id rcar_thermal_dt_ids[] = {
79+
{ .compatible = "renesas,rcar-thermal", },
80+
{},
81+
};
82+
MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
8383

8484
/*
8585
* basic functions
@@ -203,14 +203,26 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
203203
static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
204204
{
205205
struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
206+
int tmp;
207+
int ret;
206208

207-
if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv))
208-
rcar_thermal_update_temp(priv);
209+
ret = rcar_thermal_update_temp(priv);
210+
if (ret < 0)
211+
return ret;
209212

210213
mutex_lock(&priv->lock);
211-
*temp = MCELSIUS((priv->ctemp * 5) - 65);
214+
tmp = MCELSIUS((priv->ctemp * 5) - 65);
212215
mutex_unlock(&priv->lock);
213216

217+
if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {
218+
struct device *dev = rcar_priv_to_dev(priv);
219+
220+
dev_err(dev, "it couldn't measure temperature correctly\n");
221+
return -EIO;
222+
}
223+
224+
*temp = tmp;
225+
214226
return 0;
215227
}
216228

@@ -288,6 +300,9 @@ static void _rcar_thermal_irq_ctrl(struct rcar_thermal_priv *priv, int enable)
288300
unsigned long flags;
289301
u32 mask = 0x3 << rcar_id_to_shift(priv); /* enable Rising/Falling */
290302

303+
if (!rcar_has_irq_support(priv))
304+
return;
305+
291306
spin_lock_irqsave(&common->lock, flags);
292307

293308
rcar_thermal_common_bset(common, INTMSK, mask, enable ? 0 : mask);
@@ -299,11 +314,15 @@ static void rcar_thermal_work(struct work_struct *work)
299314
{
300315
struct rcar_thermal_priv *priv;
301316
int cctemp, nctemp;
317+
int ret;
302318

303319
priv = container_of(work, struct rcar_thermal_priv, work.work);
304320

305321
rcar_thermal_get_temp(priv->zone, &cctemp);
306-
rcar_thermal_update_temp(priv);
322+
ret = rcar_thermal_update_temp(priv);
323+
if (ret < 0)
324+
return;
325+
307326
rcar_thermal_irq_enable(priv);
308327

309328
rcar_thermal_get_temp(priv->zone, &nctemp);
@@ -368,8 +387,7 @@ static int rcar_thermal_remove(struct platform_device *pdev)
368387
struct rcar_thermal_priv *priv;
369388

370389
rcar_thermal_for_each_priv(priv, common) {
371-
if (rcar_has_irq_support(priv))
372-
rcar_thermal_irq_disable(priv);
390+
rcar_thermal_irq_disable(priv);
373391
thermal_zone_device_unregister(priv->zone);
374392
}
375393

@@ -441,7 +459,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
441459
mutex_init(&priv->lock);
442460
INIT_LIST_HEAD(&priv->list);
443461
INIT_DELAYED_WORK(&priv->work, rcar_thermal_work);
444-
rcar_thermal_update_temp(priv);
462+
ret = rcar_thermal_update_temp(priv);
463+
if (ret < 0)
464+
goto error_unregister;
445465

446466
priv->zone = thermal_zone_device_register("rcar_thermal",
447467
1, 0, priv,
@@ -453,8 +473,7 @@ static int rcar_thermal_probe(struct platform_device *pdev)
453473
goto error_unregister;
454474
}
455475

456-
if (rcar_has_irq_support(priv))
457-
rcar_thermal_irq_enable(priv);
476+
rcar_thermal_irq_enable(priv);
458477

459478
list_move_tail(&priv->list, &common->head);
460479

@@ -484,12 +503,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
484503
return ret;
485504
}
486505

487-
static const struct of_device_id rcar_thermal_dt_ids[] = {
488-
{ .compatible = "renesas,rcar-thermal", },
489-
{},
490-
};
491-
MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);
492-
493506
static struct platform_driver rcar_thermal_driver = {
494507
.driver = {
495508
.name = "rcar_thermal",

0 commit comments

Comments
 (0)