staging: omap-thermal: fix context restore function
authorRadhesh Fadnis <radhesh.fadnis@ti.com>
Tue, 13 Nov 2012 18:10:04 +0000 (14:10 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2012 23:08:31 +0000 (15:08 -0800)
In the context restore function, if the context is lost or
not is being checked by the contents of the counter register.
But this is logic hold good as long as counter reset value is
zero, if the reset value is non-zero then above logic doesn't
hold good. Hence removed checking of the register value and
restoring the context.

Signed-off-by: Radhesh Fadnis <radhesh.fadnis@ti.com>
Signed-off-by: Enric Balletbo i Serra <eballetbo@gmail.com>
Signed-off-by: Eduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/omap-thermal/omap-bandgap.c

index 3eb726f29d15133fed7227fe464bf94425a774d3..c17bc955c553afc6a3ef212ec6424486d16156a1 100644 (file)
@@ -1065,7 +1065,6 @@ static int omap_bandgap_save_ctxt(struct omap_bandgap *bg_ptr)
 static int omap_bandgap_restore_ctxt(struct omap_bandgap *bg_ptr)
 {
        int i;
-       u32 temp = 0;
 
        for (i = 0; i < bg_ptr->conf->sensor_count; i++) {
                struct temp_sensor_registers *tsr;
@@ -1078,41 +1077,27 @@ static int omap_bandgap_restore_ctxt(struct omap_bandgap *bg_ptr)
                if (OMAP_BANDGAP_HAS(bg_ptr, COUNTER))
                        val = omap_bandgap_readl(bg_ptr, tsr->bgap_counter);
 
-               if (val == 0) {
-                       if (OMAP_BANDGAP_HAS(bg_ptr, TSHUT_CONFIG))
-                               omap_bandgap_writel(bg_ptr,
-                                       rval->tshut_threshold,
-                                                  tsr->tshut_threshold);
-                       /* Force immediate temperature measurement and update
-                        * of the DTEMP field
-                        */
-                       omap_bandgap_force_single_read(bg_ptr, i);
-
-                       if (OMAP_BANDGAP_HAS(bg_ptr, COUNTER))
-                               omap_bandgap_writel(bg_ptr, rval->bg_counter,
-                                                          tsr->bgap_counter);
-                       if (OMAP_BANDGAP_HAS(bg_ptr, MODE_CONFIG))
-                               omap_bandgap_writel(bg_ptr, rval->bg_mode_ctrl,
-                                                          tsr->bgap_mode_ctrl);
-                       if (OMAP_BANDGAP_HAS(bg_ptr, TALERT)) {
-                               omap_bandgap_writel(bg_ptr,
-                                                          rval->bg_threshold,
-                                                          tsr->bgap_threshold);
-                               omap_bandgap_writel(bg_ptr, rval->bg_ctrl,
-                                                          tsr->bgap_mask_ctrl);
-                       }
-               } else {
-                       temp = omap_bandgap_readl(bg_ptr,
-                                                 tsr->temp_sensor_ctrl);
-                       temp &= (tsr->bgap_dtemp_mask);
-                       omap_bandgap_force_single_read(bg_ptr, i);
-                       if (temp == 0 && OMAP_BANDGAP_HAS(bg_ptr, TALERT)) {
-                               temp = omap_bandgap_readl(bg_ptr,
-                                                         tsr->bgap_mask_ctrl);
-                               temp |= 1 << __ffs(tsr->mode_ctrl_mask);
-                               omap_bandgap_writel(bg_ptr, temp,
-                                                          tsr->bgap_mask_ctrl);
-                       }
+               if (OMAP_BANDGAP_HAS(bg_ptr, TSHUT_CONFIG))
+                       omap_bandgap_writel(bg_ptr,
+                               rval->tshut_threshold,
+                                          tsr->tshut_threshold);
+               /* Force immediate temperature measurement and update
+                * of the DTEMP field
+                */
+               omap_bandgap_force_single_read(bg_ptr, i);
+
+               if (OMAP_BANDGAP_HAS(bg_ptr, COUNTER))
+                       omap_bandgap_writel(bg_ptr, rval->bg_counter,
+                                                  tsr->bgap_counter);
+               if (OMAP_BANDGAP_HAS(bg_ptr, MODE_CONFIG))
+                       omap_bandgap_writel(bg_ptr, rval->bg_mode_ctrl,
+                                                  tsr->bgap_mode_ctrl);
+               if (OMAP_BANDGAP_HAS(bg_ptr, TALERT)) {
+                       omap_bandgap_writel(bg_ptr,
+                                                  rval->bg_threshold,
+                                                  tsr->bgap_threshold);
+                       omap_bandgap_writel(bg_ptr, rval->bg_ctrl,
+                                                  tsr->bgap_mask_ctrl);
                }
        }