summaryrefslogtreecommitdiffstats
path: root/sound/pcmcia
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pcmcia')
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c182
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.h30
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_core.c42
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_irq.c6
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c62
-rw-r--r--sound/pcmcia/vx/vxp_mixer.c26
-rw-r--r--sound/pcmcia/vx/vxp_ops.c58
-rw-r--r--sound/pcmcia/vx/vxpocket.c186
-rw-r--r--sound/pcmcia/vx/vxpocket.h8
9 files changed, 255 insertions, 345 deletions
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index d6918b4..77caf43 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -52,16 +52,13 @@ MODULE_PARM_DESC(enable, "Enable " CARD_NAME " soundcard.");
/*
*/
-static dev_info_t dev_info = "snd-pdaudiocf";
-static snd_card_t *card_list[SNDRV_CARDS];
-static dev_link_t *dev_list;
+static struct snd_card *card_list[SNDRV_CARDS];
/*
* prototypes
*/
static void pdacf_config(dev_link_t *link);
-static int pdacf_event(event_t event, int priority, event_callback_args_t *args);
-static void snd_pdacf_detach(dev_link_t *link);
+static void snd_pdacf_detach(struct pcmcia_device *p_dev);
static void pdacf_release(dev_link_t *link)
{
@@ -77,16 +74,12 @@ static void pdacf_release(dev_link_t *link)
/*
* destructor
*/
-static int snd_pdacf_free(pdacf_t *pdacf)
+static int snd_pdacf_free(struct snd_pdacf *pdacf)
{
dev_link_t *link = &pdacf->link;
pdacf_release(link);
- /* Break the link with Card Services */
- if (link->handle)
- pcmcia_deregister_client(link->handle);
-
card_list[pdacf->index] = NULL;
pdacf->card = NULL;
@@ -94,23 +87,22 @@ static int snd_pdacf_free(pdacf_t *pdacf)
return 0;
}
-static int snd_pdacf_dev_free(snd_device_t *device)
+static int snd_pdacf_dev_free(struct snd_device *device)
{
- pdacf_t *chip = device->device_data;
+ struct snd_pdacf *chip = device->device_data;
return snd_pdacf_free(chip);
}
/*
* snd_pdacf_attach - attach callback for cs
*/
-static dev_link_t *snd_pdacf_attach(void)
+static int snd_pdacf_attach(struct pcmcia_device *p_dev)
{
- client_reg_t client_reg; /* Register with cardmgr */
- dev_link_t *link; /* Info for cardmgr */
- int i, ret;
- pdacf_t *pdacf;
- snd_card_t *card;
- static snd_device_ops_t ops = {
+ int i;
+ dev_link_t *link; /* Info for cardmgr */
+ struct snd_pdacf *pdacf;
+ struct snd_card *card;
+ static struct snd_device_ops ops = {
.dev_free = snd_pdacf_dev_free,
};
@@ -122,26 +114,26 @@ static dev_link_t *snd_pdacf_attach(void)
}
if (i >= SNDRV_CARDS) {
snd_printk(KERN_ERR "pdacf: too many cards found\n");
- return NULL;
+ return -EINVAL;
}
if (! enable[i])
- return NULL; /* disabled explicitly */
+ return -ENODEV; /* disabled explicitly */
/* ok, create a card instance */
card = snd_card_new(index[i], id[i], THIS_MODULE, 0);
if (card == NULL) {
snd_printk(KERN_ERR "pdacf: cannot create a card instance\n");
- return NULL;
+ return -ENOMEM;
}
pdacf = snd_pdacf_create(card);
if (! pdacf)
- return NULL;
+ return -EIO;
if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops) < 0) {
kfree(pdacf);
snd_card_free(card);
- return NULL;
+ return -ENODEV;
}
pdacf->index = i;
@@ -165,22 +157,12 @@ static dev_link_t *snd_pdacf_attach(void)
link->conf.Present = PRESENT_OPTION;
/* Chain drivers */
- link->next = dev_list;
- dev_list = link;
-
- /* Register with Card Services */
- client_reg.dev_info = &dev_info;
- client_reg.Version = 0x0210;
- client_reg.event_callback_args.client_data = link;
-
- ret = pcmcia_register_client(&link->handle, &client_reg);
- if (ret != CS_SUCCESS) {
- cs_error(link->handle, RegisterClient, ret);
- snd_pdacf_detach(link);
- return NULL;
- }
+ link->next = NULL;
- return link;
+ link->handle = p_dev;
+ pdacf_config(link);
+
+ return 0;
}
@@ -194,10 +176,10 @@ static dev_link_t *snd_pdacf_attach(void)
*
* returns 0 if successful, or a negative error code.
*/
-static int snd_pdacf_assign_resources(pdacf_t *pdacf, int port, int irq)
+static int snd_pdacf_assign_resources(struct snd_pdacf *pdacf, int port, int irq)
{
int err;
- snd_card_t *card = pdacf->card;
+ struct snd_card *card = pdacf->card;
snd_printdd(KERN_DEBUG "pdacf assign resources: port = 0x%x, irq = %d\n", port, irq);
pdacf->port = port;
@@ -217,8 +199,6 @@ static int snd_pdacf_assign_resources(pdacf_t *pdacf, int port, int irq)
if (err < 0)
return err;
- snd_card_set_pm_callback(card, snd_pdacf_suspend, snd_pdacf_resume, pdacf);
-
if ((err = snd_card_register(card)) < 0)
return err;
@@ -229,21 +209,13 @@ static int snd_pdacf_assign_resources(pdacf_t *pdacf, int port, int irq)
/*
* snd_pdacf_detach - detach callback for cs
*/
-static void snd_pdacf_detach(dev_link_t *link)
+static void snd_pdacf_detach(struct pcmcia_device *p_dev)
{
- pdacf_t *chip = link->priv;
+ dev_link_t *link = dev_to_instance(p_dev);
+ struct snd_pdacf *chip = link->priv;
snd_printdd(KERN_DEBUG "pdacf_detach called\n");
- /* Remove the interface data from the linked list */
- {
- dev_link_t **linkp;
- /* Locate device structure */
- for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
- if (*linkp == link)
- break;
- if (*linkp)
- *linkp = link->next;
- }
+
if (chip->chip_status & PDAUDIOCF_STAT_IS_CONFIGURED)
snd_pdacf_powerdown(chip);
chip->chip_status |= PDAUDIOCF_STAT_IS_STALE; /* to be sure */
@@ -261,7 +233,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void pdacf_config(dev_link_t *link)
{
client_handle_t handle = link->handle;
- pdacf_t *pdacf = link->priv;
+ struct snd_pdacf *pdacf = link->priv;
tuple_t tuple;
cisparse_t *parse = NULL;
config_info_t conf;
@@ -312,62 +284,51 @@ failed:
pcmcia_release_irq(link->handle, &link->irq);
}
-/*
- * event callback
- */
-static int pdacf_event(event_t event, int priority, event_callback_args_t *args)
-{
- dev_link_t *link = args->client_data;
- pdacf_t *chip = link->priv;
-
- switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- snd_printdd(KERN_DEBUG "CARD_REMOVAL..\n");
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG) {
- chip->chip_status |= PDAUDIOCF_STAT_IS_STALE;
- }
- break;
- case CS_EVENT_CARD_INSERTION:
- snd_printdd(KERN_DEBUG "CARD_INSERTION..\n");
- link->state |= DEV_PRESENT;
- pdacf_config(link);
- break;
#ifdef CONFIG_PM
- case CS_EVENT_PM_SUSPEND:
- snd_printdd(KERN_DEBUG "SUSPEND\n");
- link->state |= DEV_SUSPEND;
+
+static int pdacf_suspend(struct pcmcia_device *dev)
+{
+ dev_link_t *link = dev_to_instance(dev);
+ struct snd_pdacf *chip = link->priv;
+
+ snd_printdd(KERN_DEBUG "SUSPEND\n");
+ link->state |= DEV_SUSPEND;
+ if (chip) {
+ snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n");
+ snd_pdacf_suspend(chip, PMSG_SUSPEND);
+ }
+
+ snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
+ if (link->state & DEV_CONFIG)
+ pcmcia_release_configuration(link->handle);
+
+ return 0;
+}
+
+static int pdacf_resume(struct pcmcia_device *dev)
+{
+ dev_link_t *link = dev_to_instance(dev);
+ struct snd_pdacf *chip = link->priv;
+
+ snd_printdd(KERN_DEBUG "RESUME\n");
+ link->state &= ~DEV_SUSPEND;
+
+ snd_printdd(KERN_DEBUG "CARD_RESET\n");
+ if (DEV_OK(link)) {
+ snd_printdd(KERN_DEBUG "requestconfig...\n");
+ pcmcia_request_configuration(link->handle, &link->conf);
if (chip) {
- snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n");
- snd_pdacf_suspend(chip->card, PMSG_SUSPEND);
- }
- /* Fall through... */
- case CS_EVENT_RESET_PHYSICAL:
- snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
- if (link->state & DEV_CONFIG)
- pcmcia_release_configuration(link->handle);
- break;
- case CS_EVENT_PM_RESUME:
- snd_printdd(KERN_DEBUG "RESUME\n");
- link->state &= ~DEV_SUSPEND;
- /* Fall through... */
- case CS_EVENT_CARD_RESET:
- snd_printdd(KERN_DEBUG "CARD_RESET\n");
- if (DEV_OK(link)) {
- snd_printdd(KERN_DEBUG "requestconfig...\n");
- pcmcia_request_configuration(link->handle, &link->conf);
- if (chip) {
- snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n");
- snd_pdacf_resume(chip->card);
- }
+ snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n");
+ snd_pdacf_resume(chip);
}
- snd_printdd(KERN_DEBUG "resume done!\n");
- break;
-#endif
}
+ snd_printdd(KERN_DEBUG "resume done!\n");
+
return 0;
}
+#endif
+
/*
* Module entry points
*/
@@ -382,10 +343,14 @@ static struct pcmcia_driver pdacf_cs_driver = {
.drv = {
.name = "snd-pdaudiocf",
},
- .attach = snd_pdacf_attach,
- .event = pdacf_event,
- .detach = snd_pdacf_detach,
+ .probe = snd_pdacf_attach,
+ .remove = snd_pdacf_detach,
.id_table = snd_pdacf_ids,
+#ifdef CONFIG_PM
+ .suspend = pdacf_suspend,
+ .resume = pdacf_resume,
+#endif
+
};
static int __init init_pdacf(void)
@@ -396,7 +361,6 @@ static int __init init_pdacf(void)
static void __exit exit_pdacf(void)
{
pcmcia_unregister_driver(&pdacf_cs_driver);
- BUG_ON(dev_list != NULL);
}
module_init(init_pdacf);
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h
index c7a9628..2744f18 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.h
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.h
@@ -83,8 +83,8 @@
#define PDAUDIOCF_STAT_IS_CONFIGURED (1<<1)
#define PDAUDIOCF_STAT_IS_SUSPENDED (1<<2)
-typedef struct {
- snd_card_t *card;
+struct snd_pdacf {
+ struct snd_card *card;
int index;
unsigned long port;
@@ -96,12 +96,12 @@ typedef struct {
struct tasklet_struct tq;
spinlock_t ak4117_lock;
- ak4117_t *ak4117;
+ struct ak4117 *ak4117;
unsigned int chip_status;
- snd_pcm_t *pcm;
- snd_pcm_substream_t *pcm_substream;
+ struct snd_pcm *pcm;
+ struct snd_pcm_substream *pcm_substream;
unsigned int pcm_running: 1;
unsigned int pcm_channels;
unsigned int pcm_swab;
@@ -118,28 +118,28 @@ typedef struct {
/* pcmcia stuff */
dev_link_t link;
dev_node_t node;
-} pdacf_t;
+};
-static inline void pdacf_reg_write(pdacf_t *chip, unsigned char reg, unsigned short val)
+static inline void pdacf_reg_write(struct snd_pdacf *chip, unsigned char reg, unsigned short val)
{
outw(chip->regmap[reg>>1] = val, chip->port + reg);
}
-static inline unsigned short pdacf_reg_read(pdacf_t *chip, unsigned char reg)
+static inline unsigned short pdacf_reg_read(struct snd_pdacf *chip, unsigned char reg)
{
return inw(chip->port + reg);
}
-pdacf_t *snd_pdacf_create(snd_card_t *card);
-int snd_pdacf_ak4117_create(pdacf_t *pdacf);
-void snd_pdacf_powerdown(pdacf_t *chip);
+struct snd_pdacf *snd_pdacf_create(struct snd_card *card);
+int snd_pdacf_ak4117_create(struct snd_pdacf *pdacf);
+void snd_pdacf_powerdown(struct snd_pdacf *chip);
#ifdef CONFIG_PM
-int snd_pdacf_suspend(snd_card_t *card, pm_message_t state);
-int snd_pdacf_resume(snd_card_t *card);
+int snd_pdacf_suspend(struct snd_pdacf *chip, pm_message_t state);
+int snd_pdacf_resume(struct snd_pdacf *chip);
#endif
-int snd_pdacf_pcm_new(pdacf_t *chip);
+int snd_pdacf_pcm_new(struct snd_pdacf *chip);
irqreturn_t pdacf_interrupt(int irq, void *dev, struct pt_regs *regs);
void pdacf_tasklet(unsigned long private_data);
-void pdacf_reinit(pdacf_t *chip, int resume);
+void pdacf_reinit(struct snd_pdacf *chip, int resume);
#endif /* __PDAUDIOCF_H */
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
index 0208c54..bd0d70f 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
@@ -30,7 +30,7 @@
*/
static unsigned char pdacf_ak4117_read(void *private_data, unsigned char reg)
{
- pdacf_t *chip = private_data;
+ struct snd_pdacf *chip = private_data;
unsigned long timeout;
unsigned long flags;
unsigned char res;
@@ -62,7 +62,7 @@ static unsigned char pdacf_ak4117_read(void *private_data, unsigned char reg)
static void pdacf_ak4117_write(void *private_data, unsigned char reg, unsigned char val)
{
- pdacf_t *chip = private_data;
+ struct snd_pdacf *chip = private_data;
unsigned long timeout;
unsigned long flags;
@@ -81,7 +81,7 @@ static void pdacf_ak4117_write(void *private_data, unsigned char reg, unsigned c
}
#if 0
-void pdacf_dump(pdacf_t *chip)
+void pdacf_dump(struct snd_pdacf *chip)
{
printk("PDAUDIOCF DUMP (0x%lx):\n", chip->port);
printk("WPD : 0x%x\n", inw(chip->port + PDAUDIOCF_REG_WDP));
@@ -94,7 +94,7 @@ void pdacf_dump(pdacf_t *chip)
}
#endif
-static int pdacf_reset(pdacf_t *chip, int powerdown)
+static int pdacf_reset(struct snd_pdacf *chip, int powerdown)
{
u16 val;
@@ -117,7 +117,7 @@ static int pdacf_reset(pdacf_t *chip, int powerdown)
return 0;
}
-void pdacf_reinit(pdacf_t *chip, int resume)
+void pdacf_reinit(struct snd_pdacf *chip, int resume)
{
pdacf_reset(chip, 0);
if (resume)
@@ -127,10 +127,10 @@ void pdacf_reinit(pdacf_t *chip, int resume)
pdacf_reg_write(chip, PDAUDIOCF_REG_IER, chip->regmap[PDAUDIOCF_REG_IER>>1]);
}
-static void pdacf_proc_read(snd_info_entry_t * entry,
- snd_info_buffer_t * buffer)
+static void pdacf_proc_read(struct snd_info_entry * entry,
+ struct snd_info_buffer *buffer)
{
- pdacf_t *chip = entry->private_data;
+ struct snd_pdacf *chip = entry->private_data;
u16 tmp;
snd_iprintf(buffer, "PDAudioCF\n\n");
@@ -139,17 +139,17 @@ static void pdacf_proc_read(snd_info_entry_t * entry,
}
-static void pdacf_proc_init(pdacf_t *chip)
+static void pdacf_proc_init(struct snd_pdacf *chip)
{
- snd_info_entry_t *entry;
+ struct snd_info_entry *entry;
if (! snd_card_proc_new(chip->card, "pdaudiocf", &entry))
snd_info_set_text_ops(entry, chip, 1024, pdacf_proc_read);
}
-pdacf_t *snd_pdacf_create(snd_card_t *card)
+struct snd_pdacf *snd_pdacf_create(struct snd_card *card)
{
- pdacf_t *chip;
+ struct snd_pdacf *chip;
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
if (chip == NULL)
@@ -164,9 +164,9 @@ pdacf_t *snd_pdacf_create(snd_card_t *card)
return chip;
}
-static void snd_pdacf_ak4117_change(ak4117_t *ak4117, unsigned char c0, unsigned char c1)
+static void snd_pdacf_ak4117_change(struct ak4117 *ak4117, unsigned char c0, unsigned char c1)
{
- pdacf_t *chip = ak4117->change_callback_private;
+ struct snd_pdacf *chip = ak4117->change_callback_private;
unsigned long flags;
u16 val;
@@ -182,7 +182,7 @@ static void snd_pdacf_ak4117_change(ak4117_t *ak4117, unsigned char c0, unsigned
spin_unlock_irqrestore(&chip->reg_lock, flags);
}
-int snd_pdacf_ak4117_create(pdacf_t *chip)
+int snd_pdacf_ak4117_create(struct snd_pdacf *chip)
{
int err;
u16 val;
@@ -238,7 +238,7 @@ int snd_pdacf_ak4117_create(pdacf_t *chip)
return 0;
}
-void snd_pdacf_powerdown(pdacf_t *chip)
+void snd_pdacf_powerdown(struct snd_pdacf *chip)
{
u16 val;
@@ -255,11 +255,11 @@ void snd_pdacf_powerdown(pdacf_t *chip)
#ifdef CONFIG_PM
-int snd_pdacf_suspend(snd_card_t *card, pm_message_t state)
+int snd_pdacf_suspend(struct snd_pdacf *chip, pm_message_t state)
{
- pdacf_t *chip = card->pm_private_data;
u16 val;
+ snd_power_change_state(chip->card, SNDRV_CTL_POWER_D3hot);
snd_pcm_suspend_all(chip->pcm);
/* disable interrupts, but use direct write to preserve old register value in chip->regmap */
val = inw(chip->port + PDAUDIOCF_REG_IER);
@@ -270,14 +270,13 @@ int snd_pdacf_suspend(snd_card_t *card, pm_message_t state)
return 0;
}
-static inline int check_signal(pdacf_t *chip)
+static inline int check_signal(struct snd_pdacf *chip)
{
return (chip->ak4117->rcs0 & AK4117_UNLCK) == 0;
}
-int snd_pdacf_resume(snd_card_t *card)
+int snd_pdacf_resume(struct snd_pdacf *chip)
{
- pdacf_t *chip = card->pm_private_data;
int timeout = 40;
pdacf_reinit(chip, 1);
@@ -286,6 +285,7 @@ int snd_pdacf_resume(snd_card_t *card)
(snd_ak4117_external_rate(chip->ak4117) <= 0 || !check_signal(chip)))
mdelay(1);
chip->chip_status &= ~PDAUDIOCF_STAT_IS_SUSPENDED;
+ snd_power_change_state(chip->card, SNDRV_CTL_POWER_D0);
return 0;
}
#endif
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c
index 255b634..7c5f21e 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_irq.c
@@ -28,7 +28,7 @@
*/
irqreturn_t pdacf_interrupt(int irq, void *dev, struct pt_regs *regs)
{
- pdacf_t *chip = dev;
+ struct snd_pdacf *chip = dev;
unsigned short stat;
if ((chip->chip_status & (PDAUDIOCF_STAT_IS_STALE|
@@ -204,7 +204,7 @@ static inline void pdacf_transfer_stereo24be(u8 *dst, u32 xor, unsigned int size
}
}
-static void pdacf_transfer(pdacf_t *chip, unsigned int size, unsigned int off)
+static void pdacf_transfer(struct snd_pdacf *chip, unsigned int size, unsigned int off)
{
unsigned long rdp_port = chip->port + PDAUDIOCF_REG_MD;
unsigned int xor = chip->pcm_xor;
@@ -258,7 +258,7 @@ static void pdacf_transfer(pdacf_t *chip, unsigned int size, unsigned int off)
void pdacf_tasklet(unsigned long private_data)
{
- pdacf_t *chip = (pdacf_t *) private_data;
+ struct snd_pdacf *chip = (struct snd_pdacf *) private_data;
int size, off, cont, rdp, wdp;
if ((chip->chip_status & (PDAUDIOCF_STAT_IS_STALE|PDAUDIOCF_STAT_IS_CONFIGURED)) != PDAUDIOCF_STAT_IS_CONFIGURED)
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
index 20b86d8..09cb250 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c
@@ -34,7 +34,7 @@
*/
/* get the physical page pointer on the given offset */
-static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, unsigned long offset)
+static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs, unsigned long offset)
{
void *pageptr = subs->runtime->dma_area + offset;
return vmalloc_to_page(pageptr);
@@ -44,9 +44,9 @@ static struct page *snd_pcm_get_vmalloc_page(snd_pcm_substream_t *subs, unsigned
* hw_params callback
* NOTE: this may be called not only once per pcm open!
*/
-static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size)
+static int snd_pcm_alloc_vmalloc_buffer(struct snd_pcm_substream *subs, size_t size)
{
- snd_pcm_runtime_t *runtime = subs->runtime;
+ struct snd_pcm_runtime *runtime = subs->runtime;
if (runtime->dma_area) {
if (runtime->dma_bytes >= size)
return 0; /* already enough large */
@@ -63,9 +63,9 @@ static int snd_pcm_alloc_vmalloc_buffer(snd_pcm_substream_t *subs, size_t size)
* hw_free callback
* NOTE: this may be called not only once per pcm open!
*/
-static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs)
+static int snd_pcm_free_vmalloc_buffer(struct snd_pcm_substream *subs)
{
- snd_pcm_runtime_t *runtime = subs->runtime;
+ struct snd_pcm_runtime *runtime = subs->runtime;
if (runtime->dma_area) {
vfree(runtime->dma_area);
runtime->dma_area = NULL;
@@ -76,7 +76,7 @@ static int snd_pcm_free_vmalloc_buffer(snd_pcm_substream_t *subs)
/*
* clear the SRAM contents
*/
-static int pdacf_pcm_clear_sram(pdacf_t *chip)
+static int pdacf_pcm_clear_sram(struct snd_pdacf *chip)
{
int max_loop = 64 * 1024;
@@ -91,10 +91,10 @@ static int pdacf_pcm_clear_sram(pdacf_t *chip)
/*
* pdacf_pcm_trigger - trigger callback for capture
*/
-static int pdacf_pcm_trigger(snd_pcm_substream_t *subs, int cmd)
+static int pdacf_pcm_trigger(struct snd_pcm_substream *subs, int cmd)
{
- pdacf_t *chip = snd_pcm_substream_chip(subs);
- snd_pcm_runtime_t *runtime = subs->runtime;
+ struct snd_pdacf *chip = snd_pcm_substream_chip(subs);
+ struct snd_pcm_runtime *runtime = subs->runtime;
int inc, ret = 0, rate;
unsigned short mask, val, tmp;
@@ -146,8 +146,8 @@ static int pdacf_pcm_trigger(snd_pcm_substream_t *subs, int cmd)
/*
* pdacf_pcm_hw_params - hw_params callback for playback and capture
*/
-static int pdacf_pcm_hw_params(snd_pcm_substream_t *subs,
- snd_pcm_hw_params_t *hw_params)
+static int pdacf_pcm_hw_params(struct snd_pcm_substream *subs,
+ struct snd_pcm_hw_params *hw_params)
{
return snd_pcm_alloc_vmalloc_buffer(subs, params_buffer_bytes(hw_params));
}
@@ -155,7 +155,7 @@ static int pdacf_pcm_hw_params(snd_pcm_substream_t *subs,
/*
* pdacf_pcm_hw_free - hw_free callback for playback and capture
*/
-static int pdacf_pcm_hw_free(snd_pcm_substream_t *subs)
+static int pdacf_pcm_hw_free(struct snd_pcm_substream *subs)
{
return snd_pcm_free_vmalloc_buffer(subs);
}
@@ -163,10 +163,10 @@ static int pdacf_pcm_hw_free(snd_pcm_substream_t *subs)
/*
* pdacf_pcm_prepare - prepare callback for playback and capture
*/
-static int pdacf_pcm_prepare(snd_pcm_substream_t *subs)
+static int pdacf_pcm_prepare(struct snd_pcm_substream *subs)
{
- pdacf_t *chip = snd_pcm_substream_chip(subs);
- snd_pcm_runtime_t *runtime = subs->runtime;
+ struct snd_pdacf *chip = snd_pcm_substream_chip(subs);
+ struct snd_pcm_runtime *runtime = subs->runtime;
u16 val, nval, aval;
if (chip->chip_status & PDAUDIOCF_STAT_IS_STALE)
@@ -239,7 +239,7 @@ static int pdacf_pcm_prepare(snd_pcm_substream_t *subs)
* capture hw information
*/
-static snd_pcm_hardware_t pdacf_pcm_capture_hw = {
+static struct snd_pcm_hardware pdacf_pcm_capture_hw = {
.info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME |
SNDRV_PCM_INFO_MMAP_VALID),
@@ -269,10 +269,10 @@ static snd_pcm_hardware_t pdacf_pcm_capture_hw = {
/*
* pdacf_pcm_capture_open - open callback for capture
*/
-static int pdacf_pcm_capture_open(snd_pcm_substream_t *subs)
+static int pdacf_pcm_capture_open(struct snd_pcm_substream *subs)
{
- snd_pcm_runtime_t *runtime = subs->runtime;
- pdacf_t *chip = snd_pcm_substream_chip(subs);
+ struct snd_pcm_runtime *runtime = subs->runtime;
+ struct snd_pdacf *chip = snd_pcm_substream_chip(subs);
if (chip->chip_status & PDAUDIOCF_STAT_IS_STALE)
return -EBUSY;
@@ -287,9 +287,9 @@ static int pdacf_pcm_capture_open(snd_pcm_substream_t *subs)
/*
* pdacf_pcm_capture_close - close callback for capture
*/
-static int pdacf_pcm_capture_close(snd_pcm_substream_t *subs)
+static int pdacf_pcm_capture_close(struct snd_pcm_substream *subs)
{
- pdacf_t *chip = snd_pcm_substream_chip(subs);
+ struct snd_pdacf *chip = snd_pcm_substream_chip(subs);
if (!chip)
return -EINVAL;
@@ -302,16 +302,16 @@ static int pdacf_pcm_capture_close(snd_pcm_substream_t *subs)
/*
* pdacf_pcm_capture_pointer - pointer callback for capture
*/
-static snd_pcm_uframes_t pdacf_pcm_capture_pointer(snd_pcm_substream_t *subs)
+static snd_pcm_uframes_t pdacf_pcm_capture_pointer(struct snd_pcm_substream *subs)
{
- pdacf_t *chip = snd_pcm_substream_chip(subs);
+ struct snd_pdacf *chip = snd_pcm_substream_chip(subs);
return chip->pcm_hwptr;
}
/*
* operators for PCM capture
*/
-static snd_pcm_ops_t pdacf_pcm_capture_ops = {
+static struct snd_pcm_ops pdacf_pcm_capture_ops = {
.open = pdacf_pcm_capture_open,
.close = pdacf_pcm_capture_close,
.ioctl = snd_pcm_lib_ioctl,
@@ -325,20 +325,11 @@ static snd_pcm_ops_t pdacf_pcm_capture_ops = {
/*
- * free callback for pcm
- */
-static void snd_pdacf_pcm_free(snd_pcm_t *pcm)
-{
- pdacf_t *chip = pcm->private_data;
- chip->pcm = NULL;
-}
-
-/*
* snd_pdacf_pcm_new - create and initialize a pcm
*/
-int snd_pdacf_pcm_new(pdacf_t *chip)
+int snd_pdacf_pcm_new(struct snd_pdacf *chip)
{
- snd_pcm_t *pcm;
+ struct snd_pcm *pcm;
int err;
err = snd_pcm_new(chip->card, "PDAudioCF", 0, 0, 1, &pcm);
@@ -348,7 +339,6 @@ int snd_pdacf_pcm_new(pdacf_t *chip)
snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pdacf_pcm_capture_ops);
pcm->private_data = chip;
- pcm->private_free = snd_pdacf_pcm_free;
pcm->info_flags = 0;
strcpy(pcm->name, chip->card->shortname);
chip->pcm = pcm;
diff --git a/sound/pcmcia/vx/vxp_mixer.c b/sound/pcmcia/vx/vxp_mixer.c
index aeaef3d..9450149 100644
--- a/sound/pcmcia/vx/vxp_mixer.c
+++ b/sound/pcmcia/vx/vxp_mixer.c
@@ -31,7 +31,7 @@
/*
* mic level control (for VXPocket)
*/
-static int vx_mic_level_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int vx_mic_level_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1;
@@ -40,17 +40,17 @@ static int vx_mic_level_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinf
return 0;
}
-static int vx_mic_level_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int vx_mic_level_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
- vx_core_t *_chip = snd_kcontrol_chip(kcontrol);
+ struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
ucontrol->value.integer.value[0] = chip->mic_level;
return 0;
}
-static int vx_mic_level_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int vx_mic_level_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
- vx_core_t *_chip = snd_kcontrol_chip(kcontrol);
+ struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
down(&_chip->mixer_mutex);
if (chip->mic_level != ucontrol->value.integer.value[0]) {
@@ -63,7 +63,7 @@ static int vx_mic_level_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucon
return 0;
}
-static snd_kcontrol_new_t vx_control_mic_level = {
+static struct snd_kcontrol_new vx_control_mic_level = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Mic Capture Volume",
.info = vx_mic_level_info,
@@ -74,7 +74,7 @@ static snd_kcontrol_new_t vx_control_mic_level = {
/*
* mic boost level control (for VXP440)
*/
-static int vx_mic_boost_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int vx_mic_boost_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
uinfo->count = 1;
@@ -83,17 +83,17 @@ static int vx_mic_boost_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinf
return 0;
}
-static int vx_mic_boost_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int vx_mic_boost_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
- vx_core_t *_chip = snd_kcontrol_chip(kcontrol);
+ struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
ucontrol->value.integer.value[0] = chip->mic_level;
return 0;
}
-static int vx_mic_boost_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int vx_mic_boost_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
{
- vx_core_t *_chip = snd_kcontrol_chip(kcontrol);
+ struct vx_core *_chip = snd_kcontrol_chip(kcontrol);
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
down(&_chip->mixer_mutex);
if (chip->mic_level != ucontrol->value.integer.value[0]) {
@@ -106,7 +106,7 @@ static int vx_mic_boost_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucon
return 0;
}
-static snd_kcontrol_new_t vx_control_mic_boost = {
+static struct snd_kcontrol_new vx_control_mic_boost = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Mic Boost",
.info = vx_mic_boost_info,
@@ -115,7 +115,7 @@ static snd_kcontrol_new_t vx_control_mic_boost = {
};
-int vxp_add_mic_controls(vx_core_t *_chip)
+int vxp_add_mic_controls(struct vx_core *_chip)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
int err;
diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c
index 6f15c3d..7f82f61 100644
--- a/sound/pcmcia/vx/vxp_ops.c
+++ b/sound/pcmcia/vx/vxp_ops.c
@@ -49,7 +49,7 @@ static int vxp_reg_offset[VX_REG_MAX] = {
};
-static inline unsigned long vxp_reg_addr(vx_core_t *_chip, int reg)
+static inline unsigned long vxp_reg_addr(struct vx_core *_chip, int reg)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
return chip->port + vxp_reg_offset[reg];
@@ -59,7 +59,7 @@ static inline unsigned long vxp_reg_addr(vx_core_t *_chip, int reg)
* snd_vx_inb - read a byte from the register
* @offset: register offset
*/
-static unsigned char vxp_inb(vx_core_t *chip, int offset)
+static unsigned char vxp_inb(struct vx_core *chip, int offset)
{
return inb(vxp_reg_addr(chip, offset));
}
@@ -69,7 +69,7 @@ static unsigned char vxp_inb(vx_core_t *chip, int offset)
* @offset: the register offset
* @val: the value to write
*/
-static void vxp_outb(vx_core_t *chip, int offset, unsigned char val)
+static void vxp_outb(struct vx_core *chip, int offset, unsigned char val)
{
outb(val, vxp_reg_addr(chip, offset));
}
@@ -78,9 +78,9 @@ static void vxp_outb(vx_core_t *chip, int offset, unsigned char val)
* redefine macros to call directly
*/
#undef vx_inb
-#define vx_inb(chip,reg) vxp_inb((vx_core_t*)(chip), VX_##reg)
+#define vx_inb(chip,reg) vxp_inb((struct vx_core *)(chip), VX_##reg)
#undef vx_outb
-#define vx_outb(chip,reg,val) vxp_outb((vx_core_t*)(chip), VX_##reg,val)
+#define vx_outb(chip,reg,val) vxp_outb((struct vx_core *)(chip), VX_##reg,val)
/*
@@ -88,7 +88,7 @@ static void vxp_outb(vx_core_t *chip, int offset, unsigned char val)
*
* returns zero if a magic word is detected, or a negative error code.
*/
-static int vx_check_magic(vx_core_t *chip)
+static int vx_check_magic(struct vx_core *chip)
{
unsigned long end_time = jiffies + HZ / 5;
int c;
@@ -96,7 +96,7 @@ static int vx_check_magic(vx_core_t *chip)
c = vx_inb(chip, CDSP);
if (c == CDSP_MAGIC)
return 0;
- snd_vx_delay(chip, 10);
+ msleep(10);
} while (time_after_eq(end_time, jiffies));
snd_printk(KERN_ERR "cannot find xilinx magic word (%x)\n", c);
return -EIO;
@@ -109,7 +109,7 @@ static int vx_check_magic(vx_core_t *chip)
#define XX_DSP_RESET_WAIT_TIME 2 /* ms */
-static void vxp_reset_dsp(vx_core_t *_chip)
+static void vxp_reset_dsp(struct vx_core *_chip)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
@@ -127,26 +127,26 @@ static void vxp_reset_dsp(vx_core_t *_chip)
/*
* reset codec bit
*/
-static void vxp_reset_codec(vx_core_t *_chip)
+static void vxp_reset_codec(struct vx_core *_chip)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
/* Set the reset CODEC bit to 1. */
vx_outb(chip, CDSP, chip->regCDSP | VXP_CDSP_CODEC_RESET_MASK);
vx_inb(chip, CDSP);
- snd_vx_delay(_chip, 10);
+ msleep(10);
/* Set the reset CODEC bit to 0. */
chip->regCDSP &= ~VXP_CDSP_CODEC_RESET_MASK;
vx_outb(chip, CDSP, chip->regCDSP);
vx_inb(chip, CDSP);
- snd_vx_delay(_chip, 1);
+ msleep(1);
}
/*
* vx_load_xilinx_binary - load the xilinx binary image
* the binary image is the binary array converted from the bitstream file.
*/
-static int vxp_load_xilinx_binary(vx_core_t *_chip, const struct firmware *fw)
+static int vxp_load_xilinx_binary(struct vx_core *_chip, const struct firmware *fw)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
unsigned int i;
@@ -207,7 +207,7 @@ static int vxp_load_xilinx_binary(vx_core_t *_chip, const struct firmware *fw)
vx_outb(chip, ICR, ICR_HF0);
/* TEMPO 250ms : wait until Xilinx is downloaded */
- snd_vx_delay(_chip, 300);
+ msleep(300);
/* test magical word */
if (vx_check_magic(_chip) < 0)
@@ -221,7 +221,7 @@ static int vxp_load_xilinx_binary(vx_core_t *_chip, const struct firmware *fw)
chip->regDIALOG |= VXP_DLG_XILINX_REPROG_MASK;
vx_outb(chip, DIALOG, chip->regDIALOG);
vx_inb(chip, DIALOG);
- snd_vx_delay(_chip, 10);
+ msleep(10);
chip->regDIALOG &= ~VXP_DLG_XILINX_REPROG_MASK;
vx_outb(chip, DIALOG, chip->regDIALOG);
vx_inb(chip, DIALOG);
@@ -244,7 +244,7 @@ static int vxp_load_xilinx_binary(vx_core_t *_chip, const struct firmware *fw)
/*
* vxp_load_dsp - load_dsp callback
*/
-static int vxp_load_dsp(vx_core_t *vx, int index, const struct firmware *fw)
+static int vxp_load_dsp(struct vx_core *vx, int index, const struct firmware *fw)
{
int err;
@@ -279,7 +279,7 @@ static int vxp_load_dsp(vx_core_t *vx, int index, const struct firmware *fw)
*
* spinlock held!
*/
-static int vxp_test_and_ack(vx_core_t *_chip)
+static int vxp_test_and_ack(struct vx_core *_chip)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
@@ -306,7 +306,7 @@ static int vxp_test_and_ack(vx_core_t *_chip)
/*
* vx_validate_irq - enable/disable IRQ
*/
-static void vxp_validate_irq(vx_core_t *_chip, int enable)
+static void vxp_validate_irq(struct vx_core *_chip, int enable)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
@@ -322,7 +322,7 @@ static void vxp_validate_irq(vx_core_t *_chip, int enable)
* vx_setup_pseudo_dma - set up the pseudo dma read/write mode.
* @do_write: 0 = read, 1 = set up for DMA write
*/
-static void vx_setup_pseudo_dma(vx_core_t *_chip, int do_write)
+static void vx_setup_pseudo_dma(struct vx_core *_chip, int do_write)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
@@ -342,7 +342,7 @@ static void vx_setup_pseudo_dma(vx_core_t *_chip, int do_write)
/*
* vx_release_pseudo_dma - disable the pseudo-DMA mode
*/
-static void vx_release_pseudo_dma(vx_core_t *_chip)
+static void vx_release_pseudo_dma(struct vx_core *_chip)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
@@ -362,8 +362,8 @@ static void vx_release_pseudo_dma(vx_core_t *_chip)
* data size must be aligned to 6 bytes to ensure the 24bit alignment on DSP.
* NB: call with a certain lock!
*/
-static void vxp_dma_write(vx_core_t *chip, snd_pcm_runtime_t *runtime,
- vx_pipe_t *pipe, int count)
+static void vxp_dma_write(struct vx_core *chip, struct snd_pcm_runtime *runtime,
+ struct vx_pipe *pipe, int count)
{
long port = vxp_reg_addr(chip, VX_DMA);
int offset = pipe->hw_ptr;
@@ -401,8 +401,8 @@ static void vxp_dma_write(vx_core_t *chip, snd_pcm_runtime_t *runtime,
* the read length must be aligned to 6 bytes, as well as write.
* NB: call with a certain lock!
*/
-static void vxp_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtime,
- vx_pipe_t *pipe, int count)
+static void vxp_dma_read(struct vx_core *chip, struct snd_pcm_runtime *runtime,
+ struct vx_pipe *pipe, int count)
{
struct snd_vxpocket *pchip = (struct snd_vxpocket *)chip;
long port = vxp_reg_addr(chip, VX_DMA);
@@ -442,7 +442,7 @@ static void vxp_dma_read(vx_core_t *chip, snd_pcm_runtime_t *runtime,
/*
* write a codec data (24bit)
*/
-static void vxp_write_codec_reg(vx_core_t *chip, int codec, unsigned int data)
+static void vxp_write_codec_reg(struct vx_core *chip, int codec, unsigned int data)
{
int i;
@@ -465,7 +465,7 @@ static void vxp_write_codec_reg(vx_core_t *chip, int codec, unsigned int data)
* vx_set_mic_boost - set mic boost level (on vxp440 only)
* @boost: 0 = 20dB, 1 = +38dB
*/
-void vx_set_mic_boost(vx_core_t *chip, int boost)
+void vx_set_mic_boost(struct vx_core *chip, int boost)
{
struct snd_vxpocket *pchip = (struct snd_vxpocket *)chip;
unsigned long flags;
@@ -508,7 +508,7 @@ static int vx_compute_mic_level(int level)
* vx_set_mic_level - set mic level (on vxpocket only)
* @level: the mic level = 0 - 8 (max)
*/
-void vx_set_mic_level(vx_core_t *chip, int level)
+void vx_set_mic_level(struct vx_core *chip, int level)
{
struct snd_vxpocket *pchip = (struct snd_vxpocket *)chip;
unsigned long flags;
@@ -528,7 +528,7 @@ void vx_set_mic_level(vx_core_t *chip, int level)
/*
* change the input audio source
*/
-static void vxp_change_audio_source(vx_core_t *_chip, int src)
+static void vxp_change_audio_source(struct vx_core *_chip, int src)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
@@ -568,7 +568,7 @@ static void vxp_change_audio_source(vx_core_t *_chip, int src)
* change the clock source
* source = INTERNAL_QUARTZ or UER_SYNC
*/
-static void vxp_set_clock_source(vx_core_t *_chip, int source)
+static void vxp_set_clock_source(struct vx_core *_chip, int source)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
@@ -583,7 +583,7 @@ static void vxp_set_clock_source(vx_core_t *_chip, int source)
/*
* reset the board
*/
-static void vxp_reset_board(vx_core_t *_chip, int cold_reset)
+static void vxp_reset_board(struct vx_core *_chip, int cold_reset)
{
struct snd_vxpocket *chip = (struct snd_vxpocket *)_chip;
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 1e8f16b..66900d2 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -55,11 +55,6 @@ MODULE_PARM_DESC(ibl, "Capture IBL size for VXPocket soundcard.");
*/
static unsigned int card_alloc;
-static dev_link_t *dev_list; /* Linked list of devices */
-static dev_info_t dev_info = "snd-vxpocket";
-
-
-static int vxpocket_event(event_t event, int priority, event_callback_args_t *args);
/*
@@ -73,19 +68,14 @@ static void vxpocket_release(dev_link_t *link)
pcmcia_release_irq(link->handle, &link->irq);
link->state &= ~DEV_CONFIG;
}
- if (link->handle) {
- /* Break the link with Card Services */
- pcmcia_deregister_client(link->handle);
- link->handle = NULL;
- }
}
/*
* destructor, called from snd_card_free_in_thread()
*/
-static int snd_vxpocket_dev_free(snd_device_t *device)
+static int snd_vxpocket_dev_free(struct snd_device *device)
{
- vx_core_t *chip = device->device_data;
+ struct vx_core *chip = device->device_data;
snd_vx_free_firmware(chip);
kfree(chip);
@@ -142,19 +132,17 @@ static struct snd_vx_hardware vxp440_hw = {
/*
* create vxpocket instance
*/
-static struct snd_vxpocket *snd_vxpocket_new(snd_card_t *card, int ibl)
+static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl)
{
- client_reg_t client_reg; /* Register with cardmgr */
dev_link_t *link; /* Info for cardmgr */
- vx_core_t *chip;
+ struct vx_core *chip;
struct snd_vxpocket *vxp;
- int ret;
- static snd_device_ops_t ops = {
+ static struct snd_device_ops ops = {
.dev_free = snd_vxpocket_dev_free,
};
chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops,
- sizeof(struct snd_vxpocket) - sizeof(vx_core_t));
+ sizeof(struct snd_vxpocket) - sizeof(struct vx_core));
if (! chip)
return NULL;
@@ -184,26 +172,6 @@ static struct snd_vxpocket *snd_vxpocket_new(snd_card_t *card, int ibl)
link->conf.ConfigIndex = 1;
link->conf.Present = PRESENT_OPTION;
- /* Register with Card Services */
- memset(&client_reg, 0, sizeof(client_reg));
- client_reg.dev_info = &dev_info;
- client_reg.EventMask =
- CS_EVENT_CARD_INSERTION | CS_EVENT_CARD_REMOVAL
-#ifdef CONFIG_PM
- | CS_EVENT_RESET_PHYSICAL | CS_EVENT_CARD_RESET
- | CS_EVENT_PM_SUSPEND | CS_EVENT_PM_RESUME
-#endif
- ;
- client_reg.event_handler = &vxpocket_event;
- client_reg.Version = 0x0210;
- client_reg.event_callback_args.client_data = link;
-
- ret = pcmcia_register_client(&link->handle, &client_reg);
- if (ret != CS_SUCCESS) {
- cs_error(link->handle, RegisterClient, ret);
- return NULL;
- }
-
return vxp;
}
@@ -218,10 +186,10 @@ static struct snd_vxpocket *snd_vxpocket_new(snd_card_t *card, int ibl)
*
* returns 0 if successful, or a negative error code.
*/
-static int snd_vxpocket_assign_resources(vx_core_t *chip, int port, int irq)
+static int snd_vxpocket_assign_resources(struct vx_core *chip, int port, int irq)
{
int err;
- snd_card_t *card = chip->card;
+ struct snd_card *card = chip->card;
struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
snd_printdd(KERN_DEBUG "vxpocket assign resources: port = 0x%x, irq = %d\n", port, irq);
@@ -250,7 +218,7 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
static void vxpocket_config(dev_link_t *link)
{
client_handle_t handle = link->handle;
- vx_core_t *chip = link->priv;
+ struct vx_core *chip = link->priv;
struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
tuple_t tuple;
cisparse_t *parse;
@@ -317,69 +285,57 @@ failed:
kfree(parse);
}
+#ifdef CONFIG_PM
-/*
- * event callback
- */
-static int vxpocket_event(event_t event, int priority, event_callback_args_t *args)
+static int vxp_suspend(struct pcmcia_device *dev)
{
- dev_link_t *link = args->client_data;
- vx_core_t *chip = link->priv;
-
- switch (event) {
- case CS_EVENT_CARD_REMOVAL:
- snd_printdd(KERN_DEBUG "CARD_REMOVAL..\n");
- link->state &= ~DEV_PRESENT;
- if (link->state & DEV_CONFIG)
- chip->chip_status |= VX_STAT_IS_STALE;
- break;
- case CS_EVENT_CARD_INSERTION:
- snd_printdd(KERN_DEBUG "CARD_INSERTION..\n");
- link->state |= DEV_PRESENT | DEV_CONFIG_PENDING;
- vxpocket_config(link);
- break;
-#ifdef CONFIG_PM
- case CS_EVENT_PM_SUSPEND:
- snd_printdd(KERN_DEBUG "SUSPEND\n");
- link->state |= DEV_SUSPEND;
- if (chip && chip->card->pm_suspend) {
- snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n");
- chip->card->pm_suspend(chip->card, PMSG_SUSPEND);
- }
- /* Fall through... */
- case CS_EVENT_RESET_PHYSICAL:
- snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
- if (link->state & DEV_CONFIG)
- pcmcia_release_configuration(link->handle);
- break;
- case CS_EVENT_PM_RESUME:
- snd_printdd(KERN_DEBUG "RESUME\n");
- link->state &= ~DEV_SUSPEND;
- /* Fall through... */
- case CS_EVENT_CARD_RESET:
- snd_printdd(KERN_DEBUG "CARD_RESET\n");
- if (DEV_OK(link)) {
- //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
- snd_printdd(KERN_DEBUG "requestconfig...\n");
- pcmcia_request_configuration(link->handle, &link->conf);
- if (chip && chip->card->pm_resume) {
- snd_printdd(KERN_DEBUG "calling snd_vx_resume\n");
- chip->card->pm_resume(chip->card);
- }
+ dev_link_t *link = dev_to_instance(dev);
+ struct vx_core *chip = link->priv;
+
+ snd_printdd(KERN_DEBUG "SUSPEND\n");
+ link->state |= DEV_SUSPEND;
+ if (chip) {
+ snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n");
+ snd_vx_suspend(chip, PMSG_SUSPEND);
+ }
+ snd_printdd(KERN_DEBUG "RESET_PHYSICAL\n");
+ if (link->state & DEV_CONFIG)
+ pcmcia_release_configuration(link->handle);
+
+ return 0;
+}
+
+static int vxp_resume(struct pcmcia_device *dev)
+{
+ dev_link_t *link = dev_to_instance(dev);
+ struct vx_core *chip = link->priv;
+
+ snd_printdd(KERN_DEBUG "RESUME\n");
+ link->state &= ~DEV_SUSPEND;
+
+ snd_printdd(KERN_DEBUG "CARD_RESET\n");
+ if (DEV_OK(link)) {
+ //struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
+ snd_printdd(KERN_DEBUG "requestconfig...\n");
+ pcmcia_request_configuration(link->handle, &link->conf);
+ if (chip) {
+ snd_printdd(KERN_DEBUG "calling snd_vx_resume\n");
+ snd_vx_resume(chip);
}
- snd_printdd(KERN_DEBUG "resume done!\n");
- break;
-#endif
}
+ snd_printdd(KERN_DEBUG "resume done!\n");
+
return 0;
}
+#endif
+
/*
*/
-static dev_link_t *vxpocket_attach(void)
+static int vxpocket_attach(struct pcmcia_device *p_dev)
{
- snd_card_t *card;
+ struct snd_card *card;
struct snd_vxpocket *vxp;
int i;
@@ -390,54 +346,52 @@ static dev_link_t *vxpocket_attach(void)
}
if (i >= SNDRV_CARDS) {
snd_printk(KERN_ERR "vxpocket: too many cards found\n");
- return NULL;
+ return -EINVAL;
}
if (! enable[i])
- return NULL; /* disabled explicitly */
+ return -ENODEV; /* disabled explicitly */
/* ok, create a card instance */
card = snd_card_new(index[i], id[i], THIS_MODULE, 0);
if (card == NULL) {
snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n");
- return NULL;
+ return -ENOMEM;
}
vxp = snd_vxpocket_new(card, ibl[i]);
if (! vxp) {
snd_card_free(card);
- return NULL;
+ return -ENODEV;
}
+ card->private_data = vxp;
vxp->index = i;
card_alloc |= 1 << i;
/* Chain drivers */
- vxp->link.next = dev_list;
- dev_list = &vxp->link;
+ vxp->link.next = NULL;
+
+ vxp->link.handle = p_dev;
+ vxp->link.state |= DEV_PRESENT | DEV_CONFIG_PENDING;
+ p_dev->instance = &vxp->link;
+ vxpocket_config(&vxp->link);
- return &vxp->link;
+ return 0;
}
-static void vxpocket_detach(dev_link_t *link)
+static void vxpocket_detach(struct pcmcia_device *p_dev)
{
+ dev_link_t *link = dev_to_instance(p_dev);
struct snd_vxpocket *vxp;
- vx_core_t *chip;
- dev_link_t **linkp;
+ struct vx_core *chip;
if (! link)
return;
vxp = link->priv;
- chip = (vx_core_t *)vxp;
+ chip = (struct vx_core *)vxp;
card_alloc &= ~(1 << vxp->index);
- /* Remove the interface data from the linked list */
- for (linkp = &dev_list; *linkp; linkp = &(*linkp)->next)
- if (*linkp == link) {
- *linkp = link->next;
- break;
- }
-
chip->chip_status |= VX_STAT_IS_STALE; /* to be sure */
snd_card_disconnect(chip->card);
vxpocket_release(link);
@@ -459,10 +413,13 @@ static struct pcmcia_driver vxp_cs_driver = {
.drv = {
.name = "snd-vxpocket",
},
- .attach = vxpocket_attach,
- .detach = vxpocket_detach,
- .event = vxpocket_event,
+ .probe = vxpocket_attach,
+ .remove = vxpocket_detach,
.id_table = vxp_ids,
+#ifdef CONFIG_PM
+ .suspend = vxp_suspend,
+ .resume = vxp_resume,
+#endif
};
static int __init init_vxpocket(void)
@@ -473,7 +430,6 @@ static int __init init_vxpocket(void)
static void __exit exit_vxpocket(void)
{
pcmcia_unregister_driver(&vxp_cs_driver);
- BUG_ON(dev_list != NULL);
}
module_init(init_vxpocket);
diff --git a/sound/pcmcia/vx/vxpocket.h b/sound/pcmcia/vx/vxpocket.h
index 70754aa..67efae3 100644
--- a/sound/pcmcia/vx/vxpocket.h
+++ b/sound/pcmcia/vx/vxpocket.h
@@ -30,7 +30,7 @@
struct snd_vxpocket {
- vx_core_t core;
+ struct vx_core core;
unsigned long port;
@@ -48,10 +48,10 @@ struct snd_vxpocket {
extern struct snd_vx_ops snd_vxpocket_ops;
-void vx_set_mic_boost(vx_core_t *chip, int boost);
-void vx_set_mic_level(vx_core_t *chip, int level);
+void vx_set_mic_boost(struct vx_core *chip, int boost);
+void vx_set_mic_level(struct vx_core *chip, int level);
-int vxp_add_mic_controls(vx_core_t *chip);
+int vxp_add_mic_controls(struct vx_core *chip);
/* Constants used to access the CDSP register (0x08). */
#define CDSP_MAGIC 0xA7 /* magic value (for read) */
OpenPOWER on IntegriCloud