Skip to content

Commit 64b4aef

Browse files
committed
Merge tag 'sound-6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "Things look calming down, as this contains only a few small fixes: - Fix for a corner-case bug with SG-buffer page allocation helper - A regression fix for Roland USB-audio device probe - A potential memory leak fix at the error path - Handful quirks and device-specific fixes for HD- and USB-audio" * tag 'sound-6.1-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: hda: fix potential memleak in 'add_widget_node' ALSA: memalloc: Don't fall back for SG-buffer with IOMMU ALSA: usb-audio: add quirk to fix Hamedal C20 disconnect issue ALSA: hda/realtek: Add Positivo C6300 model quirk ALSA: usb-audio: Add DSD support for Accuphase DAC-60 ALSA: usb-audio: Add quirk entry for M-Audio Micro ALSA: hda/hdmi - enable runtime pm for more AMD display audio ALSA: usb-audio: Remove redundant workaround for Roland quirk ALSA: usb-audio: Yet more regression for for the delayed card registration ALSA: hda/ca0132: add quirk for EVGA Z390 DARK ALSA: hda: clarify comments on SCF changes ALSA: arm: pxa: pxa2xx-ac97-lib: fix return value check of platform_get_irq() ALSA: hda/realtek: Add quirk for ASUS Zenbook using CS35L41
2 parents fd979ca + 9a5523f commit 64b4aef

File tree

11 files changed

+62
-66
lines changed

11 files changed

+62
-66
lines changed

sound/arm/pxa2xx-ac97-lib.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -402,8 +402,10 @@ int pxa2xx_ac97_hw_probe(struct platform_device *dev)
402402
goto err_clk2;
403403

404404
irq = platform_get_irq(dev, 0);
405-
if (!irq)
405+
if (irq < 0) {
406+
ret = irq;
406407
goto err_irq;
408+
}
407409

408410
ret = request_irq(irq, pxa2xx_ac97_irq, 0, "AC97", NULL);
409411
if (ret < 0)

sound/core/memalloc.c

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/slab.h>
1010
#include <linux/mm.h>
1111
#include <linux/dma-mapping.h>
12+
#include <linux/dma-map-ops.h>
1213
#include <linux/genalloc.h>
1314
#include <linux/highmem.h>
1415
#include <linux/vmalloc.h>
@@ -541,19 +542,20 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size)
541542
struct sg_table *sgt;
542543
void *p;
543544

544-
sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir,
545-
DEFAULT_GFP, 0);
546-
if (!sgt) {
547545
#ifdef CONFIG_SND_DMA_SGBUF
546+
if (!get_dma_ops(dmab->dev.dev)) {
548547
if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
549548
dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;
550549
else
551550
dmab->dev.type = SNDRV_DMA_TYPE_DEV_SG_FALLBACK;
552551
return snd_dma_sg_fallback_alloc(dmab, size);
553-
#else
554-
return NULL;
555-
#endif
556552
}
553+
#endif
554+
555+
sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir,
556+
DEFAULT_GFP, 0);
557+
if (!sgt)
558+
return NULL;
557559

558560
dmab->dev.need_sync = dma_need_sync(dmab->dev.dev,
559561
sg_dma_address(sgt->sgl));
@@ -857,7 +859,7 @@ static const struct snd_malloc_ops snd_dma_noncoherent_ops = {
857859
/*
858860
* Entry points
859861
*/
860-
static const struct snd_malloc_ops *dma_ops[] = {
862+
static const struct snd_malloc_ops *snd_dma_ops[] = {
861863
[SNDRV_DMA_TYPE_CONTINUOUS] = &snd_dma_continuous_ops,
862864
[SNDRV_DMA_TYPE_VMALLOC] = &snd_dma_vmalloc_ops,
863865
#ifdef CONFIG_HAS_DMA
@@ -883,7 +885,7 @@ static const struct snd_malloc_ops *snd_dma_get_ops(struct snd_dma_buffer *dmab)
883885
if (WARN_ON_ONCE(!dmab))
884886
return NULL;
885887
if (WARN_ON_ONCE(dmab->dev.type <= SNDRV_DMA_TYPE_UNKNOWN ||
886-
dmab->dev.type >= ARRAY_SIZE(dma_ops)))
888+
dmab->dev.type >= ARRAY_SIZE(snd_dma_ops)))
887889
return NULL;
888-
return dma_ops[dmab->dev.type];
890+
return snd_dma_ops[dmab->dev.type];
889891
}

sound/hda/hdac_sysfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,8 +346,10 @@ static int add_widget_node(struct kobject *parent, hda_nid_t nid,
346346
return -ENOMEM;
347347
kobject_init(kobj, &widget_ktype);
348348
err = kobject_add(kobj, parent, "%02x", nid);
349-
if (err < 0)
349+
if (err < 0) {
350+
kobject_put(kobj);
350351
return err;
352+
}
351353
err = sysfs_create_group(kobj, group);
352354
if (err < 0) {
353355
kobject_put(kobj);

sound/pci/hda/hda_intel.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,8 @@ static int intel_ml_lctl_set_power(struct azx *chip, int state)
485485
int timeout;
486486

487487
/*
488-
* the codecs are sharing the first link setting by default
489-
* If other links are enabled for stream, they need similar fix
488+
* Changes to LCTL.SCF are only needed for the first multi-link dealing
489+
* with external codecs
490490
*/
491491
val = readl(bus->mlcap + AZX_ML_BASE + AZX_REG_ML_LCTL);
492492
val &= ~AZX_ML_LCTL_SPA;
@@ -513,7 +513,7 @@ static void intel_init_lctl(struct azx *chip)
513513

514514
/* 0. check lctl register value is correct or not */
515515
val = readl(bus->mlcap + AZX_ML_BASE + AZX_REG_ML_LCTL);
516-
/* if SCF is already set, let's use it */
516+
/* only perform additional configurations if the SCF is initially based on 6MHz */
517517
if ((val & AZX_ML_LCTL_SCF) != 0)
518518
return;
519519

@@ -531,7 +531,7 @@ static void intel_init_lctl(struct azx *chip)
531531
if (ret)
532532
goto set_spa;
533533

534-
/* 2. update SCF to select a properly audio clock*/
534+
/* 2. update SCF to select an audio clock different from 6MHz */
535535
val &= ~AZX_ML_LCTL_SCF;
536536
val |= intel_get_lctl_scf(chip);
537537
writel(val, bus->mlcap + AZX_ML_BASE + AZX_REG_ML_LCTL);
@@ -2711,6 +2711,9 @@ static const struct pci_device_id azx_ids[] = {
27112711
{ PCI_DEVICE(0x1002, 0xab28),
27122712
.driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS |
27132713
AZX_DCAPS_PM_RUNTIME },
2714+
{ PCI_DEVICE(0x1002, 0xab30),
2715+
.driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS |
2716+
AZX_DCAPS_PM_RUNTIME },
27142717
{ PCI_DEVICE(0x1002, 0xab38),
27152718
.driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI_NS |
27162719
AZX_DCAPS_PM_RUNTIME },

sound/pci/hda/patch_ca0132.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1306,6 +1306,7 @@ static const struct snd_pci_quirk ca0132_quirks[] = {
13061306
SND_PCI_QUIRK(0x1458, 0xA026, "Gigabyte G1.Sniper Z97", QUIRK_R3DI),
13071307
SND_PCI_QUIRK(0x1458, 0xA036, "Gigabyte GA-Z170X-Gaming 7", QUIRK_R3DI),
13081308
SND_PCI_QUIRK(0x3842, 0x1038, "EVGA X99 Classified", QUIRK_R3DI),
1309+
SND_PCI_QUIRK(0x3842, 0x1055, "EVGA Z390 DARK", QUIRK_R3DI),
13091310
SND_PCI_QUIRK(0x1102, 0x0013, "Recon3D", QUIRK_R3D),
13101311
SND_PCI_QUIRK(0x1102, 0x0018, "Recon3D", QUIRK_R3D),
13111312
SND_PCI_QUIRK(0x1102, 0x0051, "Sound Blaster AE-5", QUIRK_AE5),

sound/pci/hda/patch_realtek.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9404,6 +9404,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
94049404
SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
94059405
SND_PCI_QUIRK(0x1043, 0x1c52, "ASUS Zephyrus G15 2022", ALC289_FIXUP_ASUS_GA401),
94069406
SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
9407+
SND_PCI_QUIRK(0x1043, 0x1f12, "ASUS UM5302", ALC287_FIXUP_CS35L41_I2C_2),
94079408
SND_PCI_QUIRK(0x1043, 0x1f92, "ASUS ROG Flow X16", ALC289_FIXUP_ASUS_GA401),
94089409
SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
94099410
SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
@@ -9608,6 +9609,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
96089609
SND_PCI_QUIRK(0x17aa, 0x511f, "Thinkpad", ALC298_FIXUP_TPT470_DOCK),
96099610
SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
96109611
SND_PCI_QUIRK(0x1849, 0x1233, "ASRock NUC Box 1100", ALC233_FIXUP_NO_AUDIO_JACK),
9612+
SND_PCI_QUIRK(0x1849, 0xa233, "Positivo Master C6300", ALC269_FIXUP_HEADSET_MIC),
96119613
SND_PCI_QUIRK(0x19e5, 0x3204, "Huawei MACH-WX9", ALC256_FIXUP_HUAWEI_MACH_WX9_PINS),
96129614
SND_PCI_QUIRK(0x19e5, 0x320f, "Huawei WRT-WX9 ", ALC256_FIXUP_ASUS_MIC_NO_PRESENCE),
96139615
SND_PCI_QUIRK(0x1b35, 0x1235, "CZC B20", ALC269_FIXUP_CZC_B20),

sound/usb/card.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -742,6 +742,18 @@ get_alias_quirk(struct usb_device *dev, unsigned int id)
742742
return NULL;
743743
}
744744

745+
/* register card if we reach to the last interface or to the specified
746+
* one given via option
747+
*/
748+
static int try_to_register_card(struct snd_usb_audio *chip, int ifnum)
749+
{
750+
if (check_delayed_register_option(chip) == ifnum ||
751+
chip->last_iface == ifnum ||
752+
usb_interface_claimed(usb_ifnum_to_if(chip->dev, chip->last_iface)))
753+
return snd_card_register(chip->card);
754+
return 0;
755+
}
756+
745757
/*
746758
* probe the active usb device
747759
*
@@ -880,15 +892,9 @@ static int usb_audio_probe(struct usb_interface *intf,
880892
chip->need_delayed_register = false; /* clear again */
881893
}
882894

883-
/* register card if we reach to the last interface or to the specified
884-
* one given via option
885-
*/
886-
if (check_delayed_register_option(chip) == ifnum ||
887-
usb_interface_claimed(usb_ifnum_to_if(dev, chip->last_iface))) {
888-
err = snd_card_register(chip->card);
889-
if (err < 0)
890-
goto __error;
891-
}
895+
err = try_to_register_card(chip, ifnum);
896+
if (err < 0)
897+
goto __error_no_register;
892898

893899
if (chip->quirk_flags & QUIRK_FLAG_SHARE_MEDIA_DEVICE) {
894900
/* don't want to fail when snd_media_device_create() fails */
@@ -907,6 +913,11 @@ static int usb_audio_probe(struct usb_interface *intf,
907913
return 0;
908914

909915
__error:
916+
/* in the case of error in secondary interface, still try to register */
917+
if (chip)
918+
try_to_register_card(chip, ifnum);
919+
920+
__error_no_register:
910921
if (chip) {
911922
/* chip->active is inside the chip->card object,
912923
* decrement before memory is possibly returned.

sound/usb/endpoint.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -931,7 +931,8 @@ void snd_usb_endpoint_close(struct snd_usb_audio *chip,
931931
usb_audio_dbg(chip, "Closing EP 0x%x (count %d)\n",
932932
ep->ep_num, ep->opened);
933933

934-
if (!--ep->iface_ref->opened)
934+
if (!--ep->iface_ref->opened &&
935+
!(chip->quirk_flags & QUIRK_FLAG_IFACE_SKIP_CLOSE))
935936
endpoint_set_interface(chip, ep, false);
936937

937938
if (!--ep->opened) {

sound/usb/quirks-table.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2049,6 +2049,10 @@ YAMAHA_DEVICE(0x7010, "UB99"),
20492049
}
20502050
}
20512051
},
2052+
{
2053+
/* M-Audio Micro */
2054+
USB_DEVICE_VENDOR_SPEC(0x0763, 0x201a),
2055+
},
20522056
{
20532057
USB_DEVICE_VENDOR_SPEC(0x0763, 0x2030),
20542058
.driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {

sound/usb/quirks.c

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,8 @@ static int create_auto_midi_quirk(struct snd_usb_audio *chip,
376376

377377
static int create_autodetect_quirk(struct snd_usb_audio *chip,
378378
struct usb_interface *iface,
379-
struct usb_driver *driver)
379+
struct usb_driver *driver,
380+
const struct snd_usb_audio_quirk *quirk)
380381
{
381382
int err;
382383

@@ -386,45 +387,6 @@ static int create_autodetect_quirk(struct snd_usb_audio *chip,
386387
return err;
387388
}
388389

389-
static int create_autodetect_quirks(struct snd_usb_audio *chip,
390-
struct usb_interface *iface,
391-
struct usb_driver *driver,
392-
const struct snd_usb_audio_quirk *quirk)
393-
{
394-
int probed_ifnum = get_iface_desc(iface->altsetting)->bInterfaceNumber;
395-
int ifcount, ifnum, err;
396-
397-
err = create_autodetect_quirk(chip, iface, driver);
398-
if (err < 0)
399-
return err;
400-
401-
/*
402-
* ALSA PCM playback/capture devices cannot be registered in two steps,
403-
* so we have to claim the other corresponding interface here.
404-
*/
405-
ifcount = chip->dev->actconfig->desc.bNumInterfaces;
406-
for (ifnum = 0; ifnum < ifcount; ifnum++) {
407-
if (ifnum == probed_ifnum || quirk->ifnum >= 0)
408-
continue;
409-
iface = usb_ifnum_to_if(chip->dev, ifnum);
410-
if (!iface ||
411-
usb_interface_claimed(iface) ||
412-
get_iface_desc(iface->altsetting)->bInterfaceClass !=
413-
USB_CLASS_VENDOR_SPEC)
414-
continue;
415-
416-
err = create_autodetect_quirk(chip, iface, driver);
417-
if (err >= 0) {
418-
err = usb_driver_claim_interface(driver, iface,
419-
USB_AUDIO_IFACE_UNUSED);
420-
if (err < 0)
421-
return err;
422-
}
423-
}
424-
425-
return 0;
426-
}
427-
428390
/*
429391
* Create a stream for an Edirol UA-700/UA-25/UA-4FX interface.
430392
* The only way to detect the sample rate is by looking at wMaxPacketSize.
@@ -554,7 +516,7 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip,
554516
static const quirk_func_t quirk_funcs[] = {
555517
[QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk,
556518
[QUIRK_COMPOSITE] = create_composite_quirk,
557-
[QUIRK_AUTODETECT] = create_autodetect_quirks,
519+
[QUIRK_AUTODETECT] = create_autodetect_quirk,
558520
[QUIRK_MIDI_STANDARD_INTERFACE] = create_any_midi_quirk,
559521
[QUIRK_MIDI_FIXED_ENDPOINT] = create_any_midi_quirk,
560522
[QUIRK_MIDI_YAMAHA] = create_any_midi_quirk,
@@ -1913,6 +1875,7 @@ u64 snd_usb_interface_dsd_format_quirks(struct snd_usb_audio *chip,
19131875
/* XMOS based USB DACs */
19141876
switch (chip->usb_id) {
19151877
case USB_ID(0x1511, 0x0037): /* AURALiC VEGA */
1878+
case USB_ID(0x21ed, 0xd75a): /* Accuphase DAC-60 option card */
19161879
case USB_ID(0x2522, 0x0012): /* LH Labs VI DAC Infinity */
19171880
case USB_ID(0x2772, 0x0230): /* Pro-Ject Pre Box S2 Digital */
19181881
if (fp->altsetting == 2)
@@ -2185,6 +2148,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
21852148
QUIRK_FLAG_GENERIC_IMPLICIT_FB),
21862149
DEVICE_FLG(0x2b53, 0x0031, /* Fiero SC-01 (firmware v1.1.0) */
21872150
QUIRK_FLAG_GENERIC_IMPLICIT_FB),
2151+
DEVICE_FLG(0x0525, 0xa4ad, /* Hamedal C20 usb camero */
2152+
QUIRK_FLAG_IFACE_SKIP_CLOSE),
21882153

21892154
/* Vendor matches */
21902155
VENDOR_FLG(0x045e, /* MS Lifecam */

0 commit comments

Comments
 (0)