Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1275046ybn; Wed, 25 Sep 2019 15:26:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYhZ3p0NtkqpXNw1JM2trL8WpkRjjmLx63aFLQKQG4eUkNoJ2J4IZeAvLjqG8f+EmsH+zL X-Received: by 2002:a17:906:6a92:: with SMTP id p18mr395497ejr.253.1569450413753; Wed, 25 Sep 2019 15:26:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569450413; cv=none; d=google.com; s=arc-20160816; b=AyAanoN9XGnyFof7jQ+af9pECIIbL8rx34fBg61z4WwHSqp592bWqqtsa08vo7tqN8 6jewKtrJpGyX1s6aglilFfs597wrPKXPL6OIDl9A+bd66aQNR5d4cMSZZW6nkmNXLJno 0syB5KiwbhWMQjiJASDof/P4TJEOPj8DL7d2xxtzPknO6MoEUHbaqur4MMA1IarzX2lW K2uBsAEj1aGpJnchNRA5Xf8P06Bdb9I/6FzghFf+3ZyJDHl8iCaMnD74rVXBUDGjhSf9 uWRz5Kq8uMH6PlLFBHp32z698GqJXz0Qkjo9eO49ChkRdGYuPySwshyfTM/d2dEwYHKn QBiQ== 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 :in-reply-to:references:mime-version:dkim-signature; bh=RFx99F2ge1nFclKY3g9himgS1snsdSimRPdZ4SeJvlg=; b=RewA7y/YXU3VJKmfyDmehWMka7ZVeK1AVBHR51xHwkPIhvtVLcSJpxyVxY4Rq2dmmi QUXYErsh0nFumsJ/+21sRE4Xse8Pqpk4kKlmItl3o/3io3iOCutPHaeAlaY2ILgK9Ca/ mTwRJyYZs1f2jzck5v2ulvMOkpRYQlggUQBMQfX1L5ZD1o7NSTiDChbG6tiHQeK9aRjo YeD/mwNrrApLLRAnt43oyT5n1GOBIGlUsl9Gr66pOptH7G3J9NOcGOefv5X9XhOumfKz w9zaJdXCnasCCP4P8apC//4/SbKpP34lHjscOIYFQfFMG9xhQ60yC3XGzGQuxiwR3YAJ Aq/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=lQ5OZUGu; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3si219081edu.432.2019.09.25.15.26.29; Wed, 25 Sep 2019 15:26:53 -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=@chromium.org header.s=google header.b=lQ5OZUGu; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728009AbfIWSg1 (ORCPT + 99 others); Mon, 23 Sep 2019 14:36:27 -0400 Received: from mail-oi1-f196.google.com ([209.85.167.196]:35233 "EHLO mail-oi1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727376AbfIWSg0 (ORCPT ); Mon, 23 Sep 2019 14:36:26 -0400 Received: by mail-oi1-f196.google.com with SMTP id x3so8511488oig.2 for ; Mon, 23 Sep 2019 11:36:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RFx99F2ge1nFclKY3g9himgS1snsdSimRPdZ4SeJvlg=; b=lQ5OZUGuy2OIyORW8igAX3ubmZTtnsHSEeETkF8+tf7941UDiBdeRxVH3kDxTdO18d mWyCcpU4yPfzsuAGb9EEhhymD5CsWlXM7pc2Zdk1kAA/0zsDo71qxfN+nmlUaMHCao+3 w4OuX33W1+pF5nm+EOTkyDxenDjPA5L082aeA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RFx99F2ge1nFclKY3g9himgS1snsdSimRPdZ4SeJvlg=; b=DYLV7RS/lhjt0S5u8E5yYrgAJGNe7/qD4lV0DQ4jqeAFeC/Ym9reDX6QxODdTCI8Uh wbWhq9vTEJXNnCdc8mmOeI910Ipwv2/w57b8idhVPIPfDHOX1vnLn6iu1R1rLYd2nBZB 3PwnnZFpWG+RH7j2zOHdMJQjYqae/i/SrHBdtxg28xPlTdYsqGuh8601vjRkECrFE77N JeVvcIAUyeCYKyVxHvCbVl6HbVAtH/kA/pq7ijCvoerh9uo2Yxui8Gt426eqbEpWgHJX dPpd2AUs36Z3zFIbWTV82I9VVdXmJzrxZqgY3ByLJLNeGannNNVNJQjdpPprGQbdhQ3c n+Ng== X-Gm-Message-State: APjAAAVzlB7vsiawyI0KmWa0UCD9Yzu8GRcy7pDaOG4415OEYrpM0uO1 cmXvnybQC4LiNzOmhD4qc4RojBo1x1U= X-Received: by 2002:aca:c358:: with SMTP id t85mr1355233oif.98.1569263784963; Mon, 23 Sep 2019 11:36:24 -0700 (PDT) Received: from mail-io1-f47.google.com (mail-io1-f47.google.com. [209.85.166.47]) by smtp.gmail.com with ESMTPSA id a21sm3358398oia.27.2019.09.23.11.36.24 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 23 Sep 2019 11:36:24 -0700 (PDT) Received: by mail-io1-f47.google.com with SMTP id c6so22762736ioo.13 for ; Mon, 23 Sep 2019 11:36:24 -0700 (PDT) X-Received: by 2002:a5d:9812:: with SMTP id a18mr831293iol.168.1569263783642; Mon, 23 Sep 2019 11:36:23 -0700 (PDT) MIME-Version: 1.0 References: <20190917154021.14693-1-m.felsch@pengutronix.de> <20190917154021.14693-2-m.felsch@pengutronix.de> <20190923181431.GU2036@sirena.org.uk> In-Reply-To: <20190923181431.GU2036@sirena.org.uk> From: Doug Anderson Date: Mon, 23 Sep 2019 11:36:11 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage To: Mark Brown Cc: Marco Felsch , zhang.chunyan@linaro.org, Liam Girdwood , ckeepax@opensource.cirrus.com, LKML , Sascha Hauer 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 Mon, Sep 23, 2019 at 11:14 AM Mark Brown wrote: > > On Mon, Sep 23, 2019 at 11:02:26AM -0700, Doug Anderson wrote: > > > I will freely admit my ignorance here, but I've always been slightly > > confused by the "always-on" vs. "boot-on" distinction... > > > The bindings say: > > > regulator-always-on: > > description: boolean, regulator should never be disabled > > > regulator-boot-on: > > description: bootloader/firmware enabled regulator > > > For 'boot-on' that's a bit ambiguous about what it means. The > > constraints have a bit more details: > > Boot on means that it's powered on when the kernel starts, it's > for regulators that we can't read back the status of. 1. Would it be valid to say that it's always incorrect to set this property if there is a way to read the status back from the regulator? 2. Would this be a valid description of how the property is expected to behave a) At early boot this regulator will be turned on if it wasn't already on. b) If no clients are found for this regulator after everything has loaded, this regulator will be automatically disabled. If so then I don't _think_ #2b is happening, but I haven't confirmed. > > ...but then that begs the question of why we have two attributes? > > Maybe this has already been discussed before and someone can point me > > to a previous discussion? We should probably make it more clear in > > the bindings and/or the constraints. > > boot-on just refers to the status at boot, we can still turn > those regulators off later on if we want to. How, exactly? As of my commit 5451781dadf8 ("regulator: core: Only count load for enabled consumers") if you do: r = regulator_get(...) regulator_disable(r) ...then you'll get "Underflow of regulator enable count". In other words, if a given regulator client disables more times than it enables then you will get an error. Since there is no client that did the initial "boot" enable then there's no way to do the disable unless it happens automatically (as per 2b above). ...or do you mean that people could call regulator_force_disable()? Couldn't they also do that with an always-on regulator? -Doug