diff options
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
| -rw-r--r-- | sound/pci/hda/patch_realtek.c | 1006 | 
1 files changed, 663 insertions, 343 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index da34095c707..e8cbe216e91 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -131,8 +131,10 @@ enum {  enum {  	ALC269_BASIC,  	ALC269_QUANTA_FL1, -	ALC269_ASUS_AMIC, -	ALC269_ASUS_DMIC, +	ALC269_AMIC, +	ALC269_DMIC, +	ALC269VB_AMIC, +	ALC269VB_DMIC,  	ALC269_FUJITSU,  	ALC269_LIFEBOOK,  	ALC269_AUTO, @@ -207,8 +209,10 @@ enum {  	ALC882_ASUS_A7J,  	ALC882_ASUS_A7M,  	ALC885_MACPRO, +	ALC885_MBA21,  	ALC885_MBP3,  	ALC885_MB5, +	ALC885_MACMINI3,  	ALC885_IMAC24,  	ALC885_IMAC91,  	ALC883_3ST_2ch_DIG, @@ -338,7 +342,7 @@ struct alc_spec {  	void (*init_hook)(struct hda_codec *codec);  	void (*unsol_event)(struct hda_codec *codec, unsigned int res);  #ifdef CONFIG_SND_HDA_POWER_SAVE -	void (*power_hook)(struct hda_codec *codec, int power); +	void (*power_hook)(struct hda_codec *codec);  #endif  	/* for pin sensing */ @@ -391,7 +395,7 @@ struct alc_config_preset {  	void (*init_hook)(struct hda_codec *);  #ifdef CONFIG_SND_HDA_POWER_SAVE  	struct hda_amp_list *loopbacks; -	void (*power_hook)(struct hda_codec *codec, int power); +	void (*power_hook)(struct hda_codec *codec);  #endif  }; @@ -633,6 +637,7 @@ static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,  #define ALC_PIN_MODE(xname, nid, dir) \  	{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0,  \ +	  .subdevice = HDA_SUBDEV_NID_FLAG | nid, \  	  .info = alc_pin_mode_info, \  	  .get = alc_pin_mode_get, \  	  .put = alc_pin_mode_put, \ @@ -684,6 +689,7 @@ static int alc_gpio_data_put(struct snd_kcontrol *kcontrol,  }  #define ALC_GPIO_DATA_SWITCH(xname, nid, mask) \  	{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0,  \ +	  .subdevice = HDA_SUBDEV_NID_FLAG | nid, \  	  .info = alc_gpio_data_info, \  	  .get = alc_gpio_data_get, \  	  .put = alc_gpio_data_put, \ @@ -738,6 +744,7 @@ static int alc_spdif_ctrl_put(struct snd_kcontrol *kcontrol,  }  #define ALC_SPDIF_CTRL_SWITCH(xname, nid, mask) \  	{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0,  \ +	  .subdevice = HDA_SUBDEV_NID_FLAG | nid, \  	  .info = alc_spdif_ctrl_info, \  	  .get = alc_spdif_ctrl_get, \  	  .put = alc_spdif_ctrl_put, \ @@ -791,6 +798,7 @@ static int alc_eapd_ctrl_put(struct snd_kcontrol *kcontrol,  #define ALC_EAPD_CTRL_SWITCH(xname, nid, mask) \  	{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0,  \ +	  .subdevice = HDA_SUBDEV_NID_FLAG | nid, \  	  .info = alc_eapd_ctrl_info, \  	  .get = alc_eapd_ctrl_get, \  	  .put = alc_eapd_ctrl_put, \ @@ -837,27 +845,6 @@ static void add_verb(struct alc_spec *spec, const struct hda_verb *verb)  	spec->init_verbs[spec->num_init_verbs++] = verb;  } -#ifdef CONFIG_PROC_FS -/* - * hook for proc - */ -static void print_realtek_coef(struct snd_info_buffer *buffer, -			       struct hda_codec *codec, hda_nid_t nid) -{ -	int coeff; - -	if (nid != 0x20) -		return; -	coeff = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_PROC_COEF, 0); -	snd_iprintf(buffer, "  Processing Coefficient: 0x%02x\n", coeff); -	coeff = snd_hda_codec_read(codec, nid, 0, -				   AC_VERB_GET_COEF_INDEX, 0); -	snd_iprintf(buffer, "  Coefficient Index: 0x%02x\n", coeff); -} -#else -#define print_realtek_coef	NULL -#endif -  /*   * set up from the preset table   */ @@ -1162,6 +1149,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)  		case 0x10ec0888:  			alc888_coef_init(codec);  			break; +#if 0 /* XXX: This may cause the silent output on speaker on some machines */  		case 0x10ec0267:  		case 0x10ec0268:  			snd_hda_codec_write(codec, 0x20, 0, @@ -1174,6 +1162,7 @@ static void alc_auto_init_amp(struct hda_codec *codec, int type)  					    AC_VERB_SET_PROC_COEF,  					    tmp | 0x3000);  			break; +#endif /* XXX */  		}  		break;  	} @@ -1265,7 +1254,7 @@ static void alc_init_auto_mic(struct hda_codec *codec)   */  static int alc_subsystem_id(struct hda_codec *codec,  			    hda_nid_t porta, hda_nid_t porte, -			    hda_nid_t portd) +			    hda_nid_t portd, hda_nid_t porti)  {  	unsigned int ass, tmp, i;  	unsigned nid; @@ -1291,7 +1280,7 @@ static int alc_subsystem_id(struct hda_codec *codec,  	snd_printd("realtek: No valid SSID, "  		   "checking pincfg 0x%08x for NID 0x%x\n",  		   ass, nid); -	if (!(ass & 1) && !(ass & 0x100000)) +	if (!(ass & 1))  		return 0;  	if ((ass >> 30) != 1)	/* no physical connection */  		return 0; @@ -1351,6 +1340,8 @@ do_sku:  			nid = porte;  		else if (tmp == 2)  			nid = portd; +		else if (tmp == 3) +			nid = porti;  		else  			return 1;  		for (i = 0; i < spec->autocfg.line_outs; i++) @@ -1365,9 +1356,10 @@ do_sku:  }  static void alc_ssid_check(struct hda_codec *codec, -			   hda_nid_t porta, hda_nid_t porte, hda_nid_t portd) +			   hda_nid_t porta, hda_nid_t porte, +			   hda_nid_t portd, hda_nid_t porti)  { -	if (!alc_subsystem_id(codec, porta, porte, portd)) { +	if (!alc_subsystem_id(codec, porta, porte, portd, porti)) {  		struct alc_spec *spec = codec->spec;  		snd_printd("realtek: "  			   "Enable default setup for auto mode as fallback\n"); @@ -1840,14 +1832,6 @@ static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)  	spec->autocfg.speaker_pins[2] = 0x1b;  } -#ifdef CONFIG_SND_HDA_POWER_SAVE -static void alc889_power_eapd(struct hda_codec *codec, int power) -{ -	set_eapd(codec, 0x14, power); -	set_eapd(codec, 0x15, power); -} -#endif -  /*   * ALC880 3-stack model   * @@ -2450,6 +2434,15 @@ static const char *alc_slave_sws[] = {   * build control elements   */ +#define NID_MAPPING		(-1) + +#define SUBDEV_SPEAKER_		(0 << 6) +#define SUBDEV_HP_		(1 << 6) +#define SUBDEV_LINE_		(2 << 6) +#define SUBDEV_SPEAKER(x)	(SUBDEV_SPEAKER_ | ((x) & 0x3f)) +#define SUBDEV_HP(x)		(SUBDEV_HP_ | ((x) & 0x3f)) +#define SUBDEV_LINE(x)		(SUBDEV_LINE_ | ((x) & 0x3f)) +  static void alc_free_kctls(struct hda_codec *codec);  #ifdef CONFIG_SND_HDA_INPUT_BEEP @@ -2464,8 +2457,11 @@ static struct snd_kcontrol_new alc_beep_mixer[] = {  static int alc_build_controls(struct hda_codec *codec)  {  	struct alc_spec *spec = codec->spec; -	int err; -	int i; +	struct snd_kcontrol *kctl; +	struct snd_kcontrol_new *knew; +	int i, j, err; +	unsigned int u; +	hda_nid_t nid;  	for (i = 0; i < spec->num_mixers; i++) {  		err = snd_hda_add_new_ctls(codec, spec->mixers[i]); @@ -2506,8 +2502,7 @@ static int alc_build_controls(struct hda_codec *codec)  			if (!kctl)  				return -ENOMEM;  			kctl->private_value = spec->beep_amp; -			err = snd_hda_ctl_add(codec, -					get_amp_nid_(spec->beep_amp), kctl); +			err = snd_hda_ctl_add(codec, 0, kctl);  			if (err < 0)  				return err;  		} @@ -2534,6 +2529,75 @@ static int alc_build_controls(struct hda_codec *codec)  	}  	alc_free_kctls(codec); /* no longer needed */ + +	/* assign Capture Source enums to NID */ +	kctl = snd_hda_find_mixer_ctl(codec, "Capture Source"); +	if (!kctl) +		kctl = snd_hda_find_mixer_ctl(codec, "Input Source"); +	for (i = 0; kctl && i < kctl->count; i++) { +		hda_nid_t *nids = spec->capsrc_nids; +		if (!nids) +			nids = spec->adc_nids; +		err = snd_hda_add_nid(codec, kctl, i, nids[i]); +		if (err < 0) +			return err; +	} +	if (spec->cap_mixer) { +		const char *kname = kctl ? kctl->id.name : NULL; +		for (knew = spec->cap_mixer; knew->name; knew++) { +			if (kname && strcmp(knew->name, kname) == 0) +				continue; +			kctl = snd_hda_find_mixer_ctl(codec, knew->name); +			for (i = 0; kctl && i < kctl->count; i++) { +				err = snd_hda_add_nid(codec, kctl, i, +						      spec->adc_nids[i]); +				if (err < 0) +					return err; +			} +		} +	} + +	/* other nid->control mapping */ +	for (i = 0; i < spec->num_mixers; i++) { +		for (knew = spec->mixers[i]; knew->name; knew++) { +			if (knew->iface != NID_MAPPING) +				continue; +			kctl = snd_hda_find_mixer_ctl(codec, knew->name); +			if (kctl == NULL) +				continue; +			u = knew->subdevice; +			for (j = 0; j < 4; j++, u >>= 8) { +				nid = u & 0x3f; +				if (nid == 0) +					continue; +				switch (u & 0xc0) { +				case SUBDEV_SPEAKER_: +					nid = spec->autocfg.speaker_pins[nid]; +					break; +				case SUBDEV_LINE_: +					nid = spec->autocfg.line_out_pins[nid]; +					break; +				case SUBDEV_HP_: +					nid = spec->autocfg.hp_pins[nid]; +					break; +				default: +					continue; +				} +				err = snd_hda_add_nid(codec, kctl, 0, nid); +				if (err < 0) +					return err; +			} +			u = knew->private_value; +			for (j = 0; j < 4; j++, u >>= 8) { +				nid = u & 0xff; +				if (nid == 0) +					continue; +				err = snd_hda_add_nid(codec, kctl, 0, nid); +				if (err < 0) +					return err; +			} +		} +	}  	return 0;  } @@ -3616,6 +3680,11 @@ static int alc_build_pcms(struct hda_codec *codec)  	return 0;  } +static inline void alc_shutup(struct hda_codec *codec) +{ +	snd_hda_shutup_pins(codec); +} +  static void alc_free_kctls(struct hda_codec *codec)  {  	struct alc_spec *spec = codec->spec; @@ -3636,17 +3705,44 @@ static void alc_free(struct hda_codec *codec)  	if (!spec)  		return; +	alc_shutup(codec);  	alc_free_kctls(codec);  	kfree(spec);  	snd_hda_detach_beep_device(codec);  }  #ifdef CONFIG_SND_HDA_POWER_SAVE +static void alc_power_eapd(struct hda_codec *codec) +{ +	/* We currently only handle front, HP */ +	switch (codec->vendor_id) { +	case 0x10ec0260: +		set_eapd(codec, 0x0f, 0); +		set_eapd(codec, 0x10, 0); +		break; +	case 0x10ec0262: +	case 0x10ec0267: +	case 0x10ec0268: +	case 0x10ec0269: +	case 0x10ec0270: +	case 0x10ec0272: +	case 0x10ec0660: +	case 0x10ec0662: +	case 0x10ec0663: +	case 0x10ec0862: +	case 0x10ec0889: +		set_eapd(codec, 0x14, 0); +		set_eapd(codec, 0x15, 0); +		break; +	} +} +  static int alc_suspend(struct hda_codec *codec, pm_message_t state)  {  	struct alc_spec *spec = codec->spec; +	alc_shutup(codec);  	if (spec && spec->power_hook) -		spec->power_hook(codec, 0); +		spec->power_hook(codec);  	return 0;  }  #endif @@ -3654,16 +3750,9 @@ static int alc_suspend(struct hda_codec *codec, pm_message_t state)  #ifdef SND_HDA_NEEDS_RESUME  static int alc_resume(struct hda_codec *codec)  { -#ifdef CONFIG_SND_HDA_POWER_SAVE -	struct alc_spec *spec = codec->spec; -#endif  	codec->patch_ops.init(codec);  	snd_hda_codec_resume_amp(codec);  	snd_hda_codec_resume_cache(codec); -#ifdef CONFIG_SND_HDA_POWER_SAVE -	if (spec && spec->power_hook) -		spec->power_hook(codec, 1); -#endif  	return 0;  }  #endif @@ -3683,6 +3772,7 @@ static struct hda_codec_ops alc_patch_ops = {  	.suspend = alc_suspend,  	.check_power_status = alc_check_power_status,  #endif +	.reboot_notify = alc_shutup,  }; @@ -3839,6 +3929,7 @@ static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,  #define PIN_CTL_TEST(xname,nid) {			\  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,	\  			.name = xname,		       \ +			.subdevice = HDA_SUBDEV_NID_FLAG | nid, \  			.info = alc_test_pin_ctl_info, \  			.get = alc_test_pin_ctl_get,   \  			.put = alc_test_pin_ctl_put,   \ @@ -3848,6 +3939,7 @@ static int alc_test_pin_src_put(struct snd_kcontrol *kcontrol,  #define PIN_SRC_TEST(xname,nid) {			\  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,	\  			.name = xname,		       \ +			.subdevice = HDA_SUBDEV_NID_FLAG | nid, \  			.info = alc_test_pin_src_info, \  			.get = alc_test_pin_src_get,   \  			.put = alc_test_pin_src_put,   \ @@ -4387,7 +4479,7 @@ static int add_control(struct alc_spec *spec, int type, const char *name,  	if (!knew->name)  		return -ENOMEM;  	if (get_amp_nid_(val)) -		knew->subdevice = HDA_SUBDEV_NID_FLAG | get_amp_nid_(val); +		knew->subdevice = HDA_SUBDEV_AMP_FLAG;  	knew->private_value = val;  	return 0;  } @@ -4770,7 +4862,7 @@ static int alc880_parse_auto_config(struct hda_codec *codec)  	spec->num_mux_defs = 1;  	spec->input_mux = &spec->private_imux[0]; -	alc_ssid_check(codec, 0x15, 0x1b, 0x14); +	alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);  	return 1;  } @@ -4974,7 +5066,6 @@ static int patch_alc880(struct hda_codec *codec)  	if (!spec->loopback.amplist)  		spec->loopback.amplist = alc880_loopbacks;  #endif -	codec->proc_widget_hook = print_realtek_coef;  	return 0;  } @@ -5182,6 +5273,7 @@ static struct snd_kcontrol_new alc260_hp_output_mixer[] = {  	{  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,  		.name = "Master Playback Switch", +		.subdevice = HDA_SUBDEV_NID_FLAG | 0x11,  		.info = snd_ctl_boolean_mono_info,  		.get = alc260_hp_master_sw_get,  		.put = alc260_hp_master_sw_put, @@ -5220,6 +5312,7 @@ static struct snd_kcontrol_new alc260_hp_3013_mixer[] = {  	{  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,  		.name = "Master Playback Switch", +		.subdevice = HDA_SUBDEV_NID_FLAG | 0x11,  		.info = snd_ctl_boolean_mono_info,  		.get = alc260_hp_master_sw_get,  		.put = alc260_hp_master_sw_put, @@ -6303,7 +6396,7 @@ static int alc260_parse_auto_config(struct hda_codec *codec)  	spec->num_mux_defs = 1;  	spec->input_mux = &spec->private_imux[0]; -	alc_ssid_check(codec, 0x10, 0x15, 0x0f); +	alc_ssid_check(codec, 0x10, 0x15, 0x0f, 0);  	return 1;  } @@ -6582,7 +6675,6 @@ static int patch_alc260(struct hda_codec *codec)  	if (!spec->loopback.amplist)  		spec->loopback.amplist = alc260_loopbacks;  #endif -	codec->proc_widget_hook = print_realtek_coef;  	return 0;  } @@ -6664,6 +6756,14 @@ static struct hda_input_mux mb5_capture_source = {  	},  }; +static struct hda_input_mux macmini3_capture_source = { +	.num_items = 2, +	.items = { +		{ "Line", 0x2 }, +		{ "CD", 0x4 }, +	}, +}; +  static struct hda_input_mux alc883_3stack_6ch_intel = {  	.num_items = 4,  	.items = { @@ -6852,6 +6952,13 @@ static struct hda_channel_mode alc882_sixstack_modes[2] = {  	{ 8, alc882_sixstack_ch8_init },  }; + +/* Macbook Air 2,1 */ + +static struct hda_channel_mode alc885_mba21_ch_modes[1] = { +      { 2, NULL }, +}; +  /*   * macbook pro ALC885 can switch LineIn to LineOut without losing Mic   */ @@ -6912,6 +7019,7 @@ static struct hda_channel_mode alc885_mb5_6ch_modes[2] = {  	{ 6, alc885_mb5_ch6_init },  }; +#define alc885_macmini3_6ch_modes	alc885_mb5_6ch_modes  /*   * 2ch mode @@ -7123,6 +7231,15 @@ static struct snd_kcontrol_new alc882_base_mixer[] = {  	{ } /* end */  }; +/* Macbook Air 2,1 same control for HP and internal Speaker */ + +static struct snd_kcontrol_new alc885_mba21_mixer[] = { +      HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT), +      HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 0x02, HDA_OUTPUT), +     { } +}; + +  static struct snd_kcontrol_new alc885_mbp3_mixer[] = {  	HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x00, HDA_OUTPUT),  	HDA_BIND_MUTE   ("Speaker Playback Switch", 0x0c, 0x02, HDA_INPUT), @@ -7156,6 +7273,21 @@ static struct snd_kcontrol_new alc885_mb5_mixer[] = {  	{ } /* end */  }; +static struct snd_kcontrol_new alc885_macmini3_mixer[] = { +	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), +	HDA_BIND_MUTE   ("Front Playback Switch", 0x0c, 0x02, HDA_INPUT), +	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x00, HDA_OUTPUT), +	HDA_BIND_MUTE   ("Surround Playback Switch", 0x0d, 0x02, HDA_INPUT), +	HDA_CODEC_VOLUME("LFE Playback Volume", 0x0e, 0x00, HDA_OUTPUT), +	HDA_BIND_MUTE   ("LFE Playback Switch", 0x0e, 0x02, HDA_INPUT), +	HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0f, 0x00, HDA_OUTPUT), +	HDA_BIND_MUTE   ("Headphone Playback Switch", 0x0f, 0x02, HDA_INPUT), +	HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x07, HDA_INPUT), +	HDA_CODEC_MUTE  ("Line Playback Switch", 0x0b, 0x07, HDA_INPUT), +	HDA_CODEC_VOLUME("Line Boost", 0x15, 0x00, HDA_INPUT), +	{ } /* end */ +}; +  static struct snd_kcontrol_new alc885_imac91_mixer[] = {  	HDA_CODEC_VOLUME("Line-Out Playback Volume", 0x0c, 0x00, HDA_OUTPUT),  	HDA_BIND_MUTE   ("Line-Out Playback Switch", 0x0c, 0x02, HDA_INPUT), @@ -7247,29 +7379,18 @@ static struct snd_kcontrol_new alc882_chmode_mixer[] = {  static struct hda_verb alc882_base_init_verbs[] = {  	/* Front mixer: unmute input/output amp left and right (volume = 0) */ -	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},  	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},  	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},  	/* Rear mixer */ -	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},  	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},  	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},  	/* CLFE mixer */ -	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},  	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},  	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},  	/* Side mixer */ -	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},  	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},  	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, -	/* mute analog input loopbacks */ -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, -  	/* Front Pin: output 0 (0x0c) */  	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},  	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, @@ -7306,14 +7427,8 @@ static struct hda_verb alc882_base_init_verbs[] = {  	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */  	/* Input mixer2 */  	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},  	/* Input mixer3 */  	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},  	/* ADC2: mute amp left and right */  	{0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},  	{0x08, AC_VERB_SET_CONNECT_SEL, 0x00}, @@ -7357,26 +7472,17 @@ static struct hda_verb alc_hp15_unsol_verbs[] = {  static struct hda_verb alc885_init_verbs[] = {  	/* Front mixer: unmute input/output amp left and right (volume = 0) */ -	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, -	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},  	/* Rear mixer */ -	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, -	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, +	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},  	/* CLFE mixer */ -	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, -	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, +	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},  	/* Side mixer */ -	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, -	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, - -	/* mute analog input loopbacks */ -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},  	/* Front HP Pin: output 0 (0x0c) */  	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, @@ -7410,17 +7516,11 @@ static struct hda_verb alc885_init_verbs[] = {  	/* Mixer elements: 0x18, , 0x1a, 0x1b */  	/* Input mixer1 */ -	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)}, -	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, +	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},  	/* Input mixer2 */  	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},  	/* Input mixer3 */ -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)}, -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, +	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},  	/* ADC2: mute amp left and right */  	{0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},  	/* ADC3: mute amp left and right */ @@ -7562,6 +7662,76 @@ static struct hda_verb alc885_mb5_init_verbs[] = {  	{ }  }; +/* Macmini 3,1 */ +static struct hda_verb alc885_macmini3_init_verbs[] = { +	/* DACs */ +	{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x05, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	/* Front mixer */ +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, +	/* Surround mixer */ +	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, +	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, +	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, +	/* LFE mixer */ +	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, +	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, +	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, +	/* HP mixer */ +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, +	/* Front Pin (0x0c) */ +	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, +	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, +	/* LFE Pin (0x0e) */ +	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | 0x01}, +	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x1a, AC_VERB_SET_CONNECT_SEL, 0x02}, +	/* HP Pin (0x0f) */ +	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, +	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x14, AC_VERB_SET_CONNECT_SEL, 0x03}, +	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN}, +	/* Line In pin */ +	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, +	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + +	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, +	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, +	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, +	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, +	{ } +}; + + +static struct hda_verb alc885_mba21_init_verbs[] = { +	/*Internal and HP Speaker Mixer*/ +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, +	/*Internal Speaker Pin (0x0c)*/ +	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, (PIN_OUT | AC_PINCTL_VREF_50) }, +	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x18, AC_VERB_SET_CONNECT_SEL, 0x00}, +	/* HP Pin: output 0 (0x0e) */ +	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, +	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, +	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, (ALC880_HP_EVENT | AC_USRSP_EN)}, +	/* Line in (is hp when jack connected)*/ +	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, AC_PINCTL_VREF_50}, +	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, + +	{ } + }; + +  /* Macbook Pro rev3 */  static struct hda_verb alc885_mbp3_init_verbs[] = {  	/* Front mixer: unmute input/output amp left and right (volume = 0) */ @@ -7724,54 +7894,35 @@ static void alc885_imac24_setup(struct hda_codec *codec)  	spec->autocfg.speaker_pins[1] = 0x1a;  } -static void alc885_mbp3_setup(struct hda_codec *codec) -{ -	struct alc_spec *spec = codec->spec; - -	spec->autocfg.hp_pins[0] = 0x15; -	spec->autocfg.speaker_pins[0] = 0x14; -} +#define alc885_mb5_setup	alc885_imac24_setup +#define alc885_macmini3_setup	alc885_imac24_setup -static void alc885_mb5_automute(struct hda_codec *codec) +/* Macbook Air 2,1 */ +static void alc885_mba21_setup(struct hda_codec *codec)  { -	unsigned int present; - -	present = snd_hda_codec_read(codec, 0x14, 0, -				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; -	snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0, -				 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); -	snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, -				 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); +       struct alc_spec *spec = codec->spec; +       spec->autocfg.hp_pins[0] = 0x14; +       spec->autocfg.speaker_pins[0] = 0x18;  } -static void alc885_mb5_unsol_event(struct hda_codec *codec, -				    unsigned int res) -{ -	/* Headphone insertion or removal. */ -	if ((res >> 26) == ALC880_HP_EVENT) -		alc885_mb5_automute(codec); -} -static void alc885_imac91_automute(struct hda_codec *codec) -{ - 	unsigned int present; -	present = snd_hda_codec_read(codec, 0x14, 0, -				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; -	snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0, -				 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); -	snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0, -				 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0); +static void alc885_mbp3_setup(struct hda_codec *codec) +{ +	struct alc_spec *spec = codec->spec; +	spec->autocfg.hp_pins[0] = 0x15; +	spec->autocfg.speaker_pins[0] = 0x14;  } -static void alc885_imac91_unsol_event(struct hda_codec *codec, -				    unsigned int res) +static void alc885_imac91_setup(struct hda_codec *codec)  { -	/* Headphone insertion or removal. */ -	if ((res >> 26) == ALC880_HP_EVENT) -		alc885_imac91_automute(codec); +	struct alc_spec *spec = codec->spec; + +	spec->autocfg.hp_pins[0] = 0x14; +	spec->autocfg.speaker_pins[0] = 0x15; +	spec->autocfg.speaker_pins[1] = 0x1a;  }  static struct hda_verb alc882_targa_verbs[] = { @@ -7906,18 +8057,6 @@ static struct hda_verb alc883_auto_init_verbs[] = {  	{0x09, AC_VERB_SET_CONNECT_SEL, 0x00},  	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	/* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback -	 * mixer widget -	 * Note: PASD motherboards uses the Line In 2 as the input for -	 * front panel mic (mic 2) -	 */ -	/* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, -  	/*  	 * Set up output mixers (0x0c - 0x0f)  	 */ @@ -7942,16 +8081,9 @@ static struct hda_verb alc883_auto_init_verbs[] = {  	/* FIXME: use matrix-type input source selection */  	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */  	/* Input mixer2 */ -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, +	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},  	/* Input mixer3 */ -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))}, -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))}, -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))}, -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))}, - +	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},  	{ }  }; @@ -8938,6 +9070,8 @@ static const char *alc882_models[ALC882_MODEL_LAST] = {  	[ALC882_ASUS_A7M]	= "asus-a7m",  	[ALC885_MACPRO]		= "macpro",  	[ALC885_MB5]		= "mb5", +	[ALC885_MACMINI3]	= "macmini3", +	[ALC885_MBA21]		= "mba21",  	[ALC885_MBP3]		= "mbp3",  	[ALC885_IMAC24]		= "imac24",  	[ALC885_IMAC91]		= "imac91", @@ -9121,6 +9255,7 @@ static struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {  	 */  	SND_PCI_QUIRK(0x106b, 0x4000, "MacbookPro 5,1", ALC885_MB5),  	SND_PCI_QUIRK(0x106b, 0x4600, "MacbookPro 5,2", ALC885_MB5), +	SND_PCI_QUIRK(0x106b, 0x4100, "Macmini 3,1", ALC885_MACMINI3),  	{} /* terminator */  }; @@ -9172,6 +9307,18 @@ static struct alc_config_preset alc882_presets[] = {  		.input_mux = &alc882_capture_source,  		.dig_out_nid = ALC882_DIGOUT_NID,  	}, +	   [ALC885_MBA21] = { +			.mixers = { alc885_mba21_mixer }, +			.init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, +			.num_dacs = 2, +			.dac_nids = alc882_dac_nids, +			.channel_mode = alc885_mba21_ch_modes, +			.num_channel_mode = ARRAY_SIZE(alc885_mba21_ch_modes), +			.input_mux = &alc882_capture_source, +			.unsol_event = alc_automute_amp_unsol_event, +			.setup = alc885_mba21_setup, +			.init_hook = alc_automute_amp, +       },  	[ALC885_MBP3] = {  		.mixers = { alc885_mbp3_mixer, alc882_chmode_mixer },  		.init_verbs = { alc885_mbp3_init_verbs, @@ -9199,8 +9346,24 @@ static struct alc_config_preset alc882_presets[] = {  		.input_mux = &mb5_capture_source,  		.dig_out_nid = ALC882_DIGOUT_NID,  		.dig_in_nid = ALC882_DIGIN_NID, -		.unsol_event = alc885_mb5_unsol_event, -		.init_hook = alc885_mb5_automute, +		.unsol_event = alc_automute_amp_unsol_event, +		.setup = alc885_mb5_setup, +		.init_hook = alc_automute_amp, +	}, +	[ALC885_MACMINI3] = { +		.mixers = { alc885_macmini3_mixer, alc882_chmode_mixer }, +		.init_verbs = { alc885_macmini3_init_verbs, +				alc880_gpio1_init_verbs }, +		.num_dacs = ARRAY_SIZE(alc882_dac_nids), +		.dac_nids = alc882_dac_nids, +		.channel_mode = alc885_macmini3_6ch_modes, +		.num_channel_mode = ARRAY_SIZE(alc885_macmini3_6ch_modes), +		.input_mux = &macmini3_capture_source, +		.dig_out_nid = ALC882_DIGOUT_NID, +		.dig_in_nid = ALC882_DIGIN_NID, +		.unsol_event = alc_automute_amp_unsol_event, +		.setup = alc885_macmini3_setup, +		.init_hook = alc_automute_amp,  	},  	[ALC885_MACPRO] = {  		.mixers = { alc882_macpro_mixer }, @@ -9239,8 +9402,9 @@ static struct alc_config_preset alc882_presets[] = {  		.input_mux = &alc882_capture_source,  		.dig_out_nid = ALC882_DIGOUT_NID,  		.dig_in_nid = ALC882_DIGIN_NID, -		.unsol_event = alc885_imac91_unsol_event, -		.init_hook = alc885_imac91_automute, +		.unsol_event = alc_automute_amp_unsol_event, +		.setup = alc885_imac91_setup, +		.init_hook = alc_automute_amp,  	},  	[ALC882_TARGA] = {  		.mixers = { alc882_targa_mixer, alc882_chmode_mixer }, @@ -9528,7 +9692,7 @@ static struct alc_config_preset alc882_presets[] = {  		.setup = alc889_acer_aspire_8930g_setup,  		.init_hook = alc_automute_amp,  #ifdef CONFIG_SND_HDA_POWER_SAVE -		.power_hook = alc889_power_eapd, +		.power_hook = alc_power_eapd,  #endif  	},  	[ALC888_ACER_ASPIRE_7730G] = { @@ -10063,7 +10227,7 @@ static int alc882_parse_auto_config(struct hda_codec *codec)  	spec->num_mux_defs = 1;  	spec->input_mux = &spec->private_imux[0]; -	alc_ssid_check(codec, 0x15, 0x1b, 0x14); +	alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);  	err = alc_auto_add_mic_boost(codec);  	if (err < 0) @@ -10201,7 +10365,6 @@ static int patch_alc882(struct hda_codec *codec)  	if (!spec->loopback.amplist)  		spec->loopback.amplist = alc882_loopbacks;  #endif -	codec->proc_widget_hook = print_realtek_coef;  	return 0;  } @@ -10324,8 +10487,14 @@ static int alc262_hp_master_sw_put(struct snd_kcontrol *kcontrol,  		.info = snd_ctl_boolean_mono_info,		\  		.get = alc262_hp_master_sw_get,			\  		.put = alc262_hp_master_sw_put,			\ +	}, \ +	{							\ +		.iface = NID_MAPPING,				\ +		.name = "Master Playback Switch",		\ +		.private_value = 0x15 | (0x16 << 8) | (0x1b << 16),	\  	} +  static struct snd_kcontrol_new alc262_HP_BPC_mixer[] = {  	ALC262_HP_MASTER_SWITCH,  	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), @@ -10483,6 +10652,12 @@ static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,  		.info = snd_ctl_boolean_mono_info,		\  		.get = alc262_hippo_master_sw_get,		\  		.put = alc262_hippo_master_sw_put,		\ +	},							\ +	{							\ +		.iface = NID_MAPPING,				\ +		.name = "Master Playback Switch",		\ +		.subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \ +			     (SUBDEV_SPEAKER(0) << 16), \  	}  static struct snd_kcontrol_new alc262_hippo_mixer[] = { @@ -10963,11 +11138,17 @@ static struct snd_kcontrol_new alc262_fujitsu_mixer[] = {  	{  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,  		.name = "Master Playback Switch", +		.subdevice = HDA_SUBDEV_AMP_FLAG,  		.info = snd_hda_mixer_amp_switch_info,  		.get = snd_hda_mixer_amp_switch_get,  		.put = alc262_fujitsu_master_sw_put,  		.private_value = HDA_COMPOSE_AMP_VAL(0x14, 3, 0, HDA_OUTPUT),  	}, +	{ +		.iface = NID_MAPPING, +		.name = "Master Playback Switch", +		.private_value = 0x1b, +	},  	HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),  	HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),  	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), @@ -10998,6 +11179,7 @@ static struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {  	{  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,  		.name = "Master Playback Switch", +		.subdevice = HDA_SUBDEV_AMP_FLAG,  		.info = snd_hda_mixer_amp_switch_info,  		.get = snd_hda_mixer_amp_switch_get,  		.put = alc262_lenovo_3000_master_sw_put, @@ -11152,6 +11334,11 @@ static struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {  		.get = alc_mux_enum_get,  		.put = alc262_ultra_mux_enum_put,  	}, +	{ +		.iface = NID_MAPPING, +		.name = "Capture Source", +		.private_value = 0x15, +	},  	{ } /* end */  }; @@ -11598,7 +11785,7 @@ static int alc262_parse_auto_config(struct hda_codec *codec)  	if (err < 0)  		return err; -	alc_ssid_check(codec, 0x15, 0x14, 0x1b); +	alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);  	return 1;  } @@ -12041,7 +12228,6 @@ static int patch_alc262(struct hda_codec *codec)  	if (!spec->loopback.amplist)  		spec->loopback.amplist = alc262_loopbacks;  #endif -	codec->proc_widget_hook = print_realtek_coef;  	return 0;  } @@ -12170,6 +12356,7 @@ static struct snd_kcontrol_new alc268_acer_aspire_one_mixer[] = {  	{  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,  		.name = "Master Playback Switch", +		.subdevice = HDA_SUBDEV_AMP_FLAG,  		.info = snd_hda_mixer_amp_switch_info,  		.get = snd_hda_mixer_amp_switch_get,  		.put = alc268_acer_master_sw_put, @@ -12185,6 +12372,7 @@ static struct snd_kcontrol_new alc268_acer_mixer[] = {  	{  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,  		.name = "Master Playback Switch", +		.subdevice = HDA_SUBDEV_AMP_FLAG,  		.info = snd_hda_mixer_amp_switch_info,  		.get = snd_hda_mixer_amp_switch_get,  		.put = alc268_acer_master_sw_put, @@ -12202,6 +12390,7 @@ static struct snd_kcontrol_new alc268_acer_dmic_mixer[] = {  	{  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,  		.name = "Master Playback Switch", +		.subdevice = HDA_SUBDEV_AMP_FLAG,  		.info = snd_hda_mixer_amp_switch_info,  		.get = snd_hda_mixer_amp_switch_get,  		.put = alc268_acer_master_sw_put, @@ -12547,7 +12736,6 @@ static int alc268_new_analog_output(struct alc_spec *spec, hda_nid_t nid,  		dac = 0x02;  		break;  	case 0x15: -	case 0x21:  		dac = 0x03;  		break;  	default: @@ -12768,7 +12956,7 @@ static int alc268_parse_auto_config(struct hda_codec *codec)  	if (err < 0)  		return err; -	alc_ssid_check(codec, 0x15, 0x1b, 0x14); +	alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);  	return 1;  } @@ -13105,8 +13293,6 @@ static int patch_alc268(struct hda_codec *codec)  	if (board_config == ALC268_AUTO)  		spec->init_hook = alc268_auto_init; -	codec->proc_widget_hook = print_realtek_coef; -  	return 0;  } @@ -13126,6 +13312,15 @@ static hda_nid_t alc269_capsrc_nids[1] = {  	0x23,  }; +static hda_nid_t alc269vb_adc_nids[1] = { +	/* ADC1 */ +	0x09, +}; + +static hda_nid_t alc269vb_capsrc_nids[1] = { +	0x22, +}; +  /* NOTE: ADC2 (0x07) is connected from a recording *MIXER* (0x24),   *       not a mux!   */ @@ -13155,6 +13350,7 @@ static struct snd_kcontrol_new alc269_quanta_fl1_mixer[] = {  	{  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,  		.name = "Master Playback Switch", +		.subdevice = HDA_SUBDEV_AMP_FLAG,  		.info = snd_hda_mixer_amp_switch_info,  		.get = snd_hda_mixer_amp_switch_get,  		.put = alc268_acer_master_sw_put, @@ -13175,6 +13371,7 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = {  	{  		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,  		.name = "Master Playback Switch", +		.subdevice = HDA_SUBDEV_AMP_FLAG,  		.info = snd_hda_mixer_amp_switch_info,  		.get = snd_hda_mixer_amp_switch_get,  		.put = alc268_acer_master_sw_put, @@ -13192,7 +13389,7 @@ static struct snd_kcontrol_new alc269_lifebook_mixer[] = {  	{ }  }; -static struct snd_kcontrol_new alc269_eeepc_mixer[] = { +static struct snd_kcontrol_new alc269_laptop_mixer[] = {  	HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),  	HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT),  	HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT), @@ -13200,16 +13397,47 @@ static struct snd_kcontrol_new alc269_eeepc_mixer[] = {  	{ } /* end */  }; +static struct snd_kcontrol_new alc269vb_laptop_mixer[] = { +	HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT), +	HDA_CODEC_VOLUME("Speaker Playback Volume", 0x02, 0x0, HDA_OUTPUT), +	HDA_CODEC_MUTE("Headphone Playback Switch", 0x21, 0x0, HDA_OUTPUT), +	HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT), +	{ } /* end */ +}; +  /* capture mixer elements */ -static struct snd_kcontrol_new alc269_epc_capture_mixer[] = { +static struct snd_kcontrol_new alc269_laptop_analog_capture_mixer[] = { +	HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT), +	HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT), +	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), +	HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), +	{ } /* end */ +}; + +static struct snd_kcontrol_new alc269_laptop_digital_capture_mixer[] = {  	HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),  	HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),  	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),  	{ } /* end */  }; +static struct snd_kcontrol_new alc269vb_laptop_analog_capture_mixer[] = { +	HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), +	HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), +	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), +	HDA_CODEC_VOLUME("IntMic Boost", 0x19, 0, HDA_INPUT), +	{ } /* end */ +}; + +static struct snd_kcontrol_new alc269vb_laptop_digital_capture_mixer[] = { +	HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT), +	HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT), +	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT), +	{ } /* end */ +}; +  /* FSC amilo */ -#define alc269_fujitsu_mixer	alc269_eeepc_mixer +#define alc269_fujitsu_mixer	alc269_laptop_mixer  static struct hda_verb alc269_quanta_fl1_verbs[] = {  	{0x15, AC_VERB_SET_CONNECT_SEL, 0x01}, @@ -13352,7 +13580,7 @@ static void alc269_lifebook_init_hook(struct hda_codec *codec)  	alc269_lifebook_mic_autoswitch(codec);  } -static struct hda_verb alc269_eeepc_dmic_init_verbs[] = { +static struct hda_verb alc269_laptop_dmic_init_verbs[] = {  	{0x15, AC_VERB_SET_CONNECT_SEL, 0x01},  	{0x23, AC_VERB_SET_CONNECT_SEL, 0x05},  	{0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, @@ -13363,7 +13591,7 @@ static struct hda_verb alc269_eeepc_dmic_init_verbs[] = {  	{}  }; -static struct hda_verb alc269_eeepc_amic_init_verbs[] = { +static struct hda_verb alc269_laptop_amic_init_verbs[] = {  	{0x15, AC_VERB_SET_CONNECT_SEL, 0x01},  	{0x23, AC_VERB_SET_CONNECT_SEL, 0x01},  	{0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, @@ -13373,6 +13601,28 @@ static struct hda_verb alc269_eeepc_amic_init_verbs[] = {  	{}  }; +static struct hda_verb alc269vb_laptop_dmic_init_verbs[] = { +	{0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, +	{0x22, AC_VERB_SET_CONNECT_SEL, 0x06}, +	{0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, +	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, +	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, +	{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, +	{0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, +	{} +}; + +static struct hda_verb alc269vb_laptop_amic_init_verbs[] = { +	{0x21, AC_VERB_SET_CONNECT_SEL, 0x01}, +	{0x22, AC_VERB_SET_CONNECT_SEL, 0x01}, +	{0x02, AC_VERB_SET_AMP_GAIN_MUTE, 0xb026 }, +	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, (0x7019 | (0x00 << 8))}, +	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, +	{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT}, +	{0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT}, +	{} +}; +  /* toggle speaker-output according to the hp-jack state */  static void alc269_speaker_automute(struct hda_codec *codec)  { @@ -13390,7 +13640,7 @@ static void alc269_speaker_automute(struct hda_codec *codec)  }  /* unsolicited event for HP jack sensing */ -static void alc269_eeepc_unsol_event(struct hda_codec *codec, +static void alc269_laptop_unsol_event(struct hda_codec *codec,  				     unsigned int res)  {  	switch (res >> 26) { @@ -13403,7 +13653,7 @@ static void alc269_eeepc_unsol_event(struct hda_codec *codec,  	}  } -static void alc269_eeepc_dmic_setup(struct hda_codec *codec) +static void alc269_laptop_dmic_setup(struct hda_codec *codec)  {  	struct alc_spec *spec = codec->spec;  	spec->ext_mic.pin = 0x18; @@ -13413,7 +13663,17 @@ static void alc269_eeepc_dmic_setup(struct hda_codec *codec)  	spec->auto_mic = 1;  } -static void alc269_eeepc_amic_setup(struct hda_codec *codec) +static void alc269vb_laptop_dmic_setup(struct hda_codec *codec) +{ +	struct alc_spec *spec = codec->spec; +	spec->ext_mic.pin = 0x18; +	spec->ext_mic.mux_idx = 0; +	spec->int_mic.pin = 0x12; +	spec->int_mic.mux_idx = 6; +	spec->auto_mic = 1; +} + +static void alc269_laptop_amic_setup(struct hda_codec *codec)  {  	struct alc_spec *spec = codec->spec;  	spec->ext_mic.pin = 0x18; @@ -13423,7 +13683,7 @@ static void alc269_eeepc_amic_setup(struct hda_codec *codec)  	spec->auto_mic = 1;  } -static void alc269_eeepc_inithook(struct hda_codec *codec) +static void alc269_laptop_inithook(struct hda_codec *codec)  {  	alc269_speaker_automute(codec);  	alc_mic_automute(codec); @@ -13436,22 +13696,10 @@ static struct hda_verb alc269_init_verbs[] = {  	/*  	 * Unmute ADC0 and set the default input to mic-in  	 */ -	{0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - -	/* Mute input amps (PCBeep, Line In, Mic 1 & Mic 2) of the -	 * analog-loopback mixer widget -	 * Note: PASD motherboards uses the Line In 2 as the input for -	 * front panel mic (mic 2) -	 */ -	/* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, +	{0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},  	/* -	 * Set up output mixers (0x0c - 0x0e) +	 * Set up output mixers (0x02 - 0x03)  	 */  	/* set vol=0 to output mixers */  	{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, @@ -13476,26 +13724,57 @@ static struct hda_verb alc269_init_verbs[] = {  	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},  	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, -	{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, -	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, -	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, -	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, -	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, -	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, -	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, +	/* FIXME: use Mux-type input source selection */ +	/* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */ +	/* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ +	{0x23, AC_VERB_SET_CONNECT_SEL, 0x00}, -	/* FIXME: use matrix-type input source selection */ +	/* set EAPD */ +	{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, +	{ } +}; + +static struct hda_verb alc269vb_init_verbs[] = { +	/* +	 * Unmute ADC0 and set the default input to mic-in +	 */ +	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, + +	/* +	 * Set up output mixers (0x02 - 0x03) +	 */ +	/* set vol=0 to output mixers */ +	{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, +	{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, + +	/* set up input amps for analog loopback */ +	/* Amp Indices: DAC = 0, mixer = 1 */ +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, +	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, + +	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, +	{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, +	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, +	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, +	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, +	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, +	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, + +	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, + +	/* FIXME: use Mux-type input source selection */  	/* Mixer elements: 0x18, 19, 1a, 1b, 1d, 0b */  	/* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */ -	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, -	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, +	{0x22, AC_VERB_SET_CONNECT_SEL, 0x00},  	/* set EAPD */  	{0x14, AC_VERB_SET_EAPD_BTLENABLE, 2}, -	{0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},  	{ }  }; @@ -13543,6 +13822,7 @@ static int alc269_parse_auto_config(struct hda_codec *codec)  	struct alc_spec *spec = codec->spec;  	int err;  	static hda_nid_t alc269_ignore[] = { 0x1d, 0 }; +	hda_nid_t real_capsrc_nids;  	err = snd_hda_parse_pin_def_config(codec, &spec->autocfg,  					   alc269_ignore); @@ -13564,11 +13844,20 @@ static int alc269_parse_auto_config(struct hda_codec *codec)  	if (spec->kctls.list)  		add_mixer(spec, spec->kctls.list); -	add_verb(spec, alc269_init_verbs); +	if ((alc_read_coef_idx(codec, 0) & 0x00f0) == 0x0010) { +		add_verb(spec, alc269vb_init_verbs); +		real_capsrc_nids = alc269vb_capsrc_nids[0]; +		alc_ssid_check(codec, 0, 0x1b, 0x14, 0x21); +	} else { +		add_verb(spec, alc269_init_verbs); +		real_capsrc_nids = alc269_capsrc_nids[0]; +		alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0); +	} +  	spec->num_mux_defs = 1;  	spec->input_mux = &spec->private_imux[0];  	/* set default input source */ -	snd_hda_codec_write_cache(codec, alc269_capsrc_nids[0], +	snd_hda_codec_write_cache(codec, real_capsrc_nids,  				  0, AC_VERB_SET_CONNECT_SEL,  				  spec->input_mux->items[0].index); @@ -13579,8 +13868,6 @@ static int alc269_parse_auto_config(struct hda_codec *codec)  	if (!spec->cap_mixer && !spec->no_analog)  		set_capture_mixer(codec); -	alc_ssid_check(codec, 0x15, 0x1b, 0x14); -  	return 1;  } @@ -13606,8 +13893,8 @@ static void alc269_auto_init(struct hda_codec *codec)  static const char *alc269_models[ALC269_MODEL_LAST] = {  	[ALC269_BASIC]			= "basic",  	[ALC269_QUANTA_FL1]		= "quanta", -	[ALC269_ASUS_AMIC]		= "asus-amic", -	[ALC269_ASUS_DMIC]		= "asus-dmic", +	[ALC269_AMIC]			= "laptop-amic", +	[ALC269_DMIC]			= "laptop-dmic",  	[ALC269_FUJITSU]		= "fujitsu",  	[ALC269_LIFEBOOK]		= "lifebook",  	[ALC269_AUTO]			= "auto", @@ -13616,43 +13903,57 @@ static const char *alc269_models[ALC269_MODEL_LAST] = {  static struct snd_pci_quirk alc269_cfg_tbl[] = {  	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_QUANTA_FL1),  	SND_PCI_QUIRK(0x1043, 0x8330, "ASUS Eeepc P703 P900A", -		      ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80JT", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_ASUS_DMIC), -	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_ASUS_AMIC), -	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_ASUS_AMIC), +		      ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1013, "ASUS N61Da", ALC269VB_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1113, "ASUS N63Jn", ALC269VB_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1143, "ASUS B53f", ALC269VB_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1133, "ASUS UJ20ft", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1183, "ASUS K72DR", ALC269VB_AMIC), +	SND_PCI_QUIRK(0x1043, 0x11b3, "ASUS K52DR", ALC269VB_AMIC), +	SND_PCI_QUIRK(0x1043, 0x11e3, "ASUS U33Jc", ALC269VB_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1273, "ASUS UL80Jt", ALC269VB_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1283, "ASUS U53Jc", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x12b3, "ASUS N82Jv", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x12d3, "ASUS N61Jv", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x13a3, "ASUS UL30Vt", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1373, "ASUS G73JX", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1383, "ASUS UJ30Jc", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x13d3, "ASUS N61JA", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1413, "ASUS UL50", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1443, "ASUS UL30", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1453, "ASUS M60Jv", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1483, "ASUS UL80", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x14f3, "ASUS F83Vf", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x14e3, "ASUS UL20", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1513, "ASUS UX30", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1593, "ASUS N51Vn", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x15a3, "ASUS N60Jv", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x15b3, "ASUS N60Dp", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x15c3, "ASUS N70De", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x15e3, "ASUS F83T", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1643, "ASUS M60J", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1653, "ASUS U50", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1693, "ASUS F50N", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x16a3, "ASUS F5Q", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x16e3, "ASUS UX50", ALC269_DMIC), +	SND_PCI_QUIRK(0x1043, 0x1723, "ASUS P80", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1743, "ASUS U80", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1773, "ASUS U20A", ALC269_AMIC), +	SND_PCI_QUIRK(0x1043, 0x1883, "ASUS F81Se", ALC269_AMIC),  	SND_PCI_QUIRK(0x1043, 0x831a, "ASUS Eeepc P901", -		      ALC269_ASUS_DMIC), +		      ALC269_DMIC),  	SND_PCI_QUIRK(0x1043, 0x834a, "ASUS Eeepc S101", -		      ALC269_ASUS_DMIC), -	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_ASUS_DMIC), -	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_ASUS_DMIC), -	SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), +		      ALC269_DMIC), +	SND_PCI_QUIRK(0x1043, 0x8398, "ASUS P1005HA", ALC269_DMIC), +	SND_PCI_QUIRK(0x1043, 0x83ce, "ASUS P1005HA", ALC269_DMIC), +	SND_PCI_QUIRK(0x104d, 0x9071, "SONY XTB", ALC269_DMIC),  	SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook ICH9M-based", ALC269_LIFEBOOK), +	SND_PCI_QUIRK(0x152d, 0x1778, "Quanta ON1", ALC269_DMIC), +	SND_PCI_QUIRK(0x1734, 0x115d, "FSC Amilo", ALC269_FUJITSU), +	SND_PCI_QUIRK(0x17aa, 0x3be9, "Quanta Wistron", ALC269_AMIC), +	SND_PCI_QUIRK(0x17aa, 0x3bf8, "Quanta FL1", ALC269_AMIC), +	SND_PCI_QUIRK(0x17ff, 0x059a, "Quanta EL3", ALC269_DMIC), +	SND_PCI_QUIRK(0x17ff, 0x059b, "Quanta JR1", ALC269_DMIC),  	{}  }; @@ -13680,47 +13981,75 @@ static struct alc_config_preset alc269_presets[] = {  		.setup = alc269_quanta_fl1_setup,  		.init_hook = alc269_quanta_fl1_init_hook,  	}, -	[ALC269_ASUS_AMIC] = { -		.mixers = { alc269_eeepc_mixer }, -		.cap_mixer = alc269_epc_capture_mixer, +	[ALC269_AMIC] = { +		.mixers = { alc269_laptop_mixer }, +		.cap_mixer = alc269_laptop_analog_capture_mixer,  		.init_verbs = { alc269_init_verbs, -				alc269_eeepc_amic_init_verbs }, +				alc269_laptop_amic_init_verbs },  		.num_dacs = ARRAY_SIZE(alc269_dac_nids),  		.dac_nids = alc269_dac_nids,  		.hp_nid = 0x03,  		.num_channel_mode = ARRAY_SIZE(alc269_modes),  		.channel_mode = alc269_modes, -		.unsol_event = alc269_eeepc_unsol_event, -		.setup = alc269_eeepc_amic_setup, -		.init_hook = alc269_eeepc_inithook, +		.unsol_event = alc269_laptop_unsol_event, +		.setup = alc269_laptop_amic_setup, +		.init_hook = alc269_laptop_inithook,  	}, -	[ALC269_ASUS_DMIC] = { -		.mixers = { alc269_eeepc_mixer }, -		.cap_mixer = alc269_epc_capture_mixer, +	[ALC269_DMIC] = { +		.mixers = { alc269_laptop_mixer }, +		.cap_mixer = alc269_laptop_digital_capture_mixer,  		.init_verbs = { alc269_init_verbs, -				alc269_eeepc_dmic_init_verbs }, +				alc269_laptop_dmic_init_verbs }, +		.num_dacs = ARRAY_SIZE(alc269_dac_nids), +		.dac_nids = alc269_dac_nids, +		.hp_nid = 0x03, +		.num_channel_mode = ARRAY_SIZE(alc269_modes), +		.channel_mode = alc269_modes, +		.unsol_event = alc269_laptop_unsol_event, +		.setup = alc269_laptop_dmic_setup, +		.init_hook = alc269_laptop_inithook, +	}, +	[ALC269VB_AMIC] = { +		.mixers = { alc269vb_laptop_mixer }, +		.cap_mixer = alc269vb_laptop_analog_capture_mixer, +		.init_verbs = { alc269vb_init_verbs, +				alc269vb_laptop_amic_init_verbs }, +		.num_dacs = ARRAY_SIZE(alc269_dac_nids), +		.dac_nids = alc269_dac_nids, +		.hp_nid = 0x03, +		.num_channel_mode = ARRAY_SIZE(alc269_modes), +		.channel_mode = alc269_modes, +		.unsol_event = alc269_laptop_unsol_event, +		.setup = alc269_laptop_amic_setup, +		.init_hook = alc269_laptop_inithook, +	}, +	[ALC269VB_DMIC] = { +		.mixers = { alc269vb_laptop_mixer }, +		.cap_mixer = alc269vb_laptop_digital_capture_mixer, +		.init_verbs = { alc269vb_init_verbs, +				alc269vb_laptop_dmic_init_verbs },  		.num_dacs = ARRAY_SIZE(alc269_dac_nids),  		.dac_nids = alc269_dac_nids,  		.hp_nid = 0x03,  		.num_channel_mode = ARRAY_SIZE(alc269_modes),  		.channel_mode = alc269_modes, -		.unsol_event = alc269_eeepc_unsol_event, -		.setup = alc269_eeepc_dmic_setup, -		.init_hook = alc269_eeepc_inithook, +		.unsol_event = alc269_laptop_unsol_event, +		.setup = alc269vb_laptop_dmic_setup, +		.init_hook = alc269_laptop_inithook,  	},  	[ALC269_FUJITSU] = {  		.mixers = { alc269_fujitsu_mixer }, -		.cap_mixer = alc269_epc_capture_mixer, +		.cap_mixer = alc269_laptop_digital_capture_mixer,  		.init_verbs = { alc269_init_verbs, -				alc269_eeepc_dmic_init_verbs }, +				alc269_laptop_dmic_init_verbs },  		.num_dacs = ARRAY_SIZE(alc269_dac_nids),  		.dac_nids = alc269_dac_nids,  		.hp_nid = 0x03,  		.num_channel_mode = ARRAY_SIZE(alc269_modes),  		.channel_mode = alc269_modes, -		.unsol_event = alc269_eeepc_unsol_event, -		.setup = alc269_eeepc_dmic_setup, -		.init_hook = alc269_eeepc_inithook, +		.unsol_event = alc269_laptop_unsol_event, +		.setup = alc269_laptop_dmic_setup, +		.init_hook = alc269_laptop_inithook,  	},  	[ALC269_LIFEBOOK] = {  		.mixers = { alc269_lifebook_mixer }, @@ -13741,6 +14070,7 @@ static int patch_alc269(struct hda_codec *codec)  	struct alc_spec *spec;  	int board_config;  	int err; +	int is_alc269vb = 0;  	spec = kzalloc(sizeof(*spec), GFP_KERNEL);  	if (spec == NULL) @@ -13757,6 +14087,7 @@ static int patch_alc269(struct hda_codec *codec)  			alc_free(codec);  			return -ENOMEM;  		} +		is_alc269vb = 1;  	}  	board_config = snd_hda_check_board_config(codec, ALC269_MODEL_LAST, @@ -13792,7 +14123,7 @@ static int patch_alc269(struct hda_codec *codec)  	if (board_config != ALC269_AUTO)  		setup_preset(codec, &alc269_presets[board_config]); -	if (codec->subsystem_id == 0x17aa3bf8) { +	if (board_config == ALC269_QUANTA_FL1) {  		/* Due to a hardware problem on Lenovo Ideadpad, we need to  		 * fix the sample rate of analog I/O to 44.1kHz  		 */ @@ -13805,9 +14136,16 @@ static int patch_alc269(struct hda_codec *codec)  	spec->stream_digital_playback = &alc269_pcm_digital_playback;  	spec->stream_digital_capture = &alc269_pcm_digital_capture; -	spec->adc_nids = alc269_adc_nids; -	spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); -	spec->capsrc_nids = alc269_capsrc_nids; +	if (!is_alc269vb) { +		spec->adc_nids = alc269_adc_nids; +		spec->num_adc_nids = ARRAY_SIZE(alc269_adc_nids); +		spec->capsrc_nids = alc269_capsrc_nids; +	} else { +		spec->adc_nids = alc269vb_adc_nids; +		spec->num_adc_nids = ARRAY_SIZE(alc269vb_adc_nids); +		spec->capsrc_nids = alc269vb_capsrc_nids; +	} +  	if (!spec->cap_mixer)  		set_capture_mixer(codec);  	set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); @@ -13821,7 +14159,6 @@ static int patch_alc269(struct hda_codec *codec)  	if (!spec->loopback.amplist)  		spec->loopback.amplist = alc269_loopbacks;  #endif -	codec->proc_widget_hook = print_realtek_coef;  	return 0;  } @@ -14684,7 +15021,7 @@ static int alc861_parse_auto_config(struct hda_codec *codec)  	spec->num_adc_nids = ARRAY_SIZE(alc861_adc_nids);  	set_capture_mixer(codec); -	alc_ssid_check(codec, 0x0e, 0x0f, 0x0b); +	alc_ssid_check(codec, 0x0e, 0x0f, 0x0b, 0);  	return 1;  } @@ -14939,13 +15276,16 @@ static int patch_alc861(struct hda_codec *codec)  	spec->vmaster_nid = 0x03;  	codec->patch_ops = alc_patch_ops; -	if (board_config == ALC861_AUTO) +	if (board_config == ALC861_AUTO) {  		spec->init_hook = alc861_auto_init;  #ifdef CONFIG_SND_HDA_POWER_SAVE +		spec->power_hook = alc_power_eapd; +#endif +	} +#ifdef CONFIG_SND_HDA_POWER_SAVE  	if (!spec->loopback.amplist)  		spec->loopback.amplist = alc861_loopbacks;  #endif -	codec->proc_widget_hook = print_realtek_coef;  	return 0;  } @@ -15572,7 +15912,7 @@ static struct alc_config_preset alc861vd_presets[] = {  static int alc861vd_auto_create_input_ctls(struct hda_codec *codec,  						const struct auto_pin_cfg *cfg)  { -	return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x22, 0); +	return alc_auto_create_input_ctls(codec, cfg, 0x15, 0x09, 0);  } @@ -15808,7 +16148,7 @@ static int alc861vd_parse_auto_config(struct hda_codec *codec)  	if (err < 0)  		return err; -	alc_ssid_check(codec, 0x15, 0x1b, 0x14); +	alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);  	return 1;  } @@ -15925,7 +16265,6 @@ static int patch_alc861vd(struct hda_codec *codec)  	if (!spec->loopback.amplist)  		spec->loopback.amplist = alc861vd_loopbacks;  #endif -	codec->proc_widget_hook = print_realtek_coef;  	return 0;  } @@ -16392,13 +16731,6 @@ static struct hda_verb alc662_init_verbs[] = {  	/* ADC: mute amp left and right */  	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},  	{0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, -	/* Front mixer: unmute input/output amp left and right (volume = 0) */ - -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},  	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},  	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, @@ -16448,6 +16780,28 @@ static struct hda_verb alc662_init_verbs[] = {  	{ }  }; +static struct hda_verb alc663_init_verbs[] = { +	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, +	{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, +	{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, +	{ } +}; + +static struct hda_verb alc272_init_verbs[] = { +	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, +	{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE}, +	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, +	{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, +	{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, +	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, +	{ } +}; +  static struct hda_verb alc662_sue_init_verbs[] = {  	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_FRONT_EVENT},  	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN|ALC880_HP_EVENT}, @@ -16467,61 +16821,6 @@ static struct hda_verb alc662_eeepc_ep20_sue_init_verbs[] = {  	{}  }; -/* - * generic initialization of ADC, input mixers and output mixers - */ -static struct hda_verb alc662_auto_init_verbs[] = { -	/* -	 * Unmute ADC and set the default input to mic-in -	 */ -	{0x09, AC_VERB_SET_CONNECT_SEL, 0x00}, -	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, - -	/* Unmute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback -	 * mixer widget -	 * Note: PASD motherboards uses the Line In 2 as the input for front -	 * panel mic (mic 2) -	 */ -	/* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */ -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)}, -	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)}, - -	/* -	 * Set up output mixers (0x0c - 0x0f) -	 */ -	/* set vol=0 to output mixers */ -	{0x02, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, -	{0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, -	{0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO}, - -	/* set up input amps for analog loopback */ -	/* Amp Indices: DAC = 0, mixer = 1 */ -	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, -	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, -	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, - - -	/* FIXME: use matrix-type input source selection */ -	/* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */ -	/* Input mixer */ -	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	{ } -}; - -/* additional verbs for ALC663 */ -static struct hda_verb alc663_auto_init_verbs[] = { -	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)}, -	{0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)}, -	{ } -}; -  static struct hda_verb alc663_m51va_init_verbs[] = {  	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},  	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, @@ -17272,6 +17571,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {  	SND_PCI_QUIRK(0x1028, 0x02f4, "DELL ZM1", ALC272_DELL_ZM1),  	SND_PCI_QUIRK(0x1043, 0x1000, "ASUS N50Vm", ALC663_ASUS_MODE1),  	SND_PCI_QUIRK(0x1043, 0x1092, "ASUS NB", ALC663_ASUS_MODE3), +	SND_PCI_QUIRK(0x1043, 0x1173, "ASUS K73Jn", ALC663_ASUS_MODE1),  	SND_PCI_QUIRK(0x1043, 0x11c3, "ASUS M70V", ALC663_ASUS_MODE3),  	SND_PCI_QUIRK(0x1043, 0x11d3, "ASUS NB", ALC663_ASUS_MODE1),  	SND_PCI_QUIRK(0x1043, 0x11f3, "ASUS NB", ALC662_ASUS_MODE2), @@ -17307,6 +17607,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {  	SND_PCI_QUIRK(0x1043, 0x1893, "ASUS M50Vm", ALC663_ASUS_MODE3),  	SND_PCI_QUIRK(0x1043, 0x1894, "ASUS X55", ALC663_ASUS_MODE3),  	SND_PCI_QUIRK(0x1043, 0x18b3, "ASUS N80Vc", ALC663_ASUS_MODE1), +	SND_PCI_QUIRK(0x1043, 0x18c3, "ASUS VX5", ALC663_ASUS_MODE1),  	SND_PCI_QUIRK(0x1043, 0x18d3, "ASUS N81Te", ALC663_ASUS_MODE1),  	SND_PCI_QUIRK(0x1043, 0x18f3, "ASUS N505Tp", ALC663_ASUS_MODE1),  	SND_PCI_QUIRK(0x1043, 0x1903, "ASUS F5GL", ALC663_ASUS_MODE1), @@ -17334,6 +17635,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {  	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),  	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",  		      ALC662_3ST_6ch_DIG), +	SND_PCI_QUIRK(0x152d, 0x2304, "Quanta WH1", ALC663_ASUS_H13),  	SND_PCI_QUIRK(0x1565, 0x820f, "Biostar TA780G M2+", ALC662_3ST_6ch_DIG),  	SND_PCI_QUIRK(0x1631, 0xc10c, "PB RS65", ALC663_ASUS_M51VA),  	SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo", ALC662_LENOVO_101E), @@ -17952,15 +18254,23 @@ static int alc662_parse_auto_config(struct hda_codec *codec)  	spec->num_mux_defs = 1;  	spec->input_mux = &spec->private_imux[0]; -	add_verb(spec, alc662_auto_init_verbs); -	if (codec->vendor_id == 0x10ec0663) -		add_verb(spec, alc663_auto_init_verbs); +	add_verb(spec, alc662_init_verbs); +	if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || +	    codec->vendor_id == 0x10ec0665) +		add_verb(spec, alc663_init_verbs); + +	if (codec->vendor_id == 0x10ec0272) +		add_verb(spec, alc272_init_verbs);  	err = alc_auto_add_mic_boost(codec);  	if (err < 0)  		return err; -	alc_ssid_check(codec, 0x15, 0x1b, 0x14); +	if (codec->vendor_id == 0x10ec0272 || codec->vendor_id == 0x10ec0663 || +	    codec->vendor_id == 0x10ec0665 || codec->vendor_id == 0x10ec0670) +	    alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0x21); +	else +	    alc_ssid_check(codec, 0x15, 0x1b, 0x14, 0);  	return 1;  } @@ -18046,11 +18356,20 @@ static int patch_alc662(struct hda_codec *codec)  	if (!spec->cap_mixer)  		set_capture_mixer(codec); -	if (codec->vendor_id == 0x10ec0662) + +	switch (codec->vendor_id) { +	case 0x10ec0662:  		set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); -	else +		break; +	case 0x10ec0272: +	case 0x10ec0663: +	case 0x10ec0665:  		set_beep_amp(spec, 0x0b, 0x04, HDA_INPUT); - +		break; +	case 0x10ec0273: +		set_beep_amp(spec, 0x0b, 0x03, HDA_INPUT); +		break; +	}  	spec->vmaster_nid = 0x02;  	codec->patch_ops = alc_patch_ops; @@ -18060,7 +18379,6 @@ static int patch_alc662(struct hda_codec *codec)  	if (!spec->loopback.amplist)  		spec->loopback.amplist = alc662_loopbacks;  #endif -	codec->proc_widget_hook = print_realtek_coef;  	return 0;  } @@ -18101,6 +18419,8 @@ static struct hda_codec_preset snd_hda_preset_realtek[] = {  	{ .id = 0x10ec0662, .rev = 0x100101, .name = "ALC662 rev1",  	  .patch = patch_alc662 },  	{ .id = 0x10ec0663, .name = "ALC663", .patch = patch_alc662 }, +	{ .id = 0x10ec0665, .name = "ALC665", .patch = patch_alc662 }, +	{ .id = 0x10ec0670, .name = "ALC670", .patch = patch_alc662 },  	{ .id = 0x10ec0880, .name = "ALC880", .patch = patch_alc880 },  	{ .id = 0x10ec0882, .name = "ALC882", .patch = patch_alc882 },  	{ .id = 0x10ec0883, .name = "ALC883", .patch = patch_alc882 },  |