diff options
author | Takashi Iwai <tiwai@suse.de> | 2014-02-25 08:04:46 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-02-26 10:45:14 -0500 |
commit | 4a8d9d717f9498fb80f8e34d5c779a2bf62379f1 (patch) | |
tree | 25a9f9bdb9b3d4891e9ff1e1bc5e22fa95f3cdab /sound/pci | |
parent | 4162cd3843af8a93e70847ff20e65d25ee451e8a (diff) |
ALSA: azt3328: Use standard printk helpers
Convert with dev_err() and co from snd_printk(), etc.
All debug print macros have been replaced with dev_dbg(), too.
Also, added the missing definition of snd_azf3328_ctrl_inw().
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/azt3328.c | 288 |
1 files changed, 124 insertions, 164 deletions
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c index d5a00f337ab9..c9216c0a9c8b 100644 --- a/sound/pci/azt3328.c +++ b/sound/pci/azt3328.c | |||
@@ -238,51 +238,6 @@ MODULE_SUPPORTED_DEVICE("{{Aztech,AZF3328}}"); | |||
238 | 2>/dev/null | 238 | 2>/dev/null |
239 | */ | 239 | */ |
240 | 240 | ||
241 | #define DEBUG_MISC 0 | ||
242 | #define DEBUG_CALLS 0 | ||
243 | #define DEBUG_MIXER 0 | ||
244 | #define DEBUG_CODEC 0 | ||
245 | #define DEBUG_TIMER 0 | ||
246 | #define DEBUG_GAME 0 | ||
247 | #define DEBUG_PM 0 | ||
248 | #define MIXER_TESTING 0 | ||
249 | |||
250 | #if DEBUG_MISC | ||
251 | #define snd_azf3328_dbgmisc(format, args...) printk(KERN_DEBUG format, ##args) | ||
252 | #else | ||
253 | #define snd_azf3328_dbgmisc(format, args...) | ||
254 | #endif | ||
255 | |||
256 | #if DEBUG_MIXER | ||
257 | #define snd_azf3328_dbgmixer(format, args...) printk(KERN_DEBUG format, ##args) | ||
258 | #else | ||
259 | #define snd_azf3328_dbgmixer(format, args...) | ||
260 | #endif | ||
261 | |||
262 | #if DEBUG_CODEC | ||
263 | #define snd_azf3328_dbgcodec(format, args...) printk(KERN_DEBUG format, ##args) | ||
264 | #else | ||
265 | #define snd_azf3328_dbgcodec(format, args...) | ||
266 | #endif | ||
267 | |||
268 | #if DEBUG_MISC | ||
269 | #define snd_azf3328_dbgtimer(format, args...) printk(KERN_DEBUG format, ##args) | ||
270 | #else | ||
271 | #define snd_azf3328_dbgtimer(format, args...) | ||
272 | #endif | ||
273 | |||
274 | #if DEBUG_GAME | ||
275 | #define snd_azf3328_dbggame(format, args...) printk(KERN_DEBUG format, ##args) | ||
276 | #else | ||
277 | #define snd_azf3328_dbggame(format, args...) | ||
278 | #endif | ||
279 | |||
280 | #if DEBUG_PM | ||
281 | #define snd_azf3328_dbgpm(format, args...) printk(KERN_DEBUG format, ##args) | ||
282 | #else | ||
283 | #define snd_azf3328_dbgpm(format, args...) | ||
284 | #endif | ||
285 | |||
286 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ | 241 | static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ |
287 | module_param_array(index, int, NULL, 0444); | 242 | module_param_array(index, int, NULL, 0444); |
288 | MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard."); | 243 | MODULE_PARM_DESC(index, "Index value for AZF3328 soundcard."); |
@@ -465,6 +420,12 @@ snd_azf3328_ctrl_inb(const struct snd_azf3328 *chip, unsigned reg) | |||
465 | return inb(chip->ctrl_io + reg); | 420 | return inb(chip->ctrl_io + reg); |
466 | } | 421 | } |
467 | 422 | ||
423 | static inline u16 | ||
424 | snd_azf3328_ctrl_inw(const struct snd_azf3328 *chip, unsigned reg) | ||
425 | { | ||
426 | return inw(chip->ctrl_io + reg); | ||
427 | } | ||
428 | |||
468 | static inline void | 429 | static inline void |
469 | snd_azf3328_ctrl_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value) | 430 | snd_azf3328_ctrl_outw(const struct snd_azf3328 *chip, unsigned reg, u16 value) |
470 | { | 431 | { |
@@ -568,11 +529,12 @@ snd_azf3328_mixer_reset(const struct snd_azf3328 *chip) | |||
568 | #ifdef AZF_USE_AC97_LAYER | 529 | #ifdef AZF_USE_AC97_LAYER |
569 | 530 | ||
570 | static inline void | 531 | static inline void |
571 | snd_azf3328_mixer_ac97_map_unsupported(unsigned short reg, const char *mode) | 532 | snd_azf3328_mixer_ac97_map_unsupported(const struct snd_azf3328 *chip, |
533 | unsigned short reg, const char *mode) | ||
572 | { | 534 | { |
573 | /* need to add some more or less clever emulation? */ | 535 | /* need to add some more or less clever emulation? */ |
574 | printk(KERN_WARNING | 536 | dev_warn(chip->card->dev, |
575 | "azt3328: missing %s emulation for AC97 register 0x%02x!\n", | 537 | "missing %s emulation for AC97 register 0x%02x!\n", |
576 | mode, reg); | 538 | mode, reg); |
577 | } | 539 | } |
578 | 540 | ||
@@ -707,10 +669,8 @@ snd_azf3328_mixer_ac97_read(struct snd_ac97 *ac97, unsigned short reg_ac97) | |||
707 | unsigned short reg_val = 0; | 669 | unsigned short reg_val = 0; |
708 | bool unsupported = false; | 670 | bool unsupported = false; |
709 | 671 | ||
710 | snd_azf3328_dbgmixer( | 672 | dev_dbg(chip->card->dev, "snd_azf3328_mixer_ac97_read reg_ac97 %u\n", |
711 | "snd_azf3328_mixer_ac97_read reg_ac97 %u\n", | 673 | reg_ac97); |
712 | reg_ac97 | ||
713 | ); | ||
714 | if (reg_azf & AZF_AC97_REG_UNSUPPORTED) | 674 | if (reg_azf & AZF_AC97_REG_UNSUPPORTED) |
715 | unsupported = true; | 675 | unsupported = true; |
716 | else { | 676 | else { |
@@ -755,7 +715,7 @@ snd_azf3328_mixer_ac97_read(struct snd_ac97 *ac97, unsigned short reg_ac97) | |||
755 | } | 715 | } |
756 | } | 716 | } |
757 | if (unsupported) | 717 | if (unsupported) |
758 | snd_azf3328_mixer_ac97_map_unsupported(reg_ac97, "read"); | 718 | snd_azf3328_mixer_ac97_map_unsupported(chip, reg_ac97, "read"); |
759 | 719 | ||
760 | return reg_val; | 720 | return reg_val; |
761 | } | 721 | } |
@@ -768,10 +728,9 @@ snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97, | |||
768 | unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97); | 728 | unsigned short reg_azf = snd_azf3328_mixer_ac97_map_reg_idx(reg_ac97); |
769 | bool unsupported = false; | 729 | bool unsupported = false; |
770 | 730 | ||
771 | snd_azf3328_dbgmixer( | 731 | dev_dbg(chip->card->dev, |
772 | "snd_azf3328_mixer_ac97_write reg_ac97 %u val %u\n", | 732 | "snd_azf3328_mixer_ac97_write reg_ac97 %u val %u\n", |
773 | reg_ac97, val | 733 | reg_ac97, val); |
774 | ); | ||
775 | if (reg_azf & AZF_AC97_REG_UNSUPPORTED) | 734 | if (reg_azf & AZF_AC97_REG_UNSUPPORTED) |
776 | unsupported = true; | 735 | unsupported = true; |
777 | else { | 736 | else { |
@@ -804,7 +763,7 @@ snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97, | |||
804 | } | 763 | } |
805 | } | 764 | } |
806 | if (unsupported) | 765 | if (unsupported) |
807 | snd_azf3328_mixer_ac97_map_unsupported(reg_ac97, "write"); | 766 | snd_azf3328_mixer_ac97_map_unsupported(chip, reg_ac97, "write"); |
808 | } | 767 | } |
809 | 768 | ||
810 | static int | 769 | static int |
@@ -840,7 +799,7 @@ snd_azf3328_mixer_new(struct snd_azf3328 *chip) | |||
840 | * due to this card being a very quirky AC97 "lookalike". | 799 | * due to this card being a very quirky AC97 "lookalike". |
841 | */ | 800 | */ |
842 | if (rc) | 801 | if (rc) |
843 | printk(KERN_ERR "azt3328: AC97 init failed, err %d!\n", rc); | 802 | dev_err(chip->card->dev, "AC97 init failed, err %d!\n", rc); |
844 | 803 | ||
845 | /* If we return an error here, then snd_card_free() should | 804 | /* If we return an error here, then snd_card_free() should |
846 | * free up any ac97 codecs that got created, as well as the bus. | 805 | * free up any ac97 codecs that got created, as well as the bus. |
@@ -1007,8 +966,8 @@ snd_azf3328_get_mixer(struct snd_kcontrol *kcontrol, | |||
1007 | val = reg.mask - val; | 966 | val = reg.mask - val; |
1008 | ucontrol->value.integer.value[1] = val; | 967 | ucontrol->value.integer.value[1] = val; |
1009 | } | 968 | } |
1010 | snd_azf3328_dbgmixer("get: %02x is %04x -> vol %02lx|%02lx " | 969 | dev_dbg(chip->card->dev, |
1011 | "(shift %02d|%02d, mask %02x, inv. %d, stereo %d)\n", | 970 | "get: %02x is %04x -> vol %02lx|%02lx (shift %02d|%02d, mask %02x, inv. %d, stereo %d)\n", |
1012 | reg.reg, oreg, | 971 | reg.reg, oreg, |
1013 | ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], | 972 | ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], |
1014 | reg.lchan_shift, reg.rchan_shift, reg.mask, reg.invert, reg.stereo); | 973 | reg.lchan_shift, reg.rchan_shift, reg.mask, reg.invert, reg.stereo); |
@@ -1046,8 +1005,8 @@ snd_azf3328_put_mixer(struct snd_kcontrol *kcontrol, | |||
1046 | else | 1005 | else |
1047 | snd_azf3328_mixer_outw(chip, reg.reg, nreg); | 1006 | snd_azf3328_mixer_outw(chip, reg.reg, nreg); |
1048 | 1007 | ||
1049 | snd_azf3328_dbgmixer("put: %02x to %02lx|%02lx, " | 1008 | dev_dbg(chip->card->dev, |
1050 | "oreg %04x; shift %02d|%02d -> nreg %04x; after: %04x\n", | 1009 | "put: %02x to %02lx|%02lx, oreg %04x; shift %02d|%02d -> nreg %04x; after: %04x\n", |
1051 | reg.reg, ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], | 1010 | reg.reg, ucontrol->value.integer.value[0], ucontrol->value.integer.value[1], |
1052 | oreg, reg.lchan_shift, reg.rchan_shift, | 1011 | oreg, reg.lchan_shift, reg.rchan_shift, |
1053 | nreg, snd_azf3328_mixer_inw(chip, reg.reg)); | 1012 | nreg, snd_azf3328_mixer_inw(chip, reg.reg)); |
@@ -1116,7 +1075,8 @@ snd_azf3328_get_mixer_enum(struct snd_kcontrol *kcontrol, | |||
1116 | } else | 1075 | } else |
1117 | ucontrol->value.enumerated.item[0] = (val >> reg.lchan_shift) & (reg.enum_c - 1); | 1076 | ucontrol->value.enumerated.item[0] = (val >> reg.lchan_shift) & (reg.enum_c - 1); |
1118 | 1077 | ||
1119 | snd_azf3328_dbgmixer("get_enum: %02x is %04x -> %d|%d (shift %02d, enum_c %d)\n", | 1078 | dev_dbg(chip->card->dev, |
1079 | "get_enum: %02x is %04x -> %d|%d (shift %02d, enum_c %d)\n", | ||
1120 | reg.reg, val, ucontrol->value.enumerated.item[0], ucontrol->value.enumerated.item[1], | 1080 | reg.reg, val, ucontrol->value.enumerated.item[0], ucontrol->value.enumerated.item[1], |
1121 | reg.lchan_shift, reg.enum_c); | 1081 | reg.lchan_shift, reg.enum_c); |
1122 | return 0; | 1082 | return 0; |
@@ -1148,7 +1108,8 @@ snd_azf3328_put_mixer_enum(struct snd_kcontrol *kcontrol, | |||
1148 | snd_azf3328_mixer_outw(chip, reg.reg, val); | 1108 | snd_azf3328_mixer_outw(chip, reg.reg, val); |
1149 | nreg = val; | 1109 | nreg = val; |
1150 | 1110 | ||
1151 | snd_azf3328_dbgmixer("put_enum: %02x to %04x, oreg %04x\n", reg.reg, val, oreg); | 1111 | dev_dbg(chip->card->dev, |
1112 | "put_enum: %02x to %04x, oreg %04x\n", reg.reg, val, oreg); | ||
1152 | return (nreg != oreg); | 1113 | return (nreg != oreg); |
1153 | } | 1114 | } |
1154 | 1115 | ||
@@ -1375,15 +1336,16 @@ snd_azf3328_ctrl_reg_6AH_update(struct snd_azf3328 *chip, | |||
1375 | chip->shadow_reg_ctrl_6AH |= bitmask; | 1336 | chip->shadow_reg_ctrl_6AH |= bitmask; |
1376 | else | 1337 | else |
1377 | chip->shadow_reg_ctrl_6AH &= ~bitmask; | 1338 | chip->shadow_reg_ctrl_6AH &= ~bitmask; |
1378 | snd_azf3328_dbgcodec("6AH_update mask 0x%04x do_mask %d: val 0x%04x\n", | 1339 | dev_dbg(chip->card->dev, |
1379 | bitmask, do_mask, chip->shadow_reg_ctrl_6AH); | 1340 | "6AH_update mask 0x%04x do_mask %d: val 0x%04x\n", |
1341 | bitmask, do_mask, chip->shadow_reg_ctrl_6AH); | ||
1380 | snd_azf3328_ctrl_outw(chip, IDX_IO_6AH, chip->shadow_reg_ctrl_6AH); | 1342 | snd_azf3328_ctrl_outw(chip, IDX_IO_6AH, chip->shadow_reg_ctrl_6AH); |
1381 | } | 1343 | } |
1382 | 1344 | ||
1383 | static inline void | 1345 | static inline void |
1384 | snd_azf3328_ctrl_enable_codecs(struct snd_azf3328 *chip, bool enable) | 1346 | snd_azf3328_ctrl_enable_codecs(struct snd_azf3328 *chip, bool enable) |
1385 | { | 1347 | { |
1386 | snd_azf3328_dbgcodec("codec_enable %d\n", enable); | 1348 | dev_dbg(chip->card->dev, "codec_enable %d\n", enable); |
1387 | /* no idea what exactly is being done here, but I strongly assume it's | 1349 | /* no idea what exactly is being done here, but I strongly assume it's |
1388 | * PM related */ | 1350 | * PM related */ |
1389 | snd_azf3328_ctrl_reg_6AH_update( | 1351 | snd_azf3328_ctrl_reg_6AH_update( |
@@ -1400,7 +1362,7 @@ snd_azf3328_ctrl_codec_activity(struct snd_azf3328 *chip, | |||
1400 | struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; | 1362 | struct snd_azf3328_codec_data *codec = &chip->codecs[codec_type]; |
1401 | bool need_change = (codec->running != enable); | 1363 | bool need_change = (codec->running != enable); |
1402 | 1364 | ||
1403 | snd_azf3328_dbgcodec( | 1365 | dev_dbg(chip->card->dev, |
1404 | "codec_activity: %s codec, enable %d, need_change %d\n", | 1366 | "codec_activity: %s codec, enable %d, need_change %d\n", |
1405 | codec->name, enable, need_change | 1367 | codec->name, enable, need_change |
1406 | ); | 1368 | ); |
@@ -1441,10 +1403,11 @@ snd_azf3328_ctrl_codec_activity(struct snd_azf3328 *chip, | |||
1441 | } | 1403 | } |
1442 | 1404 | ||
1443 | static void | 1405 | static void |
1444 | snd_azf3328_codec_setdmaa(struct snd_azf3328_codec_data *codec, | 1406 | snd_azf3328_codec_setdmaa(struct snd_azf3328 *chip, |
1445 | unsigned long addr, | 1407 | struct snd_azf3328_codec_data *codec, |
1446 | unsigned int period_bytes, | 1408 | unsigned long addr, |
1447 | unsigned int buffer_bytes | 1409 | unsigned int period_bytes, |
1410 | unsigned int buffer_bytes | ||
1448 | ) | 1411 | ) |
1449 | { | 1412 | { |
1450 | WARN_ONCE(period_bytes & 1, "odd period length!?\n"); | 1413 | WARN_ONCE(period_bytes & 1, "odd period length!?\n"); |
@@ -1469,7 +1432,7 @@ snd_azf3328_codec_setdmaa(struct snd_azf3328_codec_data *codec, | |||
1469 | setup_io.dma_start_1 = addr; | 1432 | setup_io.dma_start_1 = addr; |
1470 | setup_io.dma_start_2 = addr+area_length; | 1433 | setup_io.dma_start_2 = addr+area_length; |
1471 | 1434 | ||
1472 | snd_azf3328_dbgcodec( | 1435 | dev_dbg(chip->card->dev, |
1473 | "setdma: buffers %08x[%u] / %08x[%u], %u, %u\n", | 1436 | "setdma: buffers %08x[%u] / %08x[%u], %u, %u\n", |
1474 | setup_io.dma_start_1, area_length, | 1437 | setup_io.dma_start_1, area_length, |
1475 | setup_io.dma_start_2, area_length, | 1438 | setup_io.dma_start_2, area_length, |
@@ -1511,7 +1474,7 @@ snd_azf3328_pcm_prepare(struct snd_pcm_substream *substream) | |||
1511 | runtime->rate, | 1474 | runtime->rate, |
1512 | snd_pcm_format_width(runtime->format), | 1475 | snd_pcm_format_width(runtime->format), |
1513 | runtime->channels); | 1476 | runtime->channels); |
1514 | snd_azf3328_codec_setdmaa(codec, | 1477 | snd_azf3328_codec_setdmaa(chip, codec, |
1515 | runtime->dma_addr, count, size); | 1478 | runtime->dma_addr, count, size); |
1516 | #endif | 1479 | #endif |
1517 | return 0; | 1480 | return 0; |
@@ -1530,7 +1493,7 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1530 | 1493 | ||
1531 | switch (cmd) { | 1494 | switch (cmd) { |
1532 | case SNDRV_PCM_TRIGGER_START: | 1495 | case SNDRV_PCM_TRIGGER_START: |
1533 | snd_azf3328_dbgcodec("START %s\n", codec->name); | 1496 | dev_dbg(chip->card->dev, "START PCM %s\n", codec->name); |
1534 | 1497 | ||
1535 | if (is_main_mixer_playback_codec) { | 1498 | if (is_main_mixer_playback_codec) { |
1536 | /* mute WaveOut (avoid clicking during setup) */ | 1499 | /* mute WaveOut (avoid clicking during setup) */ |
@@ -1557,7 +1520,7 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1557 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_IRQTYPE, 0xffff); | 1520 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_IRQTYPE, 0xffff); |
1558 | spin_unlock(codec->lock); | 1521 | spin_unlock(codec->lock); |
1559 | 1522 | ||
1560 | snd_azf3328_codec_setdmaa(codec, runtime->dma_addr, | 1523 | snd_azf3328_codec_setdmaa(chip, codec, runtime->dma_addr, |
1561 | snd_pcm_lib_period_bytes(substream), | 1524 | snd_pcm_lib_period_bytes(substream), |
1562 | snd_pcm_lib_buffer_bytes(substream) | 1525 | snd_pcm_lib_buffer_bytes(substream) |
1563 | ); | 1526 | ); |
@@ -1597,10 +1560,10 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1597 | ); | 1560 | ); |
1598 | } | 1561 | } |
1599 | 1562 | ||
1600 | snd_azf3328_dbgcodec("STARTED %s\n", codec->name); | 1563 | dev_dbg(chip->card->dev, "PCM STARTED %s\n", codec->name); |
1601 | break; | 1564 | break; |
1602 | case SNDRV_PCM_TRIGGER_RESUME: | 1565 | case SNDRV_PCM_TRIGGER_RESUME: |
1603 | snd_azf3328_dbgcodec("RESUME %s\n", codec->name); | 1566 | dev_dbg(chip->card->dev, "PCM RESUME %s\n", codec->name); |
1604 | /* resume codec if we were active */ | 1567 | /* resume codec if we were active */ |
1605 | spin_lock(codec->lock); | 1568 | spin_lock(codec->lock); |
1606 | if (codec->running) | 1569 | if (codec->running) |
@@ -1612,7 +1575,7 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1612 | spin_unlock(codec->lock); | 1575 | spin_unlock(codec->lock); |
1613 | break; | 1576 | break; |
1614 | case SNDRV_PCM_TRIGGER_STOP: | 1577 | case SNDRV_PCM_TRIGGER_STOP: |
1615 | snd_azf3328_dbgcodec("STOP %s\n", codec->name); | 1578 | dev_dbg(chip->card->dev, "PCM STOP %s\n", codec->name); |
1616 | 1579 | ||
1617 | if (is_main_mixer_playback_codec) { | 1580 | if (is_main_mixer_playback_codec) { |
1618 | /* mute WaveOut (avoid clicking during setup) */ | 1581 | /* mute WaveOut (avoid clicking during setup) */ |
@@ -1648,10 +1611,10 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1648 | ); | 1611 | ); |
1649 | } | 1612 | } |
1650 | 1613 | ||
1651 | snd_azf3328_dbgcodec("STOPPED %s\n", codec->name); | 1614 | dev_dbg(chip->card->dev, "PCM STOPPED %s\n", codec->name); |
1652 | break; | 1615 | break; |
1653 | case SNDRV_PCM_TRIGGER_SUSPEND: | 1616 | case SNDRV_PCM_TRIGGER_SUSPEND: |
1654 | snd_azf3328_dbgcodec("SUSPEND %s\n", codec->name); | 1617 | dev_dbg(chip->card->dev, "PCM SUSPEND %s\n", codec->name); |
1655 | /* make sure codec is stopped */ | 1618 | /* make sure codec is stopped */ |
1656 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, | 1619 | snd_azf3328_codec_outw(codec, IDX_IO_CODEC_DMA_FLAGS, |
1657 | snd_azf3328_codec_inw( | 1620 | snd_azf3328_codec_inw( |
@@ -1660,13 +1623,13 @@ snd_azf3328_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | |||
1660 | ); | 1623 | ); |
1661 | break; | 1624 | break; |
1662 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 1625 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
1663 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); | 1626 | WARN(1, "FIXME: SNDRV_PCM_TRIGGER_PAUSE_PUSH NIY!\n"); |
1664 | break; | 1627 | break; |
1665 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 1628 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
1666 | snd_printk(KERN_ERR "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); | 1629 | WARN(1, "FIXME: SNDRV_PCM_TRIGGER_PAUSE_RELEASE NIY!\n"); |
1667 | break; | 1630 | break; |
1668 | default: | 1631 | default: |
1669 | snd_printk(KERN_ERR "FIXME: unknown trigger mode!\n"); | 1632 | WARN(1, "FIXME: unknown trigger mode!\n"); |
1670 | return -EINVAL; | 1633 | return -EINVAL; |
1671 | } | 1634 | } |
1672 | 1635 | ||
@@ -1691,8 +1654,8 @@ snd_azf3328_pcm_pointer(struct snd_pcm_substream *substream | |||
1691 | result -= codec->dma_base; | 1654 | result -= codec->dma_base; |
1692 | #endif | 1655 | #endif |
1693 | frmres = bytes_to_frames( substream->runtime, result); | 1656 | frmres = bytes_to_frames( substream->runtime, result); |
1694 | snd_azf3328_dbgcodec("%08li %s @ 0x%8lx, frames %8ld\n", | 1657 | dev_dbg(substream->pcm->card->dev, "%08li %s @ 0x%8lx, frames %8ld\n", |
1695 | jiffies, codec->name, result, frmres); | 1658 | jiffies, codec->name, result, frmres); |
1696 | return frmres; | 1659 | return frmres; |
1697 | } | 1660 | } |
1698 | 1661 | ||
@@ -1755,7 +1718,7 @@ snd_azf3328_gameport_interrupt(struct snd_azf3328 *chip) | |||
1755 | * skeleton handler only | 1718 | * skeleton handler only |
1756 | * (we do not want axis reading in interrupt handler - too much load!) | 1719 | * (we do not want axis reading in interrupt handler - too much load!) |
1757 | */ | 1720 | */ |
1758 | snd_azf3328_dbggame("gameport irq\n"); | 1721 | dev_dbg(chip->card->dev, "gameport irq\n"); |
1759 | 1722 | ||
1760 | /* this should ACK the gameport IRQ properly, hopefully. */ | 1723 | /* this should ACK the gameport IRQ properly, hopefully. */ |
1761 | snd_azf3328_game_inw(chip, IDX_GAME_AXIS_VALUE); | 1724 | snd_azf3328_game_inw(chip, IDX_GAME_AXIS_VALUE); |
@@ -1767,7 +1730,7 @@ snd_azf3328_gameport_open(struct gameport *gameport, int mode) | |||
1767 | struct snd_azf3328 *chip = gameport_get_port_data(gameport); | 1730 | struct snd_azf3328 *chip = gameport_get_port_data(gameport); |
1768 | int res; | 1731 | int res; |
1769 | 1732 | ||
1770 | snd_azf3328_dbggame("gameport_open, mode %d\n", mode); | 1733 | dev_dbg(chip->card->dev, "gameport_open, mode %d\n", mode); |
1771 | switch (mode) { | 1734 | switch (mode) { |
1772 | case GAMEPORT_MODE_COOKED: | 1735 | case GAMEPORT_MODE_COOKED: |
1773 | case GAMEPORT_MODE_RAW: | 1736 | case GAMEPORT_MODE_RAW: |
@@ -1790,7 +1753,7 @@ snd_azf3328_gameport_close(struct gameport *gameport) | |||
1790 | { | 1753 | { |
1791 | struct snd_azf3328 *chip = gameport_get_port_data(gameport); | 1754 | struct snd_azf3328 *chip = gameport_get_port_data(gameport); |
1792 | 1755 | ||
1793 | snd_azf3328_dbggame("gameport_close\n"); | 1756 | dev_dbg(chip->card->dev, "gameport_close\n"); |
1794 | snd_azf3328_gameport_set_counter_frequency(chip, | 1757 | snd_azf3328_gameport_set_counter_frequency(chip, |
1795 | GAME_HWCFG_ADC_COUNTER_FREQ_1_200); | 1758 | GAME_HWCFG_ADC_COUNTER_FREQ_1_200); |
1796 | snd_azf3328_gameport_axis_circuit_enable(chip, 0); | 1759 | snd_azf3328_gameport_axis_circuit_enable(chip, 0); |
@@ -1855,9 +1818,8 @@ snd_azf3328_gameport_cooked_read(struct gameport *gameport, | |||
1855 | axes[i] = -1; | 1818 | axes[i] = -1; |
1856 | } | 1819 | } |
1857 | 1820 | ||
1858 | snd_azf3328_dbggame("cooked_read: axes %d %d %d %d buttons %d\n", | 1821 | dev_dbg(chip->card->dev, "cooked_read: axes %d %d %d %d buttons %d\n", |
1859 | axes[0], axes[1], axes[2], axes[3], *buttons | 1822 | axes[0], axes[1], axes[2], axes[3], *buttons); |
1860 | ); | ||
1861 | 1823 | ||
1862 | return 0; | 1824 | return 0; |
1863 | } | 1825 | } |
@@ -1869,7 +1831,7 @@ snd_azf3328_gameport(struct snd_azf3328 *chip, int dev) | |||
1869 | 1831 | ||
1870 | chip->gameport = gp = gameport_allocate_port(); | 1832 | chip->gameport = gp = gameport_allocate_port(); |
1871 | if (!gp) { | 1833 | if (!gp) { |
1872 | printk(KERN_ERR "azt3328: cannot alloc memory for gameport\n"); | 1834 | dev_err(chip->card->dev, "cannot alloc memory for gameport\n"); |
1873 | return -ENOMEM; | 1835 | return -ENOMEM; |
1874 | } | 1836 | } |
1875 | 1837 | ||
@@ -1913,23 +1875,23 @@ snd_azf3328_gameport_free(struct snd_azf3328 *chip) { } | |||
1913 | static inline void | 1875 | static inline void |
1914 | snd_azf3328_gameport_interrupt(struct snd_azf3328 *chip) | 1876 | snd_azf3328_gameport_interrupt(struct snd_azf3328 *chip) |
1915 | { | 1877 | { |
1916 | printk(KERN_WARNING "huh, game port IRQ occurred!?\n"); | 1878 | dev_warn(chip->card->dev, "huh, game port IRQ occurred!?\n"); |
1917 | } | 1879 | } |
1918 | #endif /* SUPPORT_GAMEPORT */ | 1880 | #endif /* SUPPORT_GAMEPORT */ |
1919 | 1881 | ||
1920 | /******************************************************************/ | 1882 | /******************************************************************/ |
1921 | 1883 | ||
1922 | static inline void | 1884 | static inline void |
1923 | snd_azf3328_irq_log_unknown_type(u8 which) | 1885 | snd_azf3328_irq_log_unknown_type(struct snd_azf3328 *chip, u8 which) |
1924 | { | 1886 | { |
1925 | snd_azf3328_dbgcodec( | 1887 | dev_dbg(chip->card->dev, |
1926 | "azt3328: unknown IRQ type (%x) occurred, please report!\n", | 1888 | "unknown IRQ type (%x) occurred, please report!\n", |
1927 | which | 1889 | which); |
1928 | ); | ||
1929 | } | 1890 | } |
1930 | 1891 | ||
1931 | static inline void | 1892 | static inline void |
1932 | snd_azf3328_pcm_interrupt(const struct snd_azf3328_codec_data *first_codec, | 1893 | snd_azf3328_pcm_interrupt(struct snd_azf3328 *chip, |
1894 | const struct snd_azf3328_codec_data *first_codec, | ||
1933 | u8 status | 1895 | u8 status |
1934 | ) | 1896 | ) |
1935 | { | 1897 | { |
@@ -1953,17 +1915,15 @@ snd_azf3328_pcm_interrupt(const struct snd_azf3328_codec_data *first_codec, | |||
1953 | 1915 | ||
1954 | if (codec->substream) { | 1916 | if (codec->substream) { |
1955 | snd_pcm_period_elapsed(codec->substream); | 1917 | snd_pcm_period_elapsed(codec->substream); |
1956 | snd_azf3328_dbgcodec("%s period done (#%x), @ %x\n", | 1918 | dev_dbg(chip->card->dev, "%s period done (#%x), @ %x\n", |
1957 | codec->name, | 1919 | codec->name, |
1958 | which, | 1920 | which, |
1959 | snd_azf3328_codec_inl( | 1921 | snd_azf3328_codec_inl( |
1960 | codec, IDX_IO_CODEC_DMA_CURRPOS | 1922 | codec, IDX_IO_CODEC_DMA_CURRPOS)); |
1961 | ) | ||
1962 | ); | ||
1963 | } else | 1923 | } else |
1964 | printk(KERN_WARNING "azt3328: irq handler problem!\n"); | 1924 | dev_warn(chip->card->dev, "irq handler problem!\n"); |
1965 | if (which & IRQ_SOMETHING) | 1925 | if (which & IRQ_SOMETHING) |
1966 | snd_azf3328_irq_log_unknown_type(which); | 1926 | snd_azf3328_irq_log_unknown_type(chip, which); |
1967 | } | 1927 | } |
1968 | } | 1928 | } |
1969 | 1929 | ||
@@ -1972,9 +1932,7 @@ snd_azf3328_interrupt(int irq, void *dev_id) | |||
1972 | { | 1932 | { |
1973 | struct snd_azf3328 *chip = dev_id; | 1933 | struct snd_azf3328 *chip = dev_id; |
1974 | u8 status; | 1934 | u8 status; |
1975 | #if DEBUG_CODEC | ||
1976 | static unsigned long irq_count; | 1935 | static unsigned long irq_count; |
1977 | #endif | ||
1978 | 1936 | ||
1979 | status = snd_azf3328_ctrl_inb(chip, IDX_IO_IRQSTATUS); | 1937 | status = snd_azf3328_ctrl_inb(chip, IDX_IO_IRQSTATUS); |
1980 | 1938 | ||
@@ -1985,14 +1943,13 @@ snd_azf3328_interrupt(int irq, void *dev_id) | |||
1985 | )) | 1943 | )) |
1986 | return IRQ_NONE; /* must be interrupt for another device */ | 1944 | return IRQ_NONE; /* must be interrupt for another device */ |
1987 | 1945 | ||
1988 | snd_azf3328_dbgcodec( | 1946 | dev_dbg(chip->card->dev, |
1989 | "irq_count %ld! IDX_IO_IRQSTATUS %04x\n", | 1947 | "irq_count %ld! IDX_IO_IRQSTATUS %04x\n", |
1990 | irq_count++ /* debug-only */, | 1948 | irq_count++ /* debug-only */, |
1991 | status | 1949 | status); |
1992 | ); | ||
1993 | 1950 | ||
1994 | if (status & IRQ_TIMER) { | 1951 | if (status & IRQ_TIMER) { |
1995 | /* snd_azf3328_dbgcodec("timer %ld\n", | 1952 | /* dev_dbg(chip->card->dev, "timer %ld\n", |
1996 | snd_azf3328_codec_inl(chip, IDX_IO_TIMER_VALUE) | 1953 | snd_azf3328_codec_inl(chip, IDX_IO_TIMER_VALUE) |
1997 | & TIMER_VALUE_MASK | 1954 | & TIMER_VALUE_MASK |
1998 | ); */ | 1955 | ); */ |
@@ -2002,11 +1959,11 @@ snd_azf3328_interrupt(int irq, void *dev_id) | |||
2002 | spin_lock(&chip->reg_lock); | 1959 | spin_lock(&chip->reg_lock); |
2003 | snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x07); | 1960 | snd_azf3328_ctrl_outb(chip, IDX_IO_TIMER_VALUE + 3, 0x07); |
2004 | spin_unlock(&chip->reg_lock); | 1961 | spin_unlock(&chip->reg_lock); |
2005 | snd_azf3328_dbgcodec("azt3328: timer IRQ\n"); | 1962 | dev_dbg(chip->card->dev, "timer IRQ\n"); |
2006 | } | 1963 | } |
2007 | 1964 | ||
2008 | if (status & (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_I2S_OUT)) | 1965 | if (status & (IRQ_PLAYBACK|IRQ_RECORDING|IRQ_I2S_OUT)) |
2009 | snd_azf3328_pcm_interrupt(chip->codecs, status); | 1966 | snd_azf3328_pcm_interrupt(chip, chip->codecs, status); |
2010 | 1967 | ||
2011 | if (status & IRQ_GAMEPORT) | 1968 | if (status & IRQ_GAMEPORT) |
2012 | snd_azf3328_gameport_interrupt(chip); | 1969 | snd_azf3328_gameport_interrupt(chip); |
@@ -2018,7 +1975,7 @@ snd_azf3328_interrupt(int irq, void *dev_id) | |||
2018 | 1975 | ||
2019 | /* hmm, do we have to ack the IRQ here somehow? | 1976 | /* hmm, do we have to ack the IRQ here somehow? |
2020 | * If so, then I don't know how yet... */ | 1977 | * If so, then I don't know how yet... */ |
2021 | snd_azf3328_dbgcodec("azt3328: MPU401 IRQ\n"); | 1978 | dev_dbg(chip->card->dev, "MPU401 IRQ\n"); |
2022 | } | 1979 | } |
2023 | return IRQ_HANDLED; | 1980 | return IRQ_HANDLED; |
2024 | } | 1981 | } |
@@ -2244,10 +2201,10 @@ snd_azf3328_timer_start(struct snd_timer *timer) | |||
2244 | * this timing tweak | 2201 | * this timing tweak |
2245 | * (we need to do it to avoid a lockup, though) */ | 2202 | * (we need to do it to avoid a lockup, though) */ |
2246 | 2203 | ||
2247 | snd_azf3328_dbgtimer("delay was too low (%d)!\n", delay); | 2204 | dev_dbg(chip->card->dev, "delay was too low (%d)!\n", delay); |
2248 | delay = 49; /* minimum time is 49 ticks */ | 2205 | delay = 49; /* minimum time is 49 ticks */ |
2249 | } | 2206 | } |
2250 | snd_azf3328_dbgtimer("setting timer countdown value %d\n", delay); | 2207 | dev_dbg(chip->card->dev, "setting timer countdown value %d\n", delay); |
2251 | delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE; | 2208 | delay |= TIMER_COUNTDOWN_ENABLE | TIMER_IRQ_ENABLE; |
2252 | spin_lock_irqsave(&chip->reg_lock, flags); | 2209 | spin_lock_irqsave(&chip->reg_lock, flags); |
2253 | snd_azf3328_ctrl_outl(chip, IDX_IO_TIMER_VALUE, delay); | 2210 | snd_azf3328_ctrl_outl(chip, IDX_IO_TIMER_VALUE, delay); |
@@ -2386,34 +2343,34 @@ snd_azf3328_test_bit(unsigned unsigned reg, int bit) | |||
2386 | static inline void | 2343 | static inline void |
2387 | snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip) | 2344 | snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip) |
2388 | { | 2345 | { |
2389 | #if DEBUG_MISC | ||
2390 | u16 tmp; | 2346 | u16 tmp; |
2391 | 2347 | ||
2392 | snd_azf3328_dbgmisc( | 2348 | dev_dbg(chip->card->dev, |
2393 | "ctrl_io 0x%lx, game_io 0x%lx, mpu_io 0x%lx, " | 2349 | "ctrl_io 0x%lx, game_io 0x%lx, mpu_io 0x%lx, " |
2394 | "opl3_io 0x%lx, mixer_io 0x%lx, irq %d\n", | 2350 | "opl3_io 0x%lx, mixer_io 0x%lx, irq %d\n", |
2395 | chip->ctrl_io, chip->game_io, chip->mpu_io, | 2351 | chip->ctrl_io, chip->game_io, chip->mpu_io, |
2396 | chip->opl3_io, chip->mixer_io, chip->irq | 2352 | chip->opl3_io, chip->mixer_io, chip->irq); |
2397 | ); | ||
2398 | 2353 | ||
2399 | snd_azf3328_dbgmisc("game %02x %02x %02x %02x %02x %02x\n", | 2354 | dev_dbg(chip->card->dev, |
2355 | "game %02x %02x %02x %02x %02x %02x\n", | ||
2400 | snd_azf3328_game_inb(chip, 0), | 2356 | snd_azf3328_game_inb(chip, 0), |
2401 | snd_azf3328_game_inb(chip, 1), | 2357 | snd_azf3328_game_inb(chip, 1), |
2402 | snd_azf3328_game_inb(chip, 2), | 2358 | snd_azf3328_game_inb(chip, 2), |
2403 | snd_azf3328_game_inb(chip, 3), | 2359 | snd_azf3328_game_inb(chip, 3), |
2404 | snd_azf3328_game_inb(chip, 4), | 2360 | snd_azf3328_game_inb(chip, 4), |
2405 | snd_azf3328_game_inb(chip, 5) | 2361 | snd_azf3328_game_inb(chip, 5)); |
2406 | ); | ||
2407 | 2362 | ||
2408 | for (tmp = 0; tmp < 0x07; tmp += 1) | 2363 | for (tmp = 0; tmp < 0x07; tmp += 1) |
2409 | snd_azf3328_dbgmisc("mpu_io 0x%04x\n", inb(chip->mpu_io + tmp)); | 2364 | dev_dbg(chip->card->dev, |
2365 | "mpu_io 0x%04x\n", inb(chip->mpu_io + tmp)); | ||
2410 | 2366 | ||
2411 | for (tmp = 0; tmp <= 0x07; tmp += 1) | 2367 | for (tmp = 0; tmp <= 0x07; tmp += 1) |
2412 | snd_azf3328_dbgmisc("0x%02x: game200 0x%04x, game208 0x%04x\n", | 2368 | dev_dbg(chip->card->dev, |
2369 | "0x%02x: game200 0x%04x, game208 0x%04x\n", | ||
2413 | tmp, inb(0x200 + tmp), inb(0x208 + tmp)); | 2370 | tmp, inb(0x200 + tmp), inb(0x208 + tmp)); |
2414 | 2371 | ||
2415 | for (tmp = 0; tmp <= 0x01; tmp += 1) | 2372 | for (tmp = 0; tmp <= 0x01; tmp += 1) |
2416 | snd_azf3328_dbgmisc( | 2373 | dev_dbg(chip->card->dev, |
2417 | "0x%02x: mpu300 0x%04x, mpu310 0x%04x, mpu320 0x%04x, " | 2374 | "0x%02x: mpu300 0x%04x, mpu310 0x%04x, mpu320 0x%04x, " |
2418 | "mpu330 0x%04x opl388 0x%04x opl38c 0x%04x\n", | 2375 | "mpu330 0x%04x opl388 0x%04x opl38c 0x%04x\n", |
2419 | tmp, | 2376 | tmp, |
@@ -2422,19 +2379,17 @@ snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip) | |||
2422 | inb(0x320 + tmp), | 2379 | inb(0x320 + tmp), |
2423 | inb(0x330 + tmp), | 2380 | inb(0x330 + tmp), |
2424 | inb(0x388 + tmp), | 2381 | inb(0x388 + tmp), |
2425 | inb(0x38c + tmp) | 2382 | inb(0x38c + tmp)); |
2426 | ); | ||
2427 | 2383 | ||
2428 | for (tmp = 0; tmp < AZF_IO_SIZE_CTRL; tmp += 2) | 2384 | for (tmp = 0; tmp < AZF_IO_SIZE_CTRL; tmp += 2) |
2429 | snd_azf3328_dbgmisc("ctrl 0x%02x: 0x%04x\n", | 2385 | dev_dbg(chip->card->dev, |
2430 | tmp, snd_azf3328_ctrl_inw(chip, tmp) | 2386 | "ctrl 0x%02x: 0x%04x\n", |
2431 | ); | 2387 | tmp, snd_azf3328_ctrl_inw(chip, tmp)); |
2432 | 2388 | ||
2433 | for (tmp = 0; tmp < AZF_IO_SIZE_MIXER; tmp += 2) | 2389 | for (tmp = 0; tmp < AZF_IO_SIZE_MIXER; tmp += 2) |
2434 | snd_azf3328_dbgmisc("mixer 0x%02x: 0x%04x\n", | 2390 | dev_dbg(chip->card->dev, |
2435 | tmp, snd_azf3328_mixer_inw(chip, tmp) | 2391 | "mixer 0x%02x: 0x%04x\n", |
2436 | ); | 2392 | tmp, snd_azf3328_mixer_inw(chip, tmp)); |
2437 | #endif /* DEBUG_MISC */ | ||
2438 | } | 2393 | } |
2439 | 2394 | ||
2440 | static int | 2395 | static int |
@@ -2471,8 +2426,8 @@ snd_azf3328_create(struct snd_card *card, | |||
2471 | /* check if we can restrict PCI DMA transfers to 24 bits */ | 2426 | /* check if we can restrict PCI DMA transfers to 24 bits */ |
2472 | if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || | 2427 | if (pci_set_dma_mask(pci, DMA_BIT_MASK(24)) < 0 || |
2473 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { | 2428 | pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(24)) < 0) { |
2474 | snd_printk(KERN_ERR "architecture does not support " | 2429 | dev_err(card->dev, |
2475 | "24bit PCI busmaster DMA\n" | 2430 | "architecture does not support 24bit PCI busmaster DMA\n" |
2476 | ); | 2431 | ); |
2477 | err = -ENXIO; | 2432 | err = -ENXIO; |
2478 | goto out_err; | 2433 | goto out_err; |
@@ -2508,7 +2463,7 @@ snd_azf3328_create(struct snd_card *card, | |||
2508 | 2463 | ||
2509 | if (request_irq(pci->irq, snd_azf3328_interrupt, | 2464 | if (request_irq(pci->irq, snd_azf3328_interrupt, |
2510 | IRQF_SHARED, KBUILD_MODNAME, chip)) { | 2465 | IRQF_SHARED, KBUILD_MODNAME, chip)) { |
2511 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2466 | dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); |
2512 | err = -EBUSY; | 2467 | err = -EBUSY; |
2513 | goto out_err; | 2468 | goto out_err; |
2514 | } | 2469 | } |
@@ -2603,7 +2558,7 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2603 | -1, &chip->rmidi | 2558 | -1, &chip->rmidi |
2604 | ); | 2559 | ); |
2605 | if (err < 0) { | 2560 | if (err < 0) { |
2606 | snd_printk(KERN_ERR "azf3328: no MPU-401 device at 0x%lx?\n", | 2561 | dev_err(card->dev, "no MPU-401 device at 0x%lx?\n", |
2607 | chip->mpu_io | 2562 | chip->mpu_io |
2608 | ); | 2563 | ); |
2609 | goto out_err; | 2564 | goto out_err; |
@@ -2619,7 +2574,7 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2619 | 2574 | ||
2620 | if (snd_opl3_create(card, chip->opl3_io, chip->opl3_io+2, | 2575 | if (snd_opl3_create(card, chip->opl3_io, chip->opl3_io+2, |
2621 | OPL3_HW_AUTO, 1, &opl3) < 0) { | 2576 | OPL3_HW_AUTO, 1, &opl3) < 0) { |
2622 | snd_printk(KERN_ERR "azf3328: no OPL3 device at 0x%lx-0x%lx?\n", | 2577 | dev_err(card->dev, "no OPL3 device at 0x%lx-0x%lx?\n", |
2623 | chip->opl3_io, chip->opl3_io+2 | 2578 | chip->opl3_io, chip->opl3_io+2 |
2624 | ); | 2579 | ); |
2625 | } else { | 2580 | } else { |
@@ -2641,12 +2596,15 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2641 | goto out_err; | 2596 | goto out_err; |
2642 | 2597 | ||
2643 | #ifdef MODULE | 2598 | #ifdef MODULE |
2644 | printk(KERN_INFO | 2599 | dev_info(card->dev, |
2645 | "azt3328: Sound driver for Aztech AZF3328-based soundcards such as PCI168.\n" | 2600 | "Sound driver for Aztech AZF3328-based soundcards such as PCI168.\n"); |
2646 | "azt3328: Hardware was completely undocumented, unfortunately.\n" | 2601 | dev_info(card->dev, |
2647 | "azt3328: Feel free to contact andi AT lisas.de for bug reports etc.!\n" | 2602 | "Hardware was completely undocumented, unfortunately.\n"); |
2648 | "azt3328: User-scalable sequencer timer set to %dHz (1024000Hz / %d).\n", | 2603 | dev_info(card->dev, |
2649 | 1024000 / seqtimer_scaling, seqtimer_scaling); | 2604 | "Feel free to contact andi AT lisas.de for bug reports etc.!\n"); |
2605 | dev_info(card->dev, | ||
2606 | "User-scalable sequencer timer set to %dHz (1024000Hz / %d).\n", | ||
2607 | 1024000 / seqtimer_scaling, seqtimer_scaling); | ||
2650 | #endif | 2608 | #endif |
2651 | 2609 | ||
2652 | snd_azf3328_gameport(chip, dev); | 2610 | snd_azf3328_gameport(chip, dev); |
@@ -2658,7 +2616,7 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) | |||
2658 | goto out; | 2616 | goto out; |
2659 | 2617 | ||
2660 | out_err: | 2618 | out_err: |
2661 | snd_printk(KERN_ERR "azf3328: something failed, exiting\n"); | 2619 | dev_err(card->dev, "something failed, exiting\n"); |
2662 | snd_card_free(card); | 2620 | snd_card_free(card); |
2663 | 2621 | ||
2664 | out: | 2622 | out: |
@@ -2673,13 +2631,14 @@ snd_azf3328_remove(struct pci_dev *pci) | |||
2673 | 2631 | ||
2674 | #ifdef CONFIG_PM_SLEEP | 2632 | #ifdef CONFIG_PM_SLEEP |
2675 | static inline void | 2633 | static inline void |
2676 | snd_azf3328_suspend_regs(unsigned long io_addr, unsigned count, u32 *saved_regs) | 2634 | snd_azf3328_suspend_regs(const struct snd_azf3328 *chip, |
2635 | unsigned long io_addr, unsigned count, u32 *saved_regs) | ||
2677 | { | 2636 | { |
2678 | unsigned reg; | 2637 | unsigned reg; |
2679 | 2638 | ||
2680 | for (reg = 0; reg < count; ++reg) { | 2639 | for (reg = 0; reg < count; ++reg) { |
2681 | *saved_regs = inl(io_addr); | 2640 | *saved_regs = inl(io_addr); |
2682 | snd_azf3328_dbgpm("suspend: io 0x%04lx: 0x%08x\n", | 2641 | dev_dbg(chip->card->dev, "suspend: io 0x%04lx: 0x%08x\n", |
2683 | io_addr, *saved_regs); | 2642 | io_addr, *saved_regs); |
2684 | ++saved_regs; | 2643 | ++saved_regs; |
2685 | io_addr += sizeof(*saved_regs); | 2644 | io_addr += sizeof(*saved_regs); |
@@ -2687,7 +2646,8 @@ snd_azf3328_suspend_regs(unsigned long io_addr, unsigned count, u32 *saved_regs) | |||
2687 | } | 2646 | } |
2688 | 2647 | ||
2689 | static inline void | 2648 | static inline void |
2690 | snd_azf3328_resume_regs(const u32 *saved_regs, | 2649 | snd_azf3328_resume_regs(const struct snd_azf3328 *chip, |
2650 | const u32 *saved_regs, | ||
2691 | unsigned long io_addr, | 2651 | unsigned long io_addr, |
2692 | unsigned count | 2652 | unsigned count |
2693 | ) | 2653 | ) |
@@ -2696,7 +2656,8 @@ snd_azf3328_resume_regs(const u32 *saved_regs, | |||
2696 | 2656 | ||
2697 | for (reg = 0; reg < count; ++reg) { | 2657 | for (reg = 0; reg < count; ++reg) { |
2698 | outl(*saved_regs, io_addr); | 2658 | outl(*saved_regs, io_addr); |
2699 | snd_azf3328_dbgpm("resume: io 0x%04lx: 0x%08x --> 0x%08x\n", | 2659 | dev_dbg(chip->card->dev, |
2660 | "resume: io 0x%04lx: 0x%08x --> 0x%08x\n", | ||
2700 | io_addr, *saved_regs, inl(io_addr)); | 2661 | io_addr, *saved_regs, inl(io_addr)); |
2701 | ++saved_regs; | 2662 | ++saved_regs; |
2702 | io_addr += sizeof(*saved_regs); | 2663 | io_addr += sizeof(*saved_regs); |
@@ -2709,7 +2670,7 @@ snd_azf3328_suspend_ac97(struct snd_azf3328 *chip) | |||
2709 | #ifdef AZF_USE_AC97_LAYER | 2670 | #ifdef AZF_USE_AC97_LAYER |
2710 | snd_ac97_suspend(chip->ac97); | 2671 | snd_ac97_suspend(chip->ac97); |
2711 | #else | 2672 | #else |
2712 | snd_azf3328_suspend_regs(chip->mixer_io, | 2673 | snd_azf3328_suspend_regs(chip, chip->mixer_io, |
2713 | ARRAY_SIZE(chip->saved_regs_mixer), chip->saved_regs_mixer); | 2674 | ARRAY_SIZE(chip->saved_regs_mixer), chip->saved_regs_mixer); |
2714 | 2675 | ||
2715 | /* make sure to disable master volume etc. to prevent looping sound */ | 2676 | /* make sure to disable master volume etc. to prevent looping sound */ |
@@ -2724,7 +2685,7 @@ snd_azf3328_resume_ac97(const struct snd_azf3328 *chip) | |||
2724 | #ifdef AZF_USE_AC97_LAYER | 2685 | #ifdef AZF_USE_AC97_LAYER |
2725 | snd_ac97_resume(chip->ac97); | 2686 | snd_ac97_resume(chip->ac97); |
2726 | #else | 2687 | #else |
2727 | snd_azf3328_resume_regs(chip->saved_regs_mixer, chip->mixer_io, | 2688 | snd_azf3328_resume_regs(chip, chip->saved_regs_mixer, chip->mixer_io, |
2728 | ARRAY_SIZE(chip->saved_regs_mixer)); | 2689 | ARRAY_SIZE(chip->saved_regs_mixer)); |
2729 | 2690 | ||
2730 | /* unfortunately with 32bit transfers, IDX_MIXER_PLAY_MASTER (0x02) | 2691 | /* unfortunately with 32bit transfers, IDX_MIXER_PLAY_MASTER (0x02) |
@@ -2751,18 +2712,18 @@ snd_azf3328_suspend(struct device *dev) | |||
2751 | 2712 | ||
2752 | snd_azf3328_suspend_ac97(chip); | 2713 | snd_azf3328_suspend_ac97(chip); |
2753 | 2714 | ||
2754 | snd_azf3328_suspend_regs(chip->ctrl_io, | 2715 | snd_azf3328_suspend_regs(chip, chip->ctrl_io, |
2755 | ARRAY_SIZE(chip->saved_regs_ctrl), chip->saved_regs_ctrl); | 2716 | ARRAY_SIZE(chip->saved_regs_ctrl), chip->saved_regs_ctrl); |
2756 | 2717 | ||
2757 | /* manually store the one currently relevant write-only reg, too */ | 2718 | /* manually store the one currently relevant write-only reg, too */ |
2758 | saved_regs_ctrl_u16 = (u16 *)chip->saved_regs_ctrl; | 2719 | saved_regs_ctrl_u16 = (u16 *)chip->saved_regs_ctrl; |
2759 | saved_regs_ctrl_u16[IDX_IO_6AH / 2] = chip->shadow_reg_ctrl_6AH; | 2720 | saved_regs_ctrl_u16[IDX_IO_6AH / 2] = chip->shadow_reg_ctrl_6AH; |
2760 | 2721 | ||
2761 | snd_azf3328_suspend_regs(chip->game_io, | 2722 | snd_azf3328_suspend_regs(chip, chip->game_io, |
2762 | ARRAY_SIZE(chip->saved_regs_game), chip->saved_regs_game); | 2723 | ARRAY_SIZE(chip->saved_regs_game), chip->saved_regs_game); |
2763 | snd_azf3328_suspend_regs(chip->mpu_io, | 2724 | snd_azf3328_suspend_regs(chip, chip->mpu_io, |
2764 | ARRAY_SIZE(chip->saved_regs_mpu), chip->saved_regs_mpu); | 2725 | ARRAY_SIZE(chip->saved_regs_mpu), chip->saved_regs_mpu); |
2765 | snd_azf3328_suspend_regs(chip->opl3_io, | 2726 | snd_azf3328_suspend_regs(chip, chip->opl3_io, |
2766 | ARRAY_SIZE(chip->saved_regs_opl3), chip->saved_regs_opl3); | 2727 | ARRAY_SIZE(chip->saved_regs_opl3), chip->saved_regs_opl3); |
2767 | 2728 | ||
2768 | pci_disable_device(pci); | 2729 | pci_disable_device(pci); |
@@ -2781,23 +2742,22 @@ snd_azf3328_resume(struct device *dev) | |||
2781 | pci_set_power_state(pci, PCI_D0); | 2742 | pci_set_power_state(pci, PCI_D0); |
2782 | pci_restore_state(pci); | 2743 | pci_restore_state(pci); |
2783 | if (pci_enable_device(pci) < 0) { | 2744 | if (pci_enable_device(pci) < 0) { |
2784 | printk(KERN_ERR "azt3328: pci_enable_device failed, " | 2745 | dev_err(dev, "pci_enable_device failed, disabling device\n"); |
2785 | "disabling device\n"); | ||
2786 | snd_card_disconnect(card); | 2746 | snd_card_disconnect(card); |
2787 | return -EIO; | 2747 | return -EIO; |
2788 | } | 2748 | } |
2789 | pci_set_master(pci); | 2749 | pci_set_master(pci); |
2790 | 2750 | ||
2791 | snd_azf3328_resume_regs(chip->saved_regs_game, chip->game_io, | 2751 | snd_azf3328_resume_regs(chip, chip->saved_regs_game, chip->game_io, |
2792 | ARRAY_SIZE(chip->saved_regs_game)); | 2752 | ARRAY_SIZE(chip->saved_regs_game)); |
2793 | snd_azf3328_resume_regs(chip->saved_regs_mpu, chip->mpu_io, | 2753 | snd_azf3328_resume_regs(chip, chip->saved_regs_mpu, chip->mpu_io, |
2794 | ARRAY_SIZE(chip->saved_regs_mpu)); | 2754 | ARRAY_SIZE(chip->saved_regs_mpu)); |
2795 | snd_azf3328_resume_regs(chip->saved_regs_opl3, chip->opl3_io, | 2755 | snd_azf3328_resume_regs(chip, chip->saved_regs_opl3, chip->opl3_io, |
2796 | ARRAY_SIZE(chip->saved_regs_opl3)); | 2756 | ARRAY_SIZE(chip->saved_regs_opl3)); |
2797 | 2757 | ||
2798 | snd_azf3328_resume_ac97(chip); | 2758 | snd_azf3328_resume_ac97(chip); |
2799 | 2759 | ||
2800 | snd_azf3328_resume_regs(chip->saved_regs_ctrl, chip->ctrl_io, | 2760 | snd_azf3328_resume_regs(chip, chip->saved_regs_ctrl, chip->ctrl_io, |
2801 | ARRAY_SIZE(chip->saved_regs_ctrl)); | 2761 | ARRAY_SIZE(chip->saved_regs_ctrl)); |
2802 | 2762 | ||
2803 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); | 2763 | snd_power_change_state(card, SNDRV_CTL_POWER_D0); |