~ubuntu-branches/ubuntu/precise/alsa-driver/precise

« back to all changes in this revision

Viewing changes to alsa-kernel/pci/ali5451/ali5451.c

  • Committer: Bazaar Package Importer
  • Author(s): Luke Yelavich
  • Date: 2009-11-04 16:28:58 UTC
  • mfrom: (1.1.12 upstream) (3.1.7 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091104162858-7ky0tu33d7mn6oys
Tags: 1.0.21+dfsg-3ubuntu1
* Merge from debian unstable, remaining changes:
  - Script paths (/usr/sbin -> /sbin, /usr/bin -> /bin);
  - debian/rules:
    + Don't install snddevices and program-wrapper
    + install alsa-base apport hook
    + Package separate USB card list file
  - Vcs and maintainer fields mangling
  - Rename blacklist files in /etc/modprobe.d to be consistant with the rest
    of the distro
  - debian/alsa-base.init:
    + create /var/run/alsa if it doesn't exist
    + Run alsactl store before force unloading modules
    + Run alsactl restore after reloading unloaded modules
  - debian/linux-sound-base.postrm: Remove /etc/modprobe.d/blacklist* files
    on package removal
  - Add missing $CMDLINE_OPTS to all install rules.
  - Replace -Q with --quiet.
  - Add --use-blacklist to all rules so the blacklist still takes effect.
  - debian/alsa-base.postinst: Do not run snddevices
  - retain patches:
    + add_suspend_quirk_hp_nc6220_nw8240.patch,
    + refix_lp_68659_by_disabling_dxs_for_0x1458a002.patch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
310
310
        unsigned int res;
311
311
        
312
312
        end_time = jiffies + msecs_to_jiffies(250);
313
 
        do {
 
313
 
 
314
        for (;;) {
314
315
                res = snd_ali_5451_peek(codec,port);
315
316
                if (!(res & 0x8000))
316
317
                        return 0;
 
318
                if (!time_after_eq(end_time, jiffies))
 
319
                        break;
317
320
                schedule_timeout_uninterruptible(1);
318
 
        } while (time_after_eq(end_time, jiffies));
 
321
        }
 
322
 
319
323
        snd_ali_5451_poke(codec, port, res & ~0x8000);
320
324
        snd_printdd("ali_codec_ready: codec is not ready.\n ");
321
325
        return -EIO;
327
331
        unsigned long dwChk1,dwChk2;
328
332
        
329
333
        dwChk1 = snd_ali_5451_peek(codec, ALI_STIMER);
330
 
        dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
 
334
        end_time = jiffies + msecs_to_jiffies(250);
331
335
 
332
 
        end_time = jiffies + msecs_to_jiffies(250);
333
 
        do {
 
336
        for (;;) {
334
337
                dwChk2 = snd_ali_5451_peek(codec, ALI_STIMER);
335
338
                if (dwChk2 != dwChk1)
336
339
                        return 0;
 
340
                if (!time_after_eq(end_time, jiffies))
 
341
                        break;
337
342
                schedule_timeout_uninterruptible(1);
338
 
        } while (time_after_eq(end_time, jiffies));
 
343
        }
 
344
 
339
345
        snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n");
340
346
        return -EIO;
341
347
}
472
478
        return 0;
473
479
}
474
480
 
475
 
#ifdef CODEC_RESET
476
 
 
477
 
static int snd_ali_reset_codec(struct snd_ali *codec)
478
 
{
479
 
        struct pci_dev *pci_dev;
480
 
        unsigned char bVal;
481
 
        unsigned int   dwVal;
482
 
        unsigned short wCount, wReg;
483
 
 
484
 
        pci_dev = codec->pci_m1533;
485
 
        
486
 
        pci_read_config_dword(pci_dev, 0x7c, &dwVal);
487
 
        pci_write_config_dword(pci_dev, 0x7c, dwVal | 0x08000000);
488
 
        udelay(5000);
489
 
        pci_read_config_dword(pci_dev, 0x7c, &dwVal);
490
 
        pci_write_config_dword(pci_dev, 0x7c, dwVal & 0xf7ffffff);
491
 
        udelay(5000);
492
 
 
493
 
        bVal = inb(ALI_REG(codec,ALI_SCTRL));
494
 
        bVal |= 0x02;
495
 
        outb(ALI_REG(codec,ALI_SCTRL),bVal);
496
 
        udelay(5000);
497
 
        bVal = inb(ALI_REG(codec,ALI_SCTRL));
498
 
        bVal &= 0xfd;
499
 
        outb(ALI_REG(codec,ALI_SCTRL),bVal);
500
 
        udelay(15000);
501
 
 
502
 
        wCount = 200;
503
 
        while (wCount--) {
504
 
                wReg = snd_ali_codec_read(codec->ac97, AC97_POWERDOWN);
505
 
                if ((wReg & 0x000f) == 0x000f)
506
 
                        return 0;
507
 
                udelay(5000);
508
 
        }
509
 
        return -1;
510
 
}
511
 
 
512
 
#endif
513
 
 
514
481
/*
515
482
 *  ALI 5451 Controller
516
483
 */
555
522
        outl(gc, ALI_REG(codec, ALI_GC_CIR));
556
523
}
557
524
 
558
 
#if 0 /* not used */
559
 
static void snd_ali_enable_voice_irq(struct snd_ali *codec,
560
 
                                     unsigned int channel)
561
 
{
562
 
        unsigned int mask;
563
 
        struct snd_ali_channel_control *pchregs = &(codec->chregs);
564
 
 
565
 
        snd_ali_printk("enable_voice_irq channel=%d\n",channel);
566
 
        
567
 
        mask = 1 << (channel & 0x1f);
568
 
        pchregs->data.ainten  = inl(ALI_REG(codec, pchregs->regs.ainten));
569
 
        pchregs->data.ainten |= mask;
570
 
        outl(pchregs->data.ainten, ALI_REG(codec, pchregs->regs.ainten));
571
 
}
572
 
#endif
573
 
 
574
525
static void snd_ali_disable_voice_irq(struct snd_ali *codec,
575
526
                                      unsigned int channel)
576
527
{
671
622
        }
672
623
}
673
624
 
674
 
#if 0 /* not used */
675
 
static void snd_ali_start_voice(struct snd_ali *codec, unsigned int channel)
676
 
{
677
 
        unsigned int mask = 1 << (channel & 0x1f);
678
 
        
679
 
        snd_ali_printk("start_voice: channel=%d\n",channel);
680
 
        outl(mask, ALI_REG(codec,codec->chregs.regs.start));
681
 
}
682
 
#endif
683
 
 
684
625
static void snd_ali_stop_voice(struct snd_ali *codec, unsigned int channel)
685
626
{
686
627
        unsigned int mask = 1 << (channel & 0x1f);