SSI supports "variable" and "fixed" mode of operation in AC'97 mode. Up to now, driver always configured SSI port to operate in "variable" AC'97 mode which is known to be unreliable with some CODECs, see: commit 01ca485171e3 ("ASoC: fsl_ssi: only enable proper channel slots in AC'97 mode") for more information on issues related to spurious SLOTREQ bits. But in summary, when SSI operates in AC'97 variable mode of operation, CODECs can sometimes send SLOTREQ bits for non-existent audio slots which then "stick" in SSI and completely break audio output. Contrary when operating SSI in AC'97 fixed mode, described issues were completely gone!
Thus add support for operating SSI in AC'97 Fixed Mode of operation which provides better audio reliability when compared to AC'97 Variable Mode with some CODECs.
Signed-off-by: Primoz Fiser primoz.fiser@norik.com --- sound/soc/fsl/fsl_ssi.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index 404be27c15fe..3b89785f6de8 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c @@ -243,6 +243,7 @@ struct fsl_ssi_soc_data { * @dma_maxburst: Max number of words to transfer in one go. So far, * this is always the same as fifo_watermark. * @ac97_reg_lock: Mutex lock to serialize AC97 register access operations + * @ac97_fixed_mode: SSI in AC97 fixed mode of operation */ struct fsl_ssi { struct regmap *regs; @@ -287,6 +288,7 @@ struct fsl_ssi { u32 dma_maxburst;
struct mutex ac97_reg_lock; + bool ac97_fixed_mode; };
/* @@ -616,7 +618,12 @@ static void fsl_ssi_setup_ac97(struct fsl_ssi *ssi) regmap_write(regs, REG_SSI_SRCCR, SSI_SxCCR_WL(17) | SSI_SxCCR_DC(13));
/* Enable AC97 mode and startup the SSI */ - regmap_write(regs, REG_SSI_SACNT, SSI_SACNT_AC97EN | SSI_SACNT_FV); + if (ssi->ac97_fixed_mode) { + regmap_write(regs, REG_SSI_SACNT, SSI_SACNT_AC97EN); + regmap_write(regs, REG_SSI_SATAG, 0x9800); + } else + regmap_write(regs, REG_SSI_SACNT, + SSI_SACNT_AC97EN | SSI_SACNT_FV);
/* AC97 has to communicate with codec before starting a stream */ regmap_update_bits(regs, REG_SSI_SCR, @@ -1092,8 +1099,10 @@ static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd, * send valid data to slots other than normal playback slots. * * To be safe, configure SACCST right before TX starts. + * + * Above applies only when SSI operates in AC97 Variable Mode. */ - if (tx && fsl_ssi_is_ac97(ssi)) + if (tx && fsl_ssi_is_ac97(ssi) && !ssi->ac97_fixed_mode) fsl_ssi_tx_ac97_saccst_setup(ssi); fsl_ssi_config_enable(ssi, tx); break; @@ -1437,6 +1446,11 @@ static int fsl_ssi_probe_from_dt(struct fsl_ssi *ssi) ssi->synchronous = true; }
+ /* Check AC97 mode of operation */ + sprop = of_get_property(np, "fsl,ac97-mode", NULL); + if (sprop && !strcmp(sprop, "fixed")) + ssi->ac97_fixed_mode = true; + /* Select DMA or FIQ */ ssi->use_dma = !of_property_read_bool(np, "fsl,fiq-stream-filter");