mbox series

[V3,0/4] update supported sample format

Message ID cover.1568861098.git.shengjiu.wang@nxp.com
Headers show
Series update supported sample format | expand

Message

Shengjiu Wang Sept. 19, 2019, 12:11 p.m. UTC
This patch serial is to update the supported format for fsl_asrc
and fix some format issue.

Shengjiu Wang (4):
  ASoC: fsl_asrc: Use in(out)put_format instead of in(out)put_word_width
  ASoC: fsl_asrc: update supported sample format
  ASoC: pcm_dmaengine: Extract snd_dmaengine_pcm_refine_runtime_hwparams
  ASoC: fsl_asrc: Fix error with S24_3LE format bitstream in i.MX8

changes in v2
- extract snd_dmaengine_pcm_set_runtime_hwparams in one
  separate path.
- 4th patch depends on 3rd patch

changes in v3
- Fix build report by kbuild test robot <lkp@intel.com>
- change snd_dmaengine_pcm_set_runtime_hwparams to
  snd_dmaengine_pcm_refine_runtime_hwparams

 include/sound/dmaengine_pcm.h         |  5 ++
 sound/core/pcm_dmaengine.c            | 83 +++++++++++++++++++++++++++
 sound/soc/fsl/fsl_asrc.c              | 65 ++++++++++++++-------
 sound/soc/fsl/fsl_asrc.h              |  7 ++-
 sound/soc/fsl/fsl_asrc_dma.c          | 52 ++++++++++++++---
 sound/soc/soc-generic-dmaengine-pcm.c | 62 +++-----------------
 6 files changed, 188 insertions(+), 86 deletions(-)

-- 
2.21.0

Comments

Nicolin Chen Sept. 19, 2019, 11:48 p.m. UTC | #1
On Thu, Sep 19, 2019 at 08:11:40PM +0800, Shengjiu Wang wrote:
> The ASRC support 24bit/16bit/8bit input width, which is

> data width, not slot width.

> 

> For the S20_3LE format, the data with is 20bit, slot width

> is 24bit, if we set ASRMCR1n.IWD to be 24bits, the result

> is the volume is lower than expected, it likes 24bit data

> right shift 4 bits

> 

> So replace S20_3LE with S24_3LE in supported list and add S8

> format in TX supported list

> 

> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>


Acked-by: Nicolin Chen <nicoleotsuka@gmail.com>


> ---

>  sound/soc/fsl/fsl_asrc.c | 5 +++--

>  1 file changed, 3 insertions(+), 2 deletions(-)

> 

> diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c

> index 4d3804a1ea55..584badf956d2 100644

> --- a/sound/soc/fsl/fsl_asrc.c

> +++ b/sound/soc/fsl/fsl_asrc.c

> @@ -624,7 +624,7 @@ static int fsl_asrc_dai_probe(struct snd_soc_dai *dai)

>  

>  #define FSL_ASRC_FORMATS	(SNDRV_PCM_FMTBIT_S24_LE | \

>  				 SNDRV_PCM_FMTBIT_S16_LE | \

> -				 SNDRV_PCM_FMTBIT_S20_3LE)

> +				 SNDRV_PCM_FMTBIT_S24_3LE)

>  

>  static struct snd_soc_dai_driver fsl_asrc_dai = {

>  	.probe = fsl_asrc_dai_probe,

> @@ -635,7 +635,8 @@ static struct snd_soc_dai_driver fsl_asrc_dai = {

>  		.rate_min = 5512,

>  		.rate_max = 192000,

>  		.rates = SNDRV_PCM_RATE_KNOT,

> -		.formats = FSL_ASRC_FORMATS,

> +		.formats = FSL_ASRC_FORMATS |

> +			   SNDRV_PCM_FMTBIT_S8,

>  	},

>  	.capture = {

>  		.stream_name = "ASRC-Capture",

> -- 

> 2.21.0

>
Nicolin Chen Sept. 20, 2019, 10:50 p.m. UTC | #2
On Thu, Sep 19, 2019 at 08:11:41PM +0800, Shengjiu Wang wrote:
> When set the runtime hardware parameters, we may need to query

> the capability of DMA to complete the parameters.

> 

> This patch is to Extract this operation from

> dmaengine_pcm_set_runtime_hwparams function to a separate function

> snd_dmaengine_pcm_refine_runtime_hwparams, that other components

> which need this feature can call this function.

> 

> Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>


> @@ -145,58 +140,15 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea


> +	ret = snd_dmaengine_pcm_refine_runtime_hwparams(substream,

> +							dma_data,

> +							&hw,

> +							chan);

> +	if (ret)

> +		return ret;

>  

>  	return snd_soc_set_runtime_hwparams(substream, &hw);

> +

> }


Just a nit, why add a line here? :)

The rest looks good to me, not sure whether the name "refine"
would be the best one though, would like to wait for opinions
from others.

Thanks