€•èMŒ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/cards/pcmtest”Œ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/cards/pcmtest”Œ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/cards/pcmtest”Œ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/cards/pcmtest”Œ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/cards/pcmtest”Œ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/cards/pcmtest”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh£sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1h¡hhhžhhŸŒA/var/lib/git/docbuild/linux/Documentation/sound/cards/pcmtest.rst”h KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒThe Virtual PCM Test Driver”h]”hŒThe Virtual PCM Test Driver”…””}”(hh»hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hh¶hžhhŸh³h KubhŒ paragraph”“”)”}”(hXThe Virtual PCM Test Driver emulates a generic PCM device, and can be used for testing/fuzzing of the userspace ALSA applications, as well as for testing/fuzzing of the PCM middle layer. Additionally, it can be used for simulating hard to reproduce problems with PCM devices.”h]”hXThe Virtual PCM Test Driver emulates a generic PCM device, and can be used for testing/fuzzing of the userspace ALSA applications, as well as for testing/fuzzing of the PCM middle layer. Additionally, it can be used for simulating hard to reproduce problems with PCM devices.”…””}”(hhËhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khh¶hžhubhµ)”}”(hhh]”(hº)”}”(hŒWhat can this driver do?”h]”hŒWhat can this driver do?”…””}”(hhÜhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hhÙhžhhŸh³h K ubhŒdefinition_list”“”)”}”(hhh]”hŒdefinition_list_item”“”)”}”(hŒûAt this moment the driver can do the following things: * Simulate both capture and playback processes * Generate random or pattern-based capturing data * Inject delays into the playback and capturing processes * Inject errors during the PCM callbacks ”h]”(hŒterm”“”)”}”(hŒ6At this moment the driver can do the following things:”h]”hŒ6At this moment the driver can do the following things:”…””}”(hh÷hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hõhŸh³h KhhñubhŒ definition”“”)”}”(hhh]”hŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ,Simulate both capture and playback processes”h]”hÊ)”}”(hjh]”hŒ,Simulate both capture and playback processes”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubj)”}”(hŒ/Generate random or pattern-based capturing data”h]”hÊ)”}”(hj*h]”hŒ/Generate random or pattern-based capturing data”…””}”(hj,hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khj(ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubj)”}”(hŒ7Inject delays into the playback and capturing processes”h]”hÊ)”}”(hjAh]”hŒ7Inject delays into the playback and capturing processes”…””}”(hjChžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khj?ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubj)”}”(hŒ'Inject errors during the PCM callbacks ”h]”hÊ)”}”(hŒ&Inject errors during the PCM callbacks”h]”hŒ&Inject errors during the PCM callbacks”…””}”(hjZhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhjVubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj ubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1j hŸh³h Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhhñubeh}”(h]”h ]”h"]”h$]”h&]”uh1hïhŸh³h Khhìubah}”(h]”h ]”h"]”h$]”h&]”uh1hêhhÙhžhhŸNh NubhÊ)”}”(hŒrIt supports up to 8 substreams and 4 channels. Also it supports both interleaved and non-interleaved access modes.”h]”hŒrIt supports up to 8 substreams and 4 channels. Also it supports both interleaved and non-interleaved access modes.”…””}”(hjˆhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhhÙhžhubhÊ)”}”(hXQAlso, this driver can check the playback stream for containing the predefined pattern, which is used in the corresponding selftest (alsa/pcmtest-test.sh) to check the PCM middle layer data transferring functionality. Additionally, this driver redefines the default RESET ioctl, and the selftest covers this PCM API functionality as well.”h]”hXQAlso, this driver can check the playback stream for containing the predefined pattern, which is used in the corresponding selftest (alsa/pcmtest-test.sh) to check the PCM middle layer data transferring functionality. Additionally, this driver redefines the default RESET ioctl, and the selftest covers this PCM API functionality as well.”…””}”(hj–hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KhhÙhžhubhµ)”}”(hhh]”(hº)”}”(hŒ Configuration”h]”hŒ Configuration”…””}”(hj§hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj¤hžhhŸh³h KubhÊ)”}”(hŒLThe driver has several parameters besides the common ALSA module parameters:”h]”hŒLThe driver has several parameters besides the common ALSA module parameters:”…””}”(hjµhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Khj¤hžhubhŒ block_quote”“”)”}”(hŒ›* fill_mode (bool) - Buffer fill mode (see below) * inject_delay (int) * inject_hwpars_err (bool) * inject_prepare_err (bool) * inject_trigger_err (bool) ”h]”j )”}”(hhh]”(j)”}”(hŒ/fill_mode (bool) - Buffer fill mode (see below)”h]”hÊ)”}”(hjÎh]”hŒ/fill_mode (bool) - Buffer fill mode (see below)”…””}”(hjÐhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K!hjÌubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉubj)”}”(hŒinject_delay (int)”h]”hÊ)”}”(hjåh]”hŒinject_delay (int)”…””}”(hjçhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K"hjãubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉubj)”}”(hŒinject_hwpars_err (bool)”h]”hÊ)”}”(hjüh]”hŒinject_hwpars_err (bool)”…””}”(hjþhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K#hjúubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉubj)”}”(hŒinject_prepare_err (bool)”h]”hÊ)”}”(hjh]”hŒinject_prepare_err (bool)”…””}”(hjhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K$hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉubj)”}”(hŒinject_trigger_err (bool) ”h]”hÊ)”}”(hŒinject_trigger_err (bool)”h]”hŒinject_trigger_err (bool)”…””}”(hj,hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K%hj(ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjÉubeh}”(h]”h ]”h"]”h$]”h&]”jtjuuh1j hŸh³h K!hjÅubah}”(h]”h ]”h"]”h$]”h&]”uh1jÃhŸh³h K!hj¤hžhubeh}”(h]”Œ configuration”ah ]”h"]”Œ configuration”ah$]”h&]”uh1h´hhÙhžhhŸh³h Kubhµ)”}”(hhh]”(hº)”}”(hŒCapture Data Generation”h]”hŒCapture Data Generation”…””}”(hjWhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjThžhhŸh³h K)ubhÊ)”}”(hŒÓThe driver has two modes of data generation: the first (0 in the fill_mode parameter) means random data generation, the second (1 in the fill_mode) - pattern-based data generation. Let's look at the second mode.”h]”hŒÕThe driver has two modes of data generation: the first (0 in the fill_mode parameter) means random data generation, the second (1 in the fill_mode) - pattern-based data generation. Let’s look at the second mode.”…””}”(hjehžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K+hjThžhubhÊ)”}”(hŒ÷First of all, you may want to specify the pattern for data generation. You can do it by writing the pattern to the debugfs file. There are pattern buffer debugfs entries for each channel, as well as entries which contain the pattern buffer length.”h]”hŒ÷First of all, you may want to specify the pattern for data generation. You can do it by writing the pattern to the debugfs file. There are pattern buffer debugfs entries for each channel, as well as entries which contain the pattern buffer length.”…””}”(hjshžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K/hjThžhubjÄ)”}”(hŒ`* /sys/kernel/debug/pcmtest/fill_pattern[0-3] * /sys/kernel/debug/pcmtest/fill_pattern[0-3]_len ”h]”j )”}”(hhh]”(j)”}”(hŒ+/sys/kernel/debug/pcmtest/fill_pattern[0-3]”h]”hÊ)”}”(hjŠh]”hŒ+/sys/kernel/debug/pcmtest/fill_pattern[0-3]”…””}”(hjŒhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K3hjˆubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj…ubj)”}”(hŒ0/sys/kernel/debug/pcmtest/fill_pattern[0-3]_len ”h]”hÊ)”}”(hŒ//sys/kernel/debug/pcmtest/fill_pattern[0-3]_len”h]”hŒ//sys/kernel/debug/pcmtest/fill_pattern[0-3]_len”…””}”(hj£hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K4hjŸubah}”(h]”h ]”h"]”h$]”h&]”uh1jhj…ubeh}”(h]”h ]”h"]”h$]”h&]”jtjuuh1j hŸh³h K3hjubah}”(h]”h ]”h"]”h$]”h&]”uh1jÃhŸh³h K3hjThžhubhÊ)”}”(hŒKTo set the pattern for the channel 0 you can execute the following command:”h]”hŒKTo set the pattern for the channel 0 you can execute the following command:”…””}”(hjÃhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K6hjThžhubhŒ literal_block”“”)”}”(hŒ?echo -n mycoolpattern > /sys/kernel/debug/pcmtest/fill_pattern0”h]”hŒ?echo -n mycoolpattern > /sys/kernel/debug/pcmtest/fill_pattern0”…””}”hjÓsbah}”(h]”h ]”h"]”h$]”h&]”h±h²Œforce”‰Œlanguage”Œbash”Œhighlight_args”}”uh1jÑhŸh³h K8hjThžhubhÊ)”}”(hŒœThen, after every capture action performed on the 'pcmtest' device the buffer for the channel 0 will contain 'mycoolpatternmycoolpatternmycoolpatternmy...'.”h]”hŒ¤Then, after every capture action performed on the ‘pcmtest’ device the buffer for the channel 0 will contain ‘mycoolpatternmycoolpatternmycoolpatternmy...’.”…””}”(hjæhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K /sys/module/snd_pcmtest/parameters/inject_hwpars_err”h]”hŒ=echo 1 > /sys/module/snd_pcmtest/parameters/inject_hwpars_err”…””}”hjzsbah}”(h]”h ]”h"]”h$]”h&]”h±h²já‰jâŒbash”jä}”uh1jÑhŸh³h KZhjMhžhubhÊ)”}”(hŒ8Errors can be injected into the following PCM callbacks:”h]”hŒ8Errors can be injected into the following PCM callbacks:”…””}”(hjŠhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K^hjMhžhubjÄ)”}”(hŒ:* hw_params (EBUSY) * prepare (EINVAL) * trigger (EINVAL) ”h]”j )”}”(hhh]”(j)”}”(hŒhw_params (EBUSY)”h]”hÊ)”}”(hj¡h]”hŒhw_params (EBUSY)”…””}”(hj£hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h K`hjŸubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjœubj)”}”(hŒprepare (EINVAL)”h]”hÊ)”}”(hj¸h]”hŒprepare (EINVAL)”…””}”(hjºhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Kahj¶ubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjœubj)”}”(hŒtrigger (EINVAL) ”h]”hÊ)”}”(hŒtrigger (EINVAL)”h]”hŒtrigger (EINVAL)”…””}”(hjÑhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h KbhjÍubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjœubeh}”(h]”h ]”h"]”h$]”h&]”jtjuuh1j hŸh³h K`hj˜ubah}”(h]”h ]”h"]”h$]”h&]”uh1jÃhŸh³h K`hjMhžhubeh}”(h]”Œerrors-injection”ah ]”h"]”Œerrors injection”ah$]”h&]”uh1h´hhÙhžhhŸh³h KQubhµ)”}”(hhh]”(hº)”}”(hŒ Playback test”h]”hŒ Playback test”…””}”(hjühžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hjùhžhhŸh³h KeubhÊ)”}”(hXªThis driver can be also used for the playback functionality testing - every time you write the playback data to the 'pcmtest' PCM device and close it, the driver checks the buffer for containing the looped pattern (which is specified in the fill_pattern debugfs file for each channel). If the playback buffer content represents the looped pattern, 'pc_test' debugfs entry is set into '1'. Otherwise, the driver sets it to '0'.”h]”hXºThis driver can be also used for the playback functionality testing - every time you write the playback data to the ‘pcmtest’ PCM device and close it, the driver checks the buffer for containing the looped pattern (which is specified in the fill_pattern debugfs file for each channel). If the playback buffer content represents the looped pattern, ‘pc_test’ debugfs entry is set into ‘1’. Otherwise, the driver sets it to ‘0’.”…””}”(hj hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Kghjùhžhubeh}”(h]”Œ playback-test”ah ]”h"]”Œ playback test”ah$]”h&]”uh1h´hhÙhžhhŸh³h Keubhµ)”}”(hhh]”(hº)”}”(hŒioctl redefinition test”h]”hŒioctl redefinition test”…””}”(hj#hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1h¹hj hžhhŸh³h KnubhÊ)”}”(hŒ²The driver redefines the 'reset' ioctl, which is default for all PCM devices. To test this functionality, we can trigger the reset ioctl and check the 'ioctl_test' debugfs entry:”h]”hŒºThe driver redefines the ‘reset’ ioctl, which is default for all PCM devices. To test this functionality, we can trigger the reset ioctl and check the ‘ioctl_test’ debugfs entry:”…””}”(hj1hžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Kphj hžhubjÒ)”}”(hŒ(cat /sys/kernel/debug/pcmtest/ioctl_test”h]”hŒ(cat /sys/kernel/debug/pcmtest/ioctl_test”…””}”hj?sbah}”(h]”h ]”h"]”h$]”h&]”h±h²já‰jâŒbash”jä}”uh1jÑhŸh³h Kthj hžhubhÊ)”}”(hŒVIf the ioctl is triggered successfully, this file will contain '1', and '0' otherwise.”h]”hŒ^If the ioctl is triggered successfully, this file will contain ‘1’, and ‘0’ otherwise.”…””}”(hjOhžhhŸNh Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÉhŸh³h Kxhj hžhubeh}”(h]”Œioctl-redefinition-test”ah ]”h"]”Œioctl redefinition test”ah$]”h&]”uh1h´hhÙhžhhŸh³h Knubeh}”(h]”Œwhat-can-this-driver-do”ah ]”h"]”Œwhat can this driver do?”ah$]”h&]”uh1h´hh¶hžhhŸh³h K ubeh}”(h]”Œthe-virtual-pcm-test-driver”ah ]”h"]”Œthe virtual pcm test 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”}”(jrjojjjgjQjNjjjJjGjöjójjjbj_uŒ nametypes”}”(jr‰jj‰jQ‰j‰jJ‰jö‰j‰jb‰uh}”(joh¶jghÙjNj¤jjTjGj jójMjjùj_j 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”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nhžhub.