How to enable wake on usb (remote wakeup) in android?
Asked Answered
J

0

15

I have an AOSP tree compiled on my board. I bought a wireless keyboard and connected it to my board via usb port. I expect when the board is in the suspend state, it will wakeup by pressing a key on keyboard. But it is not so.

I tried several ways in my bootloader (uboot), kernel, etc. But no effect. Additionally I made an experiment and found out that in the sleep state, my usb port (which has a dongle in it) has just 1-5 mA. But it should be higher for the dongle to work!

Has anyone experienced this? How to enable remote wakeup for usb in android?

Thanks


More info: The uboot supports usb host controller interface. I tweaked kernel build options. but these two actions has no effect.


EDIT : I work on p212 reference board of amlogic. Its SoC is Amlogic S905X.


EDIT 2 : I tested the board (which is a tv box actually) using my phone and its charger and I found that when the box goes to sleep, the charging is stopped!! So I can deduce that the dongle has not enough power to stay alive! (yet to send wake signal to SoC !)

Then I carried out a second experiment: I connected the phone using a USB charger which only has two pin instead of four. (Just voltage supply; differential pins (signal pins) are disconnected). The result: my phone is charging now!! It seems when the SoC is suspending, it sends a signal to USB peripherals telling them to not draw power. Am I correct? How can I configure my AOSP tree and Linux kernel and uboot bootloader to avoid happening this? Please guide me how to fix it in kernel or other parts of stack!


EDIT 3 :

I have pasted my kernel config here. I configured these options to y but has no effect:

CONFIG_PM_RUNTIME=y
CONFIG_PM_AUTOSLEEP=y
CONFIG_PM_DEBUG=y
CONFIG_USB_OTG_WAKELOCK=y

CONFIG_USB_DEBUG=y
CONFIG_USB_OTG=y

Also this link is my device tree files. (in kernel. NOT uboot)

Jourdain answered 6/7, 2019 at 13:57 Comment(10)
What board do you have? It may be a hardware limitation that your board isn't supplying the correct power to maintain the wireless receiver.Tisza
May I ask the name of the board you are working on (or at least the MPU/SoC model)?Agouti
I work on p212 reference board of amlogic. Its SoC is Amlogic S905X and I know existing firmwares which are okay with usb remote wakeup. (So it is not a hardware limitation) Thank you @danlorJourdain
Hi @Tisza . Please take a look at my second edit. Thanks (I really need help)Jourdain
Can we see your device tree (concerning usb-peripheral)? The kernel .config file could help to debug this as well, just to check that you have configured the kernel/driver PM features in a proper way.Agouti
Hi @danlor . Please take a look at my "EDIT 3". ThanksJourdain
Nice, could you check the result of cat /sys/bus/usb/devices/..<usb_device_ id>../power/wakeup (I'm not sure whether this is the asctual path in your rootfs or not, but you can use find /sys/ -name wakeup)?Agouti
It is "disabled" But when I run echo enabled > ... it writes wnabled to the file but anyway no effect happens @danlorJourdain
Have you double-checked that you enabled the right USB bus/port (lsusb -t)? If you wonder, just enable all of them.Agouti
I'm sure all of ports are enabled. (They all work as expected). Also lsusb -t is the same as lsusb in android shell. @danlor .. I suspect maybe the problem is from android parts of stack (framework, ...) but not sure. Maybe it can be handled via kernel.... I need source of related information to research more on itJourdain

© 2022 - 2024 — McMap. All rights reserved.