linux/drivers/mxc/pmic/mc13783/pmic_audio.c File Reference

Implementation of the PMIC(mc13783) Audio driver APIs. More...

Data Structures

struct  PMIC_MICROPHONE_STATE
 This structure is used to track the state of a microphone input. More...
struct  REGFIELD
 This structure is used to define a specific hardware register field. More...
struct  REGISTER_AUD_CODEC
 This structure lists all fields of the AUD_CODEC hardware register. More...
struct  REGISTER_ST_DAC
 This structure lists all fields of the ST_DAC hardware register. More...
struct  REGISTER_SSI_NETWORK
 This structure lists all of the fields in the SSI_NETWORK hardware register. More...
struct  REGISTER_AUDIO_TX
 This structure lists all fields of the AUDIO_TX hardware register. More...
struct  REGISTER_AUDIO_RX_0
 This structure lists all fields of the AUDIO_RX_0 hardware register. More...
struct  REGISTER_AUDIO_RX_1
 This structure lists all fields of the AUDIO_RX_1 hardware register. More...
struct  PMIC_AUDIO_STDAC_STATE
 This structure maintains the current state of the Stereo DAC. More...
struct  PMIC_AUDIO_VCODEC_STATE
 This structure maintains the current state of the Voice CODEC. More...
struct  PMIC_AUDIO_EXT_STEREO_IN_STATE
 This maintains the current state of the External Stereo Input. More...
struct  PMIC_AUDIO_EVENT_STATE
 This maintains the current state of the callback & Eventmask. More...
struct  PMIC_AUDIO_AUDIO_OUTPUT_STATE
 This maintains the current state of the Audio Output Section. More...

Defines

#define SET_BITS(reg, field, value)
#define GET_BITS(reg, field, value)

Enumerations

enum  HANDLE_STATE {
  HANDLE_FREE,
  HANDLE_IN_USE,
  HANDLE_FREE,
  HANDLE_IN_USE
}
enum  PMIC_CORE_EVENT {
  CORE_EVENT_MC2BI,
  CORE_EVENT_HSDETI,
  CORE_EVENT_HSLI,
  CORE_EVENT_ALSPTHI,
  CORE_EVENT_AHSSHORTI,
  CORE_EVENT_4V4 = 1,
  CORE_EVENT_2V0 = 2,
  CORE_EVENT_0V8 = 4,
  CORE_EVENT_ABDET = 8
}
enum  HEADSET_STATUS {
  NO_HEADSET,
  HEADSET_ON
}
enum  PMIC_AUDIO_VCODEC_OUTPUT_PATH {
  VCODEC_DIRECT_OUT,
  VCODEC_MIXER_OUT
}

Functions

static DEFINE_SPINLOCK (lock)
static DECLARE_MUTEX (mutex)
Audio Driver Internal Support Functions

These non-exported internal functions are used to support the functionality of the exported audio APIs.

static PMIC_STATUS pmic_audio_close_handle (const PMIC_AUDIO_HANDLE handle)
static PMIC_STATUS pmic_audio_reset_device (const PMIC_AUDIO_HANDLE handle)
static PMIC_STATUS pmic_audio_deregister (void *callback, PMIC_AUDIO_EVENTS *const eventMask)
PMIC_STATUS pmic_audio_fm_output_enable (bool enable)
General Setup and Configuration APIs

Functions for general setup and configuration of the PMIC Audio hardware.

PMIC_STATUS pmic_audio_set_autodetect (int val)
PMIC_STATUS pmic_audio_open (PMIC_AUDIO_HANDLE *const handle, const PMIC_AUDIO_SOURCE device)
PMIC_STATUS pmic_audio_close (const PMIC_AUDIO_HANDLE handle)
PMIC_STATUS pmic_audio_set_protocol (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_DATA_BUS busID, const PMIC_AUDIO_BUS_PROTOCOL protocol, const PMIC_AUDIO_BUS_MODE masterSlave, const PMIC_AUDIO_NUMSLOTS numSlots)
PMIC_STATUS pmic_audio_get_protocol (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_DATA_BUS *const busID, PMIC_AUDIO_BUS_PROTOCOL *const protocol, PMIC_AUDIO_BUS_MODE *const masterSlave, PMIC_AUDIO_NUMSLOTS *const numSlots)
PMIC_STATUS pmic_audio_enable (const PMIC_AUDIO_HANDLE handle)
PMIC_STATUS pmic_audio_disable (const PMIC_AUDIO_HANDLE handle)
PMIC_STATUS pmic_audio_reset (const PMIC_AUDIO_HANDLE handle)
PMIC_STATUS pmic_audio_reset_all (void)
PMIC_STATUS pmic_audio_set_callback (void *func, const PMIC_AUDIO_EVENTS eventMask, PMIC_HS_STATE *hs_state)
PMIC_STATUS pmic_audio_clear_callback (void)
PMIC_STATUS pmic_audio_get_callback (PMIC_AUDIO_CALLBACK *const func, PMIC_AUDIO_EVENTS *const eventMask)
PMIC_STATUS pmic_audio_antipop_enable (const PMIC_AUDIO_ANTI_POP_RAMP_SPEED rampSpeed)
PMIC_STATUS pmic_audio_antipop_disable (void)
PMIC_STATUS pmic_audio_digital_filter_reset (const PMIC_AUDIO_HANDLE handle)
PMIC_STATUS pmic_audio_get_ptt_button_level (unsigned int *const level)
General Voice CODEC Setup and Configuration APIs

Functions for general setup and configuration of the PMIC Voice CODEC hardware.

PMIC_STATUS pmic_audio_vcodec_set_clock (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_CLOCK_IN_SOURCE clockIn, const PMIC_AUDIO_VCODEC_CLOCK_IN_FREQ clockFreq, const PMIC_AUDIO_VCODEC_SAMPLING_RATE samplingRate, const PMIC_AUDIO_CLOCK_INVERT invert)
PMIC_STATUS pmic_audio_vcodec_get_clock (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_CLOCK_IN_SOURCE *const clockIn, PMIC_AUDIO_VCODEC_CLOCK_IN_FREQ *const clockFreq, PMIC_AUDIO_VCODEC_SAMPLING_RATE *const samplingRate, PMIC_AUDIO_CLOCK_INVERT *const invert)
PMIC_STATUS pmic_audio_vcodec_set_rxtx_timeslot (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_VCODEC_TIMESLOT timeslot)
PMIC_STATUS pmic_audio_vcodec_get_rxtx_timeslot (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_VCODEC_TIMESLOT *const timeslot)
PMIC_STATUS pmic_audio_vcodec_set_secondary_txslot (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_VCODEC_TIMESLOT timeslot)
PMIC_STATUS pmic_audio_vcodec_get_secondary_txslot (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_VCODEC_TIMESLOT *const timeslot)
PMIC_STATUS pmic_audio_vcodec_set_config (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_VCODEC_CONFIG config)
PMIC_STATUS pmic_audio_vcodec_clear_config (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_VCODEC_CONFIG config)
PMIC_STATUS pmic_audio_vcodec_get_config (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_VCODEC_CONFIG *const config)
PMIC_STATUS pmic_audio_vcodec_enable_bypass (const PMIC_AUDIO_HANDLE handle)
PMIC_STATUS pmic_audio_vcodec_disable_bypass (const PMIC_AUDIO_HANDLE handle)
General Stereo DAC Setup and Configuration APIs

Functions for general setup and configuration of the PMIC Stereo DAC hardware.

PMIC_STATUS pmic_audio_stdac_set_clock (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_CLOCK_IN_SOURCE clockIn, const PMIC_AUDIO_STDAC_CLOCK_IN_FREQ clockFreq, const PMIC_AUDIO_STDAC_SAMPLING_RATE samplingRate, const PMIC_AUDIO_CLOCK_INVERT invert)
PMIC_STATUS pmic_audio_stdac_get_clock (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_CLOCK_IN_SOURCE *const clockIn, PMIC_AUDIO_STDAC_SAMPLING_RATE *const samplingRate, PMIC_AUDIO_STDAC_CLOCK_IN_FREQ *const clockFreq, PMIC_AUDIO_CLOCK_INVERT *const invert)
PMIC_STATUS pmic_audio_stdac_set_rxtx_timeslot (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_STDAC_TIMESLOTS timeslot)
PMIC_STATUS pmic_audio_stdac_get_rxtx_timeslot (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_STDAC_TIMESLOTS *const timeslot)
PMIC_STATUS pmic_audio_stdac_set_config (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_STDAC_CONFIG config)
PMIC_STATUS pmic_audio_stdac_clear_config (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_STDAC_CONFIG config)
PMIC_STATUS pmic_audio_stdac_get_config (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_STDAC_CONFIG *const config)
Audio Input Setup and Configuration APIs

Functions for general setup and configuration of the PMIC audio input hardware.

PMIC_STATUS pmic_audio_input_set_config (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_INPUT_CONFIG config)
PMIC_STATUS pmic_audio_input_clear_config (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_INPUT_CONFIG config)
PMIC_STATUS pmic_audio_input_get_config (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_INPUT_CONFIG *const config)
Audio Recording Using the Voice CODEC Setup and Configuration APIs

Functions for general setup and configuration of the PMIC Voice CODEC to perform audio recording.

PMIC_STATUS pmic_audio_vcodec_set_mic (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_INPUT_PORT leftChannel, const PMIC_AUDIO_INPUT_PORT rightChannel)
PMIC_STATUS pmic_audio_vcodec_get_mic (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_INPUT_PORT *const leftChannel, PMIC_AUDIO_INPUT_PORT *const rightChannel)
PMIC_STATUS pmic_audio_vcodec_set_mic_on_off (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_INPUT_MIC_STATE leftChannel, const PMIC_AUDIO_INPUT_MIC_STATE rightChannel)
PMIC_STATUS pmic_audio_vcodec_get_mic_on_off (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_INPUT_MIC_STATE *const leftChannel, PMIC_AUDIO_INPUT_MIC_STATE *const rightChannel)
PMIC_STATUS pmic_audio_vcodec_set_record_gain (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_MIC_AMP_MODE leftChannelMode, const PMIC_AUDIO_MIC_GAIN leftChannelGain, const PMIC_AUDIO_MIC_AMP_MODE rightChannelMode, const PMIC_AUDIO_MIC_GAIN rightChannelGain)
PMIC_STATUS pmic_audio_vcodec_get_record_gain (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_MIC_AMP_MODE *const leftChannelMode, PMIC_AUDIO_MIC_GAIN *const leftChannelGain, PMIC_AUDIO_MIC_AMP_MODE *const rightChannelMode, PMIC_AUDIO_MIC_GAIN *const rightChannelGain)
PMIC_STATUS pmic_audio_vcodec_enable_micbias (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_MIC_BIAS biasCircuit)
PMIC_STATUS pmic_audio_vcodec_disable_micbias (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_MIC_BIAS biasCircuit)
Audio Playback Using the Voice CODEC Setup and Configuration APIs

Functions for general setup and configuration of the PMIC Voice CODEC to perform audio playback.

PMIC_STATUS pmic_audio_vcodec_enable_mixer (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_VCODEC_TIMESLOT rxSecondaryTimeslot, const PMIC_AUDIO_VCODEC_MIX_IN_GAIN gainIn, const PMIC_AUDIO_VCODEC_MIX_OUT_GAIN gainOut)
PMIC_STATUS pmic_audio_vcodec_disable_mixer (const PMIC_AUDIO_HANDLE handle)
Audio Playback Using the Stereo DAC Setup and Configuration APIs

Functions for general setup and configuration of the PMIC Stereo DAC to perform audio playback.

PMIC_STATUS pmic_audio_stdac_enable_mixer (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_STDAC_TIMESLOTS rxSecondaryTimeslot, const PMIC_AUDIO_STDAC_MIX_IN_GAIN gainIn, const PMIC_AUDIO_STDAC_MIX_OUT_GAIN gainOut)
PMIC_STATUS pmic_audio_stdac_disable_mixer (const PMIC_AUDIO_HANDLE handle)
Audio Output Section Setup and Configuration APIs

Functions for general setup and configuration of the PMIC audio output section to support playback.

PMIC_STATUS pmic_audio_output_set_port (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_OUTPUT_PORT port)
PMIC_STATUS pmic_audio_output_clear_port (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_OUTPUT_PORT port)
PMIC_STATUS pmic_audio_output_get_port (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_OUTPUT_PORT *const port)
PMIC_STATUS pmic_audio_output_set_stereo_in_gain (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_STEREO_IN_GAIN gain)
PMIC_STATUS pmic_audio_output_get_stereo_in_gain (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_STEREO_IN_GAIN *const gain)
PMIC_STATUS pmic_audio_output_set_pgaGain (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_OUTPUT_PGA_GAIN gain)
PMIC_STATUS pmic_audio_output_get_pgaGain (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_OUTPUT_PGA_GAIN *const gain)
PMIC_STATUS pmic_audio_output_enable_mixer (const PMIC_AUDIO_HANDLE handle)
PMIC_STATUS pmic_audio_output_disable_mixer (const PMIC_AUDIO_HANDLE handle)
PMIC_STATUS pmic_audio_output_set_balance (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_OUTPUT_BALANCE_GAIN leftGain, const PMIC_AUDIO_OUTPUT_BALANCE_GAIN rightGain)
PMIC_STATUS pmic_audio_output_get_balance (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_OUTPUT_BALANCE_GAIN *const leftGain, PMIC_AUDIO_OUTPUT_BALANCE_GAIN *const rightGain)
PMIC_STATUS pmic_audio_output_enable_mono_adder (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_MONO_ADDER_MODE mode)
PMIC_STATUS pmic_audio_output_disable_mono_adder (const PMIC_AUDIO_HANDLE handle)
PMIC_STATUS pmic_audio_output_set_mono_adder_gain (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_MONO_ADDER_OUTPUT_GAIN gain)
PMIC_STATUS pmic_audio_output_get_mono_adder_gain (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_MONO_ADDER_OUTPUT_GAIN *const gain)
PMIC_STATUS pmic_audio_output_set_config (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_OUTPUT_CONFIG config)
PMIC_STATUS pmic_audio_output_clear_config (const PMIC_AUDIO_HANDLE handle, const PMIC_AUDIO_OUTPUT_CONFIG config)
PMIC_STATUS pmic_audio_output_get_config (const PMIC_AUDIO_HANDLE handle, PMIC_AUDIO_OUTPUT_CONFIG *const config)
PMIC_STATUS pmic_audio_output_enable_phantom_ground ()
PMIC_STATUS pmic_audio_output_disable_phantom_ground ()
Audio Driver Loading/Unloading Functions

These non-exported internal functions are used to support the audio device driver initialization and de-initialization operations.

static int __init mc13783_pmic_audio_init (void)
static void __exit mc13783_pmic_audio_exit (void)

Variables

const unsigned MIN_STDAC_SAMPLING_RATE_HZ = 8000
const unsigned MAX_STDAC_SAMPLING_RATE_HZ = 96000
static const REGISTER_AUD_CODEC regAUD_CODEC
static const REGISTER_ST_DAC regST_DAC
static const REGISTER_SSI_NETWORK regSSI_NETWORK
static const REGISTER_AUDIO_TX regAUDIO_TX
static const REGISTER_AUDIO_RX_0 regAUDIO_RX_0
static const REGISTER_AUDIO_RX_1 regAUDIO_RX_1
static const unsigned int REG_FULLMASK = 0xffffff
static const unsigned int RESET_AUD_CODEC = 0x180027
static const unsigned int RESET_ST_DAC = 0x0E0004
static const unsigned int RESET_SSI_NETWORK = 0x013060
static const unsigned int RESET_AUDIO_TX = 0x420000
static const unsigned int RESET_AUDIO_RX_0 = 0x001000
static const unsigned int RESET_AUDIO_RX_1 = 0x00D35A
static const unsigned int REG_SSI_VCODEC_MASK = 0x000fff
static const unsigned int REG_SSI_STDAC_MASK = 0xfff000
static const PMIC_AUDIO_HANDLE AUDIO_HANDLE_NULL = (PMIC_AUDIO_HANDLE) NULL
static PMIC_AUDIO_STDAC_STATE stDAC
static PMIC_AUDIO_VCODEC_STATE vCodec
static
PMIC_AUDIO_EXT_STEREO_IN_STATE 
extStereoIn
static
PMIC_AUDIO_AUDIO_OUTPUT_STATE 
audioOutput
static HEADSET_STATUS headsetState = NO_HEADSET
static const unsigned long delay_1ms = (HZ / 1000)

Detailed Description

Implementation of the PMIC(mc13783) Audio driver APIs.

The PMIC Audio driver and this API were developed to support the audio playback, recording, and mixing capabilities of the power management ICs that are available from Freescale Semiconductor, Inc.

The following operating modes are supported:

       Operating Mode               mc13783
       ---------------------------- -------
       Stereo DAC Playback           Yes
       Stereo DAC Input Mixing       Yes
       Voice CODEC Playback          Yes
       Voice CODEC Input Mixing      Yes
       Voice CODEC Mono Recording    Yes
       Voice CODEC Stereo Recording  Yes
       Microphone Bias Control       Yes
       Output Amplifier Control      Yes
       Output Mixing Control         Yes
       Input Amplifier Control       Yes
       Master/Slave Mode Select      Yes
       Anti Pop Bias Circuit Control Yes
   

Note that the Voice CODEC may also be referred to as the Telephone CODEC in the PMIC DTS documentation. Also note that, while the power management ICs do provide similar audio capabilities, each PMIC may support additional configuration settings and features. Therefore, it is highly recommended that the appropriate power management IC DTS documents be used in conjunction with this API interface.


Define Documentation

#define GET_BITS ( reg,
field,
value   ) 
Value:
(((value) & reg.field.mask) >> \
                reg.field.offset)

Get the current value of a given register field.

#define SET_BITS ( reg,
field,
value   ) 
Value:
(((value) << reg.field.offset) & \
                reg.field.mask)

Set a register field to a given value.

Referenced by pmic_audio_antipop_disable(), pmic_audio_antipop_enable(), pmic_audio_digital_filter_reset(), pmic_audio_disable(), pmic_audio_enable(), pmic_audio_fm_output_enable(), pmic_audio_output_clear_config(), pmic_audio_output_clear_port(), pmic_audio_output_disable_mixer(), pmic_audio_output_disable_mono_adder(), pmic_audio_output_disable_phantom_ground(), pmic_audio_output_enable_mixer(), pmic_audio_output_enable_mono_adder(), pmic_audio_output_enable_phantom_ground(), pmic_audio_output_set_balance(), pmic_audio_output_set_config(), pmic_audio_output_set_pgaGain(), pmic_audio_output_set_port(), pmic_audio_output_set_stereo_in_gain(), pmic_audio_reset_device(), pmic_audio_set_protocol(), pmic_audio_stdac_clear_config(), pmic_audio_stdac_disable_mixer(), pmic_audio_stdac_enable_mixer(), pmic_audio_stdac_set_clock(), pmic_audio_stdac_set_config(), pmic_audio_stdac_set_rxtx_timeslot(), pmic_audio_vcodec_clear_config(), pmic_audio_vcodec_disable_bypass(), pmic_audio_vcodec_disable_micbias(), pmic_audio_vcodec_disable_mixer(), pmic_audio_vcodec_enable_bypass(), pmic_audio_vcodec_enable_micbias(), pmic_audio_vcodec_enable_mixer(), pmic_audio_vcodec_set_clock(), pmic_audio_vcodec_set_config(), pmic_audio_vcodec_set_mic(), pmic_audio_vcodec_set_mic_on_off(), pmic_audio_vcodec_set_record_gain(), pmic_audio_vcodec_set_rxtx_timeslot(), pmic_audio_vcodec_set_secondary_txslot(), pmic_convity_cea936_exit_signal(), pmic_convity_rs232_set_config(), pmic_convity_set_mode_internal(), pmic_convity_set_output(), pmic_convity_usb_otg_clear_config(), pmic_convity_usb_otg_set_config(), pmic_convity_usb_set_power_source(), pmic_convity_usb_set_speed(), and pmic_convity_usb_set_xcvr().


Enumeration Type Documentation

Define the possible states for a device handle.

This enumeration is used to track the current state of each device handle.

Enumerator:
HANDLE_FREE 

Handle is available for use.

HANDLE_IN_USE 

Handle is currently in use.

HANDLE_FREE 

Handle is available for use.

HANDLE_IN_USE 

Handle is currently in use.

Tracks whether a headset is currently attached or not.

Enumerator:
NO_HEADSET 

No headset currently attached.

HEADSET_ON 

Headset has been attached.

mc13783 only enum that indicates the path to output taken by the voice codec output

Enumerator:
VCODEC_DIRECT_OUT 

Vcodec signal out direct

VCODEC_MIXER_OUT 

Output via the mixer

Identifies the hardware interrupt source.

This enumeration identifies which of the possible hardware interrupt sources actually caused the current interrupt handler to be called.

Enumerator:
CORE_EVENT_MC2BI 

Microphone Bias 2 detect.

CORE_EVENT_HSDETI 

Detect Headset attach

CORE_EVENT_HSLI 

Detect Stereo Headset

CORE_EVENT_ALSPTHI 

Detect Thermal shutdown of ALSP

CORE_EVENT_AHSSHORTI 

Detect Short circuit on AHS outputs

CORE_EVENT_4V4 

Detected USB 4.4 V event.

CORE_EVENT_2V0 

Detected USB 2.0 V event.

CORE_EVENT_0V8 

Detected USB 0.8 V event.

CORE_EVENT_ABDET 

Detected USB mini A-B connector event.


Function Documentation

static DECLARE_MUTEX ( mutex   )  [static]

This mutex is used to provide mutual exclusion.

Create a mutex that can be used to provide mutually exclusive read/write access to the globally accessible data structures that were defined above. Mutually exclusive access is required to ensure that the audio data structures are consistent at all times when possibly accessed by multiple threads of execution.

Note that we use a mutex instead of the spinlock whenever disabling interrupts while in the critical section is not required. This helps to minimize kernel interrupt handling latency.

static DEFINE_SPINLOCK ( lock   )  [static]

This spinlock is used to provide mutual exclusion.

Create a spinlock that can be used to provide mutually exclusive read/write access to the globally accessible data structures that were defined above. Mutually exclusive access is required to ensure that the audio data structures are consistent at all times when possibly accessed by multiple threads of execution (for example, while simultaneously handling a user request and an interrupt event).

We need to use a spinlock whenever we do need to provide mutual exclusion while possibly executing in a hardware interrupt context. Spinlocks should be held for the minimum time that is necessary because hardware interrupts are disabled while a spinlock is held.

static void __exit mc13783_pmic_audio_exit ( void   )  [static]
static int __init mc13783_pmic_audio_init ( void   )  [static]

This is the audio device driver initialization function.

This function is called by the kernel when this device driver is first loaded.

PMIC_STATUS pmic_audio_antipop_disable ( void   ) 

Disable the anti-pop circuitry.

Disable the use of the built-in anti-pop circuitry to prevent noise from being generated when an external audio device is inserted or removed from an audio plug.

Return values:
PMIC_SUCCESS If the anti-pop circuitry was successfully disabled.
PMIC_ERROR If the anti-pop circuitry could not be disabled.

References pmic_write_reg(), and SET_BITS.

PMIC_STATUS pmic_audio_antipop_enable ( const PMIC_AUDIO_ANTI_POP_RAMP_SPEED  rampSpeed  ) 

Enable the anti-pop circuitry to avoid extra noise when inserting or removing a external device (e.g., a headset).

Enable the use of the built-in anti-pop circuitry to prevent noise from being generated when an external audio device is inserted or removed from an audio plug. A slow ramp speed may be needed to avoid extra noise.

Parameters:
rampSpeed The desired anti-pop circuitry ramp speed.
Return values:
PMIC_SUCCESS If the anti-pop circuitry was successfully enabled.
PMIC_ERROR If the anti-pop circuitry could not be enabled.

References pmic_write_reg(), and SET_BITS.

Referenced by pmic_audio_fm_output_enable().

PMIC_STATUS pmic_audio_clear_callback ( void   ) 

Deregisters the existing audio callback function.

Deregister the callback function that was previously registered by calling pmic_audio_set_callback().

Return values:
PMIC_SUCCESS If the callback was successfully deregistered.
PMIC_PARAMETER_ERROR If the handle is invalid.

References PMIC_AUDIO_EVENT_STATE::callback, PMIC_AUDIO_EVENT_STATE::eventMask, and pmic_audio_deregister().

PMIC_STATUS pmic_audio_close ( const PMIC_AUDIO_HANDLE  handle  ) 

Terminate further access to the PMIC audio hardware.

Terminate further access to the PMIC audio hardware that was previously acquired by calling pmic_audio_open(). This now allows another thread to successfully call pmic_audio_open() to gain access.

Note that we will shutdown/reset the Voice CODEC or Stereo DAC as well as any associated audio input/output components that are no longer required.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the close request was successful.
PMIC_PARAMETER_ERROR If the handle is invalid.

References pmic_audio_close_handle().

Referenced by mc13783_pmic_audio_exit().

static PMIC_STATUS pmic_audio_close_handle ( const PMIC_AUDIO_HANDLE  handle  )  [static]

Global variable to track currently active interrupt events.

Enables the 5.6V boost for the microphone bias 2 circuit.

This global variable is used to keep track of all of the currently active interrupt events for the audio driver. Note that access to this variable may occur while within an interrupt context and, therefore, must be guarded by using a spinlock.

This function enables the switching regulator SW3 and configures it to provide the 5.6V boost that is required for driving the microphone bias 2 circuit when using a 5-pole jack configuration (which is the case for the Sphinx board).

Return values:
PMIC_SUCCESS The 5.6V boost was successfully enabled.
PMIC_ERROR Failed to enable the 5.6V boost.

Disables the 5.6V boost for the microphone bias 2 circuit. This function disables the switching regulator SW3 to turn off the 5.6V boost for the microphone bias 2 circuit.

Return values:
PMIC_SUCCESS The 5.6V boost was successfully disabled.
PMIC_ERROR Failed to disable the 5.6V boost.

Free a device handle previously acquired by calling pmic_audio_open(). Terminate further access to the PMIC audio hardware that was previously acquired by calling pmic_audio_open(). This now allows another thread to successfully call pmic_audio_open() to gain access.

Note that we will shutdown/reset the Voice CODEC or Stereo DAC as well as any associated audio input/output components that are no longer required.

Also note that this function should only be called with the mutex already acquired.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the close request was successful.
PMIC_PARAMETER_ERROR If the handle is invalid.

References AUDIO_HANDLE_NULL, PMIC_AUDIO_EXT_STEREO_IN_STATE::handle, PMIC_AUDIO_VCODEC_STATE::handle, PMIC_AUDIO_STDAC_STATE::handle, HANDLE_FREE, HANDLE_IN_USE, PMIC_AUDIO_EXT_STEREO_IN_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_STDAC_STATE::handleState, and pmic_audio_reset_device().

Referenced by pmic_audio_close(), and pmic_audio_reset_all().

static PMIC_STATUS pmic_audio_deregister ( void *  callback,
PMIC_AUDIO_EVENTS *const   eventMask 
) [static]

Deregister the callback function and event mask currently associated with an audio device handle.

This function deregisters any existing callback function and event mask for the given audio device handle. This is done by either calling the pmic_audio_clear_callback() API or by closing the device handle.

Note that this function should only be called with the mutex already acquired. We will also acquire the spinlock here to prevent possible race conditions with the interrupt handler.

Parameters:
[in] callback The current event callback function pointer.
[in] eventMask The current audio event mask.
Return values:
PMIC_SUCCESS If the callback function and event mask were both successfully deregistered.
PMIC_ERROR If either the callback function or the event mask was not successfully deregistered.

References CORE_EVENT_AHSSHORTI, CORE_EVENT_ALSPTHI, CORE_EVENT_HSDETI, CORE_EVENT_HSLI, pmic_event_callback_t::func, pmic_event_callback_t::param, and pmic_event_unsubscribe().

Referenced by pmic_audio_clear_callback().

PMIC_STATUS pmic_audio_digital_filter_reset ( const PMIC_AUDIO_HANDLE  handle  ) 

Performs a reset of the Voice CODEC/Stereo DAC digital filter.

The digital filter should be reset whenever the clock or sampling rate configuration has been changed.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the digital filter was successfully reset.
PMIC_ERROR If the digital filter could not be reset.

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

PMIC_STATUS pmic_audio_disable ( const PMIC_AUDIO_HANDLE  handle  ) 

Disable the Stereo DAC or the Voice CODEC.

Explicitly disable the Stereo DAC or the Voice CODEC to end audio playback or recording as required.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the device was successful disabled.
PMIC_PARAMETER_ERROR If the handle is invalid.
PMIC_ERROR If the device could not be disabled.

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

PMIC_STATUS pmic_audio_enable ( const PMIC_AUDIO_HANDLE  handle  ) 

Enable the Stereo DAC or the Voice CODEC.

Explicitly enable the Stereo DAC or the Voice CODEC to begin audio playback or recording as required. This should only be done after successfully configuring all of the associated audio components (e.g., microphones, amplifiers, etc.).

Note that the timed delays used in this function are necessary to ensure reliable operation of the Voice CODEC and Stereo DAC. The Stereo DAC seems to be particularly sensitive and it has been observed to fail to generate the required master mode clock signals if it is not allowed enough time to initialize properly.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the device was successful enabled.
PMIC_PARAMETER_ERROR If the handle is invalid.
PMIC_ERROR If the device could not be enabled.

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

PMIC_STATUS pmic_audio_fm_output_enable ( bool  enable  ) 

enable/disable fm output.

Parameters:
[in] enable true to enable false to disable

References pmic_audio_antipop_enable(), pmic_write_reg(), and SET_BITS.

PMIC_STATUS pmic_audio_get_callback ( PMIC_AUDIO_CALLBACK *const   func,
PMIC_AUDIO_EVENTS *const   eventMask 
)

Get the current audio callback function settings.

Get the current callback function and event mask.

Parameters:
func The current callback function.
eventMask The current event selection mask.
Return values:
PMIC_SUCCESS If the callback information was successfully retrieved.
PMIC_PARAMETER_ERROR If the handle is invalid.

References PMIC_AUDIO_EVENT_STATE::callback, and PMIC_AUDIO_EVENT_STATE::eventMask.

PMIC_STATUS pmic_audio_get_protocol ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_DATA_BUS *const   busID,
PMIC_AUDIO_BUS_PROTOCOL *const   protocol,
PMIC_AUDIO_BUS_MODE *const   masterSlave,
PMIC_AUDIO_NUMSLOTS *const   numSlots 
)

Retrieve the current data bus protocol configuration.

Retrieve the parameters that define the current audio data bus protocol.

Parameters:
handle Device handle from pmic_audio_open() call.
busID The data bus being used.
protocol The data bus protocol being used.
masterSlave The data bus timing mode being used.
numSlots The number of timeslots being used (if in master mode).
Return values:
PMIC_SUCCESS If the protocol was successful retrieved.
PMIC_PARAMETER_ERROR If the handle is invalid.

References PMIC_AUDIO_VCODEC_STATE::busID, PMIC_AUDIO_STDAC_STATE::busID, PMIC_AUDIO_VCODEC_STATE::handle, PMIC_AUDIO_STDAC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_STDAC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::masterSlave, PMIC_AUDIO_STDAC_STATE::masterSlave, PMIC_AUDIO_VCODEC_STATE::numSlots, PMIC_AUDIO_STDAC_STATE::numSlots, PMIC_AUDIO_VCODEC_STATE::protocol, and PMIC_AUDIO_STDAC_STATE::protocol.

PMIC_STATUS pmic_audio_get_ptt_button_level ( unsigned int *const   level  ) 

Get the most recent PTT button voltage reading.

This feature is not supported by mc13783

Parameters:
level PTT button level.
Return values:
PMIC_SUCCESS If the most recent PTT button voltage was returned.
PMIC_PARAMETER_ERROR If a NULL pointer argument was given.
PMIC_STATUS pmic_audio_input_clear_config ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_INPUT_CONFIG  config 
)

Clear/Disable the audio input section options.

Clear or disable various audio input section options.

Parameters:
handle Device handle from pmic_audio_open() call.
config The audio input section options to be cleared/disabled. NOT SUPPORTED BY MC13783
Return values:
PMIC_SUCCESS If the audio input section options were successfully cleared/disabled.
PMIC_PARAMETER_ERROR If the handle or the audio input section options were invalid.
PMIC_ERROR If the audio input section options could not be cleared/disabled.
PMIC_STATUS pmic_audio_input_get_config ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_INPUT_CONFIG *const   config 
)

Get the current audio input section options.

Get the current audio input section options.

Parameters:
[in] handle Device handle from pmic_audio_open() call.
[out] config The current set of audio input section options. NOT SUPPORTED BY MC13783
Return values:
PMIC_SUCCESS If the audio input section options were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the audio input section options could not be retrieved.
PMIC_STATUS pmic_audio_input_set_config ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_INPUT_CONFIG  config 
)

Set/Enable the audio input section options.

Set or enable various audio input section options. The only available option right now is to enable the automatic disabling of the microphone input amplifiers when a microphone/headset is inserted or removed. NOT SUPPORTED BY MC13783

Parameters:
handle Device handle from pmic_audio_open() call.
config The audio input section options to enable.
Return values:
PMIC_SUCCESS If the audio input section options were successfully configured.
PMIC_PARAMETER_ERROR If the handle or audio input section options were invalid.
PMIC_ERROR If the audio input section options could not be successfully set/enabled.
PMIC_STATUS pmic_audio_open ( PMIC_AUDIO_HANDLE *const   handle,
const PMIC_AUDIO_SOURCE  device 
)

Request exclusive access to the PMIC Audio hardware.

Attempt to open and gain exclusive access to a key PMIC audio hardware component (e.g., the Stereo DAC or the Voice CODEC). Depending upon the type of audio operation that is desired and the nature of the audio data stream, the Stereo DAC and/or the Voice CODEC will be a required hardware component and needs to be acquired by calling this function.

If the open request is successful, then a numeric handle is returned and this handle must be used in all subsequent function calls to complete the configuration of either the Stereo DAC or the Voice CODEC and along with any other associated audio hardware components that will be needed.

The same handle must also be used in the close call when use of the PMIC audio hardware is no longer required.

The open request will fail if the requested audio hardware component has already been acquired by a previous open call but not yet closed.

Parameters:
handle Device handle to be used for subsequent PMIC audio API calls.
device The required PMIC audio hardware component.
Return values:
PMIC_SUCCESS If the open request was successful
PMIC_PARAMETER_ERROR If the handle argument is NULL.
PMIC_ERROR If the audio hardware component is unavailable.

References AUDIO_HANDLE_NULL, PMIC_AUDIO_EXT_STEREO_IN_STATE::handle, PMIC_AUDIO_VCODEC_STATE::handle, PMIC_AUDIO_STDAC_STATE::handle, HANDLE_FREE, HANDLE_IN_USE, PMIC_AUDIO_EXT_STEREO_IN_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::handleState, and PMIC_AUDIO_STDAC_STATE::handleState.

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.

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 pmic_audio_output_clear_port ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_OUTPUT_PORT  port 
)

Deselect/disable the audio output ports.

This function disables the audio output ports that were previously enabled by calling pmic_audio_output_set_port().

Parameters:
handle Device handle from pmic_audio_open() call.
port The audio output ports to be disabled.
Return values:
PMIC_SUCCESS If the audio output ports were successfully disabled.
PMIC_PARAMETER_ERROR If the handle or output ports were invalid.
PMIC_ERROR If the audio output ports could not be disabled.

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

PMIC_STATUS pmic_audio_output_disable_mixer ( const PMIC_AUDIO_HANDLE  handle  ) 

Disable the output mixer.

This function disables the output mixer for the audio stream that corresponds to the current handle (i.e., the Voice CODEC, Stereo DAC, or the external stereo inputs).

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the mixer was successfully disabled.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the mixer could not be disabled.

References 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(), SET_BITS, and VCODEC_DIRECT_OUT.

PMIC_STATUS pmic_audio_output_disable_mono_adder ( const PMIC_AUDIO_HANDLE  handle  ) 

Disable the output mono adder.

This function disables the output mono adder.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the mono adder was successfully disabled.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the mono adder could not be disabled.

References 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 pmic_audio_output_disable_phantom_ground (  ) 

Disable the phantom ground circuit that is used to help identify the type of headset that has been inserted.

This function disables the phantom ground circuit that is used to help identify the type of headset (e.g., stereo or mono) that has been inserted.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the phantom ground circuit was successfully disabled.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the phantom ground circuit could not be disabled.

References pmic_write_reg(), and SET_BITS.

PMIC_STATUS pmic_audio_output_enable_mixer ( const PMIC_AUDIO_HANDLE  handle  ) 

Enable the output mixer.

This function enables the output mixer for the audio stream that corresponds to the current handle (i.e., the Voice CODEC, Stereo DAC, or the external stereo inputs).

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the mixer was successfully enabled.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the mixer could not be enabled.

References 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(), SET_BITS, and VCODEC_MIXER_OUT.

PMIC_STATUS pmic_audio_output_enable_mono_adder ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_MONO_ADDER_MODE  mode 
)

Configure and enable the output mono adder.

This function configures and enables the output mono adder.

Parameters:
handle Device handle from pmic_audio_open() call.
mode The desired mono adder operating mode.
Return values:
PMIC_SUCCESS If the mono adder was successfully configured and enabled.
PMIC_PARAMETER_ERROR If the handle or mono adder mode was invalid.
PMIC_ERROR If the mono adder could not be reconfigured or enabled.

References 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 pmic_audio_output_enable_phantom_ground (  ) 

Enable the phantom ground circuit that is used to help identify the type of headset that has been inserted.

This function enables the phantom ground circuit that is used to help identify the type of headset (e.g., stereo or mono) that has been inserted.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the phantom ground circuit was successfully enabled.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the phantom ground circuit could not be enabled.

References pmic_write_reg(), and SET_BITS.

PMIC_STATUS pmic_audio_output_get_balance ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_OUTPUT_BALANCE_GAIN *const   leftGain,
PMIC_AUDIO_OUTPUT_BALANCE_GAIN *const   rightGain 
)

Get the current output balance amplifier gain levels.

This function retrieves the current output balance amplifier gain levels.

Parameters:
handle Device handle from pmic_audio_open() call.
leftGain The current left channel gain level.
rightGain The current right channel gain level.
Return values:
PMIC_SUCCESS If the output balance amplifier gain levels were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the output balance amplifier gain levels could be retrieved.

References PMIC_AUDIO_AUDIO_OUTPUT_STATE::balanceLeftGain, PMIC_AUDIO_AUDIO_OUTPUT_STATE::balanceRightGain, 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, and PMIC_AUDIO_STDAC_STATE::handleState.

PMIC_STATUS pmic_audio_output_get_config ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_OUTPUT_CONFIG *const   config 
)

Get the current audio output section options.

This function retrieves the current audio output section configuration option settings.

Parameters:
handle Device handle from pmic_audio_open() call.
config The current audio output section configuration option settings.
Return values:
PMIC_SUCCESS If the current configuration options were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the current configuration options could not be retrieved.

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, and PMIC_AUDIO_STDAC_STATE::handleState.

PMIC_STATUS pmic_audio_output_get_mono_adder_gain ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_MONO_ADDER_OUTPUT_GAIN *const   gain 
)

Get the current mono adder output gain level.

This function retrieves the current mono adder output amplifier gain level.

Parameters:
handle Device handle from pmic_audio_open() call.
gain The current output gain level.
Return values:
PMIC_SUCCESS If the mono adder output amplifier gain level was successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the mono adder output amplifier gain level could not be retrieved.
PMIC_STATUS pmic_audio_output_get_pgaGain ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_OUTPUT_PGA_GAIN *const   gain 
)

Get the output PGA gain level.

This function retrieves the current audio output PGA gain level.

Parameters:
handle Device handle from pmic_audio_open() call.
gain The current output PGA gain level.
Return values:
PMIC_SUCCESS If the gain level was successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the gain level could not be retrieved.

References PMIC_AUDIO_AUDIO_OUTPUT_STATE::extStereooutputPGAGain, PMIC_AUDIO_STDAC_STATE::handle, PMIC_AUDIO_VCODEC_STATE::handle, PMIC_AUDIO_EXT_STEREO_IN_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_STDAC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_EXT_STEREO_IN_STATE::handleState, PMIC_AUDIO_AUDIO_OUTPUT_STATE::stDacoutputPGAGain, and PMIC_AUDIO_AUDIO_OUTPUT_STATE::vCodecoutputPGAGain.

PMIC_STATUS pmic_audio_output_get_port ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_OUTPUT_PORT *const   port 
)

Get the current audio output ports.

This function retrieves the audio output ports that are currently being used.

Parameters:
handle Device handle from pmic_audio_open() call.
port The audio output ports currently being used.
Return values:
PMIC_SUCCESS If the audio output ports were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the audio output ports could not be retrieved.

References 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, and PMIC_AUDIO_AUDIO_OUTPUT_STATE::outputPort.

PMIC_STATUS pmic_audio_output_get_stereo_in_gain ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_STEREO_IN_GAIN *const   gain 
)

Get the current gain level for the external stereo inputs.

This function retrieves the current gain levels for the external stereo inputs.

Parameters:
handle Device handle from pmic_audio_open() call.
gain The current external stereo input gain level.
Return values:
PMIC_SUCCESS If the gain level was successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the gain level could not be retrieved.

References PMIC_AUDIO_EXT_STEREO_IN_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_EXT_STEREO_IN_STATE::handleState, and PMIC_AUDIO_EXT_STEREO_IN_STATE::inputGain.

PMIC_STATUS pmic_audio_output_set_balance ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_OUTPUT_BALANCE_GAIN  leftGain,
const PMIC_AUDIO_OUTPUT_BALANCE_GAIN  rightGain 
)

Configure and enable the output balance amplifiers.

This function configures and enables the output balance amplifiers.

Parameters:
handle Device handle from pmic_audio_open() call.
leftGain The desired left channel gain level.
rightGain The desired right channel gain level.
Return values:
PMIC_SUCCESS If the output balance amplifiers were successfully configured and enabled.
PMIC_PARAMETER_ERROR If the handle or gain levels were invalid.
PMIC_ERROR If the output balance amplifiers could not be reconfigured or enabled.

References PMIC_AUDIO_AUDIO_OUTPUT_STATE::balanceLeftGain, PMIC_AUDIO_AUDIO_OUTPUT_STATE::balanceRightGain, 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 pmic_audio_output_set_config ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_OUTPUT_CONFIG  config 
)

Set various audio output section options.

This function sets one or more audio output section configuration options. The currently supported options include whether to disable the non-inverting mono speaker output, enabling the loudspeaker common bias circuit, enabling detection of headset insertion/removal, and whether to automatically disable the headset amplifiers when a headset insertion/removal has been detected.

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

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 pmic_audio_output_set_mono_adder_gain ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_MONO_ADDER_OUTPUT_GAIN  gain 
)

Configure the mono adder output gain level.

This function configures the mono adder output amplifier gain level.

Parameters:
handle Device handle from pmic_audio_open() call.
gain The desired output gain level.
Return values:
PMIC_SUCCESS If the mono adder output amplifier gain level was successfully set.
PMIC_PARAMETER_ERROR If the handle or gain level was invalid.
PMIC_ERROR If the mono adder output amplifier gain level could not be reconfigured.
PMIC_STATUS pmic_audio_output_set_pgaGain ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_OUTPUT_PGA_GAIN  gain 
)

Set the output PGA gain level.

This function sets the audio output PGA gain level.

Parameters:
handle Device handle from pmic_audio_open() call.
gain The output PGA gain level.
Return values:
PMIC_SUCCESS If the gain level was successfully set.
PMIC_PARAMETER_ERROR If the handle or gain level was invalid.
PMIC_ERROR If the gain level could not be set.

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

PMIC_STATUS pmic_audio_output_set_port ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_OUTPUT_PORT  port 
)

Select the audio output ports.

This function selects the audio output ports to be used. This also enables the appropriate output amplifiers.

Parameters:
handle Device handle from pmic_audio_open() call.
port The audio output ports to be used.
Return values:
PMIC_SUCCESS If the audio output ports were successfully acquired.
PMIC_PARAMETER_ERROR If the handle or output ports were invalid.
PMIC_ERROR If the audio output ports could not be acquired.

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

PMIC_STATUS pmic_audio_output_set_stereo_in_gain ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_STEREO_IN_GAIN  gain 
)

Set the gain level for the external stereo inputs.

This function sets the gain levels for the external stereo inputs.

Parameters:
handle Device handle from pmic_audio_open() call.
gain The external stereo input gain level.
Return values:
PMIC_SUCCESS If the gain level was successfully set.
PMIC_PARAMETER_ERROR If the handle or gain level was invalid.
PMIC_ERROR If the gain level could not be set.

References PMIC_AUDIO_EXT_STEREO_IN_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_EXT_STEREO_IN_STATE::handleState, PMIC_AUDIO_EXT_STEREO_IN_STATE::inputGain, pmic_write_reg(), and SET_BITS.

PMIC_STATUS pmic_audio_reset ( const PMIC_AUDIO_HANDLE  handle  ) 

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.

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.

References pmic_audio_reset_device().

PMIC_STATUS pmic_audio_reset_all ( void   ) 

Reset all audio hardware control registers to their power on state.

This resets all of the audio hardware control registers back to their power on states. Use this function with care since it also invalidates (i.e., automatically closes) all currently opened device handles.

Return values:
PMIC_SUCCESS If the reset operation was successful.
PMIC_ERROR If the reset was unsuccessful.

References PMIC_MICROPHONE_STATE::ampMode, PMIC_AUDIO_AUDIO_OUTPUT_STATE::balanceLeftGain, PMIC_AUDIO_AUDIO_OUTPUT_STATE::balanceRightGain, 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_AUDIO_OUTPUT_STATE::config, PMIC_AUDIO_VCODEC_STATE::config, PMIC_AUDIO_STDAC_STATE::config, PMIC_AUDIO_AUDIO_OUTPUT_STATE::extStereooutputPGAGain, PMIC_MICROPHONE_STATE::gain, PMIC_AUDIO_EXT_STEREO_IN_STATE::handle, PMIC_AUDIO_VCODEC_STATE::handle, PMIC_AUDIO_STDAC_STATE::handle, PMIC_AUDIO_VCODEC_STATE::invert, PMIC_AUDIO_STDAC_STATE::invert, PMIC_AUDIO_VCODEC_STATE::leftChannelMic, PMIC_AUDIO_VCODEC_STATE::masterSlave, PMIC_AUDIO_STDAC_STATE::masterSlave, PMIC_MICROPHONE_STATE::mic, PMIC_MICROPHONE_STATE::micOnOff, PMIC_AUDIO_AUDIO_OUTPUT_STATE::monoAdderGain, NO_HEADSET, PMIC_AUDIO_VCODEC_STATE::numSlots, PMIC_AUDIO_STDAC_STATE::numSlots, PMIC_AUDIO_AUDIO_OUTPUT_STATE::outputPort, pmic_audio_close_handle(), pmic_write_reg(), PMIC_AUDIO_VCODEC_STATE::protocol, PMIC_AUDIO_STDAC_STATE::protocol, RESET_AUD_CODEC, RESET_AUDIO_RX_0, RESET_AUDIO_RX_1, RESET_AUDIO_TX, RESET_SSI_NETWORK, RESET_ST_DAC, PMIC_AUDIO_VCODEC_STATE::rightChannelMic, PMIC_AUDIO_VCODEC_STATE::samplingRate, PMIC_AUDIO_STDAC_STATE::samplingRate, PMIC_AUDIO_AUDIO_OUTPUT_STATE::stDacoutputPGAGain, PMIC_AUDIO_VCODEC_STATE::timeslot, PMIC_AUDIO_STDAC_STATE::timeslot, VCODEC_DIRECT_OUT, and PMIC_AUDIO_AUDIO_OUTPUT_STATE::vCodecoutputPGAGain.

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.

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, 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 pmic_audio_set_callback ( void *  func,
const PMIC_AUDIO_EVENTS  eventMask,
PMIC_HS_STATE *  hs_state 
)

Set the Audio callback function.

Register a callback function that will be used to signal PMIC audio events. For example, the OSS audio driver should register a callback function in order to be notified of headset connect/disconnect events.

Parameters:
func A pointer to the callback function.
eventMask A mask selecting events to be notified.
hs_state To know the headset state.
Return values:
PMIC_SUCCESS If the callback was successfully registered.
PMIC_PARAMETER_ERROR If the handle or the eventMask is invalid.

References PMIC_AUDIO_EVENT_STATE::callback, CORE_EVENT_AHSSHORTI, CORE_EVENT_ALSPTHI, CORE_EVENT_HSDETI, CORE_EVENT_HSLI, CORE_EVENT_MC2BI, PMIC_AUDIO_EVENT_STATE::eventMask, pmic_event_callback_t::func, pmic_event_callback_t::param, pmic_event_subscribe(), and pmic_event_unsubscribe().

PMIC_STATUS pmic_audio_set_protocol ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_DATA_BUS  busID,
const PMIC_AUDIO_BUS_PROTOCOL  protocol,
const PMIC_AUDIO_BUS_MODE  masterSlave,
const PMIC_AUDIO_NUMSLOTS  numSlots 
)

Configure the data bus protocol to be used.

Provide the parameters needed to properly configure the audio data bus protocol so that data can be read/written to either the Stereo DAC or the Voice CODEC.

Parameters:
handle Device handle from pmic_audio_open() call.
busID Select data bus to be used.
protocol Select the data bus protocol.
masterSlave Select the data bus timing mode.
numSlots Define the number of timeslots (only if in master mode).
Return values:
PMIC_SUCCESS If the protocol was successful configured.
PMIC_PARAMETER_ERROR If the handle or the protocol parameters are invalid.

References PMIC_AUDIO_VCODEC_STATE::busID, PMIC_AUDIO_STDAC_STATE::busID, PMIC_AUDIO_STDAC_STATE::handle, PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_STDAC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_STDAC_STATE::masterSlave, PMIC_AUDIO_VCODEC_STATE::masterSlave, PMIC_AUDIO_STDAC_STATE::numSlots, PMIC_AUDIO_VCODEC_STATE::numSlots, pmic_write_reg(), PMIC_AUDIO_STDAC_STATE::protocol, PMIC_AUDIO_VCODEC_STATE::protocol, and SET_BITS.

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.

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 pmic_audio_stdac_disable_mixer ( const PMIC_AUDIO_HANDLE  handle  ) 

Disable the Stereo DAC mixer.

This function disables the Stereo DAC mixer.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the Stereo DAC mixer was successfully disabled.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the Stereo DAC mixer could not be disabled.

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

PMIC_STATUS pmic_audio_stdac_enable_mixer ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_STDAC_TIMESLOTS  rxSecondaryTimeslot,
const PMIC_AUDIO_STDAC_MIX_IN_GAIN  gainIn,
const PMIC_AUDIO_STDAC_MIX_OUT_GAIN  gainOut 
)

Configure and enable the Stereo DAC mixer.

This function configures and enables the Stereo DAC mixer.

Parameters:
handle Device handle from pmic_audio_open() call.
rxSecondaryTimeslot The timeslot used for the secondary audio channel.
gainIn The secondary audio channel gain level.
gainOut The mixer output gain level.
Return values:
PMIC_SUCCESS If the Stereo DAC mixer was successfully configured and enabled.
PMIC_PARAMETER_ERROR If the handle or mixer configuration was invalid.
PMIC_ERROR If the Stereo DAC mixer could not be reconfigured or enabled.

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

PMIC_STATUS pmic_audio_stdac_get_clock ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_CLOCK_IN_SOURCE *const   clockIn,
PMIC_AUDIO_STDAC_SAMPLING_RATE *const   samplingRate,
PMIC_AUDIO_STDAC_CLOCK_IN_FREQ *const   clockFreq,
PMIC_AUDIO_CLOCK_INVERT *const   invert 
)

Get the Stereo DAC clock source and operating characteristics.

Get the current Stereo DAC clock source and operating characteristics.

Parameters:
handle Device handle from pmic_audio_open() call.
clockIn The clock signal source.
clockFreq The clock signal frequency.
samplingRate The audio data sampling rate.
invert Inversion of the frame sync and/or bit clock inputs is enabled/disabled.
Return values:
PMIC_SUCCESS If the Stereo DAC clock settings were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle invalid.
PMIC_ERROR If the Stereo DAC clock configuration could not be retrieved.

References PMIC_AUDIO_STDAC_STATE::clockFreq, PMIC_AUDIO_STDAC_STATE::clockIn, PMIC_AUDIO_STDAC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_STDAC_STATE::handleState, PMIC_AUDIO_STDAC_STATE::invert, and PMIC_AUDIO_STDAC_STATE::samplingRate.

PMIC_STATUS pmic_audio_stdac_get_config ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_STDAC_CONFIG *const   config 
)

Get the current Stereo DAC options.

Get the current Stereo DAC options.

Parameters:
handle Device handle from pmic_audio_open() call.
config The current set of Stereo DAC options.
Return values:
PMIC_SUCCESS If the Stereo DAC options were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the Stereo DAC options could not be retrieved.

References PMIC_AUDIO_STDAC_STATE::config, PMIC_AUDIO_STDAC_STATE::handle, HANDLE_IN_USE, and PMIC_AUDIO_STDAC_STATE::handleState.

PMIC_STATUS pmic_audio_stdac_get_rxtx_timeslot ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_STDAC_TIMESLOTS *const   timeslot 
)

Get the current Stereo DAC primary audio channel timeslot.

Get the current Stereo DAC primary audio channel timeslot.

Parameters:
handle Device handle from pmic_audio_open() call.
timeslot The primary audio channel timeslot.
Return values:
PMIC_SUCCESS If the Stereo DAC primary audio channel timeslot was successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the Stereo DAC primary audio channel timeslot could not be retrieved.

References PMIC_AUDIO_STDAC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_STDAC_STATE::handleState, and PMIC_AUDIO_STDAC_STATE::timeslot.

PMIC_STATUS pmic_audio_stdac_set_clock ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_CLOCK_IN_SOURCE  clockIn,
const PMIC_AUDIO_STDAC_CLOCK_IN_FREQ  clockFreq,
const PMIC_AUDIO_STDAC_SAMPLING_RATE  samplingRate,
const PMIC_AUDIO_CLOCK_INVERT  invert 
)

Set the Stereo DAC clock source and operating characteristics.

Define the Stereo DAC clock source and operating characteristics. This must be done before the Stereo DAC is enabled.

Parameters:
handle Device handle from pmic_audio_open() call.
clockIn Select the clock signal source.
clockFreq Select the clock signal frequency.
samplingRate Select the audio data sampling rate.
invert Enable inversion of the frame sync and/or bit clock inputs.
Return values:
PMIC_SUCCESS If the Stereo DAC clock settings were successfully configured.
PMIC_PARAMETER_ERROR If the handle or clock configuration was invalid.
PMIC_ERROR If the Stereo DAC clock configuration could not be set.

References PMIC_AUDIO_STDAC_STATE::clockFreq, PMIC_AUDIO_STDAC_STATE::clockIn, PMIC_AUDIO_STDAC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_STDAC_STATE::handleState, PMIC_AUDIO_STDAC_STATE::invert, PMIC_AUDIO_STDAC_STATE::masterSlave, pmic_write_reg(), PMIC_AUDIO_STDAC_STATE::samplingRate, and SET_BITS.

PMIC_STATUS pmic_audio_stdac_set_config ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_STDAC_CONFIG  config 
)

Set/Enable the Stereo DAC options.

Set or enable various Stereo DAC options. The available options include resetting the digital filter and enabling the bus master clock outputs.

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

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 pmic_audio_stdac_set_rxtx_timeslot ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_STDAC_TIMESLOTS  timeslot 
)

Set the Stereo DAC primary audio channel timeslot.

Set the Stereo DAC primary audio channel timeslot. This function must be used if the default timeslot for the primary audio channel is to be changed.

Parameters:
handle Device handle from pmic_audio_open() call.
timeslot Select the primary audio channel timeslot.
Return values:
PMIC_SUCCESS If the Stereo DAC primary audio channel timeslot was successfully configured.
PMIC_PARAMETER_ERROR If the handle or audio channel timeslot was invalid.
PMIC_ERROR If the Stereo DAC primary audio channel timeslot could not be set.

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

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.

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.

PMIC_STATUS pmic_audio_vcodec_disable_bypass ( const PMIC_AUDIO_HANDLE  handle  ) 

Disable the Voice CODEC bypass audio pathway.

Disables the Voice CODEC bypass pathway for audio data. This means that the TX data bus line will deliver digital data to the digital-to-analog converters within the Voice CODEC.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the Voice CODEC bypass was successfully disabled.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the Voice CODEC bypass could not be disabled.

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

PMIC_STATUS pmic_audio_vcodec_disable_micbias ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_MIC_BIAS  biasCircuit 
)

Disable a microphone bias circuit.

This function disables one of the available microphone bias circuits.

Parameters:
handle Device handle from pmic_audio_open() call.
biasCircuit The microphone bias circuit to be disabled.
Return values:
PMIC_SUCCESS If the microphone bias circuit was successfully disabled.
PMIC_PARAMETER_ERROR If the handle or selected microphone bias circuit was invalid.
PMIC_ERROR If the microphone bias circuit could not be disabled.

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

PMIC_STATUS pmic_audio_vcodec_disable_mixer ( const PMIC_AUDIO_HANDLE  handle  ) 

Disable the Voice CODEC mixer.

This function disables the Voice CODEC mixer.

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the Voice CODEC mixer was successfully disabled.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the Voice CODEC mixer could not be disabled.

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

PMIC_STATUS pmic_audio_vcodec_enable_bypass ( const PMIC_AUDIO_HANDLE  handle  ) 

Enable the Voice CODEC bypass audio pathway.

Enables the Voice CODEC bypass pathway for audio data. This allows direct output of the voltages on the TX data bus line to the output amplifiers (bypassing the digital-to-analog converters within the Voice CODEC).

Parameters:
handle Device handle from pmic_audio_open() call.
Return values:
PMIC_SUCCESS If the Voice CODEC bypass was successfully enabled.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the Voice CODEC bypass could not be enabled.

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

PMIC_STATUS pmic_audio_vcodec_enable_micbias ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_MIC_BIAS  biasCircuit 
)

Enable a microphone bias circuit.

This function enables one of the available microphone bias circuits.

Parameters:
handle Device handle from pmic_audio_open() call.
biasCircuit The microphone bias circuit to be enabled.
Return values:
PMIC_SUCCESS If the microphone bias circuit was successfully enabled.
PMIC_PARAMETER_ERROR If the handle or selected microphone bias circuit was invalid.
PMIC_ERROR If the microphone bias circuit could not be enabled.

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

PMIC_STATUS pmic_audio_vcodec_enable_mixer ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_VCODEC_TIMESLOT  rxSecondaryTimeslot,
const PMIC_AUDIO_VCODEC_MIX_IN_GAIN  gainIn,
const PMIC_AUDIO_VCODEC_MIX_OUT_GAIN  gainOut 
)

Configure and enable the Voice CODEC mixer.

This function configures and enables the Voice CODEC mixer.

Parameters:
handle Device handle from pmic_audio_open() call.
rxSecondaryTimeslot The timeslot used for the secondary audio channel.
gainIn The secondary audio channel gain level.
gainOut The mixer output gain level.
Return values:
PMIC_SUCCESS If the Voice CODEC mixer was successfully configured and enabled.
PMIC_PARAMETER_ERROR If the handle or mixer configuration was invalid.
PMIC_ERROR If the Voice CODEC mixer could not be reconfigured or enabled.

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

PMIC_STATUS pmic_audio_vcodec_get_clock ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_CLOCK_IN_SOURCE *const   clockIn,
PMIC_AUDIO_VCODEC_CLOCK_IN_FREQ *const   clockFreq,
PMIC_AUDIO_VCODEC_SAMPLING_RATE *const   samplingRate,
PMIC_AUDIO_CLOCK_INVERT *const   invert 
)

Get the Voice CODEC clock source and operating characteristics.

Get the current Voice CODEC clock source and operating characteristics.

Parameters:
handle Device handle from pmic_audio_open() call.
clockIn The clock signal source.
clockFreq The clock signal frequency.
samplingRate The audio data sampling rate.
invert Inversion of the frame sync and/or bit clock inputs is enabled/disabled.
Return values:
PMIC_SUCCESS If the Voice CODEC clock settings were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle invalid.
PMIC_ERROR If the Voice CODEC clock configuration could not be retrieved.

References PMIC_AUDIO_VCODEC_STATE::clockFreq, PMIC_AUDIO_VCODEC_STATE::clockIn, PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::invert, and PMIC_AUDIO_VCODEC_STATE::samplingRate.

PMIC_STATUS pmic_audio_vcodec_get_config ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_VCODEC_CONFIG *const   config 
)

Get the current Voice CODEC options.

Get the current Voice CODEC options.

Parameters:
handle Device handle from pmic_audio_open() call.
config The current set of Voice CODEC options.
Return values:
PMIC_SUCCESS If the Voice CODEC options were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the Voice CODEC options could not be retrieved.

References PMIC_AUDIO_VCODEC_STATE::config, PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, and PMIC_AUDIO_VCODEC_STATE::handleState.

PMIC_STATUS pmic_audio_vcodec_get_mic ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_INPUT_PORT *const   leftChannel,
PMIC_AUDIO_INPUT_PORT *const   rightChannel 
)

Get the current microphone inputs being used for Voice CODEC recording.

Get the left (mc13783-only) and right microphone inputs currently being used for Voice CODEC recording.

Parameters:
handle Device handle from pmic_audio_open() call.
leftChannel The left microphone input channel.
rightChannel The right microphone input channel.
Return values:
PMIC_SUCCESS If the microphone input channels were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the microphone input channels could not be retrieved.

References PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::leftChannelMic, PMIC_MICROPHONE_STATE::mic, and PMIC_AUDIO_VCODEC_STATE::rightChannelMic.

PMIC_STATUS pmic_audio_vcodec_get_mic_on_off ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_INPUT_MIC_STATE *const   leftChannel,
PMIC_AUDIO_INPUT_MIC_STATE *const   rightChannel 
)

Return the current state of the microphone inputs.

This function returns the current state (on/off) of the microphone input channels.

Parameters:
handle Device handle from pmic_audio_open() call.
leftChannel The current left microphone input channel state.
rightChannel the current right microphone input channel state.
Return values:
PMIC_SUCCESS If the microphone input channel states were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the microphone input channel states could not be retrieved.

References PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::leftChannelMic, PMIC_MICROPHONE_STATE::micOnOff, and PMIC_AUDIO_VCODEC_STATE::rightChannelMic.

PMIC_STATUS pmic_audio_vcodec_get_record_gain ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_MIC_AMP_MODE *const   leftChannelMode,
PMIC_AUDIO_MIC_GAIN *const   leftChannelGain,
PMIC_AUDIO_MIC_AMP_MODE *const   rightChannelMode,
PMIC_AUDIO_MIC_GAIN *const   rightChannelGain 
)

Get the current microphone input amplifier mode and gain level.

This function gets the current microphone input amplifier operating mode and gain level.

Parameters:
handle Device handle from pmic_audio_open() call.
leftChannelMode The left microphone input amplifier mode.
leftChannelGain The left microphone input amplifier gain level.
rightChannelMode The right microphone input amplifier mode.
rightChannelGain The right microphone input amplifier gain level.
Return values:
PMIC_SUCCESS If the microphone input amplifier modes and gain levels were successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the microphone input amplifier modes and gain levels could not be retrieved.

References PMIC_MICROPHONE_STATE::ampMode, PMIC_MICROPHONE_STATE::gain, PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::leftChannelMic, and PMIC_AUDIO_VCODEC_STATE::rightChannelMic.

PMIC_STATUS pmic_audio_vcodec_get_rxtx_timeslot ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_VCODEC_TIMESLOT *const   timeslot 
)

Get the current Voice CODEC primary audio channel timeslot.

Get the current Voice CODEC primary audio channel timeslot.

Parameters:
handle Device handle from pmic_audio_open() call.
timeslot The primary audio channel timeslot.
Return values:
PMIC_SUCCESS If the Voice CODEC primary audio channel timeslot was successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the Voice CODEC primary audio channel timeslot could not be retrieved.

References PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, and PMIC_AUDIO_VCODEC_STATE::timeslot.

PMIC_STATUS pmic_audio_vcodec_get_secondary_txslot ( const PMIC_AUDIO_HANDLE  handle,
PMIC_AUDIO_VCODEC_TIMESLOT *const   timeslot 
)

Get the Voice CODEC secondary recording audio channel timeslot.

Get the Voice CODEC secondary audio channel timeslot.

Parameters:
handle Device handle from pmic_audio_open() call.
timeslot The secondary audio channel timeslot.
Return values:
PMIC_SUCCESS If the Voice CODEC secondary audio channel timeslot was successfully retrieved.
PMIC_PARAMETER_ERROR If the handle was invalid.
PMIC_ERROR If the Voice CODEC secondary audio channel timeslot could not be retrieved.

References PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, and PMIC_AUDIO_VCODEC_STATE::handleState.

PMIC_STATUS pmic_audio_vcodec_set_clock ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_CLOCK_IN_SOURCE  clockIn,
const PMIC_AUDIO_VCODEC_CLOCK_IN_FREQ  clockFreq,
const PMIC_AUDIO_VCODEC_SAMPLING_RATE  samplingRate,
const PMIC_AUDIO_CLOCK_INVERT  invert 
)

Set the Voice CODEC clock source and operating characteristics.

Define the Voice CODEC clock source and operating characteristics. This must be done before the Voice CODEC is enabled.

Parameters:
handle Device handle from pmic_audio_open() call.
clockIn Select the clock signal source.
clockFreq Select the clock signal frequency.
samplingRate Select the audio data sampling rate.
invert Enable inversion of the frame sync and/or bit clock inputs.
Return values:
PMIC_SUCCESS If the Voice CODEC clock settings were successfully configured.
PMIC_PARAMETER_ERROR If the handle or clock configuration was invalid.
PMIC_ERROR If the Voice CODEC clock configuration could not be set.

References PMIC_AUDIO_VCODEC_STATE::clockFreq, PMIC_AUDIO_VCODEC_STATE::clockIn, PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::invert, pmic_write_reg(), PMIC_AUDIO_VCODEC_STATE::samplingRate, and SET_BITS.

PMIC_STATUS pmic_audio_vcodec_set_config ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_VCODEC_CONFIG  config 
)

Set/Enable the Voice CODEC options.

Set or enable various Voice CODEC options. The available options include the use of dithering, highpass digital filters, and loopback modes.

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

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.

PMIC_STATUS pmic_audio_vcodec_set_mic ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_INPUT_PORT  leftChannel,
const PMIC_AUDIO_INPUT_PORT  rightChannel 
)

Select the microphone inputs to be used for Voice CODEC recording.

Select left (mc13783-only) and right microphone inputs for Voice CODEC recording. It is possible to disable or not use a particular microphone input channel by specifying NO_MIC as a parameter.

Parameters:
handle Device handle from pmic_audio_open() call.
leftChannel Select the left microphone input channel.
rightChannel Select the right microphone input channel.
Return values:
PMIC_SUCCESS If the microphone input channels were successfully enabled.
PMIC_PARAMETER_ERROR If the handle or microphone input ports were invalid.
PMIC_ERROR If the microphone input channels could not be successfully enabled.

References PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::leftChannelMic, PMIC_MICROPHONE_STATE::mic, pmic_write_reg(), PMIC_AUDIO_VCODEC_STATE::rightChannelMic, and SET_BITS.

PMIC_STATUS pmic_audio_vcodec_set_mic_on_off ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_INPUT_MIC_STATE  leftChannel,
const PMIC_AUDIO_INPUT_MIC_STATE  rightChannel 
)

Enable/disable the microphone input.

This function enables/disables the current microphone input channel. The input amplifier is automatically turned off when the microphone input is disabled.

Parameters:
handle Device handle from pmic_audio_open() call.
leftChannel The left microphone input channel state.
rightChannel the right microphone input channel state.
Return values:
PMIC_SUCCESS If the microphone input channels were successfully reconfigured.
PMIC_PARAMETER_ERROR If the handle or microphone input states were invalid.
PMIC_ERROR If the microphone input channels could not be reconfigured.

References PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::leftChannelMic, PMIC_MICROPHONE_STATE::mic, PMIC_MICROPHONE_STATE::micOnOff, pmic_write_reg(), PMIC_AUDIO_VCODEC_STATE::rightChannelMic, and SET_BITS.

PMIC_STATUS pmic_audio_vcodec_set_record_gain ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_MIC_AMP_MODE  leftChannelMode,
const PMIC_AUDIO_MIC_GAIN  leftChannelGain,
const PMIC_AUDIO_MIC_AMP_MODE  rightChannelMode,
const PMIC_AUDIO_MIC_GAIN  rightChannelGain 
)

Set the microphone input amplifier mode and gain level.

This function sets the current microphone input amplifier operating mode and gain level.

Parameters:
handle Device handle from pmic_audio_open() call.
leftChannelMode The left microphone input amplifier mode.
leftChannelGain The left microphone input amplifier gain level.
rightChannelMode The right microphone input amplifier mode.
rightChannelGain The right microphone input amplifier gain level.
Return values:
PMIC_SUCCESS If the microphone input amplifiers were successfully reconfigured.
PMIC_PARAMETER_ERROR If the handle or microphone input amplifier modes or gain levels were invalid.
PMIC_ERROR If the microphone input amplifiers could not be reconfigured.

References PMIC_MICROPHONE_STATE::ampMode, PMIC_MICROPHONE_STATE::gain, PMIC_AUDIO_VCODEC_STATE::handle, HANDLE_IN_USE, PMIC_AUDIO_VCODEC_STATE::handleState, PMIC_AUDIO_VCODEC_STATE::leftChannelMic, PMIC_MICROPHONE_STATE::mic, pmic_write_reg(), PMIC_AUDIO_VCODEC_STATE::rightChannelMic, and SET_BITS.

PMIC_STATUS pmic_audio_vcodec_set_rxtx_timeslot ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_VCODEC_TIMESLOT  timeslot 
)

Set the Voice CODEC primary audio channel timeslot.

Set the Voice CODEC primary audio channel timeslot. This function must be used if the default timeslot for the primary audio channel is to be changed.

Parameters:
handle Device handle from pmic_audio_open() call.
timeslot Select the primary audio channel timeslot.
Return values:
PMIC_SUCCESS If the Voice CODEC primary audio channel timeslot was successfully configured.
PMIC_PARAMETER_ERROR If the handle or audio channel timeslot was invalid.
PMIC_ERROR If the Voice CODEC primary audio channel timeslot could not be set.

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

PMIC_STATUS pmic_audio_vcodec_set_secondary_txslot ( const PMIC_AUDIO_HANDLE  handle,
const PMIC_AUDIO_VCODEC_TIMESLOT  timeslot 
)

Set the Voice CODEC secondary recording audio channel timeslot.

Set the Voice CODEC secondary audio channel timeslot. This function must be used if the default timeslot for the secondary audio channel is to be changed. The secondary audio channel timeslot is used to transmit the audio data that was recorded by the Voice CODEC from the secondary audio input channel.

Parameters:
handle Device handle from pmic_audio_open() call.
timeslot Select the secondary audio channel timeslot.
Return values:
PMIC_SUCCESS If the Voice CODEC secondary audio channel timeslot was successfully configured.
PMIC_PARAMETER_ERROR If the handle or audio channel timeslot was invalid.
PMIC_ERROR If the Voice CODEC secondary audio channel timeslot could not be set.

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


Variable Documentation

const PMIC_AUDIO_HANDLE AUDIO_HANDLE_NULL = (PMIC_AUDIO_HANDLE) NULL [static]

Constant NULL value for initializing/reseting the audio handles.

Referenced by pmic_audio_close_handle(), and pmic_audio_open().

Initial value:
 {
        (PMIC_AUDIO_OUTPUT_PORT) NULL,  
        OUTPGA_GAIN_0DB,        
        OUTPGA_GAIN_0DB,        
        OUTPGA_GAIN_0DB,        
        BAL_GAIN_0DB,           
        BAL_GAIN_0DB,           
        MONOADD_GAIN_0DB,       
        (PMIC_AUDIO_OUTPUT_CONFIG) 0,   
        VCODEC_DIRECT_OUT
}

This variable maintains the current state of the Audio Output Section.

This variable tracks the current state of the Audio Output Section.

The initial values represent the reset/power on state of the Audio Output Section.

const unsigned long delay_1ms = (HZ / 1000) [static]

Define a 1 ms wait interval that is needed to ensure that certain hardware operations are successfully completed.

Initial value:
 {
        (PMIC_AUDIO_HANDLE) NULL,       
        HANDLE_FREE,            
        (PMIC_AUDIO_CALLBACK) NULL,     
        (PMIC_AUDIO_EVENTS) NULL,       
        STEREO_IN_GAIN_0DB      
}

This maintains the current state of the External Stereo Input.

This variable tracks the current state of the External Stereo Input audio hardware along with any information that is required by the device driver to manage the hardware (e.g., callback functions and event notification masks).

The initial values represent the reset/power on state of the External Stereo Input.

HEADSET_STATUS headsetState = NO_HEADSET [static]

The current headset status.

const unsigned MAX_STDAC_SAMPLING_RATE_HZ = 96000

Define the maximum sampling rate (in Hz) that is supported by the Stereo DAC.

const unsigned MIN_STDAC_SAMPLING_RATE_HZ = 8000

Define the minimum sampling rate (in Hz) that is supported by the Stereo DAC.

const unsigned int REG_FULLMASK = 0xffffff [static]

Define a mask to access the entire hardware register.

Referenced by mc13783_pmic_audio_exit(), and pmic_audio_reset_device().

const unsigned int REG_SSI_STDAC_MASK = 0xfff000 [static]

Reset mask for the SSI network STDAC part. last 12 bits 12 - 24

Referenced by pmic_audio_reset_device().

const unsigned int REG_SSI_VCODEC_MASK = 0x000fff [static]

Reset mask for the SSI network Vcodec part. first 12 bits 0 - 11

Referenced by pmic_audio_reset_device().

Initial value:
 {
        {0, 0x000001},          
        {1, 0x000002},          
        {2, 0x000004},          
        {3, 0x000008},          
        {4, 0x000010},          
        {5, 0x000060},          
        {7, 0x000380},          
        {10, 0x000400},         
        {11, 0x000800},         
        {12, 0x001000},         
        {13, 0x002000},         
        {14, 0x004000},         
        {15, 0x008000},         
        {16, 0x010000},         
        {17, 0x020000},         
        {18, 0x040000},         
        {19, 0x080000},         
        {20, 0x100000}          
        
        
        

}

This variable is used to access the AUD_CODEC hardware register.

This variable defines how to access all of the fields within the AUD_CODEC hardware register. The initial values consist of the offset and mask values needed to access each of the register fields.

Initial value:
 {
        {0, 0x000001},          
        {1, 0x000002},          
        {2, 0x000004},          
        {3, 0x000008},          
        {4, 0x000010},          
        {5, 0x000020},          
        {6, 0x000040},          
        {7, 0x000080},          
        {8, 0x000100},          
        {9, 0x000200},          
        {10, 0x000400},         
        {11, 0x000800},         
        {12, 0x001000},         
        {13, 0x002000},         
        {14, 0x004000},         
        {15, 0x008000},         
        {16, 0x010000},         
        {17, 0x020000},         
        {18, 0x040000},         
        {19, 0x080000},         
        {21, 0x200000},         
        {22, 0x400000},         
        {23, 0x800000}          
}

This variable is used to access the AUDIO_RX_0 hardware register.

This variable defines how to access all of the fields within the AUDIO_RX_0 hardware register. The initial values consist of the offset and mask values needed to access each of the register fields.

Initial value:
 {
        {0, 0x000001},          
        {1, 0x00001e},          
        {5, 0x000020},          
        {6, 0x0003c0},          
        {10, 0x000400},         
        {11, 0x000800},         
        {12, 0x00f000},         
        {16, 0x030000},         
        {18, 0x1c0000},         
        {21, 0x200000}          
}

This variable is used to access the AUDIO_RX_1 hardware register.

This variable defines how to access all of the fields within the AUDIO_RX_1 hardware register. The initial values consist of the offset and mask values needed to access each of the register fields.

Initial value:
 {
        {0, 0x000001},          
        {1, 0x000002},          
        {2, 0x000004},          
        {3, 0x000008},          
        {5, 0x000020},          
        {6, 0x000040},          
        {7, 0x000080},          
        {8, 0x000100},          
        {9, 0x000200},          
        {10, 0x000400},         
        {11, 0x000800},         
        {12, 0x001000},         
        {13, 0x002000},         
        {14, 0x07c000},         
        {19, 0xf80000}          
}

This variable is used to access the AUDIO_TX hardware register.

This variable defines how to access all of the fields within the AUDIO_TX hardware register. The initial values consist of the offset and mask values needed to access each of the register fields.

Initial value:
 {
        {2, 0x00000c},          
        {4, 0x000030},          
        {6, 0x0000c0},          
        {8, 0x000300},          
        {10, 0x000400},         
        {11, 0x000800},         
        {12, 0x003000},         
        {14, 0x00c000},         
        {16, 0x030000},         
        {18, 0x0c0000},         
        {20, 0x100000}          
}

This variable is used to access the SSI_NETWORK hardware register.

This variable defines how to access all of the fields within the SSI_NETWORK hardware register. The initial values consist of the offset and mask values needed to access each of the register fields.

const REGISTER_ST_DAC regST_DAC [static]
Initial value:
 {
        {0, 0x000001},          
        {1, 0x000002},          
        {2, 0x000004},          
        {3, 0x000008},          
        {4, 0x000010},          
        {5, 0x000060},          
        {7, 0x000380},          
        {10, 0x000400},         
        {11, 0x000800},         
        {12, 0x001000},         
        {15, 0x008000},         
        {16, 0x010000},         
        {17, 0x1E0000}          
}

This variable is used to access the ST_DAC hardware register.

This variable defines how to access all of the fields within the ST_DAC hardware register. The initial values consist of the offset and mask values needed to access each of the register fields.

const unsigned int RESET_AUD_CODEC = 0x180027 [static]

Reset value for the AUD_CODEC register.

Referenced by mc13783_pmic_audio_exit(), pmic_audio_reset_all(), and pmic_audio_reset_device().

const unsigned int RESET_AUDIO_RX_0 = 0x001000 [static]

Reset value for the AUDIO_RX_0 register.

Referenced by mc13783_pmic_audio_exit(), and pmic_audio_reset_all().

const unsigned int RESET_AUDIO_RX_1 = 0x00D35A [static]

Reset value for the AUDIO_RX_1 register.

Referenced by mc13783_pmic_audio_exit(), and pmic_audio_reset_all().

const unsigned int RESET_AUDIO_TX = 0x420000 [static]

Reset value for the AUDIO_TX register.

Note that we avoid resetting any of the arbitration bits.

Referenced by mc13783_pmic_audio_exit(), pmic_audio_reset_all(), and pmic_audio_reset_device().

const unsigned int RESET_SSI_NETWORK = 0x013060 [static]

Reset value for the SSI_NETWORK register.

Referenced by mc13783_pmic_audio_exit(), pmic_audio_reset_all(), and pmic_audio_reset_device().

const unsigned int RESET_ST_DAC = 0x0E0004 [static]

Reset value for the ST_DAC register.

Note that we avoid resetting any of the arbitration bits.

Referenced by mc13783_pmic_audio_exit(), pmic_audio_reset_all(), and pmic_audio_reset_device().

Initial value:
 {
        (PMIC_AUDIO_HANDLE) NULL,       
        HANDLE_FREE,            
        AUDIO_DATA_BUS_1,       
        false,
        NORMAL_MSB_JUSTIFIED_MODE,      
        BUS_MASTER_MODE,        
        USE_2_TIMESLOTS,        
        (PMIC_AUDIO_CALLBACK) NULL,     
        (PMIC_AUDIO_EVENTS) NULL,       
        CLOCK_IN_CLIA,          
        STDAC_RATE_44_1_KHZ,    
        STDAC_CLI_13MHZ,        
        NO_INVERT,              
        USE_TS0_TS1,            
        (PMIC_AUDIO_STDAC_CONFIG) 0     
}

This variable maintains the current state of the Stereo DAC.

This variable tracks the current state of the Stereo DAC audio hardware along with any information that is required by the device driver to manage the hardware (e.g., callback functions and event notification masks).

The initial values represent the reset/power on state of the Stereo DAC.

Initial value:
 {
        (PMIC_AUDIO_HANDLE) NULL,       
        HANDLE_FREE,            
        AUDIO_DATA_BUS_2,       
        false,
        NETWORK_MODE,           
        BUS_SLAVE_MODE,         
        USE_4_TIMESLOTS,        
        (PMIC_AUDIO_CALLBACK) NULL,     
        (PMIC_AUDIO_EVENTS) NULL,       
        CLOCK_IN_CLIB,          
        VCODEC_RATE_8_KHZ,      
        VCODEC_CLI_13MHZ,       
        NO_INVERT,              
        USE_TS0,                
        USE_TS2,                
        INPUT_HIGHPASS_FILTER | OUTPUT_HIGHPASS_FILTER, 
        
        {NO_MIC,                
         MICROPHONE_OFF,        
         AMP_OFF,               
         MIC_GAIN_0DB           
         },
        
        {NO_MIC,                
         MICROPHONE_OFF,        
         AMP_OFF,               
         MIC_GAIN_0DB           
         }
}

This variable maintains the current state of the Voice CODEC.

This variable tracks the current state of the Voice CODEC audio hardware along with any information that is required by the device driver to manage the hardware (e.g., callback functions and event notification masks).

The initial values represent the reset/power on state of the Voice CODEC.

footer
©  Freescale Semiconductor, Inc., 2007.  All rights reserved.
Freescale Confidential Proprietary
NDA Required
doxygen