lkml.org 
[lkml]   [2011]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC][PATCH] gpiolib: add irq_wake (power-management) sysfs file
From
On Fri, Nov 11, 2011 at 10:40 AM, Patrick Combes <p-combes@ti.com> wrote:

> 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).
(...)
> +       if (!test_bit(FLAG_EXPORT, &desc->flags))
> +               status = -EIO;
> +       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;

As noted elsewhere, human-readable files go into debugfs.

sysfs rule is one file, one value.

Create a file ile named "irq_wakeup_enable" that works
like this:

cat wakeup_enable
0
echo 1 > wakeup_enable
cat wakeup_enable
1

Also document you new ABI in
Documentation/ABI/testing/*
and preferabley write some new words on it
in Documentation/gpio.txt too.

Thanks!
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-11-21 08:51    [W:0.129 / U:0.284 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site