Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp8793562ybn; Tue, 1 Oct 2019 12:59:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwyKzpz4O+Cu85j1KKPI3+972CGXjgSWpG15LjQlgG+jj5OGURkHZ435CsKsSaBa9MahGSv X-Received: by 2002:a50:f19c:: with SMTP id x28mr27036451edl.42.1569959968202; Tue, 01 Oct 2019 12:59:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1569959968; cv=none; d=google.com; s=arc-20160816; b=TooXtuzJbVQHPUh4JPvMUNUwrVpI/IOYw0x3aSWmVZ61WeM9+uK+Nf2vveatOPAhFG 9ssm7T6M77zHon7W1TErsP30Ox8Ku/1SxeUpwN4B0UeNO23VfbPiOphMtyTfG6dbaUDZ jVuWe45WWKOAgvoVg07MOQWYCgMcYUYx22/Ozc1G8jYkFyUZf02fP7a/KRq1rzVfeDsa jeCHEkhg5Xhz4ws3++PtGWY3ct605ZfCBPec0yA5iySQt6w0UR668Dh8BohwfPSt0bMY mmXiay3YAj6OepnKDLfC0h4hY/tmR8daWHdgRjTew5Rxhv2H9YE4BX8gRMejnJIrvPI/ swUA== 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=o96/wPUY2y8t2voI0Nm5DYaXA5TqXtuex67jswMxEfo=; b=cRWnvb41tgzg8my64m+MMbshO3MaTC/c+XhYGq9I4Xu3CrrgGoGNrfE1e4ahf86G7b jlQdGyELLXnoDPPywDBXk5aPXRIwNuISAdJDvRYAqu4Mrg3bH7eQoyPEH2JFxCkVmna+ 3tL5D7QB815Xuji2//nHPwri+3VuUi8v5zioPN5aS2ZPaan7g7AURPTT5ufB2lJkgkqD QaNCa38qJknwjZnr+PnMDvyWeSN22Rlnu5Uif8K8aa+oStXp5QafDR+ftY86kx11tTBM EuwFtVRaYSaJi3YSZQZ8KkmByGAsIFRZDS32VwBJ2XLddEPKdkkQDdgJ3eYTixSxh2R/ Cgxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=UnfQmCCa; 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 p20si8875801ejg.30.2019.10.01.12.59.03; Tue, 01 Oct 2019 12:59:28 -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=UnfQmCCa; 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 S1727139AbfJAT5p (ORCPT + 99 others); Tue, 1 Oct 2019 15:57:45 -0400 Received: from mail-io1-f65.google.com ([209.85.166.65]:35897 "EHLO mail-io1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725851AbfJAT5p (ORCPT ); Tue, 1 Oct 2019 15:57:45 -0400 Received: by mail-io1-f65.google.com with SMTP id b136so51244797iof.3 for ; Tue, 01 Oct 2019 12:57:44 -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=o96/wPUY2y8t2voI0Nm5DYaXA5TqXtuex67jswMxEfo=; b=UnfQmCCa9punf9e/whGTDqID0hInyaH5EOY9vA7tDwhbUQLhMNrPorQKMIioGkP+yp HS2/+bo04gQQgpdbN1Dc2K+aCrYPcGzvk0J8aR+fjy9ZdnbNut6TuC3PO0erBUF+gIY2 IoOz4UmCofirLGKeCXFZB9X6K0YpCd8iPj1yw= 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=o96/wPUY2y8t2voI0Nm5DYaXA5TqXtuex67jswMxEfo=; b=sXooTPFynnbDvM90TV14bw4/ZSP/sg/et4MhKUuTyc7PJcqQLyUSvFpG2Hjk0pSOc6 6lqMTAeG6FOqb/ci0oxUERv9hrgVU3r5GGyA3V1xCG2wa/xY3IyAKd9KBkFA+CpYkz9y eRxmxFgl3eWt0InKFniadLNXsxtosk+JzUjeUpGNXjjsObh+6KMrRiNSR2Rs4zuhpTgs jYYYZn3DdkuaXzo7PsXnytqsS9V8Bvhel1mq5TWqvwGVBM/XRKRYHwNNj/dMjsWLKaWC cEpSUJP9ylEhtqFXtrB3Y+RrYx0j4rQNO6I/9uN9uznkq/DiTl2TRY9Is8Xx5tvns2zL T95Q== X-Gm-Message-State: APjAAAUMd74wfY3YkiU1J1/tU3HhNbVzNdFZjTFVGcJa3kN4RXWFVU5o fc45S5tI7og62Xs9Hn6CgSiNcegkdOk= X-Received: by 2002:a92:b74f:: with SMTP id c15mr28228873ilm.43.1569959864067; Tue, 01 Oct 2019 12:57:44 -0700 (PDT) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com. [209.85.166.52]) by smtp.gmail.com with ESMTPSA id t24sm7392857ioi.44.2019.10.01.12.57.43 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Oct 2019 12:57:43 -0700 (PDT) Received: by mail-io1-f52.google.com with SMTP id q1so51315044ion.1 for ; Tue, 01 Oct 2019 12:57:43 -0700 (PDT) X-Received: by 2002:a92:4a11:: with SMTP id m17mr27844201ilf.142.1569959862851; Tue, 01 Oct 2019 12:57:42 -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> <20190923184907.GY2036@sirena.org.uk> <20190924182758.GC2036@sirena.org.uk> <20190927084710.mt42454vsrjm3yh3@pengutronix.de> In-Reply-To: <20190927084710.mt42454vsrjm3yh3@pengutronix.de> From: Doug Anderson Date: Tue, 1 Oct 2019 12:57:31 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage To: Marco Felsch Cc: Mark Brown , Chunyan Zhang , 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 Fri, Sep 27, 2019 at 1:47 AM Marco Felsch wrote: > > > > > It should be possible to do a regulator_disable() though I'm not > > > > > sure anyone actually uses that. The pattern for a regular > > > > > consumer should be the normal enable/disable pair to handle > > > > > shared usage, only an exclusive consumer should be able to use > > > > > just a straight disable. > > In my case it is a regulator-fixed which uses the enable/disable pair. > But as my descriptions says this will not work currently because boot-on > marked regulators can't be disabled right now (using the same logic as > always-on regulators). > > > > > Ah, I see, I wasn't aware of the "exclusive" special case! Marco: is > > > > this working for you? I wonder if we need to match > > > > "regulator->enable_count" to "rdev->use_count" at the end of > > > > _regulator_get() in the exclusive case... > > So my fix isn't correct to fix this in general? I don't think your fix is correct. It sounds as if the intention of "regulator-boot-on" is to have the OS turn the regulator on at bootup and it keep an implicit reference until someone explicitly tells the OS to drop the reference. > > > Yes, I think that case has been missed when adding the enable > > > counts - I've never actually had a system myself that made any > > > use of this stuff. It probably needs an audit of the users to > > > make sure nobody's relying on the current behaviour though I > > > can't think how they would. > > > > Marco: I'm going to assume you'll tackle this since I don't actually > > have any use cases that need this. > > My use case is a simple regulator-fixed which is turned on by the > bootloader or to be more precise by the pmic-rom. To map that correctly > I marked this regulator as boot-on. Unfortunately as I pointed out above > this is handeld the same way as always-on. It's a fixed regulator controlled by a GPIO? Presumably the GPIO can be read. That would mean it ideally shouldn't be using "regulator-boot-on" since this is _not_ a regulator whose software state can't be read. Just remove the property. -Doug