All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] usb: gadget: f_uac2: Fix pcm sample size selection
@ 2014-07-03 18:15 Sebastian Reimers
       [not found] ` <1404411328-32566-1-git-send-email-sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Sebastian Reimers @ 2014-07-03 18:15 UTC (permalink / raw)
  To: Felipe Balbi, Takashi Iwai, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Daniel Mack
  Cc: Sebastian Reimers

The pcm playback and capture sample size format was fixed
SNDRV_PCM_FMTBIT_S16_LE.

This patch respects also 16, 24 and 32 bit p_ssize and c_ssize values.

Signed-off-by: Sebastian Reimers <sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/usb/gadget/f_uac2.c | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/f_uac2.c b/drivers/usb/gadget/f_uac2.c
index 6261db4a..3ed89ec 100644
--- a/drivers/usb/gadget/f_uac2.c
+++ b/drivers/usb/gadget/f_uac2.c
@@ -348,14 +348,34 @@ static int uac2_pcm_open(struct snd_pcm_substream *substream)
 	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
 		spin_lock_init(&uac2->p_prm.lock);
 		runtime->hw.rate_min = p_srate;
-		runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; /* ! p_ssize ! */
+		switch (p_ssize) {
+		case 3:
+			runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_3LE;
+			break;
+		case 4:
+			runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE;
+			break;
+		default:
+			runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+			break;
+		}
 		runtime->hw.channels_min = num_channels(p_chmask);
 		runtime->hw.period_bytes_min = 2 * uac2->p_prm.max_psize
 						/ runtime->hw.periods_min;
 	} else {
 		spin_lock_init(&uac2->c_prm.lock);
 		runtime->hw.rate_min = c_srate;
-		runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; /* ! c_ssize ! */
+		switch (c_ssize) {
+		case 3:
+			runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_3LE;
+			break;
+		case 4:
+			runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE;
+			break;
+		default:
+			runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
+			break;
+		}
 		runtime->hw.channels_min = num_channels(c_chmask);
 		runtime->hw.period_bytes_min = 2 * uac2->c_prm.max_psize
 						/ runtime->hw.periods_min;
-- 
2.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/1] usb: gadget: f_uac2: Fix pcm sample size selection
       [not found] ` <1404411328-32566-1-git-send-email-sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2014-07-04  5:43   ` Takashi Iwai
       [not found]     ` <s5hha2xu19g.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2014-07-04  5:43 UTC (permalink / raw)
  To: Sebastian Reimers
  Cc: Felipe Balbi, alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Daniel Mack, Sebastian Reimers

At Thu,  3 Jul 2014 20:15:28 +0200,
Sebastian Reimers wrote:
> 
> The pcm playback and capture sample size format was fixed
> SNDRV_PCM_FMTBIT_S16_LE.
> 
> This patch respects also 16, 24 and 32 bit p_ssize and c_ssize values.
> 
> Signed-off-by: Sebastian Reimers <sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>

In general, this driver should check more on p_ssize.  This can be any
integer value passed as a module parameter.  It should be cut to a
sane value or give an error in the probe function when an invalid
value is given.  Ditto for p_srate and other parameters.

Also, I don't understand the logic of the code
	runtime->hw.period_bytes_min = 2 * uac2->p_prm.max_psize
					/ runtime->hw.periods_min;

But this is mostly irrelevant with this patch, so for this patch:
   Reviewed-by: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>


thanks,

Takashi


> ---
>  drivers/usb/gadget/f_uac2.c | 24 ++++++++++++++++++++++--
>  1 file changed, 22 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/f_uac2.c b/drivers/usb/gadget/f_uac2.c
> index 6261db4a..3ed89ec 100644
> --- a/drivers/usb/gadget/f_uac2.c
> +++ b/drivers/usb/gadget/f_uac2.c
> @@ -348,14 +348,34 @@ static int uac2_pcm_open(struct snd_pcm_substream *substream)
>  	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
>  		spin_lock_init(&uac2->p_prm.lock);
>  		runtime->hw.rate_min = p_srate;
> -		runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; /* ! p_ssize ! */
> +		switch (p_ssize) {
> +		case 3:
> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_3LE;
> +			break;
> +		case 4:
> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE;
> +			break;
> +		default:
> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
> +			break;
> +		}
>  		runtime->hw.channels_min = num_channels(p_chmask);
>  		runtime->hw.period_bytes_min = 2 * uac2->p_prm.max_psize
>  						/ runtime->hw.periods_min;
>  	} else {
>  		spin_lock_init(&uac2->c_prm.lock);
>  		runtime->hw.rate_min = c_srate;
> -		runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; /* ! c_ssize ! */
> +		switch (c_ssize) {
> +		case 3:
> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_3LE;
> +			break;
> +		case 4:
> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE;
> +			break;
> +		default:
> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
> +			break;
> +		}
>  		runtime->hw.channels_min = num_channels(c_chmask);
>  		runtime->hw.period_bytes_min = 2 * uac2->c_prm.max_psize
>  						/ runtime->hw.periods_min;
> -- 
> 2.0.1
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] [PATCH 1/1] usb: gadget: f_uac2: Fix pcm sample size selection
       [not found]     ` <s5hha2xu19g.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
@ 2014-07-22 17:09       ` Daniel Mack
       [not found]         ` <53CE9ADF.80604-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Daniel Mack @ 2014-07-22 17:09 UTC (permalink / raw)
  To: Felipe Balbi
  Cc: Takashi Iwai, Sebastian Reimers,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Sebastian Reimers

On 07/04/2014 07:43 AM, Takashi Iwai wrote:
> At Thu,  3 Jul 2014 20:15:28 +0200,
> Sebastian Reimers wrote:
>>
>> The pcm playback and capture sample size format was fixed
>> SNDRV_PCM_FMTBIT_S16_LE.
>>
>> This patch respects also 16, 24 and 32 bit p_ssize and c_ssize values.
>>
>> Signed-off-by: Sebastian Reimers <sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> 
> In general, this driver should check more on p_ssize.  This can be any
> integer value passed as a module parameter.  It should be cut to a
> sane value or give an error in the probe function when an invalid
> value is given.  Ditto for p_srate and other parameters.
> 
> Also, I don't understand the logic of the code
> 	runtime->hw.period_bytes_min = 2 * uac2->p_prm.max_psize
> 					/ runtime->hw.periods_min;
> 
> But this is mostly irrelevant with this patch, so for this patch:
>    Reviewed-by: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>

Felipe, are you fine with this one?


Thanks,
Daniel

>> ---
>>  drivers/usb/gadget/f_uac2.c | 24 ++++++++++++++++++++++--
>>  1 file changed, 22 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/usb/gadget/f_uac2.c b/drivers/usb/gadget/f_uac2.c
>> index 6261db4a..3ed89ec 100644
>> --- a/drivers/usb/gadget/f_uac2.c
>> +++ b/drivers/usb/gadget/f_uac2.c
>> @@ -348,14 +348,34 @@ static int uac2_pcm_open(struct snd_pcm_substream *substream)
>>  	if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
>>  		spin_lock_init(&uac2->p_prm.lock);
>>  		runtime->hw.rate_min = p_srate;
>> -		runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; /* ! p_ssize ! */
>> +		switch (p_ssize) {
>> +		case 3:
>> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_3LE;
>> +			break;
>> +		case 4:
>> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE;
>> +			break;
>> +		default:
>> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
>> +			break;
>> +		}
>>  		runtime->hw.channels_min = num_channels(p_chmask);
>>  		runtime->hw.period_bytes_min = 2 * uac2->p_prm.max_psize
>>  						/ runtime->hw.periods_min;
>>  	} else {
>>  		spin_lock_init(&uac2->c_prm.lock);
>>  		runtime->hw.rate_min = c_srate;
>> -		runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE; /* ! c_ssize ! */
>> +		switch (c_ssize) {
>> +		case 3:
>> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S24_3LE;
>> +			break;
>> +		case 4:
>> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S32_LE;
>> +			break;
>> +		default:
>> +			runtime->hw.formats = SNDRV_PCM_FMTBIT_S16_LE;
>> +			break;
>> +		}
>>  		runtime->hw.channels_min = num_channels(c_chmask);
>>  		runtime->hw.period_bytes_min = 2 * uac2->c_prm.max_psize
>>  						/ runtime->hw.periods_min;
>> -- 
>> 2.0.1
>>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] [PATCH 1/1] usb: gadget: f_uac2: Fix pcm sample size selection
       [not found]         ` <53CE9ADF.80604-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>
@ 2014-07-22 17:44           ` Felipe Balbi
       [not found]             ` <20140722174448.GL20588-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Felipe Balbi @ 2014-07-22 17:44 UTC (permalink / raw)
  To: Daniel Mack
  Cc: Felipe Balbi, Takashi Iwai, Sebastian Reimers,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Sebastian Reimers

[-- Attachment #1: Type: text/plain, Size: 1216 bytes --]

On Tue, Jul 22, 2014 at 07:09:51PM +0200, Daniel Mack wrote:
> On 07/04/2014 07:43 AM, Takashi Iwai wrote:
> > At Thu,  3 Jul 2014 20:15:28 +0200,
> > Sebastian Reimers wrote:
> >>
> >> The pcm playback and capture sample size format was fixed
> >> SNDRV_PCM_FMTBIT_S16_LE.
> >>
> >> This patch respects also 16, 24 and 32 bit p_ssize and c_ssize values.
> >>
> >> Signed-off-by: Sebastian Reimers <sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
> > 
> > In general, this driver should check more on p_ssize.  This can be any
> > integer value passed as a module parameter.  It should be cut to a
> > sane value or give an error in the probe function when an invalid
> > value is given.  Ditto for p_srate and other parameters.
> > 
> > Also, I don't understand the logic of the code
> > 	runtime->hw.period_bytes_min = 2 * uac2->p_prm.max_psize
> > 					/ runtime->hw.periods_min;
> > 
> > But this is mostly irrelevant with this patch, so for this patch:
> >    Reviewed-by: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>
> 
> Felipe, are you fine with this one?

seems like I missed this one, do you mind if we take it during v3.17-rc
and add Cc: stable ?

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [alsa-devel] [PATCH 1/1] usb: gadget: f_uac2: Fix pcm sample size selection
       [not found]             ` <20140722174448.GL20588-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
@ 2014-07-22 18:02               ` Daniel Mack
  0 siblings, 0 replies; 5+ messages in thread
From: Daniel Mack @ 2014-07-22 18:02 UTC (permalink / raw)
  To: balbi-l0cyMroinI0
  Cc: Takashi Iwai, Sebastian Reimers,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw,
	linux-usb-u79uwXL29TY76Z2rM5mHXA, Sebastian Reimers

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/22/2014 07:44 PM, Felipe Balbi wrote:
> On Tue, Jul 22, 2014 at 07:09:51PM +0200, Daniel Mack wrote:
>> On 07/04/2014 07:43 AM, Takashi Iwai wrote:
>>> At Thu,  3 Jul 2014 20:15:28 +0200, Sebastian Reimers wrote:
>>>> 
>>>> The pcm playback and capture sample size format was fixed 
>>>> SNDRV_PCM_FMTBIT_S16_LE.
>>>> 
>>>> This patch respects also 16, 24 and 32 bit p_ssize and
>>>> c_ssize values.
>>>> 
>>>> Signed-off-by: Sebastian Reimers
>>>> <sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
>>> 
>>> In general, this driver should check more on p_ssize.  This can
>>> be any integer value passed as a module parameter.  It should
>>> be cut to a sane value or give an error in the probe function
>>> when an invalid value is given.  Ditto for p_srate and other
>>> parameters.
>>> 
>>> Also, I don't understand the logic of the code 
>>> runtime->hw.period_bytes_min = 2 * uac2->p_prm.max_psize /
>>> runtime->hw.periods_min;
>>> 
>>> But this is mostly irrelevant with this patch, so for this
>>> patch: Reviewed-by: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>
>> 
>> Felipe, are you fine with this one?
> 
> seems like I missed this one, do you mind if we take it during
> v3.17-rc and add Cc: stable ?

I guess that was what Sebastian intended :)

Thanks for taking care of it!


Daniel

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBAgAGBQJTzqckAAoJELphMRr8Y1QkzXYP/iWtHkczgDurT5s/6JNGJSv1
UsVTueRVepMLfVVFRW0mMiHHVfZVD/JoLMTAl0LkODBf95Vxgd0OR9WmHm1FVYdW
oJ80LTCkGEEjeZlZTcHJFIqfgwB6ryUsPoC+BAWvWpVSjvp2uHME8JmipYiNrwLS
fJNJSwL4lT5PFESQ27seonkDneAUk8FQObZCSOnqJsqqZpAWHmRQOPTQSyRsJ/fA
wOj/jo9gWJXqMtow2mfDteM/doiblBJaquKoQDIlj1UuEv4Ta97a1f/0N/O0q8kP
+4VqynEgCOhr8TNR8x7a6YTlzYQkonddFUGZuuJLLf5//Z5SA1zGdBl+bnZ3OPVV
7oVJZPakVaG/1ImkkPh+yUmPg6jRjaEbW6f2Y9p1t2iitnEGsi/doQpBS7xEf3+n
kHehgcKBUXCGzrJ25vxu9Q1/wUQXDXqsb3Q+PorcbhSF86OOe9pll9GvGjJbc7VY
zEitPPPKMmmLVUgyfFcsyz94NkZeAYMOCPZIBIZXtshoQGMvujUKB/qRbK5tO7x3
Y7cUnb5rSlfSuNCuRz4kKGIVK+ULr8XtdT6sSzm5kmNnqwYlxh2zt4XEPflIiRg9
4Z0MMHW4mRN0rUikfJofjsHObx/B6BvbFj7EBhyFipRZZW32b5jEn7kL5pOQRq1K
pANkTdVOnKGmgJ1VI6x8
=3cTI
-----END PGP SIGNATURE-----
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-07-22 18:02 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-03 18:15 [PATCH 1/1] usb: gadget: f_uac2: Fix pcm sample size selection Sebastian Reimers
     [not found] ` <1404411328-32566-1-git-send-email-sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-07-04  5:43   ` Takashi Iwai
     [not found]     ` <s5hha2xu19g.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2014-07-22 17:09       ` [alsa-devel] " Daniel Mack
     [not found]         ` <53CE9ADF.80604-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>
2014-07-22 17:44           ` Felipe Balbi
     [not found]             ` <20140722174448.GL20588-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-07-22 18:02               ` Daniel Mack

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.