提交 28ce5539 编写于 作者: H Heikki Krogerus 提交者: Greg Kroah-Hartman

usb: typec: Improve Alt Mode documentation

Adding the document to the usb index file and fixing a few
references. Also, exposing the code examples as "literal
blocks" so they are more easy to read.
Signed-off-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 54578ee8
...@@ -19,6 +19,7 @@ Linux USB API ...@@ -19,6 +19,7 @@ Linux USB API
dwc3 dwc3
writing_musb_glue_layer writing_musb_glue_layer
typec typec
typec_bus
usb3-debug-port usb3-debug-port
.. only:: subproject and html .. only:: subproject and html
......
.. _typec:
USB Type-C connector class USB Type-C connector class
========================== ==========================
......
...@@ -13,10 +13,10 @@ every alternate mode, so every alternate mode will need a custom driver. ...@@ -13,10 +13,10 @@ every alternate mode, so every alternate mode will need a custom driver.
USB Type-C bus allows binding a driver to the discovered partner alternate USB Type-C bus allows binding a driver to the discovered partner alternate
modes by using the SVID and the mode number. modes by using the SVID and the mode number.
USB Type-C Connector Class provides a device for every alternate mode a port :ref:`USB Type-C Connector Class <typec>` provides a device for every alternate
supports, and separate device for every alternate mode the partner supports. mode a port supports, and separate device for every alternate mode the partner
The drivers for the alternate modes are bound to the partner alternate mode supports. The drivers for the alternate modes are bound to the partner alternate
devices, and the port alternate mode devices must be handled by the port mode devices, and the port alternate mode devices must be handled by the port
drivers. drivers.
When a new partner alternate mode device is registered, it is linked to the When a new partner alternate mode device is registered, it is linked to the
...@@ -46,7 +46,7 @@ enter any modes on their own. ...@@ -46,7 +46,7 @@ enter any modes on their own.
``->vdm`` is the most important callback in the operation callbacks vector. It ``->vdm`` is the most important callback in the operation callbacks vector. It
will be used to deliver all the SVID specific commands from the partner to the will be used to deliver all the SVID specific commands from the partner to the
alternate mode driver, and vice versa in case of port drivers. The drivers send alternate mode driver, and vice versa in case of port drivers. The drivers send
the SVID specific commands to each other using :c:func:`typec_altmode_vmd()`. the SVID specific commands to each other using :c:func:`typec_altmode_vdm()`.
If the communication with the partner using the SVID specific commands results If the communication with the partner using the SVID specific commands results
in need to reconfigure the pins on the connector, the alternate mode driver in need to reconfigure the pins on the connector, the alternate mode driver
...@@ -67,15 +67,15 @@ Type-C Specification, and also put the connector back to ``TYPEC_STATE_USB`` ...@@ -67,15 +67,15 @@ Type-C Specification, and also put the connector back to ``TYPEC_STATE_USB``
after the mode has been exited. after the mode has been exited.
An example of working definitions for SVID specific pin configurations would An example of working definitions for SVID specific pin configurations would
look like this: look like this::
enum { enum {
ALTMODEX_CONF_A = TYPEC_STATE_MODAL, ALTMODEX_CONF_A = TYPEC_STATE_MODAL,
ALTMODEX_CONF_B, ALTMODEX_CONF_B,
... ...
}; };
Helper macro ``TYPEC_MODAL_STATE()`` can also be used: Helper macro ``TYPEC_MODAL_STATE()`` can also be used::
#define ALTMODEX_CONF_A = TYPEC_MODAL_STATE(0); #define ALTMODEX_CONF_A = TYPEC_MODAL_STATE(0);
#define ALTMODEX_CONF_B = TYPEC_MODAL_STATE(1); #define ALTMODEX_CONF_B = TYPEC_MODAL_STATE(1);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册