summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--firmware/drivers/dac.c18
-rw-r--r--firmware/drivers/dac.h1
-rw-r--r--firmware/mpeg.c7
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)
37 buf[1] = (left & 0x3f) | (deemph ? 0x40 : 0); 37 buf[1] = (left & 0x3f) | (deemph ? 0x40 : 0);
38 buf[2] = right & 0x3f; 38 buf[2] = right & 0x3f;
39 39
40 /* send read command */ 40 /* send write command */
41 if (i2c_write(DAC_DEV_WRITE,buf,3)) 41 if (i2c_write(DAC_DEV_WRITE,buf,3))
42 { 42 {
43 ret = -1; 43 ret = -1;
@@ -66,7 +66,7 @@ int dac_config(int value)
66 buf[0] = DAC_REG_WRITE | DAC_GCFG; 66 buf[0] = DAC_REG_WRITE | DAC_GCFG;
67 buf[1] = value; 67 buf[1] = value;
68 68
69 /* send read command */ 69 /* send write command */
70 if (i2c_write(DAC_DEV_WRITE,buf,2)) 70 if (i2c_write(DAC_DEV_WRITE,buf,2))
71 { 71 {
72 ret = -1; 72 ret = -1;
@@ -75,3 +75,17 @@ int dac_config(int value)
75 i2c_end(); 75 i2c_end();
76 return ret; 76 return ret;
77} 77}
78
79void dac_init(void)
80{
81 unsigned char buf[2];
82
83 i2c_begin();
84
85 buf[0] = DAC_REG_WRITE | DAC_SR_REG;
86 buf[1] = 0x07;
87
88 /* send write command */
89 i2c_write(DAC_DEV_WRITE,buf,2);
90 i2c_end();
91}
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 @@
34 34
35extern int dac_volume(unsigned int left, unsigned int right, bool deemph); 35extern int dac_volume(unsigned int left, unsigned int right, bool deemph);
36extern int dac_config(int value); 36extern int dac_config(int value);
37extern void dac_init(void);
37 38
38#endif 39#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
1327 1327
1328 setup_sci0(); 1328 setup_sci0();
1329 1329
1330 dac_init();
1331
1330#ifdef HAVE_MAS3587F 1332#ifdef HAVE_MAS3587F
1331 mas_reset(); 1333 mas_reset();
1332 1334
@@ -1364,6 +1366,11 @@ void mpeg_init(int volume, int bass, int treble, int loudness, int bass_boost, i
1364#endif 1366#endif
1365 1367
1366#ifdef HAVE_MAS3507D 1368#ifdef HAVE_MAS3507D
1369 PBDR &= ~0x20;
1370 sleep(HZ/5);
1371 PBDR |= 0x20;
1372 sleep(HZ/5);
1373
1367 mas_readmem(MAS_BANK_D1, 0xff7, &mas_version_code, 1); 1374 mas_readmem(MAS_BANK_D1, 0xff7, &mas_version_code, 1);
1368 1375
1369 mas_writereg(0x3b, 0x20); /* Don't ask why. The data sheet doesn't say */ 1376 mas_writereg(0x3b, 0x20); /* Don't ask why. The data sheet doesn't say */