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

PMIC_STATUS pmic_audio_stdac_clear_config ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_STDAC_CONFIG  config 
)

Clear/Disable the Stereo DAC options.

Clear or disable various Stereo DAC options.

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

Definition at line 3020 of file pmic_audio.c.

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

{
      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 == stDAC.handle) && (stDAC.handleState == HANDLE_IN_USE)) {

            if (config & STDAC_MASTER_CLOCK_OUTPUTS) {
                  reg_mask |= SET_BITS(regST_DAC, STDCCLKEN, 1);
            }

            if (reg_mask != 0) {
                  rc = pmic_write_reg(REG_AUDIO_STEREO_DAC,
                                  reg_write, reg_mask);

                  if (rc == PMIC_SUCCESS) {
                        stDAC.config &= ~config;
                  }
            }
      }

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

      return rc;
}


Generated by  Doxygen 1.6.0   Back to index