diff options
author | Sebastian Reimers <sebastian.reimers@googlemail.com> | 2014-07-03 20:15:28 +0200 |
---|---|---|
committer | Felipe Balbi <balbi@ti.com> | 2014-07-16 12:50:40 -0500 |
commit | 55f7840ac4c6224263d88014b69f8cd35fa66817 (patch) | |
tree | 5999cdb78ed8853c5395d46a368bbab40e4e650e /drivers/usb/gadget | |
parent | c9d872592611b98d3481e978f93b90a5fa194252 (diff) | |
download | linux-55f7840ac4c6224263d88014b69f8cd35fa66817.tar.gz linux-55f7840ac4c6224263d88014b69f8cd35fa66817.tar.bz2 linux-55f7840ac4c6224263d88014b69f8cd35fa66817.zip |
usb: gadget: f_uac2: Fix pcm sample size selection
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.
Reviewed-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sebastian Reimers <sebastian.reimers@gmail.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r-- | drivers/usb/gadget/function/f_uac2.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/drivers/usb/gadget/function/f_uac2.c b/drivers/usb/gadget/function/f_uac2.c index 6261db4a9910..3ed89ecc8d6d 100644 --- a/drivers/usb/gadget/function/f_uac2.c +++ b/drivers/usb/gadget/function/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; |