All of lore.kernel.org
 help / color / mirror / Atom feed
From: swarren@wwwdotorg.org (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 03/10] tty: pxa: configure pin
Date: Mon, 22 Oct 2012 14:26:46 -0600	[thread overview]
Message-ID: <5085AC06.8070508@wwwdotorg.org> (raw)
In-Reply-To: <CACRpkdb5Jiw71jBLDXpf2VTJQx7_gABqs03_20CeCLbVT=JkaA@mail.gmail.com>

On 10/22/2012 02:45 AM, Linus Walleij wrote:
> On Fri, Oct 19, 2012 at 12:20 AM, Stephen Warren <swarren@wwwdotorg.org> wrote:
> 
>> On 10/18/2012 03:06 AM, Haojian Zhuang wrote:
>>> Configure pins by pinctrl driver.
>>
>> In general, it seems better to use pinctrl "hogs" if the driver is only
>> going to statically set up one pinctrl state and never change it. The
>> alternative is make every single driver execute these pinctrl calls,
>> which could be tedious.
> 
> True. And each platform has to choose how to go ahead with this.
> 
> I always imagined that any system of the "power socket in wall"
> type would just use hogs to configure its pins and be done with
> it, and there appear to be some platforms like that. (e.g. MIPS and
> various power-inaware references come to mind).
> 
> For the Ux500 drivers we have found that all of those that have pin
> resources actually have to be handled by the driver. The reason is
> that all of them have idle and/or sleep states that need to be
> handled at runtime.

Well, presumably the pinctrl driver itself could have both default/idle
states, and system sleep could engage the appropriate system-wide setting.

> As an additional complication our drivers are used also by
> the Versatile and SPEAr family of platforms, so the control
> need to be tolerant (accept missing pinctrl handles and states)
> as well. (I can see that other drivers take shortcuts by being less
> elaborate since there is a 1:1 driver<->platform mapping.)

Isn't the driver (or DT binding) supposed to define what pinctrl states
must exist, and those state must always exist? There's no requirement
for a pinctrl state definition to always actually contain content that
changes the state. That's exactly why PIN_MAP_TYPE_DUMMY_STATE exists.

> An alternative to embedding the pin handling code into
> the drivers is to use bus notifiers as is done with the
> shmobile clocking by drivers/base/power/clock_ops.c
> I could easily imagine pinctrl_ops.c like that for some
> platforms. This mandates still binding the pin table entries
> to a device but avoids adding any code to the drivers.
> 
> However this latter approach does not work for us (Ux500) -
> the three resources we have: clocks, pins and power domains
> are dependent on state switch ordering (sometimes you need
> to switch off the clock then set pin state, sometimes the
> other way around) and it is not even
> the same for all drivers - the notifier approach mandates
> that all drivers do the clock, power domain and pin handling
> uniformly.

That certainly does imply that individual drivers do need to handle this
explicitly. Although I still think that only specific drivers actually
affected by this should end up actively managing pinctrl; shouldn't
anything that can get away with relying on system hogs do so?

WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Linus Walleij <linus.walleij-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	Mark Brown
	<broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>,
	Magnus Damm <magnus.damm-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH 03/10] tty: pxa: configure pin
Date: Mon, 22 Oct 2012 14:26:46 -0600	[thread overview]
Message-ID: <5085AC06.8070508@wwwdotorg.org> (raw)
In-Reply-To: <CACRpkdb5Jiw71jBLDXpf2VTJQx7_gABqs03_20CeCLbVT=JkaA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On 10/22/2012 02:45 AM, Linus Walleij wrote:
> On Fri, Oct 19, 2012 at 12:20 AM, Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org> wrote:
> 
>> On 10/18/2012 03:06 AM, Haojian Zhuang wrote:
>>> Configure pins by pinctrl driver.
>>
>> In general, it seems better to use pinctrl "hogs" if the driver is only
>> going to statically set up one pinctrl state and never change it. The
>> alternative is make every single driver execute these pinctrl calls,
>> which could be tedious.
> 
> True. And each platform has to choose how to go ahead with this.
> 
> I always imagined that any system of the "power socket in wall"
> type would just use hogs to configure its pins and be done with
> it, and there appear to be some platforms like that. (e.g. MIPS and
> various power-inaware references come to mind).
> 
> For the Ux500 drivers we have found that all of those that have pin
> resources actually have to be handled by the driver. The reason is
> that all of them have idle and/or sleep states that need to be
> handled at runtime.

Well, presumably the pinctrl driver itself could have both default/idle
states, and system sleep could engage the appropriate system-wide setting.

> As an additional complication our drivers are used also by
> the Versatile and SPEAr family of platforms, so the control
> need to be tolerant (accept missing pinctrl handles and states)
> as well. (I can see that other drivers take shortcuts by being less
> elaborate since there is a 1:1 driver<->platform mapping.)

Isn't the driver (or DT binding) supposed to define what pinctrl states
must exist, and those state must always exist? There's no requirement
for a pinctrl state definition to always actually contain content that
changes the state. That's exactly why PIN_MAP_TYPE_DUMMY_STATE exists.

> An alternative to embedding the pin handling code into
> the drivers is to use bus notifiers as is done with the
> shmobile clocking by drivers/base/power/clock_ops.c
> I could easily imagine pinctrl_ops.c like that for some
> platforms. This mandates still binding the pin table entries
> to a device but avoids adding any code to the drivers.
> 
> However this latter approach does not work for us (Ux500) -
> the three resources we have: clocks, pins and power domains
> are dependent on state switch ordering (sometimes you need
> to switch off the clock then set pin state, sometimes the
> other way around) and it is not even
> the same for all drivers - the notifier approach mandates
> that all drivers do the clock, power domain and pin handling
> uniformly.

That certainly does imply that individual drivers do need to handle this
explicitly. Although I still think that only specific drivers actually
affected by this should end up actively managing pinctrl; shouldn't
anything that can get away with relying on system hogs do so?

  reply	other threads:[~2012-10-22 20:26 UTC|newest]

Thread overview: 96+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-18  9:06 [PATCH 01/10] pinctrl: use postcore_initcall Haojian Zhuang
2012-10-18  9:06 ` Haojian Zhuang
2012-10-18  9:06 ` [PATCH 02/10] ARM: mmp: select pinctrl driver Haojian Zhuang
2012-10-18  9:06   ` Haojian Zhuang
2012-10-18  9:06 ` [PATCH 03/10] tty: pxa: configure pin Haojian Zhuang
2012-10-18  9:06   ` Haojian Zhuang
2012-10-18 18:21   ` Linus Walleij
2012-10-18 18:21     ` Linus Walleij
2012-10-18 22:20   ` Stephen Warren
2012-10-18 22:20     ` Stephen Warren
2012-10-22  8:45     ` Linus Walleij
2012-10-22  8:45       ` Linus Walleij
2012-10-22 20:26       ` Stephen Warren [this message]
2012-10-22 20:26         ` Stephen Warren
2012-10-23  9:26         ` Linus Walleij
2012-10-23  9:26           ` Linus Walleij
2012-10-23  9:37           ` Mark Brown
2012-10-23  9:37             ` Mark Brown
2012-10-23  9:59             ` Linus Walleij
2012-10-23  9:59               ` Linus Walleij
2012-10-23 11:58               ` Mark Brown
2012-10-23 11:58                 ` Mark Brown
2012-10-24  5:43                 ` Linus Walleij
2012-10-24  5:43                   ` Linus Walleij
2012-10-18  9:06 ` [PATCH 04/10] i2c: pxa: configure pins Haojian Zhuang
2012-10-18  9:06   ` Haojian Zhuang
2012-10-18 18:22   ` Linus Walleij
2012-10-18 18:22     ` Linus Walleij
2012-10-18  9:06 ` [PATCH 05/10] i2c: pxa: use devm_kzalloc Haojian Zhuang
2012-10-18  9:06   ` Haojian Zhuang
2012-10-18 22:27   ` Stephen Warren
2012-10-18 22:27     ` Stephen Warren
2012-10-19  1:16     ` Haojian Zhuang
2012-10-19  1:16       ` Haojian Zhuang
2012-10-18  9:07 ` [PATCH 06/10] pinctrl: single: support gpio request and free Haojian Zhuang
2012-10-18  9:07   ` Haojian Zhuang
2012-10-19 22:37   ` Tony Lindgren
2012-10-19 22:37     ` Tony Lindgren
2012-10-18  9:07 ` [PATCH 07/10] pinctrl: remove mutex lock in groups show Haojian Zhuang
2012-10-18  9:07   ` Haojian Zhuang
2012-10-18 18:29   ` Linus Walleij
2012-10-18 18:29     ` Linus Walleij
2012-10-18 22:26   ` Stephen Warren
2012-10-18 22:26     ` Stephen Warren
2012-10-22  8:53     ` Linus Walleij
2012-10-22  8:53       ` Linus Walleij
2012-10-18  9:07 ` [PATCH 08/10] pinctrl: single: support pinconf generic Haojian Zhuang
2012-10-18  9:07   ` Haojian Zhuang
2012-10-18 18:30   ` Linus Walleij
2012-10-18 18:30     ` Linus Walleij
2012-10-18 22:29     ` Tony Lindgren
2012-10-18 22:29       ` Tony Lindgren
2012-10-19  2:23       ` Haojian Zhuang
2012-10-19  2:23         ` Haojian Zhuang
2012-10-19  2:40         ` Tony Lindgren
2012-10-19  2:40           ` Tony Lindgren
2012-10-19 18:44           ` Tony Lindgren
2012-10-19 18:44             ` Tony Lindgren
2012-10-19 18:53         ` Tony Lindgren
2012-10-19 18:53           ` Tony Lindgren
2012-10-19 19:13   ` Tony Lindgren
2012-10-19 19:13     ` Tony Lindgren
2012-10-22 10:09     ` Haojian Zhuang
2012-10-22 10:09       ` Haojian Zhuang
2012-10-22 17:09       ` Tony Lindgren
2012-10-22 17:09         ` Tony Lindgren
2012-10-25 23:43         ` Tony Lindgren
2012-10-25 23:43           ` Tony Lindgren
2012-10-26  1:47           ` Haojian Zhuang
2012-10-26  1:47             ` Haojian Zhuang
2012-10-26 17:29             ` Tony Lindgren
2012-10-26 17:29               ` Tony Lindgren
2012-10-31 22:37           ` Haojian Zhuang
2012-10-31 22:37             ` Haojian Zhuang
2012-10-18  9:07 ` [PATCH 09/10] ARM: dts: support pinctrl single in pxa910 Haojian Zhuang
2012-10-18  9:07   ` Haojian Zhuang
2012-10-18  9:07 ` [PATCH 10/10] document: devicetree: bind pinconf in pinctrl single Haojian Zhuang
2012-10-18  9:07   ` Haojian Zhuang
2012-10-19 22:40   ` Tony Lindgren
2012-10-19 22:40     ` Tony Lindgren
2012-10-18 18:20 ` [PATCH 01/10] pinctrl: use postcore_initcall Linus Walleij
2012-10-18 18:20   ` Linus Walleij
2012-10-18 22:18 ` Stephen Warren
2012-10-18 22:18   ` Stephen Warren
2012-10-18 22:28   ` Tony Lindgren
2012-10-18 22:28     ` Tony Lindgren
2012-10-19  2:16     ` Haojian Zhuang
2012-10-19  2:16       ` Haojian Zhuang
2012-10-19  2:38       ` Tony Lindgren
2012-10-19  2:38         ` Tony Lindgren
2012-10-19  2:53         ` Haojian Zhuang
2012-10-19  2:53           ` Haojian Zhuang
2012-10-19 17:41           ` Tony Lindgren
2012-10-19 17:41             ` Tony Lindgren
2012-10-19  2:24 ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-19  2:24   ` Jean-Christophe PLAGNIOL-VILLARD

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=5085AC06.8070508@wwwdotorg.org \
    --to=swarren@wwwdotorg.org \
    --cc=linux-arm-kernel@lists.infradead.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.