2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
* Driver for Aztech Sound Galaxy cards
|
|
|
|
* Copyright (c) by Christopher Butler <chrisb@sandy.force9.co.uk.
|
|
|
|
*
|
|
|
|
* I don't have documentation for this card, I based this driver on the
|
|
|
|
* driver for OSS/Free included in the kernel source (drivers/sound/sgalaxy.c)
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sound/driver.h>
|
|
|
|
#include <linux/init.h>
|
2005-11-17 17:12:43 +01:00
|
|
|
#include <linux/err.h>
|
2007-02-22 12:50:54 +01:00
|
|
|
#include <linux/isa.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <linux/delay.h>
|
|
|
|
#include <linux/time.h>
|
|
|
|
#include <linux/interrupt.h>
|
|
|
|
#include <linux/moduleparam.h>
|
2005-11-17 17:12:43 +01:00
|
|
|
#include <asm/dma.h>
|
2005-04-17 00:20:36 +02:00
|
|
|
#include <sound/core.h>
|
|
|
|
#include <sound/sb.h>
|
|
|
|
#include <sound/ad1848.h>
|
|
|
|
#include <sound/control.h>
|
|
|
|
#define SNDRV_LEGACY_FIND_FREE_IRQ
|
|
|
|
#define SNDRV_LEGACY_FIND_FREE_DMA
|
|
|
|
#include <sound/initval.h>
|
|
|
|
|
|
|
|
MODULE_AUTHOR("Christopher Butler <chrisb@sandy.force9.co.uk>");
|
|
|
|
MODULE_DESCRIPTION("Aztech Sound Galaxy");
|
|
|
|
MODULE_LICENSE("GPL");
|
|
|
|
MODULE_SUPPORTED_DEVICE("{{Aztech Systems,Sound Galaxy}}");
|
|
|
|
|
|
|
|
static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
|
|
|
|
static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
|
|
|
|
static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
|
|
|
|
static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240 */
|
|
|
|
static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x530,0xe80,0xf40,0x604 */
|
|
|
|
static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 7,9,10,11 */
|
|
|
|
static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3 */
|
|
|
|
|
|
|
|
module_param_array(index, int, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(index, "Index value for Sound Galaxy soundcard.");
|
|
|
|
module_param_array(id, charp, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(id, "ID string for Sound Galaxy soundcard.");
|
|
|
|
module_param_array(sbport, long, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(sbport, "Port # for Sound Galaxy SB driver.");
|
|
|
|
module_param_array(wssport, long, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(wssport, "Port # for Sound Galaxy WSS driver.");
|
|
|
|
module_param_array(irq, int, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(irq, "IRQ # for Sound Galaxy driver.");
|
|
|
|
module_param_array(dma1, int, NULL, 0444);
|
|
|
|
MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver.");
|
|
|
|
|
|
|
|
#define SGALAXY_AUXC_LEFT 18
|
|
|
|
#define SGALAXY_AUXC_RIGHT 19
|
|
|
|
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
#define PFX "sgalaxy: "
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
/*
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define AD1848P1( port, x ) ( port + c_d_c_AD1848##x )
|
|
|
|
|
2005-11-17 14:42:36 +01:00
|
|
|
/* from lowlevel/sb/sb.c - to avoid having to allocate a struct snd_sb for the */
|
2005-04-17 00:20:36 +02:00
|
|
|
/* short time we actually need it.. */
|
|
|
|
|
|
|
|
static int snd_sgalaxy_sbdsp_reset(unsigned long port)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
outb(1, SBP1(port, RESET));
|
|
|
|
udelay(10);
|
|
|
|
outb(0, SBP1(port, RESET));
|
|
|
|
udelay(30);
|
|
|
|
for (i = 0; i < 1000 && !(inb(SBP1(port, DATA_AVAIL)) & 0x80); i++);
|
|
|
|
if (inb(SBP1(port, READ)) != 0xaa) {
|
|
|
|
snd_printd("sb_reset: failed at 0x%lx!!!\n", port);
|
|
|
|
return -ENODEV;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
static int __devinit snd_sgalaxy_sbdsp_command(unsigned long port,
|
|
|
|
unsigned char val)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 10000; i; i--)
|
|
|
|
if ((inb(SBP1(port, STATUS)) & 0x80) == 0) {
|
|
|
|
outb(val, SBP1(port, COMMAND));
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
IRQ: Maintain regs pointer globally rather than passing to IRQ handlers
Maintain a per-CPU global "struct pt_regs *" variable which can be used instead
of passing regs around manually through all ~1800 interrupt handlers in the
Linux kernel.
The regs pointer is used in few places, but it potentially costs both stack
space and code to pass it around. On the FRV arch, removing the regs parameter
from all the genirq function results in a 20% speed up of the IRQ exit path
(ie: from leaving timer_interrupt() to leaving do_IRQ()).
Where appropriate, an arch may override the generic storage facility and do
something different with the variable. On FRV, for instance, the address is
maintained in GR28 at all times inside the kernel as part of general exception
handling.
Having looked over the code, it appears that the parameter may be handed down
through up to twenty or so layers of functions. Consider a USB character
device attached to a USB hub, attached to a USB controller that posts its
interrupts through a cascaded auxiliary interrupt controller. A character
device driver may want to pass regs to the sysrq handler through the input
layer which adds another few layers of parameter passing.
I've build this code with allyesconfig for x86_64 and i386. I've runtested the
main part of the code on FRV and i386, though I can't test most of the drivers.
I've also done partial conversion for powerpc and MIPS - these at least compile
with minimal configurations.
This will affect all archs. Mostly the changes should be relatively easy.
Take do_IRQ(), store the regs pointer at the beginning, saving the old one:
struct pt_regs *old_regs = set_irq_regs(regs);
And put the old one back at the end:
set_irq_regs(old_regs);
Don't pass regs through to generic_handle_irq() or __do_IRQ().
In timer_interrupt(), this sort of change will be necessary:
- update_process_times(user_mode(regs));
- profile_tick(CPU_PROFILING, regs);
+ update_process_times(user_mode(get_irq_regs()));
+ profile_tick(CPU_PROFILING);
I'd like to move update_process_times()'s use of get_irq_regs() into itself,
except that i386, alone of the archs, uses something other than user_mode().
Some notes on the interrupt handling in the drivers:
(*) input_dev() is now gone entirely. The regs pointer is no longer stored in
the input_dev struct.
(*) finish_unlinks() in drivers/usb/host/ohci-q.c needs checking. It does
something different depending on whether it's been supplied with a regs
pointer or not.
(*) Various IRQ handler function pointers have been moved to type
irq_handler_t.
Signed-Off-By: David Howells <dhowells@redhat.com>
(cherry picked from 1b16e7ac850969f38b375e511e3fa2f474a33867 commit)
2006-10-05 15:55:46 +02:00
|
|
|
static irqreturn_t snd_sgalaxy_dummy_interrupt(int irq, void *dev_id)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
return IRQ_NONE;
|
|
|
|
}
|
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
static int __devinit snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
static int interrupt_bits[] = {-1, -1, -1, -1, -1, -1, -1, 0x08, -1,
|
|
|
|
0x10, 0x18, 0x20, -1, -1, -1, -1};
|
|
|
|
static int dma_bits[] = {1, 2, 0, 3};
|
|
|
|
int tmp, tmp1;
|
|
|
|
|
|
|
|
if ((tmp = inb(port + 3)) == 0xff)
|
|
|
|
{
|
|
|
|
snd_printdd("I/O address dead (0x%lx)\n", port);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
snd_printdd("WSS signature = 0x%x\n", tmp);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
if ((tmp & 0x3f) != 0x04 &&
|
|
|
|
(tmp & 0x3f) != 0x0f &&
|
|
|
|
(tmp & 0x3f) != 0x00) {
|
|
|
|
snd_printdd("No WSS signature detected on port 0x%lx\n",
|
|
|
|
port + 3);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
snd_printdd(PFX "setting up IRQ/DMA for WSS\n");
|
2005-04-17 00:20:36 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* initialize IRQ for WSS codec */
|
|
|
|
tmp = interrupt_bits[irq % 16];
|
|
|
|
if (tmp < 0)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2006-07-02 04:29:46 +02:00
|
|
|
if (request_irq(irq, snd_sgalaxy_dummy_interrupt, IRQF_DISABLED, "sgalaxy", NULL)) {
|
2005-04-17 00:20:36 +02:00
|
|
|
snd_printk(KERN_ERR "sgalaxy: can't grab irq %d\n", irq);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
outb(tmp | 0x40, port);
|
|
|
|
tmp1 = dma_bits[dma % 4];
|
|
|
|
outb(tmp | tmp1, port);
|
|
|
|
|
|
|
|
free_irq(irq, NULL);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
static int __devinit snd_sgalaxy_detect(int dev, int irq, int dma)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
|
|
|
#if 0
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
snd_printdd(PFX "switching to WSS mode\n");
|
2005-04-17 00:20:36 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* switch to WSS mode */
|
|
|
|
snd_sgalaxy_sbdsp_reset(sbport[dev]);
|
|
|
|
|
|
|
|
snd_sgalaxy_sbdsp_command(sbport[dev], 9);
|
|
|
|
snd_sgalaxy_sbdsp_command(sbport[dev], 0);
|
|
|
|
|
|
|
|
udelay(400);
|
|
|
|
return snd_sgalaxy_setup_wss(wssport[dev], irq, dma);
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct ad1848_mix_elem snd_sgalaxy_controls[] = {
|
|
|
|
AD1848_DOUBLE("Aux Playback Switch", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 7, 7, 1, 1),
|
|
|
|
AD1848_DOUBLE("Aux Playback Volume", 0, SGALAXY_AUXC_LEFT, SGALAXY_AUXC_RIGHT, 0, 0, 31, 0)
|
|
|
|
};
|
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
static int __devinit snd_sgalaxy_mixer(struct snd_ad1848 *chip)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2005-11-17 14:42:36 +01:00
|
|
|
struct snd_card *card = chip->card;
|
|
|
|
struct snd_ctl_elem_id id1, id2;
|
2005-04-17 00:20:36 +02:00
|
|
|
unsigned int idx;
|
|
|
|
int err;
|
|
|
|
|
|
|
|
memset(&id1, 0, sizeof(id1));
|
|
|
|
memset(&id2, 0, sizeof(id2));
|
|
|
|
id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
|
|
|
|
/* reassign AUX0 to LINE */
|
|
|
|
strcpy(id1.name, "Aux Playback Switch");
|
|
|
|
strcpy(id2.name, "Line Playback Switch");
|
|
|
|
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
|
|
|
return err;
|
|
|
|
strcpy(id1.name, "Aux Playback Volume");
|
|
|
|
strcpy(id2.name, "Line Playback Volume");
|
|
|
|
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
|
|
|
return err;
|
|
|
|
/* reassign AUX1 to FM */
|
|
|
|
strcpy(id1.name, "Aux Playback Switch"); id1.index = 1;
|
|
|
|
strcpy(id2.name, "FM Playback Switch");
|
|
|
|
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
|
|
|
return err;
|
|
|
|
strcpy(id1.name, "Aux Playback Volume");
|
|
|
|
strcpy(id2.name, "FM Playback Volume");
|
|
|
|
if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
|
|
|
|
return err;
|
|
|
|
/* build AUX2 input */
|
|
|
|
for (idx = 0; idx < ARRAY_SIZE(snd_sgalaxy_controls); idx++) {
|
|
|
|
if ((err = snd_ad1848_add_ctl_elem(chip, &snd_sgalaxy_controls[idx])) < 0)
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
static int __devinit snd_sgalaxy_match(struct device *devptr, unsigned int dev)
|
2005-04-17 00:20:36 +02:00
|
|
|
{
|
2007-02-22 12:50:54 +01:00
|
|
|
if (!enable[dev])
|
|
|
|
return 0;
|
2005-04-17 00:20:36 +02:00
|
|
|
if (sbport[dev] == SNDRV_AUTO_PORT) {
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
snd_printk(KERN_ERR PFX "specify SB port\n");
|
2007-02-22 12:50:54 +01:00
|
|
|
return 0;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
if (wssport[dev] == SNDRV_AUTO_PORT) {
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
snd_printk(KERN_ERR PFX "specify WSS port\n");
|
2007-02-22 12:50:54 +01:00
|
|
|
return 0;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
2007-02-22 12:50:54 +01:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev)
|
|
|
|
{
|
|
|
|
static int possible_irqs[] = {7, 9, 10, 11, -1};
|
|
|
|
static int possible_dmas[] = {1, 3, 0, -1};
|
|
|
|
int err, xirq, xdma1;
|
|
|
|
struct snd_card *card;
|
|
|
|
struct snd_ad1848 *chip;
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
|
|
|
|
if (card == NULL)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
xirq = irq[dev];
|
|
|
|
if (xirq == SNDRV_AUTO_IRQ) {
|
|
|
|
if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
|
|
|
|
err = -EBUSY;
|
|
|
|
goto _err;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
xdma1 = dma1[dev];
|
|
|
|
if (xdma1 == SNDRV_AUTO_DMA) {
|
|
|
|
if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
|
|
|
|
err = -EBUSY;
|
|
|
|
goto _err;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0)
|
|
|
|
goto _err;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
if ((err = snd_ad1848_create(card, wssport[dev] + 4,
|
|
|
|
xirq, xdma1,
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
AD1848_HW_DETECT, &chip)) < 0)
|
|
|
|
goto _err;
|
2005-11-17 17:12:43 +01:00
|
|
|
card->private_data = chip;
|
2005-04-17 00:20:36 +02:00
|
|
|
|
|
|
|
if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) {
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
snd_printdd(PFX "error creating new ad1848 PCM device\n");
|
|
|
|
goto _err;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
if ((err = snd_ad1848_mixer(chip)) < 0) {
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
snd_printdd(PFX "error creating new ad1848 mixer\n");
|
|
|
|
goto _err;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
if ((err = snd_sgalaxy_mixer(chip)) < 0) {
|
|
|
|
snd_printdd(PFX "the mixer rewrite failed\n");
|
|
|
|
goto _err;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
strcpy(card->driver, "Sound Galaxy");
|
|
|
|
strcpy(card->shortname, "Sound Galaxy");
|
|
|
|
sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d",
|
|
|
|
wssport[dev], xirq, xdma1);
|
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
snd_card_set_dev(card, devptr);
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
|
|
|
|
if ((err = snd_card_register(card)) < 0)
|
|
|
|
goto _err;
|
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
dev_set_drvdata(devptr, card);
|
2005-04-17 00:20:36 +02:00
|
|
|
return 0;
|
[ALSA] Add snd_card_set_generic_dev() call to ISA drivers
ISA,CMI8330 driver,ES18xx driver,OPL3SA2 driver,Sound Galaxy driver
Sound Scape driver,AD1848 driver,CS4231 driver,CS4236+ driver
ES1688 driver,GUS Classic driver,GUS Extreme driver,GUS MAX driver
AMD InterWave driver,Opti9xx drivers,SB16/AWE driver,SB8 driver
Wavefront drivers
- Added snd_card_set_generic_dev() call.
- Added SND_GENERIC_DRIVER to Kconfig.
- Clean up the error path in probe if necessary.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2005-09-05 17:19:20 +02:00
|
|
|
|
|
|
|
_err:
|
|
|
|
snd_card_free(card);
|
|
|
|
return err;
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
static int __devexit snd_sgalaxy_remove(struct device *devptr, unsigned int dev)
|
2005-11-17 17:12:43 +01:00
|
|
|
{
|
2007-02-22 12:50:54 +01:00
|
|
|
snd_card_free(dev_get_drvdata(devptr));
|
|
|
|
dev_set_drvdata(devptr, NULL);
|
2005-11-17 17:12:43 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef CONFIG_PM
|
2007-02-22 12:50:54 +01:00
|
|
|
static int snd_sgalaxy_suspend(struct device *pdev, unsigned int n,
|
|
|
|
pm_message_t state)
|
2005-11-17 17:12:43 +01:00
|
|
|
{
|
2007-02-22 12:50:54 +01:00
|
|
|
struct snd_card *card = dev_get_drvdata(pdev);
|
2005-11-17 17:12:43 +01:00
|
|
|
struct snd_ad1848 *chip = card->private_data;
|
|
|
|
|
|
|
|
snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
|
|
|
|
chip->suspend(chip);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
static int snd_sgalaxy_resume(struct device *pdev, unsigned int n)
|
2005-11-17 17:12:43 +01:00
|
|
|
{
|
2007-02-22 12:50:54 +01:00
|
|
|
struct snd_card *card = dev_get_drvdata(pdev);
|
2005-11-17 17:12:43 +01:00
|
|
|
struct snd_ad1848 *chip = card->private_data;
|
|
|
|
|
|
|
|
chip->resume(chip);
|
|
|
|
snd_ad1848_out(chip, SGALAXY_AUXC_LEFT, chip->image[SGALAXY_AUXC_LEFT]);
|
|
|
|
snd_ad1848_out(chip, SGALAXY_AUXC_RIGHT, chip->image[SGALAXY_AUXC_RIGHT]);
|
|
|
|
|
|
|
|
snd_power_change_state(card, SNDRV_CTL_POWER_D0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2007-03-20 11:33:46 +01:00
|
|
|
#define DEV_NAME "sgalaxy"
|
2005-11-17 17:12:43 +01:00
|
|
|
|
2007-02-22 12:50:54 +01:00
|
|
|
static struct isa_driver snd_sgalaxy_driver = {
|
|
|
|
.match = snd_sgalaxy_match,
|
2005-11-17 17:12:43 +01:00
|
|
|
.probe = snd_sgalaxy_probe,
|
|
|
|
.remove = __devexit_p(snd_sgalaxy_remove),
|
|
|
|
#ifdef CONFIG_PM
|
|
|
|
.suspend = snd_sgalaxy_suspend,
|
|
|
|
.resume = snd_sgalaxy_resume,
|
|
|
|
#endif
|
|
|
|
.driver = {
|
2007-03-20 11:33:46 +01:00
|
|
|
.name = DEV_NAME
|
2005-11-17 17:12:43 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2005-04-17 00:20:36 +02:00
|
|
|
static int __init alsa_card_sgalaxy_init(void)
|
|
|
|
{
|
2007-02-22 12:50:54 +01:00
|
|
|
return isa_register_driver(&snd_sgalaxy_driver, SNDRV_CARDS);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static void __exit alsa_card_sgalaxy_exit(void)
|
|
|
|
{
|
2007-02-22 12:50:54 +01:00
|
|
|
isa_unregister_driver(&snd_sgalaxy_driver);
|
2005-04-17 00:20:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
module_init(alsa_card_sgalaxy_init)
|
|
|
|
module_exit(alsa_card_sgalaxy_exit)
|