Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp4171470ima; Mon, 4 Feb 2019 11:26:08 -0800 (PST) X-Google-Smtp-Source: AHgI3IaSq+MEO+rNESdLbErMK0hJS5rZ5cyePLZKEbich8J4SJvARb7GCipT9lEgWxlZN6sXiLrp X-Received: by 2002:a17:902:9a02:: with SMTP id v2mr1044868plp.180.1549308368407; Mon, 04 Feb 2019 11:26:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549308368; cv=none; d=google.com; s=arc-20160816; b=mOg/nrq+56MarBdYoVYA7Vwk1ikDEi9QlgB8I8Tk65cUsYwbcZfk4kTGE5NqcHi1ja 2JNGuyy04b/qLkrkQ8H1RkrLTUIZy0QJHZgDN4bxVzhC+cmoZmSPVp4nHdX9g21tdnLl A2IOctSZ9taaxzx1fP7pzKBAY5yS4/U84UN46DDhjAqeWGPPvGfO8DPuGnX5imbCc+VU qk9zJgKlhU88KZX7JZs6xJdOl918fSWGTeheIhWMJADz98/fJ54LXXG7x/FUm7GVVH+A cvU8TNrgm2qWYGsMi/1D4UJVXR4mP8rPJgV80aXa1YvLSNXMSK6HH5Idjx08di91dUHF bQaA== 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; bh=ZLB+B3AT+x832TXyMloDVxso/Exwsg5043nY90d/CZ0=; b=r/EHo4NkYPYwEJNpv/omHBgK6LIvuA6BYDvGgdxT8Bbc82PQTQpvc2u02hUJtJnJ2Y /oOIaMasSpohqDQnqRWov/rqBgKY8lJeOgjRbHPMPip4efuLGMqnjg/f1UsygG73tdko 9O9s7zq1FzDJjExCMKX1tdMGssL6NnytBUvHDmLRIWB9peohA3cCr7578NeqUXq3Z31M cngz8T4+Q5Mu3wAGthjFzyaL6ivcvqzIn8YriWYTdPRbPZcMb7UhGGCQwOSwMsEkIPXe qy5IVflAcvyGiz1qDTdx7XyHlPafbChVRjpu/1IgPaHvp9X8yVNdXNOoCFqWoe0p4Icc ar7w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=S1ItIJhQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 6si765008plc.241.2019.02.04.11.25.51; Mon, 04 Feb 2019 11:26:08 -0800 (PST) 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=@linaro.org header.s=google header.b=S1ItIJhQ; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729827AbfBDTZP (ORCPT + 99 others); Mon, 4 Feb 2019 14:25:15 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:35254 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728731AbfBDTZO (ORCPT ); Mon, 4 Feb 2019 14:25:14 -0500 Received: by mail-pl1-f193.google.com with SMTP id p8so390739plo.2 for ; Mon, 04 Feb 2019 11:25:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ZLB+B3AT+x832TXyMloDVxso/Exwsg5043nY90d/CZ0=; b=S1ItIJhQvDnvaUoLKkwqG5b8CUfC03Y6qdx0l9HlLt7se3NH3aV8TwJpUpYJepNOO4 7cc21d59MYr87lEwMao6eGXHVqh2vegCBrtX+3eWlGy5YzYLLPNvSx/6dxK9i/MCXMVn gujFNnMBjquBi3tVgBWhO7nIqO1iu8HOxMppU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ZLB+B3AT+x832TXyMloDVxso/Exwsg5043nY90d/CZ0=; b=snQuyvFn5Z9bt0w5NSoO0idwFGXq6v1x0nA0GVUST3QxLq4ZsQm0ndTYxkqim1lAPD MW4xnVTCb+3go8pXvsxKCLkHTjjci3qdvW3lTRO/eqvT0lXk4EARDT44yh3S6EwK612O EZeHopw2yr8Fu4VBFmPZG0UYY5BplqAZYtauLwQJah2UpvMs4y5MzPIKAeWGW5M+aA08 sUm74wijpC/haWDrgal9l3NQPHakm0W1+ega+mjMED4KxBtxzp4RBXqGQQ5M93nHC+WH S6ge3S4q5cz6ZwqJjLGk1BH/+JK+8BgKm5sXzAnk9BsoBStZ00jDz+tmh9yfU6AUnJe+ azjA== X-Gm-Message-State: AHQUAuZ/TinFjSlbixZQPhe3GQQbE0Sh/Zs3cVvGO+t5aJgJYRhHoPTN E9kRkK8UwNzyzLyk1G+MIkB/fg== X-Received: by 2002:a17:902:32b:: with SMTP id 40mr920694pld.327.1549308313821; Mon, 04 Feb 2019 11:25:13 -0800 (PST) Received: from minitux (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id s2sm890780pfa.167.2019.02.04.11.25.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 04 Feb 2019 11:25:12 -0800 (PST) Date: Mon, 4 Feb 2019 11:25:10 -0800 From: Bjorn Andersson To: Mark Brown Cc: Niklas Cassel , Jorge Ramirez , Andy Gross , David Brown , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Khasim Syed Mohammed Subject: Re: [PATCH] arm64: dts: qcs404: evb: Fix voltages for s5 and l3 Message-ID: <20190204192510.GZ31919@minitux> References: <20190125232954.26166-1-bjorn.andersson@linaro.org> <32b8136d-3acb-66e9-948c-ee8903b91401@linaro.org> <20190129224652.GB11349@centauri.lan> <20190204104347.GD23441@sirena.org.uk> <20190204160337.GG2387@tuxbook-pro> <20190204182321.GH23441@sirena.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190204182321.GH23441@sirena.org.uk> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 04 Feb 10:23 PST 2019, Mark Brown wrote: > On Mon, Feb 04, 2019 at 08:03:37AM -0800, Bjorn Andersson wrote: > > > We have a regulator that is described as 1.05V in the schematics for the > > board we're working on and we have the USB block wanting 1.05V on one of > > its pins. But the particular regulator works in steps of 8mV, and the > > adjacent steps are 1.048V and 1.056V. > > > A) If we describe the min-microvolt = max-microvolt = 1.05V then the > > regulator frameworks adjusts the min value to 1.056V, per the steps, and > > fail as min > max. > > Right, because that constraint isn't satisifiable on the board, an exact > value has been asked for which can't be delivered. We *could* try to > allow some fudge factor for tolerance but that feels risky, it'd be > better if the constraints were written to be satisfiable. > Okay, I don't see a big problem with expecting the DT to only contain values that the hardware can actually do. I do however see that machine_constraints_voltage() has been changes to expect the driver to return -ENOTRECOVERABLE when we don't have a way to query the voltage during probe. Updating the qcom_smd-regulator driver to do this causes this regulator to not be probed as we now have: [ 0.199911] l3: Setting 1050000-1050000uV^M [ 0.199927] l3: unsupportable voltage constraints 1056000-1048000uV^M So there's a risk of this breaking compatibility with older dtb files on other boards. We will have to do some more verification on this. But we can start by making sure we're specifying valid constraints for the hardware. > > B) The USB driver that we inherited was written to request min/max of > > 1.05V/1.05V, so pointing this to a regulator with min/max of e.g. > > 1.05V/1.06V we're outside the adjusted range of 1.056V/1.06V. > > This is just very bad practice on the part of the USB driver, if it is > not varying the voltage it should not be setting the voltage and let the > machine figure things out. It is completely pointless for the driver to > be setting an exact value that it never varies, this is the sort of > thing machine constraints are for as it leads to trouble like this. > This is one of the many unfortunate practices in the Qualcomm BSP code > sadly. > We're taking care of this, but I spotted the min = max = non-supported-value issue on SDM845 recently as well and wanted to know which path to take. > > So the question is, should the board dts be written with > > min/max-microvolt adjusted to match the hardware steps? Or could the > > Well, it is definitely unwise of the board to request a specific > voltage if the board can't physically set it, that's asking for trouble, > so I'd have expected the board should pick the value it wants. > Agreed, and if we can make the initial get_voltage fail with -ENOTRECOVERABLE then we get a proper failure on an invalid DT, so I'll review the other platforms using this driver to see if we can introduce this. > > regulator framework be made to round down to the previous valid step > > instead of up? > > We definitely don't want to round voltages down, it is vastly more > common for devices to experience problems like brownouts if they go > under voltage so it'd be more likely to cause harm than good. We're 2mV off in this case, but it could have been way off. So I'm good with this position. Thanks Mark Regards, Bjorn