diff options
Diffstat (limited to 'firmware/target/arm/as3525')
11 files changed, 47 insertions, 106 deletions
diff --git a/firmware/target/arm/as3525/ascodec-as3525.c b/firmware/target/arm/as3525/ascodec-as3525.c index ddf6786409..be81178859 100644 --- a/firmware/target/arm/as3525/ascodec-as3525.c +++ b/firmware/target/arm/as3525/ascodec-as3525.c | |||
@@ -44,7 +44,7 @@ | |||
44 | interrupt bit 7 is raised and DACNT is not decremented after the transfer. | 44 | interrupt bit 7 is raised and DACNT is not decremented after the transfer. |
45 | */ | 45 | */ |
46 | 46 | ||
47 | #include "ascodec-target.h" | 47 | #include "ascodec.h" |
48 | #include "clock-target.h" | 48 | #include "clock-target.h" |
49 | #include "kernel.h" | 49 | #include "kernel.h" |
50 | #include "system.h" | 50 | #include "system.h" |
@@ -534,6 +534,29 @@ bool ascodec_chg_status(void) | |||
534 | { | 534 | { |
535 | return ascodec_enrd0_shadow & CHG_STATUS; | 535 | return ascodec_enrd0_shadow & CHG_STATUS; |
536 | } | 536 | } |
537 | |||
538 | void ascodec_monitor_endofch(void) | ||
539 | { | ||
540 | /* already enabled */ | ||
541 | } | ||
542 | |||
543 | void ascodec_write_charger(int value) | ||
544 | { | ||
545 | #if CONFIG_CPU == AS3525 | ||
546 | ascodec_write(AS3514_CHARGER, value); | ||
547 | #else | ||
548 | ascodec_write_pmu(AS3543_CHARGER, 1, value); | ||
549 | #endif | ||
550 | } | ||
551 | |||
552 | int ascodec_read_charger(void) | ||
553 | { | ||
554 | #if CONFIG_CPU == AS3525 | ||
555 | return ascodec_read(AS3514_CHARGER); | ||
556 | #else | ||
557 | return ascodec_read_pmu(AS3543_CHARGER, 1); | ||
558 | #endif | ||
559 | } | ||
537 | #endif /* CONFIG_CHARGING */ | 560 | #endif /* CONFIG_CHARGING */ |
538 | 561 | ||
539 | /* | 562 | /* |
diff --git a/firmware/target/arm/as3525/ascodec-target.h b/firmware/target/arm/as3525/ascodec-target.h deleted file mode 100644 index ece8c21dd0..0000000000 --- a/firmware/target/arm/as3525/ascodec-target.h +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Driver for AS3514 audio codec | ||
11 | * | ||
12 | * Copyright (c) 2007 Daniel Ankers | ||
13 | * Copyright (c) 2007 Christian Gmeiner | ||
14 | * | ||
15 | * This program is free software; you can redistribute it and/or | ||
16 | * modify it under the terms of the GNU General Public License | ||
17 | * as published by the Free Software Foundation; either version 2 | ||
18 | * of the License, or (at your option) any later version. | ||
19 | * | ||
20 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
21 | * KIND, either express or implied. | ||
22 | * | ||
23 | ****************************************************************************/ | ||
24 | |||
25 | #ifndef _ASCODEC_TARGET_H | ||
26 | #define _ASCODEC_TARGET_H | ||
27 | |||
28 | #ifndef SIMULATOR | ||
29 | |||
30 | #include "config.h" | ||
31 | #include "as3514.h" | ||
32 | #include "kernel.h" /* for struct semaphore */ | ||
33 | #include "clock-target.h" /* for AS3525_I2C_PRESCALER */ | ||
34 | #include "system-arm.h" | ||
35 | |||
36 | /* Charge Pump and Power management Settings */ | ||
37 | #define AS314_CP_DCDC3_SETTING \ | ||
38 | ((0<<7) | /* CP_SW Auto-Switch Margin 0=200/300 1=150/255 */ \ | ||
39 | (0<<6) | /* CP_on 0=Normal op 1=Chg Pump Always On */ \ | ||
40 | (0<<5) | /* LREG_CPnot Always write 0 */ \ | ||
41 | (0<<3) | /* DCDC3p BVDD setting 3.6/3.2/3.1/3.0 */ \ | ||
42 | (1<<2) | /* LREG_off 1=Auto mode switching 0=Length Reg only*/\ | ||
43 | (0<<0) ) /* CVDDp Core Voltage Setting 1.2/1.15/1.10/1.05*/ | ||
44 | |||
45 | #define CVDD_1_20 0 | ||
46 | #define CVDD_1_15 1 | ||
47 | #define CVDD_1_10 2 | ||
48 | #define CVDD_1_05 3 | ||
49 | |||
50 | void ascodec_init(void) INIT_ATTR; | ||
51 | |||
52 | int ascodec_write(unsigned int index, unsigned int value); | ||
53 | |||
54 | int ascodec_read(unsigned int index); | ||
55 | |||
56 | int ascodec_readbytes(unsigned int index, unsigned int len, unsigned char *data); | ||
57 | |||
58 | void ascodec_lock(void); | ||
59 | |||
60 | void ascodec_unlock(void); | ||
61 | |||
62 | void ascodec_wait_adc_finished(void); | ||
63 | |||
64 | static inline void ascodec_monitor_endofch(void) {} /* already enabled */ | ||
65 | |||
66 | bool ascodec_endofch(void); | ||
67 | |||
68 | bool ascodec_chg_status(void); | ||
69 | |||
70 | #if CONFIG_CPU == AS3525v2 | ||
71 | void ascodec_write_pmu(unsigned int index, unsigned int subreg, | ||
72 | unsigned int value); | ||
73 | int ascodec_read_pmu(unsigned int index, unsigned int subreg); | ||
74 | #endif /* CONFIG_CPU == AS3525v2 */ | ||
75 | |||
76 | static inline void ascodec_write_charger(int value) | ||
77 | { | ||
78 | #if CONFIG_CPU == AS3525 | ||
79 | ascodec_write(AS3514_CHARGER, value); | ||
80 | #else | ||
81 | ascodec_write_pmu(AS3543_CHARGER, 1, value); | ||
82 | #endif | ||
83 | } | ||
84 | |||
85 | static inline int ascodec_read_charger(void) | ||
86 | { | ||
87 | #if CONFIG_CPU == AS3525 | ||
88 | return ascodec_read(AS3514_CHARGER); | ||
89 | #else | ||
90 | return ascodec_read_pmu(AS3543_CHARGER, 1); | ||
91 | #endif | ||
92 | } | ||
93 | |||
94 | #endif /* !SIMULATOR */ | ||
95 | |||
96 | #endif /* !_ASCODEC_TARGET_H */ | ||
diff --git a/firmware/target/arm/as3525/backlight-e200v2-fuze.c b/firmware/target/arm/as3525/backlight-e200v2-fuze.c index 61c2b1db79..91e1ef4d0c 100644 --- a/firmware/target/arm/as3525/backlight-e200v2-fuze.c +++ b/firmware/target/arm/as3525/backlight-e200v2-fuze.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "lcd.h" | 24 | #include "lcd.h" |
25 | #include "backlight.h" | 25 | #include "backlight.h" |
26 | #include "ascodec-target.h" | 26 | #include "ascodec.h" |
27 | #include "as3514.h" | 27 | #include "as3514.h" |
28 | 28 | ||
29 | int buttonlight_is_on = 0; | 29 | int buttonlight_is_on = 0; |
diff --git a/firmware/target/arm/as3525/debug-as3525.c b/firmware/target/arm/as3525/debug-as3525.c index 783f3f68a4..3e546bb5e3 100644 --- a/firmware/target/arm/as3525/debug-as3525.c +++ b/firmware/target/arm/as3525/debug-as3525.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #include "system.h" | 26 | #include "system.h" |
27 | #include "cpu.h" | 27 | #include "cpu.h" |
28 | #include "pl180.h" | 28 | #include "pl180.h" |
29 | #include "ascodec-target.h" | 29 | #include "ascodec.h" |
30 | #include "adc.h" | 30 | #include "adc.h" |
31 | #include "storage.h" | 31 | #include "storage.h" |
32 | 32 | ||
diff --git a/firmware/target/arm/as3525/power-as3525.c b/firmware/target/arm/as3525/power-as3525.c index 21ce98bd75..e6f1cfd24d 100644 --- a/firmware/target/arm/as3525/power-as3525.c +++ b/firmware/target/arm/as3525/power-as3525.c | |||
@@ -20,7 +20,7 @@ | |||
20 | ****************************************************************************/ | 20 | ****************************************************************************/ |
21 | #include <stdbool.h> | 21 | #include <stdbool.h> |
22 | #include "config.h" | 22 | #include "config.h" |
23 | #include "ascodec-target.h" | 23 | #include "ascodec.h" |
24 | #include "as3514.h" | 24 | #include "as3514.h" |
25 | #include "power.h" | 25 | #include "power.h" |
26 | 26 | ||
diff --git a/firmware/target/arm/as3525/sansa-c200v2/backlight-c200v2.c b/firmware/target/arm/as3525/sansa-c200v2/backlight-c200v2.c index 0f4dd4dbbb..1da57de93a 100644 --- a/firmware/target/arm/as3525/sansa-c200v2/backlight-c200v2.c +++ b/firmware/target/arm/as3525/sansa-c200v2/backlight-c200v2.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "lcd.h" | 24 | #include "lcd.h" |
25 | #include "backlight.h" | 25 | #include "backlight.h" |
26 | #include "ascodec-target.h" | 26 | #include "ascodec.h" |
27 | #include "as3514.h" | 27 | #include "as3514.h" |
28 | 28 | ||
29 | int buttonlight_is_on = 0; | 29 | int buttonlight_is_on = 0; |
diff --git a/firmware/target/arm/as3525/sansa-clipplus/backlight-clip.c b/firmware/target/arm/as3525/sansa-clipplus/backlight-clip.c index ef727608b5..e3b518b3f8 100644 --- a/firmware/target/arm/as3525/sansa-clipplus/backlight-clip.c +++ b/firmware/target/arm/as3525/sansa-clipplus/backlight-clip.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "backlight-target.h" | 22 | #include "backlight-target.h" |
23 | #include "lcd.h" | 23 | #include "lcd.h" |
24 | #include "as3525v2.h" | 24 | #include "as3525v2.h" |
25 | #include "ascodec-target.h" | 25 | #include "ascodec.h" |
26 | 26 | ||
27 | void _backlight_on(void) | 27 | void _backlight_on(void) |
28 | { | 28 | { |
diff --git a/firmware/target/arm/as3525/sansa-clipv2/backlight-clipv2.c b/firmware/target/arm/as3525/sansa-clipv2/backlight-clipv2.c index bf28bd6108..f4927ba5bf 100644 --- a/firmware/target/arm/as3525/sansa-clipv2/backlight-clipv2.c +++ b/firmware/target/arm/as3525/sansa-clipv2/backlight-clipv2.c | |||
@@ -22,7 +22,7 @@ | |||
22 | #include "backlight-target.h" | 22 | #include "backlight-target.h" |
23 | #include "lcd.h" | 23 | #include "lcd.h" |
24 | #include "as3525v2.h" | 24 | #include "as3525v2.h" |
25 | #include "ascodec-target.h" | 25 | #include "ascodec.h" |
26 | 26 | ||
27 | void _backlight_on(void) | 27 | void _backlight_on(void) |
28 | { | 28 | { |
diff --git a/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c b/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c index 589f80436e..fd44d76cac 100644 --- a/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c +++ b/firmware/target/arm/as3525/sansa-clipzip/backlight-clipzip.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "backlight-target.h" | 24 | #include "backlight-target.h" |
25 | #include "lcd.h" | 25 | #include "lcd.h" |
26 | #include "as3525v2.h" | 26 | #include "as3525v2.h" |
27 | #include "ascodec-target.h" | 27 | #include "ascodec.h" |
28 | #include "lcd-target.h" | 28 | #include "lcd-target.h" |
29 | 29 | ||
30 | bool _backlight_init() | 30 | bool _backlight_init() |
diff --git a/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c b/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c index 68c626d829..a01b168b71 100644 --- a/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c +++ b/firmware/target/arm/as3525/sansa-fuzev2/backlight-fuzev2.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include "system.h" | 23 | #include "system.h" |
24 | #include "lcd.h" | 24 | #include "lcd.h" |
25 | #include "backlight.h" | 25 | #include "backlight.h" |
26 | #include "ascodec-target.h" | 26 | #include "ascodec.h" |
27 | #include "as3514.h" | 27 | #include "as3514.h" |
28 | 28 | ||
29 | void _backlight_set_brightness(int brightness) | 29 | void _backlight_set_brightness(int brightness) |
diff --git a/firmware/target/arm/as3525/system-as3525.c b/firmware/target/arm/as3525/system-as3525.c index 89a07939b6..01aaeaccbe 100644 --- a/firmware/target/arm/as3525/system-as3525.c +++ b/firmware/target/arm/as3525/system-as3525.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "kernel.h" | 24 | #include "kernel.h" |
25 | #include "system.h" | 25 | #include "system.h" |
26 | #include "panic.h" | 26 | #include "panic.h" |
27 | #include "ascodec-target.h" | 27 | #include "ascodec.h" |
28 | #include "adc.h" | 28 | #include "adc.h" |
29 | #include "dma-target.h" | 29 | #include "dma-target.h" |
30 | #include "clock-target.h" | 30 | #include "clock-target.h" |
@@ -33,6 +33,20 @@ | |||
33 | #include "backlight-target.h" | 33 | #include "backlight-target.h" |
34 | #include "lcd.h" | 34 | #include "lcd.h" |
35 | 35 | ||
36 | /* Charge Pump and Power management Settings */ | ||
37 | #define AS314_CP_DCDC3_SETTING \ | ||
38 | ((0<<7) | /* CP_SW Auto-Switch Margin 0=200/300 1=150/255 */ \ | ||
39 | (0<<6) | /* CP_on 0=Normal op 1=Chg Pump Always On */ \ | ||
40 | (0<<5) | /* LREG_CPnot Always write 0 */ \ | ||
41 | (0<<3) | /* DCDC3p BVDD setting 3.6/3.2/3.1/3.0 */ \ | ||
42 | (1<<2) | /* LREG_off 1=Auto mode switching 0=Length Reg only*/\ | ||
43 | (0<<0) ) /* CVDDp Core Voltage Setting 1.2/1.15/1.10/1.05*/ | ||
44 | |||
45 | #define CVDD_1_20 0 | ||
46 | #define CVDD_1_15 1 | ||
47 | #define CVDD_1_10 2 | ||
48 | #define CVDD_1_05 3 | ||
49 | |||
36 | #define default_interrupt(name) \ | 50 | #define default_interrupt(name) \ |
37 | extern __attribute__((weak,alias("UIRQ"))) void name (void) | 51 | extern __attribute__((weak,alias("UIRQ"))) void name (void) |
38 | 52 | ||