Commit 80c19b75 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: trident: Use standard printk helpers

Convert with dev_err() and co from snd_printk(), etc.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 09ae539e
...@@ -69,40 +69,40 @@ static void snd_trident_print_voice_regs(struct snd_trident *trident, int voice) ...@@ -69,40 +69,40 @@ static void snd_trident_print_voice_regs(struct snd_trident *trident, int voice)
{ {
unsigned int val, tmp; unsigned int val, tmp;
printk(KERN_DEBUG "Trident voice %i:\n", voice); dev_dbg(trident->card->dev, "Trident voice %i:\n", voice);
outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR)); outb(voice, TRID_REG(trident, T4D_LFO_GC_CIR));
val = inl(TRID_REG(trident, CH_LBA)); val = inl(TRID_REG(trident, CH_LBA));
printk(KERN_DEBUG "LBA: 0x%x\n", val); dev_dbg(trident->card->dev, "LBA: 0x%x\n", val);
val = inl(TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); val = inl(TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC));
printk(KERN_DEBUG "GVSel: %i\n", val >> 31); dev_dbg(trident->card->dev, "GVSel: %i\n", val >> 31);
printk(KERN_DEBUG "Pan: 0x%x\n", (val >> 24) & 0x7f); dev_dbg(trident->card->dev, "Pan: 0x%x\n", (val >> 24) & 0x7f);
printk(KERN_DEBUG "Vol: 0x%x\n", (val >> 16) & 0xff); dev_dbg(trident->card->dev, "Vol: 0x%x\n", (val >> 16) & 0xff);
printk(KERN_DEBUG "CTRL: 0x%x\n", (val >> 12) & 0x0f); dev_dbg(trident->card->dev, "CTRL: 0x%x\n", (val >> 12) & 0x0f);
printk(KERN_DEBUG "EC: 0x%x\n", val & 0x0fff); dev_dbg(trident->card->dev, "EC: 0x%x\n", val & 0x0fff);
if (trident->device != TRIDENT_DEVICE_ID_NX) { if (trident->device != TRIDENT_DEVICE_ID_NX) {
val = inl(TRID_REG(trident, CH_DX_CSO_ALPHA_FMS)); val = inl(TRID_REG(trident, CH_DX_CSO_ALPHA_FMS));
printk(KERN_DEBUG "CSO: 0x%x\n", val >> 16); dev_dbg(trident->card->dev, "CSO: 0x%x\n", val >> 16);
printk("Alpha: 0x%x\n", (val >> 4) & 0x0fff); dev_dbg(trident->card->dev, "Alpha: 0x%x\n", (val >> 4) & 0x0fff);
printk(KERN_DEBUG "FMS: 0x%x\n", val & 0x0f); dev_dbg(trident->card->dev, "FMS: 0x%x\n", val & 0x0f);
val = inl(TRID_REG(trident, CH_DX_ESO_DELTA)); val = inl(TRID_REG(trident, CH_DX_ESO_DELTA));
printk(KERN_DEBUG "ESO: 0x%x\n", val >> 16); dev_dbg(trident->card->dev, "ESO: 0x%x\n", val >> 16);
printk(KERN_DEBUG "Delta: 0x%x\n", val & 0xffff); dev_dbg(trident->card->dev, "Delta: 0x%x\n", val & 0xffff);
val = inl(TRID_REG(trident, CH_DX_FMC_RVOL_CVOL)); val = inl(TRID_REG(trident, CH_DX_FMC_RVOL_CVOL));
} else { // TRIDENT_DEVICE_ID_NX } else { // TRIDENT_DEVICE_ID_NX
val = inl(TRID_REG(trident, CH_NX_DELTA_CSO)); val = inl(TRID_REG(trident, CH_NX_DELTA_CSO));
tmp = (val >> 24) & 0xff; tmp = (val >> 24) & 0xff;
printk(KERN_DEBUG "CSO: 0x%x\n", val & 0x00ffffff); dev_dbg(trident->card->dev, "CSO: 0x%x\n", val & 0x00ffffff);
val = inl(TRID_REG(trident, CH_NX_DELTA_ESO)); val = inl(TRID_REG(trident, CH_NX_DELTA_ESO));
tmp |= (val >> 16) & 0xff00; tmp |= (val >> 16) & 0xff00;
printk(KERN_DEBUG "Delta: 0x%x\n", tmp); dev_dbg(trident->card->dev, "Delta: 0x%x\n", tmp);
printk(KERN_DEBUG "ESO: 0x%x\n", val & 0x00ffffff); dev_dbg(trident->card->dev, "ESO: 0x%x\n", val & 0x00ffffff);
val = inl(TRID_REG(trident, CH_NX_ALPHA_FMS_FMC_RVOL_CVOL)); val = inl(TRID_REG(trident, CH_NX_ALPHA_FMS_FMC_RVOL_CVOL));
printk(KERN_DEBUG "Alpha: 0x%x\n", val >> 20); dev_dbg(trident->card->dev, "Alpha: 0x%x\n", val >> 20);
printk(KERN_DEBUG "FMS: 0x%x\n", (val >> 16) & 0x0f); dev_dbg(trident->card->dev, "FMS: 0x%x\n", (val >> 16) & 0x0f);
} }
printk(KERN_DEBUG "FMC: 0x%x\n", (val >> 14) & 3); dev_dbg(trident->card->dev, "FMC: 0x%x\n", (val >> 14) & 3);
printk(KERN_DEBUG "RVol: 0x%x\n", (val >> 7) & 0x7f); dev_dbg(trident->card->dev, "RVol: 0x%x\n", (val >> 7) & 0x7f);
printk(KERN_DEBUG "CVol: 0x%x\n", val & 0x7f); dev_dbg(trident->card->dev, "CVol: 0x%x\n", val & 0x7f);
} }
#endif #endif
...@@ -156,7 +156,8 @@ static unsigned short snd_trident_codec_read(struct snd_ac97 *ac97, unsigned sho ...@@ -156,7 +156,8 @@ static unsigned short snd_trident_codec_read(struct snd_ac97 *ac97, unsigned sho
} }
if (count == 0 && !trident->ac97_detect) { if (count == 0 && !trident->ac97_detect) {
snd_printk(KERN_ERR "ac97 codec read TIMEOUT [0x%x/0x%x]!!!\n", dev_err(trident->card->dev,
"ac97 codec read TIMEOUT [0x%x/0x%x]!!!\n",
reg, data); reg, data);
data = 0; data = 0;
} }
...@@ -497,16 +498,16 @@ void snd_trident_write_voice_regs(struct snd_trident * trident, ...@@ -497,16 +498,16 @@ void snd_trident_write_voice_regs(struct snd_trident * trident,
outl(regs[4], TRID_REG(trident, CH_START + 16)); outl(regs[4], TRID_REG(trident, CH_START + 16));
#if 0 #if 0
printk(KERN_DEBUG "written %i channel:\n", voice->number); dev_dbg(trident->card->dev, "written %i channel:\n", voice->number);
printk(KERN_DEBUG " regs[0] = 0x%x/0x%x\n", dev_dbg(trident->card->dev, " regs[0] = 0x%x/0x%x\n",
regs[0], inl(TRID_REG(trident, CH_START + 0))); regs[0], inl(TRID_REG(trident, CH_START + 0)));
printk(KERN_DEBUG " regs[1] = 0x%x/0x%x\n", dev_dbg(trident->card->dev, " regs[1] = 0x%x/0x%x\n",
regs[1], inl(TRID_REG(trident, CH_START + 4))); regs[1], inl(TRID_REG(trident, CH_START + 4)));
printk(KERN_DEBUG " regs[2] = 0x%x/0x%x\n", dev_dbg(trident->card->dev, " regs[2] = 0x%x/0x%x\n",
regs[2], inl(TRID_REG(trident, CH_START + 8))); regs[2], inl(TRID_REG(trident, CH_START + 8)));
printk(KERN_DEBUG " regs[3] = 0x%x/0x%x\n", dev_dbg(trident->card->dev, " regs[3] = 0x%x/0x%x\n",
regs[3], inl(TRID_REG(trident, CH_START + 12))); regs[3], inl(TRID_REG(trident, CH_START + 12)));
printk(KERN_DEBUG " regs[4] = 0x%x/0x%x\n", dev_dbg(trident->card->dev, " regs[4] = 0x%x/0x%x\n",
regs[4], inl(TRID_REG(trident, CH_START + 16))); regs[4], inl(TRID_REG(trident, CH_START + 16)));
#endif #endif
} }
...@@ -589,7 +590,7 @@ static void snd_trident_write_vol_reg(struct snd_trident * trident, ...@@ -589,7 +590,7 @@ static void snd_trident_write_vol_reg(struct snd_trident * trident,
outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2)); outb(voice->Vol >> 2, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 2));
break; break;
case TRIDENT_DEVICE_ID_SI7018: case TRIDENT_DEVICE_ID_SI7018:
/* printk(KERN_DEBUG "voice->Vol = 0x%x\n", voice->Vol); */ /* dev_dbg(trident->card->dev, "voice->Vol = 0x%x\n", voice->Vol); */
outw((voice->CTRL << 12) | voice->Vol, outw((voice->CTRL << 12) | voice->Vol,
TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC));
break; break;
...@@ -3013,13 +3014,15 @@ static int snd_trident_mixer(struct snd_trident *trident, int pcm_spdif_device) ...@@ -3013,13 +3014,15 @@ static int snd_trident_mixer(struct snd_trident *trident, int pcm_spdif_device)
_ac97.num = 1; _ac97.num = 1;
err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97_sec); err = snd_ac97_mixer(trident->ac97_bus, &_ac97, &trident->ac97_sec);
if (err < 0) if (err < 0)
snd_printk(KERN_ERR "SI7018: the secondary codec - invalid access\n"); dev_err(trident->card->dev,
"SI7018: the secondary codec - invalid access\n");
#if 0 // only for my testing purpose --jk #if 0 // only for my testing purpose --jk
{ {
struct snd_ac97 *mc97; struct snd_ac97 *mc97;
err = snd_ac97_modem(trident->card, &_ac97, &mc97); err = snd_ac97_modem(trident->card, &_ac97, &mc97);
if (err < 0) if (err < 0)
snd_printk(KERN_ERR "snd_ac97_modem returned error %i\n", err); dev_err(trident->card->dev,
"snd_ac97_modem returned error %i\n", err);
} }
#endif #endif
} }
...@@ -3197,7 +3200,8 @@ int snd_trident_create_gameport(struct snd_trident *chip) ...@@ -3197,7 +3200,8 @@ int snd_trident_create_gameport(struct snd_trident *chip)
chip->gameport = gp = gameport_allocate_port(); chip->gameport = gp = gameport_allocate_port();
if (!gp) { if (!gp) {
printk(KERN_ERR "trident: cannot allocate memory for gameport\n"); dev_err(chip->card->dev,
"cannot allocate memory for gameport\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -3270,7 +3274,8 @@ static int snd_trident_sis_reset(struct snd_trident *trident) ...@@ -3270,7 +3274,8 @@ static int snd_trident_sis_reset(struct snd_trident *trident)
goto __si7018_ok; goto __si7018_ok;
do_delay(trident); do_delay(trident);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
snd_printk(KERN_ERR "AC'97 codec ready error [0x%x]\n", inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL))); dev_err(trident->card->dev, "AC'97 codec ready error [0x%x]\n",
inl(TRID_REG(trident, SI_SERIAL_INTF_CTRL)));
if (r-- > 0) { if (r-- > 0) {
end_time = jiffies + HZ; end_time = jiffies + HZ;
do { do {
...@@ -3367,7 +3372,7 @@ static int snd_trident_tlb_alloc(struct snd_trident *trident) ...@@ -3367,7 +3372,7 @@ static int snd_trident_tlb_alloc(struct snd_trident *trident)
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci), if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci),
2 * SNDRV_TRIDENT_MAX_PAGES * 4, &trident->tlb.buffer) < 0) { 2 * SNDRV_TRIDENT_MAX_PAGES * 4, &trident->tlb.buffer) < 0) {
snd_printk(KERN_ERR "trident: unable to allocate TLB buffer\n"); dev_err(trident->card->dev, "unable to allocate TLB buffer\n");
return -ENOMEM; return -ENOMEM;
} }
trident->tlb.entries = (unsigned int*)ALIGN((unsigned long)trident->tlb.buffer.area, SNDRV_TRIDENT_MAX_PAGES * 4); trident->tlb.entries = (unsigned int*)ALIGN((unsigned long)trident->tlb.buffer.area, SNDRV_TRIDENT_MAX_PAGES * 4);
...@@ -3375,13 +3380,14 @@ static int snd_trident_tlb_alloc(struct snd_trident *trident) ...@@ -3375,13 +3380,14 @@ static int snd_trident_tlb_alloc(struct snd_trident *trident)
/* allocate shadow TLB page table (virtual addresses) */ /* allocate shadow TLB page table (virtual addresses) */
trident->tlb.shadow_entries = vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long)); trident->tlb.shadow_entries = vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long));
if (trident->tlb.shadow_entries == NULL) { if (trident->tlb.shadow_entries == NULL) {
snd_printk(KERN_ERR "trident: unable to allocate shadow TLB entries\n"); dev_err(trident->card->dev,
"unable to allocate shadow TLB entries\n");
return -ENOMEM; return -ENOMEM;
} }
/* allocate and setup silent page and initialise TLB entries */ /* allocate and setup silent page and initialise TLB entries */
if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci), if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(trident->pci),
SNDRV_TRIDENT_PAGE_SIZE, &trident->tlb.silent_page) < 0) { SNDRV_TRIDENT_PAGE_SIZE, &trident->tlb.silent_page) < 0) {
snd_printk(KERN_ERR "trident: unable to allocate silent page\n"); dev_err(trident->card->dev, "unable to allocate silent page\n");
return -ENOMEM; return -ENOMEM;
} }
memset(trident->tlb.silent_page.area, 0, SNDRV_TRIDENT_PAGE_SIZE); memset(trident->tlb.silent_page.area, 0, SNDRV_TRIDENT_PAGE_SIZE);
...@@ -3439,7 +3445,7 @@ static int snd_trident_4d_dx_init(struct snd_trident *trident) ...@@ -3439,7 +3445,7 @@ static int snd_trident_4d_dx_init(struct snd_trident *trident)
goto __dx_ok; goto __dx_ok;
do_delay(trident); do_delay(trident);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
snd_printk(KERN_ERR "AC'97 codec ready error\n"); dev_err(trident->card->dev, "AC'97 codec ready error\n");
return -EIO; return -EIO;
__dx_ok: __dx_ok:
...@@ -3477,7 +3483,8 @@ static int snd_trident_4d_nx_init(struct snd_trident *trident) ...@@ -3477,7 +3483,8 @@ static int snd_trident_4d_nx_init(struct snd_trident *trident)
goto __nx_ok; goto __nx_ok;
do_delay(trident); do_delay(trident);
} while (time_after_eq(end_time, jiffies)); } while (time_after_eq(end_time, jiffies));
snd_printk(KERN_ERR "AC'97 codec ready error [0x%x]\n", inl(TRID_REG(trident, NX_ACR0_AC97_COM_STAT))); dev_err(trident->card->dev, "AC'97 codec ready error [0x%x]\n",
inl(TRID_REG(trident, NX_ACR0_AC97_COM_STAT)));
return -EIO; return -EIO;
__nx_ok: __nx_ok:
...@@ -3562,7 +3569,8 @@ int snd_trident_create(struct snd_card *card, ...@@ -3562,7 +3569,8 @@ int snd_trident_create(struct snd_card *card,
/* check, if we can restrict PCI DMA transfers to 30 bits */ /* check, if we can restrict PCI DMA transfers to 30 bits */
if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0 || if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0 ||
pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(30)) < 0) {
snd_printk(KERN_ERR "architecture does not support 30bit PCI busmaster DMA\n"); dev_err(card->dev,
"architecture does not support 30bit PCI busmaster DMA\n");
pci_disable_device(pci); pci_disable_device(pci);
return -ENXIO; return -ENXIO;
} }
...@@ -3600,7 +3608,7 @@ int snd_trident_create(struct snd_card *card, ...@@ -3600,7 +3608,7 @@ int snd_trident_create(struct snd_card *card,
if (request_irq(pci->irq, snd_trident_interrupt, IRQF_SHARED, if (request_irq(pci->irq, snd_trident_interrupt, IRQF_SHARED,
KBUILD_MODNAME, trident)) { KBUILD_MODNAME, trident)) {
snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
snd_trident_free(trident); snd_trident_free(trident);
return -EBUSY; return -EBUSY;
} }
...@@ -3949,8 +3957,7 @@ static int snd_trident_resume(struct device *dev) ...@@ -3949,8 +3957,7 @@ static int snd_trident_resume(struct device *dev)
pci_set_power_state(pci, PCI_D0); pci_set_power_state(pci, PCI_D0);
pci_restore_state(pci); pci_restore_state(pci);
if (pci_enable_device(pci) < 0) { if (pci_enable_device(pci) < 0) {
printk(KERN_ERR "trident: pci_enable_device failed, " dev_err(dev, "pci_enable_device failed, disabling device\n");
"disabling device\n");
snd_card_disconnect(card); snd_card_disconnect(card);
return -EIO; return -EIO;
} }
......
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