blob: b1300162e01cef93ae7f97dc728ce02255487500 [file] [log] [blame]
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +02001Audio Clocking
2==============
3
4This text describes the audio clocking terms in ASoC and digital audio in
Matt LaPlante01dd2fb2007-10-20 01:34:40 +02005general. Note: Audio clocking can be complex!
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +02006
7
8Master Clock
9------------
10
Matt LaPlante01dd2fb2007-10-20 01:34:40 +020011Every audio subsystem is driven by a master clock (sometimes referred to as MCLK
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020012or SYSCLK). This audio master clock can be derived from a number of sources
13(e.g. crystal, PLL, CPU clock) and is responsible for producing the correct
14audio playback and capture sample rates.
15
Mark Brown7c4dbbd2008-01-23 08:41:46 +010016Some master clocks (e.g. PLLs and CPU based clocks) are configurable in that
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020017their speed can be altered by software (depending on the system use and to save
Matt LaPlante01dd2fb2007-10-20 01:34:40 +020018power). Other master clocks are fixed at a set frequency (i.e. crystals).
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020019
20
21DAI Clocks
22----------
23The Digital Audio Interface is usually driven by a Bit Clock (often referred to
24as BCLK). This clock is used to drive the digital audio data across the link
25between the codec and CPU.
26
27The DAI also has a frame clock to signal the start of each audio frame. This
28clock is sometimes referred to as LRC (left right clock) or FRAME. This clock
Liam Girdwooda71a4682006-10-19 20:35:56 +020029runs at exactly the sample rate (LRC = Rate).
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020030
Liam Girdwooda71a4682006-10-19 20:35:56 +020031Bit Clock can be generated as follows:-
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020032
33BCLK = MCLK / x
34
35 or
36
37BCLK = LRC * x
38
Liam Girdwooda71a4682006-10-19 20:35:56 +020039 or
40
41BCLK = LRC * Channels * Word Size
42
Liam Girdwood10b98522007-02-08 17:06:09 +010043This relationship depends on the codec or SoC CPU in particular. In general
Mark Brown7c4dbbd2008-01-23 08:41:46 +010044it is best to configure BCLK to the lowest possible speed (depending on your
45rate, number of channels and word size) to save on power.
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020046
Mark Brown7c4dbbd2008-01-23 08:41:46 +010047It is also desirable to use the codec (if possible) to drive (or master) the
48audio clocks as it usually gives more accurate sample rates than the CPU.
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020049
50
Liam Girdwoodeb1a6af2006-10-06 18:34:51 +020051