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

📄 patch_realtek.c

📁 linux-2.6.15.6
💻 C
📖 第 1 页 / 共 5 页
字号:
	{0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */	{0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */	/*	 * Set pin mode and muting	 */	/* set front pin widgets 0x14 for output */	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* Mic1 (rear panel) pin widget for input and vref at 80% */	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	/* Mic2 (as headphone out) for HP output */	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* Line In pin widget for input */	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	/* Line2 (as front mic) pin widget for input and vref at 80% */	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	/* CD pin widget for input */	{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{ }};/* * 5-stack pin configuration: * front = 0x14, surround = 0x17, clfe = 0x16, mic = 0x18, HP = 0x19, * line-in/side = 0x1a, f-mic = 0x1b */static struct hda_verb alc880_pin_5stack_init_verbs[] = {	/*	 * preset connection lists of input pins	 * 0 = front, 1 = rear_surr, 2 = CLFE, 3 = surround	 */	{0x11, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */	{0x12, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/side */	/*	 * Set pin mode and muting	 */	/* set pin widgets 0x14-0x17 for output */	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	/* unmute pins for output (no gain on this amp) */	{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_UNMUTE},	{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* Mic1 (rear panel) pin widget for input and vref at 80% */	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	/* Mic2 (as headphone out) for HP output */	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	/* Line In pin widget for input */	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	/* Line2 (as front mic) pin widget for input and vref at 80% */	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	/* CD pin widget for input */	{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{ }};/* * W810 pin configuration: * front = 0x14, surround = 0x15, clfe = 0x16, HP = 0x1b */static struct hda_verb alc880_pin_w810_init_verbs[] = {	/* hphone/speaker input selector: front DAC */	{0x13, AC_VERB_SET_CONNECT_SEL, 0x0},	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{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},	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},	{ }};/* * Z71V pin configuration: * Speaker-out = 0x14, HP = 0x15, Mic = 0x18, Line-in = 0x1a, Mic2 = 0x1b (?) */static struct hda_verb alc880_pin_z71v_init_verbs[] = {	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{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},	{0x18, 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_VREF80},	{0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},	{ }};/* * 6-stack pin configuration: * front = 0x14, surr = 0x15, clfe = 0x16, side = 0x17, mic = 0x18, f-mic = 0x19, * line = 0x1a, HP = 0x1b */static struct hda_verb alc880_pin_6stack_init_verbs[] = {	{0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{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},	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},	{0x17, 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_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},		{ }};/* 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 */static struct hda_verb alc880_gpio1_init_verbs[] = {	{0x01, AC_VERB_SET_GPIO_MASK, 0x01},	{0x01, AC_VERB_SET_GPIO_DIRECTION, 0x01},	{0x01, AC_VERB_SET_GPIO_DATA, 0x01},};/* Enable GPIO mask and set output */static struct hda_verb alc880_gpio2_init_verbs[] = {	{0x01, AC_VERB_SET_GPIO_MASK, 0x02},	{0x01, AC_VERB_SET_GPIO_DIRECTION, 0x02},	{0x01, AC_VERB_SET_GPIO_DATA, 0x02},};/* */static int alc_init(struct hda_codec *codec){	struct alc_spec *spec = codec->spec;	unsigned int i;	for (i = 0; i < spec->num_init_verbs; i++)		snd_hda_sequence_write(codec, spec->init_verbs[i]);	return 0;}#ifdef CONFIG_PM/* * resume */static int alc_resume(struct hda_codec *codec){	struct alc_spec *spec = codec->spec;	int i;	alc_init(codec);	for (i = 0; i < spec->num_mixers; i++)		snd_hda_resume_ctls(codec, spec->mixers[i]);	if (spec->multiout.dig_out_nid)		snd_hda_resume_spdif_out(codec);	if (spec->dig_in_nid)		snd_hda_resume_spdif_in(codec);	return 0;}#endif/* * Analog playback callbacks */static int alc880_playback_pcm_open(struct hda_pcm_stream *hinfo,				    struct hda_codec *codec,				    snd_pcm_substream_t *substream){	struct alc_spec *spec = codec->spec;	return snd_hda_multi_out_analog_open(codec, &spec->multiout, substream);}static int alc880_playback_pcm_prepare(struct hda_pcm_stream *hinfo,				       struct hda_codec *codec,				       unsigned int stream_tag,				       unsigned int format,				       snd_pcm_substream_t *substream){	struct alc_spec *spec = codec->spec;	return snd_hda_multi_out_analog_prepare(codec, &spec->multiout, stream_tag,						format, substream);}static int alc880_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,				       struct hda_codec *codec,				       snd_pcm_substream_t *substream){	struct alc_spec *spec = codec->spec;	return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);}/* * Digital out */static int alc880_dig_playback_pcm_open(struct hda_pcm_stream *hinfo,					struct hda_codec *codec,					snd_pcm_substream_t *substream){	struct alc_spec *spec = codec->spec;	return snd_hda_multi_out_dig_open(codec, &spec->multiout);}static int alc880_dig_playback_pcm_close(struct hda_pcm_stream *hinfo,					 struct hda_codec *codec,					 snd_pcm_substream_t *substream){	struct alc_spec *spec = codec->spec;	return snd_hda_multi_out_dig_close(codec, &spec->multiout);}/* * Analog capture */static int alc880_capture_pcm_prepare(struct hda_pcm_stream *hinfo,				      struct hda_codec *codec,				      unsigned int stream_tag,				      unsigned int format,				      snd_pcm_substream_t *substream){	struct alc_spec *spec = codec->spec;	snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number],				   stream_tag, 0, format);	return 0;}static int alc880_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,				      struct hda_codec *codec,				      snd_pcm_substream_t *substream){	struct alc_spec *spec = codec->spec;	snd_hda_codec_setup_stream(codec, spec->adc_nids[substream->number], 0, 0, 0);	return 0;}/* */static struct hda_pcm_stream alc880_pcm_analog_playback = {	.substreams = 1,	.channels_min = 2,	.channels_max = 8,	/* NID is set in alc_build_pcms */	.ops = {		.open = alc880_playback_pcm_open,		.prepare = alc880_playback_pcm_prepare,		.cleanup = alc880_playback_pcm_cleanup	},};static struct hda_pcm_stream alc880_pcm_analog_capture = {	.substreams = 2,	.channels_min = 2,	.channels_max = 2,	/* NID is set in alc_build_pcms */	.ops = {		.prepare = alc880_capture_pcm_prepare,		.cleanup = alc880_capture_pcm_cleanup	},};static struct hda_pcm_stream alc880_pcm_digital_playback = {	.substreams = 1,	.channels_min = 2,	.channels_max = 2,	/* NID is set in alc_build_pcms */	.ops = {		.open = alc880_dig_playback_pcm_open,		.close = alc880_dig_playback_pcm_close	},};static struct hda_pcm_stream alc880_pcm_digital_capture = {	.substreams = 1,	.channels_min = 2,	.channels_max = 2,	/* NID is set in alc_build_pcms */};static int alc_build_pcms(struct hda_codec *codec){	struct alc_spec *spec = codec->spec;	struct hda_pcm *info = spec->pcm_rec;	int i;	codec->num_pcms = 1;	codec->pcm_info = info;	info->name = spec->stream_name_analog;	info->stream[SNDRV_PCM_STREAM_PLAYBACK] = *(spec->stream_analog_playback);	info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];	info->stream[SNDRV_PCM_STREAM_CAPTURE] = *(spec->stream_analog_capture);

⌨️ 快捷键说明

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