summaryrefslogtreecommitdiff
path: root/firmware
diff options
context:
space:
mode:
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/audio/tsc2100.c11
-rw-r--r--firmware/drivers/audio/uda1380.c14
-rw-r--r--firmware/drivers/audio/wm8721.c50
-rw-r--r--firmware/drivers/audio/wm8731.c3
-rw-r--r--firmware/drivers/audio/wm8751.c1
-rw-r--r--firmware/drivers/audio/wm8758.c3
-rw-r--r--firmware/drivers/audio/wm8975.c3
-rw-r--r--firmware/drivers/audio/wm8985.c75
-rw-r--r--firmware/export/audiohw.h11
-rw-r--r--firmware/target/arm/pcm-pp.c8
-rw-r--r--firmware/target/arm/pcm-telechips.c13
-rw-r--r--firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c5
-rw-r--r--firmware/target/arm/tcc77x/logikdax/audio-logikdax.c5
-rw-r--r--firmware/target/arm/tcc77x/m200/audio-m200.c5
-rw-r--r--firmware/target/arm/wmcodec-pp.c18
-rw-r--r--firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c9
16 files changed, 76 insertions, 158 deletions
diff --git a/firmware/drivers/audio/tsc2100.c b/firmware/drivers/audio/tsc2100.c
index 038f3ed178..e0e2c53e69 100644
--- a/firmware/drivers/audio/tsc2100.c
+++ b/firmware/drivers/audio/tsc2100.c
@@ -90,16 +90,7 @@ void audiohw_init(void)
90 90
91void audiohw_postinit(void) 91void audiohw_postinit(void)
92{ 92{
93} 93 audiohw_mute(0);
94
95/* Silently enable / disable audio output */
96void audiohw_enable_output(bool enable)
97{
98 if (enable) {
99 audiohw_mute(0);
100 } else {
101 audiohw_mute(1);
102 }
103} 94}
104 95
105void audiohw_set_master_vol(int vol_l, int vol_r) 96void audiohw_set_master_vol(int vol_l, int vol_r)
diff --git a/firmware/drivers/audio/uda1380.c b/firmware/drivers/audio/uda1380.c
index e76b08a429..a0e7ef56d8 100644
--- a/firmware/drivers/audio/uda1380.c
+++ b/firmware/drivers/audio/uda1380.c
@@ -193,17 +193,6 @@ static int audiohw_set_regs(void)
193 return 0; 193 return 0;
194} 194}
195 195
196/* Silently enable / disable audio output */
197void audiohw_enable_output(bool enable)
198{
199 if (enable) {
200 uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] | PON_DAC | PON_HP);
201 } else {
202 uda1380_write_reg(REG_MUTE, MUTE_MASTER);
203 uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] & ~PON_DAC);
204 }
205}
206
207static void reset(void) 196static void reset(void)
208{ 197{
209#ifdef IRIVER_H300_SERIES 198#ifdef IRIVER_H300_SERIES
@@ -278,8 +267,9 @@ void audiohw_postinit(void)
278 /* Sleep a while so the power can stabilize (especially a long 267 /* Sleep a while so the power can stabilize (especially a long
279 delay is needed for the line out connector). */ 268 delay is needed for the line out connector). */
280 sleep(HZ); 269 sleep(HZ);
270
281 /* Power on FSDAC and HP amp. */ 271 /* Power on FSDAC and HP amp. */
282 audiohw_enable_output(true); 272 uda1380_write_reg(REG_PWR, uda1380_regs[REG_PWR] | PON_DAC | PON_HP);
283 273
284 /* UDA1380: Unmute the master channel 274 /* UDA1380: Unmute the master channel
285 (DAC should be at zero point now). */ 275 (DAC should be at zero point now). */
diff --git a/firmware/drivers/audio/wm8721.c b/firmware/drivers/audio/wm8721.c
index 6c4e12b9dc..3f14ca467e 100644
--- a/firmware/drivers/audio/wm8721.c
+++ b/firmware/drivers/audio/wm8721.c
@@ -33,7 +33,6 @@
33 33
34#include "wmcodec.h" 34#include "wmcodec.h"
35#include "audiohw.h" 35#include "audiohw.h"
36#include "i2s.h"
37 36
38#define IPOD_PCM_LEVEL 0x65 /* -6dB */ 37#define IPOD_PCM_LEVEL 0x65 /* -6dB */
39 38
@@ -91,43 +90,38 @@ static void codec_set_active(int active)
91 90
92 91
93/* Silently enable / disable audio output */ 92/* Silently enable / disable audio output */
94void audiohw_enable_output(bool enable) 93void audiohw_preinit(void)
95{ 94{
96 if (enable) 95 wmcodec_write(RESET, 0x0); /*Reset*/
97 {
98 /* reset the I2S controller into known state */
99 i2s_reset();
100
101 wmcodec_write(RESET, 0x0); /*Reset*/
102 96
103 codec_set_active(0x0); 97 codec_set_active(0x0);
104 98
105 /* DACSEL=1 */ 99 /* DACSEL=1 */
106 wmcodec_write(0x4, 0x10); 100 wmcodec_write(0x4, 0x10);
107 101
108 /* set power register to POWEROFF=0 on OUTPD=0, DACPD=0 */ 102 /* set power register to POWEROFF=0 on OUTPD=0, DACPD=0 */
109 wmcodec_write(PDCTRL, 0x67); 103 wmcodec_write(PDCTRL, 0x67);
110 104
111 /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */ 105 /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */
112 /* IWL=00(16 bit) FORMAT=10(I2S format) */ 106 /* IWL=00(16 bit) FORMAT=10(I2S format) */
113 wmcodec_write(AINTFCE, 0x42); 107 wmcodec_write(AINTFCE, 0x42);
114 108
115 audiohw_set_sample_rate(WM8721_USB24_44100HZ); 109 audiohw_set_sample_rate(WM8721_USB24_44100HZ);
116 110
117 /* set the volume to -6dB */ 111 /* set the volume to -6dB */
118 wmcodec_write(LOUTVOL, IPOD_PCM_LEVEL); 112 wmcodec_write(LOUTVOL, IPOD_PCM_LEVEL);
119 wmcodec_write(ROUTVOL, 0x100 | IPOD_PCM_LEVEL); 113 wmcodec_write(ROUTVOL, 0x100 | IPOD_PCM_LEVEL);
120 114
121 /* ACTIVE=1 */ 115 /* ACTIVE=1 */
122 codec_set_active(1); 116 codec_set_active(1);
123 117
124 /* 5. Set DACMU = 0 to soft-un-mute the audio DACs. */ 118 /* 5. Set DACMU = 0 to soft-un-mute the audio DACs. */
125 wmcodec_write(DAPCTRL, 0x0); 119 wmcodec_write(DAPCTRL, 0x0);
120}
126 121
127 audiohw_mute(0); 122void audiohw_postinit(void)
128 } else { 123{
129 audiohw_mute(1); 124 audiohw_mute(0);
130 }
131} 125}
132 126
133void audiohw_set_master_vol(int vol_l, int vol_r) 127void audiohw_set_master_vol(int vol_l, int vol_r)
diff --git a/firmware/drivers/audio/wm8731.c b/firmware/drivers/audio/wm8731.c
index d6e21c34de..2f882e8fe1 100644
--- a/firmware/drivers/audio/wm8731.c
+++ b/firmware/drivers/audio/wm8731.c
@@ -33,7 +33,6 @@
33 33
34#include "wmcodec.h" 34#include "wmcodec.h"
35#include "audiohw.h" 35#include "audiohw.h"
36#include "i2s.h"
37#include "sound.h" 36#include "sound.h"
38 37
39const struct sound_settings_info audiohw_settings[] = { 38const struct sound_settings_info audiohw_settings[] = {
@@ -150,8 +149,6 @@ static void codec_set_active(int active)
150 149
151void audiohw_preinit(void) 150void audiohw_preinit(void)
152{ 151{
153 i2s_reset();
154
155 /* POWER UP SEQUENCE */ 152 /* POWER UP SEQUENCE */
156 /* 1) Switch on power supplies. By default the WM8731 is in Standby Mode, 153 /* 1) Switch on power supplies. By default the WM8731 is in Standby Mode,
157 * the DAC is digitally muted and the Audio Interface and Outputs are 154 * the DAC is digitally muted and the Audio Interface and Outputs are
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c
index 7145fe4ea4..d53cfa3d79 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -27,7 +27,6 @@
27 ****************************************************************************/ 27 ****************************************************************************/
28#include "kernel.h" 28#include "kernel.h"
29#include "wmcodec.h" 29#include "wmcodec.h"
30#include "i2s.h"
31#include "audio.h" 30#include "audio.h"
32#include "audiohw.h" 31#include "audiohw.h"
33#include "system.h" 32#include "system.h"
diff --git a/firmware/drivers/audio/wm8758.c b/firmware/drivers/audio/wm8758.c
index e9d4b5c5c7..8ebfbe8e26 100644
--- a/firmware/drivers/audio/wm8758.c
+++ b/firmware/drivers/audio/wm8758.c
@@ -31,7 +31,6 @@
31 31
32#include "wmcodec.h" 32#include "wmcodec.h"
33#include "audiohw.h" 33#include "audiohw.h"
34#include "i2s.h"
35 34
36const struct sound_settings_info audiohw_settings[] = { 35const struct sound_settings_info audiohw_settings[] = {
37 [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25}, 36 [SOUND_VOLUME] = {"dB", 0, 1, -58, 6, -25},
@@ -95,8 +94,6 @@ void audiohw_mute(bool mute)
95 94
96void audiohw_preinit(void) 95void audiohw_preinit(void)
97{ 96{
98 i2s_reset();
99
100 wmcodec_write(RESET, RESET_RESET); 97 wmcodec_write(RESET, RESET_RESET);
101 98
102 wmcodec_write(PWRMGMT1, PWRMGMT1_PLLEN | PWRMGMT1_BIASEN 99 wmcodec_write(PWRMGMT1, PWRMGMT1_PLLEN | PWRMGMT1_BIASEN
diff --git a/firmware/drivers/audio/wm8975.c b/firmware/drivers/audio/wm8975.c
index 86e463cdff..aa519e8819 100644
--- a/firmware/drivers/audio/wm8975.c
+++ b/firmware/drivers/audio/wm8975.c
@@ -33,7 +33,6 @@
33 33
34#include "wmcodec.h" 34#include "wmcodec.h"
35#include "audiohw.h" 35#include "audiohw.h"
36#include "i2s.h"
37 36
38const struct sound_settings_info audiohw_settings[] = { 37const struct sound_settings_info audiohw_settings[] = {
39 [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25}, 38 [SOUND_VOLUME] = {"dB", 0, 1, -74, 6, -25},
@@ -129,8 +128,6 @@ void audiohw_mute(bool mute)
129 128
130void audiohw_preinit(void) 129void audiohw_preinit(void)
131{ 130{
132 i2s_reset();
133
134 /* POWER UP SEQUENCE */ 131 /* POWER UP SEQUENCE */
135 wmcodec_write(RESET, RESET_RESET); 132 wmcodec_write(RESET, RESET_RESET);
136 133
diff --git a/firmware/drivers/audio/wm8985.c b/firmware/drivers/audio/wm8985.c
index 9d80f9e374..0467e3718a 100644
--- a/firmware/drivers/audio/wm8985.c
+++ b/firmware/drivers/audio/wm8985.c
@@ -23,7 +23,6 @@
23 23
24#include "wmcodec.h" 24#include "wmcodec.h"
25#include "audiohw.h" 25#include "audiohw.h"
26#include "i2s.h"
27 26
28/* Register addresses as per datasheet Rev.4.4 */ 27/* Register addresses as per datasheet Rev.4.4 */
29#define RESET 0x00 28#define RESET 0x00
@@ -127,57 +126,50 @@ int tenthdb2master(int db)
127} 126}
128 127
129/* Silently enable / disable audio output */ 128/* Silently enable / disable audio output */
130void audiohw_enable_output(bool enable) 129void audiohw_preinit(void)
131{ 130{
132 if (enable) 131 wmcodec_write(RESET, 0x1ff); /* Reset */
133 {
134 /* TODO: reset the I2S controller into known state */
135 //i2s_reset();
136 132
137 wmcodec_write(RESET, 0x1ff); /* Reset */ 133 wmcodec_write(BIASCTL, 0x100); /* BIASCUT = 1 */
134 wmcodec_write(OUTCTRL, 0x6); /* Thermal shutdown */
138 135
139 wmcodec_write(BIASCTL, 0x100); /* BIASCUT = 1 */ 136 wmcodec_write(PWRMGMT1, 0x8); /* BIASEN = 1 */
140 wmcodec_write(OUTCTRL, 0x6); /* Thermal shutdown */
141 137
142 wmcodec_write(PWRMGMT1, 0x8); /* BIASEN = 1 */ 138 /* Volume zero, mute all outputs */
139 wmcodec_write(LOUT1VOL, 0x140);
140 wmcodec_write(ROUT1VOL, 0x140);
141 wmcodec_write(LOUT2VOL, 0x140);
142 wmcodec_write(ROUT2VOL, 0x140);
143 wmcodec_write(OUT3MIX, 0x40);
144 wmcodec_write(OUT4MIX, 0x40);
143 145
144 /* Volume zero, mute all outputs */ 146 /* DAC softmute, automute, 128OSR */
145 wmcodec_write(LOUT1VOL, 0x140); 147 wmcodec_write(DACCTRL, 0x4c);
146 wmcodec_write(ROUT1VOL, 0x140);
147 wmcodec_write(LOUT2VOL, 0x140);
148 wmcodec_write(ROUT2VOL, 0x140);
149 wmcodec_write(OUT3MIX, 0x40);
150 wmcodec_write(OUT4MIX, 0x40);
151
152 /* DAC softmute, automute, 128OSR */
153 wmcodec_write(DACCTRL, 0x4c);
154 148
155 wmcodec_write(OUT4ADC, 0x2); /* POBCTRL = 1 */ 149 wmcodec_write(OUT4ADC, 0x2); /* POBCTRL = 1 */
156 150
157 /* Enable output, DAC and mixer */ 151 /* Enable output, DAC and mixer */
158 wmcodec_write(PWRMGMT3, 0x6f); 152 wmcodec_write(PWRMGMT3, 0x6f);
159 wmcodec_write(PWRMGMT2, 0x180); 153 wmcodec_write(PWRMGMT2, 0x180);
160 wmcodec_write(PWRMGMT1, 0xd); 154 wmcodec_write(PWRMGMT1, 0xd);
161 wmcodec_write(LOUTMIX, 0x1); 155 wmcodec_write(LOUTMIX, 0x1);
162 wmcodec_write(ROUTMIX, 0x1); 156 wmcodec_write(ROUTMIX, 0x1);
163 157
164 /* Disable clock since we're acting as slave to the SoC */ 158 /* Disable clock since we're acting as slave to the SoC */
165 wmcodec_write(CLKGEN, 0x0); 159 wmcodec_write(CLKGEN, 0x0);
166 wmcodec_write(AINTFCE, 0x10); /* 16-bit, I2S format */ 160 wmcodec_write(AINTFCE, 0x10); /* 16-bit, I2S format */
167 161
168 wmcodec_write(LDACVOL, 0x1ff); /* Full DAC digital vol */ 162 wmcodec_write(LDACVOL, 0x1ff); /* Full DAC digital vol */
169 wmcodec_write(RDACVOL, 0x1ff); 163 wmcodec_write(RDACVOL, 0x1ff);
170 164
171 wmcodec_write(OUT4ADC, 0x0); /* POBCTRL = 0 */ 165 wmcodec_write(OUT4ADC, 0x0); /* POBCTRL = 0 */
166}
172 167
173 sleep(HZ/2); 168void audiohw_postinit(void)
169{
170 sleep(HZ/2);
174 171
175 audiohw_mute(0); 172 audiohw_mute(0);
176 }
177 else
178 {
179 audiohw_mute(1);
180 }
181} 173}
182 174
183void audiohw_set_headphone_vol(int vol_l, int vol_r) 175void audiohw_set_headphone_vol(int vol_l, int vol_r)
@@ -256,9 +248,6 @@ void audiohw_enable_recording(bool source_mic)
256{ 248{
257 (void)source_mic; /* We only have a line-in (I think) */ 249 (void)source_mic; /* We only have a line-in (I think) */
258 250
259 /* TODO: reset the I2S controller into known state */
260 //i2s_reset();
261
262 wmcodec_write(RESET, 0x1ff); /*Reset*/ 251 wmcodec_write(RESET, 0x1ff); /*Reset*/
263 252
264 wmcodec_write(PWRMGMT1, 0x2b); 253 wmcodec_write(PWRMGMT1, 0x2b);
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index 171358c325..b82c27e2fb 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -150,12 +150,13 @@ extern const struct sound_settings_info audiohw_settings[];
150 */ 150 */
151 151
152/** 152/**
153 * Initialize audio codec to a well defined state. 153 * Initialize audio codec to a well defined state. Includes SoC-specific
154 * setup.
154 */ 155 */
155void audiohw_init(void); 156void audiohw_init(void);
156 157
157/** 158/**
158 * Do initial audio codec setup. 159 * Do initial audio codec setup. Usually called from audiohw_init.
159 */ 160 */
160void audiohw_preinit(void); 161void audiohw_preinit(void);
161 162
@@ -207,12 +208,6 @@ void audiohw_set_balance(int val);
207 */ 208 */
208void audiohw_mute(bool mute); 209void audiohw_mute(bool mute);
209 210
210/**
211 * Silently en/disable audio output.
212 * @param enable true or false.
213 */
214void audiohw_enable_output(bool enable);
215
216#ifdef AUDIOHW_HAVE_TREBLE 211#ifdef AUDIOHW_HAVE_TREBLE
217/** 212/**
218 * Set new treble value. 213 * Set new treble value.
diff --git a/firmware/target/arm/pcm-pp.c b/firmware/target/arm/pcm-pp.c
index c572578383..2c4a6ac87d 100644
--- a/firmware/target/arm/pcm-pp.c
+++ b/firmware/target/arm/pcm-pp.c
@@ -373,14 +373,6 @@ void pcm_play_dma_init(void)
373 /* Initialize default register values. */ 373 /* Initialize default register values. */
374 audiohw_init(); 374 audiohw_init();
375 375
376#if !defined(HAVE_WM8731) && !defined(HAVE_WM8751) && !defined(HAVE_WM8975) \
377 && !defined(HAVE_WM8758) && !defined(HAVE_AS3514)
378 /* Power on */
379 audiohw_enable_output(true);
380 /* Unmute the master channel (DAC should be at zero point now). */
381 audiohw_mute(false);
382#endif
383
384 dma_play_data.size = 0; 376 dma_play_data.size = 0;
385#if NUM_CORES > 1 377#if NUM_CORES > 1
386 dma_play_data.core = 0; /* no core in control */ 378 dma_play_data.core = 0; /* no core in control */
diff --git a/firmware/target/arm/pcm-telechips.c b/firmware/target/arm/pcm-telechips.c
index b3fd9216dc..dc77b36f00 100644
--- a/firmware/target/arm/pcm-telechips.c
+++ b/firmware/target/arm/pcm-telechips.c
@@ -108,19 +108,18 @@ void pcm_play_dma_init(void)
108 108
109 /* Initialize default register values. */ 109 /* Initialize default register values. */
110 audiohw_init(); 110 audiohw_init();
111 111
112 /* Power on */
113 audiohw_enable_output(true);
114
115 /* Unmute the master channel (DAC should be at zero point now). */
116 audiohw_mute(false);
117
118 dma_play_data.size = 0; 112 dma_play_data.size = 0;
119#if NUM_CORES > 1 113#if NUM_CORES > 1
120 dma_play_data.core = 0; /* no core in control */ 114 dma_play_data.core = 0; /* no core in control */
121#endif 115#endif
122} 116}
123 117
118void pcm_postinit(void)
119{
120 audiohw_postinit();
121}
122
124void pcm_apply_settings(void) 123void pcm_apply_settings(void)
125{ 124{
126 pcm_curr_sampr = pcm_freq; 125 pcm_curr_sampr = pcm_freq;
diff --git a/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c b/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c
index 4e7f58df47..bcb6843286 100644
--- a/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c
+++ b/firmware/target/arm/tcc77x/iaudio7/audio-iaudio7.c
@@ -26,11 +26,6 @@
26int audio_channels = 2; 26int audio_channels = 2;
27int audio_output_source = AUDIO_SRC_PLAYBACK; 27int audio_output_source = AUDIO_SRC_PLAYBACK;
28 28
29void audiohw_enable_output(bool on)
30{
31 (void) on;
32}
33
34void audio_set_output_source(int source) 29void audio_set_output_source(int source)
35{ 30{
36 int oldmode = set_fiq_status(FIQ_DISABLED); 31 int oldmode = set_fiq_status(FIQ_DISABLED);
diff --git a/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c b/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c
index bd85e0b573..107b2743ae 100644
--- a/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c
+++ b/firmware/target/arm/tcc77x/logikdax/audio-logikdax.c
@@ -26,11 +26,6 @@
26int audio_channels = 2; 26int audio_channels = 2;
27int audio_output_source = AUDIO_SRC_PLAYBACK; 27int audio_output_source = AUDIO_SRC_PLAYBACK;
28 28
29void audiohw_enable_output(bool on)
30{
31 (void)on;
32}
33
34void audio_set_output_source(int source) 29void audio_set_output_source(int source)
35{ 30{
36 (void)source; 31 (void)source;
diff --git a/firmware/target/arm/tcc77x/m200/audio-m200.c b/firmware/target/arm/tcc77x/m200/audio-m200.c
index bd85e0b573..107b2743ae 100644
--- a/firmware/target/arm/tcc77x/m200/audio-m200.c
+++ b/firmware/target/arm/tcc77x/m200/audio-m200.c
@@ -26,11 +26,6 @@
26int audio_channels = 2; 26int audio_channels = 2;
27int audio_output_source = AUDIO_SRC_PLAYBACK; 27int audio_output_source = AUDIO_SRC_PLAYBACK;
28 28
29void audiohw_enable_output(bool on)
30{
31 (void)on;
32}
33
34void audio_set_output_source(int source) 29void audio_set_output_source(int source)
35{ 30{
36 (void)source; 31 (void)source;
diff --git a/firmware/target/arm/wmcodec-pp.c b/firmware/target/arm/wmcodec-pp.c
index 0d751f6b3f..031f5c8d47 100644
--- a/firmware/target/arm/wmcodec-pp.c
+++ b/firmware/target/arm/wmcodec-pp.c
@@ -29,6 +29,7 @@
29#include "system.h" 29#include "system.h"
30#include "audiohw.h" 30#include "audiohw.h"
31#include "i2c-pp.h" 31#include "i2c-pp.h"
32#include "i2s.h"
32#include "wmcodec.h" 33#include "wmcodec.h"
33 34
34#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(MROBE_100) 35#if defined(IRIVER_H10) || defined(IRIVER_H10_5GB) || defined(MROBE_100)
@@ -43,7 +44,8 @@
43/* 44/*
44 * Initialise the PP I2C and I2S. 45 * Initialise the PP I2C and I2S.
45 */ 46 */
46void audiohw_init(void) { 47void audiohw_init(void)
48{
47#ifdef CPU_PP502x 49#ifdef CPU_PP502x
48 /* normal outputs for CDI and I2S pin groups */ 50 /* normal outputs for CDI and I2S pin groups */
49 DEV_INIT2 &= ~0x300; 51 DEV_INIT2 &= ~0x300;
@@ -95,21 +97,13 @@ void audiohw_init(void) {
95 outl(inl(0xcf000028) & ~0x8, 0xcf000028); 97 outl(inl(0xcf000028) & ~0x8, 0xcf000028);
96#endif /* IPOD_1G2G/3G */ 98#endif /* IPOD_1G2G/3G */
97#endif 99#endif
100
101 /* reset the I2S controller into known state */
102 i2s_reset();
98 103
99#if defined(HAVE_WM8731) || defined(HAVE_WM8751) || defined(HAVE_WM8975) \
100 || defined(HAVE_WM8758)
101 audiohw_preinit(); 104 audiohw_preinit();
102#endif
103
104} 105}
105 106
106#if !defined(HAVE_WM8731) && !defined(HAVE_WM8751) && !defined(HAVE_WM8975) \
107 && !defined(HAVE_WM8758)
108void audiohw_postinit(void)
109{
110}
111#endif
112
113void wmcodec_write(int reg, int data) 107void wmcodec_write(int reg, int data)
114{ 108{
115 pp_i2c_send(I2C_AUDIO_ADDRESS, (reg<<1) | ((data&0x100)>>8),data&0xff); 109 pp_i2c_send(I2C_AUDIO_ADDRESS, (reg<<1) | ((data&0x100)>>8),data&0xff);
diff --git a/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c
index a5cc61b844..cdfb67d7ee 100644
--- a/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c
+++ b/firmware/target/mips/ingenic_jz47xx/pcm-jz4740.c
@@ -50,12 +50,11 @@ void pcm_play_dma_init(void)
50 50
51 /* Initialize default register values. */ 51 /* Initialize default register values. */
52 audiohw_init(); 52 audiohw_init();
53}
53 54
54 /* Power on */ 55void pcm_postinit(void)
55 audiohw_enable_output(true); 56{
56 57 audiohw_postinit();
57 /* Unmute the master channel (DAC should be at zero point now). */
58 audiohw_mute(false);
59} 58}
60 59
61void pcm_apply_settings(void) 60void pcm_apply_settings(void)