Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp909084imm; Mon, 21 May 2018 17:01:58 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo1q1GlmELGHCoOSve4ldUjnyrb7z3tIkW88IHg+UEGxCNFpOmNXq6sRjmX7SIYWGwsZKx5 X-Received: by 2002:a17:902:6bc7:: with SMTP id m7-v6mr21756874plt.162.1526947318879; Mon, 21 May 2018 17:01:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526947318; cv=none; d=google.com; s=arc-20160816; b=xmQVyx3T9Vl6RXAAfrskye+Y+Qoynic/EN7Z1ZYGBMkedPDboy+c6DQhCzgs0McvDC 5Rhw084rmA3KSyKOVxkQBEoQ9e2yaRo9Mad7cFvOLgGyex+vDnicVXPTK6w6A0dpSfcB 7tucUsdpi24zyinXVRGIGbNWibcX8h0PHow7FXRli03HTvqFV/LyVHaZV6V7yyz6kbeJ OOKPxtCbHBD9jCm3sMB+CfMXO6CoDIGLKMyp6Fj4q4qGL61Q03MtzBnEiZYa7FyI8PCt MLzYIiuyP66n1IWi11LZVfnOnnRmB/mJlAHUDP5fyyieLJwkYawPgMFMBtxH2dpSsUPg LLJA== 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=r+z5YhvS1z2Qcp8OaJOdK1iQC3fSdAuJaGIYnQAGQSg=; b=pN6thzwwz5w3sd57NPO9oQszx2UoEKIYxt2FQlv8297eRhs/T/QiCdVuCZV1m+0VEm vxhEyfElxVJ7A+AlVgx5sI0Jq2qQNj9Q36LhKQ9FEbLQLSfl19Ar1GrsPynwVEMhVHu4 m94JGhOqGvR1zvJ2+kFHV5w/2iQPo+puYZgKXzJSFiB4Q9o5Jm0jmywrndkFrJrDhGN6 HLv5isqwC7PV4k/ey6gTzQ2jeIa2xLQKKPVavOLm+XLYxmaBVP0JOHbrhMubEZSkRJCQ ooGccCemSrJF0iF+nMx8UZs42+aC//Ky24PW64NXV2bsmyTi2RdNx4m4ORVzU6+PqIxo PgAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=nnFOWOR8; dkim=pass header.i=@codeaurora.org header.s=default header.b=nOs9QLGW; 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 b97-v6si15318631plb.135.2018.05.21.17.01.44; Mon, 21 May 2018 17:01:58 -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=nnFOWOR8; dkim=pass header.i=@codeaurora.org header.s=default header.b=nOs9QLGW; 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 S1751413AbeEVAAz (ORCPT + 99 others); Mon, 21 May 2018 20:00:55 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:58320 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751073AbeEVAAw (ORCPT ); Mon, 21 May 2018 20:00:52 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 0419060AD4; Tue, 22 May 2018 00:00:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526947252; bh=EWwwVupTULbGARLpNWrlY8Xzw2YU5/VLcr1Umh6qQ/k=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=nnFOWOR80twAT0FCROpf0A1l7h7Dn1Kd4xtfQpAG3kj2kirGk417at9y2nDxIoqjC jo+QEdv1ltXoYpiV9z9/s0SJuZKj9OK9qJfshK9DgrsxzXRZ1A7pMg3nTjbPqeR3Mu onLiwtUJIntBQiHorh3LVJKTlT7HzfF5WpMgvBNE= 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 7074360392; Tue, 22 May 2018 00:00:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1526947250; bh=EWwwVupTULbGARLpNWrlY8Xzw2YU5/VLcr1Umh6qQ/k=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=nOs9QLGWaa5I5BB15zw8bfELHQKR6mEAvn/poeOYH+EapTU8AI1+VKTI6ef/eemqv wZUGOVXdJ+i3p/MLBseMrjCuYHd6p86/OYhaJmLx85sjLGTTb1LvT8AP8qc/K8tQQS 23BhkpafI8HgjxPSxCy17AB+Io1yKRoH1mBDgVnM= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 7074360392 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 v3 1/2] regulator: dt-bindings: add QCOM RPMh regulator bindings To: Doug Anderson Cc: Mark Brown , Liam Girdwood , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, Linux ARM , devicetree@vger.kernel.org, LKML , Rajendra Nayak , Stephen Boyd References: <41d5df73ddac772551d2966e0752bb0c357b1ded.1526088081.git.collinsd@codeaurora.org> <869aad59-1cc5-28ef-1fb5-4ef846696c40@codeaurora.org> From: David Collins Message-ID: Date: Mon, 21 May 2018 17:00:49 -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 On 05/21/2018 11:01 AM, Doug Anderson wrote: > On Fri, May 18, 2018 at 5:46 PM, David Collins wrote: ... >> Something to keep in mind about the downstream rpmh-regulator driver is >> that it caches the initial voltages specified in device tree and only >> sends them after a consumer driver makes a regulator framework call. This >> saves time during boot and ensures that requests are not made for >> regulators that no Linux consumer cares about. > > You're saying that in the downstream driver you'd specify > "initial-voltage" in the device tree and: > > * This voltage would be reported by any subsequent get_voltage() calls > > * This voltage would _not_ be communicated to RPMh. > > That seems really strange because you're essentially going to be > returning something from get_voltage() that could be a lie. You don't > know if the BIOS actually set the value or not but you'll claim that > it did. It also doesn't seem to match what I see in the downstream > driver. There I see it read "qcom,init-voltage" and then do a > "rpmh_regulator_set_reg()". Thus my reading of the downstream driver > is that it should do the same requests that you're doing. In the downstream rpmh-regulator driver [1], the value specified via the "qcom,init-voltage" DT property is only sent to RPMh at probe time if the "qcom,send-defaults" property is also specified. "qcom,send-defaults" is currently specified only for PMI8998 BOB. The rpmh_regulator_set_reg() function only updates the cached RPMh request value to be sent in the next request. The rpmh_regulator_send_aggregate_requests() function must be called to actually issue the request. Returning the cached (but not sent) initial voltage equal to the min constraint voltage in get_voltage() calls should not cause any problems. This represents the highest voltage that is guaranteed to be output by the regulator. Consumer's should call regulator_set_voltage() to specify their voltage needs. If they simply call regulator_enable(), then the cached voltage will be sent along with the enable request. >> It is generally not safe to request all regulators to be set to the >> minimum allowed voltage. Special care will be needed with the upstream >> qcom-rpmh-regulator driver to avoid disrupting the boot up state of >> regulators that are needed by other subsystems. Therefore, I would like >> to keep the initial voltage feature supported. > > I was asking for specific examples. Do you have any? I was able to track down an example that requires initialization at a non-minimum voltage: PM8998 LDO 13 on SDM845 MTP. This regulator supplies the microSD card with a voltage in the range 1.8 V to 2.96 V. The boot loader leaves this regulator enabled at 2.96 V. It is only guaranteed to be safe to reduce the voltage to 1.8 V on UHS type cards and only after following the proper SD identification and command sequence. > BTW: have I already said how terrible of a design it is that you can't > read back the voltages that the BIOS set? If we could just read back > what the BIOS set then everything would work great and we could stop > talking about this. Even if such reading were feasible, it would not help the situation substantially. Very few requests are made via the AP RSC before Linux kernel boot, so 0 V values would still be read back for most regulators. Additionally, reading the true hardware state (as opposed to what AP RSC voted before Linux boot) would also not be helpful. For example, if a regulator was physically enabled due to a vote via modem RSC and qcom-rpmh-regulator returned is_enabled() == true inside of a regulator_enable() call, then no enable request would be made via the AP RSC which would result in the regulator turning off unexpectedly later when the modem requests to disable the regulator. Take care, David [1]: https://source.codeaurora.org/quic/la/kernel/msm-4.9/tree/drivers/regulator/rpmh-regulator.c?h=msm-4.9 -- The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project