summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcoen Hirschberg <marcoen@gmail.com>2006-12-06 10:24:59 +0000
committerMarcoen Hirschberg <marcoen@gmail.com>2006-12-06 10:24:59 +0000
commit77d039bab8591e991001bf8680f9915854483809 (patch)
treecf45a738b7c68e2fac18513965027901a4240787
parent46a608bf07ec9d40bdd151e3283646682bb9e9bd (diff)
downloadrockbox-77d039bab8591e991001bf8680f9915854483809.tar.gz
rockbox-77d039bab8591e991001bf8680f9915854483809.zip
first step in audio driver unification: renaming the functions to audio_*
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11670 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/eq_menu.c46
-rw-r--r--firmware/drivers/tlv320.c30
-rw-r--r--firmware/drivers/uda1380.c34
-rw-r--r--firmware/drivers/wm8731l.c32
-rw-r--r--firmware/drivers/wm8758.c40
-rw-r--r--firmware/drivers/wm8975.c36
-rw-r--r--firmware/export/tlv320.h22
-rw-r--r--firmware/export/uda1380.h28
-rw-r--r--firmware/export/wm8731l.h30
-rw-r--r--firmware/export/wm8758.h34
-rw-r--r--firmware/export/wm8975.h32
-rw-r--r--firmware/export/wmcodec.h2
-rw-r--r--firmware/pcm_playback.c8
-rw-r--r--firmware/powermgmt.c6
-rw-r--r--firmware/sound.c20
-rw-r--r--firmware/target/arm/gigabeat/meg-fx/wmcodec-meg-fx.c2
-rw-r--r--firmware/target/arm/wmcodec-pp.c2
-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
20 files changed, 229 insertions, 240 deletions
diff --git a/apps/eq_menu.c b/apps/eq_menu.c
index 9939ee77fe..798b05d304 100644
--- a/apps/eq_menu.c
+++ b/apps/eq_menu.c
@@ -788,7 +788,7 @@ static bool eq_hw_set_band0_cutoff(void)
788 sizeof(names) / sizeof(*names), NULL); 788 sizeof(names) / sizeof(*names), NULL);
789 789
790#ifndef SIMULATOR 790#ifndef SIMULATOR
791 wmcodec_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 0, 791 audiohw_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 0,
792 global_settings.eq_hw_band0_gain); 792 global_settings.eq_hw_band0_gain);
793#endif 793#endif
794 794
@@ -803,7 +803,7 @@ static bool eq_hw_set_band0_gain(void)
803 eq_hw_gain_format); 803 eq_hw_gain_format);
804 804
805#ifndef SIMULATOR 805#ifndef SIMULATOR
806 wmcodec_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 0, 806 audiohw_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 0,
807 global_settings.eq_hw_band0_gain); 807 global_settings.eq_hw_band0_gain);
808#endif 808#endif
809 809
@@ -824,7 +824,7 @@ static bool eq_hw_set_band1_center(void)
824 sizeof(names) / sizeof(*names), NULL); 824 sizeof(names) / sizeof(*names), NULL);
825 825
826#ifndef SIMULATOR 826#ifndef SIMULATOR
827 wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center, 827 audiohw_set_equalizer_band(1, global_settings.eq_hw_band1_center,
828 global_settings.eq_hw_band1_bandwidth, 828 global_settings.eq_hw_band1_bandwidth,
829 global_settings.eq_hw_band1_gain); 829 global_settings.eq_hw_band1_gain);
830#endif 830#endif
@@ -839,7 +839,7 @@ static bool eq_hw_set_band1_bandwidth(void)
839 BANDWIDTH_NAMES_SIZE, NULL); 839 BANDWIDTH_NAMES_SIZE, NULL);
840 840
841#ifndef SIMULATOR 841#ifndef SIMULATOR
842 wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center, 842 audiohw_set_equalizer_band(1, global_settings.eq_hw_band1_center,
843 global_settings.eq_hw_band1_bandwidth, 843 global_settings.eq_hw_band1_bandwidth,
844 global_settings.eq_hw_band1_gain); 844 global_settings.eq_hw_band1_gain);
845#endif 845#endif
@@ -855,7 +855,7 @@ static bool eq_hw_set_band1_gain(void)
855 eq_hw_gain_format); 855 eq_hw_gain_format);
856 856
857#ifndef SIMULATOR 857#ifndef SIMULATOR
858 wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center, 858 audiohw_set_equalizer_band(1, global_settings.eq_hw_band1_center,
859 global_settings.eq_hw_band1_bandwidth, 859 global_settings.eq_hw_band1_bandwidth,
860 global_settings.eq_hw_band1_gain); 860 global_settings.eq_hw_band1_gain);
861#endif 861#endif
@@ -877,7 +877,7 @@ static bool eq_hw_set_band2_center(void)
877 sizeof(names) / sizeof(*names), NULL); 877 sizeof(names) / sizeof(*names), NULL);
878 878
879#ifndef SIMULATOR 879#ifndef SIMULATOR
880 wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center, 880 audiohw_set_equalizer_band(2, global_settings.eq_hw_band2_center,
881 global_settings.eq_hw_band2_bandwidth, 881 global_settings.eq_hw_band2_bandwidth,
882 global_settings.eq_hw_band2_gain); 882 global_settings.eq_hw_band2_gain);
883#endif 883#endif
@@ -892,7 +892,7 @@ static bool eq_hw_set_band2_bandwidth(void)
892 BANDWIDTH_NAMES_SIZE, NULL); 892 BANDWIDTH_NAMES_SIZE, NULL);
893 893
894#ifndef SIMULATOR 894#ifndef SIMULATOR
895 wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center, 895 audiohw_set_equalizer_band(2, global_settings.eq_hw_band2_center,
896 global_settings.eq_hw_band2_bandwidth, 896 global_settings.eq_hw_band2_bandwidth,
897 global_settings.eq_hw_band2_gain); 897 global_settings.eq_hw_band2_gain);
898#endif 898#endif
@@ -908,7 +908,7 @@ static bool eq_hw_set_band2_gain(void)
908 eq_hw_gain_format); 908 eq_hw_gain_format);
909 909
910#ifndef SIMULATOR 910#ifndef SIMULATOR
911 wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center, 911 audiohw_set_equalizer_band(2, global_settings.eq_hw_band2_center,
912 global_settings.eq_hw_band2_bandwidth, 912 global_settings.eq_hw_band2_bandwidth,
913 global_settings.eq_hw_band2_gain); 913 global_settings.eq_hw_band2_gain);
914#endif 914#endif
@@ -930,7 +930,7 @@ static bool eq_hw_set_band3_center(void)
930 sizeof(names) / sizeof(*names), NULL); 930 sizeof(names) / sizeof(*names), NULL);
931 931
932#ifndef SIMULATOR 932#ifndef SIMULATOR
933 wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center, 933 audiohw_set_equalizer_band(3, global_settings.eq_hw_band3_center,
934 global_settings.eq_hw_band3_bandwidth, 934 global_settings.eq_hw_band3_bandwidth,
935 global_settings.eq_hw_band3_gain); 935 global_settings.eq_hw_band3_gain);
936#endif 936#endif
@@ -945,7 +945,7 @@ static bool eq_hw_set_band3_bandwidth(void)
945 BANDWIDTH_NAMES_SIZE, NULL); 945 BANDWIDTH_NAMES_SIZE, NULL);
946 946
947#ifndef SIMULATOR 947#ifndef SIMULATOR
948 wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center, 948 audiohw_set_equalizer_band(3, global_settings.eq_hw_band3_center,
949 global_settings.eq_hw_band3_bandwidth, 949 global_settings.eq_hw_band3_bandwidth,
950 global_settings.eq_hw_band3_gain); 950 global_settings.eq_hw_band3_gain);
951#endif 951#endif
@@ -961,7 +961,7 @@ static bool eq_hw_set_band3_gain(void)
961 eq_hw_gain_format); 961 eq_hw_gain_format);
962 962
963#ifndef SIMULATOR 963#ifndef SIMULATOR
964 wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center, 964 audiohw_set_equalizer_band(3, global_settings.eq_hw_band3_center,
965 global_settings.eq_hw_band3_bandwidth, 965 global_settings.eq_hw_band3_bandwidth,
966 global_settings.eq_hw_band3_gain); 966 global_settings.eq_hw_band3_gain);
967#endif 967#endif
@@ -983,7 +983,7 @@ static bool eq_hw_set_band4_cutoff(void)
983 sizeof(names) / sizeof(*names), NULL); 983 sizeof(names) / sizeof(*names), NULL);
984 984
985#ifndef SIMULATOR 985#ifndef SIMULATOR
986 wmcodec_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 0, 986 audiohw_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 0,
987 global_settings.eq_hw_band4_gain); 987 global_settings.eq_hw_band4_gain);
988#endif 988#endif
989 989
@@ -998,7 +998,7 @@ static bool eq_hw_set_band4_gain(void)
998 eq_hw_gain_format); 998 eq_hw_gain_format);
999 999
1000#ifndef SIMULATOR 1000#ifndef SIMULATOR
1001 wmcodec_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 0, 1001 audiohw_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 0,
1002 global_settings.eq_hw_band4_gain); 1002 global_settings.eq_hw_band4_gain);
1003#endif 1003#endif
1004 1004
@@ -1011,28 +1011,28 @@ void eq_hw_enable(bool enable)
1011 (void) enable; 1011 (void) enable;
1012#else 1012#else
1013 if (enable) { 1013 if (enable) {
1014 wmcodec_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 1014 audiohw_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff,
1015 0, global_settings.eq_hw_band0_gain); 1015 0, global_settings.eq_hw_band0_gain);
1016 wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center, 1016 audiohw_set_equalizer_band(1, global_settings.eq_hw_band1_center,
1017 global_settings.eq_hw_band1_bandwidth, 1017 global_settings.eq_hw_band1_bandwidth,
1018 global_settings.eq_hw_band1_gain); 1018 global_settings.eq_hw_band1_gain);
1019 wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center, 1019 audiohw_set_equalizer_band(2, global_settings.eq_hw_band2_center,
1020 global_settings.eq_hw_band2_bandwidth, 1020 global_settings.eq_hw_band2_bandwidth,
1021 global_settings.eq_hw_band2_gain); 1021 global_settings.eq_hw_band2_gain);
1022 wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center, 1022 audiohw_set_equalizer_band(3, global_settings.eq_hw_band3_center,
1023 global_settings.eq_hw_band3_bandwidth, 1023 global_settings.eq_hw_band3_bandwidth,
1024 global_settings.eq_hw_band3_gain); 1024 global_settings.eq_hw_band3_gain);
1025 wmcodec_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 1025 audiohw_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff,
1026 0, global_settings.eq_hw_band4_gain); 1026 0, global_settings.eq_hw_band4_gain);
1027 } else { 1027 } else {
1028 wmcodec_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 0, 0); 1028 audiohw_set_equalizer_band(0, global_settings.eq_hw_band0_cutoff, 0, 0);
1029 wmcodec_set_equalizer_band(1, global_settings.eq_hw_band1_center, 1029 audiohw_set_equalizer_band(1, global_settings.eq_hw_band1_center,
1030 global_settings.eq_hw_band1_bandwidth, 0); 1030 global_settings.eq_hw_band1_bandwidth, 0);
1031 wmcodec_set_equalizer_band(2, global_settings.eq_hw_band2_center, 1031 audiohw_set_equalizer_band(2, global_settings.eq_hw_band2_center,
1032 global_settings.eq_hw_band2_bandwidth, 0); 1032 global_settings.eq_hw_band2_bandwidth, 0);
1033 wmcodec_set_equalizer_band(3, global_settings.eq_hw_band3_center, 1033 audiohw_set_equalizer_band(3, global_settings.eq_hw_band3_center,
1034 global_settings.eq_hw_band3_bandwidth, 0); 1034 global_settings.eq_hw_band3_bandwidth, 0);
1035 wmcodec_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 0, 0); 1035 audiohw_set_equalizer_band(4, global_settings.eq_hw_band4_cutoff, 0, 0);
1036 } 1036 }
1037#endif 1037#endif
1038} 1038}
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 */
70void tlv320_init(void) 70void 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 */
93void tlv320_reset(void) 93void 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 */
107void tlv320_set_frequency(unsigned fsel) 107void 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 */
129void tlv320_set_headphone_vol(int vol_l, int vol_r) 129void 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 */
159void tlv320_set_recvol(int left, int right, int type) 159void 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 */
183void tlv320_mute(bool mute) 183void 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 */
208void tlv320_close(void) 208void 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
217void tlv320_enable_recording(bool source_mic) 217void 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
237void tlv320_disable_recording(void) 237void 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
249void tlv320_set_monitor(bool enable) 249void 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 */
100int uda1380_set_master_vol(int vol_l, int vol_r) 100int 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 */
109int uda1380_set_mixer_vol(int channel1, int channel2) 109int 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 */
118void uda1380_set_bass(int value) 118void 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 */
127void uda1380_set_treble(int value) 127void 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 */
137int uda1380_mute(int mute) 137int 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 */
150int uda1380_set_regs(void) 150int 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 */
169void uda1380_enable_output(bool enable) 169void 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
179void uda1380_reset(void) 179void 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 */
206void uda1380_set_frequency(unsigned fsel) 206void 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) */
234int uda1380_init(void) 234int 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 */
248void uda1380_close(void) 248void 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 */
266void uda1380_enable_recording(bool source_mic) 266void 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 */
301void uda1380_disable_recording(void) 301void 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 */
330void uda1380_set_recvol(int left, int right, int type) 330void 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 */
415void uda1380_set_monitor(int enable) 415void 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
46int wmcodec_mute(int mute) 46int 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 */
73void wmcodec_enable_output(bool enable) 73void 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
125int wmcodec_set_master_vol(int vol_l, int vol_r) 125int 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
139int wmcodec_set_mixer_vol(int channel1, int channel2) 139int 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
147void wmcodec_set_bass(int value) 147void audiohw_set_bass(int value)
148{ 148{
149 (void)value; 149 (void)value;
150} 150}
151 151
152void wmcodec_set_treble(int value) 152void 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 */
158void wmcodec_close(void) 158void 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 */
180void wmcodec_set_nsorder(int order) 180void audiohw_set_nsorder(int order)
181{ 181{
182 (void)order; 182 (void)order;
183} 183}
184 184
185void wmcodec_set_sample_rate(int sampling_control) 185void 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
192void wmcodec_enable_recording(bool source_mic) 192void audiohw_enable_recording(bool source_mic)
193{ 193{
194 (void)source_mic; 194 (void)source_mic;
195} 195}
196 196
197void wmcodec_disable_recording(void) 197void audiohw_disable_recording(void)
198{ 198{
199 199
200} 200}
201 201
202void wmcodec_set_recvol(int left, int right, int type) 202void 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
209void wmcodec_set_monitor(int enable) 209void 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
43void wmcodec_reset(void); 43void 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 */
51void wmcodec_enable_output(bool enable) 51void 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
83int wmcodec_set_master_vol(int vol_l, int vol_r) 83int 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
92int wmcodec_set_lineout_vol(int vol_l, int vol_r) 92int 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
101int wmcodec_set_mixer_vol(int channel1, int channel2) 101int 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 */
110void wmcodec_set_bass(int value) 110void 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
124void wmcodec_set_treble(int value) 124void 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
139int wmcodec_mute(int mute) 139int 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 */
154void wmcodec_close(void) 154void 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 */
166void wmcodec_set_nsorder(int order) 166void 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 */
172void wmcodec_set_sample_rate(int sampling_control) 172void 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
193void wmcodec_enable_recording(bool source_mic) 193void audiohw_enable_recording(bool source_mic)
194{ 194{
195 (void)source_mic; 195 (void)source_mic;
196} 196}
197 197
198void wmcodec_disable_recording(void) { 198void audiohw_disable_recording(void) {
199 199
200} 200}
201 201
202void wmcodec_set_recvol(int left, int right, int type) { 202void 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
209void wmcodec_set_monitor(int enable) { 209void audiohw_set_monitor(int enable) {
210 210
211 (void)enable; 211 (void)enable;
212} 212}
213 213
214void wmcodec_set_equalizer_band(int band, int freq, int bw, int gain) 214void 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
43void wmcodec_reset(void); 43void 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 */
49void wmcodec_enable_output(bool enable) 49void 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
103int wmcodec_set_master_vol(int vol_l, int vol_r) 103int 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
118int wmcodec_set_lineout_vol(int vol_l, int vol_r) 118int 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
127int wmcodec_set_mixer_vol(int channel1, int channel2) 127int 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 */
136void wmcodec_set_bass(int value) 136void 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
146void wmcodec_set_treble(int value) 146void 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
156int wmcodec_mute(int mute) 156int 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 */
171void wmcodec_close(void) 171void 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 */
184void wmcodec_set_nsorder(int order) 184void 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 */
190void wmcodec_set_sample_rate(int sampling_control) { 190void 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
196void wmcodec_enable_recording(bool source_mic) { 196void audiohw_enable_recording(bool source_mic) {
197 197
198 (void)source_mic; 198 (void)source_mic;
199} 199}
200 200
201void wmcodec_disable_recording(void) { 201void audiohw_disable_recording(void) {
202 202
203} 203}
204 204
205void wmcodec_set_recvol(int left, int right, int type) { 205void 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
212void wmcodec_set_monitor(int enable) { 212void 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
25extern void tlv320_init(void); 25extern void audiohw_init(void);
26extern void tlv320_reset(void); 26extern 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 */
36extern void tlv320_set_frequency(unsigned fsel); 36extern void audiohw_set_frequency(unsigned fsel);
37extern void tlv320_enable_output(bool enable); 37extern void audiohw_enable_output(bool enable);
38extern void tlv320_set_headphone_vol(int vol_l, int vol_r); 38extern void audiohw_set_headphone_vol(int vol_l, int vol_r);
39extern void tlv320_set_recvol(int left, int right, int type); 39extern void audiohw_set_recvol(int left, int right, int type);
40extern void tlv320_mute(bool mute); 40extern void audiohw_mute(bool mute);
41extern void tlv320_close(void); 41extern void audiohw_close(void);
42extern void tlv320_enable_recording(bool source_mic); 42extern void audiohw_enable_recording(bool source_mic);
43extern void tlv320_disable_recording(void); 43extern void audiohw_disable_recording(void);
44extern void tlv320_set_monitor(bool enable); 44extern 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
22extern void uda1380_reset(void); 22extern void audiohw_reset(void);
23extern int uda1380_init(void); 23extern int audiohw_init(void);
24extern void uda1380_enable_output(bool enable); 24extern void audiohw_enable_output(bool enable);
25extern int uda1380_set_master_vol(int vol_l, int vol_r); 25extern int audiohw_set_master_vol(int vol_l, int vol_r);
26extern int uda1380_set_mixer_vol(int channel1, int channel2); 26extern int audiohw_set_mixer_vol(int channel1, int channel2);
27extern void uda1380_set_bass(int value); 27extern void audiohw_set_bass(int value);
28extern void uda1380_set_treble(int value); 28extern void audiohw_set_treble(int value);
29extern int uda1380_mute(int mute); 29extern int audiohw_mute(int mute);
30extern void uda1380_close(void); 30extern 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 */
41extern void uda1380_set_frequency(unsigned fsel); 41extern void audiohw_set_frequency(unsigned fsel);
42extern void uda1380_enable_recording(bool source_mic); 42extern void audiohw_enable_recording(bool source_mic);
43extern void uda1380_disable_recording(void); 43extern void audiohw_disable_recording(void);
44extern void uda1380_set_recvol(int left, int right, int type); 44extern void audiohw_set_recvol(int left, int right, int type);
45extern void uda1380_set_monitor(int enable); 45extern 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
23extern void wmcodec_reset(void); 23extern void audiohw_reset(void);
24extern int wmcodec_init(void); 24extern int audiohw_init(void);
25extern void wmcodec_enable_output(bool enable); 25extern void audiohw_enable_output(bool enable);
26extern int wmcodec_set_master_vol(int vol_l, int vol_r); 26extern int audiohw_set_master_vol(int vol_l, int vol_r);
27extern int wmcodec_set_mixer_vol(int channel1, int channel2); 27extern int audiohw_set_mixer_vol(int channel1, int channel2);
28extern void wmcodec_set_bass(int value); 28extern void audiohw_set_bass(int value);
29extern void wmcodec_set_treble(int value); 29extern void audiohw_set_treble(int value);
30extern int wmcodec_mute(int mute); 30extern int audiohw_mute(int mute);
31extern void wmcodec_close(void); 31extern void audiohw_close(void);
32extern void wmcodec_set_nsorder(int order); 32extern void audiohw_set_nsorder(int order);
33extern void wmcodec_set_sample_rate(int sampling_control); 33extern void audiohw_set_sample_rate(int sampling_control);
34 34
35extern void wmcodec_enable_recording(bool source_mic); 35extern void audiohw_enable_recording(bool source_mic);
36extern void wmcodec_disable_recording(void); 36extern void audiohw_disable_recording(void);
37extern void wmcodec_set_recvol(int left, int right, int type); 37extern void audiohw_set_recvol(int left, int right, int type);
38extern void wmcodec_set_monitor(int enable); 38extern 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
23extern void wmcodec_reset(void); 23extern void audiohw_reset(void);
24extern int wmcodec_init(void); 24extern int audiohw_init(void);
25extern void wmcodec_enable_output(bool enable); 25extern void audiohw_enable_output(bool enable);
26extern int wmcodec_set_master_vol(int vol_l, int vol_r); 26extern int audiohw_set_master_vol(int vol_l, int vol_r);
27extern int wmcodec_set_lineout_vol(int vol_l, int vol_r); 27extern int audiohw_set_lineout_vol(int vol_l, int vol_r);
28extern int wmcodec_set_mixer_vol(int channel1, int channel2); 28extern int audiohw_set_mixer_vol(int channel1, int channel2);
29extern void wmcodec_set_bass(int value); 29extern void audiohw_set_bass(int value);
30extern void wmcodec_set_treble(int value); 30extern void audiohw_set_treble(int value);
31extern int wmcodec_mute(int mute); 31extern int audiohw_mute(int mute);
32extern void wmcodec_close(void); 32extern void audiohw_close(void);
33extern void wmcodec_set_nsorder(int order); 33extern void audiohw_set_nsorder(int order);
34extern void wmcodec_set_sample_rate(int sampling_control); 34extern void audiohw_set_sample_rate(int sampling_control);
35 35
36extern void wmcodec_enable_recording(bool source_mic); 36extern void audiohw_enable_recording(bool source_mic);
37extern void wmcodec_disable_recording(void); 37extern void audiohw_disable_recording(void);
38extern void wmcodec_set_recvol(int left, int right, int type); 38extern void audiohw_set_recvol(int left, int right, int type);
39extern void wmcodec_set_monitor(int enable); 39extern void audiohw_set_monitor(int enable);
40 40
41extern void wmcodec_set_equalizer_band(int band, int freq, int bw, int gain); 41extern 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
23extern void wmcodec_reset(void); 23extern void audiohw_reset(void);
24extern int wmcodec_init(void); 24extern int audiohw_init(void);
25extern void wmcodec_enable_output(bool enable); 25extern void audiohw_enable_output(bool enable);
26extern int wmcodec_set_master_vol(int vol_l, int vol_r); 26extern int audiohw_set_master_vol(int vol_l, int vol_r);
27extern int wmcodec_set_lineout_vol(int vol_l, int vol_r); 27extern int audiohw_set_lineout_vol(int vol_l, int vol_r);
28extern int wmcodec_set_mixer_vol(int channel1, int channel2); 28extern int audiohw_set_mixer_vol(int channel1, int channel2);
29extern void wmcodec_set_bass(int value); 29extern void audiohw_set_bass(int value);
30extern void wmcodec_set_treble(int value); 30extern void audiohw_set_treble(int value);
31extern int wmcodec_mute(int mute); 31extern int audiohw_mute(int mute);
32extern void wmcodec_close(void); 32extern void audiohw_close(void);
33extern void wmcodec_set_nsorder(int order); 33extern void audiohw_set_nsorder(int order);
34extern void wmcodec_set_sample_rate(int sampling_control); 34extern void audiohw_set_sample_rate(int sampling_control);
35 35
36extern void wmcodec_enable_recording(bool source_mic); 36extern void audiohw_enable_recording(bool source_mic);
37extern void wmcodec_disable_recording(void); 37extern void audiohw_disable_recording(void);
38extern void wmcodec_set_recvol(int left, int right, int type); 38extern void audiohw_set_recvol(int left, int right, int type);
39extern void wmcodec_set_monitor(int enable); 39extern 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
20void i2s_reset(void); 20void i2s_reset(void);
21int wmcodec_init(void); 21int audiohw_init(void);
22void wmcodec_write(int reg, int data); 22void 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 */
52int wmcodec_init(void) { 52int 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 */
100int wmcodec_init(void) { 100int 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 @@
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 */