diff options
Diffstat (limited to 'sound/pcmcia/pdaudiocf')
-rw-r--r-- | sound/pcmcia/pdaudiocf/pdaudiocf.c | 30 | ||||
-rw-r--r-- | sound/pcmcia/pdaudiocf/pdaudiocf.h | 30 | ||||
-rw-r--r-- | sound/pcmcia/pdaudiocf/pdaudiocf_core.c | 42 | ||||
-rw-r--r-- | sound/pcmcia/pdaudiocf/pdaudiocf_irq.c | 6 | ||||
-rw-r--r-- | sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 62 |
5 files changed, 79 insertions, 91 deletions
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index d6918b453f2..a7cd2d4df75 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -53,7 +53,7 @@ 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 struct snd_card *card_list[SNDRV_CARDS]; static dev_link_t *dev_list; /* @@ -77,7 +77,7 @@ 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; @@ -94,9 +94,9 @@ 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); } @@ -108,9 +108,9 @@ static dev_link_t *snd_pdacf_attach(void) 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 = { + struct snd_pdacf *pdacf; + struct snd_card *card; + static struct snd_device_ops ops = { .dev_free = snd_pdacf_dev_free, }; @@ -194,10 +194,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 +217,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; @@ -231,7 +229,7 @@ static int snd_pdacf_assign_resources(pdacf_t *pdacf, int port, int irq) */ static void snd_pdacf_detach(dev_link_t *link) { - pdacf_t *chip = link->priv; + struct snd_pdacf *chip = link->priv; snd_printdd(KERN_DEBUG "pdacf_detach called\n"); /* Remove the interface data from the linked list */ @@ -261,7 +259,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; @@ -318,7 +316,7 @@ failed: 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; + struct snd_pdacf *chip = link->priv; switch (event) { case CS_EVENT_CARD_REMOVAL: @@ -339,7 +337,7 @@ static int pdacf_event(event_t event, int priority, event_callback_args_t *args) link->state |= DEV_SUSPEND; if (chip) { snd_printdd(KERN_DEBUG "snd_pdacf_suspend calling\n"); - snd_pdacf_suspend(chip->card, PMSG_SUSPEND); + snd_pdacf_suspend(chip, PMSG_SUSPEND); } /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: @@ -358,7 +356,7 @@ static int pdacf_event(event_t event, int priority, event_callback_args_t *args) pcmcia_request_configuration(link->handle, &link->conf); if (chip) { snd_printdd(KERN_DEBUG "calling snd_pdacf_resume\n"); - snd_pdacf_resume(chip->card); + snd_pdacf_resume(chip); } } snd_printdd(KERN_DEBUG "resume done!\n"); diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h index c7a9628256e..2744f189a61 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 0208c54896b..bd0d70ff301 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 255b63444b5..7c5f21e45cb 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 20b86d8df7a..09cb250d582 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; |