From patchwork Fri May 20 13:33:51 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Balaji T K X-Patchwork-Id: 803252 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4KDZCo4018519 for ; Fri, 20 May 2011 13:35:13 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933962Ab1ETNfH (ORCPT ); Fri, 20 May 2011 09:35:07 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:56678 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933851Ab1ETNfD (ORCPT ); Fri, 20 May 2011 09:35:03 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4KDYuFg008994 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 May 2011 08:34:58 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4KDYtgJ014775; Fri, 20 May 2011 19:04:55 +0530 (IST) Received: from dbdp31.itg.ti.com (172.24.170.98) by DBDE71.ent.ti.com (172.24.170.149) with Microsoft SMTP Server id 8.3.106.1; Fri, 20 May 2011 19:04:55 +0530 Received: from localhost.localdomain (a0393241pc.india.ti.com [172.24.136.78]) by dbdp31.itg.ti.com (8.13.8/8.13.8) with ESMTP id p4KDYn2d008423; Fri, 20 May 2011 19:04:55 +0530 (IST) From: Balaji T K To: , CC: , , , Balaji T K Subject: [PATCH 1/2] regulator: twl6030: do not write to _GRP for regulator enable Date: Fri, 20 May 2011 19:03:51 +0530 Message-ID: <1305898432-14939-2-git-send-email-balajitk@ti.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1305898432-14939-1-git-send-email-balajitk@ti.com> References: <1305898432-14939-1-git-send-email-balajitk@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 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Fri, 20 May 2011 13:35:13 +0000 (UTC) TWL6030: regulator is enabled via VREG_STATE TWL4030: regulator is enabled via VREG_GRP Since there is nothing common, split twlreg_enable similar to other regulator_ops Signed-off-by: Balaji T K Acked-by: Mark Brown --- drivers/regulator/twl-regulator.c | 39 +++++++++++++++++++++++------------- 1 files changed, 25 insertions(+), 14 deletions(-) diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index 2a808c2..abb40c6 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c @@ -156,7 +156,7 @@ static int twl6030reg_is_enabled(struct regulator_dev *rdev) return grp && (val == TWL6030_CFG_STATE_ON); } -static int twlreg_enable(struct regulator_dev *rdev) +static int twl4030reg_enable(struct regulator_dev *rdev) { struct twlreg_info *info = rdev_get_drvdata(rdev); int grp; @@ -166,17 +166,28 @@ static int twlreg_enable(struct regulator_dev *rdev) if (grp < 0) return grp; - if (twl_class_is_4030()) - grp |= P1_GRP_4030; - else - grp |= P1_GRP_6030; + grp |= P1_GRP_4030; ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp); - if (!ret && twl_class_is_6030()) - ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE, - grp << TWL6030_CFG_STATE_GRP_SHIFT | - TWL6030_CFG_STATE_ON); + udelay(info->delay); + + return ret; +} + +static int twl6030reg_enable(struct regulator_dev *rdev) +{ + struct twlreg_info *info = rdev_get_drvdata(rdev); + int grp; + int ret; + + grp = twlreg_read(info, TWL_MODULE_PM_RECEIVER, VREG_GRP); + if (grp < 0) + return grp; + + ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE, + grp << TWL6030_CFG_STATE_GRP_SHIFT | + TWL6030_CFG_STATE_ON); udelay(info->delay); @@ -473,7 +484,7 @@ static struct regulator_ops twl4030ldo_ops = { .set_voltage = twl4030ldo_set_voltage, .get_voltage = twl4030ldo_get_voltage, - .enable = twlreg_enable, + .enable = twl4030reg_enable, .disable = twlreg_disable, .is_enabled = twl4030reg_is_enabled, @@ -531,7 +542,7 @@ static struct regulator_ops twl6030ldo_ops = { .set_voltage = twl6030ldo_set_voltage, .get_voltage = twl6030ldo_get_voltage, - .enable = twlreg_enable, + .enable = twl6030reg_enable, .disable = twlreg_disable, .is_enabled = twl6030reg_is_enabled, @@ -564,7 +575,7 @@ static struct regulator_ops twl4030fixed_ops = { .get_voltage = twlfixed_get_voltage, - .enable = twlreg_enable, + .enable = twl4030reg_enable, .disable = twlreg_disable, .is_enabled = twl4030reg_is_enabled, @@ -578,7 +589,7 @@ static struct regulator_ops twl6030fixed_ops = { .get_voltage = twlfixed_get_voltage, - .enable = twlreg_enable, + .enable = twl6030reg_enable, .disable = twlreg_disable, .is_enabled = twl6030reg_is_enabled, @@ -588,7 +599,7 @@ static struct regulator_ops twl6030fixed_ops = { }; static struct regulator_ops twl6030_fixed_resource = { - .enable = twlreg_enable, + .enable = twl6030reg_enable, .disable = twlreg_disable, .is_enabled = twl6030reg_is_enabled, .get_status = twl6030reg_get_status,