All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@ti.com>
To: Tim Niemeyer <tim.niemeyer@corscience.de>
Cc: balbi@ti.com, Linux OMAP List <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] gpio: omap-gpio: add support for pm_runtime autosuspend
Date: Fri, 26 Oct 2012 14:42:50 +0300	[thread overview]
Message-ID: <20121026114250.GA26342@arwen.pp.htv.fi> (raw)
In-Reply-To: <1351248155.2182.26.camel@herbert.er.corscience.de>

[-- Attachment #1: Type: text/plain, Size: 2258 bytes --]

On Fri, Oct 26, 2012 at 12:42:35PM +0200, Tim Niemeyer wrote:
> Am Freitag, den 26.10.2012, 11:03 +0300 schrieb Felipe Balbi:
> > Hi,
> > 
> > On Fri, Oct 26, 2012 at 09:55:30AM +0200, Tim Niemeyer wrote:
> > > Adds support for configuring the omap-gpio driver use autosuspend for
> > > runtime power management. This can reduce the latency in using it by
> > > not suspending the device immediately on idle. If another access takes
> > > place before the autosuspend timeout (2 secs), the call to resume the
> > > device can return immediately saving some save/ restore cycles.
> > > 
> > > I use a gpio to monitor a spi transfer which occurs every 250µs. The
> > > suspend overhead is to high, so almost every second transfer is lost.
> > > This patch fixes that.
> > > 
> > > Signed-off-by: Tim Niemeyer <tim.niemeyer@corscience.de>
> > > ---
> > >  drivers/gpio/gpio-omap.c |   23 ++++++++++++++++++-----
> > >  1 files changed, 18 insertions(+), 5 deletions(-)
> > > 
> > > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> > > index 94cbc84..92f48cb 100644
> > > --- a/drivers/gpio/gpio-omap.c
> > > +++ b/drivers/gpio/gpio-omap.c
> > > @@ -31,6 +31,7 @@
> > >  #include <asm/mach/irq.h>
> > >  
> > >  #define OFF_MODE	1
> > > +#define GPIO_AUTOSUSPEND_TIMEOUT                2000
> > >  
> > >  static LIST_HEAD(omap_gpio_list);
> > >  
> > > @@ -628,8 +629,10 @@ static void omap_gpio_free(struct gpio_chip *chip, unsigned offset)
> > >  	 * If this is the last gpio to be freed in the bank,
> > >  	 * disable the bank module.
> > >  	 */
> > > -	if (!bank->mod_usage)
> > > -		pm_runtime_put(bank->dev);
> > > +	if (!bank->mod_usage) {
> > 
> > while at that I would drop this bank->mod_usage nonsense and let
> > power core handle reference counting.
> I looked at it, but i'm unsure about the GPIO_MOD_CTRL_BIT. The
> bank->mod_usage counter prevents omap_gpio_free() to disable the hole
> bank while another gpio is still in use.

pm core's usage count will do the same thing. If you request 6 gpios,
you will have 6 pm_runtime_get(). If you free 5 of those, you will have
5 pm_runtime_put_autosuspend() which will only decrement the counter and
do nothing else.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-10-26 11:48 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-26  7:55 [PATCH] gpio: omap-gpio: add support for pm_runtime autosuspend Tim Niemeyer
2012-10-26  8:03 ` Felipe Balbi
2012-10-26 10:42   ` Tim Niemeyer
2012-10-26 11:42     ` Felipe Balbi [this message]
2012-10-26 13:19       ` Tim Niemeyer
2012-10-26 20:01         ` Felipe Balbi
2012-10-26 21:39           ` Jon Hunter
2012-10-27 10:58             ` Santosh Shilimkar
2012-10-29  8:52           ` Tim Niemeyer
2012-10-29  6:47         ` Santosh Shilimkar
2012-10-29  8:05           ` Felipe Balbi
2012-10-29  8:23             ` Santosh Shilimkar
2012-10-29 20:03               ` Felipe Balbi
2012-10-30  6:32                 ` Santosh Shilimkar
2012-10-30  7:09                   ` Felipe Balbi
2012-10-30 14:16                     ` Jon Hunter
2012-10-30 15:10                       ` Felipe Balbi
2012-10-31 10:15                         ` Jon Hunter
2012-10-31 10:15                           ` Felipe Balbi
2012-10-31 10:37                   ` Kevin Hilman
2012-10-31 11:05                     ` Santosh Shilimkar
2012-10-29  8:43           ` Tim Niemeyer

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=20121026114250.GA26342@arwen.pp.htv.fi \
    --to=balbi@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=tim.niemeyer@corscience.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.