/[openvortex]/alsa/pci/au88x0/au88x0_core.c
ViewVC logotype

Diff of /alsa/pci/au88x0/au88x0_core.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.24 by mjander, Mon Jun 23 02:44:25 2003 UTC revision 1.25 by vizard, Mon Jun 30 02:38:04 2003 UTC
# Line 1927  void vortex_codec_write(ac97_t *codec, u Line 1927  void vortex_codec_write(ac97_t *codec, u
1927          vortex_t *card = (vortex_t*)codec->private_data;          vortex_t *card = (vortex_t*)codec->private_data;
1928          unsigned long flags;          unsigned long flags;
1929          unsigned int lifeboat = 0;          unsigned int lifeboat = 0;
1930            unsigned long read_addr;
1931          spin_lock_irqsave(&card->lock, flags);          spin_lock_irqsave(&card->lock, flags);
1932                    
1933          /* wait for transactions to clear */          /* wait for transactions to clear */
1934          while (!(hwread(card->mmio, VORTEX_CODEC_CTRL) & 0x100)) {          while (!(hwread(card->mmio, VORTEX_CODEC_CTRL) & 0x100)) {
1935                  udelay(100);                  udelay(100);
1936                  if (lifeboat++ > POLL_COUNT) {                  if (lifeboat++ > POLL_COUNT) {
1937                          printk(KERN_ERR "vortex: ac97 codec busy\n");                          printk(KERN_ERR "vortex: ac97 codec stuck busy\n");
1938                          return;                          return;
1939                  }                  }
1940          }          }
# Line 1944  void vortex_codec_write(ac97_t *codec, u Line 1944  void vortex_codec_write(ac97_t *codec, u
1944                          ((data << VORTEX_CODEC_DATSHIFT) & VORTEX_CODEC_DATMASK) |                          ((data << VORTEX_CODEC_DATSHIFT) & VORTEX_CODEC_DATMASK) |
1945                                          VORTEX_CODEC_WRITE);                                          VORTEX_CODEC_WRITE);
1946    
1947          spin_unlock_irqrestore(&card->lock, flags);          
1948            /* this is necessary to flush the write */
1949          /* verify that the write succeeded */          while (!(hwread(card->mmio, VORTEX_CODEC_CTRL) & 0x100)) {
1950          /* This isn't too happy...                  udelay(100);
1951          if (vortex_codec_read(codec, addr) != data)                  if (lifeboat++ > POLL_COUNT) {
1952                  printk(KERN_ERR "vortex: ac97 codec write failed %x - %x\n", vortex_codec_read(codec, addr), data);                          printk(KERN_ERR "vortex: ac97 codec stuck busy\n");
1953          */                          return;
1954                    }
1955            }
1956            read_addr = ((addr << VORTEX_CODEC_ADDSHIFT) & VORTEX_CODEC_ADDMASK);
1957            hwwrite(card->mmio, VORTEX_CODEC_IO, read_addr);
1958    
1959          vortex_codec_read(codec, addr);          spin_unlock_irqrestore(&card->lock, flags);
1960  }  }
1961    
1962  unsigned short vortex_codec_read(ac97_t *codec, unsigned short addr) {  unsigned short vortex_codec_read(ac97_t *codec, unsigned short addr) {
# Line 1969  unsigned short vortex_codec_read(ac97_t Line 1973  unsigned short vortex_codec_read(ac97_t
1973          while (!(hwread(card->mmio, VORTEX_CODEC_CTRL) & 0x100)) {          while (!(hwread(card->mmio, VORTEX_CODEC_CTRL) & 0x100)) {
1974                  udelay(100);                  udelay(100);
1975                  if (lifeboat++ > POLL_COUNT) {                  if (lifeboat++ > POLL_COUNT) {
1976                          printk(KERN_ERR "vortex: ac97 codec busy\n");                          printk(KERN_ERR "vortex: ac97 codec stuck busy\n");
1977                          return 0xffff;                          return 0xffff;
1978                  }                  }
1979          }          }

Legend:
Removed from v.1.24  
changed lines
  Added in v.1.25

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26