summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2010-05-11 04:02:45 +0000
committerMichael Sevakis <jethead71@rockbox.org>2010-05-11 04:02:45 +0000
commit8ce5b01ec717a8ee1d765ec9c0d4d6f20868092e (patch)
tree00469290ec43bbf5493c14226d766a164b6562d6 /firmware/drivers/audio
parent7d21e5ab32ef24724c201b5ffc4df3a2637966e7 (diff)
downloadrockbox-8ce5b01ec717a8ee1d765ec9c0d4d6f20868092e.tar.gz
rockbox-8ce5b01ec717a8ee1d765ec9c0d4d6f20868092e.zip
MRobe100, HD200, Gigabeat F/X (anything with wm8750 or wm8751). Properly prescale bass and treble controls to avoid clipping.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25940 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/audio')
-rw-r--r--firmware/drivers/audio/wm8751.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c
index 18441826d4..e7c0b18da3 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -61,6 +61,8 @@ const struct sound_settings_info audiohw_settings[] = {
61/* We use linear treble control with 4 kHz cutoff */ 61/* We use linear treble control with 4 kHz cutoff */
62#define TREBCTRL_BITS (TREBCTRL_TC) 62#define TREBCTRL_BITS (TREBCTRL_TC)
63 63
64static int prescaler = 0;
65
64/* convert tenth of dB volume (-730..60) to master volume register value */ 66/* convert tenth of dB volume (-730..60) to master volume register value */
65int tenthdb2master(int db) 67int tenthdb2master(int db)
66{ 68{
@@ -173,6 +175,10 @@ void audiohw_postinit(void)
173 PWRMGMT2_ROUT2); 175 PWRMGMT2_ROUT2);
174#endif 176#endif
175 177
178 /* Full -0dB on the DACS */
179 wmcodec_write(LEFTGAIN, 0xff);
180 wmcodec_write(RIGHTGAIN, RIGHTGAIN_RDVU | 0xff);
181
176 wmcodec_write(ADDITIONAL1, ADDITIONAL1_TSDEN | ADDITIONAL1_TOEN | 182 wmcodec_write(ADDITIONAL1, ADDITIONAL1_TSDEN | ADDITIONAL1_TOEN |
177 ADDITIONAL1_DMONOMIX_LLRR | ADDITIONAL1_VSEL_DEFAULT); 183 ADDITIONAL1_DMONOMIX_LLRR | ADDITIONAL1_VSEL_DEFAULT);
178 184
@@ -249,6 +255,14 @@ void audiohw_set_treble(int value)
249 TREBCTRL_TREB(tone_tenthdb2hw(value))); 255 TREBCTRL_TREB(tone_tenthdb2hw(value)));
250} 256}
251 257
258void audiohw_set_prescaler(int value)
259{
260 prescaler = 2 * value;
261 wmcodec_write(LEFTGAIN, 0xff - (prescaler & LEFTGAIN_LDACVOL));
262 wmcodec_write(RIGHTGAIN, RIGHTGAIN_RDVU |
263 (0xff - (prescaler & RIGHTGAIN_RDACVOL)));
264}
265
252/* Nice shutdown of WM8751 codec */ 266/* Nice shutdown of WM8751 codec */
253void audiohw_close(void) 267void audiohw_close(void)
254{ 268{