diff options
-rw-r--r-- | apps/debug_menu.c | 2 | ||||
-rw-r--r-- | firmware/drivers/audio/as3514.c | 96 | ||||
-rw-r--r-- | firmware/drivers/rtc/rtc_as3514.c | 4 | ||||
-rw-r--r-- | firmware/export/as3514.h | 75 | ||||
-rw-r--r-- | firmware/target/arm/i2c-pp.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/adc-c200_e200.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/backlight-c200_e200.c | 4 | ||||
-rw-r--r-- | firmware/target/arm/sandisk/power-c200_e200.c | 4 | ||||
-rw-r--r-- | firmware/usbstack/usb_core.c | 2 |
9 files changed, 99 insertions, 94 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c index e167b1f329..55a4dfd14d 100644 --- a/apps/debug_menu.c +++ b/apps/debug_menu.c | |||
@@ -1220,7 +1220,7 @@ bool dbg_ports(void) | |||
1220 | lcd_puts(0, line++, buf); | 1220 | lcd_puts(0, line++, buf); |
1221 | snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT)); | 1221 | snprintf(buf, sizeof(buf), "ADC_VBAT: %4d", adc_read(ADC_VBAT)); |
1222 | lcd_puts(0, line++, buf); | 1222 | lcd_puts(0, line++, buf); |
1223 | snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X", i2c_readbyte(AS3514_I2C_ADDR, CHRGR), i2c_readbyte(AS3514_I2C_ADDR, IRQ_ENRD0)); | 1223 | snprintf(buf, sizeof(buf), "CHARGER: %02X/%02X", i2c_readbyte(AS3514_I2C_ADDR, AS3514_CHARGER), i2c_readbyte(AS3514_I2C_ADDR, AS3514_IRQ_ENRD0)); |
1224 | lcd_puts(0, line++, buf); | 1224 | lcd_puts(0, line++, buf); |
1225 | #endif | 1225 | #endif |
1226 | lcd_update(); | 1226 | lcd_update(); |
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index d51341d8c3..bcc6ba1da2 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c | |||
@@ -161,33 +161,33 @@ void audiohw_init(void) | |||
161 | /* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */ | 161 | /* Set ADC off, mixer on, DAC on, line out off, line in off, mic off */ |
162 | 162 | ||
163 | /* Turn on SUM, DAC */ | 163 | /* Turn on SUM, DAC */ |
164 | as3514_write(AUDIOSET1, (1 << 6) | (1 << 5)); | 164 | as3514_write(AS3514_AUDIOSET1, (1 << 6) | (1 << 5)); |
165 | 165 | ||
166 | /* Set BIAS on, DITH on, AGC on, IBR_DAC max, LSP_LP on, IBR_LSP min */ | 166 | /* Set BIAS on, DITH on, AGC on, IBR_DAC max, LSP_LP on, IBR_LSP min */ |
167 | as3514_write(AUDIOSET2, (1 << 2) | (3 << 0)); | 167 | as3514_write(AS3514_AUDIOSET2, (1 << 2) | (3 << 0)); |
168 | 168 | ||
169 | /* Set HPCM off, ZCU off*/ | 169 | /* Set HPCM off, ZCU off*/ |
170 | as3514_write(AUDIOSET3, (1 << 2) | (1 << 0)); | 170 | as3514_write(AS3514_AUDIOSET3, (1 << 2) | (1 << 0)); |
171 | 171 | ||
172 | /* Mute and disable speaker */ | 172 | /* Mute and disable speaker */ |
173 | as3514_write(LSP_OUT_R, 0); | 173 | as3514_write(AS3514_LSP_OUT_R, 0); |
174 | as3514_write(LSP_OUT_L, (1 << 7)); | 174 | as3514_write(AS3514_LSP_OUT_L, (1 << 7)); |
175 | 175 | ||
176 | /* set vol and set headphone over-current to 0 */ | 176 | /* set vol and set headphone over-current to 0 */ |
177 | as3514_write(HPH_OUT_R, (0x3 << 6) | 0x16); | 177 | as3514_write(AS3514_HPH_OUT_R, (0x3 << 6) | 0x16); |
178 | /* set default vol for headphone */ | 178 | /* set default vol for headphone */ |
179 | as3514_write(HPH_OUT_L, 0x16); | 179 | as3514_write(AS3514_HPH_OUT_L, 0x16); |
180 | 180 | ||
181 | /* LRCK 24-48kHz */ | 181 | /* LRCK 24-48kHz */ |
182 | as3514_write(PLLMODE, 0x00); | 182 | as3514_write(AS3514_PLLMODE, 0x00); |
183 | 183 | ||
184 | /* DAC_Mute_off */ | 184 | /* DAC_Mute_off */ |
185 | as3514_write_or(DAC_L, (1 << 6)); | 185 | as3514_write_or(AS3514_DAC_L, (1 << 6)); |
186 | 186 | ||
187 | /* M1_Sup_off */ | 187 | /* M1_Sup_off */ |
188 | as3514_write_or(MIC1_L, (1 << 7)); | 188 | as3514_write_or(AS3514_MIC1_L, (1 << 7)); |
189 | /* M2_Sup_off */ | 189 | /* M2_Sup_off */ |
190 | as3514_write_or(MIC2_L, (1 << 7)); | 190 | as3514_write_or(AS3514_MIC2_L, (1 << 7)); |
191 | 191 | ||
192 | /* read all reg values */ | 192 | /* read all reg values */ |
193 | for (i = 0; i < ARRAYLEN(as3514.regs); i++) | 193 | for (i = 0; i < ARRAYLEN(as3514.regs); i++) |
@@ -207,18 +207,18 @@ void audiohw_enable_output(bool enable) | |||
207 | /* reset the I2S controller into known state */ | 207 | /* reset the I2S controller into known state */ |
208 | i2s_reset(); | 208 | i2s_reset(); |
209 | 209 | ||
210 | as3514_write_or(HPH_OUT_L, (1 << 6)); /* power on */ | 210 | as3514_write_or(AS3514_HPH_OUT_L, (1 << 6)); /* power on */ |
211 | audiohw_mute(0); | 211 | audiohw_mute(0); |
212 | } else { | 212 | } else { |
213 | audiohw_mute(1); | 213 | audiohw_mute(1); |
214 | as3514_write_and(HPH_OUT_L, ~(1 << 6)); /* power off */ | 214 | as3514_write_and(AS3514_HPH_OUT_L, ~(1 << 6)); /* power off */ |
215 | } | 215 | } |
216 | } | 216 | } |
217 | 217 | ||
218 | void audiohw_set_master_vol(int vol_l, int vol_r) | 218 | void audiohw_set_master_vol(int vol_l, int vol_r) |
219 | { | 219 | { |
220 | unsigned int hph_r = as3514.regs[HPH_OUT_R] & ~0x1f; | 220 | unsigned int hph_r = as3514.regs[AS3514_HPH_OUT_R] & ~0x1f; |
221 | unsigned int hph_l = as3514.regs[HPH_OUT_L] & ~0x1f; | 221 | unsigned int hph_l = as3514.regs[AS3514_HPH_OUT_L] & ~0x1f; |
222 | unsigned int mix_l, mix_r; | 222 | unsigned int mix_l, mix_r; |
223 | unsigned int mix_reg_r, mix_reg_l; | 223 | unsigned int mix_reg_r, mix_reg_l; |
224 | 224 | ||
@@ -227,11 +227,11 @@ void audiohw_set_master_vol(int vol_l, int vol_r) | |||
227 | as3514.vol_r = vol_r; | 227 | as3514.vol_r = vol_r; |
228 | 228 | ||
229 | if (source == SOURCE_LINE_IN1_ANALOG) { | 229 | if (source == SOURCE_LINE_IN1_ANALOG) { |
230 | mix_reg_r = LINE_IN1_R; | 230 | mix_reg_r = AS3514_LINE_IN1_R; |
231 | mix_reg_l = LINE_IN1_L; | 231 | mix_reg_l = AS3514_LINE_IN1_L; |
232 | } else { | 232 | } else { |
233 | mix_reg_r = DAC_R; | 233 | mix_reg_r = AS3514_DAC_R; |
234 | mix_reg_l = DAC_L; | 234 | mix_reg_l = AS3514_DAC_L; |
235 | } | 235 | } |
236 | 236 | ||
237 | mix_r = as3514.regs[mix_reg_r] & ~0x1f; | 237 | mix_r = as3514.regs[mix_reg_r] & ~0x1f; |
@@ -257,22 +257,22 @@ void audiohw_set_master_vol(int vol_l, int vol_r) | |||
257 | 257 | ||
258 | as3514_write(mix_reg_r, mix_r); | 258 | as3514_write(mix_reg_r, mix_r); |
259 | as3514_write(mix_reg_l, mix_l); | 259 | as3514_write(mix_reg_l, mix_l); |
260 | as3514_write(HPH_OUT_R, hph_r); | 260 | as3514_write(AS3514_HPH_OUT_R, hph_r); |
261 | as3514_write(HPH_OUT_L, hph_l); | 261 | as3514_write(AS3514_HPH_OUT_L, hph_l); |
262 | } | 262 | } |
263 | 263 | ||
264 | void audiohw_set_lineout_vol(int vol_l, int vol_r) | 264 | void audiohw_set_lineout_vol(int vol_l, int vol_r) |
265 | { | 265 | { |
266 | as3514_write(LINE_OUT_R, vol_r); | 266 | as3514_write(AS3514_LINE_OUT_R, vol_r); |
267 | as3514_write(LINE_OUT_L, (1 << 6) | vol_l); | 267 | as3514_write(AS3514_LINE_OUT_L, (1 << 6) | vol_l); |
268 | } | 268 | } |
269 | 269 | ||
270 | void audiohw_mute(bool mute) | 270 | void audiohw_mute(bool mute) |
271 | { | 271 | { |
272 | if (mute) { | 272 | if (mute) { |
273 | as3514_write_or(HPH_OUT_L, (1 << 7)); | 273 | as3514_write_or(AS3514_HPH_OUT_L, (1 << 7)); |
274 | } else { | 274 | } else { |
275 | as3514_write_and(HPH_OUT_L, ~(1 << 7)); | 275 | as3514_write_and(AS3514_HPH_OUT_L, ~(1 << 7)); |
276 | } | 276 | } |
277 | } | 277 | } |
278 | 278 | ||
@@ -283,7 +283,7 @@ void audiohw_close(void) | |||
283 | audiohw_mute(true); | 283 | audiohw_mute(true); |
284 | 284 | ||
285 | /* turn off everything */ | 285 | /* turn off everything */ |
286 | as3514_write(AUDIOSET1, 0x0); | 286 | as3514_write(AS3514_AUDIOSET1, 0x0); |
287 | } | 287 | } |
288 | 288 | ||
289 | void audiohw_set_sample_rate(int sampling_control) | 289 | void audiohw_set_sample_rate(int sampling_control) |
@@ -300,29 +300,29 @@ void audiohw_enable_recording(bool source_mic) | |||
300 | audiohw_set_master_vol(as3514.vol_l, as3514.vol_r); | 300 | audiohw_set_master_vol(as3514.vol_l, as3514.vol_r); |
301 | 301 | ||
302 | /* ADCmux = Stereo Microphone */ | 302 | /* ADCmux = Stereo Microphone */ |
303 | as3514_write_and(ADC_R, ~(0x3 << 6)); | 303 | as3514_write_and(AS3514_ADC_R, ~(0x3 << 6)); |
304 | /* MIC1_on, LIN1_off */ | 304 | /* MIC1_on, LIN1_off */ |
305 | as3514_write(AUDIOSET1, | 305 | as3514_write(AS3514_AUDIOSET1, |
306 | (as3514.regs[AUDIOSET1] & ~(1 << 2)) | (1 << 0)); | 306 | (as3514.regs[AS3514_AUDIOSET1] & ~(1 << 2)) | (1 << 0)); |
307 | /* M1_AGC_off */ | 307 | /* M1_AGC_off */ |
308 | as3514_write_and(MIC1_R, ~(1 << 7)); | 308 | as3514_write_and(AS3514_MIC1_R, ~(1 << 7)); |
309 | } else { | 309 | } else { |
310 | source = SOURCE_LINE_IN1; | 310 | source = SOURCE_LINE_IN1; |
311 | 311 | ||
312 | audiohw_set_master_vol(as3514.vol_l, as3514.vol_r); | 312 | audiohw_set_master_vol(as3514.vol_l, as3514.vol_r); |
313 | 313 | ||
314 | /* ADCmux = Line_IN1 */ | 314 | /* ADCmux = Line_IN1 */ |
315 | as3514_write(ADC_R, | 315 | as3514_write(AS3514_ADC_R, |
316 | (as3514.regs[ADC_R] & ~(0x3 << 6)) | (0x1 << 6)); | 316 | (as3514.regs[AS3514_ADC_R] & ~(0x3 << 6)) | (0x1 << 6)); |
317 | /* MIC1_off, LIN1_on */ | 317 | /* MIC1_off, LIN1_on */ |
318 | as3514_write(AUDIOSET1, | 318 | as3514_write(AS3514_AUDIOSET1, |
319 | (as3514.regs[AUDIOSET1] & ~(1 << 0)) | (1 << 2)); | 319 | (as3514.regs[AS3514_AUDIOSET1] & ~(1 << 0)) | (1 << 2)); |
320 | } | 320 | } |
321 | 321 | ||
322 | /* ADC_Mute_off */ | 322 | /* ADC_Mute_off */ |
323 | as3514_write_or(ADC_L, (1 << 6)); | 323 | as3514_write_or(AS3514_ADC_L, (1 << 6)); |
324 | /* ADC_on */ | 324 | /* ADC_on */ |
325 | as3514_write_or(AUDIOSET1, (1 << 7)); | 325 | as3514_write_or(AS3514_AUDIOSET1, (1 << 7)); |
326 | } | 326 | } |
327 | 327 | ||
328 | void audiohw_disable_recording(void) | 328 | void audiohw_disable_recording(void) |
@@ -330,10 +330,10 @@ void audiohw_disable_recording(void) | |||
330 | source = SOURCE_DAC; | 330 | source = SOURCE_DAC; |
331 | 331 | ||
332 | /* ADC_Mute_on */ | 332 | /* ADC_Mute_on */ |
333 | as3514_write_and(ADC_L, ~(1 << 6)); | 333 | as3514_write_and(AS3514_ADC_L, ~(1 << 6)); |
334 | 334 | ||
335 | /* ADC_off, LIN1_off, MIC_off */ | 335 | /* ADC_off, LIN1_off, MIC_off */ |
336 | as3514_write_and(AUDIOSET1, ~((1 << 7) | (1 << 2) | (1 << 0))); | 336 | as3514_write_and(AS3514_AUDIOSET1, ~((1 << 7) | (1 << 2) | (1 << 0))); |
337 | 337 | ||
338 | audiohw_set_master_vol(as3514.vol_l, as3514.vol_r); | 338 | audiohw_set_master_vol(as3514.vol_l, as3514.vol_r); |
339 | } | 339 | } |
@@ -354,7 +354,7 @@ void audiohw_set_recvol(int left, int right, int type) | |||
354 | case AUDIO_GAIN_MIC: | 354 | case AUDIO_GAIN_MIC: |
355 | { | 355 | { |
356 | /* Combine MIC gains seamlessly with ADC levels */ | 356 | /* Combine MIC gains seamlessly with ADC levels */ |
357 | unsigned int mic1_r = as3514.regs[MIC1_R] & ~(0x3 << 5); | 357 | unsigned int mic1_r = as3514.regs[AS3514_MIC1_R] & ~(0x3 << 5); |
358 | 358 | ||
359 | if (left >= 36) { | 359 | if (left >= 36) { |
360 | /* M1_Gain = +40db, ADR_Vol = +7.5dB .. +12.0 dB => | 360 | /* M1_Gain = +40db, ADR_Vol = +7.5dB .. +12.0 dB => |
@@ -372,7 +372,7 @@ void audiohw_set_recvol(int left, int right, int type) | |||
372 | 372 | ||
373 | right = left; | 373 | right = left; |
374 | 374 | ||
375 | as3514_write(MIC1_R, mic1_r); | 375 | as3514_write(AS3514_MIC1_R, mic1_r); |
376 | break; | 376 | break; |
377 | } | 377 | } |
378 | case AUDIO_GAIN_LINEIN: | 378 | case AUDIO_GAIN_LINEIN: |
@@ -381,8 +381,8 @@ void audiohw_set_recvol(int left, int right, int type) | |||
381 | return; | 381 | return; |
382 | } | 382 | } |
383 | 383 | ||
384 | as3514_write(ADC_R, (as3514.regs[ADC_R] & ~0x1f) | right); | 384 | as3514_write(AS3514_ADC_R, (as3514.regs[AS3514_ADC_R] & ~0x1f) | right); |
385 | as3514_write(ADC_L, (as3514.regs[ADC_L] & ~0x1f) | left); | 385 | as3514_write(AS3514_ADC_L, (as3514.regs[AS3514_ADC_L] & ~0x1f) | left); |
386 | } | 386 | } |
387 | 387 | ||
388 | /** | 388 | /** |
@@ -392,11 +392,11 @@ void audiohw_set_recvol(int left, int right, int type) | |||
392 | void audiohw_set_monitor(bool enable) | 392 | void audiohw_set_monitor(bool enable) |
393 | { | 393 | { |
394 | /* LI1R_Mute_on - default */ | 394 | /* LI1R_Mute_on - default */ |
395 | unsigned int line_in1_r = as3514.regs[LINE_IN1_R] & ~(1 << 5); | 395 | unsigned int line_in1_r = as3514.regs[AS3514_LINE_IN1_R] & ~(1 << 5); |
396 | /* LI1L_Mute_on - default */ | 396 | /* LI1L_Mute_on - default */ |
397 | unsigned int line_in1_l = as3514.regs[LINE_IN1_L] & ~(1 << 5); | 397 | unsigned int line_in1_l = as3514.regs[AS3514_LINE_IN1_L] & ~(1 << 5); |
398 | /* LIN1_off - default */ | 398 | /* LIN1_off - default */ |
399 | unsigned int audioset1 = as3514.regs[AUDIOSET1] & ~(1 << 2); | 399 | unsigned int audioset1 = as3514.regs[AS3514_AUDIOSET1] & ~(1 << 2); |
400 | 400 | ||
401 | if (enable) { | 401 | if (enable) { |
402 | source = SOURCE_LINE_IN1_ANALOG; | 402 | source = SOURCE_LINE_IN1_ANALOG; |
@@ -409,9 +409,9 @@ void audiohw_set_monitor(bool enable) | |||
409 | audioset1 |= (1 << 2); | 409 | audioset1 |= (1 << 2); |
410 | } | 410 | } |
411 | 411 | ||
412 | as3514_write(AUDIOSET1, audioset1); | 412 | as3514_write(AS3514_AUDIOSET1, audioset1); |
413 | as3514_write(LINE_IN1_R, line_in1_r); | 413 | as3514_write(AS3514_LINE_IN1_R, line_in1_r); |
414 | as3514_write(LINE_IN1_L, line_in1_l); | 414 | as3514_write(AS3514_LINE_IN1_L, line_in1_l); |
415 | 415 | ||
416 | /* Sync mixer volume */ | 416 | /* Sync mixer volume */ |
417 | audiohw_set_master_vol(as3514.vol_l, as3514.vol_r); | 417 | audiohw_set_master_vol(as3514.vol_l, as3514.vol_r); |
diff --git a/firmware/drivers/rtc/rtc_as3514.c b/firmware/drivers/rtc/rtc_as3514.c index 15d543ec3f..32d90b3e11 100644 --- a/firmware/drivers/rtc/rtc_as3514.c +++ b/firmware/drivers/rtc/rtc_as3514.c | |||
@@ -55,7 +55,7 @@ int rtc_read_datetime(unsigned char* buf) | |||
55 | 55 | ||
56 | /* RTC_AS3514's slave address is 0x46*/ | 56 | /* RTC_AS3514's slave address is 0x46*/ |
57 | for (i=0;i<4;i++){ | 57 | for (i=0;i<4;i++){ |
58 | tmp[i] = i2c_readbyte(AS3514_I2C_ADDR, RTC_0 + i); | 58 | tmp[i] = i2c_readbyte(AS3514_I2C_ADDR, AS3514_RTC_0 + i); |
59 | } | 59 | } |
60 | seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24); | 60 | seconds = tmp[0] + (tmp[1]<<8) + (tmp[2]<<16) + (tmp[3]<<24); |
61 | 61 | ||
@@ -160,7 +160,7 @@ int rtc_write_datetime(unsigned char* buf) | |||
160 | 160 | ||
161 | /* Send data to RTC */ | 161 | /* Send data to RTC */ |
162 | for (i=0;i<4;i++){ | 162 | for (i=0;i<4;i++){ |
163 | pp_i2c_send(AS3514_I2C_ADDR, RTC_0 + i, ((seconds >> (8 * i)) & 0xff)); | 163 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_RTC_0 + i, ((seconds >> (8 * i)) & 0xff)); |
164 | } | 164 | } |
165 | return 1; | 165 | return 1; |
166 | } | 166 | } |
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h index a1c061905d..f6f759b75c 100644 --- a/firmware/export/as3514.h +++ b/firmware/export/as3514.h | |||
@@ -29,44 +29,49 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | |||
29 | extern void audiohw_set_sample_rate(int sampling_control); | 29 | extern void audiohw_set_sample_rate(int sampling_control); |
30 | 30 | ||
31 | /* Register Descriptions */ | 31 | /* Register Descriptions */ |
32 | #define LINE_OUT_R 0x00 | 32 | #define AS3514_LINE_OUT_R 0x00 |
33 | #define LINE_OUT_L 0x01 | 33 | #define AS3514_LINE_OUT_L 0x01 |
34 | #define HPH_OUT_R 0x02 | 34 | #define AS3514_HPH_OUT_R 0x02 |
35 | #define HPH_OUT_L 0x03 | 35 | #define AS3514_HPH_OUT_L 0x03 |
36 | #define LSP_OUT_R 0x04 | 36 | #define AS3514_LSP_OUT_R 0x04 |
37 | #define LSP_OUT_L 0x05 | 37 | #define AS3514_LSP_OUT_L 0x05 |
38 | #define MIC1_R 0x06 | 38 | #define AS3514_MIC1_R 0x06 |
39 | #define MIC1_L 0x07 | 39 | #define AS3514_MIC1_L 0x07 |
40 | #define MIC2_R 0x08 | 40 | #define AS3514_MIC2_R 0x08 |
41 | #define MIC2_L 0x09 | 41 | #define AS3514_MIC2_L 0x09 |
42 | #define LINE_IN1_R 0x0a | 42 | #define AS3514_LINE_IN1_R 0x0a |
43 | #define LINE_IN1_L 0x0b | 43 | #define AS3514_LINE_IN1_L 0x0b |
44 | #define LINE_IN2_R 0x0c | 44 | #define AS3514_LINE_IN2_R 0x0c |
45 | #define LINE_IN2_L 0x0d | 45 | #define AS3514_LINE_IN2_L 0x0d |
46 | #define DAC_R 0x0e | 46 | #define AS3514_DAC_R 0x0e |
47 | #define DAC_L 0x0f | 47 | #define AS3514_DAC_L 0x0f |
48 | #define ADC_R 0x10 | 48 | #define AS3514_ADC_R 0x10 |
49 | #define ADC_L 0x11 | 49 | #define AS3514_ADC_L 0x11 |
50 | #define AUDIOSET1 0x14 | 50 | #define AS3514_AUDIOSET1 0x14 |
51 | #define AUDIOSET2 0x15 | 51 | #define AS3514_AUDIOSET2 0x15 |
52 | #define AUDIOSET3 0x16 | 52 | #define AS3514_AUDIOSET3 0x16 |
53 | #define PLLMODE 0x1d | 53 | #define AS3514_PLLMODE 0x1d |
54 | 54 | ||
55 | #define SYSTEM 0x20 | 55 | #define AS3514_SYSTEM 0x20 |
56 | #define CHRGR 0x22 | 56 | #define AS3514_CVDD_DCDC3 0x21 |
57 | #define DCDC15 0x23 | 57 | #define AS3514_CHARGER 0x22 |
58 | #define SUPERVISOR 0x24 | 58 | #define AS3514_DCDC15 0x23 |
59 | #define AS3514_SUPERVISOR 0x24 | ||
59 | 60 | ||
60 | #define IRQ_ENRD0 0x25 | 61 | #define AS3514_IRQ_ENRD0 0x25 |
61 | #define IRQ_ENRD1 0x26 | 62 | #define AS3514_IRQ_ENRD1 0x26 |
62 | #define IRQ_ENRD2 0x27 | 63 | #define AS3514_IRQ_ENRD2 0x27 |
63 | 64 | ||
64 | #define RTC_0 0x2a | 65 | #define AS3514_RTCV 0x28 |
65 | #define RTC_1 0x2b | 66 | #define AS3514_RTCT 0x29 |
66 | #define RTC_2 0x2c | 67 | #define AS3514_RTC_0 0x2a |
67 | #define RTC_3 0x2d | 68 | #define AS3514_RTC_1 0x2b |
68 | #define ADC_0 0x2e | 69 | #define AS3514_RTC_2 0x2c |
69 | #define ADC_1 0x2f | 70 | #define AS3514_RTC_3 0x2d |
71 | #define AS3514_ADC_0 0x2e | ||
72 | #define AS3514_ADC_1 0x2f | ||
73 | |||
74 | #define AS3514_UID_0 0x30 | ||
70 | 75 | ||
71 | /* Headphone volume goes from -73.5 ... +6dB */ | 76 | /* Headphone volume goes from -73.5 ... +6dB */ |
72 | #define VOLUME_MIN -735 | 77 | #define VOLUME_MIN -735 |
diff --git a/firmware/target/arm/i2c-pp.c b/firmware/target/arm/i2c-pp.c index 40eb80cfe1..5799d7c37f 100644 --- a/firmware/target/arm/i2c-pp.c +++ b/firmware/target/arm/i2c-pp.c | |||
@@ -228,7 +228,7 @@ void i2c_init(void) | |||
228 | outl(0, 0x600060a4); | 228 | outl(0, 0x600060a4); |
229 | outl(0x1e, 0x600060a4); | 229 | outl(0x1e, 0x600060a4); |
230 | 230 | ||
231 | pp_i2c_send(AS3514_I2C_ADDR, SUPERVISOR, 5); | 231 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_SUPERVISOR, 5); |
232 | #endif | 232 | #endif |
233 | #endif | 233 | #endif |
234 | 234 | ||
diff --git a/firmware/target/arm/sandisk/adc-c200_e200.c b/firmware/target/arm/sandisk/adc-c200_e200.c index fd07812cfb..dcf6cba26e 100644 --- a/firmware/target/arm/sandisk/adc-c200_e200.c +++ b/firmware/target/arm/sandisk/adc-c200_e200.c | |||
@@ -31,12 +31,12 @@ unsigned short adc_read(int channel) | |||
31 | i2c_lock(); | 31 | i2c_lock(); |
32 | 32 | ||
33 | /* Select channel */ | 33 | /* Select channel */ |
34 | if (pp_i2c_send( AS3514_I2C_ADDR, ADC_0, (channel << 4)) >= 0) | 34 | if (pp_i2c_send( AS3514_I2C_ADDR, AS3514_ADC_0, (channel << 4)) >= 0) |
35 | { | 35 | { |
36 | unsigned char buf[2]; | 36 | unsigned char buf[2]; |
37 | 37 | ||
38 | /* Read data */ | 38 | /* Read data */ |
39 | if (i2c_readbytes( AS3514_I2C_ADDR, ADC_0, 2, buf) >= 0) | 39 | if (i2c_readbytes( AS3514_I2C_ADDR, AS3514_ADC_0, 2, buf) >= 0) |
40 | { | 40 | { |
41 | data = (((buf[0] & 0x3) << 8) | buf[1]); | 41 | data = (((buf[0] & 0x3) << 8) | buf[1]); |
42 | } | 42 | } |
diff --git a/firmware/target/arm/sandisk/backlight-c200_e200.c b/firmware/target/arm/sandisk/backlight-c200_e200.c index 9eeb05072e..016751121e 100644 --- a/firmware/target/arm/sandisk/backlight-c200_e200.c +++ b/firmware/target/arm/sandisk/backlight-c200_e200.c | |||
@@ -44,12 +44,12 @@ void _backlight_on(void) | |||
44 | #if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER) | 44 | #if defined(HAVE_LCD_SLEEP) && !defined(BOOTLOADER) |
45 | _lcd_sleep_timer = 0; /* LCD should be awake already */ | 45 | _lcd_sleep_timer = 0; /* LCD should be awake already */ |
46 | #endif | 46 | #endif |
47 | pp_i2c_send(AS3514_I2C_ADDR, DCDC15, backlight_brightness); | 47 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, backlight_brightness); |
48 | } | 48 | } |
49 | 49 | ||
50 | void _backlight_off(void) | 50 | void _backlight_off(void) |
51 | { | 51 | { |
52 | pp_i2c_send(AS3514_I2C_ADDR, DCDC15, 0x0); | 52 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_DCDC15, 0x0); |
53 | #ifdef HAVE_LCD_ENABLE | 53 | #ifdef HAVE_LCD_ENABLE |
54 | lcd_enable(false); /* power off lcd */ | 54 | lcd_enable(false); /* power off lcd */ |
55 | #endif | 55 | #endif |
diff --git a/firmware/target/arm/sandisk/power-c200_e200.c b/firmware/target/arm/sandisk/power-c200_e200.c index ade3a0c63b..a7ec6cdead 100644 --- a/firmware/target/arm/sandisk/power-c200_e200.c +++ b/firmware/target/arm/sandisk/power-c200_e200.c | |||
@@ -33,9 +33,9 @@ void power_off(void) | |||
33 | char byte; | 33 | char byte; |
34 | 34 | ||
35 | /* Send shutdown command to PMU */ | 35 | /* Send shutdown command to PMU */ |
36 | byte = i2c_readbyte(AS3514_I2C_ADDR, SYSTEM); | 36 | byte = i2c_readbyte(AS3514_I2C_ADDR, AS3514_SYSTEM); |
37 | byte &= ~0x1; | 37 | byte &= ~0x1; |
38 | pp_i2c_send(AS3514_I2C_ADDR, SYSTEM, byte); | 38 | pp_i2c_send(AS3514_I2C_ADDR, AS3514_SYSTEM, byte); |
39 | 39 | ||
40 | /* Stop interrupts on both cores */ | 40 | /* Stop interrupts on both cores */ |
41 | disable_interrupt(IRQ_FIQ_STATUS); | 41 | disable_interrupt(IRQ_FIQ_STATUS); |
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index aa4686500d..ae5606f359 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c | |||
@@ -283,7 +283,7 @@ static void set_serial_descriptor(void) | |||
283 | short* p = &usb_string_iSerial.wString[1]; | 283 | short* p = &usb_string_iSerial.wString[1]; |
284 | int i; | 284 | int i; |
285 | 285 | ||
286 | i2c_readbytes(AS3514_I2C_ADDR, 0x30, 0x10, serial); | 286 | i2c_readbytes(AS3514_I2C_ADDR, AS3514_UID_0, 0x10, serial); |
287 | for (i = 0; i < 16; i++) { | 287 | for (i = 0; i < 16; i++) { |
288 | *p++ = hex[(serial[i] >> 4) & 0xF]; | 288 | *p++ = hex[(serial[i] >> 4) & 0xF]; |
289 | *p++ = hex[(serial[i] >> 0) & 0xF]; | 289 | *p++ = hex[(serial[i] >> 0) & 0xF]; |