Skip to content

Commit d6ef8b4

Browse files
committed
Merge tag 'sound-6.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "A collection of small fixes. Nothing really stands out, fortunately. - Follow-up fixes for the new compress offload API extension - A few ASoC SOF, AMD and Mediatek quirks and fixes - A regression fix in legacy SH driver cleanup - Fix DMA mapping error handling in the helper code - Fix kselftest dependency" * tag 'sound-6.13-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: ALSA: sh: Fix wrong argument order for copy_from_iter() selftests/alsa: Fix circular dependency involving global-timer ALSA: memalloc: prefer dma_mapping_error() over explicit address checking ALSA: compress_offload: improve file descriptors installation for dma-buf ALSA: compress_offload: use safe list iteration in snd_compr_task_seq() ALSA: compress_offload: avoid 64-bit get_user() ALSA: compress_offload: import DMA_BUF namespace ASoC: mediatek: disable buffer pre-allocation ASoC: rt722: add delay time to wait for the calibration procedure ASoC: SOF: Intel: hda-dai: Do not release the link DMA on STOP ASoC: dt-bindings: realtek,rt5645: Fix CPVDD voltage comment ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21QA and 21QB ASoC: Intel: sof_sdw: Fix DMI match for Lenovo 21Q6 and 21Q7 ASoC: amd: ps: Fix for enabling DMIC on acp63 platform via _DSD entry
2 parents 23db0ed + 8cbd01b commit d6ef8b4

File tree

11 files changed

+88
-31
lines changed

11 files changed

+88
-31
lines changed

Documentation/devicetree/bindings/sound/realtek,rt5645.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ properties:
5151
description: Power supply for AVDD, providing 1.8V.
5252

5353
cpvdd-supply:
54-
description: Power supply for CPVDD, providing 3.5V.
54+
description: Power supply for CPVDD, providing 1.8V.
5555

5656
hp-detect-gpios:
5757
description:

sound/core/compress_offload.c

+21-12
Original file line numberDiff line numberDiff line change
@@ -1025,7 +1025,7 @@ static u64 snd_compr_seqno_next(struct snd_compr_stream *stream)
10251025
static int snd_compr_task_new(struct snd_compr_stream *stream, struct snd_compr_task *utask)
10261026
{
10271027
struct snd_compr_task_runtime *task;
1028-
int retval;
1028+
int retval, fd_i, fd_o;
10291029

10301030
if (stream->runtime->total_tasks >= stream->runtime->fragments)
10311031
return -EBUSY;
@@ -1039,16 +1039,24 @@ static int snd_compr_task_new(struct snd_compr_stream *stream, struct snd_compr_
10391039
retval = stream->ops->task_create(stream, task);
10401040
if (retval < 0)
10411041
goto cleanup;
1042-
utask->input_fd = dma_buf_fd(task->input, O_WRONLY|O_CLOEXEC);
1043-
if (utask->input_fd < 0) {
1044-
retval = utask->input_fd;
1042+
/* similar functionality as in dma_buf_fd(), but ensure that both
1043+
file descriptors are allocated before fd_install() */
1044+
if (!task->input || !task->input->file || !task->output || !task->output->file) {
1045+
retval = -EINVAL;
10451046
goto cleanup;
10461047
}
1047-
utask->output_fd = dma_buf_fd(task->output, O_RDONLY|O_CLOEXEC);
1048-
if (utask->output_fd < 0) {
1049-
retval = utask->output_fd;
1048+
fd_i = get_unused_fd_flags(O_WRONLY|O_CLOEXEC);
1049+
if (fd_i < 0)
1050+
goto cleanup;
1051+
fd_o = get_unused_fd_flags(O_RDONLY|O_CLOEXEC);
1052+
if (fd_o < 0) {
1053+
put_unused_fd(fd_i);
10501054
goto cleanup;
10511055
}
1056+
fd_install(fd_i, task->input->file);
1057+
fd_install(fd_o, task->output->file);
1058+
utask->input_fd = fd_i;
1059+
utask->output_fd = fd_o;
10521060
/* keep dmabuf reference until freed with task free ioctl */
10531061
dma_buf_get(utask->input_fd);
10541062
dma_buf_get(utask->output_fd);
@@ -1174,18 +1182,18 @@ typedef void (*snd_compr_seq_func_t)(struct snd_compr_stream *stream,
11741182
static int snd_compr_task_seq(struct snd_compr_stream *stream, unsigned long arg,
11751183
snd_compr_seq_func_t fcn)
11761184
{
1177-
struct snd_compr_task_runtime *task;
1185+
struct snd_compr_task_runtime *task, *temp;
11781186
__u64 seqno;
11791187
int retval;
11801188

11811189
if (stream->runtime->state != SNDRV_PCM_STATE_SETUP)
11821190
return -EPERM;
1183-
retval = get_user(seqno, (__u64 __user *)arg);
1184-
if (retval < 0)
1185-
return retval;
1191+
retval = copy_from_user(&seqno, (__u64 __user *)arg, sizeof(seqno));
1192+
if (retval)
1193+
return -EFAULT;
11861194
retval = 0;
11871195
if (seqno == 0) {
1188-
list_for_each_entry_reverse(task, &stream->runtime->tasks, list)
1196+
list_for_each_entry_safe_reverse(task, temp, &stream->runtime->tasks, list)
11891197
fcn(stream, task);
11901198
} else {
11911199
task = snd_compr_find_task(stream, seqno);
@@ -1247,6 +1255,7 @@ void snd_compr_task_finished(struct snd_compr_stream *stream,
12471255
}
12481256
EXPORT_SYMBOL_GPL(snd_compr_task_finished);
12491257

1258+
MODULE_IMPORT_NS("DMA_BUF");
12501259
#endif /* CONFIG_SND_COMPRESS_ACCEL */
12511260

12521261
static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)

sound/core/memalloc.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,7 @@ static void *snd_dma_wc_alloc(struct snd_dma_buffer *dmab, size_t size)
505505
if (!p)
506506
return NULL;
507507
dmab->addr = dma_map_single(dmab->dev.dev, p, size, DMA_BIDIRECTIONAL);
508-
if (dmab->addr == DMA_MAPPING_ERROR) {
508+
if (dma_mapping_error(dmab->dev.dev, dmab->addr)) {
509509
do_free_pages(dmab->area, size, true);
510510
return NULL;
511511
}

sound/sh/sh_dac_audio.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ static int snd_sh_dac_pcm_copy(struct snd_pcm_substream *substream,
163163
/* channel is not used (interleaved data) */
164164
struct snd_sh_dac *chip = snd_pcm_substream_chip(substream);
165165

166-
if (copy_from_iter(chip->data_buffer + pos, src, count) != count)
166+
if (copy_from_iter(chip->data_buffer + pos, count, src) != count)
167167
return -EFAULT;
168168
chip->buffer_end = chip->data_buffer + pos + count;
169169

sound/soc/amd/ps/pci-ps.c

+16-1
Original file line numberDiff line numberDiff line change
@@ -375,11 +375,18 @@ static int get_acp63_device_config(struct pci_dev *pci, struct acp63_dev_data *a
375375
{
376376
struct acpi_device *pdm_dev;
377377
const union acpi_object *obj;
378+
acpi_handle handle;
379+
acpi_integer dmic_status;
378380
u32 config;
379381
bool is_dmic_dev = false;
380382
bool is_sdw_dev = false;
383+
bool wov_en, dmic_en;
381384
int ret;
382385

386+
/* IF WOV entry not found, enable dmic based on acp-audio-device-type entry*/
387+
wov_en = true;
388+
dmic_en = false;
389+
383390
config = readl(acp_data->acp63_base + ACP_PIN_CONFIG);
384391
switch (config) {
385392
case ACP_CONFIG_4:
@@ -412,10 +419,18 @@ static int get_acp63_device_config(struct pci_dev *pci, struct acp63_dev_data *a
412419
if (!acpi_dev_get_property(pdm_dev, "acp-audio-device-type",
413420
ACPI_TYPE_INTEGER, &obj) &&
414421
obj->integer.value == ACP_DMIC_DEV)
415-
is_dmic_dev = true;
422+
dmic_en = true;
416423
}
424+
425+
handle = ACPI_HANDLE(&pci->dev);
426+
ret = acpi_evaluate_integer(handle, "_WOV", NULL, &dmic_status);
427+
if (!ACPI_FAILURE(ret))
428+
wov_en = dmic_status;
417429
}
418430

431+
if (dmic_en && wov_en)
432+
is_dmic_dev = true;
433+
419434
if (acp_data->is_sdw_config) {
420435
ret = acp_scan_sdw_devices(&pci->dev, ACP63_SDW_ADDR);
421436
if (!ret && acp_data->info.link_mask)

sound/soc/codecs/rt722-sdca.c

+6-1
Original file line numberDiff line numberDiff line change
@@ -1468,13 +1468,18 @@ static void rt722_sdca_jack_preset(struct rt722_sdca_priv *rt722)
14681468
0x008d);
14691469
/* check HP calibration FSM status */
14701470
for (loop_check = 0; loop_check < chk_cnt; loop_check++) {
1471+
usleep_range(10000, 11000);
14711472
ret = rt722_sdca_index_read(rt722, RT722_VENDOR_CALI,
14721473
RT722_DAC_DC_CALI_CTL3, &calib_status);
1473-
if (ret < 0 || loop_check == chk_cnt)
1474+
if (ret < 0)
14741475
dev_dbg(&rt722->slave->dev, "calibration failed!, ret=%d\n", ret);
14751476
if ((calib_status & 0x0040) == 0x0)
14761477
break;
14771478
}
1479+
1480+
if (loop_check == chk_cnt)
1481+
dev_dbg(&rt722->slave->dev, "%s, calibration time-out!\n", __func__);
1482+
14781483
/* Set ADC09 power entity floating control */
14791484
rt722_sdca_index_write(rt722, RT722_VENDOR_HDA_CTL, RT722_ADC0A_08_PDE_FLOAT_CTL,
14801485
0x2a12);

sound/soc/intel/boards/sof_sdw.c

+20-3
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
632632
.callback = sof_sdw_quirk_cb,
633633
.matches = {
634634
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
635-
DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "233C")
635+
DMI_MATCH(DMI_PRODUCT_NAME, "21QB")
636636
},
637637
/* Note this quirk excludes the CODEC mic */
638638
.driver_data = (void *)(SOC_SDW_CODEC_MIC),
@@ -641,9 +641,26 @@ static const struct dmi_system_id sof_sdw_quirk_table[] = {
641641
.callback = sof_sdw_quirk_cb,
642642
.matches = {
643643
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
644-
DMI_EXACT_MATCH(DMI_PRODUCT_SKU, "233B")
644+
DMI_MATCH(DMI_PRODUCT_NAME, "21QA")
645645
},
646-
.driver_data = (void *)(SOC_SDW_SIDECAR_AMPS),
646+
/* Note this quirk excludes the CODEC mic */
647+
.driver_data = (void *)(SOC_SDW_CODEC_MIC),
648+
},
649+
{
650+
.callback = sof_sdw_quirk_cb,
651+
.matches = {
652+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
653+
DMI_MATCH(DMI_PRODUCT_NAME, "21Q6")
654+
},
655+
.driver_data = (void *)(SOC_SDW_SIDECAR_AMPS | SOC_SDW_CODEC_MIC),
656+
},
657+
{
658+
.callback = sof_sdw_quirk_cb,
659+
.matches = {
660+
DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
661+
DMI_MATCH(DMI_PRODUCT_NAME, "21Q7")
662+
},
663+
.driver_data = (void *)(SOC_SDW_SIDECAR_AMPS | SOC_SDW_CODEC_MIC),
647664
},
648665

649666
/* ArrowLake devices */

sound/soc/mediatek/common/mtk-afe-platform-driver.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,8 @@ int mtk_afe_pcm_new(struct snd_soc_component *component,
120120
struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
121121

122122
size = afe->mtk_afe_hardware->buffer_bytes_max;
123-
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV,
124-
afe->dev, size, size);
123+
snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, afe->dev, 0, size);
124+
125125
return 0;
126126
}
127127
EXPORT_SYMBOL_GPL(mtk_afe_pcm_new);

sound/soc/sof/intel/hda-dai.c

+19-6
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,10 @@ hda_dai_get_ops(struct snd_pcm_substream *substream, struct snd_soc_dai *cpu_dai
103103
return sdai->platform_private;
104104
}
105105

106-
int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_stream *hext_stream,
107-
struct snd_soc_dai *cpu_dai)
106+
static int
107+
hda_link_dma_cleanup(struct snd_pcm_substream *substream,
108+
struct hdac_ext_stream *hext_stream,
109+
struct snd_soc_dai *cpu_dai, bool release)
108110
{
109111
const struct hda_dai_widget_dma_ops *ops = hda_dai_get_ops(substream, cpu_dai);
110112
struct sof_intel_hda_stream *hda_stream;
@@ -128,6 +130,17 @@ int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_st
128130
snd_hdac_ext_bus_link_clear_stream_id(hlink, stream_tag);
129131
}
130132

133+
if (!release) {
134+
/*
135+
* Force stream reconfiguration without releasing the channel on
136+
* subsequent stream restart (without free), including LinkDMA
137+
* reset.
138+
* The stream is released via hda_dai_hw_free()
139+
*/
140+
hext_stream->link_prepared = 0;
141+
return 0;
142+
}
143+
131144
if (ops->release_hext_stream)
132145
ops->release_hext_stream(sdev, cpu_dai, substream);
133146

@@ -211,7 +224,7 @@ static int __maybe_unused hda_dai_hw_free(struct snd_pcm_substream *substream,
211224
if (!hext_stream)
212225
return 0;
213226

214-
return hda_link_dma_cleanup(substream, hext_stream, cpu_dai);
227+
return hda_link_dma_cleanup(substream, hext_stream, cpu_dai, true);
215228
}
216229

217230
static int __maybe_unused hda_dai_hw_params_data(struct snd_pcm_substream *substream,
@@ -304,7 +317,8 @@ static int __maybe_unused hda_dai_trigger(struct snd_pcm_substream *substream, i
304317
switch (cmd) {
305318
case SNDRV_PCM_TRIGGER_STOP:
306319
case SNDRV_PCM_TRIGGER_SUSPEND:
307-
ret = hda_link_dma_cleanup(substream, hext_stream, dai);
320+
ret = hda_link_dma_cleanup(substream, hext_stream, dai,
321+
cmd == SNDRV_PCM_TRIGGER_STOP ? false : true);
308322
if (ret < 0) {
309323
dev_err(sdev->dev, "%s: failed to clean up link DMA\n", __func__);
310324
return ret;
@@ -660,8 +674,7 @@ static int hda_dai_suspend(struct hdac_bus *bus)
660674
}
661675

662676
ret = hda_link_dma_cleanup(hext_stream->link_substream,
663-
hext_stream,
664-
cpu_dai);
677+
hext_stream, cpu_dai, true);
665678
if (ret < 0)
666679
return ret;
667680
}

sound/soc/sof/intel/hda.h

-2
Original file line numberDiff line numberDiff line change
@@ -1038,8 +1038,6 @@ const struct hda_dai_widget_dma_ops *
10381038
hda_select_dai_widget_ops(struct snd_sof_dev *sdev, struct snd_sof_widget *swidget);
10391039
int hda_dai_config(struct snd_soc_dapm_widget *w, unsigned int flags,
10401040
struct snd_sof_dai_config_data *data);
1041-
int hda_link_dma_cleanup(struct snd_pcm_substream *substream, struct hdac_ext_stream *hext_stream,
1042-
struct snd_soc_dai *cpu_dai);
10431041

10441042
static inline struct snd_sof_dev *widget_to_sdev(struct snd_soc_dapm_widget *w)
10451043
{

tools/testing/selftests/alsa/Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ include ../lib.mk
2727
$(OUTPUT)/libatest.so: conf.c alsa-local.h
2828
$(CC) $(CFLAGS) -shared -fPIC $< $(LDLIBS) -o $@
2929

30-
$(OUTPUT)/%: %.c $(TEST_GEN_PROGS_EXTENDED) alsa-local.h
30+
$(OUTPUT)/%: %.c $(OUTPUT)/libatest.so alsa-local.h
3131
$(CC) $(CFLAGS) $< $(LDLIBS) -latest -o $@

0 commit comments

Comments
 (0)