OMAP4 McPDM

From OMAPpedia

Jump to: navigation, search

Contents

[edit] McPDM driver

Multichannel Pulse Density Modulation component is the interface that connects the codec with the application processor. This module converts the digital PCM coded signal from DMA or other sources into a PDM signal, and sends it to Phoenix which converts it back to an analog signal. A PDM signal converts audio in to a series of bits, the density of which in relation to each otehr are used to specify the deviation of the analog audio signal.

The McPDM interface consists of the following features:

More information on pulse density modulation: http://en.wikipedia.org/wiki/Pulse-density_modulation

This module corresponds to a part of the platform driver of the ASoC layer.

[edit] McPDM API

The McPDM API offers a set of functions to create, open/close, start/stop, and remove a McPDM stream. Each stream requires the passing of a configuration structure to defined the parameters of the stream:

[edit] Format Structure

struct omap_mcpdm_link {
    int irq_mask;
    int threshold;
    int format; 
    int channels;
    }


irq_mask See table 23-460 of the OMAP4430 TRM for explanation of these interrupt events. Multiple events may be set by "or-ing" them together.
threshold Number of words to store in the FIFO before firing an interrupt.
format Controls the justification of the McPDM stream. See register MCPDM_CTRL bit 8 (PDMOUTFORMAT) in the OMAP4430 TRM for more details. Default value is Left Justification
channels Number of channels associated with the stream.


[edit] Open

The Open interfaces configure the McPDM link for audio capture/playback. This function should be called prior to starting the interface via omap_mcpdm_start().

int omap_mcpdm_capture_open(struct omap_mcpdm_link *uplink)

Description: Configures McPDM uplink for audio recording.

Input Parameters:
*uplink: Pointer to omap_mcpdm_link structure that contains configuration information for the link.  See section 1.1.1 for details.

Output Parameters:
-EINVAL: If a configuration pointer is not provided.
0: if the function completed normally.

int omap_mcpdm_playback_open(struct omap_mcpdm_link *downlink)
 
Description: Configures McPDM downlink for audio playback.

Input Parameters:
*downlink: Pointer to omap_mcpdm_link structure that contains configuration information for the link.  See section 1.1.1 for details.

Output Parameters:
-EINVAL: If a configuration pointer is not provided.
0: if the function completed normally.

[edit] Close

The Close interfaces disable the McPDM link for audio capture/playback. This function should be called after stopping the interface.

int omap_mcpdm_capture_close(struct omap_mcpdm_link *uplink)
 
Description: Disables McPDM uplink for audio recording.  

Input Parameters:
*uplink: Pointer to omap_mcpdm_link structure that contains configuration information for the link.  See section 5.3.5 for details.

Output Parameters:
-EINVAL: If a configuration pointer is not provided.
0: if the function completed normally.

int omap_mcpdm_playback_close(struct omap_mcpdm_link *downlink)
 
Description: Disables McPDM downlink for audio playback.

Input Parameters:
*downlink: Pointer to omap_mcpdm_link structure that contains configuration information for the link.  See section 5.3.5 for details.

Output Parameters:
-EINVAL: If a configuration pointer is not provided.
0: if the function completed normally.

[edit] Start

The Start interface enables the transfer of data through the McPDM interface to/from the Phoenix codec.

int omap_mcpdm_start(int stream)

Description: Starts McPDM transfer for stream.  

Input Parameters:
stream: McPDM port to start transfer

Output Parameters:
None

[edit] Stop

The Stop interface disables the transfer of data through the McPDM interface to/from the Phoenix codec.

int omap_mcpdm_stop(int stream)

Description: Stops McPDM transfer for stream.  

Input Parameters:
stream: McPDM port to stop transfer

Output Parameters:
None

[edit] Request

The Request function creates the McPDM driver instance.

int omap_mcpdm_request(void)

Description: Creates the McPDM driver instance 

Input Parameters:
None

Output Parameters:
0: If function completes normally
-EBUSY: McPDM port is already in use
ret: return value from trying to request an IRQ.  This is a failure case.

[edit] Free

The Free function tears down the McPDM driver instance.

void omap_mcpdm_free(void)

Description: tears down the McPDM driver instance

Input Parameters:
None

Output Parameters:
None

[edit] Set Offset

The Set Offset function is used to enable/disable the DC offset cancelation for the analog headset path (on McPDM channels 1 and 2).

int omap_mcpdm_set_offset(int offset1, int offset2)

Description: This function is used to enable/disable the DC offset cancelation for the analog headset path (for McPDM streams 1 and 2)

Input Parameters:
int offset1: DC offset for uplink path on McPDM1
int offset2: DC offset for uplink path on McPDM2

Offset value of zero will disable any DC correction.

Output Parameters:
-EINVAL: if either offset value is higher than the max value DN_OFST_MAX.
0: if the function returns normally.

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox