Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp513879imm; Thu, 31 May 2018 04:49:51 -0700 (PDT) X-Google-Smtp-Source: ADUXVKK1bn/SIYPQxUVniPbeitFuqc4gr+uyOcr4xPAZ0m5kTfFE/jfX5+XesOOIDcjqXzr88QvS X-Received: by 2002:a63:7e51:: with SMTP id o17-v6mr5107033pgn.398.1527767391830; Thu, 31 May 2018 04:49:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527767391; cv=none; d=google.com; s=arc-20160816; b=f9mTMlPvBlEXv+MlD+ShzHlpnwM0/hlIYDnagLvhT+mT2vYkMlL6fBBlRsBO1CuSjO eWpncZ0DWSc/dpSo80cxtP7V99+1EQdUMDR3rvBLEJis1IfeZqMVxW9twei0XgUlCPb9 kUQ/aOQaHbcDbFg+4b/cdgTQ/jCm+KdSVk7H8BlIj352MldMoVX7Qb1EeE35/SZjYrvi a1YlYefyzqW4l+Fe/1IvyLrKe2qDKqZWqBl9pvwU5dOePtN/pPeeIVKK9gmf6ERTakqX YTmx/Kbu+TVgyJQBRXI2n64II5Q31htVfnDoMstnJVlVMkqT4zgcvxw0b0eQetBHiX1S ijrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=z5Ht97/qPs1XZ+XR4C9ZaFxBYxZ/VsSxwUJTb/HX1sQ=; b=QuFEOq5JcgAhHyBG/qb6vLfTA6jJTPeZC7mG2StAUfRJ+xfJcRR2lPig/0n3GeCIxK 0rHtkC4rG52QJEqa6tVEeDnV7e4bJLITuuq3mrIec9vK5NnJay1NAqC98vXJizCFe9gM WriyPAYY4yuXoBVW4q0Ej6Pa5ySXls6sbjfcaEEMOWH7ypGwXZiX6xfO4V+pDtAbGu8i rdyU3SbwLiaV1qDGZ15ACKfCqDjhY3KgGikrhudjUYCMz3XPp6utiaH/f7NbMJPSMZz1 EeYPTeDzfzlDMV+pyWljY2W1dL/oefjfnao43dJu7DgxIs8wLf1NGVkUZO2OuohlANcY KUAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=v83TRlx8; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r10-v6si26736849pgp.363.2018.05.31.04.49.37; Thu, 31 May 2018 04:49:51 -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=fail header.i=@sirena.org.uk header.s=20170815-heliosphere header.b=v83TRlx8; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754807AbeEaLsX (ORCPT + 99 others); Thu, 31 May 2018 07:48:23 -0400 Received: from heliosphere.sirena.org.uk ([172.104.155.198]:36406 "EHLO heliosphere.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754522AbeEaLsU (ORCPT ); Thu, 31 May 2018 07:48:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sirena.org.uk; s=20170815-heliosphere; h=In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=z5Ht97/qPs1XZ+XR4C9ZaFxBYxZ/VsSxwUJTb/HX1sQ=; b=v83TRlx8A5Mfaw+LgwJAip/lj gCFvG0agWUPhWPvMLb88OtNzds9vkgRNC5UFnkb0P4OMxPGaa4R0HZamx0qdI17UQmuTwJrhwxPLd asyHLwYGk+A1LglwrilkIts7wk8hkeTL4YYBHfDo38pXGwzAsnB+Y0g48K3ug49SJc9m4=; Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by heliosphere.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOM41-0000Cn-1k; Thu, 31 May 2018 11:48:17 +0000 Received: from broonie by debutante with local (Exim 4.91) (envelope-from ) id 1fOM40-0003WT-D2; Thu, 31 May 2018 12:48:16 +0100 Date: Thu, 31 May 2018 12:48:16 +0100 From: Mark Brown To: David Collins Cc: Doug Anderson , Liam Girdwood , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, Linux ARM , devicetree@vger.kernel.org, LKML , Rajendra Nayak , Stephen Boyd Subject: Re: [PATCH v4 1/2] regulator: dt-bindings: add QCOM RPMh regulator bindings Message-ID: <20180531114816.GC13319@sirena.org.uk> References: <6d03576cf90f06afb1194301cb41fc31704def1d.1527040878.git.collinsd@codeaurora.org> <20180530103720.GH6920@sirena.org.uk> <20180530155044.GR6920@sirena.org.uk> <20180530162007.GU6920@sirena.org.uk> <75088820-f20d-32ac-780a-5e7dacdf20ff@codeaurora.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="xesSdrSSBC0PokLI" Content-Disposition: inline In-Reply-To: <75088820-f20d-32ac-780a-5e7dacdf20ff@codeaurora.org> X-Cookie: I've read SEVEN MILLION books!! User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --xesSdrSSBC0PokLI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, May 30, 2018 at 04:39:10PM -0700, David Collins wrote: > 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. Is there really no way to improve the RPM firmware? > 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 This is, of course, why the regulator API aggregates this stuff based on the current not based on having every individual user select a mode. > 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). That's obviously just never going to work well, the best you can do here is just pretend that the other components are always operating at full power (which I assume all the other components are doing too...) or not try to use load based mode switching in the first place. > 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. That's obviously broken though, what you're describing is just clearly nothing to do with load so trying to configure it using load is just going to lead to problems later on. Honestly it sounds like you just want to force the regulator into forced PWM mode all the time, otherwise you need to look into implementing support for describing the thing you're actually trying to do and add a mechanism for per consumer mode configuration. This has been a frequent pattern with these RPM drivers, trying to find some way to shoehorn something that happens to work right now into the code. That's going to make things fragile and hard to maintain, we need code that does the thing it's saying it does so that it's easier to understand and work with - getting things running isn't enough, they need to be clear. --xesSdrSSBC0PokLI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAlsP4P8ACgkQJNaLcl1U h9BZQgf+I/wVcjtOanB4eFLuRoPbjP9O9H6RSWlJp+LFFwEULGP49jMLGuqIeLzK mqSzLLeiX5EylzIBQQO9bpRriFg3RVYPu5FOJzUenu6oFqlJjEFO2ALlU0ONDcrG OJjFt2J1aLQcoQANqFPDWVfXuJxQPQvBP0spKNqshU6MjoOhHL2o0Agks2QPA7LE nMh0N+zMQbggfDkYRqWFGWq3i9wYqilj6MgHEJD5h1yoAF97Hgr7iPM/XDVDFk4R h3v5rkWRgCdou4VvKvg4RAKrCjKnZ86FQsQC2LaBHsnIpwSw82f9byBGc6W9MX9F JVLIY/r+xiLxURg68B6Hk5L7SUPmaA== =+MsJ -----END PGP SIGNATURE----- --xesSdrSSBC0PokLI--