summaryrefslogtreecommitdiff
path: root/firmware/target/coldfire
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/coldfire')
-rw-r--r--firmware/target/coldfire/iaudio/x5/audio-x5.c20
-rw-r--r--firmware/target/coldfire/iriver/audio-iriver.c26
-rw-r--r--firmware/target/coldfire/pcm-coldfire.c19
3 files changed, 27 insertions, 38 deletions
diff --git a/firmware/target/coldfire/iaudio/x5/audio-x5.c b/firmware/target/coldfire/iaudio/x5/audio-x5.c
index 70d5313a7e..0e2ba60c1d 100644
--- a/firmware/target/coldfire/iaudio/x5/audio-x5.c
+++ b/firmware/target/coldfire/iaudio/x5/audio-x5.c
@@ -23,7 +23,7 @@
23 23
24/** 24/**
25 * Note that microphone is mono, only left value is used 25 * Note that microphone is mono, only left value is used
26 * See tlv320_set_recvol() for exact ranges. 26 * See audiohw_set_recvol() for exact ranges.
27 * 27 *
28 * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN 28 * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN
29 * 29 *
@@ -31,7 +31,7 @@
31void audio_set_recording_gain(int left, int right, int type) 31void audio_set_recording_gain(int left, int right, int type)
32{ 32{
33 //logf("rcmrec: t=%d l=%d r=%d", type, left, right); 33 //logf("rcmrec: t=%d l=%d r=%d", type, left, right);
34 tlv320_set_recvol(left, right, type); 34 audiohw_set_recvol(left, right, type);
35} /* audio_set_recording_gain */ 35} /* audio_set_recording_gain */
36 36
37void audio_set_output_source(int source) 37void audio_set_output_source(int source)
@@ -61,8 +61,8 @@ void audio_set_source(int source, unsigned flags)
61 case AUDIO_SRC_PLAYBACK: 61 case AUDIO_SRC_PLAYBACK:
62 if (source != last_source) 62 if (source != last_source)
63 { 63 {
64 tlv320_disable_recording(); 64 audiohw_disable_recording();
65 tlv320_set_monitor(false); 65 audiohw_set_monitor(false);
66 /* Reset PDIR2 data flow */ 66 /* Reset PDIR2 data flow */
67 DATAINCONTROL = (1 << 9); 67 DATAINCONTROL = (1 << 9);
68 } 68 }
@@ -71,7 +71,7 @@ void audio_set_source(int source, unsigned flags)
71 case AUDIO_SRC_MIC: /* recording only */ 71 case AUDIO_SRC_MIC: /* recording only */
72 if (source != last_source) 72 if (source != last_source)
73 { 73 {
74 tlv320_enable_recording(true); /* source mic */ 74 audiohw_enable_recording(true); /* source mic */
75 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ 75 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
76 DATAINCONTROL = (3 << 14) | (4 << 3); 76 DATAINCONTROL = (3 << 14) | (4 << 3);
77 } 77 }
@@ -80,7 +80,7 @@ void audio_set_source(int source, unsigned flags)
80 case AUDIO_SRC_LINEIN: /* recording only */ 80 case AUDIO_SRC_LINEIN: /* recording only */
81 if (source != last_source) 81 if (source != last_source)
82 { 82 {
83 tlv320_enable_recording(false); /* source line */ 83 audiohw_enable_recording(false); /* source line */
84 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ 84 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
85 DATAINCONTROL = (3 << 14) | (4 << 3); 85 DATAINCONTROL = (3 << 14) | (4 << 3);
86 } 86 }
@@ -88,7 +88,7 @@ void audio_set_source(int source, unsigned flags)
88 88
89 case AUDIO_SRC_FMRADIO: /* recording and playback */ 89 case AUDIO_SRC_FMRADIO: /* recording and playback */
90 if (!recording) 90 if (!recording)
91 tlv320_set_recvol(23, 23, AUDIO_GAIN_LINEIN); 91 audiohw_set_recvol(23, 23, AUDIO_GAIN_LINEIN);
92 92
93 /* I2S recording and analog playback */ 93 /* I2S recording and analog playback */
94 if (source == last_source && recording == last_recording) 94 if (source == last_source && recording == last_recording)
@@ -100,12 +100,12 @@ void audio_set_source(int source, unsigned flags)
100 { 100 {
101 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ 101 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
102 DATAINCONTROL = (3 << 14) | (4 << 3); 102 DATAINCONTROL = (3 << 14) | (4 << 3);
103 tlv320_enable_recording(false); /* source line */ 103 audiohw_enable_recording(false); /* source line */
104 } 104 }
105 else 105 else
106 { 106 {
107 tlv320_disable_recording(); 107 audiohw_disable_recording();
108 tlv320_set_monitor(true); /* analog bypass */ 108 audiohw_set_monitor(true); /* analog bypass */
109 /* Reset PDIR2 data flow */ 109 /* Reset PDIR2 data flow */
110 DATAINCONTROL = (1 << 9); 110 DATAINCONTROL = (1 << 9);
111 } 111 }
diff --git a/firmware/target/coldfire/iriver/audio-iriver.c b/firmware/target/coldfire/iriver/audio-iriver.c
index 420ca309d8..5a5e80bc46 100644
--- a/firmware/target/coldfire/iriver/audio-iriver.c
+++ b/firmware/target/coldfire/iriver/audio-iriver.c
@@ -23,7 +23,7 @@
23 23
24/** 24/**
25 * Note that microphone is mono, only left value is used 25 * Note that microphone is mono, only left value is used
26 * See uda1380_set_recvol() for exact ranges. 26 * See audiohw_set_recvol() for exact ranges.
27 * 27 *
28 * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN 28 * @param type AUDIO_GAIN_MIC, AUDIO_GAIN_LINEIN
29 * 29 *
@@ -31,7 +31,7 @@
31void audio_set_recording_gain(int left, int right, int type) 31void audio_set_recording_gain(int left, int right, int type)
32{ 32{
33 //logf("rcmrec: t=%d l=%d r=%d", type, left, right); 33 //logf("rcmrec: t=%d l=%d r=%d", type, left, right);
34 uda1380_set_recvol(left, right, type); 34 audiohw_set_recvol(left, right, type);
35} /* audio_set_recording_gain */ 35} /* audio_set_recording_gain */
36 36
37void audio_set_output_source(int source) 37void audio_set_output_source(int source)
@@ -67,8 +67,8 @@ void audio_set_source(int source, unsigned flags)
67 case AUDIO_SRC_PLAYBACK: 67 case AUDIO_SRC_PLAYBACK:
68 if (source != last_source) 68 if (source != last_source)
69 { 69 {
70 uda1380_disable_recording(); 70 audiohw_disable_recording();
71 uda1380_set_monitor(false); 71 audiohw_set_monitor(false);
72 /* Reset PDIR2 data flow */ 72 /* Reset PDIR2 data flow */
73 DATAINCONTROL = (1 << 9); 73 DATAINCONTROL = (1 << 9);
74 } 74 }
@@ -77,8 +77,8 @@ void audio_set_source(int source, unsigned flags)
77 case AUDIO_SRC_MIC: /* recording only */ 77 case AUDIO_SRC_MIC: /* recording only */
78 if (source != last_source) 78 if (source != last_source)
79 { 79 {
80 uda1380_enable_recording(true); /* source mic */ 80 audiohw_enable_recording(true); /* source mic */
81 uda1380_set_monitor(false); 81 audiohw_set_monitor(false);
82 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ 82 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
83 DATAINCONTROL = (3 << 14) | (4 << 3); 83 DATAINCONTROL = (3 << 14) | (4 << 3);
84 } 84 }
@@ -87,8 +87,8 @@ void audio_set_source(int source, unsigned flags)
87 case AUDIO_SRC_LINEIN: /* recording only */ 87 case AUDIO_SRC_LINEIN: /* recording only */
88 if (source != last_source) 88 if (source != last_source)
89 { 89 {
90 uda1380_enable_recording(false); /* source line */ 90 audiohw_enable_recording(false); /* source line */
91 uda1380_set_monitor(false); 91 audiohw_set_monitor(false);
92 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ 92 /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */
93 DATAINCONTROL = (3 << 14) | (4 << 3); 93 DATAINCONTROL = (3 << 14) | (4 << 3);
94 } 94 }
@@ -98,8 +98,8 @@ void audio_set_source(int source, unsigned flags)
98 case AUDIO_SRC_SPDIF: /* recording only */ 98 case AUDIO_SRC_SPDIF: /* recording only */
99 if (source != last_source) 99 if (source != last_source)
100 { 100 {
101 uda1380_disable_recording(); 101 audiohw_disable_recording();
102 uda1380_set_monitor(false); 102 audiohw_set_monitor(false);
103 /* Int. when 6 samples in FIFO, PDIR2 src = ebu1RcvData */ 103 /* Int. when 6 samples in FIFO, PDIR2 src = ebu1RcvData */
104 DATAINCONTROL = (3 << 14) | (7 << 3); 104 DATAINCONTROL = (3 << 14) | (7 << 3);
105 } 105 }
@@ -108,7 +108,7 @@ void audio_set_source(int source, unsigned flags)
108 108
109 case AUDIO_SRC_FMRADIO: /* recording and playback */ 109 case AUDIO_SRC_FMRADIO: /* recording and playback */
110 if (!recording) 110 if (!recording)
111 uda1380_set_recvol(0, 0, AUDIO_GAIN_LINEIN); 111 audiohw_set_recvol(0, 0, AUDIO_GAIN_LINEIN);
112 112
113 if (source == last_source && recording == last_recording) 113 if (source == last_source && recording == last_recording)
114 break; 114 break;
@@ -127,8 +127,8 @@ void audio_set_source(int source, unsigned flags)
127 } 127 }
128 128
129 /* I2S recording and playback */ 129 /* I2S recording and playback */
130 uda1380_enable_recording(false); /* source line */ 130 audiohw_enable_recording(false); /* source line */
131 uda1380_set_monitor(!recording); 131 audiohw_set_monitor(!recording);
132 break; 132 break;
133 } /* end switch */ 133 } /* end switch */
134 134
diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c
index 4e4e557d9b..6db3e943dc 100644
--- a/firmware/target/coldfire/pcm-coldfire.c
+++ b/firmware/target/coldfire/pcm-coldfire.c
@@ -30,17 +30,6 @@
30#include "spdif.h" 30#include "spdif.h"
31#endif 31#endif
32 32
33/* Avoid further #ifdef's for some codec functions */
34#if defined(HAVE_UDA1380)
35#define ac_init uda1380_init
36#define ac_mute uda1380_mute
37#define ac_set_frequency uda1380_set_frequency
38#elif defined(HAVE_TLV320)
39#define ac_init tlv320_init
40#define ac_mute tlv320_mute
41#define ac_set_frequency tlv320_set_frequency
42#endif
43
44/* peaks */ 33/* peaks */
45static int play_peak_left, play_peak_right; 34static int play_peak_left, play_peak_right;
46static unsigned long *rec_peak_addr; 35static unsigned long *rec_peak_addr;
@@ -136,7 +125,7 @@ void pcm_apply_settings(bool reset)
136 if (pcm_freq != last_pcm_freq) 125 if (pcm_freq != last_pcm_freq)
137 { 126 {
138 last_pcm_freq = pcm_freq; 127 last_pcm_freq = pcm_freq;
139 ac_set_frequency(freq_ent[FPARM_FSEL]); 128 audiohw_set_frequency(freq_ent[FPARM_FSEL]);
140 coldfire_set_pllcr_audio_bits(PLLCR_SET_AUDIO_BITS_DEFPARM); 129 coldfire_set_pllcr_audio_bits(PLLCR_SET_AUDIO_BITS_DEFPARM);
141 } 130 }
142 131
@@ -211,7 +200,7 @@ void pcm_init(void)
211#endif 200#endif
212 201
213 /* Initialize default register values. */ 202 /* Initialize default register values. */
214 ac_init(); 203 audiohw_init();
215 204
216#if defined(HAVE_UDA1380) 205#if defined(HAVE_UDA1380)
217 /* Sleep a while so the power can stabilize (especially a long 206 /* Sleep a while so the power can stabilize (especially a long
@@ -225,7 +214,7 @@ void pcm_init(void)
225 214
226 /* UDA1380: Unmute the master channel 215 /* UDA1380: Unmute the master channel
227 (DAC should be at zero point now). */ 216 (DAC should be at zero point now). */
228 ac_mute(false); 217 audiohw_mute(false);
229 218
230 /* Call pcm_play_dma_stop to initialize everything. */ 219 /* Call pcm_play_dma_stop to initialize everything. */
231 pcm_play_dma_stop(); 220 pcm_play_dma_stop();
@@ -402,7 +391,7 @@ void pcm_record_more(void *start, size_t size)
402 391
403void pcm_mute(bool mute) 392void pcm_mute(bool mute)
404{ 393{
405 ac_mute(mute); 394 audiohw_mute(mute);
406 if (mute) 395 if (mute)
407 sleep(HZ/16); 396 sleep(HZ/16);
408} /* pcm_mute */ 397} /* pcm_mute */