genirq: Add wakeup sysfs node to show IRQ wakeup state
Surprisingly there is no simple way to see if the IRQ line in question is wakeup source or not. Note that wakeup might be an OOB (out-of-band) source like GPIO line which makes things slightly more complicated. Add a sysfs node to cover this case. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Tested-by: Tony Lindgren <tony@atomide.com> Cc: Grygorii Strashko <grygorii.strashko@ti.com> Cc: "Rafael J . Wysocki" <rafael.j.wysocki@intel.com> Link: https://lkml.kernel.org/r/20180226155043.67937-1-andriy.shevchenko@linux.intel.com
This commit is contained in:

committed by
Thomas Gleixner

parent
e69c61dd05
commit
d61e2944b6
@@ -210,6 +210,22 @@ static ssize_t type_show(struct kobject *kobj,
|
||||
}
|
||||
IRQ_ATTR_RO(type);
|
||||
|
||||
static ssize_t wakeup_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
struct irq_desc *desc = container_of(kobj, struct irq_desc, kobj);
|
||||
ssize_t ret = 0;
|
||||
|
||||
raw_spin_lock_irq(&desc->lock);
|
||||
ret = sprintf(buf, "%s\n",
|
||||
irqd_is_wakeup_set(&desc->irq_data) ? "enabled" : "disabled");
|
||||
raw_spin_unlock_irq(&desc->lock);
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
IRQ_ATTR_RO(wakeup);
|
||||
|
||||
static ssize_t name_show(struct kobject *kobj,
|
||||
struct kobj_attribute *attr, char *buf)
|
||||
{
|
||||
@@ -253,6 +269,7 @@ static struct attribute *irq_attrs[] = {
|
||||
&chip_name_attr.attr,
|
||||
&hwirq_attr.attr,
|
||||
&type_attr.attr,
|
||||
&wakeup_attr.attr,
|
||||
&name_attr.attr,
|
||||
&actions_attr.attr,
|
||||
NULL
|
||||
|
Reference in New Issue
Block a user