summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/CREDITS1
-rw-r--r--firmware/drivers/audio/wm8985.c75
-rw-r--r--firmware/export/wm8985.h2
-rw-r--r--manual/appendix/config_file_options.tex2
-rw-r--r--manual/configure_rockbox/sound_settings.tex3
5 files changed, 63 insertions, 20 deletions
diff --git a/docs/CREDITS b/docs/CREDITS
index dde1f751e5..f7b0c5bc20 100644
--- a/docs/CREDITS
+++ b/docs/CREDITS
@@ -542,6 +542,7 @@ Luca Leonardo Scorcia
542Gerhard Zintel 542Gerhard Zintel
543Adrián Cereto Massagué 543Adrián Cereto Massagué
544Chris Savery 544Chris Savery
545Raphaël Jakse
545 546
546The libmad team 547The libmad team
547The wavpack team 548The wavpack team
diff --git a/firmware/drivers/audio/wm8985.c b/firmware/drivers/audio/wm8985.c
index da08b44402..a76e20e57b 100644
--- a/firmware/drivers/audio/wm8985.c
+++ b/firmware/drivers/audio/wm8985.c
@@ -42,6 +42,7 @@
42#define ADCCTL 0x0e 42#define ADCCTL 0x0e
43#define LADCVOL 0x0f 43#define LADCVOL 0x0f
44#define RADCVOL 0x10 44#define RADCVOL 0x10
45#define RDACVOL_DACVU 0x100
45 46
46#define EQ1 0x12 47#define EQ1 0x12
47#define EQ2 0x13 48#define EQ2 0x13
@@ -88,7 +89,7 @@
88#define BIASCTL 0x3d 89#define BIASCTL 0x3d
89 90
90const struct sound_settings_info audiohw_settings[] = { 91const struct sound_settings_info audiohw_settings[] = {
91 [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25}, 92 [SOUND_VOLUME] = {"dB", 0, 1, -90, 6, -25},
92 [SOUND_BASS] = {"dB", 0, 1, -12, 12, 0}, 93 [SOUND_BASS] = {"dB", 0, 1, -12, 12, 0},
93 [SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 0}, 94 [SOUND_TREBLE] = {"dB", 0, 1, -12, 12, 0},
94 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0}, 95 [SOUND_BALANCE] = {"%", 0, 1,-100, 100, 0},
@@ -111,21 +112,48 @@ const struct sound_settings_info audiohw_settings[] = {
111unsigned int eq1_reg; 112unsigned int eq1_reg;
112unsigned int eq5_reg; 113unsigned int eq5_reg;
113 114
114/* convert tenth of dB volume (-57..6) to master volume register value */ 115/* convert tenth of dB volume (-89..6) to master volume register value */
115int tenthdb2master(int db) 116int tenthdb2master(int db)
116{ 117{
117 /* +6 to -57dB in 1dB steps == 64 levels = 6 bits */ 118 /* Might have no sense, taken from wm8758.c :
118 /* 0111111 == +6dB (0x3f) = 63) */ 119 att DAC AMP result
119 /* 0111001 == 0dB (0x39) = 57) */ 120 +6dB 0 +6 96
120 /* 0000001 == -56dB (0x01) = */ 121 0dB 0 0 90
121 /* 0000000 == -57dB (0x00) */ 122 -57dB 0 -57 33
122 123 -58dB -1 -57 32
123 /* 1000000 == Mute (0x40) */ 124 -89dB -32 -57 1
125 -90dB -oo -oo 0 */
124 126
125 if (db < VOLUME_MIN) { 127 if (db < VOLUME_MIN) {
126 return 0x40; 128 return 0;
127 } else { 129 } else {
128 return((db/10)+57); 130 return (db-VOLUME_MIN)/10 + 1;
131 }
132}
133
134 /* helper function coming from wm8758.c that calculates the register setting for amplifier and
135 DAC volume out of the input from tenthdb2master() */
136static void get_volume_params(int db, int *dac, int *amp)
137{
138 /* should never happen, set max volume for amp and dac */
139 if (db > 96) {
140 *dac = 255;
141 *amp = 63;
142 }
143 /* set dac to max and set volume for amp (better snr) */
144 else if (db > 32) {
145 *dac = 255;
146 *amp = (db-90)+57;
147 }
148 /* set amp to min and reduce dac output */
149 else if (db > 0) {
150 *dac = (db-33)*2 + 255;
151 *amp = 0;
152 }
153 /* mute all */
154 else {
155 *dac = 0x00;
156 *amp = 0x40;
129 } 157 }
130} 158}
131 159
@@ -190,16 +218,29 @@ void audiohw_postinit(void)
190 218
191void audiohw_set_headphone_vol(int vol_l, int vol_r) 219void audiohw_set_headphone_vol(int vol_l, int vol_r)
192{ 220{
193 /* OUT1 */ 221 int dac_l, amp_l, dac_r, amp_r;
194 wmcodec_write(LOUT1VOL, 0x080 | vol_l); 222 get_volume_params(vol_l, &dac_l, &amp_l);
195 wmcodec_write(ROUT1VOL, 0x180 | vol_r); 223 get_volume_params(vol_r, &dac_r, &amp_r);
224
225 /* set DAC
226 Important: DAC is global and will also affect lineout */
227 wmcodec_write(LDACVOL, dac_l);
228 wmcodec_write(RDACVOL, dac_r | RDACVOL_DACVU);
229
230 /* set headphone amp OUT1 */
231 wmcodec_write(LOUT1VOL, amp_l | 0x080);
232 wmcodec_write(ROUT1VOL, amp_r | 0x180);
196} 233}
197 234
198void audiohw_set_lineout_vol(int vol_l, int vol_r) 235void audiohw_set_lineout_vol(int vol_l, int vol_r)
199{ 236{
200 /* OUT2 */ 237 int dac_l, amp_l, dac_r, amp_r;
201 wmcodec_write(LOUT2VOL, vol_l); 238 get_volume_params(vol_l, &dac_l, &amp_l);
202 wmcodec_write(ROUT2VOL, 0x100 | vol_r); 239 get_volume_params(vol_r, &dac_r, &amp_r);
240
241 /* set lineout amp OUT2 */
242 wmcodec_write(LOUT2VOL, amp_l);
243 wmcodec_write(ROUT2VOL, amp_r | 0x100);
203} 244}
204 245
205void audiohw_set_aux_vol(int vol_l, int vol_r) 246void audiohw_set_aux_vol(int vol_l, int vol_r)
diff --git a/firmware/export/wm8985.h b/firmware/export/wm8985.h
index c6b8e3825f..4538b5edc5 100644
--- a/firmware/export/wm8985.h
+++ b/firmware/export/wm8985.h
@@ -23,7 +23,7 @@
23#define _WM8985_H 23#define _WM8985_H
24 24
25/* volume/balance/treble/bass interdependency */ 25/* volume/balance/treble/bass interdependency */
26#define VOLUME_MIN -570 26#define VOLUME_MIN -890
27#define VOLUME_MAX 60 27#define VOLUME_MAX 60
28 28
29#ifdef COWON_D2 29#ifdef COWON_D2
diff --git a/manual/appendix/config_file_options.tex b/manual/appendix/config_file_options.tex
index e70a020e26..c4c1dfa223 100644
--- a/manual/appendix/config_file_options.tex
+++ b/manual/appendix/config_file_options.tex
@@ -16,7 +16,7 @@
16 \opt{h100,h300}{-84 to 0}% 16 \opt{h100,h300}{-84 to 0}%
17 \opt{ipodnano}{-72 to +6}% 17 \opt{ipodnano}{-72 to +6}%
18 \opt{ipodnano2g}{-74 to +6}% 18 \opt{ipodnano2g}{-74 to +6}%
19 \opt{ipodvideo}{-89 to +6}% 19 \opt{ipodvideo,cowond2}{-89 to +6}%
20 \opt{x5}{-73 to +6} 20 \opt{x5}{-73 to +6}
21 \opt{e200,e200v2}{-74 to +6} 21 \opt{e200,e200v2}{-74 to +6}
22 \opt{ipodcolor,vibe500}{-74 to +6}% 22 \opt{ipodcolor,vibe500}{-74 to +6}%
diff --git a/manual/configure_rockbox/sound_settings.tex b/manual/configure_rockbox/sound_settings.tex
index b239efbb1e..7d13c2fe3a 100644
--- a/manual/configure_rockbox/sound_settings.tex
+++ b/manual/configure_rockbox/sound_settings.tex
@@ -22,13 +22,14 @@ change to customise your listening experience.
22 \opt{h100,h300}{minimum of -84~dB to a maximum of 0~dB.}% 22 \opt{h100,h300}{minimum of -84~dB to a maximum of 0~dB.}%
23 \opt{x5,m5,ipod3g,ipod4g,gigabeatf,mrobe100}{minimum of -73~dB to a maximum of +6~dB.}% 23 \opt{x5,m5,ipod3g,ipod4g,gigabeatf,mrobe100}{minimum of -73~dB to a maximum of +6~dB.}%
24 \opt{ipodnano}{minimum of -72~dB to a maximum of +6~dB.}% 24 \opt{ipodnano}{minimum of -72~dB to a maximum of +6~dB.}%
25 \opt{ipodvideo}{minimum of -89~dB to a maximum of +6~dB.}% 25 \opt{ipodvideo,cowond2}{minimum of -89~dB to a maximum of +6~dB.}%
26 \opt{ipodnano2g,ipodcolor,ipod1g2g,h10,h10_5gb,sansa,sansaAMS}{minimum of 26 \opt{ipodnano2g,ipodcolor,ipod1g2g,h10,h10_5gb,sansa,sansaAMS}{minimum of
27 -74~dB to a maximum of +6~dB.}% 27 -74~dB to a maximum of +6~dB.}%
28 \opt{gigabeats}{minimum of -90~dB to a maximum of +6~dB.}% 28 \opt{gigabeats}{minimum of -90~dB to a maximum of +6~dB.}%
29 \opt{gigabeatf,vibe500}{minimum of -74~dB to a maximum of +6~dB.}% 29 \opt{gigabeatf,vibe500}{minimum of -74~dB to a maximum of +6~dB.}%
30 \opt{ipodvideo}{\\Remark: Lowering the volume below -57~dB will also affect the line-out 30 \opt{ipodvideo}{\\Remark: Lowering the volume below -57~dB will also affect the line-out
31 and the recording gain.} 31 and the recording gain.}
32 \opt{cowond2}{\\Remark: Lowering the volume below -57~dB will also affect the line-out.}
32 33
33\section{Bass} 34\section{Bass}
34 This setting emphasises 35 This setting emphasises