Wake Up with 'short' press of power button

Post Reply
Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Wake Up with 'short' press of power button

Post by Erick_Estrada »

In Android, when the Odroid is turned on I can go to suspend mode with a short press, let's say 1 second press. If I do a long press, let' s say 3 seconds, then I go to Android Menu (with options like Power Off, Reset, etc).
But when I go to sleep, I must do a long press (2 seconds or more) to wake up. It would be possible to wake up with a short press (like 1 second) ?
If so, it is a question of some configurations or I need to recompile U-Boot ? And if I need to recompile U-Boot, do you know where to tweak to make it work ?

User avatar
tobetter
Posts: 8191
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 475 times
Been thanked: 1281 times
Contact:

Re: Wake Up with 'short' press of power button

Post by tobetter »

Have you waited for several seconds once the wake up button is pressed?
Can you share how you connected the button?

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

The button is connected on pins 9 and 11, typical power off/wake up pins for c4.

The user can go to suspend or wake up at any time. So I would like a solution that could work at any time. If it is short press, so a short press for everything. If it is long, long for everything. Short is better. Today sometimes requesting short press and sometimes long press isn't something intuitive.

User avatar
tobetter
Posts: 8191
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 475 times
Been thanked: 1281 times
Contact:

Re: Wake Up with 'short' press of power button

Post by tobetter »

Erick_Estrada wrote:
Fri Jul 02, 2021 1:02 pm
The button is connected on pins 9 and 11, typical power off/wake up pins for c4.

The user can go to suspend or wake up at any time. So I would like a solution that could work at any time. If it is short press, so a short press for everything. If it is long, long for everything. Short is better. Today sometimes requesting short press and sometimes long press isn't something intuitive.
There is no configuration for the wake up button delay, I believe the wake up can be triggered when the switch is pressed shortly but wake up took several seconds in order to bring up CPU and peripherals.

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

Odroid C4 is wakening up quickly. My only problem is the long press.

There is no solution ? Even if I recompile U-Boot ?

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

I noted that BananaPi M5 and M2Pro wakes up from a suspend mode with a short press, so it is not a processor issue.

User avatar
tobetter
Posts: 8191
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 475 times
Been thanked: 1281 times
Contact:

Re: Wake Up with 'short' press of power button

Post by tobetter »

Erick_Estrada wrote:
Sat Jul 03, 2021 2:43 am
Odroid C4 is wakening up quickly. My only problem is the long press.

There is no solution ? Even if I recompile U-Boot ?
Have you pressed a button for a less than one second and waited for several seconds if Android wake up?
Can you please check when the blue LED turns on after you have pressed the wake up button?

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

Thanks for your responses and your time.

"Have you pressed a button for a less than one second and waited for several seconds if Android wake up?"
It doesn pt take several seconds, it takes a litle bit more than 1 second (at least with some special LCD boards, with other could take up to 10 seconds, but it is a lcd board issue have nothing to do with C4)

"Can you please check when the blue LED turns on after you have pressed the wake up button?"
I can but the user can't. It is not operational. I would like to have a short press no matter how blue or red lights are, no matter in which state board is (in suspend mode or going to suspend mode).

To make question shorter: "Is there a way to wake up Odroid C4 from suspend mode with a short press of gpio buttons ?".

User avatar
tobetter
Posts: 8191
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 475 times
Been thanked: 1281 times
Contact:

Re: Wake Up with 'short' press of power button

Post by tobetter »

Erick_Estrada wrote:
Sun Jul 04, 2021 11:04 am
Thanks for your responses and your time.

"Have you pressed a button for a less than one second and waited for several seconds if Android wake up?"
It doesn pt take several seconds, it takes a litle bit more than 1 second (at least with some special LCD boards, with other could take up to 10 seconds, but it is a lcd board issue have nothing to do with C4)

"Can you please check when the blue LED turns on after you have pressed the wake up button?"
I can but the user can't. It is not operational. I would like to have a short press no matter how blue or red lights are, no matter in which state board is (in suspend mode or going to suspend mode).

To make question shorter: "Is there a way to wake up Odroid C4 from suspend mode with a short press of gpio buttons ?".
As I metioned earlier, there is no configuration to change the delay to recognize the GPIO button. If the power button is pressed in suspend state, it's pressed. It doesn't delay to make sure if the button is pressed or not. The reason why I am asking to check when the blue LED turns on is that the blue LED turns on by Linux kernel. If it takes longer than expected but the time period from button press to LED turns is consistent, there is nothing to do with U-Boot. But if it takes for long to get Android after the blue LED lits or blinks, it's the problem something else. It may take a bit more time to enable a display device or USB device, for example.

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

Thanks for yor reply.
Let's forget everything and start again in a simpler way:
"It is possible in anyway (including recompiling firmware code) to wake up Odroid C4 from suspend mode (no blue or red leds turned on) with a 1 second gpio button press ?"

User avatar
tobetter
Posts: 8191
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 475 times
Been thanked: 1281 times
Contact:

Re: Wake Up with 'short' press of power button

Post by tobetter »

Erick_Estrada wrote:
Mon Jul 05, 2021 12:42 am
Thanks for yor reply.
Let's forget everything and start again in a simpler way:
"It is possible in anyway (including recompiling firmware code) to wake up Odroid C4 from suspend mode (no blue or red leds turned on) with a 1 second gpio button press ?"
You can look into the codes,
https://github.com/hardkernel/u-boot/tr ... a/firmware
https://github.com/hardkernel/u-boot/tr ... 4/firmware

And this must be what you are looking for where the GPIO key is read in suspend mode,
https://github.com/hardkernel/u-boot/bl ... key.c#L209
These users thanked the author tobetter for the post:
odroid (Mon Jul 05, 2021 10:23 am)

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

A-há ! This last one seems to be the way.

Thanks !

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

Not working yet, but I could see some changes. So it seems that at least I'm working in the right place: u-boot.

I'm using Android official release.

When Odroid C4 is in suspend mode, I make a long press and everything works fine:

Code: Select all

exit_reason:0x0d
Enter ddr resume
ddr resume time: 124us
store restore gp0 pll
store restore gp1 pll
cfg15 d3b00000 
cfg15 d3b00000 
Little core clk resume rate 2016000000
[   74.693813@0] cectx ff80023c.aocec: cec resume noirq!
[   74.693937@0] cectx ff80023c.aocec: wakeup_reason:0xd
[   74.698321@0] cectx ff80023c.aocec: cev val1:0x0,0x0,0x0
[   74.703584@0] cectx ff80023c.aocec: cev val2: 0x0x0
[   74.811160@0] meson6-dwmac ff3f0000.ethernet: Failed to reset the dma
[   74.812001@0] stmmac_hw_setup: DMA engine initialization failed
[   76.622973@0] cectx ff80023c.aocec: aml_cec_pm_complete
[   76.854518@0] cectx ff80023c.aocec: aocec_late_resume, suspend sts:0
---> note the line: [ 76.854518@0] cectx ff80023c.aocec: aocec_late_resume, suspend sts:0

When Odroid C4 is in suspend mode I make a short press Odroid C4 makes a quick start (turn on red light, blue light), send some console data and go back to sleep

Code: Select all

exit_reason:0x0d
Enter ddr resume
ddr resume time: 125us
store restore gp0 pll
store restore gp1 pll
cfg15 d3b00000 
cfg15 d3b00000 
Little core clk resume rate 2016000000
[   51.494179@2] cectx ff80023c.aocec: cec resume noirq!
[   51.494288@0] cectx ff80023c.aocec: wakeup_reason:0xd
[   51.498679@0] cectx ff80023c.aocec: cev val1:0x0,0x0,0x0
[   51.503991@0] cectx ff80023c.aocec: cev val2: 0x0x0
[   51.612210@0] meson6-dwmac ff3f0000.ethernet: Failed to reset the dma
[   51.613003@0] stmmac_hw_setup: DMA engine initialization failed
[   53.456061@0] cectx ff80023c.aocec: aml_cec_pm_complete
[   54.484160@1] cectx ff80023c.aocec: aml_cec_pm_prepare
wake-on-lan = 00000000
bl30 get wakeup sources!
process command 00000006
bl30 enter suspend!
Little core clk suspend rate 2016000000
store restore gp0 pll
store restore gp1 pll
suspend_counter: 6
Enter ddr suspend
ddr suspend time: 16us
alarm=3180S
process command 00000001
cec ver:2018/07/03
CEC cfg:0x003b
WAKEUP GPIO cfg:0x000001df
08915d0000000000set_remote_mode 0x00000000cec reset
Set cec pinmux:0x11
kern log_addr:0x04
Set cec log_addr:0x04,ADDR0:14
----> note the line [ 54.484160@1] cectx ff80023c.aocec: aml_cec_pm_prepare

It looks like that if button is still pressed when the u-boot arrives at "cectx ff80023c.aocec: aml_cec_pm_complete" then it goes one way (cectx ff80023c.aocec: aocec_late_resume, suspend sts:0) and if it is not pressed at that time it goes other way (cectx ff80023c.aocec: aml_cec_pm_prepare).

I compiled the suggested code with some changes. I got a faster or shorter response in the first miliseconds the button is pressed, but I was unable to find where "cectx ff80023c.aocec: aml_cec_pm_complete" is. Any light ?

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

I tested with several displays, including computer monitors - as it sounds related to HDMI - and nothing happened. Tried with nothing connected and the same behavior.

I tried to push very quickly the button and then press again just before the "aml_cec_pm_prepare" message, and it worked. Itconfirms my theory: the button must be pressed when this message arrives.

If I found where in the u-boot it is, maybe I could change it to a full wake up with short press.

I'm not using IR, timers or any other way to wake up, only the button.

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

I also tried to disable CEC following these suggestions: viewtopic.php?t=26588 (It is for C2, but maybe work with C4( without success.

Erick_Estrada
Posts: 27
Joined: Fri May 28, 2021 10:12 pm
languages_spoken: english
ODROIDs: Odroid C4
Has thanked: 0
Been thanked: 0
Contact:

Re: Wake Up with 'short' press of power button

Post by Erick_Estrada »

Tobetter,

It's working fine now ! Thanks for your help !

Your suggestion helped to trace the way the firmware goes and after some changes on the u-boot code it worked like a charm. Thanks.

Post Reply

Return to “Hardware and peripherals”

Who is online

Users browsing this forum: No registered users and 0 guests