mirror of
https://github.com/torvalds/linux.git
synced 2026-07-30 11:11:26 +02:00
ASoC: fsl_sai: Add sample rate constraint
Platforms like i.MX93/91 only have one audio PLL. Some sample rates are not supported. If the PLL source is used for 8kHz series rates, then 11kHz series rates can't be supported. Use fsl_asoc_constrain_rates() to constrain rates according to PLL sources. Signed-off-by: Chancel Liu <chancel.liu@nxp.com> Link: https://patch.msgid.link/20241126115440.3929061-5-chancel.liu@nxp.com Acked-by: Shengjiu Wang <shengjiu.wang@gmail.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
b622b677d2
commit
4edc98598b
|
|
@ -885,7 +885,7 @@ static int fsl_sai_startup(struct snd_pcm_substream *substream,
|
||||||
sai->dma_params_rx.maxburst);
|
sai->dma_params_rx.maxburst);
|
||||||
|
|
||||||
ret = snd_pcm_hw_constraint_list(substream->runtime, 0,
|
ret = snd_pcm_hw_constraint_list(substream->runtime, 0,
|
||||||
SNDRV_PCM_HW_PARAM_RATE, &fsl_sai_rate_constraints);
|
SNDRV_PCM_HW_PARAM_RATE, &sai->constraint_rates);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
@ -1442,6 +1442,11 @@ static int fsl_sai_probe(struct platform_device *pdev)
|
||||||
fsl_asoc_get_pll_clocks(&pdev->dev, &sai->pll8k_clk,
|
fsl_asoc_get_pll_clocks(&pdev->dev, &sai->pll8k_clk,
|
||||||
&sai->pll11k_clk);
|
&sai->pll11k_clk);
|
||||||
|
|
||||||
|
fsl_asoc_constrain_rates(&sai->constraint_rates,
|
||||||
|
&fsl_sai_rate_constraints,
|
||||||
|
sai->pll8k_clk, sai->pll11k_clk, NULL,
|
||||||
|
sai->constraint_rates_list);
|
||||||
|
|
||||||
/* Use Multi FIFO mode depending on the support from SDMA script */
|
/* Use Multi FIFO mode depending on the support from SDMA script */
|
||||||
ret = of_property_read_u32_array(np, "dmas", dmas, 4);
|
ret = of_property_read_u32_array(np, "dmas", dmas, 4);
|
||||||
if (!sai->soc_data->use_edma && !ret && dmas[2] == IMX_DMATYPE_MULTI_SAI)
|
if (!sai->soc_data->use_edma && !ret && dmas[2] == IMX_DMATYPE_MULTI_SAI)
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include <linux/dma/imx-dma.h>
|
#include <linux/dma/imx-dma.h>
|
||||||
#include <sound/dmaengine_pcm.h>
|
#include <sound/dmaengine_pcm.h>
|
||||||
|
|
||||||
|
#define FAL_SAI_NUM_RATES 20
|
||||||
#define FSL_SAI_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
|
#define FSL_SAI_FORMATS (SNDRV_PCM_FMTBIT_S16_LE |\
|
||||||
SNDRV_PCM_FMTBIT_S20_3LE |\
|
SNDRV_PCM_FMTBIT_S20_3LE |\
|
||||||
SNDRV_PCM_FMTBIT_S24_LE |\
|
SNDRV_PCM_FMTBIT_S24_LE |\
|
||||||
|
|
@ -309,6 +310,8 @@ struct fsl_sai {
|
||||||
struct pinctrl *pinctrl;
|
struct pinctrl *pinctrl;
|
||||||
struct pinctrl_state *pins_state;
|
struct pinctrl_state *pins_state;
|
||||||
struct sdma_peripheral_config audio_config[2];
|
struct sdma_peripheral_config audio_config[2];
|
||||||
|
struct snd_pcm_hw_constraint_list constraint_rates;
|
||||||
|
unsigned int constraint_rates_list[FAL_SAI_NUM_RATES];
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TX 1
|
#define TX 1
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user