diff options
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/drivers/tlv320.c | 30 | ||||
-rw-r--r-- | firmware/drivers/uda1380.c | 34 | ||||
-rw-r--r-- | firmware/drivers/wm8731l.c | 32 | ||||
-rw-r--r-- | firmware/drivers/wm8758.c | 40 | ||||
-rw-r--r-- | firmware/drivers/wm8975.c | 36 | ||||
-rw-r--r-- | firmware/export/tlv320.h | 22 | ||||
-rw-r--r-- | firmware/export/uda1380.h | 28 | ||||
-rw-r--r-- | firmware/export/wm8731l.h | 30 | ||||
-rw-r--r-- | firmware/export/wm8758.h | 34 | ||||
-rw-r--r-- | firmware/export/wm8975.h | 32 | ||||
-rw-r--r-- | firmware/export/wmcodec.h | 2 | ||||
-rw-r--r-- | firmware/pcm_playback.c | 8 | ||||
-rw-r--r-- | firmware/powermgmt.c | 6 | ||||
-rw-r--r-- | firmware/sound.c | 20 | ||||
-rw-r--r-- | firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c | 2 | ||||
-rw-r--r-- | firmware/target/arm/wmcodec-pp.c | 2 | ||||
-rw-r--r-- | firmware/target/coldfire/iaudio/x5/audio-x5.c | 20 | ||||
-rw-r--r-- | firmware/target/coldfire/iriver/audio-iriver.c | 26 | ||||
-rw-r--r-- | firmware/target/coldfire/pcm-coldfire.c | 19 |
19 files changed, 206 insertions, 217 deletions
diff --git a/firmware/drivers/tlv320.c b/firmware/drivers/tlv320.c index 7c4bbbd1ee..c9ab094ef3 100644 --- a/firmware/drivers/tlv320.c +++ b/firmware/drivers/tlv320.c | |||
@@ -67,7 +67,7 @@ void tlv320_write_reg(unsigned reg, unsigned value) | |||
67 | /** | 67 | /** |
68 | * Init our tlv with default values | 68 | * Init our tlv with default values |
69 | */ | 69 | */ |
70 | void tlv320_init(void) | 70 | void audiohw_init(void) |
71 | { | 71 | { |
72 | memset(tlv320_regs, 0, sizeof(tlv320_regs)); | 72 | memset(tlv320_regs, 0, sizeof(tlv320_regs)); |
73 | 73 | ||
@@ -75,14 +75,14 @@ void tlv320_init(void) | |||
75 | 75 | ||
76 | /* All ON except OUT, ADC, MIC and LINE */ | 76 | /* All ON except OUT, ADC, MIC and LINE */ |
77 | tlv320_write_reg(REG_PC, PC_OUT | PC_ADC | PC_MIC | PC_LINE); | 77 | tlv320_write_reg(REG_PC, PC_OUT | PC_ADC | PC_MIC | PC_LINE); |
78 | tlv320_set_recvol(0, 0, AUDIO_GAIN_MIC); | 78 | audiohw_set_recvol(0, 0, AUDIO_GAIN_MIC); |
79 | tlv320_set_recvol(0, 0, AUDIO_GAIN_LINEIN); | 79 | audiohw_set_recvol(0, 0, AUDIO_GAIN_LINEIN); |
80 | tlv320_mute(true); | 80 | audiohw_mute(true); |
81 | tlv320_write_reg(REG_AAP, AAP_DAC | AAP_MICM); | 81 | tlv320_write_reg(REG_AAP, AAP_DAC | AAP_MICM); |
82 | tlv320_write_reg(REG_DAP, 0x00); /* No deemphasis */ | 82 | tlv320_write_reg(REG_DAP, 0x00); /* No deemphasis */ |
83 | tlv320_write_reg(REG_DAIF, DAIF_IWL_16 | DAIF_FOR_I2S); | 83 | tlv320_write_reg(REG_DAIF, DAIF_IWL_16 | DAIF_FOR_I2S); |
84 | tlv320_write_reg(REG_DIA, DIA_ACT); | 84 | tlv320_write_reg(REG_DIA, DIA_ACT); |
85 | tlv320_set_frequency(-1); /* default */ | 85 | audiohw_set_frequency(-1); /* default */ |
86 | /* All ON except ADC, MIC and LINE */ | 86 | /* All ON except ADC, MIC and LINE */ |
87 | tlv320_write_reg(REG_PC, PC_ADC | PC_MIC | PC_LINE); | 87 | tlv320_write_reg(REG_PC, PC_ADC | PC_MIC | PC_LINE); |
88 | } | 88 | } |
@@ -90,7 +90,7 @@ void tlv320_init(void) | |||
90 | /** | 90 | /** |
91 | * Resets tlv320 to default values | 91 | * Resets tlv320 to default values |
92 | */ | 92 | */ |
93 | void tlv320_reset(void) | 93 | void audiohw_reset(void) |
94 | { | 94 | { |
95 | tlv320_write_reg(REG_RR, RR_RESET); | 95 | tlv320_write_reg(REG_RR, RR_RESET); |
96 | } | 96 | } |
@@ -104,7 +104,7 @@ void tlv320_reset(void) | |||
104 | * 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default) | 104 | * 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default) |
105 | * 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2 | 105 | * 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2 |
106 | */ | 106 | */ |
107 | void tlv320_set_frequency(unsigned fsel) | 107 | void audiohw_set_frequency(unsigned fsel) |
108 | { | 108 | { |
109 | /* All rates available for 11.2896MHz besides 8.021 */ | 109 | /* All rates available for 11.2896MHz besides 8.021 */ |
110 | unsigned char values_src[3] = | 110 | unsigned char values_src[3] = |
@@ -126,7 +126,7 @@ void tlv320_set_frequency(unsigned fsel) | |||
126 | * | 126 | * |
127 | * Left & Right: 48 .. 121 .. 127 => Volume -73dB (mute) .. +0 dB .. +6 dB | 127 | * Left & Right: 48 .. 121 .. 127 => Volume -73dB (mute) .. +0 dB .. +6 dB |
128 | */ | 128 | */ |
129 | void tlv320_set_headphone_vol(int vol_l, int vol_r) | 129 | void audiohw_set_headphone_vol(int vol_l, int vol_r) |
130 | { | 130 | { |
131 | unsigned value_dap = tlv320_regs[REG_DAP]; | 131 | unsigned value_dap = tlv320_regs[REG_DAP]; |
132 | unsigned value_dap_last = value_dap; | 132 | unsigned value_dap_last = value_dap; |
@@ -156,7 +156,7 @@ void tlv320_set_headphone_vol(int vol_l, int vol_r) | |||
156 | * Mic (left): 0 .. 1 => Volume +0, +20 dB | 156 | * Mic (left): 0 .. 1 => Volume +0, +20 dB |
157 | * | 157 | * |
158 | */ | 158 | */ |
159 | void tlv320_set_recvol(int left, int right, int type) | 159 | void audiohw_set_recvol(int left, int right, int type) |
160 | { | 160 | { |
161 | if (type == AUDIO_GAIN_MIC) | 161 | if (type == AUDIO_GAIN_MIC) |
162 | { | 162 | { |
@@ -180,7 +180,7 @@ void tlv320_set_recvol(int left, int right, int type) | |||
180 | * Mute (mute=true) or enable sound (mute=false) | 180 | * Mute (mute=true) or enable sound (mute=false) |
181 | * | 181 | * |
182 | */ | 182 | */ |
183 | void tlv320_mute(bool mute) | 183 | void audiohw_mute(bool mute) |
184 | { | 184 | { |
185 | unsigned value_dap = tlv320_regs[REG_DAP]; | 185 | unsigned value_dap = tlv320_regs[REG_DAP]; |
186 | unsigned value_l, value_r; | 186 | unsigned value_l, value_r; |
@@ -205,16 +205,16 @@ void tlv320_mute(bool mute) | |||
205 | } | 205 | } |
206 | 206 | ||
207 | /* Nice shutdown of TLV320 codec */ | 207 | /* Nice shutdown of TLV320 codec */ |
208 | void tlv320_close(void) | 208 | void audiohw_close(void) |
209 | { | 209 | { |
210 | tlv320_mute(true); | 210 | audiohw_mute(true); |
211 | sleep(HZ/8); | 211 | sleep(HZ/8); |
212 | 212 | ||
213 | tlv320_write_reg(REG_PC, PC_OFF | PC_CLK | PC_OSC | PC_OUT | | 213 | tlv320_write_reg(REG_PC, PC_OFF | PC_CLK | PC_OSC | PC_OUT | |
214 | PC_DAC | PC_ADC | PC_MIC | PC_LINE); /* All OFF */ | 214 | PC_DAC | PC_ADC | PC_MIC | PC_LINE); /* All OFF */ |
215 | } | 215 | } |
216 | 216 | ||
217 | void tlv320_enable_recording(bool source_mic) | 217 | void audiohw_enable_recording(bool source_mic) |
218 | { | 218 | { |
219 | unsigned value_aap, value_pc; | 219 | unsigned value_aap, value_pc; |
220 | 220 | ||
@@ -234,7 +234,7 @@ void tlv320_enable_recording(bool source_mic) | |||
234 | tlv320_write_reg(REG_AAP, value_aap); | 234 | tlv320_write_reg(REG_AAP, value_aap); |
235 | } | 235 | } |
236 | 236 | ||
237 | void tlv320_disable_recording(void) | 237 | void audiohw_disable_recording(void) |
238 | { | 238 | { |
239 | unsigned value_pc = tlv320_regs[REG_PC]; | 239 | unsigned value_pc = tlv320_regs[REG_PC]; |
240 | unsigned value_aap = tlv320_regs[REG_AAP]; | 240 | unsigned value_aap = tlv320_regs[REG_AAP]; |
@@ -246,7 +246,7 @@ void tlv320_disable_recording(void) | |||
246 | tlv320_write_reg(REG_PC, value_pc); | 246 | tlv320_write_reg(REG_PC, value_pc); |
247 | } | 247 | } |
248 | 248 | ||
249 | void tlv320_set_monitor(bool enable) | 249 | void audiohw_set_monitor(bool enable) |
250 | { | 250 | { |
251 | unsigned value_aap, value_pc; | 251 | unsigned value_aap, value_pc; |
252 | 252 | ||
diff --git a/firmware/drivers/uda1380.c b/firmware/drivers/uda1380.c index 82bf6d1ae1..841e7fbd19 100644 --- a/firmware/drivers/uda1380.c +++ b/firmware/drivers/uda1380.c | |||
@@ -97,7 +97,7 @@ int uda1380_write_reg(unsigned char reg, unsigned short value) | |||
97 | /** | 97 | /** |
98 | * Sets left and right master volume (0(max) to 252(muted)) | 98 | * Sets left and right master volume (0(max) to 252(muted)) |
99 | */ | 99 | */ |
100 | int uda1380_set_master_vol(int vol_l, int vol_r) | 100 | int audiohw_set_master_vol(int vol_l, int vol_r) |
101 | { | 101 | { |
102 | return uda1380_write_reg(REG_MASTER_VOL, | 102 | return uda1380_write_reg(REG_MASTER_VOL, |
103 | MASTER_VOL_LEFT(vol_l) | MASTER_VOL_RIGHT(vol_r)); | 103 | MASTER_VOL_LEFT(vol_l) | MASTER_VOL_RIGHT(vol_r)); |
@@ -106,7 +106,7 @@ int uda1380_set_master_vol(int vol_l, int vol_r) | |||
106 | /** | 106 | /** |
107 | * Sets mixer volume for both channels (0(max) to 228(muted)) | 107 | * Sets mixer volume for both channels (0(max) to 228(muted)) |
108 | */ | 108 | */ |
109 | int uda1380_set_mixer_vol(int channel1, int channel2) | 109 | int audiohw_set_mixer_vol(int channel1, int channel2) |
110 | { | 110 | { |
111 | return uda1380_write_reg(REG_MIX_VOL, | 111 | return uda1380_write_reg(REG_MIX_VOL, |
112 | MIX_VOL_CH_1(channel1) | MIX_VOL_CH_2(channel2)); | 112 | MIX_VOL_CH_1(channel1) | MIX_VOL_CH_2(channel2)); |
@@ -115,7 +115,7 @@ int uda1380_set_mixer_vol(int channel1, int channel2) | |||
115 | /** | 115 | /** |
116 | * Sets the bass value (0-12) | 116 | * Sets the bass value (0-12) |
117 | */ | 117 | */ |
118 | void uda1380_set_bass(int value) | 118 | void audiohw_set_bass(int value) |
119 | { | 119 | { |
120 | uda1380_write_reg(REG_EQ, (uda1380_regs[REG_EQ] & ~BASS_MASK) | 120 | uda1380_write_reg(REG_EQ, (uda1380_regs[REG_EQ] & ~BASS_MASK) |
121 | | BASSL(value) | BASSR(value)); | 121 | | BASSL(value) | BASSR(value)); |
@@ -124,7 +124,7 @@ void uda1380_set_bass(int value) | |||
124 | /** | 124 | /** |
125 | * Sets the treble value (0-3) | 125 | * Sets the treble value (0-3) |
126 | */ | 126 | */ |
127 | void uda1380_set_treble(int value) | 127 | void audiohw_set_treble(int value) |
128 | { | 128 | { |
129 | uda1380_write_reg(REG_EQ, (uda1380_regs[REG_EQ] & ~TREBLE_MASK) | 129 | uda1380_write_reg(REG_EQ, (uda1380_regs[REG_EQ] & ~TREBLE_MASK) |
130 | | TREBLEL(value) | TREBLER(value)); | 130 | | TREBLEL(value) | TREBLER(value)); |
@@ -134,7 +134,7 @@ void uda1380_set_treble(int value) | |||
134 | * Mute (mute=1) or enable sound (mute=0) | 134 | * Mute (mute=1) or enable sound (mute=0) |
135 | * | 135 | * |
136 | */ | 136 | */ |
137 | int uda1380_mute(int mute) | 137 | int audiohw_mute(int mute) |
138 | { | 138 | { |
139 | unsigned int value = uda1380_regs[REG_MUTE]; | 139 | unsigned int value = uda1380_regs[REG_MUTE]; |
140 | 140 | ||
@@ -147,7 +147,7 @@ int uda1380_mute(int mute) | |||
147 | } | 147 | } |
148 | 148 | ||
149 | /* Returns 0 if successful or -1 if some register failed */ | 149 | /* Returns 0 if successful or -1 if some register failed */ |
150 | int uda1380_set_regs(void) | 150 | int audiohw_set_regs(void) |
151 | { | 151 | { |
152 | int i; | 152 | int i; |
153 | memset(uda1380_regs, 0, sizeof(uda1380_regs)); | 153 | memset(uda1380_regs, 0, sizeof(uda1380_regs)); |
@@ -166,7 +166,7 @@ int uda1380_set_regs(void) | |||
166 | } | 166 | } |
167 | 167 | ||
168 | /* Silently enable / disable audio output */ | 168 | /* Silently enable / disable audio output */ |
169 | void uda1380_enable_output(bool enable) | 169 | void audiohw_enable_output(bool enable) |
170 | { | 170 | { |
171 | if (enable) { | 171 | if (enable) { |
172 | uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] | PON_DAC | PON_HP); | 172 | uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] | PON_DAC | PON_HP); |
@@ -176,7 +176,7 @@ void uda1380_enable_output(bool enable) | |||
176 | } | 176 | } |
177 | } | 177 | } |
178 | 178 | ||
179 | void uda1380_reset(void) | 179 | void audiohw_reset(void) |
180 | { | 180 | { |
181 | #ifdef IRIVER_H300_SERIES | 181 | #ifdef IRIVER_H300_SERIES |
182 | int mask = set_irq_level(HIGHEST_IRQ_LEVEL); | 182 | int mask = set_irq_level(HIGHEST_IRQ_LEVEL); |
@@ -203,7 +203,7 @@ void uda1380_reset(void) | |||
203 | * 44100: 2 = 25 to 50 MCLK SCLK, LRCK: Audio Clk / 4 (default) | 203 | * 44100: 2 = 25 to 50 MCLK SCLK, LRCK: Audio Clk / 4 (default) |
204 | * 88200: 3 = 50 to 100 MCLK SCLK, LRCK: Audio Clk / 2 <= TODO: Needs WSPLL | 204 | * 88200: 3 = 50 to 100 MCLK SCLK, LRCK: Audio Clk / 2 <= TODO: Needs WSPLL |
205 | */ | 205 | */ |
206 | void uda1380_set_frequency(unsigned fsel) | 206 | void audiohw_set_frequency(unsigned fsel) |
207 | { | 207 | { |
208 | static const unsigned short values_reg[4][2] = | 208 | static const unsigned short values_reg[4][2] = |
209 | { | 209 | { |
@@ -231,21 +231,21 @@ void uda1380_set_frequency(unsigned fsel) | |||
231 | } | 231 | } |
232 | 232 | ||
233 | /* Initialize UDA1380 codec with default register values (uda1380_defaults) */ | 233 | /* Initialize UDA1380 codec with default register values (uda1380_defaults) */ |
234 | int uda1380_init(void) | 234 | int audiohw_init(void) |
235 | { | 235 | { |
236 | recgain_mic = 0; | 236 | recgain_mic = 0; |
237 | recgain_line = 0; | 237 | recgain_line = 0; |
238 | 238 | ||
239 | uda1380_reset(); | 239 | audiohw_reset(); |
240 | 240 | ||
241 | if (uda1380_set_regs() == -1) | 241 | if (audiohw_set_regs() == -1) |
242 | return -1; | 242 | return -1; |
243 | 243 | ||
244 | return 0; | 244 | return 0; |
245 | } | 245 | } |
246 | 246 | ||
247 | /* Nice shutdown of UDA1380 codec */ | 247 | /* Nice shutdown of UDA1380 codec */ |
248 | void uda1380_close(void) | 248 | void audiohw_close(void) |
249 | { | 249 | { |
250 | /* First enable mute and sleep a while */ | 250 | /* First enable mute and sleep a while */ |
251 | uda1380_write_reg(REG_MUTE, MUTE_MASTER); | 251 | uda1380_write_reg(REG_MUTE, MUTE_MASTER); |
@@ -263,7 +263,7 @@ void uda1380_close(void) | |||
263 | * | 263 | * |
264 | * source_mic: true=record from microphone, false=record from line-in (or radio) | 264 | * source_mic: true=record from microphone, false=record from line-in (or radio) |
265 | */ | 265 | */ |
266 | void uda1380_enable_recording(bool source_mic) | 266 | void audiohw_enable_recording(bool source_mic) |
267 | { | 267 | { |
268 | uda1380_regs[REG_0] &= ~(ADC_CLK | DAC_CLK); | 268 | uda1380_regs[REG_0] &= ~(ADC_CLK | DAC_CLK); |
269 | uda1380_write_reg(REG_0, uda1380_regs[REG_0] | EN_ADC); | 269 | uda1380_write_reg(REG_0, uda1380_regs[REG_0] | EN_ADC); |
@@ -298,7 +298,7 @@ void uda1380_enable_recording(bool source_mic) | |||
298 | /** | 298 | /** |
299 | * Stop sending samples on the I2S bus | 299 | * Stop sending samples on the I2S bus |
300 | */ | 300 | */ |
301 | void uda1380_disable_recording(void) | 301 | void audiohw_disable_recording(void) |
302 | { | 302 | { |
303 | uda1380_write_reg(REG_PGA, MUTE_ADC); | 303 | uda1380_write_reg(REG_PGA, MUTE_ADC); |
304 | sleep(HZ/8); | 304 | sleep(HZ/8); |
@@ -327,7 +327,7 @@ void uda1380_disable_recording(void) | |||
327 | be a peak or a dip. The small glitch is caused by the time between | 327 | be a peak or a dip. The small glitch is caused by the time between |
328 | setting the two gains | 328 | setting the two gains |
329 | */ | 329 | */ |
330 | void uda1380_set_recvol(int left, int right, int type) | 330 | void audiohw_set_recvol(int left, int right, int type) |
331 | { | 331 | { |
332 | int left_ag, right_ag; | 332 | int left_ag, right_ag; |
333 | 333 | ||
@@ -412,7 +412,7 @@ void uda1380_set_recvol(int left, int right, int type) | |||
412 | * Enable or disable recording monitor (so one can listen to the recording) | 412 | * Enable or disable recording monitor (so one can listen to the recording) |
413 | * | 413 | * |
414 | */ | 414 | */ |
415 | void uda1380_set_monitor(int enable) | 415 | void audiohw_set_monitor(int enable) |
416 | { | 416 | { |
417 | if (enable) /* enable channel 2 */ | 417 | if (enable) /* enable channel 2 */ |
418 | uda1380_write_reg(REG_MUTE, uda1380_regs[REG_MUTE] & ~MUTE_CH2); | 418 | uda1380_write_reg(REG_MUTE, uda1380_regs[REG_MUTE] & ~MUTE_CH2); |
diff --git a/firmware/drivers/wm8731l.c b/firmware/drivers/wm8731l.c index be9bf14099..4fc33f882d 100644 --- a/firmware/drivers/wm8731l.c +++ b/firmware/drivers/wm8731l.c | |||
@@ -43,7 +43,7 @@ | |||
43 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ | 43 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ |
44 | 44 | ||
45 | 45 | ||
46 | int wmcodec_mute(int mute) | 46 | int audiohw_mute(int mute) |
47 | { | 47 | { |
48 | if (mute) | 48 | if (mute) |
49 | { | 49 | { |
@@ -70,7 +70,7 @@ static void codec_set_active(int active) | |||
70 | 70 | ||
71 | 71 | ||
72 | /* Silently enable / disable audio output */ | 72 | /* Silently enable / disable audio output */ |
73 | void wmcodec_enable_output(bool enable) | 73 | void audiohw_enable_output(bool enable) |
74 | { | 74 | { |
75 | if (enable) | 75 | if (enable) |
76 | { | 76 | { |
@@ -96,7 +96,7 @@ void wmcodec_enable_output(bool enable) | |||
96 | /* IWL=00(16 bit) FORMAT=10(I2S format) */ | 96 | /* IWL=00(16 bit) FORMAT=10(I2S format) */ |
97 | wmcodec_write(AINTFCE, 0x42); | 97 | wmcodec_write(AINTFCE, 0x42); |
98 | 98 | ||
99 | wmcodec_set_sample_rate(WM8731L_44100HZ); | 99 | audiohw_set_sample_rate(WM8731L_44100HZ); |
100 | 100 | ||
101 | /* set the volume to -6dB */ | 101 | /* set the volume to -6dB */ |
102 | wmcodec_write(LOUTVOL, IPOD_PCM_LEVEL); | 102 | wmcodec_write(LOUTVOL, IPOD_PCM_LEVEL); |
@@ -112,17 +112,17 @@ void wmcodec_enable_output(bool enable) | |||
112 | /* We need to enable bit 4 of GPIOL for output for sound on H10 */ | 112 | /* We need to enable bit 4 of GPIOL for output for sound on H10 */ |
113 | GPIOL_OUTPUT_VAL |= 0x10; | 113 | GPIOL_OUTPUT_VAL |= 0x10; |
114 | #endif | 114 | #endif |
115 | wmcodec_mute(0); | 115 | audiohw_mute(0); |
116 | } else { | 116 | } else { |
117 | #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) | 117 | #if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) |
118 | /* We need to disable bit 4 of GPIOL to disable sound on H10 */ | 118 | /* We need to disable bit 4 of GPIOL to disable sound on H10 */ |
119 | GPIOL_OUTPUT_VAL &= ~0x10; | 119 | GPIOL_OUTPUT_VAL &= ~0x10; |
120 | #endif | 120 | #endif |
121 | wmcodec_mute(1); | 121 | audiohw_mute(1); |
122 | } | 122 | } |
123 | } | 123 | } |
124 | 124 | ||
125 | int wmcodec_set_master_vol(int vol_l, int vol_r) | 125 | int audiohw_set_master_vol(int vol_l, int vol_r) |
126 | { | 126 | { |
127 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ | 127 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ |
128 | /* 1111111 == +6dB */ | 128 | /* 1111111 == +6dB */ |
@@ -136,7 +136,7 @@ int wmcodec_set_master_vol(int vol_l, int vol_r) | |||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | int wmcodec_set_mixer_vol(int channel1, int channel2) | 139 | int audiohw_set_mixer_vol(int channel1, int channel2) |
140 | { | 140 | { |
141 | (void)channel1; | 141 | (void)channel1; |
142 | (void)channel2; | 142 | (void)channel2; |
@@ -144,18 +144,18 @@ int wmcodec_set_mixer_vol(int channel1, int channel2) | |||
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
146 | 146 | ||
147 | void wmcodec_set_bass(int value) | 147 | void audiohw_set_bass(int value) |
148 | { | 148 | { |
149 | (void)value; | 149 | (void)value; |
150 | } | 150 | } |
151 | 151 | ||
152 | void wmcodec_set_treble(int value) | 152 | void audiohw_set_treble(int value) |
153 | { | 153 | { |
154 | (void)value; | 154 | (void)value; |
155 | } | 155 | } |
156 | 156 | ||
157 | /* Nice shutdown of WM8731 codec */ | 157 | /* Nice shutdown of WM8731 codec */ |
158 | void wmcodec_close(void) | 158 | void audiohw_close(void) |
159 | { | 159 | { |
160 | /* set DACMU=1 DEEMPH=0 */ | 160 | /* set DACMU=1 DEEMPH=0 */ |
161 | wmcodec_write(DACCTRL, 0x8); | 161 | wmcodec_write(DACCTRL, 0x8); |
@@ -177,36 +177,36 @@ void wmcodec_close(void) | |||
177 | } | 177 | } |
178 | 178 | ||
179 | /* Change the order of the noise shaper, 5th order is recommended above 32kHz */ | 179 | /* Change the order of the noise shaper, 5th order is recommended above 32kHz */ |
180 | void wmcodec_set_nsorder(int order) | 180 | void audiohw_set_nsorder(int order) |
181 | { | 181 | { |
182 | (void)order; | 182 | (void)order; |
183 | } | 183 | } |
184 | 184 | ||
185 | void wmcodec_set_sample_rate(int sampling_control) | 185 | void audiohw_set_sample_rate(int sampling_control) |
186 | { | 186 | { |
187 | codec_set_active(0x0); | 187 | codec_set_active(0x0); |
188 | wmcodec_write(SAMPCTRL, sampling_control); | 188 | wmcodec_write(SAMPCTRL, sampling_control); |
189 | codec_set_active(0x1); | 189 | codec_set_active(0x1); |
190 | } | 190 | } |
191 | 191 | ||
192 | void wmcodec_enable_recording(bool source_mic) | 192 | void audiohw_enable_recording(bool source_mic) |
193 | { | 193 | { |
194 | (void)source_mic; | 194 | (void)source_mic; |
195 | } | 195 | } |
196 | 196 | ||
197 | void wmcodec_disable_recording(void) | 197 | void audiohw_disable_recording(void) |
198 | { | 198 | { |
199 | 199 | ||
200 | } | 200 | } |
201 | 201 | ||
202 | void wmcodec_set_recvol(int left, int right, int type) | 202 | void audiohw_set_recvol(int left, int right, int type) |
203 | { | 203 | { |
204 | (void)left; | 204 | (void)left; |
205 | (void)right; | 205 | (void)right; |
206 | (void)type; | 206 | (void)type; |
207 | } | 207 | } |
208 | 208 | ||
209 | void wmcodec_set_monitor(int enable) | 209 | void audiohw_set_monitor(int enable) |
210 | { | 210 | { |
211 | (void)enable; | 211 | (void)enable; |
212 | } | 212 | } |
diff --git a/firmware/drivers/wm8758.c b/firmware/drivers/wm8758.c index bdc9c8b450..3a4256bb69 100644 --- a/firmware/drivers/wm8758.c +++ b/firmware/drivers/wm8758.c | |||
@@ -40,7 +40,7 @@ | |||
40 | #include "wmcodec.h" | 40 | #include "wmcodec.h" |
41 | #include "wm8758.h" | 41 | #include "wm8758.h" |
42 | 42 | ||
43 | void wmcodec_reset(void); | 43 | void audiohw_reset(void); |
44 | 44 | ||
45 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ | 45 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ |
46 | 46 | ||
@@ -48,7 +48,7 @@ void wmcodec_reset(void); | |||
48 | //#define TREBCTRL 0x0b | 48 | //#define TREBCTRL 0x0b |
49 | 49 | ||
50 | /* Silently enable / disable audio output */ | 50 | /* Silently enable / disable audio output */ |
51 | void wmcodec_enable_output(bool enable) | 51 | void audiohw_enable_output(bool enable) |
52 | { | 52 | { |
53 | if (enable) | 53 | if (enable) |
54 | { | 54 | { |
@@ -70,17 +70,17 @@ void wmcodec_enable_output(bool enable) | |||
70 | 70 | ||
71 | /* The iPod can handle multiple frequencies, but fix at 44.1KHz | 71 | /* The iPod can handle multiple frequencies, but fix at 44.1KHz |
72 | for now */ | 72 | for now */ |
73 | wmcodec_set_sample_rate(WM8758_44100HZ); | 73 | audiohw_set_sample_rate(WM8758_44100HZ); |
74 | 74 | ||
75 | wmcodec_write(LOUTMIX,0x1); /* Enable mixer */ | 75 | wmcodec_write(LOUTMIX,0x1); /* Enable mixer */ |
76 | wmcodec_write(ROUTMIX,0x1); /* Enable mixer */ | 76 | wmcodec_write(ROUTMIX,0x1); /* Enable mixer */ |
77 | wmcodec_mute(0); | 77 | audiohw_mute(0); |
78 | } else { | 78 | } else { |
79 | wmcodec_mute(1); | 79 | audiohw_mute(1); |
80 | } | 80 | } |
81 | } | 81 | } |
82 | 82 | ||
83 | int wmcodec_set_master_vol(int vol_l, int vol_r) | 83 | int audiohw_set_master_vol(int vol_l, int vol_r) |
84 | { | 84 | { |
85 | /* OUT1 */ | 85 | /* OUT1 */ |
86 | wmcodec_write(LOUT1VOL, 0x080 | vol_l); | 86 | wmcodec_write(LOUT1VOL, 0x080 | vol_l); |
@@ -89,7 +89,7 @@ int wmcodec_set_master_vol(int vol_l, int vol_r) | |||
89 | return 0; | 89 | return 0; |
90 | } | 90 | } |
91 | 91 | ||
92 | int wmcodec_set_lineout_vol(int vol_l, int vol_r) | 92 | int audiohw_set_lineout_vol(int vol_l, int vol_r) |
93 | { | 93 | { |
94 | /* OUT2 */ | 94 | /* OUT2 */ |
95 | wmcodec_write(LOUT2VOL, vol_l); | 95 | wmcodec_write(LOUT2VOL, vol_l); |
@@ -98,7 +98,7 @@ int wmcodec_set_lineout_vol(int vol_l, int vol_r) | |||
98 | return 0; | 98 | return 0; |
99 | } | 99 | } |
100 | 100 | ||
101 | int wmcodec_set_mixer_vol(int channel1, int channel2) | 101 | int audiohw_set_mixer_vol(int channel1, int channel2) |
102 | { | 102 | { |
103 | (void)channel1; | 103 | (void)channel1; |
104 | (void)channel2; | 104 | (void)channel2; |
@@ -107,7 +107,7 @@ int wmcodec_set_mixer_vol(int channel1, int channel2) | |||
107 | } | 107 | } |
108 | 108 | ||
109 | /* We are using Linear bass control */ | 109 | /* We are using Linear bass control */ |
110 | void wmcodec_set_bass(int value) | 110 | void audiohw_set_bass(int value) |
111 | { | 111 | { |
112 | (void)value; | 112 | (void)value; |
113 | #if 0 | 113 | #if 0 |
@@ -121,7 +121,7 @@ void wmcodec_set_bass(int value) | |||
121 | #endif | 121 | #endif |
122 | } | 122 | } |
123 | 123 | ||
124 | void wmcodec_set_treble(int value) | 124 | void audiohw_set_treble(int value) |
125 | { | 125 | { |
126 | (void)value; | 126 | (void)value; |
127 | #if 0 | 127 | #if 0 |
@@ -136,7 +136,7 @@ void wmcodec_set_treble(int value) | |||
136 | 136 | ||
137 | } | 137 | } |
138 | 138 | ||
139 | int wmcodec_mute(int mute) | 139 | int audiohw_mute(int mute) |
140 | { | 140 | { |
141 | if (mute) | 141 | if (mute) |
142 | { | 142 | { |
@@ -151,9 +151,9 @@ int wmcodec_mute(int mute) | |||
151 | } | 151 | } |
152 | 152 | ||
153 | /* Nice shutdown of WM8758 codec */ | 153 | /* Nice shutdown of WM8758 codec */ |
154 | void wmcodec_close(void) | 154 | void audiohw_close(void) |
155 | { | 155 | { |
156 | wmcodec_mute(1); | 156 | audiohw_mute(1); |
157 | 157 | ||
158 | wmcodec_write(PWRMGMT3, 0x0); | 158 | wmcodec_write(PWRMGMT3, 0x0); |
159 | 159 | ||
@@ -163,13 +163,13 @@ void wmcodec_close(void) | |||
163 | } | 163 | } |
164 | 164 | ||
165 | /* Change the order of the noise shaper, 5th order is recommended above 32kHz */ | 165 | /* Change the order of the noise shaper, 5th order is recommended above 32kHz */ |
166 | void wmcodec_set_nsorder(int order) | 166 | void audiohw_set_nsorder(int order) |
167 | { | 167 | { |
168 | (void)order; | 168 | (void)order; |
169 | } | 169 | } |
170 | 170 | ||
171 | /* Note: Disable output before calling this function */ | 171 | /* Note: Disable output before calling this function */ |
172 | void wmcodec_set_sample_rate(int sampling_control) | 172 | void audiohw_set_sample_rate(int sampling_control) |
173 | { | 173 | { |
174 | /**** We force 44.1KHz for now. ****/ | 174 | /**** We force 44.1KHz for now. ****/ |
175 | (void)sampling_control; | 175 | (void)sampling_control; |
@@ -190,28 +190,28 @@ void wmcodec_set_sample_rate(int sampling_control) | |||
190 | wmcodec_write(SRATECTRL, (0 << 1)); | 190 | wmcodec_write(SRATECTRL, (0 << 1)); |
191 | } | 191 | } |
192 | 192 | ||
193 | void wmcodec_enable_recording(bool source_mic) | 193 | void audiohw_enable_recording(bool source_mic) |
194 | { | 194 | { |
195 | (void)source_mic; | 195 | (void)source_mic; |
196 | } | 196 | } |
197 | 197 | ||
198 | void wmcodec_disable_recording(void) { | 198 | void audiohw_disable_recording(void) { |
199 | 199 | ||
200 | } | 200 | } |
201 | 201 | ||
202 | void wmcodec_set_recvol(int left, int right, int type) { | 202 | void audiohw_set_recvol(int left, int right, int type) { |
203 | 203 | ||
204 | (void)left; | 204 | (void)left; |
205 | (void)right; | 205 | (void)right; |
206 | (void)type; | 206 | (void)type; |
207 | } | 207 | } |
208 | 208 | ||
209 | void wmcodec_set_monitor(int enable) { | 209 | void audiohw_set_monitor(int enable) { |
210 | 210 | ||
211 | (void)enable; | 211 | (void)enable; |
212 | } | 212 | } |
213 | 213 | ||
214 | void wmcodec_set_equalizer_band(int band, int freq, int bw, int gain) | 214 | void audiohw_set_equalizer_band(int band, int freq, int bw, int gain) |
215 | { | 215 | { |
216 | unsigned int eq = 0; | 216 | unsigned int eq = 0; |
217 | 217 | ||
diff --git a/firmware/drivers/wm8975.c b/firmware/drivers/wm8975.c index a961356222..96a563b1c9 100644 --- a/firmware/drivers/wm8975.c +++ b/firmware/drivers/wm8975.c | |||
@@ -40,13 +40,13 @@ | |||
40 | #include "wmcodec.h" | 40 | #include "wmcodec.h" |
41 | #include "wm8975.h" | 41 | #include "wm8975.h" |
42 | 42 | ||
43 | void wmcodec_reset(void); | 43 | void audiohw_reset(void); |
44 | 44 | ||
45 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ | 45 | #define IPOD_PCM_LEVEL 0x65 /* -6dB */ |
46 | 46 | ||
47 | 47 | ||
48 | /* Silently enable / disable audio output */ | 48 | /* Silently enable / disable audio output */ |
49 | void wmcodec_enable_output(bool enable) | 49 | void audiohw_enable_output(bool enable) |
50 | { | 50 | { |
51 | if (enable) | 51 | if (enable) |
52 | { | 52 | { |
@@ -77,7 +77,7 @@ void wmcodec_enable_output(bool enable) | |||
77 | wmcodec_write(AINTFCE, 0x42); | 77 | wmcodec_write(AINTFCE, 0x42); |
78 | 78 | ||
79 | /* The iPod can handle multiple frequencies, but fix at 44.1KHz for now */ | 79 | /* The iPod can handle multiple frequencies, but fix at 44.1KHz for now */ |
80 | wmcodec_set_sample_rate(WM8975_44100HZ); | 80 | audiohw_set_sample_rate(WM8975_44100HZ); |
81 | 81 | ||
82 | /* set the volume to -6dB */ | 82 | /* set the volume to -6dB */ |
83 | wmcodec_write(LOUT1VOL, IPOD_PCM_LEVEL); | 83 | wmcodec_write(LOUT1VOL, IPOD_PCM_LEVEL); |
@@ -94,13 +94,13 @@ void wmcodec_enable_output(bool enable) | |||
94 | wmcodec_write(MOUTMIX1, 0x0); /* Mono out Mix */ | 94 | wmcodec_write(MOUTMIX1, 0x0); /* Mono out Mix */ |
95 | wmcodec_write(MOUTMIX2, 0x0); | 95 | wmcodec_write(MOUTMIX2, 0x0); |
96 | 96 | ||
97 | wmcodec_mute(0); | 97 | audiohw_mute(0); |
98 | } else { | 98 | } else { |
99 | wmcodec_mute(1); | 99 | audiohw_mute(1); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
103 | int wmcodec_set_master_vol(int vol_l, int vol_r) | 103 | int audiohw_set_master_vol(int vol_l, int vol_r) |
104 | { | 104 | { |
105 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ | 105 | /* +6 to -73dB 1dB steps (plus mute == 80levels) 7bits */ |
106 | /* 1111111 == +6dB */ | 106 | /* 1111111 == +6dB */ |
@@ -115,7 +115,7 @@ int wmcodec_set_master_vol(int vol_l, int vol_r) | |||
115 | return 0; | 115 | return 0; |
116 | } | 116 | } |
117 | 117 | ||
118 | int wmcodec_set_lineout_vol(int vol_l, int vol_r) | 118 | int audiohw_set_lineout_vol(int vol_l, int vol_r) |
119 | { | 119 | { |
120 | /* OUT2 */ | 120 | /* OUT2 */ |
121 | wmcodec_write(LOUT2VOL, vol_l); | 121 | wmcodec_write(LOUT2VOL, vol_l); |
@@ -124,7 +124,7 @@ int wmcodec_set_lineout_vol(int vol_l, int vol_r) | |||
124 | return 0; | 124 | return 0; |
125 | } | 125 | } |
126 | 126 | ||
127 | int wmcodec_set_mixer_vol(int channel1, int channel2) | 127 | int audiohw_set_mixer_vol(int channel1, int channel2) |
128 | { | 128 | { |
129 | (void)channel1; | 129 | (void)channel1; |
130 | (void)channel2; | 130 | (void)channel2; |
@@ -133,7 +133,7 @@ int wmcodec_set_mixer_vol(int channel1, int channel2) | |||
133 | } | 133 | } |
134 | 134 | ||
135 | /* We are using Linear bass control */ | 135 | /* We are using Linear bass control */ |
136 | void wmcodec_set_bass(int value) | 136 | void audiohw_set_bass(int value) |
137 | { | 137 | { |
138 | int regvalues[]={11, 10, 10, 9, 8, 8, 0xf , 6, 6, 5, 4, 4, 3, 2, 1, 0}; | 138 | int regvalues[]={11, 10, 10, 9, 8, 8, 0xf , 6, 6, 5, 4, 4, 3, 2, 1, 0}; |
139 | 139 | ||
@@ -143,7 +143,7 @@ void wmcodec_set_bass(int value) | |||
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | void wmcodec_set_treble(int value) | 146 | void audiohw_set_treble(int value) |
147 | { | 147 | { |
148 | int regvalues[]={11, 10, 10, 9, 8, 8, 0xf , 6, 6, 5, 4, 4, 3, 2, 1, 0}; | 148 | int regvalues[]={11, 10, 10, 9, 8, 8, 0xf , 6, 6, 5, 4, 4, 3, 2, 1, 0}; |
149 | 149 | ||
@@ -153,7 +153,7 @@ void wmcodec_set_treble(int value) | |||
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | int wmcodec_mute(int mute) | 156 | int audiohw_mute(int mute) |
157 | { | 157 | { |
158 | if (mute) | 158 | if (mute) |
159 | { | 159 | { |
@@ -168,7 +168,7 @@ int wmcodec_mute(int mute) | |||
168 | } | 168 | } |
169 | 169 | ||
170 | /* Nice shutdown of WM8975 codec */ | 170 | /* Nice shutdown of WM8975 codec */ |
171 | void wmcodec_close(void) | 171 | void audiohw_close(void) |
172 | { | 172 | { |
173 | /* 1. Set DACMU = 1 to soft-mute the audio DACs. */ | 173 | /* 1. Set DACMU = 1 to soft-mute the audio DACs. */ |
174 | wmcodec_write(DACCTRL, 0x8); | 174 | wmcodec_write(DACCTRL, 0x8); |
@@ -181,35 +181,35 @@ void wmcodec_close(void) | |||
181 | } | 181 | } |
182 | 182 | ||
183 | /* Change the order of the noise shaper, 5th order is recommended above 32kHz */ | 183 | /* Change the order of the noise shaper, 5th order is recommended above 32kHz */ |
184 | void wmcodec_set_nsorder(int order) | 184 | void audiohw_set_nsorder(int order) |
185 | { | 185 | { |
186 | (void)order; | 186 | (void)order; |
187 | } | 187 | } |
188 | 188 | ||
189 | /* Note: Disable output before calling this function */ | 189 | /* Note: Disable output before calling this function */ |
190 | void wmcodec_set_sample_rate(int sampling_control) { | 190 | void audiohw_set_sample_rate(int sampling_control) { |
191 | 191 | ||
192 | wmcodec_write(0x08, sampling_control); | 192 | wmcodec_write(0x08, sampling_control); |
193 | 193 | ||
194 | } | 194 | } |
195 | 195 | ||
196 | void wmcodec_enable_recording(bool source_mic) { | 196 | void audiohw_enable_recording(bool source_mic) { |
197 | 197 | ||
198 | (void)source_mic; | 198 | (void)source_mic; |
199 | } | 199 | } |
200 | 200 | ||
201 | void wmcodec_disable_recording(void) { | 201 | void audiohw_disable_recording(void) { |
202 | 202 | ||
203 | } | 203 | } |
204 | 204 | ||
205 | void wmcodec_set_recvol(int left, int right, int type) { | 205 | void audiohw_set_recvol(int left, int right, int type) { |
206 | 206 | ||
207 | (void)left; | 207 | (void)left; |
208 | (void)right; | 208 | (void)right; |
209 | (void)type; | 209 | (void)type; |
210 | } | 210 | } |
211 | 211 | ||
212 | void wmcodec_set_monitor(int enable) { | 212 | void audiohw_set_monitor(int enable) { |
213 | 213 | ||
214 | (void)enable; | 214 | (void)enable; |
215 | } | 215 | } |
diff --git a/firmware/export/tlv320.h b/firmware/export/tlv320.h index 023ec9d874..dbb17e35bc 100644 --- a/firmware/export/tlv320.h +++ b/firmware/export/tlv320.h | |||
@@ -22,8 +22,8 @@ | |||
22 | 22 | ||
23 | /*** definitions ***/ | 23 | /*** definitions ***/ |
24 | 24 | ||
25 | extern void tlv320_init(void); | 25 | extern void audiohw_init(void); |
26 | extern void tlv320_reset(void); | 26 | extern void audiohw_reset(void); |
27 | /** | 27 | /** |
28 | * Sets internal sample rate for DAC and ADC relative to MCLK | 28 | * Sets internal sample rate for DAC and ADC relative to MCLK |
29 | * Selection for frequency: | 29 | * Selection for frequency: |
@@ -33,15 +33,15 @@ extern void tlv320_reset(void); | |||
33 | * 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default) | 33 | * 44100: 1 = MCLK MCLK SCLK, LRCK: Audio Clk / 4 (default) |
34 | * 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2 | 34 | * 88200: 2 = MCLK*2 MCLK SCLK, LRCK: Audio Clk / 2 |
35 | */ | 35 | */ |
36 | extern void tlv320_set_frequency(unsigned fsel); | 36 | extern void audiohw_set_frequency(unsigned fsel); |
37 | extern void tlv320_enable_output(bool enable); | 37 | extern void audiohw_enable_output(bool enable); |
38 | extern void tlv320_set_headphone_vol(int vol_l, int vol_r); | 38 | extern void audiohw_set_headphone_vol(int vol_l, int vol_r); |
39 | extern void tlv320_set_recvol(int left, int right, int type); | 39 | extern void audiohw_set_recvol(int left, int right, int type); |
40 | extern void tlv320_mute(bool mute); | 40 | extern void audiohw_mute(bool mute); |
41 | extern void tlv320_close(void); | 41 | extern void audiohw_close(void); |
42 | extern void tlv320_enable_recording(bool source_mic); | 42 | extern void audiohw_enable_recording(bool source_mic); |
43 | extern void tlv320_disable_recording(void); | 43 | extern void audiohw_disable_recording(void); |
44 | extern void tlv320_set_monitor(bool enable); | 44 | extern void audiohw_set_monitor(bool enable); |
45 | 45 | ||
46 | #define HEADPHONE_MUTE 0x30 /* 0110000 = -73db */ | 46 | #define HEADPHONE_MUTE 0x30 /* 0110000 = -73db */ |
47 | 47 | ||
diff --git a/firmware/export/uda1380.h b/firmware/export/uda1380.h index 639ca8aa5c..4b70e795bf 100644 --- a/firmware/export/uda1380.h +++ b/firmware/export/uda1380.h | |||
@@ -19,15 +19,15 @@ | |||
19 | 19 | ||
20 | #ifndef _UDA1380_H | 20 | #ifndef _UDA1380_H |
21 | #define _UDA1380_H | 21 | #define _UDA1380_H |
22 | extern void uda1380_reset(void); | 22 | extern void audiohw_reset(void); |
23 | extern int uda1380_init(void); | 23 | extern int audiohw_init(void); |
24 | extern void uda1380_enable_output(bool enable); | 24 | extern void audiohw_enable_output(bool enable); |
25 | extern int uda1380_set_master_vol(int vol_l, int vol_r); | 25 | extern int audiohw_set_master_vol(int vol_l, int vol_r); |
26 | extern int uda1380_set_mixer_vol(int channel1, int channel2); | 26 | extern int audiohw_set_mixer_vol(int channel1, int channel2); |
27 | extern void uda1380_set_bass(int value); | 27 | extern void audiohw_set_bass(int value); |
28 | extern void uda1380_set_treble(int value); | 28 | extern void audiohw_set_treble(int value); |
29 | extern int uda1380_mute(int mute); | 29 | extern int audiohw_mute(int mute); |
30 | extern void uda1380_close(void); | 30 | extern void audiohw_close(void); |
31 | /** | 31 | /** |
32 | * Sets frequency settings for DAC and ADC relative to MCLK | 32 | * Sets frequency settings for DAC and ADC relative to MCLK |
33 | * | 33 | * |
@@ -38,11 +38,11 @@ extern void uda1380_close(void); | |||
38 | * 44100: 2 = 25 to 50 SCLK, LRCK: Audio Clk / 4 (default) | 38 | * 44100: 2 = 25 to 50 SCLK, LRCK: Audio Clk / 4 (default) |
39 | * 88200: 3 = 50 to 100 SCLK, LRCK: Audio Clk / 2 | 39 | * 88200: 3 = 50 to 100 SCLK, LRCK: Audio Clk / 2 |
40 | */ | 40 | */ |
41 | extern void uda1380_set_frequency(unsigned fsel); | 41 | extern void audiohw_set_frequency(unsigned fsel); |
42 | extern void uda1380_enable_recording(bool source_mic); | 42 | extern void audiohw_enable_recording(bool source_mic); |
43 | extern void uda1380_disable_recording(void); | 43 | extern void audiohw_disable_recording(void); |
44 | extern void uda1380_set_recvol(int left, int right, int type); | 44 | extern void audiohw_set_recvol(int left, int right, int type); |
45 | extern void uda1380_set_monitor(int enable); | 45 | extern void audiohw_set_monitor(int enable); |
46 | 46 | ||
47 | #define UDA1380_ADDR 0x30 | 47 | #define UDA1380_ADDR 0x30 |
48 | 48 | ||
diff --git a/firmware/export/wm8731l.h b/firmware/export/wm8731l.h index 7e123afd64..5783be17cc 100644 --- a/firmware/export/wm8731l.h +++ b/firmware/export/wm8731l.h | |||
@@ -20,22 +20,22 @@ | |||
20 | #ifndef _WM8731L_H | 20 | #ifndef _WM8731L_H |
21 | #define _WM8731L_H | 21 | #define _WM8731L_H |
22 | 22 | ||
23 | extern void wmcodec_reset(void); | 23 | extern void audiohw_reset(void); |
24 | extern int wmcodec_init(void); | 24 | extern int audiohw_init(void); |
25 | extern void wmcodec_enable_output(bool enable); | 25 | extern void audiohw_enable_output(bool enable); |
26 | extern int wmcodec_set_master_vol(int vol_l, int vol_r); | 26 | extern int audiohw_set_master_vol(int vol_l, int vol_r); |
27 | extern int wmcodec_set_mixer_vol(int channel1, int channel2); | 27 | extern int audiohw_set_mixer_vol(int channel1, int channel2); |
28 | extern void wmcodec_set_bass(int value); | 28 | extern void audiohw_set_bass(int value); |
29 | extern void wmcodec_set_treble(int value); | 29 | extern void audiohw_set_treble(int value); |
30 | extern int wmcodec_mute(int mute); | 30 | extern int audiohw_mute(int mute); |
31 | extern void wmcodec_close(void); | 31 | extern void audiohw_close(void); |
32 | extern void wmcodec_set_nsorder(int order); | 32 | extern void audiohw_set_nsorder(int order); |
33 | extern void wmcodec_set_sample_rate(int sampling_control); | 33 | extern void audiohw_set_sample_rate(int sampling_control); |
34 | 34 | ||
35 | extern void wmcodec_enable_recording(bool source_mic); | 35 | extern void audiohw_enable_recording(bool source_mic); |
36 | extern void wmcodec_disable_recording(void); | 36 | extern void audiohw_disable_recording(void); |
37 | extern void wmcodec_set_recvol(int left, int right, int type); | 37 | extern void audiohw_set_recvol(int left, int right, int type); |
38 | extern void wmcodec_set_monitor(int enable); | 38 | extern void audiohw_set_monitor(int enable); |
39 | 39 | ||
40 | /* Register addresses */ | 40 | /* Register addresses */ |
41 | #define LINVOL 0x00 | 41 | #define LINVOL 0x00 |
diff --git a/firmware/export/wm8758.h b/firmware/export/wm8758.h index e0b66b614f..ca7074646d 100644 --- a/firmware/export/wm8758.h +++ b/firmware/export/wm8758.h | |||
@@ -20,25 +20,25 @@ | |||
20 | #ifndef _WM8758_H | 20 | #ifndef _WM8758_H |
21 | #define _WM8758_H | 21 | #define _WM8758_H |
22 | 22 | ||
23 | extern void wmcodec_reset(void); | 23 | extern void audiohw_reset(void); |
24 | extern int wmcodec_init(void); | 24 | extern int audiohw_init(void); |
25 | extern void wmcodec_enable_output(bool enable); | 25 | extern void audiohw_enable_output(bool enable); |
26 | extern int wmcodec_set_master_vol(int vol_l, int vol_r); | 26 | extern int audiohw_set_master_vol(int vol_l, int vol_r); |
27 | extern int wmcodec_set_lineout_vol(int vol_l, int vol_r); | 27 | extern int audiohw_set_lineout_vol(int vol_l, int vol_r); |
28 | extern int wmcodec_set_mixer_vol(int channel1, int channel2); | 28 | extern int audiohw_set_mixer_vol(int channel1, int channel2); |
29 | extern void wmcodec_set_bass(int value); | 29 | extern void audiohw_set_bass(int value); |
30 | extern void wmcodec_set_treble(int value); | 30 | extern void audiohw_set_treble(int value); |
31 | extern int wmcodec_mute(int mute); | 31 | extern int audiohw_mute(int mute); |
32 | extern void wmcodec_close(void); | 32 | extern void audiohw_close(void); |
33 | extern void wmcodec_set_nsorder(int order); | 33 | extern void audiohw_set_nsorder(int order); |
34 | extern void wmcodec_set_sample_rate(int sampling_control); | 34 | extern void audiohw_set_sample_rate(int sampling_control); |
35 | 35 | ||
36 | extern void wmcodec_enable_recording(bool source_mic); | 36 | extern void audiohw_enable_recording(bool source_mic); |
37 | extern void wmcodec_disable_recording(void); | 37 | extern void audiohw_disable_recording(void); |
38 | extern void wmcodec_set_recvol(int left, int right, int type); | 38 | extern void audiohw_set_recvol(int left, int right, int type); |
39 | extern void wmcodec_set_monitor(int enable); | 39 | extern void audiohw_set_monitor(int enable); |
40 | 40 | ||
41 | extern void wmcodec_set_equalizer_band(int band, int freq, int bw, int gain); | 41 | extern void audiohw_set_equalizer_band(int band, int freq, int bw, int gain); |
42 | 42 | ||
43 | #define RESET 0x00 | 43 | #define RESET 0x00 |
44 | #define PWRMGMT1 0x01 | 44 | #define PWRMGMT1 0x01 |
diff --git a/firmware/export/wm8975.h b/firmware/export/wm8975.h index a6769390c0..005535bfaf 100644 --- a/firmware/export/wm8975.h +++ b/firmware/export/wm8975.h | |||
@@ -20,23 +20,23 @@ | |||
20 | #ifndef _WM8975_H | 20 | #ifndef _WM8975_H |
21 | #define _WM8975_H | 21 | #define _WM8975_H |
22 | 22 | ||
23 | extern void wmcodec_reset(void); | 23 | extern void audiohw_reset(void); |
24 | extern int wmcodec_init(void); | 24 | extern int audiohw_init(void); |
25 | extern void wmcodec_enable_output(bool enable); | 25 | extern void audiohw_enable_output(bool enable); |
26 | extern int wmcodec_set_master_vol(int vol_l, int vol_r); | 26 | extern int audiohw_set_master_vol(int vol_l, int vol_r); |
27 | extern int wmcodec_set_lineout_vol(int vol_l, int vol_r); | 27 | extern int audiohw_set_lineout_vol(int vol_l, int vol_r); |
28 | extern int wmcodec_set_mixer_vol(int channel1, int channel2); | 28 | extern int audiohw_set_mixer_vol(int channel1, int channel2); |
29 | extern void wmcodec_set_bass(int value); | 29 | extern void audiohw_set_bass(int value); |
30 | extern void wmcodec_set_treble(int value); | 30 | extern void audiohw_set_treble(int value); |
31 | extern int wmcodec_mute(int mute); | 31 | extern int audiohw_mute(int mute); |
32 | extern void wmcodec_close(void); | 32 | extern void audiohw_close(void); |
33 | extern void wmcodec_set_nsorder(int order); | 33 | extern void audiohw_set_nsorder(int order); |
34 | extern void wmcodec_set_sample_rate(int sampling_control); | 34 | extern void audiohw_set_sample_rate(int sampling_control); |
35 | 35 | ||
36 | extern void wmcodec_enable_recording(bool source_mic); | 36 | extern void audiohw_enable_recording(bool source_mic); |
37 | extern void wmcodec_disable_recording(void); | 37 | extern void audiohw_disable_recording(void); |
38 | extern void wmcodec_set_recvol(int left, int right, int type); | 38 | extern void audiohw_set_recvol(int left, int right, int type); |
39 | extern void wmcodec_set_monitor(int enable); | 39 | extern void audiohw_set_monitor(int enable); |
40 | 40 | ||
41 | /* Register addresses */ | 41 | /* Register addresses */ |
42 | #define LOUT1VOL 0x02 | 42 | #define LOUT1VOL 0x02 |
diff --git a/firmware/export/wmcodec.h b/firmware/export/wmcodec.h index f1c5e20ea9..1079a80498 100644 --- a/firmware/export/wmcodec.h +++ b/firmware/export/wmcodec.h | |||
@@ -18,6 +18,6 @@ | |||
18 | ****************************************************************************/ | 18 | ****************************************************************************/ |
19 | 19 | ||
20 | void i2s_reset(void); | 20 | void i2s_reset(void); |
21 | int wmcodec_init(void); | 21 | int audiohw_init(void); |
22 | void wmcodec_write(int reg, int data); | 22 | void wmcodec_write(int reg, int data); |
23 | 23 | ||
diff --git a/firmware/pcm_playback.c b/firmware/pcm_playback.c index 99a495ca10..46a458fa8a 100644 --- a/firmware/pcm_playback.c +++ b/firmware/pcm_playback.c | |||
@@ -406,13 +406,13 @@ void pcm_init(void) | |||
406 | pcm_callback_for_more = NULL; | 406 | pcm_callback_for_more = NULL; |
407 | 407 | ||
408 | /* Initialize default register values. */ | 408 | /* Initialize default register values. */ |
409 | wmcodec_init(); | 409 | audiohw_init(); |
410 | 410 | ||
411 | /* Power on */ | 411 | /* Power on */ |
412 | wmcodec_enable_output(true); | 412 | audiohw_enable_output(true); |
413 | 413 | ||
414 | /* Unmute the master channel (DAC should be at zero point now). */ | 414 | /* Unmute the master channel (DAC should be at zero point now). */ |
415 | wmcodec_mute(false); | 415 | audiohw_mute(false); |
416 | 416 | ||
417 | /* Call pcm_play_dma_stop to initialize everything. */ | 417 | /* Call pcm_play_dma_stop to initialize everything. */ |
418 | pcm_play_dma_stop(); | 418 | pcm_play_dma_stop(); |
@@ -603,7 +603,7 @@ void pcm_mute(bool mute) | |||
603 | { | 603 | { |
604 | #if defined(HAVE_WM8975) || defined(HAVE_WM8758) \ | 604 | #if defined(HAVE_WM8975) || defined(HAVE_WM8758) \ |
605 | || defined(HAVE_WM8731) || defined(HAVE_WM8721) | 605 | || defined(HAVE_WM8731) || defined(HAVE_WM8721) |
606 | wmcodec_mute(mute); | 606 | audiohw_mute(mute); |
607 | #endif | 607 | #endif |
608 | if (mute) | 608 | if (mute) |
609 | sleep(HZ/16); | 609 | sleep(HZ/16); |
diff --git a/firmware/powermgmt.c b/firmware/powermgmt.c index 17acd3d503..dcf8fd14ab 100644 --- a/firmware/powermgmt.c +++ b/firmware/powermgmt.c | |||
@@ -1326,11 +1326,11 @@ void shutdown_hw(void) | |||
1326 | 1326 | ||
1327 | mp3_shutdown(); | 1327 | mp3_shutdown(); |
1328 | #ifdef HAVE_UDA1380 | 1328 | #ifdef HAVE_UDA1380 |
1329 | uda1380_close(); | 1329 | audiohw_close(); |
1330 | #elif defined(HAVE_TLV320) | 1330 | #elif defined(HAVE_TLV320) |
1331 | tlv320_close(); | 1331 | audiohw_close(); |
1332 | #elif defined(HAVE_WM8758) || defined(HAVE_WM8975) | defined(HAVE_WM8731) | 1332 | #elif defined(HAVE_WM8758) || defined(HAVE_WM8975) | defined(HAVE_WM8731) |
1333 | wmcodec_close(); | 1333 | audiohw_close(); |
1334 | #endif | 1334 | #endif |
1335 | /* If HD is still active we try to wait for spindown, otherwise the | 1335 | /* If HD is still active we try to wait for spindown, otherwise the |
1336 | shutdown_timeout in power_thread_sleep will force a power off */ | 1336 | shutdown_timeout in power_thread_sleep will force a power off */ |
diff --git a/firmware/sound.c b/firmware/sound.c index 6bd9b70029..0c4c153797 100644 --- a/firmware/sound.c +++ b/firmware/sound.c | |||
@@ -464,10 +464,10 @@ static void set_prescaled_volume(void) | |||
464 | #if CONFIG_CODEC == MAS3507D | 464 | #if CONFIG_CODEC == MAS3507D |
465 | mas_writereg(MAS_REG_KPRESCALE, prescale_table[prescale/10]); | 465 | mas_writereg(MAS_REG_KPRESCALE, prescale_table[prescale/10]); |
466 | #elif defined(HAVE_UDA1380) | 466 | #elif defined(HAVE_UDA1380) |
467 | uda1380_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale)); | 467 | audiohw_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale)); |
468 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8758) \ | 468 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8758) \ |
469 | || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751) | 469 | || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751) |
470 | wmcodec_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale)); | 470 | audiohw_set_mixer_vol(tenthdb2mixer(-prescale), tenthdb2mixer(-prescale)); |
471 | #endif | 471 | #endif |
472 | 472 | ||
473 | if (current_volume == VOLUME_MIN) | 473 | if (current_volume == VOLUME_MIN) |
@@ -491,16 +491,16 @@ static void set_prescaled_volume(void) | |||
491 | #if CONFIG_CODEC == MAS3507D | 491 | #if CONFIG_CODEC == MAS3507D |
492 | dac_volume(tenthdb2reg(l), tenthdb2reg(r), false); | 492 | dac_volume(tenthdb2reg(l), tenthdb2reg(r), false); |
493 | #elif defined(HAVE_UDA1380) | 493 | #elif defined(HAVE_UDA1380) |
494 | uda1380_set_master_vol(tenthdb2master(l), tenthdb2master(r)); | 494 | audiohw_set_master_vol(tenthdb2master(l), tenthdb2master(r)); |
495 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8758) \ | 495 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8758) \ |
496 | || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751) | 496 | || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751) |
497 | wmcodec_set_master_vol(tenthdb2master(l), tenthdb2master(r)); | 497 | audiohw_set_master_vol(tenthdb2master(l), tenthdb2master(r)); |
498 | #if defined(HAVE_WM8975) || defined(HAVE_WM8758) || defined(HAVE_WM8751) | 498 | #if defined(HAVE_WM8975) || defined(HAVE_WM8758) || defined(HAVE_WM8751) |
499 | wmcodec_set_lineout_vol(tenthdb2master(0), tenthdb2master(0)); | 499 | audiohw_set_lineout_vol(tenthdb2master(0), tenthdb2master(0)); |
500 | #endif | 500 | #endif |
501 | 501 | ||
502 | #elif defined(HAVE_TLV320) | 502 | #elif defined(HAVE_TLV320) |
503 | tlv320_set_headphone_vol(tenthdb2master(l), tenthdb2master(r)); | 503 | audiohw_set_headphone_vol(tenthdb2master(l), tenthdb2master(r)); |
504 | #endif | 504 | #endif |
505 | } | 505 | } |
506 | #endif /* (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 */ | 506 | #endif /* (CONFIG_CODEC == MAS3507D) || defined HAVE_UDA1380 */ |
@@ -649,13 +649,13 @@ void sound_set_bass(int value) | |||
649 | current_bass = value * 10; | 649 | current_bass = value * 10; |
650 | set_prescaled_volume(); | 650 | set_prescaled_volume(); |
651 | #elif defined(HAVE_UDA1380) | 651 | #elif defined(HAVE_UDA1380) |
652 | uda1380_set_bass(value >> 1); | 652 | audiohw_set_bass(value >> 1); |
653 | current_bass = value * 10; | 653 | current_bass = value * 10; |
654 | set_prescaled_volume(); | 654 | set_prescaled_volume(); |
655 | #elif defined HAVE_WM8975 || defined HAVE_WM8758 \ | 655 | #elif defined HAVE_WM8975 || defined HAVE_WM8758 \ |
656 | || defined HAVE_WM8731 || defined(HAVE_WM8721) || defined(HAVE_WM8751) | 656 | || defined HAVE_WM8731 || defined(HAVE_WM8721) || defined(HAVE_WM8751) |
657 | current_bass = value * 10; | 657 | current_bass = value * 10; |
658 | wmcodec_set_bass(value); | 658 | audiohw_set_bass(value); |
659 | set_prescaled_volume(); | 659 | set_prescaled_volume(); |
660 | #elif CONFIG_CPU == PNX0101 || defined(HAVE_PP5024_CODEC) | 660 | #elif CONFIG_CPU == PNX0101 || defined(HAVE_PP5024_CODEC) |
661 | /* TODO: implement for iFP and Sansa */ | 661 | /* TODO: implement for iFP and Sansa */ |
@@ -675,12 +675,12 @@ void sound_set_treble(int value) | |||
675 | current_treble = value * 10; | 675 | current_treble = value * 10; |
676 | set_prescaled_volume(); | 676 | set_prescaled_volume(); |
677 | #elif defined(HAVE_UDA1380) | 677 | #elif defined(HAVE_UDA1380) |
678 | uda1380_set_treble(value >> 1); | 678 | audiohw_set_treble(value >> 1); |
679 | current_treble = value * 10; | 679 | current_treble = value * 10; |
680 | set_prescaled_volume(); | 680 | set_prescaled_volume(); |
681 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8758) \ | 681 | #elif defined(HAVE_WM8975) || defined(HAVE_WM8758) \ |
682 | || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751) | 682 | || defined(HAVE_WM8731) || defined(HAVE_WM8721) || defined(HAVE_WM8751) |
683 | wmcodec_set_treble(value); | 683 | audiohw_set_treble(value); |
684 | current_treble = value * 10; | 684 | current_treble = value * 10; |
685 | set_prescaled_volume(); | 685 | set_prescaled_volume(); |
686 | #elif CONFIG_CPU == PNX0101 || defined(HAVE_PP5024_CODEC) | 686 | #elif CONFIG_CPU == PNX0101 || defined(HAVE_PP5024_CODEC) |
diff --git a/firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c b/firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c index 20c8e9a8e7..cf24bed265 100644 --- a/firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c +++ b/firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c | |||
@@ -49,7 +49,7 @@ void i2s_reset(void) | |||
49 | * Initialise the WM8975 for playback via headphone and line out. | 49 | * Initialise the WM8975 for playback via headphone and line out. |
50 | * Note, I'm using the WM8750 datasheet as its apparently close. | 50 | * Note, I'm using the WM8750 datasheet as its apparently close. |
51 | */ | 51 | */ |
52 | int wmcodec_init(void) { | 52 | int audiohw_init(void) { |
53 | /* reset I2C */ | 53 | /* reset I2C */ |
54 | i2c_init(); | 54 | i2c_init(); |
55 | 55 | ||
diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c index 73324c0dec..8aa862c187 100644 --- a/firmware/target/arm/wmcodec-pp.c +++ b/firmware/target/arm/wmcodec-pp.c | |||
@@ -97,7 +97,7 @@ void i2s_reset(void) | |||
97 | * Initialise the WM8975 for playback via headphone and line out. | 97 | * Initialise the WM8975 for playback via headphone and line out. |
98 | * Note, I'm using the WM8750 datasheet as its apparently close. | 98 | * Note, I'm using the WM8750 datasheet as its apparently close. |
99 | */ | 99 | */ |
100 | int wmcodec_init(void) { | 100 | int audiohw_init(void) { |
101 | /* reset I2C */ | 101 | /* reset I2C */ |
102 | i2c_init(); | 102 | i2c_init(); |
103 | 103 | ||
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 @@ | |||
31 | void audio_set_recording_gain(int left, int right, int type) | 31 | void 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 | ||
37 | void audio_set_output_source(int source) | 37 | void 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 @@ | |||
31 | void audio_set_recording_gain(int left, int right, int type) | 31 | void 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 | ||
37 | void audio_set_output_source(int source) | 37 | void 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 */ |
45 | static int play_peak_left, play_peak_right; | 34 | static int play_peak_left, play_peak_right; |
46 | static unsigned long *rec_peak_addr; | 35 | static 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 | ||
403 | void pcm_mute(bool mute) | 392 | void 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 */ |