sound fixes for 5.0-rc7
A bit more changes than wished, but still manageable ammount. 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. -----BEGIN PGP SIGNATURE----- iQJCBAABCAAsFiEEIXTw5fNLNI7mMiVaLtJE4w1nLE8FAmMqv3MOHHRpd2FpQHN1 c2UuZGUACgkQLtJE4w1nLE/mQRAAnwAfR4D3RZsDO35j0ggpnF9XXE6S8uUKqmFp 1ge6qYrXgNxm26za6MTWrK5/kSsl9SbFXNjWO5Gzq2mjnNTJw/WEucyGCY/szHG9 M+X57gmrvj8ctpZQKmehpdoaUcT2Yc8oBZjYU9q2mQBMGtROcbUeF1WvXDKnh5QG 9DE9qJ0yn8LbE9Cj+rcuc8+rnurWjWGgStPAcEah65TaZ4ZqhaCcMCAm6qxio6Js TerlILP2QAssaPNksR6R8mm2vWoOFF/2uZXIQTdyUi1RlaSdemKiO9j2cO0RmJNP qKqHzGacwobJu2XJc/go/CesXA1K8tgMNmEWw0Ng7Rzn29jtBTLeZalcS79GLe+E RlYmY1s8lS2vYBu7OVIOTxaW9NPC7mTtKMEuZM4mZ3YplSQLZst0oEJeKOcqkBIv YLt81V3eH2mERy9HsPiLbCBU6wPBk3qx/QZNvTq8vc+qXYi9JI7b89g2aCHFFwkk ONXwuW4O4OjlbqH3K4Mf1iWMdvxbnLhuICRLVCdREay/exXv1dt0sF78Rs13AAv4 J2DlLG1YtMOhsRy3YxnVr94oYi7tA3GDx1aEuwZ4v/yuA7UZTD1A40iS+/P5GRic uZJYtLoULJkPBx9LG7ON49mF9Ap2nlj2PkNeNE6lEeWLU8oMeu1HV6XPO7FaXOPv 4VZi1jI= =5FVb -----END PGP SIGNATURE----- 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
This commit is contained in:
commit
5ce94102fb
@ -178,10 +178,8 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
|
||||
return -ENOMEM;
|
||||
|
||||
err = snd_card_init(card, parent, idx, xid, module, extra_size);
|
||||
if (err < 0) {
|
||||
kfree(card);
|
||||
return err;
|
||||
}
|
||||
if (err < 0)
|
||||
return err; /* card is freed by error handler */
|
||||
|
||||
*card_ret = card;
|
||||
return 0;
|
||||
@ -233,7 +231,7 @@ int snd_devm_card_new(struct device *parent, int idx, const char *xid,
|
||||
card->managed = true;
|
||||
err = snd_card_init(card, parent, idx, xid, module, extra_size);
|
||||
if (err < 0) {
|
||||
devres_free(card);
|
||||
devres_free(card); /* in managed mode, we need to free manually */
|
||||
return err;
|
||||
}
|
||||
|
||||
@ -297,6 +295,8 @@ static int snd_card_init(struct snd_card *card, struct device *parent,
|
||||
mutex_unlock(&snd_card_mutex);
|
||||
dev_err(parent, "cannot find the slot for index %d (range 0-%i), error: %d\n",
|
||||
idx, snd_ecards_limit - 1, err);
|
||||
if (!card->managed)
|
||||
kfree(card); /* manually free here, as no destructor called */
|
||||
return err;
|
||||
}
|
||||
set_bit(idx, snd_cards_lock); /* lock it */
|
||||
|
@ -157,10 +157,10 @@ static int hda_codec_driver_remove(struct device *dev)
|
||||
return codec->bus->core.ext_ops->hdev_detach(&codec->core);
|
||||
}
|
||||
|
||||
refcount_dec(&codec->pcm_ref);
|
||||
snd_hda_codec_disconnect_pcms(codec);
|
||||
snd_hda_jack_tbl_disconnect(codec);
|
||||
wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
|
||||
if (!refcount_dec_and_test(&codec->pcm_ref))
|
||||
wait_event(codec->remove_sleep, !refcount_read(&codec->pcm_ref));
|
||||
snd_power_sync_ref(codec->bus->card);
|
||||
|
||||
if (codec->patch_ops.free)
|
||||
|
@ -2550,6 +2550,8 @@ static const struct pci_device_id azx_ids[] = {
|
||||
/* 5 Series/3400 */
|
||||
{ PCI_DEVICE(0x8086, 0x3b56),
|
||||
.driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
|
||||
{ PCI_DEVICE(0x8086, 0x3b57),
|
||||
.driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_NOPM },
|
||||
/* Poulsbo */
|
||||
{ PCI_DEVICE(0x8086, 0x811b),
|
||||
.driver_data = AZX_DRIVER_SCH | AZX_DCAPS_INTEL_PCH_BASE },
|
||||
|
@ -170,6 +170,8 @@ struct hdmi_spec {
|
||||
bool dyn_pcm_no_legacy;
|
||||
/* hdmi interrupt trigger control flag for Nvidia codec */
|
||||
bool hdmi_intr_trig_ctrl;
|
||||
bool nv_dp_workaround; /* workaround DP audio infoframe for Nvidia */
|
||||
|
||||
bool intel_hsw_fixup; /* apply Intel platform-specific fixups */
|
||||
/*
|
||||
* Non-generic VIA/NVIDIA specific
|
||||
@ -679,15 +681,24 @@ static void hdmi_pin_setup_infoframe(struct hda_codec *codec,
|
||||
int ca, int active_channels,
|
||||
int conn_type)
|
||||
{
|
||||
struct hdmi_spec *spec = codec->spec;
|
||||
union audio_infoframe ai;
|
||||
|
||||
memset(&ai, 0, sizeof(ai));
|
||||
if (conn_type == 0) { /* HDMI */
|
||||
if ((conn_type == 0) || /* HDMI */
|
||||
/* Nvidia DisplayPort: Nvidia HW expects same layout as HDMI */
|
||||
(conn_type == 1 && spec->nv_dp_workaround)) {
|
||||
struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi;
|
||||
|
||||
hdmi_ai->type = 0x84;
|
||||
hdmi_ai->ver = 0x01;
|
||||
hdmi_ai->len = 0x0a;
|
||||
if (conn_type == 0) { /* HDMI */
|
||||
hdmi_ai->type = 0x84;
|
||||
hdmi_ai->ver = 0x01;
|
||||
hdmi_ai->len = 0x0a;
|
||||
} else {/* Nvidia DP */
|
||||
hdmi_ai->type = 0x84;
|
||||
hdmi_ai->ver = 0x1b;
|
||||
hdmi_ai->len = 0x11 << 2;
|
||||
}
|
||||
hdmi_ai->CC02_CT47 = active_channels - 1;
|
||||
hdmi_ai->CA = ca;
|
||||
hdmi_checksum_audio_infoframe(hdmi_ai);
|
||||
@ -1267,6 +1278,7 @@ static int hdmi_pcm_open(struct hda_pcm_stream *hinfo,
|
||||
set_bit(pcm_idx, &spec->pcm_in_use);
|
||||
per_pin = get_pin(spec, pin_idx);
|
||||
per_pin->cvt_nid = per_cvt->cvt_nid;
|
||||
per_pin->silent_stream = false;
|
||||
hinfo->nid = per_cvt->cvt_nid;
|
||||
|
||||
/* flip stripe flag for the assigned stream if supported */
|
||||
@ -3617,6 +3629,7 @@ static int patch_nvhdmi_2ch(struct hda_codec *codec)
|
||||
spec->pcm_playback.rates = SUPPORTED_RATES;
|
||||
spec->pcm_playback.maxbps = SUPPORTED_MAXBPS;
|
||||
spec->pcm_playback.formats = SUPPORTED_FORMATS;
|
||||
spec->nv_dp_workaround = true;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3756,6 +3769,7 @@ static int patch_nvhdmi(struct hda_codec *codec)
|
||||
spec->chmap.ops.chmap_cea_alloc_validate_get_type =
|
||||
nvhdmi_chmap_cea_alloc_validate_get_type;
|
||||
spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
|
||||
spec->nv_dp_workaround = true;
|
||||
|
||||
codec->link_down_at_suspend = 1;
|
||||
|
||||
@ -3779,6 +3793,7 @@ static int patch_nvhdmi_legacy(struct hda_codec *codec)
|
||||
spec->chmap.ops.chmap_cea_alloc_validate_get_type =
|
||||
nvhdmi_chmap_cea_alloc_validate_get_type;
|
||||
spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
|
||||
spec->nv_dp_workaround = true;
|
||||
|
||||
codec->link_down_at_suspend = 1;
|
||||
|
||||
@ -3984,6 +3999,7 @@ static int tegra_hdmi_init(struct hda_codec *codec)
|
||||
|
||||
generic_hdmi_init_per_pins(codec);
|
||||
|
||||
codec->depop_delay = 10;
|
||||
codec->patch_ops.build_pcms = tegra_hdmi_build_pcms;
|
||||
spec->chmap.ops.chmap_cea_alloc_validate_get_type =
|
||||
nvhdmi_chmap_cea_alloc_validate_get_type;
|
||||
@ -3992,6 +4008,7 @@ static int tegra_hdmi_init(struct hda_codec *codec)
|
||||
spec->chmap.ops.chmap_cea_alloc_validate_get_type =
|
||||
nvhdmi_chmap_cea_alloc_validate_get_type;
|
||||
spec->chmap.ops.chmap_validate = nvhdmi_chmap_validate;
|
||||
spec->nv_dp_workaround = true;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -7067,6 +7067,8 @@ enum {
|
||||
ALC294_FIXUP_ASUS_GU502_HP,
|
||||
ALC294_FIXUP_ASUS_GU502_PINS,
|
||||
ALC294_FIXUP_ASUS_GU502_VERBS,
|
||||
ALC294_FIXUP_ASUS_G513_PINS,
|
||||
ALC285_FIXUP_ASUS_G533Z_PINS,
|
||||
ALC285_FIXUP_HP_GPIO_LED,
|
||||
ALC285_FIXUP_HP_MUTE_LED,
|
||||
ALC236_FIXUP_HP_GPIO_LED,
|
||||
@ -8405,6 +8407,24 @@ static const struct hda_fixup alc269_fixups[] = {
|
||||
[ALC294_FIXUP_ASUS_GU502_HP] = {
|
||||
.type = HDA_FIXUP_FUNC,
|
||||
.v.func = alc294_fixup_gu502_hp,
|
||||
},
|
||||
[ALC294_FIXUP_ASUS_G513_PINS] = {
|
||||
.type = HDA_FIXUP_PINS,
|
||||
.v.pins = (const struct hda_pintbl[]) {
|
||||
{ 0x19, 0x03a11050 }, /* front HP mic */
|
||||
{ 0x1a, 0x03a11c30 }, /* rear external mic */
|
||||
{ 0x21, 0x03211420 }, /* front HP out */
|
||||
{ }
|
||||
},
|
||||
},
|
||||
[ALC285_FIXUP_ASUS_G533Z_PINS] = {
|
||||
.type = HDA_FIXUP_PINS,
|
||||
.v.pins = (const struct hda_pintbl[]) {
|
||||
{ 0x14, 0x90170120 },
|
||||
{ }
|
||||
},
|
||||
.chained = true,
|
||||
.chain_id = ALC294_FIXUP_ASUS_G513_PINS,
|
||||
},
|
||||
[ALC294_FIXUP_ASUS_COEF_1B] = {
|
||||
.type = HDA_FIXUP_VERBS,
|
||||
@ -9149,6 +9169,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x1028, 0x0871, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1028, 0x0872, "Dell Precision 3630", ALC255_FIXUP_DELL_HEADSET_MIC),
|
||||
SND_PCI_QUIRK(0x1028, 0x0873, "Dell Precision 3930", ALC255_FIXUP_DUMMY_LINEOUT_VERB),
|
||||
SND_PCI_QUIRK(0x1028, 0x087d, "Dell Precision 5530", ALC289_FIXUP_DUAL_SPK),
|
||||
SND_PCI_QUIRK(0x1028, 0x08ad, "Dell WYSE AIO", ALC225_FIXUP_DELL_WYSE_AIO_MIC_NO_PRESENCE),
|
||||
SND_PCI_QUIRK(0x1028, 0x08ae, "Dell WYSE NB", ALC225_FIXUP_DELL1_MIC_NO_PRESENCE),
|
||||
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[] = {
|
||||
SND_PCI_QUIRK(0x1028, 0x0a9d, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
|
||||
SND_PCI_QUIRK(0x1028, 0x0a9e, "Dell Latitude 5430", ALC269_FIXUP_DELL4_MIC_NO_PRESENCE),
|
||||
SND_PCI_QUIRK(0x1028, 0x0b19, "Dell XPS 15 9520", ALC289_FIXUP_DUAL_SPK),
|
||||
SND_PCI_QUIRK(0x1028, 0x0b1a, "Dell Precision 5570", ALC289_FIXUP_DUAL_SPK),
|
||||
SND_PCI_QUIRK(0x1028, 0x164a, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
|
||||
SND_PCI_QUIRK(0x1028, 0x164b, "Dell", ALC293_FIXUP_DELL1_MIC_NO_PRESENCE),
|
||||
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[] = {
|
||||
SND_PCI_QUIRK(0x103c, 0x8896, "HP EliteBook 855 G8 Notebook PC", ALC285_FIXUP_HP_MUTE_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8898, "HP EliteBook 845 G8 Notebook PC", ALC285_FIXUP_HP_LIMIT_INT_MIC_BOOST),
|
||||
SND_PCI_QUIRK(0x103c, 0x88d0, "HP Pavilion 15-eh1xxx (mainboard 88D0)", ALC287_FIXUP_HP_GPIO_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8902, "HP OMEN 16", ALC285_FIXUP_HP_MUTE_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x896e, "HP EliteBook x360 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
|
||||
SND_PCI_QUIRK(0x103c, 0x8971, "HP EliteBook 830 G9", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
|
||||
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[] = {
|
||||
SND_PCI_QUIRK(0x1043, 0x13b0, "ASUS Z550SA", ALC256_FIXUP_ASUS_MIC),
|
||||
SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_ASUS_ZENBOOK),
|
||||
SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_ASUS_ZENBOOK_UX31A),
|
||||
SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
|
||||
SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
|
||||
SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_FIXUP_STEREO_DMIC),
|
||||
SND_PCI_QUIRK(0x1043, 0x1740, "ASUS UX430UA", ALC295_FIXUP_ASUS_DACS),
|
||||
SND_PCI_QUIRK(0x1043, 0x17d1, "ASUS UX431FL", ALC294_FIXUP_ASUS_DUAL_SPK),
|
||||
SND_PCI_QUIRK(0x1043, 0x1662, "ASUS GV301QH", ALC294_FIXUP_ASUS_DUAL_SPK),
|
||||
SND_PCI_QUIRK(0x1043, 0x1881, "ASUS Zephyrus S/M", ALC294_FIXUP_ASUS_GX502_PINS),
|
||||
SND_PCI_QUIRK(0x1043, 0x18b1, "Asus MJ401TA", ALC256_FIXUP_ASUS_HEADSET_MIC),
|
||||
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[] = {
|
||||
SND_PCI_QUIRK(0x1043, 0x1b13, "Asus U41SV", ALC269_FIXUP_INV_DMIC),
|
||||
SND_PCI_QUIRK(0x1043, 0x1bbd, "ASUS Z550MA", ALC255_FIXUP_ASUS_MIC_NO_PRESENCE),
|
||||
SND_PCI_QUIRK(0x1043, 0x1c23, "Asus X55U", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
|
||||
SND_PCI_QUIRK(0x1043, 0x1c92, "ASUS ROG Strix G15", ALC285_FIXUP_ASUS_G533Z_PINS),
|
||||
SND_PCI_QUIRK(0x1043, 0x1ccd, "ASUS X555UB", ALC256_FIXUP_ASUS_MIC),
|
||||
SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
|
||||
SND_PCI_QUIRK(0x1043, 0x1d4e, "ASUS TM420", ALC256_FIXUP_ASUS_HPE),
|
||||
SND_PCI_QUIRK(0x1043, 0x1e11, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA502),
|
||||
SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
|
||||
SND_PCI_QUIRK(0x1043, 0x1e5e, "ASUS ROG Strix G513", ALC294_FIXUP_ASUS_G513_PINS),
|
||||
SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
|
||||
SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
|
||||
SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
|
||||
SND_PCI_QUIRK(0x1043, 0x1d42, "ASUS Zephyrus G14 2022", ALC289_FIXUP_ASUS_GA401),
|
||||
SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
|
||||
SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
|
||||
SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
|
||||
SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),
|
||||
@ -9569,6 +9595,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
|
||||
SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
|
||||
SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
|
||||
SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
|
||||
SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
|
||||
SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),
|
||||
SND_PCI_QUIRK(0x1b35, 0x1236, "CZC TMI", ALC269_FIXUP_CZC_TMI),
|
||||
SND_PCI_QUIRK(0x1b35, 0x1237, "CZC L101", ALC269_FIXUP_CZC_L101),
|
||||
|
@ -758,8 +758,7 @@ bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,
|
||||
* The endpoint needs to be closed via snd_usb_endpoint_close() later.
|
||||
*
|
||||
* Note that this function doesn't configure the endpoint. The substream
|
||||
* needs to set it up later via snd_usb_endpoint_set_params() and
|
||||
* snd_usb_endpoint_prepare().
|
||||
* needs to set it up later via snd_usb_endpoint_configure().
|
||||
*/
|
||||
struct snd_usb_endpoint *
|
||||
snd_usb_endpoint_open(struct snd_usb_audio *chip,
|
||||
@ -1293,13 +1292,12 @@ out_of_memory:
|
||||
/*
|
||||
* snd_usb_endpoint_set_params: configure an snd_usb_endpoint
|
||||
*
|
||||
* It's called either from hw_params callback.
|
||||
* Determine the number of URBs to be used on this endpoint.
|
||||
* An endpoint must be configured before it can be started.
|
||||
* An endpoint that is already running can not be reconfigured.
|
||||
*/
|
||||
int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
|
||||
struct snd_usb_endpoint *ep)
|
||||
static int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
|
||||
struct snd_usb_endpoint *ep)
|
||||
{
|
||||
const struct audioformat *fmt = ep->cur_audiofmt;
|
||||
int err;
|
||||
@ -1382,18 +1380,18 @@ static int init_sample_rate(struct snd_usb_audio *chip,
|
||||
}
|
||||
|
||||
/*
|
||||
* snd_usb_endpoint_prepare: Prepare the endpoint
|
||||
* snd_usb_endpoint_configure: Configure the endpoint
|
||||
*
|
||||
* This function sets up the EP to be fully usable state.
|
||||
* It's called either from prepare callback.
|
||||
* It's called either from hw_params or prepare callback.
|
||||
* The function checks need_setup flag, and performs nothing unless needed,
|
||||
* so it's safe to call this multiple times.
|
||||
*
|
||||
* This returns zero if unchanged, 1 if the configuration has changed,
|
||||
* or a negative error code.
|
||||
*/
|
||||
int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
|
||||
struct snd_usb_endpoint *ep)
|
||||
int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
|
||||
struct snd_usb_endpoint *ep)
|
||||
{
|
||||
bool iface_first;
|
||||
int err = 0;
|
||||
@ -1414,6 +1412,9 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
}
|
||||
err = snd_usb_endpoint_set_params(chip, ep);
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -1441,6 +1442,10 @@ int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
|
||||
err = snd_usb_endpoint_set_params(chip, ep);
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
|
||||
err = snd_usb_select_mode_quirk(chip, ep->cur_audiofmt);
|
||||
if (err < 0)
|
||||
goto unlock;
|
||||
|
@ -17,10 +17,8 @@ snd_usb_endpoint_open(struct snd_usb_audio *chip,
|
||||
bool is_sync_ep);
|
||||
void snd_usb_endpoint_close(struct snd_usb_audio *chip,
|
||||
struct snd_usb_endpoint *ep);
|
||||
int snd_usb_endpoint_set_params(struct snd_usb_audio *chip,
|
||||
struct snd_usb_endpoint *ep);
|
||||
int snd_usb_endpoint_prepare(struct snd_usb_audio *chip,
|
||||
struct snd_usb_endpoint *ep);
|
||||
int snd_usb_endpoint_configure(struct snd_usb_audio *chip,
|
||||
struct snd_usb_endpoint *ep);
|
||||
int snd_usb_endpoint_get_clock_rate(struct snd_usb_audio *chip, int clock);
|
||||
|
||||
bool snd_usb_endpoint_compatible(struct snd_usb_audio *chip,
|
||||
|
@ -443,17 +443,17 @@ static int configure_endpoints(struct snd_usb_audio *chip,
|
||||
if (stop_endpoints(subs, false))
|
||||
sync_pending_stops(subs);
|
||||
if (subs->sync_endpoint) {
|
||||
err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint);
|
||||
err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
err = snd_usb_endpoint_prepare(chip, subs->data_endpoint);
|
||||
err = snd_usb_endpoint_configure(chip, subs->data_endpoint);
|
||||
if (err < 0)
|
||||
return err;
|
||||
snd_usb_set_format_quirk(subs, subs->cur_audiofmt);
|
||||
} else {
|
||||
if (subs->sync_endpoint) {
|
||||
err = snd_usb_endpoint_prepare(chip, subs->sync_endpoint);
|
||||
err = snd_usb_endpoint_configure(chip, subs->sync_endpoint);
|
||||
if (err < 0)
|
||||
return err;
|
||||
}
|
||||
@ -551,13 +551,7 @@ static int snd_usb_hw_params(struct snd_pcm_substream *substream,
|
||||
subs->cur_audiofmt = fmt;
|
||||
mutex_unlock(&chip->mutex);
|
||||
|
||||
if (subs->sync_endpoint) {
|
||||
ret = snd_usb_endpoint_set_params(chip, subs->sync_endpoint);
|
||||
if (ret < 0)
|
||||
goto unlock;
|
||||
}
|
||||
|
||||
ret = snd_usb_endpoint_set_params(chip, subs->data_endpoint);
|
||||
ret = configure_endpoints(chip, subs);
|
||||
|
||||
unlock:
|
||||
if (ret < 0)
|
||||
|
Loading…
Reference in New Issue
Block a user