mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-10 15:10:38 +00:00
ALSA: opti9xx: remove snd_opti9xx fields
Remove snd_opti9xx fields which are indirect arguments to the snd_opti9xx_configure(). Pass these values as function arguments. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
cf5bd652c3
commit
d8ea23931c
@ -141,15 +141,7 @@ struct snd_opti9xx {
|
|||||||
|
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
|
|
||||||
long wss_base;
|
|
||||||
int irq;
|
int irq;
|
||||||
int dma1;
|
|
||||||
int dma2;
|
|
||||||
|
|
||||||
long fm_port;
|
|
||||||
|
|
||||||
long mpu_port;
|
|
||||||
int mpu_irq;
|
|
||||||
|
|
||||||
#ifdef CONFIG_PNP
|
#ifdef CONFIG_PNP
|
||||||
struct pnp_dev *dev;
|
struct pnp_dev *dev;
|
||||||
@ -216,13 +208,7 @@ static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip,
|
|||||||
|
|
||||||
spin_lock_init(&chip->lock);
|
spin_lock_init(&chip->lock);
|
||||||
|
|
||||||
chip->wss_base = -1;
|
|
||||||
chip->irq = -1;
|
chip->irq = -1;
|
||||||
chip->dma1 = -1;
|
|
||||||
chip->dma2 = -1;
|
|
||||||
chip->fm_port = -1;
|
|
||||||
chip->mpu_port = -1;
|
|
||||||
chip->mpu_irq = -1;
|
|
||||||
|
|
||||||
switch (hardware) {
|
switch (hardware) {
|
||||||
#ifndef OPTi93X
|
#ifndef OPTi93X
|
||||||
@ -348,7 +334,10 @@ static void snd_opti9xx_write(struct snd_opti9xx *chip, unsigned char reg,
|
|||||||
(snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
|
(snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask)))
|
||||||
|
|
||||||
|
|
||||||
static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
|
static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip,
|
||||||
|
long wss_base,
|
||||||
|
int irq, int dma1, int dma2,
|
||||||
|
long mpu_port, int mpu_irq)
|
||||||
{
|
{
|
||||||
unsigned char wss_base_bits;
|
unsigned char wss_base_bits;
|
||||||
unsigned char irq_bits;
|
unsigned char irq_bits;
|
||||||
@ -416,7 +405,7 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (chip->wss_base) {
|
switch (wss_base) {
|
||||||
case 0x530:
|
case 0x530:
|
||||||
wss_base_bits = 0x00;
|
wss_base_bits = 0x00;
|
||||||
break;
|
break;
|
||||||
@ -430,14 +419,13 @@ static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip)
|
|||||||
wss_base_bits = 0x02;
|
wss_base_bits = 0x02;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n",
|
snd_printk(KERN_WARNING "WSS port 0x%lx not valid\n", wss_base);
|
||||||
chip->wss_base);
|
|
||||||
goto __skip_base;
|
goto __skip_base;
|
||||||
}
|
}
|
||||||
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30);
|
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(1), wss_base_bits << 4, 0x30);
|
||||||
|
|
||||||
__skip_base:
|
__skip_base:
|
||||||
switch (chip->irq) {
|
switch (irq) {
|
||||||
//#ifdef OPTi93X
|
//#ifdef OPTi93X
|
||||||
case 5:
|
case 5:
|
||||||
irq_bits = 0x05;
|
irq_bits = 0x05;
|
||||||
@ -456,11 +444,11 @@ __skip_base:
|
|||||||
irq_bits = 0x04;
|
irq_bits = 0x04;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snd_printk(KERN_WARNING "WSS irq # %d not valid\n", chip->irq);
|
snd_printk(KERN_WARNING "WSS irq # %d not valid\n", irq);
|
||||||
goto __skip_resources;
|
goto __skip_resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (chip->dma1) {
|
switch (dma1) {
|
||||||
case 0:
|
case 0:
|
||||||
dma_bits = 0x01;
|
dma_bits = 0x01;
|
||||||
break;
|
break;
|
||||||
@ -471,38 +459,36 @@ __skip_base:
|
|||||||
dma_bits = 0x03;
|
dma_bits = 0x03;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n",
|
snd_printk(KERN_WARNING "WSS dma1 # %d not valid\n", dma1);
|
||||||
chip->dma1);
|
|
||||||
goto __skip_resources;
|
goto __skip_resources;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(CS4231) || defined(OPTi93X)
|
#if defined(CS4231) || defined(OPTi93X)
|
||||||
if (chip->dma1 == chip->dma2) {
|
if (dma1 == dma2) {
|
||||||
snd_printk(KERN_ERR "don't want to share dmas\n");
|
snd_printk(KERN_ERR "don't want to share dmas\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (chip->dma2) {
|
switch (dma2) {
|
||||||
case 0:
|
case 0:
|
||||||
case 1:
|
case 1:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n",
|
snd_printk(KERN_WARNING "WSS dma2 # %d not valid\n", dma2);
|
||||||
chip->dma2);
|
|
||||||
goto __skip_resources;
|
goto __skip_resources;
|
||||||
}
|
}
|
||||||
dma_bits |= 0x04;
|
dma_bits |= 0x04;
|
||||||
#endif /* CS4231 || OPTi93X */
|
#endif /* CS4231 || OPTi93X */
|
||||||
|
|
||||||
#ifndef OPTi93X
|
#ifndef OPTi93X
|
||||||
outb(irq_bits << 3 | dma_bits, chip->wss_base);
|
outb(irq_bits << 3 | dma_bits, wss_base);
|
||||||
#else /* OPTi93X */
|
#else /* OPTi93X */
|
||||||
snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits));
|
snd_opti9xx_write(chip, OPTi9XX_MC_REG(3), (irq_bits << 3 | dma_bits));
|
||||||
#endif /* OPTi93X */
|
#endif /* OPTi93X */
|
||||||
|
|
||||||
__skip_resources:
|
__skip_resources:
|
||||||
if (chip->hardware > OPTi9XX_HW_82C928) {
|
if (chip->hardware > OPTi9XX_HW_82C928) {
|
||||||
switch (chip->mpu_port) {
|
switch (mpu_port) {
|
||||||
case 0:
|
case 0:
|
||||||
case -1:
|
case -1:
|
||||||
break;
|
break;
|
||||||
@ -520,12 +506,11 @@ __skip_resources:
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snd_printk(KERN_WARNING
|
snd_printk(KERN_WARNING
|
||||||
"MPU-401 port 0x%lx not valid\n",
|
"MPU-401 port 0x%lx not valid\n", mpu_port);
|
||||||
chip->mpu_port);
|
|
||||||
goto __skip_mpu;
|
goto __skip_mpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (chip->mpu_irq) {
|
switch (mpu_irq) {
|
||||||
case 5:
|
case 5:
|
||||||
mpu_irq_bits = 0x02;
|
mpu_irq_bits = 0x02;
|
||||||
break;
|
break;
|
||||||
@ -540,12 +525,12 @@ __skip_resources:
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n",
|
snd_printk(KERN_WARNING "MPU-401 irq # %d not valid\n",
|
||||||
chip->mpu_irq);
|
mpu_irq);
|
||||||
goto __skip_mpu;
|
goto __skip_mpu;
|
||||||
}
|
}
|
||||||
|
|
||||||
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6),
|
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6),
|
||||||
(chip->mpu_port <= 0) ? 0x00 :
|
(mpu_port <= 0) ? 0x00 :
|
||||||
0x80 | mpu_port_bits << 5 | mpu_irq_bits << 3,
|
0x80 | mpu_port_bits << 5 | mpu_irq_bits << 3,
|
||||||
0xf8);
|
0xf8);
|
||||||
}
|
}
|
||||||
@ -701,6 +686,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
|
|||||||
{
|
{
|
||||||
static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
|
static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
|
||||||
int error;
|
int error;
|
||||||
|
int xdma2;
|
||||||
struct snd_opti9xx *chip = card->private_data;
|
struct snd_opti9xx *chip = card->private_data;
|
||||||
struct snd_wss *codec;
|
struct snd_wss *codec;
|
||||||
#ifdef CS4231
|
#ifdef CS4231
|
||||||
@ -715,31 +701,25 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
|
|||||||
"OPTi9xx MC")) == NULL)
|
"OPTi9xx MC")) == NULL)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
chip->wss_base = port;
|
|
||||||
chip->fm_port = fm_port;
|
|
||||||
chip->mpu_port = mpu_port;
|
|
||||||
chip->irq = irq;
|
|
||||||
chip->mpu_irq = mpu_irq;
|
|
||||||
chip->dma1 = dma1;
|
|
||||||
#if defined(CS4231) || defined(OPTi93X)
|
#if defined(CS4231) || defined(OPTi93X)
|
||||||
chip->dma2 = dma2;
|
xdma2 = dma2;
|
||||||
#else
|
#else
|
||||||
chip->dma2 = -1;
|
xdma2 = -1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (chip->wss_base == SNDRV_AUTO_PORT) {
|
if (port == SNDRV_AUTO_PORT) {
|
||||||
chip->wss_base = snd_legacy_find_free_ioport(possible_ports, 4);
|
port = snd_legacy_find_free_ioport(possible_ports, 4);
|
||||||
if (chip->wss_base < 0) {
|
if (port < 0) {
|
||||||
snd_printk(KERN_ERR "unable to find a free WSS port\n");
|
snd_printk(KERN_ERR "unable to find a free WSS port\n");
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
error = snd_opti9xx_configure(chip);
|
error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2,
|
||||||
|
mpu_port, mpu_irq);
|
||||||
if (error)
|
if (error)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
error = snd_wss_create(card, chip->wss_base + 4, -1,
|
error = snd_wss_create(card, port + 4, -1, irq, dma1, xdma2,
|
||||||
chip->irq, chip->dma1, chip->dma2,
|
|
||||||
#ifdef OPTi93X
|
#ifdef OPTi93X
|
||||||
WSS_HW_OPTI93X, WSS_HWSHARE_IRQ,
|
WSS_HW_OPTI93X, WSS_HWSHARE_IRQ,
|
||||||
#else
|
#else
|
||||||
@ -763,35 +743,35 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
|
|||||||
return error;
|
return error;
|
||||||
#endif
|
#endif
|
||||||
#ifdef OPTi93X
|
#ifdef OPTi93X
|
||||||
error = request_irq(chip->irq, snd_opti93x_interrupt,
|
error = request_irq(irq, snd_opti93x_interrupt,
|
||||||
IRQF_DISABLED, DEV_NAME" - WSS", codec);
|
IRQF_DISABLED, DEV_NAME" - WSS", codec);
|
||||||
if (error < 0) {
|
if (error < 0) {
|
||||||
snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq);
|
snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", chip->irq);
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
chip->irq = irq;
|
||||||
strcpy(card->driver, chip->name);
|
strcpy(card->driver, chip->name);
|
||||||
sprintf(card->shortname, "OPTi %s", card->driver);
|
sprintf(card->shortname, "OPTi %s", card->driver);
|
||||||
#if defined(CS4231) || defined(OPTi93X)
|
#if defined(CS4231) || defined(OPTi93X)
|
||||||
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d",
|
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d",
|
||||||
card->shortname, pcm->name, chip->wss_base + 4,
|
card->shortname, pcm->name, port + 4, irq, dma1, xdma2);
|
||||||
chip->irq, chip->dma1, chip->dma2);
|
|
||||||
#else
|
#else
|
||||||
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d",
|
sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d",
|
||||||
card->shortname, pcm->name, chip->wss_base + 4,
|
card->shortname, pcm->name, port + 4, irq, dma1);
|
||||||
chip->irq, chip->dma1);
|
|
||||||
#endif /* CS4231 || OPTi93X */
|
#endif /* CS4231 || OPTi93X */
|
||||||
|
|
||||||
if (chip->mpu_port <= 0 || chip->mpu_port == SNDRV_AUTO_PORT)
|
if (mpu_port <= 0 || mpu_port == SNDRV_AUTO_PORT)
|
||||||
rmidi = NULL;
|
rmidi = NULL;
|
||||||
else
|
else {
|
||||||
if ((error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
|
error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401,
|
||||||
chip->mpu_port, 0, chip->mpu_irq, IRQF_DISABLED,
|
mpu_port, 0, mpu_irq, IRQF_DISABLED, &rmidi);
|
||||||
&rmidi)))
|
if (error)
|
||||||
snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n",
|
snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n",
|
||||||
chip->mpu_port);
|
mpu_port);
|
||||||
|
}
|
||||||
|
|
||||||
if (chip->fm_port > 0 && chip->fm_port != SNDRV_AUTO_PORT) {
|
if (fm_port > 0 && fm_port != SNDRV_AUTO_PORT) {
|
||||||
struct snd_opl3 *opl3 = NULL;
|
struct snd_opl3 *opl3 = NULL;
|
||||||
#ifndef OPTi93X
|
#ifndef OPTi93X
|
||||||
if (chip->hardware == OPTi9XX_HW_82C928 ||
|
if (chip->hardware == OPTi9XX_HW_82C928 ||
|
||||||
@ -801,9 +781,7 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
|
|||||||
/* assume we have an OPL4 */
|
/* assume we have an OPL4 */
|
||||||
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2),
|
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2),
|
||||||
0x20, 0x20);
|
0x20, 0x20);
|
||||||
if (snd_opl4_create(card,
|
if (snd_opl4_create(card, fm_port, fm_port - 8,
|
||||||
chip->fm_port,
|
|
||||||
chip->fm_port - 8,
|
|
||||||
2, &opl3, &opl4) < 0) {
|
2, &opl3, &opl4) < 0) {
|
||||||
/* no luck, use OPL3 instead */
|
/* no luck, use OPL3 instead */
|
||||||
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2),
|
snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(2),
|
||||||
@ -811,12 +789,10 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* !OPTi93X */
|
#endif /* !OPTi93X */
|
||||||
if (!opl3 && snd_opl3_create(card,
|
if (!opl3 && snd_opl3_create(card, fm_port, fm_port + 2,
|
||||||
chip->fm_port,
|
|
||||||
chip->fm_port + 2,
|
|
||||||
OPL3_HW_AUTO, 0, &opl3) < 0) {
|
OPL3_HW_AUTO, 0, &opl3) < 0) {
|
||||||
snd_printk(KERN_WARNING "no OPL device at 0x%lx-0x%lx\n",
|
snd_printk(KERN_WARNING "no OPL device at 0x%lx-0x%lx\n",
|
||||||
chip->fm_port, chip->fm_port + 4 - 1);
|
fm_port, fm_port + 4 - 1);
|
||||||
}
|
}
|
||||||
if (opl3) {
|
if (opl3) {
|
||||||
error = snd_opl3_hwdep_new(opl3, 0, 1, &synth);
|
error = snd_opl3_hwdep_new(opl3, 0, 1, &synth);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user