H10: Touch-up the audio source switching a bit. Actually fix my earlier errors when enabling recording from Line/FM.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15580 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Michael Sevakis 2007-11-11 19:11:23 +00:00
parent 31ea780ee0
commit 6e36ac547c
2 changed files with 20 additions and 15 deletions

View file

@ -238,6 +238,8 @@ void audiohw_enable_recording(bool source_mic)
codec_set_active(false);
wm8731_regs[PDCTRL] &= ~PDCTRL_ADCPD;
/* NOTE: When switching to digital monitoring we will not want
* the DAC disabled. */
wm8731_regs[PDCTRL] |= PDCTRL_DACPD;
wm8731_regs[AAPCTRL] &= ~AAPCTRL_DACSEL;
@ -247,7 +249,7 @@ void audiohw_enable_recording(bool source_mic)
wm8731_regs[PDCTRL] &= ~PDCTRL_MICPD;
wm8731_regs[PDCTRL] |= PDCTRL_LINEINPD;
wm8731_regs[AAPCTRL] |= AAPCTRL_INSEL | AAPCTRL_SIDETONE;
wm8731_regs[AAPCTRL] &= ~AAPCTRL_MUTEMIC;
wm8731_regs[AAPCTRL] &= ~(AAPCTRL_MUTEMIC | AAPCTRL_BYPASS);
} else {
wm8731_regs[PDCTRL] |= PDCTRL_MICPD;
wm8731_regs[PDCTRL] &= ~PDCTRL_LINEINPD;
@ -259,9 +261,6 @@ void audiohw_enable_recording(bool source_mic)
wm8731_write(AAPCTRL, wm8731_regs[AAPCTRL]);
if (!source_mic) {
wm8731_regs[AAPCTRL] |= AAPCTRL_INSEL | AAPCTRL_SIDETONE;
wm8731_regs[AAPCTRL] &= ~(AAPCTRL_MUTEMIC | AAPCTRL_BYPASS);
} else {
wm8731_write_and(LINVOL, ~LINVOL_LINMUTE);
wm8731_write_and(RINVOL, ~RINVOL_RINMUTE);
}
@ -321,13 +320,11 @@ void audiohw_set_monitor(int enable)
{
if(enable)
{
wm8731_regs[AAPCTRL] |= AAPCTRL_BYPASS;
wm8731_regs[AAPCTRL] &=~ (AAPCTRL_DACSEL | AAPCTRL_SIDETONE);
wm8731_write(AAPCTRL, wm8731_regs[AAPCTRL]);
wm8731_write_and(PDCTRL, ~PDCTRL_LINEINPD);
wm8731_write_or(AAPCTRL, AAPCTRL_BYPASS);
}
else {
wm8731_regs[AAPCTRL] &=~ AAPCTRL_BYPASS;
wm8731_regs[AAPCTRL] |= AAPCTRL_DACSEL | AAPCTRL_SIDETONE;
wm8731_write(AAPCTRL, wm8731_regs[AAPCTRL]);
wm8731_write_and(AAPCTRL, ~AAPCTRL_BYPASS);
wm8731_write_or(PDCTRL, PDCTRL_LINEINPD);
}
}

View file

@ -47,8 +47,8 @@ void audio_input_mux(int source, unsigned flags)
#ifdef HAVE_RECORDING
if (source != last_source)
{
audiohw_disable_recording();
audiohw_set_monitor(false);
audiohw_disable_recording();
}
#endif
break;
@ -56,8 +56,8 @@ void audio_input_mux(int source, unsigned flags)
case AUDIO_SRC_MIC: /* recording only */
if (source != last_source)
{
audiohw_enable_recording(true); /* source mic */
audiohw_set_monitor(false);
audiohw_enable_recording(true); /* source mic */
}
break;
#endif
@ -69,8 +69,8 @@ void audio_input_mux(int source, unsigned flags)
#endif
if (source != last_source)
{
audiohw_enable_recording(false); /* source line */
audiohw_set_monitor(false);
audiohw_enable_recording(false); /* source line */
}
break;
#endif
@ -88,8 +88,16 @@ void audio_input_mux(int source, unsigned flags)
last_recording = recording;
audiohw_enable_recording(false); /* select line-in source */
audiohw_set_monitor(!recording); /* enable bypass mode */
if (recording)
{
audiohw_set_monitor(false); /* disable bypass mode */
audiohw_enable_recording(false); /* select line-in source */
}
else
{
audiohw_disable_recording();
audiohw_set_monitor(true); /* enable bypass mode */
}
break;
#endif
} /* end switch */