# USB

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

Universal serial bus (USB) is an industry standard that allows data exchange and delivery
            of power between various types of electronics. It can run at different speeds such as
            low speed at 1.5 Mbps, full speed at 12 Mbps, high speed at 480 Mbps, SuperSpeed at
            5 Gbps, and SuperSpeed Plus at 10 Gbps.

Synopsys DesignWare® Core SuperSpeed USB 3.x powers the USB on the Qualcomm SoC and is
            connected to two PHYs – USB2 PHY over UTMI and USB3 PHY over PIPE interfaces. These PHYs
            are wired to the physical Type-C port and facilitate communication to the external
            world.

The following are the key hardware components of the USB.
- **USB controllers**
    - The primary controller is a Synopsys DesignWare Core SuperSpeed USB 3.x
                            controller (Gen1/Gen2).
        - Two instances of Qualcomm multipurpose PHY (QMP) for USB
                                    SuperSpeed and DisplayPort.
        - Synopsys PHY for high-speed USB.
    - The secondary controller is a Synopsys DesignWare Core high-speed USB
                            2.0 controller.
        - Synopsys PHY for high-speed USB
    - The tertiary controller is a Synopsys DesignWare Core high-speed USB 2.0
                            controller.
        - Synopsys PHY for high-speed USB.
    - QCS9075 has three USB controllers (primary USB 3.2, secondary USB 3.2,
                            tertiary USB 2.0)
- **Synopsys DesignWare core SuperSpeed USB 3.x controller features**
    - Synopsys DesignWare Core SuperSpeed USB 3.x controller is a USB
                            SuperSpeed-compliant controller, which can be configured in one of the
                            following ways:
        - Peripheral-only configuration
        - Host-only configuration
        - Dual-role configuration
    - Supports all transfer types (control, bulk, interrupt, and
                            isochronous)
    - Supports SuperSpeed bulk streams
    - Compliant with the eXtensible host controller interface (xHCI)
                            specification
    - Host mode supports SuperSpeed (5 Gbps), high-speed (480 Mbps),
                            full-speed (12 Mbps), and low-speed (1.5 Mbps) operations.
    - Device mode supports SuperSpeed (5 Gbps), high-speed (480 Mbps), and
                            full-speed (12 Mbps) operations, and up to 16 bidirectional endpoints
                            (including the control pipe `ep0`).
    - Link power management
- **USB PHY access method**
    - Register-level interface through AHB2PHY for performing PHY-related
                            operations.
- **USB Type-C**
    - Supports USB Type-C and power delivery using the PM7325B PD
                            controller.
    - Fully compliant with the USB Type-C 3.0 power delivery
                            specifications.
    - Supports the PM7325B software driver updates according to the UCSI
                            framework after the delivery controller determines the Type‑C
                            orientation, role, and mode of the connected link partner.
    - Used only for the primary USB controller.

### Clocks

The following tables list the clocks and operating frequencies required for the USB
                controller, and the high speed and SuperSpeed PHYs to function.

Table : USB controller clocks

| Clock name | Operating frequency | Description |
| --- | --- | --- |
| `gcc_usb30_prim_master_clk “core_clk”` | <ul class="ul" id="usb__ul_dtq_hfk_k1c"><br>                                    <li class="li">200&nbsp;MHz SuperSpeed</li><br><br>                                    <li class="li"> 66&nbsp;MHz high speed </li><br><br>                                </ul> | Asynchronous to the bus clock; clock rates defined within the<br>                                device tree node |
| `gcc_cfg_noc_usb3_prim_axi_clk<br>                                “iface_clk”` | <ul class="ul" id="usb__ul_avq_kfk_k1c"><br>                                    <li class="li">200&nbsp;MHz SuperSpeed</li><br><br>                                    <li class="li"> 66&nbsp;MHz high speed </li><br><br>                                </ul> | Auxiliary bus controller unit clock. |
| `gcc_aggre_usb3_prim_axi_clk<br>                                “bus_aggr_clk”` | <ul class="ul" id="usb__ul_yjq_lfk_k1c"><br>                                    <li class="li">200&nbsp;MHz SuperSpeed</li><br><br>                                    <li class="li"> 66&nbsp;MHz high speed </li><br><br>                                </ul> | Clock that feeds into the `aggregator2` module,<br>                                which controls data flow from the USB AXI to the NoC |
| `gcc_usb30_prim_mock_utmi_clk “utmi_clk”` | 19.2 MHz | The internal controller `ref_clk` used for<br>                                generating the ITP counter when the USB transceiver macrocell<br>                                interface (UTMI)/UTMI+ Low Pin interface (ULPI) is suspended |
| `gcc_usb30_prim_sleep_clk “sleep_clk” ` | 32 kHz | Sleep clock |
| `gcc_usb3_sec_clkref_clk_en “xo”` | 19.2 MHz | External reference clock source to the HS-PHY (PMIC) |
| `rpmh_cxo_clk “ref_clk_src” ` | 19.2 MHz | Reference clock source to the HS-PHY |
| ` gcc_usb_phy_cfg_ahb2phy_clk “cfg_ahb_clk”` | 100 MHz | Clock required for the AHB2PHY block (frequency based off PNoC<br>                                frequency. |

Table : High-speed PHY clocks

| Clock name | Operating Frequency | Description |
| --- | --- | --- |
| `rpmh_cxo_clk “ref_clk_src”` | 19.2 MHz | Reference clock source to the HS-PHY |
| `gcc_usb_phy_cfg_ahb2phy_clk<br>                                “cfg_ahb_clk”` | 100 MHz | Clock required for the AHB2PHY block (frequency based off PNoC<br>                                frequency) |

Table : SuperSpeed PHY clocks

| Clock name | Operating Frequency | Description |
| --- | --- | --- |
| `gcc_usb3_prim_phy_aux_clk "aux_clk”` | 19.2 MHz | PHY interface to PCI express (PIPE) auxiliary clock for power<br>                                states |
| `gcc_usb3_prim_phy_pipe_clk “pipe_clk” ` | 125 MHz | Input source for the PIPE, which allows for data transfers<br>                                between PHY and controller |
| `rpmh_cxo_clk "ref_clk_src"` | 19.2 MHz | Parent clock for `ref_clk` |
| `gcc_usb3_prim_clkref_clk "ref_clk"` | 19.2 MHz | Reference clock source to the SS-PHY |
| `gcc_usb3_prim_phy_com_aux_clk "com_aux_clk"` | 19.2 MHz | – |

### Voltage rails

The following table lists the required voltage rails for the HighSpeed and SuperSpeed
                    PHYs.

| Voltage rails | Voltage levels<br>                                    (MAX/NOM/MIN) | Voltage levels<br>                                    (MAX/NOM/MIN) | Voltage levels<br>                                    (MAX/NOM/MIN) | Device mode | Description |
| --- | --- | --- | --- | --- | --- |
| VREG L1C | 1.8 | 1.7 | 0 | Primary and secondary HS-PHY | 1.8 V regulator used by both HS-PHYs in the system |
| VREG L2B | 3.3 | 3.05 | 0 | Primary and secondary HS-PHY | 3.3 V regulator used by both HS-PHYs in the system |
| VREG L1B | 0.912 | 0.912 | 0 | SS-PHY | SS-PHY VDD core |
| VREG L10C | 0.880 | 0.880 | 0 | Primary and secondary HS‑PHY, and SS‑PHY | HS-PHY/SS‑PHY VDD core |

**QCS9075 USB voltage rails**
- HS PHY: L7A (0.88 V), L6C (1.8 V), L9A (3.3 V)
- SS PHY: L1C, L7A

### Interrupts

The following table lists the various interrupts used by the USB controller to notify
                    events.

| Interrupt name | QCS6490 /QCS5430 interrupts | QCS9075 interrupts | QCS9075 interrupts | QCS9075 interrupts | Interrupt events PDC wake-up<br>                                    kernel handling | Interrupt events PDC wake-up<br>                                    kernel handling | Description |
| --- | --- | --- | --- | --- | --- | --- | --- |
| `dp_hs_phy_irq` | 14 | PDC14 | PDC8 | PDC10 | D+ changes | – | Only used when the system is in VDD min/XO shutdown |
| `dm_hs_phy_irq` | 15 | PDC15 | PDC7 | PDC9 | D-changes | – | Only used when the system is in VDD min/XO shutdown |
| `ss_phy_irq` | 17 | PDC12 | PDC13 | – | LFPS detection | – | Only used when the system is in VDD min/XO shutdown |
| `pwr_event_irq` | 130 | 287 | 352 | 444 | – | USB PHY power state changes<br><br><br>                                    <br>Exit/enter P3/L2 | Used as the main controller wake-up handle when the system is<br>                                    not in power collapse |
| `core irq` | 133 | 292 | 349 | 442 | – | <ul class="ul" id="usb__ul_xgw_tkk_k1c"><br>                                        <li class="li">Bus events<ul class="ul" id="usb__ul_pqx_4mn_h1c"><br>                                                <li class="li">Suspend</li><br><br>                                                <li class="li">Resume</li><br><br>                                                <li class="li">Reset</li><br><br>                                            </ul><br></li><br><br>                                        <li class="li">Controller event completion<ul class="ul" id="usb__ul_qqx_4mn_h1c"><br>                                                <li class="li">Transfer completion</li><br><br>                                                <li class="li">Command completion</li><br><br>                                            </ul><br></li><br><br>                                    </ul> | Main USB interrupt that handles all USB controller<br>                                    events |

### Interconnect

The following table lists the various interconnects used by the USB controller.

Table : USB interconnects

| Interconnect name | Controller | Target | Interconnect path bandwidths in MBps |
| --- | --- | --- | --- |
| USB-DDR | <ul class="ul" id="usb__ul_qyk_ywh_4cc"><br>                                        <li class="li"><code class="ph codeph">MASTER_USB3_0</code></li><br><br>                                        <li class="li">QCS9075<ul class="ul" id="usb__ul_bym_bxh_4cc"><br>                                                <li class="li"><code class="ph codeph">MASTER_USB3_1</code></li><br><br>                                                <li class="li"><code class="ph codeph">MASTER_USB2</code></li><br><br>                                            </ul><br></li><br><br>                                    </ul> | `SLAVE_EBI1` | <ul class="ul" id="usb__ul_xwc_tlk_k1c"><br>                                        <li class="li">USB_MEMORY_AVG_HS_BW MBps_to_icc(240)</li><br><br>                                        <li class="li">USB_MEMORY_PEAK_HS_BW MBps_to_icc(700)</li><br><br>                                        <li class="li">USB_MEMORY_AVG_SS_BW MBps_to_icc(1000)</li><br><br>                                        <li class="li"> USB_MEMORY_PEAK_SS_BW MBps_to_icc(2500)</li><br><br>                                    </ul> |
| APPS-USB | `MASTER_APPSS_PROC` | <ul class="ul" id="usb__ul_p4f_tj3_4cc"><br>                                        <li class="li"><code class="ph codeph">SLAVE_USB3_0</code></li><br><br>                                        <li class="li">QCS9075<ul class="ul" id="usb__ul_sm3_sj3_4cc"><br>                                                <li class="li"><code class="ph codeph">SLAVE_USB3_1</code></li><br><br>                                                <li class="li"><code class="ph codeph">SLAVE_USB2</code></li><br><br>                                            </ul><br></li><br><br>                                    </ul> | <ul class="ul" id="usb__ul_m24_vlk_k1c"><br>                                        <li class="li">APPS_USB_AVG_BW 0</li><br><br>                                        <li class="li">APPS_USB_PEAK_BW MBps_to_icc(40)</li><br><br>                                    </ul> |

### **USB controller reset control using clock control**

The following table lists the reset methods used for the USB controller and
                PHY.

Table : USB reset methods

| Clock name | Reset control | Description |
| --- | --- | --- |
| `GCC_USB3_DP_PHY_PRIM_BCR "global_phy_reset"<br>                                    ` | SS-PHY | Resets the SS-PHY control and status registers |
| `GCC_USB3_PHY_PRIM_BCR "phy_reset" ` | SS-PHY | Resets the SS-PHY |
| `GCC_QUSB2PHY_PRIM_BCR "phy_reset" ` | HS-PHY | Resets the HS-PHY |
| `GCC_USB30_PRIM_BCR "core_reset" ` | USB controller | Clock controller output to reset the USB controller |

### USB controller software reset using register

The following table lists the register options to reset the USB controller.

Table : USB controller resets

| USB controller register | USB register bit field | Reset control | Description |
| --- | --- | --- | --- |
| DWC3\_DCTL | CSFTRST [Bit 30] | USB controller | Resets the USB controller device stack. |
| DWC3\_GCTL | CORESOFTRESET [Bit 11] | - | Global reset for the DWC3 controller |

**QCS9075 controller reset registers**
- HS: GCC\_USB2\_PHY\_PRIM\_BCR
- SS: GCC\_USB3\_PHY\_PRIM\_BCR/ GCC\_USB3PHY\_PHY\_PRIM\_BCR
- GCC\_USB3\_PHY\_TERT\_BCR
- USB30\_PRIM\_GDSC
- USB30\_SEC\_GDSC
- USB20\_PRIM\_GDSC

### USB controller and SoC integration

The
                intellectual property and PHYs of the USB controller are integrated into the SoC as
                shown in the following figure. 
Figure : USB controller PHYs and SoC integration
                    
                    <!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by Microsoft Visio, SVG Export usb-controller-soc.svg Page-1 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="5.25434in" height="5.20528in" viewbox="0 0 378.313 374.78" xml:space="preserve" color-interpolation-filters="sRGB" class="st13"><v:documentproperties v:langid="1033" v:metric="true" v:viewmarkup="false">	<v:userdefs>		<v:ud v:nameu="msvNoAutoConnect" v:val="VT0(1):26"></v:ud>	</v:userdefs></v:documentproperties>
<style>.svg-1 .st1 { fill: #ffffff; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-1 .st2 { fill: none; stroke: #3253dc; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st3 { fill: #000000; font-family: Arial; font-size: 1.00001em }
.svg-1 .st4 { font-size: 1em }
.svg-1 .st5 { fill: none; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st6 { fill: #000000; font-family: Arial; font-size: 1.16666em }
.svg-1 .st7 { marker-end: url("#mrkr4-27"); marker-start: url("#mrkr4-25"); stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st8 { fill: #000000; fill-opacity: 1; stroke: #000000; stroke-opacity: 1; stroke-width: 0.28409090909091 }
.svg-1 .st9 { marker-end: url("#mrkr4-27"); stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st10 { stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st11 { marker-start: url("#mrkr4-25"); stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 1 }
.svg-1 .st12 { fill: #000000; font-family: Arial; font-size: 0.833336em }
.svg-1 .st13 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<defs id="Markers">	<g id="lend4">		<path d="M 2 1 L 0 0 L 2 -1 L 2 1 " style="stroke:none"></path>	</g>	<marker id="mrkr4-25" class="st8" v:arrowtype="4" v:arrowsize="2" v:setback="6.68" refx="6.68" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend4" transform="scale(3.52) "></use>	</marker>	<marker id="mrkr4-27" class="st8" v:arrowtype="4" v:arrowsize="2" v:setback="7.04" refx="-7.04" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend4" transform="scale(-3.52,-3.52) "></use>	</marker></defs><g v:mid="7" v:index="1" v:groupcontext="backgroundPage">	<v:userdefs>		<v:ud v:nameu="msvVisioCreated" v:prompt="" v:val="VT0(0):26"></v:ud>	</v:userdefs>	<title>VBackground-1</title>	<v:pageproperties width="5.25434" height="5.20528" v:drawingscale="0.0393701" v:pagescale="0.0393701" v:drawingunits="24" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape1-1" v:mid="1" v:groupcontext="shape">		<title>Solid</title>		<v:userdefs>			<v:ud v:nameu="Background" v:val="VT0(0):26"></v:ud>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>			<v:ud v:nameu="msvShapeCategories" v:prompt="" v:val="VT4(DoNotContain)"></v:ud>			<v:ud v:nameu="msvVisioCreated" v:prompt="" v:val="VT0(0):26"></v:ud>		</v:userdefs>		<rect x="0" y="0" width="378.313" height="374.78" class="st1"></rect>	</g></g><g v:mid="0" v:index="2" v:groupcontext="foregroundPage">	<title>Page-1</title>	<v:pageproperties v:drawingscale="0.0393701" v:pagescale="0.0393701" v:drawingunits="24" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape3-3" v:mid="3" v:groupcontext="shape" transform="translate(19,-64)">		<title>Sheet.3</title>		<rect x="0" y="83" width="340.312" height="291.78" class="st2"></rect>	</g>	<g id="shape4-5" v:mid="4" v:groupcontext="shape" transform="translate(127.563,-245.89)">		<title>Sheet.4</title>		<desc>USB 3.x controller</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="36" cy="338.78" width="72" height="72"></v:textrect>		<rect x="0" y="302.78" width="72" height="72" class="st2"></rect>		<text x="13.99" y="335.18" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>USB 3.x<v:lf></v:lf><tspan x="11.32" dy="1.2em" class="st4">controller</tspan></text>		</g>	<g id="shape5-9" v:mid="5" v:groupcontext="shape" transform="translate(54.0325,-328.78)">		<title>Sheet.5</title>		<desc>SoC</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="122.265" cy="361.28" width="244.54" height="27"></v:textrect>		<rect x="0" y="347.78" width="244.53" height="27" class="st5"></rect>		<text x="108.65" y="365.48" class="st6" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>SoC</text>		</g>	<g id="shape7-12" v:mid="7" v:groupcontext="shape" transform="translate(51.0625,-19)">		<title>Sheet.7</title>		<desc>Type-C connector</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="131.625" cy="361.28" width="263.25" height="27"></v:textrect>		<rect x="0" y="347.78" width="263.25" height="27" class="st2"></rect>		<text x="83.94" y="364.88" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Type-C connector</text>		</g>	<g id="shape8-15" v:mid="8" v:groupcontext="shape" transform="translate(213.063,-245.89)">		<title>Sheet.8</title>		<desc>AHB 2 PHY</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="36" cy="338.78" width="72" height="72"></v:textrect>		<rect x="0" y="302.78" width="72" height="72" class="st2"></rect>		<text x="18.66" y="335.18" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>AHB 2<v:newlinechar></v:newlinechar><tspan x="23.66" dy="1.2em" class="st4">PHY</tspan></text>		</g>	<g id="shape9-19" v:mid="9" v:groupcontext="shape" transform="translate(518.813,129.25) rotate(90)">		<title>Sheet.9</title>		<path d="M6.68 374.78 L7.04 374.78 L84.49 374.78" class="st7"></path>	</g>	<g id="shape10-28" v:mid="10" v:groupcontext="shape" transform="translate(446.813,292.78) rotate(90)">		<title>Sheet.10</title>		<path d="M6.68 374.78 L7.04 374.78 L28.96 374.78" class="st7"></path>	</g>	<g id="shape11-35" v:mid="11" v:groupcontext="shape" transform="translate(27.0325,-245.53)">		<title>Sheet.11</title>		<desc>Display port controller</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="36" cy="338.6" width="72" height="72.36"></v:textrect>		<rect x="0" y="302.42" width="72" height="72.36" class="st2"></rect>		<text x="4.32" y="335" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Display port <v:newlinechar></v:newlinechar><tspan x="11.32" dy="1.2em" class="st4">controller</tspan></text>		</g>	<g id="shape12-39" v:mid="12" v:groupcontext="shape" transform="translate(430.343,129.25) rotate(90)">		<title>Sheet.12</title>		<path d="M6.68 374.78 L7.04 374.78 L84.49 374.78" class="st7"></path>	</g>	<g id="shape13-46" v:mid="13" v:groupcontext="shape" transform="translate(55.5625,-154)">		<title>Sheet.13</title>		<path d="M0 354.13 L69.75 354.13 L69.75 367.74" class="st9"></path>	</g>	<g id="shape15-51" v:mid="15" v:groupcontext="shape" transform="translate(186.063,517.125) scale(1,-1)">		<title>Sheet.15</title>		<path d="M0 374.78 L114.75 374.78" class="st10"></path>	</g>	<g id="shape16-54" v:mid="16" v:groupcontext="shape" transform="translate(-188.717,129.25) rotate(-90) scale(-1,1)">		<title>Sheet.16</title>		<path d="M6.68 374.78 L7.04 374.78 L13.09 374.78" class="st11"></path>	</g>	<g id="shape17-59" v:mid="17" v:groupcontext="shape" transform="translate(108.033,-82)">		<title>Sheet.17</title>		<desc>SS0_1 DP PHY (QMP)</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="36" cy="338.78" width="72" height="72"></v:textrect>		<rect x="0" y="302.78" width="72" height="72" class="st2"></rect>		<text x="17.99" y="327.98" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>SS0_1<v:newlinechar></v:newlinechar><tspan x="27.66" dy="1.2em" class="st4">DP<v:newlinechar></v:newlinechar></tspan><tspan x="4.33" dy="1.2em" class="st4">PHY (QMP)</tspan></text>		</g>	<g id="shape18-64" v:mid="18" v:groupcontext="shape" transform="translate(512.358,328.78) rotate(90) scale(-1,1)">		<title>Sheet.18</title>		<path d="M6.68 374.78 L7.04 374.78 L28.96 374.78" class="st7"></path>	</g>	<g id="shape19-71" v:mid="19" v:groupcontext="shape" transform="translate(36.0325,-82)">		<title>Sheet.19</title>		<desc>SS0_0 DP PHY (QMP)</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="36" cy="338.78" width="72" height="72"></v:textrect>		<rect x="0" y="302.78" width="72" height="72" class="st2"></rect>		<text x="17.99" y="327.98" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>SS0_0<v:newlinechar></v:newlinechar><tspan x="27.66" dy="1.2em" class="st4">DP<v:newlinechar></v:newlinechar></tspan><tspan x="4.33" dy="1.2em" class="st4">PHY (QMP)</tspan></text>		</g>	<g id="shape20-76" v:mid="20" v:groupcontext="shape" transform="translate(-280.967,165.97) rotate(-90) scale(-1,1)">		<title>Sheet.20</title>		<path d="M0 374.78 L47.36 374.78" class="st9"></path>	</g>	<g id="shape21-81" v:mid="21" v:groupcontext="shape" transform="translate(-213.467,165.97) rotate(-90) scale(-1,1)">		<title>Sheet.21</title>		<path d="M0 374.78 L47.36 374.78" class="st9"></path>	</g>	<g id="shape22-86" v:mid="22" v:groupcontext="shape" transform="translate(279.31,-208.81) scale(-1,1)">		<title>Sheet.22</title>		<path d="M0 374.78 L185.5 374.78" class="st10"></path>	</g>	<g id="shape23-89" v:mid="23" v:groupcontext="shape" transform="translate(614.843,129.25) rotate(90)">		<title>Sheet.23</title>		<path d="M6.68 374.78 L7.04 374.78 L36.72 374.78" class="st11"></path>	</g>	<g id="shape24-94" v:mid="24" v:groupcontext="shape" transform="translate(-73.9675,292.78) rotate(-90) scale(-1,1)">		<title>Sheet.24</title>		<path d="M6.68 374.78 L7.04 374.78 L28.55 374.78" class="st7"></path>	</g>	<g id="shape25-101" v:mid="25" v:groupcontext="shape" transform="translate(264.813,-172.405)">		<title>Sheet.25</title>		<desc>EUD</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="36" cy="362.968" width="72" height="23.625"></v:textrect>		<rect x="0" y="351.155" width="72" height="23.625" class="st2"></rect>		<text x="23.33" y="366.57" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>EUD</text>		</g>	<g id="shape26-104" v:mid="26" v:groupcontext="shape" transform="translate(265.533,-82)">		<title>Sheet.26</title>		<desc>HS0 PHY (SNPS)</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="36" cy="338.78" width="72" height="72"></v:textrect>		<rect x="0" y="302.78" width="72" height="72" class="st2"></rect>		<text x="24.33" y="327.98" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>HS0<v:newlinechar></v:newlinechar><tspan x="23.66" dy="1.2em" class="st4">PHY<v:newlinechar></v:newlinechar></tspan><tspan x="15.66" dy="1.2em" class="st4">(SNPS)</tspan></text>		</g>	<g id="shape28-109" v:mid="28" v:groupcontext="shape" transform="translate(103.46,-224.479)">		<title>Sheet.28</title>		<desc>Pipe</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="18.2806" cy="365.78" width="36.57" height="18"></v:textrect>		<rect x="0" y="356.78" width="36.5613" height="18" class="st5"></rect>		<text x="12.55" y="368.78" class="st12" v:langid="1033"><v:paragraph v:horizalign="2"></v:paragraph><v:tablist></v:tablist>Pipe</text>		</g>	<g id="shape29-112" v:mid="29" v:groupcontext="shape" transform="translate(153.8,-223.991)">		<title>Sheet.29</title>		<desc>UTMI</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="18.2806" cy="365.78" width="36.57" height="18"></v:textrect>		<rect x="0" y="356.78" width="36.5613" height="18" class="st5"></rect>		<text x="4" y="368.78" class="st12" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>UTMI</text>		</g>	<g id="shape30-115" v:mid="30" v:groupcontext="shape" transform="translate(134.313,-247.06)">		<title>Sheet.30</title>		<desc>SS</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="13.5" cy="368.03" width="27" height="13.5"></v:textrect>		<rect x="0" y="361.28" width="27" height="13.5" class="st5"></rect>		<text x="4" y="371.03" class="st12" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>SS</text>		</g>	<g id="shape31-118" v:mid="31" v:groupcontext="shape" transform="translate(170.313,-247.06)">		<title>Sheet.31</title>		<desc>HS</desc>		<v:textblock v:margins="rect(4,4,4,4)"></v:textblock>		<v:textrect cx="13.5" cy="368.03" width="27" height="13.5"></v:textrect>		<rect x="0" y="361.28" width="27" height="13.5" class="st5"></rect>		<text x="9.11" y="371.03" class="st12" v:langid="1033"><v:paragraph v:horizalign="2"></v:paragraph><v:tablist></v:tablist>HS</text>		</g>	<g id="shape33-121" v:mid="33" v:groupcontext="shape" transform="translate(654.09,165.97) rotate(90)">		<title>Sheet.33</title>		<path d="M0 374.78 L5.74 374.78" class="st9"></path>	</g>	<g id="shape34-126" v:mid="34" v:groupcontext="shape" transform="translate(675.593,142.345) rotate(90)">		<title>Sheet.34</title>		<path d="M0 374.78 L29.36 374.78" class="st9"></path>	</g>	<g id="shape35-131" v:mid="35" v:groupcontext="shape" transform="translate(677.061,202.375) rotate(90)">		<title>Sheet.35</title>		<path d="M6.68 374.78 L7.04 374.78 L11.37 374.78" class="st7"></path>	</g>	<g id="shape36-138" v:mid="36" v:groupcontext="shape" transform="translate(80.8851,-154)">		<title>Sheet.36</title>		<path d="M63.15 343.89 L0 343.89 L0 367.74" class="st9"></path>	</g></g>
</svg>

The Synopsys DesignWare Core SuperSpeed USB 3.0 intellectual property
                controls only the core functionality and not the device specifics, such as clocks,
                interconnects, regulators, and GDSCs. The Synopsys DesignWare Core intellectual
                property is embedded inside a `Qscratch` wrapper (intellectual
                property and software driver), which takes up the responsibility of managing the
                required resources (clocks, interconnects, interrupts, GDSC, and regulators) during
                the probe, suspends, or resume state. Both these drivers co-exist to ensure the USB
                functionality.

For information on the USB `Qscratch` wrapper
            driver, see [https://github.com/torvalds/linux/blob/master/drivers/usb/dwc3/dwc3-qcom.c](https://github.com/torvalds/linux/blob/master/drivers/usb/dwc3/dwc3-qcom.c). For information on the controller core driver,
                see [https://github.com/torvalds/linux/blob/master/drivers/usb/dwc3/core.c](https://github.com/torvalds/linux/blob/master/drivers/usb/dwc3/core.c).

### xHCI support

The xHCI specification describes the register-level host controller interface for USB
                2.0 and later. The USB controller is compliant with xHCI specifications, and in host
                mode it supports SuperSpeed (5 Gbps), high-speed (480 Mbps), full-speed (12 Mbps),
                and low-speed (1.5 Mbps) operations.

Linux standard xHCI drivers are used to operate the USB controller in host mode.

### USB Type-C connector system software interface (UCSI)

Note: QCS9075 does not support USB Type-C feature.

- The USB Type-C connector system software interface is available in the Linux
                    kernel as a library. It defines a set of registers and data structures, which
                    are used to interface with the USB Type-C connectors on a system. The USB Type-C
                    connectors on the platform are referred to as the platform policy manager (PPM)
                    and the system software component is referred to as the OS policy manager
                    (OPM).
- Qualcomm reference design uses the UCSI `Glink` driver to handle
                    the communication between the OPM on the application processor and the PPM,
                    which is the charger firmware running on the remote subsystem (aDSP) over PMIC
                    GLINK.
- The USB Type-C DisplayPort alternate mode adds the capabilities of supporting
                    additional cable details, such as DPAM version and signaling of cable. The
                    Qualcomm reference design supports DisplayPort over Type-C and concurrent
                    support of USB SuperSpeed and DisplayPort with a maximum of two lanes for
                    DisplayPort (two lanes for USB SuperSpeed and two lanes for DisplayPort).
- The USB Type-C power delivery is supported by the PM7325B PD controller, fully
                    compliant with the USB PD 3.0 specification. Using the UCSI interface, USB
                    data-role swap and power-role swap are supported.
- Following are the references of the drivers involved:
    - [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/typec/ucsi/ucsi.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/typec/ucsi/ucsi.c?h=v6.6.2)
    - [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/typec/ucsi/ucsi_glink.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/typec/ucsi/ucsi_glink.c?h=v6.6.2)
    - [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/typec/ucsi/displayport.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/typec/ucsi/displayport.c?h=v6.6.2)
    - [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/phy/qualcomm/phy-qcom-qmp-combo.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/phy/qualcomm/phy-qcom-qmp-combo.c?h=v6.6.2)
    - [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/dwc3/dwc3-qcom.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/dwc3/dwc3-qcom.c?h=v6.6.2)
    - [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/soc/qcom/pmic_glink.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/soc/qcom/pmic_glink.c?h=v6.6.2)
    - [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/soc/qcom/pmic_glink_altmode.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/soc/qcom/pmic_glink_altmode.c?h=v6.6.2)

## USB features

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

Qualcomm chip products allow working in the dual-role device (DRD) mode. DRD enables both
            device and host roles. The device dynamically detects the role to move to and programs
            the controller accordingly. The autosuspend capability is supported to shut down the USB
            controller when the cable is removed. Function interfaces, such as video, audio,
            tethering, file transfer, media transfer, and charging are supported.

Table : USB features: Linux

| Feature | Description |
| --- | --- |
| USB\_DWC3 controller | Synopsys DesignWare Core is supported by default in the Linux<br>                            kernel. |
| USB\_DWC3\_QCOM | `Qscratch` wrapper using the Synopsys DesignWare Core<br>                            for the USB functionality. |
| Runtime power management (RPM) | Linux supports RPM with the software drive file<br>                                `dwc3-qcom`, for low-power mode operations. |
| USB LPM | Low-power mode for power-saving options from both HS/SS-PHY as well<br>                            as the controller. |
| DRD | Dual-role device detection allows USB to work in both host and device<br>                            mode. |

### Runtime power management

The Runtime power management feature can be enabled according to the user
                requirements. LPM support is added as part of [https://lore.kernel.org/all/20231017131851.8299-1-quic_kriskura@quicinc.com/](https://lore.kernel.org/all/20231017131851.8299-1-quic_kriskura@quicinc.com/).

By default, USB-suspend and resume in runtime are disabled. To enable these
                features, run the following
                command:

    echo auto > /sys/bus/platform/devices/a600000.usb/power/controlCopy to clipboard

The default autosuspend delay is set to 5 s. To change the delay, run the following
                    `sysfs`
                command:

    echo 2000 > /sys/bus/platform/devices/a600000.usb/power/autosuspend_delay_msCopy to clipboard

During a role switch, the DWC3 controller enters the suspend state, toggles GDSC, and
                resets the controller to ensure successful host mode peripheral enumeration.

While in host mode, for remote wake-up to work, wake-up, and autosuspend are enabled
                for the xHCI interface, USB root hubs, and the connected peripherals according to
                user requirements.

    echo enabled > /sys/bus/platform/devices/xhci-hcd.X.auto/power/wakeup
    cd /sys/bus/usb/devices/
    echo enabled > usb1/power/wakeup
    echo enabled > usb2/power/wakeup
    Copy to clipboard

Note: The host controller driver (HCD) device generates the
                    `xhci-hcd.X.auto` value, where <var class="keyword varname">X</var> = 0, 1, 2 and
                so on. It indicates the number of devices connected to the USB. The connected
                devices are listed at
                    /sys/bus/platform/devices/xhci-hcd.X.auto/usb1/&lt;&gt;.

To enable the remote wake up for an LS optical mouse, run the following commands:

    cd /sys/bus/usb/devices/usb1/1-1/
    echo auto > power/control
    echo enabled > power/wakeup
    Copy to clipboard

To check the runtime status, run the following
                command:

    cat /sys/bus/platform/devices/a600000.usb/power/runtime_statusCopy to clipboard

To avoid suspending in the composition switch, remove the active UDC to rebind the
                composition by running the following
                command:

    echo on > /sys/bus/platform/devices/a600000.usb/power/control
    echo auto > /sys/bus/platform/devices/a600000.usb/power/control
    Copy to clipboard

## USB architecture

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

The Qualcomm USB software architecture is loosely made of two components, one is based on
            pure upstream, and another is a sandbox where some of the pending feature-related
            changes are present. The pure upstream is directly picked from the latest stable kernel
            long-term support (LTS) 6.6.2. The architecture uses a Yocto (release 4.0) recipe for
            creating the binaries.

Figure : USB software architecture
            
            <!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by Microsoft Visio, SVG Export usb-sw-architecture.svg Page-2 -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="10.0208in" height="8.18062in" viewbox="0 0 721.5 589.004" xml:space="preserve" color-interpolation-filters="sRGB" class="st16"><v:documentproperties v:langid="1033" v:metric="true" v:viewmarkup="false">	<v:userdefs>		<v:ud v:nameu="msvNoAutoConnect" v:val="VT0(1):26"></v:ud>	</v:userdefs></v:documentproperties>
<style>.svg-2 .st1 { fill: #ffffff; stroke: none; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-2 .st2 { fill: #ffffff; stroke: #3253dc; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-2 .st3 { fill: #000000; font-family: Calibri; font-size: 1.00001em }
.svg-2 .st4 { font-size: 1em }
.svg-2 .st5 { marker-start: url("#mrkr4-86"); stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-2 .st6 { fill: #000000; fill-opacity: 1; stroke: #000000; stroke-opacity: 1; stroke-width: 0.29411764705882 }
.svg-2 .st7 { fill: #ffffff; stroke: none; stroke-linecap: butt; stroke-width: 7.2 }
.svg-2 .st8 { fill: #000000; font-family: Calibri; font-size: 0.666664em }
.svg-2 .st9 { marker-start: url("#mrkr4-173"); stroke: #000000; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-2 .st10 { fill: #000000; fill-opacity: 1; stroke: #000000; stroke-opacity: 1; stroke-width: 0.34246575342466 }
.svg-2 .st11 { fill: #d8d8d8; stroke: #3253dc; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-2 .st12 { fill: none; stroke: #3253dc; stroke-linecap: round; stroke-linejoin: round; stroke-width: 0.75 }
.svg-2 .st13 { fill: none; stroke: #3253dc; stroke-linecap: butt; stroke-width: 6 }
.svg-2 .st14 { fill: #000000; stroke: #3253dc; stroke-linecap: butt; stroke-width: 0.75 }
.svg-2 .st15 { fill: #ffff00; stroke: #3253dc; stroke-linecap: butt; stroke-width: 0.75 }
.svg-2 .st16 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<defs id="Markers">	<g id="lend4">		<path d="M 2 1 L 0 0 L 2 -1 L 2 1 " style="stroke:none"></path>	</g>	<marker id="mrkr4-86" class="st6" v:arrowtype="4" v:arrowsize="1" v:setback="6.32" refx="6.32" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend4" transform="scale(3.4) "></use>	</marker>	<marker id="mrkr4-173" class="st10" v:arrowtype="4" v:arrowsize="0" v:setback="5.36" refx="5.36" orient="auto" markerunits="strokeWidth" overflow="visible">		<use xlink:href="#lend4" transform="scale(2.92) "></use>	</marker></defs><g v:mid="7" v:index="1" v:groupcontext="backgroundPage">	<v:userdefs>		<v:ud v:nameu="msvVisioCreated" v:prompt="" v:val="VT0(0):26"></v:ud>	</v:userdefs>	<title>VBackground-1</title>	<v:pageproperties width="10.0208" height="8.18062" v:drawingscale="0.0393701" v:pagescale="0.0393701" v:drawingunits="24" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape1-1" v:mid="1" v:groupcontext="shape">		<title>Solid</title>		<v:userdefs>			<v:ud v:nameu="Background" v:val="VT0(0):26"></v:ud>			<v:ud v:nameu="visVersion" v:val="VT0(15):26"></v:ud>			<v:ud v:nameu="msvShapeCategories" v:prompt="" v:val="VT4(DoNotContain)"></v:ud>			<v:ud v:nameu="msvVisioCreated" v:prompt="" v:val="VT0(0):26"></v:ud>		</v:userdefs>		<rect x="0" y="0" width="721.5" height="589.004" class="st1"></rect>	</g></g><g v:mid="4" v:index="3" v:groupcontext="foregroundPage">	<title>Page-2</title>	<v:pageproperties v:drawingscale="0.0393701" v:pagescale="0.0393701" v:drawingunits="24" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<v:layer v:name="Connector" v:index="0"></v:layer>	<g id="shape2-3" v:mid="2" v:groupcontext="shape" transform="translate(18.75,-403.323)">		<title>Sheet.2</title>		<rect x="0" y="517.004" width="553.5" height="72" class="st2"></rect>	</g>	<g id="shape3-5" v:mid="3" v:groupcontext="shape" transform="translate(18.75,-83.823)">		<title>Sheet.3</title>		<rect x="0" y="274.004" width="553.5" height="315" class="st2"></rect>	</g>	<g id="shape4-7" v:mid="4" v:groupcontext="shape" transform="translate(36.75,-430.323)">		<title>Sheet.4</title>		<desc>/dev/ffs-xxx/</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="36" cy="575.504" width="72" height="27"></v:textrect>		<rect x="0" y="562.004" width="72" height="27" class="st2"></rect>		<text x="4.56" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>/dev/ffs-xxx/</text>		</g>	<g id="shape5-10" v:mid="5" v:groupcontext="shape" transform="translate(45.75,-421.323)">		<title>Sheet.5</title>		<desc>/dev/ffs-xxx/</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="36" cy="575.504" width="72" height="27"></v:textrect>		<rect x="0" y="562.004" width="72" height="27" class="st2"></rect>		<text x="4.56" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>/dev/ffs-xxx/</text>		</g>	<g id="shape6-13" v:mid="6" v:groupcontext="shape" transform="translate(54.75,-412.323)">		<title>Sheet.6</title>		<desc>/dev/ffs-xxx/</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="36" cy="575.504" width="72" height="27"></v:textrect>		<rect x="0" y="562.004" width="72" height="27" class="st2"></rect>		<text x="4.56" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>/dev/ffs-xxx/</text>		</g>	<g id="shape7-16" v:mid="7" v:groupcontext="shape" transform="translate(133.5,-412.323)">		<title>Sheet.7</title>		<desc>/sys/kernel/config/usb_gadget/...</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="90" cy="575.504" width="180" height="27"></v:textrect>		<rect x="0" y="562.004" width="180" height="27" class="st2"></rect>		<text x="7.95" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>/sys/kernel/config/usb_gadget/...</text>		</g>	<g id="shape8-19" v:mid="8" v:groupcontext="shape" transform="translate(324.75,-412.323)">		<title>Sheet.8</title>		<desc>/sys/bus/usb/...</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="47.25" cy="575.504" width="94.5" height="27"></v:textrect>		<rect x="0" y="562.004" width="94.5" height="27" class="st2"></rect>		<text x="8.72" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>/sys/bus/usb/...</text>		</g>	<g id="shape9-22" v:mid="9" v:groupcontext="shape" transform="translate(27.75,-220.823)">		<title>Sheet.9</title>		<rect x="0" y="429.004" width="189" height="160" class="st2"></rect>	</g>	<g id="shape10-24" v:mid="10" v:groupcontext="shape" transform="translate(36.75,-326.823)">		<title>Sheet.10</title>		<desc>Function driver</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="40.5" cy="571.004" width="81" height="36"></v:textrect>		<rect x="0" y="553.004" width="81" height="36" class="st2"></rect>		<text x="19.2" y="567.4" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Function <tspan x="26.09" dy="1.2em" class="st4">driver</tspan></text>		</g>	<g id="shape11-28" v:mid="11" v:groupcontext="shape" transform="translate(126.75,-326.823)">		<title>Sheet.11</title>		<desc>Function driver</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="40.5" cy="571.004" width="81" height="36"></v:textrect>		<rect x="0" y="553.004" width="81" height="36" class="st2"></rect>		<text x="19.2" y="567.4" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Function <tspan x="26.09" dy="1.2em" class="st4">driver</tspan></text>		</g>	<g id="shape12-32" v:mid="12" v:groupcontext="shape" transform="translate(36.75,-272.823)">		<title>Sheet.12</title>		<desc>Gadget framework configfs, UDC core</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="85.5" cy="566.504" width="171" height="45"></v:textrect>		<rect x="0" y="544.004" width="171" height="45" class="st2"></rect>		<text x="39.67" y="562.9" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Gadget framework<v:newlinechar></v:newlinechar><tspan x="40.71" dy="1.2em" class="st4">configfs, UDC core</tspan></text>		</g>	<g id="shape13-36" v:mid="13" v:groupcontext="shape" transform="translate(36.75,-227.823)">		<title>Sheet.13</title>		<desc>Device controller driver</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="85.5" cy="571.004" width="171" height="36"></v:textrect>		<rect x="0" y="553.004" width="171" height="36" class="st2"></rect>		<text x="28.14" y="574.6" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Device controller driver</text>		</g>	<g id="shape14-39" v:mid="14" v:groupcontext="shape" transform="translate(252.75,-220.823)">		<title>Sheet.14</title>		<rect x="0" y="429.004" width="189" height="160" class="st2"></rect>	</g>	<g id="shape15-41" v:mid="15" v:groupcontext="shape" transform="translate(261.75,-326.823)">		<title>Sheet.15</title>		<desc>Class driver</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="40.5" cy="571.004" width="81" height="36"></v:textrect>		<rect x="0" y="553.004" width="81" height="36" class="st2"></rect>		<text x="28.36" y="567.4" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Class<v:newlinechar></v:newlinechar><tspan x="26.09" dy="1.2em" class="st4">driver</tspan></text>		</g>	<g id="shape16-45" v:mid="16" v:groupcontext="shape" transform="translate(351.75,-326.823)">		<title>Sheet.16</title>		<desc>Class driver</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="40.5" cy="571.004" width="81" height="36"></v:textrect>		<rect x="0" y="553.004" width="81" height="36" class="st2"></rect>		<text x="28.36" y="567.4" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Class<v:newlinechar></v:newlinechar><tspan x="26.09" dy="1.2em" class="st4">driver</tspan></text>		</g>	<g id="shape17-49" v:mid="17" v:groupcontext="shape" transform="translate(261.75,-272.823)">		<title>Sheet.17</title>		<desc>USB core</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="85.5" cy="566.504" width="171" height="45"></v:textrect>		<rect x="0" y="544.004" width="171" height="45" class="st2"></rect>		<text x="63.49" y="570.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>USB core</text>		</g>	<g id="shape18-52" v:mid="18" v:groupcontext="shape" transform="translate(261.75,-227.823)">		<title>Sheet.18</title>		<desc>Host controller driver</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="85.5" cy="571.004" width="171" height="36"></v:textrect>		<rect x="0" y="553.004" width="171" height="36" class="st2"></rect>		<text x="33.17" y="574.6" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Host controller driver</text>		</g>	<g id="shape19-55" v:mid="19" v:groupcontext="shape" transform="translate(144.75,-173.823)">		<title>Sheet.19</title>		<desc>dwc3-qcom</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="90" cy="577.192" width="180" height="23.625"></v:textrect>		<rect x="0" y="565.379" width="180" height="23.625" class="st2"></rect>		<text x="61.5" y="580.79" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>dwc3-qcom</text>		</g>	<g id="shape20-58" v:mid="20" v:groupcontext="shape" transform="translate(72.75,-137.823)">		<title>Sheet.20</title>		<desc>DWC3 core drivers</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="162" cy="577.192" width="324.01" height="23.625"></v:textrect>		<rect x="0" y="565.379" width="324" height="23.625" class="st2"></rect>		<text x="116.48" y="580.79" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>DWC3 core drivers</text>		</g>	<g id="shape21-61" v:mid="21" v:groupcontext="shape" transform="translate(72.75,-96.7605)">		<title>Sheet.21</title>		<desc>Femto phy driver</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="54" cy="578.598" width="108.01" height="20.8125"></v:textrect>		<rect x="0" y="568.192" width="108" height="20.8125" class="st2"></rect>		<text x="12.15" y="582.2" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Femto phy driver</text>		</g>	<g id="shape22-64" v:mid="22" v:groupcontext="shape" transform="translate(288.75,-96.7605)">		<title>Sheet.22</title>		<desc>QMP phy driver</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="54" cy="578.598" width="108.01" height="20.8125"></v:textrect>		<rect x="0" y="568.192" width="108" height="20.8125" class="st2"></rect>		<text x="15.59" y="582.2" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>QMP phy driver</text>		</g>	<g id="shape23-67" v:mid="23" v:groupcontext="shape" transform="translate(459.75,-186.198)">		<title>Sheet.23</title>		<desc>UCSI</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="49.5" cy="577.192" width="99" height="23.625"></v:textrect>		<rect x="0" y="565.379" width="99" height="23.625" class="st2"></rect>		<text x="38.18" y="580.79" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>UCSI</text>		</g>	<g id="shape24-70" v:mid="24" v:groupcontext="shape" transform="translate(459.75,-137.823)">		<title>Sheet.24</title>		<desc>PMIC GLINK</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="49.5" cy="577.192" width="99" height="23.625"></v:textrect>		<rect x="0" y="565.379" width="99" height="23.625" class="st2"></rect>		<text x="20.39" y="580.79" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>PMIC GLINK</text>		</g>	<g id="shape25-73" v:mid="25" v:groupcontext="shape" transform="translate(612.75,-52.323)">		<title>Sheet.25</title>		<desc>PM7325B</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="45" cy="575.504" width="90" height="27"></v:textrect>		<rect x="0" y="562.004" width="90" height="27" class="st2"></rect>		<text x="21.34" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>PM7325B</text>		</g>	<g id="shape26-76" v:mid="26" v:groupcontext="shape" transform="translate(612.75,-137.823)">		<title>Sheet.26</title>		<desc>aDSP core charger firmware</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="45" cy="553.004" width="90" height="72"></v:textrect>		<rect x="0" y="517.004" width="90" height="72" class="st2"></rect>		<text x="20.44" y="542.2" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>aDSP core<v:newlinechar></v:newlinechar><tspan x="26.44" dy="1.2em" class="st4">charger </tspan><tspan x="22.67" dy="1.2em" class="st4">firmware</tspan></text>		</g>	<g id="shape27-81" v:mid="27" v:groupcontext="shape" v:layermember="0" transform="translate(612.75,-142.549)">		<title>Dynamic connector</title>		<path d="M-4.74 581.92 L-5.1 581.92 L-54 581.92" class="st5"></path>	</g>	<g id="shape28-87" v:mid="28" v:groupcontext="shape" v:layermember="0" transform="translate(650.663,-137.823)">		<title>Dynamic connector.28</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 647.5" class="st5"></path>	</g>	<g id="shape29-92" v:mid="29" v:groupcontext="shape" v:layermember="0" transform="translate(502.163,-186.198)">		<title>Dynamic connector.29</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 613.75" class="st5"></path>	</g>	<g id="shape30-97" v:mid="30" v:groupcontext="shape" v:layermember="0" transform="translate(324.75,-183.611)">		<title>Dynamic connector.30</title>		<path d="M4.74 587.54 L5.1 587.54 L25.12 587.54 A2.3622 2.3622 0 1 1 29.84 587.54 L58.5 587.54 L58.5 576.29 L135 576.29" class="st5"></path>	</g>	<g id="shape31-102" v:mid="31" v:groupcontext="shape" v:layermember="0" transform="translate(335.811,-53.322)">		<title>Dynamic connector.31</title>		<desc>VBUS, CC, D+,D-</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="138.469" cy="581.918" width="61.93" height="17.6036"></v:textrect>		<path d="M4.74 581.92 L5.1 581.92 L276.94 581.92" class="st5"></path>		<rect v:rectcontext="textBkgnd" x="112.413" y="577.118" width="52.1136" height="9.59985" class="st7"></rect>		<text x="112.41" y="584.32" class="st8" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>VBUS, CC, D+,D-</text>		</g>	<g id="shape32-109" v:mid="32" v:groupcontext="shape" v:layermember="0" transform="translate(148.913,-96.7605)">		<title>Dynamic connector.32</title>		<desc>HS</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="7.08661" cy="603.137" width="40" height="17.6036"></v:textrect>		<path d="M7.09 593.74 L7.09 594.1 L7.09 617.27" class="st5"></path>		<rect v:rectcontext="textBkgnd" x="2.75669" y="598.338" width="8.65997" height="9.59985" class="st7"></rect>		<text x="2.76" y="605.54" class="st8" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>HS</text>		</g>	<g id="shape33-116" v:mid="33" v:groupcontext="shape" v:layermember="0" transform="translate(306.413,-96.7605)">		<title>Dynamic connector.33</title>		<desc>SS</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="7.08661" cy="603.137" width="40" height="17.6036"></v:textrect>		<path d="M7.09 593.74 L7.09 594.1 L7.09 617.27" class="st5"></path>		<rect v:rectcontext="textBkgnd" x="3.41092" y="598.338" width="7.3515" height="9.59985" class="st7"></rect>		<text x="3.41" y="605.54" class="st8" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>SS</text>		</g>	<g id="shape34-123" v:mid="34" v:groupcontext="shape" v:layermember="0" transform="translate(119.663,-117.573)">		<title>Dynamic connector.34</title>		<path d="M7.09 584.26 L7.09 583.9 L7.09 568.75" class="st5"></path>	</g>	<g id="shape35-128" v:mid="35" v:groupcontext="shape" v:layermember="0" transform="translate(335.663,-117.573)">		<title>Dynamic connector.44</title>		<path d="M7.09 584.26 L7.09 583.9 L7.09 568.75" class="st5"></path>	</g>	<g id="shape36-133" v:mid="36" v:groupcontext="shape" v:layermember="0" transform="translate(101.663,-220.823)">		<title>Dynamic connector.45</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 648.38" class="st5"></path>	</g>	<g id="shape37-138" v:mid="37" v:groupcontext="shape" v:layermember="0" transform="translate(345.142,-220.823)">		<title>Dynamic connector.37</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 648.38" class="st5"></path>	</g>	<g id="shape38-143" v:mid="38" v:groupcontext="shape" v:layermember="0" transform="translate(364.913,-412.323)">		<title>Dynamic connector.47</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 620.5" class="st5"></path>	</g>	<g id="shape39-148" v:mid="39" v:groupcontext="shape" v:layermember="0" transform="translate(168.038,-412.323)">		<title>Dynamic connector.49</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 620.5" class="st5"></path>	</g>	<g id="shape40-153" v:mid="40" v:groupcontext="shape" v:layermember="0" transform="translate(83.6634,-412.323)">		<title>Dynamic connector.50</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 620.5" class="st5"></path>	</g>	<g id="shape41-158" v:mid="41" v:groupcontext="shape" v:layermember="0" transform="translate(183.337,-220.823)">		<title>Dynamic connector.51</title>		<path d="M-7.09 593.74 L-7.09 594.1 L-7.09 612.38" class="st5"></path>	</g>	<g id="shape42-163" v:mid="42" v:groupcontext="shape" v:layermember="0" transform="translate(281.663,-220.823)">		<title>Dynamic connector.52</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 612.38" class="st5"></path>	</g>	<g id="shape43-168" v:mid="43" v:groupcontext="shape" v:layermember="0" transform="translate(227.663,-174.722)">		<title>Dynamic connector.53</title>		<path d="M7.09 593.92 L7.09 594.28 L7.09 602.28" class="st9"></path>	</g>	<g id="shape44-174" v:mid="44" v:groupcontext="shape" transform="translate(432.75,-412.323)">		<title>Sheet.44</title>		<desc>/sys/class/typec/port0/...</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="67.5" cy="575.504" width="135" height="27"></v:textrect>		<rect x="0" y="562.004" width="135" height="27" class="st2"></rect>		<text x="5.62" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>/sys/class/typec/port0/...</text>		</g>	<g id="shape45-177" v:mid="45" v:groupcontext="shape" transform="translate(459.75,-227.823)">		<title>Sheet.45</title>		<desc>Dual-role class driver</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="49.5" cy="571.004" width="99" height="36"></v:textrect>		<rect x="0" y="553.004" width="99" height="36" class="st2"></rect>		<text x="14.11" y="567.4" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Dual-role class <tspan x="35.09" dy="1.2em" class="st4">driver</tspan></text>		</g>	<g id="shape46-181" v:mid="46" v:groupcontext="shape" v:layermember="0" transform="translate(502.163,-412.323)">		<title>Dynamic connector.46</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 737.5" class="st5"></path>	</g>	<g id="shape47-186" v:mid="47" v:groupcontext="shape" transform="translate(18.75,-488.823)">		<title>Sheet.47</title>		<rect x="0" y="508.004" width="553.5" height="81" class="st2"></rect>	</g>	<g id="shape48-188" v:mid="48" v:groupcontext="shape" transform="translate(456.87,-515.823)">		<title>Sheet.48</title>		<desc>Type-C role swap</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="52.38" cy="575.504" width="104.76" height="27"></v:textrect>		<rect x="0" y="562.004" width="104.76" height="27" class="st2"></rect>		<text x="10.57" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Type-C role swap</text>		</g>	<g id="shape49-191" v:mid="49" v:groupcontext="shape" transform="translate(24.375,-493.323)">		<title>Sheet.49</title>		<rect x="0" y="517.004" width="142.875" height="72" class="st2"></rect>	</g>	<g id="shape50-193" v:mid="50" v:groupcontext="shape" transform="translate(27.75,-533.823)">		<title>Sheet.50</title>		<desc>diag-router</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="36" cy="575.504" width="72" height="27"></v:textrect>		<rect x="0" y="562.004" width="72" height="27" class="st2"></rect>		<text x="8.44" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>diag-router</text>		</g>	<g id="shape51-196" v:mid="51" v:groupcontext="shape" transform="translate(90.75,-524.823)">		<title>Sheet.51</title>		<desc>port-bridge</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="36" cy="575.504" width="72" height="27"></v:textrect>		<rect x="0" y="562.004" width="72" height="27" class="st2"></rect>		<text x="8.16" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>port-bridge</text>		</g>	<g id="shape52-199" v:mid="52" v:groupcontext="shape" transform="translate(50.25,-502.323)">		<title>Sheet.52</title>		<desc>adbd.service</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="36" cy="575.504" width="72" height="27"></v:textrect>		<rect x="0" y="562.004" width="72" height="27" class="st2"></rect>		<text x="5.12" y="579.1" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>adbd.service</text>		</g>	<g id="shape53-202" v:mid="53" v:groupcontext="shape" transform="translate(171.75,-502.323)">		<title>Sheet.53</title>		<desc>USB peripheral mode configuration</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="81" cy="575.504" width="162" height="27"></v:textrect>		<rect x="0" y="562.004" width="162" height="27" class="st2"></rect>		<text x="29.08" y="571.9" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>USB peripheral mode <tspan x="48.29" dy="1.2em" class="st4">configuration</tspan></text>		</g>	<g id="shape54-206" v:mid="54" v:groupcontext="shape" transform="translate(283.125,-533.823)">		<title>Sheet.54</title>		<desc>Runtime power management control</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="81" cy="575.504" width="162" height="27"></v:textrect>		<rect x="0" y="562.004" width="162" height="27" class="st2"></rect>		<text x="9.43" y="571.9" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Runtime power management <tspan x="63.5" dy="1.2em" class="st4">control</tspan></text>		</g>	<g id="shape55-210" v:mid="55" v:groupcontext="shape" v:layermember="0" transform="translate(369.413,-533.823)">		<title>Dynamic connector.68</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 683.5" class="st5"></path>	</g>	<g id="shape56-215" v:mid="56" v:groupcontext="shape" v:layermember="0" transform="translate(502.163,-515.823)">		<title>Dynamic connector.69</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 665.5" class="st5"></path>	</g>	<g id="shape57-220" v:mid="57" v:groupcontext="shape" v:layermember="0" transform="translate(235.538,-502.323)">		<title>Dynamic connector.70</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 652" class="st5"></path>	</g>	<g id="shape58-225" v:mid="58" v:groupcontext="shape" v:layermember="0" transform="translate(65.6634,-493.323)">		<title>Dynamic connector.72</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 625" class="st5"></path>	</g>	<g id="shape59-230" v:mid="59" v:groupcontext="shape" v:layermember="0" transform="translate(502.163,-227.823)">		<title>Dynamic connector.73</title>		<path d="M7.09 593.74 L7.09 594.1 L7.09 607" class="st5"></path>	</g>	<g id="shape60-235" v:mid="60" v:groupcontext="shape" transform="translate(452.01,-550.179)">		<title>Sheet.60</title>		<desc>User-space services</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="60.12" cy="579.004" width="120.24" height="20"></v:textrect>		<rect x="0" y="569.004" width="120.24" height="20" class="st11"></rect>		<text x="12.38" y="582.6" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>User-space services</text>		</g>	<g id="shape61-238" v:mid="61" v:groupcontext="shape" transform="translate(534.5,-454.756)">		<title>Sheet.61</title>		<desc>VFS</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="18.875" cy="579.004" width="37.75" height="20"></v:textrect>		<rect x="0" y="569.004" width="37.75" height="20" class="st11"></rect>		<text x="9.96" y="582.6" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>VFS</text>		</g>	<g id="shape62-241" v:mid="62" v:groupcontext="shape" transform="translate(500.25,-378.823)">		<title>Sheet.62</title>		<desc>Kernel-space</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="36" cy="579.004" width="72" height="20"></v:textrect>		<rect x="0" y="569.004" width="72" height="20" class="st11"></rect>		<text x="4.56" y="582.6" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Kernel-space</text>		</g>	<g id="shape63-244" v:mid="63" v:groupcontext="shape" transform="translate(173.171,-8.34646)">		<title>Sheet.63</title>		<desc>Type-C connector</desc>		<v:textblock v:margins="rect(4,4,4,4)" v:tabspace="42.5197"></v:textblock>		<v:textrect cx="60.12" cy="579.004" width="120.24" height="20"></v:textrect>		<rect x="0" y="569.004" width="120.24" height="20" class="st12"></rect>		<text x="17.16" y="582.6" class="st3" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Type-C connector</text>		</g>	<g id="group64-247" transform="translate(131.25,-34.8855)" v:mid="64" v:groupcontext="group">		<title>Sheet.64</title>		<g id="shape65-248" v:mid="65" v:groupcontext="shape">			<title>Sheet.65</title>			<path d="M0 572.2 A16.8048 16.8048 -180 0 0 16.8 589 L190.2 589 A16.8048 16.8048 -180 0 0 207 572.2 A16.8048 16.8048						 -180 0 0 190.2 555.4 L16.8 555.4 A16.8048 16.8048 -180 0 0 0 572.2 Z" class="st13"></path>		</g>		<g id="shape66-250" v:mid="66" v:groupcontext="shape" transform="translate(13.3672,-12.9852)">			<title>Sheet.66</title>			<path d="M0 588.24 a0.763855 0.763855 -180 0 0 0.763838 0.763838 L179.5 589 a0.763855 0.763855 -180 0 0 0.763838						 -0.763838 L180.27 582.13 a0.763855 0.763855 -180 0 0 -0.763838 -0.763838 L0.76 581.37 a0.763855 0.763855						 -180 0 0 -0.763838 0.763838 L0 588.24 Z" class="st14"></path>		</g>		<g id="shape67-252" v:mid="67" v:groupcontext="shape" transform="translate(14.322,-18.5231)">			<title>r.297</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape68-254" v:mid="68" v:groupcontext="shape" transform="translate(14.322,-11.6485)">			<title>Sheet.68</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape69-256" v:mid="69" v:groupcontext="shape" transform="translate(29.5987,-18.5231)">			<title>r</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape70-258" v:mid="70" v:groupcontext="shape" transform="translate(29.5987,-11.6485)">			<title>Sheet.70</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape71-260" v:mid="71" v:groupcontext="shape" transform="translate(44.8755,-18.5231)">			<title>r.307</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape72-262" v:mid="72" v:groupcontext="shape" transform="translate(44.8755,-11.6485)">			<title>Sheet.72</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape73-264" v:mid="73" v:groupcontext="shape" transform="translate(60.1522,-18.5231)">			<title>r.312</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape74-266" v:mid="74" v:groupcontext="shape" transform="translate(60.1522,-11.6485)">			<title>Sheet.74</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape75-268" v:mid="75" v:groupcontext="shape" transform="translate(75.429,-18.5231)">			<title>r.317</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape76-270" v:mid="76" v:groupcontext="shape" transform="translate(75.429,-11.6485)">			<title>Sheet.76</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape77-272" v:mid="77" v:groupcontext="shape" transform="translate(90.7057,-18.5231)">			<title>r.322</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape78-274" v:mid="78" v:groupcontext="shape" transform="translate(90.7057,-11.6485)">			<title>Sheet.78</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape79-276" v:mid="79" v:groupcontext="shape" transform="translate(105.982,-18.5231)">			<title>r.327</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape80-278" v:mid="80" v:groupcontext="shape" transform="translate(105.982,-11.6485)">			<title>Sheet.80</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape81-280" v:mid="81" v:groupcontext="shape" transform="translate(121.259,-18.5231)">			<title>r.332</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape82-282" v:mid="82" v:groupcontext="shape" transform="translate(121.259,-11.6485)">			<title>Sheet.82</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape83-284" v:mid="83" v:groupcontext="shape" transform="translate(136.536,-18.5231)">			<title>r.337</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape84-286" v:mid="84" v:groupcontext="shape" transform="translate(136.536,-11.6485)">			<title>Sheet.84</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape85-288" v:mid="85" v:groupcontext="shape" transform="translate(151.813,-18.5231)">			<title>r.342</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape86-290" v:mid="86" v:groupcontext="shape" transform="translate(151.813,-11.6485)">			<title>Sheet.86</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape87-292" v:mid="87" v:groupcontext="shape" transform="translate(167.089,-18.5231)">			<title>r.347</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape88-294" v:mid="88" v:groupcontext="shape" transform="translate(167.089,-11.6485)">			<title>Sheet.88</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape89-296" v:mid="89" v:groupcontext="shape" transform="translate(182.366,-18.5231)">			<title>r.352</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>		<g id="shape90-298" v:mid="90" v:groupcontext="shape" transform="translate(182.366,-11.6485)">			<title>Sheet.90</title>			<rect x="0" y="585.567" width="10.3118" height="3.43727" class="st15"></rect>		</g>	</g></g>
</svg>

The sandbox is implemented with the following Qualcomm-specific features.
- USB\_DWC3\_QCOM: The primary glue driver is responsible for the USB functionality
                    on both host and device modes, depending on what is connected. The device tree
                    entry for the glue driver consists of resources, such as clocks, power rails,
                    and interrupts. This feature uses the DWC3 core driver as a library, which
                    controls the actual functionality of the DWC3 controller. For more details,
                        see [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/dwc3/dwc3-qcom.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/dwc3/dwc3-qcom.c?h=v6.6.2).
- Synopsys femto PHY: Qualcomm Synopsys femto PHY is the high-speed USB PHY
                    responsible for controlling D+/D-
                    lines, and facilitates data transfers along with charger detection. For more
                    details, see [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/phy/qualcomm/phy-qcom-snps-femto-v2.c?h=v6.6.2).
- QMP DisplayPort combo PHY: Qualcomm multipurpose PHY (QMP) display port combo
                    PHY is designed for generic usage. A sample use case for USB would be the
                    SuperSpeed and SuperSpeed-plus functionality as part of which the
                        Rx+/Rx- and
                        Tx+/Tx- can be used for data
                    transfer. The PHY supports the display alternate mode when the display can claim
                    a pair of lanes for the mirroring functionality while USB works in SuperSpeed.
                    For more details, see [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/phy/qualcomm/phy-qcom-qmp-combo.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/phy/qualcomm/phy-qcom-qmp-combo.c?h=v6.6.2).

## USB interfaces

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

USB supports multiple interfaces to transfer audio, video, debug information, and
            tethering. Each of the following USB interface communication protocol is different and
            has its own protocols in addition to the standard USB protocol.
- Android debug bridge (ADB)
    - The USB ADB is a debug interface, providing access to the system through
                            the USB connection. For more details on ADB, see [https://developer.android.com/tools/adb](https://developer.android.com/tools/adb).
    - The filenames are the virtual `eps` names of the
                                `dev` node. For more details on
                                `f_fs.c`, see [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/gadget/function/f_fs.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/gadget/function/f_fs.c?h=v6.6.2).
    - User space service: The user space daemon `adbd.service`
                            operates ADB and is responsible for establishing the connection between
                            the underlying kernel driver and the host PC.
- Diagnostics (diag)
    - Diag is a diagnostics framework used for collecting log data from
                            various subsystems, and debugging. The diag data is transmitted over USB
                            to the host PC.
    - Kernel driver: Diag uses `f_fs.c` to expose the
                                `/dev/ffs-diag` node, which is operated by a user
                            space service for various operations. The `dev` node
                            contains three more files – `ep0` (control operations),
                                `ep1` (read operations), and `ep2`
                            (write operations). These filenames are the virtual `eps`
                            names of the `dev` node. For more details on
                                `f_fs.c`, see [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/gadget/function/f_fs.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/gadget/function/f_fs.c?h=v6.6.2).
- Mass storage
    - A generic interface driver with mass storage driver is available for the
                            device to act as a generic storage device.
    - Kernel driver: The `mass_storage` functionality is
                            regulated by the `f_mass_storage.c` driver. This driver
                            exposes `dev node[revisit]`, which is controlled by the
                            host PC. For more details on mass storage, see [https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/gadget/function/f_mass_storage.c?h=v6.6.2](https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/usb/gadget/function/f_mass_storage.c?h=v6.6.2).
- Remote network driver interface specification (RNDIS)
    - RNDIS is a specification developed by Microsoft for network devices on
                            dynamic plug and play I/O buses such as USB.
    - Kernel driver: It uses a `f_rndis` driver, which is
                            present in the upstream Linux kernel and directly communicates with the
                            network interfaces or stack.
- Network control model (NCM)
    - NCM is a protocol designed to offer advanced features and capabilities
                            compared to RNDIS.
    - It is commonly found in applications where USB devices must handle
                            demanding networking tasks.
- USB audio class 2 (UAC2)
    - UAC2 is a standard governing the communication between USB audio devices
                            and computers.
    - UAC2 supports higher audio data transfer rates, resulting in improved
                            audio quality and reduced latency.
- USB video class (UVC)
    - UVC is a standard that defines how video streaming devices, such as
                            webcams, should communicate with computers over USB.
    - UVC facilitates the plug-and-play functionality for video devices.

## USB software

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

The following USB features are supported in software.

Table : USB software features

| Feature | Description |
| --- | --- |
| Peripheral ADB | ADB functionality is integrated over functionFS (FFS) |
| Peripheral mass storage | Generic Mass\_storage functionality |
| Peripheral diag | Diag functionality is integrated over FFS |
| Peripheral RNDIS | Standard RNDIS protocol according to Linux kernel |
| Peripheral network control modem (NCM) | Standard NCM protocol according to Linux kernel |
| Host USB 3.0 driver (xHCI) | Both USB controllers support the xHCI architecture |
| Host high-speed USB | High-speed USB detection in host mode |
| Host HID/MS/hub driver | Class driver detection in host mode |
| Host video driver | UVC verified on limited webcam models |
| Host link power management | USB host mode LPM implementation |
| Peripheral USB link power management | USB device mode LPM implementation |
| DRD | Dual-role device support is possible (host/device mode<br>                                support) |
| USB Type-C | Supported by PM7325B; supports current charging, CC logic, and<br>                                SuperSpeed USB switch selection, all performed in the embedded<br>                                controller |
| USB Type-C display port | Supports SuperSpeed USB + DisplayPort operating concurrently (2<br>                                DisplayPort lanes) |
| USB PD 2.0/3.0 charging | PD support depends on the PM7325B solution used. Fully compliant<br>                                with PD 3.0 |
| USB 3.1 Gen1 | The USB controller supports USB 3.x Gen1 (5 Gbps). |

## USB tools

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

A few commonly used USB tools are listed in the following table.

Table : USB tool and download details

| USB tools | Download link |
| --- | --- |
| Platform tools (adb/fastboot) | [https://developer.android.com/tools/releases/platform-tools](https://developer.android.com/tools/releases/platform-tools) |
| USB video class (UVC) LibUVC | <ul class="ul" id="usb-tools__ul_rj4_ccl_j1c"><br>                                    <li class="li"><a href="https://github.com/libuvc/libuvc" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://github.com/libuvc/libuvc')">https://github.com/libuvc/libuvc</a></li><br><br>                                    <li class="li"><a href="https://libuvc.github.io/libuvc/" target="_blank" class="xref cursorpointer" onclick="Window.BookmapComponent.navigateExternalFile('https://libuvc.github.io/libuvc/')">https://libuvc.github.io/libuvc/</a></li><br><br>                                </ul> |
| UVC gadget | [https://github.com/wlhe/uvc-gadget](https://github.com/wlhe/uvc-gadget) |
| UVC streamer | [https://github.com/bsapundzhiev/uvc-streamer](https://github.com/bsapundzhiev/uvc-streamer) |
| UVC Video4Linux (v4l2-utils) | [https://linuxtv.org/downloads/v4l-dvb-apis/driver-api/v4l2-core.html](https://linuxtv.org/downloads/v4l-dvb-apis/driver-api/v4l2-core.html) |

## USB boot loader configuration

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

The device tree parameters for tuning the high-speed and SuperSpeed USB signal quality in
            the boot loader can be modified using the Qualcomm DeviceTree editor (QDTE) tool.

QDTE tool is used to configure the device tree binary blob by editing
                the xbl\_config.elf file, as shown in the following figure. For
            more information on how to configure the device tree blobs, see the  [QDTE](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-4/qdte-tools.html) section.

Figure : Device tree layout
            
            ![](data:image/png;base64,UklGRvocAABXRUJQVlA4TO4cAAAvSURFABq88v/JjSSnzH0kmmW2WWabey90jylTpkw+ikyaeoQ225S55oSsWxWB/P3+mchMkB0ER6xQ7tG7GVECNWhyqYjegdgNQLE1x6L3YO5BEIptS5KUkL0cZr4MmTJkz83MlyWRSGQsBfklS0iZEtmyD2omoEiSZNdp6CPNkeYY/nthQ0FBQcGGgoKCDQUXbhi9//SfFiTJYttmEStFhlBm7wFPAEweV/y8r9ogWbb+69VMf/tcfz1V+pun2gzRR1N9xMquKoRsXl+f1682P/Sinx/xEkLI1vXt9ePb88fX55dPP52/jE0P/eTP7y7Z1eXxMb/n6/Nx+HqMH1f8ujEIiyXKF/1AfS5QfjSNjCO7Gv9zyJcffz16jM/jfGdL96Ubxsss+k4yigHby+INYjKCWlTeWN6r8H9Q13PYxIiB5iPqus5MOdINUSvOTIAKz0EFsWAh1khoJqWxU0M2pFNeMJ3I7xw2pQ5UZyPcOYz3pzhKBc8EMnBfniXqOqwXxQCW9PnXZm+f03diZVdndtW/ftW/Pu//+/Xoz6O/U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85Qf2OPPTJkNCypo5fAbiF109cgbU04iCHmAilwkAgAYpy6wPiyEoRJZdqEhoeJQiZzwC2MKkCtA5e4pK3BDgFiD5LDe54CNYxyxT6X8JWcgXSxmgMWNRwl3ia4+/2pAEmSII2xaYnBJ4KGtX9gIVw6/iYg5ZznTlIckiIc8uB65YDsI49BFHDXAiIQlsuxCJqGacGVc8aMQcvmr3D1lBW4IEKtLDluGHLD901wRUv9V7l24G+uEIu/daGudOl+uX14m/vm9oJCkUQyB1QVhhIGH1iOoOby6+FmtzCy7+H/Ak5nJhc6OQxc6aYpjzYUJCdZEqIwL/pnFDcCE2mFyDlDeR5e7p6zAjQFiJeD2OPibA1bbxqU9ng7wt4aqXIxP7igqrMWhg6t5qHhtkAQZciO7fcBtXcsGScdpnFYXvzB1IPOiBEebyIYkiJfzCOsJLhAAYRy6wN+kQZCAGq+NXRcaEqyJsJ4TfmE9Cebx4ANAeR9d7p6y6GqoRwwQy8DcFtb3HLApddeGOWOtPAh5YI+1UPoxWVVX50s+y6shQAEDFGekawMiGw5EIuNhhfFrBVfqkY1IEK+/COuRi8R2AMahC6qPIAH1dLDpQk8i1ARLZJlfJwkmRR8ASvzoUveUvZdeN05LZTzrD6Gq7ynribQuq/mest5I63KDZNn6r63/ekVSAg==)

The following table lists the properties for tuning the HS-USB PHY and SS USB PHY signal
            quality.

Table : USB configuration properties

| Property name | Property description | Data type | Possible values and value range | Device behavior |
| --- | --- | --- | --- | --- |
| `path=/soc/usb0/hs_phy_cfg` | Tunes the USB signal quality for the primary USB controller HS-PHY. | UINT32-array | <ul class="ul" id="usb-configuration__ul_jml_bfl_l1c"><br>                                <li class="li">This property is an array of address, value pairs<br>                                        &lt;<code class="ph codeph">addr</code>, <code class="ph codeph">val</code>&gt;</li><br><br>                                <li class="li"><code class="ph codeph">addr</code> is 4&nbsp;bytes in length. It can have 1 of the<br>                                    4 values, range: <code class="ph codeph">[0x88E306C, 0x88E3070, 0x88E3074,<br>                                        0x88E3078]</code></li><br><br>                                <li class="li"><code class="ph codeph">val</code> is of 1&nbsp;byte in length, range:<br>                                        <code class="ph codeph">0x00</code> to <code class="ph codeph">0xFF</code></li><br><br>                            </ul> | Improved USB signal quality for the primary USB HS-PHY. |
| `path=/soc/usb0/ss_phy_cfg` | Improves signal quality for primary USB controller SS-PHY. | UINT32-array | <ul class="ul" id="usb-configuration__ul_lml_bfl_l1c"><br>                                <li class="li">This property is an array of address, value pairs<br>                                        &lt;<code class="ph codeph">addr</code>, <code class="ph codeph">val</code>&gt;</li><br><br>                                <li class="li"><code class="ph codeph">addr</code> is 4&nbsp;bytes in length. Range:<br>                                        <code class="ph codeph">[0x088E8000, 0x088EB000]</code></li><br><br>                                <li class="li"><code class="ph codeph">val</code> is of 1&nbsp;byte in length, range: <code class="ph codeph">0x00<br>                                    </code> to <code class="ph codeph">0xFF</code></li><br><br>                            </ul> | Improved signal quality for the primary USB SS-PHY. |
| `path=/soc/usb1/hs_phy_cfg` | Improves the USB signal quality for the secondary USB controller<br>                            HS-PHY. | UINT32-array | <ul class="ul" id="usb-configuration__ul_nml_bfl_l1c"><br>                                <li class="li">This property is an array of address, value pairs<br>                                        &lt;<code class="ph codeph">addr</code>, <code class="ph codeph">val</code>&gt;</li><br><br>                                <li class="li"><code class="ph codeph">addr</code> is 4&nbsp;bytes in length. It can have 1 of the<br>                                    4 values, range: <code class="ph codeph">[0x88E406C,0x88E4070, 0x88E4074,<br>                                        0x88E4078]</code></li><br><br>                                <li class="li"><code class="ph codeph">val</code> is of 1&nbsp;byte in length, range:<br>                                        <code class="ph codeph">0x00</code> to <code class="ph codeph">0xFF</code></li><br><br>                            </ul> | Improved signal quality for secondary USB HS-PHY. |
| `Path = /sw/usb_config/fastboot_core_num` | Select the USB core number for Fastboot<br>                            (primary=0/secondary=1) | UINT32 | 0 or 1 | The Fastboot device is enumerated at either USB core0 or<br>                            core1 according to the selected property. |

## USB camera configuration

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

The Qualcomm Linux devices provide driver support for USB web cameras that adhere to the
            USB video class (UVC) standard. The `uvcvideo` driver of the Linux kernel
            supports cameras. For more information on the `uvcvideo` driver,
                see [https://www.kernel.org/doc/html/v4.19/media/v4l-drivers/uvcvideo.html](https://www.kernel.org/doc/html/v4.19/media/v4l-drivers/uvcvideo.html).

The `uvcvideo` driver exposes these cameras as V4L2 video devices, which
            can be accessed through the character device nodes such as /dev/videoX.

In the user space, applications can manage USB cameras using the `v4l2src`
            GStreamer plug-in, which comes bundled with the Qualcomm Intelligent Multimedia SDK (IM
            SDK). Alternatively, programs such as Yavta (yet another V4L2 test application) directly
            interact with the V4L2 (Video4Linux2) interface to test and control camera devices.

The current release does not include the Yavta program by default. To obtain and
            cross-compile Yavta, do the following:
1. The cross-compilation environment can be established using any of the following
                        methods.
    - Method 1: To set up the cross-compilation environment, run the following
                            command.

            sudo apt install gcc-aarch64-linux-gnuCopy to clipboard
    - Method 2: To set up the cross-compilation environment, run the following
                                commands:
        1. Download the
                                    cross-compiler.

                wget https://releases.linaro.org/archive/14.07/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux.tar.xz
                Copy to clipboard
        2. Extract the
                                    cross-compiler.

                tar -xf gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux.tar.xzCopy to clipboard
        3. Set up the environment for cross-compilation by running the
                                    following
                                    command.

                export PATH=$PATH:`pwd`/gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux/binCopy to clipboard
2. Clone the Yavta repository and change the
                    directory.

        git clone https://github.com/fastr/yavta.git
        cd yavta
        Copy to clipboard
3. Cross-compile the
                    tool.

        make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-Copy to clipboard
4. To push Yavta to the Qualcomm Linux chip product, do the following:
    1. Open the SSH shell in permissive mode. For more information on how to
                            run SSH, see the [Use SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#use-ssh) section.
    2. Mount the file
                            system.

            mount -o remount,rw /Copy to clipboard
    3. Transfer files using SCP or similar tools. For more information on how
                            to run SSH, see the [Use SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#use-ssh) section.
        For
                                example, `scp yavta
                            root@10.92.162.185:/usr/bin`
    4. Assign permission to execute in
                            Yavta.

            chmod 0777 /usr/bin/yavtaCopy to clipboard

### Prerequisite: Obtain image format and size 

To configure the USB camera either through Yavta or GStreamer, the following steps
                are mandatory.
1. To know the enumeration details, plug in the USB camera and run the
                        following
                            command.

        lsusbCopy to clipboard

The
                            following output is
                            displayed.

        Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
        Bus 001 Device 002: ID 03f0:0959 HP, Inc w200
        Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
        Copy to clipboard
2. Identify the USB camera video node created as
                            /dev/videoX from the serial
                            console.

        ls /sys/bus/usb/devices/1-1/1-1:1.0/video4linux/Copy to clipboard

Note: The `1-1/1-1:1.0` value varies
                            according to the USB device connected.

The following output is
                            displayed.

        video4	video5Copy to clipboard
3. To view the supported output formats and sizes using Yavta, run the
                        following
                            command:

        yavta /dev/video4 --enum-formatsCopy to clipboard

The
                            following output is displayed.

        Device /dev/video4 opened: w200: w200 (usb-xhci-hcd.2.auto-1).
        - Available formats:Format 0: MJPG (47504a4d)Type: Video capture (1)Name: Motion-JPEGFrame size: 1280x720 (1/30, 1/25, 1/20, 1/15, 1/10, 1/5)Frame size: 800x600 (1/30)Frame size: 640x480 (1/30)Frame size: 320x240 (1/30)
        Format 1: YUYV (56595559)Type: Video capture (1)Name: YUYV 4:2:2Frame size: 1280x720 (1/10)Frame size: 800x600 (1/15)Frame size: 640x480 (1/30)Frame size: 320x240 (1/30)
        Copy to clipboard
4. Select the required image format and size from step 3.

### Configure USB camera using Yavta

**Prerequisite**: Ensure that Yavta is cross-compiled, and the output format, size
                are identified.

- To select MJPEG format of 1280x720 output size and 30 fps, capture 10 frames
                    under /tmp/ with filename
                        testmjpeg-00000\*.bin, run the following
                        command.

        yavta -f MJPEG -s 1280x720 -t 1/30 -c10 -F/tmp/testmjpeg /dev/video4Copy to clipboard

The
                        following output is
                        displayed.

        Device /dev/video4 opened: w200: w200 (usb-xhci-hcd.2.auto-1).
        Video format set: width: 1280 height: 720 buffer size: 1843789
        Video format: MJPG (47504a4d) 1280x720
        Current frame rate: 1/30
        Setting frame rate to: 1/30
        Frame rate set: 1/30
        8 buffers requested.
        length: 1843789 offset: 0
        Buffer 0 mapped at address 0x7fabd5d000.
        length: 1843789 offset: 1847296
        Buffer 1 mapped at address 0x7fabb9a000.
        length: 1843789 offset: 3694592
        Buffer 2 mapped at address 0x7fab9d7000.
        length: 1843789 offset: 5541888
        Buffer 3 mapped at address 0x7fab814000.
        length: 1843789 offset: 7389184
        Buffer 4 mapped at address 0x7fab651000.
        length: 1843789 offset: 9236480
        Buffer 5 mapped at address 0x7fab48e000.
        length: 1843789 offset: 11083776
        Buffer 6 mapped at address 0x7fab2cb000.
        length: 1843789 offset: 12931072
        Buffer 7 mapped at address 0x7fab108000.
        0 (0) [-] 0 57672 bytes 2459.697791 315967245.973463
        1 (1) [-] 1 40816 bytes 2459.730553 315967246.005839
        2 (2) [-] 2 40472 bytes 2459.763517 315967246.039485
        3 (3) [-] 3 41272 bytes 2459.797002 315967246.073073
        4 (4) [-] 4 42232 bytes 2459.830192 315967246.105592
        5 (5) [-] 5 46024 bytes 2459.863253 315967246.139142
        6 (6) [-] 6 47440 bytes 2459.896755 315967246.172384
        7 (7) [-] 7 48840 bytes 2459.930006 315967246.205114
        8 (0) [-] 8 50248 bytes 2459.963235 315967246.238308
        9 (1) [-] 9 53136 bytes 2459.996526 315967246.272690
        Captured 9 frames in 0.300183 seconds (29.981711 fps, 1559555.337911 B/s).
        8 buffers released.
        Copy to clipboard
- To select YUV format of 1280x960 output size, 30 fps, capture 10 frames under
                        /tmp/, the generated filename is
                        testyuv-00000\*.bin, run the following
                        command.

        yavta -f YUYV -s 1280x720 -t 1/30 -c10 -F/tmp/testyuv /dev/video4Copy to clipboard

The
                        following output is
                        displayed.

        Device /dev/video4 opened: w200: w200 (usb-xhci-hcd.2.auto-1).
        Video format set: width: 1280 height: 720 buffer size: 1843200
        Video format: YUYV (56595559) 1280x720
        Current frame rate: 1/10
        Setting frame rate to: 1/10
        Frame rate set: 1/10
        8 buffers requested.
        length: 1843200 offset: 0
        Buffer 0 mapped at address 0x7f9853e000.
        length: 1843200 offset: 1843200
        Buffer 1 mapped at address 0x7f9837c000.
        length: 1843200 offset: 3686400
        Buffer 2 mapped at address 0x7f981ba000.
        length: 1843200 offset: 5529600
        Buffer 3 mapped at address 0x7f97ff8000.
        length: 1843200 offset: 7372800
        Buffer 4 mapped at address 0x7f97e36000.
        length: 1843200 offset: 9216000
        Buffer 5 mapped at address 0x7f97c74000.
        length: 1843200 offset: 11059200
        Buffer 6 mapped at address 0x7f97ab2000.
        length: 1843200 offset: 12902400
        Buffer 7 mapped at address 0x7f978f0000.
        0 (3) [-] 3 1843200 bytes 2536.837027 315967323.172707
        1 (4) [-] 4 1843200 bytes 2536.937122 315967323.273059
        2 (6) [-] 6 1843200 bytes 2537.136830 315967323.472473
        3 (7) [-] 7 1843200 bytes 2537.237183 315967323.572533
        4 (2) [-] 17 1843200 bytes 2538.237266 315967324.571848
        5 (2) [-] 24 1843200 bytes 2538.936539 315967325.271919
        6 (3) [-] 25 1843200 bytes 2539.036550 315967325.372403
        Warning: bytes used 0 != image size 1843200
        7 (7) [E] 28 0 bytes 2539.336529 3159  325.609436
        Warning: bytes used 0 != image size 1843200
        8 (0) [E] 22 0 bytes 2538.737975 315967325.610149
        Warning: bytes used 0 != image size 1843200
        9 (1) [E] 23 0 bytes 2538.837814 315967325.610622
        Captured 9 frames in 2.438312 seconds (3.691078 fps, 5291529.549951 B/s).
        8 buffers released.
        Copy to clipboard

### Configure USB camera using GStreamer in Qualcomm IM SDK

Qualcomm IM SDK uses [GStreamer](https://gstreamer.freedesktop.org), an open-source multimedia framework to expose
                easy APIs and plugins in both the multimedia and machine learning domains. For
                information on installing the Qualcomm IM SDK, see the [Getting Started](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-51/install-sdk.html) section.

The Qualcomm IM SDK includes the `v4l2src` plug-in, which allows input
                from USB cameras with a selected format. The `waylandsink` plug-in is
                responsible for rendering the video output on a Wayland display.

**Prerequisite**: Ensure that Yavta is cross-compiled, and the output format and
                size are identified.

1. To set the environment variables for the Wayland display, run the following
                    command in the serial
                    console.

        export XDG_RUNTIME_DIR=/dev/socket/weston && export WAYLAND_DISPLAY=wayland-1Copy to clipboard
2. Use GStreamer commands to stream video from the camera to the UI. Ensure that
                    you set the appropriate device ID (`/dev/videoX`) and select the
                    correct format based on the USB camera detection.
    - For 720p, run the following
                            command:

            gst-launch-1.0 -e v4l2src io-mode=dmabuf-import device="/dev/video0" ! video/x-raw,format=YUY2,width=1280,height=720,framerate=10/1 ! waylandsink fullscreen=trueCopy to clipboard

The
                            following output is
                            displayed.

            Y2,width=1280,height=720,framerate=10/1 ! waylandsink fullscreen=true
            Setting pipeline to PAUSED ...
            I/Adreno-UNKNOWN (1985,1985): <ReadGpuID:357>: Reading chip ID through GSL
            GBM_INFO::msmgbm_mapper(262)::gbm mapper instantiated
            gbm_create_device(224): Info: backend name is: msm_drm
            Pipeline is live and does not need PREROLL ...
            Pipeline is PREROLLED ...
            Setting pipeline to PLAYING ...
            New clock: GstSystemClock
            gbm_create_device(224): Info: backend name is: msm_drm
            GBM_ERR::msmgbm_bo_create(870)::DRM_IOCTL_PRIME_FD_TO_HANDLE failed for data fd errono: 22 (Invalid argument) drm fd: 24 data fd: 26
             GBM_ERR::msmgbm_bo_create(923)::DRM_IOCTL_PRIME_FD_TO_HANDLE failed for metadata fd errono: 22 (Invalid argument) drm fd: 24 metadata fd: 27
            GBM_ERR::msmgbm_bo_create(870)::DRM_IOCTL_PRIME_FD_TO_HANDLE failed for data fd errono: 22 (Invalid argument) drm fd: 24 data fd: 29
            GBM_ERR::msmgbm_bo_create(923)::DRM_IOCTL_PRIME_FD_TO_HANDLE failed for metadata fd errono: 22 (Invalid argument) drm fd: 24 metadata fd: 30
            GBM_ERR::msmgbm_bo_create(870)::DRM_IOCTL_PRIME_FD_TO_HANDLE failed for data fd errono: 22 (Invalid argument) drm fd: 24 data fd: 32
            GBM_ERR::msmgbm_bo_create(923)::DRM_IOCTL_PRIME_FD_TO_HANDLE failed for metadata fd errono: 22 (Invalid argument) drm fd: 24 metadata fd: 33
            GBM_ERR::msmgbm_bo_create(870)::DRM_IOCTL_PRIME_FD_TO_HANDLE failed for data fd errono: 22 (Invalid argument) drm fd: 24 data fd: 35
            GBM_ERR::msmgbm_bo_create(923)::DRM_IOCTL_PRIME_FD_TO_HANDLE failed for metadata fd errono: 22 (Invalid argument) drm fd: 24 metadata fd: 36
            Redistribute latency...
            0:00:47.7 / 99:99:99.
            Copy to clipboard
    - For 1080p, run the following
                            command:

            gst-launch-1.0 -e v4l2src io-mode=dmabuf-import device="/dev/video0" ! video/x-raw,format=YUY2,width=1920,height=1080,framerate=5/1 ! waylandsink fullscreen=true.Copy to clipboard

## USB customization

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

This section describes the requirements for various configurations and customizations in
            the USB software.

### Example shell script for a USB composition with diag and ADB interfaces

    cd /sys/kernel/config/usb_gadget/adb
    echo on > /sys/bus/platform/devices/a600000.usb/power/control
    echo "" > UDC
    mkdir functions/ffs.diag
    echo "QCOM" > strings/0x409/manufacturer
    echo 0x05c6 > idVendor
    echo 0x901d > idProduct
    echo "Diag_ADB" > configs/c.1/strings/0x409/configuration
    
    if [ ! -d /dev/ffs-diag ]; then
    mkdir -p /dev/ffs-diag
    fi
    if [ ! -e /dev/ffs-diag/ep0 ]; then
    mount -o uid=2000,gid=2000 -t functionfs diag /dev/ffs-diag
    fi
    
    /usr/bin/diag-router &
    
    cd configs/c.1
    rm -r ffs.usb0
    ln -s ../../functions/ffs.diag f1
    ln -s ../../functions/ffs.usb0 f2
    cd ../../ udcname=`ls -1 /sys/class/udc | head -n 1`
    echo $udcname > UDC
    echo auto > /sys/bus/platform/devices/a600000.usb/power/control
    Copy to clipboard

### Change USB composition through QUSB service

`usb.service` starts the QUSB service at /usr/bin/qusb to provide users the flexibility to configure
                the USB gadgets. It completely removes the hassle of manually executing commands to
                initialize USB from `configfs`.

Example:

    qusb [bind] [unbind] [showpid] [help]
                         [setpid [-p] <PID>] [persist <PID>]
    Copy to clipboard

### Enable and configure UVC use case

The USB video device class (also USB video class or UVC) is a USB device class that
                describes devices capable of streaming video, such as webcams, digital camcorders,
                transcoders, analog video converters, and still-image cameras.

The latest revision of the USB video class specification is v1.5. The USB
                implementers forum describes both the basic protocol and the different payload
                formats in v1.5.

Note: QCS9075 does not support the UVC use case.

The tools and procedures to test the UVC are as follows:
- **UVC gadget** (device side): It is a sample application to test the
                            `f_uvc` functional driver. It opens the video node
                        created by `uvc_gadget` and sends MJPEG frames at a specified
                        frame rate. This application is cross-compiled for the DUT.
Note: Ensure that the packages and tools required for
                            cross-compiling a 64‑bit Arm® technology compiler are installed on the
                            host machine.

    1. The cross-compilation environment can be established using any of
                                the following methods.
        - Method 1: Run the following
                                        command.

                sudo apt install gcc-aarch64-linux-gnuCopy to clipboard
        - Method 2: To set up the cross-compilation environment, run
                                        the following commands:
            1. Download the
                                                cross-compiler.

                    wget https://releases.linaro.org/archive/14.07/components/toolchain/binaries/gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux.tar.xz
                    Copy to clipboard
            2. Extract the
                                                cross-compiler.

                    tar -xf gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux.tar.xzCopy to clipboard
            3. Set up the environment for cross-compilation by
                                                running the following
                                                command.

                    export PATH=$PATH:`pwd`/gcc-linaro-aarch64-linux-gnu-4.9-2014.07_linux/binCopy to clipboard
    2. To build the UVC gadget tool, do the following.
        1. Clone the `uvc-gadget`
                                        repository.

                git clone https://github.com/wlhe/uvc-gadget.git
                cd uvc-gadget
                Copy to clipboard
        2. Modify `Makefile` for a static
                                        build.

                git diff
                diff --git a/Makefile b/Makefile
                index ccf5a34..5be54cc 100644
                --- a/Makefile
                +++ b/Makefile
                @@ -2,7 +2,7 @@ CROSS_COMPILE   ?=
                 ARCH           ?= x86
                 KERNEL_DIR     ?= /usr/src/linux
                
                -CC             := $(CROSS_COMPILE)gcc
                +CC             := $(CROSS_COMPILE)gcc -static
                 KERNEL_INCLUDE := -I$(KERNEL_DIR)/include -I$(KERNEL_DIR)/arch/$(ARCH)/include
                 CFLAGS         := -W -Wall -g $(KERNEL_INCLUDE)
                 LDFLAGS                := -g
                Copy to clipboard
        3. Cross-compile for `arm64` to generate the
                                            `uvc‑gadget`
                                        executable.

                make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-Copy to clipboard
- **UVC viewer** (host side): To receive the UVC data, open any USB webcam
                        application on the computer.
    1. To validate, push the UVC gadget application and sample image files
                                to the device, do the following:
        1. Open the SSH shell in permissive mode. For more information
                                        on how to run SSH, see the [Use SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#use-ssh)
                                        section.
        2. Mount the file
                                        system.

                mount -o remount,rw /Copy to clipboard
        3. Transfer files using SCP or similar tools. For more
                                        information on how to run SSH, see the [Use SSH](https://docs.qualcomm.com/bundle/publicresource/topics/80-70015-254/how_to.html#use-ssh)
                                            section.
            For example, `scp uvc-gadget
                                                root@10.92.175.138:/usr/bin`
        4. Assign permission to
                                        execute.

                chmod 0777 /usr/bin/uvc-gadgetCopy to clipboard
    2. Change to any UVC composition (90DF or 90CB). For example,

            qusb setpid 90CBCopy to clipboard

USB is enumerated in UVC composition only when a user space video application is
                open. For the USB enumeration to occur, start the `uvc_gadget`application through a console (serial console or SSH shell).
- YUYV
    1. Push the `image-720.yuv` image file to
                                    `/data`.

            scp image-720.yuv root@10.92.175.138:/dataCopy to clipboard
    2. Verify the `image-720.yuv` image with the
                                    `uvc-gadget`
                                    tool.

            uvc-gadget -u /dev/video0 -i /data/image-720.yuv -s 2 -m 2 -n 32  -t 10 -f 0
            Copy to clipboard

Where `-f`is &lt;format&gt; with the
                                    following values:
        - `0` = V4L2\_PIX\_FMT\_YUYV
        - `1` = V4L2\_PIX\_FMT\_MJPEG
- MJPEG
    1. Push the `image-720.jpg` image file to
                                    `/data`.

            scp image-720.jpg root@10.92.175.138:/dataCopy to clipboard
    2. Verify the `image-720.jpg` image with the
                                    `uvc-gadget`
                                    tool.

            uvc-gadget -u /dev/video0 -i /data/image-720.jpg -s 2 -m 2 -n 32  -t 10 -f 1
            Copy to clipboard

Where `-f`is &lt;format&gt; with the
                                    following values:
        - `0` = V4L2\_PIX\_FMT\_YUYV
        - `1` = V4L2\_PIX\_FMT\_MJPEG
- For information on usage, run the following
                            command.

        ./uvc-gadget -hCopy to clipboard

    The
                            following output is
                        displayed.

        Usage: uvc-gadget [options]
        Available options are
        -b             Use bulk mode
        -d             Do not use any real V4L2 capture device
        -f <format>    Select frame format
                0 = V4L2_PIX_FMT_YUYV
                1 = V4L2_PIX_FMT_MJPEG
        -h             Print this help screen and exit
        -i image       MJPEG image
        -m             Streaming mult for ISOC (b/w 0 and 2)
        -n             Number of Video buffers (b/w 2 and 32)
        -o <IO method> Select UVC IO method:
                0 = MMAP
                1 = USER_PTR
        -r <resolution> Select frame resolution:
                0 = 360p, VGA (640x360)
                1 = 720p, WXGA (1280x720)
        -s <speed>     Select USB bus speed (b/w 0 and 2)
                0 = Full Speed (FS)
                1 = High Speed (HS)
                2 = Super Speed (SS)
        -t             Streaming burst (b/w 0 and 15)
        -u device      UVC Video Output device
        -v device      V4L2 Video Capture deviceCopy to clipboard

### UAC use cases

USB audio uses isochronous, interrupt, and control transfers. All audio data is
                transferred over isochronous transfers. The interrupt transfers are used to relay
                information regarding the availability of audio clocks and control transfers are
                used to set volume, request sample rates, and so on.

Note: QCS9075 does not support the UAC use case.

To verify, select a USB composition with a UAC
                function.

    qusb setpid 90CACopy to clipboard

To capture or play back, use `tinyutils` applications such as
                    `tinyplay/tinycap` available in the `rootfs`. The
                application opens the PCM nodes created in `/dev/snd/` when the UAC
                driver binds are successful.

The following are a few sample commands.
- List the sound card on the Linux host
                        machine.

        arecord -L 
        
        aplay -f S16_LE -r 44100 -c 2 -D front:CARD=qcs6490rb3gen2v,DEV=0 441k_16bit_5min_m1dB.wavCopy to clipboard
- Play back the audio file.
    - To play the audio from device to host, push the
                                    `file.wav`file with the matching audio
                                configuration. The following is an example of a sample
                                    configuration.
        - cat /sys/kernel/config/usb_gadget/adb/functions/uac2.0/p_chmaskCopy to clipboard

Output:

                3Copy to clipboard
        - cat /sys/kernel/config/usb_gadget/adb/functions/uac2.0/c_chmaskCopy to clipboard

Output:

                3Copy to clipboard
        - cat /sys/kernel/config/usb_gadget/adb/functions/uac2.0/p_srateCopy to clipboard

Output:

                48000Copy to clipboard
        - cat /sys/kernel/config/usb_gadget/adb/functions/uac2.0/c_srateCopy to clipboard

Output:

                64000Copy to clipboard
        - cat /sys/kernel/config/usb_gadget/adb/functions/uac2.0/p_ssizeCopy to clipboard

Output:

                2Copy to clipboard
        - cat /sys/kernel/config/usb_gadget/adb/functions/uac2.0/c_ssizeCopy to clipboard

Output:

                2Copy to clipboard

Note: To modify the audio configuration,
                                    adjust the preceding parameters before establishing the USB
                                    composition to 90CA.
    - Run the following command on the SSH shell or serial
                                    console.

            tinyplay
            Copy to clipboard

The following output is
                                    displayed.

            Usage: tinyplay file.wav [-D card] [-d device] [-p period_size] [-n n_periods]Copy to clipboard
    - Run the following command on a Linux host machine with an
                                application such as `arecord` to capture the
                                audio.

            arecord -f S16_LE -r 44100 -c 2 -D front:CARD=qcs6490rb3gen2v,DEV=0 test1.wavCopy to clipboard
- Record an audio file.
    - Run the following command on a Linux host machine with an
                                application such as `aplay` to play the
                                audio.

            aplay -f S16_LE -r 44100 -c 2 -D front:CARD=qcs6490rb3gen2v,DEV=0 441k_16bit_5min_m1dB.wavCopy to clipboard
    - Run the following command on the SSH shell of the device or the
                                serial console.

            tinycap
            Copy to clipboard

The following output is
                                    displayed.

            Usage: tinycap file.wav [-D card] [-d device] [-c channels] [-r rate] [-b bits] [-a 	bits_packed] [-p period_size] [-n n_periods] [-T capture time]Copy to clipboard

### Data role swapping in USB power delivery

Data role swap (DR\_SWAP) is the exchange of DFP (host) and UFP (device) roles between
                port partners over a USB Type-C connector. Power role swap (PR\_SWAP) exchanges the
                source and sink roles between the port partners.

Note: QCS9075 does not support data/power role swapping over
                Type-C connectors.

- Data role
    - To swap data roles from host to device, run the following
                                commands:

            cat /sys/class/typec/port0/data_role
            Copy to clipboard

The following output is displayed.

            [host] deviceCopy to clipboard

            echo device > /sys/class/typec/port0/data_role
            cat /sys/class/typec/port0/data_roleCopy to clipboard

The following
                                output is displayed.

            host [device]Copy to clipboard
    - To swap data roles from device to host, run the following
                                commands:

            cat /sys/class/typec/port0/data_role
            Copy to clipboard

The following output is
    displayed.

            host [device]Copy to clipboard

            echo host > /sys/class/typec/port0/data_role
            cat /sys/class/typec/port0/data_roleCopy to clipboard

The following
                                output is
                                displayed.

            [host] deviceCopy to clipboard
- Power role
    - To swap power roles from sink to source, run the following
                                commands:

            cat /sys/class/typec/port0/power_role
            Copy to clipboard

The following output is
    displayed.

            source [sink]Copy to clipboard

            echo source > /sys/class/typec/port0/power_role
            cat /sys/class/typec/port0/power_roleCopy to clipboard

The following
                                output is
                                displayed.

            [source] sinkCopy to clipboard
    - To swap power role from source to sink, run the following
                                commands:

            cat /sys/class/typec/port0/power_role
            Copy to clipboard

The following output is
    displayed.

            [source] sinkCopy to clipboard

            echo sink > /sys/class/typec/port0/power_role
            cat /sys/class/typec/port0/power_roleCopy to clipboard

The following output is displayed.

            source [sink]Copy to clipboard

### Customize with configfs

The `configfs` file system provides the converse of the
                    `sysfs` functionality. A number of interfaces can configure Linux
                USB gadgets, with each interface representing a USB function.

The `qusb` executable configures the USB gadget using
                    `configfs`using the following commands.
1. Create `configfs` and mount
                        `functionfs`.

        qusb initCopy to clipboard
2. Start `adbd/diag` services.
3. Bind `configfs` with the USB gadget
                        application.

        qusb bindCopy to clipboard
4. Stop or unbind the USB gadget
                        application.

        qusb unbindCopy to clipboard
5. Set diag and ADB
                        composition.

        qusb setpid 901DCopy to clipboard
6. List the available USB compositions.

        qusb showpidCopy to clipboard

The USB
                            compositions are as follows.
    - `A4A1 NCM`
    - `4EE7 ADB`
    - `900E DIAG`
    - `901C DIAG + UAC2`
    - `901D DIAG + ADB`
    - `9015 MASS_STORAGE + ADB`
    - `9024 RNDIS + ADB`
    - `902A RNDIS + MASS_STORAGE`
    - `902B RNDIS + ADB + MASS_STORAGE`
    - `902C RNDIS + DIAG`
    - `902D RNDIS + DIAG + ADB`
    - `902F RNDIS + DIAG + MASS_STORAGE`
    - `9060 DIAG + QDSS + ADB`
    - `908C NCM + ADB`
    - `90CA DIAG + UAC2 + ADB`
    - `90CB DIAG + UVC + ADB`
    - `90CC DIAG + UAC2 + UVC + ADB`
    - `90DF DIAG + UVC`
    - `90E0 DIAG + UAC2 + UVC`
    - `F000 MASS_STORAGE`
    - `F00E RNDIS`

## USB verification

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

The following table lists the various methods to verify the USB device and host
                modes.

| USB mode | Feature | Description |
| --- | --- | --- |
| USB device mode | ADB | By default, USB is enumerated in the ADB-only<br>                                composition. |
| USB device mode | Diag | See [Example shell script for a USB composition with diag and ADB interfaces](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html#usb-customization__section_y3t_dhl_j1c) and [Change USB composition through QUSB service](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html#usb-customization__section_nqf_ghl_j1c). |
| USB device mode | Mass storage | Change the USB composition (see [Change USB composition through QUSB service](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html#usb-customization__section_nqf_ghl_j1c)) and select the mass\_storage composition. |
| USB device mode | Composition switch | See [Example shell script for a USB composition with diag and ADB interfaces](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html#usb-customization__section_y3t_dhl_j1c) and [Change USB composition through QUSB service](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html#usb-customization__section_nqf_ghl_j1c). |
| USB device mode | USB LPM with cable connects and disconnects | Disconnect USB manually so that the `dwc3-qcom`<br>                                module changes to low-power mode. |
| USB device mode | Network control modem (NCM) | Change the USB composition ([Change USB composition through QUSB service](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html#usb-customization__section_nqf_ghl_j1c)) and select the NCM composition. |
| USB host mode | Host human interface device (HID) class | Switch to host mode by connecting the HID class device directly<br>                                to the device under test. |
| USB host mode | Host mass storage (MS) class | Switch to host mode by connecting the MS class device directly to<br>                                the device under test. |
| USB host mode | Host hub class | Switch to host mode by connecting the hub class device directly<br>                                to the device under test. |
| USB host mode | Host power management | Peripherals support the host-mode suspend (headsets) state when<br>                                the `dwc3-qcom` module changes to low-power mode in<br>                                host mode. |
| USB host mode | USB LPM with peripheral connect and disconnect | Peripherals support the host mode suspend (headsets) when the<br>                                    `dwc3-qcom` module changes to low-power mode in<br>                                host mode. |
| USB host mode | USB L1 LPM with high speed | High-speed peripherals support host mode suspend (headsets) when<br>                                the `dwc3-qcom` module changes to low-power mode in<br>                                host mode. |
| USB host mode | USB camera | See [USB camera configuration](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html#usb-camera-configuration). |
|  |  |  |
|  |  |  |
|  |  |  |
|  |  |  |
|  |  |  |
|  |  |  |

## USB debugging

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

This section provides information on the various methods to obtain debugging logs. The
            debugging methods include `regdumps`, debug `ftraces`,
                `configfs` nodes and so on. The logs provide visibility into the
            event and controller state details when debugging issues with low-power mode entry-exit,
            SMMU faults, unclocked accesses.

### USB tracing

The `debugfs` tracing provides a deeper view into each transaction
                over the USB line. To view the list of traces, run the following
                    command.

    ls /sys/kernel/debug/tracing/events/dwc3Copy to clipboard

Note: Ensure that `debugfs` is mounted. If not
                    mounted, run the following command to mount `debugfs`.

    mount -t debugfs none /sys/kernel/debugCopy to clipboard

Following are the traces available for verifying data transfers in the xHCI/gadget
                stack/USB Type-C connector system software interface
                (UCSI).

    dwc3_alloc_request  dwc3_event              dwc3_gadget_generic_cmd  enable
    dwc3_complete_trb   dwc3_free_request       dwc3_gadget_giveback     filter
    dwc3_ctrl_req       dwc3_gadget_ep_cmd      dwc3_prepare_trb
    dwc3_ep_dequeue     dwc3_gadget_ep_disable  dwc3_readl
    dwc3_ep_queue       dwc3_gadget_ep_enable   dwc3_writel
    Copy to clipboard

To list the traces in xHCI/host controller driver (HCD), run the following
                command.

    ls /sys/kernel/debug/tracing/events/xhci-hcdCopy to clipboard

Following are the traces available for verifying data transfers in the xHCI/HCD.

    enable                            xhci_handle_cmd_config_ep
    filter                            xhci_handle_cmd_disable_slot
      xhci_add_endpoint                 xhci_handle_cmd_reset_dev
      xhci_address_ctrl_ctx             xhci_handle_cmd_reset_ep
      xhci_address_ctx                  xhci_handle_cmd_set_deq
      xhci_alloc_dev                    xhci_handle_cmd_set_deq_ep
      xhci_alloc_virt_device            xhci_handle_cmd_stop_ep
      xhci_configure_endpoint           xhci_handle_command
      xhci_configure_endpoint_ctrl_ctx  xhci_handle_event
      xhci_dbc_alloc_request            xhci_handle_port_status
      xhci_dbc_free_request             xhci_handle_transfer
      xhci_dbc_gadget_ep_queue          xhci_hub_status_data
      xhci_dbc_giveback_request         xhci_inc_deq
      xhci_dbc_handle_event             xhci_inc_enq
      xhci_dbc_handle_transfer          xhci_queue_trb
      xhci_dbc_queue_request            xhci_ring_alloc
      xhci_dbg_address                  xhci_ring_ep_doorbell
      xhci_dbg_cancel_urb               xhci_ring_expansion
      xhci_dbg_context_change           xhci_ring_free
      xhci_dbg_init                     xhci_ring_host_doorbell
      xhci_dbg_quirks                   xhci_setup_addressable_virt_device
      xhci_dbg_reset_ep                 xhci_setup_device
      xhci_dbg_ring_expansion           xhci_setup_device_slot
      xhci_discover_or_reset_device     xhci_stop_device
      xhci_free_dev                     xhci_urb_dequeue
      xhci_free_virt_device             xhci_urb_enqueue
      xhci_get_port_status              xhci_urb_giveback
      xhci_handle_cmd_addr_dev
    Copy to clipboard

To list the available events of the USB video class (UVC) gadget driver, run the
                following
                command.

    ls /sys/kernel/debug/tracing/events/gadgetCopy to clipboard

The following output is
                displayed.

    enable                      usb_gadget_activate
      filter                      usb_gadget_clear_selfpowered
      usb_ep_alloc_request        usb_gadget_connect
      usb_ep_clear_halt           usb_gadget_deactivate
      usb_ep_dequeue              usb_gadget_disconnect
      usb_ep_disable              usb_gadget_frame_number
      usb_ep_enable               usb_gadget_giveback_request
      usb_ep_fifo_flush           usb_gadget_set_remote_wakeup
      usb_ep_fifo_status          usb_gadget_set_selfpowered
      usb_ep_free_request         usb_gadget_vbus_connect
      usb_ep_queue                usb_gadget_vbus_disconnect
      usb_ep_set_halt             usb_gadget_vbus_draw
      usb_ep_set_maxpacket_limit  usb_gadget_wakeup
      usb_ep_set_wedge
    Copy to clipboard

To list the available events in the UCSI driver, run the following command.

    ls /sys/kernel/debug/tracing/events/ucsiCopy to clipboard

The following output is
                displayed.

    enable  ucsi_connector_change  ucsi_register_port  ucsi_run_command
    filter  ucsi_register_altmode  ucsi_reset_ppm
    Copy to clipboard

### USB regdump

The USB
                    `debugfs`provides the following information.
- Mode of
                            operation.

        cat /sys/kernel/debug/usb/a600000.usb/mode
        Copy to clipboard

Sample
                            output:

        deviceCopy to clipboard
- State and transfer ring buffer (TRB) queues to all endpoints in device
                        mode.
- Current link
                            state.

        cat /sys/kernel/debug/usb/a600000.usb/link_stateCopy to clipboard

Sample
                            output. 

        SleepCopy to clipboard
- List processor (LSP)
                            dump.

        cat /sys/kernel/debug/usb/a600000.usb/lsp_dumpCopy to clipboard

Sample
                            output: 

        GDBGLSP[0] = 0x40000000
        GDBGLSP[1] = 0x00003a80
        GDBGLSP[2] = 0x38200000
        GDBGLSP[3] = 0x00802000
        GDBGLSP[4] = 0x126f1000
        GDBGLSP[5] = 0x3a800018
        GDBGLSP[6] = 0x00000a80
        GDBGLSP[7] = 0xfc03f14a
        GDBGLSP[8] = 0x0b803fff
        GDBGLSP[9] = 0x00000000
        GDBGLSP[10] = 0x000000f8
        GDBGLSP[11] = 0x000000f8
        GDBGLSP[12] = 0x000000f8
        GDBGLSP[13] = 0x000000f8
        GDBGLSP[14] = 0x000000f8
        GDBGLSP[15] = 0x000000f8Copy to clipboard

    ls /sys/kernel/debug/usb/a600000.usbCopy to clipboard

Sample
                output:

    ep0in    ep11out  ep14in   ep1out  ep4in   ep6out  ep9in       regdump
    ep0out   ep12in   ep14out  ep2in   ep4out  ep7in   ep9out      testmode
    ep10in   ep12out  ep15in   ep2out  ep5in   ep7out  link_state
    ep10out  ep13in   ep15out  ep3in   ep5out  ep8in   lsp_dump
    ep11in   ep13out  ep1in    ep3out  ep6in   ep8out  modeCopy to clipboard

The
                    `regdump`command provides the current state of the register
                space for the following registers:
- Device mode registers, such as DCTL, DSTS, and DCFG
- Global registers, such as GCTL and GSTS

    cd /sys/kernel/debug/usb/a600000.usb
    cat regdump
                    Copy to clipboard

Sample
            output:

    GSBUSCFG0 = 0x2222000e
    GSBUSCFG1 = 0x00001700
    GTXTHRCFG = 0x00000000
    GRXTHRCFG = 0x00000000
    GCTL = 0x00102000
    GEVTEN = 0x00000000
    GSTS = 0x7e800000
    GUCTL1 = 0x810c1802
    GSNPSID = 0x5533330a
    GGPIO = 0x00000000
    GUID = 0x00060500
    GUCTL = 0x0d00c010
    GBUSERRADDR0 = 0x00000000
    GBUSERRADDR1 = 0x00000000
    GPRTBIMAP0 = 0x00000000
    GPRTBIMAP1 = 0x00000000
    GHWPARAMS0 = 0x4020400a
    GDBGFIFOSPACE = 0x00420000
    GDBGLTSSM = 0x41090658
    GDBGBMU = 0x20300000
    GPRTBIMAP_HS0 = 0x00000000
    GPRTBIMAP_HS1 = 0x00000000
    GPRTBIMAP_FS0 = 0x00000000
    GPRTBIMAP_FS1 = 0x00000000
    GUCTL2 = 0x0198440d
    VER_NUMBER = 0x00000000
    VER_TYPE = 0x00000000
    GUSB2PHYCFG(0) = 0x00002400
    GUSB2I2CCTL(0) = 0x00000000
    GUSB2PHYACC(0) = 0x00000000
    GUSB3PIPECTL(0) = 0x030e0002
    GTXFIFOSIZ(0) = 0x00000042
    GRXFIFOSIZ(0) = 0x00000305
    GEVNTADRLO(0) = 0xfffff000
    GEVNTADRHI(0) = 0x0000000f
    GEVNTSIZ(0) = 0x00001000
    GEVNTCOUNT(0) = 0x00000000
    GHWPARAMS8 = 0x000007ea
    GUCTL3 = 0x00010000
    GFLADJ = 0x8c80c8a0
    DCFG = 0x00cc08b4
    DCTL = 0x8cf00a00
    DEVTEN = 0x00000257
    DSTS = 0x008a5200
    DGCMDPAR = 0x00000000
    DGCMD = 0x00000000
    DALEPENA = 0x0000000f
    DEPCMDPAR2(0) = 0x00000000
    DEPCMDPAR1(0) = 0xffffe000
    DEPCMDPAR0(0) = 0x0000000f
    DEPCMD(0) = 0x00000006
    OCFG = 0x00000000
    OCTL = 0x00000000
    OEVT = 0x00000000
    OEVTEN = 0x00000000
    OSTS = 0x00000000
    Copy to clipboard

### Host mode sysfs lookup

To view the bus details, run the following
                command.

    lsusb
    Copy to clipboard

Sample output:

    Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
    Bus 001 Device 002: ID 03f0:134a HP, Inc Optical Mouse
    Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
    Copy to clipboard

To list the contents of the current directory, run the following
                command.

    cd /sys/bus/usb/devices/
    lsCopy to clipboard

Sample output:

    1-0:1.0  1-1  1-1:1.0  2-0:1.0  usb1  usb2
    Copy to clipboard

To view details about the USB devices, run the following
                command.

    cat /sys/kernel/debug/usb/devices
    Copy to clipboard

Sample output:

    T:  Bus=01 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=480  MxCh= 1
    B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
    D:  Ver= 2.00 Cls=09(hub  ) Sub=00 Prot=01 MxPS=64 #Cfgs=  1
    P:  Vendor=1d6b ProdID=0002 Rev= 6.05
    S:  Manufacturer=Linux 6.5.0-rc4 xhci-hcd
    S:  Product=xHCI Host Controller
    S:  SerialNumber=xhci-hcd.0.auto
    C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
    E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms
    
    T:  Bus=01 Lev=01 Prnt=01 Port=00 Cnt=01 Dev#=  2 Spd=1.5  MxCh= 0
    D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS= 8 #Cfgs=  1
    P:  Vendor=03f0 ProdID=134a Rev= 1.00
    S:  Manufacturer=PixArt
    S:  Product=HP USB Optical Mouse
    C:* #Ifs= 1 Cfg#= 1 Atr=a0 MxPwr=100mA
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=03(HID  ) Sub=01 Prot=02 Driver=usbhid
    E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=10ms
    
    T:  Bus=02 Lev=00 Prnt=00 Port=00 Cnt=00 Dev#=  1 Spd=5000 MxCh= 1
    B:  Alloc=  0/800 us ( 0%), #Int=  0, #Iso=  0
    D:  Ver= 3.00 Cls=09(hub  ) Sub=00 Prot=03 MxPS= 9 #Cfgs=  1
    P:  Vendor=1d6b ProdID=0003 Rev= 6.05
    S:  Manufacturer=Linux 6.5.0-rc4 xhci-hcd
    S:  Product=xHCI Host Controller
    S:  SerialNumber=xhci-hcd.0.auto
    C:* #Ifs= 1 Cfg#= 1 Atr=e0 MxPwr=  0mA
    I:* If#= 0 Alt= 0 #EPs= 1 Cls=09(hub  ) Sub=00 Prot=00 Driver=hub
    E:  Ad=81(I) Atr=03(Int.) MxPS=   4 Ivl=256ms
    Copy to clipboard

## USB examples

Source: [https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html](https://docs.qualcomm.com/doc/80-70015-8/topic/usb.html)

For information on the upstream device tree reference, see [https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi](https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/sc7280.dtsi).

For information on the Qualcomm Linux chip product device-tree node, see [https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts](https://git.linaro.org/kernel-org/linux-next.git/tree/arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts).

For information on RPM changes in the USB driver and other examples, see [https://patchwork.kernel.org/project/linux-usb/list/?series=793939&archive=both](https://patchwork.kernel.org/project/linux-usb/list/?series=793939&amp;archive=both).

For information on how to flatten a device tree, see [https://lore.kernel.org/all/af60c05b-4a0f-51b8-486a-1fc601602515@quicinc.com/](https://lore.kernel.org/all/af60c05b-4a0f-51b8-486a-1fc601602515@quicinc.com/) and [https://lore.kernel.org/all/20231016-dwc3-refactor-v1-0-ab4a84165470@quicinc.com/](https://lore.kernel.org/all/20231016-dwc3-refactor-v1-0-ab4a84165470@quicinc.com/).

Last Published: Oct 15, 2024

[Previous Topic
PCIe](https://docs.qualcomm.com/bundle/publicresource/80-70015-8/topics/pcie.md) [Next Topic
CAN](https://docs.qualcomm.com/bundle/publicresource/80-70015-8/topics/can.md)