€•±®Œsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ"/translations/zh_CN/sound/soc/dpcm”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/zh_TW/sound/soc/dpcm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/it_IT/sound/soc/dpcm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/ja_JP/sound/soc/dpcm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/ko_KR/sound/soc/dpcm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/pt_BR/sound/soc/dpcm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ"/translations/sp_SP/sound/soc/dpcm”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒ Dynamic PCM”h]”hŒ Dynamic PCM”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³Œ * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <----DAI1-----> Codec Speakers * DSP * PCM2 <------------> * * <----DAI2-----> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”h]”hXŠ| Front End PCMs | SoC DSP | Back End DAIs | Audio devices | ************* PCM0 <------------> * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <----DAI1-----> Codec Speakers * DSP * PCM2 <------------> * * <----DAI2-----> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”…””}”hj)sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1j'h³hÊh´Khjh²hubhÝ)”}”(hXƒThis diagram shows a simple smart phone audio subsystem. It supports Bluetooth, FM digital radio, Speakers, Headset Jack, digital microphones and cellular modem. This sound card exposes 4 DSP front end (FE) ALSA PCM devices and supports 6 back end (BE) DAIs. Each FE PCM can digitally route audio data to any of the BE DAIs. The FE PCM devices can also route audio to more than 1 BE DAI.”h]”hXƒThis diagram shows a simple smart phone audio subsystem. It supports Bluetooth, FM digital radio, Speakers, Headset Jack, digital microphones and cellular modem. This sound card exposes 4 DSP front end (FE) ALSA PCM devices and supports 6 back end (BE) DAIs. Each FE PCM can digitally route audio data to any of the BE DAIs. The FE PCM devices can also route audio to more than 1 BE DAI.”…””}”(hj9h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K-hjh²hubeh}”(h]”Œ%phone-audio-system-with-soc-based-dsp”ah ]”h"]”Œ%phone audio system with soc based dsp”ah$]”h&]”uh1hµhhËh²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒ3Example - DPCM Switching playback from DAI0 to DAI1”h]”hŒ3Example - DPCM Switching playback from DAI0 to DAI1”…””}”(hjRh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjOh²hh³hÊh´K6ubhÝ)”}”(hŒ}Audio is being played to the Headset. After a while the user removes the headset and audio continues playing on the speakers.”h]”hŒ}Audio is being played to the Headset. After a while the user removes the headset and audio continues playing on the speakers.”…””}”(hj`h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K8hjOh²hubhÝ)”}”(hŒ1Playback on PCM0 to Headset would look like :- ::”h]”hŒ.Playback on PCM0 to Headset would look like :-”…””}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K;hjOh²hubj()”}”(hXG ************* PCM0 <============> * * <====DAI0=====> Codec Headset * * PCM1 <------------> * * <----DAI1-----> Codec Speakers * DSP * PCM2 <------------> * * <----DAI2-----> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”h]”hXG ************* PCM0 <============> * * <====DAI0=====> Codec Headset * * PCM1 <------------> * * <----DAI1-----> Codec Speakers * DSP * PCM2 <------------> * * <----DAI2-----> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”…””}”hj|sbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´K>hjOh²hubhÝ)”}”(hŒSThe headset is removed from the jack by user so the speakers must now be used :- ::”h]”hŒPThe headset is removed from the jack by user so the speakers must now be used :-”…””}”(hjŠh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KLhjOh²hubj()”}”(hXG ************* PCM0 <============> * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <====DAI1=====> Codec Speakers * DSP * PCM2 <------------> * * <----DAI2-----> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”h]”hXG ************* PCM0 <============> * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <====DAI1=====> Codec Speakers * DSP * PCM2 <------------> * * <----DAI2-----> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”…””}”hj˜sbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´KOhjOh²hubhÝ)”}”(hŒ-The audio driver processes this as follows :-”h]”hŒ-The audio driver processes this as follows :-”…””}”(hj¦h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K]hjOh²hubhŒenumerated_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ,Machine driver receives Jack removal event. ”h]”hÝ)”}”(hŒ+Machine driver receives Jack removal event.”h]”hŒ+Machine driver receives Jack removal event.”…””}”(hj¿h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K_hj»ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj¶h²hh³hÊh´Nubjº)”}”(hŒ7Machine driver OR audio HAL disables the Headset path. ”h]”hÝ)”}”(hŒ6Machine driver OR audio HAL disables the Headset path.”h]”hŒ6Machine driver OR audio HAL disables the Headset path.”…””}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KahjÓubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj¶h²hh³hÊh´Nubjº)”}”(hŒvDPCM runs the PCM trigger(stop), hw_free(), shutdown() operations on DAI0 for headset since the path is now disabled. ”h]”hÝ)”}”(hŒuDPCM runs the PCM trigger(stop), hw_free(), shutdown() operations on DAI0 for headset since the path is now disabled.”h]”hŒuDPCM runs the PCM trigger(stop), hw_free(), shutdown() operations on DAI0 for headset since the path is now disabled.”…””}”(hjïh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kchjëubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj¶h²hh³hÊh´Nubjº)”}”(hŒ6Machine driver or audio HAL enables the speaker path. ”h]”hÝ)”}”(hŒ5Machine driver or audio HAL enables the speaker path.”h]”hŒ5Machine driver or audio HAL enables the speaker path.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kfhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj¶h²hh³hÊh´Nubjº)”}”(hŒ|DPCM runs the PCM ops for startup(), hw_params(), prepare() and trigger(start) for DAI1 Speakers since the path is enabled. ”h]”hÝ)”}”(hŒ{DPCM runs the PCM ops for startup(), hw_params(), prepare() and trigger(start) for DAI1 Speakers since the path is enabled.”h]”hŒ{DPCM runs the PCM ops for startup(), hw_params(), prepare() and trigger(start) for DAI1 Speakers since the path is enabled.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Khhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj¶h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œarabic”Œprefix”hŒsuffix”Œ.”uh1j´hjOh²hh³hÊh´K_ubhÝ)”}”(hŒêIn this example, the machine driver or userspace audio HAL can alter the routing and then DPCM will take care of managing the DAI PCM operations to either bring the link up or down. Audio playback does not stop during this transition.”h]”hŒêIn this example, the machine driver or userspace audio HAL can alter the routing and then DPCM will take care of managing the DAI PCM operations to either bring the link up or down. Audio playback does not stop during this transition.”…””}”(hj>h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KkhjOh²hubeh}”(h]”Œ1example-dpcm-switching-playback-from-dai0-to-dai1”ah ]”h"]”Œ3example - dpcm switching playback from dai0 to dai1”ah$]”h&]”uh1hµhhËh²hh³hÊh´K6ubeh}”(h]”Œ description”ah ]”h"]”Œ description”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒDPCM machine driver”h]”hŒDPCM machine driver”…””}”(hj_h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj\h²hh³hÊh´KrubhÝ)”}”(hŒhThe DPCM enabled ASoC machine driver is similar to normal machine drivers except that we also have to :-”h]”hŒhThe DPCM enabled ASoC machine driver is similar to normal machine drivers except that we also have to :-”…””}”(hjmh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kthj\h²hubjµ)”}”(hhh]”(jº)”}”(hŒ Define the FE and BE DAI links. ”h]”hÝ)”}”(hŒDefine the FE and BE DAI links.”h]”hŒDefine the FE and BE DAI links.”…””}”(hj‚h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kwhj~ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj{h²hh³hÊh´Nubjº)”}”(hŒ!Define any FE/BE PCM operations. ”h]”hÝ)”}”(hŒ Define any FE/BE PCM operations.”h]”hŒ Define any FE/BE PCM operations.”…””}”(hjšh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Kyhj–ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj{h²hh³hÊh´Nubjº)”}”(hŒ"Define widget graph connections. ”h]”hÝ)”}”(hŒ Define widget graph connections.”h]”hŒ Define widget graph connections.”…””}”(hj²h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K{hj®ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj{h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j9j:j;hj<j=uh1j´hj\h²hh³hÊh´Kwubh¶)”}”(hhh]”(h»)”}”(hŒFE and BE DAI links”h]”hŒFE and BE DAI links”…””}”(hjÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÌh²hh³hÊh´Kubj()”}”(hXŠ| Front End PCMs | SoC DSP | Back End DAIs | Audio devices | ************* PCM0 <------------> * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <----DAI1-----> Codec Speakers * DSP * PCM2 <------------> * * <----DAI2-----> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”h]”hXŠ| Front End PCMs | SoC DSP | Back End DAIs | Audio devices | ************* PCM0 <------------> * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <----DAI1-----> Codec Speakers * DSP * PCM2 <------------> * * <----DAI2-----> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”…””}”hjÝsbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´K‚hjÌh²hubhÝ)”}”(hŒxFor the example above we have to define 4 FE DAI links and 6 BE DAI links. The FE DAI links are defined as follows :- ::”h]”hŒuFor the example above we have to define 4 FE DAI links and 6 BE DAI links. The FE DAI links are defined as follows :-”…””}”(hjëh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K’hjÌh²hubj()”}”(hXSND_SOC_DAILINK_DEFS(pcm0, DAILINK_COMP_ARRAY(COMP_CPU("System Pin")), DAILINK_COMP_ARRAY(COMP_DUMMY()), DAILINK_COMP_ARRAY(COMP_PLATFORM("dsp-audio"))); static struct snd_soc_dai_link machine_dais[] = { { .name = "PCM0 System", .stream_name = "System Playback", SND_SOC_DAILINK_REG(pcm0), .dynamic = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, }, .....< other FE and BE DAI links here > };”h]”hXSND_SOC_DAILINK_DEFS(pcm0, DAILINK_COMP_ARRAY(COMP_CPU("System Pin")), DAILINK_COMP_ARRAY(COMP_DUMMY()), DAILINK_COMP_ARRAY(COMP_PLATFORM("dsp-audio"))); static struct snd_soc_dai_link machine_dais[] = { { .name = "PCM0 System", .stream_name = "System Playback", SND_SOC_DAILINK_REG(pcm0), .dynamic = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, }, .....< other FE and BE DAI links here > };”…””}”hjùsbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´K–hjÌh²hubhÝ)”}”(hX‚This FE DAI link is pretty similar to a regular DAI link except that we also set the DAI link to a DPCM FE with the ``dynamic = 1``. There is also an option to specify the ordering of the trigger call for each FE. This allows the ASoC core to trigger the DSP before or after the other components (as some DSPs have strong requirements for the ordering DAI/DSP start and stop sequences).”h]”(hŒtThis FE DAI link is pretty similar to a regular DAI link except that we also set the DAI link to a DPCM FE with the ”…””}”(hjh²hh³Nh´NubhŒliteral”“”)”}”(hŒ``dynamic = 1``”h]”hŒ dynamic = 1”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubhŒÿ. There is also an option to specify the ordering of the trigger call for each FE. This allows the ASoC core to trigger the DSP before or after the other components (as some DSPs have strong requirements for the ordering DAI/DSP start and stop sequences).”…””}”(hjh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K¦hjÌh²hubhÝ)”}”(hŒƒThe FE DAI above sets the codec and code DAIs to dummy devices since the BE is dynamic and will change depending on runtime config.”h]”hŒƒThe FE DAI above sets the codec and code DAIs to dummy devices since the BE is dynamic and will change depending on runtime config.”…””}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K­hjÌh²hubhÝ)”}”(hŒ+The BE DAIs are configured as follows :- ::”h]”hŒ(The BE DAIs are configured as follows :-”…””}”(hj7h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´K°hjÌh²hubj()”}”(hXESND_SOC_DAILINK_DEFS(headset, DAILINK_COMP_ARRAY(COMP_CPU("ssp-dai.0")), DAILINK_COMP_ARRAY(COMP_CODEC("rt5640.0-001c", "rt5640-aif1"))); static struct snd_soc_dai_link machine_dais[] = { .....< FE DAI links here > { .name = "Codec Headset", SND_SOC_DAILINK_REG(headset), .no_pcm = 1, .ignore_suspend = 1, .ignore_pmdown_time = 1, .be_hw_params_fixup = hswult_ssp0_fixup, .ops = &haswell_ops, }, .....< other BE DAI links here > };”h]”hXESND_SOC_DAILINK_DEFS(headset, DAILINK_COMP_ARRAY(COMP_CPU("ssp-dai.0")), DAILINK_COMP_ARRAY(COMP_CODEC("rt5640.0-001c", "rt5640-aif1"))); static struct snd_soc_dai_link machine_dais[] = { .....< FE DAI links here > { .name = "Codec Headset", SND_SOC_DAILINK_REG(headset), .no_pcm = 1, .ignore_suspend = 1, .ignore_pmdown_time = 1, .be_hw_params_fixup = hswult_ssp0_fixup, .ops = &haswell_ops, }, .....< other BE DAI links here > };”…””}”hjEsbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´K³hjÌh²hubhÝ)”}”(hŒxThis BE DAI link connects DAI0 to the codec (in this case RT5460 AIF1). It sets the ``no_pcm`` flag to mark it has a BE.”h]”(hŒTThis BE DAI link connects DAI0 to the codec (in this case RT5460 AIF1). It sets the ”…””}”(hjSh²hh³Nh´Nubj)”}”(hŒ ``no_pcm``”h]”hŒno_pcm”…””}”(hj[h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjSubhŒ flag to mark it has a BE.”…””}”(hjSh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KÅhjÌh²hubhÝ)”}”(hŒµThe BE has also flags set for ignoring suspend and PM down time. This allows the BE to work in a hostless mode where the host CPU is not transferring data like a BT phone call :- ::”h]”hŒ²The BE has also flags set for ignoring suspend and PM down time. This allows the BE to work in a hostless mode where the host CPU is not transferring data like a BT phone call :-”…””}”(hjsh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KÈhjÌh²hubj()”}”(hXG ************* PCM0 <------------> * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <----DAI1-----> Codec Speakers * DSP * PCM2 <------------> * * <====DAI2=====> MODEM * * PCM3 <------------> * * <====DAI3=====> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”h]”hXG ************* PCM0 <------------> * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <----DAI1-----> Codec Speakers * DSP * PCM2 <------------> * * <====DAI2=====> MODEM * * PCM3 <------------> * * <====DAI3=====> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´KÍhjÌh²hubhÝ)”}”(hŒaThis allows the host CPU to sleep while the DSP, MODEM DAI and the BT DAI are still in operation.”h]”hŒaThis allows the host CPU to sleep while the DSP, MODEM DAI and the BT DAI are still in operation.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KÛhjÌh²hubhÝ)”}”(hŒkA BE DAI link can also set the codec to a dummy device if the codec is a device that is managed externally.”h]”hŒkA BE DAI link can also set the codec to a dummy device if the codec is a device that is managed externally.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KÞhjÌh²hubhÝ)”}”(hŒ]Likewise a BE DAI can also set a dummy cpu DAI if the CPU DAI is managed by the DSP firmware.”h]”hŒ]Likewise a BE DAI can also set a dummy cpu DAI if the CPU DAI is managed by the DSP firmware.”…””}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KáhjÌh²hubeh}”(h]”Œfe-and-be-dai-links”ah ]”h"]”Œfe and be dai links”ah$]”h&]”uh1hµhj\h²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒFE/BE PCM operations”h]”hŒFE/BE PCM operations”…””}”(hjÄh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÁh²hh³hÊh´KæubhÝ)”}”(hŒæThe BE above also exports some PCM operations and a ``fixup`` callback. The fixup callback is used by the machine driver to (re)configure the DAI based upon the FE hw params. i.e. the DSP may perform SRC or ASRC from the FE to BE.”h]”(hŒ4The BE above also exports some PCM operations and a ”…””}”(hjÒh²hh³Nh´Nubj)”}”(hŒ ``fixup``”h]”hŒfixup”…””}”(hjÚh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÒubhŒ© callback. The fixup callback is used by the machine driver to (re)configure the DAI based upon the FE hw params. i.e. the DSP may perform SRC or ASRC from the FE to BE.”…””}”(hjÒh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KèhjÁh²hubhÝ)”}”(hŒþe.g. DSP converts all FE hw params to run at fixed rate of 48k, 16bit, stereo for DAI0. This means all FE hw_params have to be fixed in the machine driver for DAI0 so that the DAI is running at desired configuration regardless of the FE configuration. ::”h]”hŒûe.g. DSP converts all FE hw params to run at fixed rate of 48k, 16bit, stereo for DAI0. This means all FE hw_params have to be fixed in the machine driver for DAI0 so that the DAI is running at desired configuration regardless of the FE configuration.”…””}”(hjòh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´KìhjÁh²hubj()”}”(hX_static int dai0_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); /* The DSP will convert the FE rate to 48k, stereo */ rate->min = rate->max = 48000; channels->min = channels->max = 2; /* set DAI0 to 16 bit */ params_set_format(params, SNDRV_PCM_FORMAT_S16_LE); return 0; }”h]”hX_static int dai0_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params) { struct snd_interval *rate = hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE); struct snd_interval *channels = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); /* The DSP will convert the FE rate to 48k, stereo */ rate->min = rate->max = 48000; channels->min = channels->max = 2; /* set DAI0 to 16 bit */ params_set_format(params, SNDRV_PCM_FORMAT_S16_LE); return 0; }”…””}”hjsbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´KòhjÁh²hubhÝ)”}”(hŒPThe other PCM operation are the same as for regular DAI links. Use as necessary.”h]”hŒPThe other PCM operation are the same as for regular DAI links. Use as necessary.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MhjÁh²hubeh}”(h]”Œfe-be-pcm-operations”ah ]”h"]”Œfe/be pcm operations”ah$]”h&]”uh1hµhj\h²hh³hÊh´Kæubh¶)”}”(hhh]”(h»)”}”(hŒWidget graph connections”h]”hŒWidget graph connections”…””}”(hj'h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj$h²hh³hÊh´MubhÝ)”}”(hŒËThe BE DAI links will normally be connected to the graph at initialisation time by the ASoC DAPM core. However, if the BE codec or BE DAI is a dummy then this has to be set explicitly in the driver :- ::”h]”hŒÈThe BE DAI links will normally be connected to the graph at initialisation time by the ASoC DAPM core. However, if the BE codec or BE DAI is a dummy then this has to be set explicitly in the driver :-”…””}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M hj$h²hubj()”}”(hŒ•/* BE for codec Headset - DAI0 is dummy and managed by DSP FW */ {"DAI0 CODEC IN", NULL, "AIF1 Capture"}, {"AIF1 Playback", NULL, "DAI0 CODEC OUT"},”h]”hŒ•/* BE for codec Headset - DAI0 is dummy and managed by DSP FW */ {"DAI0 CODEC IN", NULL, "AIF1 Capture"}, {"AIF1 Playback", NULL, "DAI0 CODEC OUT"},”…””}”hjCsbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´Mhj$h²hubeh}”(h]”Œwidget-graph-connections”ah ]”h"]”Œwidget graph connections”ah$]”h&]”uh1hµhj\h²hh³hÊh´Mubeh}”(h]”Œdpcm-machine-driver”ah ]”h"]”Œdpcm machine driver”ah$]”h&]”uh1hµhh·h²hh³hÊh´Krubh¶)”}”(hhh]”(h»)”}”(hŒWriting a DPCM DSP driver”h]”hŒWriting a DPCM DSP driver”…””}”(hjdh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjah²hh³hÊh´MubhÝ)”}”(hŒ£The DPCM DSP driver looks much like a standard platform class ASoC driver combined with elements from a codec class driver. A DSP platform driver must implement :-”h]”hŒ£The DPCM DSP driver looks much like a standard platform class ASoC driver combined with elements from a codec class driver. A DSP platform driver must implement :-”…””}”(hjrh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mhjah²hubjµ)”}”(hhh]”(jº)”}”(hŒ5Front End PCM DAIs - i.e. struct snd_soc_dai_driver. ”h]”hÝ)”}”(hŒ4Front End PCM DAIs - i.e. struct snd_soc_dai_driver.”h]”hŒ4Front End PCM DAIs - i.e. struct snd_soc_dai_driver.”…””}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mhjƒubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj€h²hh³hÊh´Nubjº)”}”(hŒ:DAPM graph showing DSP audio routing from FE DAIs to BEs. ”h]”hÝ)”}”(hŒ9DAPM graph showing DSP audio routing from FE DAIs to BEs.”h]”hŒ9DAPM graph showing DSP audio routing from FE DAIs to BEs.”…””}”(hjŸh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mhj›ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj€h²hh³hÊh´Nubjº)”}”(hŒDAPM widgets from DSP graph. ”h]”hÝ)”}”(hŒDAPM widgets from DSP graph.”h]”hŒDAPM widgets from DSP graph.”…””}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mhj³ubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj€h²hh³hÊh´Nubjº)”}”(hŒ Mixers for gains, routing, etc. ”h]”hÝ)”}”(hŒMixers for gains, routing, etc.”h]”hŒMixers for gains, routing, etc.”…””}”(hjÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M hjËubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj€h²hh³hÊh´Nubjº)”}”(hŒDMA configuration. ”h]”hÝ)”}”(hŒDMA configuration.”h]”hŒDMA configuration.”…””}”(hjçh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M"hjãubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj€h²hh³hÊh´Nubjº)”}”(hŒBE AIF widgets. ”h]”hÝ)”}”(hŒBE AIF widgets.”h]”hŒBE AIF widgets.”…””}”(hjÿh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M$hjûubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hj€h²hh³hÊh´Nubeh}”(h]”h ]”h"]”h$]”h&]”j9j:j;hj<j=uh1j´hjah²hh³hÊh´MubhÝ)”}”(hŒ¦Items 6 is important for routing the audio outside of the DSP. AIF need to be defined for each BE and each stream direction. e.g for BE DAI0 above we would have :- ::”h]”hŒ£Items 6 is important for routing the audio outside of the DSP. AIF need to be defined for each BE and each stream direction. e.g for BE DAI0 above we would have :-”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M&hjah²hubj()”}”(hŒzSND_SOC_DAPM_AIF_IN("DAI0 RX", NULL, 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_OUT("DAI0 TX", NULL, 0, SND_SOC_NOPM, 0, 0),”h]”hŒzSND_SOC_DAPM_AIF_IN("DAI0 RX", NULL, 0, SND_SOC_NOPM, 0, 0), SND_SOC_DAPM_AIF_OUT("DAI0 TX", NULL, 0, SND_SOC_NOPM, 0, 0),”…””}”hj'sbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´M+hjah²hubhÝ)”}”(hŒnThe BE AIF are used to connect the DSP graph to the graphs for the other component drivers (e.g. codec graph).”h]”hŒnThe BE AIF are used to connect the DSP graph to the graphs for the other component drivers (e.g. codec graph).”…””}”(hj5h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M.hjah²hubeh}”(h]”Œwriting-a-dpcm-dsp-driver”ah ]”h"]”Œwriting a dpcm dsp driver”ah$]”h&]”uh1hµhh·h²hh³hÊh´Mubh¶)”}”(hhh]”(h»)”}”(hŒHostless PCM streams”h]”hŒHostless PCM streams”…””}”(hjNh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjKh²hh³hÊh´M3ubhÝ)”}”(hŒA hostless PCM stream is a stream that is not routed through the host CPU. An example of this would be a phone call from handset to modem. ::”h]”hŒŠA hostless PCM stream is a stream that is not routed through the host CPU. An example of this would be a phone call from handset to modem.”…””}”(hj\h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M5hjKh²hubj()”}”(hXK ************* PCM0 <------------> * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <====DAI1=====> Codec Speakers/Mic * DSP * PCM2 <------------> * * <====DAI2=====> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”h]”hXK ************* PCM0 <------------> * * <----DAI0-----> Codec Headset * * PCM1 <------------> * * <====DAI1=====> Codec Speakers/Mic * DSP * PCM2 <------------> * * <====DAI2=====> MODEM * * PCM3 <------------> * * <----DAI3-----> BT * * * * <----DAI4-----> DMIC * * * * <----DAI5-----> FM *************”…””}”hjjsbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´M9hjKh²hubhÝ)”}”(hŒ—In this case the PCM data is routed via the DSP. The host CPU in this use case is only used for control and can sleep during the runtime of the stream.”h]”hŒ—In this case the PCM data is routed via the DSP. The host CPU in this use case is only used for control and can sleep during the runtime of the stream.”…””}”(hjxh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MGhjKh²hubhÝ)”}”(hŒ3The host can control the hostless link either by :-”h]”hŒ3The host can control the hostless link either by :-”…””}”(hj†h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MJhjKh²hubhŒ block_quote”“”)”}”(hX}1. Configuring the link as a CODEC <-> CODEC style link. In this case the link is enabled or disabled by the state of the DAPM graph. This usually means there is a mixer control that can be used to connect or disconnect the path between both DAIs. 2. Hostless FE. This FE has a virtual connection to the BE DAI links on the DAPM graph. Control is then carried out by the FE as regular PCM operations. This method gives more control over the DAI links, but requires much more userspace code to control the link. Its recommended to use CODEC<->CODEC unless your HW needs more fine grained sequencing of the PCM ops. ”h]”jµ)”}”(hhh]”(jº)”}”(hŒõConfiguring the link as a CODEC <-> CODEC style link. In this case the link is enabled or disabled by the state of the DAPM graph. This usually means there is a mixer control that can be used to connect or disconnect the path between both DAIs. ”h]”hÝ)”}”(hŒôConfiguring the link as a CODEC <-> CODEC style link. In this case the link is enabled or disabled by the state of the DAPM graph. This usually means there is a mixer control that can be used to connect or disconnect the path between both DAIs.”h]”hŒôConfiguring the link as a CODEC <-> CODEC style link. In this case the link is enabled or disabled by the state of the DAPM graph. This usually means there is a mixer control that can be used to connect or disconnect the path between both DAIs.”…””}”(hj¡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MLhjubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hjšubjº)”}”(hXlHostless FE. This FE has a virtual connection to the BE DAI links on the DAPM graph. Control is then carried out by the FE as regular PCM operations. This method gives more control over the DAI links, but requires much more userspace code to control the link. Its recommended to use CODEC<->CODEC unless your HW needs more fine grained sequencing of the PCM ops. ”h]”hÝ)”}”(hXjHostless FE. This FE has a virtual connection to the BE DAI links on the DAPM graph. Control is then carried out by the FE as regular PCM operations. This method gives more control over the DAI links, but requires much more userspace code to control the link. Its recommended to use CODEC<->CODEC unless your HW needs more fine grained sequencing of the PCM ops.”h]”hXjHostless FE. This FE has a virtual connection to the BE DAI links on the DAPM graph. Control is then carried out by the FE as regular PCM operations. This method gives more control over the DAI links, but requires much more userspace code to control the link. Its recommended to use CODEC<->CODEC unless your HW needs more fine grained sequencing of the PCM ops.”…””}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MQhjµubah}”(h]”h ]”h"]”h$]”h&]”uh1j¹hjšubeh}”(h]”h ]”h"]”h$]”h&]”j9j:j;hj<j=uh1j´hj–ubah}”(h]”h ]”h"]”h$]”h&]”uh1j”h³hÊh´MLhjKh²hubh¶)”}”(hhh]”(h»)”}”(hŒCODEC <-> CODEC link”h]”hŒCODEC <-> CODEC link”…””}”(hjÜh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÙh²hh³hÊh´MYubhÝ)”}”(hŒ™This DAI link is enabled when DAPM detects a valid path within the DAPM graph. The machine driver sets some additional parameters to the DAI link i.e. ::”h]”hŒ–This DAI link is enabled when DAPM detects a valid path within the DAPM graph. The machine driver sets some additional parameters to the DAI link i.e.”…””}”(hjêh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´M[hjÙh²hubj()”}”(hXÑstatic const struct snd_soc_pcm_stream dai_params = { .formats = SNDRV_PCM_FMTBIT_S32_LE, .rate_min = 8000, .rate_max = 8000, .channels_min = 2, .channels_max = 2, }; static struct snd_soc_dai_link dais[] = { < ... more DAI links above ... > { .name = "MODEM", .stream_name = "MODEM", .cpu_dai_name = "dai2", .codec_dai_name = "modem-aif1", .codec_name = "modem", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP, .c2c_params = &dai_params, .num_c2c_params = 1, } < ... more DAI links here ... >”h]”hXÑstatic const struct snd_soc_pcm_stream dai_params = { .formats = SNDRV_PCM_FMTBIT_S32_LE, .rate_min = 8000, .rate_max = 8000, .channels_min = 2, .channels_max = 2, }; static struct snd_soc_dai_link dais[] = { < ... more DAI links above ... > { .name = "MODEM", .stream_name = "MODEM", .cpu_dai_name = "dai2", .codec_dai_name = "modem-aif1", .codec_name = "modem", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBP_CFP, .c2c_params = &dai_params, .num_c2c_params = 1, } < ... more DAI links here ... >”…””}”hjøsbah}”(h]”h ]”h"]”h$]”h&]”j7j8uh1j'h³hÊh´M_hjÙh²hubhÝ)”}”(hŒöThese parameters are used to configure the DAI hw_params() when DAPM detects a valid path and then calls the PCM operations to start the link. DAPM will also call the appropriate PCM operations to disable the DAI when the path is no longer valid.”h]”hŒöThese parameters are used to configure the DAI hw_params() when DAPM detects a valid path and then calls the PCM operations to start the link. DAPM will also call the appropriate PCM operations to disable the DAI when the path is no longer valid.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´MvhjÙh²hubeh}”(h]”Œcodec-codec-link”ah ]”h"]”Œcodec <-> codec link”ah$]”h&]”uh1hµhjKh²hh³hÊh´MYubh¶)”}”(hhh]”(h»)”}”(hŒ Hostless FE”h]”hŒ Hostless FE”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjh²hh³hÊh´M}ubhÝ)”}”(hXJThe DAI link(s) are enabled by a FE that does not read or write any PCM data. This means creating a new FE that is connected with a virtual path to both DAI links. The DAI links will be started when the FE PCM is started and stopped when the FE PCM is stopped. Note that the FE PCM cannot read or write data in this configuration.”h]”hXJThe DAI link(s) are enabled by a FE that does not read or write any PCM data. This means creating a new FE that is connected with a virtual path to both DAI links. The DAI links will be started when the FE PCM is started and stopped when the FE PCM is stopped. Note that the FE PCM cannot read or write data in this configuration.”…””}”(hj-h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜh³hÊh´Mhjh²hubeh}”(h]”Œ hostless-fe”ah ]”h"]”Œ hostless fe”ah$]”h&]”uh1hµhjKh²hh³hÊh´M}ubeh}”(h]”Œhostless-pcm-streams”ah ]”h"]”Œhostless pcm streams”ah$]”h&]”uh1hµhh·h²hh³hÊh´M3ubeh}”(h]”Œ dynamic-pcm”ah ]”h"]”Œ dynamic pcm”ah$]”h&]”uh1hµhhh²hh³hÊh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÊuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hºNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”jvŒerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÊŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(jPjMjYjVjLjIjQjNj^j[j¾j»j!jjVjSjHjEjHjEjjj@j=uŒ nametypes”}”(jP‰jY‰jL‰jQ‰j^‰j¾‰j!‰jV‰jH‰jH‰j‰j@‰uh}”(jMh·jVhËjIjjNjOj[j\j»jÌjjÁjSj$jEjajEjKjjÙj=juŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”(hŒsystem_message”“”)”}”(hhh]”hÝ)”}”(hŒfPossible title underline, too short for the title. Treating it as ordinary text because it's so short.”h]”hŒhPossible title underline, too short for the title. Treating it as ordinary text because it’s so short.”…””}”(hjÝh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÜhjÚubah}”(h]”h ]”h"]”h$]”h&]”Œlevel”KŒtype”ŒINFO”Œline”K<Œsource”hÊuh1jØhjOh²hh³hÊh´K