summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Sevakis <jethead71@rockbox.org>2007-03-14 10:06:57 +0000
committerMichael Sevakis <jethead71@rockbox.org>2007-03-14 10:06:57 +0000
commit6c8772d6db3c9c9eb16f38e8445ccdf48c8ef60a (patch)
treeeb844da5bd7af77a59869dd4ac499e53ff15406c
parenta5f7ef27f02fba0a7c7ac749b3f61fc22bf9680e (diff)
downloadrockbox-6c8772d6db3c9c9eb16f38e8445ccdf48c8ef60a.tar.gz
rockbox-6c8772d6db3c9c9eb16f38e8445ccdf48c8ef60a.zip
x5/M5: Finally get rid of filter selection aberrations when switching to 88.2kHz sampling rate which affected both the DAC and ADC. Turning off the DAC and ADC before changing the internal codec frequency seems to cure the remaining glitch of the filters not being correctly selected by the TLV320. Some FIFO reset changes that help keep it stable as well. Supporting 88.2KHz on iAudio has been a tricky ordeal. Also made sure to ok the HW tone controls on iRiver. :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@12757 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/drivers/tlv320.c12
-rw-r--r--firmware/target/coldfire/pcm-coldfire.c12
2 files changed, 21 insertions, 3 deletions
diff --git a/firmware/drivers/tlv320.c b/firmware/drivers/tlv320.c
index c0f28d31d9..3e27d22817 100644
--- a/firmware/drivers/tlv320.c
+++ b/firmware/drivers/tlv320.c
@@ -141,10 +141,22 @@ void audiohw_set_frequency(unsigned fsel)
(0xf << 2), /* 88200 */
};
+ unsigned value_dap, value_pc;
+
if (fsel >= ARRAYLEN(values_src))
fsel = 1;
+ /* Temporarily turn off the DAC and ADC before switching sample
+ rates or they don't choose their filters correctly */
+ value_dap = tlv320_regs[REG_DAP];
+ value_pc = tlv320_regs[REG_PC];
+
+ tlv320_write_reg(REG_DAP, value_dap | DAP_DACM);
+ tlv320_write_reg(REG_PC, value_pc | PC_DAC | PC_ADC);
tlv320_write_reg(REG_SRC, values_src[fsel]);
+ tlv320_write_reg(REG_PC, value_pc | PC_DAC);
+ tlv320_write_reg(REG_PC, value_pc);
+ tlv320_write_reg(REG_DAP, value_dap);
}
/**
diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c
index b827887636..ee9dfb3a3e 100644
--- a/firmware/target/coldfire/pcm-coldfire.c
+++ b/firmware/target/coldfire/pcm-coldfire.c
@@ -128,6 +128,7 @@ bool _pcm_apply_settings(bool clear_reset)
{
static int last_pcm_freq = 0;
bool did_reset = false;
+ unsigned long iis_play_defparm = IIS_PLAY_DEFPARM;
if (pcm_freq != last_pcm_freq)
{
@@ -139,13 +140,18 @@ bool _pcm_apply_settings(bool clear_reset)
or starting recording will sound absolutely awful once in
awhile - audiohw_set_frequency then coldfire_set_pllcr_audio_bits
*/
+ SET_IIS_PLAY(iis_play_defparm | IIS_FIFO_RESET);
audiohw_set_frequency(freq_ent[FPARM_FSEL]);
coldfire_set_pllcr_audio_bits(PLLCR_SET_AUDIO_BITS_DEFPARM);
did_reset = true;
}
- SET_IIS_PLAY(IIS_PLAY_DEFPARM |
- (clear_reset ? 0 : (IIS_PLAY & IIS_FIFO_RESET)));
+ /* If a reset was done because of a sample rate change, IIS_PLAY will have
+ been set already, so only needs to be set again if the reset flag must
+ be cleared. If the frequency didn't change, it was never altered and
+ the reset flag can just be removed or no action taken. */
+ if (clear_reset)
+ SET_IIS_PLAY(iis_play_defparm & ~IIS_FIFO_RESET);
#if 0
logf("IISPLAY: %08X", IIS_PLAY);
#endif
@@ -259,9 +265,9 @@ void pcm_init(void)
/* Setup Coldfire I2S before initializing hardware or changing
other settings. */
or_l(IIS_FIFO_RESET, &IIS_PLAY);
+ SET_IIS_PLAY(IIS_PLAY_DEFPARM | IIS_FIFO_RESET);
pcm_set_frequency(HW_FREQ_DEFAULT);
audio_set_output_source(AUDIO_SRC_PLAYBACK);
- SET_IIS_PLAY(IIS_FIFO_RESET | IIS_PLAY_DEFPARM);
/* Initialize default register values. */
audiohw_init();