Skip to content

Commit a27405b

Browse files
committed
Merge tag 'sound-6.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull more sound updates from Takashi Iwai: "A few more updates for 6.2: most of changes are about ASoC device-specific fixes. - Lots of ASoC Intel AVS extensions and refactoring - Quirks for ASoC Intel SOF as well as regression fixes - ASoC Mediatek and Rockchip fixes - Intel HD-audio HDMI workarounds - Usual HD- and USB-audio device-specific quirks" * tag 'sound-6.2-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (54 commits) ALSA: usb-audio: Add new quirk FIXED_RATE for JBL Quantum810 Wireless ALSA: azt3328: Remove the unused function snd_azf3328_codec_outl() ASoC: lochnagar: Fix unused lochnagar_of_match warning ASoC: Intel: Add HP Stream 8 to bytcr_rt5640.c ASoC: SOF: mediatek: initialize panic_info to zero ASoC: rt5670: Remove unbalanced pm_runtime_put() ASoC: Intel: bytcr_rt5640: Add quirk for the Advantech MICA-071 tablet ASoC: Intel: soc-acpi: update codec addr on 0C11/0C4F product ASoC: rockchip: spdif: Add missing clk_disable_unprepare() in rk_spdif_runtime_resume() ASoC: wm8994: Fix potential deadlock ASoC: mediatek: mt8195: add sof be ops to check audio active ASoC: SOF: Revert: "core: unregister clients and machine drivers in .shutdown" ASoC: SOF: Intel: pci-tgl: unblock S5 entry if DMA stop has failed" ALSA: hda/hdmi: fix stream-id config keep-alive for rt suspend ALSA: hda/hdmi: set default audio parameters for KAE silent-stream ALSA: hda/hdmi: fix i915 silent stream programming flow ALSA: hda: Error out if invalid stream is being setup ASoC: dt-bindings: fsl-sai: Reinstate i.MX93 SAI compatible string ASoC: soc-pcm.c: Clear DAIs parameters after stream_active is updated ASoC: codecs: wcd-clsh: Remove the unused function ...
2 parents 55c7d6a + 6bf5f9a commit a27405b

Some content is hidden

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

71 files changed

+1731
-640
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/hda_codec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,7 @@ struct hda_codec {
258258
unsigned int link_down_at_suspend:1; /* link down at runtime suspend */
259259
unsigned int relaxed_resume:1; /* don't resume forcibly for jack */
260260
unsigned int forced_resume:1; /* forced resume for jack */
261+
unsigned int no_stream_clean_at_suspend:1; /* do not clean streams at suspend */
261262

262263
#ifdef CONFIG_PM
263264
unsigned long power_on_acct;

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: 35 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,23 @@ 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+
} else {
504+
WARN(1, "No substream or cstream assigned\n");
505+
return -EINVAL;
506+
}
507+
495508
/* reset BDL address */
496509
snd_hdac_stream_writel(azx_dev, SD_BDLPL, 0);
497510
snd_hdac_stream_writel(azx_dev, SD_BDLPU, 0);
@@ -505,7 +518,7 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
505518
azx_dev->frags = 0;
506519

507520
pos_adj = bus->bdl_pos_adj;
508-
if (!azx_dev->no_period_wakeup && pos_adj > 0) {
521+
if (runtime && !azx_dev->no_period_wakeup && pos_adj > 0) {
509522
pos_align = pos_adj;
510523
pos_adj = DIV_ROUND_UP(pos_adj * runtime->rate, 48000);
511524
if (!pos_adj)
@@ -518,8 +531,7 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
518531
pos_adj);
519532
pos_adj = 0;
520533
} else {
521-
ofs = setup_bdle(bus, snd_pcm_get_dma_buf(substream),
522-
azx_dev,
534+
ofs = setup_bdle(bus, dmab, azx_dev,
523535
&bdl, ofs, pos_adj, true);
524536
if (ofs < 0)
525537
goto error;
@@ -529,13 +541,11 @@ int snd_hdac_stream_setup_periods(struct hdac_stream *azx_dev)
529541

530542
for (i = 0; i < periods; i++) {
531543
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);
544+
ofs = setup_bdle(bus, dmab, azx_dev,
545+
&bdl, ofs, period_bytes - pos_adj, 0);
535546
else
536-
ofs = setup_bdle(bus, snd_pcm_get_dma_buf(substream),
537-
azx_dev, &bdl, ofs,
538-
period_bytes,
547+
ofs = setup_bdle(bus, dmab, azx_dev,
548+
&bdl, ofs, period_bytes,
539549
!azx_dev->no_period_wakeup);
540550
if (ofs < 0)
541551
goto error;
@@ -560,26 +570,32 @@ EXPORT_SYMBOL_GPL(snd_hdac_stream_setup_periods);
560570
int snd_hdac_stream_set_params(struct hdac_stream *azx_dev,
561571
unsigned int format_val)
562572
{
563-
564-
unsigned int bufsize, period_bytes;
565573
struct snd_pcm_substream *substream = azx_dev->substream;
566-
struct snd_pcm_runtime *runtime;
574+
struct snd_compr_stream *cstream = azx_dev->cstream;
575+
unsigned int bufsize, period_bytes;
576+
unsigned int no_period_wakeup;
567577
int err;
568578

569-
if (!substream)
579+
if (substream) {
580+
bufsize = snd_pcm_lib_buffer_bytes(substream);
581+
period_bytes = snd_pcm_lib_period_bytes(substream);
582+
no_period_wakeup = substream->runtime->no_period_wakeup;
583+
} else if (cstream) {
584+
bufsize = cstream->runtime->buffer_size;
585+
period_bytes = cstream->runtime->fragment_size;
586+
no_period_wakeup = 0;
587+
} else {
570588
return -EINVAL;
571-
runtime = substream->runtime;
572-
bufsize = snd_pcm_lib_buffer_bytes(substream);
573-
period_bytes = snd_pcm_lib_period_bytes(substream);
589+
}
574590

575591
if (bufsize != azx_dev->bufsize ||
576592
period_bytes != azx_dev->period_bytes ||
577593
format_val != azx_dev->format_val ||
578-
runtime->no_period_wakeup != azx_dev->no_period_wakeup) {
594+
no_period_wakeup != azx_dev->no_period_wakeup) {
579595
azx_dev->bufsize = bufsize;
580596
azx_dev->period_bytes = period_bytes;
581597
azx_dev->format_val = format_val;
582-
azx_dev->no_period_wakeup = runtime->no_period_wakeup;
598+
azx_dev->no_period_wakeup = no_period_wakeup;
583599
err = snd_hdac_stream_setup_periods(azx_dev);
584600
if (err < 0)
585601
return err;

sound/pci/azt3328.c

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -363,15 +363,6 @@ snd_azf3328_codec_inw(const struct snd_azf3328_codec_data *codec, unsigned reg)
363363
return inw(codec->io_base + reg);
364364
}
365365

366-
static inline void
367-
snd_azf3328_codec_outl(const struct snd_azf3328_codec_data *codec,
368-
unsigned reg,
369-
u32 value
370-
)
371-
{
372-
outl(value, codec->io_base + reg);
373-
}
374-
375366
static inline void
376367
snd_azf3328_codec_outl_multi(const struct snd_azf3328_codec_data *codec,
377368
unsigned reg, const void *buffer, int count

sound/pci/hda/hda_codec.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2886,7 +2886,8 @@ static unsigned int hda_call_codec_suspend(struct hda_codec *codec)
28862886
snd_hdac_enter_pm(&codec->core);
28872887
if (codec->patch_ops.suspend)
28882888
codec->patch_ops.suspend(codec);
2889-
hda_cleanup_all_streams(codec);
2889+
if (!codec->no_stream_clean_at_suspend)
2890+
hda_cleanup_all_streams(codec);
28902891
state = hda_set_power_state(codec, AC_PWRST_D3);
28912892
update_power_acct(codec, true);
28922893
snd_hdac_leave_pm(&codec->core);

sound/pci/hda/patch_hdmi.c

Lines changed: 117 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1738,6 +1738,7 @@ static void silent_stream_enable(struct hda_codec *codec,
17381738

17391739
switch (spec->silent_stream_type) {
17401740
case SILENT_STREAM_KAE:
1741+
silent_stream_enable_i915(codec, per_pin);
17411742
silent_stream_set_kae(codec, per_pin, true);
17421743
break;
17431744
case SILENT_STREAM_I915:
@@ -1975,6 +1976,7 @@ static int hdmi_add_cvt(struct hda_codec *codec, hda_nid_t cvt_nid)
19751976
static const struct snd_pci_quirk force_connect_list[] = {
19761977
SND_PCI_QUIRK(0x103c, 0x870f, "HP", 1),
19771978
SND_PCI_QUIRK(0x103c, 0x871a, "HP", 1),
1979+
SND_PCI_QUIRK(0x103c, 0x8711, "HP", 1),
19781980
SND_PCI_QUIRK(0x1462, 0xec94, "MS-7C94", 1),
19791981
SND_PCI_QUIRK(0x8086, 0x2081, "Intel NUC 10", 1),
19801982
{}
@@ -2878,9 +2880,33 @@ static int i915_hsw_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
28782880
hda_nid_t pin_nid, int dev_id, u32 stream_tag,
28792881
int format)
28802882
{
2883+
struct hdmi_spec *spec = codec->spec;
2884+
int pin_idx = pin_id_to_pin_index(codec, pin_nid, dev_id);
2885+
struct hdmi_spec_per_pin *per_pin;
2886+
int res;
2887+
2888+
if (pin_idx < 0)
2889+
per_pin = NULL;
2890+
else
2891+
per_pin = get_pin(spec, pin_idx);
2892+
28812893
haswell_verify_D0(codec, cvt_nid, pin_nid);
2882-
return hdmi_setup_stream(codec, cvt_nid, pin_nid, dev_id,
2883-
stream_tag, format);
2894+
2895+
if (spec->silent_stream_type == SILENT_STREAM_KAE && per_pin && per_pin->silent_stream) {
2896+
silent_stream_set_kae(codec, per_pin, false);
2897+
/* wait for pending transfers in codec to clear */
2898+
usleep_range(100, 200);
2899+
}
2900+
2901+
res = hdmi_setup_stream(codec, cvt_nid, pin_nid, dev_id,
2902+
stream_tag, format);
2903+
2904+
if (spec->silent_stream_type == SILENT_STREAM_KAE && per_pin && per_pin->silent_stream) {
2905+
usleep_range(100, 200);
2906+
silent_stream_set_kae(codec, per_pin, true);
2907+
}
2908+
2909+
return res;
28842910
}
28852911

28862912
/* pin_cvt_fixup ops override for HSW+ and VLV+ */
@@ -2900,6 +2926,88 @@ static void i915_pin_cvt_fixup(struct hda_codec *codec,
29002926
}
29012927
}
29022928

2929+
#ifdef CONFIG_PM
2930+
static int i915_adlp_hdmi_suspend(struct hda_codec *codec)
2931+
{
2932+
struct hdmi_spec *spec = codec->spec;
2933+
bool silent_streams = false;
2934+
int pin_idx, res;
2935+
2936+
res = generic_hdmi_suspend(codec);
2937+
2938+
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
2939+
struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
2940+
2941+
if (per_pin->silent_stream) {
2942+
silent_streams = true;
2943+
break;
2944+
}
2945+
}
2946+
2947+
if (silent_streams && spec->silent_stream_type == SILENT_STREAM_KAE) {
2948+
/*
2949+
* stream-id should remain programmed when codec goes
2950+
* to runtime suspend
2951+
*/
2952+
codec->no_stream_clean_at_suspend = 1;
2953+
2954+
/*
2955+
* the system might go to S3, in which case keep-alive
2956+
* must be reprogrammed upon resume
2957+
*/
2958+
codec->forced_resume = 1;
2959+
2960+
codec_dbg(codec, "HDMI: KAE active at suspend\n");
2961+
} else {
2962+
codec->no_stream_clean_at_suspend = 0;
2963+
codec->forced_resume = 0;
2964+
}
2965+
2966+
return res;
2967+
}
2968+
2969+
static int i915_adlp_hdmi_resume(struct hda_codec *codec)
2970+
{
2971+
struct hdmi_spec *spec = codec->spec;
2972+
int pin_idx, res;
2973+
2974+
res = generic_hdmi_resume(codec);
2975+
2976+
/* KAE not programmed at suspend, nothing to do here */
2977+
if (!codec->no_stream_clean_at_suspend)
2978+
return res;
2979+
2980+
for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
2981+
struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
2982+
2983+
/*
2984+
* If system was in suspend with monitor connected,
2985+
* the codec setting may have been lost. Re-enable
2986+
* keep-alive.
2987+
*/
2988+
if (per_pin->silent_stream) {
2989+
unsigned int param;
2990+
2991+
param = snd_hda_codec_read(codec, per_pin->cvt_nid, 0,
2992+
AC_VERB_GET_CONV, 0);
2993+
if (!param) {
2994+
codec_dbg(codec, "HDMI: KAE: restore stream id\n");
2995+
silent_stream_enable_i915(codec, per_pin);
2996+
}
2997+
2998+
param = snd_hda_codec_read(codec, per_pin->cvt_nid, 0,
2999+
AC_VERB_GET_DIGI_CONVERT_1, 0);
3000+
if (!(param & (AC_DIG3_KAE << 16))) {
3001+
codec_dbg(codec, "HDMI: KAE: restore DIG3_KAE\n");
3002+
silent_stream_set_kae(codec, per_pin, true);
3003+
}
3004+
}
3005+
}
3006+
3007+
return res;
3008+
}
3009+
#endif
3010+
29033011
/* precondition and allocation for Intel codecs */
29043012
static int alloc_intel_hdmi(struct hda_codec *codec)
29053013
{
@@ -3030,8 +3138,14 @@ static int patch_i915_adlp_hdmi(struct hda_codec *codec)
30303138
if (!res) {
30313139
spec = codec->spec;
30323140

3033-
if (spec->silent_stream_type)
3141+
if (spec->silent_stream_type) {
30343142
spec->silent_stream_type = SILENT_STREAM_KAE;
3143+
3144+
#ifdef CONFIG_PM
3145+
codec->patch_ops.resume = i915_adlp_hdmi_resume;
3146+
codec->patch_ops.suspend = i915_adlp_hdmi_suspend;
3147+
#endif
3148+
}
30353149
}
30363150

30373151
return res;

0 commit comments

Comments
 (0)