forked from len0rd/rockbox
Allow a clock divider larger than 255 for the internal i2c bus to the as3525 ascodec.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20861 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
330f9359e2
commit
b5886beb81
1 changed files with 5 additions and 2 deletions
|
@ -65,12 +65,15 @@ void i2c_init(void)
|
||||||
/* initialises the internal i2c bus and prepares for transfers to the codec */
|
/* initialises the internal i2c bus and prepares for transfers to the codec */
|
||||||
void ascodec_init(void)
|
void ascodec_init(void)
|
||||||
{
|
{
|
||||||
|
int prescaler;
|
||||||
|
|
||||||
/* enable clock */
|
/* enable clock */
|
||||||
CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE;
|
CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE;
|
||||||
|
|
||||||
/* prescaler for i2c clock */
|
/* prescaler for i2c clock */
|
||||||
I2C2_CPSR0 = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ);
|
prescaler = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ);
|
||||||
I2C2_CPSR1 = 0; /* MSB */
|
I2C2_CPSR0 = prescaler & 0xFF;
|
||||||
|
I2C2_CPSR1 = (prescaler >> 8) & 0xFF;
|
||||||
|
|
||||||
/* set i2c slave address of codec part */
|
/* set i2c slave address of codec part */
|
||||||
I2C2_SLAD0 = AS3514_I2C_ADDR << 1;
|
I2C2_SLAD0 = AS3514_I2C_ADDR << 1;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue