summaryrefslogtreecommitdiff
path: root/firmware/drivers/audio
diff options
context:
space:
mode:
authorDave Chapman <dave@dchapman.com>2008-10-31 00:16:42 +0000
committerDave Chapman <dave@dchapman.com>2008-10-31 00:16:42 +0000
commit42f77d4eb027afed4f4ef80f10c16112c2b7fe2b (patch)
tree2da09bcab257322dce48ddccc4a71d915318aa3a /firmware/drivers/audio
parent324816f0190dec308f3496a288820a47926b1c17 (diff)
downloadrockbox-42f77d4eb027afed4f4ef80f10c16112c2b7fe2b.tar.gz
rockbox-42f77d4eb027afed4f4ef80f10c16112c2b7fe2b.zip
Abstract the PortalPlayer AS3514 handling with an "ascodec" API - inspired by the wmcodec API used with the Wolfson codecs. The intention is to implement this API for the AS3525 and then share code with the Sansa V2 ports.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@18940 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/audio')
-rw-r--r--firmware/drivers/audio/as3514.c38
1 files changed, 4 insertions, 34 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
34const struct sound_settings_info audiohw_settings[] = { 34const 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 */
72static void as3514_write(unsigned int reg, unsigned int value) 72static 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 */
138void audiohw_init(void) 138void 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
206void audiohw_postinit(void)
207{
208}
209
210/* Silently enable / disable audio output */ 180/* Silently enable / disable audio output */
211void audiohw_enable_output(bool enable) 181void audiohw_enable_output(bool enable)
212{ 182{