€•Ø>Œ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/machine”Œ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/machine”Œ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/machine”Œ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/machine”Œ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/machine”Œ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/machine”Œ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/machine”Œ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ŒASoC Machine Driver”h]”hŒASoC Machine Driver”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³Œ?/var/lib/git/docbuild/linux/Documentation/sound/soc/machine.rst”h´KubhŒ paragraph”“”)”}”(hXThe ASoC machine (or board) driver is the code that glues together all the component drivers (e.g. codecs, platforms and DAIs). It also describes the relationships between each component which include audio paths, GPIOs, interrupts, clocking, jacks and voltage regulators.”h]”hXThe ASoC machine (or board) driver is the code that glues together all the component drivers (e.g. codecs, platforms and DAIs). It also describes the relationships between each component which include audio paths, GPIOs, interrupts, clocking, jacks and voltage regulators.”…””}”(hhÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhÌ)”}”(hŒ¶The machine driver can contain codec and platform specific code. It registers the audio subsystem with the kernel as a platform device and is represented by the following struct:- ::”h]”hŒ³The machine driver can contain codec and platform specific code. It registers the audio subsystem with the kernel as a platform device and is represented by the following struct:-”…””}”(hhÛh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hh·h²hubhŒ literal_block”“”)”}”(hX³/* SoC machine */ struct snd_soc_card { char *name; ... int (*probe)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev); /* the pre and post PM functions are used to do any PM work before and * after the codec and DAIs do any PM work. */ int (*suspend_pre)(struct platform_device *pdev, pm_message_t state); int (*suspend_post)(struct platform_device *pdev, pm_message_t state); int (*resume_pre)(struct platform_device *pdev); int (*resume_post)(struct platform_device *pdev); ... /* CPU <--> Codec DAI links */ struct snd_soc_dai_link *dai_link; int num_links; ... };”h]”hX³/* SoC machine */ struct snd_soc_card { char *name; ... int (*probe)(struct platform_device *pdev); int (*remove)(struct platform_device *pdev); /* the pre and post PM functions are used to do any PM work before and * after the codec and DAIs do any PM work. */ int (*suspend_pre)(struct platform_device *pdev, pm_message_t state); int (*suspend_post)(struct platform_device *pdev, pm_message_t state); int (*resume_pre)(struct platform_device *pdev); int (*resume_post)(struct platform_device *pdev); ... /* CPU <--> Codec DAI links */ struct snd_soc_dai_link *dai_link; int num_links; ... };”…””}”hhësbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1héh³hÊh´Khh·h²hubh¶)”}”(hhh]”(h»)”}”(hŒprobe()/remove()”h]”hŒprobe()/remove()”…””}”(hhþh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhhûh²hh³hÊh´K)ubhÌ)”}”(hŒ>probe/remove are optional. Do any machine specific probe here.”h]”hŒ>probe/remove are optional. Do any machine specific probe here.”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K*hhûh²hubeh}”(h]”Œ probe-remove”ah ]”h"]”Œprobe()/remove()”ah$]”h&]”uh1hµhh·h²hh³hÊh´K)ubh¶)”}”(hhh]”(h»)”}”(hŒsuspend()/resume()”h]”hŒsuspend()/resume()”…””}”(hj%h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj"h²hh³hÊh´K.ubhÌ)”}”(hŒËThe machine driver has pre and post versions of suspend and resume to take care of any machine audio tasks that have to be done before or after the codec, DAIs and DMA is suspended and resumed. Optional.”h]”hŒËThe machine driver has pre and post versions of suspend and resume to take care of any machine audio tasks that have to be done before or after the codec, DAIs and DMA is suspended and resumed. Optional.”…””}”(hj3h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K/hj"h²hubeh}”(h]”Œsuspend-resume”ah ]”h"]”Œsuspend()/resume()”ah$]”h&]”uh1hµhh·h²hh³hÊh´K.ubh¶)”}”(hhh]”(h»)”}”(hŒMachine DAI Configuration”h]”hŒMachine DAI Configuration”…””}”(hjLh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjIh²hh³hÊh´K5ubhÌ)”}”(hXThe machine DAI configuration glues all the codec and CPU DAIs together. It can also be used to set up the DAI system clock and for any machine related DAI initialisation e.g. the machine audio map can be connected to the codec audio map, unconnected codec pins can be set as such.”h]”hXThe machine DAI configuration glues all the codec and CPU DAIs together. It can also be used to set up the DAI system clock and for any machine related DAI initialisation e.g. the machine audio map can be connected to the codec audio map, unconnected codec pins can be set as such.”…””}”(hjZh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K6hjIh²hubhÌ)”}”(hŒKstruct snd_soc_dai_link is used to set up each DAI in your machine. e.g. ::”h]”hŒHstruct snd_soc_dai_link is used to set up each DAI in your machine. e.g.”…””}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K;hjIh²hubhê)”}”(hX‚/* corgi digital audio interface glue - connects codec <--> CPU */ static struct snd_soc_dai_link corgi_dai = { .name = "WM8731", .stream_name = "WM8731", .cpu_dai_name = "pxa-is2-dai", .codec_dai_name = "wm8731-hifi", .platform_name = "pxa-pcm-audio", .codec_name = "wm8713-codec.0-001a", .init = corgi_wm8731_init, .ops = &corgi_ops, };”h]”hX‚/* corgi digital audio interface glue - connects codec <--> CPU */ static struct snd_soc_dai_link corgi_dai = { .name = "WM8731", .stream_name = "WM8731", .cpu_dai_name = "pxa-is2-dai", .codec_dai_name = "wm8731-hifi", .platform_name = "pxa-pcm-audio", .codec_name = "wm8713-codec.0-001a", .init = corgi_wm8731_init, .ops = &corgi_ops, };”…””}”hjvsbah}”(h]”h ]”h"]”h$]”h&]”hùhúuh1héh³hÊh´K>hjIh²hubhÌ)”}”(hŒÇIn the above struct, dai’s are registered using names but you can pass either dai name or device tree node but not both. Also, names used here for cpu/codec/platform dais should be globally unique.”h]”hŒÇIn the above struct, dai’s are registered using names but you can pass either dai name or device tree node but not both. Also, names used here for cpu/codec/platform dais should be globally unique.”…””}”(hj„h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KJhjIh²hubhÌ)”}”(hŒVAdditionally below example macro can be used to register cpu, codec and platform dai::”h]”hŒUAdditionally below example macro can be used to register cpu, codec and platform dai:”…””}”(hj’h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KNhjIh²hubhê)”}”(hŒÓSND_SOC_DAILINK_DEFS(wm2200_cpu_dsp, DAILINK_COMP_ARRAY(COMP_CPU("samsung-i2s.0")), DAILINK_COMP_ARRAY(COMP_CODEC("spi0.0", "wm0010-sdi1")), DAILINK_COMP_ARRAY(COMP_PLATFORM("samsung-i2s.0")));”h]”hŒÓSND_SOC_DAILINK_DEFS(wm2200_cpu_dsp, DAILINK_COMP_ARRAY(COMP_CPU("samsung-i2s.0")), DAILINK_COMP_ARRAY(COMP_CODEC("spi0.0", "wm0010-sdi1")), DAILINK_COMP_ARRAY(COMP_PLATFORM("samsung-i2s.0")));”…””}”hj sbah}”(h]”h ]”h"]”h$]”h&]”hùhúuh1héh³hÊh´KQhjIh²hubhÌ)”}”(hŒCstruct snd_soc_card then sets up the machine with its DAIs. e.g. ::”h]”hŒ@struct snd_soc_card then sets up the machine with its DAIs. e.g.”…””}”(hj®h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KVhjIh²hubhê)”}”(hŒ›/* corgi audio machine driver */ static struct snd_soc_card snd_soc_corgi = { .name = "Corgi", .dai_link = &corgi_dai, .num_links = 1, };”h]”hŒ›/* corgi audio machine driver */ static struct snd_soc_card snd_soc_corgi = { .name = "Corgi", .dai_link = &corgi_dai, .num_links = 1, };”…””}”hj¼sbah}”(h]”h ]”h"]”h$]”h&]”hùhúuh1héh³hÊh´KYhjIh²hubhÌ)”}”(hX Following this, ``devm_snd_soc_register_card`` can be used to register the sound card. During the registration, the individual components such as the codec, CPU, and platform are probed. If all these components are successfully probed, the sound card gets registered.”h]”(hŒFollowing this, ”…””}”(hjÊh²hh³Nh´NubhŒliteral”“”)”}”(hŒ``devm_snd_soc_register_card``”h]”hŒdevm_snd_soc_register_card”…””}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1jÒhjÊubhŒÝ can be used to register the sound card. During the registration, the individual components such as the codec, CPU, and platform are probed. If all these components are successfully probed, the sound card gets registered.”…””}”(hjÊh²hh³Nh´Nubeh}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K`hjIh²hubeh}”(h]”Œmachine-dai-configuration”ah ]”h"]”Œmachine dai configuration”ah$]”h&]”uh1hµhh·h²hh³hÊh´K5ubh¶)”}”(hhh]”(h»)”}”(hŒMachine Power Map”h]”hŒMachine Power Map”…””}”(hj÷h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjôh²hh³hÊh´KfubhÌ)”}”(hXThe machine driver can optionally extend the codec power map and to become an audio power map of the audio subsystem. This allows for automatic power up/down of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack sockets in the machine init function.”h]”hXThe machine driver can optionally extend the codec power map and to become an audio power map of the audio subsystem. This allows for automatic power up/down of speaker/HP amplifiers, etc. Codec pins can be connected to the machines jack sockets in the machine init function.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khhjôh²hubeh}”(h]”Œmachine-power-map”ah ]”h"]”Œmachine power map”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kfubh¶)”}”(hhh]”(h»)”}”(hŒMachine Controls”h]”hŒMachine Controls”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjh²hh³hÊh´KoubhÌ)”}”(hŒLMachine specific audio mixer controls can be added in the DAI init function.”h]”hŒLMachine specific audio mixer controls can be added in the DAI init function.”…””}”(hj,h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Kqhjh²hubeh}”(h]”Œmachine-controls”ah ]”h"]”Œmachine controls”ah$]”h&]”uh1hµhh·h²hh³hÊh´Koubh¶)”}”(hhh]”(h»)”}”(hŒClocking Controls”h]”hŒClocking Controls”…””}”(hjEh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjBh²hh³hÊh´KuubhÌ)”}”(hXoAs previously noted, clock configuration is handled within the machine driver. For details on the clock APIs that the machine driver can utilize for setup, please refer to Documentation/sound/soc/clocking.rst. However, the callback needs to be registered by the CPU/Codec/Platform drivers to configure the clocks that is needed for the corresponding device operation.”h]”hXoAs previously noted, clock configuration is handled within the machine driver. For details on the clock APIs that the machine driver can utilize for setup, please refer to Documentation/sound/soc/clocking.rst. However, the callback needs to be registered by the CPU/Codec/Platform drivers to configure the clocks that is needed for the corresponding device operation.”…””}”(hjSh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KwhjBh²hubeh}”(h]”Œclocking-controls”ah ]”h"]”Œclocking controls”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kuubeh}”(h]”Œasoc-machine-driver”ah ]”h"]”Œasoc machine driver”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”j”Œ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”}”(jnjkjjjFjCjñjîjjj?j<jfjcuŒ nametypes”}”(jn‰j‰jF‰jñ‰j‰j?‰jf‰uh}”(jkh·jhûjCj"jîjIjjôj<jjcjBuŒ 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öhjIh²hh³hÊh´K