diff options
author | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-19 17:30:38 +0000 |
---|---|---|
committer | Rafaël Carré <rafael.carre@gmail.com> | 2010-05-19 17:30:38 +0000 |
commit | 9c774b3849b397345040fa064081368e17ed663e (patch) | |
tree | 81200e464b13442891e770920019b8623407d785 /firmware/export | |
parent | 9fbd7fd9c9ef4d2ef52556af7479866521018048 (diff) | |
download | rockbox-9c774b3849b397345040fa064081368e17ed663e.tar.gz rockbox-9c774b3849b397345040fa064081368e17ed663e.zip |
as3514.c: clean up
- enhance registers description in header file with respect to the as3543
registers: point which one are present or not in the as3543, which bits
change (i didn't detail all registers)
- cache less registers, only up to the ones which are written to
multiple times
- use ascodec_readbytes() to cache all needed registers in a row
- separate the as3543 bits from as3514/as3515 in audiohw_preinit()
- comment out unused audiohw_set_lineout_vol
- some cosmetics
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26174 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/export')
-rw-r--r-- | firmware/export/as3514.h | 49 |
1 files changed, 45 insertions, 4 deletions
diff --git a/firmware/export/as3514.h b/firmware/export/as3514.h index 6916e2fb4a..e9eda62ee3 100644 --- a/firmware/export/as3514.h +++ b/firmware/export/as3514.h | |||
@@ -30,31 +30,45 @@ extern void audiohw_set_master_vol(int vol_l, int vol_r); | |||
30 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | 30 | extern void audiohw_set_lineout_vol(int vol_l, int vol_r); |
31 | 31 | ||
32 | /* Register Descriptions */ | 32 | /* Register Descriptions */ |
33 | |||
34 | #ifndef HAVE_AS3543 | ||
33 | #define AS3514_LINE_OUT_R 0x00 | 35 | #define AS3514_LINE_OUT_R 0x00 |
34 | #define AS3514_LINE_OUT_L 0x01 | 36 | #define AS3514_LINE_OUT_L 0x01 |
37 | #endif | ||
38 | |||
35 | #define AS3514_HPH_OUT_R 0x02 | 39 | #define AS3514_HPH_OUT_R 0x02 |
36 | #define AS3514_HPH_OUT_L 0x03 | 40 | #define AS3514_HPH_OUT_L 0x03 |
41 | |||
42 | #ifndef HAVE_AS3543 | ||
37 | #define AS3514_LSP_OUT_R 0x04 | 43 | #define AS3514_LSP_OUT_R 0x04 |
38 | #define AS3514_LSP_OUT_L 0x05 | 44 | #define AS3514_LSP_OUT_L 0x05 |
45 | #endif | ||
46 | |||
39 | #define AS3514_MIC1_R 0x06 | 47 | #define AS3514_MIC1_R 0x06 |
40 | #define AS3514_MIC1_L 0x07 | 48 | #define AS3514_MIC1_L 0x07 |
49 | |||
41 | #ifndef HAVE_AS3543 | 50 | #ifndef HAVE_AS3543 |
42 | #define AS3514_MIC2_R 0x08 | 51 | #define AS3514_MIC2_R 0x08 |
43 | #define AS3514_MIC2_L 0x09 | 52 | #define AS3514_MIC2_L 0x09 |
44 | #endif | 53 | #endif |
54 | |||
45 | #define AS3514_LINE_IN1_R 0x0a | 55 | #define AS3514_LINE_IN1_R 0x0a |
46 | #define AS3514_LINE_IN1_L 0x0b | 56 | #define AS3514_LINE_IN1_L 0x0b |
57 | |||
47 | #ifndef HAVE_AS3543 | 58 | #ifndef HAVE_AS3543 |
48 | #define AS3514_LINE_IN2_R 0x0c | 59 | #define AS3514_LINE_IN2_R 0x0c |
49 | #define AS3514_LINE_IN2_L 0x0d | 60 | #define AS3514_LINE_IN2_L 0x0d |
50 | #endif | 61 | #endif |
62 | |||
51 | #define AS3514_DAC_R 0x0e | 63 | #define AS3514_DAC_R 0x0e |
52 | #define AS3514_DAC_L 0x0f | 64 | #define AS3514_DAC_L 0x0f |
53 | #define AS3514_ADC_R 0x10 | 65 | #define AS3514_ADC_R 0x10 |
54 | #define AS3514_ADC_L 0x11 | 66 | #define AS3514_ADC_L 0x11 |
67 | |||
55 | #ifdef HAVE_AS3543 | 68 | #ifdef HAVE_AS3543 |
56 | #define AS3543_DAC_IF 0x12 | 69 | #define AS3543_DAC_IF 0x12 |
57 | #endif | 70 | #endif |
71 | |||
58 | #define AS3514_AUDIOSET1 0x14 | 72 | #define AS3514_AUDIOSET1 0x14 |
59 | #define AS3514_AUDIOSET2 0x15 | 73 | #define AS3514_AUDIOSET2 0x15 |
60 | #define AS3514_AUDIOSET3 0x16 | 74 | #define AS3514_AUDIOSET3 0x16 |
@@ -65,18 +79,27 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | |||
65 | #define AS3543_PMU_ENABLE 0x1c | 79 | #define AS3543_PMU_ENABLE 0x1c |
66 | #endif | 80 | #endif |
67 | 81 | ||
82 | #ifndef HAVE_AS3543 | ||
68 | #define AS3514_PLLMODE 0x1d | 83 | #define AS3514_PLLMODE 0x1d |
84 | #endif | ||
69 | 85 | ||
70 | #ifdef HAVE_AS3543 | 86 | #ifdef HAVE_AS3543 |
71 | #define AS3543_CHARGER 0x19 /* PMU: sub register 1 (CHGVBUS1) */ | 87 | #define AS3543_CHARGER 0x19 /* PMU: 2 sub registers */ |
72 | #endif | 88 | #endif |
73 | 89 | ||
74 | #define AS3514_SYSTEM 0x20 | 90 | #define AS3514_SYSTEM 0x20 |
75 | #define AS3514_CVDD_DCDC3 0x21 | 91 | #define AS3514_CVDD_DCDC3 0x21 |
92 | |||
93 | #ifndef HAVE_AS3543 | ||
76 | #define AS3514_CHARGER 0x22 | 94 | #define AS3514_CHARGER 0x22 |
77 | #define AS3514_DCDC15 0x23 | 95 | #define AS3514_DCDC15 0x23 |
78 | #define AS3514_SUPERVISOR 0x24 | 96 | #define AS3514_SUPERVISOR 0x24 |
97 | #endif | ||
79 | 98 | ||
99 | /* AS3543 has 2 IRQ_ENRD registers at 0x23 and 0x24, but we don't use them | ||
100 | * We call the real IRQ_ENRD2 register, IRQ_ENRD0, to stay compatible with | ||
101 | * as3514, because the bits we use are the same | ||
102 | */ | ||
80 | #define AS3514_IRQ_ENRD0 0x25 | 103 | #define AS3514_IRQ_ENRD0 0x25 |
81 | #define AS3514_IRQ_ENRD1 0x26 | 104 | #define AS3514_IRQ_ENRD1 0x26 |
82 | #define AS3514_IRQ_ENRD2 0x27 | 105 | #define AS3514_IRQ_ENRD2 0x27 |
@@ -98,8 +121,8 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | |||
98 | 121 | ||
99 | /*** Audio Registers ***/ | 122 | /*** Audio Registers ***/ |
100 | 123 | ||
101 | /* 00h (LINE_OUT_R) to 1Dh (PLLMODE) */ | 124 | /* 00h (LINE_OUT_R) to 16h (AUDIOSET3) */ |
102 | #define AS3514_NUM_AUDIO_REGS (0x1e) | 125 | #define AS3514_NUM_AUDIO_REGS (0x17) |
103 | 126 | ||
104 | /* Common registers masks */ | 127 | /* Common registers masks */ |
105 | #define AS3514_VOL_MASK (0x1f << 0) | 128 | #define AS3514_VOL_MASK (0x1f << 0) |
@@ -122,6 +145,8 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | |||
122 | #define HPH_OUT_R_HP_OVC_TO_256MS (0x0 << 6) | 145 | #define HPH_OUT_R_HP_OVC_TO_256MS (0x0 << 6) |
123 | #define HPH_OUT_R_HP_OVC_TO_512MS (0x2 << 6) | 146 | #define HPH_OUT_R_HP_OVC_TO_512MS (0x2 << 6) |
124 | /* AS3543 */ | 147 | /* AS3543 */ |
148 | #define HPH_OUT_R_LINEOUT (0x1 << 7) | ||
149 | #define HPH_OUT_R_HEADPHONES (0x0 << 7) | ||
125 | #define HPH_OUT_R_HP_OUT_SUM (0x0 << 5) | 150 | #define HPH_OUT_R_HP_OUT_SUM (0x0 << 5) |
126 | #define HPH_OUT_R_HP_OUT_DAC (0x1 << 5) | 151 | #define HPH_OUT_R_HP_OUT_DAC (0x1 << 5) |
127 | #define HPH_OUT_R_HP_OUT_LINE (0x2 << 5) | 152 | #define HPH_OUT_R_HP_OUT_LINE (0x2 << 5) |
@@ -237,17 +262,25 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | |||
237 | #endif | 262 | #endif |
238 | 263 | ||
239 | /* AUDIOSET1 (14h)*/ | 264 | /* AUDIOSET1 (14h)*/ |
240 | #define AUDIOSET1_ADC_on (0x1 << 7) | 265 | #ifdef HAVE_AS3543 |
266 | #define AUDIOSET1_DAC_on (0x1 << 6) | ||
267 | #define AUDIOSET1_DAC_GAIN_on (0x1 << 5) | ||
268 | #else | ||
241 | #define AUDIOSET1_SUM_on (0x1 << 6) | 269 | #define AUDIOSET1_SUM_on (0x1 << 6) |
242 | #define AUDIOSET1_DAC_on (0x1 << 5) | 270 | #define AUDIOSET1_DAC_on (0x1 << 5) |
243 | #define AUDIOSET1_LOUT_on (0x1 << 4) | 271 | #define AUDIOSET1_LOUT_on (0x1 << 4) |
272 | #endif /* HAVE_AS3543 */ | ||
273 | /* common bits */ | ||
274 | #define AUDIOSET1_ADC_on (0x1 << 7) | ||
244 | #define AUDIOSET1_LIN2_on (0x1 << 3) | 275 | #define AUDIOSET1_LIN2_on (0x1 << 3) |
245 | #define AUDIOSET1_LIN1_on (0x1 << 2) | 276 | #define AUDIOSET1_LIN1_on (0x1 << 2) |
246 | #define AUDIOSET1_MIC2_on (0x1 << 1) | 277 | #define AUDIOSET1_MIC2_on (0x1 << 1) |
247 | #define AUDIOSET1_MIC1_on (0x1 << 0) | 278 | #define AUDIOSET1_MIC1_on (0x1 << 0) |
279 | |||
248 | #define AUDIOSET1_INPUT_MASK AUDIOSET1_MIC1_on | AUDIOSET1_MIC2_on | \ | 280 | #define AUDIOSET1_INPUT_MASK AUDIOSET1_MIC1_on | AUDIOSET1_MIC2_on | \ |
249 | AUDIOSET1_LIN1_on | AUDIOSET1_LIN2_on | 281 | AUDIOSET1_LIN1_on | AUDIOSET1_LIN2_on |
250 | 282 | ||
283 | |||
251 | /* AUDIOSET2 (15h) */ | 284 | /* AUDIOSET2 (15h) */ |
252 | #ifdef HAVE_AS3543 | 285 | #ifdef HAVE_AS3543 |
253 | #define AUDIOSET2_HPH_QUALITY_LOW_POWER (0x0 << 4) | 286 | #define AUDIOSET2_HPH_QUALITY_LOW_POWER (0x0 << 4) |
@@ -270,9 +303,17 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r); | |||
270 | #endif | 303 | #endif |
271 | 304 | ||
272 | /* AUDIOSET3 (16h) */ | 305 | /* AUDIOSET3 (16h) */ |
306 | #ifdef HAVE_AS3543 | ||
307 | #define AUDIOSET3_HP_FASTSTART (0x1 << 2) | ||
308 | #define AUDIOSET3_HP_LONGSTART (0x0 << 2) | ||
309 | #define AUDIOSET3_HP_BIAS_150 (0x1 << 1) | ||
310 | #define AUDIOSET3_HPCM_on (0x1 << 0) | ||
311 | #define AUDIOSET3_HPCM_off (0x0 << 0) | ||
312 | #else | ||
273 | #define AUDIOSET3_ZCU_off (0x1 << 2) | 313 | #define AUDIOSET3_ZCU_off (0x1 << 2) |
274 | #define AUDIOSET3_IBR_HPH (0x1 << 1) | 314 | #define AUDIOSET3_IBR_HPH (0x1 << 1) |
275 | #define AUDIOSET3_HPCM_off (0x1 << 0) | 315 | #define AUDIOSET3_HPCM_off (0x1 << 0) |
316 | #endif | ||
276 | 317 | ||
277 | /* PLLMODE (1Dh) */ | 318 | /* PLLMODE (1Dh) */ |
278 | #define PLLMODE_LRCK (0x3 << 1) | 319 | #define PLLMODE_LRCK (0x3 << 1) |