diff options
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/aic3x.h | 6 | ||||
-rw-r--r-- | firmware/export/ak4537.h | 4 | ||||
-rw-r--r-- | firmware/export/as3514.h | 39 | ||||
-rw-r--r-- | firmware/export/audiohw.h | 149 | ||||
-rw-r--r-- | firmware/export/audiohw_settings.h | 143 | ||||
-rw-r--r-- | firmware/export/cs42l55.h | 15 | ||||
-rw-r--r-- | firmware/export/dac3550a.h | 1 | ||||
-rw-r--r-- | firmware/export/dummy_codec.h | 2 | ||||
-rw-r--r-- | firmware/export/hosted_codec.h | 30 | ||||
-rw-r--r-- | firmware/export/imx233-codec.h | 15 | ||||
-rw-r--r-- | firmware/export/jz4740-codec.h | 13 | ||||
-rw-r--r-- | firmware/export/mas35xx.h | 59 | ||||
-rw-r--r-- | firmware/export/rk27xx_codec.h | 12 | ||||
-rw-r--r-- | firmware/export/sound.h | 14 | ||||
-rw-r--r-- | firmware/export/tlv320.h | 28 | ||||
-rw-r--r-- | firmware/export/tsc2100.h | 9 | ||||
-rw-r--r-- | firmware/export/uda1341.h | 17 | ||||
-rw-r--r-- | firmware/export/uda1380.h | 19 | ||||
-rw-r--r-- | firmware/export/wm8731.h | 13 | ||||
-rw-r--r-- | firmware/export/wm8751.h | 38 | ||||
-rw-r--r-- | firmware/export/wm8758.h | 25 | ||||
-rw-r--r-- | firmware/export/wm8975.h | 20 | ||||
-rw-r--r-- | firmware/export/wm8978.h | 40 | ||||
-rw-r--r-- | firmware/export/wm8985.h | 22 |
24 files changed, 563 insertions, 170 deletions
diff --git a/firmware/export/aic3x.h b/firmware/export/aic3x.h index 4cfa0a5535..65e1ebd62c 100644 --- a/firmware/export/aic3x.h +++ b/firmware/export/aic3x.h | |||
@@ -25,12 +25,10 @@ | |||
25 | #define VOLUME_MIN -630 | 25 | #define VOLUME_MIN -630 |
26 | #define VOLUME_MAX 0 | 26 | #define VOLUME_MAX 0 |
27 | 27 | ||
28 | extern int tenthdb2master(int db); | 28 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -64, 0, -25) |
29 | 29 | ||
30 | /*** definitions ***/ | 30 | /*** definitions ***/ |
31 | extern void audiohw_set_headphone_vol(int vol_l, int vol_r); | 31 | void aic3x_switch_output(bool stereo); |
32 | |||
33 | extern void aic3x_switch_output(bool stereo); | ||
34 | 32 | ||
35 | /* Page 0 registers */ | 33 | /* Page 0 registers */ |
36 | #define AIC3X_PAGE_SELECT 0 | 34 | #define AIC3X_PAGE_SELECT 0 |
diff --git a/firmware/export/ak4537.h b/firmware/export/ak4537.h index 1f272d41fc..abf2a378ae 100644 --- a/firmware/export/ak4537.h +++ b/firmware/export/ak4537.h | |||
@@ -26,9 +26,7 @@ | |||
26 | #define VOLUME_MIN -1270 | 26 | #define VOLUME_MIN -1270 |
27 | #define VOLUME_MAX 0 | 27 | #define VOLUME_MAX 0 |
28 | 28 | ||
29 | extern int tenthdb2master(int db); | 29 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -128, 0, -25) |
30 | |||
31 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | ||
32 | 30 | ||
33 | #define AKC_NUM_REGS 0x11 | 31 | #define AKC_NUM_REGS 0x11 |
34 | 32 | ||
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h index 85da14493f..e9e48fab63 100644 --- a/firmware/export/as3514.h +++ b/firmware/export/as3514.h | |||
@@ -24,11 +24,32 @@ | |||
24 | 24 | ||
25 | #include "config.h" | 25 | #include "config.h" |
26 | 26 | ||
27 | extern int tenthdb2master(int db); | 27 | #if 0 |
28 | #define AUDIOHW_CAPS (LINEOUT_CAP | LIN_GAIN_CAP | MIC_GAIN_CAP) | ||
29 | #endif | ||
30 | |||
31 | #define AUDIOHW_CAPS (LIN_GAIN_CAP | MIC_GAIN_CAP) | ||
32 | |||
33 | /*different volume ranges for different AMS chips*/ | ||
34 | #if CONFIG_CPU == AS3525v2 | ||
35 | /* Headphone volume goes from -81.0 ... +6dB */ | ||
36 | #define VOLUME_MIN -810 | ||
37 | #define VOLUME_MAX 60 | ||
38 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -82, 6, -25) | ||
39 | #else /* AS3525v1 */ | ||
40 | /* Headphone volume goes from -73.5 ... +6dB */ | ||
41 | #define VOLUME_MIN -735 | ||
42 | #define VOLUME_MAX 60 | ||
43 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -74, 6, -25) | ||
44 | #endif /* CONFIG_CPU == AS3525v2 */ | ||
28 | 45 | ||
29 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | 46 | #ifdef HAVE_RECORDING |
30 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | 47 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1, 0, 39, 23, (val - 23) * 15) |
31 | extern void audiohw_set_sampr_dividers(int fsel); | 48 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1, 0, 31, 23, (val - 23) * 15) |
49 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1, 0, 31, 23, (val - 23) * 15) | ||
50 | #endif /* HAVE_RECORDING */ | ||
51 | |||
52 | void audiohw_set_sampr_dividers(int fsel); | ||
32 | 53 | ||
33 | /* Register Descriptions */ | 54 | /* Register Descriptions */ |
34 | 55 | ||
@@ -126,16 +147,6 @@ extern void audiohw_set_sampr_dividers(int fsel); | |||
126 | #define AS3514_UID_LEN 16 | 147 | #define AS3514_UID_LEN 16 |
127 | #endif | 148 | #endif |
128 | 149 | ||
129 | /*different volume ranges for different AMS chips*/ | ||
130 | #if CONFIG_CPU == AS3525v2 | ||
131 | /* Headphone volume goes from -81.0 ... +6dB */ | ||
132 | #define VOLUME_MIN -810 | ||
133 | #else | ||
134 | /* Headphone volume goes from -73.5 ... +6dB */ | ||
135 | #define VOLUME_MIN -735 | ||
136 | #endif | ||
137 | #define VOLUME_MAX 60 | ||
138 | |||
139 | /*** Audio Registers ***/ | 150 | /*** Audio Registers ***/ |
140 | 151 | ||
141 | /* 00h (LINE_OUT_R) to 16h (AUDIOSET3) */ | 152 | /* 00h (LINE_OUT_R) to 16h (AUDIOSET3) */ |
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h index 304c5aa460..e18e996282 100644 --- a/firmware/export/audiohw.h +++ b/firmware/export/audiohw.h | |||
@@ -35,6 +35,35 @@ | |||
35 | #define TREBLE_CUTOFF_CAP (1 << 6) | 35 | #define TREBLE_CUTOFF_CAP (1 << 6) |
36 | #define EQ_CAP (1 << 7) | 36 | #define EQ_CAP (1 << 7) |
37 | #define DEPTH_3D_CAP (1 << 8) | 37 | #define DEPTH_3D_CAP (1 << 8) |
38 | #define LINEOUT_CAP (1 << 9) | ||
39 | #define MONO_VOL_CAP (1 << 10) | ||
40 | #define LIN_GAIN_CAP (1 << 11) | ||
41 | #define MIC_GAIN_CAP (1 << 12) | ||
42 | |||
43 | /* Used by every driver to export its min/max/default values for its audio | ||
44 | settings. */ | ||
45 | #ifdef AUDIOHW_IS_SOUND_C | ||
46 | /* This is the master file with the settings table... */ | ||
47 | struct sound_settings_info | ||
48 | { | ||
49 | const char *unit; | ||
50 | char numdecimals; | ||
51 | char steps; | ||
52 | short minval; | ||
53 | short maxval; | ||
54 | short defaultval; | ||
55 | }; | ||
56 | |||
57 | #define AUDIOHW_SETTING(name, us, nd, st, minv, maxv, defv, expr...) \ | ||
58 | static const struct sound_settings_info _audiohw_setting_##name = \ | ||
59 | { .unit = us, .numdecimals = nd, .steps = st, \ | ||
60 | .minval = minv, .maxval = maxv, .defaultval = defv }; \ | ||
61 | static inline int _sound_val2phys_##name(int val) \ | ||
62 | { return #expr[0] ? expr : val; } | ||
63 | #else | ||
64 | /* ...otherwise these produce nothing. */ | ||
65 | #define AUDIOHW_SETTING(name, us, nd, st, minv, maxv, defv, expr...) | ||
66 | #endif | ||
38 | 67 | ||
39 | #ifdef HAVE_UDA1380 | 68 | #ifdef HAVE_UDA1380 |
40 | #include "uda1380.h" | 69 | #include "uda1380.h" |
@@ -78,17 +107,25 @@ | |||
78 | #include "imx233-codec.h" | 107 | #include "imx233-codec.h" |
79 | #elif defined(HAVE_DUMMY_CODEC) | 108 | #elif defined(HAVE_DUMMY_CODEC) |
80 | #include "dummy_codec.h" | 109 | #include "dummy_codec.h" |
81 | #endif | 110 | #elif (CONFIG_PLATFORM & (PLATFORM_ANDROID | PLATFORM_MAEMO\ |
82 | #if (CONFIG_PLATFORM & (PLATFORM_ANDROID|PLATFORM_MAEMO|PLATFORM_PANDORA|PLATFORM_SDL)) | 111 | | PLATFORM_PANDORA | PLATFORM_SDL)) |
83 | /* #include <SDL_audio.h> gives errors in other code areas, | 112 | #include "hosted_codec.h" |
84 | * we don't really need it here, so don't. but it should maybe be fixed */ | ||
85 | #ifndef SIMULATOR /* simulator gets values from the target .h files */ | ||
86 | #define VOLUME_MIN -990 | ||
87 | #define VOLUME_MAX 0 | ||
88 | #endif | ||
89 | #endif | 113 | #endif |
90 | 114 | ||
115 | #if defined(SIMULATOR) && !defined(HAVE_SW_VOLUME_CONTROL) | ||
116 | /* For now, without software volume control, sim only supports mono control */ | ||
117 | #define AUDIOHW_HAVE_MONO_VOLUME | ||
118 | #endif | ||
91 | 119 | ||
120 | /* Some values are the same for every codec and can be defined here one | ||
121 | time. */ | ||
122 | #ifdef HAVE_SW_TONE_CONTROLS | ||
123 | AUDIOHW_SETTING(BASS, "dB", 0, 1, -24, 24, 0) | ||
124 | AUDIOHW_SETTING(TREBLE, "dB", 0, 1, -24, 24, 0) | ||
125 | #endif /* HAVE_SW_TONE_CONTROLS */ | ||
126 | AUDIOHW_SETTING(BALANCE, "%", 0, 1, -100, 100, 0) | ||
127 | AUDIOHW_SETTING(CHANNELS, "", 0, 1, 0, 5, 0) | ||
128 | AUDIOHW_SETTING(STEREO_WIDTH, "%", 0, 5, 0, 250, 100) | ||
92 | 129 | ||
93 | #define ONE_DB 10 | 130 | #define ONE_DB 10 |
94 | 131 | ||
@@ -246,7 +283,26 @@ enum AUDIOHW_EQ_SETTINGS | |||
246 | #if (AUDIOHW_CAPS & DEPTH_3D_CAP) | 283 | #if (AUDIOHW_CAPS & DEPTH_3D_CAP) |
247 | #define AUDIOHW_HAVE_DEPTH_3D | 284 | #define AUDIOHW_HAVE_DEPTH_3D |
248 | #endif | 285 | #endif |
249 | #else | 286 | |
287 | #if (AUDIOHW_CAPS & LINEOUT_CAP) | ||
288 | #define AUDIOHW_HAVE_LINEOUT | ||
289 | #endif | ||
290 | |||
291 | #if (AUDIOHW_CAPS & MONO_VOL_CAP) | ||
292 | #define AUDIOHW_HAVE_MONO_VOLUME | ||
293 | #endif | ||
294 | |||
295 | #ifdef HAVE_RECORDING | ||
296 | #if (AUDIOHW_CAPS & LIN_GAIN_CAP) | ||
297 | #define AUDIOHW_HAVE_LIN_GAIN | ||
298 | #endif | ||
299 | |||
300 | #if (AUDIOHW_CAPS & MIC_GAIN_CAP) | ||
301 | #define AUDIOHW_HAVE_MIC_GAIN | ||
302 | #endif | ||
303 | #endif /* HAVE_RECORDING */ | ||
304 | |||
305 | #else /* ndef AUDIOHW_CAPS */ | ||
250 | #if defined (HAVE_SW_TONE_CONTROLS) | 306 | #if defined (HAVE_SW_TONE_CONTROLS) |
251 | /* Needed for proper sound support */ | 307 | /* Needed for proper sound support */ |
252 | #define AUDIOHW_HAVE_BASS | 308 | #define AUDIOHW_HAVE_BASS |
@@ -255,6 +311,7 @@ enum AUDIOHW_EQ_SETTINGS | |||
255 | #endif /* AUDIOHW_CAPS */ | 311 | #endif /* AUDIOHW_CAPS */ |
256 | 312 | ||
257 | enum { | 313 | enum { |
314 | /* TODO: Volume shouldn't be needed if device doesn't have digital control */ | ||
258 | SOUND_VOLUME = 0, | 315 | SOUND_VOLUME = 0, |
259 | /* Tone control */ | 316 | /* Tone control */ |
260 | #if defined(AUDIOHW_HAVE_BASS) | 317 | #if defined(AUDIOHW_HAVE_BASS) |
@@ -276,9 +333,11 @@ enum { | |||
276 | SOUND_MDB_ENABLE, | 333 | SOUND_MDB_ENABLE, |
277 | SOUND_SUPERBASS, | 334 | SOUND_SUPERBASS, |
278 | #endif | 335 | #endif |
279 | #if defined(HAVE_RECORDING) | 336 | #if defined(AUDIOHW_HAVE_LIN_GAIN) |
280 | SOUND_LEFT_GAIN, | 337 | SOUND_LEFT_GAIN, |
281 | SOUND_RIGHT_GAIN, | 338 | SOUND_RIGHT_GAIN, |
339 | #endif | ||
340 | #if defined(AUDIOHW_HAVE_MIC_GAIN) | ||
282 | SOUND_MIC_GAIN, | 341 | SOUND_MIC_GAIN, |
283 | #endif | 342 | #endif |
284 | /* Bass and treble tone controls */ | 343 | /* Bass and treble tone controls */ |
@@ -339,7 +398,8 @@ enum { | |||
339 | SOUND_LAST_SETTING, /* Keep this last */ | 398 | SOUND_LAST_SETTING, /* Keep this last */ |
340 | }; | 399 | }; |
341 | 400 | ||
342 | enum Channel { | 401 | enum Channel |
402 | { | ||
343 | SOUND_CHAN_STEREO, | 403 | SOUND_CHAN_STEREO, |
344 | SOUND_CHAN_MONO, | 404 | SOUND_CHAN_MONO, |
345 | SOUND_CHAN_CUSTOM, | 405 | SOUND_CHAN_CUSTOM, |
@@ -349,19 +409,6 @@ enum Channel { | |||
349 | SOUND_CHAN_NUM_MODES, | 409 | SOUND_CHAN_NUM_MODES, |
350 | }; | 410 | }; |
351 | 411 | ||
352 | struct sound_settings_info { | ||
353 | const char *unit; | ||
354 | char numdecimals; | ||
355 | char steps; | ||
356 | short minval; | ||
357 | short maxval; | ||
358 | short defaultval; | ||
359 | }; | ||
360 | |||
361 | /* This struct is used by every driver to export its min/max/default values for | ||
362 | * its audio settings. Keep in mind that the order must be correct! */ | ||
363 | extern const struct sound_settings_info audiohw_settings[]; | ||
364 | |||
365 | /* All usable functions implemented by a audio codec drivers. Most of | 412 | /* All usable functions implemented by a audio codec drivers. Most of |
366 | * the function in sound settings are only called, when in audio codecs | 413 | * the function in sound settings are only called, when in audio codecs |
367 | * .h file suitable defines are added. | 414 | * .h file suitable defines are added. |
@@ -390,17 +437,35 @@ void audiohw_postinit(void); | |||
390 | */ | 437 | */ |
391 | void audiohw_close(void); | 438 | void audiohw_close(void); |
392 | 439 | ||
393 | #if defined(AUDIOHW_HAVE_CLIPPING) || defined(HAVE_SDL_AUDIO) || defined(ANDROID) | 440 | #ifdef AUDIOHW_HAVE_MONO_VOLUME |
394 | /** | 441 | /** |
395 | * Set new volume value | 442 | * Set new volume value |
396 | * @param val to set. | 443 | * @param val to set. |
397 | * NOTE: AUDIOHW_CAPS need to contain | 444 | * NOTE: AUDIOHW_CAPS need to contain |
398 | * CLIPPING_CAP | 445 | * CLIPPING_CAP |
399 | */ | 446 | */ |
400 | void audiohw_set_volume(int val); | 447 | void audiohw_set_volume(int val); |
448 | #else /* Stereo volume */ | ||
449 | /** | ||
450 | * Set new voluem value for each channel | ||
451 | * @param vol_l sets left channel volume | ||
452 | * @param vol_r sets right channel volume | ||
453 | */ | ||
454 | void audiohw_set_volume(int vol_l, int vol_r); | ||
455 | #endif /* AUDIOHW_HAVE_MONO_VOLUME */ | ||
456 | |||
457 | #ifdef AUDIOHW_HAVE_LINEOUT | ||
458 | /** | ||
459 | * Set new voluem value for each channel | ||
460 | * @param vol_l sets left channel volume | ||
461 | * @param vol_r sets right channel volume | ||
462 | */ | ||
463 | void audiohw_set_lineout_volume(int vol_l, int vol_r); | ||
401 | #endif | 464 | #endif |
402 | 465 | ||
403 | #ifdef AUDIOHW_HAVE_PRESCALER | 466 | #ifndef AUDIOHW_HAVE_CLIPPING |
467 | #if defined(AUDIOHW_HAVE_BASS) || defined(AUDIOHW_HAVE_TREBLE) \ | ||
468 | || defined(AUDIOHW_HAVE_EQ) | ||
404 | /** | 469 | /** |
405 | * Set new prescaler value. | 470 | * Set new prescaler value. |
406 | * @param val to set. | 471 | * @param val to set. |
@@ -409,6 +474,7 @@ void audiohw_set_volume(int val); | |||
409 | */ | 474 | */ |
410 | void audiohw_set_prescaler(int val); | 475 | void audiohw_set_prescaler(int val); |
411 | #endif | 476 | #endif |
477 | #endif /* !AUDIOHW_HAVE_CLIPPING */ | ||
412 | 478 | ||
413 | #ifdef AUDIOHW_HAVE_BALANCE | 479 | #ifdef AUDIOHW_HAVE_BALANCE |
414 | /** | 480 | /** |
@@ -552,31 +618,38 @@ void audiohw_set_recvol(int left, int right, int type); | |||
552 | void audiohw_set_monitor(bool enable); | 618 | void audiohw_set_monitor(bool enable); |
553 | #endif | 619 | #endif |
554 | 620 | ||
555 | |||
556 | |||
557 | #if CONFIG_CODEC != SWCODEC | ||
558 | |||
559 | /* functions which are only used by mas35xx codecs, but are also | ||
560 | aviable on SWCODECS through dsp */ | ||
561 | |||
562 | /** | 621 | /** |
563 | * Set channel configuration. | 622 | * Set channel configuration. |
564 | * @param val new channel value (see enum Channel). | 623 | * @param val new channel value (see enum Channel). |
565 | */ | 624 | */ |
566 | void audiohw_set_channel(int val); | 625 | void audiohw_set_channel(int val); |
567 | 626 | ||
627 | #ifdef HAVE_PITCHCONTROL | ||
628 | /** | ||
629 | * Set the pitch ratio | ||
630 | * @param ratio to set in .01% units | ||
631 | */ | ||
632 | void audiohw_set_pitch(int32_t val); | ||
633 | |||
634 | /** | ||
635 | * Return the set pitch ratio | ||
636 | */ | ||
637 | int32_t audiohw_get_pitch(void); | ||
638 | #endif /* HAVE_PITCHCONTROL */ | ||
639 | |||
568 | /** | 640 | /** |
569 | * Set stereo width. | 641 | * Set stereo width. |
570 | * @param val new stereo width value. | 642 | * @param val new stereo width value. |
571 | */ | 643 | */ |
572 | void audiohw_set_stereo_width(int val); | 644 | void audiohw_set_stereo_width(int val); |
573 | 645 | ||
574 | #endif /* CONFIG_CODEC != SWCODEC */ | ||
575 | |||
576 | #ifdef HAVE_SPEAKER | 646 | #ifdef HAVE_SPEAKER |
577 | |||
578 | void audiohw_enable_speaker(bool on); | 647 | void audiohw_enable_speaker(bool on); |
579 | |||
580 | #endif /* HAVE_SPEAKER */ | 648 | #endif /* HAVE_SPEAKER */ |
581 | 649 | ||
650 | #if CONFIG_CODEC == SWCODEC | ||
651 | typedef int (*audiohw_swcodec_cb_type)(int msg, intptr_t param); | ||
652 | void audiohw_swcodec_set_callback(audiohw_swcodec_cb_type func); | ||
653 | #endif /* CONFIG_CODEC == SWCODEC */ | ||
654 | |||
582 | #endif /* _AUDIOHW_H_ */ | 655 | #endif /* _AUDIOHW_H_ */ |
diff --git a/firmware/export/audiohw_settings.h b/firmware/export/audiohw_settings.h new file mode 100644 index 0000000000..8efbc0dbe7 --- /dev/null +++ b/firmware/export/audiohw_settings.h | |||
@@ -0,0 +1,143 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2005 by Linus Nielsen Feltzing | ||
11 | * Copyright (C) 2007 by Christian Gmeiner | ||
12 | * Copyright (C) 2013 by Michael Sevakis | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | #if defined(AUDIOHW_SOUND_SETTINGS_ENTRIES) | ||
24 | /* Define sound_setting_entries table */ | ||
25 | |||
26 | #define AUDIOHW_SETTINGS(...) \ | ||
27 | static const struct sound_setting_entry \ | ||
28 | { \ | ||
29 | const struct sound_settings_info *info; \ | ||
30 | sound_set_type *function; \ | ||
31 | } sound_setting_entries[] = \ | ||
32 | { \ | ||
33 | [0 ... SOUND_LAST_SETTING-1] = { NULL, NULL }, \ | ||
34 | __VA_ARGS__ \ | ||
35 | }; | ||
36 | |||
37 | #define AUDIOHW_SETTING_ENT(name, fn) \ | ||
38 | [SOUND_##name] = { .info = &_audiohw_setting_##name, .function = fn }, | ||
39 | |||
40 | #elif defined(AUDIOHW_SOUND_SETTINGS_VAL2PHYS) | ||
41 | |||
42 | /* Implements sound_val2phys */ | ||
43 | #define AUDIOHW_SETTINGS(...) \ | ||
44 | int sound_val2phys(int setting, int value) \ | ||
45 | { \ | ||
46 | switch (setting) \ | ||
47 | { \ | ||
48 | __VA_ARGS__ \ | ||
49 | default: \ | ||
50 | return value; \ | ||
51 | } \ | ||
52 | } | ||
53 | |||
54 | #define AUDIOHW_SETTING_ENT(name, fn) \ | ||
55 | case SOUND_##name: return _sound_val2phys_##name(value); | ||
56 | |||
57 | #endif /* setting table type selection */ | ||
58 | |||
59 | AUDIOHW_SETTINGS( | ||
60 | /* TODO: Volume shouldn't be needed if device doesn't have digital | ||
61 | control */ | ||
62 | AUDIOHW_SETTING_ENT(VOLUME, sound_set_volume) | ||
63 | #if defined(AUDIOHW_HAVE_BASS) | ||
64 | AUDIOHW_SETTING_ENT(BASS, sound_set_bass) | ||
65 | #endif | ||
66 | #if defined(AUDIOHW_HAVE_TREBLE) | ||
67 | AUDIOHW_SETTING_ENT(TREBLE, sound_set_treble) | ||
68 | #endif | ||
69 | AUDIOHW_SETTING_ENT(BALANCE, sound_set_balance) | ||
70 | AUDIOHW_SETTING_ENT(CHANNELS, sound_set_channels) | ||
71 | AUDIOHW_SETTING_ENT(STEREO_WIDTH, sound_set_stereo_width) | ||
72 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
73 | AUDIOHW_SETTING_ENT(LOUDNESS, sound_set_loudness) | ||
74 | AUDIOHW_SETTING_ENT(AVC, sound_set_avc) | ||
75 | AUDIOHW_SETTING_ENT(MDB_STRENGTH, sound_set_mdb_strength) | ||
76 | AUDIOHW_SETTING_ENT(MDB_HARMONICS, sound_set_mdb_harmonics) | ||
77 | AUDIOHW_SETTING_ENT(MDB_CENTER, sound_set_mdb_center) | ||
78 | AUDIOHW_SETTING_ENT(MDB_SHAPE, sound_set_mdb_shape) | ||
79 | AUDIOHW_SETTING_ENT(MDB_ENABLE, sound_set_mdb_enable) | ||
80 | AUDIOHW_SETTING_ENT(SUPERBASS, sound_set_superbass) | ||
81 | #endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */ | ||
82 | #if defined(AUDIOHW_HAVE_LIN_GAIN) | ||
83 | AUDIOHW_SETTING_ENT(LEFT_GAIN, NULL) | ||
84 | AUDIOHW_SETTING_ENT(RIGHT_GAIN, NULL) | ||
85 | #endif | ||
86 | #if defined(AUDIOHW_HAVE_MIC_GAIN) | ||
87 | AUDIOHW_SETTING_ENT(MIC_GAIN, NULL) | ||
88 | #endif | ||
89 | #if defined(AUDIOHW_HAVE_BASS_CUTOFF) | ||
90 | AUDIOHW_SETTING_ENT(BASS_CUTOFF, sound_set_bass_cutoff) | ||
91 | #endif | ||
92 | #if defined(AUDIOHW_HAVE_TREBLE_CUTOFF) | ||
93 | AUDIOHW_SETTING_ENT(TREBLE_CUTOFF, sound_set_treble_cutoff) | ||
94 | #endif | ||
95 | #if defined(AUDIOHW_HAVE_DEPTH_3D) | ||
96 | AUDIOHW_SETTING_ENT(DEPTH_3D, sound_set_depth_3d) | ||
97 | #endif | ||
98 | /* Hardware EQ tone controls */ | ||
99 | #if defined(AUDIOHW_HAVE_EQ) | ||
100 | AUDIOHW_SETTING_ENT(EQ_BAND1_GAIN, sound_set_hw_eq_band1_gain) | ||
101 | #if defined(AUDIOHW_HAVE_EQ_BAND1_FREQUENCY) | ||
102 | AUDIOHW_SETTING_ENT(EQ_BAND1_FREQUENCY, sound_set_hw_eq_band1_frequency) | ||
103 | #endif | ||
104 | #if defined(AUDIOHW_HAVE_EQ_BAND2) | ||
105 | AUDIOHW_SETTING_ENT(EQ_BAND2_GAIN, sound_set_hw_eq_band2_gain) | ||
106 | #if defined(AUDIOHW_HAVE_EQ_BAND2_FREQUENCY) | ||
107 | AUDIOHW_SETTING_ENT(EQ_BAND2_FREQUENCY, sound_set_hw_eq_band2_frequency) | ||
108 | #endif | ||
109 | #if defined(AUDIOHW_HAVE_EQ_BAND2_WIDTH) | ||
110 | AUDIOHW_SETTING_ENT(EQ_BAND2_WIDTH, sound_set_hw_eq_band2_width) | ||
111 | #endif | ||
112 | #endif /* AUDIOHW_HAVE_EQ_BAND2 */ | ||
113 | #if defined(AUDIOHW_HAVE_EQ_BAND3) | ||
114 | AUDIOHW_SETTING_ENT(EQ_BAND3_GAIN, sound_set_hw_eq_band3_gain) | ||
115 | #if defined(AUDIOHW_HAVE_EQ_BAND3_FREQUENCY) | ||
116 | AUDIOHW_SETTING_ENT(EQ_BAND3_FREQUENCY, sound_set_hw_eq_band3_frequency) | ||
117 | #endif | ||
118 | #if defined(AUDIOHW_HAVE_EQ_BAND3_WIDTH) | ||
119 | AUDIOHW_SETTING_ENT(EQ_BAND3_WIDTH, sound_set_hw_eq_band3_width) | ||
120 | #endif | ||
121 | #endif /* AUDIOHW_HAVE_EQ_BAND3 */ | ||
122 | #if defined(AUDIOHW_HAVE_EQ_BAND4) | ||
123 | AUDIOHW_SETTING_ENT(EQ_BAND4_GAIN, sound_set_hw_eq_band4_gain) | ||
124 | #if defined(AUDIOHW_HAVE_EQ_BAND4_FREQUENCY) | ||
125 | AUDIOHW_SETTING_ENT(EQ_BAND4_FREQUENCY, sound_set_hw_eq_band4_frequency) | ||
126 | #endif | ||
127 | #if defined(AUDIOHW_HAVE_EQ_BAND4_WIDTH) | ||
128 | AUDIOHW_SETTING_ENT(EQ_BAND4_WIDTH, sound_set_hw_eq_band4_width) | ||
129 | #endif | ||
130 | #endif /* AUDIOHW_HAVE_EQ_BAND4 */ | ||
131 | #if defined(AUDIOHW_HAVE_EQ_BAND5) | ||
132 | AUDIOHW_SETTING_ENT(EQ_BAND5_GAIN, sound_set_hw_eq_band5_gain) | ||
133 | #if defined(AUDIOHW_HAVE_EQ_BAND5_FREQUENCY) | ||
134 | AUDIOHW_SETTING_ENT(EQ_BAND5_FREQUENCY, sound_set_hw_eq_band5_frequency) | ||
135 | #endif | ||
136 | #endif /* AUDIOHW_HAVE_EQ_BAND5 */ | ||
137 | #endif /* AUDIOHW_HAVE_EQ */ | ||
138 | ); /* AUDIOHW_SETTINGS */ | ||
139 | |||
140 | #undef AUDIOHW_SETTINGS | ||
141 | #undef AUDIOHW_SETTING_ENT | ||
142 | #undef AUDIOHW_SOUND_SETTINGS_ENTRIES | ||
143 | #undef AUDIOHW_SOUND_SETTINGS_VAL2PHYS | ||
diff --git a/firmware/export/cs42l55.h b/firmware/export/cs42l55.h index 86b54ef272..4584706dfd 100644 --- a/firmware/export/cs42l55.h +++ b/firmware/export/cs42l55.h | |||
@@ -26,14 +26,16 @@ | |||
26 | #define VOLUME_MIN -580 | 26 | #define VOLUME_MIN -580 |
27 | #define VOLUME_MAX 120 | 27 | #define VOLUME_MAX 120 |
28 | 28 | ||
29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BASS_CUTOFF_CAP \ | 29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BASS_CUTOFF_CAP | \ |
30 | | TREBLE_CUTOFF_CAP | PRESCALER_CAP) | 30 | TREBLE_CUTOFF_CAP | PRESCALER_CAP | LINEOUT_CAP) |
31 | 31 | ||
32 | extern int tenthdb2master(int db); | 32 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -60, 12, -25) |
33 | AUDIOHW_SETTING(BASS, "dB", 1, 15,-105, 120, 0) | ||
34 | AUDIOHW_SETTING(TREBLE, "dB", 1, 15,-105, 120, 0) | ||
35 | AUDIOHW_SETTING(BASS_CUTOFF, "", 0, 1, 1, 4, 2) | ||
36 | AUDIOHW_SETTING(TREBLE_CUTOFF, "", 0, 1, 1, 4, 1) | ||
33 | 37 | ||
34 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | 38 | void audiohw_enable_lineout(bool enable); |
35 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | ||
36 | extern void audiohw_enable_lineout(bool enable); | ||
37 | 39 | ||
38 | /* Register addresses and bits */ | 40 | /* Register addresses and bits */ |
39 | 41 | ||
@@ -480,5 +482,4 @@ extern void audiohw_enable_lineout(bool enable); | |||
480 | #define HIDDEN3F 0x3f | 482 | #define HIDDEN3F 0x3f |
481 | #define HIDDEN3F_DEFAULT 0x46 | 483 | #define HIDDEN3F_DEFAULT 0x46 |
482 | 484 | ||
483 | |||
484 | #endif /* __CS42L55_H__ */ | 485 | #endif /* __CS42L55_H__ */ |
diff --git a/firmware/export/dac3550a.h b/firmware/export/dac3550a.h index 23c4db9cbc..50bf922e90 100644 --- a/firmware/export/dac3550a.h +++ b/firmware/export/dac3550a.h | |||
@@ -37,7 +37,6 @@ | |||
37 | #define DAC_GCFG 3 | 37 | #define DAC_GCFG 3 |
38 | 38 | ||
39 | /* function prototypes */ | 39 | /* function prototypes */ |
40 | extern int tenthdb2reg(int db); | ||
41 | extern int dac_volume(unsigned int left, unsigned int right, bool deemph); | 40 | extern int dac_volume(unsigned int left, unsigned int right, bool deemph); |
42 | extern void dac_enable(bool enable); | 41 | extern void dac_enable(bool enable); |
43 | extern void dac_line_in(bool enable); | 42 | extern void dac_line_in(bool enable); |
diff --git a/firmware/export/dummy_codec.h b/firmware/export/dummy_codec.h index 122b55ef2f..90fd7b03c2 100644 --- a/firmware/export/dummy_codec.h +++ b/firmware/export/dummy_codec.h | |||
@@ -25,6 +25,6 @@ | |||
25 | #define VOLUME_MIN -730 | 25 | #define VOLUME_MIN -730 |
26 | #define VOLUME_MAX 0 | 26 | #define VOLUME_MAX 0 |
27 | 27 | ||
28 | void audiohw_set_master_vol(int vol_l, int vol_r); | 28 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, VOLUME_MIN/10, VOLUME_MAX/10, 0) |
29 | 29 | ||
30 | #endif /* __DUMMY_CODEC_H_ */ | 30 | #endif /* __DUMMY_CODEC_H_ */ |
diff --git a/firmware/export/hosted_codec.h b/firmware/export/hosted_codec.h new file mode 100644 index 0000000000..50d1281394 --- /dev/null +++ b/firmware/export/hosted_codec.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (C) 2010 by Thomas Martitz | ||
11 | * | ||
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. | ||
16 | * | ||
17 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
18 | * KIND, either express or implied. | ||
19 | * | ||
20 | ****************************************************************************/ | ||
21 | #ifndef HOSTED_CODEC_H | ||
22 | #define HOSTED_CODEC_H | ||
23 | |||
24 | #define VOLUME_MIN -990 | ||
25 | #define VOLUME_MAX 0 | ||
26 | |||
27 | #define AUDIOHW_CAPS (MONO_VOL_CAP) | ||
28 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -100, 0, 0) | ||
29 | |||
30 | #endif /* HOSTED_CODEC_H */ \ No newline at end of file | ||
diff --git a/firmware/export/imx233-codec.h b/firmware/export/imx233-codec.h index 6c329ccd1a..2fbd8bde59 100644 --- a/firmware/export/imx233-codec.h +++ b/firmware/export/imx233-codec.h | |||
@@ -27,10 +27,19 @@ | |||
27 | #define VOLUME_MIN -1000 | 27 | #define VOLUME_MIN -1000 |
28 | #define VOLUME_MAX 60 | 28 | #define VOLUME_MAX 60 |
29 | 29 | ||
30 | #define AUDIOHW_CAPS (DEPTH_3D_CAP | BASS_CAP | TREBLE_CAP) | 30 | #define AUDIOHW_CAPS (DEPTH_3D_CAP | BASS_CAP | TREBLE_CAP | \ |
31 | LIN_GAIN_CAP | MIC_GAIN_CAP) | ||
31 | 32 | ||
32 | /* Work with half dB since the i.MX233 doesn't have a better resolution */ | 33 | /* Work with half dB since the i.MX233 doesn't have a better resolution */ |
33 | int tenthdb2master(int tdb); | 34 | |
34 | void audiohw_set_headphone_vol(int vol_l, int vol_r); | 35 | /* i.MX233 has half dB steps */ |
36 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1,-101, 6, -25) | ||
37 | /* HAVE_SW_TONE_CONTROLS */ | ||
38 | #ifdef HAVE_RECORDING | ||
39 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1, 0, 31, 23) | ||
40 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1, 0, 31, 23) | ||
41 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1, 0, 1, 1) | ||
42 | #endif /* HAVE_RECORDING */ | ||
43 | AUDIOHW_SETTING(DEPTH_3D, "%", 0, 1, 0, 15, 0) | ||
35 | 44 | ||
36 | #endif /* __IMX233_CODEC_H_ */ | 45 | #endif /* __IMX233_CODEC_H_ */ |
diff --git a/firmware/export/jz4740-codec.h b/firmware/export/jz4740-codec.h index 3c088f5bf7..fc731fdf50 100644 --- a/firmware/export/jz4740-codec.h +++ b/firmware/export/jz4740-codec.h | |||
@@ -24,6 +24,17 @@ | |||
24 | #define VOLUME_MIN -730 | 24 | #define VOLUME_MIN -730 |
25 | #define VOLUME_MAX 60 | 25 | #define VOLUME_MAX 60 |
26 | 26 | ||
27 | void audiohw_set_master_vol(int vol_l, int vol_r); | 27 | /* TODO */ |
28 | #ifdef HAVE_SW_VOLUME_CONTROL | ||
29 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -74, 6, -25) | ||
30 | #else | ||
31 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, 0, 6, 0) | ||
32 | #endif /* HAVE_SW_VOLUME_CONTROL */ | ||
33 | |||
34 | #ifdef HAVE_RECORDING | ||
35 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1, 0, 31, 23) | ||
36 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1, 0, 31, 23) | ||
37 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1, 0, 1, 1) | ||
38 | #endif /* HAVE_RECORDING */ | ||
28 | 39 | ||
29 | #endif /* __JZ4740_CODEC_H_ */ | 40 | #endif /* __JZ4740_CODEC_H_ */ |
diff --git a/firmware/export/mas35xx.h b/firmware/export/mas35xx.h index f75658fce1..7643e0efdc 100644 --- a/firmware/export/mas35xx.h +++ b/firmware/export/mas35xx.h | |||
@@ -39,6 +39,14 @@ | |||
39 | 39 | ||
40 | #if CONFIG_CODEC == MAS3507D | 40 | #if CONFIG_CODEC == MAS3507D |
41 | 41 | ||
42 | #define VOLUME_MIN -780 | ||
43 | #define VOLUME_MAX 180 | ||
44 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP) | ||
45 | |||
46 | AUDIOHW_SETTING(SOUND_VOLUME, "dB", 0, 1, -78, 18, -18) | ||
47 | AUDIOHW_SETTING(SOUND_BASS, "dB", 0, 1, -15, 15, 7) | ||
48 | AUDIOHW_SETTING(SOUND_TREBLE, "dB", 0, 1, -15, 15, 7) | ||
49 | |||
42 | /* I2C defines */ | 50 | /* I2C defines */ |
43 | #define MAS_ADR 0x3a | 51 | #define MAS_ADR 0x3a |
44 | #define MAS_DEV_WRITE (MAS_ADR | 0x00) | 52 | #define MAS_DEV_WRITE (MAS_ADR | 0x00) |
@@ -71,10 +79,6 @@ | |||
71 | #define MAS_D0_OUT_RL 0x7fa | 79 | #define MAS_D0_OUT_RL 0x7fa |
72 | #define MAS_D0_OUT_RR 0x7fb | 80 | #define MAS_D0_OUT_RR 0x7fb |
73 | 81 | ||
74 | #define VOLUME_MIN -780 | ||
75 | #define VOLUME_MAX 180 | ||
76 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP) | ||
77 | |||
78 | static const unsigned int bass_table[] = | 82 | static const unsigned int bass_table[] = |
79 | { | 83 | { |
80 | 0x9e400, /* -15dB */ | 84 | 0x9e400, /* -15dB */ |
@@ -167,6 +171,36 @@ static const unsigned int prescale_table[] = | |||
167 | 171 | ||
168 | #else /* CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F */ | 172 | #else /* CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F */ |
169 | 173 | ||
174 | #define VOLUME_MIN -400 | ||
175 | #define VOLUME_MAX 600 | ||
176 | |||
177 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1,-100, 12, -25) | ||
178 | AUDIOHW_SETTING(BASS, "dB", 0, 1, -12, 12, 6) | ||
179 | AUDIOHW_SETTING(TREBLE, "dB", 0, 1, -12, 12, 6) | ||
180 | AUDIOHW_SETTING(LOUDNESS, "dB", 0, 1, 0, 17, 0) | ||
181 | AUDIOHW_SETTING(AVC "", 0, 1, -1, 4, 0) | ||
182 | AUDIOHW_SETTING(MDB_STRENGTH, "dB", 0, 1, 0, 127, 48) | ||
183 | AUDIOHW_SETTING(MDB_HARMONICS, "%", 0, 1, 0, 100, 50) | ||
184 | AUDIOHW_SETTING(MDB_CENTER "Hz", 0, 10, 20, 300, 60) | ||
185 | AUDIOHW_SETTING(MDB_SHAPE "Hz", 0, 10, 50, 300, 90) | ||
186 | AUDIOHW_SETTING(MDB_ENABLE "", 0, 1, 0, 1, 0) | ||
187 | AUDIOHW_SETTING(SUPERBASS "", 0, 1, 0, 1, 0) | ||
188 | |||
189 | #if CONFIG_CODEC == MAS3587F && defined(HAVE_RECORDING) | ||
190 | /* MAS3587F and MAS3539F handle clipping prevention internally so we do not | ||
191 | * need the prescaler -> CLIPPING_CAP */ | ||
192 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BALANCE_CAP | CLIPPING_CAP | \ | ||
193 | MONO_VOL_CAP | LIN_GAIN_CAP | MIC_GAIN_CAP) | ||
194 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1, 0, 15, 8, (val - 2) * 15) | ||
195 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1, 0, 15, 8, (val - 2) * 15) | ||
196 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1, 0, 15, 2, val * 15 + 210) | ||
197 | #else | ||
198 | /* MAS3587F and MAS3539F handle clipping prevention internally so we do not | ||
199 | * need the prescaler -> CLIPPING_CAP */ | ||
200 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BALANCE_CAP | CLIPPING_CAP | \ | ||
201 | MONO_VOL_CAP) | ||
202 | #endif /* MAS3587F && HAVE_RECORDING */ | ||
203 | |||
170 | /* I2C defines */ | 204 | /* I2C defines */ |
171 | #define MAS_ADR 0x3c | 205 | #define MAS_ADR 0x3c |
172 | #define MAS_DEV_WRITE (MAS_ADR | 0x00) | 206 | #define MAS_DEV_WRITE (MAS_ADR | 0x00) |
@@ -248,18 +282,7 @@ static const unsigned int prescale_table[] = | |||
248 | #define MAS_D0_CRC_ERROR_COUNT 0xfd3 | 282 | #define MAS_D0_CRC_ERROR_COUNT 0xfd3 |
249 | #endif | 283 | #endif |
250 | 284 | ||
251 | /* MAS3587F and MAS3539F handle clipping prevention internally so we do not need | ||
252 | * the prescaler -> CLIPPING_CAP | ||
253 | */ | ||
254 | |||
255 | #define VOLUME_MIN -400 | ||
256 | #define VOLUME_MAX 600 | ||
257 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BALANCE_CAP | CLIPPING_CAP) | ||
258 | |||
259 | #endif /* CONFIG_CODEC */ | ||
260 | |||
261 | /* Function prototypes */ | 285 | /* Function prototypes */ |
262 | #if CONFIG_CODEC == MAS3587F || CONFIG_CODEC == MAS3539F | ||
263 | extern void audiohw_set_loudness(int value); | 286 | extern void audiohw_set_loudness(int value); |
264 | extern void audiohw_set_avc(int value); | 287 | extern void audiohw_set_avc(int value); |
265 | extern void audiohw_set_mdb_strength(int value); | 288 | extern void audiohw_set_mdb_strength(int value); |
@@ -269,7 +292,9 @@ extern void audiohw_set_mdb_shape(int value); | |||
269 | extern void audiohw_set_mdb_enable(int value); | 292 | extern void audiohw_set_mdb_enable(int value); |
270 | extern void audiohw_set_superbass(int value); | 293 | extern void audiohw_set_superbass(int value); |
271 | extern void audiohw_set_balance(int val); | 294 | extern void audiohw_set_balance(int val); |
272 | extern void audiohw_set_pitch(unsigned long val); | 295 | extern void audiohw_set_pitch(int32_t val); |
273 | #endif | 296 | extern int audiohw_get_pitch(void); |
297 | |||
298 | #endif /* CONFIG_CODEC */ | ||
274 | 299 | ||
275 | #endif /* _MAS35XX_H */ | 300 | #endif /* _MAS35XX_H */ |
diff --git a/firmware/export/rk27xx_codec.h b/firmware/export/rk27xx_codec.h index 5fdf0a0061..5a6796d63c 100644 --- a/firmware/export/rk27xx_codec.h +++ b/firmware/export/rk27xx_codec.h | |||
@@ -26,10 +26,14 @@ | |||
26 | 26 | ||
27 | #define VOLUME_MIN -330 | 27 | #define VOLUME_MIN -330 |
28 | #define VOLUME_MAX 40 | 28 | #define VOLUME_MAX 40 |
29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP) | 29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | LIN_GAIN_CAP | MIC_GAIN_CAP) |
30 | 30 | ||
31 | extern int tenthdb2master(int db); | 31 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -34, 4, -25) |
32 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | 32 | #ifdef HAVE_RECORDING /* disabled for now */ |
33 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 2, 75, -1725, 3000, 0) | ||
34 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 2, 75, -1725, 3000, 0) | ||
35 | AUDIOHW_SETTING(MIC_GAIN, "dB", 0, 1, 0, 20, 20) | ||
36 | #endif /* HAVE_RECORDING */ | ||
33 | 37 | ||
34 | #define CODEC_I2C_ADDR 0x4e | 38 | #define CODEC_I2C_ADDR 0x4e |
35 | 39 | ||
diff --git a/firmware/export/sound.h b/firmware/export/sound.h index ebf728c7c7..fa76c67b1f 100644 --- a/firmware/export/sound.h +++ b/firmware/export/sound.h | |||
@@ -24,17 +24,6 @@ | |||
24 | #include <inttypes.h> | 24 | #include <inttypes.h> |
25 | #include <audiohw.h> | 25 | #include <audiohw.h> |
26 | 26 | ||
27 | |||
28 | #if CONFIG_CODEC == SWCODEC | ||
29 | enum { | ||
30 | DSP_CALLBACK_SET_PRESCALE = 0, | ||
31 | DSP_CALLBACK_SET_BASS, | ||
32 | DSP_CALLBACK_SET_TREBLE, | ||
33 | DSP_CALLBACK_SET_CHANNEL_CONFIG, | ||
34 | DSP_CALLBACK_SET_STEREO_WIDTH, | ||
35 | }; | ||
36 | #endif | ||
37 | |||
38 | typedef void sound_set_type(int value); | 27 | typedef void sound_set_type(int value); |
39 | 28 | ||
40 | const char *sound_unit(int setting); | 29 | const char *sound_unit(int setting); |
@@ -45,7 +34,6 @@ int sound_max(int setting); | |||
45 | int sound_default(int setting); | 34 | int sound_default(int setting); |
46 | sound_set_type* sound_get_fn(int setting); | 35 | sound_set_type* sound_get_fn(int setting); |
47 | 36 | ||
48 | void sound_set_dsp_callback(int (*func)(int, intptr_t)); | ||
49 | void sound_set_volume(int value); | 37 | void sound_set_volume(int value); |
50 | void sound_set_balance(int value); | 38 | void sound_set_balance(int value); |
51 | void sound_set_bass(int value); | 39 | void sound_set_bass(int value); |
@@ -130,10 +118,8 @@ void sound_set_superbass(int value); | |||
130 | void sound_set(int setting, int value); | 118 | void sound_set(int setting, int value); |
131 | int sound_val2phys(int setting, int value); | 119 | int sound_val2phys(int setting, int value); |
132 | 120 | ||
133 | #if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) | ||
134 | void sound_set_pitch(int32_t pitch); | 121 | void sound_set_pitch(int32_t pitch); |
135 | int32_t sound_get_pitch(void); | 122 | int32_t sound_get_pitch(void); |
136 | #endif | ||
137 | 123 | ||
138 | #ifdef HAVE_PITCHCONTROL | 124 | #ifdef HAVE_PITCHCONTROL |
139 | /* precision of the pitch and speed variables */ | 125 | /* precision of the pitch and speed variables */ |
diff --git a/firmware/export/tlv320.h b/firmware/export/tlv320.h index 66f4d5ca92..99359f72ce 100644 --- a/firmware/export/tlv320.h +++ b/firmware/export/tlv320.h | |||
@@ -25,15 +25,33 @@ | |||
25 | #define VOLUME_MIN -730 | 25 | #define VOLUME_MIN -730 |
26 | #define VOLUME_MAX 60 | 26 | #define VOLUME_MAX 60 |
27 | 27 | ||
28 | extern int tenthdb2master(int db); | 28 | #define AUDIOHW_CAPS (LIN_GAIN_CAP | MIC_GAIN_CAP) |
29 | |||
30 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -74, 6, -20) | ||
31 | #ifdef HAVE_RECORDING | ||
32 | /* (x - 23)/1.5 *10 */ | ||
33 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1, 0, 31, 23, (val - 23) * 15) | ||
34 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1, 0, 31, 23, (val - 23) * 15) | ||
35 | /* 0 or 20 dB */ | ||
36 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1, 0, 1, 1, val * 200) | ||
37 | #endif /* HAVE_RECORDING */ | ||
38 | |||
39 | static inline int _param_2_phys(int setting, int value) | ||
40 | { | ||
41 | switch(setting) | ||
42 | { | ||
43 | default: return value; | ||
44 | #ifdef HAVE_RECORDING | ||
45 | case SOUND_LEFT_GAIN: | ||
46 | case SOUND_RIGHT_GAIN: return (value - 23) * 15; | ||
47 | case SOUND_MIC_GAIN: return value * 200; /* 0 or 20 dB */ | ||
48 | #endif | ||
49 | } | ||
50 | } | ||
29 | 51 | ||
30 | /*** definitions ***/ | 52 | /*** definitions ***/ |
31 | extern void audiohw_set_headphone_vol(int vol_l, int vol_r); | ||
32 | |||
33 | #define HEADPHONE_MUTE 0x30 /* 0110000 = -73db */ | 53 | #define HEADPHONE_MUTE 0x30 /* 0110000 = -73db */ |
34 | 54 | ||
35 | /* ToDo: samplerates */ | ||
36 | |||
37 | /* registers */ | 55 | /* registers */ |
38 | /* REG_LLIV: Left line input channel volume control */ | 56 | /* REG_LLIV: Left line input channel volume control */ |
39 | #define REG_LLIV 0x0 | 57 | #define REG_LLIV 0x0 |
diff --git a/firmware/export/tsc2100.h b/firmware/export/tsc2100.h index 9566c588df..4e1e7d9287 100644 --- a/firmware/export/tsc2100.h +++ b/firmware/export/tsc2100.h | |||
@@ -21,6 +21,12 @@ | |||
21 | #ifndef __TSC2100_H_ | 21 | #ifndef __TSC2100_H_ |
22 | #define __TSC2100_H_ | 22 | #define __TSC2100_H_ |
23 | 23 | ||
24 | /* volume/balance/treble/bass interdependency */ | ||
25 | #define VOLUME_MIN -630 | ||
26 | #define VOLUME_MAX 0 | ||
27 | |||
28 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -64, 0, -25) | ||
29 | |||
24 | void tsc2100_read_data(void); | 30 | void tsc2100_read_data(void); |
25 | bool tsc2100_read_touch(short *x, short* y, short *z1, short *z2); | 31 | bool tsc2100_read_touch(short *x, short* y, short *z1, short *z2); |
26 | bool tsc2100_read_volt(short *bat1, short *bat2, short *aux); | 32 | bool tsc2100_read_volt(short *bat1, short *bat2, short *aux); |
@@ -139,7 +145,4 @@ void tsc2100_keyclick(void); | |||
139 | #define TSAC5_PAGE 2 | 145 | #define TSAC5_PAGE 2 |
140 | #define TSAC5_ADDRESS 0x1e | 146 | #define TSAC5_ADDRESS 0x1e |
141 | 147 | ||
142 | extern int tenthdb2master(int db); | ||
143 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | ||
144 | |||
145 | #endif | 148 | #endif |
diff --git a/firmware/export/uda1341.h b/firmware/export/uda1341.h index a43d33a137..5641bd301f 100644 --- a/firmware/export/uda1341.h +++ b/firmware/export/uda1341.h | |||
@@ -26,13 +26,16 @@ | |||
26 | #define VOLUME_MIN -840 | 26 | #define VOLUME_MIN -840 |
27 | #define VOLUME_MAX 0 | 27 | #define VOLUME_MAX 0 |
28 | 28 | ||
29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP) | 29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | MIC_GAIN_CAP | LIN_GAIN_CAP) |
30 | 30 | ||
31 | extern int tenthdb2master(int db); | 31 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -84, 0, -25) |
32 | extern int tenthdb2mixer(int db); | 32 | AUDIOHW_SETTING(BASS, "dB", 0, 2, 0, 24, 0) |
33 | 33 | AUDIOHW_SETTING(TREBLE, "dB", 0, 2, 0, 6, 0) | |
34 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | 34 | #ifdef HAVE_RECORDING |
35 | extern void audiohw_set_mixer_vol(int channel1, int channel2); | 35 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1,-128, 96, 0) |
36 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1,-128, 96, 0) | ||
37 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1,-128, 108, 16) | ||
38 | #endif /* HAVE_RECORDING */ | ||
36 | 39 | ||
37 | /* These are logical register numbers for driver */ | 40 | /* These are logical register numbers for driver */ |
38 | enum uda_register { | 41 | enum uda_register { |
diff --git a/firmware/export/uda1380.h b/firmware/export/uda1380.h index e9292cf466..a2200967dd 100644 --- a/firmware/export/uda1380.h +++ b/firmware/export/uda1380.h | |||
@@ -26,13 +26,18 @@ | |||
26 | #define VOLUME_MIN -840 | 26 | #define VOLUME_MIN -840 |
27 | #define VOLUME_MAX 0 | 27 | #define VOLUME_MAX 0 |
28 | 28 | ||
29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP) | 29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP | \ |
30 | 30 | LIN_GAIN_CAP | MIC_GAIN_CAP) | |
31 | extern int tenthdb2master(int db); | 31 | |
32 | extern int tenthdb2mixer(int db); | 32 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -85, 0, -25) |
33 | 33 | AUDIOHW_SETTING(BASS, "dB", 0, 2, 0, 24, 0) | |
34 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | 34 | AUDIOHW_SETTING(TREBLE, "dB", 0, 2, 0, 6, 0) |
35 | extern void audiohw_set_mixer_vol(int channel1, int channel2); | 35 | #ifdef HAVE_RECORDING |
36 | /* (1/2) * 10 */ | ||
37 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1,-128, 96, 0, val * 5) | ||
38 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1,-128, 96, 0, val * 5) | ||
39 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1,-128, 108, 16, val * 5) | ||
40 | #endif /* HAVE_RECORDING */ | ||
36 | 41 | ||
37 | #define UDA1380_ADDR 0x30 | 42 | #define UDA1380_ADDR 0x30 |
38 | 43 | ||
diff --git a/firmware/export/wm8731.h b/firmware/export/wm8731.h index 28d4d3940d..086c847ee1 100644 --- a/firmware/export/wm8731.h +++ b/firmware/export/wm8731.h | |||
@@ -28,9 +28,16 @@ | |||
28 | #define VOLUME_MIN -730 | 28 | #define VOLUME_MIN -730 |
29 | #define VOLUME_MAX 60 | 29 | #define VOLUME_MAX 60 |
30 | 30 | ||
31 | extern int tenthdb2master(int db); | 31 | #define AUDIOHW_CAPS (LIN_GAIN_CAP | MIC_GAIN_CAP) |
32 | 32 | ||
33 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | 33 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -74, 6, -25) |
34 | #if defined(HAVE_WM8731) && defined(HAVE_RECORDING) | ||
35 | /* (x - 23)/1.5 *10 */ | ||
36 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1, 0, 31, 23, (val - 23) * 15) | ||
37 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1, 0, 31, 23, (val - 23) * 15) | ||
38 | /* 0 or 20 dB */ | ||
39 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1, 0, 1, 0, val * 200) | ||
40 | #endif /* defined(HAVE_WM8731) && defined(HAVE_RECORDING) */ | ||
34 | 41 | ||
35 | /* Common register bits */ | 42 | /* Common register bits */ |
36 | #ifdef HAVE_WM8731 | 43 | #ifdef HAVE_WM8731 |
diff --git a/firmware/export/wm8751.h b/firmware/export/wm8751.h index 3bbf744463..6e7bb245dd 100644 --- a/firmware/export/wm8751.h +++ b/firmware/export/wm8751.h | |||
@@ -25,23 +25,36 @@ | |||
25 | #define VOLUME_MIN -730 | 25 | #define VOLUME_MIN -730 |
26 | #define VOLUME_MAX 60 | 26 | #define VOLUME_MAX 60 |
27 | 27 | ||
28 | #if defined(HAVE_WM8750) | ||
29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP | \ | 28 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP | \ |
30 | BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP | \ | 29 | BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP | \ |
31 | DEPTH_3D_CAP) | 30 | DEPTH_3D_CAP | LIN_GAIN_CAP | MIC_GAIN_CAP) |
32 | #else | ||
33 | 31 | ||
34 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP | \ | 32 | #if defined(HAVE_WM8750) |
35 | BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP) | 33 | AUDIOHW_SETTING(DEPTH_3D, "%", 0, 1, 0, 15, 0, (100 * val + 8) / 15) |
36 | #endif | 34 | #ifdef HAVE_RECORDING |
37 | 35 | /* PGA -17.25dB to 30.0dB in 0.75dB increments 64 steps | |
38 | extern int tenthdb2master(int db); | 36 | * digital gain 0dB to 30.0dB in 0.5dB increments |
37 | * we use 0.75dB fake steps through whole range | ||
38 | * | ||
39 | * This combined gives -17.25 to 60.0dB | ||
40 | */ | ||
41 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 2, 75,-1725, 6000, 0, val * 5) | ||
42 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 2, 75,-1725, 6000, 0, val * 5) | ||
43 | AUDIOHW_SETTING(MIC_GAIN, "dB", 2, 75,-1725, 6000, 3000, val * 5) | ||
39 | 44 | ||
40 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | ||
41 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | ||
42 | #if defined(HAVE_WM8750) && defined(HAVE_RECORDING) | ||
43 | void audiohw_set_recsrc(int source, bool recording); | 45 | void audiohw_set_recsrc(int source, bool recording); |
44 | #endif | 46 | #endif /* HAVE_RECORDING */ |
47 | #else /* !HAVE_WM8750 */ | ||
48 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | PRESCALER_CAP | \ | ||
49 | BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP | \ | ||
50 | LINEOUT_CAP) | ||
51 | #endif /* HAVE_WM8750 */ | ||
52 | |||
53 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -74, 6, -25) | ||
54 | AUDIOHW_SETTING(BASS, "dB", 1, 15, -60, 90, 0) | ||
55 | AUDIOHW_SETTING(TREBLE, "dB", 1, 15, -60, 90, 0) | ||
56 | AUDIOHW_SETTING(BASS_CUTOFF, "Hz", 0, 70, 130, 200, 200) | ||
57 | AUDIOHW_SETTING(TREBLE_CUTOFF, "kHz", 0, 4, 4, 8, 4) | ||
45 | 58 | ||
46 | /* Register addresses and bits */ | 59 | /* Register addresses and bits */ |
47 | #define OUTPUT_MUTED 0x2f | 60 | #define OUTPUT_MUTED 0x2f |
@@ -348,4 +361,5 @@ void audiohw_set_recsrc(int source, bool recording); | |||
348 | #define MONOOUT_MOZC (1 << 7) | 361 | #define MONOOUT_MOZC (1 << 7) |
349 | 362 | ||
350 | #define WM_NUM_REGS 0x2b | 363 | #define WM_NUM_REGS 0x2b |
364 | |||
351 | #endif /* _WM8751_H */ | 365 | #endif /* _WM8751_H */ |
diff --git a/firmware/export/wm8758.h b/firmware/export/wm8758.h index ef5567e898..89b000cf8c 100644 --- a/firmware/export/wm8758.h +++ b/firmware/export/wm8758.h | |||
@@ -26,15 +26,22 @@ | |||
26 | #define VOLUME_MIN -890 | 26 | #define VOLUME_MIN -890 |
27 | #define VOLUME_MAX 60 | 27 | #define VOLUME_MAX 60 |
28 | 28 | ||
29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP) | 29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BASS_CUTOFF_CAP | \ |
30 | 30 | TREBLE_CUTOFF_CAP | LINEOUT_CAP | LIN_GAIN_CAP | \ | |
31 | extern int tenthdb2master(int db); | 31 | MIC_GAIN_CAP) |
32 | extern int tenthdb2mixer(int db); | 32 | |
33 | 33 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -90, 6, -25) | |
34 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | 34 | AUDIOHW_SETTING(BASS, "dB", 0, 1, -12, 12, 0) |
35 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | 35 | AUDIOHW_SETTING(TREBLE, "dB", 0, 1, -12, 12, 0) |
36 | extern void audiohw_set_mixer_vol(int channel1, int channel2); | 36 | AUDIOHW_SETTING(BASS_CUTOFF, "", 0, 1, 1, 4, 1) |
37 | extern void audiohw_enable_lineout(bool enable); | 37 | AUDIOHW_SETTING(TREBLE_CUTOFF, "", 0, 1, 1, 4, 1) |
38 | #ifdef HAVE_RECORDING | ||
39 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1, 0, 63, 16, ((val - 23) * 15) / 2 + 200) | ||
40 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1, 0, 63, 16, ((val - 23) * 15) / 2 + 200) | ||
41 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1, 0, 63, 16, ((val - 23) * 15) / 2 + 200) | ||
42 | #endif /* HAVE_RECORDING */ | ||
43 | |||
44 | void audiohw_enable_lineout(bool enable); | ||
38 | 45 | ||
39 | #define RESET 0x00 | 46 | #define RESET 0x00 |
40 | #define RESET_RESET 0x0 | 47 | #define RESET_RESET 0x0 |
diff --git a/firmware/export/wm8975.h b/firmware/export/wm8975.h index c9d0bd1bbe..f4e0d203a1 100644 --- a/firmware/export/wm8975.h +++ b/firmware/export/wm8975.h | |||
@@ -26,13 +26,19 @@ | |||
26 | #define VOLUME_MIN -730 | 26 | #define VOLUME_MIN -730 |
27 | #define VOLUME_MAX 60 | 27 | #define VOLUME_MAX 60 |
28 | 28 | ||
29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP) | 29 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | LINEOUT_CAP | \ |
30 | 30 | LIN_GAIN_CAP | MIC_GAIN_CAP) | |
31 | extern int tenthdb2master(int db); | 31 | |
32 | 32 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -74, 6, -25) | |
33 | extern void audiohw_set_master_vol(int vol_l, int vol_r); | 33 | AUDIOHW_SETTING(BASS, "dB", 0, 1, -6, 9, 0) |
34 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | 34 | AUDIOHW_SETTING(TREBLE, "dB", 0, 1, -6, 9, 0) |
35 | extern void audiohw_enable_lineout(bool enable); | 35 | #ifdef HAVE_RECORDING |
36 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1, 0, 63, 23, ((val - 23) * 15) / 2) | ||
37 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1, 0, 63, 23, ((val - 23) * 15) / 2)) | ||
38 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1, 0, 63, 0, ((val - 23) * 15) / 2 + 200) | ||
39 | #endif /* HAVE_RECORDING */ | ||
40 | |||
41 | void audiohw_enable_lineout(bool enable); | ||
36 | 42 | ||
37 | /* Register addresses and bits */ | 43 | /* Register addresses and bits */ |
38 | 44 | ||
diff --git a/firmware/export/wm8978.h b/firmware/export/wm8978.h index f591c1b9fb..d5ed8f184c 100644 --- a/firmware/export/wm8978.h +++ b/firmware/export/wm8978.h | |||
@@ -23,10 +23,17 @@ | |||
23 | #ifndef _WM8978_H | 23 | #ifndef _WM8978_H |
24 | #define _WM8978_H | 24 | #define _WM8978_H |
25 | 25 | ||
26 | #define VOLUME_MIN -900 | 26 | #define VOLUME_MIN -890 |
27 | #define VOLUME_MAX 60 | 27 | #define VOLUME_MAX 60 |
28 | 28 | ||
29 | #define AUDIOHW_CAPS (EQ_CAP | PRESCALER_CAP | DEPTH_3D_CAP) | 29 | #if 0 |
30 | #define AUDIOHW_CAPS (EQ_CAP | PRESCALER_CAP | DEPTH_3D_CAP | \ | ||
31 | LIN_GAIN_CAP | MIC_GAIN_CAP) | ||
32 | #else | ||
33 | #define AUDIOHW_CAPS (EQ_CAP | PRESCALER_CAP | DEPTH_3D_CAP | \ | ||
34 | LIN_GAIN_CAP) | ||
35 | #endif | ||
36 | |||
30 | /* Filter bitmask */ | 37 | /* Filter bitmask */ |
31 | #define AUDIOHW_EQ_BAND_CAPS ((EQ_CAP << 0) | (EQ_CAP << 1) | \ | 38 | #define AUDIOHW_EQ_BAND_CAPS ((EQ_CAP << 0) | (EQ_CAP << 1) | \ |
32 | (EQ_CAP << 2) | (EQ_CAP << 3) | \ | 39 | (EQ_CAP << 2) | (EQ_CAP << 3) | \ |
@@ -39,8 +46,33 @@ | |||
39 | #define AUDIOHW_EQ_WIDTH_CAPS ((EQ_CAP << 1) | (EQ_CAP << 2) | \ | 46 | #define AUDIOHW_EQ_WIDTH_CAPS ((EQ_CAP << 1) | (EQ_CAP << 2) | \ |
40 | (EQ_CAP << 3)) | 47 | (EQ_CAP << 3)) |
41 | 48 | ||
42 | int tenthdb2master(int db); | 49 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -90, 6, -25) |
43 | void audiohw_set_headphone_vol(int vol_l, int vol_r); | 50 | AUDIOHW_SETTING(EQ_BAND1_GAIN, "dB", 0, 1, -12, 12, 0) |
51 | AUDIOHW_SETTING(EQ_BAND2_GAIN, "dB", 0, 1, -12, 12, 0) | ||
52 | AUDIOHW_SETTING(EQ_BAND3_GAIN, "dB", 0, 1, -12, 12, 0) | ||
53 | AUDIOHW_SETTING(EQ_BAND4_GAIN, "dB", 0, 1, -12, 12, 0) | ||
54 | AUDIOHW_SETTING(EQ_BAND5_GAIN, "dB", 0, 1, -12, 12, 0) | ||
55 | AUDIOHW_SETTING(EQ_BAND1_FREQUENCY, "", 0, 1, 0, 3, 0) | ||
56 | AUDIOHW_SETTING(EQ_BAND2_FREQUENCY, "", 0, 1, 0, 3, 0) | ||
57 | AUDIOHW_SETTING(EQ_BAND3_FREQUENCY, "", 0, 1, 0, 3, 0) | ||
58 | AUDIOHW_SETTING(EQ_BAND4_FREQUENCY, "", 0, 1, 0, 3, 0) | ||
59 | AUDIOHW_SETTING(EQ_BAND5_FREQUENCY, "", 0, 1, 0, 3, 0) | ||
60 | AUDIOHW_SETTING(EQ_BAND2_WIDTH, "", 0, 1, 0, 1, 0) | ||
61 | AUDIOHW_SETTING(EQ_BAND3_WIDTH, "", 0, 1, 0, 1, 0) | ||
62 | AUDIOHW_SETTING(EQ_BAND4_WIDTH, "", 0, 1, 0, 1, 0) | ||
63 | AUDIOHW_SETTING(DEPTH_3D, "%", 0, 1, 0, 15, 0, (100*val + 8) / 15) | ||
64 | #ifdef HAVE_RECORDING | ||
65 | /* Digital: -119.0dB to +8.0dB in 0.5dB increments | ||
66 | * Analog: Relegated to volume control | ||
67 | * Circumstances unfortunately do not allow a great deal of positive | ||
68 | * gain. */ | ||
69 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1,-238, 16, 0, val * 5) | ||
70 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1,-238, 16, 0, val * 5) | ||
71 | #if 0 /* whenever it's needed - none on GBS */ | ||
72 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1,-238, 16, 0, val * 5) | ||
73 | #endif /* 0 */ | ||
74 | #endif /* HAVE_RECORDING */ | ||
75 | |||
44 | void audiohw_set_recsrc(int source, bool recording); | 76 | void audiohw_set_recsrc(int source, bool recording); |
45 | 77 | ||
46 | void wmc_set(unsigned int reg, unsigned int bits); | 78 | void wmc_set(unsigned int reg, unsigned int bits); |
diff --git a/firmware/export/wm8985.h b/firmware/export/wm8985.h index 4538b5edc5..a5eb59f159 100644 --- a/firmware/export/wm8985.h +++ b/firmware/export/wm8985.h | |||
@@ -29,15 +29,25 @@ | |||
29 | #ifdef COWON_D2 | 29 | #ifdef COWON_D2 |
30 | /* FIXME: somehow something was out of sync in the .lang, settings and caps. Keep the | 30 | /* FIXME: somehow something was out of sync in the .lang, settings and caps. Keep the |
31 | * cutoffs disabled until someone with the device works it out. */ | 31 | * cutoffs disabled until someone with the device works it out. */ |
32 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP) | 32 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | LINEOUT_CAP | \ |
33 | LIN_GAIN_CAP | MIC_GAIN_CAP) | ||
33 | #else | 34 | #else |
34 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BASS_CUTOFF_CAP | TREBLE_CUTOFF_CAP) | 35 | #define AUDIOHW_CAPS (BASS_CAP | TREBLE_CAP | BASS_CUTOFF_CAP | \ |
36 | TREBLE_CUTOFF_CAP | LINEOUT_CAP | LIN_GAIN_CAP | \ | ||
37 | MIC_GAIN_CAP) | ||
38 | AUDIOHW_SETTING(BASS_CUTOFF, "", 0, 1, 1, 4, 1) | ||
39 | AUDIOHW_SETTING(TREBLE_CUTOFF, "", 0, 1, 1, 4, 1) | ||
35 | #endif | 40 | #endif |
36 | 41 | ||
37 | extern int tenthdb2master(int db); | 42 | AUDIOHW_SETTING(VOLUME, "dB", 0, 1, -90, 6, -25) |
43 | AUDIOHW_SETTING(BASS, "dB", 0, 1, -12, 12, 0) | ||
44 | AUDIOHW_SETTING(TREBLE, "dB", 0, 1, -12, 12, 0) | ||
45 | #ifdef HAVE_RECORDING | ||
46 | AUDIOHW_SETTING(LEFT_GAIN, "dB", 1, 1,-128, 96, 0) | ||
47 | AUDIOHW_SETTING(RIGHT_GAIN, "dB", 1, 1,-128, 96, 0) | ||
48 | AUDIOHW_SETTING(MIC_GAIN, "dB", 1, 1,-128, 108, 16) | ||
49 | #endif /* HAVE_RECORDING */ | ||
38 | 50 | ||
39 | extern void audiohw_set_headphone_vol(int vol_l, int vol_r); | 51 | void audiohw_set_aux_vol(int vol_l, int vol_r); |
40 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | ||
41 | extern void audiohw_set_aux_vol(int vol_l, int vol_r); | ||
42 | 52 | ||
43 | #endif /* _WM8985_H */ | 53 | #endif /* _WM8985_H */ |