Skip to content

Commit

Permalink
usb: phy: Dual role sysfs class definition
Browse files Browse the repository at this point in the history
This CL adds a new class to monitor and change
dual role usb ports from userspace. The usb
phy drivers can register to the dual_role_usb
class and expose the capabilities of the ports.
The phy drivers can decide on whether a specific
attribute can be changed from userspace by
choosing to implement the appropriate callback.

Signed-off-by: Badhri Jagan Sridharan <[email protected]>
Bug: 21615151
Change-Id: I121b4a94437972b5abe8f781e3007efa8531978
  • Loading branch information
Badhri Jagan Sridharan authored and jrior001 committed Sep 6, 2016
1 parent 671e32b commit 0bc3278
Show file tree
Hide file tree
Showing 5 changed files with 738 additions and 0 deletions.
71 changes: 71 additions & 0 deletions Documentation/ABI/testing/sysfs-class-dual-role-usb
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
What: /sys/class/dual_role_usb/.../
Date: June 2015
Contact: Badhri Jagan Sridharan<[email protected]>
Description:
Provide a generic interface to monitor and change
the state of dual role usb ports. The name here
refers to the name mentioned in the
dual_role_phy_desc that is passed while registering
the dual_role_phy_intstance through
devm_dual_role_instance_register.

What: /sys/class/dual_role_usb/.../supported_modes
Date: June 2015
Contact: Badhri Jagan Sridharan<[email protected]>
Description:
This is a static node, once initialized this
is not expected to change during runtime. "dfp"
refers to "downstream facing port" i.e. port can
only act as host. "ufp" refers to "upstream
facing port" i.e. port can only act as device.
"dfp ufp" refers to "dual role port" i.e. the port
can either be a host port or a device port.

What: /sys/class/dual_role_usb/.../mode
Date: June 2015
Contact: Badhri Jagan Sridharan<[email protected]>
Description:
The mode node refers to the current mode in which the
port is operating. "dfp" for host ports. "ufp" for device
ports and "none" when cable is not connected.

On devices where the USB mode is software-controllable,
userspace can change the mode by writing "dfp" or "ufp".
On devices where the USB mode is fixed in hardware,
this attribute is read-only.

What: /sys/class/dual_role_usb/.../power_role
Date: June 2015
Contact: Badhri Jagan Sridharan<[email protected]>
Description:
The power_role node mentions whether the port
is "sink"ing or "source"ing power. "none" if
they are not connected.

On devices implementing USB Power Delivery,
userspace can control the power role by writing "sink" or
"source". On devices without USB-PD, this attribute is
read-only.

What: /sys/class/dual_role_usb/.../data_role
Date: June 2015
Contact: Badhri Jagan Sridharan<[email protected]>
Description:
The data_role node mentions whether the port
is acting as "host" or "device" for USB data connection.
"none" if there is no active data link.

On devices implementing USB Power Delivery, userspace
can control the data role by writing "host" or "device".
On devices without USB-PD, this attribute is read-only

What: /sys/class/dual_role_usb/.../powers_vconn
Date: June 2015
Contact: Badhri Jagan Sridharan<[email protected]>
Description:
The powers_vconn node mentions whether the port
is supplying power for VCONN pin.

On devices with software control of VCONN,
userspace can disable the power supply to VCONN by writing "n",
or enable the power supply by writing "y".
9 changes: 9 additions & 0 deletions drivers/usb/phy/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,13 @@ config USB_ULPI_VIEWPORT
Provides read/write operations to the ULPI phy register set for
controllers with a viewport register (e.g. Chipidea/ARC controllers).

config DUAL_ROLE_USB_INTF
bool "Generic DUAL ROLE sysfs interface"
depends on SYSFS && USB_PHY
help
A generic sysfs interface to track and change the state of
dual role usb phys. The usb phy drivers can register to
this interface to expose it capabilities to the userspace
and thereby allowing userspace to change the port mode.

endif # USB_PHY
1 change: 1 addition & 0 deletions drivers/usb/phy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
obj-$(CONFIG_USB_PHY) += phy.o
obj-$(CONFIG_USB_OTG_WAKELOCK) += otg-wakelock.o

obj-$(CONFIG_DUAL_ROLE_USB_INTF) += class-dual-role.o
# transceiver drivers, keep the list sorted

obj-$(CONFIG_AB8500_USB) += phy-ab8500-usb.o
Expand Down
Loading

0 comments on commit 0bc3278

Please sign in to comment.