1 /* 2 * Copyright (c) 2016, Freescale Semiconductor, Inc. 3 * Copyright 2016-2021 NXP 4 * All rights reserved. 5 * 6 * SPDX-License-Identifier: BSD-3-Clause 7 */ 8 9 #ifndef _FSL_WM8904_H_ 10 #define _FSL_WM8904_H_ 11 12 #include "fsl_common.h" 13 #include "fsl_codec_i2c.h" 14 /*! 15 * @addtogroup wm8904 16 * @ingroup codec 17 * @{ 18 */ 19 20 /******************************************************************************* 21 * Definitions 22 ******************************************************************************/ 23 /*! @name Driver version */ 24 /*@{*/ 25 /*! @brief WM8904 driver version 2.5.1. */ 26 #define FSL_WM8904_DRIVER_VERSION (MAKE_VERSION(2, 5, 1)) 27 /*@}*/ 28 29 /*! @brief wm8904 handle size */ 30 #ifndef WM8904_I2C_HANDLER_SIZE 31 #define WM8904_I2C_HANDLER_SIZE (CODEC_I2C_MASTER_HANDLER_SIZE) 32 #endif 33 /*! @brief wm8904 debug macro */ 34 #ifndef WM8904_DEBUG_REGISTER 35 #define WM8904_DEBUG_REGISTER 0 36 #endif 37 38 /*! @brief WM8904 register map*/ 39 #define WM8904_RESET (0x00) 40 #define WM8904_ANALOG_ADC_0 (0x0A) 41 #define WM8904_POWER_MGMT_0 (0x0C) 42 #define WM8904_POWER_MGMT_2 (0x0E) 43 #define WM8904_POWER_MGMT_3 (0x0F) 44 #define WM8904_POWER_MGMT_6 (0x12) 45 #define WM8904_CLK_RATES_0 (0x14) 46 #define WM8904_CLK_RATES_1 (0x15) 47 #define WM8904_CLK_RATES_2 (0x16) 48 #define WM8904_AUDIO_IF_0 (0x18) 49 #define WM8904_AUDIO_IF_1 (0x19) 50 #define WM8904_AUDIO_IF_2 (0x1A) 51 #define WM8904_AUDIO_IF_3 (0x1B) 52 #define WM8904_DAC_DIG_1 (0x21) 53 #define WM8904_DAC_DIG_0 (0x27) 54 #define WM8904_ANALOG_LEFT_IN_0 (0x2C) 55 #define WM8904_ANALOG_RIGHT_IN_0 (0x2D) 56 #define WM8904_ANALOG_LEFT_IN_1 (0x2E) 57 #define WM8904_ANALOG_RIGHT_IN_1 (0x2F) 58 #define WM8904_ANALOG_OUT1_LEFT (0x39) 59 #define WM8904_ANALOG_OUT1_RIGHT (0x3A) 60 #define WM8904_ANALOG_OUT12_ZC (0x3D) 61 #define WM8904_DC_SERVO_0 (0x43) 62 #define WM8904_ANALOG_HP_0 (0x5A) 63 #define WM8904_CHRG_PUMP_0 (0x62) 64 #define WM8904_CLS_W_0 (0x68) 65 #define WM8904_WRT_SEQUENCER_0 (0x6C) 66 #define WM8904_WRT_SEQUENCER_3 (0x6F) 67 #define WM8904_WRT_SEQUENCER_4 (0x70) 68 #define WM8904_DAC_DIGITAL_VOLUME_LEFT (0x1E) 69 #define WM8904_DAC_DIGITAL_VOLUME_RIGHT (0x1F) 70 #define WM8904_ADC_DIGITAL_VOLUME_LEFT (0x24) 71 #define WM8904_ADC_DIGITAL_VOLUME_RIGHT (0x25) 72 #define WM8904_ANALOG_OUT2_LEFT (0x3B) 73 #define WM8904_ANALOG_OUT2_RIGHT (0x3C) 74 #define WM8904_GPIO_CONTROL_4 (0x7C) 75 /* FLL control register */ 76 #define WM8904_FLL_CONTROL_1 (0x74) 77 #define WM8904_FLL_CONTROL_2 (0x75) 78 #define WM8904_FLL_CONTROL_3 (0x76) 79 #define WM8904_FLL_CONTROL_4 (0x77) 80 #define WM8904_FLL_CONTROL_5 (0x78) 81 /* GPIO control register */ 82 #define WM8904_GPIO_CONTROL_1 (0x79) 83 #define WM8904_GPIO_CONTROL_2 (0x7A) 84 #define WM8904_GPIO_CONTROL_3 (0x7B) 85 #define WM8904_GPIO_CONTROL_4 (0x7C) 86 /* fll nco */ 87 #define WM8904_FLL_NCO_TEST_0 (0xF7U) 88 #define WM8904_FLL_NCO_TEST_1 (0xF8U) 89 90 /*! @brief WM8904 I2C address. */ 91 #define WM8904_I2C_ADDRESS (0x1A) 92 93 /*! @brief WM8904 I2C bit rate. */ 94 #define WM8904_I2C_BITRATE (400000U) 95 96 /*!@brief WM8904 maximum volume */ 97 #define WM8904_MAP_HEADPHONE_LINEOUT_MAX_VOLUME 0x3FU 98 #define WM8904_DAC_MAX_VOLUME 0xC0U 99 /*! @brief WM8904 status return codes. 100 * @anchor _wm8904_status 101 */ 102 enum 103 { 104 kStatus_WM8904_Success = 0x0, /*!< Success */ 105 kStatus_WM8904_Fail = 0x1 /*!< Failure */ 106 }; 107 108 /*! @brief WM8904 lrc polarity. 109 * @anchor _wm8904_lrc_polarity 110 */ 111 enum 112 { 113 kWM8904_LRCPolarityNormal = 0U, /*!< LRC polarity normal */ 114 kWM8904_LRCPolarityInverted = 1U << 4U, /*!< LRC polarity inverted */ 115 }; 116 117 /*! @brief wm8904 module value*/ 118 typedef enum _wm8904_module 119 { 120 kWM8904_ModuleADC = 0, /*!< moduel ADC */ 121 kWM8904_ModuleDAC = 1, /*!< module DAC */ 122 kWM8904_ModulePGA = 2, /*!< module PGA */ 123 kWM8904_ModuleHeadphone = 3, /*!< module headphone */ 124 kWM8904_ModuleLineout = 4, /*!< module line out */ 125 } wm8904_module_t; 126 127 /*! @brief wm8904 play channel 128 * @anchor _wm8904_play_channel 129 */ 130 enum 131 { 132 kWM8904_HeadphoneLeft = 1U, 133 kWM8904_HeadphoneRight = 2U, 134 kWM8904_LineoutLeft = 4U, 135 kWM8904_LineoutRight = 8U, 136 }; 137 138 /*! @brief WM8904 time slot. */ 139 typedef enum _wm8904_timeslot 140 { 141 kWM8904_TimeSlot0 = 0U, /*!< time slot0 */ 142 kWM8904_TimeSlot1 = 1U, /*!< time slot1 */ 143 } wm8904_timeslot_t; 144 145 /*! @brief The audio data transfer protocol. */ 146 typedef enum _wm8904_protocol 147 { 148 kWM8904_ProtocolI2S = 0x2, /*!< I2S type */ 149 kWM8904_ProtocolLeftJustified = 0x1, /*!< Left justified mode */ 150 kWM8904_ProtocolRightJustified = 0x0, /*!< Right justified mode */ 151 kWM8904_ProtocolPCMA = 0x3, /*!< PCM A mode */ 152 kWM8904_ProtocolPCMB = 0x3 | (1 << 4), /*!< PCM B mode */ 153 } wm8904_protocol_t; 154 155 /*! @brief The SYSCLK / fs ratio. */ 156 typedef enum _wm8904_fs_ratio 157 { 158 kWM8904_FsRatio64X = 0x0, /*!< SYSCLK is 64 * sample rate * frame width */ 159 kWM8904_FsRatio128X = 0x1, /*!< SYSCLK is 128 * sample rate * frame width */ 160 kWM8904_FsRatio192X = 0x2, /*!< SYSCLK is 192 * sample rate * frame width */ 161 kWM8904_FsRatio256X = 0x3, /*!< SYSCLK is 256 * sample rate * frame width */ 162 kWM8904_FsRatio384X = 0x4, /*!< SYSCLK is 384 * sample rate * frame width */ 163 kWM8904_FsRatio512X = 0x5, /*!< SYSCLK is 512 * sample rate * frame width */ 164 kWM8904_FsRatio768X = 0x6, /*!< SYSCLK is 768 * sample rate * frame width */ 165 kWM8904_FsRatio1024X = 0x7, /*!< SYSCLK is 1024 * sample rate * frame width */ 166 kWM8904_FsRatio1408X = 0x8, /*!< SYSCLK is 1408 * sample rate * frame width */ 167 kWM8904_FsRatio1536X = 0x9 /*!< SYSCLK is 1536 * sample rate * frame width */ 168 } wm8904_fs_ratio_t; 169 170 /*! @brief Sample rate. */ 171 typedef enum _wm8904_sample_rate 172 { 173 kWM8904_SampleRate8kHz = 0x0, /*!< 8 kHz */ 174 kWM8904_SampleRate12kHz = 0x1, /*!< 12kHz */ 175 kWM8904_SampleRate16kHz = 0x2, /*!< 16kHz */ 176 kWM8904_SampleRate24kHz = 0x3, /*!< 24kHz */ 177 kWM8904_SampleRate32kHz = 0x4, /*!< 32kHz */ 178 kWM8904_SampleRate48kHz = 0x5, /*!< 48kHz */ 179 kWM8904_SampleRate11025Hz = 0x6, /*!< 11.025kHz */ 180 kWM8904_SampleRate22050Hz = 0x7, /*!< 22.05kHz */ 181 kWM8904_SampleRate44100Hz = 0x8 /*!< 44.1kHz */ 182 } wm8904_sample_rate_t; 183 184 /*! @brief Bit width. */ 185 typedef enum _wm8904_bit_width 186 { 187 kWM8904_BitWidth16 = 0x0, /*!< 16 bits */ 188 kWM8904_BitWidth20 = 0x1, /*!< 20 bits */ 189 kWM8904_BitWidth24 = 0x2, /*!< 24 bits */ 190 kWM8904_BitWidth32 = 0x3 /*!< 32 bits */ 191 } wm8904_bit_width_t; 192 193 /*! @brief wm8904 record source 194 * @anchor _wm8904_record_source 195 */ 196 enum 197 { 198 kWM8904_RecordSourceDifferentialLine = 1U, /*!< record source from differential line */ 199 kWM8904_RecordSourceLineInput = 2U, /*!< record source from line input */ 200 kWM8904_RecordSourceDifferentialMic = 4U, /*!< record source from differential mic */ 201 kWM8904_RecordSourceDigitalMic = 8U, /*!< record source from digital microphone */ 202 }; 203 204 /*! @brief wm8904 record channel 205 * @anchor _wm8904_record_channel 206 */ 207 enum 208 { 209 kWM8904_RecordChannelLeft1 = 1U, /*!< left record channel 1 */ 210 kWM8904_RecordChannelLeft2 = 2U, /*!< left record channel 2 */ 211 kWM8904_RecordChannelLeft3 = 4U, /*!< left record channel 3 */ 212 kWM8904_RecordChannelRight1 = 1U, /*!< right record channel 1 */ 213 kWM8904_RecordChannelRight2 = 2U, /*!< right record channel 2 */ 214 kWM8904_RecordChannelRight3 = 4U, /*!< right record channel 3 */ 215 kWM8904_RecordChannelDifferentialPositive1 = 1U, /*!< differential positive record channel 1 */ 216 kWM8904_RecordChannelDifferentialPositive2 = 2U, /*!< differential positive record channel 2 */ 217 kWM8904_RecordChannelDifferentialPositive3 = 4U, /*!< differential positive record channel 3 */ 218 kWM8904_RecordChannelDifferentialNegative1 = 8U, /*!< differential negative record channel 1 */ 219 kWM8904_RecordChannelDifferentialNegative2 = 16U, /*!< differential negative record channel 2 */ 220 kWM8904_RecordChannelDifferentialNegative3 = 32U, /*!< differential negative record channel 3 */ 221 }; 222 223 /*! @brief wm8904 play source 224 * @anchor _wm8904_play_source 225 */ 226 enum 227 { 228 kWM8904_PlaySourcePGA = 1U, /*!< play source PGA, bypass ADC */ 229 kWM8904_PlaySourceDAC = 4U, /*!< play source Input3 */ 230 }; 231 232 /*! @brief wm8904 system clock source */ 233 typedef enum _wm8904_sys_clk_source 234 { 235 kWM8904_SysClkSourceMCLK = 0U, /*!< wm8904 system clock soure from MCLK */ 236 kWM8904_SysClkSourceFLL = 1U << 14, /*!< wm8904 system clock soure from FLL */ 237 } wm8904_sys_clk_source_t; 238 239 /*! @brief wm8904 fll clock source */ 240 typedef enum _wm8904_fll_clk_source 241 { 242 kWM8904_FLLClkSourceMCLK = 0U, /*!< wm8904 FLL clock source from MCLK */ 243 } wm8904_fll_clk_source_t; 244 245 /*! @brief wm8904 fll configuration */ 246 typedef struct _wm8904_fll_config 247 { 248 wm8904_fll_clk_source_t source; /*!< fll reference clock source */ 249 uint32_t refClock_HZ; /*!< fll reference clock frequency */ 250 uint32_t outputClock_HZ; /*!< fll output clock frequency */ 251 } wm8904_fll_config_t; 252 253 /*! @brief Audio format configuration. */ 254 typedef struct _wm8904_audio_format 255 { 256 wm8904_fs_ratio_t fsRatio; /*!< SYSCLK / fs ratio */ 257 wm8904_sample_rate_t sampleRate; /*!< Sample rate */ 258 wm8904_bit_width_t bitWidth; /*!< Bit width */ 259 } wm8904_audio_format_t; 260 261 /*! @brief Configuration structure of WM8904.*/ 262 typedef struct _wm8904_config 263 { 264 bool master; /*!< Master or slave */ 265 wm8904_sys_clk_source_t sysClkSource; /*!< system clock source */ 266 wm8904_fll_config_t *fll; /*!< fll configuration */ 267 wm8904_protocol_t protocol; /*!< Audio transfer protocol */ 268 wm8904_audio_format_t format; /*!< Audio format */ 269 uint32_t mclk_HZ; /*!< MCLK frequency value */ 270 271 uint16_t recordSource; /*!< record source */ 272 uint16_t recordChannelLeft; /*!< record channel */ 273 uint16_t recordChannelRight; /*!< record channel */ 274 uint16_t playSource; /*!< play source */ 275 276 uint8_t slaveAddress; /*!< code device slave address */ 277 codec_i2c_config_t i2cConfig; /*!< i2c bus configuration */ 278 } wm8904_config_t; 279 280 /*! @brief wm8904 codec handler 281 */ 282 typedef struct _wm8904_handle 283 { 284 wm8904_config_t *config; /*!< wm8904 config pointer */ 285 uint8_t i2cHandle[WM8904_I2C_HANDLER_SIZE]; /*!< i2c handle */ 286 } wm8904_handle_t; 287 288 /******************************************************************************* 289 * API 290 ******************************************************************************/ 291 #if defined(__cplusplus) 292 extern "C" { 293 #endif 294 295 /*! 296 * @brief WM8904 write register. 297 * 298 * @param handle WM8904 handle structure. 299 * @param reg register address. 300 * @param value value to write. 301 * @return kStatus_Success, else failed. 302 */ 303 status_t WM8904_WriteRegister(wm8904_handle_t *handle, uint8_t reg, uint16_t value); 304 305 /*! 306 * @brief WM8904 write register. 307 * 308 * @param handle WM8904 handle structure. 309 * @param reg register address. 310 * @param value value to read. 311 * @return kStatus_Success, else failed. 312 */ 313 status_t WM8904_ReadRegister(wm8904_handle_t *handle, uint8_t reg, uint16_t *value); 314 315 /*! 316 * @brief WM8904 modify register. 317 * 318 * @param handle WM8904 handle structure. 319 * @param reg register address. 320 * @param mask register bits mask. 321 * @param value value to write. 322 * @return kStatus_Success, else failed. 323 */ 324 status_t WM8904_ModifyRegister(wm8904_handle_t *handle, uint8_t reg, uint16_t mask, uint16_t value); 325 326 /*! 327 * @brief Initializes WM8904. 328 * 329 * @param handle WM8904 handle structure. 330 * @param wm8904Config WM8904 configuration structure. 331 */ 332 status_t WM8904_Init(wm8904_handle_t *handle, wm8904_config_t *wm8904Config); 333 334 /*! 335 * @brief Deinitializes the WM8904 codec. 336 * 337 * This function resets WM8904. 338 * 339 * @param handle WM8904 handle structure. 340 * 341 * @return kStatus_WM8904_Success if successful, different code otherwise. 342 */ 343 status_t WM8904_Deinit(wm8904_handle_t *handle); 344 345 /*! 346 * @brief Fills the configuration structure with default values. 347 * 348 * The default values are: 349 * 350 * master = false; 351 * protocol = kWM8904_ProtocolI2S; 352 * format.fsRatio = kWM8904_FsRatio64X; 353 * format.sampleRate = kWM8904_SampleRate48kHz; 354 * format.bitWidth = kWM8904_BitWidth16; 355 * 356 * @param config default configurations of wm8904. 357 */ 358 void WM8904_GetDefaultConfig(wm8904_config_t *config); 359 360 /*! 361 * @brief Sets WM8904 as master or slave. 362 * @deprecated DO NOT USE THIS API ANYMORE. IT HAS BEEN SUPERCEDED BY @ref WM8904_SetMasterClock 363 * @param handle WM8904 handle structure. 364 * @param master true for master, false for slave. 365 * 366 * @return kStatus_WM8904_Success if successful, different code otherwise. 367 */ 368 status_t WM8904_SetMasterSlave(wm8904_handle_t *handle, bool master); 369 370 /*! 371 * @brief Sets WM8904 master clock configuration. 372 * 373 * User should pay attention to the sysclk parameter ,When using external MCLK as system clock source, the value should 374 * be frequency of MCLK, when using FLL as system clock source, the value should be frequency of the output of FLL. 375 * 376 * @param handle WM8904 handle structure. 377 * @param sysclk system clock source frequency. 378 * @param sampleRate sample rate 379 * @param bitWidth bit width 380 * 381 * @return kStatus_WM8904_Success if successful, different code otherwise. 382 */ 383 status_t WM8904_SetMasterClock(wm8904_handle_t *handle, uint32_t sysclk, uint32_t sampleRate, uint32_t bitWidth); 384 385 /*! 386 * @brief WM8904 set PLL configuration 387 * This function will enable the GPIO1 FLL clock output function, so user can see 388 * the generated fll output clock frequency from WM8904 GPIO1. 389 * 390 * @param handle wm8904 handler pointer. 391 * @param config FLL configuration pointer. 392 * 393 */ 394 status_t WM8904_SetFLLConfig(wm8904_handle_t *handle, wm8904_fll_config_t *config); 395 396 /*! 397 * @brief Sets the audio data transfer protocol. 398 * 399 * @param handle WM8904 handle structure. 400 * @param protocol Audio transfer protocol. 401 * 402 * @return kStatus_WM8904_Success if successful, different code otherwise. 403 */ 404 status_t WM8904_SetProtocol(wm8904_handle_t *handle, wm8904_protocol_t protocol); 405 406 /*! 407 * @brief Sets the audio data format. 408 * 409 * User should pay attention to the sysclk parameter ,When using external MCLK as system clock source, the value should 410 * be frequency of MCLK, when using FLL as system clock source, the value should be frequency of the output of FLL. 411 * 412 * @param handle WM8904 handle structure. 413 * @param sysclk system clock source frequency. 414 * @param sampleRate Sample rate frequency in Hz. 415 * @param bitWidth Audio data bit width. 416 * 417 * @return kStatus_WM8904_Success if successful, different code otherwise. 418 */ 419 status_t WM8904_SetAudioFormat(wm8904_handle_t *handle, uint32_t sysclk, uint32_t sampleRate, uint32_t bitWidth); 420 421 /*! 422 * @brief check and update the audio data format. 423 * This api is used check the fsRatio setting based on the mclk and sample rate, if fsRatio setting 424 * is not correct, it will correct it according to mclk and sample rate. 425 * @param handle WM8904 handle structure. 426 * @param format audio data format 427 * @param mclkFreq mclk frequency 428 * 429 * @return kStatus_WM8904_Success if successful, different code otherwise. 430 */ 431 status_t WM8904_CheckAudioFormat(wm8904_handle_t *handle, wm8904_audio_format_t *format, uint32_t mclkFreq); 432 433 /*! 434 * @brief Sets the module output volume. 435 * 436 * The parameter should be from 0 to 63. 437 * The resulting volume will be. 438 * 0 for -57DB, 63 for 6DB. 439 * 440 * @param handle WM8904 handle structure. 441 * @param volumeLeft left channel volume. 442 * @param volumeRight right channel volume. 443 * 444 * @return kStatus_WM8904_Success if successful, different code otherwise. 445 */ 446 status_t WM8904_SetVolume(wm8904_handle_t *handle, uint16_t volumeLeft, uint16_t volumeRight); 447 448 /*! 449 * @brief Sets the headphone output mute. 450 * 451 * @param handle WM8904 handle structure. 452 * @param muteLeft true to mute left channel, false to unmute. 453 * @param muteRight true to mute right channel, false to unmute. 454 * 455 * @return kStatus_WM8904_Success if successful, different code otherwise. 456 */ 457 status_t WM8904_SetMute(wm8904_handle_t *handle, bool muteLeft, bool muteRight); 458 459 /*! 460 * @brief Select LRC polarity. 461 * 462 * @param handle WM8904 handle structure. 463 * @param polarity LRC clock polarity. 464 * 465 * @return kStatus_WM8904_Success if successful, different code otherwise. 466 */ 467 status_t WM8904_SelectLRCPolarity(wm8904_handle_t *handle, uint32_t polarity); 468 469 /*! 470 * @brief Enable WM8904 DAC time slot. 471 * 472 * @param handle WM8904 handle structure. 473 * @param timeSlot timeslot number. 474 * 475 * @return kStatus_WM8904_Success if successful, different code otherwise. 476 */ 477 status_t WM8904_EnableDACTDMMode(wm8904_handle_t *handle, wm8904_timeslot_t timeSlot); 478 479 /*! 480 * @brief Enable WM8904 ADC time slot. 481 * 482 * @param handle WM8904 handle structure. 483 * @param timeSlot timeslot number. 484 * 485 * @return kStatus_WM8904_Success if successful, different code otherwise. 486 */ 487 status_t WM8904_EnableADCTDMMode(wm8904_handle_t *handle, wm8904_timeslot_t timeSlot); 488 489 #if WM8904_DEBUG_REGISTER 490 /*! 491 * @brief Reads content of all WM8904 registers and prints it to debug console. 492 * 493 * @param handle WM8904 handle structure. 494 * 495 * @return kStatus_WM8904_Success if successful, different code otherwise. 496 */ 497 status_t WM8904_PrintRegisters(wm8904_handle_t *handle); 498 #endif 499 500 /*! 501 * @brief SET the module output power. 502 * 503 * @param handle WM8904 handle structure. 504 * @param module wm8904 module. 505 * @param isEnabled, true is power on, false is power down. 506 * 507 * @return kStatus_WM8904_Success if successful, different code otherwise.. 508 */ 509 status_t WM8904_SetModulePower(wm8904_handle_t *handle, wm8904_module_t module, bool isEnabled); 510 511 /*! 512 * @brief SET the DAC module volume. 513 * 514 * @param handle WM8904 handle structure. 515 * @param volume volume to be configured. 516 * 517 * @return kStatus_WM8904_Success if successful, different code otherwise.. 518 */ 519 status_t WM8904_SetDACVolume(wm8904_handle_t *handle, uint8_t volume); 520 521 /*! 522 * @brief Sets the channel output volume. 523 * 524 * The parameter should be from 0 to 63. 525 * The resulting volume will be. 526 * 0 for -57dB, 63 for 6DB. 527 * 528 * @param handle codec handle structure. 529 * @param channel codec channel. 530 * @param volume volume value from 0 -63. 531 * 532 * @return kStatus_WM8904_Success if successful, different code otherwise. 533 */ 534 status_t WM8904_SetChannelVolume(wm8904_handle_t *handle, uint32_t channel, uint32_t volume); 535 536 /*! 537 * @brief SET the WM8904 record source. 538 * 539 * @param handle WM8904 handle structure. 540 * @param recordSource record source , can be a value of kCODEC_ModuleRecordSourceDifferentialLine, 541 * kCODEC_ModuleRecordSourceDifferentialMic, kCODEC_ModuleRecordSourceSingleEndMic, kCODEC_ModuleRecordSourceDigitalMic. 542 * 543 * @return kStatus_WM8904_Success if successful, different code otherwise. 544 */ 545 status_t WM8904_SetRecord(wm8904_handle_t *handle, uint32_t recordSource); 546 547 /*! 548 * @brief SET the WM8904 record source. 549 * 550 * @param handle WM8904 handle structure. 551 * @param leftRecordChannel channel number of left record channel when using differential source, channel number of 552 * single end left channel when using single end source, channel number of digital mic when using digital mic source. 553 * @param rightRecordChannel channel number of right record channel when using differential source, channel number 554 * of single end right channel when using single end source. 555 * 556 * @return kStatus_WM8904_Success if successful, different code otherwise.. 557 */ 558 status_t WM8904_SetRecordChannel(wm8904_handle_t *handle, uint32_t leftRecordChannel, uint32_t rightRecordChannel); 559 560 /*! 561 * @brief SET the WM8904 play source. 562 * 563 * @param handle WM8904 handle structure. 564 * @param playSource play source , can be a value of kCODEC_ModuleHeadphoneSourcePGA, 565 * kCODEC_ModuleHeadphoneSourceDAC, kCODEC_ModuleLineoutSourcePGA, kCODEC_ModuleLineoutSourceDAC. 566 * 567 * @return kStatus_WM8904_Success if successful, different code otherwise.. 568 */ 569 status_t WM8904_SetPlay(wm8904_handle_t *handle, uint32_t playSource); 570 571 /*! 572 * @brief Sets the channel mute. 573 * 574 * @param handle codec handle structure. 575 * @param channel codec module name. 576 * @param isMute true is mute, false unmute. 577 * 578 * @return kStatus_WM8904_Success if successful, different code otherwise. 579 */ 580 status_t WM8904_SetChannelMute(wm8904_handle_t *handle, uint32_t channel, bool isMute); 581 582 #if defined(__cplusplus) 583 } 584 #endif 585 586 /*! @} */ 587 588 #endif /* _FSL_WM8904_H_ */ 589