Merge branch 'omap-clock-for-next' of git://git.pwsan.com/linux-2.6 into devel
[pandora-kernel.git] / sound / pci / ice1712 / ice1724.c
index 8afa043..36ade77 100644 (file)
@@ -49,6 +49,7 @@
 #include "prodigy192.h"
 #include "prodigy_hifi.h"
 #include "juli.h"
+#include "maya44.h"
 #include "phase.h"
 #include "wtm.h"
 #include "se.h"
@@ -65,6 +66,7 @@ MODULE_SUPPORTED_DEVICE("{"
               PRODIGY192_DEVICE_DESC
               PRODIGY_HIFI_DEVICE_DESC
               JULI_DEVICE_DESC
+              MAYA44_DEVICE_DESC
               PHASE_DEVICE_DESC
               WTM_DEVICE_DESC
               SE_DEVICE_DESC
@@ -1975,7 +1977,7 @@ static inline int digital_route_shift(int idx)
        return idx * 3;
 }
 
-static int get_route_val(struct snd_ice1712 *ice, int shift)
+int snd_ice1724_get_route_val(struct snd_ice1712 *ice, int shift)
 {
        unsigned long val;
        unsigned char eitem;
@@ -1994,7 +1996,8 @@ static int get_route_val(struct snd_ice1712 *ice, int shift)
        return eitem;
 }
 
-static int put_route_val(struct snd_ice1712 *ice, unsigned int val, int shift)
+int snd_ice1724_put_route_val(struct snd_ice1712 *ice, unsigned int val,
+                                                               int shift)
 {
        unsigned int old_val, nval;
        int change;
@@ -2022,7 +2025,7 @@ static int snd_vt1724_pro_route_analog_get(struct snd_kcontrol *kcontrol,
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
        ucontrol->value.enumerated.item[0] =
-               get_route_val(ice, analog_route_shift(idx));
+               snd_ice1724_get_route_val(ice, analog_route_shift(idx));
        return 0;
 }
 
@@ -2031,8 +2034,9 @@ static int snd_vt1724_pro_route_analog_put(struct snd_kcontrol *kcontrol,
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
-       return put_route_val(ice, ucontrol->value.enumerated.item[0],
-                            analog_route_shift(idx));
+       return snd_ice1724_put_route_val(ice,
+                                        ucontrol->value.enumerated.item[0],
+                                        analog_route_shift(idx));
 }
 
 static int snd_vt1724_pro_route_spdif_get(struct snd_kcontrol *kcontrol,
@@ -2041,7 +2045,7 @@ static int snd_vt1724_pro_route_spdif_get(struct snd_kcontrol *kcontrol,
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
        ucontrol->value.enumerated.item[0] =
-               get_route_val(ice, digital_route_shift(idx));
+               snd_ice1724_get_route_val(ice, digital_route_shift(idx));
        return 0;
 }
 
@@ -2050,11 +2054,13 @@ static int snd_vt1724_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
 {
        struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
        int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
-       return put_route_val(ice, ucontrol->value.enumerated.item[0],
-                            digital_route_shift(idx));
+       return snd_ice1724_put_route_val(ice,
+                                        ucontrol->value.enumerated.item[0],
+                                        digital_route_shift(idx));
 }
 
-static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata = {
+static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata =
+{
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
        .name = "H/W Playback Route",
        .info = snd_vt1724_pro_route_info,
@@ -2121,6 +2127,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
        snd_vt1724_prodigy_hifi_cards,
        snd_vt1724_prodigy192_cards,
        snd_vt1724_juli_cards,
+       snd_vt1724_maya44_cards,
        snd_vt1724_phase_cards,
        snd_vt1724_wtm_cards,
        snd_vt1724_se_cards,
@@ -2258,8 +2265,10 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
 static void __devinit snd_vt1724_chip_reset(struct snd_ice1712 *ice)
 {
        outb(VT1724_RESET , ICEREG1724(ice, CONTROL));
+       inb(ICEREG1724(ice, CONTROL)); /* pci posting flush */
        msleep(10);
        outb(0, ICEREG1724(ice, CONTROL));
+       inb(ICEREG1724(ice, CONTROL)); /* pci posting flush */
        msleep(10);
 }
 
@@ -2289,9 +2298,12 @@ static int __devinit snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice)
        if (snd_BUG_ON(!ice->pcm))
                return -EIO;
 
-       err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_mixer_pro_spdif_route, ice));
-       if (err < 0)
-               return err;
+       if (!ice->own_routing) {
+               err = snd_ctl_add(ice->card,
+                       snd_ctl_new1(&snd_vt1724_mixer_pro_spdif_route, ice));
+               if (err < 0)
+                       return err;
+       }
 
        err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_vt1724_spdif_switch, ice));
        if (err < 0)
@@ -2338,7 +2350,7 @@ static int __devinit snd_vt1724_build_controls(struct snd_ice1712 *ice)
        if (err < 0)
                return err;
 
-       if (ice->num_total_dacs > 0) {
+       if (!ice->own_routing && ice->num_total_dacs > 0) {
                struct snd_kcontrol_new tmp = snd_vt1724_mixer_pro_analog_route;
                tmp.count = ice->num_total_dacs;
                if (ice->vt1720 && tmp.count > 2)