From patchwork Thu Oct 4 01:16:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 1544201 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 74526DFFEE for ; Thu, 4 Oct 2012 01:19:03 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TJa3Z-0003bG-N3; Thu, 04 Oct 2012 01:16:53 +0000 Received: from devils.ext.ti.com ([198.47.26.153]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TJa3V-0003Zw-AT for linux-arm-kernel@lists.infradead.org; Thu, 04 Oct 2012 01:16:50 +0000 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id q941GlZW001526; Wed, 3 Oct 2012 20:16:47 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dlelxv30.itg.ti.com (8.13.8/8.13.8) with ESMTP id q941GlwP015816; Wed, 3 Oct 2012 20:16:47 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.1.323.3; Wed, 3 Oct 2012 20:16:47 -0500 Received: from nucleus.nsc.com (nucleus.nsc.com [10.188.36.112]) by dlelxv22.itg.ti.com (8.13.8/8.13.8) with ESMTP id q941Gir4013802; Wed, 3 Oct 2012 20:16:46 -0500 From: Mike Turquette To: , Subject: [PATCH 3/5] ARM: omap: vc: .get_voltage callback Date: Wed, 3 Oct 2012 18:16:03 -0700 Message-ID: <1349313365-5262-4-git-send-email-mturquette@ti.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1349313365-5262-1-git-send-email-mturquette@ti.com> References: <1349313365-5262-1-git-send-email-mturquette@ti.com> MIME-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -9.0 (---------) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-9.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [198.47.26.153 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -2.1 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: linux-omap@vger.kernel.org, Mike Turquette , linux-arm-kernel@lists.infradead.org, Mike Turquette X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Mike Turquette Implement the voltdm->get_voltage callback for the voltage controller driver. This reads the DATA field corresponding to each VC and returns the voltage, after converting it from vsel format. If DATA is zero (the reset value) then the caller must interpret this as the PMIC running at the default power-on voltage. In such a case DT data for the PMIC is necessary to know the voltage. Signed-off-by: Mike Turquette Signed-off-by: Mike Turquette --- arch/arm/mach-omap2/vc.c | 21 +++++++++++++++++++++ arch/arm/mach-omap2/vc.h | 1 + 2 files changed, 22 insertions(+) diff --git a/arch/arm/mach-omap2/vc.c b/arch/arm/mach-omap2/vc.c index 2bcac64..90a9ea6 100644 --- a/arch/arm/mach-omap2/vc.c +++ b/arch/arm/mach-omap2/vc.c @@ -101,6 +101,27 @@ static int omap_vc_config_channel(struct voltagedomain *voltdm) } /* Voltage scale and accessory APIs */ +unsigned long omap_vc_get_bypass_data(struct voltagedomain *voltdm) +{ + struct omap_vc_channel *vc = voltdm->vc; + u32 vc_bypass_value; + u8 vsel; + unsigned long volt; + + /* sanity */ + if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv || + !voltdm->read || !voltdm->write) + return 0; + + vc_bypass_value = voltdm->read(vc->common->bypass_val_reg); + vc_bypass_value &= vc->common->data_mask; + vsel = vc_bypass_value >> __ffs(vc->common->data_mask); + + volt = voltdm->pmic->vsel_to_uv(vsel); + + return volt; +} + int omap_vc_pre_scale(struct voltagedomain *voltdm, unsigned long target_volt, u8 *target_vsel, u8 *current_vsel) diff --git a/arch/arm/mach-omap2/vc.h b/arch/arm/mach-omap2/vc.h index 84a61b1..e7d4719 100644 --- a/arch/arm/mach-omap2/vc.h +++ b/arch/arm/mach-omap2/vc.h @@ -112,6 +112,7 @@ extern struct omap_vc_channel omap4_vc_iva; extern struct omap_vc_channel omap4_vc_core; void omap_vc_init_channel(struct voltagedomain *voltdm); +unsigned long omap_vc_get_bypass_data(struct voltagedomain *voltdm); int omap_vc_pre_scale(struct voltagedomain *voltdm, unsigned long target_volt, u8 *target_vsel, u8 *current_vsel);