2 * sound/arm/omap-alsa-aic23.h
4 * Alsa Driver for AIC23 codec on OSK5912 platform board
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
10 * Copyright (C) 2006 Mika Laitio <lamikr@cc.jyu.fi>
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.
18 #ifndef __OMAP_ALSA_AIC23_H
19 #define __OMAP_ALSA_AIC23_H
21 #include <asm/arch/dma.h>
22 #include <sound/core.h>
23 #include <sound/pcm.h>
24 #include <asm/arch/mcbsp.h>
26 /* Define to set the AIC23 as the master w.r.t McBSP */
29 #define NUMBER_SAMPLE_RATES_SUPPORTED 10
32 * AUDIO related MACROS
34 #ifndef DEFAULT_BITPERSAMPLE
35 #define DEFAULT_BITPERSAMPLE 16
38 #define DEFAULT_SAMPLE_RATE 44100
39 #define CODEC_CLOCK 12000000
40 #define AUDIO_MCBSP OMAP_MCBSP1
42 #define DEFAULT_OUTPUT_VOLUME 0x60
43 #define DEFAULT_INPUT_VOLUME 0x00 /* 0 ==> mute line in */
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
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
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
62 #define DEFAULT_ANALOG_AUDIO_CONTROL (DAC_SELECTED | STE_ENABLED | \
63 BYPASS_ON | INSEL_MIC | MICB_20DB)
65 struct aic23_samplerate_reg_info {
67 u8 control; /* SR3, SR2, SR1, SR0 and BOSR */
68 u8 divider; /* if 0 CLKIN = MCLK, if 1 CLKIN = MCLK/2 */
71 extern int aic23_write_value(u8 reg, u16 value);
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)
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);