devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linus Walleij <linus.walleij@linaro.org>
To: Laxman Dewangan <ldewangan@nvidia.com>
Cc: "rtc-linux@googlegroups.com" <rtc-linux@googlegroups.com>,
	Lee Jones <lee.jones@linaro.org>,
	Samuel Ortiz <sameo@linux.intel.com>,
	Mark Brown <broonie@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	"devicetree@vger.kernel.org" <devicetree@vger.kernel.org>,
	"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-gpio@vger.kernel.org" <linux-gpio@vger.kernel.org>,
	Rob Herring <rob.herring@calxeda.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Pawel Moll <pawel.moll@arm.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Rob Landley <rob@landley.net>,
	"ijc+devicetree@hellion.org.uk" <ijc+devicetree@hellion.org.uk>,
	Grant Likely <grant.likely@linaro.org>,
	Florian Lobmaier <florian.lobmaier@ams.com>
Subject: Re: [rtc-linux] [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver
Date: Mon, 23 Sep 2013 11:26:14 +0200	[thread overview]
Message-ID: <CACRpkdYVTdh3+ayy96D4=iNO6ZASfTfeQOHF9vdoPjfLDCtB5Q@mail.gmail.com> (raw)
In-Reply-To: <524001F3.3060602@nvidia.com>

On Mon, Sep 23, 2013 at 10:55 AM, Laxman Dewangan <ldewangan@nvidia.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

  reply	other threads:[~2013-09-23  9:26 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-20 12:30 [PATCH V2 0/5] Add AMS AS3722 mfd, GPIO, regulator and RTC driver Laxman Dewangan
2013-09-20 12:30 ` [PATCH V2 1/5] regmap: add helper macro to set min/max range of register Laxman Dewangan
2013-09-20 16:56   ` Mark Brown
2013-09-20 12:30 ` [PATCH V2 2/5] mfd: add support for AMS AS3722 PMIC Laxman Dewangan
2013-09-20 12:39   ` Lee Jones
2013-09-20 15:55     ` Mark Brown
2013-09-20 12:30 ` [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver Laxman Dewangan
2013-09-23  8:06   ` [rtc-linux] " Linus Walleij
2013-09-23  8:55     ` Laxman Dewangan
2013-09-23  9:26       ` Linus Walleij [this message]
     [not found]         ` <CACRpkdYVTdh3+ayy96D4=iNO6ZASfTfeQOHF9vdoPjfLDCtB5Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2013-09-23 10:01           ` Laxman Dewangan
     [not found]             ` <5240117C.8060300-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-09-23 18:06               ` Linus Walleij
2013-09-20 12:30 ` [PATCH V2 4/5] regulator: as3722: add regulator driver for AMS AS3722 Laxman Dewangan
2013-09-20 17:08   ` Mark Brown
2013-09-20 12:30 ` [PATCH V2 5/5] drivers/rtc/rtc-as3722: add RTC driver Laxman Dewangan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CACRpkdYVTdh3+ayy96D4=iNO6ZASfTfeQOHF9vdoPjfLDCtB5Q@mail.gmail.com' \
    --to=linus.walleij@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=florian.lobmaier@ams.com \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=ldewangan@nvidia.com \
    --cc=lee.jones@linaro.org \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=rob.herring@calxeda.com \
    --cc=rob@landley.net \
    --cc=rtc-linux@googlegroups.com \
    --cc=sameo@linux.intel.com \
    --cc=swarren@wwwdotorg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).