]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
thermal: imx_tmu: enable monitoring and default alert/critical
authorTim Harvey <tharvey@gateworks.com>
Sat, 6 Feb 2021 00:11:05 +0000 (16:11 -0800)
committerStefano Babic <sbabic@denx.de>
Mon, 1 Mar 2021 09:21:36 +0000 (10:21 +0100)
Set default critical/alert temperature and enabling monoitoring.

Without calling imx_tmu_enable_msite() monitoring will not be enabled
and read_temperature will return 0. Additionally without setting alert
temperature will cause imx_tmu_get_temp() to spin indefiniately thinking
the system needs to cool.

This resolves the board spinning endlessly when enabling IMX_TMU in the
SPL.

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
drivers/thermal/imx_tmu.c

index 02cefecd0d222f8a02b925ceb23b9b64fb97153a..07766baf45a13df91a79e3cf05e0c8fb625a5da1 100644 (file)
@@ -344,6 +344,7 @@ static int imx_tmu_bind(struct udevice *dev)
        ofnode node, offset;
        const char *name;
        const void *prop;
+       int minc, maxc;
 
        debug("%s dev name %s\n", __func__, dev->name);
 
@@ -352,6 +353,10 @@ 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;
 
        node = ofnode_path("/thermal-zones");
        ofnode_for_each_subnode(offset, node) {
@@ -443,6 +448,7 @@ static int imx_tmu_probe(struct udevice *dev)
        if (pdata->zone_node) {
                imx_tmu_init(dev);
                imx_tmu_calibration(dev);
+               imx_tmu_enable_msite(dev);
        } else {
                imx_tmu_enable_msite(dev);
        }