fsl_ssi.c (6f23fc47c1b2ac226704fb7294f43ed3b0965e51) fsl_ssi.c (14ec63f678e8beaaa1005ccae6c112bf672ba2b3)
1// SPDX-License-Identifier: GPL-2.0
2//
3// Freescale SSI ALSA SoC Digital Audio Interface (DAI) driver
4//
5// Author: Timur Tabi <timur@freescale.com>
6//
7// Copyright 2007-2010 Freescale Semiconductor, Inc.
8//

--- 620 unchanged lines hidden (view full) ---

629 SSI_SCR_SSIEN | SSI_SCR_TE | SSI_SCR_RE);
630
631 regmap_write(regs, REG_SSI_SOR, SSI_SOR_WAIT(3));
632}
633
634static int fsl_ssi_startup(struct snd_pcm_substream *substream,
635 struct snd_soc_dai *dai)
636{
1// SPDX-License-Identifier: GPL-2.0
2//
3// Freescale SSI ALSA SoC Digital Audio Interface (DAI) driver
4//
5// Author: Timur Tabi <timur@freescale.com>
6//
7// Copyright 2007-2010 Freescale Semiconductor, Inc.
8//

--- 620 unchanged lines hidden (view full) ---

629 SSI_SCR_SSIEN | SSI_SCR_TE | SSI_SCR_RE);
630
631 regmap_write(regs, REG_SSI_SOR, SSI_SOR_WAIT(3));
632}
633
634static int fsl_ssi_startup(struct snd_pcm_substream *substream,
635 struct snd_soc_dai *dai)
636{
637 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
638 struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
637 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
638 struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
639 int ret;
640
641 ret = clk_prepare_enable(ssi->clk);
642 if (ret)
643 return ret;
644
645 /*
646 * When using dual fifo mode, it is safer to ensure an even period

--- 6 unchanged lines hidden (view full) ---

653 SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2);
654
655 return 0;
656}
657
658static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
659 struct snd_soc_dai *dai)
660{
639 int ret;
640
641 ret = clk_prepare_enable(ssi->clk);
642 if (ret)
643 return ret;
644
645 /*
646 * When using dual fifo mode, it is safer to ensure an even period

--- 6 unchanged lines hidden (view full) ---

653 SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 2);
654
655 return 0;
656}
657
658static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
659 struct snd_soc_dai *dai)
660{
661 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
662 struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
661 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
662 struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
663
664 clk_disable_unprepare(ssi->clk);
665}
666
667/**
668 * fsl_ssi_set_bclk - Configure Digital Audio Interface bit clock
669 * @substream: ASoC substream
670 * @dai: pointer to DAI

--- 214 unchanged lines hidden (view full) ---

885 }
886
887 return 0;
888}
889
890static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
891 struct snd_soc_dai *dai)
892{
663
664 clk_disable_unprepare(ssi->clk);
665}
666
667/**
668 * fsl_ssi_set_bclk - Configure Digital Audio Interface bit clock
669 * @substream: ASoC substream
670 * @dai: pointer to DAI

--- 214 unchanged lines hidden (view full) ---

885 }
886
887 return 0;
888}
889
890static int fsl_ssi_hw_free(struct snd_pcm_substream *substream,
891 struct snd_soc_dai *dai)
892{
893 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
894 struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
893 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
894 struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
895
896 if (fsl_ssi_is_i2s_clock_provider(ssi) &&
897 ssi->baudclk_streams & BIT(substream->stream)) {
898 clk_disable_unprepare(ssi->baudclk);
899 ssi->baudclk_streams &= ~BIT(substream->stream);
900 }
901
902 return 0;

--- 199 unchanged lines hidden (view full) ---

1102 * @dai: pointer to DAI
1103 *
1104 * The DMA channel is in external master start and pause mode, which
1105 * means the SSI completely controls the flow of data.
1106 */
1107static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
1108 struct snd_soc_dai *dai)
1109{
895
896 if (fsl_ssi_is_i2s_clock_provider(ssi) &&
897 ssi->baudclk_streams & BIT(substream->stream)) {
898 clk_disable_unprepare(ssi->baudclk);
899 ssi->baudclk_streams &= ~BIT(substream->stream);
900 }
901
902 return 0;

--- 199 unchanged lines hidden (view full) ---

1102 * @dai: pointer to DAI
1103 *
1104 * The DMA channel is in external master start and pause mode, which
1105 * means the SSI completely controls the flow of data.
1106 */
1107static int fsl_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
1108 struct snd_soc_dai *dai)
1109{
1110 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
1111 struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0));
1110 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream);
1111 struct fsl_ssi *ssi = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0));
1112 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
1113
1114 switch (cmd) {
1115 case SNDRV_PCM_TRIGGER_START:
1116 case SNDRV_PCM_TRIGGER_RESUME:
1117 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
1118 /*
1119 * SACCST might be modified via AC Link by a CODEC if it sends

--- 626 unchanged lines hidden ---
1112 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
1113
1114 switch (cmd) {
1115 case SNDRV_PCM_TRIGGER_START:
1116 case SNDRV_PCM_TRIGGER_RESUME:
1117 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
1118 /*
1119 * SACCST might be modified via AC Link by a CODEC if it sends

--- 626 unchanged lines hidden ---