Skip to content

Commit 3f354f2

Browse files
committed
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 58c419c commit 3f354f2

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

source/linux/Foundational_Components/Power_Management/pm_wakeup_sources.rst

Lines changed: 88 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 |
@@ -399,6 +401,92 @@ MCU GPIO
399401
:ref:`LPM section<lpm_modes>`, wakeup from MCU_SPI0_D1 can be triggered
400402
by grounding Pin 4 on J8 MCU Header.
401403

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

0 commit comments

Comments
 (0)