]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
ALSA: virtuoso: add HDMI enable switch for HDAV1.3
authorClemens Ladisch <clemens@ladisch.de>
Thu, 2 Dec 2010 10:38:06 +0000 (11:38 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 6 Dec 2010 13:47:58 +0000 (14:47 +0100)
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>
sound/pci/Kconfig
sound/pci/oxygen/xonar.h
sound/pci/oxygen/xonar_lib.c
sound/pci/oxygen/xonar_pcm179x.c

index 5add96bdf172c4d6d0bace9f80c4d19b07815f57..7b2678a25ca037d40faf238bcf714afafff1a647 100644 (file)
@@ -817,7 +817,7 @@ config SND_VIRTUOSO
          Say Y here to include support for sound cards based on the
          Asus AV66/AV100/AV200 chips, i.e., Xonar D1, DX, D2, D2X, DS,
          Essence ST (Deluxe), and Essence STX.
-         Support for the HDAV1.3 (Deluxe) is incomplete; for the
+         Support for the HDAV1.3 (Deluxe) is experimental; for the
          HDAV1.3 Slim and Xense, missing.
 
          To compile this driver as a module, choose M here: the module
index b35343b0a9a58cb3444faf02a832b65e888af04c..0434c207e811a00e51b4c465617e7e299defbb9a 100644 (file)
@@ -24,6 +24,8 @@ void xonar_init_ext_power(struct oxygen *chip);
 void xonar_init_cs53x1(struct oxygen *chip);
 void xonar_set_cs53x1_params(struct oxygen *chip,
                             struct snd_pcm_hw_params *params);
+
+#define XONAR_GPIO_BIT_INVERT  (1 << 16)
 int xonar_gpio_bit_switch_get(struct snd_kcontrol *ctl,
                              struct snd_ctl_elem_value *value);
 int xonar_gpio_bit_switch_put(struct snd_kcontrol *ctl,
index b3ff7131665324c7bd6b640aa19e4b9262f61e8b..0ebe7f5916f995a992a227d5ee9fd0755c6c0a87 100644 (file)
@@ -104,9 +104,10 @@ int xonar_gpio_bit_switch_get(struct snd_kcontrol *ctl,
 {
        struct oxygen *chip = ctl->private_data;
        u16 bit = ctl->private_value;
+       bool invert = ctl->private_value & XONAR_GPIO_BIT_INVERT;
 
        value->value.integer.value[0] =
-               !!(oxygen_read16(chip, OXYGEN_GPIO_DATA) & bit);
+               !!(oxygen_read16(chip, OXYGEN_GPIO_DATA) & bit) ^ invert;
        return 0;
 }
 
@@ -115,12 +116,13 @@ int xonar_gpio_bit_switch_put(struct snd_kcontrol *ctl,
 {
        struct oxygen *chip = ctl->private_data;
        u16 bit = ctl->private_value;
+       bool invert = ctl->private_value & XONAR_GPIO_BIT_INVERT;
        u16 old_bits, new_bits;
        int changed;
 
        spin_lock_irq(&chip->reg_lock);
        old_bits = oxygen_read16(chip, OXYGEN_GPIO_DATA);
-       if (value->value.integer.value[0])
+       if (!!value->value.integer.value[0] ^ invert)
                new_bits = old_bits | bit;
        else
                new_bits = old_bits & ~bit;
index fe4b2655a2528f28fe9cc0ec23aba7bb1820a0b0..3850834f989c64558d99ba4e70a5f8ab4a423544 100644 (file)
@@ -776,6 +776,15 @@ static const struct snd_kcontrol_new os_128_control = {
        .put = os_128_put,
 };
 
+static const struct snd_kcontrol_new hdav_hdmi_control = {
+       .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+       .name = "HDMI Playback Switch",
+       .info = snd_ctl_boolean_mono_info,
+       .get = xonar_gpio_bit_switch_get,
+       .put = xonar_gpio_bit_switch_put,
+       .private_value = GPIO_HDAV_OUTPUT_ENABLE | XONAR_GPIO_BIT_INVERT,
+};
+
 static int st_output_switch_info(struct snd_kcontrol *ctl,
                                 struct snd_ctl_elem_info *info)
 {
@@ -960,7 +969,15 @@ static int xonar_d2_mixer_init(struct oxygen *chip)
 
 static int xonar_hdav_mixer_init(struct oxygen *chip)
 {
-       return add_pcm1796_controls(chip);
+       int err;
+
+       err = snd_ctl_add(chip->card, snd_ctl_new1(&hdav_hdmi_control, chip));
+       if (err < 0)
+               return err;
+       err = add_pcm1796_controls(chip);
+       if (err < 0)
+               return err;
+       return 0;
 }
 
 static int xonar_st_mixer_init(struct oxygen *chip)