Skip to content

Commit a587601

Browse files
committed
Merge tag 'asoc-v6.2-2' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into for-next
ASoC: Updates for v6.2 A few more updates for v6.2 which can hopefully go into a later pull request, the bulk of these are fixes, minor cleanups or new board quirks - the one big bit that isn't is support for getting diagnostic data out of the Intel AVS firmwares.
2 parents 4bf5bf5 + e85b1f5 commit a587601

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1381
-600
lines changed

Documentation/devicetree/bindings/sound/fsl,sai.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ properties:
3838
- fsl,imx8mq-sai
3939
- fsl,imx8qm-sai
4040
- fsl,imx8ulp-sai
41+
- fsl,imx93-sai
4142
- fsl,vf610-sai
4243

4344
reg:

include/sound/hdaudio_ext.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ struct hdac_ext_stream *snd_hdac_ext_stream_assign(struct hdac_bus *bus,
7575
struct snd_pcm_substream *substream,
7676
int type);
7777
void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type);
78+
struct hdac_ext_stream *snd_hdac_ext_cstream_assign(struct hdac_bus *bus,
79+
struct snd_compr_stream *cstream);
7880
void snd_hdac_ext_stream_decouple_locked(struct hdac_bus *bus,
7981
struct hdac_ext_stream *hext_stream, bool decouple);
8082
void snd_hdac_ext_stream_decouple(struct hdac_bus *bus,

sound/hda/ext/hdac_ext_stream.c

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <sound/pcm.h>
1515
#include <sound/hda_register.h>
1616
#include <sound/hdaudio_ext.h>
17+
#include <sound/compress_driver.h>
1718

1819
/**
1920
* snd_hdac_ext_stream_init - initialize each stream (aka device)
@@ -367,3 +368,43 @@ void snd_hdac_ext_stream_release(struct hdac_ext_stream *hext_stream, int type)
367368

368369
}
369370
EXPORT_SYMBOL_GPL(snd_hdac_ext_stream_release);
371+
372+
/**
373+
* snd_hdac_ext_cstream_assign - assign a host stream for compress
374+
* @bus: HD-audio core bus
375+
* @cstream: Compress stream to assign
376+
*
377+
* Assign an unused host stream for the given compress stream.
378+
* If no stream is free, NULL is returned. Stream is decoupled
379+
* before assignment.
380+
*/
381+
struct hdac_ext_stream *snd_hdac_ext_cstream_assign(struct hdac_bus *bus,
382+
struct snd_compr_stream *cstream)
383+
{
384+
struct hdac_ext_stream *res = NULL;
385+
struct hdac_stream *hstream;
386+
387+
spin_lock_irq(&bus->reg_lock);
388+
list_for_each_entry(hstream, &bus->stream_list, list) {
389+
struct hdac_ext_stream *hext_stream = stream_to_hdac_ext_stream(hstream);
390+
391+
if (hstream->direction != cstream->direction)
392+
continue;
393+
394+
if (!hstream->opened) {
395+
res = hext_stream;
396+
break;
397+
}
398+
}
399+
400+
if (res) {
401+
snd_hdac_ext_stream_decouple_locked(bus, res, true);
402+
res->hstream.opened = 1;
403+
res->hstream.running = 0;
404+
res->hstream.cstream = cstream;
405+
}
406+
spin_unlock_irq(&bus->reg_lock);
407+
408+
return res;
409+
}
410+
EXPORT_SYMBOL_GPL(snd_hdac_ext_cstream_assign);

sound/hda/hdac_controller.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,8 @@ int snd_hdac_bus_handle_stream_irq(struct hdac_bus *bus, unsigned int status,
578578
sd_status = snd_hdac_stream_readb(azx_dev, SD_STS);
579579
snd_hdac_stream_writeb(azx_dev, SD_STS, SD_INT_MASK);
580580
handled |= 1 << azx_dev->index;
581-
if (!azx_dev->substream || !azx_dev->running ||
582-
!(sd_status & SD_INT_COMPLETE))
581+
if ((!azx_dev->substream && !azx_dev->cstream) ||
582+
!azx_dev->running || !(sd_status & SD_INT_COMPLETE))
583583
continue;
584584
if (ack)
585585
ack(bus, azx_dev);

sound/hda/hdac_stream.c

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#include <linux/delay.h>
88
#include <linux/export.h>
99
#include <linux/clocksource.h>
10+
#include <sound/compress_driver.h>
1011
#include <sound/core.h>
1112
#include <sound/pcm.h>
1213
#include <sound/hdaudio.h>
@@ -487,11 +488,20 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
487488
{
488489
struct hdac_bus *bus = azx_dev->bus;
489490
struct snd_pcm_substream *substream = azx_dev->substream;
490-
struct snd_pcm_runtime *runtime = substream->runtime;
491+
struct snd_compr_stream *cstream = azx_dev->cstream;
492+
struct snd_pcm_runtime *runtime = NULL;
493+
struct snd_dma_buffer *dmab;
491494
__le32 *bdl;
492495
int i, ofs, periods, period_bytes;
493496
int pos_adj, pos_align;
494497

498+
if (substream) {
499+
runtime = substream->runtime;
500+
dmab = snd_pcm_get_dma_buf(substream);
501+
} else if (cstream) {
502+
dmab = snd_pcm_get_dma_buf(cstream);
503+
}
504+
495505
/* reset BDL address */
496506
snd_hdac_stream_writel(azx_dev, SD_BDLPL, 0);
497507
snd_hdac_stream_writel(azx_dev, SD_BDLPU, 0);
@@ -505,7 +515,7 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
505515
azx_dev->frags = 0;
506516

507517
pos_adj = bus->bdl_pos_adj;
508-
if (!azx_dev->no_period_wakeup && pos_adj > 0) {
518+
if (runtime && !azx_dev->no_period_wakeup && pos_adj > 0) {
509519
pos_align = pos_adj;
510520
pos_adj = DIV_ROUND_UP(pos_adj * runtime->rate, 48000);
511521
if (!pos_adj)
@@ -518,8 +528,7 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
518528
pos_adj);
519529
pos_adj = 0;
520530
} else {
521-
ofs = setup_bdle(bus, snd_pcm_get_dma_buf(substream),
522-
azx_dev,
531+
ofs = setup_bdle(bus, dmab, azx_dev,
523532
&bdl, ofs, pos_adj, true);
524533
if (ofs < 0)
525534
goto error;
@@ -529,13 +538,11 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
529538

530539
for (i = 0; i < periods; i++) {
531540
if (i == periods - 1 && pos_adj)
532-
ofs = setup_bdle(bus, snd_pcm_get_dma_buf(substream),
533-
azx_dev, &bdl, ofs,
534-
period_bytes - pos_adj, 0);
541+
ofs = setup_bdle(bus, dmab, azx_dev,
542+
&bdl, ofs, period_bytes - pos_adj, 0);
535543
else
536-
ofs = setup_bdle(bus, snd_pcm_get_dma_buf(substream),
537-
azx_dev, &bdl, ofs,
538-
period_bytes,
544+
ofs = setup_bdle(bus, dmab, azx_dev,
545+
&bdl, ofs, period_bytes,
539546
!azx_dev->no_period_wakeup);
540547
if (ofs < 0)
541548
goto error;
@@ -560,26 +567,32 @@ EXPORT_SYMBOL_GPL(snd_hdac_stream_setup_periods);
560567
int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
561568
unsigned int format_val)
562569
{
563-
564-
unsigned int bufsize, period_bytes;
565570
struct snd_pcm_substream *substream = azx_dev->substream;
566-
struct snd_pcm_runtime *runtime;
571+
struct snd_compr_stream *cstream = azx_dev->cstream;
572+
unsigned int bufsize, period_bytes;
573+
unsigned int no_period_wakeup;
567574
int err;
568575

569-
if (!substream)
576+
if (substream) {
577+
bufsize = snd_pcm_lib_buffer_bytes(substream);
578+
period_bytes = snd_pcm_lib_period_bytes(substream);
579+
no_period_wakeup = substream->runtime->no_period_wakeup;
580+
} else if (cstream) {
581+
bufsize = cstream->runtime->buffer_size;
582+
period_bytes = cstream->runtime->fragment_size;
583+
no_period_wakeup = 0;
584+
} else {
570585
return -EINVAL;
571-
runtime = substream->runtime;
572-
bufsize = snd_pcm_lib_buffer_bytes(substream);
573-
period_bytes = snd_pcm_lib_period_bytes(substream);
586+
}
574587

575588
if (bufsize != azx_dev->bufsize ||
576589
period_bytes != azx_dev->period_bytes ||
577590
format_val != azx_dev->format_val ||
578-
runtime->no_period_wakeup != azx_dev->no_period_wakeup) {
591+
no_period_wakeup != azx_dev->no_period_wakeup) {
579592
azx_dev->bufsize = bufsize;
580593
azx_dev->period_bytes = period_bytes;
581594
azx_dev->format_val = format_val;
582-
azx_dev->no_period_wakeup = runtime->no_period_wakeup;
595+
azx_dev->no_period_wakeup = no_period_wakeup;
583596
err = snd_hdac_stream_setup_periods(azx_dev);
584597
if (err < 0)
585598
return err;

sound/soc/codecs/wcd-clsh-v2.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,6 @@ static inline void wcd_enable_clsh_block(struct wcd_clsh_ctrl *ctrl,
130130
ctrl->clsh_users = 0;
131131
}
132132

133-
static inline bool wcd_clsh_enable_status(struct snd_soc_component *comp)
134-
{
135-
return snd_soc_component_read(comp, WCD9XXX_A_CDC_CLSH_CRC) &
136-
WCD9XXX_A_CDC_CLSH_CRC_CLK_EN_MASK;
137-
}
138-
139133
static inline void wcd_clsh_set_buck_mode(struct snd_soc_component *comp,
140134
int mode)
141135
{

sound/soc/fsl/imx-audmux.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ static ssize_t audmux_read_file(struct file *file, char __user *user_buf,
7575
if (!buf)
7676
return -ENOMEM;
7777

78-
ret = scnprintf(buf, PAGE_SIZE, "PDCR: %08x\nPTCR: %08x\n",
79-
pdcr, ptcr);
78+
ret = sysfs_emit(buf, "PDCR: %08x\nPTCR: %08x\n", pdcr, ptcr);
8079

8180
if (ptcr & IMX_AUDMUX_V2_PTCR_TFSDIR)
8281
ret += scnprintf(buf + ret, PAGE_SIZE - ret,

sound/soc/generic/audio-graph-card.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,8 +485,10 @@ static int __graph_for_each_link(struct asoc_simple_priv *priv,
485485
of_node_put(codec_ep);
486486
of_node_put(codec_port);
487487

488-
if (ret < 0)
488+
if (ret < 0) {
489+
of_node_put(cpu_ep);
489490
return ret;
491+
}
490492

491493
codec_port_old = codec_port;
492494
}

sound/soc/intel/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ config SND_SOC_INTEL_AVS
217217
select SND_SOC_ACPI if ACPI
218218
select SND_SOC_TOPOLOGY
219219
select SND_SOC_HDA
220+
select SND_SOC_COMPRESS if DEBUG_FS
220221
select SND_HDA_EXT_CORE
221222
select SND_HDA_DSP_LOADER
222223
select SND_INTEL_DSP_CONFIG

sound/soc/intel/avs/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ snd-soc-avs-objs += trace.o
99
# tell define_trace.h where to find the trace header
1010
CFLAGS_trace.o := -I$(src)
1111

12+
ifneq ($(CONFIG_DEBUG_FS),)
13+
snd-soc-avs-objs += probes.o debugfs.o
14+
endif
15+
1216
obj-$(CONFIG_SND_SOC_INTEL_AVS) += snd-soc-avs.o
1317

1418
# Machine support

0 commit comments

Comments
 (0)