⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 patch_realtek.c

📁 linux 内核源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	/* {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP}, */	/* {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, */	{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},	{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},	{ }};/** Uniwill P53* HP = 0x14, InternalSpeaker = 0x15, mic = 0x19,  */static struct hda_verb alc880_uniwill_p53_init_verbs[] = {	{0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},	{0x0c, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},	{0x0d, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},	{0x0e, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x01 << 8))},	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},	{0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_DCVOL_EVENT},	{ }};static struct hda_verb alc880_beep_init_verbs[] = {	{ 0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5) },	{ }};/* toggle speaker-output according to the hp-jack state */static void alc880_uniwill_hp_automute(struct hda_codec *codec){ 	unsigned int present;	unsigned char bits; 	present = snd_hda_codec_read(codec, 0x14, 0,				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;	bits = present ? HDA_AMP_MUTE : 0;	snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,				 HDA_AMP_MUTE, bits);	snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,				 HDA_AMP_MUTE, bits);}/* auto-toggle front mic */static void alc880_uniwill_mic_automute(struct hda_codec *codec){ 	unsigned int present;	unsigned char bits;	present = snd_hda_codec_read(codec, 0x18, 0,				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;	bits = present ? HDA_AMP_MUTE : 0;	snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);}static void alc880_uniwill_automute(struct hda_codec *codec){	alc880_uniwill_hp_automute(codec);	alc880_uniwill_mic_automute(codec);}static void alc880_uniwill_unsol_event(struct hda_codec *codec,				       unsigned int res){	/* Looks like the unsol event is incompatible with the standard	 * definition.  4bit tag is placed at 28 bit!	 */	switch (res >> 28) {	case ALC880_HP_EVENT:		alc880_uniwill_hp_automute(codec);		break;	case ALC880_MIC_EVENT:		alc880_uniwill_mic_automute(codec);		break;	}}static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec){ 	unsigned int present;	unsigned char bits; 	present = snd_hda_codec_read(codec, 0x14, 0,				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;	bits = present ? HDA_AMP_MUTE : 0;	snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);}static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec){	unsigned int present;		present = snd_hda_codec_read(codec, 0x21, 0,				     AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);	present &= HDA_AMP_VOLMASK;	snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,				 HDA_AMP_VOLMASK, present);	snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,				 HDA_AMP_VOLMASK, present);}static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,					   unsigned int res){	/* Looks like the unsol event is incompatible with the standard	 * definition.  4bit tag is placed at 28 bit!	 */	if ((res >> 28) == ALC880_HP_EVENT)		alc880_uniwill_p53_hp_automute(codec);	if ((res >> 28) == ALC880_DCVOL_EVENT)		alc880_uniwill_p53_dcvol_automute(codec);}/* FIXME! *//* * F1734 pin configuration: * HP = 0x14, speaker-out = 0x15, mic = 0x18 */static struct hda_verb alc880_pin_f1734_init_verbs[] = {	{0x10, AC_VERB_SET_CONNECT_SEL, 0x02},	{0x11, AC_VERB_SET_CONNECT_SEL, 0x00},	{0x12, AC_VERB_SET_CONNECT_SEL, 0x01},	{0x13, AC_VERB_SET_CONNECT_SEL, 0x00},	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{ }};/* FIXME! *//* * ASUS pin configuration: * HP/front = 0x14, surr = 0x15, clfe = 0x16, mic = 0x18, line = 0x1a */static struct hda_verb alc880_pin_asus_init_verbs[] = {	{0x10, AC_VERB_SET_CONNECT_SEL, 0x02},	{0x11, AC_VERB_SET_CONNECT_SEL, 0x00},	{0x12, AC_VERB_SET_CONNECT_SEL, 0x01},	{0x13, AC_VERB_SET_CONNECT_SEL, 0x00},	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},		{ }};/* Enable GPIO mask and set output */#define alc880_gpio1_init_verbs	alc_gpio1_init_verbs#define alc880_gpio2_init_verbs	alc_gpio2_init_verbs/* Clevo m520g init */static struct hda_verb alc880_pin_clevo_init_verbs[] = {	/* headphone output */	{0x11, AC_VERB_SET_CONNECT_SEL, 0x01},	/* line-out */	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* Line-in */	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* CD */	{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* Mic1 (rear panel) */	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* Mic2 (front panel) */	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* headphone */	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},        /* change to EAPD mode */	{0x20, AC_VERB_SET_COEF_INDEX, 0x07},	{0x20, AC_VERB_SET_PROC_COEF,  0x3060},	{ }};static struct hda_verb alc880_pin_tcl_S700_init_verbs[] = {	/* change to EAPD mode */	{0x20, AC_VERB_SET_COEF_INDEX, 0x07},	{0x20, AC_VERB_SET_PROC_COEF,  0x3060},	/* Headphone output */	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	/* Front output*/	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},	/* Line In pin widget for input */	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	/* CD pin widget for input */	{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	/* Mic1 (rear panel) pin widget for input and vref at 80% */	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	/* change to EAPD mode */	{0x20, AC_VERB_SET_COEF_INDEX, 0x07},	{0x20, AC_VERB_SET_PROC_COEF,  0x3070},	{ }};/* * LG m1 express dual * * Pin assignment: *   Rear Line-In/Out (blue): 0x14 *   Build-in Mic-In: 0x15 *   Speaker-out: 0x17 *   HP-Out (green): 0x1b *   Mic-In/Out (red): 0x19 *   SPDIF-Out: 0x1e *//* To make 5.1 output working (green=Front, blue=Surr, red=CLFE) */static hda_nid_t alc880_lg_dac_nids[3] = {	0x05, 0x02, 0x03};/* seems analog CD is not working */static struct hda_input_mux alc880_lg_capture_source = {	.num_items = 3,	.items = {		{ "Mic", 0x1 },		{ "Line", 0x5 },		{ "Internal Mic", 0x6 },	},};/* 2,4,6 channel modes */static struct hda_verb alc880_lg_ch2_init[] = {	/* set line-in and mic-in to input */	{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },	{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },	{ }};static struct hda_verb alc880_lg_ch4_init[] = {	/* set line-in to out and mic-in to input */	{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },	{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },	{ }};static struct hda_verb alc880_lg_ch6_init[] = {	/* set line-in and mic-in to output */	{ 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },	{ 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },	{ }};static struct hda_channel_mode alc880_lg_ch_modes[3] = {	{ 2, alc880_lg_ch2_init },	{ 4, alc880_lg_ch4_init },	{ 6, alc880_lg_ch6_init },};static struct snd_kcontrol_new alc880_lg_mixer[] = {	/* FIXME: it's not really "master" but front channels */	HDA_CODEC_VOLUME("Master Playback Volume", 0x0f, 0x0, HDA_OUTPUT),	HDA_BIND_MUTE("Master Playback Switch", 0x0f, 2, HDA_INPUT),	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0c, 0x0, HDA_OUTPUT),	HDA_BIND_MUTE("Surround Playback Switch", 0x0c, 2, HDA_INPUT),	HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0d, 1, 0x0, HDA_OUTPUT),	HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),	HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),	HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),	HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),	HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),	HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x06, HDA_INPUT),	HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x06, HDA_INPUT),	HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x07, HDA_INPUT),	HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x07, HDA_INPUT),	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Channel Mode",		.info = alc_ch_mode_info,		.get = alc_ch_mode_get,		.put = alc_ch_mode_put,	},	{ } /* end */};static struct hda_verb alc880_lg_init_verbs[] = {	/* set capture source to mic-in */	{0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},	{0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},	{0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},	/* mute all amp mixer inputs */	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(5)},	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},	{0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},	/* line-in to input */	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* built-in mic */	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* speaker-out */	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* mic-in to input */	{0x11, AC_VERB_SET_CONNECT_SEL, 0x01},	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* HP-out */	{0x13, AC_VERB_SET_CONNECT_SEL, 0x03},	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* jack sense */	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | 0x1},	{ }};/* toggle speaker-output according to the hp-jack state */static void alc880_lg_automute(struct hda_codec *codec){	unsigned int present;	unsigned char bits;	present = snd_hda_codec_read(codec, 0x1b, 0,				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;	bits = present ? HDA_AMP_MUTE : 0;	snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,				 HDA_AMP_MUTE, bits);}static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res){	/* Looks like the unsol event is incompatible with the standard	 * definition.  4bit tag is placed at 28 bit!	 */	if ((res >> 28) == 0x01)		alc880_lg_automute(codec);}/* * LG LW20 * * Pin assignment: *   Speaker-out: 0x14 *   Mic-In: 0x18 *   Built-in Mic-In: 0x19 *   Line-In: 0x1b *   HP-Out: 0x1a *   SPDIF-Out: 0x1e */static struct hda_input_mux alc880_lg_lw_capture_source = {	.num_items = 3,	.items = {		{ "Mic", 0x0 },		{ "Internal Mic", 0x1 },		{ "Line In", 0x2 },	},};#define alc880_lg_lw_modes alc880_threestack_modesstatic s

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -