summaryrefslogtreecommitdiff
path: root/firmware/drivers
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
parent7d21e5ab32ef24724c201b5ffc4df3a2637966e7 (diff)
downloadrockbox-8ce5b01ec717a8ee1d765ec9c0d4d6f20868092e.zip
rockbox-8ce5b01ec717a8ee1d765ec9c0d4d6f20868092e.tar.gz
rockbox-8ce5b01ec717a8ee1d765ec9c0d4d6f20868092e.tar.bz2
rockbox-8ce5b01ec717a8ee1d765ec9c0d4d6f20868092e.tar.xz
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')
-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 1844182..e7c0b18 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -61,6 +61,8 @@ const struct sound_settings_info audiohw_settings[] = {
/* We use linear treble control with 4 kHz cutoff */
#define TREBCTRL_BITS (TREBCTRL_TC)
+static int prescaler = 0;
+
/* convert tenth of dB volume (-730..60) to master volume register value */
int tenthdb2master(int db)
{
@@ -173,6 +175,10 @@ void audiohw_postinit(void)
PWRMGMT2_ROUT2);
#endif
+ /* Full -0dB on the DACS */
+ wmcodec_write(LEFTGAIN, 0xff);
+ wmcodec_write(RIGHTGAIN, RIGHTGAIN_RDVU | 0xff);
+
wmcodec_write(ADDITIONAL1, ADDITIONAL1_TSDEN | ADDITIONAL1_TOEN |
ADDITIONAL1_DMONOMIX_LLRR | ADDITIONAL1_VSEL_DEFAULT);
@@ -249,6 +255,14 @@ void audiohw_set_treble(int value)
TREBCTRL_TREB(tone_tenthdb2hw(value)));
}
+void audiohw_set_prescaler(int value)
+{
+ prescaler = 2 * value;
+ wmcodec_write(LEFTGAIN, 0xff - (prescaler & LEFTGAIN_LDACVOL));
+ wmcodec_write(RIGHTGAIN, RIGHTGAIN_RDVU |
+ (0xff - (prescaler & RIGHTGAIN_RDACVOL)));
+}
+
/* Nice shutdown of WM8751 codec */
void audiohw_close(void)
{