Skip to content

Commit

Permalink
ASoC: Tegra: I2S: Ensure clock is enabled when writing regs
Browse files Browse the repository at this point in the history
The I2S controller needs a clock to respond to register writes. Without
this, register writes will at worst hang the CPU. In practice, I've only
observed writes being dropped.

Luckily, the dropped register writes historically had no effect:

TEGRA_I2S_TIMING: The value we wrote was the reset default.

TEGRA_I2S_FIFO_SCR: The default was for the FIFOs to request more data
when one slot was empty. The requested value was for the FIFOs to request
when four slots were empty. The DMA controller in the mainline kernel is
configured to burst a single entry at a time into the FIFO, hence there
was no issue. The only negative effect was on bus efficiency losses due
to an increased number of arbitration attempts.

However, in various non-upstream changes, the DMA controller now bursts
four entries at a time into the FIFO. If there is only space for one
entry, the data is simply dropped. In practice, this resulted in 3/4 of
samples being dropped, and playback at 4x the expected rate and pitch.
By fixing the clocking issue, this is solved.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Acked-by: Liam Girdwood <lrg@ti.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
  • Loading branch information
Stephen Warren authored and Mark Brown committed Jul 4, 2011
1 parent e999dc5 commit 713d136
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sound/soc/tegra/tegra_i2s.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,12 +222,18 @@ static int tegra_i2s_hw_params(struct snd_pcm_substream *substream,
if (i2sclock % (2 * srate))
reg |= TEGRA_I2S_TIMING_NON_SYM_ENABLE;

if (!i2s->clk_refs)
clk_enable(i2s->clk_i2s);

tegra_i2s_write(i2s, TEGRA_I2S_TIMING, reg);

tegra_i2s_write(i2s, TEGRA_I2S_FIFO_SCR,
TEGRA_I2S_FIFO_SCR_FIFO2_ATN_LVL_FOUR_SLOTS |
TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_FOUR_SLOTS);

if (!i2s->clk_refs)
clk_disable(i2s->clk_i2s);

return 0;
}

Expand Down

0 comments on commit 713d136

Please sign in to comment.