aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/oxygen
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2010-12-02 05:38:06 -0500
committerTakashi Iwai <tiwai@suse.de>2010-12-06 08:47:58 -0500
commit2509ec623d44320419d44d4060dbedf91b8d192d (patch)
tree1b54007d4896830334af9288104f8e89c6c1705d /sound/pci/oxygen
parentf7e4bad74e1b18aaff6e89cf2bc4a3868a6ba56e (diff)
ALSA: virtuoso: add HDMI enable switch for HDAV1.3
The GPIO bit that enables analog output on the Xonar HDAV1.3 also disables the HDMI audio output, so we better add a switch for it. Hopefully, this is sufficient to make the HDMI output work. Signed-off-by: Clemens Ladisch <clemens@ladisch.de> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/oxygen')
-rw-r--r--sound/pci/oxygen/xonar.h2
-rw-r--r--sound/pci/oxygen/xonar_lib.c6
-rw-r--r--sound/pci/oxygen/xonar_pcm179x.c19
3 files changed, 24 insertions, 3 deletions
diff --git a/sound/pci/oxygen/xonar.h b/sound/pci/oxygen/xonar.h
index b35343b0a9a5..0434c207e811 100644
--- a/sound/pci/oxygen/xonar.h
+++ b/sound/pci/oxygen/xonar.h
@@ -24,6 +24,8 @@ void xonar_init_ext_power(struct oxygen *chip);
24void xonar_init_cs53x1(struct oxygen *chip); 24void xonar_init_cs53x1(struct oxygen *chip);
25void xonar_set_cs53x1_params(struct oxygen *chip, 25void xonar_set_cs53x1_params(struct oxygen *chip,
26 struct snd_pcm_hw_params *params); 26 struct snd_pcm_hw_params *params);
27
28#define XONAR_GPIO_BIT_INVERT (1 << 16)
27int xonar_gpio_bit_switch_get(struct snd_kcontrol *ctl, 29int xonar_gpio_bit_switch_get(struct snd_kcontrol *ctl,
28 struct snd_ctl_elem_value *value); 30 struct snd_ctl_elem_value *value);
29int xonar_gpio_bit_switch_put(struct snd_kcontrol *ctl, 31int xonar_gpio_bit_switch_put(struct snd_kcontrol *ctl,
diff --git a/sound/pci/oxygen/xonar_lib.c b/sound/pci/oxygen/xonar_lib.c
index b3ff71316653..0ebe7f5916f9 100644
--- a/sound/pci/oxygen/xonar_lib.c
+++ b/sound/pci/oxygen/xonar_lib.c
@@ -104,9 +104,10 @@ int xonar_gpio_bit_switch_get(struct snd_kcontrol *ctl,
104{ 104{
105 struct oxygen *chip = ctl->private_data; 105 struct oxygen *chip = ctl->private_data;
106 u16 bit = ctl->private_value; 106 u16 bit = ctl->private_value;
107 bool invert = ctl->private_value & XONAR_GPIO_BIT_INVERT;
107 108
108 value->value.integer.value[0] = 109 value->value.integer.value[0] =
109 !!(oxygen_read16(chip, OXYGEN_GPIO_DATA) & bit); 110 !!(oxygen_read16(chip, OXYGEN_GPIO_DATA) & bit) ^ invert;
110 return 0; 111 return 0;
111} 112}
112 113
@@ -115,12 +116,13 @@ int xonar_gpio_bit_switch_put(struct snd_kcontrol *ctl,
115{ 116{
116 struct oxygen *chip = ctl->private_data; 117 struct oxygen *chip = ctl->private_data;
117 u16 bit = ctl->private_value; 118 u16 bit = ctl->private_value;
119 bool invert = ctl->private_value & XONAR_GPIO_BIT_INVERT;
118 u16 old_bits, new_bits; 120 u16 old_bits, new_bits;
119 int changed; 121 int changed;
120 122
121 spin_lock_irq(&chip->reg_lock); 123 spin_lock_irq(&chip->reg_lock);
122 old_bits = oxygen_read16(chip, OXYGEN_GPIO_DATA); 124 old_bits = oxygen_read16(chip, OXYGEN_GPIO_DATA);
123 if (value->value.integer.value[0]) 125 if (!!value->value.integer.value[0] ^ invert)
124 new_bits = old_bits | bit; 126 new_bits = old_bits | bit;
125 else 127 else
126 new_bits = old_bits & ~bit; 128 new_bits = old_bits & ~bit;
diff --git a/sound/pci/oxygen/xonar_pcm179x.c b/sound/pci/oxygen/xonar_pcm179x.c
index fe4b2655a252..3850834f989c 100644
--- a/sound/pci/oxygen/xonar_pcm179x.c
+++ b/sound/pci/oxygen/xonar_pcm179x.c
@@ -776,6 +776,15 @@ static const struct snd_kcontrol_new os_128_control = {
776 .put = os_128_put, 776 .put = os_128_put,
777}; 777};
778 778
779static const struct snd_kcontrol_new hdav_hdmi_control = {
780 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
781 .name = "HDMI Playback Switch",
782 .info = snd_ctl_boolean_mono_info,
783 .get = xonar_gpio_bit_switch_get,
784 .put = xonar_gpio_bit_switch_put,
785 .private_value = GPIO_HDAV_OUTPUT_ENABLE | XONAR_GPIO_BIT_INVERT,
786};
787
779static int st_output_switch_info(struct snd_kcontrol *ctl, 788static int st_output_switch_info(struct snd_kcontrol *ctl,
780 struct snd_ctl_elem_info *info) 789 struct snd_ctl_elem_info *info)
781{ 790{
@@ -960,7 +969,15 @@ static int xonar_d2_mixer_init(struct oxygen *chip)
960 969
961static int xonar_hdav_mixer_init(struct oxygen *chip) 970static int xonar_hdav_mixer_init(struct oxygen *chip)
962{ 971{
963 return add_pcm1796_controls(chip); 972 int err;
973
974 err = snd_ctl_add(chip->card, snd_ctl_new1(&hdav_hdmi_control, chip));
975 if (err < 0)
976 return err;
977 err = add_pcm1796_controls(chip);
978 if (err < 0)
979 return err;
980 return 0;
964} 981}
965 982
966static int xonar_st_mixer_init(struct oxygen *chip) 983static int xonar_st_mixer_init(struct oxygen *chip)