fsl_spdif.c (6f23fc47c1b2ac226704fb7294f43ed3b0965e51) | fsl_spdif.c (14ec63f678e8beaaa1005ccae6c112bf672ba2b3) |
---|---|
1// SPDX-License-Identifier: GPL-2.0 2// 3// Freescale S/PDIF ALSA SoC Digital Audio Interface (DAI) driver 4// 5// Copyright (C) 2013 Freescale Semiconductor, Inc. 6// 7// Based on stmp3xxx_spdif_dai.c 8// Vladimir Barinov <vbarinov@embeddedalley.com> --- 488 unchanged lines hidden (view full) --- 497 return 0; 498} 499 500static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv, enum spdif_txrate index); 501 502static int spdif_set_sample_rate(struct snd_pcm_substream *substream, 503 int sample_rate) 504{ | 1// SPDX-License-Identifier: GPL-2.0 2// 3// Freescale S/PDIF ALSA SoC Digital Audio Interface (DAI) driver 4// 5// Copyright (C) 2013 Freescale Semiconductor, Inc. 6// 7// Based on stmp3xxx_spdif_dai.c 8// Vladimir Barinov <vbarinov@embeddedalley.com> --- 488 unchanged lines hidden (view full) --- 497 return 0; 498} 499 500static int fsl_spdif_probe_txclk(struct fsl_spdif_priv *spdif_priv, enum spdif_txrate index); 501 502static int spdif_set_sample_rate(struct snd_pcm_substream *substream, 503 int sample_rate) 504{ |
505 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 506 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); | 505 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 506 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)); |
507 struct spdif_mixer_control *ctrl = &spdif_priv->fsl_spdif_control; 508 struct regmap *regmap = spdif_priv->regmap; 509 struct platform_device *pdev = spdif_priv->pdev; 510 unsigned long csfs = 0; 511 u32 stc, mask, rate; 512 u16 sysclk_df; 513 u8 clk, txclk_df; 514 int ret; --- 85 unchanged lines hidden (view full) --- 600 spdif_priv->txrate[rate], sample_rate); 601 602 return 0; 603} 604 605static int fsl_spdif_startup(struct snd_pcm_substream *substream, 606 struct snd_soc_dai *cpu_dai) 607{ | 507 struct spdif_mixer_control *ctrl = &spdif_priv->fsl_spdif_control; 508 struct regmap *regmap = spdif_priv->regmap; 509 struct platform_device *pdev = spdif_priv->pdev; 510 unsigned long csfs = 0; 511 u32 stc, mask, rate; 512 u16 sysclk_df; 513 u8 clk, txclk_df; 514 int ret; --- 85 unchanged lines hidden (view full) --- 600 spdif_priv->txrate[rate], sample_rate); 601 602 return 0; 603} 604 605static int fsl_spdif_startup(struct snd_pcm_substream *substream, 606 struct snd_soc_dai *cpu_dai) 607{ |
608 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 609 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); | 608 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 609 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)); |
610 struct platform_device *pdev = spdif_priv->pdev; 611 struct regmap *regmap = spdif_priv->regmap; 612 u32 scr, mask; 613 int ret; 614 615 /* Reset module and interrupts only for first initialization */ 616 if (!snd_soc_dai_active(cpu_dai)) { 617 ret = spdif_softreset(spdif_priv); --- 24 unchanged lines hidden (view full) --- 642 regmap_update_bits(regmap, REG_SPDIF_SCR, SCR_LOW_POWER, 0); 643 644 return 0; 645} 646 647static void fsl_spdif_shutdown(struct snd_pcm_substream *substream, 648 struct snd_soc_dai *cpu_dai) 649{ | 610 struct platform_device *pdev = spdif_priv->pdev; 611 struct regmap *regmap = spdif_priv->regmap; 612 u32 scr, mask; 613 int ret; 614 615 /* Reset module and interrupts only for first initialization */ 616 if (!snd_soc_dai_active(cpu_dai)) { 617 ret = spdif_softreset(spdif_priv); --- 24 unchanged lines hidden (view full) --- 642 regmap_update_bits(regmap, REG_SPDIF_SCR, SCR_LOW_POWER, 0); 643 644 return 0; 645} 646 647static void fsl_spdif_shutdown(struct snd_pcm_substream *substream, 648 struct snd_soc_dai *cpu_dai) 649{ |
650 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 651 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); | 650 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 651 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)); |
652 struct regmap *regmap = spdif_priv->regmap; 653 u32 scr, mask; 654 655 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 656 scr = 0; 657 mask = SCR_TXFIFO_AUTOSYNC_MASK | SCR_TXFIFO_CTRL_MASK | 658 SCR_TXSEL_MASK | SCR_USRC_SEL_MASK | 659 SCR_TXFIFO_FSEL_MASK; --- 36 unchanged lines hidden (view full) --- 696 return ret; 697 698 return 0; 699} 700static int fsl_spdif_hw_params(struct snd_pcm_substream *substream, 701 struct snd_pcm_hw_params *params, 702 struct snd_soc_dai *dai) 703{ | 652 struct regmap *regmap = spdif_priv->regmap; 653 u32 scr, mask; 654 655 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 656 scr = 0; 657 mask = SCR_TXFIFO_AUTOSYNC_MASK | SCR_TXFIFO_CTRL_MASK | 658 SCR_TXSEL_MASK | SCR_USRC_SEL_MASK | 659 SCR_TXFIFO_FSEL_MASK; --- 36 unchanged lines hidden (view full) --- 696 return ret; 697 698 return 0; 699} 700static int fsl_spdif_hw_params(struct snd_pcm_substream *substream, 701 struct snd_pcm_hw_params *params, 702 struct snd_soc_dai *dai) 703{ |
704 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 705 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); | 704 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 705 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)); |
706 struct spdif_mixer_control *ctrl = &spdif_priv->fsl_spdif_control; 707 struct platform_device *pdev = spdif_priv->pdev; 708 u32 sample_rate = params_rate(params); 709 int ret = 0; 710 711 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 712 ret = spdif_reparent_rootclk(spdif_priv, sample_rate); 713 if (ret) { --- 17 unchanged lines hidden (view full) --- 731 } 732 733 return ret; 734} 735 736static int fsl_spdif_trigger(struct snd_pcm_substream *substream, 737 int cmd, struct snd_soc_dai *dai) 738{ | 706 struct spdif_mixer_control *ctrl = &spdif_priv->fsl_spdif_control; 707 struct platform_device *pdev = spdif_priv->pdev; 708 u32 sample_rate = params_rate(params); 709 int ret = 0; 710 711 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 712 ret = spdif_reparent_rootclk(spdif_priv, sample_rate); 713 if (ret) { --- 17 unchanged lines hidden (view full) --- 731 } 732 733 return ret; 734} 735 736static int fsl_spdif_trigger(struct snd_pcm_substream *substream, 737 int cmd, struct snd_soc_dai *dai) 738{ |
739 struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); 740 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(asoc_rtd_to_cpu(rtd, 0)); | 739 struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); 740 struct fsl_spdif_priv *spdif_priv = snd_soc_dai_get_drvdata(snd_soc_rtd_to_cpu(rtd, 0)); |
741 struct regmap *regmap = spdif_priv->regmap; 742 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; 743 u32 intr = SIE_INTR_FOR(tx); 744 u32 dmaen = SCR_DMA_xX_EN(tx); 745 746 switch (cmd) { 747 case SNDRV_PCM_TRIGGER_START: 748 case SNDRV_PCM_TRIGGER_RESUME: --- 1031 unchanged lines hidden --- | 741 struct regmap *regmap = spdif_priv->regmap; 742 bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; 743 u32 intr = SIE_INTR_FOR(tx); 744 u32 dmaen = SCR_DMA_xX_EN(tx); 745 746 switch (cmd) { 747 case SNDRV_PCM_TRIGGER_START: 748 case SNDRV_PCM_TRIGGER_RESUME: --- 1031 unchanged lines hidden --- |