Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b87ea759 authored by Radhesh Fadnis's avatar Radhesh Fadnis Committed by Greg Kroah-Hartman
Browse files

staging: omap-thermal: fix context restore function



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: default avatarRadhesh Fadnis <radhesh.fadnis@ti.com>
Signed-off-by: default avatarEnric Balletbo i Serra <eballetbo@gmail.com>
Signed-off-by: default avatarEduardo Valentin <eduardo.valentin@ti.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 71e303f5
Loading
Loading
Loading
Loading
+21 −36
Original line number Diff line number Diff line
@@ -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,7 +1077,6 @@ 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,
@@ -1101,19 +1099,6 @@ static int omap_bandgap_restore_ctxt(struct omap_bandgap *bg_ptr)
			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);
			}
		}
	}

	return 0;