Commit b8986876 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: sb: Use standard print API

Use the standard print API with dev_*() instead of the old house-baked
one.  It gives better information and allows dynamically control of
debug prints.

Some functions are changed to receive snd_card pointer for referring
to the device pointer for dev_*() calls, too.
Reviewed-by: default avatarJaroslav Kysela <perex@perex.cz>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20240807133452.9424-31-tiwai@suse.de
parent 40b15de3
...@@ -160,8 +160,8 @@ snd_emu8000_detect(struct snd_emu8000 *emu) ...@@ -160,8 +160,8 @@ snd_emu8000_detect(struct snd_emu8000 *emu)
if ((EMU8000_HWCF2_READ(emu) & 0x0003) != 0x0003) if ((EMU8000_HWCF2_READ(emu) & 0x0003) != 0x0003)
return -ENODEV; return -ENODEV;
snd_printdd("EMU8000 [0x%lx]: Synth chip found\n", dev_dbg(emu->card->dev, "EMU8000 [0x%lx]: Synth chip found\n",
emu->port1); emu->port1);
return 0; return 0;
} }
...@@ -652,7 +652,7 @@ snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user ...@@ -652,7 +652,7 @@ snd_emu8000_load_chorus_fx(struct snd_emu8000 *emu, int mode, const void __user
{ {
struct soundfont_chorus_fx rec; struct soundfont_chorus_fx rec;
if (mode < SNDRV_EMU8000_CHORUS_PREDEFINED || mode >= SNDRV_EMU8000_CHORUS_NUMBERS) { if (mode < SNDRV_EMU8000_CHORUS_PREDEFINED || mode >= SNDRV_EMU8000_CHORUS_NUMBERS) {
snd_printk(KERN_WARNING "invalid chorus mode %d for uploading\n", mode); dev_warn(emu->card->dev, "invalid chorus mode %d for uploading\n", mode);
return -EINVAL; return -EINVAL;
} }
if (len < (long)sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec))) if (len < (long)sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec)))
...@@ -780,7 +780,7 @@ snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user ...@@ -780,7 +780,7 @@ snd_emu8000_load_reverb_fx(struct snd_emu8000 *emu, int mode, const void __user
struct soundfont_reverb_fx rec; struct soundfont_reverb_fx rec;
if (mode < SNDRV_EMU8000_REVERB_PREDEFINED || mode >= SNDRV_EMU8000_REVERB_NUMBERS) { if (mode < SNDRV_EMU8000_REVERB_PREDEFINED || mode >= SNDRV_EMU8000_REVERB_NUMBERS) {
snd_printk(KERN_WARNING "invalid reverb mode %d for uploading\n", mode); dev_warn(emu->card->dev, "invalid reverb mode %d for uploading\n", mode);
return -EINVAL; return -EINVAL;
} }
if (len < (long)sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec))) if (len < (long)sizeof(rec) || copy_from_user(&rec, buf, sizeof(rec)))
...@@ -1072,7 +1072,8 @@ snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports, ...@@ -1072,7 +1072,8 @@ snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports,
if (!devm_request_region(card->dev, hw->port1, 4, "Emu8000-1") || if (!devm_request_region(card->dev, hw->port1, 4, "Emu8000-1") ||
!devm_request_region(card->dev, hw->port2, 4, "Emu8000-2") || !devm_request_region(card->dev, hw->port2, 4, "Emu8000-2") ||
!devm_request_region(card->dev, hw->port3, 4, "Emu8000-3")) { !devm_request_region(card->dev, hw->port3, 4, "Emu8000-3")) {
snd_printk(KERN_ERR "sbawe: can't grab ports 0x%lx, 0x%lx, 0x%lx\n", hw->port1, hw->port2, hw->port3); dev_err(card->dev, "sbawe: can't grab ports 0x%lx, 0x%lx, 0x%lx\n",
hw->port1, hw->port2, hw->port3);
return -EBUSY; return -EBUSY;
} }
hw->mem_size = 0; hw->mem_size = 0;
......
...@@ -157,7 +157,6 @@ snd_emu8000_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp, ...@@ -157,7 +157,6 @@ snd_emu8000_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp,
sp->block = snd_util_mem_alloc(hdr, truesize * 2); sp->block = snd_util_mem_alloc(hdr, truesize * 2);
if (sp->block == NULL) { if (sp->block == NULL) {
/*snd_printd("EMU8000: out of memory\n");*/
/* not ENOMEM (for compatibility) */ /* not ENOMEM (for compatibility) */
return -ENOSPC; return -ENOSPC;
} }
......
...@@ -45,7 +45,7 @@ static int snd_emu8000_probe(struct device *_dev) ...@@ -45,7 +45,7 @@ static int snd_emu8000_probe(struct device *_dev)
emu->num_ports = hw->seq_ports; emu->num_ports = hw->seq_ports;
if (hw->memhdr) { if (hw->memhdr) {
snd_printk(KERN_ERR "memhdr is already initialized!?\n"); dev_err(hw->card->dev, "memhdr is already initialized!?\n");
snd_util_memhdr_free(hw->memhdr); snd_util_memhdr_free(hw->memhdr);
} }
hw->memhdr = snd_util_memhdr_new(hw->mem_size); hw->memhdr = snd_util_memhdr_new(hw->mem_size);
......
...@@ -75,13 +75,14 @@ static irqreturn_t jazz16_interrupt(int irq, void *chip) ...@@ -75,13 +75,14 @@ static irqreturn_t jazz16_interrupt(int irq, void *chip)
return snd_sb8dsp_interrupt(chip); return snd_sb8dsp_interrupt(chip);
} }
static int jazz16_configure_ports(unsigned long port, static int jazz16_configure_ports(struct snd_card *card,
unsigned long port,
unsigned long mpu_port, int idx) unsigned long mpu_port, int idx)
{ {
unsigned char val; unsigned char val;
if (!request_region(0x201, 1, "jazz16 config")) { if (!request_region(0x201, 1, "jazz16 config")) {
snd_printk(KERN_ERR "config port region is already in use.\n"); dev_err(card->dev, "config port region is already in use.\n");
return -EBUSY; return -EBUSY;
} }
outb(SB_JAZZ16_WAKEUP - idx, 0x201); outb(SB_JAZZ16_WAKEUP - idx, 0x201);
...@@ -96,15 +97,15 @@ static int jazz16_configure_ports(unsigned long port, ...@@ -96,15 +97,15 @@ static int jazz16_configure_ports(unsigned long port,
return 0; return 0;
} }
static int jazz16_detect_board(unsigned long port, static int jazz16_detect_board(struct snd_card *card, unsigned long port,
unsigned long mpu_port) unsigned long mpu_port)
{ {
int err; int err;
int val; int val;
struct snd_sb chip; struct snd_sb chip = {};
if (!request_region(port, 0x10, "jazz16")) { if (!request_region(port, 0x10, "jazz16")) {
snd_printk(KERN_ERR "I/O port region is already in use.\n"); dev_err(card->dev, "I/O port region is already in use.\n");
return -EBUSY; return -EBUSY;
} }
/* just to call snd_sbdsp_command/reset/get_byte() */ /* just to call snd_sbdsp_command/reset/get_byte() */
...@@ -113,7 +114,7 @@ static int jazz16_detect_board(unsigned long port, ...@@ -113,7 +114,7 @@ static int jazz16_detect_board(unsigned long port,
err = snd_sbdsp_reset(&chip); err = snd_sbdsp_reset(&chip);
if (err < 0) if (err < 0)
for (val = 0; val < 4; val++) { for (val = 0; val < 4; val++) {
err = jazz16_configure_ports(port, mpu_port, val); err = jazz16_configure_ports(card, port, mpu_port, val);
if (err < 0) if (err < 0)
break; break;
...@@ -143,8 +144,8 @@ static int jazz16_detect_board(unsigned long port, ...@@ -143,8 +144,8 @@ static int jazz16_detect_board(unsigned long port,
} }
snd_sbdsp_get_byte(&chip); snd_sbdsp_get_byte(&chip);
err = snd_sbdsp_get_byte(&chip); err = snd_sbdsp_get_byte(&chip);
snd_printd("Media Vision Jazz16 board detected: rev 0x%x, model 0x%x\n", dev_dbg(card->dev, "Media Vision Jazz16 board detected: rev 0x%x, model 0x%x\n",
val, err); val, err);
err = 0; err = 0;
...@@ -185,31 +186,31 @@ static int snd_jazz16_match(struct device *devptr, unsigned int dev) ...@@ -185,31 +186,31 @@ static int snd_jazz16_match(struct device *devptr, unsigned int dev)
if (!enable[dev]) if (!enable[dev])
return 0; return 0;
if (port[dev] == SNDRV_AUTO_PORT) { if (port[dev] == SNDRV_AUTO_PORT) {
snd_printk(KERN_ERR "please specify port\n"); dev_err(devptr, "please specify port\n");
return 0; return 0;
} else if (port[dev] == 0x200 || (port[dev] & ~0x270)) { } else if (port[dev] == 0x200 || (port[dev] & ~0x270)) {
snd_printk(KERN_ERR "incorrect port specified\n"); dev_err(devptr, "incorrect port specified\n");
return 0; return 0;
} }
if (dma8[dev] != SNDRV_AUTO_DMA && if (dma8[dev] != SNDRV_AUTO_DMA &&
dma8[dev] != 1 && dma8[dev] != 3) { dma8[dev] != 1 && dma8[dev] != 3) {
snd_printk(KERN_ERR "dma8 must be 1 or 3\n"); dev_err(devptr, "dma8 must be 1 or 3\n");
return 0; return 0;
} }
if (dma16[dev] != SNDRV_AUTO_DMA && if (dma16[dev] != SNDRV_AUTO_DMA &&
dma16[dev] != 5 && dma16[dev] != 7) { dma16[dev] != 5 && dma16[dev] != 7) {
snd_printk(KERN_ERR "dma16 must be 5 or 7\n"); dev_err(devptr, "dma16 must be 5 or 7\n");
return 0; return 0;
} }
if (mpu_port[dev] != SNDRV_AUTO_PORT && if (mpu_port[dev] != SNDRV_AUTO_PORT &&
(mpu_port[dev] & ~0x030) != 0x300) { (mpu_port[dev] & ~0x030) != 0x300) {
snd_printk(KERN_ERR "incorrect mpu_port specified\n"); dev_err(devptr, "incorrect mpu_port specified\n");
return 0; return 0;
} }
if (mpu_irq[dev] != SNDRV_AUTO_DMA && if (mpu_irq[dev] != SNDRV_AUTO_DMA &&
mpu_irq[dev] != 2 && mpu_irq[dev] != 3 && mpu_irq[dev] != 2 && mpu_irq[dev] != 3 &&
mpu_irq[dev] != 5 && mpu_irq[dev] != 7) { mpu_irq[dev] != 5 && mpu_irq[dev] != 7) {
snd_printk(KERN_ERR "mpu_irq must be 2, 3, 5 or 7\n"); dev_err(devptr, "mpu_irq must be 2, 3, 5 or 7\n");
return 0; return 0;
} }
return 1; return 1;
...@@ -237,7 +238,7 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev) ...@@ -237,7 +238,7 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
if (xirq == SNDRV_AUTO_IRQ) { if (xirq == SNDRV_AUTO_IRQ) {
xirq = snd_legacy_find_free_irq(possible_irqs); xirq = snd_legacy_find_free_irq(possible_irqs);
if (xirq < 0) { if (xirq < 0) {
snd_printk(KERN_ERR "unable to find a free IRQ\n"); dev_err(devptr, "unable to find a free IRQ\n");
return -EBUSY; return -EBUSY;
} }
} }
...@@ -245,7 +246,7 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev) ...@@ -245,7 +246,7 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
if (xdma8 == SNDRV_AUTO_DMA) { if (xdma8 == SNDRV_AUTO_DMA) {
xdma8 = snd_legacy_find_free_dma(possible_dmas8); xdma8 = snd_legacy_find_free_dma(possible_dmas8);
if (xdma8 < 0) { if (xdma8 < 0) {
snd_printk(KERN_ERR "unable to find a free DMA8\n"); dev_err(devptr, "unable to find a free DMA8\n");
return -EBUSY; return -EBUSY;
} }
} }
...@@ -253,7 +254,7 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev) ...@@ -253,7 +254,7 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
if (xdma16 == SNDRV_AUTO_DMA) { if (xdma16 == SNDRV_AUTO_DMA) {
xdma16 = snd_legacy_find_free_dma(possible_dmas16); xdma16 = snd_legacy_find_free_dma(possible_dmas16);
if (xdma16 < 0) { if (xdma16 < 0) {
snd_printk(KERN_ERR "unable to find a free DMA16\n"); dev_err(devptr, "unable to find a free DMA16\n");
return -EBUSY; return -EBUSY;
} }
} }
...@@ -261,9 +262,9 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev) ...@@ -261,9 +262,9 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
xmpu_port = mpu_port[dev]; xmpu_port = mpu_port[dev];
if (xmpu_port == SNDRV_AUTO_PORT) if (xmpu_port == SNDRV_AUTO_PORT)
xmpu_port = 0; xmpu_port = 0;
err = jazz16_detect_board(port[dev], xmpu_port); err = jazz16_detect_board(card, port[dev], xmpu_port);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "Media Vision Jazz16 board not detected\n"); dev_err(devptr, "Media Vision Jazz16 board not detected\n");
return err; return err;
} }
err = snd_sbdsp_create(card, port[dev], irq[dev], err = snd_sbdsp_create(card, port[dev], irq[dev],
...@@ -279,7 +280,7 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev) ...@@ -279,7 +280,7 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
xmpu_irq = 0; xmpu_irq = 0;
err = jazz16_configure_board(chip, xmpu_irq); err = jazz16_configure_board(chip, xmpu_irq);
if (err < 0) { if (err < 0) {
printk(KERN_ERR "Media Vision Jazz16 configuration failed\n"); dev_err(devptr, "Media Vision Jazz16 configuration failed\n");
return err; return err;
} }
...@@ -301,8 +302,8 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev) ...@@ -301,8 +302,8 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
err = snd_opl3_create(card, chip->port, chip->port + 2, err = snd_opl3_create(card, chip->port, chip->port + 2,
OPL3_HW_AUTO, 1, &opl3); OPL3_HW_AUTO, 1, &opl3);
if (err < 0) if (err < 0)
snd_printk(KERN_WARNING "no OPL device at 0x%lx-0x%lx\n", dev_warn(devptr, "no OPL device at 0x%lx-0x%lx\n",
chip->port, chip->port + 2); chip->port, chip->port + 2);
else { else {
err = snd_opl3_hwdep_new(opl3, 0, 1, NULL); err = snd_opl3_hwdep_new(opl3, 0, 1, NULL);
if (err < 0) if (err < 0)
...@@ -317,8 +318,8 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev) ...@@ -317,8 +318,8 @@ static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
mpu_port[dev], 0, mpu_port[dev], 0,
mpu_irq[dev], mpu_irq[dev],
NULL) < 0) NULL) < 0)
snd_printk(KERN_ERR "no MPU-401 device at 0x%lx\n", dev_err(devptr, "no MPU-401 device at 0x%lx\n",
mpu_port[dev]); mpu_port[dev]);
} }
err = snd_card_register(card); err = snd_card_register(card);
......
...@@ -21,12 +21,6 @@ ...@@ -21,12 +21,6 @@
#define SNDRV_LEGACY_FIND_FREE_DMA #define SNDRV_LEGACY_FIND_FREE_DMA
#include <sound/initval.h> #include <sound/initval.h>
#ifdef SNDRV_SBAWE
#define PFX "sbawe: "
#else
#define PFX "sb16: "
#endif
MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
#ifndef SNDRV_SBAWE #ifndef SNDRV_SBAWE
...@@ -246,7 +240,7 @@ static int snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard, ...@@ -246,7 +240,7 @@ static int snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
err = pnp_activate_dev(pdev); err = pnp_activate_dev(pdev);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR PFX "AUDIO pnp configure failure\n"); dev_err(&pdev->dev, "AUDIO pnp configure failure\n");
return err; return err;
} }
port[dev] = pnp_port_start(pdev, 0); port[dev] = pnp_port_start(pdev, 0);
...@@ -255,10 +249,10 @@ static int snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard, ...@@ -255,10 +249,10 @@ static int snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
dma8[dev] = pnp_dma(pdev, 0); dma8[dev] = pnp_dma(pdev, 0);
dma16[dev] = pnp_dma(pdev, 1); dma16[dev] = pnp_dma(pdev, 1);
irq[dev] = pnp_irq(pdev, 0); irq[dev] = pnp_irq(pdev, 0);
snd_printdd("pnp SB16: port=0x%lx, mpu port=0x%lx, fm port=0x%lx\n", dev_dbg(&pdev->dev, "pnp SB16: port=0x%lx, mpu port=0x%lx, fm port=0x%lx\n",
port[dev], mpu_port[dev], fm_port[dev]); port[dev], mpu_port[dev], fm_port[dev]);
snd_printdd("pnp SB16: dma1=%i, dma2=%i, irq=%i\n", dev_dbg(&pdev->dev, "pnp SB16: dma1=%i, dma2=%i, irq=%i\n",
dma8[dev], dma16[dev], irq[dev]); dma8[dev], dma16[dev], irq[dev]);
#ifdef SNDRV_SBAWE_EMU8000 #ifdef SNDRV_SBAWE_EMU8000
/* WaveTable initialization */ /* WaveTable initialization */
pdev = acard->devwt; pdev = acard->devwt;
...@@ -268,13 +262,13 @@ static int snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard, ...@@ -268,13 +262,13 @@ static int snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
goto __wt_error; goto __wt_error;
} }
awe_port[dev] = pnp_port_start(pdev, 0); awe_port[dev] = pnp_port_start(pdev, 0);
snd_printdd("pnp SB16: wavetable port=0x%llx\n", dev_dbg(&pdev->dev, "pnp SB16: wavetable port=0x%llx\n",
(unsigned long long)pnp_port_start(pdev, 0)); (unsigned long long)pnp_port_start(pdev, 0));
} else { } else {
__wt_error: __wt_error:
if (pdev) { if (pdev) {
pnp_release_card_device(pdev); pnp_release_card_device(pdev);
snd_printk(KERN_ERR PFX "WaveTable pnp configure failure\n"); dev_err(&pdev->dev, "WaveTable pnp configure failure\n");
} }
acard->devwt = NULL; acard->devwt = NULL;
awe_port[dev] = -1; awe_port[dev] = -1;
...@@ -329,7 +323,7 @@ static int snd_sb16_probe(struct snd_card *card, int dev) ...@@ -329,7 +323,7 @@ static int snd_sb16_probe(struct snd_card *card, int dev)
acard->chip = chip; acard->chip = chip;
if (chip->hardware != SB_HW_16) { if (chip->hardware != SB_HW_16) {
snd_printk(KERN_ERR PFX "SB 16 chip was not detected at 0x%lx\n", port[dev]); dev_err(card->dev, "SB 16 chip was not detected at 0x%lx\n", port[dev]);
return -ENODEV; return -ENODEV;
} }
chip->mpu_port = mpu_port[dev]; chip->mpu_port = mpu_port[dev];
...@@ -379,8 +373,8 @@ static int snd_sb16_probe(struct snd_card *card, int dev) ...@@ -379,8 +373,8 @@ static int snd_sb16_probe(struct snd_card *card, int dev)
OPL3_HW_OPL3, OPL3_HW_OPL3,
acard->fm_res != NULL || fm_port[dev] == port[dev], acard->fm_res != NULL || fm_port[dev] == port[dev],
&opl3) < 0) { &opl3) < 0) {
snd_printk(KERN_ERR PFX "no OPL device at 0x%lx-0x%lx\n", dev_err(card->dev, "no OPL device at 0x%lx-0x%lx\n",
fm_port[dev], fm_port[dev] + 2); fm_port[dev], fm_port[dev] + 2);
} else { } else {
#ifdef SNDRV_SBAWE_EMU8000 #ifdef SNDRV_SBAWE_EMU8000
int seqdev = awe_port[dev] > 0 ? 2 : 1; int seqdev = awe_port[dev] > 0 ? 2 : 1;
...@@ -405,7 +399,9 @@ static int snd_sb16_probe(struct snd_card *card, int dev) ...@@ -405,7 +399,9 @@ static int snd_sb16_probe(struct snd_card *card, int dev)
chip->csp = xcsp->private_data; chip->csp = xcsp->private_data;
chip->hardware = SB_HW_16CSP; chip->hardware = SB_HW_16CSP;
} else { } else {
snd_printk(KERN_INFO PFX "warning - CSP chip not detected on soundcard #%i\n", dev + 1); dev_info(card->dev,
"warning - CSP chip not detected on soundcard #%i\n",
dev + 1);
} }
} }
#endif #endif
...@@ -414,7 +410,9 @@ static int snd_sb16_probe(struct snd_card *card, int dev) ...@@ -414,7 +410,9 @@ static int snd_sb16_probe(struct snd_card *card, int dev)
err = snd_emu8000_new(card, 1, awe_port[dev], err = snd_emu8000_new(card, 1, awe_port[dev],
seq_ports[dev], NULL); seq_ports[dev], NULL);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]); dev_err(card->dev,
"fatal error - EMU-8000 synthesizer not detected at 0x%lx\n",
awe_port[dev]);
return err; return err;
} }
...@@ -502,21 +500,21 @@ static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev) ...@@ -502,21 +500,21 @@ static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev)
if (irq[dev] == SNDRV_AUTO_IRQ) { if (irq[dev] == SNDRV_AUTO_IRQ) {
irq[dev] = snd_legacy_find_free_irq(possible_irqs); irq[dev] = snd_legacy_find_free_irq(possible_irqs);
if (irq[dev] < 0) { if (irq[dev] < 0) {
snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); dev_err(pdev, "unable to find a free IRQ\n");
return -EBUSY; return -EBUSY;
} }
} }
if (dma8[dev] == SNDRV_AUTO_DMA) { if (dma8[dev] == SNDRV_AUTO_DMA) {
dma8[dev] = snd_legacy_find_free_dma(possible_dmas8); dma8[dev] = snd_legacy_find_free_dma(possible_dmas8);
if (dma8[dev] < 0) { if (dma8[dev] < 0) {
snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n"); dev_err(pdev, "unable to find a free 8-bit DMA\n");
return -EBUSY; return -EBUSY;
} }
} }
if (dma16[dev] == SNDRV_AUTO_DMA) { if (dma16[dev] == SNDRV_AUTO_DMA) {
dma16[dev] = snd_legacy_find_free_dma(possible_dmas16); dma16[dev] = snd_legacy_find_free_dma(possible_dmas16);
if (dma16[dev] < 0) { if (dma16[dev] < 0) {
snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n"); dev_err(pdev, "unable to find a free 16-bit DMA\n");
return -EBUSY; return -EBUSY;
} }
} }
......
...@@ -296,6 +296,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p, ...@@ -296,6 +296,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
struct snd_sb_csp_microcode __user * mcode) struct snd_sb_csp_microcode __user * mcode)
{ {
struct snd_sb_csp_mc_header info; struct snd_sb_csp_mc_header info;
struct device *dev = p->chip->card->dev;
unsigned char __user *data_ptr; unsigned char __user *data_ptr;
unsigned char __user *data_end; unsigned char __user *data_end;
...@@ -316,7 +317,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p, ...@@ -316,7 +317,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
return -EFAULT; return -EFAULT;
if ((le32_to_cpu(file_h.name) != RIFF_HEADER) || if ((le32_to_cpu(file_h.name) != RIFF_HEADER) ||
(le32_to_cpu(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { (le32_to_cpu(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) {
snd_printd("%s: Invalid RIFF header\n", __func__); dev_dbg(dev, "%s: Invalid RIFF header\n", __func__);
return -EINVAL; return -EINVAL;
} }
data_ptr += sizeof(file_h); data_ptr += sizeof(file_h);
...@@ -325,7 +326,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p, ...@@ -325,7 +326,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
if (copy_from_user(&item_type, data_ptr, sizeof(item_type))) if (copy_from_user(&item_type, data_ptr, sizeof(item_type)))
return -EFAULT; return -EFAULT;
if (le32_to_cpu(item_type) != CSP__HEADER) { if (le32_to_cpu(item_type) != CSP__HEADER) {
snd_printd("%s: Invalid RIFF file type\n", __func__); dev_dbg(dev, "%s: Invalid RIFF file type\n", __func__);
return -EINVAL; return -EINVAL;
} }
data_ptr += sizeof (item_type); data_ptr += sizeof (item_type);
...@@ -380,7 +381,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p, ...@@ -380,7 +381,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
return -EFAULT; return -EFAULT;
if (le32_to_cpu(code_h.name) != MAIN_HEADER) { if (le32_to_cpu(code_h.name) != MAIN_HEADER) {
snd_printd("%s: Missing 'main' microcode\n", __func__); dev_dbg(dev, "%s: Missing 'main' microcode\n", __func__);
return -EINVAL; return -EINVAL;
} }
data_ptr += sizeof(code_h); data_ptr += sizeof(code_h);
...@@ -423,9 +424,9 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p, ...@@ -423,9 +424,9 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
default: /* other codecs are unsupported */ default: /* other codecs are unsupported */
p->acc_format = p->acc_width = p->acc_rates = 0; p->acc_format = p->acc_width = p->acc_rates = 0;
p->mode = 0; p->mode = 0;
snd_printd("%s: Unsupported CSP codec type: 0x%04x\n", dev_dbg(dev, "%s: Unsupported CSP codec type: 0x%04x\n",
__func__, __func__,
le16_to_cpu(funcdesc_h.VOC_type)); le16_to_cpu(funcdesc_h.VOC_type));
return -EINVAL; return -EINVAL;
} }
p->acc_channels = le16_to_cpu(funcdesc_h.flags_stereo_mono); p->acc_channels = le16_to_cpu(funcdesc_h.flags_stereo_mono);
...@@ -443,7 +444,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p, ...@@ -443,7 +444,7 @@ static int snd_sb_csp_riff_load(struct snd_sb_csp * p,
return 0; return 0;
} }
} }
snd_printd("%s: Function #%d not found\n", __func__, info.func_req); dev_dbg(dev, "%s: Function #%d not found\n", __func__, info.func_req);
return -EINVAL; return -EINVAL;
} }
...@@ -597,7 +598,9 @@ static int get_version(struct snd_sb *chip) ...@@ -597,7 +598,9 @@ static int get_version(struct snd_sb *chip)
static int snd_sb_csp_check_version(struct snd_sb_csp * p) static int snd_sb_csp_check_version(struct snd_sb_csp * p)
{ {
if (p->version < 0x10 || p->version > 0x1f) { if (p->version < 0x10 || p->version > 0x1f) {
snd_printd("%s: Invalid CSP version: 0x%x\n", __func__, p->version); dev_dbg(p->chip->card->dev,
"%s: Invalid CSP version: 0x%x\n",
__func__, p->version);
return 1; return 1;
} }
return 0; return 0;
...@@ -616,7 +619,7 @@ static int snd_sb_csp_load(struct snd_sb_csp * p, const unsigned char *buf, int ...@@ -616,7 +619,7 @@ static int snd_sb_csp_load(struct snd_sb_csp * p, const unsigned char *buf, int
spin_lock_irqsave(&p->chip->reg_lock, flags); spin_lock_irqsave(&p->chip->reg_lock, flags);
snd_sbdsp_command(p->chip, 0x01); /* CSP download command */ snd_sbdsp_command(p->chip, 0x01); /* CSP download command */
if (snd_sbdsp_get_byte(p->chip)) { if (snd_sbdsp_get_byte(p->chip)) {
snd_printd("%s: Download command failed\n", __func__); dev_dbg(p->chip->card->dev, "%s: Download command failed\n", __func__);
goto __fail; goto __fail;
} }
/* Send CSP low byte (size - 1) */ /* Send CSP low byte (size - 1) */
...@@ -643,7 +646,9 @@ static int snd_sb_csp_load(struct snd_sb_csp * p, const unsigned char *buf, int ...@@ -643,7 +646,9 @@ static int snd_sb_csp_load(struct snd_sb_csp * p, const unsigned char *buf, int
udelay (10); udelay (10);
} }
if (status != 0x55) { if (status != 0x55) {
snd_printd("%s: Microcode initialization failed\n", __func__); dev_dbg(p->chip->card->dev,
"%s: Microcode initialization failed\n",
__func__);
goto __fail; goto __fail;
} }
} else { } else {
...@@ -788,25 +793,26 @@ static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, ...@@ -788,25 +793,26 @@ static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt,
*/ */
static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channels) static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channels)
{ {
struct device *dev = p->chip->card->dev;
unsigned char s_type; /* sample type */ unsigned char s_type; /* sample type */
unsigned char mixL, mixR; unsigned char mixL, mixR;
int result = -EIO; int result = -EIO;
unsigned long flags; unsigned long flags;
if (!(p->running & (SNDRV_SB_CSP_ST_LOADED | SNDRV_SB_CSP_ST_AUTO))) { if (!(p->running & (SNDRV_SB_CSP_ST_LOADED | SNDRV_SB_CSP_ST_AUTO))) {
snd_printd("%s: Microcode not loaded\n", __func__); dev_dbg(dev, "%s: Microcode not loaded\n", __func__);
return -ENXIO; return -ENXIO;
} }
if (p->running & SNDRV_SB_CSP_ST_RUNNING) { if (p->running & SNDRV_SB_CSP_ST_RUNNING) {
snd_printd("%s: CSP already running\n", __func__); dev_dbg(dev, "%s: CSP already running\n", __func__);
return -EBUSY; return -EBUSY;
} }
if (!(sample_width & p->acc_width)) { if (!(sample_width & p->acc_width)) {
snd_printd("%s: Unsupported PCM sample width\n", __func__); dev_dbg(dev, "%s: Unsupported PCM sample width\n", __func__);
return -EINVAL; return -EINVAL;
} }
if (!(channels & p->acc_channels)) { if (!(channels & p->acc_channels)) {
snd_printd("%s: Invalid number of channels\n", __func__); dev_dbg(dev, "%s: Invalid number of channels\n", __func__);
return -EINVAL; return -EINVAL;
} }
...@@ -829,11 +835,11 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel ...@@ -829,11 +835,11 @@ static int snd_sb_csp_start(struct snd_sb_csp * p, int sample_width, int channel
s_type |= 0x22; /* 00dX 00dX (d = 1 if 8 bit samples) */ s_type |= 0x22; /* 00dX 00dX (d = 1 if 8 bit samples) */
if (set_codec_parameter(p->chip, 0x81, s_type)) { if (set_codec_parameter(p->chip, 0x81, s_type)) {
snd_printd("%s: Set sample type command failed\n", __func__); dev_dbg(dev, "%s: Set sample type command failed\n", __func__);
goto __fail; goto __fail;
} }
if (set_codec_parameter(p->chip, 0x80, 0x00)) { if (set_codec_parameter(p->chip, 0x80, 0x00)) {
snd_printd("%s: Codec start command failed\n", __func__); dev_dbg(dev, "%s: Codec start command failed\n", __func__);
goto __fail; goto __fail;
} }
p->run_width = sample_width; p->run_width = sample_width;
......
...@@ -733,7 +733,6 @@ int snd_sb16dsp_configure(struct snd_sb * chip) ...@@ -733,7 +733,6 @@ int snd_sb16dsp_configure(struct snd_sb * chip)
unsigned char realirq, realdma, realmpureg; unsigned char realirq, realdma, realmpureg;
/* note: mpu register should be present only on SB16 Vibra soundcards */ /* note: mpu register should be present only on SB16 Vibra soundcards */
// printk(KERN_DEBUG "codec->irq=%i, codec->dma8=%i, codec->dma16=%i\n", chip->irq, chip->dma8, chip->dma16);
spin_lock_irqsave(&chip->mixer_lock, flags); spin_lock_irqsave(&chip->mixer_lock, flags);
mpureg = snd_sbmixer_read(chip, SB_DSP4_MPUSETUP) & ~0x06; mpureg = snd_sbmixer_read(chip, SB_DSP4_MPUSETUP) & ~0x06;
spin_unlock_irqrestore(&chip->mixer_lock, flags); spin_unlock_irqrestore(&chip->mixer_lock, flags);
...@@ -807,9 +806,15 @@ int snd_sb16dsp_configure(struct snd_sb * chip) ...@@ -807,9 +806,15 @@ int snd_sb16dsp_configure(struct snd_sb * chip)
spin_unlock_irqrestore(&chip->mixer_lock, flags); spin_unlock_irqrestore(&chip->mixer_lock, flags);
if ((~realirq) & irqreg || (~realdma) & dmareg) { if ((~realirq) & irqreg || (~realdma) & dmareg) {
snd_printk(KERN_ERR "SB16 [0x%lx]: unable to set DMA & IRQ (PnP device?)\n", chip->port); dev_err(chip->card->dev,
snd_printk(KERN_ERR "SB16 [0x%lx]: wanted: irqreg=0x%x, dmareg=0x%x, mpureg = 0x%x\n", chip->port, realirq, realdma, realmpureg); "SB16 [0x%lx]: unable to set DMA & IRQ (PnP device?)\n",
snd_printk(KERN_ERR "SB16 [0x%lx]: got: irqreg=0x%x, dmareg=0x%x, mpureg = 0x%x\n", chip->port, irqreg, dmareg, mpureg); chip->port);
dev_err(chip->card->dev,
"SB16 [0x%lx]: wanted: irqreg=0x%x, dmareg=0x%x, mpureg = 0x%x\n",
chip->port, realirq, realdma, realmpureg);
dev_err(chip->card->dev,
"SB16 [0x%lx]: got: irqreg=0x%x, dmareg=0x%x, mpureg = 0x%x\n",
chip->port, irqreg, dmareg, mpureg);
return -ENODEV; return -ENODEV;
} }
return 0; return 0;
......
...@@ -123,11 +123,11 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) ...@@ -123,11 +123,11 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
if (chip->hardware >= SB_HW_16) { if (chip->hardware >= SB_HW_16) {
if (chip->hardware == SB_HW_ALS100) if (chip->hardware == SB_HW_ALS100)
snd_printk(KERN_WARNING "ALS100 chip detected at 0x%lx, try snd-als100 module\n", dev_warn(pdev, "ALS100 chip detected at 0x%lx, try snd-als100 module\n",
port[dev]); port[dev]);
else else
snd_printk(KERN_WARNING "SB 16 chip detected at 0x%lx, try snd-sb16 module\n", dev_warn(pdev, "SB 16 chip detected at 0x%lx, try snd-sb16 module\n",
port[dev]); port[dev]);
return -ENODEV; return -ENODEV;
} }
...@@ -143,12 +143,12 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev) ...@@ -143,12 +143,12 @@ static int snd_sb8_probe(struct device *pdev, unsigned int dev)
err = snd_opl3_create(card, chip->port + 8, 0, err = snd_opl3_create(card, chip->port + 8, 0,
OPL3_HW_AUTO, 1, &opl3); OPL3_HW_AUTO, 1, &opl3);
if (err < 0) if (err < 0)
snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx\n", chip->port + 8); dev_warn(pdev, "sb8: no OPL device at 0x%lx\n", chip->port + 8);
} else { } else {
err = snd_opl3_create(card, chip->port, chip->port + 2, err = snd_opl3_create(card, chip->port, chip->port + 2,
OPL3_HW_AUTO, 1, &opl3); OPL3_HW_AUTO, 1, &opl3);
if (err < 0) { if (err < 0) {
snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx-0x%lx\n", dev_warn(pdev, "sb8: no OPL device at 0x%lx-0x%lx\n",
chip->port, chip->port + 2); chip->port, chip->port + 2);
} }
} }
......
...@@ -31,14 +31,14 @@ int snd_sbdsp_command(struct snd_sb *chip, unsigned char val) ...@@ -31,14 +31,14 @@ int snd_sbdsp_command(struct snd_sb *chip, unsigned char val)
{ {
int i; int i;
#ifdef IO_DEBUG #ifdef IO_DEBUG
snd_printk(KERN_DEBUG "command 0x%x\n", val); dev_dbg(chip->card->dev, "command 0x%x\n", val);
#endif #endif
for (i = BUSY_LOOPS; i; i--) for (i = BUSY_LOOPS; i; i--)
if ((inb(SBP(chip, STATUS)) & 0x80) == 0) { if ((inb(SBP(chip, STATUS)) & 0x80) == 0) {
outb(val, SBP(chip, COMMAND)); outb(val, SBP(chip, COMMAND));
return 1; return 1;
} }
snd_printd("%s [0x%lx]: timeout (0x%x)\n", __func__, chip->port, val); dev_dbg(chip->card->dev, "%s [0x%lx]: timeout (0x%x)\n", __func__, chip->port, val);
return 0; return 0;
} }
...@@ -50,12 +50,12 @@ int snd_sbdsp_get_byte(struct snd_sb *chip) ...@@ -50,12 +50,12 @@ int snd_sbdsp_get_byte(struct snd_sb *chip)
if (inb(SBP(chip, DATA_AVAIL)) & 0x80) { if (inb(SBP(chip, DATA_AVAIL)) & 0x80) {
val = inb(SBP(chip, READ)); val = inb(SBP(chip, READ));
#ifdef IO_DEBUG #ifdef IO_DEBUG
snd_printk(KERN_DEBUG "get_byte 0x%x\n", val); dev_dbg(chip->card->dev, "get_byte 0x%x\n", val);
#endif #endif
return val; return val;
} }
} }
snd_printd("%s [0x%lx]: timeout\n", __func__, chip->port); dev_dbg(chip->card->dev, "%s [0x%lx]: timeout\n", __func__, chip->port);
return -ENODEV; return -ENODEV;
} }
...@@ -74,7 +74,8 @@ int snd_sbdsp_reset(struct snd_sb *chip) ...@@ -74,7 +74,8 @@ int snd_sbdsp_reset(struct snd_sb *chip)
else else
break; break;
} }
snd_printdd("%s [0x%lx] failed...\n", __func__, chip->port); if (chip->card)
dev_dbg(chip->card->dev, "%s [0x%lx] failed...\n", __func__, chip->port);
return -ENODEV; return -ENODEV;
} }
...@@ -112,8 +113,8 @@ static int snd_sbdsp_probe(struct snd_sb * chip) ...@@ -112,8 +113,8 @@ static int snd_sbdsp_probe(struct snd_sb * chip)
spin_unlock_irqrestore(&chip->reg_lock, flags); spin_unlock_irqrestore(&chip->reg_lock, flags);
major = version >> 8; major = version >> 8;
minor = version & 0xff; minor = version & 0xff;
snd_printdd("SB [0x%lx]: DSP chip found, version = %i.%i\n", dev_dbg(chip->card->dev, "SB [0x%lx]: DSP chip found, version = %i.%i\n",
chip->port, major, minor); chip->port, major, minor);
switch (chip->hardware) { switch (chip->hardware) {
case SB_HW_AUTO: case SB_HW_AUTO:
...@@ -140,8 +141,8 @@ static int snd_sbdsp_probe(struct snd_sb * chip) ...@@ -140,8 +141,8 @@ static int snd_sbdsp_probe(struct snd_sb * chip)
str = "16"; str = "16";
break; break;
default: default:
snd_printk(KERN_INFO "SB [0x%lx]: unknown DSP chip version %i.%i\n", dev_info(chip->card->dev, "SB [0x%lx]: unknown DSP chip version %i.%i\n",
chip->port, major, minor); chip->port, major, minor);
return -ENODEV; return -ENODEV;
} }
break; break;
...@@ -200,7 +201,7 @@ int snd_sbdsp_create(struct snd_card *card, ...@@ -200,7 +201,7 @@ int snd_sbdsp_create(struct snd_card *card,
hardware == SB_HW_CS5530) ? hardware == SB_HW_CS5530) ?
IRQF_SHARED : 0, IRQF_SHARED : 0,
"SoundBlaster", (void *) chip)) { "SoundBlaster", (void *) chip)) {
snd_printk(KERN_ERR "sb: can't grab irq %d\n", irq); dev_err(card->dev, "sb: can't grab irq %d\n", irq);
return -EBUSY; return -EBUSY;
} }
chip->irq = irq; chip->irq = irq;
...@@ -212,14 +213,14 @@ int snd_sbdsp_create(struct snd_card *card, ...@@ -212,14 +213,14 @@ int snd_sbdsp_create(struct snd_card *card,
chip->res_port = devm_request_region(card->dev, port, 16, chip->res_port = devm_request_region(card->dev, port, 16,
"SoundBlaster"); "SoundBlaster");
if (!chip->res_port) { if (!chip->res_port) {
snd_printk(KERN_ERR "sb: can't grab port 0x%lx\n", port); dev_err(card->dev, "sb: can't grab port 0x%lx\n", port);
return -EBUSY; return -EBUSY;
} }
#ifdef CONFIG_ISA #ifdef CONFIG_ISA
if (dma8 >= 0 && snd_devm_request_dma(card->dev, dma8, if (dma8 >= 0 && snd_devm_request_dma(card->dev, dma8,
"SoundBlaster - 8bit")) { "SoundBlaster - 8bit")) {
snd_printk(KERN_ERR "sb: can't grab DMA8 %d\n", dma8); dev_err(card->dev, "sb: can't grab DMA8 %d\n", dma8);
return -EBUSY; return -EBUSY;
} }
chip->dma8 = dma8; chip->dma8 = dma8;
...@@ -229,7 +230,7 @@ int snd_sbdsp_create(struct snd_card *card, ...@@ -229,7 +230,7 @@ int snd_sbdsp_create(struct snd_card *card,
dma16 = -1; dma16 = -1;
} else if (snd_devm_request_dma(card->dev, dma16, } else if (snd_devm_request_dma(card->dev, dma16,
"SoundBlaster - 16bit")) { "SoundBlaster - 16bit")) {
snd_printk(KERN_ERR "sb: can't grab DMA16 %d\n", dma16); dev_err(card->dev, "sb: can't grab DMA16 %d\n", dma16);
return -EBUSY; return -EBUSY;
} }
} }
......
...@@ -20,7 +20,7 @@ void snd_sbmixer_write(struct snd_sb *chip, unsigned char reg, unsigned char dat ...@@ -20,7 +20,7 @@ void snd_sbmixer_write(struct snd_sb *chip, unsigned char reg, unsigned char dat
outb(data, SBP(chip, MIXER_DATA)); outb(data, SBP(chip, MIXER_DATA));
udelay(10); udelay(10);
#ifdef IO_DEBUG #ifdef IO_DEBUG
snd_printk(KERN_DEBUG "mixer_write 0x%x 0x%x\n", reg, data); dev_dbg(chip->card->dev, "mixer_write 0x%x 0x%x\n", reg, data);
#endif #endif
} }
...@@ -33,7 +33,7 @@ unsigned char snd_sbmixer_read(struct snd_sb *chip, unsigned char reg) ...@@ -33,7 +33,7 @@ unsigned char snd_sbmixer_read(struct snd_sb *chip, unsigned char reg)
result = inb(SBP(chip, MIXER_DATA)); result = inb(SBP(chip, MIXER_DATA));
udelay(10); udelay(10);
#ifdef IO_DEBUG #ifdef IO_DEBUG
snd_printk(KERN_DEBUG "mixer_read 0x%x 0x%x\n", reg, result); dev_dbg(chip->card->dev, "mixer_read 0x%x 0x%x\n", reg, result);
#endif #endif
return result; return result;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment