Skip to content

Commit

Permalink
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
torvalds committed Jan 24, 2016
2 parents c52cb43 + 98d9450 commit 81f05fe
Show file tree
Hide file tree
Showing 9 changed files with 304 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@

Required properties:
- compatible : should be "rockchip,<name>-tsadc"
"rockchip,rk3228-tsadc": found on RK3228 SoCs
"rockchip,rk3288-tsadc": found on RK3288 SoCs
"rockchip,rk3368-tsadc": found on RK3368 SoCs
"rockchip,rk3399-tsadc": found on RK3399 SoCs
- reg : physical base address of the controller and length of memory mapped
region.
- interrupts : The interrupt number to the cpu. The interrupt specifier format
Expand Down
10 changes: 10 additions & 0 deletions drivers/thermal/int340x_thermal/processor_thermal_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
/* Braswell thermal reporting device */
#define PCI_DEVICE_ID_PROC_BSW_THERMAL 0x22DC

/* Broxton thermal reporting device */
#define PCI_DEVICE_ID_PROC_BXT0_THERMAL 0x0A8C
#define PCI_DEVICE_ID_PROC_BXT1_THERMAL 0x1A8C
#define PCI_DEVICE_ID_PROC_BXTX_THERMAL 0x4A8C
#define PCI_DEVICE_ID_PROC_BXTP_THERMAL 0x5A8C

struct power_config {
u32 index;
u32 min_uw;
Expand Down Expand Up @@ -404,6 +410,10 @@ static const struct pci_device_id proc_thermal_pci_ids[] = {
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_HSB_THERMAL)},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_SKL_THERMAL)},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BSW_THERMAL)},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXT0_THERMAL)},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXT1_THERMAL)},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXTX_THERMAL)},
{ PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_PROC_BXTP_THERMAL)},
{ 0, },
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/thermal/intel_pch_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ struct pch_dev_ops {


/* dev ops for Wildcat Point */
static struct pch_dev_ops pch_dev_ops_wpt = {
static const struct pch_dev_ops pch_dev_ops_wpt = {
.hw_init = pch_wpt_init,
.get_temp = pch_wpt_get_temp,
};
Expand Down
53 changes: 33 additions & 20 deletions drivers/thermal/rcar_thermal.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ struct rcar_thermal_priv {
#define rcar_has_irq_support(priv) ((priv)->common->base)
#define rcar_id_to_shift(priv) ((priv)->id * 8)

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

/*
* basic functions
Expand Down Expand Up @@ -203,14 +203,26 @@ static int rcar_thermal_update_temp(struct rcar_thermal_priv *priv)
static int rcar_thermal_get_temp(struct thermal_zone_device *zone, int *temp)
{
struct rcar_thermal_priv *priv = rcar_zone_to_priv(zone);
int tmp;
int ret;

if (!rcar_has_irq_support(priv) || rcar_force_update_temp(priv))
rcar_thermal_update_temp(priv);
ret = rcar_thermal_update_temp(priv);
if (ret < 0)
return ret;

mutex_lock(&priv->lock);
*temp = MCELSIUS((priv->ctemp * 5) - 65);
tmp = MCELSIUS((priv->ctemp * 5) - 65);
mutex_unlock(&priv->lock);

if ((tmp < MCELSIUS(-45)) || (tmp > MCELSIUS(125))) {
struct device *dev = rcar_priv_to_dev(priv);

dev_err(dev, "it couldn't measure temperature correctly\n");
return -EIO;
}

*temp = tmp;

return 0;
}

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

if (!rcar_has_irq_support(priv))
return;

spin_lock_irqsave(&common->lock, flags);

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

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

rcar_thermal_get_temp(priv->zone, &cctemp);
rcar_thermal_update_temp(priv);
ret = rcar_thermal_update_temp(priv);
if (ret < 0)
return;

rcar_thermal_irq_enable(priv);

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

rcar_thermal_for_each_priv(priv, common) {
if (rcar_has_irq_support(priv))
rcar_thermal_irq_disable(priv);
rcar_thermal_irq_disable(priv);
thermal_zone_device_unregister(priv->zone);
}

Expand Down Expand Up @@ -441,7 +459,9 @@ static int rcar_thermal_probe(struct platform_device *pdev)
mutex_init(&priv->lock);
INIT_LIST_HEAD(&priv->list);
INIT_DELAYED_WORK(&priv->work, rcar_thermal_work);
rcar_thermal_update_temp(priv);
ret = rcar_thermal_update_temp(priv);
if (ret < 0)
goto error_unregister;

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

if (rcar_has_irq_support(priv))
rcar_thermal_irq_enable(priv);
rcar_thermal_irq_enable(priv);

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

Expand Down Expand Up @@ -484,12 +503,6 @@ static int rcar_thermal_probe(struct platform_device *pdev)
return ret;
}

static const struct of_device_id rcar_thermal_dt_ids[] = {
{ .compatible = "renesas,rcar-thermal", },
{},
};
MODULE_DEVICE_TABLE(of, rcar_thermal_dt_ids);

static struct platform_driver rcar_thermal_driver = {
.driver = {
.name = "rcar_thermal",
Expand Down
Loading

0 comments on commit 81f05fe

Please sign in to comment.