summaryrefslogtreecommitdiff
path: root/firmware/sound.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/sound.c')
-rw-r--r--firmware/sound.c50
1 files changed, 48 insertions, 2 deletions
diff --git a/firmware/sound.c b/firmware/sound.c
index 9cb4c28f32..0e1e7c5576 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -70,6 +70,10 @@ const struct sound_settings_info audiohw_settings[] = {
70 [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0}, 70 [SOUND_RIGHT_GAIN] = {"dB", 1, 1,-128, 96, 0},
71 [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16}, 71 [SOUND_MIC_GAIN] = {"dB", 1, 1,-128, 108, 16},
72#endif 72#endif
73#if defined(HAVE_WM8758)
74 [SOUND_BASS_CUTOFF] = {"", 0, 1, 1, 4, 1},
75 [SOUND_TREBLE_CUTOFF] = {"", 0, 1, 1, 4, 1},
76#endif
73}; 77};
74#endif 78#endif
75 79
@@ -132,6 +136,16 @@ sound_set_type* sound_get_fn(int setting)
132 result = sound_set_stereo_width; 136 result = sound_set_stereo_width;
133 break; 137 break;
134 138
139#ifdef HAVE_WM8758
140 case SOUND_BASS_CUTOFF:
141 result = sound_set_bass_cutoff;
142 break;
143
144 case SOUND_TREBLE_CUTOFF:
145 result = sound_set_treble_cutoff;
146 break;
147#endif
148
135#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 149#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
136 case SOUND_LOUDNESS: 150 case SOUND_LOUDNESS:
137 result = sound_set_loudness; 151 result = sound_set_loudness;
@@ -219,7 +233,8 @@ static void set_prescaled_volume(void)
219/* The WM codecs listed don't have suitable prescaler functionality, so we let 233/* The WM codecs listed don't have suitable prescaler functionality, so we let
220 * the prescaler stay at 0 for these unless SW tone controls are in use */ 234 * the prescaler stay at 0 for these unless SW tone controls are in use */
221#if defined(HAVE_SW_TONE_CONTROLS) || !(defined(HAVE_WM8975) \ 235#if defined(HAVE_SW_TONE_CONTROLS) || !(defined(HAVE_WM8975) \
222 || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751)) 236 || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751) \
237 || defined(HAVE_WM8758))
223 238
224 prescale = MAX(current_bass, current_treble); 239 prescale = MAX(current_bass, current_treble);
225 if (prescale < 0) 240 if (prescale < 0)
@@ -237,7 +252,7 @@ static void set_prescaled_volume(void)
237 dsp_callback(DSP_CALLBACK_SET_PRESCALE, prescale); 252 dsp_callback(DSP_CALLBACK_SET_PRESCALE, prescale);
238#elif CONFIG_CODEC == MAS3507D 253#elif CONFIG_CODEC == MAS3507D
239 mas_writereg(MAS_REG_KPRESCALE, prescale_table[prescale/10]); 254 mas_writereg(MAS_REG_KPRESCALE, prescale_table[prescale/10]);
240#elif defined(HAVE_UDA1380) || defined(HAVE_WM8758) 255#elif defined(HAVE_UDA1380)
241 audiohw_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale)); 256 audiohw_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale));
242#endif 257#endif
243 258
@@ -492,6 +507,24 @@ void sound_set_stereo_width(int value)
492#endif 507#endif
493} 508}
494 509
510#ifdef HAVE_WM8758
511void sound_set_bass_cutoff(int value)
512{
513 if(!audio_is_initialized)
514 return;
515
516 audiohw_set_bass_cutoff(value);
517}
518
519void sound_set_treble_cutoff(int value)
520{
521 if(!audio_is_initialized)
522 return;
523
524 audiohw_set_treble_cutoff(value);
525}
526#endif
527
495#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) 528#if (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F)
496void sound_set_loudness(int value) 529void sound_set_loudness(int value)
497{ 530{
@@ -652,6 +685,19 @@ void sound_set_superbass(int value)
652 (void)value; 685 (void)value;
653} 686}
654#endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */ 687#endif /* (CONFIG_CODEC == MAS3587F) || (CONFIG_CODEC == MAS3539F) */
688
689#ifdef HAVE_WM8758
690void sound_set_bass_cutoff(int value)
691{
692 (void) value;
693}
694
695void sound_set_treble_cutoff(int value)
696{
697 (void) value;
698}
699#endif /* HAVE_WM8758 */
700
655#endif /* SIMULATOR */ 701#endif /* SIMULATOR */
656 702
657void sound_set(int setting, int value) 703void sound_set(int setting, int value)