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);
ofnode node, offset;
const char *name;
const void *prop;
- int minc, maxc;
dev_dbg(dev, "%s\n", __func__);
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) {
{
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__);
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);