summaryrefslogtreecommitdiff
path: root/firmware/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers')
-rw-r--r--firmware/drivers/wm8975.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/firmware/drivers/wm8975.c b/firmware/drivers/wm8975.c
index 89e0b155da..9052236131 100644
--- a/firmware/drivers/wm8975.c
+++ b/firmware/drivers/wm8975.c
@@ -53,7 +53,7 @@ int tenthdb2master(int db)
53 /* 1111111 == +6dB (0x7f) */ 53 /* 1111111 == +6dB (0x7f) */
54 /* 1111001 == 0dB (0x79) */ 54 /* 1111001 == 0dB (0x79) */
55 /* 0110000 == -73dB (0x30 */ 55 /* 0110000 == -73dB (0x30 */
56 /* 0101111 == mute (0x2f) */ 56 /* 0101111..0000000 == mute (0x2f) */
57 57
58 if (db < VOLUME_MIN) { 58 if (db < VOLUME_MIN) {
59 return 0x0; 59 return 0x0;
@@ -65,14 +65,8 @@ int tenthdb2master(int db)
65/* convert tenth of dB volume (-780..0) to mixer volume register value */ 65/* convert tenth of dB volume (-780..0) to mixer volume register value */
66int tenthdb2mixer(int db) 66int tenthdb2mixer(int db)
67{ 67{
68 if (db < -660) /* 1.5 dB steps */ 68 (void)db;
69 return (2640 - db) / 15; 69 return 0;
70 else if (db < -600) /* 0.75 dB steps */
71 return (990 - db) * 2 / 15;
72 else if (db < -460) /* 0.5 dB steps */
73 return (460 - db) / 5;
74 else /* 0.25 dB steps */
75 return -db * 2 / 5;
76} 70}
77 71
78 72
@@ -171,25 +165,28 @@ int audiohw_set_mixer_vol(int channel1, int channel2)
171 return 0; 165 return 0;
172} 166}
173 167
174/* We are using Linear bass control */
175void audiohw_set_bass(int value) 168void audiohw_set_bass(int value)
176{ 169{
177 int regvalues[]={11, 10, 10, 9, 8, 8, 0xf , 6, 6, 5, 4, 4, 3, 2, 1, 0}; 170 const int regvalues[] = {
171 11, 10, 10, 9, 8, 8, 0xf, 6, 6, 5, 4, 4, 3, 2, 1, 0
172 };
178 173
179 if ((value >= -6) && (value <= 9)) { 174 if ((value >= -6) && (value <= 9)) {
180 /* We use linear bass control with 130Hz cutoff */ 175 /* We use linear bass control with 200 Hz cutoff */
181 wmcodec_write(BASSCTRL, regvalues[value+6]); 176 wmcodec_write(BASSCTRL, regvalues[value + 6] | 0x40);
182 } 177 }
183} 178}
184 179
185void audiohw_set_treble(int value) 180void audiohw_set_treble(int value)
186{ 181{
187 int regvalues[]={11, 10, 10, 9, 8, 8, 0xf , 6, 6, 5, 4, 4, 3, 2, 1, 0}; 182 const int regvalues[] = {
183 11, 10, 10, 9, 8, 8, 0xf, 6, 6, 5, 4, 4, 3, 2, 1, 0
184 };
188 185
189 if ((value >= -6) && (value <= 9)) { 186 if ((value >= -6) && (value <= 9)) {
190 /* We use a 8Khz cutoff */ 187 /* We use linear treble control with 4 kHz cutoff */
191 wmcodec_write(TREBCTRL, regvalues[value+6]); 188 wmcodec_write(TREBCTRL, regvalues[value + 6] | 0x40);
192 } 189 }
193} 190}
194 191
195int audiohw_mute(int mute) 192int audiohw_mute(int mute)