diff options
author | Shengjiu Wang <b02247@freescale.com> | 2014-05-14 23:22:03 -0400 |
---|---|---|
committer | Shengjiu Wang <b02247@freescale.com> | 2014-05-15 01:19:20 -0400 |
commit | a148914789a1986eed6c1612cc1dbfa382ea080b (patch) | |
tree | 7e5b371c3db32cd12aa5e5a164d240d8d13c2e75 /sound/soc/fsl | |
parent | 9226b11646cef7ae1d00fc9ce6e51e3a802a4ee0 (diff) |
ENGR00313535-1 ASoC: fsl: Refine imx-cs42888 machine driver
Remove local parameter for p2p_width, p2p_rate, which will be
get from the cpu driver of fe directly.
Signed-off-by: Shengjiu Wang <b02247@freescale.com>
Diffstat (limited to 'sound/soc/fsl')
-rw-r--r-- | sound/soc/fsl/imx-cs42888.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/sound/soc/fsl/imx-cs42888.c b/sound/soc/fsl/imx-cs42888.c index 357933ecf989..63ea41b22452 100644 --- a/sound/soc/fsl/imx-cs42888.c +++ b/sound/soc/fsl/imx-cs42888.c | |||
@@ -34,10 +34,9 @@ | |||
34 | #define SUPPORT_RATE_NUM 10 | 34 | #define SUPPORT_RATE_NUM 10 |
35 | 35 | ||
36 | struct imx_priv { | 36 | struct imx_priv { |
37 | int fe_p2p_rate; | ||
38 | int fe_p2p_width; | ||
39 | unsigned int mclk_freq; | 37 | unsigned int mclk_freq; |
40 | struct platform_device *pdev; | 38 | struct platform_device *pdev; |
39 | struct platform_device *asrc_pdev; | ||
41 | }; | 40 | }; |
42 | 41 | ||
43 | static struct imx_priv card_priv; | 42 | static struct imx_priv card_priv; |
@@ -141,11 +140,17 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, | |||
141 | struct snd_pcm_hw_params *params) { | 140 | struct snd_pcm_hw_params *params) { |
142 | 141 | ||
143 | struct imx_priv *priv = &card_priv; | 142 | struct imx_priv *priv = &card_priv; |
143 | struct fsl_asrc_p2p *asrc_p2p; | ||
144 | 144 | ||
145 | hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min = priv->fe_p2p_rate; | 145 | if (!priv->asrc_pdev) |
146 | hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->max = priv->fe_p2p_rate; | 146 | return -EINVAL; |
147 | |||
148 | asrc_p2p = platform_get_drvdata(priv->asrc_pdev); | ||
149 | |||
150 | hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->min = asrc_p2p->p2p_rate; | ||
151 | hw_param_interval(params, SNDRV_PCM_HW_PARAM_RATE)->max = asrc_p2p->p2p_rate; | ||
147 | snd_mask_none(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT)); | 152 | snd_mask_none(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT)); |
148 | if (priv->fe_p2p_width == 16) | 153 | if (asrc_p2p->p2p_width == 16) |
149 | snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), | 154 | snd_mask_set(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT), |
150 | SNDRV_PCM_FORMAT_S16_LE); | 155 | SNDRV_PCM_FORMAT_S16_LE); |
151 | else | 156 | else |
@@ -203,6 +208,7 @@ static int imx_cs42888_probe(struct platform_device *pdev) | |||
203 | int ret; | 208 | int ret; |
204 | 209 | ||
205 | priv->pdev = pdev; | 210 | priv->pdev = pdev; |
211 | priv->asrc_pdev = NULL; | ||
206 | 212 | ||
207 | esai_np = of_parse_phandle(pdev->dev.of_node, "esai-controller", 0); | 213 | esai_np = of_parse_phandle(pdev->dev.of_node, "esai-controller", 0); |
208 | codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); | 214 | codec_np = of_parse_phandle(pdev->dev.of_node, "audio-codec", 0); |
@@ -217,6 +223,7 @@ static int imx_cs42888_probe(struct platform_device *pdev) | |||
217 | asrc_pdev = of_find_device_by_node(asrc_np); | 223 | asrc_pdev = of_find_device_by_node(asrc_np); |
218 | if (asrc_pdev) { | 224 | if (asrc_pdev) { |
219 | struct fsl_asrc_p2p *asrc_p2p; | 225 | struct fsl_asrc_p2p *asrc_p2p; |
226 | priv->asrc_pdev = asrc_pdev; | ||
220 | asrc_p2p = platform_get_drvdata(asrc_pdev); | 227 | asrc_p2p = platform_get_drvdata(asrc_pdev); |
221 | if (!asrc_p2p) { | 228 | if (!asrc_p2p) { |
222 | dev_err(&pdev->dev, "failed to get p2p params\n"); | 229 | dev_err(&pdev->dev, "failed to get p2p params\n"); |
@@ -224,8 +231,6 @@ static int imx_cs42888_probe(struct platform_device *pdev) | |||
224 | goto fail; | 231 | goto fail; |
225 | } | 232 | } |
226 | asrc_p2p->per_dev = ESAI; | 233 | asrc_p2p->per_dev = ESAI; |
227 | priv->fe_p2p_rate = asrc_p2p->p2p_rate; | ||
228 | priv->fe_p2p_width = asrc_p2p->p2p_width; | ||
229 | } | 234 | } |
230 | } | 235 | } |
231 | 236 | ||