From patchwork Wed Oct 29 11:14:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5186561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 40DAEC11AC for ; Wed, 29 Oct 2014 11:17:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 545852024F for ; Wed, 29 Oct 2014 11:17:43 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 728312024C for ; Wed, 29 Oct 2014 11:17:42 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjRE8-00072q-4u; Wed, 29 Oct 2014 11:15:44 +0000 Received: from mailout2.w1.samsung.com ([210.118.77.12]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XjRDv-0006qX-Jv for linux-arm-kernel@lists.infradead.org; Wed, 29 Oct 2014 11:15:32 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout2.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NE700A7QE1XB590@mailout2.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 29 Oct 2014 11:17:57 +0000 (GMT) X-AuditID: cbfec7f5-b7f956d000005ed7-13-5450cc3c2a43 Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 93.94.24279.C3CC0545; Wed, 29 Oct 2014 11:15:08 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NE700E5QDX28D70@eusync4.samsung.com>; Wed, 29 Oct 2014 11:15:08 +0000 (GMT) From: Krzysztof Kozlowski To: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, Ben Dooks , Kukjin Kim , Russell King , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v6 1/3] regulator: max77686: Add suspend disable for some LDOs Date: Wed, 29 Oct 2014 12:14:52 +0100 Message-id: <1414581294-1315-2-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1414581294-1315-1-git-send-email-k.kozlowski@samsung.com> References: <1414581294-1315-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFLMWRmVeSWpSXmKPExsVy+t/xa7o2ZwJCDCZslrbYOGM9q8WkdQeY LKY+fMJmcf3Lc1aL+UfOsVoc/V1g8fqFoUXvgqtsFmeb3rBbfLvSwWSx6fE1VovLu+awWcw4 v4/J4vZlXou1R+6yO/B7tDT3sHn8fX6dxePvqhfMHjtn3WX32LSqk81j85J6j74tqxg9Pm+S C+CI4rJJSc3JLEst0rdL4Mro2X2BraBXvOLmohVMDYwPhLsYOTkkBEwkbkyZxwxhi0lcuLee rYuRi0NIYCmjxPvj15ghnD4miRfX/4JVsQkYS2xevoQNxBYR2M8k8XiCCUgRs8BqJomfV06B FQkL+Emc3XuMEcRmEVCV+Lv2PROIzSvgJvHr+BUWiHVyEiePTWYFsTkF3CU+7m5jB7GFgGo2 /+hkmcDIu4CRYRWjaGppckFxUnqukV5xYm5xaV66XnJ+7iZGSPh+3cG49JjVIUYBDkYlHt6I YwEhQqyJZcWVuYcYJTiYlUR43+0FCvGmJFZWpRblxxeV5qQWH2Jk4uCUamBcfemk8389M/7p l/g2djtx127f9sWtl/m5WXjqh9mcs6K4upa3nDcyCM3nfX1oCcsPt9y2uqkZt9evr5tvpKO3 ZdGiiQfNF9uesLsxyZv3VSVjZE7NUn6uA7bf2y5uz322yGJN3cL7Xhv9MhZbfH4VZinxPUhp WXnTpDhpyx4DAVHNnr59cz4psRRnJBpqMRcVJwIAhhipxD0CAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20141029_041531_807184_1CD8400B X-CRM114-Status: GOOD ( 11.87 ) X-Spam-Score: -5.6 (-----) Cc: Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Chanwoo Choi , Kyungmin Park , Javier Martinez Canillas , Marek Szyprowski X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Some LDOs of Maxim 77686 PMIC support disabling during system suspend (LDO{2,6,7,8,10,11,12,14,15,16}). This was already implemented as part of set_suspend_mode function. In that case the mode was one of: - disable, - normal mode, - low power mode. However there are no bindings for setting the mode during suspend. Add suspend disable for LDO regulators supporting this. Re-use existing max77686_buck_set_suspend_disable() function. This helps reducing energy consumption during system sleep. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Javier Martinez Canillas --- drivers/regulator/max77686.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index 2ebc4257425b..f960cfc7fdc6 100644 --- a/drivers/regulator/max77686.c +++ b/drivers/regulator/max77686.c @@ -99,8 +99,8 @@ static unsigned int max77686_get_opmode_shift(int id) } } -/* Some BUCKS supports Normal[ON/OFF] mode during suspend */ -static int max77686_buck_set_suspend_disable(struct regulator_dev *rdev) +/* Some BUCKs and LDOs supports Normal[ON/OFF] mode during suspend */ +static int max77686_set_suspend_disable(struct regulator_dev *rdev) { unsigned int val, shift; struct max77686_data *max77686 = rdev_get_drvdata(rdev); @@ -195,6 +195,9 @@ static int max77686_enable(struct regulator_dev *rdev) shift = max77686_get_opmode_shift(id); + if (max77686->opmode[id] == MAX77686_OFF_PWRREQ) + max77686->opmode[id] = MAX77686_NORMAL; + return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, rdev->desc->enable_mask, max77686->opmode[id] << shift); @@ -247,6 +250,7 @@ static struct regulator_ops max77686_ldo_ops = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_time_sel = regulator_set_voltage_time_sel, .set_suspend_mode = max77686_ldo_set_suspend_mode, + .set_suspend_disable = max77686_set_suspend_disable, }; static struct regulator_ops max77686_buck1_ops = { @@ -258,7 +262,7 @@ static struct regulator_ops max77686_buck1_ops = { .get_voltage_sel = regulator_get_voltage_sel_regmap, .set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_time_sel = regulator_set_voltage_time_sel, - .set_suspend_disable = max77686_buck_set_suspend_disable, + .set_suspend_disable = max77686_set_suspend_disable, }; static struct regulator_ops max77686_buck_dvs_ops = { @@ -271,7 +275,7 @@ static struct regulator_ops max77686_buck_dvs_ops = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .set_voltage_time_sel = regulator_set_voltage_time_sel, .set_ramp_delay = max77686_set_ramp_delay, - .set_suspend_disable = max77686_buck_set_suspend_disable, + .set_suspend_disable = max77686_set_suspend_disable, }; #define regulator_desc_ldo(num) { \