diff options
Diffstat (limited to 'sound/isa/ad1848')
-rw-r--r-- | sound/isa/ad1848/ad1848.c | 105 | ||||
-rw-r--r-- | sound/isa/ad1848/ad1848_lib.c | 206 |
2 files changed, 188 insertions, 123 deletions
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c index 3ebcc482b07..e091bbeffd2 100644 --- a/sound/isa/ad1848/ad1848.c +++ b/sound/isa/ad1848/ad1848.c @@ -23,6 +23,8 @@ #include <sound/driver.h> #include <linux/init.h> +#include <linux/err.h> +#include <linux/platform_device.h> #include <linux/time.h> #include <linux/wait.h> #include <linux/moduleparam.h> @@ -60,14 +62,15 @@ MODULE_PARM_DESC(dma1, "DMA1 # for AD1848 driver."); module_param_array(thinkpad, bool, NULL, 0444); MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series."); -static snd_card_t *snd_ad1848_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; +static struct platform_device *devices[SNDRV_CARDS]; -static int __init snd_card_ad1848_probe(int dev) +static int __init snd_ad1848_probe(struct platform_device *pdev) { - snd_card_t *card; - ad1848_t *chip; - snd_pcm_t *pcm; + int dev = pdev->id; + struct snd_card *card; + struct snd_ad1848 *chip; + struct snd_pcm *pcm; int err; if (port[dev] == SNDRV_AUTO_PORT) { @@ -93,6 +96,7 @@ static int __init snd_card_ad1848_probe(int dev) thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, &chip)) < 0) goto _err; + card->private_data = chip; if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) goto _err; @@ -109,13 +113,12 @@ static int __init snd_card_ad1848_probe(int dev) if (thinkpad[dev]) strcat(card->longname, " [Thinkpad]"); - if ((err = snd_card_set_generic_dev(card)) < 0) - goto _err; + snd_card_set_dev(card, &pdev->dev); if ((err = snd_card_register(card)) < 0) goto _err; - snd_ad1848_cards[dev] = card; + platform_set_drvdata(pdev, card); return 0; _err: @@ -123,29 +126,95 @@ static int __init snd_card_ad1848_probe(int dev) return err; } -static int __init alsa_card_ad1848_init(void) +static int __devexit snd_ad1848_remove(struct platform_device *devptr) +{ + snd_card_free(platform_get_drvdata(devptr)); + platform_set_drvdata(devptr, NULL); + return 0; +} + +#ifdef CONFIG_PM +static int snd_ad1848_suspend(struct platform_device *pdev, pm_message_t state) +{ + struct snd_card *card = platform_get_drvdata(pdev); + struct snd_ad1848 *chip = card->private_data; + + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + chip->suspend(chip); + return 0; +} + +static int snd_ad1848_resume(struct platform_device *pdev) { - int dev, cards; + struct snd_card *card = platform_get_drvdata(pdev); + struct snd_ad1848 *chip = card->private_data; - for (dev = cards = 0; dev < SNDRV_CARDS && enable[dev]; dev++) - if (snd_card_ad1848_probe(dev) >= 0) - cards++; + chip->resume(chip); + snd_power_change_state(card, SNDRV_CTL_POWER_D0); + return 0; +} +#endif +#define SND_AD1848_DRIVER "snd_ad1848" + +static struct platform_driver snd_ad1848_driver = { + .probe = snd_ad1848_probe, + .remove = __devexit_p(snd_ad1848_remove), +#ifdef CONFIG_PM + .suspend = snd_ad1848_suspend, + .resume = snd_ad1848_resume, +#endif + .driver = { + .name = SND_AD1848_DRIVER + }, +}; + +static void __init_or_module snd_ad1848_unregister_all(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(devices); ++i) + platform_device_unregister(devices[i]); + platform_driver_unregister(&snd_ad1848_driver); +} + +static int __init alsa_card_ad1848_init(void) +{ + int i, cards, err; + + err = platform_driver_register(&snd_ad1848_driver); + if (err < 0) + return err; + + cards = 0; + for (i = 0; i < SNDRV_CARDS && enable[i]; i++) { + struct platform_device *device; + device = platform_device_register_simple(SND_AD1848_DRIVER, + i, NULL, 0); + if (IS_ERR(device)) { + err = PTR_ERR(device); + goto errout; + } + devices[i] = device; + cards++; + } if (!cards) { #ifdef MODULE printk(KERN_ERR "AD1848 soundcard not found or device busy\n"); #endif - return -ENODEV; + err = -ENODEV; + goto errout; } return 0; + + errout: + snd_ad1848_unregister_all(); + return err; } static void __exit alsa_card_ad1848_exit(void) { - int idx; - - for (idx = 0; idx < SNDRV_CARDS; idx++) - snd_card_free(snd_ad1848_cards[idx]); + snd_ad1848_unregister_all(); } module_init(alsa_card_ad1848_init) diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c index 891bacc94f6..b78530d7ea9 100644 --- a/sound/isa/ad1848/ad1848_lib.c +++ b/sound/isa/ad1848/ad1848_lib.c @@ -24,7 +24,6 @@ #include <linux/delay.h> #include <linux/init.h> #include <linux/interrupt.h> -#include <linux/pm.h> #include <linux/slab.h> #include <linux/ioport.h> #include <sound/core.h> @@ -69,7 +68,7 @@ static unsigned int rates[14] = { 27042, 32000, 33075, 37800, 44100, 48000 }; -static snd_pcm_hw_constraint_list_t hw_constraints_rates = { +static struct snd_pcm_hw_constraint_list hw_constraints_rates = { .count = 14, .list = rates, .mask = 0, @@ -99,7 +98,7 @@ static unsigned char snd_ad1848_original_image[16] = * Basic I/O functions */ -void snd_ad1848_out(ad1848_t *chip, +void snd_ad1848_out(struct snd_ad1848 *chip, unsigned char reg, unsigned char value) { @@ -119,7 +118,7 @@ void snd_ad1848_out(ad1848_t *chip, #endif } -static void snd_ad1848_dout(ad1848_t *chip, +static void snd_ad1848_dout(struct snd_ad1848 *chip, unsigned char reg, unsigned char value) { int timeout; @@ -131,7 +130,7 @@ static void snd_ad1848_dout(ad1848_t *chip, mb(); } -static unsigned char snd_ad1848_in(ad1848_t *chip, unsigned char reg) +static unsigned char snd_ad1848_in(struct snd_ad1848 *chip, unsigned char reg) { int timeout; @@ -148,7 +147,7 @@ static unsigned char snd_ad1848_in(ad1848_t *chip, unsigned char reg) #if 0 -static void snd_ad1848_debug(ad1848_t *chip) +static void snd_ad1848_debug(struct snd_ad1848 *chip) { printk("AD1848 REGS: INDEX = 0x%02x ", inb(AD1848P(chip, REGSEL))); printk(" STATUS = 0x%02x\n", inb(AD1848P(chip, STATUS))); @@ -176,7 +175,7 @@ static void snd_ad1848_debug(ad1848_t *chip) * AD1848 detection / MCE routines */ -static void snd_ad1848_mce_up(ad1848_t *chip) +static void snd_ad1848_mce_up(struct snd_ad1848 *chip) { unsigned long flags; int timeout; @@ -197,7 +196,7 @@ static void snd_ad1848_mce_up(ad1848_t *chip) spin_unlock_irqrestore(&chip->reg_lock, flags); } -static void snd_ad1848_mce_down(ad1848_t *chip) +static void snd_ad1848_mce_down(struct snd_ad1848 *chip) { unsigned long flags; int timeout; @@ -279,7 +278,7 @@ static unsigned int snd_ad1848_get_count(unsigned char format, return size; } -static int snd_ad1848_trigger(ad1848_t *chip, unsigned char what, +static int snd_ad1848_trigger(struct snd_ad1848 *chip, unsigned char what, int channel, int cmd) { int result = 0; @@ -324,7 +323,7 @@ static unsigned char snd_ad1848_get_rate(unsigned int rate) return freq_bits[13]; } -static int snd_ad1848_ioctl(snd_pcm_substream_t * substream, +static int snd_ad1848_ioctl(struct snd_pcm_substream *substream, unsigned int cmd, void *arg) { return snd_pcm_lib_ioctl(substream, cmd, arg); @@ -348,7 +347,7 @@ static unsigned char snd_ad1848_get_format(int format, int channels) return rformat; } -static void snd_ad1848_calibrate_mute(ad1848_t *chip, int mute) +static void snd_ad1848_calibrate_mute(struct snd_ad1848 *chip, int mute) { unsigned long flags; @@ -372,7 +371,7 @@ static void snd_ad1848_calibrate_mute(ad1848_t *chip, int mute) spin_unlock_irqrestore(&chip->reg_lock, flags); } -static void snd_ad1848_set_data_format(ad1848_t *chip, snd_pcm_hw_params_t *hw_params) +static void snd_ad1848_set_data_format(struct snd_ad1848 *chip, struct snd_pcm_hw_params *hw_params) { if (hw_params == NULL) { chip->image[AD1848_DATA_FORMAT] = 0x20; @@ -384,7 +383,7 @@ static void snd_ad1848_set_data_format(ad1848_t *chip, snd_pcm_hw_params_t *hw_p // snd_printk(">>> pmode = 0x%x, dfr = 0x%x\n", pstr->mode, chip->image[AD1848_DATA_FORMAT]); } -static int snd_ad1848_open(ad1848_t *chip, unsigned int mode) +static int snd_ad1848_open(struct snd_ad1848 *chip, unsigned int mode) { unsigned long flags; @@ -438,7 +437,7 @@ static int snd_ad1848_open(ad1848_t *chip, unsigned int mode) return 0; } -static void snd_ad1848_close(ad1848_t *chip) +static void snd_ad1848_close(struct snd_ad1848 *chip) { unsigned long flags; @@ -479,24 +478,24 @@ static void snd_ad1848_close(ad1848_t *chip) * ok.. exported functions.. */ -static int snd_ad1848_playback_trigger(snd_pcm_substream_t * substream, +static int snd_ad1848_playback_trigger(struct snd_pcm_substream *substream, int cmd) { - ad1848_t *chip = snd_pcm_substream_chip(substream); + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); return snd_ad1848_trigger(chip, AD1848_PLAYBACK_ENABLE, SNDRV_PCM_STREAM_PLAYBACK, cmd); } -static int snd_ad1848_capture_trigger(snd_pcm_substream_t * substream, +static int snd_ad1848_capture_trigger(struct snd_pcm_substream *substream, int cmd) { - ad1848_t *chip = snd_pcm_substream_chip(substream); + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); return snd_ad1848_trigger(chip, AD1848_CAPTURE_ENABLE, SNDRV_PCM_STREAM_CAPTURE, cmd); } -static int snd_ad1848_playback_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_ad1848_playback_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - ad1848_t *chip = snd_pcm_substream_chip(substream); + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); unsigned long flags; int err; @@ -513,15 +512,15 @@ static int snd_ad1848_playback_hw_params(snd_pcm_substream_t * substream, return 0; } -static int snd_ad1848_playback_hw_free(snd_pcm_substream_t * substream) +static int snd_ad1848_playback_hw_free(struct snd_pcm_substream *substream) { return snd_pcm_lib_free_pages(substream); } -static int snd_ad1848_playback_prepare(snd_pcm_substream_t * substream) +static int snd_ad1848_playback_prepare(struct snd_pcm_substream *substream) { - ad1848_t *chip = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; unsigned long flags; unsigned int size = snd_pcm_lib_buffer_bytes(substream); unsigned int count = snd_pcm_lib_period_bytes(substream); @@ -537,10 +536,10 @@ static int snd_ad1848_playback_prepare(snd_pcm_substream_t * substream) return 0; } -static int snd_ad1848_capture_hw_params(snd_pcm_substream_t * substream, - snd_pcm_hw_params_t * hw_params) +static int snd_ad1848_capture_hw_params(struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *hw_params) { - ad1848_t *chip = snd_pcm_substream_chip(substream); + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); unsigned long flags; int err; @@ -557,15 +556,15 @@ static int snd_ad1848_capture_hw_params(snd_pcm_substream_t * substream, return 0; } -static int snd_ad1848_capture_hw_free(snd_pcm_substream_t * substream) +static int snd_ad1848_capture_hw_free(struct snd_pcm_substream *substream) { return snd_pcm_lib_free_pages(substream); } -static int snd_ad1848_capture_prepare(snd_pcm_substream_t * substream) +static int snd_ad1848_capture_prepare(struct snd_pcm_substream *substream) { - ad1848_t *chip = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; unsigned long flags; unsigned int size = snd_pcm_lib_buffer_bytes(substream); unsigned int count = snd_pcm_lib_period_bytes(substream); @@ -583,7 +582,7 @@ static int snd_ad1848_capture_prepare(snd_pcm_substream_t * substream) static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id, struct pt_regs *regs) { - ad1848_t *chip = dev_id; + struct snd_ad1848 *chip = dev_id; if ((chip->mode & AD1848_MODE_PLAY) && chip->playback_substream && (chip->mode & AD1848_MODE_RUNNING)) @@ -595,9 +594,9 @@ static irqreturn_t snd_ad1848_interrupt(int irq, void *dev_id, struct pt_regs *r return IRQ_HANDLED; } -static snd_pcm_uframes_t snd_ad1848_playback_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_ad1848_playback_pointer(struct snd_pcm_substream *substream) { - ad1848_t *chip = snd_pcm_substream_chip(substream); + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); size_t ptr; if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_PLAYBACK_ENABLE)) @@ -606,9 +605,9 @@ static snd_pcm_uframes_t snd_ad1848_playback_pointer(snd_pcm_substream_t * subst return bytes_to_frames(substream->runtime, ptr); } -static snd_pcm_uframes_t snd_ad1848_capture_pointer(snd_pcm_substream_t * substream) +static snd_pcm_uframes_t snd_ad1848_capture_pointer(struct snd_pcm_substream *substream) { - ad1848_t *chip = snd_pcm_substream_chip(substream); + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); size_t ptr; if (!(chip->image[AD1848_IFACE_CTRL] & AD1848_CAPTURE_ENABLE)) @@ -621,7 +620,7 @@ static snd_pcm_uframes_t snd_ad1848_capture_pointer(snd_pcm_substream_t * substr */ -static void snd_ad1848_thinkpad_twiddle(ad1848_t *chip, int on) { +static void snd_ad1848_thinkpad_twiddle(struct snd_ad1848 *chip, int on) { int tmp; @@ -642,33 +641,34 @@ static void snd_ad1848_thinkpad_twiddle(ad1848_t *chip, int on) { } #ifdef CONFIG_PM -static int snd_ad1848_suspend(snd_card_t *card, pm_message_t state) +static void snd_ad1848_suspend(struct snd_ad1848 *chip) { - ad1848_t *chip = card->pm_private_data; - snd_pcm_suspend_all(chip->pcm); - /* FIXME: save registers? */ - if (chip->thinkpad_flag) snd_ad1848_thinkpad_twiddle(chip, 0); - - return 0; } -static int snd_ad1848_resume(snd_card_t *card) +static void snd_ad1848_resume(struct snd_ad1848 *chip) { - ad1848_t *chip = card->pm_private_data; + int i; if (chip->thinkpad_flag) snd_ad1848_thinkpad_twiddle(chip, 1); - /* FIXME: restore registers? */ + /* clear any pendings IRQ */ + inb(AD1848P(chip, STATUS)); + outb(0, AD1848P(chip, STATUS)); + mb(); - return 0; + snd_ad1848_mce_down(chip); + for (i = 0; i < 16; i++) + snd_ad1848_out(chip, i, chip->image[i]); + snd_ad1848_mce_up(chip); + snd_ad1848_mce_down(chip); } #endif /* CONFIG_PM */ -static int snd_ad1848_probe(ad1848_t * chip) +static int snd_ad1848_probe(struct snd_ad1848 * chip) { unsigned long flags; int i, id, rev, ad1847; @@ -748,7 +748,7 @@ static int snd_ad1848_probe(ad1848_t * chip) */ -static snd_pcm_hardware_t snd_ad1848_playback = +static struct snd_pcm_hardware snd_ad1848_playback = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID), @@ -767,7 +767,7 @@ static snd_pcm_hardware_t snd_ad1848_playback = .fifo_size = 0, }; -static snd_pcm_hardware_t snd_ad1848_capture = +static struct snd_pcm_hardware snd_ad1848_capture = { .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP_VALID), @@ -790,10 +790,10 @@ static snd_pcm_hardware_t snd_ad1848_capture = */ -static int snd_ad1848_playback_open(snd_pcm_substream_t * substream) +static int snd_ad1848_playback_open(struct snd_pcm_substream *substream) { - ad1848_t *chip = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; int err; if ((err = snd_ad1848_open(chip, AD1848_MODE_PLAY)) < 0) @@ -806,10 +806,10 @@ static int snd_ad1848_playback_open(snd_pcm_substream_t * substream) return 0; } -static int snd_ad1848_capture_open(snd_pcm_substream_t * substream) +static int snd_ad1848_capture_open(struct snd_pcm_substream *substream) { - ad1848_t *chip = snd_pcm_substream_chip(substream); - snd_pcm_runtime_t *runtime = substream->runtime; + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); + struct snd_pcm_runtime *runtime = substream->runtime; int err; if ((err = snd_ad1848_open(chip, AD1848_MODE_CAPTURE)) < 0) @@ -822,9 +822,9 @@ static int snd_ad1848_capture_open(snd_pcm_substream_t * substream) return 0; } -static int snd_ad1848_playback_close(snd_pcm_substream_t * substream) +static int snd_ad1848_playback_close(struct snd_pcm_substream *substream) { - ad1848_t *chip = snd_pcm_substream_chip(substream); + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); chip->mode &= ~AD1848_MODE_PLAY; chip->playback_substream = NULL; @@ -832,9 +832,9 @@ static int snd_ad1848_playback_close(snd_pcm_substream_t * substream) return 0; } -static int snd_ad1848_capture_close(snd_pcm_substream_t * substream) +static int snd_ad1848_capture_close(struct snd_pcm_substream *substream) { - ad1848_t *chip = snd_pcm_substream_chip(substream); + struct snd_ad1848 *chip = snd_pcm_substream_chip(substream); chip->mode &= ~AD1848_MODE_CAPTURE; chip->capture_substream = NULL; @@ -842,7 +842,7 @@ static int snd_ad1848_capture_close(snd_pcm_substream_t * substream) return 0; } -static int snd_ad1848_free(ad1848_t *chip) +static int snd_ad1848_free(struct snd_ad1848 *chip) { release_and_free_resource(chip->res_port); if (chip->irq >= 0) @@ -855,13 +855,13 @@ static int snd_ad1848_free(ad1848_t *chip) return 0; } -static int snd_ad1848_dev_free(snd_device_t *device) +static int snd_ad1848_dev_free(struct snd_device *device) { - ad1848_t *chip = device->device_data; + struct snd_ad1848 *chip = device->device_data; return snd_ad1848_free(chip); } -static const char *snd_ad1848_chip_id(ad1848_t *chip) +static const char *snd_ad1848_chip_id(struct snd_ad1848 *chip) { switch (chip->hardware) { case AD1848_HW_AD1847: return "AD1847"; @@ -872,16 +872,16 @@ static const char *snd_ad1848_chip_id(ad1848_t *chip) } } -int snd_ad1848_create(snd_card_t * card, +int snd_ad1848_create(struct snd_card *card, unsigned long port, int irq, int dma, unsigned short hardware, - ad1848_t ** rchip) + struct snd_ad1848 ** rchip) { - static snd_device_ops_t ops = { + static struct snd_device_ops ops = { .dev_free = snd_ad1848_dev_free, }; - ad1848_t *chip; + struct snd_ad1848 *chip; int err; *rchip = NULL; @@ -919,7 +919,6 @@ int snd_ad1848_create(snd_card_t * card, chip->thinkpad_flag = 1; chip->hardware = AD1848_HW_DETECT; /* reset */ snd_ad1848_thinkpad_twiddle(chip, 1); - snd_card_set_isa_pm_callback(card, snd_ad1848_suspend, snd_ad1848_resume, chip); } if (snd_ad1848_probe(chip) < 0) { @@ -933,11 +932,16 @@ int snd_ad1848_create(snd_card_t * card, return err; } +#ifdef CONFIG_PM + chip->suspend = snd_ad1848_suspend; + chip->resume = snd_ad1848_resume; +#endif + *rchip = chip; return 0; } -static snd_pcm_ops_t snd_ad1848_playback_ops = { +static struct snd_pcm_ops snd_ad1848_playback_ops = { .open = snd_ad1848_playback_open, .close = snd_ad1848_playback_close, .ioctl = snd_ad1848_ioctl, @@ -948,7 +952,7 @@ static snd_pcm_ops_t snd_ad1848_playback_ops = { .pointer = snd_ad1848_playback_pointer, }; -static snd_pcm_ops_t snd_ad1848_capture_ops = { +static struct snd_pcm_ops snd_ad1848_capture_ops = { .open = snd_ad1848_capture_open, .close = snd_ad1848_capture_close, .ioctl = snd_ad1848_ioctl, @@ -959,16 +963,9 @@ static snd_pcm_ops_t snd_ad1848_capture_ops = { .pointer = snd_ad1848_capture_pointer, }; -static void snd_ad1848_pcm_free(snd_pcm_t *pcm) -{ - ad1848_t *chip = pcm->private_data; - chip->pcm = NULL; - snd_pcm_lib_preallocate_free_for_all(pcm); -} - -int snd_ad1848_pcm(ad1848_t *chip, int device, snd_pcm_t **rpcm) +int snd_ad1848_pcm(struct snd_ad1848 *chip, int device, struct snd_pcm **rpcm) { - snd_pcm_t *pcm; + struct snd_pcm *pcm; int err; if ((err = snd_pcm_new(chip->card, "AD1848", device, 1, 1, &pcm)) < 0) @@ -977,7 +974,6 @@ int snd_ad1848_pcm(ad1848_t *chip, int device, snd_pcm_t **rpcm) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_ad1848_playback_ops); snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_ad1848_capture_ops); - pcm->private_free = snd_ad1848_pcm_free; pcm->private_data = chip; pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; strcpy(pcm->name, snd_ad1848_chip_id(chip)); @@ -992,7 +988,7 @@ int snd_ad1848_pcm(ad1848_t *chip, int device, snd_pcm_t **rpcm) return 0; } -const snd_pcm_ops_t *snd_ad1848_get_pcm_ops(int direction) +const struct snd_pcm_ops *snd_ad1848_get_pcm_ops(int direction) { return direction == SNDRV_PCM_STREAM_PLAYBACK ? &snd_ad1848_playback_ops : &snd_ad1848_capture_ops; @@ -1002,7 +998,7 @@ const snd_pcm_ops_t *snd_ad1848_get_pcm_ops(int direction) * MIXER part */ -static int snd_ad1848_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ad1848_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { static char *texts[4] = { "Line", "Aux", "Mic", "Mix" @@ -1017,9 +1013,9 @@ static int snd_ad1848_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * u return 0; } -static int snd_ad1848_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ad1848_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - ad1848_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; spin_lock_irqsave(&chip->reg_lock, flags); @@ -1029,9 +1025,9 @@ static int snd_ad1848_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * return 0; } -static int snd_ad1848_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ad1848_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - ad1848_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; unsigned short left, right; int change; @@ -1052,7 +1048,7 @@ static int snd_ad1848_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * return change; } -static int snd_ad1848_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ad1848_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { int mask = (kcontrol->private_value >> 16) & 0xff; @@ -1063,9 +1059,9 @@ static int snd_ad1848_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t return 0; } -static int snd_ad1848_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ad1848_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - ad1848_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff; @@ -1080,9 +1076,9 @@ static int snd_ad1848_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t return 0; } -static int snd_ad1848_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ad1848_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - ad1848_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; int reg = kcontrol->private_value & 0xff; int shift = (kcontrol->private_value >> 8) & 0xff; @@ -1103,7 +1099,7 @@ static int snd_ad1848_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t return change; } -static int snd_ad1848_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) +static int snd_ad1848_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { int mask = (kcontrol->private_value >> 24) & 0xff; @@ -1114,9 +1110,9 @@ static int snd_ad1848_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t return 0; } -static int snd_ad1848_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ad1848_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - ad1848_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; int left_reg = kcontrol->private_value & 0xff; int right_reg = (kcontrol->private_value >> 8) & 0xff; @@ -1136,9 +1132,9 @@ static int snd_ad1848_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t return 0; } -static int snd_ad1848_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) +static int snd_ad1848_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) { - ad1848_t *chip = snd_kcontrol_chip(kcontrol); + struct snd_ad1848 *chip = snd_kcontrol_chip(kcontrol); unsigned long flags; int left_reg = kcontrol->private_value & 0xff; int right_reg = (kcontrol->private_value >> 8) & 0xff; @@ -1175,9 +1171,9 @@ static int snd_ad1848_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t /* */ -int snd_ad1848_add_ctl(ad1848_t *chip, const char *name, int index, int type, unsigned long value) +int snd_ad1848_add_ctl(struct snd_ad1848 *chip, const char *name, int index, int type, unsigned long value) { - static snd_kcontrol_new_t newctls[] = { + static struct snd_kcontrol_new newctls[] = { [AD1848_MIX_SINGLE] = { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .info = snd_ad1848_info_single, @@ -1197,7 +1193,7 @@ int snd_ad1848_add_ctl(ad1848_t *chip, const char *name, int index, int type, un .put = snd_ad1848_put_mux, }, }; - snd_kcontrol_t *ctl; + struct snd_kcontrol *ctl; int err; ctl = snd_ctl_new1(&newctls[type], chip); @@ -1230,10 +1226,10 @@ AD1848_SINGLE("Loopback Capture Switch", 0, AD1848_LOOPBACK, 0, 1, 0), AD1848_SINGLE("Loopback Capture Volume", 0, AD1848_LOOPBACK, 1, 63, 0) }; -int snd_ad1848_mixer(ad1848_t *chip) +int snd_ad1848_mixer(struct snd_ad1848 *chip) { - snd_card_t *card; - snd_pcm_t *pcm; + struct snd_card *card; + struct snd_pcm *pcm; unsigned int idx; int err; |