aboutsummaryrefslogtreecommitdiffstats
path: root/sound/isa
diff options
context:
space:
mode:
Diffstat (limited to 'sound/isa')
-rw-r--r--sound/isa/opl3sa2.c100
1 files changed, 49 insertions, 51 deletions
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 47cabda792b6..a343af70f519 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -115,33 +115,31 @@ MODULE_PARM_DESC(opl3sa3_ymode, "Speaker size selection for 3D Enhancement mode:
115#define OPL3SA2_PM_D0 0x00 115#define OPL3SA2_PM_D0 0x00
116#define OPL3SA2_PM_D3 (OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX) 116#define OPL3SA2_PM_D3 (OPL3SA2_PM_ADOWN|OPL3SA2_PM_PSV|OPL3SA2_PM_PDN|OPL3SA2_PM_PDX)
117 117
118typedef struct snd_opl3sa2 opl3sa2_t;
119
120struct snd_opl3sa2 { 118struct snd_opl3sa2 {
121 snd_card_t *card; 119 struct snd_card *card;
122 int version; /* 2 or 3 */ 120 int version; /* 2 or 3 */
123 unsigned long port; /* control port */ 121 unsigned long port; /* control port */
124 struct resource *res_port; /* control port resource */ 122 struct resource *res_port; /* control port resource */
125 int irq; 123 int irq;
126 int single_dma; 124 int single_dma;
127 spinlock_t reg_lock; 125 spinlock_t reg_lock;
128 snd_hwdep_t *synth; 126 struct snd_hwdep *synth;
129 snd_rawmidi_t *rmidi; 127 struct snd_rawmidi *rmidi;
130 cs4231_t *cs4231; 128 struct snd_cs4231 *cs4231;
131#ifdef CONFIG_PNP 129#ifdef CONFIG_PNP
132 struct pnp_dev *dev; 130 struct pnp_dev *dev;
133#endif 131#endif
134 unsigned char ctlregs[0x20]; 132 unsigned char ctlregs[0x20];
135 int ymode; /* SL added */ 133 int ymode; /* SL added */
136 snd_kcontrol_t *master_switch; 134 struct snd_kcontrol *master_switch;
137 snd_kcontrol_t *master_volume; 135 struct snd_kcontrol *master_volume;
138#ifdef CONFIG_PM 136#ifdef CONFIG_PM
139 void (*cs4231_suspend)(cs4231_t *); 137 void (*cs4231_suspend)(struct snd_cs4231 *);
140 void (*cs4231_resume)(cs4231_t *); 138 void (*cs4231_resume)(struct snd_cs4231 *);
141#endif 139#endif
142}; 140};
143 141
144static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 142static struct snd_card *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
145 143
146#define PFX "opl3sa2: " 144#define PFX "opl3sa2: "
147 145
@@ -176,7 +174,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_opl3sa2_pnpids);
176 174
177 175
178/* read control port (w/o spinlock) */ 176/* read control port (w/o spinlock) */
179static unsigned char __snd_opl3sa2_read(opl3sa2_t *chip, unsigned char reg) 177static unsigned char __snd_opl3sa2_read(struct snd_opl3sa2 *chip, unsigned char reg)
180{ 178{
181 unsigned char result; 179 unsigned char result;
182#if 0 180#if 0
@@ -192,7 +190,7 @@ static unsigned char __snd_opl3sa2_read(opl3sa2_t *chip, unsigned char reg)
192} 190}
193 191
194/* read control port (with spinlock) */ 192/* read control port (with spinlock) */
195static unsigned char snd_opl3sa2_read(opl3sa2_t *chip, unsigned char reg) 193static unsigned char snd_opl3sa2_read(struct snd_opl3sa2 *chip, unsigned char reg)
196{ 194{
197 unsigned long flags; 195 unsigned long flags;
198 unsigned char result; 196 unsigned char result;
@@ -204,7 +202,7 @@ static unsigned char snd_opl3sa2_read(opl3sa2_t *chip, unsigned char reg)
204} 202}
205 203
206/* write control port (w/o spinlock) */ 204/* write control port (w/o spinlock) */
207static void __snd_opl3sa2_write(opl3sa2_t *chip, unsigned char reg, unsigned char value) 205static void __snd_opl3sa2_write(struct snd_opl3sa2 *chip, unsigned char reg, unsigned char value)
208{ 206{
209#if 0 207#if 0
210 outb(0x1d, port); /* password */ 208 outb(0x1d, port); /* password */
@@ -215,7 +213,7 @@ static void __snd_opl3sa2_write(opl3sa2_t *chip, unsigned char reg, unsigned cha
215} 213}
216 214
217/* write control port (with spinlock) */ 215/* write control port (with spinlock) */
218static void snd_opl3sa2_write(opl3sa2_t *chip, unsigned char reg, unsigned char value) 216static void snd_opl3sa2_write(struct snd_opl3sa2 *chip, unsigned char reg, unsigned char value)
219{ 217{
220 unsigned long flags; 218 unsigned long flags;
221 spin_lock_irqsave(&chip->reg_lock, flags); 219 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -223,9 +221,9 @@ static void snd_opl3sa2_write(opl3sa2_t *chip, unsigned char reg, unsigned char
223 spin_unlock_irqrestore(&chip->reg_lock, flags); 221 spin_unlock_irqrestore(&chip->reg_lock, flags);
224} 222}
225 223
226static int __init snd_opl3sa2_detect(opl3sa2_t *chip) 224static int __init snd_opl3sa2_detect(struct snd_opl3sa2 *chip)
227{ 225{
228 snd_card_t *card; 226 struct snd_card *card;
229 unsigned long port; 227 unsigned long port;
230 unsigned char tmp, tmp1; 228 unsigned char tmp, tmp1;
231 char str[2]; 229 char str[2];
@@ -298,7 +296,7 @@ static int __init snd_opl3sa2_detect(opl3sa2_t *chip)
298static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id, struct pt_regs *regs) 296static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id, struct pt_regs *regs)
299{ 297{
300 unsigned short status; 298 unsigned short status;
301 opl3sa2_t *chip = dev_id; 299 struct snd_opl3sa2 *chip = dev_id;
302 int handled = 0; 300 int handled = 0;
303 301
304 if (chip == NULL || chip->card == NULL) 302 if (chip == NULL || chip->card == NULL)
@@ -340,7 +338,7 @@ static irqreturn_t snd_opl3sa2_interrupt(int irq, void *dev_id, struct pt_regs *
340 .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \ 338 .get = snd_opl3sa2_get_single, .put = snd_opl3sa2_put_single, \
341 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 339 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
342 340
343static int snd_opl3sa2_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 341static int snd_opl3sa2_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
344{ 342{
345 int mask = (kcontrol->private_value >> 16) & 0xff; 343 int mask = (kcontrol->private_value >> 16) & 0xff;
346 344
@@ -351,9 +349,9 @@ static int snd_opl3sa2_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
351 return 0; 349 return 0;
352} 350}
353 351
354static int snd_opl3sa2_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 352static int snd_opl3sa2_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
355{ 353{
356 opl3sa2_t *chip = snd_kcontrol_chip(kcontrol); 354 struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol);
357 unsigned long flags; 355 unsigned long flags;
358 int reg = kcontrol->private_value & 0xff; 356 int reg = kcontrol->private_value & 0xff;
359 int shift = (kcontrol->private_value >> 8) & 0xff; 357 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -368,9 +366,9 @@ static int snd_opl3sa2_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
368 return 0; 366 return 0;
369} 367}
370 368
371static int snd_opl3sa2_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 369static int snd_opl3sa2_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
372{ 370{
373 opl3sa2_t *chip = snd_kcontrol_chip(kcontrol); 371 struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol);
374 unsigned long flags; 372 unsigned long flags;
375 int reg = kcontrol->private_value & 0xff; 373 int reg = kcontrol->private_value & 0xff;
376 int shift = (kcontrol->private_value >> 8) & 0xff; 374 int shift = (kcontrol->private_value >> 8) & 0xff;
@@ -398,7 +396,7 @@ static int snd_opl3sa2_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
398 .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \ 396 .get = snd_opl3sa2_get_double, .put = snd_opl3sa2_put_double, \
399 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 397 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
400 398
401static int snd_opl3sa2_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 399static int snd_opl3sa2_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
402{ 400{
403 int mask = (kcontrol->private_value >> 24) & 0xff; 401 int mask = (kcontrol->private_value >> 24) & 0xff;
404 402
@@ -409,9 +407,9 @@ static int snd_opl3sa2_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
409 return 0; 407 return 0;
410} 408}
411 409
412static int snd_opl3sa2_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 410static int snd_opl3sa2_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
413{ 411{
414 opl3sa2_t *chip = snd_kcontrol_chip(kcontrol); 412 struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol);
415 unsigned long flags; 413 unsigned long flags;
416 int left_reg = kcontrol->private_value & 0xff; 414 int left_reg = kcontrol->private_value & 0xff;
417 int right_reg = (kcontrol->private_value >> 8) & 0xff; 415 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -431,9 +429,9 @@ static int snd_opl3sa2_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
431 return 0; 429 return 0;
432} 430}
433 431
434static int snd_opl3sa2_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 432static int snd_opl3sa2_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
435{ 433{
436 opl3sa2_t *chip = snd_kcontrol_chip(kcontrol); 434 struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol);
437 unsigned long flags; 435 unsigned long flags;
438 int left_reg = kcontrol->private_value & 0xff; 436 int left_reg = kcontrol->private_value & 0xff;
439 int right_reg = (kcontrol->private_value >> 8) & 0xff; 437 int right_reg = (kcontrol->private_value >> 8) & 0xff;
@@ -471,31 +469,31 @@ static int snd_opl3sa2_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
471 return change; 469 return change;
472} 470}
473 471
474static snd_kcontrol_new_t snd_opl3sa2_controls[] = { 472static struct snd_kcontrol_new snd_opl3sa2_controls[] = {
475OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1), 473OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1),
476OPL3SA2_DOUBLE("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1), 474OPL3SA2_DOUBLE("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1),
477OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1), 475OPL3SA2_SINGLE("Mic Playback Switch", 0, 0x09, 7, 1, 1),
478OPL3SA2_SINGLE("Mic Playback Volume", 0, 0x09, 0, 31, 1) 476OPL3SA2_SINGLE("Mic Playback Volume", 0, 0x09, 0, 31, 1)
479}; 477};
480 478
481static snd_kcontrol_new_t snd_opl3sa2_tone_controls[] = { 479static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = {
482OPL3SA2_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0), 480OPL3SA2_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0),
483OPL3SA2_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0), 481OPL3SA2_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0),
484OPL3SA2_DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0) 482OPL3SA2_DOUBLE("Tone Control - Treble", 0, 0x16, 0x16, 4, 0, 7, 0)
485}; 483};
486 484
487static void snd_opl3sa2_master_free(snd_kcontrol_t *kcontrol) 485static void snd_opl3sa2_master_free(struct snd_kcontrol *kcontrol)
488{ 486{
489 opl3sa2_t *chip = snd_kcontrol_chip(kcontrol); 487 struct snd_opl3sa2 *chip = snd_kcontrol_chip(kcontrol);
490 chip->master_switch = NULL; 488 chip->master_switch = NULL;
491 chip->master_volume = NULL; 489 chip->master_volume = NULL;
492} 490}
493 491
494static int __init snd_opl3sa2_mixer(opl3sa2_t *chip) 492static int __init snd_opl3sa2_mixer(struct snd_opl3sa2 *chip)
495{ 493{
496 snd_card_t *card = chip->card; 494 struct snd_card *card = chip->card;
497 snd_ctl_elem_id_t id1, id2; 495 struct snd_ctl_elem_id id1, id2;
498 snd_kcontrol_t *kctl; 496 struct snd_kcontrol *kctl;
499 unsigned int idx; 497 unsigned int idx;
500 int err; 498 int err;
501 499
@@ -539,9 +537,9 @@ static int __init snd_opl3sa2_mixer(opl3sa2_t *chip)
539 537
540/* Power Management support functions */ 538/* Power Management support functions */
541#ifdef CONFIG_PM 539#ifdef CONFIG_PM
542static int snd_opl3sa2_suspend(snd_card_t *card, pm_message_t state) 540static int snd_opl3sa2_suspend(struct snd_card *card, pm_message_t state)
543{ 541{
544 opl3sa2_t *chip = card->pm_private_data; 542 struct snd_opl3sa2 *chip = card->pm_private_data;
545 543
546 snd_pcm_suspend_all(chip->cs4231->pcm); /* stop before saving regs */ 544 snd_pcm_suspend_all(chip->cs4231->pcm); /* stop before saving regs */
547 chip->cs4231_suspend(chip->cs4231); 545 chip->cs4231_suspend(chip->cs4231);
@@ -552,9 +550,9 @@ static int snd_opl3sa2_suspend(snd_card_t *card, pm_message_t state)
552 return 0; 550 return 0;
553} 551}
554 552
555static int snd_opl3sa2_resume(snd_card_t *card) 553static int snd_opl3sa2_resume(struct snd_card *card)
556{ 554{
557 opl3sa2_t *chip = card->pm_private_data; 555 struct snd_opl3sa2 *chip = card->pm_private_data;
558 int i; 556 int i;
559 557
560 /* power up */ 558 /* power up */
@@ -577,7 +575,7 @@ static int snd_opl3sa2_resume(snd_card_t *card)
577#endif /* CONFIG_PM */ 575#endif /* CONFIG_PM */
578 576
579#ifdef CONFIG_PNP 577#ifdef CONFIG_PNP
580static int __init snd_opl3sa2_pnp(int dev, opl3sa2_t *chip, 578static int __init snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip,
581 struct pnp_dev *pdev, 579 struct pnp_dev *pdev,
582 int isapnp) 580 int isapnp)
583{ 581{
@@ -634,7 +632,7 @@ static int __init snd_opl3sa2_pnp(int dev, opl3sa2_t *chip,
634 return 0; 632 return 0;
635} 633}
636 634
637static int __init snd_opl3sa2_cpnp(int dev, opl3sa2_t *chip, 635static int __init snd_opl3sa2_cpnp(int dev, struct snd_opl3sa2 *chip,
638 struct pnp_card_link *card, 636 struct pnp_card_link *card,
639 const struct pnp_card_device_id *id) 637 const struct pnp_card_device_id *id)
640{ 638{
@@ -652,7 +650,7 @@ static int __init snd_opl3sa2_cpnp(int dev, opl3sa2_t *chip,
652} 650}
653#endif /* CONFIG_PNP */ 651#endif /* CONFIG_PNP */
654 652
655static int snd_opl3sa2_free(opl3sa2_t *chip) 653static int snd_opl3sa2_free(struct snd_opl3sa2 *chip)
656{ 654{
657 if (chip->irq >= 0) 655 if (chip->irq >= 0)
658 free_irq(chip->irq, (void *)chip); 656 free_irq(chip->irq, (void *)chip);
@@ -661,9 +659,9 @@ static int snd_opl3sa2_free(opl3sa2_t *chip)
661 return 0; 659 return 0;
662} 660}
663 661
664static int snd_opl3sa2_dev_free(snd_device_t *device) 662static int snd_opl3sa2_dev_free(struct snd_device *device)
665{ 663{
666 opl3sa2_t *chip = device->device_data; 664 struct snd_opl3sa2 *chip = device->device_data;
667 return snd_opl3sa2_free(chip); 665 return snd_opl3sa2_free(chip);
668} 666}
669 667
@@ -679,11 +677,11 @@ static int __devinit snd_opl3sa2_probe(int dev,
679 const struct pnp_card_device_id *pid) 677 const struct pnp_card_device_id *pid)
680{ 678{
681 int xirq, xdma1, xdma2; 679 int xirq, xdma1, xdma2;
682 snd_card_t *card; 680 struct snd_card *card;
683 struct snd_opl3sa2 *chip; 681 struct snd_opl3sa2 *chip;
684 cs4231_t *cs4231; 682 struct snd_cs4231 *cs4231;
685 opl3_t *opl3; 683 struct snd_opl3 *opl3;
686 static snd_device_ops_t ops = { 684 static struct snd_device_ops ops = {
687 .dev_free = snd_opl3sa2_dev_free, 685 .dev_free = snd_opl3sa2_dev_free,
688 }; 686 };
689 int err; 687 int err;
@@ -837,7 +835,7 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
837 835
838static void __devexit snd_opl3sa2_pnp_remove(struct pnp_dev * pdev) 836static void __devexit snd_opl3sa2_pnp_remove(struct pnp_dev * pdev)
839{ 837{
840 snd_card_t *card = (snd_card_t *) pnp_get_drvdata(pdev); 838 struct snd_card *card = (struct snd_card *) pnp_get_drvdata(pdev);
841 839
842 snd_card_disconnect(card); 840 snd_card_disconnect(card);
843 snd_card_free_in_thread(card); 841 snd_card_free_in_thread(card);
@@ -872,7 +870,7 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *card,
872 870
873static void __devexit snd_opl3sa2_pnp_cremove(struct pnp_card_link * pcard) 871static void __devexit snd_opl3sa2_pnp_cremove(struct pnp_card_link * pcard)
874{ 872{
875 snd_card_t *card = (snd_card_t *) pnp_get_card_drvdata(pcard); 873 struct snd_card *card = (struct snd_card *) pnp_get_card_drvdata(pcard);
876 874
877 snd_card_disconnect(card); 875 snd_card_disconnect(card);
878 snd_card_free_in_thread(card); 876 snd_card_free_in_thread(card);