aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/cs46xx/cs46xx_lib.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2014-02-25 10:36:51 -0500
committerTakashi Iwai <tiwai@suse.de>2014-02-26 10:45:25 -0500
commit2b96a7f1fe6678e92850d5a150f1bf361ae1cb8e (patch)
tree5fe9c8ef698943e12e4995834b58b3fbf1dd4232 /sound/pci/cs46xx/cs46xx_lib.c
parent00980aa9c7ce2b5b54a5a7e7cf259f36fabdb249 (diff)
ALSA: cs46xx: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/cs46xx/cs46xx_lib.c')
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c143
1 files changed, 86 insertions, 57 deletions
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 28766478f81c..32b44f25b5c8 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -116,7 +116,7 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
116 116
117 tmp = snd_cs46xx_peekBA0(chip, BA0_ACCTL); 117 tmp = snd_cs46xx_peekBA0(chip, BA0_ACCTL);
118 if ((tmp & ACCTL_VFRM) == 0) { 118 if ((tmp & ACCTL_VFRM) == 0) {
119 snd_printk(KERN_WARNING "cs46xx: ACCTL_VFRM not set 0x%x\n",tmp); 119 dev_warn(chip->card->dev, "ACCTL_VFRM not set 0x%x\n", tmp);
120 snd_cs46xx_pokeBA0(chip, BA0_ACCTL, (tmp & (~ACCTL_ESYN)) | ACCTL_VFRM ); 120 snd_cs46xx_pokeBA0(chip, BA0_ACCTL, (tmp & (~ACCTL_ESYN)) | ACCTL_VFRM );
121 msleep(50); 121 msleep(50);
122 tmp = snd_cs46xx_peekBA0(chip, BA0_ACCTL + offset); 122 tmp = snd_cs46xx_peekBA0(chip, BA0_ACCTL + offset);
@@ -168,7 +168,8 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
168 goto ok1; 168 goto ok1;
169 } 169 }
170 170
171 snd_printk(KERN_ERR "AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg); 171 dev_err(chip->card->dev,
172 "AC'97 read problem (ACCTL_DCV), reg = 0x%x\n", reg);
172 result = 0xffff; 173 result = 0xffff;
173 goto end; 174 goto end;
174 175
@@ -187,7 +188,9 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
187 udelay(10); 188 udelay(10);
188 } 189 }
189 190
190 snd_printk(KERN_ERR "AC'97 read problem (ACSTS_VSTS), codec_index %d, reg = 0x%x\n", codec_index, reg); 191 dev_err(chip->card->dev,
192 "AC'97 read problem (ACSTS_VSTS), codec_index %d, reg = 0x%x\n",
193 codec_index, reg);
191 result = 0xffff; 194 result = 0xffff;
192 goto end; 195 goto end;
193 196
@@ -197,7 +200,8 @@ static unsigned short snd_cs46xx_codec_read(struct snd_cs46xx *chip,
197 * ACSDA = Status Data Register = 474h 200 * ACSDA = Status Data Register = 474h
198 */ 201 */
199#if 0 202#if 0
200 printk(KERN_DEBUG "e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg, 203 dev_dbg(chip->card->dev,
204 "e) reg = 0x%x, val = 0x%x, BA0_ACCAD = 0x%x\n", reg,
201 snd_cs46xx_peekBA0(chip, BA0_ACSDA), 205 snd_cs46xx_peekBA0(chip, BA0_ACSDA),
202 snd_cs46xx_peekBA0(chip, BA0_ACCAD)); 206 snd_cs46xx_peekBA0(chip, BA0_ACCAD));
203#endif 207#endif
@@ -286,7 +290,9 @@ static void snd_cs46xx_codec_write(struct snd_cs46xx *chip,
286 goto end; 290 goto end;
287 } 291 }
288 } 292 }
289 snd_printk(KERN_ERR "AC'97 write problem, codec_index = %d, reg = 0x%x, val = 0x%x\n", codec_index, reg, val); 293 dev_err(chip->card->dev,
294 "AC'97 write problem, codec_index = %d, reg = 0x%x, val = 0x%x\n",
295 codec_index, reg, val);
290 end: 296 end:
291 chip->active_ctrl(chip, -1); 297 chip->active_ctrl(chip, -1);
292} 298}
@@ -608,8 +614,8 @@ static int cs46xx_wait_for_fifo(struct snd_cs46xx * chip,int retry_timeout)
608 } 614 }
609 615
610 if(status & SERBST_WBSY) { 616 if(status & SERBST_WBSY) {
611 snd_printk(KERN_ERR "cs46xx: failure waiting for " 617 dev_err(chip->card->dev,
612 "FIFO command to complete\n"); 618 "failure waiting for FIFO command to complete\n");
613 return -EINVAL; 619 return -EINVAL;
614 } 620 }
615 621
@@ -646,7 +652,9 @@ static void snd_cs46xx_clear_serial_FIFOs(struct snd_cs46xx *chip)
646 * Make sure the previous FIFO write operation has completed. 652 * Make sure the previous FIFO write operation has completed.
647 */ 653 */
648 if (cs46xx_wait_for_fifo(chip,1)) { 654 if (cs46xx_wait_for_fifo(chip,1)) {
649 snd_printdd ("failed waiting for FIFO at addr (%02X)\n",idx); 655 dev_dbg(chip->card->dev,
656 "failed waiting for FIFO at addr (%02X)\n",
657 idx);
650 658
651 if (powerdown) 659 if (powerdown)
652 snd_cs46xx_pokeBA0(chip, BA0_CLKCR1, tmp); 660 snd_cs46xx_pokeBA0(chip, BA0_CLKCR1, tmp);
@@ -694,7 +702,7 @@ static void snd_cs46xx_proc_start(struct snd_cs46xx *chip)
694 } 702 }
695 703
696 if (snd_cs46xx_peek(chip, BA1_SPCR) & SPCR_RUNFR) 704 if (snd_cs46xx_peek(chip, BA1_SPCR) & SPCR_RUNFR)
697 snd_printk(KERN_ERR "SPCR_RUNFR never reset\n"); 705 dev_err(chip->card->dev, "SPCR_RUNFR never reset\n");
698} 706}
699 707
700static void snd_cs46xx_proc_stop(struct snd_cs46xx *chip) 708static void snd_cs46xx_proc_stop(struct snd_cs46xx *chip)
@@ -1054,7 +1062,8 @@ static int _cs46xx_adjust_sample_rate (struct snd_cs46xx *chip, struct snd_cs46x
1054 cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate, 1062 cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate,
1055 cpcm, cpcm->hw_buf.addr,cpcm->pcm_channel_id); 1063 cpcm, cpcm->hw_buf.addr,cpcm->pcm_channel_id);
1056 if (cpcm->pcm_channel == NULL) { 1064 if (cpcm->pcm_channel == NULL) {
1057 snd_printk(KERN_ERR "cs46xx: failed to create virtual PCM channel\n"); 1065 dev_err(chip->card->dev,
1066 "failed to create virtual PCM channel\n");
1058 return -ENOMEM; 1067 return -ENOMEM;
1059 } 1068 }
1060 cpcm->pcm_channel->sample_rate = sample_rate; 1069 cpcm->pcm_channel->sample_rate = sample_rate;
@@ -1067,7 +1076,8 @@ static int _cs46xx_adjust_sample_rate (struct snd_cs46xx *chip, struct snd_cs46x
1067 if ( (cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate, cpcm, 1076 if ( (cpcm->pcm_channel = cs46xx_dsp_create_pcm_channel (chip, sample_rate, cpcm,
1068 cpcm->hw_buf.addr, 1077 cpcm->hw_buf.addr,
1069 cpcm->pcm_channel_id)) == NULL) { 1078 cpcm->pcm_channel_id)) == NULL) {
1070 snd_printk(KERN_ERR "cs46xx: failed to re-create virtual PCM channel\n"); 1079 dev_err(chip->card->dev,
1080 "failed to re-create virtual PCM channel\n");
1071 return -ENOMEM; 1081 return -ENOMEM;
1072 } 1082 }
1073 1083
@@ -1116,7 +1126,8 @@ static int snd_cs46xx_playback_hw_params(struct snd_pcm_substream *substream,
1116 return -EINVAL; 1126 return -EINVAL;
1117 } 1127 }
1118 1128
1119 snd_printdd ("period_size (%d), periods (%d) buffer_size(%d)\n", 1129 dev_dbg(chip->card->dev,
1130 "period_size (%d), periods (%d) buffer_size(%d)\n",
1120 period_size, params_periods(hw_params), 1131 period_size, params_periods(hw_params),
1121 params_buffer_bytes(hw_params)); 1132 params_buffer_bytes(hw_params));
1122#endif 1133#endif
@@ -1531,22 +1542,20 @@ static int _cs46xx_playback_open_channel (struct snd_pcm_substream *substream,in
1531 1542
1532static int snd_cs46xx_playback_open(struct snd_pcm_substream *substream) 1543static int snd_cs46xx_playback_open(struct snd_pcm_substream *substream)
1533{ 1544{
1534 snd_printdd("open front channel\n"); 1545 dev_dbg(substream->pcm->card->dev, "open front channel\n");
1535 return _cs46xx_playback_open_channel(substream,DSP_PCM_MAIN_CHANNEL); 1546 return _cs46xx_playback_open_channel(substream,DSP_PCM_MAIN_CHANNEL);
1536} 1547}
1537 1548
1538#ifdef CONFIG_SND_CS46XX_NEW_DSP 1549#ifdef CONFIG_SND_CS46XX_NEW_DSP
1539static int snd_cs46xx_playback_open_rear(struct snd_pcm_substream *substream) 1550static int snd_cs46xx_playback_open_rear(struct snd_pcm_substream *substream)
1540{ 1551{
1541 snd_printdd("open rear channel\n"); 1552 dev_dbg(substream->pcm->card->dev, "open rear channel\n");
1542
1543 return _cs46xx_playback_open_channel(substream,DSP_PCM_REAR_CHANNEL); 1553 return _cs46xx_playback_open_channel(substream,DSP_PCM_REAR_CHANNEL);
1544} 1554}
1545 1555
1546static int snd_cs46xx_playback_open_clfe(struct snd_pcm_substream *substream) 1556static int snd_cs46xx_playback_open_clfe(struct snd_pcm_substream *substream)
1547{ 1557{
1548 snd_printdd("open center - LFE channel\n"); 1558 dev_dbg(substream->pcm->card->dev, "open center - LFE channel\n");
1549
1550 return _cs46xx_playback_open_channel(substream,DSP_PCM_CENTER_LFE_CHANNEL); 1559 return _cs46xx_playback_open_channel(substream,DSP_PCM_CENTER_LFE_CHANNEL);
1551} 1560}
1552 1561
@@ -1554,7 +1563,7 @@ static int snd_cs46xx_playback_open_iec958(struct snd_pcm_substream *substream)
1554{ 1563{
1555 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); 1564 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream);
1556 1565
1557 snd_printdd("open raw iec958 channel\n"); 1566 dev_dbg(chip->card->dev, "open raw iec958 channel\n");
1558 1567
1559 mutex_lock(&chip->spos_mutex); 1568 mutex_lock(&chip->spos_mutex);
1560 cs46xx_iec958_pre_open (chip); 1569 cs46xx_iec958_pre_open (chip);
@@ -1570,7 +1579,7 @@ static int snd_cs46xx_playback_close_iec958(struct snd_pcm_substream *substream)
1570 int err; 1579 int err;
1571 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream); 1580 struct snd_cs46xx *chip = snd_pcm_substream_chip(substream);
1572 1581
1573 snd_printdd("close raw iec958 channel\n"); 1582 dev_dbg(chip->card->dev, "close raw iec958 channel\n");
1574 1583
1575 err = snd_cs46xx_playback_close(substream); 1584 err = snd_cs46xx_playback_close(substream);
1576 1585
@@ -2421,10 +2430,10 @@ static void snd_cs46xx_codec_reset (struct snd_ac97 * ac97)
2421 2430
2422 /* set the desired CODEC mode */ 2431 /* set the desired CODEC mode */
2423 if (ac97->num == CS46XX_PRIMARY_CODEC_INDEX) { 2432 if (ac97->num == CS46XX_PRIMARY_CODEC_INDEX) {
2424 snd_printdd("cs46xx: CODEC1 mode %04x\n", 0x0); 2433 dev_dbg(ac97->bus->card->dev, "CODEC1 mode %04x\n", 0x0);
2425 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x0); 2434 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x0);
2426 } else if (ac97->num == CS46XX_SECONDARY_CODEC_INDEX) { 2435 } else if (ac97->num == CS46XX_SECONDARY_CODEC_INDEX) {
2427 snd_printdd("cs46xx: CODEC2 mode %04x\n", 0x3); 2436 dev_dbg(ac97->bus->card->dev, "CODEC2 mode %04x\n", 0x3);
2428 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x3); 2437 snd_cs46xx_ac97_write(ac97, AC97_CSR_ACMODE, 0x3);
2429 } else { 2438 } else {
2430 snd_BUG(); /* should never happen ... */ 2439 snd_BUG(); /* should never happen ... */
@@ -2456,7 +2465,8 @@ static void snd_cs46xx_codec_reset (struct snd_ac97 * ac97)
2456 msleep(10); 2465 msleep(10);
2457 } while (time_after_eq(end_time, jiffies)); 2466 } while (time_after_eq(end_time, jiffies));
2458 2467
2459 snd_printk(KERN_ERR "CS46xx secondary codec doesn't respond!\n"); 2468 dev_err(ac97->bus->card->dev,
2469 "CS46xx secondary codec doesn't respond!\n");
2460} 2470}
2461#endif 2471#endif
2462 2472
@@ -2476,7 +2486,8 @@ static int cs46xx_detect_codec(struct snd_cs46xx *chip, int codec)
2476 snd_cs46xx_codec_write(chip, AC97_RESET, 0, codec); 2486 snd_cs46xx_codec_write(chip, AC97_RESET, 0, codec);
2477 udelay(10); 2487 udelay(10);
2478 if (snd_cs46xx_codec_read(chip, AC97_RESET, codec) & 0x8000) { 2488 if (snd_cs46xx_codec_read(chip, AC97_RESET, codec) & 0x8000) {
2479 snd_printdd("snd_cs46xx: seconadry codec not present\n"); 2489 dev_dbg(chip->card->dev,
2490 "seconadry codec not present\n");
2480 return -ENXIO; 2491 return -ENXIO;
2481 } 2492 }
2482 } 2493 }
@@ -2489,7 +2500,7 @@ static int cs46xx_detect_codec(struct snd_cs46xx *chip, int codec)
2489 } 2500 }
2490 msleep(10); 2501 msleep(10);
2491 } 2502 }
2492 snd_printdd("snd_cs46xx: codec %d detection timeout\n", codec); 2503 dev_dbg(chip->card->dev, "codec %d detection timeout\n", codec);
2493 return -ENXIO; 2504 return -ENXIO;
2494} 2505}
2495 2506
@@ -2509,7 +2520,7 @@ int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device)
2509 2520
2510 /* detect primary codec */ 2521 /* detect primary codec */
2511 chip->nr_ac97_codecs = 0; 2522 chip->nr_ac97_codecs = 0;
2512 snd_printdd("snd_cs46xx: detecting primary codec\n"); 2523 dev_dbg(chip->card->dev, "detecting primary codec\n");
2513 if ((err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus)) < 0) 2524 if ((err = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus)) < 0)
2514 return err; 2525 return err;
2515 chip->ac97_bus->private_free = snd_cs46xx_mixer_free_ac97_bus; 2526 chip->ac97_bus->private_free = snd_cs46xx_mixer_free_ac97_bus;
@@ -2519,7 +2530,7 @@ int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device)
2519 chip->nr_ac97_codecs = 1; 2530 chip->nr_ac97_codecs = 1;
2520 2531
2521#ifdef CONFIG_SND_CS46XX_NEW_DSP 2532#ifdef CONFIG_SND_CS46XX_NEW_DSP
2522 snd_printdd("snd_cs46xx: detecting seconadry codec\n"); 2533 dev_dbg(chip->card->dev, "detecting seconadry codec\n");
2523 /* try detect a secondary codec */ 2534 /* try detect a secondary codec */
2524 if (! cs46xx_detect_codec(chip, CS46XX_SECONDARY_CODEC_INDEX)) 2535 if (! cs46xx_detect_codec(chip, CS46XX_SECONDARY_CODEC_INDEX))
2525 chip->nr_ac97_codecs = 2; 2536 chip->nr_ac97_codecs = 2;
@@ -2554,7 +2565,7 @@ int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device)
2554 } 2565 }
2555 /* do soundcard specific mixer setup */ 2566 /* do soundcard specific mixer setup */
2556 if (chip->mixer_init) { 2567 if (chip->mixer_init) {
2557 snd_printdd ("calling chip->mixer_init(chip);\n"); 2568 dev_dbg(chip->card->dev, "calling chip->mixer_init(chip);\n");
2558 chip->mixer_init(chip); 2569 chip->mixer_init(chip);
2559 } 2570 }
2560#endif 2571#endif
@@ -2801,7 +2812,8 @@ int snd_cs46xx_gameport(struct snd_cs46xx *chip)
2801 2812
2802 chip->gameport = gp = gameport_allocate_port(); 2813 chip->gameport = gp = gameport_allocate_port();
2803 if (!gp) { 2814 if (!gp) {
2804 printk(KERN_ERR "cs46xx: cannot allocate memory for gameport\n"); 2815 dev_err(chip->card->dev,
2816 "cannot allocate memory for gameport\n");
2805 return -ENOMEM; 2817 return -ENOMEM;
2806 } 2818 }
2807 2819
@@ -3138,8 +3150,10 @@ static int snd_cs46xx_chip_init(struct snd_cs46xx *chip)
3138 } 3150 }
3139 3151
3140 3152
3141 snd_printk(KERN_ERR "create - never read codec ready from AC'97\n"); 3153 dev_err(chip->card->dev,
3142 snd_printk(KERN_ERR "it is not probably bug, try to use CS4236 driver\n"); 3154 "create - never read codec ready from AC'97\n");
3155 dev_err(chip->card->dev,
3156 "it is not probably bug, try to use CS4236 driver\n");
3143 return -EIO; 3157 return -EIO;
3144 ok1: 3158 ok1:
3145#ifdef CONFIG_SND_CS46XX_NEW_DSP 3159#ifdef CONFIG_SND_CS46XX_NEW_DSP
@@ -3157,7 +3171,8 @@ static int snd_cs46xx_chip_init(struct snd_cs46xx *chip)
3157 * Make sure CODEC is READY. 3171 * Make sure CODEC is READY.
3158 */ 3172 */
3159 if (!(snd_cs46xx_peekBA0(chip, BA0_ACSTS2) & ACSTS_CRDY)) 3173 if (!(snd_cs46xx_peekBA0(chip, BA0_ACSTS2) & ACSTS_CRDY))
3160 snd_printdd("cs46xx: never read card ready from secondary AC'97\n"); 3174 dev_dbg(chip->card->dev,
3175 "never read card ready from secondary AC'97\n");
3161 } 3176 }
3162#endif 3177#endif
3163 3178
@@ -3187,17 +3202,21 @@ static int snd_cs46xx_chip_init(struct snd_cs46xx *chip)
3187 } 3202 }
3188 3203
3189#ifndef CONFIG_SND_CS46XX_NEW_DSP 3204#ifndef CONFIG_SND_CS46XX_NEW_DSP
3190 snd_printk(KERN_ERR "create - never read ISV3 & ISV4 from AC'97\n"); 3205 dev_err(chip->card->dev,
3206 "create - never read ISV3 & ISV4 from AC'97\n");
3191 return -EIO; 3207 return -EIO;
3192#else 3208#else
3193 /* This may happen on a cold boot with a Terratec SiXPack 5.1. 3209 /* This may happen on a cold boot with a Terratec SiXPack 5.1.
3194 Reloading the driver may help, if there's other soundcards 3210 Reloading the driver may help, if there's other soundcards
3195 with the same problem I would like to know. (Benny) */ 3211 with the same problem I would like to know. (Benny) */
3196 3212
3197 snd_printk(KERN_ERR "ERROR: snd-cs46xx: never read ISV3 & ISV4 from AC'97\n"); 3213 dev_err(chip->card->dev, "never read ISV3 & ISV4 from AC'97\n");
3198 snd_printk(KERN_ERR " Try reloading the ALSA driver, if you find something\n"); 3214 dev_err(chip->card->dev,
3199 snd_printk(KERN_ERR " broken or not working on your soundcard upon\n"); 3215 "Try reloading the ALSA driver, if you find something\n");
3200 snd_printk(KERN_ERR " this message please report to alsa-devel@alsa-project.org\n"); 3216 dev_err(chip->card->dev,
3217 "broken or not working on your soundcard upon\n");
3218 dev_err(chip->card->dev,
3219 "this message please report to alsa-devel@alsa-project.org\n");
3201 3220
3202 return -EIO; 3221 return -EIO;
3203#endif 3222#endif
@@ -3266,13 +3285,13 @@ int snd_cs46xx_start_dsp(struct snd_cs46xx *chip)
3266 for (i = 0; i < CS46XX_DSP_MODULES; i++) { 3285 for (i = 0; i < CS46XX_DSP_MODULES; i++) {
3267 err = load_firmware(chip, &chip->modules[i], module_names[i]); 3286 err = load_firmware(chip, &chip->modules[i], module_names[i]);
3268 if (err < 0) { 3287 if (err < 0) {
3269 snd_printk(KERN_ERR "firmware load error [%s]\n", 3288 dev_err(chip->card->dev, "firmware load error [%s]\n",
3270 module_names[i]); 3289 module_names[i]);
3271 return err; 3290 return err;
3272 } 3291 }
3273 err = cs46xx_dsp_load_module(chip, chip->modules[i]); 3292 err = cs46xx_dsp_load_module(chip, chip->modules[i]);
3274 if (err < 0) { 3293 if (err < 0) {
3275 snd_printk(KERN_ERR "image download error [%s]\n", 3294 dev_err(chip->card->dev, "image download error [%s]\n",
3276 module_names[i]); 3295 module_names[i]);
3277 return err; 3296 return err;
3278 } 3297 }
@@ -3288,7 +3307,7 @@ int snd_cs46xx_start_dsp(struct snd_cs46xx *chip)
3288 /* old image */ 3307 /* old image */
3289 err = snd_cs46xx_download_image(chip); 3308 err = snd_cs46xx_download_image(chip);
3290 if (err < 0) { 3309 if (err < 0) {
3291 snd_printk(KERN_ERR "image download error\n"); 3310 dev_err(chip->card->dev, "image download error\n");
3292 return err; 3311 return err;
3293 } 3312 }
3294 3313
@@ -3341,7 +3360,7 @@ static int voyetra_setup_eapd_slot(struct snd_cs46xx *chip)
3341 u32 idx, valid_slots,tmp,powerdown = 0; 3360 u32 idx, valid_slots,tmp,powerdown = 0;
3342 u16 modem_power,pin_config,logic_type; 3361 u16 modem_power,pin_config,logic_type;
3343 3362
3344 snd_printdd ("cs46xx: cs46xx_setup_eapd_slot()+\n"); 3363 dev_dbg(chip->card->dev, "cs46xx_setup_eapd_slot()+\n");
3345 3364
3346 /* 3365 /*
3347 * See if the devices are powered down. If so, we must power them up first 3366 * See if the devices are powered down. If so, we must power them up first
@@ -3359,7 +3378,8 @@ static int voyetra_setup_eapd_slot(struct snd_cs46xx *chip)
3359 * stuff. 3378 * stuff.
3360 */ 3379 */
3361 if(chip->nr_ac97_codecs != 2) { 3380 if(chip->nr_ac97_codecs != 2) {
3362 snd_printk (KERN_ERR "cs46xx: cs46xx_setup_eapd_slot() - no secondary codec configured\n"); 3381 dev_err(chip->card->dev,
3382 "cs46xx_setup_eapd_slot() - no secondary codec configured\n");
3363 return -EINVAL; 3383 return -EINVAL;
3364 } 3384 }
3365 3385
@@ -3400,7 +3420,7 @@ static int voyetra_setup_eapd_slot(struct snd_cs46xx *chip)
3400 snd_cs46xx_pokeBA0(chip, BA0_ACOSV, valid_slots); 3420 snd_cs46xx_pokeBA0(chip, BA0_ACOSV, valid_slots);
3401 3421
3402 if ( cs46xx_wait_for_fifo(chip,1) ) { 3422 if ( cs46xx_wait_for_fifo(chip,1) ) {
3403 snd_printdd("FIFO is busy\n"); 3423 dev_dbg(chip->card->dev, "FIFO is busy\n");
3404 3424
3405 return -EINVAL; 3425 return -EINVAL;
3406 } 3426 }
@@ -3421,7 +3441,9 @@ static int voyetra_setup_eapd_slot(struct snd_cs46xx *chip)
3421 * Wait for command to complete 3441 * Wait for command to complete
3422 */ 3442 */
3423 if ( cs46xx_wait_for_fifo(chip,200) ) { 3443 if ( cs46xx_wait_for_fifo(chip,200) ) {
3424 snd_printdd("failed waiting for FIFO at addr (%02X)\n",idx); 3444 dev_dbg(chip->card->dev,
3445 "failed waiting for FIFO at addr (%02X)\n",
3446 idx);
3425 3447
3426 return -EINVAL; 3448 return -EINVAL;
3427 } 3449 }
@@ -3510,14 +3532,14 @@ static void amp_hercules(struct snd_cs46xx *chip, int change)
3510 3532
3511 chip->amplifier += change; 3533 chip->amplifier += change;
3512 if (chip->amplifier && !old) { 3534 if (chip->amplifier && !old) {
3513 snd_printdd ("Hercules amplifier ON\n"); 3535 dev_dbg(chip->card->dev, "Hercules amplifier ON\n");
3514 3536
3515 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, 3537 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR,
3516 EGPIODR_GPOE2 | val1); /* enable EGPIO2 output */ 3538 EGPIODR_GPOE2 | val1); /* enable EGPIO2 output */
3517 snd_cs46xx_pokeBA0(chip, BA0_EGPIOPTR, 3539 snd_cs46xx_pokeBA0(chip, BA0_EGPIOPTR,
3518 EGPIOPTR_GPPT2 | val2); /* open-drain on output */ 3540 EGPIOPTR_GPPT2 | val2); /* open-drain on output */
3519 } else if (old && !chip->amplifier) { 3541 } else if (old && !chip->amplifier) {
3520 snd_printdd ("Hercules amplifier OFF\n"); 3542 dev_dbg(chip->card->dev, "Hercules amplifier OFF\n");
3521 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, val1 & ~EGPIODR_GPOE2); /* disable */ 3543 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, val1 & ~EGPIODR_GPOE2); /* disable */
3522 snd_cs46xx_pokeBA0(chip, BA0_EGPIOPTR, val2 & ~EGPIOPTR_GPPT2); /* disable */ 3544 snd_cs46xx_pokeBA0(chip, BA0_EGPIOPTR, val2 & ~EGPIOPTR_GPPT2); /* disable */
3523 } 3545 }
@@ -3525,7 +3547,7 @@ static void amp_hercules(struct snd_cs46xx *chip, int change)
3525 3547
3526static void voyetra_mixer_init (struct snd_cs46xx *chip) 3548static void voyetra_mixer_init (struct snd_cs46xx *chip)
3527{ 3549{
3528 snd_printdd ("initializing Voyetra mixer\n"); 3550 dev_dbg(chip->card->dev, "initializing Voyetra mixer\n");
3529 3551
3530 /* Enable SPDIF out */ 3552 /* Enable SPDIF out */
3531 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, EGPIODR_GPOE0); 3553 snd_cs46xx_pokeBA0(chip, BA0_EGPIODR, EGPIODR_GPOE0);
@@ -3543,7 +3565,7 @@ static void hercules_mixer_init (struct snd_cs46xx *chip)
3543 /* set EGPIO to default */ 3565 /* set EGPIO to default */
3544 hercules_init(chip); 3566 hercules_init(chip);
3545 3567
3546 snd_printdd ("initializing Hercules mixer\n"); 3568 dev_dbg(chip->card->dev, "initializing Hercules mixer\n");
3547 3569
3548#ifdef CONFIG_SND_CS46XX_NEW_DSP 3570#ifdef CONFIG_SND_CS46XX_NEW_DSP
3549 if (chip->in_suspend) 3571 if (chip->in_suspend)
@@ -3554,7 +3576,9 @@ static void hercules_mixer_init (struct snd_cs46xx *chip)
3554 3576
3555 kctl = snd_ctl_new1(&snd_hercules_controls[idx], chip); 3577 kctl = snd_ctl_new1(&snd_hercules_controls[idx], chip);
3556 if ((err = snd_ctl_add(card, kctl)) < 0) { 3578 if ((err = snd_ctl_add(card, kctl)) < 0) {
3557 printk (KERN_ERR "cs46xx: failed to initialize Hercules mixer (%d)\n",err); 3579 dev_err(card->dev,
3580 "failed to initialize Hercules mixer (%d)\n",
3581 err);
3558 break; 3582 break;
3559 } 3583 }
3560 } 3584 }
@@ -3826,8 +3850,7 @@ static int snd_cs46xx_resume(struct device *dev)
3826 pci_set_power_state(pci, PCI_D0); 3850 pci_set_power_state(pci, PCI_D0);
3827 pci_restore_state(pci); 3851 pci_restore_state(pci);
3828 if (pci_enable_device(pci) < 0) { 3852 if (pci_enable_device(pci) < 0) {
3829 printk(KERN_ERR "cs46xx: pci_enable_device failed, " 3853 dev_err(dev, "pci_enable_device failed, disabling device\n");
3830 "disabling device\n");
3831 snd_card_disconnect(card); 3854 snd_card_disconnect(card);
3832 return -EIO; 3855 return -EIO;
3833 } 3856 }
@@ -3932,7 +3955,8 @@ int snd_cs46xx_create(struct snd_card *card,
3932 chip->ba1_addr = pci_resource_start(pci, 1); 3955 chip->ba1_addr = pci_resource_start(pci, 1);
3933 if (chip->ba0_addr == 0 || chip->ba0_addr == (unsigned long)~0 || 3956 if (chip->ba0_addr == 0 || chip->ba0_addr == (unsigned long)~0 ||
3934 chip->ba1_addr == 0 || chip->ba1_addr == (unsigned long)~0) { 3957 chip->ba1_addr == 0 || chip->ba1_addr == (unsigned long)~0) {
3935 snd_printk(KERN_ERR "wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n", 3958 dev_err(chip->card->dev,
3959 "wrong address(es) - ba0 = 0x%lx, ba1 = 0x%lx\n",
3936 chip->ba0_addr, chip->ba1_addr); 3960 chip->ba0_addr, chip->ba1_addr);
3937 snd_cs46xx_free(chip); 3961 snd_cs46xx_free(chip);
3938 return -ENOMEM; 3962 return -ENOMEM;
@@ -3969,7 +3993,8 @@ int snd_cs46xx_create(struct snd_card *card,
3969 3993
3970 for (cp = &cards[0]; cp->name; cp++) { 3994 for (cp = &cards[0]; cp->name; cp++) {
3971 if (cp->vendor == ss_vendor && cp->id == ss_card) { 3995 if (cp->vendor == ss_vendor && cp->id == ss_card) {
3972 snd_printdd ("hack for %s enabled\n", cp->name); 3996 dev_dbg(chip->card->dev, "hack for %s enabled\n",
3997 cp->name);
3973 3998
3974 chip->amplifier_ctrl = cp->amp; 3999 chip->amplifier_ctrl = cp->amp;
3975 chip->active_ctrl = cp->active; 4000 chip->active_ctrl = cp->active;
@@ -3982,12 +4007,14 @@ int snd_cs46xx_create(struct snd_card *card,
3982 } 4007 }
3983 4008
3984 if (external_amp) { 4009 if (external_amp) {
3985 snd_printk(KERN_INFO "Crystal EAPD support forced on.\n"); 4010 dev_info(chip->card->dev,
4011 "Crystal EAPD support forced on.\n");
3986 chip->amplifier_ctrl = amp_voyetra; 4012 chip->amplifier_ctrl = amp_voyetra;
3987 } 4013 }
3988 4014
3989 if (thinkpad) { 4015 if (thinkpad) {
3990 snd_printk(KERN_INFO "Activating CLKRUN hack for Thinkpad.\n"); 4016 dev_info(chip->card->dev,
4017 "Activating CLKRUN hack for Thinkpad.\n");
3991 chip->active_ctrl = clkrun_hack; 4018 chip->active_ctrl = clkrun_hack;
3992 clkrun_init(chip); 4019 clkrun_init(chip);
3993 } 4020 }
@@ -4005,14 +4032,16 @@ int snd_cs46xx_create(struct snd_card *card,
4005 region = &chip->region.idx[idx]; 4032 region = &chip->region.idx[idx];
4006 if ((region->resource = request_mem_region(region->base, region->size, 4033 if ((region->resource = request_mem_region(region->base, region->size,
4007 region->name)) == NULL) { 4034 region->name)) == NULL) {
4008 snd_printk(KERN_ERR "unable to request memory region 0x%lx-0x%lx\n", 4035 dev_err(chip->card->dev,
4036 "unable to request memory region 0x%lx-0x%lx\n",
4009 region->base, region->base + region->size - 1); 4037 region->base, region->base + region->size - 1);
4010 snd_cs46xx_free(chip); 4038 snd_cs46xx_free(chip);
4011 return -EBUSY; 4039 return -EBUSY;
4012 } 4040 }
4013 region->remap_addr = ioremap_nocache(region->base, region->size); 4041 region->remap_addr = ioremap_nocache(region->base, region->size);
4014 if (region->remap_addr == NULL) { 4042 if (region->remap_addr == NULL) {
4015 snd_printk(KERN_ERR "%s ioremap problem\n", region->name); 4043 dev_err(chip->card->dev,
4044 "%s ioremap problem\n", region->name);
4016 snd_cs46xx_free(chip); 4045 snd_cs46xx_free(chip);
4017 return -ENOMEM; 4046 return -ENOMEM;
4018 } 4047 }
@@ -4020,7 +4049,7 @@ int snd_cs46xx_create(struct snd_card *card,
4020 4049
4021 if (request_irq(pci->irq, snd_cs46xx_interrupt, IRQF_SHARED, 4050 if (request_irq(pci->irq, snd_cs46xx_interrupt, IRQF_SHARED,
4022 KBUILD_MODNAME, chip)) { 4051 KBUILD_MODNAME, chip)) {
4023 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 4052 dev_err(chip->card->dev, "unable to grab IRQ %d\n", pci->irq);
4024 snd_cs46xx_free(chip); 4053 snd_cs46xx_free(chip);
4025 return -EBUSY; 4054 return -EBUSY;
4026 } 4055 }