diff options
Diffstat (limited to 'firmware/drivers')
-rw-r--r-- | firmware/drivers/audio/as3514.c | 38 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_as3514.c | 5 |
2 files changed, 7 insertions, 36 deletions
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index 97117e48c3..db4cb0699f 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c | |||
@@ -29,7 +29,7 @@ | |||
29 | 29 | ||
30 | #include "audiohw.h" | 30 | #include "audiohw.h" |
31 | #include "i2s.h" | 31 | #include "i2s.h" |
32 | #include "i2c-pp.h" | 32 | #include "ascodec.h" |
33 | 33 | ||
34 | const struct sound_settings_info audiohw_settings[] = { | 34 | const struct sound_settings_info audiohw_settings[] = { |
35 | [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, | 35 | [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, |
@@ -71,7 +71,7 @@ static unsigned int source = SOURCE_DAC; | |||
71 | */ | 71 | */ |
72 | static void as3514_write(unsigned int reg, unsigned int value) | 72 | static void as3514_write(unsigned int reg, unsigned int value) |
73 | { | 73 | { |
74 | if (pp_i2c_send(AS3514_I2C_ADDR, reg, value) != 2) | 74 | if (ascodec_write(reg, value) != 2) |
75 | { | 75 | { |
76 | DEBUGF("as3514 error reg=0x%02x", reg); | 76 | DEBUGF("as3514 error reg=0x%02x", reg); |
77 | } | 77 | } |
@@ -135,36 +135,10 @@ int sound_val2phys(int setting, int value) | |||
135 | /* | 135 | /* |
136 | * Initialise the PP I2C and I2S. | 136 | * Initialise the PP I2C and I2S. |
137 | */ | 137 | */ |
138 | void audiohw_init(void) | 138 | void audiohw_preinit(void) |
139 | { | 139 | { |
140 | unsigned int i; | 140 | unsigned int i; |
141 | 141 | ||
142 | /* normal outputs for CDI and I2S pin groups */ | ||
143 | DEV_INIT2 &= ~0x300; | ||
144 | |||
145 | /*mini2?*/ | ||
146 | DEV_INIT1 &=~0x3000000; | ||
147 | /*mini2?*/ | ||
148 | |||
149 | /* device reset */ | ||
150 | DEV_RS |= DEV_I2S; | ||
151 | DEV_RS &=~DEV_I2S; | ||
152 | |||
153 | /* I2S device reset */ | ||
154 | DEV_RS |= DEV_I2S; | ||
155 | DEV_RS &=~DEV_I2S; | ||
156 | |||
157 | /* I2S device enable */ | ||
158 | DEV_EN |= DEV_I2S; | ||
159 | |||
160 | /* enable external dev clock clocks */ | ||
161 | DEV_EN |= DEV_EXTCLOCKS; | ||
162 | |||
163 | /* external dev clock to 24MHz */ | ||
164 | outl(inl(0x70000018) & ~0xc, 0x70000018); | ||
165 | |||
166 | i2s_reset(); | ||
167 | |||
168 | /* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */ | 142 | /* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */ |
169 | 143 | ||
170 | /* Turn on SUM, DAC */ | 144 | /* Turn on SUM, DAC */ |
@@ -199,14 +173,10 @@ void audiohw_init(void) | |||
199 | /* read all reg values */ | 173 | /* read all reg values */ |
200 | for (i = 0; i < ARRAYLEN(as3514.regs); i++) | 174 | for (i = 0; i < ARRAYLEN(as3514.regs); i++) |
201 | { | 175 | { |
202 | as3514.regs[i] = i2c_readbyte(AS3514_I2C_ADDR, i); | 176 | as3514.regs[i] = ascodec_read(i); |
203 | } | 177 | } |
204 | } | 178 | } |
205 | 179 | ||
206 | void audiohw_postinit(void) | ||
207 | { | ||
208 | } | ||
209 | |||
210 | /* Silently enable / disable audio output */ | 180 | /* Silently enable / disable audio output */ |
211 | void audiohw_enable_output(bool enable) | 181 | void audiohw_enable_output(bool enable) |
212 | { | 182 | { |
diff --git a/firmware/drivers/rtc/rtc_as3514.c b/firmware/drivers/rtc/rtc_as3514.c index 65d8359e08..878f204a4e 100644 --- a/firmware/drivers/rtc/rtc_as3514.c +++ b/firmware/drivers/rtc/rtc_as3514.c | |||
@@ -22,6 +22,7 @@ | |||
22 | #include "rtc.h" | 22 | #include "rtc.h" |
23 | #include "i2c-pp.h" | 23 | #include "i2c-pp.h" |
24 | #include "as3514.h" | 24 | #include "as3514.h" |
25 | #include "ascodec.h" | ||
25 | 26 | ||
26 | #define MINUTE_SECONDS 60 | 27 | #define MINUTE_SECONDS 60 |
27 | #define HOUR_SECONDS 3600 | 28 | #define HOUR_SECONDS 3600 |
@@ -57,7 +58,7 @@ int rtc_read_datetime(unsigned char* buf) | |||
57 | 58 | ||
58 | /* RTC_AS3514's slave address is 0x46*/ | 59 | /* RTC_AS3514's slave address is 0x46*/ |
59 | for (i=0;i<4;i++){ | 60 | for (i=0;i<4;i++){ |
60 | tmp[i] = i2c_readbyte(AS3514_I2C_ADDR, AS3514_RTC_0 + i); | 61 | tmp[i] = ascodec_read(AS3514_RTC_0 + i); |
61 | } | 62 | } |
62 | seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24); | 63 | seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24); |
63 | 64 | ||
@@ -162,7 +163,7 @@ int rtc_write_datetime(unsigned char* buf) | |||
162 | 163 | ||
163 | /* Send data to RTC */ | 164 | /* Send data to RTC */ |
164 | for (i=0;i<4;i++){ | 165 | for (i=0;i<4;i++){ |
165 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff)); | 166 | ascodec_write(AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff)); |
166 | } | 167 | } |
167 | return 1; | 168 | return 1; |
168 | } | 169 | } |