Commit 419edf1b authored by Daniel Petrini's avatar Daniel Petrini Committed by Tony Lindgren

[PATCH] ARM: OMAP: Alsa modularisations and support for tsc2101 1/3 (round 2)

This 1/3 patch prepares the addon of tsc2101 driver by renaming structures
that can be shared by aic23 and tsc2101 drivers to more specific names.
In addition this patch renames DMA function names so that they do not
conflict with the dma function names in the oss driver.
Signed-off-by: default avatarMika Laitio <lamikr@cc.jyu.fi>
Signed-off-by: default avatarTony Lindgren <tony@atomide.com>
parent 51c0cddf
This diff is collapsed.
...@@ -93,17 +93,15 @@ struct audio_stream { ...@@ -93,17 +93,15 @@ struct audio_stream {
/* /*
* Alsa card structure for aic23 * Alsa card structure for aic23
*/ */
struct snd_card_omap_aic23 { struct snd_card_omap_codec {
snd_card_t *card; snd_card_t *card;
snd_pcm_t *pcm; snd_pcm_t *pcm;
long samplerate; long samplerate;
struct audio_stream s[2]; /* playback & capture */ struct audio_stream s[2]; /* playback & capture */
}; };
/*********** Function Prototypes *************************/ /*********** Mixer function prototypes *************************/
int snd_omap_mixer(struct snd_card_omap_codec *);
void audio_dma_callback(void *);
int snd_omap_mixer(struct snd_card_omap_aic23 *);
void snd_omap_init_mixer(void); void snd_omap_init_mixer(void);
/* Clock functions */ /* Clock functions */
int omap_aic23_clock_on(void); int omap_aic23_clock_on(void);
...@@ -114,6 +112,9 @@ void snd_omap_suspend_mixer(void); ...@@ -114,6 +112,9 @@ void snd_omap_suspend_mixer(void);
void snd_omap_resume_mixer(void); void snd_omap_resume_mixer(void);
#endif #endif
/*********** function prototype to function called from the dma interrupt handler ******/
void callback_omap_alsa_sound_dma(void *);
/* Codec AIC23 */ /* Codec AIC23 */
#if defined(CONFIG_SENSORS_TLV320AIC23) || defined (CONFIG_SENSORS_TLV320AIC23_MODULE) #if defined(CONFIG_SENSORS_TLV320AIC23) || defined (CONFIG_SENSORS_TLV320AIC23_MODULE)
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
* *
* Common audio DMA handling for the OMAP processors * Common audio DMA handling for the OMAP processors
* *
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* *
* Copyright (C) 2004 Texas Instruments, Inc. * Copyright (C) 2004 Texas Instruments, Inc.
...@@ -66,10 +68,8 @@ ...@@ -66,10 +68,8 @@
#include <asm/arch/mcbsp.h> #include <asm/arch/mcbsp.h>
#include "omap-aic23.h"
#undef DEBUG #undef DEBUG
//#define DEBUG #define DEBUG
#ifdef DEBUG #ifdef DEBUG
#define DPRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS) #define DPRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
#define FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__) #define FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
...@@ -165,7 +165,7 @@ static void omap_sound_dma_link_lch(void *data) ...@@ -165,7 +165,7 @@ static void omap_sound_dma_link_lch(void *data)
FN_OUT(0); FN_OUT(0);
} }
int omap_request_sound_dma(int device_id, const char *device_name, int omap_request_alsa_sound_dma(int device_id, const char *device_name,
void *data, int **channels) void *data, int **channels)
{ {
int i, err = 0; int i, err = 0;
...@@ -186,10 +186,11 @@ int omap_request_sound_dma(int device_id, const char *device_name, ...@@ -186,10 +186,11 @@ int omap_request_sound_dma(int device_id, const char *device_name,
} }
spin_lock(&dma_list_lock); spin_lock(&dma_list_lock);
for (i = 0; i < nr_linked_channels; i++) { for (i = 0; i < nr_linked_channels; i++) {
err = err = omap_request_dma(device_id,
omap_request_dma(device_id, device_name, device_name,
sound_dma_irq_handler, data, sound_dma_irq_handler,
&chan[i]); data,
&chan[i]);
/* Handle Failure condition here */ /* Handle Failure condition here */
if (err < 0) { if (err < 0) {
...@@ -223,7 +224,7 @@ int omap_request_sound_dma(int device_id, const char *device_name, ...@@ -223,7 +224,7 @@ int omap_request_sound_dma(int device_id, const char *device_name,
**************************************************************************************/ **************************************************************************************/
static void omap_sound_dma_unlink_lch(void *data) static void omap_sound_dma_unlink_lch(void *data)
{ {
struct audio_stream *s = (struct audio_stream *) data; struct audio_stream *s = (struct audio_stream *)data;
int *chan = s->lch; int *chan = s->lch;
int i; int i;
...@@ -243,11 +244,11 @@ static void omap_sound_dma_unlink_lch(void *data) ...@@ -243,11 +244,11 @@ static void omap_sound_dma_unlink_lch(void *data)
FN_OUT(0); FN_OUT(0);
} }
int omap_free_sound_dma(void *data, int **channels) int omap_free_alsa_sound_dma(void *data, int **channels)
{ {
int i; int i;
int *chan = NULL; int *chan = NULL;
FN_IN; FN_IN;
if (unlikely(NULL == channels)) { if (unlikely(NULL == channels)) {
BUG(); BUG();
...@@ -277,10 +278,11 @@ int omap_free_sound_dma(void *data, int **channels) ...@@ -277,10 +278,11 @@ int omap_free_sound_dma(void *data, int **channels)
* Stop all the DMA channels of the stream * Stop all the DMA channels of the stream
* *
**************************************************************************************/ **************************************************************************************/
void omap_audio_stop_dma(struct audio_stream *s) void omap_stop_alsa_sound_dma(struct audio_stream *s)
{ {
int *chan = s->lch; int *chan = s->lch;
int i; int i;
FN_IN; FN_IN;
if (unlikely(NULL == chan)) { if (unlikely(NULL == chan)) {
BUG(); BUG();
...@@ -299,7 +301,7 @@ void omap_audio_stop_dma(struct audio_stream *s) ...@@ -299,7 +301,7 @@ void omap_audio_stop_dma(struct audio_stream *s)
* Clear any pending transfers * Clear any pending transfers
* *
**************************************************************************************/ **************************************************************************************/
void omap_clear_sound_dma(struct audio_stream * s) void omap_clear_alsa_sound_dma(struct audio_stream * s)
{ {
FN_IN; FN_IN;
omap_clear_dma(s->lch[s->dma_q_head]); omap_clear_dma(s->lch[s->dma_q_head]);
...@@ -307,13 +309,6 @@ void omap_clear_sound_dma(struct audio_stream * s) ...@@ -307,13 +309,6 @@ void omap_clear_sound_dma(struct audio_stream * s)
return; return;
} }
/*********************************** MODULE FUNCTIONS DEFINTIONS ***********************/
#ifdef OMAP1610_MCBSP1_BASE
#undef OMAP1610_MCBSP1_BASE
#endif
#define OMAP1610_MCBSP1_BASE 0xE1011000
/*************************************************************************************** /***************************************************************************************
* *
* DMA related functions * DMA related functions
...@@ -325,9 +320,10 @@ static int audio_set_dma_params_play(int channel, dma_addr_t dma_ptr, ...@@ -325,9 +320,10 @@ static int audio_set_dma_params_play(int channel, dma_addr_t dma_ptr,
int dt = 0x1; /* data type 16 */ int dt = 0x1; /* data type 16 */
int cen = 32; /* Stereo */ int cen = 32; /* Stereo */
int cfn = dma_size / (2 * cen); int cfn = dma_size / (2 * cen);
FN_IN; FN_IN;
omap_set_dma_dest_params(channel, 0x05, 0x00, omap_set_dma_dest_params(channel, 0x05, 0x00,
(OMAP1610_MCBSP1_BASE + 0x806), (OMAP1510_MCBSP1_BASE + 0x06),
0, 0); 0, 0);
omap_set_dma_src_params(channel, 0x00, 0x01, dma_ptr, omap_set_dma_src_params(channel, 0x00, 0x01, dma_ptr,
0, 0); 0, 0);
...@@ -341,11 +337,11 @@ static int audio_set_dma_params_capture(int channel, dma_addr_t dma_ptr, ...@@ -341,11 +337,11 @@ static int audio_set_dma_params_capture(int channel, dma_addr_t dma_ptr,
{ {
int dt = 0x1; /* data type 16 */ int dt = 0x1; /* data type 16 */
int cen = 32; /* stereo */ int cen = 32; /* stereo */
int cfn = dma_size / (2 * cen); int cfn = dma_size / (2 * cen);
FN_IN; FN_IN;
omap_set_dma_src_params(channel, 0x05, 0x00, omap_set_dma_src_params(channel, 0x05, 0x00,
(OMAP1610_MCBSP1_BASE + 0x802), (OMAP1510_MCBSP1_BASE + 0x02),
0, 0); 0, 0);
omap_set_dma_dest_params(channel, 0x00, 0x01, dma_ptr, 0, 0); omap_set_dma_dest_params(channel, 0x00, 0x01, dma_ptr, 0, 0);
omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00, 0, 0); omap_set_dma_transfer_params(channel, dt, cen, cfn, 0x00, 0, 0);
...@@ -358,7 +354,7 @@ static int audio_start_dma_chain(struct audio_stream *s) ...@@ -358,7 +354,7 @@ static int audio_start_dma_chain(struct audio_stream *s)
int channel = s->lch[s->dma_q_head]; int channel = s->lch[s->dma_q_head];
FN_IN; FN_IN;
if (!s->started) { if (!s->started) {
s->hw_stop(); /* stops McBSP Interface */ s->hw_stop(); /* stops McBSP Interface */
omap_start_dma(channel); omap_start_dma(channel);
s->started = 1; s->started = 1;
s->hw_start(); /* start McBSP interface */ s->hw_start(); /* start McBSP interface */
...@@ -372,8 +368,9 @@ static int audio_start_dma_chain(struct audio_stream *s) ...@@ -372,8 +368,9 @@ static int audio_start_dma_chain(struct audio_stream *s)
* Do the initial set of work to initialize all the channels as required. * Do the initial set of work to initialize all the channels as required.
* We shall then initate a transfer * We shall then initate a transfer
*/ */
int omap_start_sound_dma(struct audio_stream *s, dma_addr_t dma_ptr, int omap_start_alsa_sound_dma(struct audio_stream *s,
u_int dma_size) dma_addr_t dma_ptr,
u_int dma_size)
{ {
int ret = -EPERM; int ret = -EPERM;
...@@ -439,18 +436,17 @@ static void sound_dma_irq_handler(int sound_curr_lch, u16 ch_status, ...@@ -439,18 +436,17 @@ static void sound_dma_irq_handler(int sound_curr_lch, u16 ch_status,
} }
if (ch_status & DCSR_END_BLOCK) if (ch_status & DCSR_END_BLOCK)
audio_dma_callback(s); callback_omap_alsa_sound_dma(s);
FN_OUT(0); FN_OUT(0);
return; return;
} }
MODULE_AUTHOR("Texas Instruments"); MODULE_AUTHOR("Texas Instruments");
MODULE_DESCRIPTION MODULE_DESCRIPTION("Common DMA handling for Audio driver on OMAP processors");
("Common DMA handling for Audio driver on OMAP processors");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
EXPORT_SYMBOL(omap_start_sound_dma); EXPORT_SYMBOL(omap_start_alsa_sound_dma);
EXPORT_SYMBOL(omap_clear_sound_dma); EXPORT_SYMBOL(omap_clear_alsa_sound_dma);
EXPORT_SYMBOL(omap_request_sound_dma); EXPORT_SYMBOL(omap_request_alsa_sound_dma);
EXPORT_SYMBOL(omap_free_sound_dma); EXPORT_SYMBOL(omap_free_alsa_sound_dma);
EXPORT_SYMBOL(omap_audio_stop_dma); EXPORT_SYMBOL(omap_stop_alsa_sound_dma);
/* /*
* linux/sound/arm/omap-alsa-dma.h * sound/arm/omap-alsa-dma.h
* *
* Common audio DMA handling for the OMAP processors * Common audio DMA handling for the OMAP processors
* *
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* *
* Copyright (C) 2004 Texas Instruments, Inc. * Copyright (C) 2004 Texas Instruments, Inc.
...@@ -32,28 +34,20 @@ ...@@ -32,28 +34,20 @@
#include "omap-aic23.h" #include "omap-aic23.h"
/************************** GLOBAL MACROS *************************************/
/* Provide the Macro interfaces common across platforms */
#define DMA_REQUEST(e,s, cb) {e=omap_request_sound_dma(s->dma_dev, s->id, s, &s->lch);}
#define DMA_FREE(s) omap_free_sound_dma(s, &s->lch)
#define DMA_CLEAR(s) omap_clear_sound_dma(s)
/************************** GLOBAL DATA STRUCTURES *********************************/ /************************** GLOBAL DATA STRUCTURES *********************************/
typedef void (*dma_callback_t) (int lch, u16 ch_status, void *data); typedef void (*dma_callback_t) (int lch, u16 ch_status, void *data);
/**************** ARCH SPECIFIC FUNCIONS *******************************************/ /**************** ARCH SPECIFIC FUNCIONS *******************************************/
void omap_clear_sound_dma(struct audio_stream * s); void omap_clear_alsa_sound_dma(struct audio_stream * s);
int omap_request_sound_dma(int device_id, const char *device_name, int omap_request_alsa_sound_dma(int device_id, const char *device_name,
void *data, int **channels); void *data, int **channels);
int omap_free_sound_dma(void *data, int **channels); int omap_free_alsa_sound_dma(void *data, int **channels);
int omap_start_sound_dma(struct audio_stream *s, dma_addr_t dma_ptr, int omap_start_alsa_sound_dma(struct audio_stream *s, dma_addr_t dma_ptr, u_int dma_size);
u_int dma_size);
void omap_audio_stop_dma(struct audio_stream *s); void omap_stop_alsa_sound_dma(struct audio_stream *s);
#endif #endif
...@@ -474,7 +474,7 @@ void snd_omap_resume_mixer(void) ...@@ -474,7 +474,7 @@ void snd_omap_resume_mixer(void)
} }
#endif #endif
int snd_omap_mixer(struct snd_card_omap_aic23 *chip) int snd_omap_mixer(struct snd_card_omap_codec *chip)
{ {
snd_card_t *card; snd_card_t *card;
unsigned int idx; unsigned int idx;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment