ti-soc-thermal: request temperature periodically if hw can't do that itself
authorPavel Machek <pavel@ucw.cz>
Tue, 24 Mar 2015 22:20:21 +0000 (23:20 +0100)
committerEduardo Valentin <edubezval@gmail.com>
Tue, 5 May 2015 04:27:54 +0000 (21:27 -0700)
When periodic mode is not enabled, it is neccessary to force reads.

Signed-off-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
drivers/thermal/ti-soc-thermal/ti-bandgap.c

index 12f3ee5337bb7d93e854b8c15ab1cf4d5e408f67..63e2f5ce7e94a212a9b118fa53472f8bfe2f2f8a 100644 (file)
@@ -43,6 +43,8 @@
 
 #include "ti-bandgap.h"
 
+static int ti_bandgap_force_single_read(struct ti_bandgap *bgp, int id);
+
 /***   Helper functions to access registers and their bitfields   ***/
 
 /**
@@ -829,6 +831,12 @@ int ti_bandgap_read_temperature(struct ti_bandgap *bgp, int id,
        if (ret)
                return ret;
 
+       if (!TI_BANDGAP_HAS(bgp, MODE_CONFIG)) {
+               ret = ti_bandgap_force_single_read(bgp, id);
+               if (ret)
+                       return ret;
+       }
+
        spin_lock(&bgp->lock);
        temp = ti_bandgap_read_temp(bgp, id);
        spin_unlock(&bgp->lock);