diff options
-rw-r--r-- | firmware/drivers/audio/wm8731.c | 17 | ||||
-rw-r--r-- | firmware/target/arm/audio-pp.c | 18 |
2 files changed, 20 insertions, 15 deletions
diff --git a/firmware/drivers/audio/wm8731.c b/firmware/drivers/audio/wm8731.c index 44aeefe791..66eb1e859a 100644 --- a/firmware/drivers/audio/wm8731.c +++ b/firmware/drivers/audio/wm8731.c | |||
@@ -238,6 +238,8 @@ void audiohw_enable_recording(bool source_mic) | |||
238 | codec_set_active(false); | 238 | codec_set_active(false); |
239 | 239 | ||
240 | wm8731_regs[PDCTRL] &= ~PDCTRL_ADCPD; | 240 | wm8731_regs[PDCTRL] &= ~PDCTRL_ADCPD; |
241 | /* NOTE: When switching to digital monitoring we will not want | ||
242 | * the DAC disabled. */ | ||
241 | wm8731_regs[PDCTRL] |= PDCTRL_DACPD; | 243 | wm8731_regs[PDCTRL] |= PDCTRL_DACPD; |
242 | wm8731_regs[AAPCTRL] &= ~AAPCTRL_DACSEL; | 244 | wm8731_regs[AAPCTRL] &= ~AAPCTRL_DACSEL; |
243 | 245 | ||
@@ -247,7 +249,7 @@ void audiohw_enable_recording(bool source_mic) | |||
247 | wm8731_regs[PDCTRL] &= ~PDCTRL_MICPD; | 249 | wm8731_regs[PDCTRL] &= ~PDCTRL_MICPD; |
248 | wm8731_regs[PDCTRL] |= PDCTRL_LINEINPD; | 250 | wm8731_regs[PDCTRL] |= PDCTRL_LINEINPD; |
249 | wm8731_regs[AAPCTRL] |= AAPCTRL_INSEL | AAPCTRL_SIDETONE; | 251 | wm8731_regs[AAPCTRL] |= AAPCTRL_INSEL | AAPCTRL_SIDETONE; |
250 | wm8731_regs[AAPCTRL] &= ~AAPCTRL_MUTEMIC; | 252 | wm8731_regs[AAPCTRL] &= ~(AAPCTRL_MUTEMIC | AAPCTRL_BYPASS); |
251 | } else { | 253 | } else { |
252 | wm8731_regs[PDCTRL] |= PDCTRL_MICPD; | 254 | wm8731_regs[PDCTRL] |= PDCTRL_MICPD; |
253 | wm8731_regs[PDCTRL] &= ~PDCTRL_LINEINPD; | 255 | wm8731_regs[PDCTRL] &= ~PDCTRL_LINEINPD; |
@@ -259,9 +261,6 @@ void audiohw_enable_recording(bool source_mic) | |||
259 | wm8731_write(AAPCTRL, wm8731_regs[AAPCTRL]); | 261 | wm8731_write(AAPCTRL, wm8731_regs[AAPCTRL]); |
260 | 262 | ||
261 | if (!source_mic) { | 263 | if (!source_mic) { |
262 | wm8731_regs[AAPCTRL] |= AAPCTRL_INSEL | AAPCTRL_SIDETONE; | ||
263 | wm8731_regs[AAPCTRL] &= ~(AAPCTRL_MUTEMIC | AAPCTRL_BYPASS); | ||
264 | } else { | ||
265 | wm8731_write_and(LINVOL, ~LINVOL_LINMUTE); | 264 | wm8731_write_and(LINVOL, ~LINVOL_LINMUTE); |
266 | wm8731_write_and(RINVOL, ~RINVOL_RINMUTE); | 265 | wm8731_write_and(RINVOL, ~RINVOL_RINMUTE); |
267 | } | 266 | } |
@@ -321,13 +320,11 @@ void audiohw_set_monitor(int enable) | |||
321 | { | 320 | { |
322 | if(enable) | 321 | if(enable) |
323 | { | 322 | { |
324 | wm8731_regs[AAPCTRL] |= AAPCTRL_BYPASS; | 323 | wm8731_write_and(PDCTRL, ~PDCTRL_LINEINPD); |
325 | wm8731_regs[AAPCTRL] &=~ (AAPCTRL_DACSEL | AAPCTRL_SIDETONE); | 324 | wm8731_write_or(AAPCTRL, AAPCTRL_BYPASS); |
326 | wm8731_write(AAPCTRL, wm8731_regs[AAPCTRL]); | ||
327 | } | 325 | } |
328 | else { | 326 | else { |
329 | wm8731_regs[AAPCTRL] &=~ AAPCTRL_BYPASS; | 327 | wm8731_write_and(AAPCTRL, ~AAPCTRL_BYPASS); |
330 | wm8731_regs[AAPCTRL] |= AAPCTRL_DACSEL | AAPCTRL_SIDETONE; | 328 | wm8731_write_or(PDCTRL, PDCTRL_LINEINPD); |
331 | wm8731_write(AAPCTRL, wm8731_regs[AAPCTRL]); | ||
332 | } | 329 | } |
333 | } | 330 | } |
diff --git a/firmware/target/arm/audio-pp.c b/firmware/target/arm/audio-pp.c index 783342ef37..2c94e36359 100644 --- a/firmware/target/arm/audio-pp.c +++ b/firmware/target/arm/audio-pp.c | |||
@@ -47,8 +47,8 @@ void audio_input_mux(int source, unsigned flags) | |||
47 | #ifdef HAVE_RECORDING | 47 | #ifdef HAVE_RECORDING |
48 | if (source != last_source) | 48 | if (source != last_source) |
49 | { | 49 | { |
50 | audiohw_disable_recording(); | ||
51 | audiohw_set_monitor(false); | 50 | audiohw_set_monitor(false); |
51 | audiohw_disable_recording(); | ||
52 | } | 52 | } |
53 | #endif | 53 | #endif |
54 | break; | 54 | break; |
@@ -56,8 +56,8 @@ void audio_input_mux(int source, unsigned flags) | |||
56 | case AUDIO_SRC_MIC: /* recording only */ | 56 | case AUDIO_SRC_MIC: /* recording only */ |
57 | if (source != last_source) | 57 | if (source != last_source) |
58 | { | 58 | { |
59 | audiohw_enable_recording(true); /* source mic */ | ||
60 | audiohw_set_monitor(false); | 59 | audiohw_set_monitor(false); |
60 | audiohw_enable_recording(true); /* source mic */ | ||
61 | } | 61 | } |
62 | break; | 62 | break; |
63 | #endif | 63 | #endif |
@@ -69,8 +69,8 @@ void audio_input_mux(int source, unsigned flags) | |||
69 | #endif | 69 | #endif |
70 | if (source != last_source) | 70 | if (source != last_source) |
71 | { | 71 | { |
72 | audiohw_enable_recording(false); /* source line */ | ||
73 | audiohw_set_monitor(false); | 72 | audiohw_set_monitor(false); |
73 | audiohw_enable_recording(false); /* source line */ | ||
74 | } | 74 | } |
75 | break; | 75 | break; |
76 | #endif | 76 | #endif |
@@ -88,8 +88,16 @@ void audio_input_mux(int source, unsigned flags) | |||
88 | 88 | ||
89 | last_recording = recording; | 89 | last_recording = recording; |
90 | 90 | ||
91 | audiohw_enable_recording(false); /* select line-in source */ | 91 | if (recording) |
92 | audiohw_set_monitor(!recording); /* enable bypass mode */ | 92 | { |
93 | audiohw_set_monitor(false); /* disable bypass mode */ | ||
94 | audiohw_enable_recording(false); /* select line-in source */ | ||
95 | } | ||
96 | else | ||
97 | { | ||
98 | audiohw_disable_recording(); | ||
99 | audiohw_set_monitor(true); /* enable bypass mode */ | ||
100 | } | ||
93 | break; | 101 | break; |
94 | #endif | 102 | #endif |
95 | } /* end switch */ | 103 | } /* end switch */ |