Logo Search packages:      
Sourcecode: linux-fsl-imx51 version File versions  Download package

PMIC_STATUS pmic_audio_vcodec_clear_config ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_VCODEC_CONFIG  config 
)

Clear/Disable the Voice CODEC options.

Clear or disable various Voice CODEC options.

Parameters:
handle Device handle from pmic_audio_open() call.
config The Voice CODEC options to be cleared/disabled.
Return values:
PMIC_SUCCESS If the Voice CODEC options were successfully cleared/disabled.
PMIC_PARAMETER_ERROR If the handle or the Voice CODEC options were invalid.
PMIC_ERROR If the Voice CODEC options could not be cleared/disabled.

Definition at line 2508 of file pmic_audio.c.

References PMIC_AUDIO_VCODEC_STATE::config, PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, pmic_write_reg(), and SET_BITS.

Referenced by disable_codec().

{
      PMIC_STATUS rc = PMIC_PARAMETER_ERROR;
      unsigned int reg_write = 0;
      unsigned int reg_mask = 0;

      /* Use a critical section to ensure a consistent hardware state. */
      if (down_interruptible(&mutex))
            return PMIC_SYSTEM_ERROR_EINTR;

      if ((handle == vCodec.handle) && (vCodec.handleState == HANDLE_IN_USE)) {
            if (config & DITHERING) {
                  reg_mask = SET_BITS(regAUD_CODEC, CDCDITH, 1);
                  reg_write = SET_BITS(regAUD_CODEC, CDCDITH, 1);
            }

            if (config & INPUT_HIGHPASS_FILTER) {
                  reg_mask |= SET_BITS(regAUD_CODEC, AUDIHPF, 1);
            }

            if (config & OUTPUT_HIGHPASS_FILTER) {
                  reg_mask |= SET_BITS(regAUD_CODEC, AUDOHPF, 1);
            }

            if (config & DIGITAL_LOOPBACK) {
                  reg_mask |= SET_BITS(regAUD_CODEC, CDCDLM, 1);
            }

            if (config & ANALOG_LOOPBACK) {
                  reg_mask |= SET_BITS(regAUD_CODEC, CDCALM, 1);
            }

            if (config & VCODEC_MASTER_CLOCK_OUTPUTS) {
                  reg_mask |= SET_BITS(regAUD_CODEC, CDCCLKEN, 1);
            }

            if (config & TRISTATE_TS) {
                  reg_mask |= SET_BITS(regAUD_CODEC, CDCTS, 1);
            }

            if (reg_mask == 0) {
                  /* We should not reach this point without having to configure
                   * anything so we flag it as an error.
                   */
                  rc = PMIC_ERROR;
            } else {
                  rc = pmic_write_reg(REG_AUDIO_CODEC,
                                  reg_write, reg_mask);
            }

            if (rc == PMIC_SUCCESS) {
                  vCodec.config |= config;
            }

      }

      /* Exit the critical section. */
      up(&mutex);

      return rc;
}


Generated by  Doxygen 1.6.0   Back to index