Re: [rtc-linux] [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver
From: Laxman Dewangan <hidden>
Date: 2013-09-23 09:39:27
Also in:
linux-gpio, lkml
On Monday 23 September 2013 02:56 PM, Linus Walleij wrote:
On Mon, Sep 23, 2013 at 10:55 AM, Laxman Dewangan [off-list ref] wrote:quoted
On Monday 23 September 2013 01:36 PM, Linus Walleij wrote:quoted
This is pin control. Do not try to shoehorn pin control drivers into the GPIO subsystem. Take a good day off, read through Documentation/pinctrl.txt and come back with a thoroughly rewritten driver in drivers/pinctrl/pinctrl-as3722.c.(...)quoted
Yes, the appropriate location is pin control for pull up/down etc configuration but with this device, the actual issue is with the way it is require to configure the pull up/down and input/output of the pin. There is no separate bits for pull up/down and direction and it is clubbed together. The register's bits are defined as: Selects the GPIO mode (I, I/O, Tri, Pulls) (BIT 2:0) 0 : Input 1 : Output (push and pull) VSUP_GPIO 2 : Output/Input (open drain, only NMOS is active) 3 : ADC input (Tristate) 4 : Input with pull-up to VDD_GPIO_lv 5 : Input with pull-down 6 : Output/Input open drain (nmos) with pull-up to VDD_GPIO_lv, 7 : Output (push and pull) VDD_GPIO_lv So I can not actually configure the pull up/down, open drain and direction independently until every thing is known. Direction come from gpio driver but pull up/down and open drain configuration come from the pin control. And this is only the reason to make all configuration in single driver.This is nothing special. Create a single combined GPIO and pin control driver using the pin control framework and device tree bindings.
Ok, I was thinking that we should not call gpiochip_add() from the pin control driver in any new driver and that's why I developed gpio driver but it seems it is allowed. I saw some of driver in pinctrl are doing pin control and gpio functionality in single driver i.e. pincntrl-nomadik, pinctrl-samsung, pincntrl-st etc. So this gpio driver can be moved now to the pincntrl folder and can use pincontrol and gpio framework. I will respin the change. -- 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