Skip to content

Commit 9f65cbf

Browse files
kwillis01cshilwant
authored andcommitted
feat(pm_wakeup_sources): Add Main GPIO wakeup source for AM62L
Add the Main GPIO wakeup example for AM62L. Since this wakeup source is enabled in the AM62L device tree by default, use the example that is configured for AM62L. Move the AM62X/A/P specific example into an ifconfig. Signed-off-by: Kendall Willis <[email protected]>
1 parent 192212c commit 9f65cbf

File tree

1 file changed

+86
-50
lines changed

1 file changed

+86
-50
lines changed

source/linux/Foundational_Components/Power_Management/pm_wakeup_sources.rst

Lines changed: 86 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ valid for given low power modes:
5353

5454
.. ifconfig:: CONFIG_part_variant in ('AM62LX')
5555

56-
+----------------------------------+------------+----------------+
57-
| Wakeup Source | Deep Sleep | RTC Only + DDR |
58-
+==================================+============+================+
59-
| Real-Time Clock (RTC) | Yes | Yes |
60-
+----------------------------------+------------+----------------+
61-
| WKUP GPIO | Yes | No |
62-
+----------------------------------+------------+----------------+
63-
| Main I/O Daisy Chain (Main UART) | Yes | No |
64-
+----------------------------------+------------+----------------+
65-
| USB Wakeup | Yes | No |
66-
+----------------------------------+------------+----------------+
67-
| RTC Ext Pin | Yes | Yes |
68-
+----------------------------------+------------+----------------+
56+
+------------------------------------------------+------------+----------------+
57+
| Wakeup Source | Deep Sleep | RTC Only + DDR |
58+
+================================================+============+================+
59+
| Real-Time Clock (RTC) | Yes | Yes |
60+
+------------------------------------------------+------------+----------------+
61+
| WKUP GPIO | Yes | No |
62+
+------------------------------------------------+------------+----------------+
63+
| Main I/O Daisy Chain (Main GPIO and Main UART) | Yes | No |
64+
+------------------------------------------------+------------+----------------+
65+
| USB Wakeup | Yes | No |
66+
+------------------------------------------------+------------+----------------+
67+
| RTC Ext Pin | Yes | Yes |
68+
+------------------------------------------------+------------+----------------+
6969

7070
*********************
7171
Real-Time Clock (RTC)
@@ -511,26 +511,27 @@ I/O Power Management and Daisy Chaining section in the TRM.
511511

512512
.. note::
513513

514-
|__PART_FAMILY_DEVICE_NAMES__| supports the ability to wakeup using pad based wake event ONLY in Deep Sleep or MCU Only Mode.
515-
During active system usage, even if the wake_enable bit is set the system will be unresponsive to any wakeup
516-
activity on that pad.
517-
518-
To demonstrate I/O daisy chain wakeup as part of |__PART_FAMILY_DEVICE_NAMES__| offering, two reference examples are provided:
519-
520-
#. main_uart0 is used where a key press on the Linux console can wakeup the system.
521-
#. main_gpio is used where activity on configured GPIO pin can wakeup the system.
514+
|__PART_FAMILY_DEVICE_NAMES__| supports the ability to wakeup using pad
515+
based wake event ONLY in Deep Sleep or MCU Only Mode. During active
516+
system usage, even if the wake_enable bit is set the system will be
517+
unresponsive to any wakeup activity on that pad.
522518

523519
.. ifconfig:: CONFIG_part_variant in ('AM62LX')
524520

525521
.. note::
526522

527-
|__PART_FAMILY_DEVICE_NAMES__| supports the ability to wakeup using pad based wake event ONLY in Deep Sleep.
528-
During active system usage, even if the wake_enable bit is set the system will be unresponsive to any wakeup
523+
|__PART_FAMILY_DEVICE_NAMES__| supports the ability to wakeup using pad
524+
based wake event ONLY in Deep Sleep. During active system usage, even if
525+
the wake_enable bit is set the system will be unresponsive to any wakeup
529526
activity on that pad.
530527

531-
To demonstrate I/O daisy chain wakeup as part of |__PART_FAMILY_DEVICE_NAMES__| offering, a reference example is provided:
528+
To demonstrate I/O daisy chain wakeup as part of |__PART_FAMILY_DEVICE_NAMES__|
529+
offering, two reference examples are provided:
532530

533-
#. main_uart0 is used where a key press on the Linux console can wakeup the system.
531+
#. main_uart0 is used where a key press on the Linux console can wakeup the
532+
system.
533+
#. main_gpio is used where activity on configured GPIO pin can wakeup the
534+
system.
534535

535536

536537
Main UART
@@ -709,36 +710,32 @@ Any UART can be chosen according to application requirements.
709710
Main GPIO
710711
=========
711712

712-
.. ifconfig:: CONFIG_part_variant in ('AM62LX')
713-
714-
Main GPIO wakeup is not yet supported on AM62LX.
713+
Configuring Main GPIO as an I/O daisy chain wakeup source requires a
714+
combination of gpio-keys with chained IRQ in the pinctrl driver. To briefly
715+
explain, setting the 29th bit in the desired padconfig register, allows the
716+
pad to act as a wakeup source by triggering a wake IRQ in Deep Sleep states.
715717

716718
.. ifconfig:: CONFIG_part_variant in ('AM62X', 'AM62AX', 'AM62PX')
717719

718-
Configuring Main GPIO as an I/O daisy chain wakeup source requires a
719-
combination of gpio-keys with chained IRQ in the pinctrl driver. To briefly
720-
explain, setting the 29th bit in the desired padconfig register, allows the
721-
pad to act as a wakeup source by triggering a wake IRQ to the DM R5 in Deep
722-
Sleep states.
723-
724720
The reference configuration for Main GPIO wakeup can be found under
725-
gpio_key node in `k3-am62x-sk-lpm-wkup-sources.dtso <https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am62x-sk-lpm-wkup-sources.dtso?h=11.01.05#n21>`__
721+
gpio_key node in
722+
`k3-am62x-sk-lpm-wkup-sources.dtso <https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am62x-sk-lpm-wkup-sources.dtso?h=11.02.08#n21>`__
726723

727-
.. code-block:: console
724+
.. code-block:: dts
728725
729-
gpio_key {
730-
compatible = "gpio-keys";
731-
autorepeat;
732-
pinctrl-names = "default";
733-
pinctrl-0 = <&main_gpio1_pins_default>;
734-
switch {
735-
label = "WKGPIO";
736-
linux,code = <KEY_WAKEUP>;
737-
interrupts-extended = <&main_gpio1 10 IRQ_TYPE_EDGE_RISING>,
738-
<&main_pmx0 0x1a0>;
739-
interrupt-names = "irq", "wakeup";
740-
};
741-
};
726+
gpio_key {
727+
compatible = "gpio-keys";
728+
autorepeat;
729+
pinctrl-names = "default";
730+
pinctrl-0 = <&main_gpio1_pins_default>;
731+
switch {
732+
label = "WKGPIO";
733+
linux,code = <KEY_WAKEUP>;
734+
interrupts-extended = <&main_gpio1 10 IRQ_TYPE_EDGE_RISING>,
735+
<&main_pmx0 0x1a0>;
736+
interrupt-names = "irq", "wakeup";
737+
};
738+
};
742739
743740
Here, we chain the IRQ to the pinctrl driver using the second
744741
interrupts-extended entry. The wake IRQ framework in Linux works in such a
@@ -747,7 +744,7 @@ Main GPIO
747744
configured as a wakeup pad when system enters Deep Sleep.
748745

749746
Main GPIO wakeup can only be tested when
750-
`k3-am62x-sk-lpm-wkup-sources.dtso <https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am62x-sk-lpm-wkup-sources.dtso?h=11.01.05>`__
747+
`k3-am62x-sk-lpm-wkup-sources.dtso <https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am62x-sk-lpm-wkup-sources.dtso?h=11.02.08>`__
751748
overlay is loaded. Please refer to :ref:`How to enable DT overlays<howto_dt_overlays>` for more details.
752749

753750
To use main_gpio as a wakeup source, ensure gpio is a wake-irq in /proc/interrupts:
@@ -761,6 +758,45 @@ Main GPIO
761758
:ref:`LPM section<lpm_modes>`, wakeup from MAIN GPIO1_10 can be triggered
762759
by grounding Pin 33 on J3 User Expansion Connector.
763760

761+
.. ifconfig:: CONFIG_part_variant in ('AM62LX')
762+
763+
The reference configuration for Main GPIO wakeup can be found under
764+
gpio_key node in
765+
`k3-am62l3-evm.dts <https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am62l3-evm.dts?h=11.02.08#n50>`__
766+
767+
.. code-block:: dts
768+
769+
gpio_key {
770+
compatible = "gpio-keys";
771+
autorepeat;
772+
pinctrl-names = "default";
773+
pinctrl-0 = <&usr_button_pins_default>;
774+
switch {
775+
label = "User Key";
776+
linux,code = <BTN_0>;
777+
interrupts-extended = <&main_gpio0 90 IRQ_TYPE_EDGE_RISING>,
778+
<&main_pmx0 0x1ac>;
779+
interrupt-names = "irq", "wakeup";
780+
};
781+
};
782+
783+
Here, we chain the IRQ to the pinctrl driver using the second
784+
interrupts-extended entry. The wake IRQ framework in Linux works in such a
785+
way that the second entry gets marked as a wakeup source, and then the
786+
pinctrl driver is informed that the pad 0x1ac in this case is to be
787+
configured as a wakeup pad when system enters Deep Sleep.
788+
789+
To use main_gpio as a wakeup source, ensure gpio is a wake-irq in /proc/interrupts:
790+
791+
.. code-block:: console
792+
793+
root@<machine>:~# grep wakeup /proc/interrupts
794+
299: 0 0 pinctrl 428 Edge User Key:wakeup
795+
796+
Once the system has entered Deep Sleep as shown in the
797+
:ref:`LPM section<lpm_modes>`, wakeup from MAIN GPIO0_90 can be triggered
798+
by pressing button SW5.
799+
764800
*********
765801
WKUP UART
766802
*********

0 commit comments

Comments
 (0)