From patchwork Wed Jan 28 02:46:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 5724011 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 31ECCBFFA8 for ; Wed, 28 Jan 2015 02:48:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6DEB72024F for ; Wed, 28 Jan 2015 02:48:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83B03201DD for ; Wed, 28 Jan 2015 02:48:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933520AbbA1Cry (ORCPT ); Tue, 27 Jan 2015 21:47:54 -0500 Received: from seldrel01.sonyericsson.com ([212.209.106.2]:18631 "EHLO seldrel01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933484AbbA1CrA (ORCPT ); Tue, 27 Jan 2015 21:47:00 -0500 From: Bjorn Andersson To: Liam Girdwood , Mark Brown CC: , , , , Subject: [PATCH 6/9] regulator: hi6421: move to set_optimum_mode Date: Tue, 27 Jan 2015 18:46:36 -0800 Message-ID: <1422413199-17273-7-git-send-email-bjorn.andersson@sonymobile.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1422413199-17273-1-git-send-email-bjorn.andersson@sonymobile.com> References: <1422413199-17273-1-git-send-email-bjorn.andersson@sonymobile.com> MIME-Version: 1.0 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_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 Signed-off-by: Bjorn Andersson --- drivers/regulator/hi6421-regulator.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/regulator/hi6421-regulator.c b/drivers/regulator/hi6421-regulator.c index 42dc5fb..42b362d 100644 --- a/drivers/regulator/hi6421-regulator.c +++ b/drivers/regulator/hi6421-regulator.c @@ -477,15 +477,18 @@ static int hi6421_regulator_buck_set_mode(struct regulator_dev *rdev, return 0; } -unsigned int hi6421_regulator_ldo_get_optimum_mode(struct regulator_dev *rdev, +static int hi6421_regulator_ldo_set_optimum_mode(struct regulator_dev *rdev, int input_uV, int output_uV, int load_uA) { struct hi6421_regulator_info *info = rdev_get_drvdata(rdev); + unsigned int mode; if (load_uA > info->eco_microamp) - return REGULATOR_MODE_NORMAL; + mode = REGULATOR_MODE_NORMAL; + else + mode = REGULATOR_MODE_IDLE; - return REGULATOR_MODE_IDLE; + return hi6421_regulator_ldo_set_mode(rdev, mode); } static const struct regulator_ops hi6421_ldo_ops = { @@ -498,7 +501,7 @@ static const struct regulator_ops hi6421_ldo_ops = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .get_mode = hi6421_regulator_ldo_get_mode, .set_mode = hi6421_regulator_ldo_set_mode, - .get_optimum_mode = hi6421_regulator_ldo_get_optimum_mode, + .set_optimum_mode = hi6421_regulator_ldo_set_optimum_mode, }; static const struct regulator_ops hi6421_ldo_linear_ops = { @@ -511,7 +514,7 @@ static const struct regulator_ops hi6421_ldo_linear_ops = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .get_mode = hi6421_regulator_ldo_get_mode, .set_mode = hi6421_regulator_ldo_set_mode, - .get_optimum_mode = hi6421_regulator_ldo_get_optimum_mode, + .set_optimum_mode = hi6421_regulator_ldo_set_optimum_mode, }; static const struct regulator_ops hi6421_ldo_linear_range_ops = { @@ -524,7 +527,7 @@ static const struct regulator_ops hi6421_ldo_linear_range_ops = { .set_voltage_sel = regulator_set_voltage_sel_regmap, .get_mode = hi6421_regulator_ldo_get_mode, .set_mode = hi6421_regulator_ldo_set_mode, - .get_optimum_mode = hi6421_regulator_ldo_get_optimum_mode, + .set_optimum_mode = hi6421_regulator_ldo_set_optimum_mode, }; static const struct regulator_ops hi6421_buck012_ops = {