Fsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget!/translations/zh_CN/sound/soc/usbmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/zh_TW/sound/soc/usbmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/it_IT/sound/soc/usbmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/ja_JP/sound/soc/usbmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/ko_KR/sound/soc/usbmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hPortuguese (Brazilian)}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/pt_BR/sound/soc/usbmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget!/translations/sp_SP/sound/soc/usbmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hASoC USB supporth]hASoC USB support}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhh;/var/lib/git/docbuild/linux/Documentation/sound/soc/usb.rsthKubh)}(hhh](h)}(hOverviewh]hOverview}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh paragraph)}(hIn order to leverage the existing USB sound device support in ALSA, the ASoC USB APIs are introduced to allow the subsystems to exchange configuration information.h]hIn order to leverage the existing USB sound device support in ALSA, the ASoC USB APIs are introduced to allow the subsystems to exchange configuration information.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hXOne potential use case would be to support USB audio offloading, which is an implementation that allows for an alternate power-optimized path in the audio subsystem to handle the transfer of audio data over the USB bus. This would let the main processor to stay in lower power modes for longer duration. The following is an example design of how the ASoC and ALSA pieces can be connected together to achieve this:h]hXOne potential use case would be to support USB audio offloading, which is an implementation that allows for an alternate power-optimized path in the audio subsystem to handle the transfer of audio data over the USB bus. This would let the main processor to stay in lower power modes for longer duration. The following is an example design of how the ASoC and ALSA pieces can be connected together to achieve this:}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh literal_block)}(hX USB | ASoC | _________________________ | | ASoC Platform card | | |_________________________| | | | | ___V____ ____V____ | |ASoC BE | |ASoC FE | | |DAI LNK | |DAI LNK | | |________| |_________| | ^ ^ ^ | | |________| | ___V____ | | |SoC-USB | | ________ ________ | | | |USB SND |<--->|USBSND |<------------>|________| | |(card.c)| |offld |<---------- | |________| |________|___ | | | ^ ^ | | | ____________V_________ | | | | | |IPC | __ V_______________V_____ | | | |______________________| |USB SND (endpoint.c) | | | | ^ |_________________________| | | | | ^ | | | ___________V___________ | | | |->|audio DSP | ___________V_____________ | | |_______________________| |XHCI HCD |<- | |_________________________| |h]hX USB | ASoC | _________________________ | | ASoC Platform card | | |_________________________| | | | | ___V____ ____V____ | |ASoC BE | |ASoC FE | | |DAI LNK | |DAI LNK | | |________| |_________| | ^ ^ ^ | | |________| | ___V____ | | |SoC-USB | | ________ ________ | | | |USB SND |<--->|USBSND |<------------>|________| | |(card.c)| |offld |<---------- | |________| |________|___ | | | ^ ^ | | | ____________V_________ | | | | | |IPC | __ V_______________V_____ | | | |______________________| |USB SND (endpoint.c) | | | | ^ |_________________________| | | | | ^ | | | ___________V___________ | | | |->|audio DSP | ___________V_____________ | | |_______________________| |XHCI HCD |<- | |_________________________| |}hhsbah}(h]h ]h"]h$]h&] xml:spacepreserveuh1hhhhKhhhhubeh}(h]overviewah ]h"]overviewah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hSoC USB driverh]hSoC USB driver}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK2ubh)}(hhh](h)}(h Structuresh]h Structures}(hj(hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj%hhhhhK4ubh)}(h``struct snd_soc_usb``h]hliteral)}(hj8h]hstruct snd_soc_usb}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj6ubah}(h]h ]h"]h$]h&]uh1hhhhK5hj%hhubh block_quote)}(hX- ``list``: list head for SND SoC struct list - ``component``: reference to ASoC component - ``connection_status_cb``: callback to notify connection events - ``update_offload_route_info``: callback to fetch selected USB sound card/PCM device - ``priv_data``: driver data h]h bullet_list)}(hhh](h list_item)}(h+``list``: list head for SND SoC struct listh]h)}(hj^h](j;)}(h``list``h]hlist}(hjchhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj`ubh#: list head for SND SoC struct list}(hj`hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK7hj\ubah}(h]h ]h"]h$]h&]uh1jZhjWubj[)}(h*``component``: reference to ASoC componenth]h)}(hjh](j;)}(h ``component``h]h component}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh: reference to ASoC component}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK8hjubah}(h]h ]h"]h$]h&]uh1jZhjWubj[)}(h>``connection_status_cb``: callback to notify connection eventsh]h)}(hjh](j;)}(h``connection_status_cb``h]hconnection_status_cb}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh&: callback to notify connection events}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK9hjubah}(h]h ]h"]h$]h&]uh1jZhjWubj[)}(hS``update_offload_route_info``: callback to fetch selected USB sound card/PCM deviceh]h)}(hS``update_offload_route_info``: callback to fetch selected USB sound card/PCM deviceh](j;)}(h``update_offload_route_info``h]hupdate_offload_route_info}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh6: callback to fetch selected USB sound card/PCM device}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK:hjubah}(h]h ]h"]h$]h&]uh1jZhjWubj[)}(h``priv_data``: driver data h]h)}(h``priv_data``: driver datah](j;)}(h ``priv_data``h]h priv_data}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh : driver data}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKdev). This is created by the ASoC BE DAI link, and the USB sound entity will be able to pass information to the ASoC BE DAI link using this structure.h]hThe snd_soc_usb structure can be referenced using the ASoC platform card device, or a USB device (udev->dev). This is created by the ASoC BE DAI link, and the USB sound entity will be able to pass information to the ASoC BE DAI link using this structure.}(hj%hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK>hj%hhubh)}(h``struct snd_soc_usb_device``h]j;)}(hj5h]hstruct snd_soc_usb_device}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj3ubah}(h]h ]h"]h$]h&]uh1hhhhKChj%hhubjP)}(hX- ``card_idx``: sound card index associated with USB sound device - ``chip_idx``: USB sound chip array index - ``cpcm_idx``: capture pcm device indexes associated with the USB sound device - ``ppcm_idx``: playback pcm device indexes associated with the USB sound device - ``num_playback``: number of playback streams - ``num_capture``: number of capture streams - ``list``: list head for the USB sound device list h]jV)}(hhh](j[)}(h?``card_idx``: sound card index associated with USB sound deviceh]h)}(hjSh](j;)}(h ``card_idx``h]hcard_idx}(hjXhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjUubh3: sound card index associated with USB sound device}(hjUhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKEhjQubah}(h]h ]h"]h$]h&]uh1jZhjNubj[)}(h(``chip_idx``: USB sound chip array indexh]h)}(hjxh](j;)}(h ``chip_idx``h]hchip_idx}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjzubh: USB sound chip array index}(hjzhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKFhjvubah}(h]h ]h"]h$]h&]uh1jZhjNubj[)}(hM``cpcm_idx``: capture pcm device indexes associated with the USB sound deviceh]h)}(hjh](j;)}(h ``cpcm_idx``h]hcpcm_idx}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubhA: capture pcm device indexes associated with the USB sound device}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKGhjubah}(h]h ]h"]h$]h&]uh1jZhjNubj[)}(hN``ppcm_idx``: playback pcm device indexes associated with the USB sound deviceh]h)}(hjh](j;)}(h ``ppcm_idx``h]hppcm_idx}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubhB: playback pcm device indexes associated with the USB sound device}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKHhjubah}(h]h ]h"]h$]h&]uh1jZhjNubj[)}(h,``num_playback``: number of playback streamsh]h)}(hjh](j;)}(h``num_playback``h]h num_playback}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh: number of playback streams}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKIhjubah}(h]h ]h"]h$]h&]uh1jZhjNubj[)}(h*``num_capture``: number of capture streamsh]h)}(hj h](j;)}(h``num_capture``h]h num_capture}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh: number of capture streams}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKJhj ubah}(h]h ]h"]h$]h&]uh1jZhjNubj[)}(h2``list``: list head for the USB sound device list h]h)}(h1``list``: list head for the USB sound device listh](j;)}(h``list``h]hlist}(hj7hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj3ubh): list head for the USB sound device list}(hj3hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKKhj/ubah}(h]h ]h"]h$]h&]uh1jZhjNubeh}(h]h ]h"]h$]h&]jjuh1jUhhhKEhjJubah}(h]h ]h"]h$]h&]uh1jOhhhKEhj%hhubh)}(hThe struct snd_soc_usb_device is created by the USB sound offload driver. This will carry basic parameters/limitations that will be used to determine the possible offloading paths for this USB audio device.h]hThe struct snd_soc_usb_device is created by the USB sound offload driver. This will carry basic parameters/limitations that will be used to determine the possible offloading paths for this USB audio device.}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKMhj%hhubeh}(h] structuresah ]h"] structuresah$]h&]uh1hhjhhhhhK4ubh)}(hhh](h)}(h Functionsh]h Functions}(hjzhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjwhhhhhKRubh)}(htint snd_soc_usb_find_supported_format(int card_idx, struct snd_pcm_hw_params *params, int direction)h]htint snd_soc_usb_find_supported_format(int card_idx, struct snd_pcm_hw_params *params, int direction)}hjsbah}(h]h ]h"]h$]h&]j j forcelanguagersthighlight_args}uh1hhhhKShjwhhubhcomment)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKWubjP)}(h- ``card_idx``: the index into the USB sound chip array. - ``params``: Requested PCM parameters from the USB DPCM BE DAI link - ``direction``: capture or playback h]jV)}(hhh](j[)}(h6``card_idx``: the index into the USB sound chip array.h]h)}(hjh](j;)}(h ``card_idx``h]hcard_idx}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh*: the index into the USB sound chip array.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKYhjubah}(h]h ]h"]h$]h&]uh1jZhjubj[)}(hB``params``: Requested PCM parameters from the USB DPCM BE DAI linkh]h)}(hjh](j;)}(h ``params``h]hparams}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh8: Requested PCM parameters from the USB DPCM BE DAI link}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKZhjubah}(h]h ]h"]h$]h&]uh1jZhjubj[)}(h#``direction``: capture or playback h]h)}(h"``direction``: capture or playbackh](j;)}(h ``direction``h]h direction}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh: capture or playback}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK[hjubah}(h]h ]h"]h$]h&]uh1jZhjubeh}(h]h ]h"]h$]h&]jjuh1jUhhhKYhjubah}(h]h ]h"]h$]h&]uh1jOhhhKYhjwhhubh)}(h**snd_soc_usb_find_supported_format()** ensures that the requested audio profile being requested by the external DSP is supported by the USB device.h](hstrong)}(h'**snd_soc_usb_find_supported_format()**h]h#snd_soc_usb_find_supported_format()}(hj/hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj)ubhm ensures that the requested audio profile being requested by the external DSP is supported by the USB device.}(hj)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhK]hjwhhubh)}(h1Returns 0 on success, and -EOPNOTSUPP on failure.h]h1Returns 0 on success, and -EOPNOTSUPP on failure.}(hjGhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK`hjwhhubh)}(hOint snd_soc_usb_connect(struct device *usbdev, struct snd_soc_usb_device *sdev)h]hOint snd_soc_usb_connect(struct device *usbdev, struct snd_soc_usb_device *sdev)}hjUsbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhKbhjwhhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKeubjP)}(hX- ``usbdev``: the usb device that was discovered - ``sdev``: capabilities of the device h]jV)}(hhh](j[)}(h.``usbdev``: the usb device that was discoveredh]h)}(hjwh](j;)}(h ``usbdev``h]husbdev}(hj|hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjyubh$: the usb device that was discovered}(hjyhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKghjuubah}(h]h ]h"]h$]h&]uh1jZhjrubj[)}(h%``sdev``: capabilities of the device h]h)}(h$``sdev``: capabilities of the deviceh](j;)}(h``sdev``h]hsdev}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh: capabilities of the device}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhhjubah}(h]h ]h"]h$]h&]uh1jZhjrubeh}(h]h ]h"]h$]h&]jjuh1jUhhhKghjnubah}(h]h ]h"]h$]h&]uh1jOhhhKghjwhhubh)}(hX**snd_soc_usb_connect()** notifies the ASoC USB DCPM BE DAI link of a USB audio device detection. This can be utilized in the BE DAI driver to keep track of available USB audio devices. This is intended to be called by the USB offload driver residing in USB SND.h](j.)}(h**snd_soc_usb_connect()**h]hsnd_soc_usb_connect()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubh notifies the ASoC USB DCPM BE DAI link of a USB audio device detection. This can be utilized in the BE DAI driver to keep track of available USB audio devices. This is intended to be called by the USB offload driver residing in USB SND.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKjhjwhhubh)}(h5Returns 0 on success, negative error code on failure.h]h5Returns 0 on success, negative error code on failure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKohjwhhubh)}(hRint snd_soc_usb_disconnect(struct device *usbdev, struct snd_soc_usb_device *sdev)h]hRint snd_soc_usb_disconnect(struct device *usbdev, struct snd_soc_usb_device *sdev)}hjsbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhKqhjwhhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKtubjP)}(hO- ``usbdev``: the usb device that was removed - ``sdev``: capabilities to free h]jV)}(hhh](j[)}(h+``usbdev``: the usb device that was removedh]h)}(hjh](j;)}(h ``usbdev``h]husbdev}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh!: the usb device that was removed}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKvhjubah}(h]h ]h"]h$]h&]uh1jZhjubj[)}(h``sdev``: capabilities to free h]h)}(h``sdev``: capabilities to freeh](j;)}(h``sdev``h]hsdev}(hjChhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj?ubh: capabilities to free}(hj?hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKwhj;ubah}(h]h ]h"]h$]h&]uh1jZhjubeh}(h]h ]h"]h$]h&]jjuh1jUhhhKvhjubah}(h]h ]h"]h$]h&]uh1jOhhhKvhjwhhubh)}(h**snd_soc_usb_disconnect()** notifies the ASoC USB DCPM BE DAI link of a USB audio device removal. This is intended to be called by the USB offload driver that resides in USB SND.h](j.)}(h**snd_soc_usb_disconnect()**h]hsnd_soc_usb_disconnect()}(hjqhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjmubh notifies the ASoC USB DCPM BE DAI link of a USB audio device removal. This is intended to be called by the USB offload driver that resides in USB SND.}(hjmhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKyhjwhhubh)}(h7void *snd_soc_usb_find_priv_data(struct device *usbdev)h]h7void *snd_soc_usb_find_priv_data(struct device *usbdev)}hjsbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhK}hjwhhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKubjP)}(h?- ``usbdev``: the usb device to reference to find private data h]jV)}(hhh]j[)}(h=``usbdev``: the usb device to reference to find private data h]h)}(h<``usbdev``: the usb device to reference to find private datah](j;)}(h ``usbdev``h]husbdev}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh2: the usb device to reference to find private data}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jZhjubah}(h]h ]h"]h$]h&]jjuh1jUhhhKhjubah}(h]h ]h"]h$]h&]uh1jOhhhKhjwhhubh)}(hV**snd_soc_usb_find_priv_data()** fetches the private data saved to the SoC USB device.h](j.)}(h **snd_soc_usb_find_priv_data()**h]hsnd_soc_usb_find_priv_data()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubh6 fetches the private data saved to the SoC USB device.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(h9Returns pointer to priv_data on success, NULL on failure.h]h9Returns pointer to priv_data on success, NULL on failure.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(hint snd_soc_usb_setup_offload_jack(struct snd_soc_component *component, struct snd_soc_jack *jack)h]hint snd_soc_usb_setup_offload_jack(struct snd_soc_component *component, struct snd_soc_jack *jack)}hjsbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhKhjwhhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKubjP)}(hW- ``component``: ASoC component to add the jack - ``jack``: jack component to populate h]jV)}(hhh](j[)}(h-``component``: ASoC component to add the jackh]h)}(hj'h](j;)}(h ``component``h]h component}(hj,hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj)ubh : ASoC component to add the jack}(hj)hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj%ubah}(h]h ]h"]h$]h&]uh1jZhj"ubj[)}(h%``jack``: jack component to populate h]h)}(h$``jack``: jack component to populateh](j;)}(h``jack``h]hjack}(hjRhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjNubh: jack component to populate}(hjNhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjJubah}(h]h ]h"]h$]h&]uh1jZhj"ubeh}(h]h ]h"]h$]h&]jjuh1jUhhhKhjubah}(h]h ]h"]h$]h&]uh1jOhhhKhjwhhubh)}(hX**snd_soc_usb_setup_offload_jack()** is a helper to add a sound jack control to the platform sound card. This will allow for consistent naming to be used on designs that support USB audio offloading. Additionally, this will enable the jack to notify of changes.h](j.)}(h$**snd_soc_usb_setup_offload_jack()**h]h snd_soc_usb_setup_offload_jack()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj|ubh is a helper to add a sound jack control to the platform sound card. This will allow for consistent naming to be used on designs that support USB audio offloading. Additionally, this will enable the jack to notify of changes.}(hj|hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(h)Returns 0 on success, negative otherwise.h]h)Returns 0 on success, negative otherwise.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(hint snd_soc_usb_update_offload_route(struct device *dev, int card, int pcm, int direction, enum snd_soc_usb_kctl path, long *route)h]hint snd_soc_usb_update_offload_route(struct device *dev, int card, int pcm, int direction, enum snd_soc_usb_kctl path, long *route)}hjsbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhKhjwhhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKubjP)}(hX- ``dev``: USB device to look up offload path mapping - ``card``: USB sound card index - ``pcm``: USB sound PCM device index - ``direction``: direction to fetch offload routing information - ``path``: kcontrol selector - pcm device or card index - ``route``: mapping of sound card and pcm indexes for the offload path. This is an array of two integers that will carry the card and pcm device indexes in that specific order. This can be used as the array for the kcontrol output. h]jV)}(hhh](j[)}(h3``dev``: USB device to look up offload path mappingh]h)}(hjh](j;)}(h``dev``h]hdev}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh,: USB device to look up offload path mapping}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jZhjubj[)}(h``card``: USB sound card indexh]h)}(hjh](j;)}(h``card``h]hcard}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh: USB sound card index}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jZhjubj[)}(h#``pcm``: USB sound PCM device indexh]h)}(hjh](j;)}(h``pcm``h]hpcm}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh: USB sound PCM device index}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jZhjubj[)}(h=``direction``: direction to fetch offload routing informationh]h)}(hj7h](j;)}(h ``direction``h]h direction}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj9ubh0: direction to fetch offload routing information}(hj9hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj5ubah}(h]h ]h"]h$]h&]uh1jZhjubj[)}(h6``path``: kcontrol selector - pcm device or card indexh]h)}(hj\h](j;)}(h``path``h]hpath}(hjahhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj^ubh.: kcontrol selector - pcm device or card index}(hj^hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjZubah}(h]h ]h"]h$]h&]uh1jZhjubj[)}(hX ``route``: mapping of sound card and pcm indexes for the offload path. This is an array of two integers that will carry the card and pcm device indexes in that specific order. This can be used as the array for the kcontrol output. h]hdefinition_list)}(hhh]hdefinition_list_item)}(h``route``: mapping of sound card and pcm indexes for the offload path. This is an array of two integers that will carry the card and pcm device indexes in that specific order. This can be used as the array for the kcontrol output. h](hterm)}(hO``route``: mapping of sound card and pcm indexes for the offload path. This ish](j;)}(h ``route``h]hroute}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubhF: mapping of sound card and pcm indexes for the offload path. This is}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1jhhhKhjubh definition)}(hhh]h)}(han array of two integers that will carry the card and pcm device indexes in that specific order. This can be used as the array for the kcontrol output.h]han array of two integers that will carry the card and pcm device indexes in that specific order. This can be used as the array for the kcontrol output.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhhhKhjubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jZhjubeh}(h]h ]h"]h$]h&]jjuh1jUhhhKhjubah}(h]h ]h"]h$]h&]uh1jOhhhKhjwhhubh)}(hX-**snd_soc_usb_update_offload_route()** calls a registered callback to the USB BE DAI link to fetch the information about the mapped ASoC devices for executing USB audio offload for the device. ``route`` may be a pointer to a kcontrol value output array, which carries values when the kcontrol is read.h](j.)}(h&**snd_soc_usb_update_offload_route()**h]h"snd_soc_usb_update_offload_route()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubh calls a registered callback to the USB BE DAI link to fetch the information about the mapped ASoC devices for executing USB audio offload for the device. }(hjhhhNhNubj;)}(h ``route``h]hroute}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubhc may be a pointer to a kcontrol value output array, which carries values when the kcontrol is read.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(h)Returns 0 on success, negative otherwise.h]h)Returns 0 on success, negative otherwise.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(hostruct snd_soc_usb *snd_soc_usb_allocate_port(struct snd_soc_component *component, void *data);h]hostruct snd_soc_usb *snd_soc_usb_allocate_port(struct snd_soc_component *component, void *data);}hjsbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhKhjwhhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKubjP)}(hE- ``component``: DPCM BE DAI link component - ``data``: private data h]jV)}(hhh](j[)}(h)``component``: DPCM BE DAI link componenth]h)}(hjAh](j;)}(h ``component``h]h component}(hjFhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjCubh: DPCM BE DAI link component}(hjChhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj?ubah}(h]h ]h"]h$]h&]uh1jZhj<ubj[)}(h``data``: private data h]h)}(h``data``: private datah](j;)}(h``data``h]hdata}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjhubh: private data}(hjhhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjdubah}(h]h ]h"]h$]h&]uh1jZhj<ubeh}(h]h ]h"]h$]h&]jjuh1jUhhhKhj8ubah}(h]h ]h"]h$]h&]uh1jOhhhKhjwhhubh)}(h**snd_soc_usb_allocate_port()** allocates a SoC USB device and populates standard parameters that is used for further operations.h](j.)}(h**snd_soc_usb_allocate_port()**h]hsnd_soc_usb_allocate_port()}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubhb allocates a SoC USB device and populates standard parameters that is used for further operations.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(hBReturns a pointer to struct soc_usb on success, negative on error.h]hBReturns a pointer to struct soc_usb on success, negative on error.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(h4void snd_soc_usb_free_port(struct snd_soc_usb *usb);h]h4void snd_soc_usb_free_port(struct snd_soc_usb *usb);}hjsbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhKhjwhhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKubjP)}(h"- ``usb``: SoC USB device to free h]jV)}(hhh]j[)}(h ``usb``: SoC USB device to free h]h)}(h``usb``: SoC USB device to freeh](j;)}(h``usb``h]husb}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh: SoC USB device to free}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjubah}(h]h ]h"]h$]h&]uh1jZhjubah}(h]h ]h"]h$]h&]jjuh1jUhhhKhjubah}(h]h ]h"]h$]h&]uh1jOhhhKhjwhhubh)}(h3**snd_soc_usb_free_port()** frees a SoC USB device.h](j.)}(h**snd_soc_usb_free_port()**h]hsnd_soc_usb_free_port()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubh frees a SoC USB device.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(h3void snd_soc_usb_add_port(struct snd_soc_usb *usb);h]h3void snd_soc_usb_add_port(struct snd_soc_usb *usb);}hj. sbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhKhjwhhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKubjP)}(h!- ``usb``: SoC USB device to add h]jV)}(hhh]j[)}(h``usb``: SoC USB device to add h]h)}(h``usb``: SoC USB device to addh](j;)}(h``usb``h]husb}(hjV hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjR ubh: SoC USB device to add}(hjR hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjN ubah}(h]h ]h"]h$]h&]uh1jZhjK ubah}(h]h ]h"]h$]h&]jjuh1jUhhhKhjG ubah}(h]h ]h"]h$]h&]uh1jOhhhKhjwhhubh)}(h**snd_soc_usb_add_port()** add an allocated SoC USB device to the SOC USB framework. Once added, this device can be referenced by further operations.h](j.)}(h**snd_soc_usb_add_port()**h]hsnd_soc_usb_add_port()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubh{ add an allocated SoC USB device to the SOC USB framework. Once added, this device can be referenced by further operations.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubh)}(h6void snd_soc_usb_remove_port(struct snd_soc_usb *usb);h]h6void snd_soc_usb_remove_port(struct snd_soc_usb *usb);}hj sbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhKhjwhhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhjwhhhhhKubjP)}(h$- ``usb``: SoC USB device to remove h]jV)}(hhh]j[)}(h"``usb``: SoC USB device to remove h]h)}(h!``usb``: SoC USB device to removeh](j;)}(h``usb``h]husb}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj ubh: SoC USB device to remove}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhj ubah}(h]h ]h"]h$]h&]uh1jZhj ubah}(h]h ]h"]h$]h&]jjuh1jUhhhKhj ubah}(h]h ]h"]h$]h&]uh1jOhhhKhjwhhubh)}(h**snd_soc_usb_remove_port()** removes a SoC USB device from the SoC USB framework. After removing a device, any SOC USB operations would not be able to reference the device removed.h](j.)}(h**snd_soc_usb_remove_port()**h]hsnd_soc_usb_remove_port()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubh removes a SoC USB device from the SoC USB framework. After removing a device, any SOC USB operations would not be able to reference the device removed.}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhKhjwhhubeh}(h] functionsah ]h"] functionsah$]h&]uh1hhjhhhhhKRubh)}(hhh](h)}(hHow to Register to SoC USBh]hHow to Register to SoC USB}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhKubh)}(hThe ASoC DPCM USB BE DAI link is the entity responsible for allocating and registering the SoC USB device on the component bind. Likewise, it will also be responsible for freeing the allocated resources. An example can be shown below:h]hThe ASoC DPCM USB BE DAI link is the entity responsible for allocating and registering the SoC USB device on the component bind. Likewise, it will also be responsible for freeing the allocated resources. An example can be shown below:}(hj# hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhj hhubh)}(hXNstatic int q6usb_component_probe(struct snd_soc_component *component) { ... data->usb = snd_soc_usb_allocate_port(component, 1, &data->priv); if (!data->usb) return -ENOMEM; usb->connection_status_cb = q6usb_alsa_connection_cb; ret = snd_soc_usb_add_port(usb); if (ret < 0) { dev_err(component->dev, "failed to add usb port\n"); goto free_usb; } ... } static void q6usb_component_remove(struct snd_soc_component *component) { ... snd_soc_usb_remove_port(data->usb); snd_soc_usb_free_port(data->usb); } static const struct snd_soc_component_driver q6usb_dai_component = { .probe = q6usb_component_probe, .remove = q6usb_component_remove, .name = "q6usb-dai-component", ... };h]hXNstatic int q6usb_component_probe(struct snd_soc_component *component) { ... data->usb = snd_soc_usb_allocate_port(component, 1, &data->priv); if (!data->usb) return -ENOMEM; usb->connection_status_cb = q6usb_alsa_connection_cb; ret = snd_soc_usb_add_port(usb); if (ret < 0) { dev_err(component->dev, "failed to add usb port\n"); goto free_usb; } ... } static void q6usb_component_remove(struct snd_soc_component *component) { ... snd_soc_usb_remove_port(data->usb); snd_soc_usb_free_port(data->usb); } static const struct snd_soc_component_driver q6usb_dai_component = { .probe = q6usb_component_probe, .remove = q6usb_component_remove, .name = "q6usb-dai-component", ... };}hj1 sbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhKhj hhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhj hhhhhMubh)}(hBE DAI links can pass along vendor specific information as part of the call to allocate the SoC USB device. This will allow any BE DAI link parameters or settings to be accessed by the USB offload driver that resides in USB SND.h]hBE DAI links can pass along vendor specific information as part of the call to allocate the SoC USB device. This will allow any BE DAI link parameters or settings to be accessed by the USB offload driver that resides in USB SND.}(hjJ hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj hhubeh}(h]how-to-register-to-soc-usbah ]h"]how to register to soc usbah$]h&]uh1hhjhhhhhKubh)}(hhh](h)}(h USB Audio Device Connection Flowh]h USB Audio Device Connection Flow}(hjc hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj` hhhhhM ubh)}(hX&USB devices can be hotplugged into the USB ports at any point in time. The BE DAI link should be aware of the current state of the physical USB port, i.e. if there are any USB devices with audio interface(s) connected. connection_status_cb() can be used to notify the BE DAI link of any change.h]hX&USB devices can be hotplugged into the USB ports at any point in time. The BE DAI link should be aware of the current state of the physical USB port, i.e. if there are any USB devices with audio interface(s) connected. connection_status_cb() can be used to notify the BE DAI link of any change.}(hjq hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM hj` hhubh)}(hThis is called whenever there is a USB SND interface bind or remove event, using snd_soc_usb_connect() or snd_soc_usb_disconnect():h]hThis is called whenever there is a USB SND interface bind or remove event, using snd_soc_usb_connect() or snd_soc_usb_disconnect():}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj` hhubh)}(hXLstatic void qc_usb_audio_offload_probe(struct snd_usb_audio *chip) { ... snd_soc_usb_connect(usb_get_usb_backend(udev), sdev); ... } static void qc_usb_audio_offload_disconnect(struct snd_usb_audio *chip) { ... snd_soc_usb_disconnect(usb_get_usb_backend(chip->dev), dev->sdev); ... }h]hXLstatic void qc_usb_audio_offload_probe(struct snd_usb_audio *chip) { ... snd_soc_usb_connect(usb_get_usb_backend(udev), sdev); ... } static void qc_usb_audio_offload_disconnect(struct snd_usb_audio *chip) { ... snd_soc_usb_disconnect(usb_get_usb_backend(chip->dev), dev->sdev); ... }}hj sbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhMhj` hhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhj` hhhhhM$ubh)}(hIn order to account for conditions where driver or device existence is not guaranteed, USB SND exposes snd_usb_rediscover_devices() to resend the connect events for any identified USB audio interfaces. Consider the the following situation:h]hIn order to account for conditions where driver or device existence is not guaranteed, USB SND exposes snd_usb_rediscover_devices() to resend the connect events for any identified USB audio interfaces. Consider the the following situation:}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhM&hj` hhubjP)}(hXf**usb_audio_probe()** | --> USB audio streams allocated and saved to usb_chip[] | --> Propagate connect event to USB offload driver in USB SND | --> **snd_soc_usb_connect()** exits as USB BE DAI link is not ready BE DAI link component probe | --> DAI link is probed and SoC USB port is allocated | --> The USB audio device connect event is missed h]j)}(hhh](j)}(h**usb_audio_probe()** | --> USB audio streams allocated and saved to usb_chip[] | --> Propagate connect event to USB offload driver in USB SND | --> **snd_soc_usb_connect()** exits as USB BE DAI link is not ready h](j)}(h**usb_audio_probe()**h]j.)}(hj h]husb_audio_probe()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubah}(h]h ]h"]h$]h&]uh1jhhhM.hj ubj)}(hhh]h line_block)}(hhh](hh)}(h7--> USB audio streams allocated and saved to usb_chip[]h]h7--> USB audio streams allocated and saved to usb_chip[]}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hindentKhj hhhKubj )}(h<--> Propagate connect event to USB offload driver in USB SNDh]h<--> Propagate connect event to USB offload driver in USB SND}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hj Khj hhhKubj )}(hC--> **snd_soc_usb_connect()** exits as USB BE DAI link is not readyh](h--> }(hj hhhNhNubj.)}(h**snd_soc_usb_connect()**h]hsnd_soc_usb_connect()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubh& exits as USB BE DAI link is not ready}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hj Khj hhhKubeh}(h]h ]h"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhM.hj ubj)}(hBE DAI link component probe | --> DAI link is probed and SoC USB port is allocated | --> The USB audio device connect event is missed h](j)}(hBE DAI link component probeh]hBE DAI link component probe}(hj2 hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhM2hj. ubj)}(hhh]j )}(hhh](j )}(h4--> DAI link is probed and SoC USB port is allocatedh]h4--> DAI link is probed and SoC USB port is allocated}(hjF hhhNhNubah}(h]h ]h"]h$]h&]uh1hj KhjC hhhKubj )}(h0--> The USB audio device connect event is missedh]h0--> The USB audio device connect event is missed}(hjT hhhNhNubah}(h]h ]h"]h$]h&]uh1hj KhjC hhhKubeh}(h]h ]h"]h$]h&]uh1j hj@ ubah}(h]h ]h"]h$]h&]uh1jhj. ubeh}(h]h ]h"]h$]h&]uh1jhhhM2hj ubeh}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jOhhhM+hj` hhubh)}(hTo ensure connection events are not missed, **snd_usb_rediscover_devices()** is executed when the SoC USB device is registered. Now, when the BE DAI link component probe occurs, the following highlights the sequence:h](h,To ensure connection events are not missed, }(hj hhhNhNubj.)}(h **snd_usb_rediscover_devices()**h]hsnd_usb_rediscover_devices()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubh is executed when the SoC USB device is registered. Now, when the BE DAI link component probe occurs, the following highlights the sequence:}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM4hj` hhubjP)}(hX&BE DAI link component probe | --> DAI link is probed and SoC USB port is allocated | --> SoC USB device added, and **snd_usb_rediscover_devices()** runs **snd_usb_rediscover_devices()** | --> Traverses through usb_chip[] and for non-NULL entries issue | **connection_status_cb()** h]j)}(hhh](j)}(hBE DAI link component probe | --> DAI link is probed and SoC USB port is allocated | --> SoC USB device added, and **snd_usb_rediscover_devices()** runs h](j)}(hBE DAI link component probeh]hBE DAI link component probe}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhM:hj ubj)}(hhh]j )}(hhh](j )}(h4--> DAI link is probed and SoC USB port is allocatedh]h4--> DAI link is probed and SoC USB port is allocated}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hj Khj hhhKubj )}(hC--> SoC USB device added, and **snd_usb_rediscover_devices()** runsh](h--> SoC USB device added, and }(hj hhhNhNubj.)}(h **snd_usb_rediscover_devices()**h]hsnd_usb_rediscover_devices()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubh runs}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hj Khj hhhKubeh}(h]h ]h"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhM:hj ubj)}(h**snd_usb_rediscover_devices()** | --> Traverses through usb_chip[] and for non-NULL entries issue | **connection_status_cb()** h](j)}(h **snd_usb_rediscover_devices()**h]j.)}(hj h]hsnd_usb_rediscover_devices()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubah}(h]h ]h"]h$]h&]uh1jhhhM>hj ubj)}(hhh]j )}(hhh](j )}(h?--> Traverses through usb_chip[] and for non-NULL entries issueh]h?--> Traverses through usb_chip[] and for non-NULL entries issue}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hj Khj hhhKubj )}(hhh]j )}(h**connection_status_cb()**h]j.)}(hj3 h]hconnection_status_cb()}(hj5 hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj1 ubah}(h]h ]h"]h$]h&]uh1hj Khj. hhhKubah}(h]h ]h"]h$]h&]uh1j hj ubeh}(h]h ]h"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhM>hj ubeh}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jOhhhM8hj` hhubh)}(hIn the case where the USB offload driver is unbound, while USB SND is ready, the **snd_usb_rediscover_devices()** is called during module init. This allows for the offloading path to also be enabled with the following flow:h](hQIn the case where the USB offload driver is unbound, while USB SND is ready, the }(hjl hhhNhNubj.)}(h **snd_usb_rediscover_devices()**h]hsnd_usb_rediscover_devices()}(hjt hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjl ubho is called during module init. This allows for the offloading path to also be enabled with the following flow:}(hjl hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM@hj` hhubjP)}(hX**usb_audio_probe()** | --> USB audio streams allocated and saved to usb_chip[] | --> Propagate connect event to USB offload driver in USB SND | --> USB offload driver **NOT** ready! BE DAI link component probe | --> DAI link is probed and SoC USB port is allocated | --> No USB connect event due to missing USB offload driver USB offload driver probe | --> **qc_usb_audio_offload_init()** | --> Calls **snd_usb_rediscover_devices()** to notify of devices h]j)}(hhh](j)}(h**usb_audio_probe()** | --> USB audio streams allocated and saved to usb_chip[] | --> Propagate connect event to USB offload driver in USB SND | --> USB offload driver **NOT** ready! h](j)}(h**usb_audio_probe()**h]j.)}(hj h]husb_audio_probe()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubah}(h]h ]h"]h$]h&]uh1jhhhMGhj ubj)}(hhh]j )}(hhh](j )}(h7--> USB audio streams allocated and saved to usb_chip[]h]h7--> USB audio streams allocated and saved to usb_chip[]}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hj Khj hhhKubj )}(h<--> Propagate connect event to USB offload driver in USB SNDh]h<--> Propagate connect event to USB offload driver in USB SND}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hj Khj hhhKubj )}(h%--> USB offload driver **NOT** ready!h](h--> USB offload driver }(hj hhhNhNubj.)}(h**NOT**h]hNOT}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj ubh ready!}(hj hhhNhNubeh}(h]h ]h"]h$]h&]uh1hj Khj hhhKubeh}(h]h ]h"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhMGhj ubj)}(hBE DAI link component probe | --> DAI link is probed and SoC USB port is allocated | --> No USB connect event due to missing USB offload driver h](j)}(hBE DAI link component probeh]hBE DAI link component probe}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMKhj ubj)}(hhh]j )}(hhh](j )}(h4--> DAI link is probed and SoC USB port is allocatedh]h4--> DAI link is probed and SoC USB port is allocated}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hj Khj hhhKubj )}(h:--> No USB connect event due to missing USB offload driverh]h:--> No USB connect event due to missing USB offload driver}(hj( hhhNhNubah}(h]h ]h"]h$]h&]uh1hj Khj hhhKubeh}(h]h ]h"]h$]h&]uh1j hj ubah}(h]h ]h"]h$]h&]uh1jhj ubeh}(h]h ]h"]h$]h&]uh1jhhhMKhj ubj)}(hUSB offload driver probe | --> **qc_usb_audio_offload_init()** | --> Calls **snd_usb_rediscover_devices()** to notify of devices h](j)}(hUSB offload driver probeh]hUSB offload driver probe}(hjL hhhNhNubah}(h]h ]h"]h$]h&]uh1jhhhMOhjH ubj)}(hhh]j )}(hhh](j )}(h#--> **qc_usb_audio_offload_init()**h](h--> }(hj` hhhNhNubj.)}(h**qc_usb_audio_offload_init()**h]hqc_usb_audio_offload_init()}(hjh hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj` ubeh}(h]h ]h"]h$]h&]uh1hj Khj] hhhKubj )}(h?--> Calls **snd_usb_rediscover_devices()** to notify of devicesh](h --> Calls }(hj| hhhNhNubj.)}(h **snd_usb_rediscover_devices()**h]hsnd_usb_rediscover_devices()}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj| ubh to notify of devices}(hj| hhhNhNubeh}(h]h ]h"]h$]h&]uh1hj Khj] hhhKubeh}(h]h ]h"]h$]h&]uh1j hjZ ubah}(h]h ]h"]h$]h&]uh1jhjH ubeh}(h]h ]h"]h$]h&]uh1jhhhMOhj ubeh}(h]h ]h"]h$]h&]uh1jhj ubah}(h]h ]h"]h$]h&]uh1jOhhhMDhj` hhubeh}(h] usb-audio-device-connection-flowah ]h"] usb audio device connection flowah$]h&]uh1hhjhhhhhM ubeh}(h]soc-usb-driverah ]h"]soc usb driverah$]h&]uh1hhhhhhhhK2ubh)}(hhh](h)}(hUSB Offload Related Kcontrolsh]hUSB Offload Related Kcontrols}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMRubh)}(hhh](h)}(hDetailsh]hDetails}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj hhhhhMTubh)}(hXA set of kcontrols can be utilized by applications to help select the proper sound devices to enable USB audio offloading. SoC USB exposes the get_offload_dev() callback that designs can use to ensure that the proper indices are returned to the application.h]hXA set of kcontrols can be utilized by applications to help select the proper sound devices to enable USB audio offloading. SoC USB exposes the get_offload_dev() callback that designs can use to ensure that the proper indices are returned to the application.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMUhj hhubeh}(h]detailsah ]h"]detailsah$]h&]uh1hhj hhhhhMTubh)}(hhh](h)}(hImplementationh]hImplementation}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhM[ubh)}(h **Example:**h]j.)}(hjh]hExample:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubah}(h]h ]h"]h$]h&]uh1hhhhM]hjhhubjP)}(hX3**Sound Cards**: :: 0 [SM8250MTPWCD938]: sm8250 - SM8250-MTP-WCD9380-WSA8810-VA-D SM8250-MTP-WCD9380-WSA8810-VA-DMIC 1 [Seri ]: USB-Audio - Plantronics Blackwire 3225 Seri Plantronics Plantronics Blackwire 3225 Seri at usb-xhci-hcd.1.auto-1.1, full sp 2 [C320M ]: USB-Audio - Plantronics C320-M Plantronics Plantronics C320-M at usb-xhci-hcd.1.auto-1.2, full speed **PCM Devices**: :: card 0: SM8250MTPWCD938 [SM8250-MTP-WCD9380-WSA8810-VA-D], device 0: MultiMedia1 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: SM8250MTPWCD938 [SM8250-MTP-WCD9380-WSA8810-VA-D], device 1: MultiMedia2 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Seri [Plantronics Blackwire 3225 Seri], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: C320M [Plantronics C320-M], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 **USB Sound Card** - card#1: :: USB Offload Playback Card Route PCM#0 -1 (range -1->32) USB Offload Playback PCM Route PCM#0 -1 (range -1->255) **USB Sound Card** - card#2: :: USB Offload Playback Card Route PCM#0 0 (range -1->32) USB Offload Playback PCM Route PCM#0 1 (range -1->255) h](h)}(h**Sound Cards**:h](j.)}(h**Sound Cards**h]h Sound Cards}(hj2hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hj.ubh:}(hj.hhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM_hj*ubjP)}(hX$:: 0 [SM8250MTPWCD938]: sm8250 - SM8250-MTP-WCD9380-WSA8810-VA-D SM8250-MTP-WCD9380-WSA8810-VA-DMIC 1 [Seri ]: USB-Audio - Plantronics Blackwire 3225 Seri Plantronics Plantronics Blackwire 3225 Seri at usb-xhci-hcd.1.auto-1.1, full sp 2 [C320M ]: USB-Audio - Plantronics C320-M Plantronics Plantronics C320-M at usb-xhci-hcd.1.auto-1.2, full speed h]h)}(hX0 [SM8250MTPWCD938]: sm8250 - SM8250-MTP-WCD9380-WSA8810-VA-D SM8250-MTP-WCD9380-WSA8810-VA-DMIC 1 [Seri ]: USB-Audio - Plantronics Blackwire 3225 Seri Plantronics Plantronics Blackwire 3225 Seri at usb-xhci-hcd.1.auto-1.1, full sp 2 [C320M ]: USB-Audio - Plantronics C320-M Plantronics Plantronics C320-M at usb-xhci-hcd.1.auto-1.2, full speedh]hX0 [SM8250MTPWCD938]: sm8250 - SM8250-MTP-WCD9380-WSA8810-VA-D SM8250-MTP-WCD9380-WSA8810-VA-DMIC 1 [Seri ]: USB-Audio - Plantronics Blackwire 3225 Seri Plantronics Plantronics Blackwire 3225 Seri at usb-xhci-hcd.1.auto-1.1, full sp 2 [C320M ]: USB-Audio - Plantronics C320-M Plantronics Plantronics C320-M at usb-xhci-hcd.1.auto-1.2, full speed}hjNsbah}(h]h ]h"]h$]h&]j j uh1hhhhMchjJubah}(h]h ]h"]h$]h&]uh1jOhhhMahj*ubh)}(h**PCM Devices**:h](j.)}(h**PCM Devices**h]h PCM Devices}(hjfhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjbubh:}(hjbhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMlhj*ubjP)}(hX :: card 0: SM8250MTPWCD938 [SM8250-MTP-WCD9380-WSA8810-VA-D], device 0: MultiMedia1 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: SM8250MTPWCD938 [SM8250-MTP-WCD9380-WSA8810-VA-D], device 1: MultiMedia2 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Seri [Plantronics Blackwire 3225 Seri], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: C320M [Plantronics C320-M], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 h]h)}(hXcard 0: SM8250MTPWCD938 [SM8250-MTP-WCD9380-WSA8810-VA-D], device 0: MultiMedia1 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: SM8250MTPWCD938 [SM8250-MTP-WCD9380-WSA8810-VA-D], device 1: MultiMedia2 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Seri [Plantronics Blackwire 3225 Seri], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: C320M [Plantronics C320-M], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0h]hXcard 0: SM8250MTPWCD938 [SM8250-MTP-WCD9380-WSA8810-VA-D], device 0: MultiMedia1 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 0: SM8250MTPWCD938 [SM8250-MTP-WCD9380-WSA8810-VA-D], device 1: MultiMedia2 (*) [] Subdevices: 1/1 Subdevice #0: subdevice #0 card 1: Seri [Plantronics Blackwire 3225 Seri], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0 card 2: C320M [Plantronics C320-M], device 0: USB Audio [USB Audio] Subdevices: 1/1 Subdevice #0: subdevice #0}hjsbah}(h]h ]h"]h$]h&]j j uh1hhhhMphj~ubah}(h]h ]h"]h$]h&]uh1jOhhhMnhj*ubh)}(h**USB Sound Card** - card#1:h](j.)}(h**USB Sound Card**h]hUSB Sound Card}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubh - card#1:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhM}hj*ubjP)}(h}:: USB Offload Playback Card Route PCM#0 -1 (range -1->32) USB Offload Playback PCM Route PCM#0 -1 (range -1->255) h]h)}(htUSB Offload Playback Card Route PCM#0 -1 (range -1->32) USB Offload Playback PCM Route PCM#0 -1 (range -1->255)h]htUSB Offload Playback Card Route PCM#0 -1 (range -1->32) USB Offload Playback PCM Route PCM#0 -1 (range -1->255)}hjsbah}(h]h ]h"]h$]h&]j j uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jOhhhMhj*ubh)}(h**USB Sound Card** - card#2:h](j.)}(h**USB Sound Card**h]hUSB Sound Card}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubh - card#2:}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj*ubjP)}(h{:: USB Offload Playback Card Route PCM#0 0 (range -1->32) USB Offload Playback PCM Route PCM#0 1 (range -1->255) h]h)}(hrUSB Offload Playback Card Route PCM#0 0 (range -1->32) USB Offload Playback PCM Route PCM#0 1 (range -1->255)h]hrUSB Offload Playback Card Route PCM#0 0 (range -1->32) USB Offload Playback PCM Route PCM#0 1 (range -1->255)}hjsbah}(h]h ]h"]h$]h&]j j uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jOhhhMhj*ubeh}(h]h ]h"]h$]h&]uh1jOhhhM_hjhhubh)}(hX;The above example shows a scenario where the system has one ASoC platform card (card#0) and two USB sound devices connected (card#1 and card#2). When reading the available kcontrols for each USB audio device, the following kcontrols lists the mapped offload card and pcm device indexes for the specific USB device:h]hX;The above example shows a scenario where the system has one ASoC platform card (card#0) and two USB sound devices connected (card#1 and card#2). When reading the available kcontrols for each USB audio device, the following kcontrols lists the mapped offload card and pcm device indexes for the specific USB device:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubjP)}(hT``USB Offload Playback Card Route PCM#*`` ``USB Offload Playback PCM Route PCM#*`` h](h)}(h)``USB Offload Playback Card Route PCM#*``h]j;)}(hjh]h%USB Offload Playback Card Route PCM#*}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubah}(h]h ]h"]h$]h&]uh1hhhhMhjubh)}(h(``USB Offload Playback PCM Route PCM#*``h]j;)}(hj/h]h$USB Offload Playback PCM Route PCM#*}(hj1hhhNhNubah}(h]h ]h"]h$]h&]uh1j:hj-ubah}(h]h ]h"]h$]h&]uh1hhhhMhjubeh}(h]h ]h"]h$]h&]uh1jOhhhMhjhhubh)}(hThe kcontrol is indexed, because a USB audio device could potentially have several PCM devices. The above kcontrols are defined as:h]hThe kcontrol is indexed, because a USB audio device could potentially have several PCM devices. The above kcontrols are defined as:}(hjJhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubjP)}(hX[- ``USB Offload Playback Card Route PCM#`` **(R)**: Returns the ASoC platform sound card index for a mapped offload path. The output **"0"** (card index) signifies that there is an available offload path for the USB SND device through card#0. If **"-1"** is seen, then no offload path is available for the USB SND device. This kcontrol exists for each USB audio device that exists in the system, and its expected to derive the current status of offload based on the output value for the kcontrol along with the PCM route kcontrol. - ``USB Offload Playback PCM Route PCM#`` **(R)**: Returns the ASoC platform sound PCM device index for a mapped offload path. The output **"1"** (PCM device index) signifies that there is an available offload path for the USB SND device through PCM device#0. If **"-1"** is seen, then no offload path is available for the USB\ SND device. This kcontrol exists for each USB audio device that exists in the system, and its expected to derive the current status of offload based on the output value for this kcontrol, in addition to the card route kcontrol. :h]jV)}(hhh](j[)}(hX``USB Offload Playback Card Route PCM#`` **(R)**: Returns the ASoC platform sound card index for a mapped offload path. The output **"0"** (card index) signifies that there is an available offload path for the USB SND device through card#0. If **"-1"** is seen, then no offload path is available for the USB SND device. This kcontrol exists for each USB audio device that exists in the system, and its expected to derive the current status of offload based on the output value for the kcontrol along with the PCM route kcontrol. h]h)}(hX``USB Offload Playback Card Route PCM#`` **(R)**: Returns the ASoC platform sound card index for a mapped offload path. The output **"0"** (card index) signifies that there is an available offload path for the USB SND device through card#0. If **"-1"** is seen, then no offload path is available for the USB SND device. This kcontrol exists for each USB audio device that exists in the system, and its expected to derive the current status of offload based on the output value for the kcontrol along with the PCM route kcontrol.h](j;)}(h(``USB Offload Playback Card Route PCM#``h]h$USB Offload Playback Card Route PCM#}(hjghhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjcubh }(hjchhhNhNubj.)}(h**(R)**h]h(R)}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjcubhT: Returns the ASoC platform sound card index for a mapped offload path. The output }(hjchhhNhNubj.)}(h**"0"**h]h“0”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjcubhj (card index) signifies that there is an available offload path for the USB SND device through card#0. If }(hjchhhNhNubj.)}(h**"-1"**h]h“-1”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjcubhX is seen, then no offload path is available for the USB SND device. This kcontrol exists for each USB audio device that exists in the system, and its expected to derive the current status of offload based on the output value for the kcontrol along with the PCM route kcontrol.}(hjchhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj_ubah}(h]h ]h"]h$]h&]uh1jZhj\ubj[)}(hX,``USB Offload Playback PCM Route PCM#`` **(R)**: Returns the ASoC platform sound PCM device index for a mapped offload path. The output **"1"** (PCM device index) signifies that there is an available offload path for the USB SND device through PCM device#0. If **"-1"** is seen, then no offload path is available for the USB\ SND device. This kcontrol exists for each USB audio device that exists in the system, and its expected to derive the current status of offload based on the output value for this kcontrol, in addition to the card route kcontrol. h]h)}(hX+``USB Offload Playback PCM Route PCM#`` **(R)**: Returns the ASoC platform sound PCM device index for a mapped offload path. The output **"1"** (PCM device index) signifies that there is an available offload path for the USB SND device through PCM device#0. If **"-1"** is seen, then no offload path is available for the USB\ SND device. This kcontrol exists for each USB audio device that exists in the system, and its expected to derive the current status of offload based on the output value for this kcontrol, in addition to the card route kcontrol.h](j;)}(h'``USB Offload Playback PCM Route PCM#``h]h#USB Offload Playback PCM Route PCM#}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j:hjubh }(hjhhhNhNubj.)}(h**(R)**h]h(R)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubhZ: Returns the ASoC platform sound PCM device index for a mapped offload path. The output }(hjhhhNhNubj.)}(h**"1"**h]h“1”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubhv (PCM device index) signifies that there is an available offload path for the USB SND device through PCM device#0. If }(hjhhhNhNubj.)}(h**"-1"**h]h“-1”}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubhX is seen, then no offload path is available for the USB SND device. This kcontrol exists for each USB audio device that exists in the system, and its expected to derive the current status of offload based on the output value for this kcontrol, in addition to the card route kcontrol.}(hjhhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jZhj\ubeh}(h]h ]h"]h$]h&]jjuh1jUhhhMhjXubah}(h]h ]h"]h$]h&]uh1jOhhhMhjhhubeh}(h]implementationah ]h"]implementationah$]h&]uh1hhj hhhhhM[ubh)}(hhh](h)}(h#USB Offload Playback Route Kcontrolh]h#USB Offload Playback Route Kcontrol}(hj.hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj+hhhhhMubh)}(hIn order to allow for vendor specific implementations on audio offloading device selection, the SoC USB layer exposes the following:h]hIn order to allow for vendor specific implementations on audio offloading device selection, the SoC USB layer exposes the following:}(hj<hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj+hhubh)}(hint (*update_offload_route_info)(struct snd_soc_component *component, int card, int pcm, int direction, enum snd_soc_usb_kctl path, long *route)h]hint (*update_offload_route_info)(struct snd_soc_component *component, int card, int pcm, int direction, enum snd_soc_usb_kctl path, long *route)}hjJsbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhMhj+hhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhj+hhhhhMubh)}(hqThese are specific for the **USB Offload Playback Card Route PCM#** and **USB Offload PCM Route PCM#** kcontrols.h](hThese are specific for the }(hjchhhNhNubj.)}(h(**USB Offload Playback Card Route PCM#**h]h$USB Offload Playback Card Route PCM#}(hjkhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjcubh and }(hjchhhNhNubj.)}(h**USB Offload PCM Route PCM#**h]hUSB Offload PCM Route PCM#}(hj}hhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjcubh kcontrols.}(hjchhhNhNubeh}(h]h ]h"]h$]h&]uh1hhhhMhj+hhubh)}(hWhen users issue get calls to the kcontrol, the registered SoC USB callbacks will execute the registered function calls to the DPCM BE DAI link.h]hWhen users issue get calls to the kcontrol, the registered SoC USB callbacks will execute the registered function calls to the DPCM BE DAI link.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhj+hhubh)}(h**Callback Registration:**h]j.)}(hjh]hCallback Registration:}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1j-hjubah}(h]h ]h"]h$]h&]uh1hhhhMhj+hhubh)}(hXAstatic int q6usb_component_probe(struct snd_soc_component *component) { ... usb = snd_soc_usb_allocate_port(component, 1, &data->priv); if (IS_ERR(usb)) return -ENOMEM; usb->connection_status_cb = q6usb_alsa_connection_cb; usb->update_offload_route_info = q6usb_get_offload_dev; ret = snd_soc_usb_add_port(usb);h]hXAstatic int q6usb_component_probe(struct snd_soc_component *component) { ... usb = snd_soc_usb_allocate_port(component, 1, &data->priv); if (IS_ERR(usb)) return -ENOMEM; usb->connection_status_cb = q6usb_alsa_connection_cb; usb->update_offload_route_info = q6usb_get_offload_dev; ret = snd_soc_usb_add_port(usb);}hjsbah}(h]h ]h"]h$]h&]j j jjrstj}uh1hhhhMhj+hhubj)}(hhh]h}(h]h ]h"]h$]h&]j j uh1jhj+hhhhhMubeh}(h]#usb-offload-playback-route-kcontrolah ]h"]#usb offload playback route kcontrolah$]h&]uh1hhj hhhhhMubh)}(hhh](h)}(hExisting USB Sound Kcontrolh]hExisting USB Sound Kcontrol}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhMubh)}(hX With the introduction of USB offload support, the above USB offload kcontrol will be added to the pre existing list of kcontrols identified by the USB sound framework. These kcontrols are still the main controls that are used to modify characteristics pertaining to the USB audio device.h]hX With the introduction of USB offload support, the above USB offload kcontrol will be added to the pre existing list of kcontrols identified by the USB sound framework. These kcontrols are still the main controls that are used to modify characteristics pertaining to the USB audio device.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubjP)}(hX:: Number of controls: 9 ctl type num name value 0 INT 2 Capture Channel Map 0, 0 (range 0->36) 1 INT 2 Playback Channel Map 0, 0 (range 0->36) 2 BOOL 1 Headset Capture Switch On 3 INT 1 Headset Capture Volume 10 (range 0->13) 4 BOOL 1 Sidetone Playback Switch On 5 INT 1 Sidetone Playback Volume 4096 (range 0->8192) 6 BOOL 1 Headset Playback Switch On 7 INT 2 Headset Playback Volume 20, 20 (range 0->24) 8 INT 1 USB Offload Playback Card Route PCM#0 0 (range -1->32) 9 INT 1 USB Offload Playback PCM Route PCM#0 1 (range -1->255) h]h)}(hXhNumber of controls: 9 ctl type num name value 0 INT 2 Capture Channel Map 0, 0 (range 0->36) 1 INT 2 Playback Channel Map 0, 0 (range 0->36) 2 BOOL 1 Headset Capture Switch On 3 INT 1 Headset Capture Volume 10 (range 0->13) 4 BOOL 1 Sidetone Playback Switch On 5 INT 1 Sidetone Playback Volume 4096 (range 0->8192) 6 BOOL 1 Headset Playback Switch On 7 INT 2 Headset Playback Volume 20, 20 (range 0->24) 8 INT 1 USB Offload Playback Card Route PCM#0 0 (range -1->32) 9 INT 1 USB Offload Playback PCM Route PCM#0 1 (range -1->255)h]hXhNumber of controls: 9 ctl type num name value 0 INT 2 Capture Channel Map 0, 0 (range 0->36) 1 INT 2 Playback Channel Map 0, 0 (range 0->36) 2 BOOL 1 Headset Capture Switch On 3 INT 1 Headset Capture Volume 10 (range 0->13) 4 BOOL 1 Sidetone Playback Switch On 5 INT 1 Sidetone Playback Volume 4096 (range 0->8192) 6 BOOL 1 Headset Playback Switch On 7 INT 2 Headset Playback Volume 20, 20 (range 0->24) 8 INT 1 USB Offload Playback Card Route PCM#0 0 (range -1->32) 9 INT 1 USB Offload Playback PCM Route PCM#0 1 (range -1->255)}hjsbah}(h]h ]h"]h$]h&]j j uh1hhhhMhjubah}(h]h ]h"]h$]h&]uh1jOhhhMhjhhubh)}(hSince USB audio device controls are handled over the USB control endpoint, use the existing mechanisms present in the USB mixer to set parameters, such as volume.h]hSince USB audio device controls are handled over the USB control endpoint, use the existing mechanisms present in the USB mixer to set parameters, such as volume.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhMhjhhubeh}(h]existing-usb-sound-kcontrolah ]h"]existing usb sound kcontrolah$]h&]uh1hhj hhhhhMubeh}(h]usb-offload-related-kcontrolsah ]h"]usb offload related kcontrolsah$]h&]uh1hhhhhhhhMRubeh}(h]asoc-usb-supportah ]h"]asoc usb supportah$]h&]uh1hhhhhhhhKubeh}(h]h ]h"]h$]h&]sourcehuh1hcurrent_sourceN current_lineNsettingsdocutils.frontendValues)}(hN generatorN datestampN source_linkN source_urlN toc_backlinksentryfootnote_backlinksK sectnum_xformKstrip_commentsNstrip_elements_with_classesN strip_classesN report_levelK halt_levelKexit_status_levelKdebugNwarning_streamN tracebackinput_encoding utf-8-siginput_encoding_error_handlerstrictoutput_encodingutf-8output_encoding_error_handlerj[error_encodingutf-8error_encoding_error_handlerbackslashreplace language_codeenrecord_dependenciesNconfigN id_prefixhauto_id_prefixid dump_settingsNdump_internalsNdump_transformsNdump_pseudo_xmlNexpose_internalsNstrict_visitorN_disable_configN_sourcehʌ _destinationN _config_files]7/var/lib/git/docbuild/linux/Documentation/docutils.confafile_insertion_enabled raw_enabledKline_length_limitM'pep_referencesN pep_base_urlhttps://peps.python.org/pep_file_url_templatepep-%04drfc_referencesN rfc_base_url&https://datatracker.ietf.org/doc/html/ tab_widthKtrim_footnote_reference_spacesyntax_highlightlong smart_quotessmartquotes_locales]character_level_inline_markupdoctitle_xform docinfo_xformKsectsubtitle_xform image_loadinglinkembed_stylesheetcloak_email_addressessection_self_linkenvNubreporterNindirect_targets]substitution_defs}substitution_names}refnames}refids}nameids}(j5j2jjj j jtjqj j j] jZ j j j-j*j j j(j%jjj%j"u nametypes}(j5jj jtj j] j j-j j(jj%uh}(j2hjhj jjqj%j jwjZ j j j` j*j j j j%jjj+j"ju footnote_refs} citation_refs} autofootnotes]autofootnote_refs]symbol_footnotes]symbol_footnote_refs] footnotes] citations]autofootnote_startKsymbol_footnote_startK id_counter collectionsCounter}Rparse_messages]transform_messages] transformerN include_log] decorationNhhub.