25 Mar
2007
25 Mar
'07
5:50 p.m.
This patch is against the latest -mm snapshot.
Regards, Michal
--
Michal K. K. Piotrowski
LTG - Linux Testers Group (PL)
(http://www.stardust.webpages.pl/ltg/)
LTG - Linux Testers Group (EN)
(http://www.stardust.webpages.pl/linux_testers_group_en/)
Signed-off-by: Michal Piotrowski michal.k.k.piotrowski@gmail.com
--- linux-work5/sound/pci/au88x0/au88x0_core.c 2007-02-04 19:44:54.000000000 +0100
+++ linux-work3/sound/pci/au88x0/au88x0_core.c 2007-03-25 17:06:31.000000000 +0200
@@ -97,85 +97,6 @@ static void vortex_mixer_dis_sr(vortex_t
hwread(vortex->mmio, VORTEX_MIXER_SR) & ~(0x1 << channel));
}
-#if 0
-static void
-vortex_mix_muteinputgain(vortex_t * vortex, unsigned char mix,
- unsigned char channel)
-{
- hwwrite(vortex->mmio, VORTEX_MIX_INVOL_A + ((mix << 5) + channel),
- 0x80);
- hwwrite(vortex->mmio, VORTEX_MIX_INVOL_B + ((mix << 5) + channel),
- 0x80);
-}
-
-static int vortex_mix_getvolume(vortex_t * vortex, unsigned char mix)
-{
- int a;
- a = hwread(vortex->mmio, VORTEX_MIX_VOL_A + (mix << 2)) & 0xff;
- //FP2LinearFrac(a);
- return (a);
-}
-
-static int
-vortex_mix_getinputvolume(vortex_t * vortex, unsigned char mix,
- int channel, int *vol)
-{
- int a;
- if (!(mchannels[mix] & (1 << channel)))
- return 0;
- a = hwread(vortex->mmio,
- VORTEX_MIX_INVOL_A + (((mix << 5) + channel) << 2));
- /*
- if (rampchs[mix] == 0)
- a = FP2LinearFrac(a);
- else
- a = FP2LinearFracWT(a);
- */
- *vol = a;
- return (0);
-}
-
-static unsigned int vortex_mix_boost6db(unsigned char vol)
-{
- return (vol + 8); /* WOW! what a complex function! */
-}
-
-static void vortex_mix_rampvolume(vortex_t * vortex, int mix)
-{
- int ch;
- char a;
- // This function is intended for ramping down only (see vortex_disableinput()).
- for (ch = 0; ch < 0x20; ch++) {
- if (((1 << ch) & rampchs[mix]) == 0)
- continue;
- a = hwread(vortex->mmio,
- VORTEX_MIX_INVOL_B + (((mix << 5) + ch) << 2));
- if (a > -126) {
- a -= 2;
- hwwrite(vortex->mmio,
- VORTEX_MIX_INVOL_A +
- (((mix << 5) + ch) << 2), a);
- hwwrite(vortex->mmio,
- VORTEX_MIX_INVOL_B +
- (((mix << 5) + ch) << 2), a);
- } else
- vortex_mix_killinput(vortex, mix, ch);
- }
-}
-
-static int
-vortex_mix_getenablebit(vortex_t * vortex, unsigned char mix, int mixin)
-{
- int addr, temp;
- if (mixin >= 0)
- addr = mixin;
- else
- addr = mixin + 3;
- addr = ((mix << 3) + (addr >> 2)) << 2;
- temp = hwread(vortex->mmio, VORTEX_MIX_ENIN + addr);
- return ((temp >> (mixin & 3)) & 1);
-}
-#endif
static void
vortex_mix_setvolumebyte(vortex_t * vortex, unsigned char mix,
unsigned char vol)
@@ -500,61 +421,6 @@ vortex_src_persist_convratio(vortex_t *
return temp;
}
-#if 0
-static void vortex_src_slowlock(vortex_t * vortex, unsigned char src)
-{
- int temp;
-
- hwwrite(vortex->mmio, VORTEX_SRC_DRIFT2 + (src << 2), 1);
- hwwrite(vortex->mmio, VORTEX_SRC_DRIFT0 + (src << 2), 0);
- temp = hwread(vortex->mmio, VORTEX_SRC_U0 + (src << 2));
- if (temp & 0x200)
- hwwrite(vortex->mmio, VORTEX_SRC_U0 + (src << 2),
- temp & ~0x200L);
-}
-
-static void
-vortex_src_change_convratio(vortex_t * vortex, unsigned char src, int ratio)
-{
- int temp, a;
-
- if ((ratio & 0x10000) && (ratio != 0x10000)) {
- if (ratio & 0x3fff)
- a = (0x11 - ((ratio >> 0xe) & 0x3)) - 1;
- else
- a = (0x11 - ((ratio >> 0xe) & 0x3)) - 2;
- } else
- a = 0xc;
- temp = hwread(vortex->mmio, VORTEX_SRC_U0 + (src << 2));
- if (((temp >> 4) & 0xf) != a)
- hwwrite(vortex->mmio, VORTEX_SRC_U0 + (src << 2),
- (temp & 0xf) | ((a & 0xf) << 4));
-
- vortex_src_persist_convratio(vortex, src, ratio);
-}
-
-static int
-vortex_src_checkratio(vortex_t * vortex, unsigned char src,
- unsigned int desired_ratio)
-{
- int hw_ratio, lifeboat = 0;
-
- hw_ratio = hwread(vortex->mmio, VORTEX_SRC_CONVRATIO + (src << 2));
-
- while (hw_ratio != desired_ratio) {
- hwwrite(vortex->mmio, VORTEX_SRC_CONVRATIO + (src << 2), desired_ratio);
-
- if ((lifeboat++) > 15) {
- printk(KERN_ERR "Vortex: could not set src-%d from %d to %d\n",
- src, hw_ratio, desired_ratio);
- break;
- }
- }
-
- return hw_ratio;
-}
-
-#endif
/*
Objective: Set samplerate for given SRC module.
Arguments:
@@ -784,19 +650,6 @@ vortex_fifo_clearadbdata(vortex_t * vort
(((fifo << FIFO_SIZE_BITS) + x) << 2), 0);
}
-#if 0
-static void vortex_fifo_adbinitialize(vortex_t * vortex, int fifo, int j)
-{
- vortex_fifo_clearadbdata(vortex, fifo, FIFO_SIZE);
-#ifdef CHIP_AU8820
- hwwrite(vortex->mmio, VORTEX_FIFO_ADBCTRL + (fifo << 2),
- (FIFO_U1 | ((j & FIFO_MASK) << 0xb)));
-#else
- hwwrite(vortex->mmio, VORTEX_FIFO_ADBCTRL + (fifo << 2),
- (FIFO_U1 | ((j & FIFO_MASK) << 0xc)));
-#endif
-}
-#endif
static void vortex_fifo_setadbvalid(vortex_t * vortex, int fifo, int en)
{
hwwrite(vortex->mmio, VORTEX_FIFO_ADBCTRL + (fifo << 2),
@@ -1329,22 +1182,6 @@ static void vortex_adbdma_pausefifo(vort
dma->fifo_status = FIFO_PAUSE;
}
-#if 0 // Using pause instead
-static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma)
-{
- stream_t *dma = &vortex->dma_adb[adbdma];
-
- int this_4 = 0, this_8 = 0;
- if (dma->fifo_status == FIFO_START)
- vortex_fifo_setadbctrl(vortex, adbdma, dma->dma_unknown,
- this_4, this_8, 0, 0);
- else if (dma->fifo_status == FIFO_STOP)
- return;
- dma->fifo_status = FIFO_STOP;
- dma->fifo_enabled = 0;
-}
-
-#endif
/* WTDMA */
#ifndef CHIP_AU8810
@@ -1483,22 +1320,6 @@ static int vortex_wtdma_bufshift(vortex_
return delta;
}
-#if 0
-static void
-vortex_wtdma_getposition(vortex_t * vortex, int wtdma, int *subbuf, int *pos)
-{
- int temp;
- temp = hwread(vortex->mmio, VORTEX_WTDMA_STAT + (wtdma << 2));
- *subbuf = (temp >> WT_SUBBUF_SHIFT) & WT_SUBBUF_MASK;
- *pos = temp & POS_MASK;
-}
-
-static int vortex_wtdma_getcursubuffer(vortex_t * vortex, int wtdma)
-{
- return ((hwread(vortex->mmio, VORTEX_WTDMA_STAT + (wtdma << 2)) >>
- POS_SHIFT) & POS_MASK);
-}
-#endif
static int inline vortex_wtdma_getlinearpos(vortex_t * vortex, int wtdma)
{
stream_t *dma = &vortex->dma_wt[wtdma];
@@ -1743,40 +1564,6 @@ vortex_route(vortex_t * vortex, int en,
}
}
-#if 0
-static void
-vortex_routes(vortex_t * vortex, int en, unsigned char channel,
- unsigned char source, unsigned char dest0, unsigned char dest1)
-{
- ADBRamLink route[2];
-
- route[0] = ((source & ADB_MASK) << ADB_SHIFT) | (dest0 & ADB_MASK);
- route[1] = ((source & ADB_MASK) << ADB_SHIFT) | (dest1 & ADB_MASK);
-
- if (en) {
- vortex_adb_addroutes(vortex, channel, route, 2);
- if ((source < (OFFSET_SRCOUT + NR_SRC))
- && (source >= (OFFSET_SRCOUT)))
- vortex_src_addWTD(vortex, (source - OFFSET_SRCOUT),
- channel);
- else if ((source < (OFFSET_MIXOUT + NR_MIXOUT))
- && (source >= (OFFSET_MIXOUT)))
- vortex_mixer_addWTD(vortex,
- (source - OFFSET_MIXOUT), channel);
- } else {
- vortex_adb_delroutes(vortex, channel, route[0], route[1]);
- if ((source < (OFFSET_SRCOUT + NR_SRC))
- && (source >= (OFFSET_SRCOUT)))
- vortex_src_delWTD(vortex, (source - OFFSET_SRCOUT),
- channel);
- else if ((source < (OFFSET_MIXOUT + NR_MIXOUT))
- && (source >= (OFFSET_MIXOUT)))
- vortex_mixer_delWTD(vortex,
- (source - OFFSET_MIXOUT), channel);
- }
-}
-
-#endif
/* Route two sources to same target. Sources must be of same class !!! */
static void
vortex_routeLRT(vortex_t * vortex, int en, unsigned char ch,
@@ -1899,44 +1686,6 @@ vortex_connection_mix_src(vortex_t * vor
vortex_mix_setvolumebyte(vortex, mix, MIX_DEFOGAIN); // added to original code.
}
-#if 0
-static void
-vortex_connection_adbdma_src_src(vortex_t * vortex, int en,
- unsigned char channel,
- unsigned char adbdma, unsigned char src0,
- unsigned char src1)
-{
- vortex_routes(vortex, en, channel, ADB_DMA(adbdma),
- ADB_SRCIN(src0), ADB_SRCIN(src1));
-}
-
-// Connect two mix to AdbDma.
-static void
-vortex_connection_mix_mix_adbdma(vortex_t * vortex, int en,
- unsigned char ch, unsigned char mix0,
- unsigned char mix1, unsigned char adbdma)
-{
-
- ADBRamLink routes[2];
- routes[0] =
- (((mix0 +
- OFFSET_MIXOUT) & ADB_MASK) << ADB_SHIFT) | (adbdma & ADB_MASK);
- routes[1] =
- (((mix1 + OFFSET_MIXOUT) & ADB_MASK) << ADB_SHIFT) | ((adbdma +
- 0x20) &
- ADB_MASK);
- if (en) {
- vortex_adb_addroutes(vortex, ch, routes, 0x2);
- vortex_mixer_addWTD(vortex, mix0, ch);
- vortex_mixer_addWTD(vortex, mix1, ch);
- } else {
- vortex_adb_delroutes(vortex, ch, routes[0], routes[1]);
- vortex_mixer_delWTD(vortex, mix0, ch);
- vortex_mixer_delWTD(vortex, mix1, ch);
- }
-}
-#endif
-
/* CODEC connect. */
static void
@@ -1946,7 +1695,6 @@ vortex_connect_codecplay(vortex_t * vort
vortex_connection_mix_adb(vortex, en, 0x11, mixers[0], ADB_CODECOUT(0));
vortex_connection_mix_adb(vortex, en, 0x11, mixers[1], ADB_CODECOUT(1));
#else
-#if 1
// Connect front channels through EQ.
vortex_connection_mix_adb(vortex, en, 0x11, mixers[0], ADB_EQIN(0));
vortex_connection_mix_adb(vortex, en, 0x11, mixers[1], ADB_EQIN(1));
@@ -1965,11 +1713,6 @@ vortex_connect_codecplay(vortex_t * vort
ADB_CODECOUT(1 + 4));
//printk("SDAC detected ");
}
-#else
- // Use plain direct output to codec.
- vortex_connection_mix_adb(vortex, en, 0x11, mixers[0], ADB_CODECOUT(0));
- vortex_connection_mix_adb(vortex, en, 0x11, mixers[1], ADB_CODECOUT(1));
-#endif
#endif
}
@@ -2356,20 +2099,6 @@ static void vortex_settimer(vortex_t * v
hwwrite(vortex->mmio, VORTEX_IRQ_STAT, period);
}
-#if 0
-static void vortex_enable_timer_int(vortex_t * card)
-{
- hwwrite(card->mmio, VORTEX_IRQ_CTRL,
- hwread(card->mmio, VORTEX_IRQ_CTRL) | IRQ_TIMER | 0x60);
-}
-
-static void vortex_disable_timer_int(vortex_t * card)
-{
- hwwrite(card->mmio, VORTEX_IRQ_CTRL,
- hwread(card->mmio, VORTEX_IRQ_CTRL) & ~IRQ_TIMER);
-}
-
-#endif
static void vortex_enable_int(vortex_t * card)
{
// CAsp4ISR__EnableVortexInt_void_