亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? hda_generic.c

?? linux 內核源代碼
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * Universal Interface for Intel High Definition Audio Codec * * Generic widget tree parser * * Copyright (c) 2004 Takashi Iwai <tiwai@suse.de> * *  This driver is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. * *  This driver is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. * *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA */#include <sound/driver.h>#include <linux/init.h>#include <linux/slab.h>#include <sound/core.h>#include "hda_codec.h"#include "hda_local.h"/* widget node for parsing */struct hda_gnode {	hda_nid_t nid;		/* NID of this widget */	unsigned short nconns;	/* number of input connections */	hda_nid_t *conn_list;	hda_nid_t slist[2];	/* temporay list */	unsigned int wid_caps;	/* widget capabilities */	unsigned char type;	/* widget type */	unsigned char pin_ctl;	/* pin controls */	unsigned char checked;	/* the flag indicates that the node is already parsed */	unsigned int pin_caps;	/* pin widget capabilities */	unsigned int def_cfg;	/* default configuration */	unsigned int amp_out_caps;	/* AMP out capabilities */	unsigned int amp_in_caps;	/* AMP in capabilities */	struct list_head list;};/* patch-specific record */#define MAX_PCM_VOLS	2struct pcm_vol {	struct hda_gnode *node;	/* Node for PCM volume */	unsigned int index;	/* connection of PCM volume */};struct hda_gspec {	struct hda_gnode *dac_node[2];	/* DAC node */	struct hda_gnode *out_pin_node[2];	/* Output pin (Line-Out) node */	struct pcm_vol pcm_vol[MAX_PCM_VOLS];	/* PCM volumes */	unsigned int pcm_vol_nodes;	/* number of PCM volumes */	struct hda_gnode *adc_node;	/* ADC node */	struct hda_gnode *cap_vol_node;	/* Node for capture volume */	unsigned int cur_cap_src;	/* current capture source */	struct hda_input_mux input_mux;	char cap_labels[HDA_MAX_NUM_INPUTS][16];	unsigned int def_amp_in_caps;	unsigned int def_amp_out_caps;	struct hda_pcm pcm_rec;		/* PCM information */	struct list_head nid_list;	/* list of widgets */#ifdef CONFIG_SND_HDA_POWER_SAVE#define MAX_LOOPBACK_AMPS	7	struct hda_loopback_check loopback;	int num_loopbacks;	struct hda_amp_list loopback_list[MAX_LOOPBACK_AMPS + 1];#endif};/* * retrieve the default device type from the default config value */#define defcfg_type(node) (((node)->def_cfg & AC_DEFCFG_DEVICE) >> \			   AC_DEFCFG_DEVICE_SHIFT)#define defcfg_location(node) (((node)->def_cfg & AC_DEFCFG_LOCATION) >> \			       AC_DEFCFG_LOCATION_SHIFT)#define defcfg_port_conn(node) (((node)->def_cfg & AC_DEFCFG_PORT_CONN) >> \				AC_DEFCFG_PORT_CONN_SHIFT)/* * destructor */static void snd_hda_generic_free(struct hda_codec *codec){	struct hda_gspec *spec = codec->spec;	struct hda_gnode *node, *n;	if (! spec)		return;	/* free all widgets */	list_for_each_entry_safe(node, n, &spec->nid_list, list) {		if (node->conn_list != node->slist)			kfree(node->conn_list);		kfree(node);	}	kfree(spec);}/* * add a new widget node and read its attributes */static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid_t nid){	struct hda_gnode *node;	int nconns;	hda_nid_t conn_list[HDA_MAX_CONNECTIONS];	node = kzalloc(sizeof(*node), GFP_KERNEL);	if (node == NULL)		return -ENOMEM;	node->nid = nid;	nconns = snd_hda_get_connections(codec, nid, conn_list,					 HDA_MAX_CONNECTIONS);	if (nconns < 0) {		kfree(node);		return nconns;	}	if (nconns <= ARRAY_SIZE(node->slist))		node->conn_list = node->slist;	else {		node->conn_list = kmalloc(sizeof(hda_nid_t) * nconns,					  GFP_KERNEL);		if (! node->conn_list) {			snd_printk(KERN_ERR "hda-generic: cannot malloc\n");			kfree(node);			return -ENOMEM;		}	}	memcpy(node->conn_list, conn_list, nconns * sizeof(hda_nid_t));	node->nconns = nconns;	node->wid_caps = get_wcaps(codec, nid);	node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;	if (node->type == AC_WID_PIN) {		node->pin_caps = snd_hda_param_read(codec, node->nid, AC_PAR_PIN_CAP);		node->pin_ctl = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_PIN_WIDGET_CONTROL, 0);		node->def_cfg = snd_hda_codec_read(codec, node->nid, 0, AC_VERB_GET_CONFIG_DEFAULT, 0);	}	if (node->wid_caps & AC_WCAP_OUT_AMP) {		if (node->wid_caps & AC_WCAP_AMP_OVRD)			node->amp_out_caps = snd_hda_param_read(codec, node->nid, AC_PAR_AMP_OUT_CAP);		if (! node->amp_out_caps)			node->amp_out_caps = spec->def_amp_out_caps;	}	if (node->wid_caps & AC_WCAP_IN_AMP) {		if (node->wid_caps & AC_WCAP_AMP_OVRD)			node->amp_in_caps = snd_hda_param_read(codec, node->nid, AC_PAR_AMP_IN_CAP);		if (! node->amp_in_caps)			node->amp_in_caps = spec->def_amp_in_caps;	}	list_add_tail(&node->list, &spec->nid_list);	return 0;}/* * build the AFG subtree */static int build_afg_tree(struct hda_codec *codec){	struct hda_gspec *spec = codec->spec;	int i, nodes, err;	hda_nid_t nid;	snd_assert(spec, return -EINVAL);	spec->def_amp_out_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_OUT_CAP);	spec->def_amp_in_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_IN_CAP);	nodes = snd_hda_get_sub_nodes(codec, codec->afg, &nid);	if (! nid || nodes < 0) {		printk(KERN_ERR "Invalid AFG subtree\n");		return -EINVAL;	}	/* parse all nodes belonging to the AFG */	for (i = 0; i < nodes; i++, nid++) {		if ((err = add_new_node(codec, spec, nid)) < 0)			return err;	}	return 0;}/* * look for the node record for the given NID *//* FIXME: should avoid the braindead linear search */static struct hda_gnode *hda_get_node(struct hda_gspec *spec, hda_nid_t nid){	struct hda_gnode *node;	list_for_each_entry(node, &spec->nid_list, list) {		if (node->nid == nid)			return node;	}	return NULL;}/* * unmute (and set max vol) the output amplifier */static int unmute_output(struct hda_codec *codec, struct hda_gnode *node){	unsigned int val, ofs;	snd_printdd("UNMUTE OUT: NID=0x%x\n", node->nid);	val = (node->amp_out_caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT;	ofs = (node->amp_out_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;	if (val >= ofs)		val -= ofs;	snd_hda_codec_amp_stereo(codec, node->nid, HDA_OUTPUT, 0, 0xff, val);	return 0;}/* * unmute (and set max vol) the input amplifier */static int unmute_input(struct hda_codec *codec, struct hda_gnode *node, unsigned int index){	unsigned int val, ofs;	snd_printdd("UNMUTE IN: NID=0x%x IDX=0x%x\n", node->nid, index);	val = (node->amp_in_caps & AC_AMPCAP_NUM_STEPS) >> AC_AMPCAP_NUM_STEPS_SHIFT;	ofs = (node->amp_in_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;	if (val >= ofs)		val -= ofs;	snd_hda_codec_amp_stereo(codec, node->nid, HDA_INPUT, index, 0xff, val);	return 0;}/* * select the input connection of the given node. */static int select_input_connection(struct hda_codec *codec, struct hda_gnode *node,				   unsigned int index){	snd_printdd("CONNECT: NID=0x%x IDX=0x%x\n", node->nid, index);	return snd_hda_codec_write_cache(codec, node->nid, 0,					 AC_VERB_SET_CONNECT_SEL, index);}/* * clear checked flag of each node in the node list */static void clear_check_flags(struct hda_gspec *spec){	struct hda_gnode *node;	list_for_each_entry(node, &spec->nid_list, list) {		node->checked = 0;	}}/* * parse the output path recursively until reach to an audio output widget * * returns 0 if not found, 1 if found, or a negative error code. */static int parse_output_path(struct hda_codec *codec, struct hda_gspec *spec,			     struct hda_gnode *node, int dac_idx){	int i, err;	struct hda_gnode *child;	if (node->checked)		return 0;	node->checked = 1;	if (node->type == AC_WID_AUD_OUT) {		if (node->wid_caps & AC_WCAP_DIGITAL) {			snd_printdd("Skip Digital OUT node %x\n", node->nid);			return 0;		}		snd_printdd("AUD_OUT found %x\n", node->nid);		if (spec->dac_node[dac_idx]) {			/* already DAC node is assigned, just unmute & connect */			return node == spec->dac_node[dac_idx];		}		spec->dac_node[dac_idx] = node;		if ((node->wid_caps & AC_WCAP_OUT_AMP) &&		    spec->pcm_vol_nodes < MAX_PCM_VOLS) {			spec->pcm_vol[spec->pcm_vol_nodes].node = node;			spec->pcm_vol[spec->pcm_vol_nodes].index = 0;			spec->pcm_vol_nodes++;		}		return 1; /* found */	}	for (i = 0; i < node->nconns; i++) {		child = hda_get_node(spec, node->conn_list[i]);		if (! child)			continue;		err = parse_output_path(codec, spec, child, dac_idx);		if (err < 0)			return err;		else if (err > 0) {			/* found one,			 * select the path, unmute both input and output			 */			if (node->nconns > 1)				select_input_connection(codec, node, i);			unmute_input(codec, node, i);			unmute_output(codec, node);			if (spec->dac_node[dac_idx] &&			    spec->pcm_vol_nodes < MAX_PCM_VOLS &&			    !(spec->dac_node[dac_idx]->wid_caps &			      AC_WCAP_OUT_AMP)) {				if ((node->wid_caps & AC_WCAP_IN_AMP) ||				    (node->wid_caps & AC_WCAP_OUT_AMP)) {					int n = spec->pcm_vol_nodes;					spec->pcm_vol[n].node = node;					spec->pcm_vol[n].index = i;					spec->pcm_vol_nodes++;				}			}			return 1;		}	}	return 0;}/* * Look for the output PIN widget with the given jack type * and parse the output path to that PIN. * * Returns the PIN node when the path to DAC is established. */static struct hda_gnode *parse_output_jack(struct hda_codec *codec,					   struct hda_gspec *spec,					   int jack_type){	struct hda_gnode *node;	int err;	list_for_each_entry(node, &spec->nid_list, list) {		if (node->type != AC_WID_PIN)			continue;		/* output capable? */		if (! (node->pin_caps & AC_PINCAP_OUT))			continue;		if (defcfg_port_conn(node) == AC_JACK_PORT_NONE)			continue; /* unconnected */		if (jack_type >= 0) {			if (jack_type != defcfg_type(node))				continue;			if (node->wid_caps & AC_WCAP_DIGITAL)				continue; /* skip SPDIF */		} else {			/* output as default? */			if (! (node->pin_ctl & AC_PINCTL_OUT_EN))				continue;		}		clear_check_flags(spec);		err = parse_output_path(codec, spec, node, 0);		if (err < 0)			return NULL;		if (! err && spec->out_pin_node[0]) {			err = parse_output_path(codec, spec, node, 1);			if (err < 0)				return NULL;		}		if (err > 0) {			/* unmute the PIN output */			unmute_output(codec, node);			/* set PIN-Out enable */			snd_hda_codec_write_cache(codec, node->nid, 0,					    AC_VERB_SET_PIN_WIDGET_CONTROL,					    AC_PINCTL_OUT_EN |					    ((node->pin_caps & AC_PINCAP_HP_DRV) ?					     AC_PINCTL_HP_EN : 0));			return node;		}	}	return NULL;}/* * parse outputs */static int parse_output(struct hda_codec *codec){	struct hda_gspec *spec = codec->spec;	struct hda_gnode *node;	/*	 * Look for the output PIN widget	 */	/* first, look for the line-out pin */	node = parse_output_jack(codec, spec, AC_JACK_LINE_OUT);	if (node) /* found, remember the PIN node */		spec->out_pin_node[0] = node;	else {		/* if no line-out is found, try speaker out */		node = parse_output_jack(codec, spec, AC_JACK_SPEAKER);		if (node)			spec->out_pin_node[0] = node;	}	/* look for the HP-out pin */	node = parse_output_jack(codec, spec, AC_JACK_HP_OUT);	if (node) {		if (! spec->out_pin_node[0])			spec->out_pin_node[0] = node;		else			spec->out_pin_node[1] = node;	}	if (! spec->out_pin_node[0]) {		/* no line-out or HP pins found,		 * then choose for the first output pin		 */		spec->out_pin_node[0] = parse_output_jack(codec, spec, -1);		if (! spec->out_pin_node[0])			snd_printd("hda_generic: no proper output path found\n");	}	return 0;}/* * input MUX *//* control callbacks */static int capture_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo){	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);	struct hda_gspec *spec = codec->spec;	return snd_hda_input_mux_info(&spec->input_mux, uinfo);}static int capture_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol){	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);	struct hda_gspec *spec = codec->spec;	ucontrol->value.enumerated.item[0] = spec->cur_cap_src;	return 0;}static int capture_source_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol){	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);	struct hda_gspec *spec = codec->spec;	return snd_hda_input_mux_put(codec, &spec->input_mux, ucontrol,				     spec->adc_node->nid, &spec->cur_cap_src);}/* * return the string name of the given input PIN widget */static const char *get_input_type(struct hda_gnode *node, unsigned int *pinctl){	unsigned int location = defcfg_location(node);	switch (defcfg_type(node)) {	case AC_JACK_LINE_IN:		if ((location & 0x0f) == AC_JACK_LOC_FRONT)			return "Front Line";		return "Line";	case AC_JACK_CD:#if 0		if (pinctl)			*pinctl |= AC_PINCTL_VREF_GRD;#endif		return "CD";	case AC_JACK_AUX:		if ((location & 0x0f) == AC_JACK_LOC_FRONT)			return "Front Aux";		return "Aux";	case AC_JACK_MIC_IN:		if (pinctl &&		    (node->pin_caps &		     (AC_PINCAP_VREF_80 << AC_PINCAP_VREF_SHIFT)))			*pinctl |= AC_PINCTL_VREF_80;		if ((location & 0x0f) == AC_JACK_LOC_FRONT)			return "Front Mic";		return "Mic";	case AC_JACK_SPDIF_IN:		return "SPDIF";	case AC_JACK_DIG_OTHER_IN:		return "Digital";	}	return NULL;}/* * parse the nodes recursively until reach to the input PIN * * returns 0 if not found, 1 if found, or a negative error code. */static int parse_adc_sub_nodes(struct hda_codec *codec, struct hda_gspec *spec,			       struct hda_gnode *node){	int i, err;	unsigned int pinctl;	char *label;	const char *type;	if (node->checked)		return 0;	node->checked = 1;	if (node->type != AC_WID_PIN) {		for (i = 0; i < node->nconns; i++) {			struct hda_gnode *child;			child = hda_get_node(spec, node->conn_list[i]);			if (! child)				continue;			err = parse_adc_sub_nodes(codec, spec, child);			if (err < 0)				return err;			if (err > 0) {				/* found one,				 * select the path, unmute both input and output				 */				if (node->nconns > 1)					select_input_connection(codec, node, i);				unmute_input(codec, node, i);				unmute_output(codec, node);				return err;			}		}		return 0;	}	/* input capable? */	if (! (node->pin_caps & AC_PINCAP_IN))		return 0;	if (defcfg_port_conn(node) == AC_JACK_PORT_NONE)		return 0; /* unconnected */	if (node->wid_caps & AC_WCAP_DIGITAL)		return 0; /* skip SPDIF */	if (spec->input_mux.num_items >= HDA_MAX_NUM_INPUTS) {		snd_printk(KERN_ERR "hda_generic: Too many items for capture\n");

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
日韩色在线观看| 成人av网址在线观看| 亚洲靠逼com| 国产精品久久久久久久久免费桃花 | 亚洲国产美女搞黄色| 亚洲欧美综合色| 中文字幕一区二区三区在线播放| 国产日本一区二区| 精品国产凹凸成av人网站| 欧美色综合天天久久综合精品| 欧美吻胸吃奶大尺度电影| 日本伦理一区二区| 91麻豆福利精品推荐| 在线亚洲一区二区| 欧美在线一区二区三区| 欧美日韩午夜精品| 欧美日韩综合在线免费观看| 777亚洲妇女| 久久久www免费人成精品| 日本高清免费不卡视频| 欧美一区二区在线观看| 精品免费一区二区三区| 国产日韩影视精品| 亚洲一区二区av在线| 亚洲va韩国va欧美va| 国产东北露脸精品视频| k8久久久一区二区三区| 91麻豆精品国产无毒不卡在线观看| www国产成人| 洋洋成人永久网站入口| 麻豆精品一二三| 国产乱一区二区| 欧美色中文字幕| 国产精品视频在线看| 日韩极品在线观看| 成a人片国产精品| 精品久久久久一区二区国产| 日韩毛片精品高清免费| 久久精品99国产精品| 91香蕉视频污| 久久丝袜美腿综合| 日本不卡一区二区三区| 91伊人久久大香线蕉| 日韩欧美不卡在线观看视频| 亚洲精品乱码久久久久久| 精品一区二区在线视频| 欧美日韩国产综合视频在线观看| 国产精品少妇自拍| 青青草97国产精品免费观看| 欧洲av在线精品| 欧美激情一区二区三区不卡| 美女视频一区二区三区| 色婷婷国产精品综合在线观看| 久久精品一区八戒影视| 图片区小说区国产精品视频| 成人av资源站| 欧美激情综合在线| 精品在线观看免费| 日韩一区二区三区电影在线观看 | 亚洲精品视频免费看| 国产在线精品国自产拍免费| 欧美群妇大交群的观看方式| 一区二区三区四区亚洲| 99视频国产精品| 国产精品麻豆欧美日韩ww| 国产一区二区在线电影| 精品国内片67194| 蜜臀精品一区二区三区在线观看| 欧美自拍丝袜亚洲| 亚洲精品视频在线看| 成年人网站91| 欧美成人一区二区三区| 一区二区在线观看免费视频播放| 不卡的av电影| 最新日韩av在线| 丁香婷婷综合网| 中文字幕欧美激情一区| 国产成人高清视频| 中文一区在线播放 | 亚洲精品免费看| 99久久综合国产精品| 日本一区二区免费在线观看视频| 国产一区二区导航在线播放| 久久久噜噜噜久久中文字幕色伊伊 | 欧美精品一区二区不卡| 男人的天堂亚洲一区| 欧美精品一区二| 不卡区在线中文字幕| 亚洲最大的成人av| 欧美午夜电影网| 另类中文字幕网| 亚洲欧美在线另类| 欧美丰满美乳xxx高潮www| 精品无码三级在线观看视频| 国产精品青草综合久久久久99| 色婷婷久久久综合中文字幕| 亚洲成人av免费| 久久久久九九视频| 在线国产亚洲欧美| 国产在线播放一区三区四| 综合久久国产九一剧情麻豆| 91精品国产色综合久久ai换脸| 国内精品国产成人国产三级粉色| 国产精品萝li| 欧美大胆人体bbbb| 99久久婷婷国产| 日本v片在线高清不卡在线观看| 国产亲近乱来精品视频 | 国产 日韩 欧美大片| 亚洲精品免费看| 亚洲精品在线三区| 99国产精品99久久久久久| 午夜视频久久久久久| 亚洲国产精品精华液2区45| 欧美午夜影院一区| 美女视频黄免费的久久| 国产精品视频一区二区三区不卡| 欧美日韩国产免费一区二区| 成人短视频下载| 国产一区二区91| 日本va欧美va精品发布| 一区二区三区在线视频播放| 久久久影院官网| 欧美成人bangbros| 欧美视频一二三区| 91免费视频网| 成人av资源网站| 国产aⅴ精品一区二区三区色成熟| 亚洲午夜在线视频| 悠悠色在线精品| 中文字幕日韩精品一区| 国产亚洲精品资源在线26u| 91精品国产一区二区三区| 在线观看一区日韩| 色婷婷av一区二区三区软件 | 久久人人97超碰com| 欧美一区二区三区在线观看视频| 一本色道久久综合精品竹菊| 高清av一区二区| 国产91色综合久久免费分享| 国产精品羞羞答答xxdd| 九色综合狠狠综合久久| 蜜桃视频免费观看一区| 美腿丝袜在线亚洲一区| 男人的j进女人的j一区| 欧美aa在线视频| 亚洲成人综合视频| 一区二区三区中文字幕电影| 2019国产精品| 国产情人综合久久777777| 中文字幕不卡三区| 中文一区二区在线观看| 国产精品毛片a∨一区二区三区| 中文字幕av一区二区三区| 国产亚洲短视频| 中国av一区二区三区| 亚洲精品国产一区二区三区四区在线| 亚洲色图欧美偷拍| 夜夜嗨av一区二区三区四季av | 国产福利一区在线| 国产aⅴ综合色| a级高清视频欧美日韩| 欧美主播一区二区三区| 在线电影欧美成精品| 欧美xxxxxxxx| 国产精品久久午夜夜伦鲁鲁| 亚洲精品国产a| 亚洲h动漫在线| 黄页视频在线91| 91蜜桃在线免费视频| 欧美精品123区| 精品精品欲导航| 亚洲日本一区二区| 免费日本视频一区| 不卡高清视频专区| 欧美另类久久久品| 国产日韩v精品一区二区| 亚洲视频在线观看三级| 日韩av中文字幕一区二区三区| 国产成人精品一区二| 欧美手机在线视频| 国产人久久人人人人爽| 亚洲国产成人porn| 国产成人精品1024| 91精品在线一区二区| 国产精品久久久久一区二区三区共| 亚洲韩国一区二区三区| 国产精品正在播放| 欧美日韩精品一区二区天天拍小说 | 亚洲日本在线看| 青青国产91久久久久久| 波多野洁衣一区| 日韩一区二区高清| 亚洲女同一区二区| 韩国理伦片一区二区三区在线播放| 色94色欧美sute亚洲线路一久| 久久综合久久综合亚洲| 日日欢夜夜爽一区| 91色视频在线| 国产女人18水真多18精品一级做|