Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 1 | Audio Clocking |
| 2 | ============== |
| 3 | |
| 4 | This text describes the audio clocking terms in ASoC and digital audio in |
Matt LaPlante | 01dd2fb | 2007-10-20 01:34:40 +0200 | [diff] [blame^] | 5 | general. Note: Audio clocking can be complex! |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 6 | |
| 7 | |
| 8 | Master Clock |
| 9 | ------------ |
| 10 | |
Matt LaPlante | 01dd2fb | 2007-10-20 01:34:40 +0200 | [diff] [blame^] | 11 | Every audio subsystem is driven by a master clock (sometimes referred to as MCLK |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 12 | or 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 |
| 14 | audio playback and capture sample rates. |
| 15 | |
Matt LaPlante | 01dd2fb | 2007-10-20 01:34:40 +0200 | [diff] [blame^] | 16 | Some master clocks (e.g. PLL's and CPU based clocks) are configurable in that |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 17 | their speed can be altered by software (depending on the system use and to save |
Matt LaPlante | 01dd2fb | 2007-10-20 01:34:40 +0200 | [diff] [blame^] | 18 | power). Other master clocks are fixed at a set frequency (i.e. crystals). |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 19 | |
| 20 | |
| 21 | DAI Clocks |
| 22 | ---------- |
| 23 | The Digital Audio Interface is usually driven by a Bit Clock (often referred to |
| 24 | as BCLK). This clock is used to drive the digital audio data across the link |
| 25 | between the codec and CPU. |
| 26 | |
| 27 | The DAI also has a frame clock to signal the start of each audio frame. This |
| 28 | clock is sometimes referred to as LRC (left right clock) or FRAME. This clock |
Liam Girdwood | a71a468 | 2006-10-19 20:35:56 +0200 | [diff] [blame] | 29 | runs at exactly the sample rate (LRC = Rate). |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 30 | |
Liam Girdwood | a71a468 | 2006-10-19 20:35:56 +0200 | [diff] [blame] | 31 | Bit Clock can be generated as follows:- |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 32 | |
| 33 | BCLK = MCLK / x |
| 34 | |
| 35 | or |
| 36 | |
| 37 | BCLK = LRC * x |
| 38 | |
Liam Girdwood | a71a468 | 2006-10-19 20:35:56 +0200 | [diff] [blame] | 39 | or |
| 40 | |
| 41 | BCLK = LRC * Channels * Word Size |
| 42 | |
Liam Girdwood | 10b9852 | 2007-02-08 17:06:09 +0100 | [diff] [blame] | 43 | This relationship depends on the codec or SoC CPU in particular. In general |
| 44 | it's best to configure BCLK to the lowest possible speed (depending on your |
| 45 | rate, number of channels and wordsize) to save on power. |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 46 | |
Matt LaPlante | 01dd2fb | 2007-10-20 01:34:40 +0200 | [diff] [blame^] | 47 | It's also desirable to use the codec (if possible) to drive (or master) the |
Liam Girdwood | 10b9852 | 2007-02-08 17:06:09 +0100 | [diff] [blame] | 48 | audio clocks as it's usually gives more accurate sample rates than the CPU. |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 49 | |
| 50 | |
Liam Girdwood | eb1a6af | 2006-10-06 18:34:51 +0200 | [diff] [blame] | 51 | |