jsphinx.addnodesdocument)}( rawsourcechildren]( translations LanguagesNode)}(hhh](h pending_xref)}(hhh]docutils.nodesTextChinese (Simplified)}parenthsba attributes}(ids]classes]names]dupnames]backrefs] refdomainstdreftypedoc reftarget&/translations/zh_CN/sound/soc/clockingmodnameN classnameN refexplicitutagnamehhh ubh)}(hhh]hChinese (Traditional)}hh2sbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/zh_TW/sound/soc/clockingmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hItalian}hhFsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/it_IT/sound/soc/clockingmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hJapanese}hhZsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/ja_JP/sound/soc/clockingmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hKorean}hhnsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/ko_KR/sound/soc/clockingmodnameN classnameN refexplicituh1hhh ubh)}(hhh]hSpanish}hhsbah}(h]h ]h"]h$]h&] refdomainh)reftypeh+ reftarget&/translations/sp_SP/sound/soc/clockingmodnameN classnameN refexplicituh1hhh ubeh}(h]h ]h"]h$]h&]current_languageEnglishuh1h hh _documenthsourceNlineNubhsection)}(hhh](htitle)}(hAudio Clockingh]hAudio Clocking}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhh@/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking.rsthKubh paragraph)}(hwThis text describes the audio clocking terms in ASoC and digital audio in general. Note: Audio clocking can be complex!h]hwThis text describes the audio clocking terms in ASoC and digital audio in general. Note: Audio clocking can be complex!}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hhh](h)}(h Master Clockh]h Master Clock}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhK ubh)}(hXEvery audio subsystem is driven by a master clock (sometimes referred to as MCLK or SYSCLK). This audio master clock can be derived from a number of sources (e.g. crystal, PLL, CPU clock) and is responsible for producing the correct audio playback and capture sample rates.h]hXEvery audio subsystem is driven by a master clock (sometimes referred to as MCLK or SYSCLK). This audio master clock can be derived from a number of sources (e.g. crystal, PLL, CPU clock) and is responsible for producing the correct audio playback and capture sample rates.}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh)}(hSome master clocks (e.g. PLLs and CPU based clocks) are configurable in that their speed can be altered by software (depending on the system use and to save power). Other master clocks are fixed at a set frequency (i.e. crystals).h]hSome master clocks (e.g. PLLs and CPU based clocks) are configurable in that their speed can be altered by software (depending on the system use and to save power). Other master clocks are fixed at a set frequency (i.e. crystals).}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubeh}(h] master-clockah ]h"] master clockah$]h&]uh1hhhhhhhhK ubh)}(hhh](h)}(h DAI Clocksh]h DAI Clocks}(hhhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhhhhhKubh)}(hThe Digital Audio Interface is usually driven by a Bit Clock (often referred to as BCLK). This clock is used to drive the digital audio data across the link between the codec and CPU.h]hThe Digital Audio Interface is usually driven by a Bit Clock (often referred to as BCLK). This clock is used to drive the digital audio data across the link between the codec and CPU.}(hj hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(hThe DAI also has a frame clock to signal the start of each audio frame. This clock is sometimes referred to as LRC (left right clock) or FRAME. This clock runs at exactly the sample rate (LRC = Rate).h]hThe DAI also has a frame clock to signal the start of each audio frame. This clock is sometimes referred to as LRC (left right clock) or FRAME. This clock runs at exactly the sample rate (LRC = Rate).}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhKhhhhubh)}(h'Bit Clock can be generated as follows:-h]h'Bit Clock can be generated as follows:-}(hj)hhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK hhhhubh bullet_list)}(hhh](h list_item)}(hBCLK = MCLK / x, orh]h)}(hj@h]hBCLK = MCLK / x, or}(hjBhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK"hj>ubah}(h]h ]h"]h$]h&]uh1j<hj9hhhhhNubj=)}(hBCLK = LRC * x, orh]h)}(hjWh]hBCLK = LRC * x, or}(hjYhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK#hjUubah}(h]h ]h"]h$]h&]uh1j<hj9hhhhhNubj=)}(h"BCLK = LRC * Channels * Word Size h]h)}(h!BCLK = LRC * Channels * Word Sizeh]h!BCLK = LRC * Channels * Word Size}(hjphhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK$hjlubah}(h]h ]h"]h$]h&]uh1j<hj9hhhhhNubeh}(h]h ]h"]h$]h&]bullet-uh1j7hhhK"hhhhubh)}(hThis relationship depends on the codec or SoC CPU in particular. In general it is best to configure BCLK to the lowest possible speed (depending on your rate, number of channels and word size) to save on power.h]hThis relationship depends on the codec or SoC CPU in particular. In general it is best to configure BCLK to the lowest possible speed (depending on your rate, number of channels and word size) to save on power.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK&hhhhubh)}(hIt is also desirable to use the codec (if possible) to drive (or master) the audio clocks as it usually gives more accurate sample rates than the CPU.h]hIt is also desirable to use the codec (if possible) to drive (or master) the audio clocks as it usually gives more accurate sample rates than the CPU.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhhhK*hhhhubeh}(h] dai-clocksah ]h"] dai clocksah$]h&]uh1hhhhhhhhKubh)}(hhh](h)}(hASoC provided clock APIsh]hASoC provided clock APIs}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhhhhK.ubhindex)}(hhh]h}(h]h ]h"]h$]h&]entries](single#snd_soc_dai_set_sysclk (C function)c.snd_soc_dai_set_sysclkhNtauh1jhjhhhNhNubhdesc)}(hhh](hdesc_signature)}(h\int snd_soc_dai_set_sysclk (struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir)h]hdesc_signature_line)}(h[int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir)h](hdesc_sig_keyword_type)}(hinth]hint}(hjhhhNhNubah}(h]h ]ktah"]h$]h&]uh1jhjhhhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:48: ./sound/soc/soc-dai.chK&ubhdesc_sig_space)}(h h]h }(hjhhhNhNubah}(h]h ]wah"]h$]h&]uh1jhjhhhjhK&ubh desc_name)}(hsnd_soc_dai_set_sysclkh]h desc_sig_name)}(hsnd_soc_dai_set_sysclkh]hsnd_soc_dai_set_sysclk}(hjhhhNhNubah}(h]h ]nah"]h$]h&]uh1j hjubah}(h]h ](sig-namedescnameeh"]h$]h&] xml:spacepreserveuh1jhjhhhjhK&ubhdesc_parameterlist)}(hA(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir)h](hdesc_parameter)}(hstruct snd_soc_dai *daih](hdesc_sig_keyword)}(hstructh]hstruct}(hj5hhhNhNubah}(h]h ]kah"]h$]h&]uh1j3hj/ubj)}(h h]h }(hjDhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj/ubh)}(hhh]j )}(h snd_soc_daih]h snd_soc_dai}(hjUhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjRubah}(h]h ]h"]h$]h&] refdomaincreftype identifier reftargetjWmodnameN classnameN c:parent_keysphinx.domains.c LookupKey)}data]jq ASTIdentifier)}jljsbc.snd_soc_dai_set_sysclkasbuh1hhj/ubj)}(h h]h }(hj~hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj/ubhdesc_sig_punctuation)}(h*h]h*}(hjhhhNhNubah}(h]h ]pah"]h$]h&]uh1jhj/ubj )}(hdaih]hdai}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj/ubeh}(h]h ]h"]h$]h&]noemphj%j&uh1j-hj)ubj.)}(h int clk_idh](j)}(hinth]hint}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj )}(hclk_idh]hclk_id}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]noemphj%j&uh1j-hj)ubj.)}(hunsigned int freqh](j)}(hunsignedh]hunsigned}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(hinth]hint}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj )}(hfreqh]hfreq}(hj#hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]noemphj%j&uh1j-hj)ubj.)}(hint dirh](j)}(hinth]hint}(hj<hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj8ubj)}(h h]h }(hjJhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhj8ubj )}(hdirh]hdir}(hjXhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj8ubeh}(h]h ]h"]h$]h&]noemphj%j&uh1j-hj)ubeh}(h]h ]h"]h$]h&]j%j&uh1j'hjhhhjhK&ubeh}(h]h ]h"]h$]h&]j%j& add_permalinkuh1jsphinx_line_type declaratorhjhhhjhK&ubah}(h]jah ](sig sig-objecteh"]h$]h&] is_multiline _toc_parts) _toc_namehuh1jhjhK&hjhhubh desc_content)}(hhh]h)}(h%configure DAI system or master clock.h]h%configure DAI system or master clock.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:48: ./sound/soc/soc-dai.chKhjhhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhK&ubeh}(h]h ](jjfunctioneh"]h$]h&]domainjjobjtypejdesctypejnoindex noindexentrynocontentsentryuh1jhhhjhNhNubh container)}(hX'**Parameters** ``struct snd_soc_dai *dai`` DAI ``int clk_id`` DAI specific clock ID ``unsigned int freq`` new clock frequency in Hz ``int dir`` new clock direction (SND_SOC_CLOCK_IN or SND_SOC_CLOCK_OUT) **Description** Configures the DAI master (MCLK) or system (SYSCLK) clocking.h](h)}(h**Parameters**h]hstrong)}(hjh]h Parameters}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:48: ./sound/soc/soc-dai.chK"hjubhdefinition_list)}(hhh](hdefinition_list_item)}(h ``struct snd_soc_dai *dai`` DAI h](hterm)}(h``struct snd_soc_dai *dai``h]hliteral)}(hjh]hstruct snd_soc_dai *dai}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:48: ./sound/soc/soc-dai.chKhjubh definition)}(hhh]h)}(hDAIh]hDAI}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhKhjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhKhjubj)}(h%``int clk_id`` DAI specific clock ID h](j)}(h``int clk_id``h]j)}(hjh]h int clk_id}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:48: ./sound/soc/soc-dai.chK hjubj)}(hhh]h)}(hDAI specific clock IDh]hDAI specific clock ID}(hj3hhhNhNubah}(h]h ]h"]h$]h&]uh1hhj/hK hj0ubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhj/hK hjubj)}(h0``unsigned int freq`` new clock frequency in Hz h](j)}(h``unsigned int freq``h]j)}(hjSh]hunsigned int freq}(hjUhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjQubah}(h]h ]h"]h$]h&]uh1jhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:48: ./sound/soc/soc-dai.chK!hjMubj)}(hhh]h)}(hnew clock frequency in Hzh]hnew clock frequency in Hz}(hjlhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhhK!hjiubah}(h]h ]h"]h$]h&]uh1jhjMubeh}(h]h ]h"]h$]h&]uh1jhjhhK!hjubj)}(hH``int dir`` new clock direction (SND_SOC_CLOCK_IN or SND_SOC_CLOCK_OUT) h](j)}(h ``int dir``h]j)}(hjh]hint dir}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:48: ./sound/soc/soc-dai.chK"hjubj)}(hhh]h)}(h;new clock direction (SND_SOC_CLOCK_IN or SND_SOC_CLOCK_OUT)h]h;new clock direction (SND_SOC_CLOCK_IN or SND_SOC_CLOCK_OUT)}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhK"hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhK"hjubeh}(h]h ]h"]h$]h&]uh1jhjubh)}(h**Description**h]j)}(hjh]h Description}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1hhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:48: ./sound/soc/soc-dai.chK$hjubh)}(h=Configures the DAI master (MCLK) or system (SYSCLK) clocking.h]h=Configures the DAI master (MCLK) or system (SYSCLK) clocking.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:48: ./sound/soc/soc-dai.chK$hjubeh}(h]h ] kernelindentah"]h$]h&]uh1jhjhhhNhNubj)}(hhh]h}(h]h ]h"]h$]h&]entries](j#snd_soc_dai_set_clkdiv (C function)c.snd_soc_dai_set_clkdivhNtauh1jhjhhhNhNubj)}(hhh](j)}(hIint snd_soc_dai_set_clkdiv (struct snd_soc_dai *dai, int div_id, int div)h]j)}(hHint snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div)h](j)}(hinth]hint}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:51: ./sound/soc/soc-dai.chK@ubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjhhhjhK@ubj)}(hsnd_soc_dai_set_clkdivh]j )}(hsnd_soc_dai_set_clkdivh]hsnd_soc_dai_set_clkdiv}(hj-hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hj)ubah}(h]h ](j j!eh"]h$]h&]j%j&uh1jhjhhhjhK@ubj()}(h.(struct snd_soc_dai *dai, int div_id, int div)h](j.)}(hstruct snd_soc_dai *daih](j4)}(hj7h]hstruct}(hjIhhhNhNubah}(h]h ]j@ah"]h$]h&]uh1j3hjEubj)}(h h]h }(hjVhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjEubh)}(hhh]j )}(h snd_soc_daih]h snd_soc_dai}(hjghhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjdubah}(h]h ]h"]h$]h&] refdomainjjreftypejl reftargetjimodnameN classnameNjpjs)}jv]jy)}jlj/sbc.snd_soc_dai_set_clkdivasbuh1hhjEubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjEubj)}(hjh]h*}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjEubj )}(hdaih]hdai}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjEubeh}(h]h ]h"]h$]h&]noemphj%j&uh1j-hjAubj.)}(h int div_idh](j)}(hinth]hint}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj )}(hdiv_idh]hdiv_id}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]noemphj%j&uh1j-hjAubj.)}(hint divh](j)}(hinth]hint}(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj)}(h h]h }(hjhhhNhNubah}(h]h ]jah"]h$]h&]uh1jhjubj )}(hdivh]hdiv}(hj hhhNhNubah}(h]h ]jah"]h$]h&]uh1j hjubeh}(h]h ]h"]h$]h&]noemphj%j&uh1j-hjAubeh}(h]h ]h"]h$]h&]j%j&uh1j'hjhhhjhK@ubeh}(h]h ]h"]h$]h&]j%j&jyuh1jjzj{hjhhhjhK@ubah}(h]jah ](jjeh"]h$]h&]jj)jhuh1jhjhK@hjhhubj)}(hhh]h)}(hconfigure DAI clock dividers.h]hconfigure DAI clock dividers.}(hj6hhhNhNubah}(h]h ]h"]h$]h&]uh1hhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:51: ./sound/soc/soc-dai.chK7hj3hhubah}(h]h ]h"]h$]h&]uh1jhjhhhjhK@ubeh}(h]h ](jjfunctioneh"]h$]h&]jjjjjNjjNjjjuh1jhhhjhNhNubj)}(hXe**Parameters** ``struct snd_soc_dai *dai`` DAI ``int div_id`` DAI specific clock divider ID ``int div`` new clock divisor. **Description** Configures the clock dividers. This is used to derive the best DAI bit and frame clocks from the system or master clock. It's best to set the DAI bit and frame clocks as low as possible to save system power.h](h)}(h**Parameters**h]j)}(hjXh]h Parameters}(hjZhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjVubah}(h]h ]h"]h$]h&]uh1hhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:51: ./sound/soc/soc-dai.chK;hjRubj)}(hhh](j)}(h ``struct snd_soc_dai *dai`` DAI h](j)}(h``struct snd_soc_dai *dai``h]j)}(hjwh]hstruct snd_soc_dai *dai}(hjyhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjuubah}(h]h ]h"]h$]h&]uh1jhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:51: ./sound/soc/soc-dai.chK8hjqubj)}(hhh]h)}(hDAIh]hDAI}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhK8hjubah}(h]h ]h"]h$]h&]uh1jhjqubeh}(h]h ]h"]h$]h&]uh1jhjhK8hjnubj)}(h-``int div_id`` DAI specific clock divider ID h](j)}(h``int div_id``h]j)}(hjh]h int div_id}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:51: ./sound/soc/soc-dai.chK9hjubj)}(hhh]h)}(hDAI specific clock divider IDh]hDAI specific clock divider ID}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhK9hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhK9hjnubj)}(h``int div`` new clock divisor. h](j)}(h ``int div``h]j)}(hjh]hint div}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1jhjubah}(h]h ]h"]h$]h&]uh1jhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:51: ./sound/soc/soc-dai.chK:hjubj)}(hhh]h)}(hnew clock divisor.h]hnew clock divisor.}(hjhhhNhNubah}(h]h ]h"]h$]h&]uh1hhjhK:hjubah}(h]h ]h"]h$]h&]uh1jhjubeh}(h]h ]h"]h$]h&]uh1jhjhK:hjnubeh}(h]h ]h"]h$]h&]uh1jhjRubh)}(h**Description**h]j)}(hj$h]h Description}(hj&hhhNhNubah}(h]h ]h"]h$]h&]uh1jhj"ubah}(h]h ]h"]h$]h&]uh1hhV/var/lib/git/docbuild/linux/Documentation/sound/soc/clocking:51: ./sound/soc/soc-dai.chK