gpis-keys for power is causing the camera to start

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

gpis-keys for power is causing the camera to start

Jump to solution
1,467 Views
dennis3
Contributor V

This is w/ an Android 9, 4.14.98 kernel, w/ in imx8mq board.

In my DTS file I added our power key:

gpio-keys {
   compatible = "gpio-keys";
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_gpio_keys>;
   status = "okay";

   power {
     label = "Power Button";
     gpios = <&gpio1 22 GPIO_ACTIVE_HIGH>;
     wakeup-source;
     linux,code = <KEY_POWER>;
};

When Android is running, I can press the power key and android brings up the power/restart/screenshot menu as expected.  However, it also launches the camera.  Our older Android 8 solution didn't have this issue.  I'm not exactly sure where to look to debug this.  Any ideas?  Expected would be to get the power menu but not have the camera launch.

Labels (1)
Tags (1)
0 Kudos
1 Solution
1,297 Views
dennis3
Contributor V

After even more debugging, I found that I didn't even need to map the power key for it to work properly.  Your original question about the snvs power circuit was good.  I double checked the Variscite board and found that they do in fact use that same circuit.  The problem was that in our board, the gpio-keys for the power key was adding the 2nd KEY_POWER event. (causing the gesture for the camera to trigger).  It wasn't a bounce as the gpio controller takes care of those for you.  I had originally added the gpis-keys mapping because it turns out that even though we weren't using the ethernet functionality, the pin was still configured as an output by default and when it was being driven, it overrode the fet input so we never got any power events from the button.

So in the end, the solution was just to delete the gpio-keys mapping for the power button but still put the pin into a hog group so that it is explicitly claimed and set to an input.  After that it works properly.

View solution in original post

0 Kudos
7 Replies
1,297 Views
shivanipatel
Senior Contributor II

Hi, Dennis Muhlestein

We have tested the Power Key/ONOFF key functionality on i.Mx8MQ EVK with Android 9.0.0_2.3.0 version, 4.14.98 kernel version and this kind of issue has not been observed.

In i.MX8MQ EVK, there is a dedicated SNVS power key which has been used as ONOFF button.

As per your dts node, it seems that you are not using the dedicated SNVS power key pin.

Can you please let us know which pin are you trying to use as Power Key? Is this your Custom board?

Regards,

Shivani

1,297 Views
dennis3
Contributor V

Yes this is a custom board.  We are reading the status of the button on GPIO 1, io 22, which is normally MX8MQ_IOMUXC_ENET_TX_CTL_ENET1_RGMII_TX_CTL.  On our board we don't have an ethernet chip so we're just configuring it as a gpio input.

The button input also goes through an nmos to invert its status and that is the input to the ON/OFF (So holding the button down for 5 seconds causes on/off to go low and that does indeed hard shut off the system as expected.)

0 Kudos
1,297 Views
shivanipatel
Senior Contributor II

Hi, Dennis Muhlestein

Can you please share the schematic of your board?

Regards,

Shivani

0 Kudos
1,297 Views
dennis3
Contributor V

Here are the relevant circuits.

Screen Shot 2020-01-17 at 9.42.02 AM.png

Screen Shot 2020-01-17 at 9.39.49 AM.png

This is using the Variscite dart-mx8m carrier board and their version of android is slightly behind the nxp release I believe. 4.14.98 kernel still but 9.0.0_2.0.0 Android release.

Also, our board is battery powered, hence the power button is also driving the MASTER_ON to provide power a battery switch until uboot/linux start driving GPO_PWR to keep the system on.

0 Kudos
1,297 Views
diegoadrian
NXP Employee
NXP Employee

Hello,

Do you have the schematic where you have connected the MIPI_CSI? Furthermore, the whole device tree could be also helpful.

Best regards,

Diego.

0 Kudos
1,297 Views
dennis3
Contributor V

So it turns out, in the Android system settings there is a gesture to jump to the camera if power button is pressed twice.  Disabling this no longer causes the camera to launch.  I think the issue is likely that we have bounce or multiple key events on the power button when it is pressed.

1,298 Views
dennis3
Contributor V

After even more debugging, I found that I didn't even need to map the power key for it to work properly.  Your original question about the snvs power circuit was good.  I double checked the Variscite board and found that they do in fact use that same circuit.  The problem was that in our board, the gpio-keys for the power key was adding the 2nd KEY_POWER event. (causing the gesture for the camera to trigger).  It wasn't a bounce as the gpio controller takes care of those for you.  I had originally added the gpis-keys mapping because it turns out that even though we weren't using the ethernet functionality, the pin was still configured as an output by default and when it was being driven, it overrode the fet input so we never got any power events from the button.

So in the end, the solution was just to delete the gpio-keys mapping for the power button but still put the pin into a hog group so that it is explicitly claimed and set to an input.  After that it works properly.

0 Kudos