18c2ecf20Sopenharmony_ci================================== 28c2ecf20Sopenharmony_ciASoC Digital Audio Interface (DAI) 38c2ecf20Sopenharmony_ci================================== 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ciASoC currently supports the three main Digital Audio Interfaces (DAI) found on 68c2ecf20Sopenharmony_ciSoC controllers and portable audio CODECs today, namely AC97, I2S and PCM. 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ciAC97 108c2ecf20Sopenharmony_ci==== 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ciAC97 is a five wire interface commonly found on many PC sound cards. It is 138c2ecf20Sopenharmony_cinow also popular in many portable devices. This DAI has a reset line and time 148c2ecf20Sopenharmony_cimultiplexes its data on its SDATA_OUT (playback) and SDATA_IN (capture) lines. 158c2ecf20Sopenharmony_ciThe bit clock (BCLK) is always driven by the CODEC (usually 12.288MHz) and the 168c2ecf20Sopenharmony_ciframe (FRAME) (usually 48kHz) is always driven by the controller. Each AC97 178c2ecf20Sopenharmony_ciframe is 21uS long and is divided into 13 time slots. 188c2ecf20Sopenharmony_ci 198c2ecf20Sopenharmony_ciThe AC97 specification can be found at : 208c2ecf20Sopenharmony_cihttps://www.intel.com/p/en_US/business/design 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_ci 238c2ecf20Sopenharmony_ciI2S 248c2ecf20Sopenharmony_ci=== 258c2ecf20Sopenharmony_ci 268c2ecf20Sopenharmony_ciI2S is a common 4 wire DAI used in HiFi, STB and portable devices. The Tx and 278c2ecf20Sopenharmony_ciRx lines are used for audio transmission, while the bit clock (BCLK) and 288c2ecf20Sopenharmony_cileft/right clock (LRC) synchronise the link. I2S is flexible in that either the 298c2ecf20Sopenharmony_cicontroller or CODEC can drive (master) the BCLK and LRC clock lines. Bit clock 308c2ecf20Sopenharmony_ciusually varies depending on the sample rate and the master system clock 318c2ecf20Sopenharmony_ci(SYSCLK). LRCLK is the same as the sample rate. A few devices support separate 328c2ecf20Sopenharmony_ciADC and DAC LRCLKs, this allows for simultaneous capture and playback at 338c2ecf20Sopenharmony_cidifferent sample rates. 348c2ecf20Sopenharmony_ci 358c2ecf20Sopenharmony_ciI2S has several different operating modes:- 368c2ecf20Sopenharmony_ci 378c2ecf20Sopenharmony_ciI2S 388c2ecf20Sopenharmony_ci MSB is transmitted on the falling edge of the first BCLK after LRC 398c2ecf20Sopenharmony_ci transition. 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ciLeft Justified 428c2ecf20Sopenharmony_ci MSB is transmitted on transition of LRC. 438c2ecf20Sopenharmony_ci 448c2ecf20Sopenharmony_ciRight Justified 458c2ecf20Sopenharmony_ci MSB is transmitted sample size BCLKs before LRC transition. 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ciPCM 488c2ecf20Sopenharmony_ci=== 498c2ecf20Sopenharmony_ci 508c2ecf20Sopenharmony_ciPCM is another 4 wire interface, very similar to I2S, which can support a more 518c2ecf20Sopenharmony_ciflexible protocol. It has bit clock (BCLK) and sync (SYNC) lines that are used 528c2ecf20Sopenharmony_cito synchronise the link while the Tx and Rx lines are used to transmit and 538c2ecf20Sopenharmony_cireceive the audio data. Bit clock usually varies depending on sample rate 548c2ecf20Sopenharmony_ciwhile sync runs at the sample rate. PCM also supports Time Division 558c2ecf20Sopenharmony_ciMultiplexing (TDM) in that several devices can use the bus simultaneously (this 568c2ecf20Sopenharmony_ciis sometimes referred to as network mode). 578c2ecf20Sopenharmony_ci 588c2ecf20Sopenharmony_ciCommon PCM operating modes:- 598c2ecf20Sopenharmony_ci 608c2ecf20Sopenharmony_ciMode A 618c2ecf20Sopenharmony_ci MSB is transmitted on falling edge of first BCLK after FRAME/SYNC. 628c2ecf20Sopenharmony_ci 638c2ecf20Sopenharmony_ciMode B 648c2ecf20Sopenharmony_ci MSB is transmitted on rising edge of FRAME/SYNC. 65