From mboxrd@z Thu Jan 1 00:00:00 1970 From: Laxman Dewangan Subject: Re: [rtc-linux] [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver Date: Mon, 23 Sep 2013 14:25:15 +0530 Message-ID: <524001F3.3060602@nvidia.com> References: <1379680214-9143-1-git-send-email-ldewangan@nvidia.com> <1379680214-9143-4-git-send-email-ldewangan@nvidia.com> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-doc-owner@vger.kernel.org To: Linus Walleij Cc: "rtc-linux@googlegroups.com" , Lee Jones , Samuel Ortiz , Mark Brown , Andrew Morton , "devicetree@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linux-gpio@vger.kernel.org" , Rob Herring , Mark Rutland , Pawel Moll , Stephen Warren , Rob Landley , "ijc+devicetree@hellion.org.uk" , Grant Likely , Florian Lobmaier List-Id: devicetree@vger.kernel.org On Monday 23 September 2013 01:36 PM, Linus Walleij wrote: > On Fri, Sep 20, 2013 at 2:30 PM, Laxman Dewangan wrote: > >> +Required subnode properties: >> +--------------------------- >> +reg: The GPIO number on which the properties need to be applied. >> + >> +Optional subnode properties: >> +--------------------------- >> +bias-pull-up: The Pull-up for the pin to be enable. >> +bias-pull-down: Pull down of the pins to be enable. >> +bias-high-impedance: High impedance of the pin to be enable. >> +open-drain: Pin is open drain type. >> +function: IO functionality of the pins. The valid options are: >> + gpio, intrrupt-output, vsup-vbat-low-undeb, interrupt-input, >> + pwm-input, voltage-stby, oc-powergood-sd0, powergood-output, >> + clk32k-output, watchdog-input, soft-reset-input, pwm-output, >> + vsup-vbat-low-deb, oc-powergood-sd6 >> + Missing the function property will set the pin in GPIO mode. > 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. > > We already have generic device tree bindings for all of the above > properties, and a library for generic pin config in the pin control > subsystem to handle them. Look at recent drivers for > inspiration. > 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.