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

PMIC_STATUS pmic_audio_output_clear_config ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_OUTPUT_CONFIG  config 
)

Clear various audio output section options.

This function clears one or more audio output section configuration options.

Parameters:
handle Device handle from pmic_audio_open() call.
config The desired audio output section configuration options to be cleared.
Return values:
PMIC_SUCCESS If the desired configuration options were all successfully cleared.
PMIC_PARAMETER_ERROR If the handle or configuration options were invalid.
PMIC_ERROR If the desired configuration options could not be cleared.

Definition at line 5250 of file pmic_audio.c.

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

{
      PMIC_STATUS rc = PMIC_PARAMETER_ERROR;
      /*unsigned int reg_write_RX = 0;
         unsigned int reg_mask_RX  = 0;
         unsigned int reg_write_TX = 0;
         unsigned int reg_mask_TX  = 0; */
      unsigned int reg_mask = 0;
      unsigned int reg_write = 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)) ||
          ((handle == vCodec.handle) &&
           (vCodec.handleState == HANDLE_IN_USE)) ||
          ((handle == extStereoIn.handle) &&
           (extStereoIn.handleState == HANDLE_IN_USE))) {
            if (config & MONO_SPEAKER_INVERT_OUT_ONLY) {
                  /* If this is one of the parameters */
                  rc = PMIC_NOT_SUPPORTED;
            } else {
                  if (config & MONO_LOUDSPEAKER_COMMON_BIAS) {
                        reg_mask = SET_BITS(regAUDIO_RX_0, ALSPREF, 1);
                        reg_write = SET_BITS(regAUDIO_RX_0, ALSPREF, 0);
                  }

                  if (config & HEADSET_DETECT_ENABLE) {
                        reg_mask |= SET_BITS(regAUDIO_RX_0, HSDETEN, 1);
                        reg_write |=
                            SET_BITS(regAUDIO_RX_0, HSDETEN, 0);
                  }

                  if (config & STEREO_HEADSET_AMP_AUTO_DISABLE) {
                        reg_mask |=
                            SET_BITS(regAUDIO_RX_0, HSDETAUTOB, 1);
                        reg_write |=
                            SET_BITS(regAUDIO_RX_0, HSDETAUTOB, 0);
                  }

                  if (reg_mask == 0) {
                        rc = PMIC_PARAMETER_ERROR;
                  } else {
                        rc = pmic_write_reg(REG_AUDIO_RX_0,
                                        reg_write, reg_mask);

                        if (rc == PMIC_SUCCESS) {
                              pr_debug("Output config cleared\n");
                              audioOutput.config &= ~config;

                        }
                  }
            }
      }

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

      return rc;
}


Generated by  Doxygen 1.6.0   Back to index