|
@@ -620,7 +620,6 @@ static int snd_es1688_free(struct snd_es1688 *chip)
|
|
disable_dma(chip->dma8);
|
|
disable_dma(chip->dma8);
|
|
free_dma(chip->dma8);
|
|
free_dma(chip->dma8);
|
|
}
|
|
}
|
|
- kfree(chip);
|
|
|
|
return 0;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -638,23 +637,20 @@ static const char *snd_es1688_chip_id(struct snd_es1688 *chip)
|
|
}
|
|
}
|
|
|
|
|
|
int snd_es1688_create(struct snd_card *card,
|
|
int snd_es1688_create(struct snd_card *card,
|
|
|
|
+ struct snd_es1688 *chip,
|
|
unsigned long port,
|
|
unsigned long port,
|
|
unsigned long mpu_port,
|
|
unsigned long mpu_port,
|
|
int irq,
|
|
int irq,
|
|
int mpu_irq,
|
|
int mpu_irq,
|
|
int dma8,
|
|
int dma8,
|
|
- unsigned short hardware,
|
|
|
|
- struct snd_es1688 **rchip)
|
|
|
|
|
|
+ unsigned short hardware)
|
|
{
|
|
{
|
|
static struct snd_device_ops ops = {
|
|
static struct snd_device_ops ops = {
|
|
.dev_free = snd_es1688_dev_free,
|
|
.dev_free = snd_es1688_dev_free,
|
|
};
|
|
};
|
|
|
|
|
|
- struct snd_es1688 *chip;
|
|
|
|
int err;
|
|
int err;
|
|
|
|
|
|
- *rchip = NULL;
|
|
|
|
- chip = kzalloc(sizeof(*chip), GFP_KERNEL);
|
|
|
|
if (chip == NULL)
|
|
if (chip == NULL)
|
|
return -ENOMEM;
|
|
return -ENOMEM;
|
|
chip->irq = -1;
|
|
chip->irq = -1;
|
|
@@ -662,25 +658,21 @@ int snd_es1688_create(struct snd_card *card,
|
|
|
|
|
|
if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) {
|
|
if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) {
|
|
snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4);
|
|
snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4);
|
|
- snd_es1688_free(chip);
|
|
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
if (request_irq(irq, snd_es1688_interrupt, IRQF_DISABLED, "ES1688", (void *) chip)) {
|
|
if (request_irq(irq, snd_es1688_interrupt, IRQF_DISABLED, "ES1688", (void *) chip)) {
|
|
snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq);
|
|
snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq);
|
|
- snd_es1688_free(chip);
|
|
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
chip->irq = irq;
|
|
chip->irq = irq;
|
|
if (request_dma(dma8, "ES1688")) {
|
|
if (request_dma(dma8, "ES1688")) {
|
|
snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8);
|
|
snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8);
|
|
- snd_es1688_free(chip);
|
|
|
|
return -EBUSY;
|
|
return -EBUSY;
|
|
}
|
|
}
|
|
chip->dma8 = dma8;
|
|
chip->dma8 = dma8;
|
|
|
|
|
|
spin_lock_init(&chip->reg_lock);
|
|
spin_lock_init(&chip->reg_lock);
|
|
spin_lock_init(&chip->mixer_lock);
|
|
spin_lock_init(&chip->mixer_lock);
|
|
- chip->card = card;
|
|
|
|
chip->port = port;
|
|
chip->port = port;
|
|
mpu_port &= ~0x000f;
|
|
mpu_port &= ~0x000f;
|
|
if (mpu_port < 0x300 || mpu_port > 0x330)
|
|
if (mpu_port < 0x300 || mpu_port > 0x330)
|
|
@@ -689,23 +681,16 @@ int snd_es1688_create(struct snd_card *card,
|
|
chip->mpu_irq = mpu_irq;
|
|
chip->mpu_irq = mpu_irq;
|
|
chip->hardware = hardware;
|
|
chip->hardware = hardware;
|
|
|
|
|
|
- if ((err = snd_es1688_probe(chip)) < 0) {
|
|
|
|
- snd_es1688_free(chip);
|
|
|
|
|
|
+ err = snd_es1688_probe(chip);
|
|
|
|
+ if (err < 0)
|
|
return err;
|
|
return err;
|
|
- }
|
|
|
|
- if ((err = snd_es1688_init(chip, 1)) < 0) {
|
|
|
|
- snd_es1688_free(chip);
|
|
|
|
- return err;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- /* Register device */
|
|
|
|
- if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
|
|
|
|
- snd_es1688_free(chip);
|
|
|
|
|
|
+ err = snd_es1688_init(chip, 1);
|
|
|
|
+ if (err < 0)
|
|
return err;
|
|
return err;
|
|
- }
|
|
|
|
|
|
|
|
- *rchip = chip;
|
|
|
|
- return 0;
|
|
|
|
|
|
+ /* Register device */
|
|
|
|
+ return snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
|
|
}
|
|
}
|
|
|
|
|
|
static struct snd_pcm_ops snd_es1688_playback_ops = {
|
|
static struct snd_pcm_ops snd_es1688_playback_ops = {
|
|
@@ -730,12 +715,14 @@ static struct snd_pcm_ops snd_es1688_capture_ops = {
|
|
.pointer = snd_es1688_capture_pointer,
|
|
.pointer = snd_es1688_capture_pointer,
|
|
};
|
|
};
|
|
|
|
|
|
-int snd_es1688_pcm(struct snd_es1688 * chip, int device, struct snd_pcm ** rpcm)
|
|
|
|
|
|
+int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip,
|
|
|
|
+ int device, struct snd_pcm **rpcm)
|
|
{
|
|
{
|
|
struct snd_pcm *pcm;
|
|
struct snd_pcm *pcm;
|
|
int err;
|
|
int err;
|
|
|
|
|
|
- if ((err = snd_pcm_new(chip->card, "ESx688", device, 1, 1, &pcm)) < 0)
|
|
|
|
|
|
+ err = snd_pcm_new(card, "ESx688", device, 1, 1, &pcm);
|
|
|
|
+ if (err < 0)
|
|
return err;
|
|
return err;
|
|
|
|
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_es1688_playback_ops);
|
|
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_es1688_playback_ops);
|
|
@@ -1009,18 +996,15 @@ static unsigned char snd_es1688_init_table[][2] = {
|
|
{ ES1688_REC_DEV, 0x17 }
|
|
{ ES1688_REC_DEV, 0x17 }
|
|
};
|
|
};
|
|
|
|
|
|
-int snd_es1688_mixer(struct snd_es1688 *chip)
|
|
|
|
|
|
+int snd_es1688_mixer(struct snd_card *card, struct snd_es1688 *chip)
|
|
{
|
|
{
|
|
- struct snd_card *card;
|
|
|
|
unsigned int idx;
|
|
unsigned int idx;
|
|
int err;
|
|
int err;
|
|
unsigned char reg, val;
|
|
unsigned char reg, val;
|
|
|
|
|
|
- if (snd_BUG_ON(!chip || !chip->card))
|
|
|
|
|
|
+ if (snd_BUG_ON(!chip || !card))
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
- card = chip->card;
|
|
|
|
-
|
|
|
|
strcpy(card->mixername, snd_es1688_chip_id(chip));
|
|
strcpy(card->mixername, snd_es1688_chip_id(chip));
|
|
|
|
|
|
for (idx = 0; idx < ARRAY_SIZE(snd_es1688_controls); idx++) {
|
|
for (idx = 0; idx < ARRAY_SIZE(snd_es1688_controls); idx++) {
|