All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: balbi@ti.com
Cc: Linus Walleij <linus.walleij@linaro.org>,
	Benoit Cousson <b-cousson@ti.com>,
	Sourav Poddar <sourav.poddar@ti.com>,
	tony@atomide.com, linux-omap@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	devicetree-discuss@lists.ozlabs.org,
	linux-arm-kernel@lists.infradead.org,
	linux-input@vger.kernel.org
Subject: Re: [PATCHv2] Input: omap4-keypad: Add pinctrl support
Date: Wed, 24 Oct 2012 10:58:53 -0700	[thread overview]
Message-ID: <64355430.MNHe7H1cg3@dtor-d630.eng.vmware.com> (raw)
In-Reply-To: <20121024165749.GB32220@arwen.pp.htv.fi>

On Wednesday, October 24, 2012 07:57:49 PM Felipe Balbi wrote:
> Hi,
> 
> On Wed, Oct 24, 2012 at 09:18:01AM -0700, Dmitry Torokhov wrote:
> > On Wed, Oct 24, 2012 at 02:54:23PM +0200, Linus Walleij wrote:
> > > On Tue, Oct 23, 2012 at 10:02 PM, Dmitry Torokhov
> > > 
> > > <dmitry.torokhov@gmail.com> wrote:
> > > > I have seen just in a few days 3 or 4 drivers having exactly the same
> > > > change - call to devm_pinctrl_get_select_default(), and I guess I will
> > > > receive the same patches for the rest of input drivers shortly.
> > > > This suggests that the operation is done at the wrong level. Do the
> > > > pin configuration as you parse DT data, the same way you set up i2c
> > > > devices registers in of_i2c.c, and leave the individual drivers that
> > > > do
> > > > not care about specifics alone.
> > > 
> > > Exactly this can be done with pinctrl hogs.
> > > 
> > > The problem with that is that it removes the cross-reference
> > > between the device and it's pinctrl handle (also from the device
> > > tree). Instead the pinctrl handle gets referenced to the pin controller
> > > itself. So from a modelling perpective this looks a bit ugly.
> > > 
> > > So we have two kinds of ugly:
> > > 
> > > - Sprinke devm_pinctrl_get_select_default() over all drivers
> > > 
> > >   which makes pinctrl handles properly reference their devices
> > > 
> > > - Use hogs and loose coupling between pinctrl handles and their
> > > 
> > >   devices
> > > 
> > > A third alternative as outlined is to use notifiers and some
> > > resource core in drivers/base/*
> > 
> > OK, so with drivers/base/, have you considered doing default pinctrl
> > selection in bus's probe() methods? Yo would select the default
> > configuration before starting probing the device and maybe select idle
> > when probe fails or device is unbound? That would still keep the link
> > between device object and pinctrl and there less busses than device
> > drivers out there.
> 
> it starts to become confusing after a while. I mean, there's a reason
> why all drivers explictly call pm_runtim_enable(), right ?

Right. Because not all of them support runtime PM and quite usually their
PM methods are not ready to go until initialization is complete. And again,
the driver here controls its own behavior.

> 
> From a first thought, one could think of just yanking that into bus'
> probe() as you may suggest, but sometimes the device is already enabled,
> so we need extra tricks:
> 
> pm_runtime_set_active();
> pm_runtime_enable();
> pm_runtime_get();
> 
> the same could happen with pinctrl eventually. What if a device needs to
> do something else (an errata fix as an example) before requesting
> pinctrl's default state ?

That is a valid concern and we'll need to find a compromise here. As I said,
I am not saying that no driver should ever touch pinctrl. I can see, for
example, input drivers actually disabling pins until they are ->open()ed,
in addition of doing that at [runtime] suspend/resume. But it would be nice
if we could have "dumb" drivers not care about pins.

Thanks.

-- 
Dmitry

WARNING: multiple messages have this Message-ID (diff)
From: dmitry.torokhov@gmail.com (Dmitry Torokhov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2] Input: omap4-keypad: Add pinctrl support
Date: Wed, 24 Oct 2012 10:58:53 -0700	[thread overview]
Message-ID: <64355430.MNHe7H1cg3@dtor-d630.eng.vmware.com> (raw)
In-Reply-To: <20121024165749.GB32220@arwen.pp.htv.fi>

On Wednesday, October 24, 2012 07:57:49 PM Felipe Balbi wrote:
> Hi,
> 
> On Wed, Oct 24, 2012 at 09:18:01AM -0700, Dmitry Torokhov wrote:
> > On Wed, Oct 24, 2012 at 02:54:23PM +0200, Linus Walleij wrote:
> > > On Tue, Oct 23, 2012 at 10:02 PM, Dmitry Torokhov
> > > 
> > > <dmitry.torokhov@gmail.com> wrote:
> > > > I have seen just in a few days 3 or 4 drivers having exactly the same
> > > > change - call to devm_pinctrl_get_select_default(), and I guess I will
> > > > receive the same patches for the rest of input drivers shortly.
> > > > This suggests that the operation is done at the wrong level. Do the
> > > > pin configuration as you parse DT data, the same way you set up i2c
> > > > devices registers in of_i2c.c, and leave the individual drivers that
> > > > do
> > > > not care about specifics alone.
> > > 
> > > Exactly this can be done with pinctrl hogs.
> > > 
> > > The problem with that is that it removes the cross-reference
> > > between the device and it's pinctrl handle (also from the device
> > > tree). Instead the pinctrl handle gets referenced to the pin controller
> > > itself. So from a modelling perpective this looks a bit ugly.
> > > 
> > > So we have two kinds of ugly:
> > > 
> > > - Sprinke devm_pinctrl_get_select_default() over all drivers
> > > 
> > >   which makes pinctrl handles properly reference their devices
> > > 
> > > - Use hogs and loose coupling between pinctrl handles and their
> > > 
> > >   devices
> > > 
> > > A third alternative as outlined is to use notifiers and some
> > > resource core in drivers/base/*
> > 
> > OK, so with drivers/base/, have you considered doing default pinctrl
> > selection in bus's probe() methods? Yo would select the default
> > configuration before starting probing the device and maybe select idle
> > when probe fails or device is unbound? That would still keep the link
> > between device object and pinctrl and there less busses than device
> > drivers out there.
> 
> it starts to become confusing after a while. I mean, there's a reason
> why all drivers explictly call pm_runtim_enable(), right ?

Right. Because not all of them support runtime PM and quite usually their
PM methods are not ready to go until initialization is complete. And again,
the driver here controls its own behavior.

> 
> From a first thought, one could think of just yanking that into bus'
> probe() as you may suggest, but sometimes the device is already enabled,
> so we need extra tricks:
> 
> pm_runtime_set_active();
> pm_runtime_enable();
> pm_runtime_get();
> 
> the same could happen with pinctrl eventually. What if a device needs to
> do something else (an errata fix as an example) before requesting
> pinctrl's default state ?

That is a valid concern and we'll need to find a compromise here. As I said,
I am not saying that no driver should ever touch pinctrl. I can see, for
example, input drivers actually disabling pins until they are ->open()ed,
in addition of doing that at [runtime] suspend/resume. But it would be nice
if we could have "dumb" drivers not care about pins.

Thanks.

-- 
Dmitry

  parent reply	other threads:[~2012-10-24 17:59 UTC|newest]

Thread overview: 162+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-22 13:13 [PATCHv2] Input: omap4-keypad: Add pinctrl support Sourav Poddar
2012-10-22 13:13 ` Sourav Poddar
2012-10-22 13:13 ` Sourav Poddar
2012-10-22 15:50 ` Dmitry Torokhov
2012-10-22 15:50   ` Dmitry Torokhov
2012-10-23  9:13   ` Linus Walleij
2012-10-23  9:13     ` Linus Walleij
2012-10-23  9:35     ` Benoit Cousson
2012-10-23  9:35       ` Benoit Cousson
2012-10-23  9:35       ` Benoit Cousson
2012-10-23 10:04       ` Linus Walleij
2012-10-23 10:04         ` Linus Walleij
2012-10-23 10:03         ` Felipe Balbi
2012-10-23 10:03           ` Felipe Balbi
2012-10-23 10:03           ` Felipe Balbi
2012-10-23 10:23           ` Thomas Petazzoni
2012-10-23 10:23             ` Thomas Petazzoni
2012-10-23 10:29             ` Linus Walleij
2012-10-23 10:29               ` Linus Walleij
2012-10-23 10:29               ` Felipe Balbi
2012-10-23 10:29                 ` Felipe Balbi
2012-10-23 10:29                 ` Felipe Balbi
2012-10-23 10:45                 ` Linus Walleij
2012-10-23 10:45                   ` Linus Walleij
2012-10-23 10:42                   ` Felipe Balbi
2012-10-23 10:42                     ` Felipe Balbi
2012-10-23 10:42                     ` Felipe Balbi
2012-10-23 11:11                   ` Thomas Petazzoni
2012-10-23 11:11                     ` Thomas Petazzoni
2012-10-23 17:02           ` Mitch Bradley
2012-10-23 17:02             ` Mitch Bradley
2012-10-23 17:20             ` Felipe Balbi
2012-10-23 17:20               ` Felipe Balbi
2012-10-23 17:20               ` Felipe Balbi
2012-10-23 17:51               ` Mitch Bradley
2012-10-23 17:51                 ` Mitch Bradley
     [not found]                 ` <5086D91A.5080109-D5eQfiDGL7eakBO8gow8eQ@public.gmane.org>
2012-10-23 17:51                   ` Felipe Balbi
2012-10-23 17:51                     ` Felipe Balbi
2012-10-23 17:51                     ` Felipe Balbi
     [not found]   ` <20121022155028.GA13791-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>
2012-10-23  9:18     ` Benoit Cousson
2012-10-23  9:18       ` Benoit Cousson
2012-10-23  9:18       ` Benoit Cousson
2012-10-23 20:02       ` Dmitry Torokhov
2012-10-23 20:02         ` Dmitry Torokhov
     [not found]         ` <20121023200249.GA2712-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>
2012-10-24  8:37           ` Felipe Balbi
2012-10-24  8:37             ` Felipe Balbi
2012-10-24  8:37             ` Felipe Balbi
2012-10-24 16:14             ` Dmitry Torokhov
2012-10-24 16:14               ` Dmitry Torokhov
2012-10-24 16:51               ` Linus Walleij
2012-10-24 16:51                 ` Linus Walleij
2012-10-24 17:28                 ` Dmitry Torokhov
2012-10-24 17:28                   ` Dmitry Torokhov
2012-10-24 18:58                   ` Felipe Balbi
2012-10-24 18:58                     ` Felipe Balbi
2012-10-24 18:58                     ` Felipe Balbi
     [not found]                     ` <20121024185818.GB772-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2012-10-25 20:59                       ` Mark Brown
2012-10-25 20:59                         ` Mark Brown
2012-10-25 20:59                         ` Mark Brown
2012-10-26  6:20                         ` Felipe Balbi
2012-10-26  6:20                           ` Felipe Balbi
2012-10-26  6:20                           ` Felipe Balbi
2012-10-26 16:03                           ` Mark Brown
2012-10-26 16:03                             ` Mark Brown
2012-10-29 19:49                             ` Felipe Balbi
2012-10-29 19:49                               ` Felipe Balbi
2012-10-29 19:49                               ` Felipe Balbi
2012-10-30 11:24                               ` Mark Brown
2012-10-30 11:24                                 ` Mark Brown
2012-10-30 11:49                                 ` Felipe Balbi
2012-10-30 11:49                                   ` Felipe Balbi
2012-10-30 11:49                                   ` Felipe Balbi
2012-10-30 14:07                                   ` Mark Brown
2012-10-30 14:07                                     ` Mark Brown
2012-10-30 14:16                                     ` Linus Walleij
2012-10-30 14:16                                       ` Linus Walleij
2012-10-30 14:54                                       ` Mark Brown
2012-10-30 14:54                                         ` Mark Brown
2012-10-30 15:16                                     ` Felipe Balbi
2012-10-30 15:16                                       ` Felipe Balbi
2012-10-30 15:16                                       ` Felipe Balbi
2012-10-30 15:58                                       ` Mark Brown
2012-10-30 15:58                                         ` Mark Brown
2012-10-30 17:25                                         ` Felipe Balbi
2012-10-30 17:25                                           ` Felipe Balbi
2012-10-30 17:25                                           ` Felipe Balbi
2012-10-30 18:20                                           ` Dmitry Torokhov
2012-10-30 18:20                                             ` Dmitry Torokhov
2012-10-30 18:48                                             ` Felipe Balbi
2012-10-30 18:48                                               ` Felipe Balbi
2012-10-30 18:48                                               ` Felipe Balbi
2012-10-30 18:37                                           ` Mark Brown
2012-10-30 18:37                                             ` Mark Brown
2012-10-30 21:51                                             ` Linus Walleij
2012-10-30 21:51                                               ` Linus Walleij
2012-10-30 22:57                                               ` Rafael J. Wysocki
2012-10-30 22:57                                                 ` Rafael J. Wysocki
2012-11-02 18:26                                               ` Mark Brown
2012-11-02 18:26                                                 ` Mark Brown
2012-10-30 14:11                                   ` Linus Walleij
2012-10-30 14:11                                     ` Linus Walleij
2012-10-28 20:12                   ` Linus Walleij
2012-10-28 20:12                     ` Linus Walleij
     [not found]                     ` <CACRpkdaiLXVeUg1quuw3XPTenbKOjn+aWbGQezpcyvzQCtCWow-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-10-30 11:34                       ` Mark Brown
2012-10-30 11:34                         ` Mark Brown
2012-10-30 11:34                         ` Mark Brown
2012-10-30 14:02                         ` Linus Walleij
2012-10-30 14:02                           ` Linus Walleij
2012-10-30 14:37                           ` Mark Brown
2012-10-30 14:37                             ` Mark Brown
2012-10-31 20:10                           ` Kevin Hilman
2012-10-31 20:10                             ` Kevin Hilman
     [not found]                             ` <87obji8kta.fsf-1D3HCaltpLuhEniVeURVKkEOCMrvLtNR@public.gmane.org>
2012-11-01  8:54                               ` Linus Walleij
2012-11-01  8:54                                 ` Linus Walleij
2012-11-01  8:56                                 ` Fwd: " Linus Walleij
2012-11-01  8:56                                   ` Linus Walleij
2012-11-01 11:42                                   ` Kevin Hilman
2012-11-01 11:42                                     ` Kevin Hilman
2012-11-01 13:22                                     ` Linus Walleij
2012-11-01 13:22                                       ` Linus Walleij
2012-11-01 12:07                                 ` Mark Brown
2012-11-01 12:07                                   ` Mark Brown
2012-11-01 14:01                                   ` Linus Walleij
2012-11-01 14:01                                     ` Linus Walleij
2012-11-01 14:19                                     ` Mark Brown
2012-11-01 14:19                                       ` Mark Brown
2012-11-11 12:32                                     ` Linus Walleij
2012-11-11 12:32                                       ` Linus Walleij
2012-10-31 13:19                     ` Jean-Christophe PLAGNIOL-VILLARD
2012-10-31 13:19                       ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]               ` <20121024161429.GA16350-WlK9ik9hQGAhIp7JRqBPierSzoNAToWh@public.gmane.org>
2012-10-24 16:52                 ` Felipe Balbi
2012-10-24 16:52                   ` Felipe Balbi
2012-10-24 16:52                   ` Felipe Balbi
2012-10-24 17:13                   ` Linus Walleij
2012-10-24 17:13                     ` Linus Walleij
2012-10-24 17:34                   ` Dmitry Torokhov
2012-10-24 17:34                     ` Dmitry Torokhov
2012-10-24 17:46               ` Benoit Cousson
2012-10-24 17:46                 ` Benoit Cousson
2012-10-24 17:46                 ` Benoit Cousson
2012-10-24 12:54         ` Linus Walleij
2012-10-24 12:54           ` Linus Walleij
2012-10-24 16:18           ` Dmitry Torokhov
2012-10-24 16:18             ` Dmitry Torokhov
2012-10-24 16:57             ` Felipe Balbi
2012-10-24 16:57               ` Felipe Balbi
2012-10-24 16:57               ` Felipe Balbi
2012-10-24 17:18               ` Linus Walleij
2012-10-24 17:18                 ` Linus Walleij
2012-10-24 17:58               ` Dmitry Torokhov [this message]
2012-10-24 17:58                 ` Dmitry Torokhov
2012-10-24 19:10                 ` Felipe Balbi
2012-10-24 19:10                   ` Felipe Balbi
2012-10-24 19:10                   ` Felipe Balbi
     [not found]                   ` <20121024191042.GC772-S8G//mZuvNWo5Im9Ml3/Zg@public.gmane.org>
2012-10-24 19:38                     ` Dmitry Torokhov
2012-10-24 19:38                       ` Dmitry Torokhov
2012-10-24 19:38                       ` Dmitry Torokhov
2012-10-24 19:51                       ` Felipe Balbi
2012-10-24 19:51                         ` Felipe Balbi
2012-10-24 19:51                         ` Felipe Balbi
2012-10-24 17:01             ` Linus Walleij
2012-10-24 17:01               ` Linus Walleij

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=64355430.MNHe7H1cg3@dtor-d630.eng.vmware.com \
    --to=dmitry.torokhov@gmail.com \
    --cc=b-cousson@ti.com \
    --cc=balbi@ti.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=sourav.poddar@ti.com \
    --cc=tony@atomide.com \
    /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.