€•>Œ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Œ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.”…””}”(hhø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()”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hjhž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.”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K/hjhž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”…””}”(hj8hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj5hž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.”…””}”(hjFhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K6hj5hž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.”…””}”(hjThžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h K;hj5hž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, };”…””}”hjbsbah}”(h]”h ]”h"]”h$]”h&]”håhæuh1hÕhŸh¶h K>hj5hž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.”…””}”(hjphžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h KJhj5hž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 KNhj5hž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 KQhj5hž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 KVhj5hž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 KYhj5hž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`hj5hž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.”…””}”(hjñhž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”…””}”(hj hž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.”…””}”(hjhž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”…””}”(hj1hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¦hj.hž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.”…””}”(hj?hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h·hŸh¶h Kwhj.hž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”}”(jZjWj jj2j/jÝjÚjjj+j(jRjOuŒ nametypes”}”(jZ‰j ‰j2‰j݉j‰j+‰jR‰uh}”(jWh£jhçj/jjÚj5jjàj(jjOj.uŒ 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âhj5hžhhŸh¶h K