From patchwork Sat Aug 15 03:11:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 52464 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f197.google.com (mail-wi0-f197.google.com [209.85.212.197]) by patches.linaro.org (Postfix) with ESMTPS id A0E8522B12 for ; Sat, 15 Aug 2015 03:12:26 +0000 (UTC) Received: by wilj18 with SMTP id j18sf11659904wil.0 for ; Fri, 14 Aug 2015 20:12:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:date:from:to:cc:subject:message-id :references:mime-version:content-type:content-disposition :in-reply-to:user-agent:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=UIk4P69QO7Scwcp3CzDfKZX8FtVL6vHZUMIvucxoWcI=; b=jfj1lQlHH0a3y2tRx/kyNWPDPA+oYSyx4MsKL/H1o0vUcY3kM8eLERm7Sr4WAUcaaB +VG47iIIggBCikTq6jvGK+mlIPB2N1wFzU8dUhWLxZ2G2QLB/1Yt7yHjfj6NpYzAlCI5 VrHTNyz4Pi+/lEbOuBSWVkZVsWbPbiS9mBjOaNP/xL5UvR3uwpMnO1wCeSFTlGAw8mqq JeUwda0KwUwS02/Ba0b04D7QQZfXOtAevHlwry1X6Z+XO63ruz/tNZvlJVRmXTuxreyd n6X2jRkGjqBowgq8OgYhu+mb8i8zq5M1H8cjAtUvF6ALhDGkAwUHabjKTT5LEBc2MM9h qkGg== X-Gm-Message-State: ALoCoQnAQjl23SAcjBzA0NVw+XD0kiic7DEq4RBLpQVXoui/wLNbs49Zf7hmZcY5gWZrArvUn8HW X-Received: by 10.112.167.201 with SMTP id zq9mr1631007lbb.2.1439608345898; Fri, 14 Aug 2015 20:12:25 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.88.7 with SMTP id bc7ls450097lab.74.gmail; Fri, 14 Aug 2015 20:12:25 -0700 (PDT) X-Received: by 10.112.12.102 with SMTP id x6mr47038558lbb.80.1439608345583; Fri, 14 Aug 2015 20:12:25 -0700 (PDT) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com. [209.85.217.179]) by mx.google.com with ESMTPS id dc7si7219077lad.31.2015.08.14.20.12.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Aug 2015 20:12:25 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) client-ip=209.85.217.179; Received: by lbbtg9 with SMTP id tg9so55579963lbb.1 for ; Fri, 14 Aug 2015 20:12:25 -0700 (PDT) X-Received: by 10.152.29.132 with SMTP id k4mr26649680lah.88.1439608345106; Fri, 14 Aug 2015 20:12:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.7.198 with SMTP id l6csp57429lba; Fri, 14 Aug 2015 20:12:23 -0700 (PDT) X-Received: by 10.70.101.200 with SMTP id fi8mr47901580pdb.139.1439608342741; Fri, 14 Aug 2015 20:12:22 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id cb12si3436330pdb.170.2015.08.14.20.12.21; Fri, 14 Aug 2015 20:12:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753016AbbHODL5 (ORCPT + 28 others); Fri, 14 Aug 2015 23:11:57 -0400 Received: from mail-pa0-f41.google.com ([209.85.220.41]:34390 "EHLO mail-pa0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752015AbbHODLz (ORCPT ); Fri, 14 Aug 2015 23:11:55 -0400 Received: by paccq16 with SMTP id cq16so27625471pac.1 for ; Fri, 14 Aug 2015 20:11:54 -0700 (PDT) X-Received: by 10.68.69.108 with SMTP id d12mr95571469pbu.24.1439608314681; Fri, 14 Aug 2015 20:11:54 -0700 (PDT) Received: from localhost ([122.171.186.190]) by smtp.gmail.com with ESMTPSA id k5sm7522402pdo.48.2015.08.14.20.11.53 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 14 Aug 2015 20:11:54 -0700 (PDT) Date: Sat, 15 Aug 2015 08:41:49 +0530 From: Viresh Kumar To: Mark Brown Cc: linaro-kernel@lists.linaro.org, sboyd@codeaurora.org, nm@ti.com, Liam Girdwood , "open list:VOLTAGE AND CURRENT REGULATOR FRAMEWORK" Subject: Re: [PATCH] regulator: core: Define regulator_set_voltage_triplet() Message-ID: <20150815031149.GD1162@linux> References: <28971ff9b110d18970fcc6291531f617cda18230.1439553400.git.viresh.kumar@linaro.org> <20150814162506.GV10748@sirena.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150814162506.GV10748@sirena.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.179 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On 14-08-15, 17:25, Mark Brown wrote: > On Fri, Aug 14, 2015 at 05:30:55PM +0530, Viresh Kumar wrote: > > > The OPP (Operating performance points) v2 bindings allows regulator > > voltage to be supplied as a triplet of voltages. > > Looking at this I really don't understand why you tried to get me to > review this via an IRC pastebin instead of following the normal patch > submission process. Please don't do that, it's not at all helpful. IRC > can be useful for interactive discussions or things that are really > urgent, not for normal upstream code review. Okay. > > +static inline int regulator_set_voltage_triplet(struct regulator *regulator, > > + int target_uV, int min_uV, > > + int max_uV) > > This seems awkward, these things are normally written as min <= target > <= max but this is target, min, max. Hmm.. > > static inline int regulator_set_voltage_tol(struct regulator *regulator, > > int new_uV, int tol_uV) > > { > > -- > > 2.4.0 > > You've not added a stub for the new function. This function will always be present as its not part of the #ifdef CONFIG_REGULATOR region. And so the stub isn't required. Hopefully below version looks better ? --------------------------------8<-------------------------------------- Message-Id: <3d0154d897bba396c5018cf3b3562871af4ca844.1439608146.git.viresh.kumar@linaro.org> From: Viresh Kumar Date: Fri, 14 Aug 2015 15:06:10 +0530 Subject: [PATCH] regulator: core: Define regulator_set_voltage_triplet() The OPP (Operating performance points) v2 bindings allows regulator voltage to be supplied as a triplet of voltages. Add regulator_set_voltage_triplet() API in regulator core to support that. This first tries to set a voltage between the target voltage and the upper limit, then fall back on the full range. The idea behind this is to set regulator's voltage as close to the target voltage, as possible. Based on regulator_set_voltage_tol(). Signed-off-by: Viresh Kumar --- include/linux/regulator/consumer.h | 10 ++++++++++ 1 file changed, 10 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index f8a689ed62a5..a6269c184b8c 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -552,6 +552,16 @@ static inline int regulator_count_voltages(struct regulator *regulator) } #endif +static inline int regulator_set_voltage_triplet(struct regulator *regulator, + int min_uV, int target_uV, + int max_uV) +{ + if (!regulator_set_voltage(regulator, target_uV, max_uV)) + return 0; + + return regulator_set_voltage(regulator, min_uV, max_uV); +} + static inline int regulator_set_voltage_tol(struct regulator *regulator, int new_uV, int tol_uV) {