Skip to content

Commit 0a566d4

Browse files
committed
Merge tag 'sound-5.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "A collection of small fixes. The major changes are ASoC core fixes, addressing the DPCM locking issue after the recent code changes and the potentially invalid register accesses via control API. Also, HD-audio got a core fix for Oops at dynamic unbinding. The rest are device-specific small fixes, including the usual stuff like HD-audio and USB-audio quirks" * tag 'sound-5.17-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (31 commits) ALSA: hda: Skip codec shutdown in case the codec is not registered ALSA: usb-audio: Correct quirk for VF0770 ALSA: Replace acpi_bus_get_device() Input: wm97xx: Simplify resource management ALSA: hda/realtek: Add quirk for ASUS GU603 ALSA: hda/realtek: Fix silent output on Gigabyte X570 Aorus Xtreme after reboot from Windows ALSA: hda/realtek: Fix silent output on Gigabyte X570S Aorus Master (newer chipset) ALSA: hda/realtek: Add missing fixup-model entry for Gigabyte X570 ALC1220 quirks ALSA: hda: realtek: Fix race at concurrent COEF updates ASoC: ops: Check for negative values before reading them ASoC: rt5682: Fix deadlock on resume ASoC: hdmi-codec: Fix OOB memory accesses ASoC: soc-pcm: Move debugfs removal out of spinlock ASoC: soc-pcm: Fix DPCM lockdep warning due to nested stream locks ASoC: fsl: Add missing error handling in pcm030_fabric_probe ALSA: hda: Fix signedness of sscanf() arguments ALSA: usb-audio: initialize variables that could ignore errors ALSA: hda: Fix UAF of leds class devs at unbinding ASoC: qdsp6: q6apm-dai: only stop graphs that are started ASoC: codecs: wcd938x: fix return value of mixer put function ...
2 parents 31462d9 + 52517d9 commit 0a566d4

29 files changed

+263
-105
lines changed

drivers/input/touchscreen/wm97xx-core.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -615,10 +615,9 @@ static int wm97xx_register_touch(struct wm97xx *wm)
615615
* extensions)
616616
*/
617617
wm->touch_dev = platform_device_alloc("wm97xx-touch", -1);
618-
if (!wm->touch_dev) {
619-
ret = -ENOMEM;
620-
goto touch_err;
621-
}
618+
if (!wm->touch_dev)
619+
return -ENOMEM;
620+
622621
platform_set_drvdata(wm->touch_dev, wm);
623622
wm->touch_dev->dev.parent = wm->dev;
624623
wm->touch_dev->dev.platform_data = pdata;
@@ -629,18 +628,13 @@ static int wm97xx_register_touch(struct wm97xx *wm)
629628
return 0;
630629
touch_reg_err:
631630
platform_device_put(wm->touch_dev);
632-
touch_err:
633-
input_unregister_device(wm->input_dev);
634-
wm->input_dev = NULL;
635631

636632
return ret;
637633
}
638634

639635
static void wm97xx_unregister_touch(struct wm97xx *wm)
640636
{
641637
platform_device_unregister(wm->touch_dev);
642-
input_unregister_device(wm->input_dev);
643-
wm->input_dev = NULL;
644638
}
645639

646640
static int _wm97xx_probe(struct wm97xx *wm)

include/sound/pcm.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ void snd_pcm_stream_unlock(struct snd_pcm_substream *substream);
617617
void snd_pcm_stream_lock_irq(struct snd_pcm_substream *substream);
618618
void snd_pcm_stream_unlock_irq(struct snd_pcm_substream *substream);
619619
unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
620+
unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream);
620621

621622
/**
622623
* snd_pcm_stream_lock_irqsave - Lock the PCM stream
@@ -635,6 +636,20 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream);
635636
void snd_pcm_stream_unlock_irqrestore(struct snd_pcm_substream *substream,
636637
unsigned long flags);
637638

639+
/**
640+
* snd_pcm_stream_lock_irqsave_nested - Single-nested PCM stream locking
641+
* @substream: PCM substream
642+
* @flags: irq flags
643+
*
644+
* This locks the PCM stream like snd_pcm_stream_lock_irqsave() but with
645+
* the single-depth lockdep subclass.
646+
*/
647+
#define snd_pcm_stream_lock_irqsave_nested(substream, flags) \
648+
do { \
649+
typecheck(unsigned long, flags); \
650+
flags = _snd_pcm_stream_lock_irqsave_nested(substream); \
651+
} while (0)
652+
638653
/**
639654
* snd_pcm_group_for_each_entry - iterate over the linked substreams
640655
* @s: the iterator

include/uapi/sound/asound.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,10 @@
5656
* *
5757
****************************************************************************/
5858

59+
#define AES_IEC958_STATUS_SIZE 24
60+
5961
struct snd_aes_iec958 {
60-
unsigned char status[24]; /* AES/IEC958 channel status bits */
62+
unsigned char status[AES_IEC958_STATUS_SIZE]; /* AES/IEC958 channel status bits */
6163
unsigned char subcode[147]; /* AES/IEC958 subcode bits */
6264
unsigned char pad; /* nothing */
6365
unsigned char dig_subframe[4]; /* AES/IEC958 subframe bits */

sound/core/pcm_native.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,19 @@ unsigned long _snd_pcm_stream_lock_irqsave(struct snd_pcm_substream *substream)
172172
}
173173
EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave);
174174

175+
unsigned long _snd_pcm_stream_lock_irqsave_nested(struct snd_pcm_substream *substream)
176+
{
177+
unsigned long flags = 0;
178+
if (substream->pcm->nonatomic)
179+
mutex_lock_nested(&substream->self_group.mutex,
180+
SINGLE_DEPTH_NESTING);
181+
else
182+
spin_lock_irqsave_nested(&substream->self_group.lock, flags,
183+
SINGLE_DEPTH_NESTING);
184+
return flags;
185+
}
186+
EXPORT_SYMBOL_GPL(_snd_pcm_stream_lock_irqsave_nested);
187+
175188
/**
176189
* snd_pcm_stream_unlock_irqrestore - Unlock the PCM stream
177190
* @substream: PCM substream

sound/hda/intel-sdw-acpi.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,11 +50,11 @@ static bool is_link_enabled(struct fwnode_handle *fw_node, int i)
5050
static int
5151
sdw_intel_scan_controller(struct sdw_intel_acpi_info *info)
5252
{
53-
struct acpi_device *adev;
53+
struct acpi_device *adev = acpi_fetch_acpi_dev(info->handle);
5454
int ret, i;
5555
u8 count;
5656

57-
if (acpi_bus_get_device(info->handle, &adev))
57+
if (!adev)
5858
return -EINVAL;
5959

6060
/* Found controller, find links supported */
@@ -119,15 +119,14 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level,
119119
void *cdata, void **return_value)
120120
{
121121
struct sdw_intel_acpi_info *info = cdata;
122-
struct acpi_device *adev;
123122
acpi_status status;
124123
u64 adr;
125124

126125
status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr);
127126
if (ACPI_FAILURE(status))
128127
return AE_OK; /* keep going */
129128

130-
if (acpi_bus_get_device(handle, &adev)) {
129+
if (!acpi_fetch_acpi_dev(handle)) {
131130
pr_err("%s: Couldn't find ACPI handle\n", __func__);
132131
return AE_NOT_FOUND;
133132
}

sound/pci/hda/hda_auto_parser.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ void snd_hda_pick_fixup(struct hda_codec *codec,
981981
int id = HDA_FIXUP_ID_NOT_SET;
982982
const char *name = NULL;
983983
const char *type = NULL;
984-
int vendor, device;
984+
unsigned int vendor, device;
985985

986986
if (codec->fixup_id != HDA_FIXUP_ID_NOT_SET)
987987
return;

sound/pci/hda/hda_codec.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3000,6 +3000,10 @@ void snd_hda_codec_shutdown(struct hda_codec *codec)
30003000
{
30013001
struct hda_pcm *cpcm;
30023002

3003+
/* Skip the shutdown if codec is not registered */
3004+
if (!codec->registered)
3005+
return;
3006+
30033007
list_for_each_entry(cpcm, &codec->pcm_list_head, list)
30043008
snd_pcm_suspend_all(cpcm->pcm);
30053009

sound/pci/hda/hda_generic.c

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ static void snd_hda_gen_spec_free(struct hda_gen_spec *spec)
9191
free_kctls(spec);
9292
snd_array_free(&spec->paths);
9393
snd_array_free(&spec->loopback_list);
94+
#ifdef CONFIG_SND_HDA_GENERIC_LEDS
95+
if (spec->led_cdevs[LED_AUDIO_MUTE])
96+
led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MUTE]);
97+
if (spec->led_cdevs[LED_AUDIO_MICMUTE])
98+
led_classdev_unregister(spec->led_cdevs[LED_AUDIO_MICMUTE]);
99+
#endif
94100
}
95101

96102
/*
@@ -3922,7 +3928,10 @@ static int create_mute_led_cdev(struct hda_codec *codec,
39223928
enum led_brightness),
39233929
bool micmute)
39243930
{
3931+
struct hda_gen_spec *spec = codec->spec;
39253932
struct led_classdev *cdev;
3933+
int idx = micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE;
3934+
int err;
39263935

39273936
cdev = devm_kzalloc(&codec->core.dev, sizeof(*cdev), GFP_KERNEL);
39283937
if (!cdev)
@@ -3932,10 +3941,14 @@ static int create_mute_led_cdev(struct hda_codec *codec,
39323941
cdev->max_brightness = 1;
39333942
cdev->default_trigger = micmute ? "audio-micmute" : "audio-mute";
39343943
cdev->brightness_set_blocking = callback;
3935-
cdev->brightness = ledtrig_audio_get(micmute ? LED_AUDIO_MICMUTE : LED_AUDIO_MUTE);
3944+
cdev->brightness = ledtrig_audio_get(idx);
39363945
cdev->flags = LED_CORE_SUSPENDRESUME;
39373946

3938-
return devm_led_classdev_register(&codec->core.dev, cdev);
3947+
err = led_classdev_register(&codec->core.dev, cdev);
3948+
if (err < 0)
3949+
return err;
3950+
spec->led_cdevs[idx] = cdev;
3951+
return 0;
39393952
}
39403953

39413954
/**

sound/pci/hda/hda_generic.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,9 @@ struct hda_gen_spec {
294294
struct hda_jack_callback *cb);
295295
void (*mic_autoswitch_hook)(struct hda_codec *codec,
296296
struct hda_jack_callback *cb);
297+
298+
/* leds */
299+
struct led_classdev *led_cdevs[NUM_AUDIO_LEDS];
297300
};
298301

299302
/* values for add_stereo_mix_input flag */

sound/pci/hda/patch_realtek.c

Lines changed: 55 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ struct alc_spec {
9898
unsigned int gpio_mic_led_mask;
9999
struct alc_coef_led mute_led_coef;
100100
struct alc_coef_led mic_led_coef;
101+
struct mutex coef_mutex;
101102

102103
hda_nid_t headset_mic_pin;
103104
hda_nid_t headphone_mic_pin;
@@ -137,8 +138,8 @@ struct alc_spec {
137138
* COEF access helper functions
138139
*/
139140

140-
static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
141-
unsigned int coef_idx)
141+
static int __alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
142+
unsigned int coef_idx)
142143
{
143144
unsigned int val;
144145

@@ -147,28 +148,61 @@ static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
147148
return val;
148149
}
149150

151+
static int alc_read_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
152+
unsigned int coef_idx)
153+
{
154+
struct alc_spec *spec = codec->spec;
155+
unsigned int val;
156+
157+
mutex_lock(&spec->coef_mutex);
158+
val = __alc_read_coefex_idx(codec, nid, coef_idx);
159+
mutex_unlock(&spec->coef_mutex);
160+
return val;
161+
}
162+
150163
#define alc_read_coef_idx(codec, coef_idx) \
151164
alc_read_coefex_idx(codec, 0x20, coef_idx)
152165

153-
static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
154-
unsigned int coef_idx, unsigned int coef_val)
166+
static void __alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
167+
unsigned int coef_idx, unsigned int coef_val)
155168
{
156169
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_COEF_INDEX, coef_idx);
157170
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_PROC_COEF, coef_val);
158171
}
159172

173+
static void alc_write_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
174+
unsigned int coef_idx, unsigned int coef_val)
175+
{
176+
struct alc_spec *spec = codec->spec;
177+
178+
mutex_lock(&spec->coef_mutex);
179+
__alc_write_coefex_idx(codec, nid, coef_idx, coef_val);
180+
mutex_unlock(&spec->coef_mutex);
181+
}
182+
160183
#define alc_write_coef_idx(codec, coef_idx, coef_val) \
161184
alc_write_coefex_idx(codec, 0x20, coef_idx, coef_val)
162185

186+
static void __alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
187+
unsigned int coef_idx, unsigned int mask,
188+
unsigned int bits_set)
189+
{
190+
unsigned int val = __alc_read_coefex_idx(codec, nid, coef_idx);
191+
192+
if (val != -1)
193+
__alc_write_coefex_idx(codec, nid, coef_idx,
194+
(val & ~mask) | bits_set);
195+
}
196+
163197
static void alc_update_coefex_idx(struct hda_codec *codec, hda_nid_t nid,
164198
unsigned int coef_idx, unsigned int mask,
165199
unsigned int bits_set)
166200
{
167-
unsigned int val = alc_read_coefex_idx(codec, nid, coef_idx);
201+
struct alc_spec *spec = codec->spec;
168202

169-
if (val != -1)
170-
alc_write_coefex_idx(codec, nid, coef_idx,
171-
(val & ~mask) | bits_set);
203+
mutex_lock(&spec->coef_mutex);
204+
__alc_update_coefex_idx(codec, nid, coef_idx, mask, bits_set);
205+
mutex_unlock(&spec->coef_mutex);
172206
}
173207

174208
#define alc_update_coef_idx(codec, coef_idx, mask, bits_set) \
@@ -201,13 +235,17 @@ struct coef_fw {
201235
static void alc_process_coef_fw(struct hda_codec *codec,
202236
const struct coef_fw *fw)
203237
{
238+
struct alc_spec *spec = codec->spec;
239+
240+
mutex_lock(&spec->coef_mutex);
204241
for (; fw->nid; fw++) {
205242
if (fw->mask == (unsigned short)-1)
206-
alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
243+
__alc_write_coefex_idx(codec, fw->nid, fw->idx, fw->val);
207244
else
208-
alc_update_coefex_idx(codec, fw->nid, fw->idx,
209-
fw->mask, fw->val);
245+
__alc_update_coefex_idx(codec, fw->nid, fw->idx,
246+
fw->mask, fw->val);
210247
}
248+
mutex_unlock(&spec->coef_mutex);
211249
}
212250

213251
/*
@@ -1153,6 +1191,7 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
11531191
codec->spdif_status_reset = 1;
11541192
codec->forced_resume = 1;
11551193
codec->patch_ops = alc_patch_ops;
1194+
mutex_init(&spec->coef_mutex);
11561195

11571196
err = alc_codec_rename_from_preset(codec);
11581197
if (err < 0) {
@@ -2125,6 +2164,7 @@ static void alc1220_fixup_gb_x570(struct hda_codec *codec,
21252164
{
21262165
static const hda_nid_t conn1[] = { 0x0c };
21272166
static const struct coef_fw gb_x570_coefs[] = {
2167+
WRITE_COEF(0x07, 0x03c0),
21282168
WRITE_COEF(0x1a, 0x01c1),
21292169
WRITE_COEF(0x1b, 0x0202),
21302170
WRITE_COEF(0x43, 0x3005),
@@ -2551,7 +2591,8 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
25512591
SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte EP45-DS3/Z87X-UD3H", ALC889_FIXUP_FRONT_HP_NO_PRESENCE),
25522592
SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
25532593
SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_GB_X570),
2554-
SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_CLEVO_P950),
2594+
SND_PCI_QUIRK(0x1458, 0xa0ce, "Gigabyte X570 Aorus Xtreme", ALC1220_FIXUP_GB_X570),
2595+
SND_PCI_QUIRK(0x1458, 0xa0d5, "Gigabyte X570S Aorus Master", ALC1220_FIXUP_GB_X570),
25552596
SND_PCI_QUIRK(0x1462, 0x11f7, "MSI-GE63", ALC1220_FIXUP_CLEVO_P950),
25562597
SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
25572598
SND_PCI_QUIRK(0x1462, 0x1229, "MSI-GP73", ALC1220_FIXUP_CLEVO_P950),
@@ -2626,6 +2667,7 @@ static const struct hda_model_fixup alc882_fixup_models[] = {
26262667
{.id = ALC882_FIXUP_NO_PRIMARY_HP, .name = "no-primary-hp"},
26272668
{.id = ALC887_FIXUP_ASUS_BASS, .name = "asus-bass"},
26282669
{.id = ALC1220_FIXUP_GB_DUAL_CODECS, .name = "dual-codecs"},
2670+
{.id = ALC1220_FIXUP_GB_X570, .name = "gb-x570"},
26292671
{.id = ALC1220_FIXUP_CLEVO_P950, .name = "clevo-p950"},
26302672
{}
26312673
};
@@ -8969,6 +9011,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
89699011
SND_PCI_QUIRK(0x1043, 0x1e51, "ASUS Zephyrus M15", ALC294_FIXUP_ASUS_GU502_PINS),
89709012
SND_PCI_QUIRK(0x1043, 0x1e8e, "ASUS Zephyrus G15", ALC289_FIXUP_ASUS_GA401),
89719013
SND_PCI_QUIRK(0x1043, 0x1f11, "ASUS Zephyrus G14", ALC289_FIXUP_ASUS_GA401),
9014+
SND_PCI_QUIRK(0x1043, 0x16b2, "ASUS GU603", ALC289_FIXUP_ASUS_GA401),
89729015
SND_PCI_QUIRK(0x1043, 0x3030, "ASUS ZN270IE", ALC256_FIXUP_ASUS_AIO_GPIO2),
89739016
SND_PCI_QUIRK(0x1043, 0x831a, "ASUS P901", ALC269_FIXUP_STEREO_DMIC),
89749017
SND_PCI_QUIRK(0x1043, 0x834a, "ASUS S101", ALC269_FIXUP_STEREO_DMIC),

0 commit comments

Comments
 (0)