Skip to content

Commit

Permalink
Merge tag 'sound-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kerne…
Browse files Browse the repository at this point in the history
…l/git/tiwai/sound

Pull sound fixes from Takashi Iwai:
 "A bit higher volume of changes than wished, but each change is
  relatively small and the fix targets are mostly device-specific, so
  those should be safe as a late stage merge.

  The most significant LoC is about the memalloc helper fix, which is
  applied only to Xen PV. The other major parts are ASoC Intel SOF and
  AVS fixes that are scattered as various small code changes. The rest
  are device-specific fixes and quirks for HD- and USB-audio, FireWire
  and ASoC AMD / HDMI"

* tag 'sound-6.2-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (30 commits)
  ALSA: firewire-motu: fix unreleased lock warning in hwdep device
  ALSA: memalloc: Workaround for Xen PV
  ASoC: cs42l56: fix DT probe
  ASoC: codecs: wsa883x: correct playback min/max rates
  ALSA: hda/realtek: Add Acer Predator PH315-54
  ASoC: amd: yc: Add Xiaomi Redmi Book Pro 15 2022 into DMI table
  ALSA: hda: Do not unset preset when cleaning up codec
  ASoC: SOF: sof-audio: prepare_widgets: Check swidget for NULL on sink failure
  ASoC: hdmi-codec: zero clear HDMI pdata
  ASoC: SOF: ipc4-mtrace: prevent underflow in sof_ipc4_priority_mask_dfs_write()
  ASoC: Intel: sof_ssp_amp: always set dpcm_capture for amplifiers
  ASoC: Intel: sof_nau8825: always set dpcm_capture for amplifiers
  ASoC: Intel: sof_cs42l42: always set dpcm_capture for amplifiers
  ASoC: Intel: sof_rt5682: always set dpcm_capture for amplifiers
  ALSA: hda/via: Avoid potential array out-of-bound in add_secret_dac_path()
  ALSA: usb-audio: Add FIXED_RATE quirk for JBL Quantum610 Wireless
  ALSA: hda/realtek: fix mute/micmute LEDs, speaker don't work for a HP platform
  ASoC: SOF: keep prepare/unprepare widgets in sink path
  ASoC: SOF: sof-audio: skip prepare/unprepare if swidget is NULL
  ASoC: SOF: sof-audio: unprepare when swidget->use_count > 0
  ...
  • Loading branch information
torvalds committed Feb 1, 2023
2 parents c0b6753 + c7a806d commit ce18d3a
Show file tree
Hide file tree
Showing 25 changed files with 189 additions and 69 deletions.
4 changes: 3 additions & 1 deletion drivers/firewire/core-cdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,8 +819,10 @@ static int ioctl_send_response(struct client *client, union ioctl_arg *arg)

r = container_of(resource, struct inbound_transaction_resource,
resource);
if (is_fcp_request(r->request))
if (is_fcp_request(r->request)) {
kfree(r->data);
goto out;
}

if (a->length != fw_get_response_length(r->request)) {
ret = -EINVAL;
Expand Down
1 change: 1 addition & 0 deletions drivers/gpu/drm/bridge/synopsys/dw-hdmi-i2s-audio.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ static int snd_dw_hdmi_probe(struct platform_device *pdev)
struct hdmi_codec_pdata pdata;
struct platform_device *platform;

memset(&pdata, 0, sizeof(pdata));
pdata.ops = &dw_hdmi_i2s_ops;
pdata.i2s = 1;
pdata.max_i2s_channels = 8;
Expand Down
87 changes: 69 additions & 18 deletions sound/core/memalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -541,16 +541,15 @@ static void *snd_dma_noncontig_alloc(struct snd_dma_buffer *dmab, size_t size)
struct sg_table *sgt;
void *p;

#ifdef CONFIG_SND_DMA_SGBUF
if (cpu_feature_enabled(X86_FEATURE_XENPV))
return snd_dma_sg_fallback_alloc(dmab, size);
#endif
sgt = dma_alloc_noncontiguous(dmab->dev.dev, size, dmab->dev.dir,
DEFAULT_GFP, 0);
#ifdef CONFIG_SND_DMA_SGBUF
if (!sgt && !get_dma_ops(dmab->dev.dev)) {
if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;
else
dmab->dev.type = SNDRV_DMA_TYPE_DEV_SG_FALLBACK;
if (!sgt && !get_dma_ops(dmab->dev.dev))
return snd_dma_sg_fallback_alloc(dmab, size);
}
#endif
if (!sgt)
return NULL;
Expand Down Expand Up @@ -717,19 +716,38 @@ static const struct snd_malloc_ops snd_dma_sg_wc_ops = {

/* Fallback SG-buffer allocations for x86 */
struct snd_dma_sg_fallback {
bool use_dma_alloc_coherent;
size_t count;
struct page **pages;
/* DMA address array; the first page contains #pages in ~PAGE_MASK */
dma_addr_t *addrs;
};

static void __snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab,
struct snd_dma_sg_fallback *sgbuf)
{
bool wc = dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;
size_t i;

for (i = 0; i < sgbuf->count && sgbuf->pages[i]; i++)
do_free_pages(page_address(sgbuf->pages[i]), PAGE_SIZE, wc);
size_t i, size;

if (sgbuf->pages && sgbuf->addrs) {
i = 0;
while (i < sgbuf->count) {
if (!sgbuf->pages[i] || !sgbuf->addrs[i])
break;
size = sgbuf->addrs[i] & ~PAGE_MASK;
if (WARN_ON(!size))
break;
if (sgbuf->use_dma_alloc_coherent)
dma_free_coherent(dmab->dev.dev, size << PAGE_SHIFT,
page_address(sgbuf->pages[i]),
sgbuf->addrs[i] & PAGE_MASK);
else
do_free_pages(page_address(sgbuf->pages[i]),
size << PAGE_SHIFT, false);
i += size;
}
}
kvfree(sgbuf->pages);
kvfree(sgbuf->addrs);
kfree(sgbuf);
}

Expand All @@ -738,24 +756,36 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size)
struct snd_dma_sg_fallback *sgbuf;
struct page **pagep, *curp;
size_t chunk, npages;
dma_addr_t *addrp;
dma_addr_t addr;
void *p;
bool wc = dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;

/* correct the type */
if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_SG)
dmab->dev.type = SNDRV_DMA_TYPE_DEV_SG_FALLBACK;
else if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG)
dmab->dev.type = SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK;

sgbuf = kzalloc(sizeof(*sgbuf), GFP_KERNEL);
if (!sgbuf)
return NULL;
sgbuf->use_dma_alloc_coherent = cpu_feature_enabled(X86_FEATURE_XENPV);
size = PAGE_ALIGN(size);
sgbuf->count = size >> PAGE_SHIFT;
sgbuf->pages = kvcalloc(sgbuf->count, sizeof(*sgbuf->pages), GFP_KERNEL);
if (!sgbuf->pages)
sgbuf->addrs = kvcalloc(sgbuf->count, sizeof(*sgbuf->addrs), GFP_KERNEL);
if (!sgbuf->pages || !sgbuf->addrs)
goto error;

pagep = sgbuf->pages;
chunk = size;
addrp = sgbuf->addrs;
chunk = (PAGE_SIZE - 1) << PAGE_SHIFT; /* to fit in low bits in addrs */
while (size > 0) {
chunk = min(size, chunk);
p = do_alloc_pages(dmab->dev.dev, chunk, &addr, wc);
if (sgbuf->use_dma_alloc_coherent)
p = dma_alloc_coherent(dmab->dev.dev, chunk, &addr, DEFAULT_GFP);
else
p = do_alloc_pages(dmab->dev.dev, chunk, &addr, false);
if (!p) {
if (chunk <= PAGE_SIZE)
goto error;
Expand All @@ -767,17 +797,25 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size)
size -= chunk;
/* fill pages */
npages = chunk >> PAGE_SHIFT;
*addrp = npages; /* store in lower bits */
curp = virt_to_page(p);
while (npages--)
while (npages--) {
*pagep++ = curp++;
*addrp++ |= addr;
addr += PAGE_SIZE;
}
}

p = vmap(sgbuf->pages, sgbuf->count, VM_MAP, PAGE_KERNEL);
if (!p)
goto error;

if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK)
set_pages_array_wc(sgbuf->pages, sgbuf->count);

dmab->private_data = sgbuf;
/* store the first page address for convenience */
dmab->addr = snd_sgbuf_get_addr(dmab, 0);
dmab->addr = sgbuf->addrs[0] & PAGE_MASK;
return p;

error:
Expand All @@ -787,10 +825,23 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size)

static void snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab)
{
struct snd_dma_sg_fallback *sgbuf = dmab->private_data;

if (dmab->dev.type == SNDRV_DMA_TYPE_DEV_WC_SG_FALLBACK)
set_pages_array_wb(sgbuf->pages, sgbuf->count);
vunmap(dmab->area);
__snd_dma_sg_fallback_free(dmab, dmab->private_data);
}

static dma_addr_t snd_dma_sg_fallback_get_addr(struct snd_dma_buffer *dmab,
size_t offset)
{
struct snd_dma_sg_fallback *sgbuf = dmab->private_data;
size_t index = offset >> PAGE_SHIFT;

return (sgbuf->addrs[index] & PAGE_MASK) | (offset & ~PAGE_MASK);
}

static int snd_dma_sg_fallback_mmap(struct snd_dma_buffer *dmab,
struct vm_area_struct *area)
{
Expand All @@ -805,8 +856,8 @@ static const struct snd_malloc_ops snd_dma_sg_fallback_ops = {
.alloc = snd_dma_sg_fallback_alloc,
.free = snd_dma_sg_fallback_free,
.mmap = snd_dma_sg_fallback_mmap,
.get_addr = snd_dma_sg_fallback_get_addr,
/* reuse vmalloc helpers */
.get_addr = snd_dma_vmalloc_get_addr,
.get_page = snd_dma_vmalloc_get_page,
.get_chunk_size = snd_dma_vmalloc_get_chunk_size,
};
Expand Down
4 changes: 4 additions & 0 deletions sound/firewire/motu/motu-hwdep.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ static long hwdep_read(struct snd_hwdep *hwdep, char __user *buf, long count,
return -EFAULT;

count = consumed;
} else {
spin_unlock_irq(&motu->lock);

count = 0;
}

return count;
Expand Down
2 changes: 2 additions & 0 deletions sound/pci/hda/hda_bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ static int hda_codec_driver_probe(struct device *dev)

error:
snd_hda_codec_cleanup_for_unbind(codec);
codec->preset = NULL;
return err;
}

Expand All @@ -166,6 +167,7 @@ static int hda_codec_driver_remove(struct device *dev)
if (codec->patch_ops.free)
codec->patch_ops.free(codec);
snd_hda_codec_cleanup_for_unbind(codec);
codec->preset = NULL;
module_put(dev->driver->owner);
return 0;
}
Expand Down
1 change: 0 additions & 1 deletion sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,6 @@ void snd_hda_codec_cleanup_for_unbind(struct hda_codec *codec)
snd_array_free(&codec->cvt_setups);
snd_array_free(&codec->spdif_out);
snd_array_free(&codec->verbs);
codec->preset = NULL;
codec->follower_dig_outs = NULL;
codec->spdif_status_reset = 0;
snd_array_free(&codec->mixers);
Expand Down
2 changes: 2 additions & 0 deletions sound/pci/hda/patch_realtek.c
Original file line number Diff line number Diff line change
Expand Up @@ -9202,6 +9202,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x1025, 0x142b, "Acer Swift SF314-42", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1025, 0x1430, "Acer TravelMate B311R-31", ALC256_FIXUP_ACER_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1025, 0x1466, "Acer Aspire A515-56", ALC255_FIXUP_ACER_HEADPHONE_AND_MIC),
SND_PCI_QUIRK(0x1025, 0x1534, "Acer Predator PH315-54", ALC255_FIXUP_ACER_MIC_NO_PRESENCE),
SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
SND_PCI_QUIRK(0x1028, 0x053c, "Dell Latitude E5430", ALC292_FIXUP_DELL_E7X),
SND_PCI_QUIRK(0x1028, 0x054b, "Dell XPS one 2710", ALC275_FIXUP_DELL_XPS),
Expand Down Expand Up @@ -9432,6 +9433,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
SND_PCI_QUIRK(0x103c, 0x8ad2, "HP EliteBook 860 16 inch G9 Notebook PC", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x8b5d, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
SND_PCI_QUIRK(0x103c, 0x8b5e, "HP", ALC236_FIXUP_HP_MUTE_LED_MICMUTE_VREF),
SND_PCI_QUIRK(0x103c, 0x8b92, "HP", ALC245_FIXUP_CS35L41_SPI_2_HP_GPIO_LED),
SND_PCI_QUIRK(0x103c, 0x8bf0, "HP", ALC236_FIXUP_HP_GPIO_LED),
SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
Expand Down
3 changes: 3 additions & 0 deletions sound/pci/hda/patch_via.c
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,9 @@ static int add_secret_dac_path(struct hda_codec *codec)
return 0;
nums = snd_hda_get_connections(codec, spec->gen.mixer_nid, conn,
ARRAY_SIZE(conn) - 1);
if (nums < 0)
return nums;

for (i = 0; i < nums; i++) {
if (get_wcaps_type(get_wcaps(codec, conn[i])) == AC_WID_AUD_OUT)
return 0;
Expand Down
6 changes: 4 additions & 2 deletions sound/soc/amd/acp-es8336.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,9 +198,11 @@ static int st_es8336_late_probe(struct snd_soc_card *card)
int ret;

adev = acpi_dev_get_first_match_dev("ESSX8336", NULL, -1);
if (adev)
put_device(&adev->dev);
if (!adev)
return -ENODEV;

codec_dev = acpi_get_first_physical_node(adev);
acpi_dev_put(adev);
if (!codec_dev)
dev_err(card->dev, "can not find codec dev\n");

Expand Down
21 changes: 21 additions & 0 deletions sound/soc/amd/yc/acp6x-mach.c
Original file line number Diff line number Diff line change
Expand Up @@ -227,13 +227,34 @@ static const struct dmi_system_id yc_acp_quirk_table[] = {
DMI_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 14 2022"),
}
},
{
.driver_data = &acp6x_card,
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "TIMI"),
DMI_MATCH(DMI_PRODUCT_NAME, "Redmi Book Pro 15 2022"),
}
},
{
.driver_data = &acp6x_card,
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "Razer"),
DMI_MATCH(DMI_PRODUCT_NAME, "Blade 14 (2022) - RZ09-0427"),
}
},
{
.driver_data = &acp6x_card,
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "RB"),
DMI_MATCH(DMI_PRODUCT_NAME, "Swift SFA16-41"),
}
},
{
.driver_data = &acp6x_card,
.matches = {
DMI_MATCH(DMI_BOARD_VENDOR, "IRBIS"),
DMI_MATCH(DMI_PRODUCT_NAME, "15NBC1011"),
}
},
{}
};

Expand Down
6 changes: 0 additions & 6 deletions sound/soc/codecs/cs42l56.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,18 +1191,12 @@ static int cs42l56_i2c_probe(struct i2c_client *i2c_client)
if (pdata) {
cs42l56->pdata = *pdata;
} else {
pdata = devm_kzalloc(&i2c_client->dev, sizeof(*pdata),
GFP_KERNEL);
if (!pdata)
return -ENOMEM;

if (i2c_client->dev.of_node) {
ret = cs42l56_handle_of_data(i2c_client,
&cs42l56->pdata);
if (ret != 0)
return ret;
}
cs42l56->pdata = *pdata;
}

if (cs42l56->pdata.gpio_nreset) {
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/codecs/wsa883x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1359,8 +1359,8 @@ static struct snd_soc_dai_driver wsa883x_dais[] = {
.stream_name = "SPKR Playback",
.rates = WSA883X_RATES | WSA883X_FRAC_RATES,
.formats = WSA883X_FORMATS,
.rate_max = 8000,
.rate_min = 352800,
.rate_min = 8000,
.rate_max = 352800,
.channels_min = 1,
.channels_max = 1,
},
Expand Down
24 changes: 24 additions & 0 deletions sound/soc/intel/avs/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,29 @@ static int avs_pci_probe(struct pci_dev *pci, const struct pci_device_id *id)
return ret;
}

static void avs_pci_shutdown(struct pci_dev *pci)
{
struct hdac_bus *bus = pci_get_drvdata(pci);
struct avs_dev *adev = hdac_to_avs(bus);

cancel_work_sync(&adev->probe_work);
avs_ipc_block(adev->ipc);

snd_hdac_stop_streams(bus);
avs_dsp_op(adev, int_control, false);
snd_hdac_ext_bus_ppcap_int_enable(bus, false);
snd_hdac_ext_bus_link_power_down_all(bus);

snd_hdac_bus_stop_chip(bus);
snd_hdac_display_power(bus, HDA_CODEC_IDX_CONTROLLER, false);

if (avs_platattr_test(adev, CLDMA))
pci_free_irq(pci, 0, &code_loader);
pci_free_irq(pci, 0, adev);
pci_free_irq(pci, 0, bus);
pci_free_irq_vectors(pci);
}

static void avs_pci_remove(struct pci_dev *pci)
{
struct hdac_device *hdev, *save;
Expand Down Expand Up @@ -739,6 +762,7 @@ static struct pci_driver avs_pci_driver = {
.id_table = avs_ids,
.probe = avs_pci_probe,
.remove = avs_pci_remove,
.shutdown = avs_pci_shutdown,
.driver = {
.pm = &avs_dev_pm,
},
Expand Down
Loading

0 comments on commit ce18d3a

Please sign in to comment.