Can I controlled USB1_EN_OC# pin?


I want to control USB1_EN_OC# pin in JETSON TX2. (because I want to control USB VBUS down and up.)
Is there any way to control it?
If there is a way to control it,

  1. How to enable/disable USB1_EN_OC# pin.
  2. How to control method at runtime after booting in kernel driver.

I want to know about the above two.


Yes. USB1_EN_OC# is connected to GPIO L.05. You can use it as a GPIO just like any other GPIO and explicitly set it HIGH(1) and LOW(0) when you want.

You will start by removing any references to GPIO L.05 from your DT. Once you remove all the references and load the new DT you can explicitly control it from userspace or another kernel driver of your choice. There could be a line like this for a regulator in your DT somewhere that you will need to remove:
gpio = <&tegra_main_gpio TEGRA_MAIN_GPIO(L, 5) 0>;

Once you have removed any references you are free to control GPIO L.05 just like any other GPIO. GPIO L.05 corresponds with GPIO #413 with the default number mappings of Tegra GPIO chips.

echo 413 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio413/direction
echo 1 > /sys/class/gpio/gpio413/value
echo 0 > /sys/class/gpio/gpio413/value