Patch "ASoC: meson: axg-tdm-interface: manage formatters in trigger" has been added to the 5.4-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ASoC: meson: axg-tdm-interface: manage formatters in trigger

to the 5.4-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     asoc-meson-axg-tdm-interface-manage-formatters-in-tr.patch
and it can be found in the queue-5.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit bd47aa017fbf8cc0dd54f1f8013caabe04878dc4
Author: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
Date:   Wed Oct 20 13:42:17 2021 +0200

    ASoC: meson: axg-tdm-interface: manage formatters in trigger
    
    [ Upstream commit bf5e4887eeddb48480568466536aa08ec7f179a5 ]
    
    So far, the formatters have been reset/enabled using the .prepare()
    callback. This was done in this callback because walking the formatters use
    a mutex so it could not be done in .trigger(), which is atomic by default.
    
    It turns out there is a problem on capture path of the AXG series.
    The FIFO may get out of sync with the TDM decoder if the IP are not enabled
    in a specific order. The FIFO must be enabled before the formatter starts
    producing data. IOW, we must deal with FE before the BE. The .prepare()
    callback is called on the BEs before the FE so it is not OK for the AXG.
    
    The .trigger() callback order can be configured, and it deals with the FE
    before the BEs by default. To solve our problem, we just need to start and
    stop the formatters from the .trigger() callback. It is OK do so now that
    the links have been made 'nonatomic' in the card driver.
    
    Signed-off-by: Jerome Brunet <jbrunet@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20211020114217.133153-3-jbrunet@xxxxxxxxxxxx
    Signed-off-by: Mark Brown <broonie@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/sound/soc/meson/axg-tdm-interface.c b/sound/soc/meson/axg-tdm-interface.c
index 34aff050caf25..dc2fe9e2baadd 100644
--- a/sound/soc/meson/axg-tdm-interface.c
+++ b/sound/soc/meson/axg-tdm-interface.c
@@ -351,13 +351,29 @@ static int axg_tdm_iface_hw_free(struct snd_pcm_substream *substream,
 	return 0;
 }
 
-static int axg_tdm_iface_prepare(struct snd_pcm_substream *substream,
+static int axg_tdm_iface_trigger(struct snd_pcm_substream *substream,
+				 int cmd,
 				 struct snd_soc_dai *dai)
 {
-	struct axg_tdm_stream *ts = snd_soc_dai_get_dma_data(dai, substream);
+	struct axg_tdm_stream *ts =
+		snd_soc_dai_get_dma_data(dai, substream);
+
+	switch (cmd) {
+	case SNDRV_PCM_TRIGGER_START:
+	case SNDRV_PCM_TRIGGER_RESUME:
+	case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
+		axg_tdm_stream_start(ts);
+		break;
+	case SNDRV_PCM_TRIGGER_SUSPEND:
+	case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
+	case SNDRV_PCM_TRIGGER_STOP:
+		axg_tdm_stream_stop(ts);
+		break;
+	default:
+		return -EINVAL;
+	}
 
-	/* Force all attached formatters to update */
-	return axg_tdm_stream_reset(ts);
+	return 0;
 }
 
 static int axg_tdm_iface_remove_dai(struct snd_soc_dai *dai)
@@ -397,8 +413,8 @@ static const struct snd_soc_dai_ops axg_tdm_iface_ops = {
 	.set_fmt	= axg_tdm_iface_set_fmt,
 	.startup	= axg_tdm_iface_startup,
 	.hw_params	= axg_tdm_iface_hw_params,
-	.prepare	= axg_tdm_iface_prepare,
 	.hw_free	= axg_tdm_iface_hw_free,
+	.trigger	= axg_tdm_iface_trigger,
 };
 
 /* TDM Backend DAIs */




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux