summaryrefslogtreecommitdiff
path: root/drivers/thermal
diff options
context:
space:
mode:
authorPrimoz Fiser <[email protected]>2025-10-15 08:33:47 +0200
committerFabio Estevam <[email protected]>2025-10-30 12:38:53 -0300
commit8690133debf5d2caa624a658ac33fb43b9329bbd (patch)
tree2c7e8c450cdc7d96aba3d2c1c8a87b8620c38430 /drivers/thermal
parentd6737daa206d8622e109c22623a29a1e53f33c7e (diff)
thermal: imx_tmu: Always set thermal trips from fuses
NXP i.MX SoCs are available in different temperature grades. By default, device-tree contains only thermal trips for consumer grade parts. On the other hand, part temp grade fuse can be used to determine thermal trip points. We already do this in imx_tmu_bind() function. Now, factor out this functionality to a standalone function imx_tmu_set_trips() and use it for both cases. This fixes an issue where 'cpu-thermal' child device would set different thermal trips than the parent 'tmu@44482000' sensor, depending on which gets used. Signed-off-by: Primoz Fiser <[email protected]>
Diffstat (limited to 'drivers/thermal')
-rw-r--r--drivers/thermal/imx_tmu.c33
1 files changed, 13 insertions, 20 deletions
diff --git a/drivers/thermal/imx_tmu.c b/drivers/thermal/imx_tmu.c
index 51a072e23c6..c8389d507ee 100644
--- a/drivers/thermal/imx_tmu.c
+++ b/drivers/thermal/imx_tmu.c
@@ -532,6 +532,16 @@ static int imx_tmu_enable_msite(struct udevice *dev)
return 0;
}
+static void imx_tmu_set_trips(struct imx_tmu_plat *pdata)
+{
+ int minc, maxc;
+
+ /* default alert/crit temps based on temp grade */
+ get_cpu_temp_grade(&minc, &maxc);
+ pdata->critical = maxc * 1000;
+ pdata->alert = (maxc - 10) * 1000;
+}
+
static int imx_tmu_bind(struct udevice *dev)
{
struct imx_tmu_plat *pdata = dev_get_plat(dev);
@@ -539,7 +549,6 @@ static int imx_tmu_bind(struct udevice *dev)
ofnode node, offset;
const char *name;
const void *prop;
- int minc, maxc;
dev_dbg(dev, "%s\n", __func__);
@@ -548,10 +557,7 @@ static int imx_tmu_bind(struct udevice *dev)
return 0;
pdata->zone_node = 1;
- /* default alert/crit temps based on temp grade */
- get_cpu_temp_grade(&minc, &maxc);
- pdata->critical = maxc * 1000;
- pdata->alert = (maxc - 10) * 1000;
+ imx_tmu_set_trips(pdata);
node = ofnode_path("/thermal-zones");
ofnode_for_each_subnode(offset, node) {
@@ -572,7 +578,7 @@ static int imx_tmu_parse_fdt(struct udevice *dev)
{
struct imx_tmu_plat *pdata = dev_get_plat(dev), *p_parent_data;
struct ofnode_phandle_args args;
- ofnode trips_np, cpu_thermal_np;
+ ofnode cpu_thermal_np;
int ret;
dev_dbg(dev, "%s\n", __func__);
@@ -612,20 +618,7 @@ static int imx_tmu_parse_fdt(struct udevice *dev)
pdata->polling_delay = dev_read_u32_default(dev, "polling-delay",
IMX_TMU_POLLING_DELAY_MS);
- trips_np = ofnode_path("/thermal-zones/cpu-thermal/trips");
- ofnode_for_each_subnode(trips_np, trips_np) {
- const char *type;
-
- type = ofnode_get_property(trips_np, "type", NULL);
- if (!type)
- continue;
- if (!strcmp(type, "critical"))
- pdata->critical = ofnode_read_u32_default(trips_np, "temperature", 85);
- else if (strcmp(type, "passive") == 0)
- pdata->alert = ofnode_read_u32_default(trips_np, "temperature", 80);
- else
- continue;
- }
+ imx_tmu_set_trips(pdata);
dev_dbg(dev, "id %d polling_delay %d, critical %d, alert %d\n",
pdata->id, pdata->polling_delay, pdata->critical, pdata->alert);