diff options
author | Bertrik Sikken <bertrik@sikken.nl> | 2009-02-05 19:57:18 +0000 |
---|---|---|
committer | Bertrik Sikken <bertrik@sikken.nl> | 2009-02-05 19:57:18 +0000 |
commit | ea7f1430960cc6ccc16f67fe43c95d2341033642 (patch) | |
tree | 68843470bb257523cda24d8ddf09ed088aea872f /firmware/drivers/audio/as3514.c | |
parent | d8662489dc19592abccca44c0e1254584c6a0d29 (diff) | |
download | rockbox-ea7f1430960cc6ccc16f67fe43c95d2341033642.tar.gz rockbox-ea7f1430960cc6ccc16f67fe43c95d2341033642.zip |
FS#9611 - Sansa Clip radio code. Commit final part which enables the LINE2 input that carries the analog radio signal on ams sansas.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19927 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/drivers/audio/as3514.c')
-rw-r--r-- | firmware/drivers/audio/as3514.c | 76 |
1 files changed, 51 insertions, 25 deletions
diff --git a/firmware/drivers/audio/as3514.c b/firmware/drivers/audio/as3514.c index 23d1c52b56..dc6efb511a 100644 --- a/firmware/drivers/audio/as3514.c +++ b/firmware/drivers/audio/as3514.c | |||
@@ -31,6 +31,14 @@ | |||
31 | #include "i2s.h" | 31 | #include "i2s.h" |
32 | #include "ascodec.h" | 32 | #include "ascodec.h" |
33 | 33 | ||
34 | /* AMS Sansas based on the AS3525 use the LINE2 input for the analog radio | ||
35 | signal instead of LINE1 */ | ||
36 | #if CONFIG_CPU == AS3525 | ||
37 | #define LINE_INPUT 2 | ||
38 | #else | ||
39 | #define LINE_INPUT 1 | ||
40 | #endif | ||
41 | |||
34 | const struct sound_settings_info audiohw_settings[] = { | 42 | const struct sound_settings_info audiohw_settings[] = { |
35 | [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, | 43 | [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, |
36 | /* HAVE_SW_TONE_CONTROLS */ | 44 | /* HAVE_SW_TONE_CONTROLS */ |
@@ -227,9 +235,13 @@ void audiohw_set_master_vol(int vol_l, int vol_r) | |||
227 | 235 | ||
228 | as3514_write_masked(AS3514_DAC_R, mix_r, AS3514_VOL_MASK); | 236 | as3514_write_masked(AS3514_DAC_R, mix_r, AS3514_VOL_MASK); |
229 | as3514_write_masked(AS3514_DAC_L, mix_l, AS3514_VOL_MASK); | 237 | as3514_write_masked(AS3514_DAC_L, mix_l, AS3514_VOL_MASK); |
230 | #ifdef HAVE_RECORDING | 238 | #if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN) |
231 | as3514_write_masked(AS3514_LINE_IN1_R, mix_r, AS3514_VOL_MASK); | 239 | as3514_write_masked((LINE_INPUT == 1) ? AS3514_LINE_IN1_R : |
232 | as3514_write_masked(AS3514_LINE_IN1_L, mix_l, AS3514_VOL_MASK); | 240 | AS3514_LINE_IN2_R, |
241 | mix_r, AS3514_VOL_MASK); | ||
242 | as3514_write_masked((LINE_INPUT == 1) ? AS3514_LINE_IN1_L : | ||
243 | AS3514_LINE_IN2_L, | ||
244 | mix_l, AS3514_VOL_MASK); | ||
233 | #endif | 245 | #endif |
234 | as3514_write_masked(AS3514_HPH_OUT_R, hph_r, AS3514_VOL_MASK); | 246 | as3514_write_masked(AS3514_HPH_OUT_R, hph_r, AS3514_VOL_MASK); |
235 | as3514_write_masked(AS3514_HPH_OUT_L, hph_l, AS3514_VOL_MASK); | 247 | as3514_write_masked(AS3514_HPH_OUT_L, hph_l, AS3514_VOL_MASK); |
@@ -237,10 +249,8 @@ void audiohw_set_master_vol(int vol_l, int vol_r) | |||
237 | 249 | ||
238 | void audiohw_set_lineout_vol(int vol_l, int vol_r) | 250 | void audiohw_set_lineout_vol(int vol_l, int vol_r) |
239 | { | 251 | { |
240 | as3514_write_masked(AS3514_LINE_OUT_R, vol_r, | 252 | as3514_write_masked(AS3514_LINE_OUT_R, vol_r, AS3514_VOL_MASK); |
241 | AS3514_VOL_MASK); | 253 | as3514_write_masked(AS3514_LINE_OUT_L, vol_l, AS3514_VOL_MASK); |
242 | as3514_write_masked(AS3514_LINE_OUT_L, vol_l, | ||
243 | AS3514_VOL_MASK); | ||
244 | } | 254 | } |
245 | 255 | ||
246 | void audiohw_mute(bool mute) | 256 | void audiohw_mute(bool mute) |
@@ -286,19 +296,24 @@ void audiohw_enable_recording(bool source_mic) | |||
286 | as3514_write_masked(AS3514_ADC_R, ADC_R_ADCMUX_ST_MIC, | 296 | as3514_write_masked(AS3514_ADC_R, ADC_R_ADCMUX_ST_MIC, |
287 | ADC_R_ADCMUX); | 297 | ADC_R_ADCMUX); |
288 | 298 | ||
289 | /* MIC1_on, LIN1_off */ | 299 | /* MIC1_on, others off */ |
290 | as3514_write_masked(AS3514_AUDIOSET1, AUDIOSET1_MIC1_on, | 300 | as3514_write_masked(AS3514_AUDIOSET1, AUDIOSET1_MIC1_on, |
291 | AUDIOSET1_MIC1_on | AUDIOSET1_LIN1_on); | 301 | AUDIOSET1_INPUT_MASK); |
302 | |||
292 | /* M1_AGC_off */ | 303 | /* M1_AGC_off */ |
293 | as3514_clear(AS3514_MIC1_R, MIC1_R_M1_AGC_off); | 304 | as3514_clear(AS3514_MIC1_R, MIC1_R_M1_AGC_off); |
294 | } else { | 305 | } else { |
295 | /* ADCmux = Line_IN1 */ | 306 | /* ADCmux = Line_IN1 or Line_IN2 */ |
296 | as3514_write_masked(AS3514_ADC_R, ADC_R_ADCMUX_LINE_IN1, | 307 | as3514_write_masked(AS3514_ADC_R, |
308 | (LINE_INPUT == 1) ? ADC_R_ADCMUX_LINE_IN1 : | ||
309 | ADC_R_ADCMUX_LINE_IN2, | ||
297 | ADC_R_ADCMUX); | 310 | ADC_R_ADCMUX); |
298 | 311 | ||
299 | /* MIC1_off, LIN1_on */ | 312 | /* LIN1_or LIN2 on, rest off */ |
300 | as3514_write_masked(AS3514_AUDIOSET1, AUDIOSET1_LIN1_on, | 313 | as3514_write_masked(AS3514_AUDIOSET1, |
301 | AUDIOSET1_MIC1_on | AUDIOSET1_LIN1_on); | 314 | (LINE_INPUT == 1) ? AUDIOSET1_LIN1_on : |
315 | AUDIOSET1_LIN2_on, | ||
316 | AUDIOSET1_INPUT_MASK); | ||
302 | } | 317 | } |
303 | 318 | ||
304 | /* ADC_Mute_off */ | 319 | /* ADC_Mute_off */ |
@@ -312,10 +327,8 @@ void audiohw_disable_recording(void) | |||
312 | /* ADC_Mute_on */ | 327 | /* ADC_Mute_on */ |
313 | as3514_clear(AS3514_ADC_L, ADC_L_ADC_MUTE_off); | 328 | as3514_clear(AS3514_ADC_L, ADC_L_ADC_MUTE_off); |
314 | 329 | ||
315 | /* ADC_off, LIN1_off, MIC_off */ | 330 | /* ADC_off, all input sources off */ |
316 | as3514_clear(AS3514_AUDIOSET1, | 331 | as3514_clear(AS3514_AUDIOSET1, AUDIOSET1_ADC_on | AUDIOSET1_INPUT_MASK); |
317 | AUDIOSET1_ADC_on | AUDIOSET1_LIN1_on | | ||
318 | AUDIOSET1_MIC1_on); | ||
319 | } | 332 | } |
320 | 333 | ||
321 | /** | 334 | /** |
@@ -366,22 +379,35 @@ void audiohw_set_recvol(int left, int right, int type) | |||
366 | as3514_write_masked(AS3514_ADC_R, right, AS3514_VOL_MASK); | 379 | as3514_write_masked(AS3514_ADC_R, right, AS3514_VOL_MASK); |
367 | as3514_write_masked(AS3514_ADC_L, left, AS3514_VOL_MASK); | 380 | as3514_write_masked(AS3514_ADC_L, left, AS3514_VOL_MASK); |
368 | } | 381 | } |
382 | #endif /* HAVE_RECORDING */ | ||
369 | 383 | ||
384 | #if defined(HAVE_RECORDING) || defined(HAVE_FMRADIO_IN) | ||
370 | /** | 385 | /** |
371 | * Enable line in 1 analog monitoring | 386 | * Enable line in analog monitoring |
372 | * | 387 | * |
373 | */ | 388 | */ |
374 | void audiohw_set_monitor(bool enable) | 389 | void audiohw_set_monitor(bool enable) |
375 | { | 390 | { |
376 | if (enable) { | 391 | if (enable) { |
377 | as3514_set(AS3514_AUDIOSET1, AUDIOSET1_LIN1_on); | 392 | /* select either LIN1 or LIN2 */ |
378 | as3514_set(AS3514_LINE_IN1_R, LINE_IN1_R_LI1R_MUTE_off); | 393 | as3514_write_masked(AS3514_AUDIOSET1, |
379 | as3514_set(AS3514_LINE_IN1_L, LINE_IN1_L_LI1L_MUTE_off); | 394 | (LINE_INPUT == 1) ? |
395 | AUDIOSET1_LIN1_on : AUDIOSET1_LIN2_on, | ||
396 | AUDIOSET1_LIN1_on | AUDIOSET1_LIN2_on); | ||
397 | as3514_set((LINE_INPUT == 1) ? AS3514_LINE_IN1_R : AS3514_LINE_IN2_R, | ||
398 | LINE_IN1_R_LI1R_MUTE_off); | ||
399 | as3514_set((LINE_INPUT == 1) ? AS3514_LINE_IN1_L : AS3514_LINE_IN2_L, | ||
400 | LINE_IN1_L_LI1L_MUTE_off); | ||
380 | } | 401 | } |
381 | else { | 402 | else { |
382 | as3514_clear(AS3514_AUDIOSET1, AUDIOSET1_LIN1_on); | 403 | /* turn off both LIN1 and LIN2 */ |
383 | as3514_clear(AS3514_LINE_IN1_R, LINE_IN1_R_LI1R_MUTE_off); | 404 | as3514_clear(AS3514_LINE_IN1_R, LINE_IN1_R_LI1R_MUTE_off); |
384 | as3514_clear(AS3514_LINE_IN1_L, LINE_IN1_L_LI1L_MUTE_off); | 405 | as3514_clear(AS3514_LINE_IN1_L, LINE_IN1_L_LI1L_MUTE_off); |
406 | as3514_clear(AS3514_LINE_IN2_R, LINE_IN2_R_LI2R_MUTE_off); | ||
407 | as3514_clear(AS3514_LINE_IN2_L, LINE_IN2_L_LI2L_MUTE_off); | ||
408 | as3514_clear(AS3514_AUDIOSET1, AUDIOSET1_LIN1_on | AUDIOSET1_LIN2_on); | ||
385 | } | 409 | } |
386 | } | 410 | } |
387 | #endif /* HAVE_RECORDING */ | 411 | #endif /* HAVE_RECORDING || HAVE_FMRADIO_IN */ |
412 | |||
413 | |||