diff options
Diffstat (limited to 'firmware/drivers/audio/wm8751.c')
-rw-r--r-- | firmware/drivers/audio/wm8751.c | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c index b42c4b1041..cdc64fd69b 100644 --- a/firmware/drivers/audio/wm8751.c +++ b/firmware/drivers/audio/wm8751.c | |||
@@ -116,17 +116,22 @@ void audiohw_preinit(void) | |||
116 | * and Headphone outputs are all OFF (DACMU = 1 Power | 116 | * and Headphone outputs are all OFF (DACMU = 1 Power |
117 | * Management registers 1 and 2 are all zeros). | 117 | * Management registers 1 and 2 are all zeros). |
118 | */ | 118 | */ |
119 | |||
119 | wmcodec_write(RESET, RESET_RESET); /*Reset*/ | 120 | wmcodec_write(RESET, RESET_RESET); /*Reset*/ |
120 | 121 | ||
121 | /* 2. Enable Vmid and VREF. */ | 122 | /* 2. Enable Vmid and VREF. */ |
122 | wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_5K); | 123 | wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_5K); |
123 | 124 | ||
125 | #ifdef CODEC_SLAVE | ||
126 | wmcodec_write(AINTFCE,AINTFCE_WL_16|AINTFCE_FORMAT_I2S); | ||
127 | #else | ||
124 | /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */ | 128 | /* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */ |
125 | /* IWL=00(16 bit) FORMAT=10(I2S format) */ | 129 | /* IWL=00(16 bit) FORMAT=10(I2S format) */ |
126 | wmcodec_write(AINTFCE, AINTFCE_MS | AINTFCE_WL_16 | | 130 | wmcodec_write(AINTFCE, AINTFCE_MS | AINTFCE_WL_16 | |
127 | AINTFCE_FORMAT_I2S); | 131 | AINTFCE_FORMAT_I2S); |
128 | 132 | #endif | |
129 | /* Set default samplerate */ | 133 | /* Set default samplerate */ |
134 | |||
130 | audiohw_set_frequency(HW_FREQ_DEFAULT); | 135 | audiohw_set_frequency(HW_FREQ_DEFAULT); |
131 | } | 136 | } |
132 | 137 | ||
@@ -140,7 +145,7 @@ void audiohw_postinit(void) | |||
140 | wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR); | 145 | wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR); |
141 | 146 | ||
142 | /* 4. Enable line and / or headphone output buffers as required. */ | 147 | /* 4. Enable line and / or headphone output buffers as required. */ |
143 | #ifdef MROBE_100 | 148 | #if defined(MROBE_100) || defined(MPIO_HD200) |
144 | wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR | | 149 | wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR | |
145 | PWRMGMT2_LOUT1 | PWRMGMT2_ROUT1); | 150 | PWRMGMT2_LOUT1 | PWRMGMT2_ROUT1); |
146 | #else | 151 | #else |
@@ -166,6 +171,19 @@ void audiohw_postinit(void) | |||
166 | #endif | 171 | #endif |
167 | #endif | 172 | #endif |
168 | 173 | ||
174 | #ifdef MPIO_HD200 | ||
175 | /* Crude fix for high pitch noise at startup | ||
176 | * I should find out what realy causes this | ||
177 | */ | ||
178 | wmcodec_write(LOUT1, LOUT1_BITS|0x7f); | ||
179 | wmcodec_write(ROUT1, ROUT1_BITS|0x7f); | ||
180 | wmcodec_write(LOUT1, LOUT1_BITS); | ||
181 | wmcodec_write(ROUT1, ROUT1_BITS); | ||
182 | #endif | ||
183 | |||
184 | /* lower power consumption */ | ||
185 | wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_50K); | ||
186 | |||
169 | audiohw_mute(false); | 187 | audiohw_mute(false); |
170 | 188 | ||
171 | #ifdef MROBE_100 | 189 | #ifdef MROBE_100 |
@@ -234,6 +252,8 @@ void audiohw_close(void) | |||
234 | 252 | ||
235 | void audiohw_set_frequency(int fsel) | 253 | void audiohw_set_frequency(int fsel) |
236 | { | 254 | { |
255 | (void)fsel; | ||
256 | #ifndef CODEC_SLAVE | ||
237 | static const unsigned char srctrl_table[HW_NUM_FREQ] = | 257 | static const unsigned char srctrl_table[HW_NUM_FREQ] = |
238 | { | 258 | { |
239 | HW_HAVE_11_([HW_FREQ_11] = CODEC_SRCTRL_11025HZ,) | 259 | HW_HAVE_11_([HW_FREQ_11] = CODEC_SRCTRL_11025HZ,) |
@@ -246,4 +266,5 @@ void audiohw_set_frequency(int fsel) | |||
246 | fsel = HW_FREQ_DEFAULT; | 266 | fsel = HW_FREQ_DEFAULT; |
247 | 267 | ||
248 | wmcodec_write(CLOCKING, srctrl_table[fsel]); | 268 | wmcodec_write(CLOCKING, srctrl_table[fsel]); |
269 | #endif | ||
249 | } | 270 | } |