| @@ -64,6 +64,7 @@ struct pxa_gpio_chip { · 63 unmodified lines |
| 64 | 64 | unsigned long irq_mask; |
| 65 | 65 | unsigned long irq_edge_rise; |
| 66 | 66 | unsigned long irq_edge_fall; |
| 67 | + int (*set_wake)(unsigned int gpio, unsigned int on); |
| 67 | 68 | |
| 68 | 69 | #ifdef CONFIG_PM |
| 69 | 70 | unsigned long saved_gplr; |
| @@ -269,7 +270,8 @@ static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value) · 199 unmodified lines |
| 269 | 270 | (value ? GPSR_OFFSET : GPCR_OFFSET)); |
| 270 | 271 | } |
| 271 | 272 | |
| 272 | | −static int __devinit pxa_init_gpio_chip(int gpio_end) |
| 273 | +static int __devinit pxa_init_gpio_chip(int gpio_end, |
| 274 | + int (*set_wake)(unsigned int, unsigned int)) |
| 273 | 275 | { |
| 274 | 276 | int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1; |
| 275 | 277 | struct pxa_gpio_chip *chips; |
| @@ -285,6 +287,7 @@ static int __devinit pxa_init_gpio_chip(int gpio_end) · 9 unmodified lines |
| 285 | 287 | |
| 286 | 288 | sprintf(chips[i].label, "gpio-%d", i); |
| 287 | 289 | chips[i].regbase = gpio_reg_base + BANK_OFF(i); |
| 290 | + chips[i].set_wake = set_wake; |
| 288 | 291 | |
| 289 | 292 | c->base = gpio; |
| 290 | 293 | c->label = chips[i].label; |
| @@ -412,6 +415,17 @@ static void pxa_mask_muxed_gpio(struct irq_data *d) · 121 unmodified lines |
| 412 | 415 | writel_relaxed(gfer, c->regbase + GFER_OFFSET); |
| 413 | 416 | } |
| 414 | 417 | |
| 418 | +static int pxa_gpio_set_wake(struct irq_data *d, unsigned int on) |
| 419 | +{ |
| 420 | + int gpio = pxa_irq_to_gpio(d->irq); |
| 421 | + struct pxa_gpio_chip *c = gpio_to_pxachip(gpio); |
| 422 | + |
| 423 | + if (c->set_wake) |
| 424 | + return c->set_wake(gpio, on); |
| 425 | + else |
| 426 | + return 0; |
| 427 | +} |
| 428 | + |
| 415 | 429 | static void pxa_unmask_muxed_gpio(struct irq_data *d) |
| 416 | 430 | { |
| 417 | 431 | int gpio = pxa_irq_to_gpio(d->irq); |
| @@ -427,6 +441,7 @@ static struct irq_chip pxa_muxed_gpio_chip = { · 9 unmodified lines |
| 427 | 441 | .irq_mask = pxa_mask_muxed_gpio, |
| 428 | 442 | .irq_unmask = pxa_unmask_muxed_gpio, |
| 429 | 443 | .irq_set_type = pxa_gpio_irq_type, |
| 444 | + .irq_set_wake = pxa_gpio_set_wake, |
| 430 | 445 | }; |
| 431 | 446 | |
| 432 | 447 | static int pxa_gpio_nums(void) |
| @@ -471,6 +486,7 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) · 38 unmodified lines |
| 471 | 486 | struct pxa_gpio_chip *c; |
| 472 | 487 | struct resource *res; |
| 473 | 488 | struct clk *clk; |
| 489 | + struct pxa_gpio_platform_data *info; |
| 474 | 490 | int gpio, irq, ret; |
| 475 | 491 | int irq0 = 0, irq1 = 0, irq_mux, gpio_offset = 0; |
| 476 | 492 | |
| @@ -516,7 +532,8 @@ static int __devinit pxa_gpio_probe(struct platform_device *pdev) · 39 unmodified lines |
| 516 | 532 | } |
| 517 | 533 | |
| 518 | 534 | /* Initialize GPIO chips */ |
| 519 | | − pxa_init_gpio_chip(pxa_last_gpio); |
| 535 | + info = dev_get_platdata(&pdev->dev); |
| 536 | + pxa_init_gpio_chip(pxa_last_gpio, info ? info->gpio_set_wake : NULL); |
| 520 | 537 | |
| 521 | 538 | /* clear all GPIO edge detects */ |
| 522 | 539 | for_each_gpio_chip(gpio, c) { |