Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp19852imm; Wed, 30 May 2018 16:40:17 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKVR816s3SN3kCn9vXHLEiBhIDlBtqXuONiRnpW+lxShMrCi+vexWEoF16hAQ37XajH9rQM X-Received: by 2002:a63:43c6:: with SMTP id q189-v6mr3802986pga.123.1527723617857; Wed, 30 May 2018 16:40:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527723617; cv=none; d=google.com; s=arc-20160816; b=rlL6NW+YuIIvg6IZ3dqs0G2n1neRouCYdR2/n/Ab+v4G8PtI9J3Opk9QjTgd46ODpg tGx9LJLnJv0jpW9xtwiawI3eGq+eCJFEBOYVcuVoz7ucku82pEGUoqB7tJLkoGDBmqSp BBYl4dffuxjpLKAoZPND6CAM7sY46I/rvN75pZc3RDYR5qvgbuw535ow3wHJa+f4Ltk3 gEIva8jDQu+HSjU3qyum462MplHN5bq5c0wIpS2/0NTStjW3IsgayOYIDm7N726bi2hH +9/X1Gr9h2XDTjmDGNXP392aLwYLy3n1lkD7+ngjqfj8dfd4lsSAf6rMktsOZtx35UTR 9wAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature:arc-authentication-results; bh=txfZ6fFL8tLPJuvLpa0Yn8mgnxkOL3k9/FG8JQdtHXY=; b=wfTG52wrREnhRdWzhsgwMvjDGuNAwmBNHUq0jMt1fGM29BOX5FvAgS9bmr7irr8kfb qiNDHSQoPb7KnQC/5ClTduCQHSYCBln8BlPxlZwSH6POe1sL51NyIXaO6D8sXE5Gyqok mYwy/eKX3JYop++IpOm2hHQXYbhGhCdfK/2YnKgS/2v/INlf/7dHQ4UzRpHvCXk7mzDA O+dxDMNK+jQP5ve41Tdq2KNhcMTDuD01e4LMACvRP7cRJFns+9SwjJUsAI7DNpnmY8Ey TdtrqHJpQB4TBgq2sIKjlrHOcW/IHv7OwRmh4UuosiAETqS8fsg86P4xvAn4OgZ8Inw4 E+IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=pEOfGiVu; dkim=pass header.i=@codeaurora.org header.s=default header.b=fyN8/GNZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 99-v6si35455315plc.362.2018.05.30.16.40.04; Wed, 30 May 2018 16:40:17 -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; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=pEOfGiVu; dkim=pass header.i=@codeaurora.org header.s=default header.b=fyN8/GNZ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932603AbeE3XjQ (ORCPT + 99 others); Wed, 30 May 2018 19:39:16 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:59770 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932408AbeE3XjN (ORCPT ); Wed, 30 May 2018 19:39:13 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id EF5F160708; Wed, 30 May 2018 23:39:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527723552; bh=1cmfmnpJjVUAn35wbdXIETvxPiPoUDMK2REibSSw7Kg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=pEOfGiVuPr/VdXJmIXbCJ88CTqwV3DOpdTrVP0FhcgvM1G6aguS+czTTIpGT5+caV YkaY9ffcJaJhM4db45eFccB/JCv2iYZPfdNk6TG2cBKu65U/8Lx0t36C0UxXC168RR UYhD3Xvm2NtrBy3IeQ8jUag3OBJRncVqVhu3c5kg= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.8 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_SIGNED,T_DKIM_INVALID autolearn=no autolearn_force=no version=3.4.0 Received: from [10.46.160.165] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: collinsd@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4242E6063A; Wed, 30 May 2018 23:39:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1527723551; bh=1cmfmnpJjVUAn35wbdXIETvxPiPoUDMK2REibSSw7Kg=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=fyN8/GNZyAJrJwdgbnuo5wVOHsy9zQs2uICAy2PChS5c1H+JkH04cU2pQl9mrBkuy Tefsq5fwvJZyz+jOfFLgXcC9CAlGHPiElG3nsFaSrcetLN66w+dymOCQo5JJztHZje A39BYcpfFurEnM11A1KVUNO1M6u+ukJLCn/a3nsY= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4242E6063A Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=collinsd@codeaurora.org Subject: Re: [PATCH v4 1/2] regulator: dt-bindings: add QCOM RPMh regulator bindings To: Doug Anderson , Mark Brown Cc: Liam Girdwood , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, Linux ARM , devicetree@vger.kernel.org, LKML , Rajendra Nayak , Stephen Boyd References: <6d03576cf90f06afb1194301cb41fc31704def1d.1527040878.git.collinsd@codeaurora.org> <20180530103720.GH6920@sirena.org.uk> <20180530155044.GR6920@sirena.org.uk> <20180530162007.GU6920@sirena.org.uk> From: David Collins Message-ID: <75088820-f20d-32ac-780a-5e7dacdf20ff@codeaurora.org> Date: Wed, 30 May 2018 16:39:10 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello Mark and Doug, On 05/30/2018 09:24 AM, Doug Anderson wrote: > On Wed, May 30, 2018 at 9:20 AM, Mark Brown wrote: >> On Wed, May 30, 2018 at 09:12:25AM -0700, Doug Anderson wrote: >>> On Wed, May 30, 2018 at 8:50 AM, Mark Brown wrote: >> >>>> No, I'm saying that I don't know why that property exists at all. This >>>> sounds like it's intended to be the amount of current the regulator can >>>> deliver in each mode which is normally a design property of the silicon. >> >>> Ah, got it. So the whole point here is to be able to implement either >>> the function "set_load" or the function "get_optimum_mode". We need >>> some sort of table to convert from current to mode. That's what this >>> table does. >> >> We do need that table, my expectation would be that this table would be >> in the driver as it's not something I'd expect to vary between different >> systems but rather be a property of the silicon design. No sense in >> every single board having to copy it in. > > Ah, got it! I'd be OK with it being hardcoded in the driver. > > At one point I think David was making the argument that some boards > have different noise needs for the rails and thus you might want to > change modes at different currents. I don't know if this is realistic > but I believe it was part of his original argument for why this needed > to be specified. If we can hardcode this in the driver I'm fine with > it... That would actually solve many of my objections too... The DRMS modes to use and max allowed current per mode need to be specified at the board level in device tree instead of hard-coded per regulator type in the driver. There are at least two use cases driving this need: LDOs shared between RPMh client processors and SMPSes requiring PWM mode in certain circumstances. For LDOs the maximum low power mode (LPM) current is typically 10 mA or 30 mA (depending upon subtype) per hardware documentation. Unfortunately, sharing control of regulators with other processors adds some subtlety to the LPM current limit that should actually be applied at runtime. Consider the case of a regulator with physical 10 mA LPM max current. Say that modem and application processors each have a load on the regulator that draws 9 mA. If they each respect the 10 mA limit, then they'd each vote for LPM. The VRM block in RPMh hardware will aggregate these requests together using a max function which will result in the regulator being set to LPM, even though the total load is 18 mA (which would require high power mode (HPM)). To get around this corner case, a LPM max current of 1 uA can be used for all LDO supplies that have non-application processor consumers. Thus, any non-zero regulator_set_load() current request will result in setting the regulator to HPM (which is always safe). The second situation that needs board-level DRMS mode and current limit specification is SMPS regulator AUTO mode to PWM (HPM) mode switching. SMPS regulators should theoretically always be able to operate in AUTO mode as it switches automatically between PWM mode (which can provide the maximum current) and PFM mode (which supports lower current but has higher efficiency). However, there may be board/system issues that require switching to PWM mode for certain use cases as it has better load regulation (i.e. no PFM ripple for lower loads) and supports more aggressive load current steps (i.e. greater A/ns). If a Linux consumer requires the ability to force a given SMPS regulator from AUTO mode into PWM mode and that SMPS is shared by other Linux consumers (which may be the case, but at least must be guaranteed to work architecturally), then regulator_set_load() is the only option since it provides aggregation, where as regulator_set_mode() does not. regulator_set_load() can be utilized in this case by specifying AUTO mode and PWM mode as drms modes and specifying some particular AUTO mode maximum current (that is known by the consumer) in device tree. The consumer can then call regulator_set_load() with the imposed AUTO mode limit + delta when PWM mode is required and a lower value when AUTO mode is sufficient. Note that I previously mentioned the need for board-level drms mode and current limit specification in [1]. Take care, David [1]: https://lkml.org/lkml/2018/3/22/802 -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project