From 5407edc5ad3d1481611a1fb62e6932d2fbcd3568 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Wed, 14 Aug 2002 12:54:38 +0000 Subject: Another strike against the evil distortion problem git-svn-id: svn://svn.rockbox.org/rockbox/trunk@1732 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/dac.c | 18 ++++++++++++++++-- firmware/drivers/dac.h | 1 + firmware/mpeg.c | 7 +++++++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/firmware/drivers/dac.c b/firmware/drivers/dac.c index 9a40244292..72d4c40cf7 100644 --- a/firmware/drivers/dac.c +++ b/firmware/drivers/dac.c @@ -37,7 +37,7 @@ int dac_volume(unsigned int left, unsigned int right, bool deemph) buf[1] = (left & 0x3f) | (deemph ? 0x40 : 0); buf[2] = right & 0x3f; - /* send read command */ + /* send write command */ if (i2c_write(DAC_DEV_WRITE,buf,3)) { ret = -1; @@ -66,7 +66,7 @@ int dac_config(int value) buf[0] = DAC_REG_WRITE | DAC_GCFG; buf[1] = value; - /* send read command */ + /* send write command */ if (i2c_write(DAC_DEV_WRITE,buf,2)) { ret = -1; @@ -75,3 +75,17 @@ int dac_config(int value) i2c_end(); return ret; } + +void dac_init(void) +{ + unsigned char buf[2]; + + i2c_begin(); + + buf[0] = DAC_REG_WRITE | DAC_SR_REG; + buf[1] = 0x07; + + /* send write command */ + i2c_write(DAC_DEV_WRITE,buf,2); + i2c_end(); +} diff --git a/firmware/drivers/dac.h b/firmware/drivers/dac.h index 9530677bec..c0b2873fda 100644 --- a/firmware/drivers/dac.h +++ b/firmware/drivers/dac.h @@ -34,5 +34,6 @@ extern int dac_volume(unsigned int left, unsigned int right, bool deemph); extern int dac_config(int value); +extern void dac_init(void); #endif diff --git a/firmware/mpeg.c b/firmware/mpeg.c index b6a661f778..ab2fefc872 100644 --- a/firmware/mpeg.c +++ b/firmware/mpeg.c @@ -1327,6 +1327,8 @@ void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, i setup_sci0(); + dac_init(); + #ifdef HAVE_MAS3587F mas_reset(); @@ -1364,6 +1366,11 @@ void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, i #endif #ifdef HAVE_MAS3507D + PBDR &= ~0x20; + sleep(HZ/5); + PBDR |= 0x20; + sleep(HZ/5); + mas_readmem(MAS_BANK_D1, 0xff7, &mas_version_code, 1); mas_writereg(0x3b, 0x20); /* Don't ask why. The data sheet doesn't say */ -- cgit v1.2.3