Skip to content

Commit 5ff8116

Browse files
Raul E Rangelrafaeljw
authored andcommitted
ACPI: resources: Add wake_capable parameter to acpi_dev_irq_flags
ACPI IRQ/Interrupt resources contain a bit that describes if the interrupt should wake the system. This change exposes that bit via a new IORESOURCE_IRQ_WAKECAPABLE flag. Drivers should check this flag before arming an IRQ to wake the system. Signed-off-by: Raul E Rangel <[email protected]> Reviewed-by: Andy Shevchenko <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 4c99256 commit 5ff8116

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

drivers/acpi/irq.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ struct acpi_irq_parse_one_ctx {
147147
* @polarity: polarity attributes of hwirq
148148
* @polarity: polarity attributes of hwirq
149149
* @shareable: shareable attributes of hwirq
150+
* @wake_capable: wake capable attribute of hwirq
150151
* @ctx: acpi_irq_parse_one_ctx updated by this function
151152
*
152153
* Description:
@@ -156,12 +157,13 @@ struct acpi_irq_parse_one_ctx {
156157
static inline void acpi_irq_parse_one_match(struct fwnode_handle *fwnode,
157158
u32 hwirq, u8 triggering,
158159
u8 polarity, u8 shareable,
160+
u8 wake_capable,
159161
struct acpi_irq_parse_one_ctx *ctx)
160162
{
161163
if (!fwnode)
162164
return;
163165
ctx->rc = 0;
164-
*ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable);
166+
*ctx->res_flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
165167
ctx->fwspec->fwnode = fwnode;
166168
ctx->fwspec->param[0] = hwirq;
167169
ctx->fwspec->param[1] = acpi_dev_get_irq_type(triggering, polarity);
@@ -204,7 +206,7 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
204206
fwnode = acpi_get_gsi_domain_id(irq->interrupts[ctx->index]);
205207
acpi_irq_parse_one_match(fwnode, irq->interrupts[ctx->index],
206208
irq->triggering, irq->polarity,
207-
irq->shareable, ctx);
209+
irq->shareable, irq->wake_capable, ctx);
208210
return AE_CTRL_TERMINATE;
209211
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
210212
eirq = &ares->data.extended_irq;
@@ -218,7 +220,7 @@ static acpi_status acpi_irq_parse_one_cb(struct acpi_resource *ares,
218220
eirq->interrupts[ctx->index]);
219221
acpi_irq_parse_one_match(fwnode, eirq->interrupts[ctx->index],
220222
eirq->triggering, eirq->polarity,
221-
eirq->shareable, ctx);
223+
eirq->shareable, eirq->wake_capable, ctx);
222224
return AE_CTRL_TERMINATE;
223225
}
224226

drivers/acpi/resource.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,9 @@ EXPORT_SYMBOL_GPL(acpi_dev_resource_ext_address_space);
336336
* @triggering: Triggering type as provided by ACPI.
337337
* @polarity: Interrupt polarity as provided by ACPI.
338338
* @shareable: Whether or not the interrupt is shareable.
339+
* @wake_capable: Wake capability as provided by ACPI.
339340
*/
340-
unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable)
341+
unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable, u8 wake_capable)
341342
{
342343
unsigned long flags;
343344

@@ -351,6 +352,9 @@ unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable)
351352
if (shareable == ACPI_SHARED)
352353
flags |= IORESOURCE_IRQ_SHAREABLE;
353354

355+
if (wake_capable == ACPI_WAKE_CAPABLE)
356+
flags |= IORESOURCE_IRQ_WAKECAPABLE;
357+
354358
return flags | IORESOURCE_IRQ;
355359
}
356360
EXPORT_SYMBOL_GPL(acpi_dev_irq_flags);
@@ -442,7 +446,7 @@ static bool acpi_dev_irq_override(u32 gsi, u8 triggering, u8 polarity,
442446

443447
static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
444448
u8 triggering, u8 polarity, u8 shareable,
445-
bool check_override)
449+
u8 wake_capable, bool check_override)
446450
{
447451
int irq, p, t;
448452

@@ -475,7 +479,7 @@ static void acpi_dev_get_irqresource(struct resource *res, u32 gsi,
475479
}
476480
}
477481

478-
res->flags = acpi_dev_irq_flags(triggering, polarity, shareable);
482+
res->flags = acpi_dev_irq_flags(triggering, polarity, shareable, wake_capable);
479483
irq = acpi_register_gsi(NULL, gsi, triggering, polarity);
480484
if (irq >= 0) {
481485
res->start = irq;
@@ -523,7 +527,8 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
523527
}
524528
acpi_dev_get_irqresource(res, irq->interrupts[index],
525529
irq->triggering, irq->polarity,
526-
irq->shareable, true);
530+
irq->shareable, irq->wake_capable,
531+
true);
527532
break;
528533
case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
529534
ext_irq = &ares->data.extended_irq;
@@ -534,7 +539,8 @@ bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
534539
if (is_gsi(ext_irq))
535540
acpi_dev_get_irqresource(res, ext_irq->interrupts[index],
536541
ext_irq->triggering, ext_irq->polarity,
537-
ext_irq->shareable, false);
542+
ext_irq->shareable, ext_irq->wake_capable,
543+
false);
538544
else
539545
irqresource_disabled(res, 0);
540546
break;

drivers/pnp/pnpacpi/rsparser.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,8 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
206206
if (i >= 0) {
207207
flags = acpi_dev_irq_flags(gpio->triggering,
208208
gpio->polarity,
209-
gpio->shareable);
209+
gpio->shareable,
210+
gpio->wake_capable);
210211
} else {
211212
flags = IORESOURCE_DISABLED;
212213
}
@@ -315,7 +316,7 @@ static __init void pnpacpi_parse_irq_option(struct pnp_dev *dev,
315316
if (p->interrupts[i])
316317
__set_bit(p->interrupts[i], map.bits);
317318

318-
flags = acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable);
319+
flags = acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable, p->wake_capable);
319320
pnp_register_irq_resource(dev, option_flags, &map, flags);
320321
}
321322

@@ -339,7 +340,7 @@ static __init void pnpacpi_parse_ext_irq_option(struct pnp_dev *dev,
339340
}
340341
}
341342

342-
flags = acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable);
343+
flags = acpi_dev_irq_flags(p->triggering, p->polarity, p->shareable, p->wake_capable);
343344
pnp_register_irq_resource(dev, option_flags, &map, flags);
344345
}
345346

include/linux/acpi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ bool acpi_dev_resource_address_space(struct acpi_resource *ares,
495495
struct resource_win *win);
496496
bool acpi_dev_resource_ext_address_space(struct acpi_resource *ares,
497497
struct resource_win *win);
498-
unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable);
498+
unsigned long acpi_dev_irq_flags(u8 triggering, u8 polarity, u8 shareable, u8 wake_capable);
499499
unsigned int acpi_dev_get_irq_type(int triggering, int polarity);
500500
bool acpi_dev_resource_interrupt(struct acpi_resource *ares, int index,
501501
struct resource *res);

include/linux/ioport.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,8 @@ struct resource {
7979
#define IORESOURCE_IRQ_HIGHLEVEL (1<<2)
8080
#define IORESOURCE_IRQ_LOWLEVEL (1<<3)
8181
#define IORESOURCE_IRQ_SHAREABLE (1<<4)
82-
#define IORESOURCE_IRQ_OPTIONAL (1<<5)
82+
#define IORESOURCE_IRQ_OPTIONAL (1<<5)
83+
#define IORESOURCE_IRQ_WAKECAPABLE (1<<6)
8384

8485
/* PnP DMA specific bits (IORESOURCE_BITS) */
8586
#define IORESOURCE_DMA_TYPE_MASK (3<<0)

0 commit comments

Comments
 (0)