Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp897369ybl; Wed, 11 Dec 2019 09:12:01 -0800 (PST) X-Google-Smtp-Source: APXvYqxZp8aYGCuTf9b2rnQACJmJ1/piVzoHu2u0eNmHb8DiAEEOPtaf4m1iM6L5HcUCF5MASDyd X-Received: by 2002:a05:6808:296:: with SMTP id z22mr3383537oic.153.1576084321608; Wed, 11 Dec 2019 09:12:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576084321; cv=none; d=google.com; s=arc-20160816; b=q1lp/e7/NdY9TM/9LIaEdpnqHldUa5pQAmdLR64H86cfKlHomuSA26e5jA8OY4LHtD qEjGwzYk41R37cBrkI9jli+5XOJv2LTUpYEJ9I4aJlVy7Ftf1nPWCI5HA67ppPUftO3p XErwS55R03avYvjnBWiCCUccq8mk6fibsCVP36NgZv9sCdz2nTezGA50iMPv2X0ngFY5 nd/wsb+hnxpCReFium96TI0ln/ukwF6EzX1pSRyLqYTtZ+NRdFseUSi8uB1cxi72YcaI WrFDhdkchk7Iv61S5l9ewKmDE8FJO6zVbO6vlh8ukCkTu43GsvlqRkpr/oKmZrFKYLOJ OIKg== 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=NGw282rWo7+SCBvTMX/JQ2ztAXctqDobtcNPykyvoRQ=; b=KCq2KguzE4dyps9PHVNX6uMCWrdSQF1y5G2HCOlLnT63ANivGEMOKCoyzLzf/NkMfB +haJxpNJauj8OBo+hqjlPPJkfYXh6mIf2yDWUtP67PP62YcWlNSfcDIVdozBf0m4/L6I DgcNUfOuLyr7TqwH5wxS/DjgwdRCvD0K5YV6p+DOHaDB3yN0298pj07aon0BIaOcjHhs EEVQGvViIdyB0PvvErXvO1ocirKs/w955AK17243QCqrvPQzWE90Hf4FNQGqRp5yZ04t tKo4xplvtdvoR11U2tJM/TSaeMb40hIr1hmJkZOzrO33wYh95JjUmCFtr7YqBamKN5+N yubQ== 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 p26si1467961oto.240.2019.12.11.09.11.46; Wed, 11 Dec 2019 09:12:01 -0800 (PST) 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 S1730865AbfLKRJc (ORCPT + 99 others); Wed, 11 Dec 2019 12:09:32 -0500 Received: from metis.ext.pengutronix.de ([85.220.165.71]:57161 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730812AbfLKRJb (ORCPT ); Wed, 11 Dec 2019 12:09:31 -0500 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 1if5UG-0005Y6-BL; Wed, 11 Dec 2019 18:09:20 +0100 Received: from mfe by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1if5UE-0002i5-93; Wed, 11 Dec 2019 18:09:18 +0100 Date: Wed, 11 Dec 2019 18:09:18 +0100 From: Marco Felsch To: Adam Thomson Cc: Mark Brown , Support Opensource , "lee.jones@linaro.org" , "robh+dt@kernel.org" , "linus.walleij@linaro.org" , "bgolaszewski@baylibre.com" , "joel@jms.id.au" , "andrew@aj.id.au" , "lgirdwood@gmail.com" , "devicetree@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , "linux-aspeed@lists.ozlabs.org" , "linux-arm-kernel@lists.infradead.org" , "kernel@pengutronix.de" Subject: Re: [PATCH v3 3/6] dt-bindings: mfd: da9062: add regulator voltage selection documentation Message-ID: <20191211170918.q7kqkd4lrwwp7jl3@pengutronix.de> References: <20191129172537.31410-1-m.felsch@pengutronix.de> <20191129172537.31410-4-m.felsch@pengutronix.de> <20191204134631.GT1998@sirena.org.uk> <20191210094144.mxximpuouchy3fqu@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: 17:23:39 up 26 days, 7:42, 33 users, load average: 0.00, 0.00, 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 Adam, On 19-12-11 16:14, Adam Thomson wrote: > On 10 December 2019 09:42, Marco Felsch wrote: > > > Hi Mark, > > > > On 19-12-04 13:46, Mark Brown wrote: > > > On Fri, Nov 29, 2019 at 06:25:34PM +0100, Marco Felsch wrote: > > > > > > > + Optional regulator device-specific properties: > > > > + - dlg,vsel-sense-gpios : A GPIO reference to a local general purpose input, > > > > + the datasheet calls it GPI. The regulator sense the input signal and select > > > > + the active or suspend voltage settings. If the signal is active the > > > > + active-settings are applied else the suspend-settings are applied. > > > > + Attention: Sharing the same GPI for other purposes or across multiple > > > > + regulators is possible but the polarity setting must equal. > > > > > > I'm really confused by this. As far as I understand it it seems > > > to be doing pinmuxing on the chip using the GPIO bindings which > > > is itself a bit odd and I don't see anything here that configures > > > whatever sets the state of the pins. Don't we need another GPIO > > > to set the vsel-sense inputs on the PMIC? > > > > Yes the PMIC is very configurable and it took a while till I understand > > it.. @Adam please correct me if I'm wrong. > > > > The PMIC regulators regardless of the type: ldo or buck can be > > simplified drawn as: > > > > > > > > da9062-gpio da9062-regulator > > > > +------------------------------------------------------- > > | PMIC > > | > > > GPIO0 +--------------------------+ > > | | REGULATOR-0 | > > > GPIO1 -------+ | | > > | +-- > vsel-in voltage-a-out < > > > GPIO2 | | | > > | | > enable-in voltage-b-out < > > | | | | > > | | +--------------------------+ > > | | > > | | +--------------------------+ > > | | | REGULATOR-1 | > > | | | | > > | +-- > vsel-in voltage-a-out < > > | | | > > | > enable-in voltage-b-out < > > | | | > > | +--------------------------+ > > | > > > > The 'vsel-in' and 'enable-in' regulator inputs must be routed to the > > PMIC GPIOs which must be configured as input. If this is a pinmux in > > your opinion, then yes we need to do that. IMHO it isn't a pinmux > > because from the regulator point of view it is just a GPIO which comes > > from our own gpio-dev (da9062-gpio). So the abstraction is vald. Anyway > > I'm with you that this isn't the typical use-case. > > We've had this discussion before and to me it felt more like pinmux than GPIO > although I understand we're configuring the GPIO pin as input before then > configuring a regulator to take that specific internal GPIO as the control > signal. We're defining a specific role to this pin in HW rather than it being a > general software handled GPI so it feels like this would be neater under pinmux. > There does still need to be a mapping between that pin and the regulator which I > guess would be served by passing the pin to the regulator through generic pinmux > bindings and then in the regulator code you're simply just enabling the > regulator to be controlled from that pin. The HW lets you control multiple > regulators from the same input pin so there's a flexibility there to be > captured, as you mention. I know that we already had this discussion but the result was to wait for the maintainers input. Since Linus is the pinctrl/gpio maintainer and Mark the regulator maintainer we now have some input so we can move forward. Linus made some comments on the dt-bindings and on the code but he didn't pointed out that this usage is wrong. So I guessed it would be fine for him. Mark did his first comments now and I explained the current state.. I discussed it with a colleague again and he mentioned that pinctrl should be named pinctrl instead it should be named padctrl. We don't reconfigure the pad to a other function it is still a device general purpose input pad. The hw-signal flow goes always trough the gpio block so one argument more for my solution. Also we don't configure the "pad" to be a vsel/ena-pin. The hw-pad can only be a gpio or has an alternate function (WDKICK for GPIO0, Seq. SYS_EN for GPIO2, Seq. PWR_EN for GPIO4). Instead we tell the regulator to use _this_ GPIO e.g. for voltage selection so we go the other way around. My last argument why pinctrl isn't the correct place is that the GPIO1 can be used for regulator-0:vsel-in and for regulator-1:enable-in. So this pad would have different states which is invalid IMHO. Regards, Marco > > Regards, > > Marco > > > > -- > > Pengutronix e.K. | | > > Steuerwalder Str. 21 | http://www.pengutronix.de/ | > > 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | > > Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | > -- Pengutronix e.K. | | Steuerwalder Str. 21 | http://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |