Re: [RFC][PATCH] gpiolib: add irq_wake (power-management) sysfs file

From: Linus Walleij
Date: Mon Nov 21 2011 - 02:47:51 EST


On Fri, Nov 11, 2011 at 10:40 AM, Patrick Combes <p-combes@xxxxxx> 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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/