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

📄 aureon.c

📁 鼎力推荐!本程序是基于嵌入式LUNUX系统开发的源程序代码
💻 C
📖 第 1 页 / 共 4 页
字号:
		"CD",		"Coax"	};	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;	uinfo->count = 1;	uinfo->value.enumerated.items = 2;	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;	if (ice->eeprom.subvendor == VT1724_SUBDEVICE_PRODIGY71)		strcpy(uinfo->value.enumerated.name, prodigy_texts[uinfo->value.enumerated.item]);	else		strcpy(uinfo->value.enumerated.name, aureon_texts[uinfo->value.enumerated.item]);	return 0;}static int aureon_cs8415_mux_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	//snd_ice1712_save_gpio_status(ice);	//val = aureon_cs8415_get(ice, CS8415_CTRL2);	ucontrol->value.integer.value[0] = ice->spec.aureon.cs8415_mux;	//snd_ice1712_restore_gpio_status(ice);	return 0;}static int aureon_cs8415_mux_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	unsigned short oval, nval;	int change;	snd_ice1712_save_gpio_status(ice);	oval = aureon_cs8415_get(ice, CS8415_CTRL2);	nval = oval & ~0x07;	nval |= ucontrol->value.integer.value[0] & 7;	change = (oval != nval);	if (change)		aureon_cs8415_put(ice, CS8415_CTRL2, nval);	snd_ice1712_restore_gpio_status(ice);	ice->spec.aureon.cs8415_mux = ucontrol->value.integer.value[0];	return change;}static int aureon_cs8415_rate_info (snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo){	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;	uinfo->count = 1;	uinfo->value.integer.min = 0;	uinfo->value.integer.max = 192000;	return 0;}static int aureon_cs8415_rate_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	unsigned char ratio;	ratio = aureon_cs8415_get(ice, CS8415_RATIO);	ucontrol->value.integer.value[0] = (int)((unsigned int)ratio * 750);	return 0;}/* * CS8415A Mute */static int aureon_cs8415_mute_info (snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo){	uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;	uinfo->count = 1;	return 0;}static int aureon_cs8415_mute_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	snd_ice1712_save_gpio_status(ice);	ucontrol->value.integer.value[0] = (aureon_cs8415_get(ice, CS8415_CTRL1) & 0x20) ? 0 : 1;	snd_ice1712_restore_gpio_status(ice);	return 0;}static int aureon_cs8415_mute_put (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	unsigned char oval, nval;	int change;	snd_ice1712_save_gpio_status(ice);	oval = aureon_cs8415_get(ice, CS8415_CTRL1);	if (ucontrol->value.integer.value[0])		nval = oval & ~0x20;	else		nval = oval | 0x20;	if ((change = (oval != nval)))		aureon_cs8415_put(ice, CS8415_CTRL1, nval);	snd_ice1712_restore_gpio_status(ice);	return change;}/* * CS8415A Q-Sub info */static int aureon_cs8415_qsub_info (snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) {	uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;	uinfo->count = 10;	return 0;}static int aureon_cs8415_qsub_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) {	ice1712_t *ice = snd_kcontrol_chip(kcontrol);		snd_ice1712_save_gpio_status(ice);	aureon_cs8415_read(ice, CS8415_QSUB, ucontrol->value.bytes.data, 10);	snd_ice1712_restore_gpio_status(ice);	return 0;}static int aureon_cs8415_spdif_info (snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) {	uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;	uinfo->count = 1;	return 0;}static int aureon_cs8415_mask_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) {	memset(ucontrol->value.iec958.status, 0xFF, 24);	return 0;}static int aureon_cs8415_spdif_get (snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) {	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	snd_ice1712_save_gpio_status(ice);	aureon_cs8415_read(ice, CS8415_C_BUFFER, ucontrol->value.iec958.status, 24);	snd_ice1712_restore_gpio_status(ice);	return 0;}/* * Headphone Amplifier */static int aureon_set_headphone_amp(ice1712_t *ice, int enable){	unsigned int tmp, tmp2;	tmp2 = tmp = snd_ice1712_gpio_read(ice);	if (enable)		tmp |= AUREON_HP_SEL;	else		tmp &= ~ AUREON_HP_SEL;	if (tmp != tmp2) {		snd_ice1712_gpio_write(ice, tmp);		return 1;	}	return 0;}static int aureon_get_headphone_amp(ice1712_t *ice){	unsigned int tmp = snd_ice1712_gpio_read(ice);	return ( tmp & AUREON_HP_SEL )!= 0;}#define aureon_hpamp_info	aureon_mono_bool_infostatic int aureon_hpamp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	ucontrol->value.integer.value[0] = aureon_get_headphone_amp(ice);	return 0;}static int aureon_hpamp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	return aureon_set_headphone_amp(ice,ucontrol->value.integer.value[0]);}/* * Deemphasis */#define aureon_deemp_info	aureon_mono_bool_infostatic int aureon_deemp_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == 0xf;	return 0;}static int aureon_deemp_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	int temp, temp2;	temp2 = temp = wm_get(ice, WM_DAC_CTRL2);	if (ucontrol->value.integer.value[0])		temp |= 0xf;	else		temp &= ~0xf;	if (temp != temp2) {		wm_put(ice, WM_DAC_CTRL2, temp);		return 1;	}	return 0;}/* * ADC Oversampling */static int aureon_oversampling_info(snd_kcontrol_t *k, snd_ctl_elem_info_t *uinfo){	static char *texts[2] = { "128x", "64x"	};	uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;	uinfo->count = 1;	uinfo->value.enumerated.items = 2;	if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)		uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;	strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);        return 0;}static int aureon_oversampling_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol){	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == 0x8;	return 0;}static int aureon_oversampling_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol){	int temp, temp2;	ice1712_t *ice = snd_kcontrol_chip(kcontrol);	temp2 = temp = wm_get(ice, WM_MASTER);	if (ucontrol->value.enumerated.item[0])		temp |= 0x8;	else		temp &= ~0x8;	if (temp != temp2) {		wm_put(ice, WM_MASTER, temp);		return 1;	}	return 0;}/* * mixers */static snd_kcontrol_new_t aureon_dac_controls[] __devinitdata = {	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Master Playback Switch",		.info = wm_master_mute_info,		.get = wm_master_mute_get,		.put = wm_master_mute_put	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Master Playback Volume",		.info = wm_master_vol_info,		.get = wm_master_vol_get,		.put = wm_master_vol_put	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Front Playback Switch",		.info = wm_mute_info,		.get = wm_mute_get,		.put = wm_mute_put,		.private_value = (2 << 8) | 0	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Front Playback Volume",		.info = wm_vol_info,		.get = wm_vol_get,		.put = wm_vol_put,		.private_value = (2 << 8) | 0	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Rear Playback Switch",		.info = wm_mute_info,		.get = wm_mute_get,		.put = wm_mute_put,		.private_value = (2 << 8) | 2	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Rear Playback Volume",		.info = wm_vol_info,		.get = wm_vol_get,		.put = wm_vol_put,		.private_value = (2 << 8) | 2	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Center Playback Switch",		.info = wm_mute_info,		.get = wm_mute_get,		.put = wm_mute_put,		.private_value = (1 << 8) | 4	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Center Playback Volume",		.info = wm_vol_info,		.get = wm_vol_get,		.put = wm_vol_put,		.private_value = (1 << 8) | 4	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "LFE Playback Switch",		.info = wm_mute_info,		.get = wm_mute_get,		.put = wm_mute_put,		.private_value = (1 << 8) | 5	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "LFE Playback Volume",		.info = wm_vol_info,		.get = wm_vol_get,		.put = wm_vol_put,		.private_value = (1 << 8) | 5	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Side Playback Switch",		.info = wm_mute_info,		.get = wm_mute_get,		.put = wm_mute_put,		.private_value = (2 << 8) | 6	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Side Playback Volume",		.info = wm_vol_info,		.get = wm_vol_get,		.put = wm_vol_put,		.private_value = (2 << 8) | 6	}};static snd_kcontrol_new_t wm_controls[] __devinitdata = { 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "PCM Playback Switch",		.info = wm_pcm_mute_info,		.get = wm_pcm_mute_get,		.put = wm_pcm_mute_put 	}, 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "PCM Playback Volume",		.info = wm_pcm_vol_info,		.get = wm_pcm_vol_get,		.put = wm_pcm_vol_put 	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Capture Switch",		.info = wm_adc_mute_info,		.get = wm_adc_mute_get,		.put = wm_adc_mute_put,	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Capture Volume",		.info = wm_adc_vol_info,		.get = wm_adc_vol_get,		.put = wm_adc_vol_put	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "Capture Source",		.info = wm_adc_mux_info,		.get = wm_adc_mux_get,		.put = wm_adc_mux_put,		.private_value = 5	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "External Amplifier",		.info = aureon_hpamp_info,		.get = aureon_hpamp_get,		.put = aureon_hpamp_put	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "DAC Deemphasis Switch",		.info = aureon_deemp_info,		.get = aureon_deemp_get,		.put = aureon_deemp_put	},	{		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "ADC Oversampling",		.info = aureon_oversampling_info,		.get = aureon_oversampling_get,		.put = aureon_oversampling_put	}};static snd_kcontrol_new_t ac97_controls[] __devinitdata = { 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,		.name = "AC97 Playback Switch",		.info = aureon_ac97_mmute_info,		.get = aureon_ac97_mmute_get,		.put = aureon_ac97_mmute_put,		.private_value = AC97_MASTER 	}, 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 		.name = "AC97 Playback Volume", 		.info = aureon_ac97_vol_info, 		.get = aureon_ac97_vol_get, 		.put = aureon_ac97_vol_put, 		.private_value = AC97_MASTER|AUREON_AC97_STEREO 	}, 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 		.name = "CD Playback Switch", 		.info = aureon_ac97_mute_info, 		.get = aureon_ac97_mute_get, 		.put = aureon_ac97_mute_put, 		.private_value = AC97_CD 	}, 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 		.name = "CD Playback Volume", 		.info = aureon_ac97_vol_info, 		.get = aureon_ac97_vol_get, 		.put = aureon_ac97_vol_put, 		.private_value = AC97_CD|AUREON_AC97_STEREO 	}, 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 		.name = "Aux Playback Switch", 		.info = aureon_ac97_mute_info, 		.get = aureon_ac97_mute_get, 		.put = aureon_ac97_mute_put, 		.private_value = AC97_AUX, 	}, 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 		.name = "Aux Playback Volume", 		.info = aureon_ac97_vol_info, 		.get = aureon_ac97_vol_get, 		.put = aureon_ac97_vol_put, 		.private_value = AC97_AUX|AUREON_AC97_STEREO 	}, 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 		.name = "Line Playback Switch", 		.info = aureon_ac97_mute_info, 		.get = aureon_ac97_mute_get, 		.put = aureon_ac97_mute_put, 		.private_value = AC97_LINE 	}, 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 		.name = "Line Playback Volume", 		.info = aureon_ac97_vol_info, 		.get = aureon_ac97_vol_get, 		.put = aureon_ac97_vol_put, 		.private_value = AC97_LINE|AUREON_AC97_STEREO 	}, 	{ 		.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 		.name = "Mic Playback Switch", 		.info = aureon_ac97_mute_info, 		.get = aureon_ac97_mute_get, 		.put = aureon_ac97_mute_put, 		.private_value = AC97_MIC 	},

⌨️ 快捷键说明

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