Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e26aac3c authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull sound fixes from Takashi Iwai:
 "Over a dozen changes, but all small and clear fixes.

  Half of them are the regression fixes for CA0132 HD-audio codec, and
  the rest are, again, a few more fixups for HD-audio, two UBSAN fixes
  in the core ioctls, and a trivial fix in the error path handling in
  lx6464es driver"

* tag 'sound-4.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
  ALSA: seq: Fix UBSAN warning at SNDRV_SEQ_IOCTL_QUERY_NEXT_CLIENT ioctl
  ALSA: timer: Fix UBSAN warning at SNDRV_TIMER_IOCTL_NEXT_DEVICE ioctl
  ALSA: hda/realtek - Fix the problem of two front mics on more machines
  ALSA: hda/realtek - Add a quirk for FSC ESPRIMO U9210
  ALSA: hda/ca0132: make array ca0132_alt_chmaps static
  ALSA: hda - Force to link down at runtime suspend on ATI/AMD HDMI
  ALSA: lx6464es: Missing error code in snd_lx6464es_create()
  ALSA: hda/ca0132: Fix DMic data rate for Alienware M17x R4
  ALSA: hda/ca0132: Restore PCM Analog Mic-In2
  ALSA: hda/ca0132: Don't test for QUIRK_NONE
  ALSA: hda/ca0132: Restore behavior of QUIRK_ALIENWARE
  ALSA: hda/ca0132: Delete redundant UNSOL event requests
  ALSA: hda/ca0132: Delete pointless assignments to struct auto_pin_cfg fields
  ALSA: hda/realtek - Fix pop noise on Lenovo P50 & co
parents c7e1d692 c9a4c638
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -2004,6 +2004,7 @@ static int snd_seq_ioctl_query_next_client(struct snd_seq_client *client,
	struct snd_seq_client *cptr = NULL;

	/* search for next client */
	if (info->client < INT_MAX)
		info->client++;
	if (info->client < 0)
		info->client = 0;
+1 −1
Original line number Diff line number Diff line
@@ -1520,7 +1520,7 @@ static int snd_timer_user_next_device(struct snd_timer_id __user *_tid)
				} else {
					if (id.subdevice < 0)
						id.subdevice = 0;
					else
					else if (id.subdevice < INT_MAX)
						id.subdevice++;
				}
			}
+3 −2
Original line number Diff line number Diff line
@@ -2899,8 +2899,9 @@ static int hda_codec_runtime_suspend(struct device *dev)
	list_for_each_entry(pcm, &codec->pcm_list_head, list)
		snd_pcm_suspend_all(pcm->pcm);
	state = hda_call_codec_suspend(codec);
	if (codec_has_clkstop(codec) && codec_has_epss(codec) &&
	    (state & AC_PWRST_CLK_STOP_OK))
	if (codec->link_down_at_suspend ||
	    (codec_has_clkstop(codec) && codec_has_epss(codec) &&
	     (state & AC_PWRST_CLK_STOP_OK)))
		snd_hdac_codec_link_down(&codec->core);
	snd_hdac_link_power(&codec->core, false);
	return 0;
+1 −0
Original line number Diff line number Diff line
@@ -258,6 +258,7 @@ struct hda_codec {
	unsigned int power_save_node:1; /* advanced PM for each widget */
	unsigned int auto_runtime_pm:1; /* enable automatic codec runtime pm */
	unsigned int force_pin_prefix:1; /* Add location prefix */
	unsigned int link_down_at_suspend:1; /* link down at runtime suspend */
#ifdef CONFIG_PM
	unsigned long power_on_acct;
	unsigned long power_off_acct;
+23 −41
Original line number Diff line number Diff line
@@ -991,6 +991,7 @@ struct ca0132_spec {
enum {
	QUIRK_NONE,
	QUIRK_ALIENWARE,
	QUIRK_ALIENWARE_M17XR4,
	QUIRK_SBZ,
	QUIRK_R3DI,
};
@@ -1040,6 +1041,7 @@ static const struct hda_pintbl r3di_pincfgs[] = {
};

static const struct snd_pci_quirk ca0132_quirks[] = {
	SND_PCI_QUIRK(0x1028, 0x057b, "Alienware M17x R4", QUIRK_ALIENWARE_M17XR4),
	SND_PCI_QUIRK(0x1028, 0x0685, "Alienware 15 2015", QUIRK_ALIENWARE),
	SND_PCI_QUIRK(0x1028, 0x0688, "Alienware 17 2015", QUIRK_ALIENWARE),
	SND_PCI_QUIRK(0x1028, 0x0708, "Alienware 15 R2 2016", QUIRK_ALIENWARE),
@@ -5663,7 +5665,7 @@ static const char * const ca0132_alt_slave_pfxs[] = {
 * I think this has to do with the pin for rear surround being 0x11,
 * and the center/lfe being 0x10. Usually the pin order is the opposite.
 */
const struct snd_pcm_chmap_elem ca0132_alt_chmaps[] = {
static const struct snd_pcm_chmap_elem ca0132_alt_chmaps[] = {
	{ .channels = 2,
	  .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
	{ .channels = 4,
@@ -5966,7 +5968,7 @@ static int ca0132_build_pcms(struct hda_codec *codec)
	info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adcs[0];

	/* With the DSP enabled, desktops don't use this ADC. */
	if (spec->use_alt_functions) {
	if (!spec->use_alt_functions) {
		info = snd_hda_codec_pcm_new(codec, "CA0132 Analog Mic-In2");
		if (!info)
			return -ENOMEM;
@@ -6130,6 +6132,9 @@ static void ca0132_init_dmic(struct hda_codec *codec)
	 * Bit   6: set to select Data2, clear for Data1
	 * Bit   7: set to enable DMic, clear for AMic
	 */
	if (spec->quirk == QUIRK_ALIENWARE_M17XR4)
		val = 0x33;
	else
		val = 0x23;
	/* keep a copy of dmic ctl val for enable/disable dmic purpuse */
	spec->dmic_ctl = val;
@@ -7223,7 +7228,7 @@ static int ca0132_init(struct hda_codec *codec)

	snd_hda_sequence_write(codec, spec->base_init_verbs);

	if (spec->quirk != QUIRK_NONE)
	if (spec->use_alt_functions)
		ca0132_alt_init(codec);

	ca0132_download_dsp(codec);
@@ -7237,8 +7242,9 @@ static int ca0132_init(struct hda_codec *codec)
	case QUIRK_R3DI:
		r3di_setup_defaults(codec);
		break;
	case QUIRK_NONE:
	case QUIRK_ALIENWARE:
	case QUIRK_SBZ:
		break;
	default:
		ca0132_setup_defaults(codec);
		ca0132_init_analog_mic2(codec);
		ca0132_init_dmic(codec);
@@ -7343,7 +7349,6 @@ static const struct hda_codec_ops ca0132_patch_ops = {
static void ca0132_config(struct hda_codec *codec)
{
	struct ca0132_spec *spec = codec->spec;
	struct auto_pin_cfg *cfg = &spec->autocfg;

	spec->dacs[0] = 0x2;
	spec->dacs[1] = 0x3;
@@ -7405,12 +7410,7 @@ static void ca0132_config(struct hda_codec *codec)
		/* SPDIF I/O */
		spec->dig_out = 0x05;
		spec->multiout.dig_out_nid = spec->dig_out;
		cfg->dig_out_pins[0] = 0x0c;
		cfg->dig_outs = 1;
		cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF;
		spec->dig_in = 0x09;
		cfg->dig_in_pin = 0x0e;
		cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
		break;
	case QUIRK_R3DI:
		codec_dbg(codec, "%s: QUIRK_R3DI applied.\n", __func__);
@@ -7438,9 +7438,6 @@ static void ca0132_config(struct hda_codec *codec)
		/* SPDIF I/O */
		spec->dig_out = 0x05;
		spec->multiout.dig_out_nid = spec->dig_out;
		cfg->dig_out_pins[0] = 0x0c;
		cfg->dig_outs = 1;
		cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF;
		break;
	default:
		spec->num_outputs = 2;
@@ -7463,12 +7460,7 @@ static void ca0132_config(struct hda_codec *codec)
		/* SPDIF I/O */
		spec->dig_out = 0x05;
		spec->multiout.dig_out_nid = spec->dig_out;
		cfg->dig_out_pins[0] = 0x0c;
		cfg->dig_outs = 1;
		cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF;
		spec->dig_in = 0x09;
		cfg->dig_in_pin = 0x0e;
		cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
		break;
	}
}
@@ -7476,7 +7468,7 @@ static void ca0132_config(struct hda_codec *codec)
static int ca0132_prepare_verbs(struct hda_codec *codec)
{
/* Verbs + terminator (an empty element) */
#define NUM_SPEC_VERBS 4
#define NUM_SPEC_VERBS 2
	struct ca0132_spec *spec = codec->spec;

	spec->chip_init_verbs = ca0132_init_verbs0;
@@ -7488,34 +7480,24 @@ static int ca0132_prepare_verbs(struct hda_codec *codec)
	if (!spec->spec_init_verbs)
		return -ENOMEM;

	/* HP jack autodetection */
	spec->spec_init_verbs[0].nid = spec->unsol_tag_hp;
	spec->spec_init_verbs[0].param = AC_VERB_SET_UNSOLICITED_ENABLE;
	spec->spec_init_verbs[0].verb = AC_USRSP_EN | spec->unsol_tag_hp;

	/* MIC1 jack autodetection */
	spec->spec_init_verbs[1].nid = spec->unsol_tag_amic1;
	spec->spec_init_verbs[1].param = AC_VERB_SET_UNSOLICITED_ENABLE;
	spec->spec_init_verbs[1].verb = AC_USRSP_EN | spec->unsol_tag_amic1;

	/* config EAPD */
	spec->spec_init_verbs[2].nid = 0x0b;
	spec->spec_init_verbs[2].param = 0x78D;
	spec->spec_init_verbs[2].verb = 0x00;
	spec->spec_init_verbs[0].nid = 0x0b;
	spec->spec_init_verbs[0].param = 0x78D;
	spec->spec_init_verbs[0].verb = 0x00;

	/* Previously commented configuration */
	/*
	spec->spec_init_verbs[3].nid = 0x0b;
	spec->spec_init_verbs[3].param = AC_VERB_SET_EAPD_BTLENABLE;
	spec->spec_init_verbs[2].nid = 0x0b;
	spec->spec_init_verbs[2].param = AC_VERB_SET_EAPD_BTLENABLE;
	spec->spec_init_verbs[2].verb = 0x02;

	spec->spec_init_verbs[3].nid = 0x10;
	spec->spec_init_verbs[3].param = 0x78D;
	spec->spec_init_verbs[3].verb = 0x02;

	spec->spec_init_verbs[4].nid = 0x10;
	spec->spec_init_verbs[4].param = 0x78D;
	spec->spec_init_verbs[4].param = AC_VERB_SET_EAPD_BTLENABLE;
	spec->spec_init_verbs[4].verb = 0x02;

	spec->spec_init_verbs[5].nid = 0x10;
	spec->spec_init_verbs[5].param = AC_VERB_SET_EAPD_BTLENABLE;
	spec->spec_init_verbs[5].verb = 0x02;
	*/

	/* Terminator: spec->spec_init_verbs[NUM_SPEC_VERBS-1] */
Loading