From: Daniel Mack <daniel-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>
To: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>
Cc: Takashi Iwai <tiwai-l3A5Bk7waGM@public.gmane.org>,
Sebastian Reimers
<sebastian.reimers-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org>,
alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Sebastian Reimers
<sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: Re: [alsa-devel] [PATCH 1/1] usb: gadget: f_uac2: Fix pcm sample size selection
Date: Tue, 22 Jul 2014 19:09:51 +0200 [thread overview]
Message-ID: <53CE9ADF.80604@zonque.org> (raw)
In-Reply-To: <s5hha2xu19g.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
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
next prev parent reply other threads:[~2014-07-22 17:09 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
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 ` Daniel Mack [this message]
[not found] ` <53CE9ADF.80604-cYrQPVfZoowdnm+yROfE0A@public.gmane.org>
2014-07-22 17:44 ` [alsa-devel] " Felipe Balbi
[not found] ` <20140722174448.GL20588-HgARHv6XitL9zxVx7UNMDg@public.gmane.org>
2014-07-22 18:02 ` Daniel Mack
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=53CE9ADF.80604@zonque.org \
--to=daniel-cyrqpvfzoowdnm+yrofe0a@public.gmane.org \
--cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sebastian.reimers-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=sebastian.reimers-gM/Ye1E23mwN+BqQ9rBEUg@public.gmane.org \
--cc=tiwai-l3A5Bk7waGM@public.gmane.org \
/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.