aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/maestro3.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-06-30 07:47:58 -0400
committerJaroslav Kysela <perex@suse.cz>2005-07-28 06:21:13 -0400
commit5ba1e7b594db4d0e1f88ace87c1cb295761ca5c9 (patch)
tree8da0fe866252f6043635f176cf46b847a52924fe /sound/pci/maestro3.c
parent52b723888c1a55d34551f9b0b9d9296e0e3e8d3c (diff)
[ALSA] maestro3 - Clean up
Maestro3 driver - Clean up maestro3 code - Use msleep() - Don't enable hw-vol irq when not defined Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/maestro3.c')
-rw-r--r--sound/pci/maestro3.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 52c585901c54..39b5e7db1543 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -1050,11 +1050,6 @@ static struct m3_hv_quirk m3_hv_quirk_list[] = {
1050 * lowlevel functions 1050 * lowlevel functions
1051 */ 1051 */
1052 1052
1053#define big_mdelay(msec) do {\
1054 set_current_state(TASK_UNINTERRUPTIBLE);\
1055 schedule_timeout(((msec) * HZ) / 1000);\
1056} while (0)
1057
1058static inline void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg) 1053static inline void snd_m3_outw(m3_t *chip, u16 value, unsigned long reg)
1059{ 1054{
1060 outw(value, chip->iobase + reg); 1055 outw(value, chip->iobase + reg);
@@ -1096,7 +1091,7 @@ static void snd_m3_assp_write(m3_t *chip, u16 region, u16 index, u16 data)
1096static void snd_m3_assp_halt(m3_t *chip) 1091static void snd_m3_assp_halt(m3_t *chip)
1097{ 1092{
1098 chip->reset_state = snd_m3_inb(chip, DSP_PORT_CONTROL_REG_B) & ~REGB_STOP_CLOCK; 1093 chip->reset_state = snd_m3_inb(chip, DSP_PORT_CONTROL_REG_B) & ~REGB_STOP_CLOCK;
1099 big_mdelay(10); 1094 msleep(10);
1100 snd_m3_outb(chip, chip->reset_state & ~REGB_ENABLE_RESET, DSP_PORT_CONTROL_REG_B); 1095 snd_m3_outb(chip, chip->reset_state & ~REGB_ENABLE_RESET, DSP_PORT_CONTROL_REG_B);
1101} 1096}
1102 1097
@@ -2108,9 +2103,9 @@ static void snd_m3_ac97_reset(m3_t *chip)
2108 */ 2103 */
2109 tmp = inw(io + RING_BUS_CTRL_A); 2104 tmp = inw(io + RING_BUS_CTRL_A);
2110 outw(RAC_SDFS_ENABLE|LAC_SDFS_ENABLE, io + RING_BUS_CTRL_A); 2105 outw(RAC_SDFS_ENABLE|LAC_SDFS_ENABLE, io + RING_BUS_CTRL_A);
2111 big_mdelay(20); 2106 msleep(20);
2112 outw(tmp, io + RING_BUS_CTRL_A); 2107 outw(tmp, io + RING_BUS_CTRL_A);
2113 big_mdelay(50); 2108 msleep(50);
2114#endif 2109#endif
2115} 2110}
2116 2111
@@ -2525,9 +2520,13 @@ static void
2525snd_m3_enable_ints(m3_t *chip) 2520snd_m3_enable_ints(m3_t *chip)
2526{ 2521{
2527 unsigned long io = chip->iobase; 2522 unsigned long io = chip->iobase;
2523 unsigned short val;
2528 2524
2529 /* TODO: MPU401 not supported yet */ 2525 /* TODO: MPU401 not supported yet */
2530 outw(ASSP_INT_ENABLE | HV_INT_ENABLE /*| MPU401_INT_ENABLE*/, io + HOST_INT_CTRL); 2526 val = ASSP_INT_ENABLE /*| MPU401_INT_ENABLE*/;
2527 if (chip->hv_quirk && (chip->hv_quirk->config & HV_CTRL_ENABLE))
2528 val |= HV_INT_ENABLE;
2529 outw(val, io + HOST_INT_CTRL);
2531 outb(inb(io + ASSP_CONTROL_C) | ASSP_HOST_INT_ENABLE, 2530 outb(inb(io + ASSP_CONTROL_C) | ASSP_HOST_INT_ENABLE,
2532 io + ASSP_CONTROL_C); 2531 io + ASSP_CONTROL_C);
2533} 2532}
@@ -2589,7 +2588,7 @@ static int m3_suspend(snd_card_t *card, pm_message_t state)
2589 snd_pcm_suspend_all(chip->pcm); 2588 snd_pcm_suspend_all(chip->pcm);
2590 snd_ac97_suspend(chip->ac97); 2589 snd_ac97_suspend(chip->ac97);
2591 2590
2592 big_mdelay(10); /* give the assp a chance to idle.. */ 2591 msleep(10); /* give the assp a chance to idle.. */
2593 2592
2594 snd_m3_assp_halt(chip); 2593 snd_m3_assp_halt(chip);
2595 2594
@@ -2697,6 +2696,8 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
2697 } 2696 }
2698 2697
2699 spin_lock_init(&chip->reg_lock); 2698 spin_lock_init(&chip->reg_lock);
2699 spin_lock_init(&chip->ac97_lock);
2700
2700 switch (pci->device) { 2701 switch (pci->device) {
2701 case PCI_DEVICE_ID_ESS_ALLEGRO: 2702 case PCI_DEVICE_ID_ESS_ALLEGRO:
2702 case PCI_DEVICE_ID_ESS_ALLEGRO_1: 2703 case PCI_DEVICE_ID_ESS_ALLEGRO_1:
@@ -2765,6 +2766,8 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
2765 snd_m3_assp_init(chip); 2766 snd_m3_assp_init(chip);
2766 snd_m3_amp_enable(chip, 1); 2767 snd_m3_amp_enable(chip, 1);
2767 2768
2769 tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip);
2770
2768 if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ, 2771 if (request_irq(pci->irq, snd_m3_interrupt, SA_INTERRUPT|SA_SHIRQ,
2769 card->driver, (void *)chip)) { 2772 card->driver, (void *)chip)) {
2770 snd_printk("unable to grab IRQ %d\n", pci->irq); 2773 snd_printk("unable to grab IRQ %d\n", pci->irq);
@@ -2786,9 +2789,6 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
2786 return err; 2789 return err;
2787 } 2790 }
2788 2791
2789 spin_lock_init(&chip->ac97_lock);
2790 tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip);
2791
2792 if ((err = snd_m3_mixer(chip)) < 0) 2792 if ((err = snd_m3_mixer(chip)) < 0)
2793 return err; 2793 return err;
2794 2794