summaryrefslogtreecommitdiff
path: root/firmware/target/arm/as3525
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm/as3525')
-rw-r--r--firmware/target/arm/as3525/ascodec-as3525.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/firmware/target/arm/as3525/ascodec-as3525.c b/firmware/target/arm/as3525/ascodec-as3525.c
index 9d13994cbc..4f13dd6300 100644
--- a/firmware/target/arm/as3525/ascodec-as3525.c
+++ b/firmware/target/arm/as3525/ascodec-as3525.c
@@ -65,12 +65,15 @@ void i2c_init(void)
65/* initialises the internal i2c bus and prepares for transfers to the codec */ 65/* initialises the internal i2c bus and prepares for transfers to the codec */
66void ascodec_init(void) 66void ascodec_init(void)
67{ 67{
68 int prescaler;
69
68 /* enable clock */ 70 /* enable clock */
69 CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE; 71 CGU_PERI |= CGU_I2C_AUDIO_MASTER_CLOCK_ENABLE;
70 72
71 /* prescaler for i2c clock */ 73 /* prescaler for i2c clock */
72 I2C2_CPSR0 = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ); 74 prescaler = CLK_DIV(AS3525_PCLK_FREQ, AS3525_I2C_FREQ);
73 I2C2_CPSR1 = 0; /* MSB */ 75 I2C2_CPSR0 = prescaler & 0xFF;
76 I2C2_CPSR1 = (prescaler >> 8) & 0xFF;
74 77
75 /* set i2c slave address of codec part */ 78 /* set i2c slave address of codec part */
76 I2C2_SLAD0 = AS3514_I2C_ADDR << 1; 79 I2C2_SLAD0 = AS3514_I2C_ADDR << 1;