Skip to content

Commit 4aafdf6

Browse files
committed
Merge tag 'sound-fix-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "A collection of small fixes gathered since the previous update. ALSA core: - Regression fix for OSS PCM emulation ASoC: - Trivial fixes in reg bit mask ops, DAPM, DPCM and topology - Lots of fixes for Intel-based devices - Minor fixes for AMD, STM32, Qualcomm, Realtek Others: - Fixes for the bugs in mixer handling in HD-audio and ice1724 drivers that were caught by the recent kctl validator - New quirks for HD-audio and USB-audio Also this contains a fix for EDD firmware fix, which slipped from anyone's hands" * tag 'sound-fix-5.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (35 commits) ALSA: hda: Add driver blacklist ALSA: usb-audio: Add mixer workaround for TRX40 and co ALSA: hda/realtek - Add quirk for MSI GL63 ALSA: ice1724: Fix invalid access for enumerated ctl items ALSA: hda: Fix potential access overflow in beep helper ASoC: cs4270: pull reset GPIO low then high ALSA: hda/realtek - Add HP new mute led supported for ALC236 ALSA: hda/realtek - Add supported new mute Led for HP ASoC: rt5645: Add platform-data for Medion E1239T ASoC: Intel: bytcr_rt5640: Add quirk for MPMAN MPWIN895CL tablet ASoC: stm32: sai: Add missing cleanup ALSA: usb-audio: Add registration quirk for Kingston HyperX Cloud Alpha S ASoC: Intel: atom: Fix uninitialized variable compiler warning ASoC: Intel: atom: Check drv->lock is locked in sst_fill_and_send_cmd_unlocked ASoC: Intel: atom: Take the drv->lock mutex before calling sst_send_slot_map() ASoC: SOF: Turn "firmware boot complete" message into a dbg message ALSA: usb-audio: Add Pioneer DJ DJM-250MK2 quirk ALSA: pcm: oss: Fix regression by buffer overflow fix (again) ALSA: pcm: oss: Fix regression by buffer overflow fix edd: Use scnprintf() for avoiding potential buffer overflow ...
2 parents 93f3321 + ddd5609 commit 4aafdf6

File tree

32 files changed

+329
-44
lines changed

32 files changed

+329
-44
lines changed

Documentation/devicetree/bindings/sound/cirrus,cs42l51.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ required:
4949
examples:
5050
- |
5151
#include <dt-bindings/gpio/gpio.h>
52-
i2c@0 {
52+
i2c {
5353
#address-cells = <1>;
5454
#size-cells = <0>;
5555

drivers/firmware/edd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ edd_show_legacy_max_cylinder(struct edd_device *edev, char *buf)
341341
if (!info || !buf)
342342
return -EINVAL;
343343

344-
p += snprintf(p, left, "%u\n", info->legacy_max_cylinder);
344+
p += scnprintf(p, left, "%u\n", info->legacy_max_cylinder);
345345
return (p - buf);
346346
}
347347

@@ -356,7 +356,7 @@ edd_show_legacy_max_head(struct edd_device *edev, char *buf)
356356
if (!info || !buf)
357357
return -EINVAL;
358358

359-
p += snprintf(p, left, "%u\n", info->legacy_max_head);
359+
p += scnprintf(p, left, "%u\n", info->legacy_max_head);
360360
return (p - buf);
361361
}
362362

@@ -371,7 +371,7 @@ edd_show_legacy_sectors_per_track(struct edd_device *edev, char *buf)
371371
if (!info || !buf)
372372
return -EINVAL;
373373

374-
p += snprintf(p, left, "%u\n", info->legacy_sectors_per_track);
374+
p += scnprintf(p, left, "%u\n", info->legacy_sectors_per_track);
375375
return (p - buf);
376376
}
377377

include/sound/soc-dai.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ struct snd_soc_dai {
351351

352352
/* bit field */
353353
unsigned int probed:1;
354-
unsigned int started:1;
354+
unsigned int started[SNDRV_PCM_STREAM_LAST + 1];
355355
};
356356

357357
static inline struct snd_soc_pcm_stream *

sound/core/oss/pcm_plugin.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin)
197197
}
198198

199199
static snd_pcm_sframes_t calc_dst_frames(struct snd_pcm_substream *plug,
200-
snd_pcm_sframes_t frames)
200+
snd_pcm_sframes_t frames,
201+
bool check_size)
201202
{
202203
struct snd_pcm_plugin *plugin, *plugin_next;
203204

@@ -209,21 +210,22 @@ static snd_pcm_sframes_t calc_dst_frames(struct snd_pcm_substream *plug,
209210
if (frames < 0)
210211
return frames;
211212
}
212-
if (frames > plugin->buf_frames)
213+
if (check_size && frames > plugin->buf_frames)
213214
frames = plugin->buf_frames;
214215
plugin = plugin_next;
215216
}
216217
return frames;
217218
}
218219

219220
static snd_pcm_sframes_t calc_src_frames(struct snd_pcm_substream *plug,
220-
snd_pcm_sframes_t frames)
221+
snd_pcm_sframes_t frames,
222+
bool check_size)
221223
{
222224
struct snd_pcm_plugin *plugin, *plugin_prev;
223225

224226
plugin = snd_pcm_plug_last(plug);
225227
while (plugin && frames > 0) {
226-
if (frames > plugin->buf_frames)
228+
if (check_size && frames > plugin->buf_frames)
227229
frames = plugin->buf_frames;
228230
plugin_prev = plugin->prev;
229231
if (plugin->src_frames) {
@@ -242,9 +244,9 @@ snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_p
242244
return -ENXIO;
243245
switch (snd_pcm_plug_stream(plug)) {
244246
case SNDRV_PCM_STREAM_PLAYBACK:
245-
return calc_src_frames(plug, drv_frames);
247+
return calc_src_frames(plug, drv_frames, false);
246248
case SNDRV_PCM_STREAM_CAPTURE:
247-
return calc_dst_frames(plug, drv_frames);
249+
return calc_dst_frames(plug, drv_frames, false);
248250
default:
249251
snd_BUG();
250252
return -EINVAL;
@@ -257,9 +259,9 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc
257259
return -ENXIO;
258260
switch (snd_pcm_plug_stream(plug)) {
259261
case SNDRV_PCM_STREAM_PLAYBACK:
260-
return calc_dst_frames(plug, clt_frames);
262+
return calc_dst_frames(plug, clt_frames, false);
261263
case SNDRV_PCM_STREAM_CAPTURE:
262-
return calc_src_frames(plug, clt_frames);
264+
return calc_src_frames(plug, clt_frames, false);
263265
default:
264266
snd_BUG();
265267
return -EINVAL;
@@ -622,7 +624,7 @@ snd_pcm_sframes_t snd_pcm_plug_write_transfer(struct snd_pcm_substream *plug, st
622624
src_channels = dst_channels;
623625
plugin = next;
624626
}
625-
return snd_pcm_plug_client_size(plug, frames);
627+
return calc_src_frames(plug, frames, true);
626628
}
627629

628630
snd_pcm_sframes_t snd_pcm_plug_read_transfer(struct snd_pcm_substream *plug, struct snd_pcm_plugin_channel *dst_channels_final, snd_pcm_uframes_t size)
@@ -632,7 +634,7 @@ snd_pcm_sframes_t snd_pcm_plug_read_transfer(struct snd_pcm_substream *plug, str
632634
snd_pcm_sframes_t frames = size;
633635
int err;
634636

635-
frames = snd_pcm_plug_slave_size(plug, frames);
637+
frames = calc_src_frames(plug, frames, true);
636638
if (frames < 0)
637639
return frames;
638640

sound/pci/hda/hda_beep.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,12 @@ int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol,
290290
{
291291
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
292292
struct hda_beep *beep = codec->beep;
293+
int chs = get_amp_channels(kcontrol);
294+
293295
if (beep && (!beep->enabled || !ctl_has_mute(kcontrol))) {
294-
ucontrol->value.integer.value[0] =
296+
if (chs & 1)
297+
ucontrol->value.integer.value[0] = beep->enabled;
298+
if (chs & 2)
295299
ucontrol->value.integer.value[1] = beep->enabled;
296300
return 0;
297301
}

sound/pci/hda/hda_intel.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2076,6 +2076,17 @@ static void pcm_mmap_prepare(struct snd_pcm_substream *substream,
20762076
#endif
20772077
}
20782078

2079+
/* Blacklist for skipping the whole probe:
2080+
* some HD-audio PCI entries are exposed without any codecs, and such devices
2081+
* should be ignored from the beginning.
2082+
*/
2083+
static const struct snd_pci_quirk driver_blacklist[] = {
2084+
SND_PCI_QUIRK(0x1043, 0x874f, "ASUS ROG Zenith II / Strix", 0),
2085+
SND_PCI_QUIRK(0x1462, 0xcb59, "MSI TRX40 Creator", 0),
2086+
SND_PCI_QUIRK(0x1462, 0xcb60, "MSI TRX40", 0),
2087+
{}
2088+
};
2089+
20792090
static const struct hda_controller_ops pci_hda_ops = {
20802091
.disable_msi_reset_irq = disable_msi_reset_irq,
20812092
.pcm_mmap_prepare = pcm_mmap_prepare,
@@ -2092,6 +2103,11 @@ static int azx_probe(struct pci_dev *pci,
20922103
bool schedule_probe;
20932104
int err;
20942105

2106+
if (snd_pci_quirk_lookup(pci, driver_blacklist)) {
2107+
dev_info(&pci->dev, "Skipping the blacklisted device\n");
2108+
return -ENODEV;
2109+
}
2110+
20952111
if (dev >= SNDRV_CARDS)
20962112
return -ENODEV;
20972113
if (!enable[dev]) {

sound/pci/hda/patch_realtek.c

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,14 @@ struct alc_spec {
8686

8787
unsigned int gpio_mute_led_mask;
8888
unsigned int gpio_mic_led_mask;
89+
unsigned int mute_led_coef_idx;
90+
unsigned int mute_led_coefbit_mask;
91+
unsigned int mute_led_coefbit_on;
92+
unsigned int mute_led_coefbit_off;
93+
unsigned int mic_led_coef_idx;
94+
unsigned int mic_led_coefbit_mask;
95+
unsigned int mic_led_coefbit_on;
96+
unsigned int mic_led_coefbit_off;
8997

9098
hda_nid_t headset_mic_pin;
9199
hda_nid_t headphone_mic_pin;
@@ -2447,6 +2455,7 @@ static const struct snd_pci_quirk alc882_fixup_tbl[] = {
24472455
SND_PCI_QUIRK(0x1458, 0xa0b8, "Gigabyte AZ370-Gaming", ALC1220_FIXUP_GB_DUAL_CODECS),
24482456
SND_PCI_QUIRK(0x1458, 0xa0cd, "Gigabyte X570 Aorus Master", ALC1220_FIXUP_CLEVO_P950),
24492457
SND_PCI_QUIRK(0x1462, 0x1228, "MSI-GP63", ALC1220_FIXUP_CLEVO_P950),
2458+
SND_PCI_QUIRK(0x1462, 0x1275, "MSI-GL63", ALC1220_FIXUP_CLEVO_P950),
24502459
SND_PCI_QUIRK(0x1462, 0x1276, "MSI-GL73", ALC1220_FIXUP_CLEVO_P950),
24512460
SND_PCI_QUIRK(0x1462, 0x1293, "MSI-GP65", ALC1220_FIXUP_CLEVO_P950),
24522461
SND_PCI_QUIRK(0x1462, 0x7350, "MSI-7350", ALC889_FIXUP_CD),
@@ -4178,6 +4187,111 @@ static void alc280_fixup_hp_gpio4(struct hda_codec *codec,
41784187
}
41794188
}
41804189

4190+
/* update mute-LED according to the speaker mute state via COEF bit */
4191+
static void alc_fixup_mute_led_coefbit_hook(void *private_data, int enabled)
4192+
{
4193+
struct hda_codec *codec = private_data;
4194+
struct alc_spec *spec = codec->spec;
4195+
4196+
if (spec->mute_led_polarity)
4197+
enabled = !enabled;
4198+
4199+
/* temporarily power up/down for setting COEF bit */
4200+
enabled ? alc_update_coef_idx(codec, spec->mute_led_coef_idx,
4201+
spec->mute_led_coefbit_mask, spec->mute_led_coefbit_off) :
4202+
alc_update_coef_idx(codec, spec->mute_led_coef_idx,
4203+
spec->mute_led_coefbit_mask, spec->mute_led_coefbit_on);
4204+
}
4205+
4206+
static void alc285_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4207+
const struct hda_fixup *fix,
4208+
int action)
4209+
{
4210+
struct alc_spec *spec = codec->spec;
4211+
4212+
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4213+
spec->mute_led_polarity = 0;
4214+
spec->mute_led_coef_idx = 0x0b;
4215+
spec->mute_led_coefbit_mask = 1<<3;
4216+
spec->mute_led_coefbit_on = 1<<3;
4217+
spec->mute_led_coefbit_off = 0;
4218+
spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook;
4219+
spec->gen.vmaster_mute_enum = 1;
4220+
}
4221+
}
4222+
4223+
static void alc236_fixup_hp_mute_led_coefbit(struct hda_codec *codec,
4224+
const struct hda_fixup *fix,
4225+
int action)
4226+
{
4227+
struct alc_spec *spec = codec->spec;
4228+
4229+
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4230+
spec->mute_led_polarity = 0;
4231+
spec->mute_led_coef_idx = 0x34;
4232+
spec->mute_led_coefbit_mask = 1<<5;
4233+
spec->mute_led_coefbit_on = 0;
4234+
spec->mute_led_coefbit_off = 1<<5;
4235+
spec->gen.vmaster_mute.hook = alc_fixup_mute_led_coefbit_hook;
4236+
spec->gen.vmaster_mute_enum = 1;
4237+
}
4238+
}
4239+
4240+
/* turn on/off mic-mute LED per capture hook by coef bit */
4241+
static void alc_hp_cap_micmute_update(struct hda_codec *codec)
4242+
{
4243+
struct alc_spec *spec = codec->spec;
4244+
4245+
if (spec->gen.micmute_led.led_value)
4246+
alc_update_coef_idx(codec, spec->mic_led_coef_idx,
4247+
spec->mic_led_coefbit_mask, spec->mic_led_coefbit_on);
4248+
else
4249+
alc_update_coef_idx(codec, spec->mic_led_coef_idx,
4250+
spec->mic_led_coefbit_mask, spec->mic_led_coefbit_off);
4251+
}
4252+
4253+
static void alc285_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4254+
const struct hda_fixup *fix, int action)
4255+
{
4256+
struct alc_spec *spec = codec->spec;
4257+
4258+
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4259+
spec->mic_led_coef_idx = 0x19;
4260+
spec->mic_led_coefbit_mask = 1<<13;
4261+
spec->mic_led_coefbit_on = 1<<13;
4262+
spec->mic_led_coefbit_off = 0;
4263+
snd_hda_gen_add_micmute_led(codec, alc_hp_cap_micmute_update);
4264+
}
4265+
}
4266+
4267+
static void alc236_fixup_hp_coef_micmute_led(struct hda_codec *codec,
4268+
const struct hda_fixup *fix, int action)
4269+
{
4270+
struct alc_spec *spec = codec->spec;
4271+
4272+
if (action == HDA_FIXUP_ACT_PRE_PROBE) {
4273+
spec->mic_led_coef_idx = 0x35;
4274+
spec->mic_led_coefbit_mask = 3<<2;
4275+
spec->mic_led_coefbit_on = 2<<2;
4276+
spec->mic_led_coefbit_off = 1<<2;
4277+
snd_hda_gen_add_micmute_led(codec, alc_hp_cap_micmute_update);
4278+
}
4279+
}
4280+
4281+
static void alc285_fixup_hp_mute_led(struct hda_codec *codec,
4282+
const struct hda_fixup *fix, int action)
4283+
{
4284+
alc285_fixup_hp_mute_led_coefbit(codec, fix, action);
4285+
alc285_fixup_hp_coef_micmute_led(codec, fix, action);
4286+
}
4287+
4288+
static void alc236_fixup_hp_mute_led(struct hda_codec *codec,
4289+
const struct hda_fixup *fix, int action)
4290+
{
4291+
alc236_fixup_hp_mute_led_coefbit(codec, fix, action);
4292+
alc236_fixup_hp_coef_micmute_led(codec, fix, action);
4293+
}
4294+
41814295
#if IS_REACHABLE(CONFIG_INPUT)
41824296
static void gpio2_mic_hotkey_event(struct hda_codec *codec,
41834297
struct hda_jack_callback *event)
@@ -5964,6 +6078,8 @@ enum {
59646078
ALC285_FIXUP_THINKPAD_HEADSET_JACK,
59656079
ALC294_FIXUP_ASUS_HPE,
59666080
ALC285_FIXUP_HP_GPIO_LED,
6081+
ALC285_FIXUP_HP_MUTE_LED,
6082+
ALC236_FIXUP_HP_MUTE_LED,
59676083
};
59686084

59696085
static const struct hda_fixup alc269_fixups[] = {
@@ -7089,6 +7205,14 @@ static const struct hda_fixup alc269_fixups[] = {
70897205
.type = HDA_FIXUP_FUNC,
70907206
.v.func = alc285_fixup_hp_gpio_led,
70917207
},
7208+
[ALC285_FIXUP_HP_MUTE_LED] = {
7209+
.type = HDA_FIXUP_FUNC,
7210+
.v.func = alc285_fixup_hp_mute_led,
7211+
},
7212+
[ALC236_FIXUP_HP_MUTE_LED] = {
7213+
.type = HDA_FIXUP_FUNC,
7214+
.v.func = alc236_fixup_hp_mute_led,
7215+
},
70927216
};
70937217

70947218
static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -7234,6 +7358,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
72347358
SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
72357359
SND_PCI_QUIRK(0x103c, 0x84e7, "HP Pavilion 15", ALC269_FIXUP_HP_MUTE_LED_MIC3),
72367360
SND_PCI_QUIRK(0x103c, 0x8736, "HP", ALC285_FIXUP_HP_GPIO_LED),
7361+
SND_PCI_QUIRK(0x103c, 0x877a, "HP", ALC285_FIXUP_HP_MUTE_LED),
7362+
SND_PCI_QUIRK(0x103c, 0x877d, "HP", ALC236_FIXUP_HP_MUTE_LED),
72377363
SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
72387364
SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
72397365
SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
@@ -7325,6 +7451,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
73257451
SND_PCI_QUIRK(0x17aa, 0x225d, "Thinkpad T480", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
73267452
SND_PCI_QUIRK(0x17aa, 0x2292, "Thinkpad X1 Yoga 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
73277453
SND_PCI_QUIRK(0x17aa, 0x2293, "Thinkpad X1 Carbon 7th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
7454+
SND_PCI_QUIRK(0x17aa, 0x22be, "Thinkpad X1 Carbon 8th", ALC285_FIXUP_THINKPAD_HEADSET_JACK),
73287455
SND_PCI_QUIRK(0x17aa, 0x30bb, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
73297456
SND_PCI_QUIRK(0x17aa, 0x30e2, "ThinkCentre AIO", ALC233_FIXUP_LENOVO_LINE2_MIC_HOTKEY),
73307457
SND_PCI_QUIRK(0x17aa, 0x310c, "ThinkCentre Station", ALC294_FIXUP_LENOVO_MIC_LOCATION),

sound/pci/ice1712/prodigy_hifi.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -536,7 +536,7 @@ static int wm_adc_mux_enum_get(struct snd_kcontrol *kcontrol,
536536
struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
537537

538538
mutex_lock(&ice->gpio_mutex);
539-
ucontrol->value.integer.value[0] = wm_get(ice, WM_ADC_MUX) & 0x1f;
539+
ucontrol->value.enumerated.item[0] = wm_get(ice, WM_ADC_MUX) & 0x1f;
540540
mutex_unlock(&ice->gpio_mutex);
541541
return 0;
542542
}
@@ -550,7 +550,7 @@ static int wm_adc_mux_enum_put(struct snd_kcontrol *kcontrol,
550550

551551
mutex_lock(&ice->gpio_mutex);
552552
oval = wm_get(ice, WM_ADC_MUX);
553-
nval = (oval & 0xe0) | ucontrol->value.integer.value[0];
553+
nval = (oval & 0xe0) | ucontrol->value.enumerated.item[0];
554554
if (nval != oval) {
555555
wm_put(ice, WM_ADC_MUX, nval);
556556
change = 1;

sound/soc/amd/raven/acp3x-i2s.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ static int acp3x_i2s_hwparams(struct snd_pcm_substream *substream,
139139
rv_writel(adata->tdm_fmt, rtd->acp3x_base + frmt_reg);
140140
}
141141
val = rv_readl(rtd->acp3x_base + reg_val);
142+
val &= ~ACP3x_ITER_IRER_SAMP_LEN_MASK;
142143
val = val | (rtd->xfer_resolution << 3);
143144
rv_writel(val, rtd->acp3x_base + reg_val);
144145
return 0;

sound/soc/amd/raven/acp3x.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@
7676
#define ACP_POWERED_OFF 0x02
7777
#define ACP_POWER_OFF_IN_PROGRESS 0x03
7878

79+
#define ACP3x_ITER_IRER_SAMP_LEN_MASK 0x38
80+
7981
struct acp3x_platform_info {
8082
u16 play_i2s_instance;
8183
u16 cap_i2s_instance;

0 commit comments

Comments
 (0)