aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/thermal/rcar_gen3_thermal.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 14:31:27 -0800
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-17 14:31:27 -0800
commitbec04432cb9036dedf89140c102b5ac03e4b3626 (patch)
tree390d76ddf5f302577efc704a78251f099bfecbf5 /drivers/thermal/rcar_gen3_thermal.c
parentMerge branch 'parisc-4.15-1' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux (diff)
parentMerge branches 'thermal-core', 'thermal-tool', 'thermal-intel' and 'thermal-soc' into next (diff)
downloadlinux-dev-bec04432cb9036dedf89140c102b5ac03e4b3626.tar.xz
linux-dev-bec04432cb9036dedf89140c102b5ac03e4b3626.zip
Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux
Pull thermal management updates from Zhang Rui: - introduce brcmstb AVS TMON thermal driver (Brian Norris) - add Rockchip RV1108 support in rockchip thermal driver (Rocky Hao) - major rework on HISI driver plus additional support of hisi3660 (Daniel Lezcano) - add nvmem-cells binding on imx6sx (Leonard Crestez) - fix a NULL pointer dereference on ti thermal driver unloading (Tony Lindgren) - improve tmon tool to make it easier to cross-compile tmon (Markus Mayer) - add Coffee Lake and Cannon Lake support for intel processor and pch thermal drivers (Srinivas Pandruvada) - other small fixes and cleanups (Arvind Yadav, Colin Ian King, Allen Wild, Nicolin Chen, Baruch SiachNiklas Söderlund, Arnd Bergmann) * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/rzhang/linux: (44 commits) thermal: pch: Add Cannon Lake support thermal: int340x: processor_thermal: Add Coffee Lake support thermal: int340x: processor_thermal: Add Cannon Lake support thermal: bxt: remove redundant variable trip thermal: cpu_cooling: pr_err() strings should end with newlines thermal: add brcmstb AVS TMON driver Documentation: devicetree: add binding for Broadcom STB AVS TMON thermal/drivers/hisi: Add support for hi3660 SoC thermal/drivers/hisi: Prepare to add support for other hisi platforms thermal/drivers/hisi: Add platform prefix to function name thermal/drivers/hisi: Put platform code together thermal/drivers/qcom-spmi: Use devm_iio_channel_get thermal/drivers/generic-iio-adc: Switch tz request to devm version thermal/drivers/step_wise: Fix temperature regulation misbehavior thermal/drivers/hisi: Use round up step value thermal/drivers/hisi: Move the clk setup in the corresponding functions thermal/drivers/hisi: Remove mutex_lock in the code thermal/drivers/hisi: Remove thermal data back pointer thermal/drivers/hisi: Convert long to int thermal/drivers/hisi: Rename and remove unused field ...
Diffstat (limited to 'drivers/thermal/rcar_gen3_thermal.c')
-rw-r--r--drivers/thermal/rcar_gen3_thermal.c34
1 files changed, 15 insertions, 19 deletions
diff --git a/drivers/thermal/rcar_gen3_thermal.c b/drivers/thermal/rcar_gen3_thermal.c
index 203aca44a2bb..561a0a332208 100644
--- a/drivers/thermal/rcar_gen3_thermal.c
+++ b/drivers/thermal/rcar_gen3_thermal.c
@@ -24,6 +24,7 @@
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
#include <linux/spinlock.h>
+#include <linux/sys_soc.h>
#include <linux/thermal.h>
#include "thermal_core.h"
@@ -90,10 +91,6 @@ struct rcar_gen3_thermal_priv {
struct rcar_gen3_thermal_tsc *tscs[TSC_MAX_NUM];
unsigned int num_tscs;
spinlock_t lock; /* Protect interrupts on and off */
- const struct rcar_gen3_thermal_data *data;
-};
-
-struct rcar_gen3_thermal_data {
void (*thermal_init)(struct rcar_gen3_thermal_tsc *tsc);
};
@@ -278,7 +275,12 @@ static irqreturn_t rcar_gen3_thermal_irq_thread(int irq, void *data)
return IRQ_HANDLED;
}
-static void r8a7795_thermal_init(struct rcar_gen3_thermal_tsc *tsc)
+static const struct soc_device_attribute r8a7795es1[] = {
+ { .soc_id = "r8a7795", .revision = "ES1.*" },
+ { /* sentinel */ }
+};
+
+static void rcar_gen3_thermal_init_r8a7795es1(struct rcar_gen3_thermal_tsc *tsc)
{
rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, CTSR_THBGR);
rcar_gen3_thermal_write(tsc, REG_GEN3_CTSR, 0x0);
@@ -303,7 +305,7 @@ static void r8a7795_thermal_init(struct rcar_gen3_thermal_tsc *tsc)
usleep_range(1000, 2000);
}
-static void r8a7796_thermal_init(struct rcar_gen3_thermal_tsc *tsc)
+static void rcar_gen3_thermal_init(struct rcar_gen3_thermal_tsc *tsc)
{
u32 reg_val;
@@ -324,17 +326,9 @@ static void r8a7796_thermal_init(struct rcar_gen3_thermal_tsc *tsc)
usleep_range(1000, 2000);
}
-static const struct rcar_gen3_thermal_data r8a7795_data = {
- .thermal_init = r8a7795_thermal_init,
-};
-
-static const struct rcar_gen3_thermal_data r8a7796_data = {
- .thermal_init = r8a7796_thermal_init,
-};
-
static const struct of_device_id rcar_gen3_thermal_dt_ids[] = {
- { .compatible = "renesas,r8a7795-thermal", .data = &r8a7795_data},
- { .compatible = "renesas,r8a7796-thermal", .data = &r8a7796_data},
+ { .compatible = "renesas,r8a7795-thermal", },
+ { .compatible = "renesas,r8a7796-thermal", },
{},
};
MODULE_DEVICE_TABLE(of, rcar_gen3_thermal_dt_ids);
@@ -371,7 +365,9 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
if (!priv)
return -ENOMEM;
- priv->data = of_device_get_match_data(dev);
+ priv->thermal_init = rcar_gen3_thermal_init;
+ if (soc_device_match(r8a7795es1))
+ priv->thermal_init = rcar_gen3_thermal_init_r8a7795es1;
spin_lock_init(&priv->lock);
@@ -423,7 +419,7 @@ static int rcar_gen3_thermal_probe(struct platform_device *pdev)
priv->tscs[i] = tsc;
- priv->data->thermal_init(tsc);
+ priv->thermal_init(tsc);
rcar_gen3_thermal_calc_coefs(&tsc->coef, ptat, thcode[i]);
zone = devm_thermal_zone_of_sensor_register(dev, i, tsc,
@@ -476,7 +472,7 @@ static int __maybe_unused rcar_gen3_thermal_resume(struct device *dev)
for (i = 0; i < priv->num_tscs; i++) {
struct rcar_gen3_thermal_tsc *tsc = priv->tscs[i];
- priv->data->thermal_init(tsc);
+ priv->thermal_init(tsc);
rcar_gen3_thermal_set_trips(tsc, tsc->low, tsc->high);
}