Jump to content

OdroidC4 : How turn off GPIO 414 USB-Power


Go to solution Solved by andi61,

Recommended Posts

Hello to all,

 

In order to be able to export GPIO 414 to turn off USB-Power I wanted to unbind the USB drivers:

andreas@odroidc4:~$ lsusb -t
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/1p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/4p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/2p, 480M
    |__ Port 1: Dev 3, If 0, Class=Hub, Driver=hub/4p, 480M

Both drivers, "xhci-hcd" and "hub" are built into the kernel.
The "hub" driver exposes "bind" and "unbind" in /sys/bus/usb/drivers/hub, so no problem.
But the driver "xhci-hcd" has no /sys/bus/usb/drivers/xhci-hcd directory. So I cannot unbind it.
How can I kind of disable/unbind the "xhci-hcd" driver at runtime?

 

I also tried echo 'suspended' > /sys/bus/usb/devices/device1/power/control, but does not work with root devices.

 

I think that I can recompile the kernel with "xhci-hcd" as a loadable module. Then it would be possible to unbind/bind it at runtime.
But I am a bit reluctant to break with the standard to have the essential drivers built into the kernel.

 

Maybe somebody can give me kindly a hint how to turn off/on USB-Power at runtime (I have a battery powered application, need to save every Milliamp)

 

Thanks a lot

Andy

Link to comment
Share on other sites

Meanwhile I found out that the entries in /sys/bus/usb/drivers are aliases for the driver names.
So it was just a coincidence that entry "hub" and driver "hub" out of lsusb -t instruction had the same name, which caused my confusion.
So the "xhci-hcd" in the driver list is represented by "usb".
Provided this I could unbind the driver "hub" and "usb". Both directories are empty in terms of i.e. "1-1" or i.e. "1-0:_1.0" respectivly.

So I expected that none of the drivers blocks USB resources (GPIO pins in my case) anymore.
But still:

 echo 414 >/sys/class/gpio/export
-bash: echo: write error: Device or resource busy

 

When I check lsusb -t:
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/0p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/0p, 480M

 

Is it possible at all to get rid of the root_hub?

 

 

 

Link to comment
Share on other sites

In the /sys/bus/usb/drivers/usb/usb1 and /sys/bus/usb/drivers/usb/usb2 directories
I tried echo "0" > remove. The instruction produced no error.
However still:
lsusb -t:
/:  Bus 02.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/0p, 5000M
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci-hcd/0p, 480M
 

Link to comment
Share on other sites

  • Solution

I found the solution to get control over the regulator-usb_pwr_en (GPIO-414) finally:
I had the wrong assumption, that some kind of USB driver is blocking the access to the pin.
In fact it is the regulator-usb_pwr_en "driver" that does it.
This "driver" can be unbinded via:
cd /sys/devices/platform/regulator-usb_pwr_en/driver
echo "regulator-usb_pwr_en" > unbind

 

What is strange, that in this moment, when I unbind it, the power consumption of the OdroidC4 goes up!
I successfully exported the GPIO-414 therafter and turned it low.
No effect, the power consumption is still higher and keeps its value.

 

I think with this action to get control over the pin, I disturbed something in the USB Host Controller, so the CPU is constantly performing
some action to "solve" this problem, which results in higher power consumption.

 

So effectivly from this point of view, it doesn´t make any sense to turn down regulator-usb_pwr_en.

 

Anyhow I would be very happy about any practicable hints for safing power on the OdroidC4

 

Thanks a lot

Andy

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines