From: p-combes@ti.com (Patrick Combes)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC][PATCH] gpiolib: add irq_wake (power-management) sysfs file
Date: Wed, 16 Nov 2011 15:30:13 +0100 [thread overview]
Message-ID: <20111116143011.GA5847@una0919255> (raw)
In-Reply-To: <20111115131636.GA31028@sirena.org.uk>
On Tue, Nov 15, 2011 at 01:16:37PM +0000, Mark Brown wrote:
> On Fri, Nov 11, 2011 at 10:40:06AM +0100, Patrick Combes wrote:
>
> > By calling poll() on the /sys/class/gpio/gpioN/value sysfs file, usermode
> > application can take benefit of gpio interrupts.
> > However, depending on the power state reached, this interrupt may not wake-up
> > the CPU.
> > This patch creates a new sysfs file /sys/class/gpio/gpioN/irq_wake to enable
> > usermode application to set the wake properties of a gpio IRQ.
> > This option can be set or not for each gpio to preserve power consumption (e.g
> > embedded systems).
>
> There's already device global control for this in sysfs via the power
> framework -
I didn't know so I had a (quick) look at it. It seems to me that this interface
will fit better for a global GPIO wakeup capability. By the way, this is maybe
what you mean by 'global control'...
Therefore, there is still a need (at least I have) for an interface with a
deeper granularity.
>
> Also...
>
> > + else if (sysfs_streq(buf, "enable") || sysfs_streq(buf, "1"))
> > + status = enable_irq_wake(gpio_to_irq(gpio));
> > + else if (sysfs_streq(buf, "disable") || sysfs_streq(buf, "0"))
> > + status = disable_irq_wake(gpio_to_irq(gpio));
> > + else
> > + status = -EINVAL;
>
> ...this doesn't do anything to stop userspace doing multiple enables and
> disables.
Do you mean there is a need to prevent that?
Basically the code above accepts both "1" or "enable" strings to enable the
property. I could limit that to "enable" / "disable" if it is confusing.
>
> > + if (gpio_irq_data)
> > + status = sprintf(buf, " Wakeup %s\n",
> > + irqd_is_wakeup_set(gpio_irq_data)
> > + ? " enable" : "disable");
>
> This is *really* non-idiomatic for sysfs output, you'd expect the sysfs
> output to look like the input. It's supposed to machine parsable...
Maybe good for the debug but not for a parser; I fix it.
WARNING: multiple messages have this Message-ID (diff)
From: Patrick Combes <p-combes@ti.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: grant.likely@secretlab.ca, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Hugo Dupras <h-dupras@ti.com>
Subject: Re: [RFC][PATCH] gpiolib: add irq_wake (power-management) sysfs file
Date: Wed, 16 Nov 2011 15:30:13 +0100 [thread overview]
Message-ID: <20111116143011.GA5847@una0919255> (raw)
In-Reply-To: <20111115131636.GA31028@sirena.org.uk>
On Tue, Nov 15, 2011 at 01:16:37PM +0000, Mark Brown wrote:
> On Fri, Nov 11, 2011 at 10:40:06AM +0100, Patrick Combes wrote:
>
> > By calling poll() on the /sys/class/gpio/gpioN/value sysfs file, usermode
> > application can take benefit of gpio interrupts.
> > However, depending on the power state reached, this interrupt may not wake-up
> > the CPU.
> > This patch creates a new sysfs file /sys/class/gpio/gpioN/irq_wake to enable
> > usermode application to set the wake properties of a gpio IRQ.
> > This option can be set or not for each gpio to preserve power consumption (e.g
> > embedded systems).
>
> There's already device global control for this in sysfs via the power
> framework -
I didn't know so I had a (quick) look at it. It seems to me that this interface
will fit better for a global GPIO wakeup capability. By the way, this is maybe
what you mean by 'global control'...
Therefore, there is still a need (at least I have) for an interface with a
deeper granularity.
>
> Also...
>
> > + else if (sysfs_streq(buf, "enable") || sysfs_streq(buf, "1"))
> > + status = enable_irq_wake(gpio_to_irq(gpio));
> > + else if (sysfs_streq(buf, "disable") || sysfs_streq(buf, "0"))
> > + status = disable_irq_wake(gpio_to_irq(gpio));
> > + else
> > + status = -EINVAL;
>
> ...this doesn't do anything to stop userspace doing multiple enables and
> disables.
Do you mean there is a need to prevent that?
Basically the code above accepts both "1" or "enable" strings to enable the
property. I could limit that to "enable" / "disable" if it is confusing.
>
> > + if (gpio_irq_data)
> > + status = sprintf(buf, " Wakeup %s\n",
> > + irqd_is_wakeup_set(gpio_irq_data)
> > + ? " enable" : "disable");
>
> This is *really* non-idiomatic for sysfs output, you'd expect the sysfs
> output to look like the input. It's supposed to machine parsable...
Maybe good for the debug but not for a parser; I fix it.
next prev parent reply other threads:[~2011-11-16 14:30 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-11 9:40 [RFC][PATCH] gpiolib: add irq_wake (power-management) sysfs file Patrick Combes
2011-11-11 9:40 ` Patrick Combes
2011-11-15 13:16 ` Mark Brown
2011-11-15 13:16 ` Mark Brown
2011-11-15 17:20 ` Russell King - ARM Linux
2011-11-15 17:20 ` Russell King - ARM Linux
2011-11-16 14:39 ` Patrick Combes
2011-11-16 14:39 ` Patrick Combes
2011-11-16 14:30 ` Patrick Combes [this message]
2011-11-16 14:30 ` Patrick Combes
2011-11-16 14:37 ` Mark Brown
2011-11-16 14:37 ` Mark Brown
2011-11-16 17:23 ` Patrick Combes
2011-11-16 17:23 ` Patrick Combes
2011-11-21 7:47 ` Linus Walleij
2011-11-21 7:47 ` Linus Walleij
-- strict thread matches above, loose matches on Subject: below --
2011-11-09 16:01 Patrick Combes
2011-11-10 18:50 ` Kevin Hilman
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=20111116143011.GA5847@una0919255 \
--to=p-combes@ti.com \
--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.