How to power On/Off Colibri VFxx properly using GPIO LINUX

Hello, i’m trying to add a Push button On/Off controller on my Viola board V1.2A to turn On and Off my Colibri VF50 module. I can handle the interrupt of the On/Off controller to ask the module to power off but my problem is that i don’t know how to set a GPIO low to send a KILL signal to the On/Off controller to shutdown main power board when the colibri is powered off. It looks like there is a GPIO power-off driver to achieve this, any help will be welcome.

Have a look at the following article on our developer website.

Thank you very much i have followed this article. At this point I managed to build a specific single device tree. I did a copy of the carrier board level device tree named “vf500-colibri-my-carrier.dts” and add it to the makefile. I’m using v2.7 so as written in the article there should be no need to enable the driver CONFIG_POWER_RESET_GPIO. At this point I added as shown a new node in the .dts file:

/ {
gpio-poweroff {
    compatible = "gpio-poweroff";
    gpios = <&gpio2 25 GPIO_ACTIVE_LOW>;
};

I have build the dtbs and compile the kernel following this article “Build U-Boot and Linux Kernel from Source Code”.
Then copy as shown :

cd ~/Colibri_VF_LinuxImageV2.7/rootfs/boot
cp ~/linux-toradex/arch/arm/boot/zImage ./zImage-custom
cp ~/linux-toradex/arch/arm/boot/dts/vf500-colibri-eval-v3.dtb ./vf500-custom.dtb
ln -fs /boot/zImage-custom zImage
ln -fs /boot/vf500-custom.dtb vf500-colibri-eval-v3.dtb

Do you need to copy and link this one for VF50? (I didn’t) :

cp ~/linux-toradex/arch/arm/boot/dts/vf610-colibri-eval-v3.dtb ./vf610-custom.dtb
ln -fs /boot/vf610-custom.dtb vf610-colibri-eval-v3.dtb

Then prepared SD card and “run setupdate” and “run update” instead of “run update_rootfs”.

I still have an issue : the power gpio2 25 (pin 8 X9 viola 1.2A) => does not appear when i run cat /sys/kernel/debug/gpio.

I’m new with toradex, I’m missing something, thanks in advance if you can help.

Best regards,

As far as I understand you copied the vf500-colibri-eval-v3.dts (and vf-colibri-eval-v3.dtsi?) to vf500-colibri-my-carrier.dts and edited that is this correct?

If yes, this should give you a new device tree in ~/linux-toradex/arch/arm/boot/dts/ named vf610-colibri-my-carrier.dtb

You can just copy that manually in the colibri_imx7 folder of your (previously prepared) SD-card. When flashing, make sure to set the carrier board name like this:

setenv fdt_board my-carrier
run setupdate
run update

With that the log should show that it reads vf500-colibri-eval-v3.dtb and stores it in the UBI device tree volume.

Hi,
Thanks, this is my-carrier file.

#include "vf500-colibri.dtsi"
#include "vf-colibri-eval-v3.dtsi"

/ {
	model = "Toradex Colibri VF50 on Colibri Evaluation Board";
    	compatible = "toradex,vf500-colibri_vf50-on-eval", "toradex,vf500-colibri_vf50", "fsl,vf500";

	gpio-poweroff {
    	compatible = "gpio-poweroff";
   	gpios = <&gpio2 25 GPIO_ACTIVE_LOW>;
	};
};

then i did :
setenv fdt_board vf500-colibri-my-carrier.dtb
run setupdate
run update

At startup i have this log:

[    1.713921] poweroff-gpio gpio-poweroff: gpio_poweroff_probe: pm_power_off function already registered
[    1.746798] poweroff-gpio: probe of gpio-poweroff failed with error -16 

I’m stuck there.

The error code -16 translates to EBUSY (Device or resource busy). The error indicates that the power off function is already in use. This is due to a change which puts the module in a deep sleep when powering off (#20370).

The commit ARM: vf610: PM: register power_off function currently unconditionally sets the poweroff function, which does not allow to use the GPIO power off function anymore. The easiest way to use GPIO power off again is to revert the commit

git revert 3816bd77aad30bee3904358faa286b32c2b35b92

Thank you very much for our support, so if i use this release it should work V2.6.1 Beta 2 (Release date: 2016-11-22)

Yes. But I would recommend using the new release and revert said commit… You need to rebuild the device tree anyway, it is not that much more work to also rebuild the kernel.

Thanks, I’m using repo, I did a “repo sync” to update working tree to the latest revision but i’m not familiar with this utility, can I “git revert” using repo?

Hello,
Thank you very much for all your support, gpio power-off works fine now. You were right doing a revert was the best way.
Best regard.