From patchwork Mon Aug 29 17:58:06 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Hilman X-Patchwork-Id: 1109632 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p7TI4gTe026145 for ; Mon, 29 Aug 2011 18:04:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754416Ab1H2R5z (ORCPT ); Mon, 29 Aug 2011 13:57:55 -0400 Received: from na3sys009aog107.obsmtp.com ([74.125.149.197]:53487 "EHLO na3sys009aog107.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754383Ab1H2R5y (ORCPT ); Mon, 29 Aug 2011 13:57:54 -0400 Received: from mail-yi0-f52.google.com ([209.85.218.52]) (using TLSv1) by na3sys009aob107.postini.com ([74.125.148.12]) with SMTP ID DSNKTlvTIoLpzhjMUD6qkuzy5Vsqx/vwtER+@postini.com; Mon, 29 Aug 2011 10:57:54 PDT Received: by mail-yi0-f52.google.com with SMTP id 13so8740312yie.25 for ; Mon, 29 Aug 2011 10:57:54 -0700 (PDT) Received: by 10.42.108.72 with SMTP id g8mr922357icp.466.1314640674021; Mon, 29 Aug 2011 10:57:54 -0700 (PDT) Received: from localhost.localdomain (c-24-19-7-36.hsd1.wa.comcast.net [24.19.7.36]) by mx.google.com with ESMTPS id b9sm2718294ibb.32.2011.08.29.10.57.52 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 29 Aug 2011 10:57:53 -0700 (PDT) From: Kevin Hilman To: linux-omap@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Subject: [PATCH 06/12] OMAP3+: VP: create VP helper function for updating error gain Date: Mon, 29 Aug 2011 10:58:06 -0700 Message-Id: <1314640692-3386-7-git-send-email-khilman@ti.com> X-Mailer: git-send-email 1.7.6 In-Reply-To: <1314640692-3386-1-git-send-email-khilman@ti.com> References: <1314640692-3386-1-git-send-email-khilman@ti.com> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 29 Aug 2011 18:04:43 +0000 (UTC) Create new helper function in VP layer for updating VP error gain. Currently used during pre-scale for VP force update and VC bypass. TODO: determine if this can be removed from the pre-scale path and moved to VP enable path. Signed-off-by: Kevin Hilman --- arch/arm/mach-omap2/vc.c | 19 ++----------------- arch/arm/mach-omap2/vp.c | 19 +++++++++++++++++++ arch/arm/mach-omap2/vp.h | 2 ++ 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c index d615a0d..38ba13b 100644 --- a/arch/arm/mach-omap2/vc.c +++ b/arch/arm/mach-omap2/vc.c @@ -96,9 +96,7 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm, u8 *target_vsel, u8 *current_vsel) { struct omap_vc_channel *vc = voltdm->vc; - struct omap_vdd_info *vdd = voltdm->vdd; - struct omap_volt_data *volt_data; - u32 vc_cmdval, vp_errgain_val; + u32 vc_cmdval; /* Check if sufficient pmic info is available for this vdd */ if (!voltdm->pmic) { @@ -120,11 +118,6 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm, return -EINVAL; } - /* Get volt_data corresponding to target_volt */ - volt_data = omap_voltage_get_voltdata(voltdm, target_volt); - if (IS_ERR(volt_data)) - volt_data = NULL; - *target_vsel = voltdm->pmic->uv_to_vsel(target_volt); *current_vsel = voltdm->pmic->uv_to_vsel(vdd->curr_volt); @@ -134,15 +127,7 @@ int omap_vc_pre_scale(struct voltagedomain *voltdm, vc_cmdval |= (*target_vsel << vc->common->cmd_on_shift); voltdm->write(vc_cmdval, vc->cmdval_reg); - /* Setting vp errorgain based on the voltage */ - if (volt_data) { - vp_errgain_val = voltdm->read(voltdm->vp->vpconfig); - vdd->vp_rt_data.vpconfig_errorgain = volt_data->vp_errgain; - vp_errgain_val &= voltdm->vp->common->vpconfig_errorgain_mask; - vp_errgain_val |= vdd->vp_rt_data.vpconfig_errorgain << - __ffs(voltdm->vp->common->vpconfig_errorgain_mask); - voltdm->write(vp_errgain_val, voltdm->vp->vpconfig); - } + omap_vp_update_errorgain(voltdm, target_volt); return 0; } diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c index ea61a47..f68a6db 100644 --- a/arch/arm/mach-omap2/vp.c +++ b/arch/arm/mach-omap2/vp.c @@ -106,6 +106,25 @@ void __init omap_vp_init(struct voltagedomain *voltdm) voltdm->write(vp_val, vp->vlimitto); } +int omap_vp_update_errorgain(struct voltagedomain *voltdm, + unsigned long target_volt) +{ + struct omap_volt_data *volt_data; + + /* Get volt_data corresponding to target_volt */ + volt_data = omap_voltage_get_voltdata(voltdm, target_volt); + if (IS_ERR(volt_data)) + return -EINVAL; + + /* Setting vp errorgain based on the voltage */ + voltdm->rmw(voltdm->vp->common->vpconfig_errorgain_mask, + volt_data->vp_errgain << + __ffs(voltdm->vp->common->vpconfig_errorgain_mask), + voltdm->vp->vpconfig); + + return 0; +} + /* VP force update method of voltage scaling */ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, unsigned long target_volt) diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h index 2afe11d..71ac738 100644 --- a/arch/arm/mach-omap2/vp.h +++ b/arch/arm/mach-omap2/vp.h @@ -148,5 +148,7 @@ void omap_vp_disable(struct voltagedomain *voltdm); unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm); int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, unsigned long target_volt); +int omap_vp_update_errorgain(struct voltagedomain *voltdm, + unsigned long target_volt); #endif