All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomasz Figa <t.figa@samsung.com>
To: Thomas Abraham <thomas.abraham@linaro.org>
Cc: linux-i2c@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-samsung-soc@vger.kernel.org, linus.walleij@linaro.org,
	dong.aisheng@linaro.org, swarren@wwwdotorg.org,
	kgene.kim@samsung.com, patches@linaro.org, w.sang@pengutronix.de,
	ben-linux@fluff.org
Subject: Re: [PATCH 1/2] i2c: s3c2410: add optional pin configuration using pinctrl interface
Date: Thu, 06 Sep 2012 14:28:30 +0200	[thread overview]
Message-ID: <1390693.DWkgTZ1iNF@amdc1227> (raw)
In-Reply-To: <CAJuYYwQCQDTnpPR5WABtbozZOgc6_SZRBv3b6D8KY78tzMt-Eg@mail.gmail.com>

Hi,

Thanks for your comments.

On Thursday 06 of September 2012 16:36:08 Thomas Abraham wrote:
> > This patch shows the problem of the need to explicitly migrate all
> > drivers to pinctrl.
> > 
> > Maybe we should consider extending the pinctrl subsystem to set the
> > default state automatically before binding a driver to a device, at
> > least in case of DT-based platforms?
> 
> The pinctrl driver allows for activating default pin configuration
> when the pinctrl driver loads. This is referred to as "hogging".

What I suggested is that such default configuration would be applied just 
before binding a driver, i.e. when it's almost sure that the device will be 
actually used and the configuration will be needed.

Of course such functionality would not have to be obligatory. For example, 
we could add new property, like pinctrl-set-default, to point in device 
tree that this device should have its pinctrl state set up automatically.

> But
> should hog be used or not is something that needs to be decided. Some
> of the factors which favor the driver explicitly setting up the pin
> configuration are
> 
> 1. After a suspend and resume cycle, the pin configuration registers
> may be reset to default values. Hence, during resume, the pin
> configuration has be redone.

In my opinion it should be saved and restored by pinctrl driver (as it was 
done in case of GPIO subsystem previously). This is because the driver can 
usually quickly restore all pins at once and some hardware even provide 
facilities for restoring pin configuration after suspend. (e.g. s3c6410, 
probably not going to use pinctrl, but possibly there are more systems 
using this kind of solution, which allows to switch all pins at once from 
sleep mode settings to normal mode).

> 2. Runtime muxing/config is possible.

Of course, for cases where runtime remuxing is required this would be no 
option, but often there is just a single pin configuration used all the 
time.

> 3. Setting some of the config options such as pull-up by default might
> start consuming power from boot time itself, which could be avoided if
> such setup is done only when needed.

Making it optional would solve this issue, because in such cases the driver 
already has to be aware of setting pull-ups and similar.

> Adding pinctrl driver support in device drivers seems to be simple
> task. And it is just one time effort which can be reused on multiple
> SoC's.

I agree. Although not modifying the drivers at all would be nicer.

Best regards,
-- 
Tomasz Figa
Samsung Poland R&D Center

WARNING: multiple messages have this Message-ID (diff)
From: t.figa@samsung.com (Tomasz Figa)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] i2c: s3c2410: add optional pin configuration using pinctrl interface
Date: Thu, 06 Sep 2012 14:28:30 +0200	[thread overview]
Message-ID: <1390693.DWkgTZ1iNF@amdc1227> (raw)
In-Reply-To: <CAJuYYwQCQDTnpPR5WABtbozZOgc6_SZRBv3b6D8KY78tzMt-Eg@mail.gmail.com>

Hi,

Thanks for your comments.

On Thursday 06 of September 2012 16:36:08 Thomas Abraham wrote:
> > This patch shows the problem of the need to explicitly migrate all
> > drivers to pinctrl.
> > 
> > Maybe we should consider extending the pinctrl subsystem to set the
> > default state automatically before binding a driver to a device, at
> > least in case of DT-based platforms?
> 
> The pinctrl driver allows for activating default pin configuration
> when the pinctrl driver loads. This is referred to as "hogging".

What I suggested is that such default configuration would be applied just 
before binding a driver, i.e. when it's almost sure that the device will be 
actually used and the configuration will be needed.

Of course such functionality would not have to be obligatory. For example, 
we could add new property, like pinctrl-set-default, to point in device 
tree that this device should have its pinctrl state set up automatically.

> But
> should hog be used or not is something that needs to be decided. Some
> of the factors which favor the driver explicitly setting up the pin
> configuration are
> 
> 1. After a suspend and resume cycle, the pin configuration registers
> may be reset to default values. Hence, during resume, the pin
> configuration has be redone.

In my opinion it should be saved and restored by pinctrl driver (as it was 
done in case of GPIO subsystem previously). This is because the driver can 
usually quickly restore all pins at once and some hardware even provide 
facilities for restoring pin configuration after suspend. (e.g. s3c6410, 
probably not going to use pinctrl, but possibly there are more systems 
using this kind of solution, which allows to switch all pins at once from 
sleep mode settings to normal mode).

> 2. Runtime muxing/config is possible.

Of course, for cases where runtime remuxing is required this would be no 
option, but often there is just a single pin configuration used all the 
time.

> 3. Setting some of the config options such as pull-up by default might
> start consuming power from boot time itself, which could be avoided if
> such setup is done only when needed.

Making it optional would solve this issue, because in such cases the driver 
already has to be aware of setting pull-ups and similar.

> Adding pinctrl driver support in device drivers seems to be simple
> task. And it is just one time effort which can be reused on multiple
> SoC's.

I agree. Although not modifying the drivers at all would be nicer.

Best regards,
-- 
Tomasz Figa
Samsung Poland R&D Center

  reply	other threads:[~2012-09-06 12:28 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-06  9:22 [PATCH 0/2] i2c: s3c2410: allow pin pin configuration using pinctrl Thomas Abraham
2012-09-06  9:22 ` Thomas Abraham
2012-09-06  9:23 ` [PATCH 1/2] i2c: s3c2410: add optional pin configuration using pinctrl interface Thomas Abraham
2012-09-06  9:23   ` Thomas Abraham
2012-09-06  9:34   ` Tomasz Figa
2012-09-06  9:34     ` Tomasz Figa
2012-09-06 11:06     ` Thomas Abraham
2012-09-06 11:06       ` Thomas Abraham
2012-09-06 12:28       ` Tomasz Figa [this message]
2012-09-06 12:28         ` Tomasz Figa
2012-09-10 19:55         ` Linus Walleij
2012-09-10 19:55           ` Linus Walleij
2012-09-10 19:21       ` Stephen Warren
2012-09-10 19:21         ` Stephen Warren
     [not found]         ` <504E3DBA.3080603-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2012-09-17  7:28           ` Thomas Abraham
2012-09-17  7:28             ` Thomas Abraham
2012-09-10 20:02   ` Linus Walleij
2012-09-10 20:02     ` Linus Walleij
     [not found]     ` <CACRpkdZ7kjfDQ-CNCcCv5fQwSqMez6sKSMUMLB=0Aviboiz=2g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2012-09-17  7:52       ` Thomas Abraham
2012-09-17  7:52         ` Thomas Abraham
     [not found] ` <1346923381-14144-1-git-send-email-thomas.abraham-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2012-09-06  9:23   ` [PATCH 2/2] ARM: dts: exynos4: allow i2c0 bus to be configured " Thomas Abraham
2012-09-06  9:23     ` Thomas Abraham
2012-09-06 10:13     ` Tomasz Figa
2012-09-06 10:13       ` Tomasz Figa
2012-09-06 11:14       ` Thomas Abraham
2012-09-06 11:14         ` Thomas Abraham
2012-09-10 19:23         ` Stephen Warren
2012-09-10 19:23           ` Stephen Warren

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=1390693.DWkgTZ1iNF@amdc1227 \
    --to=t.figa@samsung.com \
    --cc=ben-linux@fluff.org \
    --cc=dong.aisheng@linaro.org \
    --cc=kgene.kim@samsung.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-samsung-soc@vger.kernel.org \
    --cc=patches@linaro.org \
    --cc=swarren@wwwdotorg.org \
    --cc=thomas.abraham@linaro.org \
    --cc=w.sang@pengutronix.de \
    /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.