user3375547
user3375547

Reputation: 111

wake up k70 from VLPS deep sleep by GPIO interrupt

I can not wake up k70 (Kinetis) from VLPS deep sleep by GPIO interrupt.

This is under uCLinux, where I enabled CONFIG_PM. After that, I can put K70 to deep sleep by "echo mem > /sys/power/state" and wake it up from UART debug console. But I can not wake up by triggering GPIO interrupt. I have confirmed that the interrupt works before and after the sleep by printing from the interrupt handler and I have also confirmed the GPIO pin value changes from 0 to 1 during sleep after I triggered the GPIO interrupt.

According to the K70 manual, I should be able to wake up VLPS by a GPIO interrupt. Does any have any insight why I could not?

Thanks

Upvotes: 0

Views: 232

Answers (1)

0andriy
0andriy

Reputation: 4674

First of all, your GPIO driver should implement IRQ chip. (From the above description I have no clue what is the platform and what is the GPIO driver is used there).

Second, the IRQ chip implementation has to have ->irq_set_wake() callback to be present and properly implemented.

Third, the caller, which does get GPIO line via gpiod_get() has to perform:

struct gpio_desc *gd;
int irq;

gd = gpiod_get(...);
if (IS_ERR(gd))
  return PTR_ERR(gd);

irq = gpiod_to_irq(gd);
if (irq < 0)
  return irq;

/* Now! */
enable_irq_wake(irq); /* This does the trick */

Upvotes: 1

Related Questions