summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorAntonius Hellmann <toni@rockbox.org>2007-05-04 10:28:07 +0000
committerAntonius Hellmann <toni@rockbox.org>2007-05-04 10:28:07 +0000
commit621cf0788fd69c967688692b7f19c02b6df7a322 (patch)
treeeb84928b456fba6f45cba58e0e94e446a74e790d /firmware
parentd68a51680f29afddac040dbebf1eeb5c4612ffa9 (diff)
downloadrockbox-621cf0788fd69c967688692b7f19c02b6df7a322.tar.gz
rockbox-621cf0788fd69c967688692b7f19c02b6df7a322.zip
bugfixes in AS3514 shadow register handling, for details see patch #7101
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13319 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/audio/as3514.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c
index 89761fbbe0..3490abdd2d 100644
--- a/firmware/drivers/audio/as3514.c
+++ b/firmware/drivers/audio/as3514.c
@@ -28,7 +28,7 @@
#include "i2c-pp.h"
/* Shadow registers */
-int as3514_regs[0x1D];
+int as3514_regs[0x1E]; /* last audio register: PLLMODE 0x1d */
/*
* little helper method to set register values.
@@ -41,7 +41,15 @@ static void as3514_write(int reg, int value)
{
DEBUGF("as3514 error reg=0x%x", reg);
}
- as3514_regs[reg] = value;
+
+ if ((unsigned int)reg < sizeof(as3514_regs) / sizeof(int))
+ {
+ as3514_regs[reg] = value;
+ }
+ else
+ {
+ DEBUGF("as3514 error reg=0x%x", reg);
+ }
}
/* convert tenth of dB volume to master volume register value */
@@ -104,7 +112,7 @@ int audiohw_init(void)
as3514_write(PLLMODE, 0x04);
/* read all reg values */
- for (i = 0; i < sizeof(as3514_regs); i++)
+ for (i = 0; i < sizeof(as3514_regs) / sizeof(int); i++)
{
as3514_regs[i] = i2c_readbyte(AS3514_I2C_ADDR, i);
}