Commit cfa0bb2a authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull sound fixes from Takashi Iwai:
 "All small fixes targeted for stable:

   - Two fixes for USB-audio with malformed descriptor, spotted by
     fuzzers

   - Two fixes Conexant HD-audio codec wrt power management

   - Quirks for HD-audio AMD platform and HP laptop

   - HD-audio memory leak fix"

* tag 'sound-5.3-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: usb-audio: Fix a stack buffer overflow bug in check_input_term
  ALSA: usb-audio: Fix an OOB bug in parse_audio_mixer_unit
  ALSA: hda - Add a generic reboot_notify
  ALSA: hda - Let all conexant codec enter D3 when rebooting
  ALSA: hda/realtek - Add quirk for HP Envy x360
  ALSA: hda - Fix a memory leak bug
  ALSA: hda - Apply workaround for another AMD chip 1022:1487
parents ec037ac2 19bce474
Loading
Loading
Loading
Loading
+20 −1
Original line number Original line Diff line number Diff line
@@ -6051,6 +6051,24 @@ void snd_hda_gen_free(struct hda_codec *codec)
}
}
EXPORT_SYMBOL_GPL(snd_hda_gen_free);
EXPORT_SYMBOL_GPL(snd_hda_gen_free);


/**
 * snd_hda_gen_reboot_notify - Make codec enter D3 before rebooting
 * @codec: the HDA codec
 *
 * This can be put as patch_ops reboot_notify function.
 */
void snd_hda_gen_reboot_notify(struct hda_codec *codec)
{
	/* Make the codec enter D3 to avoid spurious noises from the internal
	 * speaker during (and after) reboot
	 */
	snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
	snd_hda_codec_write(codec, codec->core.afg, 0,
			    AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
	msleep(10);
}
EXPORT_SYMBOL_GPL(snd_hda_gen_reboot_notify);

#ifdef CONFIG_PM
#ifdef CONFIG_PM
/**
/**
 * snd_hda_gen_check_power_status - check the loopback power save state
 * snd_hda_gen_check_power_status - check the loopback power save state
@@ -6078,6 +6096,7 @@ static const struct hda_codec_ops generic_patch_ops = {
	.init = snd_hda_gen_init,
	.init = snd_hda_gen_init,
	.free = snd_hda_gen_free,
	.free = snd_hda_gen_free,
	.unsol_event = snd_hda_jack_unsol_event,
	.unsol_event = snd_hda_jack_unsol_event,
	.reboot_notify = snd_hda_gen_reboot_notify,
#ifdef CONFIG_PM
#ifdef CONFIG_PM
	.check_power_status = snd_hda_gen_check_power_status,
	.check_power_status = snd_hda_gen_check_power_status,
#endif
#endif
@@ -6100,7 +6119,7 @@ static int snd_hda_parse_generic_codec(struct hda_codec *codec)


	err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0);
	err = snd_hda_parse_pin_defcfg(codec, &spec->autocfg, NULL, 0);
	if (err < 0)
	if (err < 0)
		return err;
		goto error;


	err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg);
	err = snd_hda_gen_parse_auto_config(codec, &spec->autocfg);
	if (err < 0)
	if (err < 0)
+1 −0
Original line number Original line Diff line number Diff line
@@ -332,6 +332,7 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
				  struct auto_pin_cfg *cfg);
				  struct auto_pin_cfg *cfg);
int snd_hda_gen_build_controls(struct hda_codec *codec);
int snd_hda_gen_build_controls(struct hda_codec *codec);
int snd_hda_gen_build_pcms(struct hda_codec *codec);
int snd_hda_gen_build_pcms(struct hda_codec *codec);
void snd_hda_gen_reboot_notify(struct hda_codec *codec);


/* standard jack event callbacks */
/* standard jack event callbacks */
void snd_hda_gen_hp_automute(struct hda_codec *codec,
void snd_hda_gen_hp_automute(struct hda_codec *codec,
+3 −0
Original line number Original line Diff line number Diff line
@@ -2508,6 +2508,9 @@ static const struct pci_device_id azx_ids[] = {
	/* AMD, X370 & co */
	/* AMD, X370 & co */
	{ PCI_DEVICE(0x1022, 0x1457),
	{ PCI_DEVICE(0x1022, 0x1457),
	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_AMD_SB },
	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_AMD_SB },
	/* AMD, X570 & co */
	{ PCI_DEVICE(0x1022, 0x1487),
	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_AMD_SB },
	/* AMD Stoney */
	/* AMD Stoney */
	{ PCI_DEVICE(0x1022, 0x157a),
	{ PCI_DEVICE(0x1022, 0x157a),
	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |
	  .driver_data = AZX_DRIVER_GENERIC | AZX_DCAPS_PRESET_ATI_SB |
+1 −14
Original line number Original line Diff line number Diff line
@@ -163,23 +163,10 @@ static void cx_auto_reboot_notify(struct hda_codec *codec)
{
{
	struct conexant_spec *spec = codec->spec;
	struct conexant_spec *spec = codec->spec;


	switch (codec->core.vendor_id) {
	case 0x14f12008: /* CX8200 */
	case 0x14f150f2: /* CX20722 */
	case 0x14f150f4: /* CX20724 */
		break;
	default:
		return;
	}

	/* Turn the problematic codec into D3 to avoid spurious noises
	/* Turn the problematic codec into D3 to avoid spurious noises
	   from the internal speaker during (and after) reboot */
	   from the internal speaker during (and after) reboot */
	cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);
	cx_auto_turn_eapd(codec, spec->num_eapds, spec->eapds, false);

	snd_hda_gen_reboot_notify(codec);
	snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
	snd_hda_codec_write(codec, codec->core.afg, 0,
			    AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
	msleep(10);
}
}


static void cx_auto_free(struct hda_codec *codec)
static void cx_auto_free(struct hda_codec *codec)
+2 −10
Original line number Original line Diff line number Diff line
@@ -869,15 +869,6 @@ static void alc_reboot_notify(struct hda_codec *codec)
		alc_shutup(codec);
		alc_shutup(codec);
}
}


/* power down codec to D3 at reboot/shutdown; set as reboot_notify ops */
static void alc_d3_at_reboot(struct hda_codec *codec)
{
	snd_hda_codec_set_power_to_all(codec, codec->core.afg, AC_PWRST_D3);
	snd_hda_codec_write(codec, codec->core.afg, 0,
			    AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
	msleep(10);
}

#define alc_free	snd_hda_gen_free
#define alc_free	snd_hda_gen_free


#ifdef CONFIG_PM
#ifdef CONFIG_PM
@@ -5152,7 +5143,7 @@ static void alc_fixup_tpt440_dock(struct hda_codec *codec,
	struct alc_spec *spec = codec->spec;
	struct alc_spec *spec = codec->spec;


	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
	if (action == HDA_FIXUP_ACT_PRE_PROBE) {
		spec->reboot_notify = alc_d3_at_reboot; /* reduce noise */
		spec->reboot_notify = snd_hda_gen_reboot_notify; /* reduce noise */
		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
		spec->parse_flags = HDA_PINCFG_NO_HP_FIXUP;
		codec->power_save_node = 0; /* avoid click noises */
		codec->power_save_node = 0; /* avoid click noises */
		snd_hda_apply_pincfgs(codec, pincfgs);
		snd_hda_apply_pincfgs(codec, pincfgs);
@@ -6987,6 +6978,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
	SND_PCI_QUIRK(0x103c, 0x82bf, "HP G3 mini", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
	SND_PCI_QUIRK(0x103c, 0x82c0, "HP G3 mini premium", ALC221_FIXUP_HP_MIC_NO_PRESENCE),
	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
	SND_PCI_QUIRK(0x103c, 0x83b9, "HP Spectre x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
	SND_PCI_QUIRK(0x103c, 0x8497, "HP Envy x360", ALC269_FIXUP_HP_MUTE_LED_MIC3),
	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
	SND_PCI_QUIRK(0x1043, 0x103e, "ASUS X540SA", ALC256_FIXUP_ASUS_MIC),
	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
	SND_PCI_QUIRK(0x1043, 0x103f, "ASUS TX300", ALC282_FIXUP_ASUS_TX300),
	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
	SND_PCI_QUIRK(0x1043, 0x106d, "Asus K53BE", ALC269_FIXUP_LIMIT_INT_MIC_BOOST),
Loading