Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4066135ybp; Mon, 7 Oct 2019 02:38:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqxBrRtDY3cVcJJ3w+0DFmwvTzxkErFx5fozSss9fBy3AgowMXWM5eXIGsbdYdnz6ORSzud7 X-Received: by 2002:a50:fa9a:: with SMTP id w26mr28098824edr.227.1570441083366; Mon, 07 Oct 2019 02:38:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570441083; cv=none; d=google.com; s=arc-20160816; b=pJBnJV+VXKc4VVRSlRzTqw5nke29WGb1fA7ndvnsrF0wtQWU/gcVKSodrLRA5wIj5L Ro2jyHSVE3diBTULl1kpvd1TL6USoH5UnLObI+MAfTBofyhxuTNf4LxZ6kh5ZpNzKdGg NrLX5JsFMYfOHbwHjpJolrQ3vk6zo5x8oHhkqff3BHKiJir1GgFw0wLIMjLWUSmJ2s/F kKhbnTJJ/IOvDiY7qD1Htp+O8Q/flZtO87FLEdmF7DRyonXomsq2OrR4/D51mNbuQRe1 GCVG1cnQAkZAjYxCSCQ7FBSI1Z+pkZ5rF4FPOyScC1U0zDPB8sFysc38+AFWB3U6m39m gXsg== 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; bh=VMc8jN3ts/LUgJR3Fo9Ufz+/Hlu07QYsvpB/M+mNtoQ=; b=XjgzuO7UQbeXh4qYCHpgVVJghpJnXojk2R2l0HSctjizB1Mc3LKDzW486t88wSB/T4 E5bSCkdcfwCKVfqZtO6WzQF4TEQkOQWQ7nGebEMfETmL+MUDt29w4HQmDbvX4XeIwFAr Ez2TLynYku4LKxM0S8psPDaEWrWerOZsrGLmmiRrhIRYD6oflztMAfuZ+LjuAUj6eBv1 BP8kjKBzSUzGJlDHf5xiIQFWUTsWTxx3oiA+DE+ePjiSn3ywRmHpgc+D4GbVMossxNJl qlMSxWONyisEKdS1DenDS4FwJi8bS1vWJA0mLIexE23BUf06BbL48sdFE/hXv8o0OmgP l0HQ== ARC-Authentication-Results: i=1; mx.google.com; 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 8si8353770edz.299.2019.10.07.02.37.39; Mon, 07 Oct 2019 02:38:03 -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; 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 S1727610AbfJGJef (ORCPT + 99 others); Mon, 7 Oct 2019 05:34:35 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:49005 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727272AbfJGJef (ORCPT ); Mon, 7 Oct 2019 05:34:35 -0400 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iHPPT-0003pH-HS; Mon, 07 Oct 2019 11:34:31 +0200 Received: from mfe by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iHPPR-0007UZ-41; Mon, 07 Oct 2019 11:34:29 +0200 Date: Mon, 7 Oct 2019 11:34:29 +0200 From: Marco Felsch To: Doug Anderson Cc: Mark Brown , Chunyan Zhang , Liam Girdwood , ckeepax@opensource.cirrus.com, LKML , Sascha Hauer Subject: Re: [PATCH 1/3] regulator: core: fix boot-on regulators use_count usage Message-ID: <20191007093429.qekysnxufvkbirit@pengutronix.de> References: <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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-IRC: #ptxdist @freenode X-Accept-Language: de,en X-Accept-Content-Type: text/plain X-Uptime: 11:28:21 up 142 days, 15:46, 94 users, load average: 0.00, 0.02, 0.00 User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::c5 X-SA-Exim-Mail-From: mfe@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Doug, Mark, On 19-10-01 12:57, Doug Anderson wrote: > 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. Sorry that won't fix my problem. If I drop the regulator-boot-on state the fixed-regulator will disable this regulator but disable/enable this regulator is only valid during suspend/resume. I don't say that my fix is correct but we should fix this. Regards, Marco > -Doug > -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |