diff options
author | Barry Wardell <rockbox@barrywardell.net> | 2006-12-18 01:52:21 +0000 |
---|---|---|
committer | Barry Wardell <rockbox@barrywardell.net> | 2006-12-18 01:52:21 +0000 |
commit | df0dc2262ea10f621677c0f97aae1c205e253b87 (patch) | |
tree | d25085132fe9f0504d221360092537492cedd3b8 /firmware/drivers/wm8731l.c | |
parent | 440353a9aa1159584b977a2852e723ae07bad2a6 (diff) | |
download | rockbox-df0dc2262ea10f621677c0f97aae1c205e253b87.tar.gz rockbox-df0dc2262ea10f621677c0f97aae1c205e253b87.zip |
FS#6096. Recording on PortalPlayer targets (H10, iPod Video, iPod 4g, iPod Color, iPod Nano).
* Fix failed compile of enc_config.c when HAVE_MPEG2_SAMPR is not defined.
* Fix bug in AIFF encoder header creation on little endian targets.
* Add recording screen keymaps for H10 and iPod.
* Move pcm_playback PP specific code to target tree.
* Add recording code to wmcodec drivers.
* Add pcm_record code.
Some problems still remain:
* Playback doesn't work after recording until Rockbox is restarted.
* Gain control not implemented.
* Only 16-bit/44KHz for now. The hardware should be capable of up to 24-bit/96KHz.
* Line-in recording not tested on H10.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11794 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/wm8731l.c')
-rw-r--r-- | firmware/drivers/wm8731l.c | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/firmware/drivers/wm8731l.c b/firmware/drivers/wm8731l.c index a690aade48..4f0f249149 100644 --- a/firmware/drivers/wm8731l.c +++ b/firmware/drivers/wm8731l.c | |||
@@ -220,12 +220,73 @@ void audiohw_set_sample_rate(int sampling_control) | |||
220 | 220 | ||
221 | void audiohw_enable_recording(bool source_mic) | 221 | void audiohw_enable_recording(bool source_mic) |
222 | { | 222 | { |
223 | (void)source_mic; | 223 | static int line_level = 0x17; |
224 | static int mic_boost = true; | ||
225 | codec_set_active(0x0); | ||
226 | |||
227 | /* set BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 | ||
228 | * LRP=0 IWL=00(16 bit) FORMAT=10(I2S format) */ | ||
229 | wmcodec_write(AINTFCE, 0x42); | ||
230 | |||
231 | wmcodec_write(LOUTVOL, 0x0); /* headphone mute left */ | ||
232 | wmcodec_write(ROUTVOL, 0x0); /* headphone mute right */ | ||
233 | |||
234 | |||
235 | if(source_mic){ | ||
236 | wmcodec_write(LINVOL, 0x80); /* line in mute left */ | ||
237 | wmcodec_write(RINVOL, 0x80); /* line in mute right */ | ||
238 | |||
239 | |||
240 | if (mic_boost) { | ||
241 | wmcodec_write(AAPCTRL, 0x5); /* INSEL=mic, MIC_BOOST=enable */ | ||
242 | } else { | ||
243 | wmcodec_write(AAPCTRL, 0x4); /* INSEL=mic */ | ||
244 | } | ||
245 | } else { | ||
246 | if (line_level == 0) { | ||
247 | wmcodec_write(LINVOL, 0x80); | ||
248 | wmcodec_write(RINVOL, 0x80); | ||
249 | } else { | ||
250 | wmcodec_write(LINVOL, line_level); | ||
251 | wmcodec_write(RINVOL, line_level); | ||
252 | } | ||
253 | wmcodec_write(AAPCTRL, 0xa); /* BY PASS, mute mic, INSEL=line in */ | ||
254 | } | ||
255 | |||
256 | /* disable ADC high pass filter, mute dac */ | ||
257 | wmcodec_write(DACCTRL, 0x9); | ||
258 | |||
259 | /* power on (PWR_OFF=0) */ | ||
260 | if(source_mic){ | ||
261 | /* CLKOUTPD OSCPD OUTPD DACPD LINEINPD */ | ||
262 | wmcodec_write(PWRMGMT, 0x79); | ||
263 | } else { | ||
264 | wmcodec_write(PWRMGMT, 0x7a); /* MICPD */ | ||
265 | } | ||
266 | |||
267 | codec_set_active(0x1); | ||
224 | } | 268 | } |
225 | 269 | ||
226 | void audiohw_disable_recording(void) | 270 | void audiohw_disable_recording(void) |
227 | { | 271 | { |
228 | 272 | /* set DACMU=1 DEEMPH=0 */ | |
273 | wmcodec_write(DACCTRL, 0x8); | ||
274 | |||
275 | /* ACTIVE=0 */ | ||
276 | codec_set_active(0x0); | ||
277 | |||
278 | /* line in mute left & right*/ | ||
279 | wmcodec_write(LINVOL, 0x80); | ||
280 | wmcodec_write(RINVOL, 0x80); | ||
281 | |||
282 | /* set DACSEL=0, MUTEMIC=1 */ | ||
283 | wmcodec_write(AAPCTRL, 0x2); | ||
284 | |||
285 | /* set POWEROFF=0 OUTPD=0 DACPD=1 */ | ||
286 | wmcodec_write(PWRMGMT, 0x6f); | ||
287 | |||
288 | /* set POWEROFF=1 OUTPD=1 DACPD=1 */ | ||
289 | wmcodec_write(PWRMGMT, 0xff); | ||
229 | } | 290 | } |
230 | 291 | ||
231 | void audiohw_set_recvol(int left, int right, int type) | 292 | void audiohw_set_recvol(int left, int right, int type) |