Skip to content

Commit d04e0d9

Browse files
Meng Dongyangrkhuangtao
authored andcommitted
usb: gadget: uac: support 2 channel of audio source
This patch add support of 2 channel of uac, set min channel number and max channel number to 2. Change-Id: Ia3b45d3329ba6819339079b31ff42398464942b5 Signed-off-by: Meng Dongyang <daniel.meng@rock-chips.com>
1 parent a13b6c3 commit d04e0d9

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

drivers/usb/gadget/function/f_audio_source.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,8 @@ static struct snd_pcm_hardware audio_hw_info = {
262262
SNDRV_PCM_INFO_BLOCK_TRANSFER,
263263

264264
.formats = SNDRV_PCM_FMTBIT_S16_LE,
265-
.channels_min = 1,
266-
.channels_max = 1,
265+
.channels_min = 2,
266+
.channels_max = 2,
267267
.rate_min = MIN_SAMPLE_RATE,
268268
.rate_max = MAX_SAMPLE_RATE,
269269

@@ -930,8 +930,8 @@ static void audio_build_desc(struct audio_dev *audio)
930930
u32 rate, i;
931931

932932
/* Set channel numbers */
933-
input_terminal_desc.bNrChannels = 1;
934-
as_type_i_desc.bNrChannels = 1;
933+
input_terminal_desc.bNrChannels = 2;
934+
as_type_i_desc.bNrChannels = 2;
935935

936936
/* Set sample rates */
937937
for (i = 0; i < ARRAY_SIZE(sample_rate_table); i++) {
@@ -1088,7 +1088,7 @@ static int audio_pcm_open(struct snd_pcm_substream *substream)
10881088
runtime->private_data = audio;
10891089
runtime->hw = audio_hw_info;
10901090
snd_pcm_limit_hw_rates(runtime);
1091-
runtime->hw.channels_max = 1;
1091+
runtime->hw.channels_max = 2;
10921092

10931093
audio->substream = substream;
10941094

@@ -1122,7 +1122,7 @@ static int audio_pcm_hw_params(struct snd_pcm_substream *substream,
11221122

11231123
if (rate > MAX_SAMPLE_RATE || rate < MIN_SAMPLE_RATE)
11241124
return -EINVAL;
1125-
if (channels != 1)
1125+
if (channels != 2)
11261126
return -EINVAL;
11271127

11281128
return snd_pcm_lib_alloc_vmalloc_buffer(substream,

0 commit comments

Comments
 (0)