aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/thermal
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2020-01-14 11:06:07 -0800
committerDaniel Lezcano <daniel.lezcano@linaro.org>2020-01-27 11:41:08 +0100
commit5fdd4e310b450939aac5486cd20e222a127cf114 (patch)
tree096f20f0ddf92fc0e0ec4407090927dadbc1d394 /drivers/thermal
parentthermal: brcmstb_thermal: Restructure interrupt registration (diff)
downloadwireguard-linux-5fdd4e310b450939aac5486cd20e222a127cf114.tar.xz
wireguard-linux-5fdd4e310b450939aac5486cd20e222a127cf114.zip
thermal: brcmstb_thermal: Register different ops per process
Since we do not have interrupts on BCM7216, we cannot have trip point crossing, the thermal subsystem expects us to provide a NULL set_trips operation in that case, so make it possible to provide per-process thermal_zone_of_device_ops Reviewed-by: Amit Kucheria <amit.kucheria@linaro.org> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://lore.kernel.org/r/20200114190607.29339-7-f.fainelli@gmail.com
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/broadcom/brcmstb_thermal.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/thermal/broadcom/brcmstb_thermal.c b/drivers/thermal/broadcom/brcmstb_thermal.c
index 6ded4b9c53be..8df5edef1ded 100644
--- a/drivers/thermal/broadcom/brcmstb_thermal.c
+++ b/drivers/thermal/broadcom/brcmstb_thermal.c
@@ -105,6 +105,7 @@ static struct avs_tmon_trip avs_tmon_trips[] = {
struct brcmstb_thermal_params {
unsigned int offset;
unsigned int mult;
+ const struct thermal_zone_of_device_ops *of_ops;
};
struct brcmstb_thermal_priv {
@@ -287,19 +288,25 @@ static int brcmstb_set_trips(void *data, int low, int high)
return 0;
}
-static const struct thermal_zone_of_device_ops of_ops = {
+static const struct thermal_zone_of_device_ops brcmstb_16nm_of_ops = {
.get_temp = brcmstb_get_temp,
- .set_trips = brcmstb_set_trips,
};
static const struct brcmstb_thermal_params brcmstb_16nm_params = {
.offset = 457829,
.mult = 557,
+ .of_ops = &brcmstb_16nm_of_ops,
+};
+
+static const struct thermal_zone_of_device_ops brcmstb_28nm_of_ops = {
+ .get_temp = brcmstb_get_temp,
+ .set_trips = brcmstb_set_trips,
};
static const struct brcmstb_thermal_params brcmstb_28nm_params = {
.offset = 410040,
.mult = 487,
+ .of_ops = &brcmstb_28nm_of_ops,
};
static const struct of_device_id brcmstb_thermal_id_table[] = {
@@ -311,6 +318,7 @@ MODULE_DEVICE_TABLE(of, brcmstb_thermal_id_table);
static int brcmstb_thermal_probe(struct platform_device *pdev)
{
+ const struct thermal_zone_of_device_ops *of_ops;
struct thermal_zone_device *thermal;
struct brcmstb_thermal_priv *priv;
struct resource *res;
@@ -331,9 +339,10 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
priv->dev = &pdev->dev;
platform_set_drvdata(pdev, priv);
+ of_ops = priv->temp_params->of_ops;
thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
- &of_ops);
+ of_ops);
if (IS_ERR(thermal)) {
ret = PTR_ERR(thermal);
dev_err(&pdev->dev, "could not register sensor: %d\n", ret);