All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org, vinod.koul@intel.com,
	nsekhar@ti.com, Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org,
	Peter Ujfalusi <peter.ujfalusi@ti.com>,
	joelf@ti.com, Mark Brown <broonie@kernel.org>,
	dmaengine@vger.kernel.org, dan.j.williams@intel.com
Subject: Re: [PATCH v2 3/5] ASoC: generic-dmaengine-pcm: Prepare formats mask for valid physical sample sizes
Date: Wed, 02 Jul 2014 16:13:59 +0200	[thread overview]
Message-ID: <53B413A7.6070301@metafoo.de> (raw)
In-Reply-To: <s5h38ej6e8y.wl%tiwai@suse.de>

On 07/02/2014 04:12 PM, Takashi Iwai wrote:
> At Wed, 02 Jul 2014 16:10:09 +0200,
> Lars-Peter Clausen wrote:
>>
>> On 07/02/2014 03:47 PM, Takashi Iwai wrote:
>> [...]
>>>> +	/*
>>>> +	 * Prepare formats mask for valid/allowed sample types. If the dma does
>>>> +	 * not have support for the given physical word size, it needs to be
>>>> +	 * masked out so user space can not use the format which produces
>>>> +	 * corrupted audio.
>>>> +	 * In case the dma driver does not implement the slave_caps the default
>>>> +	 * assumption is that it supports 1, 2 and 4 bytes widths.
>>>> +	 */
>>>> +	for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
>>>> +		int bits = snd_pcm_format_physical_width(i);
>>>
>>> Better to add a negative value check.  Some formats return -EINVAL.
>>>
>>
>> So what should we do with those formats? Not support them?
>
> Yes, these are special formats that can't be handled generically.
>

Looking through the list in pcm_misc.c there are also some formats where the 
physical width is not a multiple of 8. We should probably also skip those.

- Lars

WARNING: multiple messages have this Message-ID (diff)
From: Lars-Peter Clausen <lars@metafoo.de>
To: Takashi Iwai <tiwai@suse.de>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>,
	alsa-devel@alsa-project.org, vinod.koul@intel.com,
	nsekhar@ti.com, Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, joelf@ti.com,
	Mark Brown <broonie@kernel.org>,
	dmaengine@vger.kernel.org, dan.j.williams@intel.com
Subject: Re: [alsa-devel] [PATCH v2 3/5] ASoC: generic-dmaengine-pcm: Prepare formats mask for valid physical sample sizes
Date: Wed, 02 Jul 2014 16:13:59 +0200	[thread overview]
Message-ID: <53B413A7.6070301@metafoo.de> (raw)
In-Reply-To: <s5h38ej6e8y.wl%tiwai@suse.de>

On 07/02/2014 04:12 PM, Takashi Iwai wrote:
> At Wed, 02 Jul 2014 16:10:09 +0200,
> Lars-Peter Clausen wrote:
>>
>> On 07/02/2014 03:47 PM, Takashi Iwai wrote:
>> [...]
>>>> +	/*
>>>> +	 * Prepare formats mask for valid/allowed sample types. If the dma does
>>>> +	 * not have support for the given physical word size, it needs to be
>>>> +	 * masked out so user space can not use the format which produces
>>>> +	 * corrupted audio.
>>>> +	 * In case the dma driver does not implement the slave_caps the default
>>>> +	 * assumption is that it supports 1, 2 and 4 bytes widths.
>>>> +	 */
>>>> +	for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) {
>>>> +		int bits = snd_pcm_format_physical_width(i);
>>>
>>> Better to add a negative value check.  Some formats return -EINVAL.
>>>
>>
>> So what should we do with those formats? Not support them?
>
> Yes, these are special formats that can't be handled generically.
>

Looking through the list in pcm_misc.c there are also some formats where the 
physical width is not a multiple of 8. We should probably also skip those.

- Lars


  reply	other threads:[~2014-07-02 14:14 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-02 13:29 [PATCH v2 0/5] ALSA/ASoC/dmaengine: Fix 3 bytes physical sample support Peter Ujfalusi
2014-07-02 13:29 ` Peter Ujfalusi
2014-07-02 13:29 ` [PATCH v2 1/5] dma: Support for 3 bytes word size Peter Ujfalusi
2014-07-02 13:29   ` Peter Ujfalusi
2014-07-02 13:29 ` [PATCH v2 2/5] ALSA: pcm_dmaengine: Use the available wrapper to get physical width Peter Ujfalusi
2014-07-02 13:29   ` Peter Ujfalusi
2014-07-02 13:29 ` [PATCH v2 3/5] ASoC: generic-dmaengine-pcm: Prepare formats mask for valid physical sample sizes Peter Ujfalusi
2014-07-02 13:29   ` Peter Ujfalusi
2014-07-02 13:47   ` Takashi Iwai
2014-07-02 13:47     ` Takashi Iwai
2014-07-02 14:10     ` [alsa-devel] " Lars-Peter Clausen
2014-07-02 14:12       ` Takashi Iwai
2014-07-02 14:13         ` Lars-Peter Clausen [this message]
2014-07-02 14:13           ` Lars-Peter Clausen
2014-07-02 14:24           ` Takashi Iwai
2014-07-02 13:29 ` [PATCH v2 4/5] ALSA: pcm_dmaengine: Correct support for 24bits physical sample widths Peter Ujfalusi
2014-07-02 13:29   ` Peter Ujfalusi
2014-07-02 13:29 ` [PATCH v2 5/5] dma: edma: Declare DMA_SLAVE_BUSWIDTH_3_BYTES as supported buswidth Peter Ujfalusi
2014-07-02 13:29   ` Peter Ujfalusi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53B413A7.6070301@metafoo.de \
    --to=lars@metafoo.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=dan.j.williams@intel.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=joelf@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nsekhar@ti.com \
    --cc=peter.ujfalusi@ti.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.