From patchwork Fri May 20 13:33:52 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: 803262 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 p4KDZLVW018694 for ; Fri, 20 May 2011 13:35:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933747Ab1ETNfQ (ORCPT ); Fri, 20 May 2011 09:35:16 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:49661 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933946Ab1ETNfH (ORCPT ); Fri, 20 May 2011 09:35:07 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id p4KDYv9a008090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 May 2011 08:34:59 -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 p4KDYu29014779; Fri, 20 May 2011 19:04:56 +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:56 +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 p4KDYn2e008423; Fri, 20 May 2011 19:04:56 +0530 (IST) From: Balaji T K To: , CC: , , , Balaji T K Subject: [PATCH 2/2] regulator: twl6030: do not write to _GRP for regulator disable Date: Fri, 20 May 2011 19:03:52 +0530 Message-ID: <1305898432-14939-3-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:21 +0000 (UTC) TWL6030: regulator is disabled via VREG_STATE TWL4030: regulator is disabled 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 | 47 +++++++++++++++++------------------- 1 files changed, 22 insertions(+), 25 deletions(-) diff --git a/drivers/regulator/twl-regulator.c b/drivers/regulator/twl-regulator.c index abb40c6..4702b8a 100644 --- a/drivers/regulator/twl-regulator.c +++ b/drivers/regulator/twl-regulator.c @@ -194,7 +194,7 @@ static int twl6030reg_enable(struct regulator_dev *rdev) return ret; } -static int twlreg_disable(struct regulator_dev *rdev) +static int twl4030reg_disable(struct regulator_dev *rdev) { struct twlreg_info *info = rdev_get_drvdata(rdev); int grp; @@ -204,28 +204,25 @@ static int twlreg_disable(struct regulator_dev *rdev) if (grp < 0) return grp; - /* For 6030, set the off state for all grps enabled */ - if (twl_class_is_6030()) { - ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE, - (grp & (P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030)) << - TWL6030_CFG_STATE_GRP_SHIFT | - TWL6030_CFG_STATE_OFF); - if (ret) - return ret; - } - - if (twl_class_is_4030()) - grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030); - else - grp &= ~(P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030); + grp &= ~(P1_GRP_4030 | P2_GRP_4030 | P3_GRP_4030); ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_GRP, grp); - /* Next, associate cleared grp in state register */ - 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_OFF); + return ret; +} + +static int twl6030reg_disable(struct regulator_dev *rdev) +{ + struct twlreg_info *info = rdev_get_drvdata(rdev); + int grp = 0; + int ret; + + grp = P1_GRP_6030 | P2_GRP_6030 | P3_GRP_6030; + + /* For 6030, set the off state for all grps enabled */ + ret = twlreg_write(info, TWL_MODULE_PM_RECEIVER, VREG_STATE, + (grp) << TWL6030_CFG_STATE_GRP_SHIFT | + TWL6030_CFG_STATE_OFF); return ret; } @@ -485,7 +482,7 @@ static struct regulator_ops twl4030ldo_ops = { .get_voltage = twl4030ldo_get_voltage, .enable = twl4030reg_enable, - .disable = twlreg_disable, + .disable = twl4030reg_disable, .is_enabled = twl4030reg_is_enabled, .set_mode = twl4030reg_set_mode, @@ -543,7 +540,7 @@ static struct regulator_ops twl6030ldo_ops = { .get_voltage = twl6030ldo_get_voltage, .enable = twl6030reg_enable, - .disable = twlreg_disable, + .disable = twl6030reg_disable, .is_enabled = twl6030reg_is_enabled, .set_mode = twl6030reg_set_mode, @@ -576,7 +573,7 @@ static struct regulator_ops twl4030fixed_ops = { .get_voltage = twlfixed_get_voltage, .enable = twl4030reg_enable, - .disable = twlreg_disable, + .disable = twl4030reg_disable, .is_enabled = twl4030reg_is_enabled, .set_mode = twl4030reg_set_mode, @@ -590,7 +587,7 @@ static struct regulator_ops twl6030fixed_ops = { .get_voltage = twlfixed_get_voltage, .enable = twl6030reg_enable, - .disable = twlreg_disable, + .disable = twl6030reg_disable, .is_enabled = twl6030reg_is_enabled, .set_mode = twl6030reg_set_mode, @@ -600,7 +597,7 @@ static struct regulator_ops twl6030fixed_ops = { static struct regulator_ops twl6030_fixed_resource = { .enable = twl6030reg_enable, - .disable = twlreg_disable, + .disable = twl6030reg_disable, .is_enabled = twl6030reg_is_enabled, .get_status = twl6030reg_get_status, };