gusmax.c (f0eef25339f92f7cd4aeea23d9ae97987a5a1e82) gusmax.c (788c6043335590e0a483fdc18f85b1405a157bf9)
1/*
2 * Driver for Gravis UltraSound MAX soundcard
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 71 unchanged lines hidden (view full) ---

80 struct snd_gus_card *gus;
81 struct snd_cs4231 *cs4231;
82 unsigned short gus_status_reg;
83 unsigned short pcm_status_reg;
84};
85
86#define PFX "gusmax: "
87
1/*
2 * Driver for Gravis UltraSound MAX soundcard
3 * Copyright (c) by Jaroslav Kysela <perex@suse.cz>
4 *
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or

--- 71 unchanged lines hidden (view full) ---

80 struct snd_gus_card *gus;
81 struct snd_cs4231 *cs4231;
82 unsigned short gus_status_reg;
83 unsigned short pcm_status_reg;
84};
85
86#define PFX "gusmax: "
87
88static int __init snd_gusmax_detect(struct snd_gus_card * gus)
88static int __devinit snd_gusmax_detect(struct snd_gus_card * gus)
89{
90 unsigned char d;
91
92 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
93 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
94 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
95 return -ENODEV;
96 }

--- 25 unchanged lines hidden (view full) ---

122 handled = 1;
123 snd_cs4231_interrupt(irq, maxcard->cs4231);
124 loop++;
125 }
126 } while (loop && --max > 0);
127 return IRQ_RETVAL(handled);
128}
129
89{
90 unsigned char d;
91
92 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
93 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
94 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
95 return -ENODEV;
96 }

--- 25 unchanged lines hidden (view full) ---

122 handled = 1;
123 snd_cs4231_interrupt(irq, maxcard->cs4231);
124 loop++;
125 }
126 } while (loop && --max > 0);
127 return IRQ_RETVAL(handled);
128}
129
130static void __init snd_gusmax_init(int dev, struct snd_card *card, struct snd_gus_card * gus)
130static void __devinit snd_gusmax_init(int dev, struct snd_card *card,
131 struct snd_gus_card * gus)
131{
132 gus->equal_irq = 1;
133 gus->codec_flag = 1;
134 gus->joystick_dac = joystick_dac[dev];
135 /* init control register */
136 gus->max_cntrl_val = (gus->gf1.port >> 4) & 0x0f;
137 if (gus->gf1.dma1 > 3)
138 gus->max_cntrl_val |= 0x10;
139 if (gus->gf1.dma2 > 3)
140 gus->max_cntrl_val |= 0x20;
141 gus->max_cntrl_val |= 0x40;
142 outb(gus->max_cntrl_val, GUSP(gus, MAXCNTRLPORT));
143}
144
145#define CS4231_PRIVATE( left, right, shift, mute ) \
146 ((left << 24)|(right << 16)|(shift<<8)|mute)
147
132{
133 gus->equal_irq = 1;
134 gus->codec_flag = 1;
135 gus->joystick_dac = joystick_dac[dev];
136 /* init control register */
137 gus->max_cntrl_val = (gus->gf1.port >> 4) & 0x0f;
138 if (gus->gf1.dma1 > 3)
139 gus->max_cntrl_val |= 0x10;
140 if (gus->gf1.dma2 > 3)
141 gus->max_cntrl_val |= 0x20;
142 gus->max_cntrl_val |= 0x40;
143 outb(gus->max_cntrl_val, GUSP(gus, MAXCNTRLPORT));
144}
145
146#define CS4231_PRIVATE( left, right, shift, mute ) \
147 ((left << 24)|(right << 16)|(shift<<8)|mute)
148
148static int __init snd_gusmax_mixer(struct snd_cs4231 *chip)
149static int __devinit snd_gusmax_mixer(struct snd_cs4231 *chip)
149{
150 struct snd_card *card = chip->card;
151 struct snd_ctl_elem_id id1, id2;
152 int err;
153
154 memset(&id1, 0, sizeof(id1));
155 memset(&id2, 0, sizeof(id2));
156 id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;

--- 42 unchanged lines hidden (view full) ---

199 struct snd_gusmax *maxcard = (struct snd_gusmax *)card->private_data;
200
201 if (maxcard == NULL)
202 return;
203 if (maxcard->irq >= 0)
204 free_irq(maxcard->irq, (void *)maxcard);
205}
206
150{
151 struct snd_card *card = chip->card;
152 struct snd_ctl_elem_id id1, id2;
153 int err;
154
155 memset(&id1, 0, sizeof(id1));
156 memset(&id2, 0, sizeof(id2));
157 id1.iface = id2.iface = SNDRV_CTL_ELEM_IFACE_MIXER;

--- 42 unchanged lines hidden (view full) ---

200 struct snd_gusmax *maxcard = (struct snd_gusmax *)card->private_data;
201
202 if (maxcard == NULL)
203 return;
204 if (maxcard->irq >= 0)
205 free_irq(maxcard->irq, (void *)maxcard);
206}
207
207static int __init snd_gusmax_probe(struct platform_device *pdev)
208static int __devinit snd_gusmax_probe(struct platform_device *pdev)
208{
209 int dev = pdev->id;
210 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
211 static int possible_dmas[] = {5, 6, 7, 1, 3, -1};
212 int xirq, xdma1, xdma2, err;
213 struct snd_card *card;
214 struct snd_gus_card *gus = NULL;
215 struct snd_cs4231 *cs4231;

--- 127 unchanged lines hidden (view full) ---

343 platform_set_drvdata(pdev, card);
344 return 0;
345
346 _err:
347 snd_card_free(card);
348 return err;
349}
350
209{
210 int dev = pdev->id;
211 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
212 static int possible_dmas[] = {5, 6, 7, 1, 3, -1};
213 int xirq, xdma1, xdma2, err;
214 struct snd_card *card;
215 struct snd_gus_card *gus = NULL;
216 struct snd_cs4231 *cs4231;

--- 127 unchanged lines hidden (view full) ---

344 platform_set_drvdata(pdev, card);
345 return 0;
346
347 _err:
348 snd_card_free(card);
349 return err;
350}
351
351static int snd_gusmax_remove(struct platform_device *devptr)
352static int __devexit snd_gusmax_remove(struct platform_device *devptr)
352{
353 snd_card_free(platform_get_drvdata(devptr));
354 platform_set_drvdata(devptr, NULL);
355 return 0;
356}
357
358#define GUSMAX_DRIVER "snd_gusmax"
359
360static struct platform_driver snd_gusmax_driver = {
361 .probe = snd_gusmax_probe,
353{
354 snd_card_free(platform_get_drvdata(devptr));
355 platform_set_drvdata(devptr, NULL);
356 return 0;
357}
358
359#define GUSMAX_DRIVER "snd_gusmax"
360
361static struct platform_driver snd_gusmax_driver = {
362 .probe = snd_gusmax_probe,
362 .remove = snd_gusmax_remove,
363 .remove = __devexit_p(snd_gusmax_remove),
363 /* FIXME: suspend/resume */
364 .driver = {
365 .name = GUSMAX_DRIVER
366 },
367};
368
369static void __init_or_module snd_gusmax_unregister_all(void)
370{

--- 48 unchanged lines hidden ---
364 /* FIXME: suspend/resume */
365 .driver = {
366 .name = GUSMAX_DRIVER
367 },
368};
369
370static void __init_or_module snd_gusmax_unregister_all(void)
371{

--- 48 unchanged lines hidden ---