]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - sound/arm/omap/omap-alsa-aic23.h
[PATCH] ARM: OMAP: Alsa modularisations and support for tsc2101 2/3 (round 2)
[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 <sound/driver.h>
22 #include <asm/arch/dma.h>
23 #include <sound/core.h>
24 #include <sound/pcm.h>
25 #include <asm/arch/mcbsp.h>
26
27 /* Define to set the AIC23 as the master w.r.t McBSP */
28 #define AIC23_MASTER
29
30 #define NUMBER_SAMPLE_RATES_SUPPORTED   10
31
32 /*
33  * AUDIO related MACROS
34  */
35 #ifndef DEFAULT_BITPERSAMPLE
36 #define DEFAULT_BITPERSAMPLE            16
37 #endif
38
39 #define DEFAULT_SAMPLE_RATE             44100
40 #define CODEC_CLOCK                     12000000
41 #define AUDIO_MCBSP                     OMAP_MCBSP1
42
43 #define DEFAULT_OUTPUT_VOLUME           0x60
44 #define DEFAULT_INPUT_VOLUME            0x00    /* 0 ==> mute line in */
45
46 #define OUTPUT_VOLUME_MIN               LHV_MIN
47 #define OUTPUT_VOLUME_MAX               LHV_MAX
48 #define OUTPUT_VOLUME_RANGE             (OUTPUT_VOLUME_MAX - OUTPUT_VOLUME_MIN)
49 #define OUTPUT_VOLUME_MASK              OUTPUT_VOLUME_MAX
50
51 #define INPUT_VOLUME_MIN                LIV_MIN
52 #define INPUT_VOLUME_MAX                LIV_MAX
53 #define INPUT_VOLUME_RANGE              (INPUT_VOLUME_MAX - INPUT_VOLUME_MIN)
54 #define INPUT_VOLUME_MASK               INPUT_VOLUME_MAX
55
56 #define SIDETONE_MASK                   0x1c0
57 #define SIDETONE_0                      0x100
58 #define SIDETONE_6                      0x000
59 #define SIDETONE_9                      0x040
60 #define SIDETONE_12                     0x080
61 #define SIDETONE_18                     0x0c0
62
63 #define DEFAULT_ANALOG_AUDIO_CONTROL  DAC_SELECTED | STE_ENABLED | 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 /*
72  * Defines codec specific functions pointers that can be used from the 
73  * common omap-alse base driver for all omap codecs. (tsc2101 and aic23)
74  */
75 void define_codec_functions(struct omap_alsa_codec_config *codec_config);
76 inline void aic23_configure(void);
77 void aic23_set_samplerate(long rate);
78 void aic23_clock_setup(void);
79 int aic23_clock_on(void);
80 int aic23_clock_off(void);
81 int aic23_get_default_samplerate(void);
82
83 #endif