Skip to content

Commit 5fdd4e3

Browse files
ffainellidlezcano
authored andcommitted
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 <[email protected]> Signed-off-by: Florian Fainelli <[email protected]> Signed-off-by: Daniel Lezcano <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent eaf7a88 commit 5fdd4e3

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

drivers/thermal/broadcom/brcmstb_thermal.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ static struct avs_tmon_trip avs_tmon_trips[] = {
105105
struct brcmstb_thermal_params {
106106
unsigned int offset;
107107
unsigned int mult;
108+
const struct thermal_zone_of_device_ops *of_ops;
108109
};
109110

110111
struct brcmstb_thermal_priv {
@@ -287,19 +288,25 @@ static int brcmstb_set_trips(void *data, int low, int high)
287288
return 0;
288289
}
289290

290-
static const struct thermal_zone_of_device_ops of_ops = {
291+
static const struct thermal_zone_of_device_ops brcmstb_16nm_of_ops = {
291292
.get_temp = brcmstb_get_temp,
292-
.set_trips = brcmstb_set_trips,
293293
};
294294

295295
static const struct brcmstb_thermal_params brcmstb_16nm_params = {
296296
.offset = 457829,
297297
.mult = 557,
298+
.of_ops = &brcmstb_16nm_of_ops,
299+
};
300+
301+
static const struct thermal_zone_of_device_ops brcmstb_28nm_of_ops = {
302+
.get_temp = brcmstb_get_temp,
303+
.set_trips = brcmstb_set_trips,
298304
};
299305

300306
static const struct brcmstb_thermal_params brcmstb_28nm_params = {
301307
.offset = 410040,
302308
.mult = 487,
309+
.of_ops = &brcmstb_28nm_of_ops,
303310
};
304311

305312
static const struct of_device_id brcmstb_thermal_id_table[] = {
@@ -311,6 +318,7 @@ MODULE_DEVICE_TABLE(of, brcmstb_thermal_id_table);
311318

312319
static int brcmstb_thermal_probe(struct platform_device *pdev)
313320
{
321+
const struct thermal_zone_of_device_ops *of_ops;
314322
struct thermal_zone_device *thermal;
315323
struct brcmstb_thermal_priv *priv;
316324
struct resource *res;
@@ -331,9 +339,10 @@ static int brcmstb_thermal_probe(struct platform_device *pdev)
331339

332340
priv->dev = &pdev->dev;
333341
platform_set_drvdata(pdev, priv);
342+
of_ops = priv->temp_params->of_ops;
334343

335344
thermal = devm_thermal_zone_of_sensor_register(&pdev->dev, 0, priv,
336-
&of_ops);
345+
of_ops);
337346
if (IS_ERR(thermal)) {
338347
ret = PTR_ERR(thermal);
339348
dev_err(&pdev->dev, "could not register sensor: %d\n", ret);

0 commit comments

Comments
 (0)