diff options
-rw-r--r-- | firmware/target/coldfire/iriver/audio-iriver.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/firmware/target/coldfire/iriver/audio-iriver.c b/firmware/target/coldfire/iriver/audio-iriver.c index 7a52ce1ff0..420ca309d8 100644 --- a/firmware/target/coldfire/iriver/audio-iriver.c +++ b/firmware/target/coldfire/iriver/audio-iriver.c @@ -58,6 +58,7 @@ void audio_set_source(int source, unsigned flags) /* Prevent pops from unneeded switching */ static int last_source = AUDIO_SRC_PLAYBACK; bool recording = flags & SRCF_RECORDING; + static bool last_recording = false; switch (source) { @@ -77,7 +78,7 @@ void audio_set_source(int source, unsigned flags) if (source != last_source) { uda1380_enable_recording(true); /* source mic */ - uda1380_set_monitor(true); + uda1380_set_monitor(false); /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ DATAINCONTROL = (3 << 14) | (4 << 3); } @@ -87,7 +88,7 @@ void audio_set_source(int source, unsigned flags) if (source != last_source) { uda1380_enable_recording(false); /* source line */ - uda1380_set_monitor(true); + uda1380_set_monitor(false); /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ DATAINCONTROL = (3 << 14) | (4 << 3); } @@ -106,6 +107,14 @@ void audio_set_source(int source, unsigned flags) #endif /* HAVE_SPDIF_IN */ case AUDIO_SRC_FMRADIO: /* recording and playback */ + if (!recording) + uda1380_set_recvol(0, 0, AUDIO_GAIN_LINEIN); + + if (source == last_source && recording == last_recording) + break; + + last_recording = recording; + if (recording) { /* Int. when 6 samples in FIFO, PDIR2 src = iis1RcvData */ @@ -113,17 +122,13 @@ void audio_set_source(int source, unsigned flags) } else { - uda1380_set_recvol(0, 0, AUDIO_GAIN_LINEIN); /* Reset PDIR2 data flow */ DATAINCONTROL = (1 << 9); } - if (source != last_source) - { - /* I2S recording and playback */ - uda1380_enable_recording(false); /* source line */ - uda1380_set_monitor(true); - } + /* I2S recording and playback */ + uda1380_enable_recording(false); /* source line */ + uda1380_set_monitor(!recording); break; } /* end switch */ |