summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio/wm8751.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/audio/wm8751.c')
-rw-r--r--firmware/drivers/audio/wm8751.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c
index 426036aab0..4a17496111 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -31,7 +31,11 @@
31 31
32const struct sound_settings_info audiohw_settings[] = { 32const struct sound_settings_info audiohw_settings[] = {
33 [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, 33 [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25},
34#ifdef USE_ADAPTIVE_BASS
35 [SOUND_BASS] = {"", 0, 1, 0, 15, 0},
36#else
34 [SOUND_BASS] = {"dB", 1, 15, -60, 90, 0}, 37 [SOUND_BASS] = {"dB", 1, 15, -60, 90, 0},
38#endif
35 [SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0}, 39 [SOUND_TREBLE] = {"dB", 1, 15, -60, 90, 0},
36 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 40 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
37 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0}, 41 [SOUND_CHANNELS] = {"", 0, 1, 0, 5, 0},
@@ -47,7 +51,11 @@ const struct sound_settings_info audiohw_settings[] = {
47#define LOUT2_BITS (LOUT2_LO2ZC) 51#define LOUT2_BITS (LOUT2_LO2ZC)
48#define ROUT2_BITS (ROUT2_RO2ZC | ROUT2_RO2VU) 52#define ROUT2_BITS (ROUT2_RO2ZC | ROUT2_RO2VU)
49/* We use linear bass control with 200 Hz cutoff */ 53/* We use linear bass control with 200 Hz cutoff */
54#ifdef USE_ADAPTIVE_BASE
55#define BASSCTRL_BITS (BASSCTRL_BC | BASSCTRL_BB)
56#else
50#define BASSCTRL_BITS (BASSCTRL_BC) 57#define BASSCTRL_BITS (BASSCTRL_BC)
58#endif
51/* We use linear treble control with 4 kHz cutoff */ 59/* We use linear treble control with 4 kHz cutoff */
52#define TREBCTRL_BITS (TREBCTRL_TC) 60#define TREBCTRL_BITS (TREBCTRL_TC)
53 61
@@ -85,6 +93,18 @@ static int tone_tenthdb2hw(int value)
85 return value; 93 return value;
86} 94}
87 95
96
97#ifdef USE_ADAPTIVE_BASS
98static int adaptivebass2hw(int value)
99{
100 /* 0 to 15 step 1 - step -1 0 = off is a 15 in the register */
101 value = 15 - value;
102
103 return value;
104}
105#endif
106
107
88void audiohw_reset(void); 108void audiohw_reset(void);
89 109
90/* Reset and power up the WM8751 */ 110/* Reset and power up the WM8751 */
@@ -162,7 +182,12 @@ int audiohw_set_mixer_vol(int channel1, int channel2)
162void audiohw_set_bass(int value) 182void audiohw_set_bass(int value)
163{ 183{
164 wmcodec_write(BASSCTRL, BASSCTRL_BITS | 184 wmcodec_write(BASSCTRL, BASSCTRL_BITS |
185
186#ifdef USE_ADAPTIVE_BASS
187 BASSCTRL_BASS(adaptivebass2hw(value)));
188#else
165 BASSCTRL_BASS(tone_tenthdb2hw(value))); 189 BASSCTRL_BASS(tone_tenthdb2hw(value)));
190#endif
166} 191}
167 192
168void audiohw_set_treble(int value) 193void audiohw_set_treble(int value)