aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-25 09:48:50 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-26 10:45:23 -0500
commit5f1e69373172100d1a9be7ea36cad0a8d8081b7c (patch)
tree297734ae0dd330139a2c09888566bf47bfa65a48
parent38c16e34fe2f72c131e4dfd95c191783936c6bf8 (diff)
ALSA: ali5451: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc. Some debug prints are replaced with dev_dbg(), too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/ali5451/ali5451.c148
1 files changed, 68 insertions, 80 deletions
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 115b1120319a..feb29c24cab1 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -65,18 +65,6 @@ module_param(enable, bool, 0444);
65 65
66 66
67/* 67/*
68 * Debug part definitions
69 */
70
71/* #define ALI_DEBUG */
72
73#ifdef ALI_DEBUG
74#define snd_ali_printk(format, args...) printk(KERN_DEBUG format, ##args);
75#else
76#define snd_ali_printk(format, args...)
77#endif
78
79/*
80 * Constants definition 68 * Constants definition
81 */ 69 */
82 70
@@ -321,7 +309,7 @@ static int snd_ali_codec_ready(struct snd_ali *codec,
321 } 309 }
322 310
323 snd_ali_5451_poke(codec, port, res & ~0x8000); 311 snd_ali_5451_poke(codec, port, res & ~0x8000);
324 snd_printdd("ali_codec_ready: codec is not ready.\n "); 312 dev_dbg(codec->card->dev, "ali_codec_ready: codec is not ready.\n ");
325 return -EIO; 313 return -EIO;
326} 314}
327 315
@@ -342,7 +330,7 @@ static int snd_ali_stimer_ready(struct snd_ali *codec)
342 schedule_timeout_uninterruptible(1); 330 schedule_timeout_uninterruptible(1);
343 } 331 }
344 332
345 snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); 333 dev_err(codec->card->dev, "ali_stimer_read: stimer is not ready.\n");
346 return -EIO; 334 return -EIO;
347} 335}
348 336
@@ -354,7 +342,8 @@ static void snd_ali_codec_poke(struct snd_ali *codec,int secondary,
354 unsigned int port; 342 unsigned int port;
355 343
356 if (reg >= 0x80) { 344 if (reg >= 0x80) {
357 snd_printk(KERN_ERR "ali_codec_poke: reg(%xh) invalid.\n", reg); 345 dev_err(codec->card->dev,
346 "ali_codec_poke: reg(%xh) invalid.\n", reg);
358 return; 347 return;
359 } 348 }
360 349
@@ -385,7 +374,8 @@ static unsigned short snd_ali_codec_peek(struct snd_ali *codec,
385 unsigned int port; 374 unsigned int port;
386 375
387 if (reg >= 0x80) { 376 if (reg >= 0x80) {
388 snd_printk(KERN_ERR "ali_codec_peek: reg(%xh) invalid.\n", reg); 377 dev_err(codec->card->dev,
378 "ali_codec_peek: reg(%xh) invalid.\n", reg);
389 return ~0; 379 return ~0;
390 } 380 }
391 381
@@ -417,7 +407,7 @@ static void snd_ali_codec_write(struct snd_ac97 *ac97,
417{ 407{
418 struct snd_ali *codec = ac97->private_data; 408 struct snd_ali *codec = ac97->private_data;
419 409
420 snd_ali_printk("codec_write: reg=%xh data=%xh.\n", reg, val); 410 dev_dbg(codec->card->dev, "codec_write: reg=%xh data=%xh.\n", reg, val);
421 if (reg == AC97_GPIO_STATUS) { 411 if (reg == AC97_GPIO_STATUS) {
422 outl((val << ALI_AC97_GPIO_DATA_SHIFT) | ALI_AC97_GPIO_ENABLE, 412 outl((val << ALI_AC97_GPIO_DATA_SHIFT) | ALI_AC97_GPIO_ENABLE,
423 ALI_REG(codec, ALI_AC97_GPIO)); 413 ALI_REG(codec, ALI_AC97_GPIO));
@@ -433,7 +423,7 @@ static unsigned short snd_ali_codec_read(struct snd_ac97 *ac97,
433{ 423{
434 struct snd_ali *codec = ac97->private_data; 424 struct snd_ali *codec = ac97->private_data;
435 425
436 snd_ali_printk("codec_read reg=%xh.\n", reg); 426 dev_dbg(codec->card->dev, "codec_read reg=%xh.\n", reg);
437 return snd_ali_codec_peek(codec, ac97->num, reg); 427 return snd_ali_codec_peek(codec, ac97->num, reg);
438} 428}
439 429
@@ -474,7 +464,7 @@ static int snd_ali_reset_5451(struct snd_ali *codec)
474 } 464 }
475 465
476 /* non-fatal if you have a non PM capable codec */ 466 /* non-fatal if you have a non PM capable codec */
477 /* snd_printk(KERN_WARNING "ali5451: reset time out\n"); */ 467 /* dev_warn(codec->card->dev, "ali5451: reset time out\n"); */
478 return 0; 468 return 0;
479} 469}
480 470
@@ -528,7 +518,7 @@ static void snd_ali_disable_voice_irq(struct snd_ali *codec,
528 unsigned int mask; 518 unsigned int mask;
529 struct snd_ali_channel_control *pchregs = &(codec->chregs); 519 struct snd_ali_channel_control *pchregs = &(codec->chregs);
530 520
531 snd_ali_printk("disable_voice_irq channel=%d\n",channel); 521 dev_dbg(codec->card->dev, "disable_voice_irq channel=%d\n", channel);
532 522
533 mask = 1 << (channel & 0x1f); 523 mask = 1 << (channel & 0x1f);
534 pchregs->data.ainten = inl(ALI_REG(codec, pchregs->regs.ainten)); 524 pchregs->data.ainten = inl(ALI_REG(codec, pchregs->regs.ainten));
@@ -541,7 +531,7 @@ static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel)
541 unsigned int idx = channel & 0x1f; 531 unsigned int idx = channel & 0x1f;
542 532
543 if (codec->synth.chcnt >= ALI_CHANNELS){ 533 if (codec->synth.chcnt >= ALI_CHANNELS){
544 snd_printk(KERN_ERR 534 dev_err(codec->card->dev,
545 "ali_alloc_pcm_channel: no free channels.\n"); 535 "ali_alloc_pcm_channel: no free channels.\n");
546 return -1; 536 return -1;
547 } 537 }
@@ -549,7 +539,7 @@ static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel)
549 if (!(codec->synth.chmap & (1 << idx))) { 539 if (!(codec->synth.chmap & (1 << idx))) {
550 codec->synth.chmap |= 1 << idx; 540 codec->synth.chmap |= 1 << idx;
551 codec->synth.chcnt++; 541 codec->synth.chcnt++;
552 snd_ali_printk("alloc_pcm_channel no. %d.\n",idx); 542 dev_dbg(codec->card->dev, "alloc_pcm_channel no. %d.\n", idx);
553 return idx; 543 return idx;
554 } 544 }
555 return -1; 545 return -1;
@@ -560,7 +550,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
560 int idx; 550 int idx;
561 int result = -1; 551 int result = -1;
562 552
563 snd_ali_printk("find_free_channel: for %s\n",rec ? "rec" : "pcm"); 553 dev_dbg(codec->card->dev,
554 "find_free_channel: for %s\n", rec ? "rec" : "pcm");
564 555
565 /* recording */ 556 /* recording */
566 if (rec) { 557 if (rec) {
@@ -575,8 +566,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
575 if (result >= 0) 566 if (result >= 0)
576 return result; 567 return result;
577 else { 568 else {
578 snd_printk(KERN_ERR "ali_find_free_channel: " 569 dev_err(codec->card->dev,
579 "record channel is busy now.\n"); 570 "ali_find_free_channel: record channel is busy now.\n");
580 return -1; 571 return -1;
581 } 572 }
582 } 573 }
@@ -590,8 +581,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
590 if (result >= 0) 581 if (result >= 0)
591 return result; 582 return result;
592 else 583 else
593 snd_printk(KERN_ERR "ali_find_free_channel: " 584 dev_err(codec->card->dev,
594 "S/PDIF out channel is in busy now.\n"); 585 "ali_find_free_channel: S/PDIF out channel is in busy now.\n");
595 } 586 }
596 587
597 for (idx = 0; idx < ALI_CHANNELS; idx++) { 588 for (idx = 0; idx < ALI_CHANNELS; idx++) {
@@ -599,7 +590,7 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
599 if (result >= 0) 590 if (result >= 0)
600 return result; 591 return result;
601 } 592 }
602 snd_printk(KERN_ERR "ali_find_free_channel: no free channels.\n"); 593 dev_err(codec->card->dev, "ali_find_free_channel: no free channels.\n");
603 return -1; 594 return -1;
604} 595}
605 596
@@ -607,14 +598,15 @@ static void snd_ali_free_channel_pcm(struct snd_ali *codec, int channel)
607{ 598{
608 unsigned int idx = channel & 0x0000001f; 599 unsigned int idx = channel & 0x0000001f;
609 600
610 snd_ali_printk("free_channel_pcm channel=%d\n",channel); 601 dev_dbg(codec->card->dev, "free_channel_pcm channel=%d\n", channel);
611 602
612 if (channel < 0 || channel >= ALI_CHANNELS) 603 if (channel < 0 || channel >= ALI_CHANNELS)
613 return; 604 return;
614 605
615 if (!(codec->synth.chmap & (1 << idx))) { 606 if (!(codec->synth.chmap & (1 << idx))) {
616 snd_printk(KERN_ERR "ali_free_channel_pcm: " 607 dev_err(codec->card->dev,
617 "channel %d is not in use.\n", channel); 608 "ali_free_channel_pcm: channel %d is not in use.\n",
609 channel);
618 return; 610 return;
619 } else { 611 } else {
620 codec->synth.chmap &= ~(1 << idx); 612 codec->synth.chmap &= ~(1 << idx);
@@ -626,7 +618,7 @@ static void snd_ali_stop_voice(struct snd_ali *codec, unsigned int channel)
626{ 618{
627 unsigned int mask = 1 << (channel & 0x1f); 619 unsigned int mask = 1 << (channel & 0x1f);
628 620
629 snd_ali_printk("stop_voice: channel=%d\n",channel); 621 dev_dbg(codec->card->dev, "stop_voice: channel=%d\n", channel);
630 outl(mask, ALI_REG(codec, codec->chregs.regs.stop)); 622 outl(mask, ALI_REG(codec, codec->chregs.regs.stop));
631} 623}
632 624
@@ -667,7 +659,7 @@ static void snd_ali_detect_spdif_rate(struct snd_ali *codec)
667 } 659 }
668 660
669 if (count > 50000) { 661 if (count > 50000) {
670 snd_printk(KERN_ERR "ali_detect_spdif_rate: timeout!\n"); 662 dev_err(codec->card->dev, "ali_detect_spdif_rate: timeout!\n");
671 return; 663 return;
672 } 664 }
673 665
@@ -682,7 +674,7 @@ static void snd_ali_detect_spdif_rate(struct snd_ali *codec)
682 } 674 }
683 675
684 if (count > 50000) { 676 if (count > 50000) {
685 snd_printk(KERN_ERR "ali_detect_spdif_rate: timeout!\n"); 677 dev_err(codec->card->dev, "ali_detect_spdif_rate: timeout!\n");
686 return; 678 return;
687 } 679 }
688 680
@@ -857,9 +849,6 @@ static void snd_ali_update_ptr(struct snd_ali *codec, int channel)
857 struct snd_ali_voice *pvoice; 849 struct snd_ali_voice *pvoice;
858 struct snd_ali_channel_control *pchregs; 850 struct snd_ali_channel_control *pchregs;
859 unsigned int old, mask; 851 unsigned int old, mask;
860#ifdef ALI_DEBUG
861 unsigned int temp, cspf;
862#endif
863 852
864 pchregs = &(codec->chregs); 853 pchregs = &(codec->chregs);
865 854
@@ -877,14 +866,11 @@ static void snd_ali_update_ptr(struct snd_ali *codec, int channel)
877 866
878 if (pvoice->pcm && pvoice->substream) { 867 if (pvoice->pcm && pvoice->substream) {
879 /* pcm interrupt */ 868 /* pcm interrupt */
880#ifdef ALI_DEBUG
881 outb((u8)(pvoice->number), ALI_REG(codec, ALI_GC_CIR));
882 temp = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
883 cspf = (inl(ALI_REG(codec, ALI_CSPF)) & mask) == mask;
884#endif
885 if (pvoice->running) { 869 if (pvoice->running) {
886 snd_ali_printk("update_ptr: cso=%4.4x cspf=%d.\n", 870 dev_dbg(codec->card->dev,
887 (u16)temp, cspf); 871 "update_ptr: cso=%4.4x cspf=%d.\n",
872 inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2)),
873 (inl(ALI_REG(codec, ALI_CSPF)) & mask) == mask);
888 spin_unlock(&codec->reg_lock); 874 spin_unlock(&codec->reg_lock);
889 snd_pcm_period_elapsed(pvoice->substream); 875 snd_pcm_period_elapsed(pvoice->substream);
890 spin_lock(&codec->reg_lock); 876 spin_lock(&codec->reg_lock);
@@ -940,14 +926,14 @@ static struct snd_ali_voice *snd_ali_alloc_voice(struct snd_ali * codec,
940 struct snd_ali_voice *pvoice; 926 struct snd_ali_voice *pvoice;
941 int idx; 927 int idx;
942 928
943 snd_ali_printk("alloc_voice: type=%d rec=%d\n", type, rec); 929 dev_dbg(codec->card->dev, "alloc_voice: type=%d rec=%d\n", type, rec);
944 930
945 spin_lock_irq(&codec->voice_alloc); 931 spin_lock_irq(&codec->voice_alloc);
946 if (type == SNDRV_ALI_VOICE_TYPE_PCM) { 932 if (type == SNDRV_ALI_VOICE_TYPE_PCM) {
947 idx = channel > 0 ? snd_ali_alloc_pcm_channel(codec, channel) : 933 idx = channel > 0 ? snd_ali_alloc_pcm_channel(codec, channel) :
948 snd_ali_find_free_channel(codec,rec); 934 snd_ali_find_free_channel(codec,rec);
949 if (idx < 0) { 935 if (idx < 0) {
950 snd_printk(KERN_ERR "ali_alloc_voice: err.\n"); 936 dev_err(codec->card->dev, "ali_alloc_voice: err.\n");
951 spin_unlock_irq(&codec->voice_alloc); 937 spin_unlock_irq(&codec->voice_alloc);
952 return NULL; 938 return NULL;
953 } 939 }
@@ -970,7 +956,7 @@ static void snd_ali_free_voice(struct snd_ali * codec,
970 void (*private_free)(void *); 956 void (*private_free)(void *);
971 void *private_data; 957 void *private_data;
972 958
973 snd_ali_printk("free_voice: channel=%d\n",pvoice->number); 959 dev_dbg(codec->card->dev, "free_voice: channel=%d\n", pvoice->number);
974 if (!pvoice->use) 960 if (!pvoice->use)
975 return; 961 return;
976 snd_ali_clear_voices(codec, pvoice->number, pvoice->number); 962 snd_ali_clear_voices(codec, pvoice->number, pvoice->number);
@@ -1153,7 +1139,7 @@ static int snd_ali_trigger(struct snd_pcm_substream *substream,
1153 outl(val, ALI_REG(codec, ALI_AINTEN)); 1139 outl(val, ALI_REG(codec, ALI_AINTEN));
1154 if (do_start) 1140 if (do_start)
1155 outl(what, ALI_REG(codec, ALI_START)); 1141 outl(what, ALI_REG(codec, ALI_START));
1156 snd_ali_printk("trigger: what=%xh whati=%xh\n", what, whati); 1142 dev_dbg(codec->card->dev, "trigger: what=%xh whati=%xh\n", what, whati);
1157 spin_unlock(&codec->reg_lock); 1143 spin_unlock(&codec->reg_lock);
1158 1144
1159 return 0; 1145 return 0;
@@ -1239,7 +1225,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
1239 unsigned int VOL; 1225 unsigned int VOL;
1240 unsigned int EC; 1226 unsigned int EC;
1241 1227
1242 snd_ali_printk("playback_prepare ...\n"); 1228 dev_dbg(codec->card->dev, "playback_prepare ...\n");
1243 1229
1244 spin_lock_irq(&codec->reg_lock); 1230 spin_lock_irq(&codec->reg_lock);
1245 1231
@@ -1266,7 +1252,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
1266 /* set target ESO for channel */ 1252 /* set target ESO for channel */
1267 pvoice->eso = runtime->buffer_size; 1253 pvoice->eso = runtime->buffer_size;
1268 1254
1269 snd_ali_printk("playback_prepare: eso=%xh count=%xh\n", 1255 dev_dbg(codec->card->dev, "playback_prepare: eso=%xh count=%xh\n",
1270 pvoice->eso, pvoice->count); 1256 pvoice->eso, pvoice->count);
1271 1257
1272 /* set ESO to capture first MIDLP interrupt */ 1258 /* set ESO to capture first MIDLP interrupt */
@@ -1278,8 +1264,9 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
1278 PAN = 0; 1264 PAN = 0;
1279 VOL = 0; 1265 VOL = 0;
1280 EC = 0; 1266 EC = 0;
1281 snd_ali_printk("playback_prepare:\n"); 1267 dev_dbg(codec->card->dev, "playback_prepare:\n");
1282 snd_ali_printk("ch=%d, Rate=%d Delta=%xh,GVSEL=%xh,PAN=%xh,CTRL=%xh\n", 1268 dev_dbg(codec->card->dev,
1269 "ch=%d, Rate=%d Delta=%xh,GVSEL=%xh,PAN=%xh,CTRL=%xh\n",
1283 pvoice->number,runtime->rate,Delta,GVSEL,PAN,CTRL); 1270 pvoice->number,runtime->rate,Delta,GVSEL,PAN,CTRL);
1284 snd_ali_write_voice_regs(codec, 1271 snd_ali_write_voice_regs(codec,
1285 pvoice->number, 1272 pvoice->number,
@@ -1332,7 +1319,7 @@ static int snd_ali_prepare(struct snd_pcm_substream *substream)
1332 1319
1333 spin_lock_irq(&codec->reg_lock); 1320 spin_lock_irq(&codec->reg_lock);
1334 1321
1335 snd_ali_printk("ali_prepare...\n"); 1322 dev_dbg(codec->card->dev, "ali_prepare...\n");
1336 1323
1337 snd_ali_enable_special_channel(codec,pvoice->number); 1324 snd_ali_enable_special_channel(codec,pvoice->number);
1338 1325
@@ -1351,15 +1338,16 @@ static int snd_ali_prepare(struct snd_pcm_substream *substream)
1351 1338
1352 rate = snd_ali_get_spdif_in_rate(codec); 1339 rate = snd_ali_get_spdif_in_rate(codec);
1353 if (rate == 0) { 1340 if (rate == 0) {
1354 snd_printk(KERN_WARNING "ali_capture_preapre: " 1341 dev_warn(codec->card->dev,
1355 "spdif rate detect err!\n"); 1342 "ali_capture_preapre: spdif rate detect err!\n");
1356 rate = 48000; 1343 rate = 48000;
1357 } 1344 }
1358 spin_lock_irq(&codec->reg_lock); 1345 spin_lock_irq(&codec->reg_lock);
1359 bValue = inb(ALI_REG(codec,ALI_SPDIF_CTRL)); 1346 bValue = inb(ALI_REG(codec,ALI_SPDIF_CTRL));
1360 if (bValue & 0x10) { 1347 if (bValue & 0x10) {
1361 outb(bValue,ALI_REG(codec,ALI_SPDIF_CTRL)); 1348 outb(bValue,ALI_REG(codec,ALI_SPDIF_CTRL));
1362 printk(KERN_WARNING "clear SPDIF parity error flag.\n"); 1349 dev_warn(codec->card->dev,
1350 "clear SPDIF parity error flag.\n");
1363 } 1351 }
1364 1352
1365 if (rate != 48000) 1353 if (rate != 48000)
@@ -1418,7 +1406,7 @@ snd_ali_playback_pointer(struct snd_pcm_substream *substream)
1418 outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR)); 1406 outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR));
1419 cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2)); 1407 cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
1420 spin_unlock(&codec->reg_lock); 1408 spin_unlock(&codec->reg_lock);
1421 snd_ali_printk("playback pointer returned cso=%xh.\n", cso); 1409 dev_dbg(codec->card->dev, "playback pointer returned cso=%xh.\n", cso);
1422 1410
1423 return cso; 1411 return cso;
1424} 1412}
@@ -1685,7 +1673,8 @@ static int snd_ali_pcm(struct snd_ali *codec, int device,
1685 err = snd_pcm_new(codec->card, desc->name, device, 1673 err = snd_pcm_new(codec->card, desc->name, device,
1686 desc->playback_num, desc->capture_num, &pcm); 1674 desc->playback_num, desc->capture_num, &pcm);
1687 if (err < 0) { 1675 if (err < 0) {
1688 snd_printk(KERN_ERR "snd_ali_pcm: err called snd_pcm_new.\n"); 1676 dev_err(codec->card->dev,
1677 "snd_ali_pcm: err called snd_pcm_new.\n");
1689 return err; 1678 return err;
1690 } 1679 }
1691 pcm->private_data = codec; 1680 pcm->private_data = codec;
@@ -1861,7 +1850,7 @@ static int snd_ali_mixer(struct snd_ali *codec)
1861 ac97.num = i; 1850 ac97.num = i;
1862 err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i]); 1851 err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i]);
1863 if (err < 0) { 1852 if (err < 0) {
1864 snd_printk(KERN_ERR 1853 dev_err(codec->card->dev,
1865 "ali mixer %d creating error.\n", i); 1854 "ali mixer %d creating error.\n", i);
1866 if (i == 0) 1855 if (i == 0)
1867 return err; 1856 return err;
@@ -1947,8 +1936,7 @@ static int ali_resume(struct device *dev)
1947 pci_set_power_state(pci, PCI_D0); 1936 pci_set_power_state(pci, PCI_D0);
1948 pci_restore_state(pci); 1937 pci_restore_state(pci);
1949 if (pci_enable_device(pci) < 0) { 1938 if (pci_enable_device(pci) < 0) {
1950 printk(KERN_ERR "ali5451: pci_enable_device failed, " 1939 dev_err(dev, "pci_enable_device failed, disabling device\n");
1951 "disabling device\n");
1952 snd_card_disconnect(card); 1940 snd_card_disconnect(card);
1953 return -EIO; 1941 return -EIO;
1954 } 1942 }
@@ -2013,10 +2001,10 @@ static int snd_ali_chip_init(struct snd_ali *codec)
2013 unsigned char temp; 2001 unsigned char temp;
2014 struct pci_dev *pci_dev; 2002 struct pci_dev *pci_dev;
2015 2003
2016 snd_ali_printk("chip initializing ... \n"); 2004 dev_dbg(codec->card->dev, "chip initializing ...\n");
2017 2005
2018 if (snd_ali_reset_5451(codec)) { 2006 if (snd_ali_reset_5451(codec)) {
2019 snd_printk(KERN_ERR "ali_chip_init: reset 5451 error.\n"); 2007 dev_err(codec->card->dev, "ali_chip_init: reset 5451 error.\n");
2020 return -1; 2008 return -1;
2021 } 2009 }
2022 2010
@@ -2062,7 +2050,7 @@ static int snd_ali_chip_init(struct snd_ali *codec)
2062 ALI_REG(codec, ALI_SCTRL)); 2050 ALI_REG(codec, ALI_SCTRL));
2063 } 2051 }
2064 2052
2065 snd_ali_printk("chip initialize succeed.\n"); 2053 dev_dbg(codec->card->dev, "chip initialize succeed.\n");
2066 return 0; 2054 return 0;
2067 2055
2068} 2056}
@@ -2088,7 +2076,7 @@ static int snd_ali_resources(struct snd_ali *codec)
2088{ 2076{
2089 int err; 2077 int err;
2090 2078
2091 snd_ali_printk("resources allocation ...\n"); 2079 dev_dbg(codec->card->dev, "resources allocation ...\n");
2092 err = pci_request_regions(codec->pci, "ALI 5451"); 2080 err = pci_request_regions(codec->pci, "ALI 5451");
2093 if (err < 0) 2081 if (err < 0)
2094 return err; 2082 return err;
@@ -2096,11 +2084,11 @@ static int snd_ali_resources(struct snd_ali *codec)
2096 2084
2097 if (request_irq(codec->pci->irq, snd_ali_card_interrupt, 2085 if (request_irq(codec->pci->irq, snd_ali_card_interrupt,
2098 IRQF_SHARED, KBUILD_MODNAME, codec)) { 2086 IRQF_SHARED, KBUILD_MODNAME, codec)) {
2099 snd_printk(KERN_ERR "Unable to request irq.\n"); 2087 dev_err(codec->card->dev, "Unable to request irq.\n");
2100 return -EBUSY; 2088 return -EBUSY;
2101 } 2089 }
2102 codec->irq = codec->pci->irq; 2090 codec->irq = codec->pci->irq;
2103 snd_ali_printk("resources allocated.\n"); 2091 dev_dbg(codec->card->dev, "resources allocated.\n");
2104 return 0; 2092 return 0;
2105} 2093}
2106static int snd_ali_dev_free(struct snd_device *device) 2094static int snd_ali_dev_free(struct snd_device *device)
@@ -2125,7 +2113,7 @@ static int snd_ali_create(struct snd_card *card,
2125 2113
2126 *r_ali = NULL; 2114 *r_ali = NULL;
2127 2115
2128 snd_ali_printk("creating ...\n"); 2116 dev_dbg(card->dev, "creating ...\n");
2129 2117
2130 /* enable PCI device */ 2118 /* enable PCI device */
2131 err = pci_enable_device(pci); 2119 err = pci_enable_device(pci);
@@ -2134,8 +2122,8 @@ static int snd_ali_create(struct snd_card *card,
2134 /* check, if we can restrict PCI DMA transfers to 31 bits */ 2122 /* check, if we can restrict PCI DMA transfers to 31 bits */
2135 if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 || 2123 if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 ||
2136 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) { 2124 pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) {
2137 snd_printk(KERN_ERR "architecture does not support " 2125 dev_err(card->dev,
2138 "31bit PCI busmaster DMA\n"); 2126 "architecture does not support 31bit PCI busmaster DMA\n");
2139 pci_disable_device(pci); 2127 pci_disable_device(pci);
2140 return -ENXIO; 2128 return -ENXIO;
2141 } 2129 }
@@ -2199,19 +2187,19 @@ static int snd_ali_create(struct snd_card *card,
2199 /* M1533: southbridge */ 2187 /* M1533: southbridge */
2200 codec->pci_m1533 = pci_get_device(0x10b9, 0x1533, NULL); 2188 codec->pci_m1533 = pci_get_device(0x10b9, 0x1533, NULL);
2201 if (!codec->pci_m1533) { 2189 if (!codec->pci_m1533) {
2202 snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); 2190 dev_err(card->dev, "cannot find ALi 1533 chip.\n");
2203 snd_ali_free(codec); 2191 snd_ali_free(codec);
2204 return -ENODEV; 2192 return -ENODEV;
2205 } 2193 }
2206 /* M7101: power management */ 2194 /* M7101: power management */
2207 codec->pci_m7101 = pci_get_device(0x10b9, 0x7101, NULL); 2195 codec->pci_m7101 = pci_get_device(0x10b9, 0x7101, NULL);
2208 if (!codec->pci_m7101 && codec->revision == ALI_5451_V02) { 2196 if (!codec->pci_m7101 && codec->revision == ALI_5451_V02) {
2209 snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); 2197 dev_err(card->dev, "cannot find ALi 7101 chip.\n");
2210 snd_ali_free(codec); 2198 snd_ali_free(codec);
2211 return -ENODEV; 2199 return -ENODEV;
2212 } 2200 }
2213 2201
2214 snd_ali_printk("snd_device_new is called.\n"); 2202 dev_dbg(card->dev, "snd_device_new is called.\n");
2215 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, codec, &ops); 2203 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, codec, &ops);
2216 if (err < 0) { 2204 if (err < 0) {
2217 snd_ali_free(codec); 2205 snd_ali_free(codec);
@@ -2224,21 +2212,21 @@ static int snd_ali_create(struct snd_card *card,
2224 2212
2225 err = snd_ali_chip_init(codec); 2213 err = snd_ali_chip_init(codec);
2226 if (err < 0) { 2214 if (err < 0) {
2227 snd_printk(KERN_ERR "ali create: chip init error.\n"); 2215 dev_err(card->dev, "ali create: chip init error.\n");
2228 return err; 2216 return err;
2229 } 2217 }
2230 2218
2231#ifdef CONFIG_PM_SLEEP 2219#ifdef CONFIG_PM_SLEEP
2232 codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); 2220 codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL);
2233 if (!codec->image) 2221 if (!codec->image)
2234 snd_printk(KERN_WARNING "can't allocate apm buffer\n"); 2222 dev_warn(card->dev, "can't allocate apm buffer\n");
2235#endif 2223#endif
2236 2224
2237 snd_ali_enable_address_interrupt(codec); 2225 snd_ali_enable_address_interrupt(codec);
2238 codec->hw_initialized = 1; 2226 codec->hw_initialized = 1;
2239 2227
2240 *r_ali = codec; 2228 *r_ali = codec;
2241 snd_ali_printk("created.\n"); 2229 dev_dbg(card->dev, "created.\n");
2242 return 0; 2230 return 0;
2243} 2231}
2244 2232
@@ -2249,7 +2237,7 @@ static int snd_ali_probe(struct pci_dev *pci,
2249 struct snd_ali *codec; 2237 struct snd_ali *codec;
2250 int err; 2238 int err;
2251 2239
2252 snd_ali_printk("probe ...\n"); 2240 dev_dbg(&pci->dev, "probe ...\n");
2253 2241
2254 err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card); 2242 err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card);
2255 if (err < 0) 2243 if (err < 0)
@@ -2260,12 +2248,12 @@ static int snd_ali_probe(struct pci_dev *pci,
2260 goto error; 2248 goto error;
2261 card->private_data = codec; 2249 card->private_data = codec;
2262 2250
2263 snd_ali_printk("mixer building ...\n"); 2251 dev_dbg(&pci->dev, "mixer building ...\n");
2264 err = snd_ali_mixer(codec); 2252 err = snd_ali_mixer(codec);
2265 if (err < 0) 2253 if (err < 0)
2266 goto error; 2254 goto error;
2267 2255
2268 snd_ali_printk("pcm building ...\n"); 2256 dev_dbg(&pci->dev, "pcm building ...\n");
2269 err = snd_ali_build_pcms(codec); 2257 err = snd_ali_build_pcms(codec);
2270 if (err < 0) 2258 if (err < 0)
2271 goto error; 2259 goto error;
@@ -2278,7 +2266,7 @@ static int snd_ali_probe(struct pci_dev *pci,
2278 sprintf(card->longname, "%s at 0x%lx, irq %i", 2266 sprintf(card->longname, "%s at 0x%lx, irq %i",
2279 card->shortname, codec->port, codec->irq); 2267 card->shortname, codec->port, codec->irq);
2280 2268
2281 snd_ali_printk("register card.\n"); 2269 dev_dbg(&pci->dev, "register card.\n");
2282 err = snd_card_register(card); 2270 err = snd_card_register(card);
2283 if (err < 0) 2271 if (err < 0)
2284 goto error; 2272 goto error;