Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4030819ybp; Mon, 7 Oct 2019 02:00:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwhuVA61RoJuC+/LWW8wiU+CeH09HFaJV6oLx3BtRZihGhC+e82KLKyk+7Frxlcm8Xm+aF8 X-Received: by 2002:aa7:cdd6:: with SMTP id h22mr28126593edw.132.1570438808199; Mon, 07 Oct 2019 02:00:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570438808; cv=none; d=google.com; s=arc-20160816; b=TSdzlSHjRrN16etusnlsYxDMX5mWrmq/Ruxwbd/L9+AFytYtuWB0oALvTB4Ung5EEn LK6Fi6Z3o7CXv6ChMyq24YwTSe8KfdoIFM29uWqnUhL9LMwGxelM7VJf3HYX9n9cZRy2 ocrbkpDgPHjWeZeiYgtS9SfESJGnZFg5iTi/kW0pxaWaM6e1/y5/Ze/GfIs+CHtE153K AH51r961tY4CjVZ/bFxsz2DY1o1usGizDSEcLexiJI38uIcux64cRo81QYa7qwoEVKHC IEekmI5kxR66ei/paicjvSn0JVrENLQvMsIVnFnL6WNswKdwygKt0cWe2PjlW+U6OKC6 WDDQ== 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=F1Ai57mzvM1TP40Rz4wJ5gr1wV4rFOJ43/zjiFgWe1U=; b=gVD62wu7TaS2Fs3wt8mr8oAKgGLqtFFpMI+gSwBBM1g0k75qgnORMhc5SA3JVZgdHh muJjENE8j5K1seQyizxGU+9cFy8cH5blksMJPjyyOYgb7cOqxkwTKUPhxkBuASJLL+LP k2faMTNUJtHl38JL2qhCALI2Y2qRPSM32LqJGy2s2DdSI8ok1hynEwE21qLbkM+QhYWd EexDAtUz58OnvbQxMJ38PpdI4yqrSlYHUwxeSIndodLbX0mh5Dy+QYZtIDPZXjkZPZG5 WLxi4F/wp+ld/jZpkkQRE7mjOjMnJT3sx+J14CEQd5sn/B1GpoWeXMjDnc7ltzPxXfSW LhQA== 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 c10si8765434edc.419.2019.10.07.01.59.44; Mon, 07 Oct 2019 02:00:08 -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 S1727401AbfJGI7V (ORCPT + 99 others); Mon, 7 Oct 2019 04:59:21 -0400 Received: from metis.ext.pengutronix.de ([85.220.165.71]:42885 "EHLO metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbfJGI7V (ORCPT ); Mon, 7 Oct 2019 04:59:21 -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 1iHOrL-0008Mt-OD; Mon, 07 Oct 2019 10:59:15 +0200 Received: from mfe by pty.hi.pengutronix.de with local (Exim 4.89) (envelope-from ) id 1iHOrK-0005jI-SH; Mon, 07 Oct 2019 10:59:14 +0200 Date: Mon, 7 Oct 2019 10:59:14 +0200 From: Marco Felsch To: Linus Walleij Cc: Support Opensource , Lee Jones , Rob Herring , Liam Girdwood , Mark Brown , stwiss.opensource@diasemi.com, Sascha Hauer , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH 3/5] regulator: da9062: add voltage selection gpio support Message-ID: <20191007085914.jwp6jehllmbiilye@pengutronix.de> References: <20190917124246.11732-1-m.felsch@pengutronix.de> <20190917124246.11732-4-m.felsch@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: 10:53:07 up 142 days, 15:11, 94 users, load average: 0.14, 0.07, 0.02 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 On 19-10-04 21:41, Linus Walleij wrote: > On Tue, Sep 17, 2019 at 2:43 PM Marco Felsch wrote: > > > + /* > > + * We only must ensure that the gpio device is probed before the > > + * regulator driver so no need to store the reference global. Luckily > > + * devm_* releases the gpio upon a unbound action. > > + */ > > + gpi = devm_gpiod_get_from_of_node(cfg->dev, np, prop, 0, GPIOD_IN | > > + GPIOD_FLAGS_BIT_NONEXCLUSIVE, label); > > Do you really need the GPIOD_FLAGS_BIT_NONEXCLUSIVE flag here? > I don't think so, but describe what usecase you have that warrants this > being claimed twice. Normally that is just needed when you let the > regulator core handle enablement of a regulator over GPIO, i.e. > ena_gpiod in struct regulator_config. This pin can be assigned to all regulators so it is shared across them also it can be used as voltage-selection gpio by regulator and as enable signal by an other regulator. I mentioned that within the dt-bindings and also mentioned that the config has to be the same. > > + /* We need the local number */ > > + nr = da9062_gpio_get_hwgpio(gpi); > > If you really need this we should add a public API to gpiolib and not > create custom APIs. > > Just make a patch adding > > int gpiod_to_offset(struct gpio_desc *d); > > to the public gpiolib API in include/linux/gpio/consumer.h > > and add the code in gpiolib.c to do this trick. Okay, I will add it. Thanks for the review. Regards, Marco > Yours, > Linus Walleij > -- 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 |