Skip to content

Commit 192212c

Browse files
kwillis01cshilwant
authored andcommitted
feat(pm_wakeup_sources): Add WKUP GPIO wakeup source for AM62L
When AM62L enters Deep Sleep, WKUP GPIO pins can wakeup the system if they are configured. Detail how to configure the WKUP GPIO to wakeup the system and give an example that is used in the device tree. Signed-off-by: Kendall Willis <[email protected]>
1 parent 46cb6ae commit 192212c

File tree

1 file changed

+90
-0
lines changed

1 file changed

+90
-0
lines changed

source/linux/Foundational_Components/Power_Management/pm_wakeup_sources.rst

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ valid for given low power modes:
5858
+==================================+============+================+
5959
| Real-Time Clock (RTC) | Yes | Yes |
6060
+----------------------------------+------------+----------------+
61+
| WKUP GPIO | Yes | No |
62+
+----------------------------------+------------+----------------+
6163
| Main I/O Daisy Chain (Main UART) | Yes | No |
6264
+----------------------------------+------------+----------------+
6365
| USB Wakeup | Yes | No |
@@ -311,6 +313,8 @@ For example, to wakeup from Deep Sleep in 10 seconds, use the command like this:
311313

312314
The system will enter the mode selected by DM on the basis on existing constraints.
313315

316+
.. _pm_mcu_gpio_wakeup:
317+
314318
********
315319
MCU GPIO
316320
********
@@ -399,6 +403,92 @@ MCU GPIO
399403
:ref:`LPM section<lpm_modes>`, wakeup from MCU_SPI0_D1 can be triggered
400404
by grounding Pin 4 on J8 MCU Header.
401405

406+
*********
407+
WKUP GPIO
408+
*********
409+
410+
.. ifconfig:: CONFIG_part_variant in ('AM62LX')
411+
412+
One of the most common ways to wakeup a system is by using some I/O activity.
413+
I/O activity on the WKUP GPIOs can wakeup the system when the WKUP GPIO
414+
controller is configured as a wakeup source. Refer to the ``wkup_gpio_key`` node
415+
in
416+
`k3-am62l3-evm-lpm-wkup-sources.dtso <https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am62l3-evm-lpm-wkup-sources.dtso?h=11.02.08>`__
417+
to use as a template to configure the desired WKUP GPIO as a wakeup capable
418+
GPIO.
419+
420+
A brief guide to configuring an WKUP GPIO as wakeup:
421+
422+
1. Add "gpio-keys" as a compatible string, refer to
423+
`gpio_keys kernel documentation <https://www.kernel.org/doc/Documentation/devicetree/bindings/input/gpio-keys.txt>`__
424+
for details.
425+
426+
.. code-block:: dts
427+
428+
compatible = "gpio-keys";
429+
430+
2. Set the desired pinctrl.
431+
432+
.. code-block:: dts
433+
434+
pinctrl-names = "default";
435+
pinctrl-0 = <&wake_wkupgpio0_pins_default>;
436+
437+
3. Setup the interrupt parent as WKUP GPIO, then setup the interrupt.
438+
439+
.. code-block:: dts
440+
441+
interrupt-parent = <&wkup_gpio0>;
442+
interrupts = <0 IRQ_TYPE_EDGE_RISING>;
443+
444+
4. Create following child node as a ``switch`` node:
445+
446+
.. code-block:: dts
447+
448+
switch {
449+
label = "WKUPGPIO";
450+
linux,code = <143>;
451+
gpios = <&wkup_gpio0 0 GPIO_ACTIVE_LOW>;
452+
wakeup-source;
453+
};
454+
455+
* label: Descriptive name of the switch node. If the WKUP GPIO node is setup
456+
correctly, the label will appear under :file:`/proc/interrupts`.
457+
* linux,code: Keycode to emit.
458+
* gpios: the GPIO required to be used as the gpio-key.
459+
* wakeup-source:
460+
`wakeup-source <https://www.kernel.org/doc/Documentation/devicetree/bindings/power/wakeup-source.txt>`__
461+
property describes devices which have wakeup capability.
462+
463+
5. To confirm that gpio_keys can wakeup the system from Deep Sleep, check
464+
:file:`/proc/interrupts` for the label:
465+
466+
.. code-block:: console
467+
468+
root@<machine>:~# cat /proc/interrupts | grep "WKUPGPIO"
469+
23: 0 0 GPIO 0 Edge -davinci_gpio WKUPGPIO
470+
471+
The WKUP GPIOs can be used to wakeup the system from Deep Sleep because WKUP
472+
GPIOs are in a power domain that stays ON when the SoC is in Deep Sleep.
473+
Hence, the GPIO controller is able to act as a wakeup source and send a
474+
wakeup interrupt to the system.
475+
476+
WKUP GPIO wakeup can only be tested when
477+
`k3-am62l3-evm-lpm-wkup-sources.dtso <https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am62l3-evm-lpm-wkup-sources.dtso?h=11.02.08>`__
478+
overlay is loaded. Refer to :ref:`How to enable DT overlays<howto_dt_overlays>` for more details.
479+
The WKUP GPIO in the overlay is routed from the WKUP UART. With this
480+
configuration the WKUP UART is not available as a wakeup source.
481+
482+
Once the system has entered Deep Sleep as shown in the
483+
:ref:`LPM section<lpm_modes>`, wakeup from WKUP_UART0_RXD can be triggered
484+
by entering a keypress on the WKUP UART (/dev/ttyUSB2).
485+
486+
.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62AX', 'AM62PX')
487+
488+
Setup of WKUP GPIO is the same process of MCU GPIO. Refer to the
489+
:ref:`MCU GPIO section<pm_mcu_gpio_wakeup>` on how to configure wakeup from
490+
WKUP GPIO.
491+
402492
********************
403493
Main I/O Daisy Chain
404494
********************

0 commit comments

Comments
 (0)