OSDN Git Service

thermal: ti-soc-thermal: Ensure to compute thermal trend
authorRanganath Krishnan <ranganath@ti.com>
Fri, 23 Aug 2013 16:08:23 +0000 (11:08 -0500)
committerEduardo Valentin <eduardo.valentin@ti.com>
Thu, 29 Aug 2013 13:36:18 +0000 (09:36 -0400)
Workaround to compute thermal trend even when update interval
is not set. This patch will ensure to compute the thermal trend
when bandgap counter delay is not set.

Signed-off-by: Ranganath Krishnan <ranganath@ti.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
drivers/thermal/ti-soc-thermal/ti-bandgap.c

index 9dfd471..74c0e34 100644 (file)
@@ -1020,9 +1020,13 @@ int ti_bandgap_get_trend(struct ti_bandgap *bgp, int id, int *trend)
 
        /* Fetch the update interval */
        ret = ti_bandgap_read_update_interval(bgp, id, &interval);
-       if (ret || !interval)
+       if (ret)
                goto unfreeze;
 
+       /* Set the interval to 1 ms if bandgap counter delay is not set */
+       if (interval == 0)
+               interval = 1;
+
        *trend = (t1 - t2) / interval;
 
        dev_dbg(bgp->dev, "The temperatures are t1 = %d and t2 = %d and trend =%d\n",