From cb20d5757bbe79d9c9e4210e232934792be2336e Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 22 Mar 2013 14:12:01 +0100 Subject: ASoC: ux500_pcm: Remove duplicated SNDRV_PCM_HW_PARAM_PERIODS constraint The generic dmaengine based PCM driver code takes care of setting this constraint, there is no need of doing it manually in the ux500 driver. Signed-off-by: Lars-Peter Clausen Acked-by: Ola Lilja Signed-off-by: Mark Brown --- sound/soc/ux500/ux500_pcm.c | 9 --------- 1 file changed, 9 deletions(-) (limited to 'sound/soc/ux500') diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index 846fa82a58d0..375ca6ba3ebb 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c @@ -111,15 +111,6 @@ static int ux500_pcm_open(struct snd_pcm_substream *substream) snd_soc_set_runtime_hwparams(substream, &ux500_pcm_hw_capture); - /* ensure that buffer size is a multiple of period size */ - ret = snd_pcm_hw_constraint_integer(runtime, - SNDRV_PCM_HW_PARAM_PERIODS); - if (ret < 0) { - dev_err(dev, "%s: Error: snd_pcm_hw_constraints failed (%d)\n", - __func__, ret); - return ret; - } - dev_dbg(dev, "%s: Set hw-struct for %s.\n", __func__, snd_pcm_stream_str(substream)); runtime->hw = (stream_id == SNDRV_PCM_STREAM_PLAYBACK) ? -- cgit From 8c4e56fd5595105128077c2bbdfde3c15a4c2d91 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 22 Mar 2013 14:12:05 +0100 Subject: ASoC: ux500_pcm: No need to wrap snd_dmaengine_pcm_close() If a PCM driver using the dmaengine PCM helper functions doesn't need to do anything special in its pcm_close callback, snd_dmaengine_pcm_close can be used directly for as the pcm_close callback and there is no need to wrap it in a custom function. Signed-off-by: Lars-Peter Clausen Acked-by: Ola Lilja Signed-off-by: Mark Brown --- sound/soc/ux500/ux500_pcm.c | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) (limited to 'sound/soc/ux500') diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index 375ca6ba3ebb..d000ba271cab 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c @@ -160,18 +160,6 @@ static int ux500_pcm_open(struct snd_pcm_substream *substream) return 0; } -static int ux500_pcm_close(struct snd_pcm_substream *substream) -{ - struct snd_soc_pcm_runtime *rtd = substream->private_data; - struct snd_soc_dai *dai = rtd->cpu_dai; - - dev_dbg(dai->dev, "%s: Enter\n", __func__); - - snd_dmaengine_pcm_close(substream); - - return 0; -} - static int ux500_pcm_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *hw_params) { @@ -246,7 +234,7 @@ static int ux500_pcm_mmap(struct snd_pcm_substream *substream, static struct snd_pcm_ops ux500_pcm_ops = { .open = ux500_pcm_open, - .close = ux500_pcm_close, + .close = snd_dmaengine_pcm_close, .ioctl = snd_pcm_lib_ioctl, .hw_params = ux500_pcm_hw_params, .hw_free = ux500_pcm_hw_free, -- cgit From ebd59b07ecd9d35d5bc88c91a4878fbb4549ed42 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Fri, 22 Mar 2013 14:12:07 +0100 Subject: ASoC: ux500_pcm: No need to use snd_dmaengine_pcm_set_data() The driver never uses snd_dmaengine_pcm_get_data(), so there is no need to use snd_dmaengine_pcm_set_data(). Signed-off-by: Lars-Peter Clausen Acked-by: Ola Lilja Signed-off-by: Mark Brown --- sound/soc/ux500/ux500_pcm.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'sound/soc/ux500') diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index d000ba271cab..1ab36fa845cd 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c @@ -155,8 +155,6 @@ static int ux500_pcm_open(struct snd_pcm_substream *substream) return ret; } - snd_dmaengine_pcm_set_data(substream, dma_cfg); - return 0; } -- cgit From 69b6f19622ce0aef41df884b75e3f789c64b89c0 Mon Sep 17 00:00:00 2001 From: Lars-Peter Clausen Date: Wed, 3 Apr 2013 11:02:55 +0200 Subject: ASoC: ux500_pcm: Use the same snd_pcm_hardware for playback and capture The snd_pcm_hardware structs for playback and capture in the ux500 PCM are identical, so remove one of them and use the same snd_pcm_hardware struct for both playback and capture. Also move the defines used to initialize the snd_pcm_hardware fields from ux500_pcm.h to ux500_pcm.c since that's the only place where they are used. Also drop the assignment of the snd_pcm_hardware struct to runtime->hw since that is what the call to snd_soc_set_runtime_hwparams() right above it already does, so the second assignment is redundant. Signed-off-by: Lars-Peter Clausen Signed-off-by: Mark Brown --- sound/soc/ux500/ux500_pcm.c | 51 +++++++++++++-------------------------------- sound/soc/ux500/ux500_pcm.h | 14 ------------- 2 files changed, 15 insertions(+), 50 deletions(-) (limited to 'sound/soc/ux500') diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c index 1ab36fa845cd..09b5364e5095 100644 --- a/sound/soc/ux500/ux500_pcm.c +++ b/sound/soc/ux500/ux500_pcm.c @@ -28,28 +28,19 @@ #include "ux500_msp_i2s.h" #include "ux500_pcm.h" -static struct snd_pcm_hardware ux500_pcm_hw_playback = { - .info = SNDRV_PCM_INFO_INTERLEAVED | - SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_RESUME | - SNDRV_PCM_INFO_PAUSE, - .formats = SNDRV_PCM_FMTBIT_S16_LE | - SNDRV_PCM_FMTBIT_U16_LE | - SNDRV_PCM_FMTBIT_S16_BE | - SNDRV_PCM_FMTBIT_U16_BE, - .rates = SNDRV_PCM_RATE_KNOT, - .rate_min = UX500_PLATFORM_MIN_RATE_PLAYBACK, - .rate_max = UX500_PLATFORM_MAX_RATE_PLAYBACK, - .channels_min = UX500_PLATFORM_MIN_CHANNELS, - .channels_max = UX500_PLATFORM_MAX_CHANNELS, - .buffer_bytes_max = UX500_PLATFORM_BUFFER_BYTES_MAX, - .period_bytes_min = UX500_PLATFORM_PERIODS_BYTES_MIN, - .period_bytes_max = UX500_PLATFORM_PERIODS_BYTES_MAX, - .periods_min = UX500_PLATFORM_PERIODS_MIN, - .periods_max = UX500_PLATFORM_PERIODS_MAX, -}; +#define UX500_PLATFORM_MIN_RATE 8000 +#define UX500_PLATFORM_MAX_RATE 48000 + +#define UX500_PLATFORM_MIN_CHANNELS 1 +#define UX500_PLATFORM_MAX_CHANNELS 8 + +#define UX500_PLATFORM_PERIODS_BYTES_MIN 128 +#define UX500_PLATFORM_PERIODS_BYTES_MAX (64 * PAGE_SIZE) +#define UX500_PLATFORM_PERIODS_MIN 2 +#define UX500_PLATFORM_PERIODS_MAX 48 +#define UX500_PLATFORM_BUFFER_BYTES_MAX (2048 * PAGE_SIZE) -static struct snd_pcm_hardware ux500_pcm_hw_capture = { +static struct snd_pcm_hardware ux500_pcm_hw = { .info = SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_RESUME | @@ -59,8 +50,8 @@ static struct snd_pcm_hardware ux500_pcm_hw_capture = { SNDRV_PCM_FMTBIT_S16_BE | SNDRV_PCM_FMTBIT_U16_BE, .rates = SNDRV_PCM_RATE_KNOT, - .rate_min = UX500_PLATFORM_MIN_RATE_CAPTURE, - .rate_max = UX500_PLATFORM_MAX_RATE_CAPTURE, + .rate_min = UX500_PLATFORM_MIN_RATE, + .rate_max = UX500_PLATFORM_MAX_RATE, .channels_min = UX500_PLATFORM_MIN_CHANNELS, .channels_max = UX500_PLATFORM_MAX_CHANNELS, .buffer_bytes_max = UX500_PLATFORM_BUFFER_BYTES_MAX, @@ -90,8 +81,6 @@ static void ux500_pcm_dma_hw_free(struct device *dev, static int ux500_pcm_open(struct snd_pcm_substream *substream) { - int stream_id = substream->pstr->stream; - struct snd_pcm_runtime *runtime = substream->runtime; struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *dai = rtd->cpu_dai; struct device *dev = dai->dev; @@ -104,17 +93,7 @@ static int ux500_pcm_open(struct snd_pcm_substream *substream) snd_pcm_stream_str(substream)); dev_dbg(dev, "%s: Set runtime hwparams.\n", __func__); - if (stream_id == SNDRV_PCM_STREAM_PLAYBACK) - snd_soc_set_runtime_hwparams(substream, - &ux500_pcm_hw_playback); - else - snd_soc_set_runtime_hwparams(substream, - &ux500_pcm_hw_capture); - - dev_dbg(dev, "%s: Set hw-struct for %s.\n", __func__, - snd_pcm_stream_str(substream)); - runtime->hw = (stream_id == SNDRV_PCM_STREAM_PLAYBACK) ? - ux500_pcm_hw_playback : ux500_pcm_hw_capture; + snd_soc_set_runtime_hwparams(substream, &ux500_pcm_hw); mem_data_width = STEDMA40_HALFWORD_WIDTH; diff --git a/sound/soc/ux500/ux500_pcm.h b/sound/soc/ux500/ux500_pcm.h index 76d344476afc..d76e1aff6458 100644 --- a/sound/soc/ux500/ux500_pcm.h +++ b/sound/soc/ux500/ux500_pcm.h @@ -18,20 +18,6 @@ #include -#define UX500_PLATFORM_MIN_RATE_PLAYBACK 8000 -#define UX500_PLATFORM_MAX_RATE_PLAYBACK 48000 -#define UX500_PLATFORM_MIN_RATE_CAPTURE 8000 -#define UX500_PLATFORM_MAX_RATE_CAPTURE 48000 - -#define UX500_PLATFORM_MIN_CHANNELS 1 -#define UX500_PLATFORM_MAX_CHANNELS 8 - -#define UX500_PLATFORM_PERIODS_BYTES_MIN 128 -#define UX500_PLATFORM_PERIODS_BYTES_MAX (64 * PAGE_SIZE) -#define UX500_PLATFORM_PERIODS_MIN 2 -#define UX500_PLATFORM_PERIODS_MAX 48 -#define UX500_PLATFORM_BUFFER_BYTES_MAX (2048 * PAGE_SIZE) - int ux500_pcm_register_platform(struct platform_device *pdev); int ux500_pcm_unregister_platform(struct platform_device *pdev); -- cgit