diff options
Diffstat (limited to 'sound/soc/samsung/pcm.c')
| -rw-r--r-- | sound/soc/samsung/pcm.c | 44 | 
1 files changed, 18 insertions, 26 deletions
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c index e54256fc4b2..4c5f97fe45c 100644 --- a/sound/soc/samsung/pcm.c +++ b/sound/soc/samsung/pcm.c @@ -20,7 +20,6 @@  #include <sound/pcm_params.h>  #include <linux/platform_data/asoc-s3c.h> -#include <mach/dma.h>  #include "dma.h"  #include "pcm.h" @@ -132,11 +131,11 @@ struct s3c_pcm_info {  	struct s3c_dma_params	*dma_capture;  }; -static struct s3c2410_dma_client s3c_pcm_dma_client_out = { +static struct s3c_dma_client s3c_pcm_dma_client_out = {  	.name		= "PCM Stereo out"  }; -static struct s3c2410_dma_client s3c_pcm_dma_client_in = { +static struct s3c_dma_client s3c_pcm_dma_client_in = {  	.name		= "PCM Stereo in"  }; @@ -275,7 +274,6 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream,  {  	struct snd_soc_pcm_runtime *rtd = substream->private_data;  	struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(rtd->cpu_dai); -	struct s3c_dma_params *dma_data;  	void __iomem *regs = pcm->regs;  	struct clk *clk;  	int sclk_div, sync_div; @@ -284,16 +282,9 @@ static int s3c_pcm_hw_params(struct snd_pcm_substream *substream,  	dev_dbg(pcm->dev, "Entered %s\n", __func__); -	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) -		dma_data = pcm->dma_playback; -	else -		dma_data = pcm->dma_capture; - -	snd_soc_dai_set_dma_data(rtd->cpu_dai, substream, dma_data); -  	/* Strictly check for sample size */ -	switch (params_format(params)) { -	case SNDRV_PCM_FORMAT_S16_LE: +	switch (params_width(params)) { +	case 16:  		break;  	default:  		return -EINVAL; @@ -461,10 +452,20 @@ static const struct snd_soc_dai_ops s3c_pcm_dai_ops = {  	.set_fmt	= s3c_pcm_set_fmt,  }; +static int s3c_pcm_dai_probe(struct snd_soc_dai *dai) +{ +	struct s3c_pcm_info *pcm = snd_soc_dai_get_drvdata(dai); + +	snd_soc_dai_init_dma_data(dai, pcm->dma_playback, pcm->dma_capture); + +	return 0; +} +  #define S3C_PCM_RATES  SNDRV_PCM_RATE_8000_96000  #define S3C_PCM_DAI_DECLARE			\  	.symmetric_rates = 1,					\ +	.probe = s3c_pcm_dai_probe,				\  	.ops = &s3c_pcm_dai_ops,				\  	.playback = {						\  		.channels_min	= 2,				\ @@ -541,7 +542,7 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)  	/* Default is 128fs */  	pcm->sclk_per_fs = 128; -	pcm->cclk = clk_get(&pdev->dev, "audio-bus"); +	pcm->cclk = devm_clk_get(&pdev->dev, "audio-bus");  	if (IS_ERR(pcm->cclk)) {  		dev_err(&pdev->dev, "failed to get audio-bus\n");  		ret = PTR_ERR(pcm->cclk); @@ -566,7 +567,7 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)  		goto err3;  	} -	pcm->pclk = clk_get(&pdev->dev, "pcm"); +	pcm->pclk = devm_clk_get(&pdev->dev, "pcm");  	if (IS_ERR(pcm->pclk)) {  		dev_err(&pdev->dev, "failed to get pcm_clock\n");  		ret = -ENOENT; @@ -587,7 +588,7 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)  	pm_runtime_enable(&pdev->dev); -	ret = snd_soc_register_component(&pdev->dev, &s3c_pcm_component, +	ret = devm_snd_soc_register_component(&pdev->dev, &s3c_pcm_component,  					 &s3c_pcm_dai[pdev->id], 1);  	if (ret != 0) {  		dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret); @@ -597,23 +598,19 @@ static int s3c_pcm_dev_probe(struct platform_device *pdev)  	ret = samsung_asoc_dma_platform_register(&pdev->dev);  	if (ret) {  		dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret); -		goto err6; +		goto err5;  	}  	return 0; -err6: -	snd_soc_unregister_component(&pdev->dev);  err5:  	clk_disable_unprepare(pcm->pclk); -	clk_put(pcm->pclk);  err4:  	iounmap(pcm->regs);  err3:  	release_mem_region(mem_res->start, resource_size(mem_res));  err2:  	clk_disable_unprepare(pcm->cclk); -	clk_put(pcm->cclk);  err1:  	return ret;  } @@ -623,9 +620,6 @@ static int s3c_pcm_dev_remove(struct platform_device *pdev)  	struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id];  	struct resource *mem_res; -	samsung_asoc_dma_platform_unregister(&pdev->dev); -	snd_soc_unregister_component(&pdev->dev); -  	pm_runtime_disable(&pdev->dev);  	iounmap(pcm->regs); @@ -635,8 +629,6 @@ static int s3c_pcm_dev_remove(struct platform_device *pdev)  	clk_disable_unprepare(pcm->cclk);  	clk_disable_unprepare(pcm->pclk); -	clk_put(pcm->pclk); -	clk_put(pcm->cclk);  	return 0;  }  | 
