From patchwork Wed Jan 28 02:46:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 5724041 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 284539F2CA for ; Wed, 28 Jan 2015 02:48:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 69F9E2025A for ; Wed, 28 Jan 2015 02:48:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9B232201ED for ; Wed, 28 Jan 2015 02:48:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933897AbbA1CsZ (ORCPT ); Tue, 27 Jan 2015 21:48:25 -0500 Received: from seldrel01.sonyericsson.com ([212.209.106.2]:18575 "EHLO seldrel01.sonyericsson.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933417AbbA1Cqy (ORCPT ); Tue, 27 Jan 2015 21:46:54 -0500 From: Bjorn Andersson To: Liam Girdwood , Mark Brown , CC: , , , Subject: [PATCH 4/9] regulator: wm831x-ldo: move to set_optimum_mode Date: Tue, 27 Jan 2015 18:46:34 -0800 Message-ID: <1422413199-17273-5-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/wm831x-ldo.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c index 7ae2dc8..40d391e 100644 --- a/drivers/regulator/wm831x-ldo.c +++ b/drivers/regulator/wm831x-ldo.c @@ -186,15 +186,20 @@ static int wm831x_gp_ldo_get_status(struct regulator_dev *rdev) return regulator_mode_to_status(ret); } -static unsigned int wm831x_gp_ldo_get_optimum_mode(struct regulator_dev *rdev, - int input_uV, - int output_uV, int load_uA) +static int wm831x_gp_ldo_set_optimum_mode(struct regulator_dev *rdev, + int input_uV, + int output_uV, int load_uA) { + unsigned int mode; + if (load_uA < 20000) - return REGULATOR_MODE_STANDBY; - if (load_uA < 50000) - return REGULATOR_MODE_IDLE; - return REGULATOR_MODE_NORMAL; + mode = REGULATOR_MODE_STANDBY; + else if (load_uA < 50000) + mode = REGULATOR_MODE_IDLE; + else + mode = REGULATOR_MODE_NORMAL; + + return wm831x_gp_ldo_set_mode(rdev, mode); } @@ -207,7 +212,7 @@ static struct regulator_ops wm831x_gp_ldo_ops = { .get_mode = wm831x_gp_ldo_get_mode, .set_mode = wm831x_gp_ldo_set_mode, .get_status = wm831x_gp_ldo_get_status, - .get_optimum_mode = wm831x_gp_ldo_get_optimum_mode, + .set_optimum_mode = wm831x_gp_ldo_set_optimum_mode, .get_bypass = regulator_get_bypass_regmap, .set_bypass = regulator_set_bypass_regmap,