How to add Power Button to AML-S905X-CC Le Potato

Le Potato features many wakeup sources. The one relevant to creating a power button is GPIOH_6 on header 2J3. It can wake up the board from shutdown or suspend when it is pulled low to ground.

Any GPIO can be used to emulate a keyboard input key by creating overlays that map the GPIO to the key. We have pre-defined profiles for shutdown on that pin since it also acts as the wake pin for the board.

You can add a GPIO power button by connecting a button to header 2J3 pin 6 and the ground pin 7 next to it. Enable to test and then permanently merge the overlay for GPIO power button via sudo ldto enable gpio-key-power-2j3-6 and sudo ldto merge gpio-key-power-2j3-6.

Now you can shutdown your system by pressing the power button as well as wake up the machine.

Alternatively, you can wake the board via UART RX and ground but we do not recommend this since it is used as UART by default and cannot be bound to the gpio-key driver for shutdown. So it only acts as a wake button.

when i try run the command i get this error:

root@debian-12-aml-s905x-cc:/home/knatte# ldto enable gpio-key-power-2j3-6
LDTO_enable: gpio-key-power-2j3-6 does not exist and cannot be added

How do i add the dts file in debian?

You need to update the images to the latest version of all the tools.

First fix the expired repo key: Signatures were invalid: EXPKEYSIG 2E5FB7FC58C58FFB - #2 by librecomputer

Then run sudo apt update; sudo eatmydata apt dist-upgrade. Then the command will work.