Skip to content

Commit 5ce9410

Browse files
committed
Merge tag 'sound-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "A bit more changes than wished, but still manageable amount. Most of commits are HD-audio specific device fixes / quirks, while there is a revert for the previous fix due to regressions and a double-free fix in ALSA core code" * tag 'sound-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: Revert "ALSA: usb-audio: Split endpoint setups for hw_params and prepare" ALSA: core: Fix double-free at snd_card_new() ALSA: hda/realtek: Add a quirk for HP OMEN 16 (8902) mute LED ALSA: hda/hdmi: Fix the converter reuse for the silent stream ALSA: hda/realtek: Add quirk for ASUS GA503R laptop ALSA: hda/realtek: Add pincfg for ASUS G533Z HP jack ALSA: hda/realtek: Add pincfg for ASUS G513 HP jack ALSA: hda/realtek: Re-arrange quirk table entries ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5530 laptop ALSA: hda/realtek: Enable 4-speaker output Dell Precision 5570 laptop ALSA: hda: Fix Nvidia dp infoframe ALSA: hda/realtek: Add quirk for Huawei WRT-WX9 ALSA: hda/tegra: set depop delay for tegra ALSA: hda: add Intel 5 Series / 3400 PCI DID ALSA: hda: Fix hang at HD-audio codec unbinding due to refcount saturation
2 parents 48062bb + 79764ec commit 5ce9410

File tree

8 files changed

+80
-37
lines changed

8 files changed

+80
-37
lines changed

sound/core/init.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,8 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
178178
return -ENOMEM;
179179

180180
err = snd_card_init(card, parent, idx, xid, module, extra_size);
181-
if (err < 0) {
182-
kfree(card);
183-
return err;
184-
}
181+
if (err < 0)
182+
return err; /* card is freed by error handler */
185183

186184
*card_ret = card;
187185
return 0;
@@ -233,7 +231,7 @@ int snd_devm_card_new(struct device *parent, int idx, const char *xid,
233231
card->managed = true;
234232
err = snd_card_init(card, parent, idx, xid, module, extra_size);
235233
if (err < 0) {
236-
devres_free(card);
234+
devres_free(card); /* in managed mode, we need to free manually */
237235
return err;
238236
}
239237

@@ -297,6 +295,8 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
297295
mutex_unlock(&snd_card_mutex);
298296
dev_err(parent, "cannot find the slot for index %d (range 0-%i), error: %d\n",
299297
idx, snd_ecards_limit - 1, err);
298+
if (!card->managed)
299+
kfree(card); /* manually free here, as no destructor called */
300300
return err;
301301
}
302302
set_bit(idx, snd_cards_lock); /* lock it */

sound/pci/hda/hda_bind.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,10 @@ static int hda_codec_driver_remove(struct device *dev)
157157
return codec->bus->core.ext_ops->hdev_detach(&codec->core);
158158
}
159159

160-
refcount_dec(&codec->pcm_ref);
161160
snd_hda_codec_disconnect_pcms(codec);
162161
snd_hda_jack_tbl_disconnect(codec);
163-
wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
162+
if (!refcount_dec_and_test(&codec->pcm_ref))
163+
wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
164164
snd_power_sync_ref(codec->bus->card);
165165

166166
if (codec->patch_ops.free)

sound/pci/hda/hda_intel.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2550,6 +2550,8 @@ static const struct pci_device_id azx_ids[] = {
25502550
/* 5 Series/3400 */
25512551
{ PCI_DEVICE(0x8086, 0x3b56),
25522552
.driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
2553+
{ PCI_DEVICE(0x8086, 0x3b57),
2554+
.driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
25532555
/* Poulsbo */
25542556
{ PCI_DEVICE(0x8086, 0x811b),
25552557
.driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE },

sound/pci/hda/patch_hdmi.c

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ struct hdmi_spec {
170170
bool dyn_pcm_no_legacy;
171171
/* hdmi interrupt trigger control flag for Nvidia codec */
172172
bool hdmi_intr_trig_ctrl;
173+
bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */
174+
173175
bool intel_hsw_fixup; /* apply Intel platform-specific fixups */
174176
/*
175177
* Non-generic VIA/NVIDIA specific
@@ -679,15 +681,24 @@ static void hdmi_pin_setup_infoframe(struct hda_codec *codec,
679681
int ca, int active_channels,
680682
int conn_type)
681683
{
684+
struct hdmi_spec *spec = codec->spec;
682685
union audio_infoframe ai;
683686

684687
memset(&ai, 0, sizeof(ai));
685-
if (conn_type == 0) { /* HDMI */
688+
if ((conn_type == 0) || /* HDMI */
689+
/* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */
690+
(conn_type == 1 && spec->nv_dp_workaround)) {
686691
struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi;
687692

688-
hdmi_ai->type = 0x84;
689-
hdmi_ai->ver = 0x01;
690-
hdmi_ai->len = 0x0a;
693+
if (conn_type == 0) { /* HDMI */
694+
hdmi_ai->type = 0x84;
695+
hdmi_ai->ver = 0x01;
696+
hdmi_ai->len = 0x0a;
697+
} else {/* Nvidia DP */
698+
hdmi_ai->type = 0x84;
699+
hdmi_ai->ver = 0x1b;
700+
hdmi_ai->len = 0x11 << 2;
701+
}
691702
hdmi_ai->CC02_CT47 = active_channels - 1;
692703
hdmi_ai->CA = ca;
693704
hdmi_checksum_audio_infoframe(hdmi_ai);
@@ -1267,6 +1278,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
12671278
set_bit(pcm_idx, &spec->pcm_in_use);
12681279
per_pin = get_pin(spec, pin_idx);
12691280
per_pin->cvt_nid = per_cvt->cvt_nid;
1281+
per_pin->silent_stream = false;
12701282
hinfo->nid = per_cvt->cvt_nid;
12711283

12721284
/* flip stripe flag for the assigned stream if supported */
@@ -3617,6 +3629,7 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec)
36173629
spec->pcm_playback.rates = SUPPORTED_RATES;
36183630
spec->pcm_playback.maxbps = SUPPORTED_MAXBPS;
36193631
spec->pcm_playback.formats = SUPPORTED_FORMATS;
3632+
spec->nv_dp_workaround = true;
36203633
return 0;
36213634
}
36223635

@@ -3756,6 +3769,7 @@ static int patch_nvhdmi(struct hda_codec *codec)
37563769
spec->chmap.ops.chmap_cea_alloc_validate_get_type =
37573770
nvhdmi_chmap_cea_alloc_validate_get_type;
37583771
spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
3772+
spec->nv_dp_workaround = true;
37593773

37603774
codec->link_down_at_suspend = 1;
37613775

@@ -3779,6 +3793,7 @@ static int patch_nvhdmi_legacy(struct hda_codec *codec)
37793793
spec->chmap.ops.chmap_cea_alloc_validate_get_type =
37803794
nvhdmi_chmap_cea_alloc_validate_get_type;
37813795
spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
3796+
spec->nv_dp_workaround = true;
37823797

37833798
codec->link_down_at_suspend = 1;
37843799

@@ -3984,6 +3999,7 @@ static int tegra_hdmi_init(struct hda_codec *codec)
39843999

39854000
generic_hdmi_init_per_pins(codec);
39864001

4002+
codec->depop_delay = 10;
39874003
codec->patch_ops.build_pcms = tegra_hdmi_build_pcms;
39884004
spec->chmap.ops.chmap_cea_alloc_validate_get_type =
39894005
nvhdmi_chmap_cea_alloc_validate_get_type;
@@ -3992,6 +4008,7 @@ static int tegra_hdmi_init(struct hda_codec *codec)
39924008
spec->chmap.ops.chmap_cea_alloc_validate_get_type =
39934009
nvhdmi_chmap_cea_alloc_validate_get_type;
39944010
spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
4011+
spec->nv_dp_workaround = true;
39954012

39964013
return 0;
39974014
}

sound/pci/hda/patch_realtek.c

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7067,6 +7067,8 @@ enum {
70677067
ALC294_FIXUP_ASUS_GU502_HP,
70687068
ALC294_FIXUP_ASUS_GU502_PINS,
70697069
ALC294_FIXUP_ASUS_GU502_VERBS,
7070+
ALC294_FIXUP_ASUS_G513_PINS,
7071+
ALC285_FIXUP_ASUS_G533Z_PINS,
70707072
ALC285_FIXUP_HP_GPIO_LED,
70717073
ALC285_FIXUP_HP_MUTE_LED,
70727074
ALC236_FIXUP_HP_GPIO_LED,
@@ -8405,6 +8407,24 @@ static const struct hda_fixup alc269_fixups[] = {
84058407
[ALC294_FIXUP_ASUS_GU502_HP] = {
84068408
.type = HDA_FIXUP_FUNC,
84078409
.v.func = alc294_fixup_gu502_hp,
8410+
},
8411+
[ALC294_FIXUP_ASUS_G513_PINS] = {
8412+
.type = HDA_FIXUP_PINS,
8413+
.v.pins = (const struct hda_pintbl[]) {
8414+
{ 0x19, 0x03a11050 }, /* front HP mic */
8415+
{ 0x1a, 0x03a11c30 }, /* rear external mic */
8416+
{ 0x21, 0x03211420 }, /* front HP out */
8417+
{ }
8418+
},
8419+
},
8420+
[ALC285_FIXUP_ASUS_G533Z_PINS] = {
8421+
.type = HDA_FIXUP_PINS,
8422+
.v.pins = (const struct hda_pintbl[]) {
8423+
{ 0x14, 0x90170120 },
8424+
{ }
8425+
},
8426+
.chained = true,
8427+
.chain_id = ALC294_FIXUP_ASUS_G513_PINS,
84088428
},
84098429
[ALC294_FIXUP_ASUS_COEF_1B] = {
84108430
.type = HDA_FIXUP_VERBS,
@@ -9149,6 +9169,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
91499169
SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
91509170
SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
91519171
SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
9172+
SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SPK),
91529173
SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
91539174
SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
91549175
SND_PCI_QUIRK(0x1028, 0x0935, "Dell", ALC274_FIXUP_DELL_AIO_LINEOUT_VERB),
@@ -9165,6 +9186,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
91659186
SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
91669187
SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
91679188
SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
9189+
SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
91689190
SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
91699191
SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
91709192
SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_HP_MUTE_LED_MIC2),
@@ -9292,6 +9314,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
92929314
SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
92939315
SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
92949316
SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
9317+
SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
92959318
SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
92969319
SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
92979320
SND_PCI_QUIRK(0x103c, 0x8972, "HP EliteBook 840 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
@@ -9339,10 +9362,11 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
93399362
SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
93409363
SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
93419364
SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
9365+
SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
9366+
SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
93429367
SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
93439368
SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
93449369
SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
9345-
SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
93469370
SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
93479371
SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
93489372
SND_PCI_QUIRK(0x1043, 0x18f1, "Asus FX505DT", ALC256_FIXUP_ASUS_HEADSET_MIC),
@@ -9358,14 +9382,16 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
93589382
SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
93599383
SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
93609384
SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
9385+
SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
93619386
SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
9387+
SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
93629388
SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
93639389
SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
93649390
SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
9391+
SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
93659392
SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
9393+
SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
93669394
SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
9367-
SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
9368-
SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
93699395
SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
93709396
SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
93719397
SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
@@ -9569,6 +9595,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
95699595
SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
95709596
SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
95719597
SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
9598+
SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
95729599
SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
95739600
SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
95749601
SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),

sound/usb/endpoint.c

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -758,8 +758,7 @@ bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,
758758
* The endpoint needs to be closed via snd_usb_endpoint_close() later.
759759
*
760760
* Note that this function doesn't configure the endpoint. The substream
761-
* needs to set it up later via snd_usb_endpoint_set_params() and
762-
* snd_usb_endpoint_prepare().
761+
* needs to set it up later via snd_usb_endpoint_configure().
763762
*/
764763
struct snd_usb_endpoint *
765764
snd_usb_endpoint_open(struct snd_usb_audio *chip,
@@ -1293,13 +1292,12 @@ static int sync_ep_set_params(struct snd_usb_endpoint *ep)
12931292
/*
12941293
* snd_usb_endpoint_set_params: configure an snd_usb_endpoint
12951294
*
1296-
* It's called either from hw_params callback.
12971295
* Determine the number of URBs to be used on this endpoint.
12981296
* An endpoint must be configured before it can be started.
12991297
* An endpoint that is already running can not be reconfigured.
13001298
*/
1301-
int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
1302-
struct snd_usb_endpoint *ep)
1299+
static int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
1300+
struct snd_usb_endpoint *ep)
13031301
{
13041302
const struct audioformat *fmt = ep->cur_audiofmt;
13051303
int err;
@@ -1382,18 +1380,18 @@ static int init_sample_rate(struct snd_usb_audio *chip,
13821380
}
13831381

13841382
/*
1385-
* snd_usb_endpoint_prepare: Prepare the endpoint
1383+
* snd_usb_endpoint_configure: Configure the endpoint
13861384
*
13871385
* This function sets up the EP to be fully usable state.
1388-
* It's called either from prepare callback.
1386+
* It's called either from hw_params or prepare callback.
13891387
* The function checks need_setup flag, and performs nothing unless needed,
13901388
* so it's safe to call this multiple times.
13911389
*
13921390
* This returns zero if unchanged, 1 if the configuration has changed,
13931391
* or a negative error code.
13941392
*/
1395-
int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
1396-
struct snd_usb_endpoint *ep)
1393+
int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
1394+
struct snd_usb_endpoint *ep)
13971395
{
13981396
bool iface_first;
13991397
int err = 0;
@@ -1414,6 +1412,9 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
14141412
if (err < 0)
14151413
goto unlock;
14161414
}
1415+
err = snd_usb_endpoint_set_params(chip, ep);
1416+
if (err < 0)
1417+
goto unlock;
14171418
goto done;
14181419
}
14191420

@@ -1441,6 +1442,10 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
14411442
if (err < 0)
14421443
goto unlock;
14431444

1445+
err = snd_usb_endpoint_set_params(chip, ep);
1446+
if (err < 0)
1447+
goto unlock;
1448+
14441449
err = snd_usb_select_mode_quirk(chip, ep->cur_audiofmt);
14451450
if (err < 0)
14461451
goto unlock;

sound/usb/endpoint.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,8 @@ snd_usb_endpoint_open(struct snd_usb_audio *chip,
1717
bool is_sync_ep);
1818
void snd_usb_endpoint_close(struct snd_usb_audio *chip,
1919
struct snd_usb_endpoint *ep);
20-
int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
21-
struct snd_usb_endpoint *ep);
22-
int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
23-
struct snd_usb_endpoint *ep);
20+
int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
21+
struct snd_usb_endpoint *ep);
2422
int snd_usb_endpoint_get_clock_rate(struct snd_usb_audio *chip, int clock);
2523

2624
bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,

sound/usb/pcm.c

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -443,17 +443,17 @@ static int configure_endpoints(struct snd_usb_audio *chip,
443443
if (stop_endpoints(subs, false))
444444
sync_pending_stops(subs);
445445
if (subs->sync_endpoint) {
446-
err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint);
446+
err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
447447
if (err < 0)
448448
return err;
449449
}
450-
err = snd_usb_endpoint_prepare(chip, subs->data_endpoint);
450+
err = snd_usb_endpoint_configure(chip, subs->data_endpoint);
451451
if (err < 0)
452452
return err;
453453
snd_usb_set_format_quirk(subs, subs->cur_audiofmt);
454454
} else {
455455
if (subs->sync_endpoint) {
456-
err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint);
456+
err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
457457
if (err < 0)
458458
return err;
459459
}
@@ -551,13 +551,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
551551
subs->cur_audiofmt = fmt;
552552
mutex_unlock(&chip->mutex);
553553

554-
if (subs->sync_endpoint) {
555-
ret = snd_usb_endpoint_set_params(chip, subs->sync_endpoint);
556-
if (ret < 0)
557-
goto unlock;
558-
}
559-
560-
ret = snd_usb_endpoint_set_params(chip, subs->data_endpoint);
554+
ret = configure_endpoints(chip, subs);
561555

562556
unlock:
563557
if (ret < 0)

0 commit comments

Comments
 (0)