From patchwork Tue Nov 13 15:43:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Valentin X-Patchwork-Id: 1734691 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id A9384DF280 for ; Tue, 13 Nov 2012 15:45:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755161Ab2KMPpk (ORCPT ); Tue, 13 Nov 2012 10:45:40 -0500 Received: from comal.ext.ti.com ([198.47.26.152]:60700 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754765Ab2KMPpi (ORCPT ); Tue, 13 Nov 2012 10:45:38 -0500 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id qADFjbJo013443; Tue, 13 Nov 2012 09:45:37 -0600 Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id qADFjbNX018230; Tue, 13 Nov 2012 09:45:37 -0600 Received: from dlelxv23.itg.ti.com (172.17.1.198) by dfle73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.1.323.3; Tue, 13 Nov 2012 09:45:36 -0600 Received: from legion.dal.design.ti.com (legion.dal.design.ti.com [128.247.22.53]) by dlelxv23.itg.ti.com (8.13.8/8.13.8) with ESMTP id qADFjadN022729; Tue, 13 Nov 2012 09:45:36 -0600 Received: from localhost (h64-10.vpn.ti.com [172.24.64.10]) by legion.dal.design.ti.com (8.11.7p1+Sun/8.11.7) with ESMTP id qADFjWw00242; Tue, 13 Nov 2012 09:45:33 -0600 (CST) From: Eduardo Valentin To: CC: , , , , Radhesh Fadnis , Eduardo Valentin Subject: [PATCH 5/5] staging: omap-thermal: fix context restore function Date: Tue, 13 Nov 2012 11:43:22 -0400 Message-ID: <1352821402-13458-6-git-send-email-eduardo.valentin@ti.com> X-Mailer: git-send-email 1.7.7.1.488.ge8e1c In-Reply-To: <1352821402-13458-1-git-send-email-eduardo.valentin@ti.com> References: <1352821402-13458-1-git-send-email-eduardo.valentin@ti.com> MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Radhesh Fadnis 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 Signed-off-by: Eduardo Valentin --- drivers/staging/omap-thermal/omap-bandgap.c | 56 ++++++++++----------------- 1 files changed, 21 insertions(+), 35 deletions(-) diff --git a/drivers/staging/omap-thermal/omap-bandgap.c b/drivers/staging/omap-thermal/omap-bandgap.c index c5f39ec..d6be31d 100644 --- a/drivers/staging/omap-thermal/omap-bandgap.c +++ b/drivers/staging/omap-thermal/omap-bandgap.c @@ -1078,41 +1078,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); } }