Re: [PATCH] ASoC: omap-pcm: Allow only formats with 1, 2, and 4 byte physical size

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

 



On 03/03/2015 02:22 PM, Jarkko Nikula wrote:
> On Tue, Mar 03, 2015 at 01:41:21PM +0200, Peter Ujfalusi wrote:
>> On 03/03/2015 01:28 PM, Jyri Sarha wrote:
>>> sDMA support only transfer elements with 1, 2, and 4 byte physical
>>> size. Initialize the pcm driver accordingly.
>>
>> Acked-by: Peter Ujfalusi <peter.ujfalusi@xxxxxx>
>>
>>>
>>> Signed-off-by: Jyri Sarha <jsarha@xxxxxx>
>>> ---
>>>  sound/soc/omap/omap-pcm.c | 21 ++++++++++++++++++++-
>>>  1 file changed, 20 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
>>> index f4b05bc..e49ee23 100644
>>> --- a/sound/soc/omap/omap-pcm.c
>>> +++ b/sound/soc/omap/omap-pcm.c
>>> @@ -39,7 +39,7 @@
>>>  #define pcm_omap1510()	0
>>>  #endif
>>>  
>>> -static const struct snd_pcm_hardware omap_pcm_hardware = {
>>> +static struct snd_pcm_hardware omap_pcm_hardware = {
>>>  	.info			= SNDRV_PCM_INFO_MMAP |
>>>  				  SNDRV_PCM_INFO_MMAP_VALID |
>>>  				  SNDRV_PCM_INFO_INTERLEAVED |
>>> @@ -53,6 +53,24 @@ static const struct snd_pcm_hardware omap_pcm_hardware = {
>>>  	.buffer_bytes_max	= 128 * 1024,
>>>  };
>>>  
>>> +/* sDMA supports only 1, 2, and 4 byte transfer elements. */
>>> +static void omap_pcm_limit_supported_formats(void)
>>> +{
>>> +	int i;
>>> +
>>> +	for (i = 0; i < SNDRV_PCM_FORMAT_LAST; i++) {
>>> +		switch (snd_pcm_format_physical_width(i)) {
>>> +		case 8:
>>> +		case 16:
>>> +		case 32:
>>> +			omap_pcm_hardware.formats |= (1LL << i);
>>> +			break;
>>> +		default:
>>> +			break;
>>> +		}
>>> +	}
>>> +}
>>> +
> 
> I wonder why these are set in a loop instead of setting formats statically

omap-pcm as such can work with any formats which has 1, 2 or 4 bytes layout in
memory (and not only S16_LE, S32_LE).
sDMA can not handle 3byte words so we can not handle those with omap-pcm. In
contrast eDMA for example can handle 1, 2, 3 and 4 w/o issue.

> and why this is needed after commit 60e21d287344 ("ASoC: omap: Don't set
> unused struct snd_pcm_hardware fields")?

Hrm, interesting. We also have:
2d38df128321 (ASoC: generic-dmaengine-pcm: Prepare formats mask for valid
physical sample sizes)

Which does the same thing for the generic dmaengine pcm users.

Actually the information from the omap_pcm_hardware is copied to runtime.hw
via snd_soc_set_runtime_hwparams() call, so it is not ignored.

We need this masking to be done here since the omap-pcm is still mostly custom
code and do not plug easily to the generic code (ie, not at all).

-- 
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux