From patchwork Mon Oct 27 12:11:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 5159871 Return-Path: X-Original-To: patchwork-linux-samsung-soc@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 3F948C11AC for ; Mon, 27 Oct 2014 12:12:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6CDB3202F8 for ; Mon, 27 Oct 2014 12:12:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F1D8F20340 for ; Mon, 27 Oct 2014 12:12:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751862AbaJ0MMI (ORCPT ); Mon, 27 Oct 2014 08:12:08 -0400 Received: from mailout3.w1.samsung.com ([210.118.77.13]:35561 "EHLO mailout3.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752097AbaJ0MMF (ORCPT ); Mon, 27 Oct 2014 08:12:05 -0400 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NE300JMZRCUT830@mailout3.w1.samsung.com>; Mon, 27 Oct 2014 12:14:54 +0000 (GMT) X-AuditID: cbfec7f4-b7f6c6d00000120b-21-544e3692d81d Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 36.AC.04619.2963E445; Mon, 27 Oct 2014 12:12:02 +0000 (GMT) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NE300EP2R7U7E10@eusync1.samsung.com>; Mon, 27 Oct 2014 12:12:02 +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 Cc: Kyungmin Park , Marek Szyprowski , Bartlomiej Zolnierkiewicz , Javier Martinez Canillas , Chanwoo Choi , Krzysztof Kozlowski Subject: [PATCH v5 3/4] regulator: max77686: Add suspend disable for some LDOs Date: Mon, 27 Oct 2014 13:11:49 +0100 Message-id: <1414411911-5539-4-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1414411911-5539-1-git-send-email-k.kozlowski@samsung.com> References: <1414411911-5539-1-git-send-email-k.kozlowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrFLMWRmVeSWpSXmKPExsVy+t/xy7qTzPxCDP6/F7LYOGM9q8WkdQeY LKY+fMJmcf3Lc1aL+UfOsVoc/V1g8fqFoUXvgqtsFmeb3rBbfLvSwWSx6fE1VovLu+awWcw4 v4/J4vZlXou1R+6yO/B7tDT3sHn8fX6dxePvqhfMHjtn3WX32LSqk81j85J6j74tqxg9Pm+S C+CI4rJJSc3JLEst0rdL4Mr4t3Y2c8Ex8YrJrftZGhgniHQxcnJICJhILLu9iQ3CFpO4cG89 kM3FISSwlFFi6dnljBBOH5PE8rXv2UGq2ASMJTYvXwLWISKwn0ni8QQTkCJmgdVMEj+vnGIG SQgL+ElsXnYCrIFFQFXi0Np7YHFeATeJxuP7mCDWyUmcPDaZFcTmFHCXeDOnjRHEFgKqWXbq IfsERt4FjAyrGEVTS5MLipPScw31ihNzi0vz0vWS83M3MULC98sOxsXHrA4xCnAwKvHw7pjm GyLEmlhWXJl7iFGCg1lJhNfxJ1CINyWxsiq1KD++qDQntfgQIxMHp1QDo/lxvXvuTleO7S2c piEk+FrCQTDfS+GreoeQRwmv3cZzN+cLa92fYMR3KqPUS2X3+YdKUT/LRBz2PP9w9dbS6b6L znszuXd1JOoErxIx65Hd0i6rssbI9Jd5qYjLW96/9iuz3vkZR7b57XCJqV1iMnfdr9scWhOE /uyYEGYYU/NTd5uZlJOSEktxRqKhFnNRcSIAdsmfqj0CAAA= Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c index 2ebc4257425b..c6bf6f79bd2a 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,8 @@ 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, + .set_suspend_enable = max77686_enable, }; static struct regulator_ops max77686_buck1_ops = { @@ -258,7 +263,8 @@ 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, + .set_suspend_enable = max77686_enable, }; static struct regulator_ops max77686_buck_dvs_ops = { @@ -271,7 +277,8 @@ 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, + .set_suspend_enable = max77686_enable, }; #define regulator_desc_ldo(num) { \