Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linux-davinci
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
linux
linux-davinci
Commits
6bc09656
Commit
6bc09656
authored
Mar 23, 2006
by
Juha Yrjola
Browse files
Options
Browse Files
Download
Plain Diff
Merge source.mvista.com:linux-omap
parents
b6a3bbbf
7508d984
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
2654 additions
and
151 deletions
+2654
-151
arch/arm/mach-omap1/board-h2.c
arch/arm/mach-omap1/board-h2.c
+38
-1
arch/arm/mach-omap1/board-osk.c
arch/arm/mach-omap1/board-osk.c
+35
-2
drivers/cbus/tahvo-usb.c
drivers/cbus/tahvo-usb.c
+2
-1
include/asm-arm/arch-omap/omap-alsa.h
include/asm-arm/arch-omap/omap-alsa.h
+59
-45
sound/arm/Kconfig
sound/arm/Kconfig
+14
-0
sound/arm/Makefile
sound/arm/Makefile
+1
-2
sound/arm/omap/Makefile
sound/arm/omap/Makefile
+9
-0
sound/arm/omap/omap-alsa-aic23-mixer.c
sound/arm/omap/omap-alsa-aic23-mixer.c
+30
-41
sound/arm/omap/omap-alsa-aic23.c
sound/arm/omap/omap-alsa-aic23.c
+321
-0
sound/arm/omap/omap-alsa-aic23.h
sound/arm/omap/omap-alsa-aic23.h
+83
-0
sound/arm/omap/omap-alsa-dma.c
sound/arm/omap/omap-alsa-dma.c
+31
-44
sound/arm/omap/omap-alsa-dma.h
sound/arm/omap/omap-alsa-dma.h
+9
-15
sound/arm/omap/omap-alsa-tsc2101-mixer.c
sound/arm/omap/omap-alsa-tsc2101-mixer.c
+864
-0
sound/arm/omap/omap-alsa-tsc2101-mixer.h
sound/arm/omap/omap-alsa-tsc2101-mixer.h
+79
-0
sound/arm/omap/omap-alsa-tsc2101.c
sound/arm/omap/omap-alsa-tsc2101.c
+439
-0
sound/arm/omap/omap-alsa-tsc2101.h
sound/arm/omap/omap-alsa-tsc2101.h
+61
-0
sound/arm/omap/omap-alsa.c
sound/arm/omap/omap-alsa.c
+579
-0
No files found.
arch/arm/mach-omap1/board-h2.c
View file @
6bc09656
...
...
@@ -40,8 +40,9 @@
#include <asm/arch/irda.h>
#include <asm/arch/usb.h>
#include <asm/arch/keypad.h>
#include <asm/arch/dma.h>
#include <asm/arch/common.h>
#include <asm/arch/mcbsp.h>
#include <asm/arch/omap-alsa.h>
extern
int
omap_gpio_init
(
void
);
...
...
@@ -285,6 +286,41 @@ static struct platform_device h2_lcd_device = {
.
id
=
-
1
,
};
static
struct
omap_mcbsp_reg_cfg
mcbsp_regs
=
{
.
spcr2
=
FREE
|
FRST
|
GRST
|
XRST
|
XINTM
(
3
),
.
spcr1
=
RINTM
(
3
)
|
RRST
,
.
rcr2
=
RPHASE
|
RFRLEN2
(
OMAP_MCBSP_WORD_8
)
|
RWDLEN2
(
OMAP_MCBSP_WORD_16
)
|
RDATDLY
(
1
),
.
rcr1
=
RFRLEN1
(
OMAP_MCBSP_WORD_8
)
|
RWDLEN1
(
OMAP_MCBSP_WORD_16
),
.
xcr2
=
XPHASE
|
XFRLEN2
(
OMAP_MCBSP_WORD_8
)
|
XWDLEN2
(
OMAP_MCBSP_WORD_16
)
|
XDATDLY
(
1
)
|
XFIG
,
.
xcr1
=
XFRLEN1
(
OMAP_MCBSP_WORD_8
)
|
XWDLEN1
(
OMAP_MCBSP_WORD_16
),
.
srgr1
=
FWID
(
15
),
.
srgr2
=
GSYNC
|
CLKSP
|
FSGM
|
FPER
(
31
),
.
pcr0
=
CLKXM
|
CLKRM
|
FSXP
|
FSRP
|
CLKXP
|
CLKRP
,
//.pcr0 = CLKXP | CLKRP, /* mcbsp: slave */
};
static
struct
omap_alsa_codec_config
alsa_config
=
{
.
name
=
"H2 TSC2101"
,
.
mcbsp_regs_alsa
=
&
mcbsp_regs
,
.
codec_configure_dev
=
NULL
,
// tsc2101_configure,
.
codec_set_samplerate
=
NULL
,
// tsc2101_set_samplerate,
.
codec_clock_setup
=
NULL
,
// tsc2101_clock_setup,
.
codec_clock_on
=
NULL
,
// tsc2101_clock_on,
.
codec_clock_off
=
NULL
,
// tsc2101_clock_off,
.
get_default_samplerate
=
NULL
,
// tsc2101_get_default_samplerate,
};
static
struct
platform_device
h2_mcbsp1_device
=
{
.
name
=
"omap_alsa_mcbsp"
,
.
id
=
1
,
.
dev
=
{
.
platform_data
=
&
alsa_config
,
},
};
static
struct
platform_device
*
h2_devices
[]
__initdata
=
{
&
h2_nor_device
,
&
h2_nand_device
,
...
...
@@ -292,6 +328,7 @@ static struct platform_device *h2_devices[] __initdata = {
&
h2_irda_device
,
&
h2_kp_device
,
&
h2_lcd_device
,
&
h2_mcbsp1_device
,
};
static
void
__init
h2_init_smc91x
(
void
)
...
...
arch/arm/mach-omap1/board-osk.c
View file @
6bc09656
...
...
@@ -47,6 +47,8 @@
#include <asm/arch/tc.h>
#include <asm/arch/keypad.h>
#include <asm/arch/common.h>
#include <asm/arch/mcbsp.h>
#include <asm/arch/omap-alsa.h>
static
int
osk_keymap
[]
=
{
KEY
(
0
,
0
,
KEY_F1
),
...
...
@@ -149,9 +151,40 @@ static struct platform_device osk5912_cf_device = {
.
resource
=
osk5912_cf_resources
,
};
#define DEFAULT_BITPERSAMPLE 16
static
struct
omap_mcbsp_reg_cfg
mcbsp_regs
=
{
.
spcr2
=
FREE
|
FRST
|
GRST
|
XRST
|
XINTM
(
3
),
.
spcr1
=
RINTM
(
3
)
|
RRST
,
.
rcr2
=
RPHASE
|
RFRLEN2
(
OMAP_MCBSP_WORD_8
)
|
RWDLEN2
(
OMAP_MCBSP_WORD_16
)
|
RDATDLY
(
0
),
.
rcr1
=
RFRLEN1
(
OMAP_MCBSP_WORD_8
)
|
RWDLEN1
(
OMAP_MCBSP_WORD_16
),
.
xcr2
=
XPHASE
|
XFRLEN2
(
OMAP_MCBSP_WORD_8
)
|
XWDLEN2
(
OMAP_MCBSP_WORD_16
)
|
XDATDLY
(
0
)
|
XFIG
,
.
xcr1
=
XFRLEN1
(
OMAP_MCBSP_WORD_8
)
|
XWDLEN1
(
OMAP_MCBSP_WORD_16
),
.
srgr1
=
FWID
(
DEFAULT_BITPERSAMPLE
-
1
),
.
srgr2
=
GSYNC
|
CLKSP
|
FSGM
|
FPER
(
DEFAULT_BITPERSAMPLE
*
2
-
1
),
/*.pcr0 = FSXM | FSRM | CLKXM | CLKRM | CLKXP | CLKRP,*/
/* mcbsp: master */
.
pcr0
=
CLKXP
|
CLKRP
,
/* mcbsp: slave */
};
static
struct
omap_alsa_codec_config
alsa_config
=
{
.
name
=
"OSK AIC23"
,
.
mcbsp_regs_alsa
=
&
mcbsp_regs
,
.
codec_configure_dev
=
NULL
,
// aic23_configure,
.
codec_set_samplerate
=
NULL
,
// aic23_set_samplerate,
.
codec_clock_setup
=
NULL
,
// aic23_clock_setup,
.
codec_clock_on
=
NULL
,
// aic23_clock_on,
.
codec_clock_off
=
NULL
,
// aic23_clock_off,
.
get_default_samplerate
=
NULL
,
// aic23_get_default_samplerate,
};
static
struct
platform_device
osk5912_mcbsp1_device
=
{
.
name
=
"omap_mcbsp"
,
.
id
=
1
,
.
name
=
"omap_alsa_mcbsp"
,
.
id
=
1
,
.
dev
=
{
.
platform_data
=
&
alsa_config
,
},
};
static
struct
resource
osk5912_kp_resources
[]
=
{
...
...
drivers/cbus/tahvo-usb.c
View file @
6bc09656
...
...
@@ -193,8 +193,9 @@ static int omap_otg_probe(struct device *dev)
static
int
omap_otg_remove
(
struct
device
*
dev
)
{
tahvo_otg_dev
=
NULL
;
free_irq
(
tahvo_otg_dev
->
resource
[
1
].
start
,
&
tahvo_usb_device
);
tahvo_otg_dev
=
NULL
;
return
0
;
}
...
...
sound/arm/omap-aic23
.h
→
include/asm-arm/arch-omap/omap-alsa
.h
View file @
6bc09656
/*
*
sound/arm/omap-aic23
.h
*
linux/include/asm-arm/arch-omap/omap-alsa
.h
*
* Alsa Driver for AIC23 codec on OSK5912 platform board
* Alsa Driver for AIC23 and TSC2101 codecs on OMAP platform boards.
*
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* Written by Daniel Petrini, David Cohen, Anderson Briglia
...
...
@@ -33,39 +35,38 @@
* 2005/07/25 INdT-10LE Kernel Team - Alsa driver for omap osk,
* original version based in sa1100 driver
* and omap oss driver.
*
* 2005-12-18 Dirk Behme - Added L/R Channel Interchange fix as proposed by Ajaya Babu
*/
#ifndef __OMAP_A
IC23
_H
#define __OMAP_A
IC23
_H
#ifndef __OMAP_A
LSA
_H
#define __OMAP_A
LSA
_H
#include <sound/driver.h>
#include <asm/arch/dma.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <asm/arch/mcbsp.h>
#include <linux/platform_device.h>
/*
* Debug functions
*/
#undef DEBUG
//#define DEBUG
#define ERR(ARGS...) printk(KERN_ERR "{%s}-ERROR: ", __FUNCTION__);printk(ARGS);
#ifdef DEBUG
#define DPRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
#define ADEBUG() printk("XXX Alsa debug f:%s, l:%d\n", __FUNCTION__, __LINE__)
#define FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
#define FN_OUT(n) printk(KERN_INFO "[%s]: end(%u)\n",__FUNCTION__, n)
#else
#define DPRINTK(ARGS...)
/* nop */
#define ADEBUG()
/* nop */
#define FN_IN
/* nop */
#define FN_OUT(n)
/* nop */
#endif
#define DEFAULT_OUTPUT_VOLUME 0x60
#define DEFAULT_INPUT_VOLUME 0x00
/* 0 ==> mute line in */
#define OUTPUT_VOLUME_MIN LHV_MIN
#define OUTPUT_VOLUME_MAX LHV_MAX
#define OUTPUT_VOLUME_RANGE (OUTPUT_VOLUME_MAX - OUTPUT_VOLUME_MIN)
#define OUTPUT_VOLUME_MASK OUTPUT_VOLUME_MAX
#define INPUT_VOLUME_MIN LIV_MIN
#define INPUT_VOLUME_MAX LIV_MAX
#define INPUT_VOLUME_RANGE (INPUT_VOLUME_MAX - INPUT_VOLUME_MIN)
#define INPUT_VOLUME_MASK INPUT_VOLUME_MAX
#define SIDETONE_MASK 0x1c0
#define SIDETONE_0 0x100
#define SIDETONE_6 0x000
#define SIDETONE_9 0x040
#define SIDETONE_12 0x080
#define SIDETONE_18 0x0c0
#define DEFAULT_ANALOG_AUDIO_CONTROL DAC_SELECTED | STE_ENABLED | BYPASS_ON | INSEL_MIC | MICB_20DB
#define DMA_BUF_SIZE (1024 * 8)
/*
* Buffer management for alsa and dma
...
...
@@ -93,38 +94,51 @@ struct audio_stream {
/*
* Alsa card structure for aic23
*/
struct
snd_card_omap_
aic23
{
struct
snd_card_omap_
codec
{
snd_card_t
*
card
;
snd_pcm_t
*
pcm
;
long
samplerate
;
struct
audio_stream
s
[
2
];
/* playback & capture */
};
/*********** Function Prototypes *************************/
/* Codec specific information and function pointers.
* Codec (omap-alsa-aic23.c and omap-alsa-tsc2101.c)
* are responsible for defining the function pointers.
*/
struct
omap_alsa_codec_config
{
char
*
name
;
struct
omap_mcbsp_reg_cfg
*
mcbsp_regs_alsa
;
snd_pcm_hw_constraint_list_t
*
hw_constraints_rates
;
snd_pcm_hardware_t
*
snd_omap_alsa_playback
;
snd_pcm_hardware_t
*
snd_omap_alsa_capture
;
void
(
*
codec_configure_dev
)(
void
);
void
(
*
codec_set_samplerate
)(
long
);
void
(
*
codec_clock_setup
)(
void
);
int
(
*
codec_clock_on
)(
void
);
int
(
*
codec_clock_off
)(
void
);
int
(
*
get_default_samplerate
)(
void
);
};
void
audio_dma_callback
(
void
*
);
int
snd_omap_mixer
(
struct
snd_card_omap_
aic23
*
);
/*********** Mixer function prototypes *************************/
int
snd_omap_mixer
(
struct
snd_card_omap_
codec
*
);
void
snd_omap_init_mixer
(
void
);
/* Clock functions */
int
omap_aic23_clock_on
(
void
);
int
omap_aic23_clock_off
(
void
);
#ifdef CONFIG_PM
void
snd_omap_suspend_mixer
(
void
);
void
snd_omap_resume_mixer
(
void
);
#endif
/* Codec AIC23 */
#if defined(CONFIG_SENSORS_TLV320AIC23) || defined (CONFIG_SENSORS_TLV320AIC23_MODULE)
extern
int
tlv320aic23_write_value
(
u8
reg
,
u16
value
);
/* TLV320AIC23 is a write only device */
static
__inline__
void
audio_aic23_write
(
u8
address
,
u16
data
)
{
tlv320aic23_write_value
(
address
,
data
);
}
int
snd_omap_alsa_post_probe
(
struct
platform_device
*
pdev
,
struct
omap_alsa_codec_config
*
config
);
int
snd_omap_alsa_remove
(
struct
platform_device
*
pdev
);
#ifdef CONFIG_PM
int
snd_omap_alsa_suspend
(
struct
platform_device
*
pdev
,
pm_message_t
state
);
int
snd_omap_alsa_resume
(
struct
platform_device
*
pdev
);
#else
#define snd_omap_alsa_suspend NULL
#define snd_omap_alsa_resume NULL
#endif
#endif
/* CONFIG_SENSORS_TLV320AIC23 */
/*********** function prototype to function called from the dma interrupt handler ******/
void
callback_omap_alsa_sound_dma
(
void
*
);
#endif
sound/arm/Kconfig
View file @
6bc09656
...
...
@@ -44,5 +44,19 @@ config SND_OMAP_AIC23
To compile this driver as a module, choose M here: the module
will be called snd-omap-aic23.
config SND_OMAP_TSC2101
tristate "OMAP TSC2101 alsa driver"
depends on ARCH_OMAP && SND
select SND_PCM
select OMAP_TSC2101
select OMAP_UWIRE if ARCH_OMAP
help
Say Y here if you have a OMAP platform board
and want to use its TSC2101 audio chip. Driver has
been tested with H2 and iPAQ h6300.
To compile this driver as a module, choose M here: the module
will be called snd-omap-tsc2101.
endmenu
sound/arm/Makefile
View file @
6bc09656
...
...
@@ -14,5 +14,4 @@ snd-pxa2xx-pcm-objs := pxa2xx-pcm.o
obj-$(CONFIG_SND_PXA2XX_AC97)
+=
snd-pxa2xx-ac97.o
snd-pxa2xx-ac97-objs
:=
pxa2xx-ac97.o
obj-$(CONFIG_SND_OMAP_AIC23)
+=
snd-omap-aic23.o
snd-omap-aic23-objs
:=
omap-aic23.o omap-alsa-dma.o omap-alsa-mixer.o
obj-$(CONFIG_SND)
+=
omap/
sound/arm/omap/Makefile
0 → 100644
View file @
6bc09656
#
## Makefile for ALSA OMAP
#
#
obj-$(CONFIG_SND_OMAP_AIC23)
+=
snd-omap-alsa-aic23.o
snd-omap-alsa-aic23-objs
:=
omap-alsa.o omap-alsa-dma.o omap-alsa-aic23.o omap-alsa-aic23-mixer.o
obj-$(CONFIG_SND_OMAP_TSC2101)
+=
snd-omap-alsa-tsc2101.o
snd-omap-alsa-tsc2101-objs
:=
omap-alsa.o omap-alsa-dma.o omap-alsa-tsc2101.o omap-alsa-tsc2101-mixer.o
sound/arm/omap
-alsa
-mixer.c
→
sound/arm/omap
/omap-alsa-aic23
-mixer.c
View file @
6bc09656
/*
* sound/arm/omap
-alsa
-mixer.c
* sound/arm/omap
/omap-alsa-aic23
-mixer.c
*
* Alsa Driver Mixer for generic codecs for omap boards
*
...
...
@@ -39,20 +39,10 @@
#include <linux/config.h>
#include <sound/driver.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/init.h>
#include <linux/errno.h>
#include <linux/ioctl.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <asm/hardware.h>
#include <asm/mach-types.h>
#include <asm/arch/dma.h>
#include <asm/arch/aic23.h>
#include "omap-aic23.h"
#include <asm/arch/omap-alsa.h>
#include "omap-alsa-aic23.h"
#include <sound/initval.h>
#include <sound/control.h>
...
...
@@ -67,7 +57,7 @@ MODULE_DESCRIPTION("OMAP Alsa mixer driver for ALSA");
/* Codec AIC23 */
#if defined(CONFIG_SENSORS_TLV320AIC23) || defined (CONFIG_SENSORS_TLV320AIC23_MODULE)
extern
__inline__
void
audio_aic23_write
(
u8
,
u16
);
extern
void
audio_aic23_write
(
u8
,
u16
);
#define MIXER_NAME "Mixer AIC23"
#define SND_OMAP_WRITE(reg, val) audio_aic23_write(reg, val)
...
...
@@ -411,31 +401,6 @@ static snd_kcontrol_new_t snd_omap_controls[] = {
OMAP_MUX
(
"Capture Source"
,
ANALOG_AUDIO_CONTROL_ADDR
,
AAC_INDEX
,
INSEL_MIC
),
};
void
snd_omap_init_mixer
(
void
)
{
u16
vol_reg
;
/* Line's default values */
omap_regs
[
LINE_INDEX
].
l_reg
=
DEFAULT_INPUT_VOLUME
&
INPUT_VOLUME_MASK
;
omap_regs
[
LINE_INDEX
].
r_reg
=
DEFAULT_INPUT_VOLUME
&
INPUT_VOLUME_MASK
;
omap_regs
[
LINE_INDEX
].
sw
=
0
;
SND_OMAP_WRITE
(
LEFT_LINE_VOLUME_ADDR
,
DEFAULT_INPUT_VOLUME
&
INPUT_VOLUME_MASK
);
SND_OMAP_WRITE
(
RIGHT_LINE_VOLUME_ADDR
,
DEFAULT_INPUT_VOLUME
&
INPUT_VOLUME_MASK
);
/* Analog Audio Control's default values */
omap_regs
[
AAC_INDEX
].
l_reg
=
DEFAULT_ANALOG_AUDIO_CONTROL
;
/* Headphone's default values */
vol_reg
=
LZC_ON
;
vol_reg
&=
~
OUTPUT_VOLUME_MASK
;
vol_reg
|=
DEFAULT_OUTPUT_VOLUME
;
omap_regs
[
PCM_INDEX
].
l_reg
=
DEFAULT_OUTPUT_VOLUME
;
omap_regs
[
PCM_INDEX
].
r_reg
=
DEFAULT_OUTPUT_VOLUME
;
omap_regs
[
PCM_INDEX
].
sw
=
1
;
SND_OMAP_WRITE
(
LEFT_CHANNEL_VOLUME_ADDR
,
vol_reg
);
SND_OMAP_WRITE
(
RIGHT_CHANNEL_VOLUME_ADDR
,
vol_reg
);
}
#ifdef CONFIG_PM
void
snd_omap_suspend_mixer
(
void
)
...
...
@@ -474,7 +439,32 @@ void snd_omap_resume_mixer(void)
}
#endif
int
snd_omap_mixer
(
struct
snd_card_omap_aic23
*
chip
)
void
snd_omap_init_mixer
(
void
)
{
u16
vol_reg
;
/* Line's default values */
omap_regs
[
LINE_INDEX
].
l_reg
=
DEFAULT_INPUT_VOLUME
&
INPUT_VOLUME_MASK
;
omap_regs
[
LINE_INDEX
].
r_reg
=
DEFAULT_INPUT_VOLUME
&
INPUT_VOLUME_MASK
;
omap_regs
[
LINE_INDEX
].
sw
=
0
;
SND_OMAP_WRITE
(
LEFT_LINE_VOLUME_ADDR
,
DEFAULT_INPUT_VOLUME
&
INPUT_VOLUME_MASK
);
SND_OMAP_WRITE
(
RIGHT_LINE_VOLUME_ADDR
,
DEFAULT_INPUT_VOLUME
&
INPUT_VOLUME_MASK
);
/* Analog Audio Control's default values */
omap_regs
[
AAC_INDEX
].
l_reg
=
DEFAULT_ANALOG_AUDIO_CONTROL
;
/* Headphone's default values */
vol_reg
=
LZC_ON
;
vol_reg
&=
~
OUTPUT_VOLUME_MASK
;
vol_reg
|=
DEFAULT_OUTPUT_VOLUME
;
omap_regs
[
PCM_INDEX
].
l_reg
=
DEFAULT_OUTPUT_VOLUME
;
omap_regs
[
PCM_INDEX
].
r_reg
=
DEFAULT_OUTPUT_VOLUME
;
omap_regs
[
PCM_INDEX
].
sw
=
1
;
SND_OMAP_WRITE
(
LEFT_CHANNEL_VOLUME_ADDR
,
vol_reg
);
SND_OMAP_WRITE
(
RIGHT_CHANNEL_VOLUME_ADDR
,
vol_reg
);
}
int
snd_omap_mixer
(
struct
snd_card_omap_codec
*
chip
)
{
snd_card_t
*
card
;
unsigned
int
idx
;
...
...
@@ -493,4 +483,3 @@ int snd_omap_mixer(struct snd_card_omap_aic23 *chip)
return
0
;
}
sound/arm/omap/omap-alsa-aic23.c
0 → 100644
View file @
6bc09656
/*
* arch/arm/mach-omap1/omap-alsa-aic23.c
*
* Alsa codec Driver for AIC23 chip on OSK5912 platform board
*
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* Written by Daniel Petrini, David Cohen, Anderson Briglia
* {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br
*
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* Based in former alsa driver for osk and oss driver
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#include <sound/driver.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <sound/initval.h>
#include <sound/control.h>
#include <linux/clk.h>
#include <asm/arch/clock.h>
#include <asm/arch/aic23.h>
#include <asm/arch/omap-alsa.h>
#include "omap-alsa-aic23.h"
static
struct
clk
*
aic23_mclk
=
0
;
/* aic23 related */
static
const
struct
aic23_samplerate_reg_info
rate_reg_info
[
NUMBER_SAMPLE_RATES_SUPPORTED
]
=
{
{
4000
,
0x06
,
1
},
/* 4000 */
{
8000
,
0x06
,
0
},
/* 8000 */
{
16000
,
0x0C
,
1
},
/* 16000 */
{
22050
,
0x11
,
1
},
/* 22050 */
{
24000
,
0x00
,
1
},
/* 24000 */
{
32000
,
0x0C
,
0
},
/* 32000 */
{
44100
,
0x11
,
0
},
/* 44100 */
{
48000
,
0x00
,
0
},
/* 48000 */
{
88200
,
0x1F
,
0
},
/* 88200 */
{
96000
,
0x0E
,
0
},
/* 96000 */
};
/*
* Hardware capabilities
*/
/*
* DAC USB-mode sampling rates (MCLK = 12 MHz)
* The rates and rate_reg_into MUST be in the same order
*/
static
unsigned
int
rates
[]
=
{
4000
,
8000
,
16000
,
22050
,
24000
,
32000
,
44100
,
48000
,
88200
,
96000
,
};
static
snd_pcm_hw_constraint_list_t
aic23_hw_constraints_rates
=
{
.
count
=
ARRAY_SIZE
(
rates
),
.
list
=
rates
,
.
mask
=
0
,
};
static
snd_pcm_hardware_t
aic23_snd_omap_alsa_playback
=
{
.
info
=
(
SNDRV_PCM_INFO_INTERLEAVED
|
SNDRV_PCM_INFO_BLOCK_TRANSFER
|
SNDRV_PCM_INFO_MMAP
|
SNDRV_PCM_INFO_MMAP_VALID
),
.
formats
=
(
SNDRV_PCM_FMTBIT_S16_LE
),
.
rates
=
(
SNDRV_PCM_RATE_8000
|
SNDRV_PCM_RATE_16000
|
SNDRV_PCM_RATE_22050
|
SNDRV_PCM_RATE_32000
|
SNDRV_PCM_RATE_44100
|
SNDRV_PCM_RATE_48000
|
SNDRV_PCM_RATE_88200
|
SNDRV_PCM_RATE_96000
|
SNDRV_PCM_RATE_KNOT
),
.
rate_min
=
8000
,
.
rate_max
=
96000
,
.
channels_min
=
2
,
.
channels_max
=
2
,
.
buffer_bytes_max
=
128
*
1024
,
.
period_bytes_min
=
32
,
.
period_bytes_max
=
8
*
1024
,
.
periods_min
=
16
,
.
periods_max
=
255
,
.
fifo_size
=
0
,
};
static
snd_pcm_hardware_t
aic23_snd_omap_alsa_capture
=
{
.
info
=
(
SNDRV_PCM_INFO_INTERLEAVED
|
SNDRV_PCM_INFO_BLOCK_TRANSFER
|
SNDRV_PCM_INFO_MMAP
|
SNDRV_PCM_INFO_MMAP_VALID
),
.
formats
=
(
SNDRV_PCM_FMTBIT_S16_LE
),
.
rates
=
(
SNDRV_PCM_RATE_8000
|
SNDRV_PCM_RATE_16000
|
SNDRV_PCM_RATE_22050
|
SNDRV_PCM_RATE_32000
|
SNDRV_PCM_RATE_44100
|
SNDRV_PCM_RATE_48000
|
SNDRV_PCM_RATE_88200
|
SNDRV_PCM_RATE_96000
|
SNDRV_PCM_RATE_KNOT
),
.
rate_min
=
8000
,
.
rate_max
=
96000
,
.
channels_min
=
2
,
.
channels_max
=
2
,
.
buffer_bytes_max
=
128
*
1024
,
.
period_bytes_min
=
32
,
.
period_bytes_max
=
8
*
1024
,
.
periods_min
=
16
,
.
periods_max
=
255
,
.
fifo_size
=
0
,
};
/*
* Codec/mcbsp init and configuration section
* codec dependent code.
*/
extern
int
tlv320aic23_write_value
(
u8
reg
,
u16
value
);
/* TLV320AIC23 is a write only device */
void
audio_aic23_write
(
u8
address
,
u16
data
)
{
tlv320aic23_write_value
(
address
,
data
);
}
EXPORT_SYMBOL_GPL
(
audio_aic23_write
);
/*
* Sample rate changing
*/
void
aic23_set_samplerate
(
long
rate
)
{
u8
count
=
0
;
u16
data
=
0
;
/* Fix the rate if it has a wrong value */
if
(
rate
>=
96000
)
rate
=
96000
;
else
if
(
rate
>=
88200
)
rate
=
88200
;
else
if
(
rate
>=
48000
)
rate
=
48000
;
else
if
(
rate
>=
44100
)
rate
=
44100
;
else
if
(
rate
>=
32000
)
rate
=
32000
;
else
if
(
rate
>=
24000
)
rate
=
24000
;
else
if
(
rate
>=
22050
)
rate
=
22050
;
else
if
(
rate
>=
16000
)
rate
=
16000
;
else
if
(
rate
>=
8000
)
rate
=
8000
;
else
rate
=
4000
;
/* Search for the right sample rate */
/* Verify what happens if the rate is not supported
* now it goes to 96Khz */
while
((
rate_reg_info
[
count
].
sample_rate
!=
rate
)
&&
(
count
<
(
NUMBER_SAMPLE_RATES_SUPPORTED
-
1
)))
{
count
++
;
}
data
=
(
rate_reg_info
[
count
].
divider
<<
CLKIN_SHIFT
)
|
(
rate_reg_info
[
count
].
control
<<
BOSR_SHIFT
)
|
USB_CLK_ON
;
audio_aic23_write
(
SAMPLE_RATE_CONTROL_ADDR
,
data
);
}
inline
void
aic23_configure
(
void
)
{
/* Reset codec */
audio_aic23_write
(
RESET_CONTROL_ADDR
,
0
);
/* Initialize the AIC23 internal state */
/* Analog audio path control, DAC selected, delete INSEL_MIC for line in */
audio_aic23_write
(
ANALOG_AUDIO_CONTROL_ADDR
,
DEFAULT_ANALOG_AUDIO_CONTROL
);
/* Digital audio path control, de-emphasis control 44.1kHz */
audio_aic23_write
(
DIGITAL_AUDIO_CONTROL_ADDR
,
DEEMP_44K
);
/* Digital audio interface, master/slave mode, I2S, 16 bit */
#ifdef AIC23_MASTER
audio_aic23_write
(
DIGITAL_AUDIO_FORMAT_ADDR
,
MS_MASTER
|
IWL_16
|
FOR_DSP
);
#else
audio_aic23_write
(
DIGITAL_AUDIO_FORMAT_ADDR
,
IWL_16
|
FOR_DSP
);
#endif
/* Enable digital interface */
audio_aic23_write
(
DIGITAL_INTERFACE_ACT_ADDR
,
ACT_ON
);
}
/*
* Omap MCBSP clock configuration and Power Management
*
* Here we have some functions that allows clock to be enabled and
* disabled only when needed. Besides doing clock configuration
* it allows turn on/turn off audio when necessary.
*/
/*
* Do clock framework mclk search
*/
void
aic23_clock_setup
(
void
)
{
aic23_mclk
=
clk_get
(
0
,
"mclk"
);
}
/*
* Do some sanity check, set clock rate, starts it and
* turn codec audio on
*/
int
aic23_clock_on
(
void
)
{
if
(
clk_get_usecount
(
aic23_mclk
)
>
0
)
{
/* MCLK is already in use */
printk
(
KERN_WARNING
"MCLK in use at %d Hz. We change it to %d Hz
\n
"
,
(
uint
)
clk_get_rate
(
aic23_mclk
),
CODEC_CLOCK
);
}
if
(
clk_set_rate
(
aic23_mclk
,
CODEC_CLOCK
))
{
printk
(
KERN_ERR
"Cannot set MCLK for AIC23 CODEC
\n
"
);
return
-
ECANCELED
;
}
clk_enable
(
aic23_mclk
);
printk
(
KERN_DEBUG
"MCLK = %d [%d], usecount = %d
\n
"
,
(
uint
)
clk_get_rate
(
aic23_mclk
),
CODEC_CLOCK
,
clk_get_usecount
(
aic23_mclk
));
/* Now turn the audio on */
audio_aic23_write
(
POWER_DOWN_CONTROL_ADDR
,
~
DEVICE_POWER_OFF
&
~
OUT_OFF
&
~
DAC_OFF
&
~
ADC_OFF
&
~
MIC_OFF
&
~
LINE_OFF
);
return
0
;
}
/*
* Do some sanity check, turn clock off and then turn
* codec audio off
*/
int
aic23_clock_off
(
void
)
{
if
(
clk_get_usecount
(
aic23_mclk
)
>
0
)
{
if
(
clk_get_rate
(
aic23_mclk
)
!=
CODEC_CLOCK
)
{
printk
(
KERN_WARNING
"MCLK for audio should be %d Hz. But is %d Hz
\n
"
,
(
uint
)
clk_get_rate
(
aic23_mclk
),
CODEC_CLOCK
);
}
clk_disable
(
aic23_mclk
);
}
audio_aic23_write
(
POWER_DOWN_CONTROL_ADDR
,
DEVICE_POWER_OFF
|
OUT_OFF
|
DAC_OFF
|
ADC_OFF
|
MIC_OFF
|
LINE_OFF
);
return
0
;
}
int
aic23_get_default_samplerate
(
void
)
{
return
DEFAULT_SAMPLE_RATE
;
}
static
int
__init
snd_omap_alsa_aic23_probe
(
struct
platform_device
*
pdev
)
{
int
ret
;
struct
omap_alsa_codec_config
*
codec_cfg
;
codec_cfg
=
pdev
->
dev
.
platform_data
;
if
(
codec_cfg
!=
NULL
)
{
codec_cfg
->
hw_constraints_rates
=
&
aic23_hw_constraints_rates
;
codec_cfg
->
snd_omap_alsa_playback
=
&
aic23_snd_omap_alsa_playback
;
codec_cfg
->
snd_omap_alsa_capture
=
&
aic23_snd_omap_alsa_capture
;
codec_cfg
->
codec_configure_dev
=
aic23_configure
;
codec_cfg
->
codec_set_samplerate
=
aic23_set_samplerate
;
codec_cfg
->
codec_clock_setup
=
aic23_clock_setup
;
codec_cfg
->
codec_clock_on
=
aic23_clock_on
;
codec_cfg
->
codec_clock_off
=
aic23_clock_off
;
codec_cfg
->
get_default_samplerate
=
aic23_get_default_samplerate
;
ret
=
snd_omap_alsa_post_probe
(
pdev
,
codec_cfg
);
}
else
ret
=
-
ENODEV
;
return
ret
;
}
static
struct
platform_driver
omap_alsa_driver
=
{
.
probe
=
snd_omap_alsa_aic23_probe
,
.
remove
=
snd_omap_alsa_remove
,
.
suspend
=
snd_omap_alsa_suspend
,
.
resume
=
snd_omap_alsa_resume
,
.
driver
=
{
.
name
=
"omap_alsa_mcbsp"
,
},
};
static
int
__init
omap_alsa_aic23_init
(
void
)
{
int
err
;
ADEBUG
();
err
=
platform_driver_register
(
&
omap_alsa_driver
);
return
err
;
}
static
void
__exit
omap_alsa_aic23_exit
(
void
)
{
ADEBUG
();
platform_driver_unregister
(
&
omap_alsa_driver
);
}
module_init
(
omap_alsa_aic23_init
);
module_exit
(
omap_alsa_aic23_exit
);
sound/arm/omap/omap-alsa-aic23.h
0 → 100644
View file @
6bc09656
/*
* sound/arm/omap-alsa-aic23.h
*
* Alsa Driver for AIC23 codec on OSK5912 platform board
*
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* Written by Daniel Petrini, David Cohen, Anderson Briglia
* {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br
*
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifndef __OMAP_ALSA_AIC23_H
#define __OMAP_ALSA_AIC23_H
#include <sound/driver.h>
#include <asm/arch/dma.h>
#include <sound/core.h>
#include <sound/pcm.h>
#include <asm/arch/mcbsp.h>
/* Define to set the AIC23 as the master w.r.t McBSP */
#define AIC23_MASTER
#define NUMBER_SAMPLE_RATES_SUPPORTED 10
/*
* AUDIO related MACROS
*/
#ifndef DEFAULT_BITPERSAMPLE
#define DEFAULT_BITPERSAMPLE 16
#endif
#define DEFAULT_SAMPLE_RATE 44100
#define CODEC_CLOCK 12000000
#define AUDIO_MCBSP OMAP_MCBSP1
#define DEFAULT_OUTPUT_VOLUME 0x60
#define DEFAULT_INPUT_VOLUME 0x00
/* 0 ==> mute line in */
#define OUTPUT_VOLUME_MIN LHV_MIN
#define OUTPUT_VOLUME_MAX LHV_MAX
#define OUTPUT_VOLUME_RANGE (OUTPUT_VOLUME_MAX - OUTPUT_VOLUME_MIN)
#define OUTPUT_VOLUME_MASK OUTPUT_VOLUME_MAX
#define INPUT_VOLUME_MIN LIV_MIN
#define INPUT_VOLUME_MAX LIV_MAX
#define INPUT_VOLUME_RANGE (INPUT_VOLUME_MAX - INPUT_VOLUME_MIN)
#define INPUT_VOLUME_MASK INPUT_VOLUME_MAX
#define SIDETONE_MASK 0x1c0
#define SIDETONE_0 0x100
#define SIDETONE_6 0x000
#define SIDETONE_9 0x040
#define SIDETONE_12 0x080
#define SIDETONE_18 0x0c0
#define DEFAULT_ANALOG_AUDIO_CONTROL DAC_SELECTED | STE_ENABLED | BYPASS_ON | INSEL_MIC | MICB_20DB
struct
aic23_samplerate_reg_info
{
u32
sample_rate
;
u8
control
;
/* SR3, SR2, SR1, SR0 and BOSR */
u8
divider
;
/* if 0 CLKIN = MCLK, if 1 CLKIN = MCLK/2 */
};
/*
* Defines codec specific functions pointers that can be used from the
* common omap-alse base driver for all omap codecs. (tsc2101 and aic23)
*/
void
define_codec_functions
(
struct
omap_alsa_codec_config
*
codec_config
);
inline
void
aic23_configure
(
void
);
void
aic23_set_samplerate
(
long
rate
);
void
aic23_clock_setup
(
void
);
int
aic23_clock_on
(
void
);
int
aic23_clock_off
(
void
);
int
aic23_get_default_samplerate
(
void
);
#endif
sound/arm/omap-alsa-dma.c
→
sound/arm/omap
/omap
-alsa-dma.c
View file @
6bc09656
/*
* sound/arm/omap-alsa-dma.c
* sound/arm/omap
/omap
-alsa-dma.c
*
* 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) 2004 Texas Instruments, Inc.
...
...
@@ -66,20 +68,9 @@
#include <asm/arch/mcbsp.h>
#include
"omap-aic23.h"
#include
<asm/arch/omap-alsa.h>
#undef DEBUG
//#define DEBUG
#ifdef DEBUG
#define DPRINTK(ARGS...) printk(KERN_INFO "<%s>: ",__FUNCTION__);printk(ARGS)
#define FN_IN printk(KERN_INFO "[%s]: start\n", __FUNCTION__)
#define FN_OUT(n) printk(KERN_INFO "[%s]: end(%u)\n",__FUNCTION__, n)
#else
#define DPRINTK( x... )
#define FN_IN
#define FN_OUT(x)
#endif
#define ERR(ARGS...) printk(KERN_ERR "{%s}-ERROR: ", __FUNCTION__);printk(ARGS);
...
...
@@ -165,7 +156,7 @@ static void omap_sound_dma_link_lch(void *data)
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
)
{
int
i
,
err
=
0
;
...
...
@@ -186,10 +177,11 @@ int omap_request_sound_dma(int device_id, const char *device_name,
}
spin_lock
(
&
dma_list_lock
);
for
(
i
=
0
;
i
<
nr_linked_channels
;
i
++
)
{
err
=
omap_request_dma
(
device_id
,
device_name
,
sound_dma_irq_handler
,
data
,
&
chan
[
i
]);
err
=
omap_request_dma
(
device_id
,
device_name
,
sound_dma_irq_handler
,
data
,
&
chan
[
i
]);
/* Handle Failure condition here */
if
(
err
<
0
)
{
...
...
@@ -223,7 +215,7 @@ int omap_request_sound_dma(int device_id, const char *device_name,
**************************************************************************************/
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
i
;
...
...
@@ -243,11 +235,11 @@ static void omap_sound_dma_unlink_lch(void *data)
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
*
chan
=
NULL
;
FN_IN
;
if
(
unlikely
(
NULL
==
channels
))
{
BUG
();
...
...
@@ -277,10 +269,11 @@ int omap_free_sound_dma(void *data, int **channels)
* 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
i
;
FN_IN
;
if
(
unlikely
(
NULL
==
chan
))
{
BUG
();
...
...
@@ -299,7 +292,7 @@ void omap_audio_stop_dma(struct audio_stream *s)
* 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
;
omap_clear_dma
(
s
->
lch
[
s
->
dma_q_head
]);
...
...
@@ -307,13 +300,6 @@ void omap_clear_sound_dma(struct audio_stream * s)
return
;
}
/*********************************** MODULE FUNCTIONS DEFINTIONS ***********************/
#ifdef OMAP1610_MCBSP1_BASE
#undef OMAP1610_MCBSP1_BASE
#endif
#define OMAP1610_MCBSP1_BASE 0xE1011000
/***************************************************************************************
*
* DMA related functions
...
...
@@ -325,9 +311,10 @@ static int audio_set_dma_params_play(int channel, dma_addr_t dma_ptr,
int
dt
=
0x1
;
/* data type 16 */
int
cen
=
32
;
/* Stereo */
int
cfn
=
dma_size
/
(
2
*
cen
);
FN_IN
;
omap_set_dma_dest_params
(
channel
,
0x05
,
0x00
,
(
OMAP1
610_MCBSP1_BASE
+
0x8
06
),
(
OMAP1
510_MCBSP1_BASE
+
0x
06
),
0
,
0
);
omap_set_dma_src_params
(
channel
,
0x00
,
0x01
,
dma_ptr
,
0
,
0
);
...
...
@@ -341,11 +328,11 @@ static int audio_set_dma_params_capture(int channel, dma_addr_t dma_ptr,
{
int
dt
=
0x1
;
/* data type 16 */
int
cen
=
32
;
/* stereo */
int
cfn
=
dma_size
/
(
2
*
cen
);
FN_IN
;
omap_set_dma_src_params
(
channel
,
0x05
,
0x00
,
(
OMAP1
610_MCBSP1_BASE
+
0x8
02
),
(
OMAP1
510_MCBSP1_BASE
+
0x
02
),
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
);
...
...
@@ -358,7 +345,7 @@ static int audio_start_dma_chain(struct audio_stream *s)
int
channel
=
s
->
lch
[
s
->
dma_q_head
];
FN_IN
;
if
(
!
s
->
started
)
{
s
->
hw_stop
();
/* stops McBSP Interface */
s
->
hw_stop
();
/* stops McBSP Interface */
omap_start_dma
(
channel
);
s
->
started
=
1
;
s
->
hw_start
();
/* start McBSP interface */
...
...
@@ -372,8 +359,9 @@ static int audio_start_dma_chain(struct audio_stream *s)
* Do the initial set of work to initialize all the channels as required.
* We shall then initate a transfer
*/
int
omap_start_sound_dma
(
struct
audio_stream
*
s
,
dma_addr_t
dma_ptr
,
u_int
dma_size
)
int
omap_start_alsa_sound_dma
(
struct
audio_stream
*
s
,
dma_addr_t
dma_ptr
,
u_int
dma_size
)
{
int
ret
=
-
EPERM
;
...
...
@@ -439,18 +427,17 @@ static void sound_dma_irq_handler(int sound_curr_lch, u16 ch_status,
}
if
(
ch_status
&
DCSR_END_BLOCK
)
audio_dma_callback
(
s
);
callback_omap_alsa_sound_dma
(
s
);
FN_OUT
(
0
);
return
;
}
MODULE_AUTHOR
(
"Texas Instruments"
);
MODULE_DESCRIPTION
(
"Common DMA handling for Audio driver on OMAP processors"
);
MODULE_DESCRIPTION
(
"Common DMA handling for Audio driver on OMAP processors"
);
MODULE_LICENSE
(
"GPL"
);
EXPORT_SYMBOL
(
omap_start_sound_dma
);
EXPORT_SYMBOL
(
omap_clear_sound_dma
);
EXPORT_SYMBOL
(
omap_request_sound_dma
);
EXPORT_SYMBOL
(
omap_free_sound_dma
);
EXPORT_SYMBOL
(
omap_
audio_stop
_dma
);
EXPORT_SYMBOL
(
omap_start_
alsa_
sound_dma
);
EXPORT_SYMBOL
(
omap_clear_
alsa_
sound_dma
);
EXPORT_SYMBOL
(
omap_request_
alsa_
sound_dma
);
EXPORT_SYMBOL
(
omap_free_
alsa_
sound_dma
);
EXPORT_SYMBOL
(
omap_
stop_alsa_sound
_dma
);
sound/arm/omap-alsa-dma.h
→
sound/arm/omap
/omap
-alsa-dma.h
View file @
6bc09656
/*
* linux/sound/arm/omap-alsa-dma.h
* linux/sound/arm/omap
/omap
-alsa-dma.h
*
* 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) 2004 Texas Instruments, Inc.
...
...
@@ -30,14 +32,7 @@
/************************** INCLUDES *************************************/
#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)
#include <asm/arch/omap-alsa.h>
/************************** GLOBAL DATA STRUCTURES *********************************/
...
...
@@ -45,15 +40,14 @@ typedef void (*dma_callback_t) (int lch, u16 ch_status, void *data);
/**************** 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
);
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
,
u_int
dma_size
);
int
omap_start_alsa_sound_dma
(
struct
audio_stream
*
s
,
dma_addr_t
dma_ptr
,
u_int
dma_size
);
void
omap_
audio_stop
_dma
(
struct
audio_stream
*
s
);
void
omap_
stop_alsa_sound
_dma
(
struct
audio_stream
*
s
);
#endif
sound/arm/omap/omap-alsa-tsc2101-mixer.c
0 → 100644
View file @
6bc09656
This diff is collapsed.
Click to expand it.
sound/arm/omap/omap-alsa-tsc2101-mixer.h
0 → 100644
View file @
6bc09656
/*
* sound/arm/omap/omap-alsa-tsc2101-mixer.c
*
* Alsa Driver for TSC2101 codec for OMAP platform boards.
*
* Copyright (C) 2005 Mika Laitio <lamikr@cc.jyu.fi> and
* Everett Coleman II <gcc80x86@fuzzyneural.net>
*
* Based on the ideas in omap-aic23.c and sa11xx-uda1341.c
* Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* Copyright (C) 2002 Tomas Kasparek <tomas.kasparek@seznam.cz>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
* NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 675 Mass Ave, Cambridge, MA 02139, USA.
*
* History:
*
* 2006-03-01 Mika Laitio - Mixer for the tsc2101 driver used in omap boards.
* Can switch between headset and loudspeaker playback,
* mute and unmute dgc, set dgc volume. Record source switch,
* keyclick, buzzer and headset volume and handset volume control
* are still missing.
*/
#ifndef OMAPALSATSC2101MIXER_H_
#define OMAPALSATSC2101MIXER_H_
#include <asm/hardware/tsc2101.h>
#include <../drivers/ssi/omap-tsc2101.h>
#include "omap-alsa-dma.h"
/* tsc2101 DAC gain control volume specific */
#define OUTPUT_VOLUME_MIN 0x7F // 1111111 = -63.5 DB
#define OUTPUT_VOLUME_MAX 0x32 // 110010
#define OUTPUT_VOLUME_RANGE (OUTPUT_VOLUME_MIN - OUTPUT_VOLUME_MAX)
/* use input vol of 75 for 0dB gain */
#define INPUT_VOLUME_MIN 0x0
#define INPUT_VOLUME_MAX 0x7D
#define INPUT_VOLUME_RANGE (INPUT_VOLUME_MAX - INPUT_VOLUME_MIN)
#define PLAYBACK_TARGET_COUNT 0x02
#define PLAYBACK_TARGET_LOUDSPEAKER 0x00
#define PLAYBACK_TARGET_HEADPHONE 0x01
/* following are used for register 03h Mixer PGA control bits D7-D5 for selecting record source */
#define REC_SRC_TARGET_COUNT 0x08
#define REC_SRC_SINGLE_ENDED_MICIN_HED MPC_MICSEL(0) // oss code referred to MIXER_LINE
#define REC_SRC_SINGLE_ENDED_MICIN_HND MPC_MICSEL(1) // oss code referred to MIXER_MIC
#define REC_SRC_SINGLE_ENDED_AUX1 MPC_MICSEL(2)
#define REC_SRC_SINGLE_ENDED_AUX2 MPC_MICSEL(3)
#define REC_SRC_MICIN_HED_AND_AUX1 MPC_MICSEL(4)
#define REC_SRC_MICIN_HED_AND_AUX2 MPC_MICSEL(5)
#define REC_SRC_MICIN_HND_AND_AUX1 MPC_MICSEL(6)
#define REC_SRC_MICIN_HND_AND_AUX2 MPC_MICSEL(7)
#define DEFAULT_OUTPUT_VOLUME 90 // default output volume to dac dgc
#define DEFAULT_INPUT_VOLUME 20 // default record volume
#define TSC2101_AUDIO_CODEC_REGISTERS_PAGE2 (2)
#endif
/*OMAPALSATSC2101MIXER_H_*/
sound/arm/omap/omap-alsa-tsc2101.c
0 → 100644
View file @
6bc09656
This diff is collapsed.
Click to expand it.
sound/arm/omap/omap-alsa-tsc2101.h
0 → 100644
View file @
6bc09656
/*
* arch/arc/mach-omap1/omap-alsa-tsc2101.h
*
* Alsa Driver for TSC2101 codec for OMAP platform boards.
*
* Based on former omap-aic23.h and tsc2101 OSS drivers.
* Copyright (C) 2004 Texas Instruments, Inc.
* Written by Nishanth Menon and Sriram Kannan
*
* Copyright (C) 2006 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
* Alsa modularization by Daniel Petrini (d.pensator@gmail.com)
*
* Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*/
#ifndef OMAP_ALSA_TSC2101_H_
#define OMAP_ALSA_TSC2101_H_
#include <linux/types.h>
/* Define to set the tsc as the master w.r.t McBSP */
#define TSC_MASTER
#define NUMBER_SAMPLE_RATES_SUPPORTED 16
/*
* AUDIO related MACROS
*/
#ifndef DEFAULT_BITPERSAMPLE
#define DEFAULT_BITPERSAMPLE 16
#endif
#define DEFAULT_SAMPLE_RATE 44100
#define CODEC_CLOCK 12000000
#define AUDIO_MCBSP OMAP_MCBSP1
#define PAGE2_AUDIO_CODEC_REGISTERS (2)
struct
tsc2101_samplerate_reg_info
{
u16
sample_rate
;
u8
divisor
;
u8
fs_44kHz
;
/* if 0 48 khz, if 1 44.1 khz fsref */
};
/*
* Defines codec specific functions pointers that can be used from the
* common omap-alse base driver for all omap codecs. (tsc2101 and aic23)
*/
inline
void
tsc2101_configure
(
void
);
void
tsc2101_set_samplerate
(
long
rate
);
void
tsc2101_clock_setup
(
void
);
int
tsc2101_clock_on
(
void
);
int
tsc2101_clock_off
(
void
);
int
tsc2101_get_default_samplerate
(
void
);
#endif
/*OMAP_ALSA_TSC2101_H_*/
sound/arm/omap
-aic23
.c
→
sound/arm/omap
/omap-alsa
.c
View file @
6bc09656
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment