aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ice1712/ice1724.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/ice1712/ice1724.c')
-rw-r--r--sound/pci/ice1712/ice1724.c50
1 files changed, 26 insertions, 24 deletions
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 500471778291..5e7948f3efe9 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -146,7 +146,7 @@ static unsigned char snd_vt1724_ac97_ready(struct snd_ice1712 *ice)
146 continue; 146 continue;
147 return old_cmd; 147 return old_cmd;
148 } 148 }
149 snd_printd(KERN_ERR "snd_vt1724_ac97_ready: timeout\n"); 149 dev_dbg(ice->card->dev, "snd_vt1724_ac97_ready: timeout\n");
150 return old_cmd; 150 return old_cmd;
151} 151}
152 152
@@ -156,7 +156,7 @@ static int snd_vt1724_ac97_wait_bit(struct snd_ice1712 *ice, unsigned char bit)
156 for (tm = 0; tm < 0x10000; tm++) 156 for (tm = 0; tm < 0x10000; tm++)
157 if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0) 157 if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0)
158 return 0; 158 return 0;
159 snd_printd(KERN_ERR "snd_vt1724_ac97_wait_bit: timeout\n"); 159 dev_dbg(ice->card->dev, "snd_vt1724_ac97_wait_bit: timeout\n");
160 return -EIO; 160 return -EIO;
161} 161}
162 162
@@ -430,10 +430,10 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id)
430 spin_lock(&ice->reg_lock); 430 spin_lock(&ice->reg_lock);
431 if (++timeout > 10) { 431 if (++timeout > 10) {
432 status = inb(ICEREG1724(ice, IRQSTAT)); 432 status = inb(ICEREG1724(ice, IRQSTAT));
433 printk(KERN_ERR "ice1724: Too long irq loop, " 433 dev_err(ice->card->dev,
434 "status = 0x%x\n", status); 434 "Too long irq loop, status = 0x%x\n", status);
435 if (status & VT1724_IRQ_MPU_TX) { 435 if (status & VT1724_IRQ_MPU_TX) {
436 printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); 436 dev_err(ice->card->dev, "Disabling MPU_TX\n");
437 enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); 437 enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0);
438 } 438 }
439 spin_unlock(&ice->reg_lock); 439 spin_unlock(&ice->reg_lock);
@@ -801,7 +801,7 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream)
801 spin_unlock_irq(&ice->reg_lock); 801 spin_unlock_irq(&ice->reg_lock);
802 802
803 /* 803 /*
804 printk(KERN_DEBUG "pro prepare: ch = %d, addr = 0x%x, " 804 dev_dbg(ice->card->dev, "pro prepare: ch = %d, addr = 0x%x, "
805 "buffer = 0x%x, period = 0x%x\n", 805 "buffer = 0x%x, period = 0x%x\n",
806 substream->runtime->channels, 806 substream->runtime->channels,
807 (unsigned int)substream->runtime->dma_addr, 807 (unsigned int)substream->runtime->dma_addr,
@@ -821,13 +821,13 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea
821#if 0 /* read PLAYBACK_ADDR */ 821#if 0 /* read PLAYBACK_ADDR */
822 ptr = inl(ICEMT1724(ice, PLAYBACK_ADDR)); 822 ptr = inl(ICEMT1724(ice, PLAYBACK_ADDR));
823 if (ptr < substream->runtime->dma_addr) { 823 if (ptr < substream->runtime->dma_addr) {
824 snd_printd("ice1724: invalid negative ptr\n"); 824 dev_dbg(ice->card->dev, "invalid negative ptr\n");
825 return 0; 825 return 0;
826 } 826 }
827 ptr -= substream->runtime->dma_addr; 827 ptr -= substream->runtime->dma_addr;
828 ptr = bytes_to_frames(substream->runtime, ptr); 828 ptr = bytes_to_frames(substream->runtime, ptr);
829 if (ptr >= substream->runtime->buffer_size) { 829 if (ptr >= substream->runtime->buffer_size) {
830 snd_printd("ice1724: invalid ptr %d (size=%d)\n", 830 dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n",
831 (int)ptr, (int)substream->runtime->period_size); 831 (int)ptr, (int)substream->runtime->period_size);
832 return 0; 832 return 0;
833 } 833 }
@@ -840,7 +840,7 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea
840 else if (ptr <= substream->runtime->buffer_size) 840 else if (ptr <= substream->runtime->buffer_size)
841 ptr = substream->runtime->buffer_size - ptr; 841 ptr = substream->runtime->buffer_size - ptr;
842 else { 842 else {
843 snd_printd("ice1724: invalid ptr %d (size=%d)\n", 843 dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n",
844 (int)ptr, (int)substream->runtime->buffer_size); 844 (int)ptr, (int)substream->runtime->buffer_size);
845 ptr = 0; 845 ptr = 0;
846 } 846 }
@@ -884,7 +884,7 @@ static snd_pcm_uframes_t snd_vt1724_pcm_pointer(struct snd_pcm_substream *substr
884 else if (ptr <= substream->runtime->buffer_size) 884 else if (ptr <= substream->runtime->buffer_size)
885 ptr = substream->runtime->buffer_size - ptr; 885 ptr = substream->runtime->buffer_size - ptr;
886 else { 886 else {
887 snd_printd("ice1724: invalid ptr %d (size=%d)\n", 887 dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n",
888 (int)ptr, (int)substream->runtime->buffer_size); 888 (int)ptr, (int)substream->runtime->buffer_size);
889 ptr = 0; 889 ptr = 0;
890 } 890 }
@@ -1508,7 +1508,8 @@ static int snd_vt1724_ac97_mixer(struct snd_ice1712 *ice)
1508 ac97.private_data = ice; 1508 ac97.private_data = ice;
1509 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); 1509 err = snd_ac97_mixer(pbus, &ac97, &ice->ac97);
1510 if (err < 0) 1510 if (err < 0)
1511 printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); 1511 dev_warn(ice->card->dev,
1512 "cannot initialize pro ac97, skipped\n");
1512 else 1513 else
1513 return 0; 1514 return 0;
1514 } 1515 }
@@ -2271,7 +2272,7 @@ static void wait_i2c_busy(struct snd_ice1712 *ice)
2271 while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--) 2272 while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--)
2272 ; 2273 ;
2273 if (t == -1) 2274 if (t == -1)
2274 printk(KERN_ERR "ice1724: i2c busy timeout\n"); 2275 dev_err(ice->card->dev, "i2c busy timeout\n");
2275} 2276}
2276 2277
2277unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice, 2278unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
@@ -2287,7 +2288,7 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice,
2287 val = inb(ICEREG1724(ice, I2C_DATA)); 2288 val = inb(ICEREG1724(ice, I2C_DATA));
2288 mutex_unlock(&ice->i2c_mutex); 2289 mutex_unlock(&ice->i2c_mutex);
2289 /* 2290 /*
2290 printk(KERN_DEBUG "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); 2291 dev_dbg(ice->card->dev, "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val);
2291 */ 2292 */
2292 return val; 2293 return val;
2293} 2294}
@@ -2298,7 +2299,7 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
2298 mutex_lock(&ice->i2c_mutex); 2299 mutex_lock(&ice->i2c_mutex);
2299 wait_i2c_busy(ice); 2300 wait_i2c_busy(ice);
2300 /* 2301 /*
2301 printk(KERN_DEBUG "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); 2302 dev_dbg(ice->card->dev, "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data);
2302 */ 2303 */
2303 outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); 2304 outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR));
2304 outb(data, ICEREG1724(ice, I2C_DATA)); 2305 outb(data, ICEREG1724(ice, I2C_DATA));
@@ -2335,7 +2336,8 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2335 ((unsigned int)swab16(vendor) << 16) | swab16(device); 2336 ((unsigned int)swab16(vendor) << 16) | swab16(device);
2336 if (ice->eeprom.subvendor == 0 || 2337 if (ice->eeprom.subvendor == 0 ||
2337 ice->eeprom.subvendor == (unsigned int)-1) { 2338 ice->eeprom.subvendor == (unsigned int)-1) {
2338 printk(KERN_ERR "ice1724: No valid ID is found\n"); 2339 dev_err(ice->card->dev,
2340 "No valid ID is found\n");
2339 return -ENXIO; 2341 return -ENXIO;
2340 } 2342 }
2341 } 2343 }
@@ -2344,7 +2346,8 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2344 for (c = *tbl; c->name; c++) { 2346 for (c = *tbl; c->name; c++) {
2345 if (modelname && c->model && 2347 if (modelname && c->model &&
2346 !strcmp(modelname, c->model)) { 2348 !strcmp(modelname, c->model)) {
2347 printk(KERN_INFO "ice1724: Using board model %s\n", 2349 dev_info(ice->card->dev,
2350 "Using board model %s\n",
2348 c->name); 2351 c->name);
2349 ice->eeprom.subvendor = c->subvendor; 2352 ice->eeprom.subvendor = c->subvendor;
2350 } else if (c->subvendor != ice->eeprom.subvendor) 2353 } else if (c->subvendor != ice->eeprom.subvendor)
@@ -2353,14 +2356,14 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2353 if (!c->eeprom_size || !c->eeprom_data) 2356 if (!c->eeprom_size || !c->eeprom_data)
2354 goto found; 2357 goto found;
2355 /* if the EEPROM is given by the driver, use it */ 2358 /* if the EEPROM is given by the driver, use it */
2356 snd_printdd("using the defined eeprom..\n"); 2359 dev_dbg(ice->card->dev, "using the defined eeprom..\n");
2357 ice->eeprom.version = 2; 2360 ice->eeprom.version = 2;
2358 ice->eeprom.size = c->eeprom_size + 6; 2361 ice->eeprom.size = c->eeprom_size + 6;
2359 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); 2362 memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size);
2360 goto read_skipped; 2363 goto read_skipped;
2361 } 2364 }
2362 } 2365 }
2363 printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n", 2366 dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n",
2364 ice->eeprom.subvendor); 2367 ice->eeprom.subvendor);
2365#ifdef CONFIG_PM_SLEEP 2368#ifdef CONFIG_PM_SLEEP
2366 /* assume AC97-only card which can suspend without additional code */ 2369 /* assume AC97-only card which can suspend without additional code */
@@ -2372,13 +2375,13 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2372 if (ice->eeprom.size < 6) 2375 if (ice->eeprom.size < 6)
2373 ice->eeprom.size = 32; 2376 ice->eeprom.size = 32;
2374 else if (ice->eeprom.size > 32) { 2377 else if (ice->eeprom.size > 32) {
2375 printk(KERN_ERR "ice1724: Invalid EEPROM (size = %i)\n", 2378 dev_err(ice->card->dev, "Invalid EEPROM (size = %i)\n",
2376 ice->eeprom.size); 2379 ice->eeprom.size);
2377 return -EIO; 2380 return -EIO;
2378 } 2381 }
2379 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05); 2382 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05);
2380 if (ice->eeprom.version != 1 && ice->eeprom.version != 2) 2383 if (ice->eeprom.version != 1 && ice->eeprom.version != 2)
2381 printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n", 2384 dev_warn(ice->card->dev, "Invalid EEPROM version %i\n",
2382 ice->eeprom.version); 2385 ice->eeprom.version);
2383 size = ice->eeprom.size - 6; 2386 size = ice->eeprom.size - 6;
2384 for (i = 0; i < size; i++) 2387 for (i = 0; i < size; i++)
@@ -2586,7 +2589,7 @@ static int snd_vt1724_create(struct snd_card *card,
2586 2589
2587 if (request_irq(pci->irq, snd_vt1724_interrupt, 2590 if (request_irq(pci->irq, snd_vt1724_interrupt,
2588 IRQF_SHARED, KBUILD_MODNAME, ice)) { 2591 IRQF_SHARED, KBUILD_MODNAME, ice)) {
2589 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2592 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
2590 snd_vt1724_free(ice); 2593 snd_vt1724_free(ice);
2591 return -EIO; 2594 return -EIO;
2592 } 2595 }
@@ -2609,8 +2612,6 @@ static int snd_vt1724_create(struct snd_card *card,
2609 return err; 2612 return err;
2610 } 2613 }
2611 2614
2612 snd_card_set_dev(card, &pci->dev);
2613
2614 *r_ice1712 = ice; 2615 *r_ice1712 = ice;
2615 return 0; 2616 return 0;
2616} 2617}
@@ -2638,7 +2639,8 @@ static int snd_vt1724_probe(struct pci_dev *pci,
2638 return -ENOENT; 2639 return -ENOENT;
2639 } 2640 }
2640 2641
2641 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 2642 err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE,
2643 0, &card);
2642 if (err < 0) 2644 if (err < 0)
2643 return err; 2645 return err;
2644 2646