Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp4113748imm; Tue, 29 May 2018 22:31:32 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIBOiNgx485VSbJe38A4+y975KZGFJQrspcRSc0kzRu4klkKbWOJCx7T6XknCg4Uyh8FjR9 X-Received: by 2002:a17:902:bb83:: with SMTP id m3-v6mr1429347pls.236.1527658292866; Tue, 29 May 2018 22:31:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527658292; cv=none; d=google.com; s=arc-20160816; b=MUiT8m2+AtUS1ZnSkRHgedJHAgZzN1glotAYoeSjv5y1dK9i/ZqvRwPfS+rQBNOtFm S7FlrS5elqD/d+nI74P9bKWmclSGfNzfhH3aexboSYDQ0cc18ph3jIWi/2w1oG6rqDpT Aeh2qGH2Cv8oycu/sI8xbt+vHFPHS9FcU/xSllAcqfgqNdElaBb8oGj7SFPCk8xkB1pC 0JxtwKTrLRSW1kWfj29/apceAXe9z82KyCBeNGB1oH0HWadfu05ll+hUn0+qIYLLvT2W fWqcObifaGu9yiBn5BOqQVUXmG45rItPKsWxy3xuJqQbSKvSJh4o89U51iyV6hmSEUYP TFkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature:dkim-signature :arc-authentication-results; bh=y4tqOCJWJLEVShLIetKZKxZEV3xb9/Ld/dqmLf1wNYs=; b=q6+5L7OsPpiSCZ3g8NQZTWL4pTurbNt+8Ft7Y/h0EnoPAiyTZFq2xsCh5KCb4rOVsi sgqV4MDjInGtNQ+ysVTSIpycOuzaGekabhfeMcILbKRFcImi9eWJq3yLe2OXw+TE5fMq ZN2PCjCFNmzgcdEcg1uzCm2DtYpau/BrMk/NfN7h3D/Ib3QiCd7gkmzYEDu99VUaQoE4 LVZQeKvnSYqp1ZGCNISk+VA2zz7JmPHAqi3BUy0BXpgGCu8JACb2VlITf/c4qroFHa0k 5JKUSXWR0gbxhXv8lCm1cT2psyDU5/M77gdlcqlGaLQH8brVsu4OvyI4qVOjkTrqjuMe KmNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@google.com header.s=20161025 header.b=g18OLosZ; dkim=fail header.i=@chromium.org header.s=google header.b=QTNoaLDX; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r3-v6si35627007pli.324.2018.05.29.22.31.18; Tue, 29 May 2018 22:31:32 -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=@google.com header.s=20161025 header.b=g18OLosZ; dkim=fail header.i=@chromium.org header.s=google header.b=QTNoaLDX; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935132AbeE3Fas (ORCPT + 99 others); Wed, 30 May 2018 01:30:48 -0400 Received: from mail-ua0-f194.google.com ([209.85.217.194]:37815 "EHLO mail-ua0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933924AbeE3Faf (ORCPT ); Wed, 30 May 2018 01:30:35 -0400 Received: by mail-ua0-f194.google.com with SMTP id i3-v6so11644019uad.4 for ; Tue, 29 May 2018 22:30:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=y4tqOCJWJLEVShLIetKZKxZEV3xb9/Ld/dqmLf1wNYs=; b=g18OLosZyozfmOjVX5T7M+aXDQ1q23vVQBffenZqNWbVtZiSnZuc0iiIUJbK63sFdq kUaCNao2qlCi9K6s60VTrRgFx7yFPsjy9oHRkuwDQo+TDIC6ai4Iz9d64GvbxfvOPaV4 9VWkGtTgOETgqlKUhLz7vCoB9QgQOE8U8h6AixngH1ji73F1iSU7ienjLqTAa/Ci8+tv 2pvyPi+mQBwHM5bfUq0i3P1o2HlcsgSQsBH3j7VFOA4vPUv7X1ZqtqMRCAb/nR6X6Drh lsK++L0icEwa/vh5URTpPPSBhdPZ+fYsBxbuuIrcXbc7VG2YT+pfYy8kHGXIU6pH7Eza E9Ew== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=y4tqOCJWJLEVShLIetKZKxZEV3xb9/Ld/dqmLf1wNYs=; b=QTNoaLDXMBI+h5L5kFI/l4J+/ajSb8THIKAo9yiG8LT72y01muMnWJiEzF/Ee4mpyD mmpJiqqC3A35cXqahwZ1ONmtKfAY+JivbDZ1RvQXBRW4ccd2GP5rxqCBYs2D4etr+Ztb Tt0WNx4c87e5x0MPguaCNLvb67Vo4J7whb3tw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=y4tqOCJWJLEVShLIetKZKxZEV3xb9/Ld/dqmLf1wNYs=; b=nidxGlDYMycfN0ZxElux1YDrHIowhLOsNAb7PNXL5SsOlkNMyYfyPL7MV/ECl6piyI QhrNhXnEVkwTle2URBlLh5hhmLpeWfauzafEoY2L8WmwSzFgZ+0yIg1+bH8OAJ7/4ny8 ETzfcodfFZC5i7VzO+XFdw7CQwolIj5ZcLy6fV5Kq58euGyTA/TriKQxgxcSW1wiFvzX Z9yunIo749lMbkK/ixglGOfFDQrkxvdaUJEHd1sc7uyZZOuswqp77vpEyA+wFSv4eDZ1 Z+g/+NHzj6eEyeq47S436whi+DzZxmUKjev5KLaywIKtneASU/ddvrRLU+45z7IznylV ZHxg== X-Gm-Message-State: ALKqPwfOywtDoc+rFjeBhmyUBRisDh1dH+K8OnzNU/AIEf9xIiaL3Pgv bJgup7OieV3gzoabgiYpI94M9bm1nhqkqfrF1yS6dg== X-Received: by 2002:a9f:3b9b:: with SMTP id r27-v6mr745874uah.191.1527658234466; Tue, 29 May 2018 22:30:34 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a1f:3052:0:0:0:0:0 with HTTP; Tue, 29 May 2018 22:30:33 -0700 (PDT) In-Reply-To: <20180523155617.GN4828@sirena.org.uk> References: <20180523082908.GB4828@sirena.org.uk> <20180523154057.GL4828@sirena.org.uk> <20180523155617.GN4828@sirena.org.uk> From: Doug Anderson Date: Tue, 29 May 2018 22:30:33 -0700 X-Google-Sender-Auth: 2yGLt45TW1J3U7aoD5A5_4Plr2s Message-ID: Subject: Re: [PATCH v3 1/2] regulator: dt-bindings: add QCOM RPMh regulator bindings To: Mark Brown Cc: David Collins , Liam Girdwood , Rob Herring , Mark Rutland , linux-arm-msm@vger.kernel.org, Linux ARM , devicetree@vger.kernel.org, LKML , Rajendra Nayak , Stephen Boyd Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Wed, May 23, 2018 at 8:56 AM, Mark Brown wrote: > On Wed, May 23, 2018 at 08:50:22AM -0700, Doug Anderson wrote: >> On Wed, May 23, 2018 at 8:40 AM, Mark Brown wrote: > >> > It's got to be valid to think about the voltage of a disabled regulator >> > since drivers want to be able make sure that the regulator gets enabled >> > with a sensible config. With most hardware this is really easy since >> > you can just look at the status reported by the hardware but the RPM >> > makes this hard since there's so much write only stuff in there. > >> I should be more clear. Certainly it should be valid to set the >> voltage before enabling it so, as you said, the regulator turns on at >> the right voltage. I'm saying that it's weird (to me) to expect that >> setting the voltage for a regulator that a client thinks is disabled >> will affect any real voltages in the system until the regulator is >> enabled. In RPMh apparently setting a voltage of a regulator you >> think is disabled can affect the regulator output if another client >> (unbeknownst to you) happens to have it enabled. > > Yes, that's definitely not what's expected but it's unfortunately what > the firmware chose to implement so we may well be stuck with it > unfortunately. We're not really stuck with it if we do what I was suggesting. I was suggesting that every time we disable the regulator in Linux we have Linux vote for the lowest voltage it's comfortable with. Linux keeps track of the true voltage that the driver wants and will always change its vote back to that before enabling. Thus (assuming Linux is OK with 1.2 V - 1.4 V for a rail): Modem: want 1.3 V and enabled. => Modem votes for 1.3 V => Modem votes for enabled. => At least one vote for enabled? Yes => Highest voltage vote: 1.3V => True output: 1.3V Linux: want 1.4 V and enabled. => Linux votes for 1.4 V => Linux votes for enabled => At least one vote for enabled? Yes => Highest voltage vote: 1.4V => True output: 1.4V Linux: want disabled => Linux votes for disabled => Linux votes for 1.2 V (keeps 1.4 V in local var) => At least one vote for enabled? Yes => Highest voltage vote: 1.3V => True output: 1.3V Linux: want enabled => Linux votes for 1.4 V (from local var) => Linux votes for enabled => At least one vote for enabled? Yes => Highest voltage vote: 1.4V => True output: 1.4V ...but I'll leave it to you if you think this is a big deal. If you're happy with how David's driver works without my suggestion then I won't push it. -Doug