1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007 by Christian Gmeiner
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
26 /* define some audiohw caps */
27 #define TREBLE_CAP (1 << 0)
28 #define BASS_CAP (1 << 1)
29 #define BALANCE_CAP (1 << 2)
30 #define CLIPPING_CAP (1 << 3)
31 #define PRESCALER_CAP (1 << 4)
32 #define BASS_CUTOFF_CAP (1 << 5)
33 #define TREBLE_CUTOFF_CAP (1 << 6)
37 #elif defined(HAVE_WM8751)
39 #elif defined(HAVE_WM8978)
41 #elif defined(HAVE_WM8975)
43 #elif defined(HAVE_WM8985)
45 #elif defined(HAVE_WM8758)
47 #elif defined(HAVE_WM8721)
49 #elif defined(HAVE_WM8731)
51 #elif defined(HAVE_TLV320)
53 #elif defined(HAVE_AS3514)
55 #elif defined(HAVE_MAS35XX)
57 #elif defined(HAVE_TSC2100)
61 /* convert caps into defines */
63 #if (AUDIOHW_CAPS & TREBLE_CAP)
64 #define AUDIOHW_HAVE_TREBLE
67 #if (AUDIOHW_CAPS & BASS_CAP)
68 #define AUDIOHW_HAVE_BASS
71 #if (AUDIOHW_CAPS & BALANCE_CAP)
72 #define AUDIOHW_HAVE_BALANCE
75 #if (AUDIOHW_CAPS & CLIPPING_CAP)
76 #define AUDIOHW_HAVE_CLIPPING
79 #if (AUDIOHW_CAPS & PRESCALER_CAP)
80 #define AUDIOHW_HAVE_PRESCALER
83 #if (AUDIOHW_CAPS & BASS_CUTOFF_CAP)
84 #define AUDIOHW_HAVE_BASS_CUTOFF
87 #if (AUDIOHW_CAPS & TREBLE_CUTOFF_CAP)
88 #define AUDIOHW_HAVE_TREBLE_CUTOFF
90 #endif /* AUDIOHW_CAPS */
99 #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
109 #if defined(HAVE_RECORDING)
114 #if defined(AUDIOHW_HAVE_BASS_CUTOFF)
117 #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF)
126 SOUND_CHAN_MONO_LEFT
,
127 SOUND_CHAN_MONO_RIGHT
,
129 SOUND_CHAN_NUM_MODES
,
132 struct sound_settings_info
{
141 /* This struct is used by every driver to export its min/max/default values for
142 * its audio settings. Keep in mind that the order must be correct! */
143 extern const struct sound_settings_info audiohw_settings
[];
145 /* All usable functions implemented by a audio codec drivers. Most of
146 * the function in sound settings are only called, when in audio codecs
147 * .h file suitable defines are added.
151 * Initialize audio codec to a well defined state.
153 void audiohw_init(void);
156 * Do initial audio codec setup.
158 void audiohw_preinit(void);
161 * Do some stuff (codec related) after audiohw_init that needs to be
162 * delayed such as enabling outputs to prevent popping. This lets
163 * other inits in the system complete in the meantime.
165 void audiohw_postinit(void);
170 void audiohw_close(void);
172 #ifdef AUDIOHW_HAVE_CLIPPING
174 * Set new volume value
176 * NOTE: AUDIOHW_CAPS need to contain
179 void audiohw_set_volume(int val
);
182 #ifdef AUDIOHW_HAVE_PRESCALER
184 * Set new prescaler value.
186 * NOTE: AUDIOHW_CAPS need to contain
189 void audiohw_set_prescaler(int val
);
192 #ifdef AUDIOHW_HAVE_BALANCE
194 * Set new balance value
196 * NOTE: AUDIOHW_CAPS need to contain
199 void audiohw_set_balance(int val
);
203 * Mute or enable sound.
204 * @param mute true or false.
206 void audiohw_mute(bool mute
);
209 * Silently en/disable audio output.
210 * @param enable true or false.
212 void audiohw_enable_output(bool enable
);
214 #ifdef AUDIOHW_HAVE_TREBLE
216 * Set new treble value.
218 * NOTE: AUDIOHW_CAPS need to contain
221 void audiohw_set_treble(int val
);
224 #ifdef AUDIOHW_HAVE_BASS
226 * Set new bass value.
228 * NOTE: AUDIOHW_CAPS need to contain
231 void audiohw_set_bass(int val
);
234 #ifdef AUDIOHW_HAVE_BASS_CUTOFF
236 * Set new bass cut off value.
238 * NOTE: AUDIOHW_CAPS need to contain
241 void audiohw_set_bass_cutoff(int val
);
244 #ifdef AUDIOHW_HAVE_TREBLE_CUTOFF
246 * Set new treble cut off value.
248 * NOTE: AUDIOHW_CAPS need to contain
251 void audiohw_set_treble_cutoff(int val
);
254 #ifdef HAVE_RECORDING
258 * @param source_mic if this is true, we want to record from microphone,
259 * else we want to record FM/LineIn.
261 void audiohw_enable_recording(bool source_mic
);
266 void audiohw_disable_recording(void);
269 * Set gain of recording source.
270 * @param left gain value.
271 * @param right will not be used if recording from micophone (mono).
272 * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN.
274 void audiohw_set_recvol(int left
, int right
, int type
);
277 * Enable or disable recording monitor.
278 * @param enable ture or false.
280 void audiohw_set_monitor(bool enable
);
282 #endif /*HAVE_RECORDING*/
285 #if CONFIG_CODEC != SWCODEC
287 /* functions which are only used by mas35xx codecs, but are also
288 aviable on SWCODECS through dsp */
291 * Set channel configuration.
292 * @param val new channel value (see enum Channel).
294 void audiohw_set_channel(int val
);
298 * @param val new stereo width value.
300 void audiohw_set_stereo_width(int val
);
302 #endif /* CONFIG_CODEC != SWCODEC */
304 #endif /* _AUDIOHW_H_ */