Commit 4ca73043 authored by Zidan Wang's avatar Zidan Wang Committed by Mark Brown

ASoC: fsl: using params_width function to simplify code

using params_width function to simplify code.
Signed-off-by: default avatarZidan Wang <zidan.wang@freescale.com>
Acked-by: default avatarNicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 3d8d0bd0
...@@ -447,7 +447,7 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream, ...@@ -447,7 +447,7 @@ static int fsl_asrc_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai) struct snd_soc_dai *dai)
{ {
struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai); struct fsl_asrc *asrc_priv = snd_soc_dai_get_drvdata(dai);
int width = snd_pcm_format_width(params_format(params)); int width = params_width(params);
struct snd_pcm_runtime *runtime = substream->runtime; struct snd_pcm_runtime *runtime = substream->runtime;
struct fsl_asrc_pair *pair = runtime->private_data; struct fsl_asrc_pair *pair = runtime->private_data;
unsigned int channels = params_channels(params); unsigned int channels = params_channels(params);
......
...@@ -510,7 +510,7 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream, ...@@ -510,7 +510,7 @@ static int fsl_esai_hw_params(struct snd_pcm_substream *substream,
{ {
struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai); struct fsl_esai *esai_priv = snd_soc_dai_get_drvdata(dai);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
u32 width = snd_pcm_format_width(params_format(params)); u32 width = params_width(params);
u32 channels = params_channels(params); u32 channels = params_channels(params);
u32 pins = DIV_ROUND_UP(channels, esai_priv->slots); u32 pins = DIV_ROUND_UP(channels, esai_priv->slots);
u32 slot_width = width; u32 slot_width = width;
......
...@@ -404,7 +404,7 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream, ...@@ -404,7 +404,7 @@ static int fsl_sai_hw_params(struct snd_pcm_substream *substream,
struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai); struct fsl_sai *sai = snd_soc_dai_get_drvdata(cpu_dai);
bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
unsigned int channels = params_channels(params); unsigned int channels = params_channels(params);
u32 word_width = snd_pcm_format_width(params_format(params)); u32 word_width = params_width(params);
u32 val_cr4 = 0, val_cr5 = 0; u32 val_cr4 = 0, val_cr5 = 0;
u32 slots = (channels == 1) ? 2 : channels; u32 slots = (channels == 1) ? 2 : channels;
u32 slot_width = word_width; u32 slot_width = word_width;
......
...@@ -767,8 +767,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream, ...@@ -767,8 +767,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai); struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
struct regmap *regs = ssi_private->regs; struct regmap *regs = ssi_private->regs;
unsigned int channels = params_channels(hw_params); unsigned int channels = params_channels(hw_params);
unsigned int sample_size = unsigned int sample_size = params_width(hw_params);
snd_pcm_format_width(params_format(hw_params));
u32 wl = CCSR_SSI_SxCCR_WL(sample_size); u32 wl = CCSR_SSI_SxCCR_WL(sample_size);
int ret; int ret;
u32 scr_val; u32 scr_val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment