Fedora kernel-2.6.17-1.2142_FC4 patched with stable patch-2.6.17.4-vs2.0.2-rc26.diff
[linux-2.6.git] / sound / pci / au88x0 / au88x0_eq.c
index fdf0014..0c86a31 100644 (file)
 #include "au88x0_eq.h"
 #include "au88x0_eqdata.c"
 
+#define VORTEX_EQ_BASE  0x2b000
+#define VORTEX_EQ_DEST   (VORTEX_EQ_BASE + 0x410)
+#define VORTEX_EQ_SOURCE (VORTEX_EQ_BASE + 0x430)
+#define VORTEX_EQ_CTRL   (VORTEX_EQ_BASE + 0x440)
+
+#define VORTEX_BAND_COEFF_SIZE 0x30
+
 /* CEqHw.s */
-static void vortex_EqHw_SetTimeConsts(vortex_t * vortex, u16 a, u16 b)
+static void vortex_EqHw_SetTimeConsts(vortex_t * vortex, u16 gain, u16 level)
 {
-       hwwrite(vortex->mmio, 0x2b3c4, a);
-       hwwrite(vortex->mmio, 0x2b3c8, b);
+       hwwrite(vortex->mmio, 0x2b3c4, gain);
+       hwwrite(vortex->mmio, 0x2b3c8, level);
 }
 
-static void vortex_EqHw_SetLeftCoefs(vortex_t * vortex, u16 a[])
+static inline u16 sign_invert(u16 a)
 {
-       eqhw_t *eqhw = &(vortex->eq.this04);
-       int eax, i = 0, n /*esp2c */  = 0;
+       /* -(-32768) -> -32768 so we do -(-32768) -> 32767 to make the result positive */
+       if (a == (u16)-32768)
+               return 32767;
+       else
+               return -a;
+}
 
-       if (eqhw->this04 <= n)
-               return;
+static void vortex_EqHw_SetLeftCoefs(vortex_t * vortex, u16 coefs[])
+{
+       eqhw_t *eqhw = &(vortex->eq.this04);
+       int i = 0, n /*esp2c */;
 
-       do {
-               hwwrite(vortex->mmio, 0x2b000 + n * 0x30, a[i + 0]);
-               hwwrite(vortex->mmio, 0x2b004 + n * 0x30, a[i + 1]);
+       for (n = 0; n < eqhw->this04; n++) {
+               hwwrite(vortex->mmio, 0x2b000 + n * 0x30, coefs[i + 0]);
+               hwwrite(vortex->mmio, 0x2b004 + n * 0x30, coefs[i + 1]);
 
                if (eqhw->this08 == 0) {
-                       hwwrite(vortex->mmio, 0x2b008 + n * 0x30, a[i + 2]);
-                       hwwrite(vortex->mmio, 0x2b00c + n * 0x30, a[i + 3]);
-                       eax = a[i + 4]; //esp24;
+                       hwwrite(vortex->mmio, 0x2b008 + n * 0x30, coefs[i + 2]);
+                       hwwrite(vortex->mmio, 0x2b00c + n * 0x30, coefs[i + 3]);
+                       hwwrite(vortex->mmio, 0x2b010 + n * 0x30, coefs[i + 4]);
                } else {
-                       if (a[2 + i] == 0x8000)
-                               eax = 0x7fff;
-                       else
-                               eax = ~a[2 + i];
-                       hwwrite(vortex->mmio, 0x2b008 + n * 0x30, eax & 0xffff);
-                       if (a[3 + i] == 0x8000)
-                               eax = 0x7fff;
-                       else
-                               eax = ~a[3 + i];
-                       hwwrite(vortex->mmio, 0x2b00c + n * 0x30, eax & 0xffff);
-                       if (a[4 + i] == 0x8000)
-                               eax = 0x7fff;
-                       else
-                               eax = ~a[4 + i];
+                       hwwrite(vortex->mmio, 0x2b008 + n * 0x30, sign_invert(coefs[2 + i]));
+                       hwwrite(vortex->mmio, 0x2b00c + n * 0x30, sign_invert(coefs[3 + i]));
+                       hwwrite(vortex->mmio, 0x2b010 + n * 0x30, sign_invert(coefs[4 + i]));
                }
-               hwwrite(vortex->mmio, 0x2b010 + n * 0x30, eax);
-
-               n++;
                i += 5;
        }
-       while (n < eqhw->this04);
 }
 
-static void vortex_EqHw_SetRightCoefs(vortex_t * vortex, u16 a[])
+static void vortex_EqHw_SetRightCoefs(vortex_t * vortex, u16 coefs[])
 {
        eqhw_t *eqhw = &(vortex->eq.this04);
-       int i = 0, n /*esp2c */  = 0, eax;
+       int i = 0, n /*esp2c */;
 
-       if (eqhw->this04 <= n)
-               return;
-
-       do {
-               hwwrite(vortex->mmio, 0x2b1e0 + n * 0x30, a[0 + i]);
-               hwwrite(vortex->mmio, 0x2b1e4 + n * 0x30, a[1 + i]);
+       for (n = 0; n < eqhw->this04; n++) {
+               hwwrite(vortex->mmio, 0x2b1e0 + n * 0x30, coefs[0 + i]);
+               hwwrite(vortex->mmio, 0x2b1e4 + n * 0x30, coefs[1 + i]);
 
                if (eqhw->this08 == 0) {
-                       hwwrite(vortex->mmio, 0x2b1e8 + n * 0x30, a[2 + i]);
-                       hwwrite(vortex->mmio, 0x2b1ec + n * 0x30, a[3 + i]);
-                       eax = a[4 + i]; //*esp24;
+                       hwwrite(vortex->mmio, 0x2b1e8 + n * 0x30, coefs[2 + i]);
+                       hwwrite(vortex->mmio, 0x2b1ec + n * 0x30, coefs[3 + i]);
+                       hwwrite(vortex->mmio, 0x2b1f0 + n * 0x30, coefs[4 + i]);
                } else {
-                       if (a[2 + i] == 0x8000)
-                               eax = 0x7fff;
-                       else
-                               eax = ~(a[2 + i]);
-                       hwwrite(vortex->mmio, 0x2b1e8 + n * 0x30, eax & 0xffff);
-                       if (a[3 + i] == 0x8000)
-                               eax = 0x7fff;
-                       else
-                               eax = ~a[3 + i];
-                       hwwrite(vortex->mmio, 0x2b1ec + n * 0x30, eax & 0xffff);
-                       if (a[4 + i] == 0x8000)
-                               eax = 0x7fff;
-                       else
-                               eax = ~a[4 + i];
+                       hwwrite(vortex->mmio, 0x2b1e8 + n * 0x30, sign_invert(coefs[2 + i]));
+                       hwwrite(vortex->mmio, 0x2b1ec + n * 0x30, sign_invert(coefs[3 + i]));
+                       hwwrite(vortex->mmio, 0x2b1f0 + n * 0x30, sign_invert(coefs[4 + i]));
                }
-               hwwrite(vortex->mmio, 0x2b1f0 + n * 0x30, eax);
                i += 5;
-               n++;
        }
-       while (n < eqhw->this04);
 
 }
 
 static void vortex_EqHw_SetLeftStates(vortex_t * vortex, u16 a[], u16 b[])
 {
        eqhw_t *eqhw = &(vortex->eq.this04);
-       int i = 0, ebx = 0;
+       int i = 0, ebx;
 
        hwwrite(vortex->mmio, 0x2b3fc, a[0]);
        hwwrite(vortex->mmio, 0x2b400, a[1]);
 
-       if (eqhw->this04 < 0)
-               return;
-
-       do {
+       for (ebx = 0; ebx < eqhw->this04; ebx++) {
                hwwrite(vortex->mmio, 0x2b014 + (i * 0xc), b[i]);
                hwwrite(vortex->mmio, 0x2b018 + (i * 0xc), b[1 + i]);
                hwwrite(vortex->mmio, 0x2b01c + (i * 0xc), b[2 + i]);
                hwwrite(vortex->mmio, 0x2b020 + (i * 0xc), b[3 + i]);
                i += 4;
-               ebx++;
        }
-       while (eqhw->this04 > ebx);
 }
 
 static void vortex_EqHw_SetRightStates(vortex_t * vortex, u16 a[], u16 b[])
 {
        eqhw_t *eqhw = &(vortex->eq.this04);
-       int i = 0, ebx = 0;
+       int i = 0, ebx;
 
        hwwrite(vortex->mmio, 0x2b404, a[0]);
        hwwrite(vortex->mmio, 0x2b408, a[1]);
 
-       if (eqhw->this04 < 0)
-               return;
-
-       do {
+       for (ebx = 0; ebx < eqhw->this04; ebx++) {
                hwwrite(vortex->mmio, 0x2b1f4 + (i * 0xc), b[i]);
                hwwrite(vortex->mmio, 0x2b1f8 + (i * 0xc), b[1 + i]);
                hwwrite(vortex->mmio, 0x2b1fc + (i * 0xc), b[2 + i]);
                hwwrite(vortex->mmio, 0x2b200 + (i * 0xc), b[3 + i]);
                i += 4;
-               ebx++;
        }
-       while (ebx < eqhw->this04);
 }
 
 #if 0
@@ -203,22 +174,12 @@ static void vortex_EqHw_GetRightStates(vortex_t * vortex, u16 * a, u16 b[])
 static void vortex_EqHw_SetBypassGain(vortex_t * vortex, u16 a, u16 b)
 {
        eqhw_t *eqhw = &(vortex->eq.this04);
-       int eax;
-
        if (eqhw->this08 == 0) {
                hwwrite(vortex->mmio, 0x2b3d4, a);
                hwwrite(vortex->mmio, 0x2b3ec, b);
        } else {
-               if (a == 0x8000)
-                       eax = 0x7fff;
-               else
-                       eax = ~a;
-               hwwrite(vortex->mmio, 0x2b3d4, eax & 0xffff);
-               if (b == 0x8000)
-                       eax = 0x7fff;
-               else
-                       eax = ~b;
-               hwwrite(vortex->mmio, 0x2b3ec, eax & 0xffff);
+               hwwrite(vortex->mmio, 0x2b3d4, sign_invert(a));
+               hwwrite(vortex->mmio, 0x2b3ec, sign_invert(b));
        }
 }
 
@@ -260,60 +221,41 @@ vortex_EqHw_SetRightGainsSingleTarget(vortex_t * vortex, u16 index, u16 b)
 static void vortex_EqHw_SetLeftGainsTarget(vortex_t * vortex, u16 a[])
 {
        eqhw_t *eqhw = &(vortex->eq.this04);
-       int ebx = 0;
+       int ebx;
 
-       if (eqhw->this04 < 0)
-               return;
-       do {
+       for (ebx = 0; ebx < eqhw->this04; ebx++) {
                hwwrite(vortex->mmio, 0x2b02c + ebx * 0x30, a[ebx]);
-               ebx++;
        }
-       while (ebx < eqhw->this04);
 }
 
 static void vortex_EqHw_SetRightGainsTarget(vortex_t * vortex, u16 a[])
 {
        eqhw_t *eqhw = &(vortex->eq.this04);
-       int ebx = 0;
-
-       if (eqhw->this04 < 0)
-               return;
+       int ebx;
 
-       do {
+       for (ebx = 0; ebx < eqhw->this04; ebx++) {
                hwwrite(vortex->mmio, 0x2b20c + ebx * 0x30, a[ebx]);
-               ebx++;
        }
-       while (ebx < eqhw->this04);
 }
 
 static void vortex_EqHw_SetLeftGainsCurrent(vortex_t * vortex, u16 a[])
 {
        eqhw_t *eqhw = &(vortex->eq.this04);
-       int ebx = 0;
-
-       if (eqhw->this04 < 0)
-               return;
+       int ebx;
 
-       do {
+       for (ebx = 0; ebx < eqhw->this04; ebx++) {
                hwwrite(vortex->mmio, 0x2b028 + ebx * 0x30, a[ebx]);
-               ebx++;
        }
-       while (ebx < eqhw->this04);
 }
 
 static void vortex_EqHw_SetRightGainsCurrent(vortex_t * vortex, u16 a[])
 {
        eqhw_t *eqhw = &(vortex->eq.this04);
-       int ebx = 0;
-
-       if (eqhw->this04 < 0)
-               return;
+       int ebx;
 
-       do {
+       for (ebx = 0; ebx < eqhw->this04; ebx++) {
                hwwrite(vortex->mmio, 0x2b208 + ebx * 0x30, a[ebx]);
-               ebx++;
        }
-       while (ebx < eqhw->this04);
 }
 
 #if 0
@@ -379,34 +321,27 @@ static void vortex_EqHw_GetRightGainsCurrent(vortex_t * vortex, u16 a[])
 
 #endif
 /* EQ band levels settings */
-static void vortex_EqHw_SetLevels(vortex_t * vortex, u16 a[])
+static void vortex_EqHw_SetLevels(vortex_t * vortex, u16 peaks[])
 {
        eqhw_t *eqhw = &(vortex->eq.this04);
-       int ebx;
-
-       if (eqhw->this04 < 0)
-               return;
+       int i;
 
-       ebx = 0;
-       do {
-               hwwrite(vortex->mmio, 0x2b024 + ebx * 0x30, a[ebx]);
-               ebx++;
+       /* set left peaks */
+       for (i = 0; i < eqhw->this04; i++) {
+               hwwrite(vortex->mmio, 0x2b024 + i * VORTEX_BAND_COEFF_SIZE, peaks[i]);
        }
-       while (ebx < eqhw->this04);
 
-       hwwrite(vortex->mmio, 0x2b3cc, a[eqhw->this04]);
-       hwwrite(vortex->mmio, 0x2b3d8, a[eqhw->this04 + 1]);
+       hwwrite(vortex->mmio, 0x2b3cc, peaks[eqhw->this04]);
+       hwwrite(vortex->mmio, 0x2b3d8, peaks[eqhw->this04 + 1]);
 
-       ebx = 0;
-       do {
-               hwwrite(vortex->mmio, 0x2b204 + ebx * 0x30,
-                       a[ebx + (eqhw->this04 + 2)]);
-               ebx++;
+       /* set right peaks */
+       for (i = 0; i < eqhw->this04; i++) {
+               hwwrite(vortex->mmio, 0x2b204 + i * VORTEX_BAND_COEFF_SIZE,
+                       peaks[i + (eqhw->this04 + 2)]);
        }
-       while (ebx < eqhw->this04);
 
-       hwwrite(vortex->mmio, 0x2b3e4, a[2 + (eqhw->this04 * 2)]);
-       hwwrite(vortex->mmio, 0x2b3f0, a[3 + (eqhw->this04 * 2)]);
+       hwwrite(vortex->mmio, 0x2b3e4, peaks[2 + (eqhw->this04 * 2)]);
+       hwwrite(vortex->mmio, 0x2b3f0, peaks[3 + (eqhw->this04 * 2)]);
 }
 
 #if 0
@@ -442,23 +377,23 @@ static void vortex_EqHw_GetLevels(vortex_t * vortex, u16 a[])
 
 #endif
 /* Global Control */
-static void vortex_EqHw_SetControlReg(vortex_t * vortex, unsigned long reg)
+static void vortex_EqHw_SetControlReg(vortex_t * vortex, u32 reg)
 {
        hwwrite(vortex->mmio, 0x2b440, reg);
 }
 
-static void vortex_EqHw_SetSampleRate(vortex_t * vortex, int sr)
+static void vortex_EqHw_SetSampleRate(vortex_t * vortex, u32 sr)
 {
        hwwrite(vortex->mmio, 0x2b440, ((sr & 0x1f) << 3) | 0xb800);
 }
 
 #if 0
-static void vortex_EqHw_GetControlReg(vortex_t * vortex, unsigned long *reg)
+static void vortex_EqHw_GetControlReg(vortex_t * vortex, u32 *reg)
 {
        *reg = hwread(vortex->mmio, 0x2b440);
 }
 
-static void vortex_EqHw_GetSampleRate(vortex_t * vortex, int *sr)
+static void vortex_EqHw_GetSampleRate(vortex_t * vortex, u32 *sr)
 {
        *sr = (hwread(vortex->mmio, 0x2b440) >> 3) & 0x1f;
 }
@@ -466,12 +401,12 @@ static void vortex_EqHw_GetSampleRate(vortex_t * vortex, int *sr)
 #endif
 static void vortex_EqHw_Enable(vortex_t * vortex)
 {
-       hwwrite(vortex->mmio, 0x2b440, 0xf001);
+       hwwrite(vortex->mmio, VORTEX_EQ_CTRL, 0xf001);
 }
 
 static void vortex_EqHw_Disable(vortex_t * vortex)
 {
-       hwwrite(vortex->mmio, 0x2b440, 0xf000);
+       hwwrite(vortex->mmio, VORTEX_EQ_CTRL, 0xf000);
 }
 
 /* Reset (zero) buffers */
@@ -479,16 +414,16 @@ static void vortex_EqHw_ZeroIO(vortex_t * vortex)
 {
        int i;
        for (i = 0; i < 0x8; i++)
-               hwwrite(vortex->mmio, 0x2b410 + (i << 2), 0x0);
+               hwwrite(vortex->mmio, VORTEX_EQ_DEST + (i << 2), 0x0);
        for (i = 0; i < 0x4; i++)
-               hwwrite(vortex->mmio, 0x2b430 + (i << 2), 0x0);
+               hwwrite(vortex->mmio, VORTEX_EQ_SOURCE + (i << 2), 0x0);
 }
 
 static void vortex_EqHw_ZeroA3DIO(vortex_t * vortex)
 {
        int i;
        for (i = 0; i < 0x4; i++)
-               hwwrite(vortex->mmio, 0x2b410 + (i << 2), 0x0);
+               hwwrite(vortex->mmio, VORTEX_EQ_DEST + (i << 2), 0x0);
 }
 
 static void vortex_EqHw_ZeroState(vortex_t * vortex)
@@ -619,7 +554,7 @@ static void vortex_Eqlzr_SetRightGain(vortex_t * vortex, u16 index, u16 gain)
 
 #if 0
 static int
-vortex_Eqlzr_GetAllBands(vortex_t * vortex, u16 * gains, unsigned long *cnt)
+vortex_Eqlzr_GetAllBands(vortex_t * vortex, u16 * gains, s32 *cnt)
 {
        eqlzr_t *eq = &(vortex->eq);
        int si = 0;
@@ -651,7 +586,7 @@ static int vortex_Eqlzr_SetAllBandsFromActiveCoeffSet(vortex_t * vortex)
 }
 
 static int
-vortex_Eqlzr_SetAllBands(vortex_t * vortex, u16 gains[], unsigned long count)
+vortex_Eqlzr_SetAllBands(vortex_t * vortex, u16 gains[], s32 count)
 {
        eqlzr_t *eq = &(vortex->eq);
        int i;
@@ -659,22 +594,20 @@ vortex_Eqlzr_SetAllBands(vortex_t * vortex, u16 gains[], unsigned long count)
        if (((eq->this10) * 2 != count) || (eq->this28 == 0))
                return 1;
 
-       if (0 < count) {
-               for (i = 0; i < count; i++) {
-                       eq->this130[i] = gains[i];
-               }
+       for (i = 0; i < count; i++) {
+               eq->this130[i] = gains[i];
        }
+       
        if (eq->this54)
                return 0;
        return vortex_Eqlzr_SetAllBandsFromActiveCoeffSet(vortex);
 }
 
 static void
-vortex_Eqlzr_SetA3dBypassGain(vortex_t * vortex, unsigned long a,
-                             unsigned long b)
+vortex_Eqlzr_SetA3dBypassGain(vortex_t * vortex, u32 a, u32 b)
 {
        eqlzr_t *eq = &(vortex->eq);
-       int eax, ebx;
+       u32 eax, ebx;
 
        eq->this58 = a;
        eq->this5c = b;
@@ -690,7 +623,7 @@ vortex_Eqlzr_SetA3dBypassGain(vortex_t * vortex, unsigned long a,
 static void vortex_Eqlzr_ProgramA3dBypassGain(vortex_t * vortex)
 {
        eqlzr_t *eq = &(vortex->eq);
-       int eax, ebx;
+       u32 eax, ebx;
 
        if (eq->this54)
                eax = eq->this0e;
@@ -707,7 +640,7 @@ static void vortex_Eqlzr_ShutDownA3d(vortex_t * vortex)
                vortex_EqHw_ZeroA3DIO(vortex);
 }
 
-static void vortex_Eqlzr_SetBypass(vortex_t * vortex, long bp)
+static void vortex_Eqlzr_SetBypass(vortex_t * vortex, u32 bp)
 {
        eqlzr_t *eq = &(vortex->eq);
        
@@ -717,8 +650,8 @@ static void vortex_Eqlzr_SetBypass(vortex_t * vortex, long bp)
                vortex_EqHw_SetBypassGain(vortex, eq->this08, eq->this08);
        } else {
                /* EQ disabled. */
-               vortex_EqHw_SetLeftGainsTarget(vortex, (u16 *) (eq->this14));
-               vortex_EqHw_SetRightGainsTarget(vortex, (u16 *) (eq->this14));
+               vortex_EqHw_SetLeftGainsTarget(vortex, eq->this14_array);
+               vortex_EqHw_SetRightGainsTarget(vortex, eq->this14_array);
                vortex_EqHw_SetBypassGain(vortex, eq->this0c, eq->this0c);
        }
        vortex_Eqlzr_ProgramA3dBypassGain(vortex);
@@ -772,7 +705,7 @@ static void vortex_Eqlzr_init(vortex_t * vortex)
        eq->this5c = 0xffff;
 
        /* Set gains. */
-       memset(eq->this14, 0, 2 * 10);
+       memset(eq->this14_array, 0, sizeof(eq->this14_array));
 
        /* Actual init. */
        vortex_EqHw_ZeroState(vortex);
@@ -796,7 +729,7 @@ static void vortex_Eqlzr_shutdown(vortex_t * vortex)
 
 /* Control interface */
 static int
-snd_vortex_eqtoggle_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo)
+snd_vortex_eqtoggle_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
        uinfo->count = 1;
@@ -806,8 +739,8 @@ snd_vortex_eqtoggle_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo)
 }
 
 static int
-snd_vortex_eqtoggle_get(snd_kcontrol_t * kcontrol,
-                       snd_ctl_elem_value_t * ucontrol)
+snd_vortex_eqtoggle_get(struct snd_kcontrol *kcontrol,
+                       struct snd_ctl_elem_value *ucontrol)
 {
        vortex_t *vortex = snd_kcontrol_chip(kcontrol);
        eqlzr_t *eq = &(vortex->eq);
@@ -819,8 +752,8 @@ snd_vortex_eqtoggle_get(snd_kcontrol_t * kcontrol,
 }
 
 static int
-snd_vortex_eqtoggle_put(snd_kcontrol_t * kcontrol,
-                       snd_ctl_elem_value_t * ucontrol)
+snd_vortex_eqtoggle_put(struct snd_kcontrol *kcontrol,
+                       struct snd_ctl_elem_value *ucontrol)
 {
        vortex_t *vortex = snd_kcontrol_chip(kcontrol);
        eqlzr_t *eq = &(vortex->eq);
@@ -832,7 +765,7 @@ snd_vortex_eqtoggle_put(snd_kcontrol_t * kcontrol,
        return 1;               /* Allways changes */
 }
 
-static snd_kcontrol_new_t vortex_eqtoggle_kcontrol __devinitdata = {
+static struct snd_kcontrol_new vortex_eqtoggle_kcontrol __devinitdata = {
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
        .name = "EQ Enable",
        .index = 0,
@@ -844,7 +777,7 @@ static snd_kcontrol_new_t vortex_eqtoggle_kcontrol __devinitdata = {
 };
 
 static int
-snd_vortex_eq_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo)
+snd_vortex_eq_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->count = 2;
@@ -854,11 +787,11 @@ snd_vortex_eq_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo)
 }
 
 static int
-snd_vortex_eq_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+snd_vortex_eq_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        vortex_t *vortex = snd_kcontrol_chip(kcontrol);
        int i = kcontrol->private_value;
-       u16 gainL, gainR;
+       u16 gainL = 0, gainR = 0;
 
        vortex_Eqlzr_GetLeftGain(vortex, i, &gainL);
        vortex_Eqlzr_GetRightGain(vortex, i, &gainR);
@@ -868,11 +801,11 @@ snd_vortex_eq_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
 }
 
 static int
-snd_vortex_eq_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+snd_vortex_eq_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        vortex_t *vortex = snd_kcontrol_chip(kcontrol);
        int changed = 0, i = kcontrol->private_value;
-       u16 gainL, gainR;
+       u16 gainL = 0, gainR = 0;
 
        vortex_Eqlzr_GetLeftGain(vortex, i, &gainL);
        vortex_Eqlzr_GetRightGain(vortex, i, &gainR);
@@ -890,7 +823,7 @@ snd_vortex_eq_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
        return changed;
 }
 
-static snd_kcontrol_new_t vortex_eq_kcontrol __devinitdata = {
+static struct snd_kcontrol_new vortex_eq_kcontrol __devinitdata = {
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
        .name = "                        .",
        .index = 0,
@@ -902,7 +835,7 @@ static snd_kcontrol_new_t vortex_eq_kcontrol __devinitdata = {
 };
 
 static int
-snd_vortex_peaks_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo)
+snd_vortex_peaks_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->count = 20;
@@ -912,15 +845,15 @@ snd_vortex_peaks_info(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo)
 }
 
 static int
-snd_vortex_peaks_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
+snd_vortex_peaks_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        vortex_t *vortex = snd_kcontrol_chip(kcontrol);
-       int i, count;
+       int i, count = 0;
        u16 peaks[20];
 
        vortex_Eqlzr_GetAllPeaks(vortex, peaks, &count);
        if (count != 20) {
-               printk("vortex: peak count error 20 != %d \n", count);
+               printk(KERN_ERR "vortex: peak count error 20 != %d \n", count);
                return -1;
        }
        for (i = 0; i < 20; i++)
@@ -929,7 +862,7 @@ snd_vortex_peaks_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol)
        return 0;
 }
 
-static snd_kcontrol_new_t vortex_levels_kcontrol __devinitdata = {
+static struct snd_kcontrol_new vortex_levels_kcontrol __devinitdata = {
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
        .name = "EQ Peaks",
        .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
@@ -952,9 +885,9 @@ static char *EqBandLabels[10] __devinitdata = {
 };
 
 /* ALSA driver entry points. Init and exit. */
-static int vortex_eq_init(vortex_t * vortex)
+static int __devinit vortex_eq_init(vortex_t * vortex)
 {
-       snd_kcontrol_t *kcontrol;
+       struct snd_kcontrol *kcontrol;
        int err, i;
 
        vortex_Eqlzr_init(vortex);