[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CACRpkdYVTdh3+ayy96D4=iNO6ZASfTfeQOHF9vdoPjfLDCtB5Q@mail.gmail.com>
Date: Mon, 23 Sep 2013 11:26:14 +0200
From: Linus Walleij <linus.walleij@...aro.org>
To: Laxman Dewangan <ldewangan@...dia.com>
Cc: "rtc-linux@...glegroups.com" <rtc-linux@...glegroups.com>,
Lee Jones <lee.jones@...aro.org>,
Samuel Ortiz <sameo@...ux.intel.com>,
Mark Brown <broonie@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
Rob Herring <rob.herring@...xeda.com>,
Mark Rutland <mark.rutland@....com>,
Pawel Moll <pawel.moll@....com>,
Stephen Warren <swarren@...dotorg.org>,
Rob Landley <rob@...dley.net>,
"ijc+devicetree@...lion.org.uk" <ijc+devicetree@...lion.org.uk>,
Grant Likely <grant.likely@...aro.org>,
Florian Lobmaier <florian.lobmaier@....com>
Subject: Re: [rtc-linux] [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver
On Mon, Sep 23, 2013 at 10:55 AM, Laxman Dewangan <ldewangan@...dia.com> wrote:
> On Monday 23 September 2013 01:36 PM, Linus Walleij wrote:
>> 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.
(...)
>
> 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.
It is the responsibility of the driver to say "no" to things the
hardware cannot handle, and it is the responsibility of the
driver to track the state of the hardware.
The fact that hardware engineers have attempted to be
"helpful" by supplying 8 predefined configuration states
does not change anything.
Also it is obviously soon a pin control driver since your
DT binding contains this:
+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.
Which shall be implemented using the pinmux portions
of pin control.
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists