]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - sound/arm/omap/omap-alsa-aic23.h
Merge current mainline tree into linux-omap tree
[linux-2.6-omap-h63xx.git] / sound / arm / omap / omap-alsa-aic23.h
1 /*
2  * sound/arm/omap-alsa-aic23.h
3  *
4  * Alsa Driver for AIC23 codec on OSK5912 platform board
5  *
6  * Copyright (C) 2005 Instituto Nokia de Tecnologia - INdT - Manaus Brazil
7  * Written by Daniel Petrini, David Cohen, Anderson Briglia
8  *            {daniel.petrini, david.cohen, anderson.briglia}@indt.org.br
9  *
10  * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
11  *
12  * This program is free software; you can redistribute it and/or modify it
13  * under the terms of the GNU General Public License as published by the
14  * Free Software Foundation; either version 2 of the License, or (at your
15  * option) any later version.
16  */
17
18 #ifndef __OMAP_ALSA_AIC23_H
19 #define __OMAP_ALSA_AIC23_H
20
21 #include <mach/dma.h>
22 #include <sound/core.h>
23 #include <sound/pcm.h>
24 #include <mach/mcbsp.h>
25
26 /* Define to set the AIC23 as the master w.r.t McBSP */
27 #define AIC23_MASTER
28
29 #define NUMBER_SAMPLE_RATES_SUPPORTED   10
30
31 /*
32  * AUDIO related MACROS
33  */
34 #ifndef DEFAULT_BITPERSAMPLE
35 #define DEFAULT_BITPERSAMPLE            16
36 #endif
37
38 #define DEFAULT_SAMPLE_RATE             44100
39 #define CODEC_CLOCK                     12000000
40 #define AUDIO_MCBSP                     OMAP_MCBSP1
41
42 #define DEFAULT_OUTPUT_VOLUME           0x60
43 #define DEFAULT_INPUT_VOLUME            0x00    /* 0 ==> mute line in */
44
45 #define OUTPUT_VOLUME_MIN               LHV_MIN
46 #define OUTPUT_VOLUME_MAX               LHV_MAX
47 #define OUTPUT_VOLUME_RANGE             (OUTPUT_VOLUME_MAX - OUTPUT_VOLUME_MIN)
48 #define OUTPUT_VOLUME_MASK              OUTPUT_VOLUME_MAX
49
50 #define INPUT_VOLUME_MIN                LIV_MIN
51 #define INPUT_VOLUME_MAX                LIV_MAX
52 #define INPUT_VOLUME_RANGE              (INPUT_VOLUME_MAX - INPUT_VOLUME_MIN)
53 #define INPUT_VOLUME_MASK               INPUT_VOLUME_MAX
54
55 #define SIDETONE_MASK                   0x1c0
56 #define SIDETONE_0                      0x100
57 #define SIDETONE_6                      0x000
58 #define SIDETONE_9                      0x040
59 #define SIDETONE_12                     0x080
60 #define SIDETONE_18                     0x0c0
61
62 #define DEFAULT_ANALOG_AUDIO_CONTROL  (DAC_SELECTED | STE_ENABLED | \
63                                         BYPASS_ON | INSEL_MIC | MICB_20DB)
64
65 struct aic23_samplerate_reg_info {
66         u32 sample_rate;
67         u8 control;             /* SR3, SR2, SR1, SR0 and BOSR */
68         u8 divider;             /* if 0 CLKIN = MCLK, if 1 CLKIN = MCLK/2 */
69 };
70
71 extern int aic23_write_value(u8 reg, u16 value);
72
73 /*
74  * Defines codec specific function pointers that can be used from the
75  * common omap-alsa base driver for all omap codecs. (tsc2101 and aic23)
76  */
77 void audio_aic23_write(u8 address, u16 data);
78 void define_codec_functions(struct omap_alsa_codec_config *codec_config);
79 inline void aic23_configure(void);
80 void aic23_set_samplerate(long rate);
81 void aic23_clock_setup(void);
82 int aic23_clock_on(void);
83 int aic23_clock_off(void);
84 int aic23_get_default_samplerate(void);
85
86 #endif