From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Rafael J. Wysocki" Subject: Re: [RFC PATCH v2 07/16] gpio: Add support for unified device properties interface Date: Tue, 23 Sep 2014 22:31:27 +0200 Message-ID: <2531965.8yTKWbxWX4@vostro.rjw.lan> References: <1410868367-11056-1-git-send-email-mika.westerberg@linux.intel.com> <20140923155202.GT1786@lahna.fi.intel.com> <20140923161724.GA40700@core.coreip.homeip.net> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7Bit Return-path: In-Reply-To: <20140923161724.GA40700-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org> Sender: devicetree-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Dmitry Torokhov Cc: Mika Westerberg , Arnd Bergmann , Linus Walleij , Grant Likely , Darren Hart , Mark Rutland , ACPI Devel Maling List , "devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , "linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Greg Kroah-Hartman , Alexandre Courbot , Bryan Wu , Lee Jones , Aaron Lu List-Id: devicetree@vger.kernel.org On Tuesday, September 23, 2014 09:17:24 AM Dmitry Torokhov wrote: > On Tue, Sep 23, 2014 at 06:52:02PM +0300, Mika Westerberg wrote: > > On Tue, Sep 23, 2014 at 05:45:57PM +0200, Arnd Bergmann wrote: > > > On Tuesday 23 September 2014 17:25:50 Linus Walleij wrote: > > > > On Tue, Sep 16, 2014 at 1:52 PM, Mika Westerberg > > > > wrote: > > > > > > > > > Some drivers need to deal with only firmware representation of its > > > > > GPIOs. An example would be a GPIO button array driver where each button > > > > > is described as a separate firmware node in device tree. Typically these > > > > > child nodes do not have physical representation in the Linux device > > > > > model. > > > > > > > > > > In order to help device drivers to handle such firmware child nodes we > > > > > add dev[m]_node_get_named_gpiod() that takes a firmware node pointer as > > > > > parameter, finds the GPIO using whatever is the underlying firmware > > > > > method, and requests the GPIO properly. > > > > > > > > > > Signed-off-by: Mika Westerberg > > > > > > > > I have a hard time figuring out if this is what we want for common > > > > accessors between DT and ACPI. > > > > > > > > Can I get some input from Grant, Arnd, Mark, Darren...? > > > > > > I just took a brief look at this. My first impression is that the > > > fw_dev_node structure is weird when all callers just do (in patch 2) > > > > > > + struct fw_dev_node fdn = { > > > + .of_node = dev->of_node, > > > + .acpi_node = ACPI_COMPANION(dev), > > > + }; > > > > > > I'd much rather see an interface that passes the 'struct device' > > > pointer down to dev_get_named_gpiod() and all other exported > > > functions, and then internally does the conversion at the point > > > where the access is done. > > > > Problem is that if you don't have the dev pointer in the first place. > > Please look how leds-gpio.c or gpio_keys_polled.c are using this. > > > > Of course you have the first level device but when you need to iterate > > "leds" or "buttons" below where there is no Linux device available we > > need something like this. > > Maybe we should be passing the parent/owner device to the iterator > functions? Yes, we can do that. That's one alternative for what we have in the current set. Rafael -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html