From patchwork Thu Oct 4 01:16:04 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mike Turquette X-Patchwork-Id: 1544171 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 13A35DFF71 for ; Thu, 4 Oct 2012 01:16:58 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933270Ab2JDBQ4 (ORCPT ); Wed, 3 Oct 2012 21:16:56 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:46432 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933233Ab2JDBQx (ORCPT ); Wed, 3 Oct 2012 21:16:53 -0400 Received: from dlelxv30.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id q941Glo9015185; Wed, 3 Oct 2012 20:16:48 -0500 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 q941GlEq015822; Wed, 3 Oct 2012 20:16:47 -0500 Received: from dlelxv22.itg.ti.com (172.17.1.197) by dfle73.ent.ti.com (128.247.5.110) 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 q941Gir5013802; Wed, 3 Oct 2012 20:16:47 -0500 From: Mike Turquette To: , CC: , , Mike Turquette , Mike Turquette Subject: [PATCH 4/5] ARM: omap: vp: .get_voltage callback Date: Wed, 3 Oct 2012 18:16:04 -0700 Message-ID: <1349313365-5262-5-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 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Mike Turquette Implement the voltdm->get_voltage callback for the voltage processor driver. This reads the INITVOLTAGE field corresponding to each VP and returns the voltage, after converting it from vsel format. If INITVOLTAGE 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/vp.c | 22 ++++++++++++++++++++++ arch/arm/mach-omap2/vp.h | 1 + 2 files changed, 23 insertions(+) diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c index f95c1ba..63dc03e 100644 --- a/arch/arm/mach-omap2/vp.c +++ b/arch/arm/mach-omap2/vp.c @@ -9,6 +9,28 @@ #include "prm-regbits-44xx.h" #include "prm44xx.h" +unsigned long omap_vp_get_init_voltage(struct voltagedomain *voltdm) +{ + struct omap_vp_instance *vp = voltdm->vp; + u32 vpconfig; + u8 vsel; + unsigned long volt; + + /* sanity */ + if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv + || !voltdm->read || !voltdm->write) + return 0; + + vpconfig = voltdm->read(vp->vpconfig); + vpconfig &= vp->common->vpconfig_initvoltage_mask; + + vsel = vpconfig >> __ffs(vp->common->vpconfig_initvoltage_mask); + + volt = voltdm->pmic->vsel_to_uv(vsel); + + return volt; +} + static u32 _vp_set_init_voltage(struct voltagedomain *voltdm, u32 volt) { struct omap_vp_instance *vp = voltdm->vp; diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h index 7c155d2..0747a78 100644 --- a/arch/arm/mach-omap2/vp.h +++ b/arch/arm/mach-omap2/vp.h @@ -120,6 +120,7 @@ extern struct omap_vp_instance omap4_vp_core; void omap_vp_init(struct voltagedomain *voltdm); void omap_vp_enable(struct voltagedomain *voltdm); void omap_vp_disable(struct voltagedomain *voltdm); +unsigned long omap_vp_get_init_voltage(struct voltagedomain *voltdm); int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, unsigned long target_volt); int omap_vp_update_errorgain(struct voltagedomain *voltdm,