Simulate lcd_enable and lcd_sleep in the simulator. Therefore, turn backlight-sim...
[kugel-rb.git] / firmware / export / audiohw.h
blobe53db7e7b9eaa8b8ed8eb681274458c2d019ca4f
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2007 by Christian Gmeiner
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef _AUDIOHW_H_
23 #define _AUDIOHW_H_
25 #include "config.h"
26 #include <stdbool.h>
28 /* define some audiohw caps */
29 #define TREBLE_CAP (1 << 0)
30 #define BASS_CAP (1 << 1)
31 #define BALANCE_CAP (1 << 2)
32 #define CLIPPING_CAP (1 << 3)
33 #define PRESCALER_CAP (1 << 4)
34 #define BASS_CUTOFF_CAP (1 << 5)
35 #define TREBLE_CUTOFF_CAP (1 << 6)
37 #ifdef HAVE_UDA1380
38 #include "uda1380.h"
39 #elif defined(HAVE_WM8751)
40 #include "wm8751.h"
41 #elif defined(HAVE_WM8978)
42 #include "wm8978.h"
43 #elif defined(HAVE_WM8975)
44 #include "wm8975.h"
45 #elif defined(HAVE_WM8985)
46 #include "wm8985.h"
47 #elif defined(HAVE_WM8758)
48 #include "wm8758.h"
49 #elif defined(HAVE_WM8711) || defined(HAVE_WM8721) || \
50 defined(HAVE_WM8731)
51 #include "wm8731.h"
52 #elif defined(HAVE_TLV320)
53 #include "tlv320.h"
54 #elif defined(HAVE_AS3514)
55 #include "as3514.h"
56 #elif defined(HAVE_MAS35XX)
57 #include "mas35xx.h"
58 #elif defined(HAVE_TSC2100)
59 #include "tsc2100.h"
60 #elif defined(HAVE_JZ4740_CODEC)
61 #include "jz4740-codec.h"
62 #endif
64 /* convert caps into defines */
65 #ifdef AUDIOHW_CAPS
66 #if (AUDIOHW_CAPS & TREBLE_CAP)
67 #define AUDIOHW_HAVE_TREBLE
68 #endif
70 #if (AUDIOHW_CAPS & BASS_CAP)
71 #define AUDIOHW_HAVE_BASS
72 #endif
74 #if (AUDIOHW_CAPS & BALANCE_CAP)
75 #define AUDIOHW_HAVE_BALANCE
76 #endif
78 #if (AUDIOHW_CAPS & CLIPPING_CAP)
79 #define AUDIOHW_HAVE_CLIPPING
80 #endif
82 #if (AUDIOHW_CAPS & PRESCALER_CAP)
83 #define AUDIOHW_HAVE_PRESCALER
84 #endif
86 #if (AUDIOHW_CAPS & BASS_CUTOFF_CAP)
87 #define AUDIOHW_HAVE_BASS_CUTOFF
88 #endif
90 #if (AUDIOHW_CAPS & TREBLE_CUTOFF_CAP)
91 #define AUDIOHW_HAVE_TREBLE_CUTOFF
92 #endif
93 #endif /* AUDIOHW_CAPS */
95 enum {
96 SOUND_VOLUME = 0,
97 SOUND_BASS,
98 SOUND_TREBLE,
99 SOUND_BALANCE,
100 SOUND_CHANNELS,
101 SOUND_STEREO_WIDTH,
102 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
103 SOUND_LOUDNESS,
104 SOUND_AVC,
105 SOUND_MDB_STRENGTH,
106 SOUND_MDB_HARMONICS,
107 SOUND_MDB_CENTER,
108 SOUND_MDB_SHAPE,
109 SOUND_MDB_ENABLE,
110 SOUND_SUPERBASS,
111 #endif
112 #if defined(HAVE_RECORDING)
113 SOUND_LEFT_GAIN,
114 SOUND_RIGHT_GAIN,
115 SOUND_MIC_GAIN,
116 #endif
117 #if defined(AUDIOHW_HAVE_BASS_CUTOFF)
118 SOUND_BASS_CUTOFF,
119 #endif
120 #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
121 SOUND_TREBLE_CUTOFF,
122 #endif
123 SOUND_LAST_SETTING, /* Keep this last */
126 enum Channel {
127 SOUND_CHAN_STEREO,
128 SOUND_CHAN_MONO,
129 SOUND_CHAN_CUSTOM,
130 SOUND_CHAN_MONO_LEFT,
131 SOUND_CHAN_MONO_RIGHT,
132 SOUND_CHAN_KARAOKE,
133 SOUND_CHAN_NUM_MODES,
136 struct sound_settings_info {
137 const char *unit;
138 char numdecimals;
139 char steps;
140 short minval;
141 short maxval;
142 short defaultval;
145 /* This struct is used by every driver to export its min/max/default values for
146 * its audio settings. Keep in mind that the order must be correct! */
147 extern const struct sound_settings_info audiohw_settings[];
149 /* All usable functions implemented by a audio codec drivers. Most of
150 * the function in sound settings are only called, when in audio codecs
151 * .h file suitable defines are added.
155 * Initialize audio codec to a well defined state. Includes SoC-specific
156 * setup.
158 void audiohw_init(void);
161 * Do initial audio codec setup. Usually called from audiohw_init.
163 void audiohw_preinit(void);
166 * Do some stuff (codec related) after audiohw_init that needs to be
167 * delayed such as enabling outputs to prevent popping. This lets
168 * other inits in the system complete in the meantime.
170 void audiohw_postinit(void);
173 * Close audio codec.
175 void audiohw_close(void);
177 #ifdef AUDIOHW_HAVE_CLIPPING
179 * Set new volume value
180 * @param val to set.
181 * NOTE: AUDIOHW_CAPS need to contain
182 * CLIPPING_CAP
184 void audiohw_set_volume(int val);
185 #endif
187 #ifdef AUDIOHW_HAVE_PRESCALER
189 * Set new prescaler value.
190 * @param val to set.
191 * NOTE: AUDIOHW_CAPS need to contain
192 * PRESCALER_CAP
194 void audiohw_set_prescaler(int val);
195 #endif
197 #ifdef AUDIOHW_HAVE_BALANCE
199 * Set new balance value
200 * @param val to set.
201 * NOTE: AUDIOHW_CAPS need to contain
202 * BALANCE_CAP
204 void audiohw_set_balance(int val);
205 #endif
208 * Mute or enable sound.
209 * @param mute true or false.
211 void audiohw_mute(bool mute);
213 #ifdef AUDIOHW_HAVE_TREBLE
215 * Set new treble value.
216 * @param val to set.
217 * NOTE: AUDIOHW_CAPS need to contain
218 * TREBLE_CAP
220 void audiohw_set_treble(int val);
221 #endif
223 #ifdef AUDIOHW_HAVE_BASS
225 * Set new bass value.
226 * @param val to set.
227 * NOTE: AUDIOHW_CAPS need to contain
228 * BASS_CAP
230 void audiohw_set_bass(int val);
231 #endif
233 #ifdef AUDIOHW_HAVE_BASS_CUTOFF
235 * Set new bass cut off value.
236 * @param val to set.
237 * NOTE: AUDIOHW_CAPS need to contain
238 * BASS_CUTOFF_CAP
240 void audiohw_set_bass_cutoff(int val);
241 #endif
243 #ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
245 * Set new treble cut off value.
246 * @param val to set.
247 * NOTE: AUDIOHW_CAPS need to contain
248 * TREBLE_CUTOFF_CAP
250 void audiohw_set_treble_cutoff(int val);
251 #endif
253 void audiohw_set_frequency(int fsel);
255 #ifdef HAVE_RECORDING
258 * Enable recording.
259 * @param source_mic if this is true, we want to record from microphone,
260 * else we want to record FM/LineIn.
262 void audiohw_enable_recording(bool source_mic);
265 * Disable recording.
267 void audiohw_disable_recording(void);
270 * Set gain of recording source.
271 * @param left gain value.
272 * @param right will not be used if recording from micophone (mono).
273 * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN.
275 void audiohw_set_recvol(int left, int right, int type);
277 #endif /*HAVE_RECORDING*/
279 #if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN)
282 * Enable or disable recording monitor.
283 * @param enable ture or false.
285 void audiohw_set_monitor(bool enable);
287 #endif /* HAVE_RECORDING || HAVE_FMRADIO_IN */
289 #if CONFIG_CODEC != SWCODEC
291 /* functions which are only used by mas35xx codecs, but are also
292 aviable on SWCODECS through dsp */
295 * Set channel configuration.
296 * @param val new channel value (see enum Channel).
298 void audiohw_set_channel(int val);
301 * Set stereo width.
302 * @param val new stereo width value.
304 void audiohw_set_stereo_width(int val);
306 #endif /* CONFIG_CODEC != SWCODEC */
308 #ifdef HAVE_SPEAKER
310 void audiohw_enable_speaker(bool on);
312 #endif /* HAVE_SPEAKER */
314 #endif /* _AUDIOHW_H_ */