Re: [PATCH 1/8] ASoC pxa2xx DMA support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At Tue, 10 Oct 2006 17:11:42 +0100,
Liam Girdwood wrote:
> 
> +static int
> +pxa2xx_pcm_hw_rule_mult32(struct snd_pcm_hw_params *params,
> +	struct snd_pcm_hw_rule *rule)
> +{
> +	struct snd_interval *i = hw_param_interval(params, rule->var);
> +	int changed = 0;
> +
> +	if (i->min & 31) {
> +		i->min = (i->min & ~31) + 32;
> +		i->openmin = 0;
> +		changed = 1;
> +	}
> +
> +	if (i->max & 31) {
> +		i->max &= ~31;
> +		i->openmax = 0;
> +		changed = 1;
> +	}
> +
> +	return changed;
> +}
> +
> +static int pxa2xx_pcm_open(struct snd_pcm_substream *substream)
> +{
> +	struct snd_pcm_runtime *runtime = substream->runtime;
> +	struct pxa2xx_runtime_data *prtd;
> +	int ret;
> +
> +	snd_soc_set_runtime_hwparams(substream, &pxa2xx_pcm_hardware);
> +
> +	/*
> +	 * For mysterious reasons (and despite what the manual says)
> +	 * playback samples are lost if the DMA count is not a multiple
> +	 * of the DMA burst size.  Let's add a rule to enforce that.
> +	 */
> +	ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES,
> +				  pxa2xx_pcm_hw_rule_mult32, NULL,
> +				  SNDRV_PCM_HW_PARAM_PERIOD_BYTES, -1);

How about to use snd_pcm_hw_constraint_step()?


> +	if (ret)
> +		goto out;
> +
> +	ret = snd_pcm_hw_rule_add(runtime, 0, SNDRV_PCM_HW_PARAM_BUFFER_BYTES,
> +				  pxa2xx_pcm_hw_rule_mult32, NULL,
> +				  SNDRV_PCM_HW_PARAM_BUFFER_BYTES, -1);
> +	if (ret)
> +		goto out;
> +
> +	prtd = kzalloc(sizeof(struct pxa2xx_runtime_data), GFP_KERNEL);
> +	if (prtd == NULL) {
> +		ret = -ENOMEM;
> +		goto out;
> +	}
> +
> +	prtd->dma_desc_array =
> +		dma_alloc_writecombine(substream->pcm->card->dev, PAGE_SIZE,
> +				       &prtd->dma_desc_array_phys, GFP_KERNEL);
> +	if (!prtd->dma_desc_array)
> +		goto err1;

You have to set "ret = -EXXX" here.

> +static u64 pxa2xx_pcm_dmamask = 0xffffffff;

Use DMA_32BIT_MASK.

> +
> +int pxa2xx_pcm_new(struct snd_card *card, struct snd_soc_codec_dai *dai,
> +	struct snd_pcm *pcm)
> +{
> +	int ret = 0;
> +
> +	if (!card->dev->dma_mask)
> +		card->dev->dma_mask = &pxa2xx_pcm_dmamask;
> +	if (!card->dev->coherent_dma_mask)
> +		card->dev->coherent_dma_mask = 0xffffffff;

Ditto.


Takashi

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/alsa-devel

[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux