€•dRŒ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”Œ0/translations/zh_CN/driver-api/soundwire/locking”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/zh_TW/driver-api/soundwire/locking”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/it_IT/driver-api/soundwire/locking”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/ja_JP/driver-api/soundwire/locking”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/ko_KR/driver-api/soundwire/locking”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/pt_BR/driver-api/soundwire/locking”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ0/translations/sp_SP/driver-api/soundwire/locking”Œ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ŒSoundWire Locking”h]”hŒSoundWire Locking”…””}”(hh¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhh·h²hh³ŒJ/var/lib/git/docbuild/linux/Documentation/driver-api/soundwire/locking.rst”h´KubhŒ paragraph”“”)”}”(hŒ This document explains locking mechanism of the SoundWire Bus. Bus uses following locks in order to avoid race conditions in Bus operations on shared resources.”h]”hŒ This document explains locking mechanism of the SoundWire Bus. Bus uses following locks in order to avoid race conditions in Bus operations on shared resources.”…””}”(hhÍh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khh·h²hubhŒ block_quote”“”)”}”(hŒ- Bus lock - Message lock ”h]”hŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ Bus lock ”h]”hÌ)”}”(hŒBus lock”h]”hŒBus lock”…””}”(hhìh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hhèubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhhãubhç)”}”(hŒ Message lock ”h]”hÌ)”}”(hŒ Message lock”h]”hŒ Message lock”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhhãubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ-”uh1háh³hÊh´K hhÝubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛh³hÊh´K hh·h²hubh¶)”}”(hhh]”(h»)”}”(hŒBus lock”h]”hŒBus lock”…””}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj&h²hh³hÊh´KubhÌ)”}”(hŒÑSoundWire Bus lock is a mutex and is part of Bus data structure (sdw_bus) which is used for every Bus instance. This lock is used to serialize each of the following operations(s) within SoundWire Bus instance.”h]”hŒÑSoundWire Bus lock is a mutex and is part of Bus data structure (sdw_bus) which is used for every Bus instance. This lock is used to serialize each of the following operations(s) within SoundWire Bus instance.”…””}”(hj7h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khj&h²hubhÜ)”}”(hŒ- Addition and removal of Slave(s), changing Slave status. - Prepare, Enable, Disable and De-prepare stream operations. - Access of Stream data structure. ”h]”hâ)”}”(hhh]”(hç)”}”(hŒ9Addition and removal of Slave(s), changing Slave status. ”h]”hÌ)”}”(hŒ8Addition and removal of Slave(s), changing Slave status.”h]”hŒ8Addition and removal of Slave(s), changing Slave status.”…””}”(hjPh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KhjLubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjIubhç)”}”(hŒ;Prepare, Enable, Disable and De-prepare stream operations. ”h]”hÌ)”}”(hŒ:Prepare, Enable, Disable and De-prepare stream operations.”h]”hŒ:Prepare, Enable, Disable and De-prepare stream operations.”…””}”(hjhh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khjdubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjIubhç)”}”(hŒ!Access of Stream data structure. ”h]”hÌ)”}”(hŒ Access of Stream data structure.”h]”hŒ Access of Stream data structure.”…””}”(hj€h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khj|ubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjIubeh}”(h]”h ]”h"]”h$]”h&]”jjuh1háh³hÊh´KhjEubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛh³hÊh´Khj&h²hubeh}”(h]”Œbus-lock”ah ]”h"]”Œbus lock”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubh¶)”}”(hhh]”(h»)”}”(hŒ Message lock”h]”hŒ Message lock”…””}”(hj«h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj¨h²hh³hÊh´KubhÌ)”}”(hŒ·SoundWire message transfer lock. This mutex is part of Bus data structure (sdw_bus). This lock is used to serialize the message transfers (read/write) within a SoundWire Bus instance.”h]”hŒ·SoundWire message transfer lock. This mutex is part of Bus data structure (sdw_bus). This lock is used to serialize the message transfers (read/write) within a SoundWire Bus instance.”…””}”(hj¹h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´Khj¨h²hubhÌ)”}”(hŒ+Below examples show how locks are acquired.”h]”hŒ+Below examples show how locks are acquired.”…””}”(hjÇh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K!hj¨h²hubh¶)”}”(hhh]”(h»)”}”(hŒ Example 1”h]”hŒ Example 1”…””}”(hjØh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhjÕh²hh³hÊh´K$ubhÌ)”}”(hŒMessage transfer.”h]”hŒMessage transfer.”…””}”(hjæh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K&hjÕh²hubhÜ)”}”(hXí1. For every message transfer a. Acquire Message lock. b. Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch. c. Release Message lock :: +----------+ +---------+ | | | | | Bus | | Master | | | | Driver | | | | | +----+-----+ +----+----+ | | | bus->ops->xfer_msg() | <-------------------------------+ a. Acquire Message lock | | b. Transfer message | | +-------------------------------> c. Release Message lock | return success/error | d. Return success/error | | + + ”h]”hŒenumerated_list”“”)”}”(hhh]”hç)”}”(hX®For every message transfer a. Acquire Message lock. b. Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch. c. Release Message lock :: +----------+ +---------+ | | | | | Bus | | Master | | | | Driver | | | | | +----+-----+ +----+----+ | | | bus->ops->xfer_msg() | <-------------------------------+ a. Acquire Message lock | | b. Transfer message | | +-------------------------------> c. Release Message lock | return success/error | d. Return success/error | | + + ”h]”(hÌ)”}”(hŒFor every message transfer”h]”hŒFor every message transfer”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K(hjýubjù)”}”(hhh]”(hç)”}”(hŒAcquire Message lock. ”h]”hÌ)”}”(hŒAcquire Message lock.”h]”hŒAcquire Message lock.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K*hjubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjubhç)”}”(hŒ\Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch. ”h]”hÌ)”}”(hŒ[Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch.”h]”hŒ[Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch.”…””}”(hj.h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K,hj*ubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjubhç)”}”(hŒRelease Message lock ”h]”hÌ)”}”(hŒRelease Message lock”h]”hŒRelease Message lock”…””}”(hjFh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´K/hjBubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjubeh}”(h]”h ]”h"]”h$]”h&]”Œenumtype”Œ loweralpha”Œprefix”hŒsuffix”Œ.”uh1jøhjýubhŒ literal_block”“”)”}”(hXÊ+----------+ +---------+ | | | | | Bus | | Master | | | | Driver | | | | | +----+-----+ +----+----+ | | | bus->ops->xfer_msg() | <-------------------------------+ a. Acquire Message lock | | b. Transfer message | | +-------------------------------> c. Release Message lock | return success/error | d. Return success/error | | + +”h]”hXÊ+----------+ +---------+ | | | | | Bus | | Master | | | | Driver | | | | | +----+-----+ +----+----+ | | | bus->ops->xfer_msg() | <-------------------------------+ a. Acquire Message lock | | b. Transfer message | | +-------------------------------> c. Release Message lock | return success/error | d. Return success/error | | + +”…””}”hjgsbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1jeh³hÊh´K3hjýubeh}”(h]”h ]”h"]”h$]”h&]”uh1hæhjúubah}”(h]”h ]”h"]”h$]”h&]”j`Œarabic”jbhjcjduh1jøhjôubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛh³hÊh´K(hjÕh²hubeh}”(h]”Œ example-1”ah ]”h"]”Œ example 1”ah$]”h&]”uh1hµhj¨h²hh³hÊh´K$ubh¶)”}”(hhh]”(h»)”}”(hŒ Example 2”h]”hŒ Example 2”…””}”(hj•h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hºhj’h²hh³hÊh´KDubhÌ)”}”(hŒPrepare operation.”h]”hŒPrepare operation.”…””}”(hj£h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KFhj’h²hubhÜ)”}”(hXl1. Acquire lock for Bus instance associated with Master 1. 2. For every message transfer in Prepare operation a. Acquire Message lock. b. Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch. c. Release Message lock. 3. Release lock for Bus instance associated with Master 1 :: +----------+ +---------+ | | | | | Bus | | Master | | | | Driver | | | | | +----+-----+ +----+----+ | | | sdw_prepare_stream() | <-------------------------------+ 1. Acquire bus lock | | 2. Perform stream prepare | | | | | bus->ops->xfer_msg() | <-------------------------------+ a. Acquire Message lock | | b. Transfer message | | +-------------------------------> c. Release Message lock | return success/error | d. Return success/error | | | | | return success/error | 3. Release bus lock +-------------------------------> 4. Return success/error | | + +”h]”jù)”}”(hhh]”(hç)”}”(hŒ8Acquire lock for Bus instance associated with Master 1. ”h]”hÌ)”}”(hŒ7Acquire lock for Bus instance associated with Master 1.”h]”hŒ7Acquire lock for Bus instance associated with Master 1.”…””}”(hj¼h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KHhj¸ubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjµubhç)”}”(hŒÇFor every message transfer in Prepare operation a. Acquire Message lock. b. Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch. c. Release Message lock. ”h]”(hÌ)”}”(hŒ/For every message transfer in Prepare operation”h]”hŒ/For every message transfer in Prepare operation”…””}”(hjÔh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KJhjÐubjù)”}”(hhh]”(hç)”}”(hŒAcquire Message lock. ”h]”hÌ)”}”(hŒAcquire Message lock.”h]”hŒAcquire Message lock.”…””}”(hjéh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KLhjåubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjâubhç)”}”(hŒ\Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch. ”h]”hÌ)”}”(hŒ[Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch.”h]”hŒ[Transfer message (Read/Write) to Slave1 or broadcast message on Bus in case of bank switch.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KNhjýubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjâubhç)”}”(hŒRelease Message lock. ”h]”hÌ)”}”(hŒRelease Message lock.”h]”hŒRelease Message lock.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KQhjubah}”(h]”h ]”h"]”h$]”h&]”uh1hæhjâubeh}”(h]”h ]”h"]”h$]”h&]”j`jajbhjcjduh1jøhjÐubeh}”(h]”h ]”h"]”h$]”h&]”uh1hæhjµubhç)”}”(hXRelease lock for Bus instance associated with Master 1 :: +----------+ +---------+ | | | | | Bus | | Master | | | | Driver | | | | | +----+-----+ +----+----+ | | | sdw_prepare_stream() | <-------------------------------+ 1. Acquire bus lock | | 2. Perform stream prepare | | | | | bus->ops->xfer_msg() | <-------------------------------+ a. Acquire Message lock | | b. Transfer message | | +-------------------------------> c. Release Message lock | return success/error | d. Return success/error | | | | | return success/error | 3. Release bus lock +-------------------------------> 4. Return success/error | | + +”h]”(hÌ)”}”(hŒ9Release lock for Bus instance associated with Master 1 ::”h]”hŒ6Release lock for Bus instance associated with Master 1”…””}”(hj=h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hËh³hÊh´KShj9ubjf)”}”(hX‹+----------+ +---------+ | | | | | Bus | | Master | | | | Driver | | | | | +----+-----+ +----+----+ | | | sdw_prepare_stream() | <-------------------------------+ 1. Acquire bus lock | | 2. Perform stream prepare | | | | | bus->ops->xfer_msg() | <-------------------------------+ a. Acquire Message lock | | b. Transfer message | | +-------------------------------> c. Release Message lock | return success/error | d. Return success/error | | | | | return success/error | 3. Release bus lock +-------------------------------> 4. Return success/error | | + +”h]”hX‹+----------+ +---------+ | | | | | Bus | | Master | | | | Driver | | | | | +----+-----+ +----+----+ | | | sdw_prepare_stream() | <-------------------------------+ 1. Acquire bus lock | | 2. Perform stream prepare | | | | | bus->ops->xfer_msg() | <-------------------------------+ a. Acquire Message lock | | b. Transfer message | | +-------------------------------> c. Release Message lock | return success/error | d. Return success/error | | | | | return success/error | 3. Release bus lock +-------------------------------> 4. Return success/error | | + +”…””}”hjKsbah}”(h]”h ]”h"]”h$]”h&]”jujvuh1jeh³hÊh´KUhj9ubeh}”(h]”h ]”h"]”h$]”h&]”uh1hæhjµubeh}”(h]”h ]”h"]”h$]”h&]”j`jƒjbhjcjduh1jøhj±ubah}”(h]”h ]”h"]”h$]”h&]”uh1hÛh³hÊh´KHhj’h²hubeh}”(h]”Œ example-2”ah ]”h"]”Œ example 2”ah$]”h&]”uh1hµhj¨h²hh³hÊh´KDubeh}”(h]”Œ message-lock”ah ]”h"]”Œ message lock”ah$]”h&]”uh1hµhh·h²hh³hÊh´Kubeh}”(h]”Œsoundwire-locking”ah ]”h"]”Œsoundwire locking”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”}”(j€j}j¥j¢jxjujjŒjpjmuŒ nametypes”}”(j€‰j¥‰jx‰j‰jp‰uh}”(j}h·j¢j&juj¨jŒjÕjmj’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.