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

static PMIC_STATUS pmic_audio_reset_device ( const PMIC_AUDIO_HANDLE  handle  )  [static]

Reset the selected audio hardware control registers to their power on state.

This resets all of the audio hardware control registers currently associated with the device handle back to their power on states. For example, if the handle is associated with the Stereo DAC and a specific output port and output amplifiers, then this function will reset all of those components to their initial power on state.

This function can only be called if the mutex has already been acquired.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the reset operation was successful.
PMIC_PARAMETER_ERROR If the handle is invalid.
PMIC_ERROR If the reset was unsuccessful.

Definition at line 5561 of file pmic_audio.c.

References PMIC_AUDIO_VCODEC_STATE::busID, PMIC_AUDIO_STDAC_STATE::busID, PMIC_AUDIO_VCODEC_STATE::clockFreq, PMIC_AUDIO_STDAC_STATE::clockFreq, PMIC_AUDIO_VCODEC_STATE::clockIn, PMIC_AUDIO_STDAC_STATE::clockIn, PMIC_AUDIO_VCODEC_STATE::config, PMIC_AUDIO_STDAC_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_AUDIO_VCODEC_STATE::invert, PMIC_AUDIO_STDAC_STATE::invert, PMIC_AUDIO_VCODEC_STATE::masterSlave, PMIC_AUDIO_STDAC_STATE::masterSlave, PMIC_AUDIO_VCODEC_STATE::numSlots, PMIC_AUDIO_STDAC_STATE::numSlots, pmic_write_reg(), PMIC_AUDIO_VCODEC_STATE::protocol, PMIC_AUDIO_STDAC_STATE::protocol, PMIC_AUDIO_VCODEC_STATE::protocol_set, PMIC_AUDIO_STDAC_STATE::protocol_set, REG_FULLMASK, REG_SSI_STDAC_MASK, REG_SSI_VCODEC_MASK, RESET_AUD_CODEC, RESET_AUDIO_TX, RESET_SSI_NETWORK, RESET_ST_DAC, PMIC_AUDIO_VCODEC_STATE::samplingRate, PMIC_AUDIO_STDAC_STATE::samplingRate, SET_BITS, PMIC_AUDIO_VCODEC_STATE::timeslot, and PMIC_AUDIO_STDAC_STATE::timeslot.

Referenced by pmic_audio_close_handle(), and pmic_audio_reset().

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

      if ((handle == stDAC.handle) && (stDAC.handleState == HANDLE_IN_USE)) {
            /* Also shutdown the audio output section if nobody else is using it.
               if ((vCodec.handleState == HANDLE_FREE) &&
               (extStereoIn.handleState == HANDLE_FREE))
               {
               pmic_write_reg(REG_RX_AUD_AMPS, RESET_RX_AUD_AMPS,
               REG_FULLMASK);
               } */

            rc = pmic_write_reg(REG_AUDIO_STEREO_DAC,
                            RESET_ST_DAC, REG_FULLMASK);

            if (rc == PMIC_SUCCESS) {
                  rc = pmic_write_reg(REG_AUDIO_SSI_NETWORK,
                                  RESET_SSI_NETWORK,
                                  REG_SSI_STDAC_MASK);
                  if (rc == PMIC_SUCCESS) {
                        /* Also reset the driver state information to match. Note that we
                         * keep the device handle and event callback settings unchanged
                         * since these don't affect the actual hardware and we rely on
                         * the user to explicitly close the handle or deregister callbacks
                         */
                        stDAC.busID = AUDIO_DATA_BUS_1;
                        stDAC.protocol = NORMAL_MSB_JUSTIFIED_MODE;
                        stDAC.protocol_set = false;
                        stDAC.masterSlave = BUS_MASTER_MODE;
                        stDAC.numSlots = USE_2_TIMESLOTS;
                        stDAC.clockIn = CLOCK_IN_CLIA;
                        stDAC.samplingRate = STDAC_RATE_44_1_KHZ;
                        stDAC.clockFreq = STDAC_CLI_13MHZ;
                        stDAC.invert = NO_INVERT;
                        stDAC.timeslot = USE_TS0_TS1;
                        stDAC.config = (PMIC_AUDIO_STDAC_CONFIG) 0;

                  }
            }
      } else if ((handle == vCodec.handle)
               && (vCodec.handleState == HANDLE_IN_USE)) {
            /* Disable the audio input section when disabling the Voice CODEC. */
            pmic_write_reg(REG_AUDIO_TX, RESET_AUDIO_TX, REG_FULLMASK);

            rc = pmic_write_reg(REG_AUDIO_CODEC,
                            RESET_AUD_CODEC, REG_FULLMASK);

            if (rc == PMIC_SUCCESS) {
                  rc = pmic_write_reg(REG_AUDIO_SSI_NETWORK,
                                  RESET_SSI_NETWORK,
                                  REG_SSI_VCODEC_MASK);
                  if (rc == PMIC_SUCCESS) {

                        /* Also reset the driver state information to match. Note that we
                         * keep the device handle and event callback settings unchanged
                         * since these don't affect the actual hardware and we rely on
                         * the user to explicitly close the handle or deregister callbacks
                         */
                        vCodec.busID = AUDIO_DATA_BUS_2;
                        vCodec.protocol = NETWORK_MODE;
                        vCodec.protocol_set = false;
                        vCodec.masterSlave = BUS_SLAVE_MODE;
                        vCodec.numSlots = USE_4_TIMESLOTS;
                        vCodec.clockIn = CLOCK_IN_CLIB;
                        vCodec.samplingRate = VCODEC_RATE_8_KHZ;
                        vCodec.clockFreq = VCODEC_CLI_13MHZ;
                        vCodec.invert = NO_INVERT;
                        vCodec.timeslot = USE_TS0;
                        vCodec.config =
                            INPUT_HIGHPASS_FILTER |
                            OUTPUT_HIGHPASS_FILTER;

                  }
            }

      } else if ((handle == extStereoIn.handle) &&
               (extStereoIn.handleState == HANDLE_IN_USE)) {
            /* Disable the Ext stereo Amplifier and disable it as analog mixer input */
            reg_mask = SET_BITS(regAUDIO_RX_1, ARXINEN, 1);
            pmic_write_reg(REG_AUDIO_RX_1, 0, reg_mask);

            reg_mask = SET_BITS(regAUDIO_RX_0, ADDRXIN, 1);
            pmic_write_reg(REG_AUDIO_RX_0, 0, reg_mask);

            /* We don't need to reset any other registers for this case. */
            rc = PMIC_SUCCESS;
      }

      return rc;
}


Generated by  Doxygen 1.6.0   Back to index