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

📄 hdspm.c

📁 linux 内核源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
		strcpy(uinfo->value.enumerated.name,				texts[uinfo->value.enumerated.item]);	}	return 0;}static int snd_hdspm_get_autosync_ref(struct snd_kcontrol *kcontrol,				      struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	ucontrol->value.enumerated.item[0] = hdspm_autosync_ref(hdspm);	return 0;}#define HDSPM_LINE_OUT(xname, xindex) \{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \  .name = xname, \  .index = xindex, \  .info = snd_hdspm_info_line_out, \  .get = snd_hdspm_get_line_out, \  .put = snd_hdspm_put_line_out \}static int hdspm_line_out(struct hdspm * hdspm){	return (hdspm->control_register & HDSPM_LineOut) ? 1 : 0;}static int hdspm_set_line_output(struct hdspm * hdspm, int out){	if (out)		hdspm->control_register |= HDSPM_LineOut;	else		hdspm->control_register &= ~HDSPM_LineOut;	hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);	return 0;}#define snd_hdspm_info_line_out		snd_ctl_boolean_mono_infostatic int snd_hdspm_get_line_out(struct snd_kcontrol *kcontrol,				  struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	spin_lock_irq(&hdspm->lock);	ucontrol->value.integer.value[0] = hdspm_line_out(hdspm);	spin_unlock_irq(&hdspm->lock);	return 0;}static int snd_hdspm_put_line_out(struct snd_kcontrol *kcontrol,				  struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	int change;	unsigned int val;	if (!snd_hdspm_use_is_exclusive(hdspm))		return -EBUSY;	val = ucontrol->value.integer.value[0] & 1;	spin_lock_irq(&hdspm->lock);	change = (int) val != hdspm_line_out(hdspm);	hdspm_set_line_output(hdspm, val);	spin_unlock_irq(&hdspm->lock);	return change;}#define HDSPM_TX_64(xname, xindex) \{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \  .name = xname, \  .index = xindex, \  .info = snd_hdspm_info_tx_64, \  .get = snd_hdspm_get_tx_64, \  .put = snd_hdspm_put_tx_64 \}static int hdspm_tx_64(struct hdspm * hdspm){	return (hdspm->control_register & HDSPM_TX_64ch) ? 1 : 0;}static int hdspm_set_tx_64(struct hdspm * hdspm, int out){	if (out)		hdspm->control_register |= HDSPM_TX_64ch;	else		hdspm->control_register &= ~HDSPM_TX_64ch;	hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);	return 0;}#define snd_hdspm_info_tx_64		snd_ctl_boolean_mono_infostatic int snd_hdspm_get_tx_64(struct snd_kcontrol *kcontrol,			       struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	spin_lock_irq(&hdspm->lock);	ucontrol->value.integer.value[0] = hdspm_tx_64(hdspm);	spin_unlock_irq(&hdspm->lock);	return 0;}static int snd_hdspm_put_tx_64(struct snd_kcontrol *kcontrol,			       struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	int change;	unsigned int val;	if (!snd_hdspm_use_is_exclusive(hdspm))		return -EBUSY;	val = ucontrol->value.integer.value[0] & 1;	spin_lock_irq(&hdspm->lock);	change = (int) val != hdspm_tx_64(hdspm);	hdspm_set_tx_64(hdspm, val);	spin_unlock_irq(&hdspm->lock);	return change;}#define HDSPM_C_TMS(xname, xindex) \{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \  .name = xname, \  .index = xindex, \  .info = snd_hdspm_info_c_tms, \  .get = snd_hdspm_get_c_tms, \  .put = snd_hdspm_put_c_tms \}static int hdspm_c_tms(struct hdspm * hdspm){	return (hdspm->control_register & HDSPM_clr_tms) ? 1 : 0;}static int hdspm_set_c_tms(struct hdspm * hdspm, int out){	if (out)		hdspm->control_register |= HDSPM_clr_tms;	else		hdspm->control_register &= ~HDSPM_clr_tms;	hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);	return 0;}#define snd_hdspm_info_c_tms		snd_ctl_boolean_mono_infostatic int snd_hdspm_get_c_tms(struct snd_kcontrol *kcontrol,			       struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	spin_lock_irq(&hdspm->lock);	ucontrol->value.integer.value[0] = hdspm_c_tms(hdspm);	spin_unlock_irq(&hdspm->lock);	return 0;}static int snd_hdspm_put_c_tms(struct snd_kcontrol *kcontrol,			       struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	int change;	unsigned int val;	if (!snd_hdspm_use_is_exclusive(hdspm))		return -EBUSY;	val = ucontrol->value.integer.value[0] & 1;	spin_lock_irq(&hdspm->lock);	change = (int) val != hdspm_c_tms(hdspm);	hdspm_set_c_tms(hdspm, val);	spin_unlock_irq(&hdspm->lock);	return change;}#define HDSPM_SAFE_MODE(xname, xindex) \{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \  .name = xname, \  .index = xindex, \  .info = snd_hdspm_info_safe_mode, \  .get = snd_hdspm_get_safe_mode, \  .put = snd_hdspm_put_safe_mode \}static int hdspm_safe_mode(struct hdspm * hdspm){	return (hdspm->control_register & HDSPM_AutoInp) ? 1 : 0;}static int hdspm_set_safe_mode(struct hdspm * hdspm, int out){	if (out)		hdspm->control_register |= HDSPM_AutoInp;	else		hdspm->control_register &= ~HDSPM_AutoInp;	hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);	return 0;}#define snd_hdspm_info_safe_mode	snd_ctl_boolean_mono_infostatic int snd_hdspm_get_safe_mode(struct snd_kcontrol *kcontrol,				   struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	spin_lock_irq(&hdspm->lock);	ucontrol->value.integer.value[0] = hdspm_safe_mode(hdspm);	spin_unlock_irq(&hdspm->lock);	return 0;}static int snd_hdspm_put_safe_mode(struct snd_kcontrol *kcontrol,				   struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	int change;	unsigned int val;	if (!snd_hdspm_use_is_exclusive(hdspm))		return -EBUSY;	val = ucontrol->value.integer.value[0] & 1;	spin_lock_irq(&hdspm->lock);	change = (int) val != hdspm_safe_mode(hdspm);	hdspm_set_safe_mode(hdspm, val);	spin_unlock_irq(&hdspm->lock);	return change;}#define HDSPM_EMPHASIS(xname, xindex) \{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \  .name = xname, \  .index = xindex, \  .info = snd_hdspm_info_emphasis, \  .get = snd_hdspm_get_emphasis, \  .put = snd_hdspm_put_emphasis \}static int hdspm_emphasis(struct hdspm * hdspm){	return (hdspm->control_register & HDSPM_Emphasis) ? 1 : 0;}static int hdspm_set_emphasis(struct hdspm * hdspm, int emp){	if (emp)		hdspm->control_register |= HDSPM_Emphasis;	else		hdspm->control_register &= ~HDSPM_Emphasis;	hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);	return 0;}#define snd_hdspm_info_emphasis		snd_ctl_boolean_mono_infostatic int snd_hdspm_get_emphasis(struct snd_kcontrol *kcontrol,				  struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	spin_lock_irq(&hdspm->lock);	ucontrol->value.enumerated.item[0] = hdspm_emphasis(hdspm);	spin_unlock_irq(&hdspm->lock);	return 0;}static int snd_hdspm_put_emphasis(struct snd_kcontrol *kcontrol,				  struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	int change;	unsigned int val;	if (!snd_hdspm_use_is_exclusive(hdspm))		return -EBUSY;	val = ucontrol->value.integer.value[0] & 1;	spin_lock_irq(&hdspm->lock);	change = (int) val != hdspm_emphasis(hdspm);	hdspm_set_emphasis(hdspm, val);	spin_unlock_irq(&hdspm->lock);	return change;}#define HDSPM_DOLBY(xname, xindex) \{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \  .name = xname, \  .index = xindex, \  .info = snd_hdspm_info_dolby, \  .get = snd_hdspm_get_dolby, \  .put = snd_hdspm_put_dolby \}static int hdspm_dolby(struct hdspm * hdspm){	return (hdspm->control_register & HDSPM_Dolby) ? 1 : 0;}static int hdspm_set_dolby(struct hdspm * hdspm, int dol){	if (dol)		hdspm->control_register |= HDSPM_Dolby;	else		hdspm->control_register &= ~HDSPM_Dolby;	hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);	return 0;}#define snd_hdspm_info_dolby		snd_ctl_boolean_mono_infostatic int snd_hdspm_get_dolby(struct snd_kcontrol *kcontrol,			       struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	spin_lock_irq(&hdspm->lock);	ucontrol->value.enumerated.item[0] = hdspm_dolby(hdspm);	spin_unlock_irq(&hdspm->lock);	return 0;}static int snd_hdspm_put_dolby(struct snd_kcontrol *kcontrol,			       struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	int change;	unsigned int val;	if (!snd_hdspm_use_is_exclusive(hdspm))		return -EBUSY;	val = ucontrol->value.integer.value[0] & 1;	spin_lock_irq(&hdspm->lock);	change = (int) val != hdspm_dolby(hdspm);	hdspm_set_dolby(hdspm, val);	spin_unlock_irq(&hdspm->lock);	return change;}#define HDSPM_PROFESSIONAL(xname, xindex) \{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \  .name = xname, \  .index = xindex, \  .info = snd_hdspm_info_professional, \  .get = snd_hdspm_get_professional, \  .put = snd_hdspm_put_professional \}static int hdspm_professional(struct hdspm * hdspm){	return (hdspm->control_register & HDSPM_Professional) ? 1 : 0;}static int hdspm_set_professional(struct hdspm * hdspm, int dol){	if (dol)		hdspm->control_register |= HDSPM_Professional;	else		hdspm->control_register &= ~HDSPM_Professional;	hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);	return 0;}#define snd_hdspm_info_professional	snd_ctl_boolean_mono_infostatic int snd_hdspm_get_professional(struct snd_kcontrol *kcontrol,				      struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	spin_lock_irq(&hdspm->lock);	ucontrol->value.enumerated.item[0] = hdspm_professional(hdspm);	spin_unlock_irq(&hdspm->lock);	return 0;}static int snd_hdspm_put_professional(struct snd_kcontrol *kcontrol,				      struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	int change;	unsigned int val;	if (!snd_hdspm_use_is_exclusive(hdspm))		return -EBUSY;	val = ucontrol->value.integer.value[0] & 1;	spin_lock_irq(&hdspm->lock);	change = (int) val != hdspm_professional(hdspm);	hdspm_set_professional(hdspm, val);	spin_unlock_irq(&hdspm->lock);	return change;}#define HDSPM_INPUT_SELECT(xname, xindex) \{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \  .name = xname, \  .index = xindex, \  .info = snd_hdspm_info_input_select, \  .get = snd_hdspm_get_input_select, \  .put = snd_hdspm_put_input_select \}static int hdspm_input_select(struct hdspm * hdspm){	return (hdspm->control_register & HDSPM_InputSelect0) ? 1 : 0;}static int hdspm_set_input_select(struct hdspm * hdspm, int out){	if (out)		hdspm->control_register |= HDSPM_InputSelect0;	else		hdspm->control_register &= ~HDSPM_InputSelect0;	hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);	return 0;}static int snd_hdspm_info_input_select(struct snd_kcontrol *kcontrol,				       struct snd_ctl_elem_info *uinfo){	static char *texts[] = { "optical", "coaxial" };	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 snd_hdspm_get_input_select(struct snd_kcontrol *kcontrol,				      struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	spin_lock_irq(&hdspm->lock);	ucontrol->value.enumerated.item[0] = hdspm_input_select(hdspm);	spin_unlock_irq(&hdspm->lock);	return 0;}static int snd_hdspm_put_input_select(struct snd_kcontrol *kcontrol,				      struct snd_ctl_elem_value *ucontrol){	struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);	int 

⌨️ 快捷键说明

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