Add placeholder for the remote hotkey (aka repair WPS keymap table)
[kugel-rb.git] / firmware / export / audiohw.h
blob91df2dd8b9df1912718995ae32206448c8549444
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_UDA1341)
40 #include "uda1341.h"
41 #elif defined(HAVE_WM8751)
42 #include "wm8751.h"
43 #elif defined(HAVE_WM8978)
44 #include "wm8978.h"
45 #elif defined(HAVE_WM8975)
46 #include "wm8975.h"
47 #elif defined(HAVE_WM8985)
48 #include "wm8985.h"
49 #elif defined(HAVE_WM8758)
50 #include "wm8758.h"
51 #elif defined(HAVE_WM8711) || defined(HAVE_WM8721) || \
52 defined(HAVE_WM8731)
53 #include "wm8731.h"
54 #elif defined(HAVE_TLV320)
55 #include "tlv320.h"
56 #elif defined(HAVE_AS3514)
57 #include "as3514.h"
58 #elif defined(HAVE_MAS35XX)
59 #include "mas35xx.h"
60 #elif defined(HAVE_TSC2100)
61 #include "tsc2100.h"
62 #elif defined(HAVE_JZ4740_CODEC)
63 #include "jz4740-codec.h"
64 #elif defined(HAVE_AK4537)
65 #include "ak4537.h"
66 #endif
68 /* convert caps into defines */
69 #ifdef AUDIOHW_CAPS
70 #if (AUDIOHW_CAPS & TREBLE_CAP)
71 #define AUDIOHW_HAVE_TREBLE
72 #endif
74 #if (AUDIOHW_CAPS & BASS_CAP)
75 #define AUDIOHW_HAVE_BASS
76 #endif
78 #if (AUDIOHW_CAPS & BALANCE_CAP)
79 #define AUDIOHW_HAVE_BALANCE
80 #endif
82 #if (AUDIOHW_CAPS & CLIPPING_CAP)
83 #define AUDIOHW_HAVE_CLIPPING
84 #endif
86 #if (AUDIOHW_CAPS & PRESCALER_CAP)
87 #define AUDIOHW_HAVE_PRESCALER
88 #endif
90 #if (AUDIOHW_CAPS & BASS_CUTOFF_CAP)
91 #define AUDIOHW_HAVE_BASS_CUTOFF
92 #endif
94 #if (AUDIOHW_CAPS & TREBLE_CUTOFF_CAP)
95 #define AUDIOHW_HAVE_TREBLE_CUTOFF
96 #endif
97 #endif /* AUDIOHW_CAPS */
99 enum {
100 SOUND_VOLUME = 0,
101 SOUND_BASS,
102 SOUND_TREBLE,
103 SOUND_BALANCE,
104 SOUND_CHANNELS,
105 SOUND_STEREO_WIDTH,
106 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
107 SOUND_LOUDNESS,
108 SOUND_AVC,
109 SOUND_MDB_STRENGTH,
110 SOUND_MDB_HARMONICS,
111 SOUND_MDB_CENTER,
112 SOUND_MDB_SHAPE,
113 SOUND_MDB_ENABLE,
114 SOUND_SUPERBASS,
115 #endif
116 #if defined(HAVE_RECORDING)
117 SOUND_LEFT_GAIN,
118 SOUND_RIGHT_GAIN,
119 SOUND_MIC_GAIN,
120 #endif
121 #if defined(AUDIOHW_HAVE_BASS_CUTOFF)
122 SOUND_BASS_CUTOFF,
123 #endif
124 #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
125 SOUND_TREBLE_CUTOFF,
126 #endif
127 SOUND_LAST_SETTING, /* Keep this last */
130 enum Channel {
131 SOUND_CHAN_STEREO,
132 SOUND_CHAN_MONO,
133 SOUND_CHAN_CUSTOM,
134 SOUND_CHAN_MONO_LEFT,
135 SOUND_CHAN_MONO_RIGHT,
136 SOUND_CHAN_KARAOKE,
137 SOUND_CHAN_NUM_MODES,
140 struct sound_settings_info {
141 const char *unit;
142 char numdecimals;
143 char steps;
144 short minval;
145 short maxval;
146 short defaultval;
149 /* This struct is used by every driver to export its min/max/default values for
150 * its audio settings. Keep in mind that the order must be correct! */
151 extern const struct sound_settings_info audiohw_settings[];
153 /* All usable functions implemented by a audio codec drivers. Most of
154 * the function in sound settings are only called, when in audio codecs
155 * .h file suitable defines are added.
159 * Initialize audio codec to a well defined state. Includes SoC-specific
160 * setup.
162 void audiohw_init(void);
165 * Do initial audio codec setup. Usually called from audiohw_init.
167 void audiohw_preinit(void);
170 * Do some stuff (codec related) after audiohw_init that needs to be
171 * delayed such as enabling outputs to prevent popping. This lets
172 * other inits in the system complete in the meantime.
174 void audiohw_postinit(void);
177 * Close audio codec.
179 void audiohw_close(void);
181 #ifdef AUDIOHW_HAVE_CLIPPING
183 * Set new volume value
184 * @param val to set.
185 * NOTE: AUDIOHW_CAPS need to contain
186 * CLIPPING_CAP
188 void audiohw_set_volume(int val);
189 #endif
191 #ifdef AUDIOHW_HAVE_PRESCALER
193 * Set new prescaler value.
194 * @param val to set.
195 * NOTE: AUDIOHW_CAPS need to contain
196 * PRESCALER_CAP
198 void audiohw_set_prescaler(int val);
199 #endif
201 #ifdef AUDIOHW_HAVE_BALANCE
203 * Set new balance value
204 * @param val to set.
205 * NOTE: AUDIOHW_CAPS need to contain
206 * BALANCE_CAP
208 void audiohw_set_balance(int val);
209 #endif
212 * Mute or enable sound.
213 * @param mute true or false.
215 void audiohw_mute(bool mute);
217 #ifdef AUDIOHW_HAVE_TREBLE
219 * Set new treble value.
220 * @param val to set.
221 * NOTE: AUDIOHW_CAPS need to contain
222 * TREBLE_CAP
224 void audiohw_set_treble(int val);
225 #endif
227 #ifdef AUDIOHW_HAVE_BASS
229 * Set new bass value.
230 * @param val to set.
231 * NOTE: AUDIOHW_CAPS need to contain
232 * BASS_CAP
234 void audiohw_set_bass(int val);
235 #endif
237 #ifdef AUDIOHW_HAVE_BASS_CUTOFF
239 * Set new bass cut off value.
240 * @param val to set.
241 * NOTE: AUDIOHW_CAPS need to contain
242 * BASS_CUTOFF_CAP
244 void audiohw_set_bass_cutoff(int val);
245 #endif
247 #ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
249 * Set new treble cut off value.
250 * @param val to set.
251 * NOTE: AUDIOHW_CAPS need to contain
252 * TREBLE_CUTOFF_CAP
254 void audiohw_set_treble_cutoff(int val);
255 #endif
257 void audiohw_set_frequency(int fsel);
259 #ifdef HAVE_RECORDING
262 * Enable recording.
263 * @param source_mic if this is true, we want to record from microphone,
264 * else we want to record FM/LineIn.
266 void audiohw_enable_recording(bool source_mic);
269 * Disable recording.
271 void audiohw_disable_recording(void);
274 * Set gain of recording source.
275 * @param left gain value.
276 * @param right will not be used if recording from micophone (mono).
277 * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN.
279 void audiohw_set_recvol(int left, int right, int type);
281 #endif /*HAVE_RECORDING*/
283 #if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN)
286 * Enable or disable recording monitor.
287 * @param enable ture or false.
289 void audiohw_set_monitor(bool enable);
291 #endif /* HAVE_RECORDING || HAVE_FMRADIO_IN */
293 #if CONFIG_CODEC != SWCODEC
295 /* functions which are only used by mas35xx codecs, but are also
296 aviable on SWCODECS through dsp */
299 * Set channel configuration.
300 * @param val new channel value (see enum Channel).
302 void audiohw_set_channel(int val);
305 * Set stereo width.
306 * @param val new stereo width value.
308 void audiohw_set_stereo_width(int val);
310 #endif /* CONFIG_CODEC != SWCODEC */
312 #ifdef HAVE_SPEAKER
314 void audiohw_enable_speaker(bool on);
316 #endif /* HAVE_SPEAKER */
318 #endif /* _AUDIOHW_H_ */