From c3e6f7d8763fa0400d28c57633eb323515ba05fc Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Wed, 16 Nov 2005 18:43:35 +0100 Subject: [ALSA] Remove superfluous pcm_free callbacks Remove superflous pcm_free callbacks. Signed-off-by: Takashi Iwai --- sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c index 20b86d8df7a..d54033ebd5e 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c @@ -324,15 +324,6 @@ 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 */ @@ -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; -- cgit v1.2.3 From bdbae7e62837c22c5399df0789a24e9d8a1d675f Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 17 Nov 2005 10:21:19 +0100 Subject: [ALSA] Remove snd_vx_delay() function Replace snd_vx_delay() with appropriate delay/sleep functions. Signed-off-by: Takashi Iwai --- sound/pcmcia/vx/vxp_ops.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/vx/vxp_ops.c b/sound/pcmcia/vx/vxp_ops.c index 6f15c3d03ab..2754d657a4d 100644 --- a/sound/pcmcia/vx/vxp_ops.c +++ b/sound/pcmcia/vx/vxp_ops.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; @@ -134,12 +134,12 @@ static void vxp_reset_codec(vx_core_t *_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); } /* @@ -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); -- cgit v1.2.3 From af26367f69a474ed809e4a59abb5855b47daaff4 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 17 Nov 2005 14:46:59 +0100 Subject: [ALSA] Remove xxx_t typedefs: VXdriver Remove xxx_t typedefs from the VXdriver codes (vx_core support, vx222 and vxpocket). Signed-off-by: Takashi Iwai --- sound/pcmcia/vx/vxp_mixer.c | 26 ++++++++++++------------ sound/pcmcia/vx/vxp_ops.c | 48 ++++++++++++++++++++++----------------------- sound/pcmcia/vx/vxpocket.c | 26 ++++++++++++------------ sound/pcmcia/vx/vxpocket.h | 8 ++++---- 4 files changed, 54 insertions(+), 54 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/vx/vxp_mixer.c b/sound/pcmcia/vx/vxp_mixer.c index aeaef3d8180..9450149b931 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 2754d657a4d..7f82f619f9f 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; @@ -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,7 +127,7 @@ 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; @@ -146,7 +146,7 @@ static void vxp_reset_codec(vx_core_t *_chip) * 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; @@ -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 1e8f16b4c07..00962971414 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -83,9 +83,9 @@ static void vxpocket_release(dev_link_t *link) /* * 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 +142,19 @@ 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; @@ -218,10 +218,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 +250,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; @@ -324,7 +324,7 @@ failed: static int vxpocket_event(event_t event, int priority, event_callback_args_t *args) { dev_link_t *link = args->client_data; - vx_core_t *chip = link->priv; + struct vx_core *chip = link->priv; switch (event) { case CS_EVENT_CARD_REMOVAL: @@ -379,7 +379,7 @@ static int vxpocket_event(event_t event, int priority, event_callback_args_t *ar */ static dev_link_t *vxpocket_attach(void) { - snd_card_t *card; + struct snd_card *card; struct snd_vxpocket *vxp; int i; @@ -421,14 +421,14 @@ static dev_link_t *vxpocket_attach(void) static void vxpocket_detach(dev_link_t *link) { struct snd_vxpocket *vxp; - vx_core_t *chip; + struct vx_core *chip; dev_link_t **linkp; 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 */ diff --git a/sound/pcmcia/vx/vxpocket.h b/sound/pcmcia/vx/vxpocket.h index 70754aa3dd1..67efae3f6c8 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) */ -- cgit v1.2.3 From db13154843cb2c99a93e9feed575e906f6e0e455 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 17 Nov 2005 15:07:38 +0100 Subject: [ALSA] Remove xxx_t typedefs: PCMCIA PDaudioCF Modules: PDAudioCF driver Remove xxx_t typedefs from the PCMCIA PDaudioCF driver. Signed-off-by: Takashi Iwai --- sound/pcmcia/pdaudiocf/pdaudiocf.c | 24 +++++++-------- sound/pcmcia/pdaudiocf/pdaudiocf.h | 30 +++++++++---------- sound/pcmcia/pdaudiocf/pdaudiocf_core.c | 42 +++++++++++++------------- sound/pcmcia/pdaudiocf/pdaudiocf_irq.c | 6 ++-- sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 52 ++++++++++++++++----------------- 5 files changed, 77 insertions(+), 77 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index d6918b453f2..0ba335d045f 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; @@ -231,7 +231,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 +261,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 +318,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: diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.h b/sound/pcmcia/pdaudiocf/pdaudiocf.h index c7a9628256e..ad8f32eedce 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_card *card, pm_message_t state); +int snd_pdacf_resume(struct snd_card *card); #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..4f898238e0a 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,9 +255,9 @@ 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_card *card, pm_message_t state) { - pdacf_t *chip = card->pm_private_data; + struct snd_pdacf *chip = card->pm_private_data; u16 val; snd_pcm_suspend_all(chip->pcm); @@ -270,14 +270,14 @@ 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_card *card) { - pdacf_t *chip = card->pm_private_data; + struct snd_pdacf *chip = card->pm_private_data; int timeout = 40; pdacf_reinit(chip, 1); 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 d54033ebd5e..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, @@ -327,9 +327,9 @@ static snd_pcm_ops_t pdacf_pcm_capture_ops = { /* * 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); -- cgit v1.2.3 From 0ed1cad172176a4595f82e8cd9055938ad54bd4b Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 17 Nov 2005 16:06:05 +0100 Subject: [ALSA] vx-driver - Fix PM support Fix PM support on VX drivers (vxpocket and vx222). Signed-off-by: Takashi Iwai --- sound/pcmcia/vx/vxpocket.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 00962971414..5bb079d1795 100644 --- a/sound/pcmcia/vx/vxpocket.c +++ b/sound/pcmcia/vx/vxpocket.c @@ -342,9 +342,9 @@ static int vxpocket_event(event_t event, int priority, event_callback_args_t *ar case CS_EVENT_PM_SUSPEND: snd_printdd(KERN_DEBUG "SUSPEND\n"); link->state |= DEV_SUSPEND; - if (chip && chip->card->pm_suspend) { + if (chip) { snd_printdd(KERN_DEBUG "snd_vx_suspend calling\n"); - chip->card->pm_suspend(chip->card, PMSG_SUSPEND); + snd_vx_suspend(chip, PMSG_SUSPEND); } /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: @@ -362,9 +362,9 @@ static int vxpocket_event(event_t event, int priority, event_callback_args_t *ar //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) { + if (chip) { snd_printdd(KERN_DEBUG "calling snd_vx_resume\n"); - chip->card->pm_resume(chip->card); + snd_vx_resume(chip); } } snd_printdd(KERN_DEBUG "resume done!\n"); @@ -407,6 +407,7 @@ static dev_link_t *vxpocket_attach(void) snd_card_free(card); return NULL; } + card->private_data = vxp; vxp->index = i; card_alloc |= 1 << i; -- cgit v1.2.3 From e4f163d96080dda40fd02df725f3672d035e4c5a Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 17 Nov 2005 17:15:58 +0100 Subject: [ALSA] pdaudiocf - Fix PM support Modules: PDAudioCF driver Fix the PM support on pdaudiocf driver. Signed-off-by: Takashi Iwai --- sound/pcmcia/pdaudiocf/pdaudiocf.c | 6 ++---- sound/pcmcia/pdaudiocf/pdaudiocf.h | 4 ++-- sound/pcmcia/pdaudiocf/pdaudiocf_core.c | 8 ++++---- 3 files changed, 8 insertions(+), 10 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index 0ba335d045f..a7cd2d4df75 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c @@ -217,8 +217,6 @@ static int snd_pdacf_assign_resources(struct snd_pdacf *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; @@ -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 ad8f32eedce..2744f189a61 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf.h +++ b/sound/pcmcia/pdaudiocf/pdaudiocf.h @@ -134,8 +134,8 @@ 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(struct snd_card *card, pm_message_t state); -int snd_pdacf_resume(struct snd_card *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(struct snd_pdacf *chip); irqreturn_t pdacf_interrupt(int irq, void *dev, struct pt_regs *regs); diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c index 4f898238e0a..bd0d70ff301 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c @@ -255,11 +255,11 @@ void snd_pdacf_powerdown(struct snd_pdacf *chip) #ifdef CONFIG_PM -int snd_pdacf_suspend(struct snd_card *card, pm_message_t state) +int snd_pdacf_suspend(struct snd_pdacf *chip, pm_message_t state) { - struct snd_pdacf *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); @@ -275,9 +275,8 @@ static inline int check_signal(struct snd_pdacf *chip) return (chip->ak4117->rcs0 & AK4117_UNLCK) == 0; } -int snd_pdacf_resume(struct snd_card *card) +int snd_pdacf_resume(struct snd_pdacf *chip) { - struct snd_pdacf *chip = card->pm_private_data; int timeout = 40; pdacf_reinit(chip, 1); @@ -286,6 +285,7 @@ int snd_pdacf_resume(struct snd_card *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 -- cgit v1.2.3 From efe3cd105f2a19e72ce9280bb22c7c80752e4314 Mon Sep 17 00:00:00 2001 From: Dominik Brodowski Date: Fri, 6 Jan 2006 00:27:16 +0100 Subject: [PATCH] pcmcia: fix sound drivers Update the PCMCIA sound drivers to handle the recent changes to the PCMCIA core. A part of this merge was done by Takashi Iwai . Signed-off-by: Dominik Brodowski --- sound/pcmcia/pdaudiocf/pdaudiocf.c | 154 ++++++++++++++---------------------- sound/pcmcia/vx/vxpocket.c | 155 +++++++++++++------------------------ 2 files changed, 115 insertions(+), 194 deletions(-) (limited to 'sound/pcmcia') diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c index a7cd2d4df75..77caf43a310 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 struct snd_card *card_list[SNDRV_CARDS]; -static dev_link_t *dev_list; /* * 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) { @@ -83,10 +80,6 @@ static int snd_pdacf_free(struct snd_pdacf *pdacf) 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; @@ -103,11 +96,10 @@ static int snd_pdacf_dev_free(struct snd_device *device) /* * 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; + int i; + dev_link_t *link; /* Info for cardmgr */ struct snd_pdacf *pdacf; struct snd_card *card; static struct snd_device_ops ops = { @@ -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; } @@ -227,21 +209,13 @@ static int snd_pdacf_assign_resources(struct snd_pdacf *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) { + 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 */ @@ -310,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) +#ifdef CONFIG_PM + +static int pdacf_suspend(struct pcmcia_device *dev) { - dev_link_t *link = args->client_data; + dev_link_t *link = dev_to_instance(dev); struct snd_pdacf *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; + 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, 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); - } + 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 */ @@ -380,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) @@ -394,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/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c index 5bb079d1795..66900d20a42 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,11 +68,6 @@ 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; - } } /* @@ -144,11 +134,9 @@ static struct snd_vx_hardware vxp440_hw = { */ 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 */ struct vx_core *chip; struct snd_vxpocket *vxp; - int ret; static struct snd_device_ops ops = { .dev_free = snd_vxpocket_dev_free, }; @@ -184,26 +172,6 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *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; } @@ -317,67 +285,55 @@ 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; + dev_link_t *link = dev_to_instance(dev); struct vx_core *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; + 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 "snd_vx_suspend calling\n"); - snd_vx_suspend(chip, PMSG_SUSPEND); + snd_printdd(KERN_DEBUG "calling snd_vx_resume\n"); + snd_vx_resume(chip); } - /* 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) { - 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) { struct snd_card *card; struct snd_vxpocket *vxp; @@ -390,22 +346,22 @@ 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; @@ -413,17 +369,21 @@ static dev_link_t *vxpocket_attach(void) 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; struct vx_core *chip; - dev_link_t **linkp; if (! link) return; @@ -432,13 +392,6 @@ static void vxpocket_detach(dev_link_t *link) 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); @@ -460,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) @@ -474,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); -- cgit v1.2.3