Commit 5f1e6937 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: ali5451: Use standard printk helpers

Convert with dev_err() and co from snd_printk(), etc.
Some debug prints are replaced with dev_dbg(), too.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 38c16e34
...@@ -64,18 +64,6 @@ static bool enable; ...@@ -64,18 +64,6 @@ static bool enable;
module_param(enable, bool, 0444); module_param(enable, bool, 0444);
/*
* Debug part definitions
*/
/* #define ALI_DEBUG */
#ifdef ALI_DEBUG
#define snd_ali_printk(format, args...) printk(KERN_DEBUG format, ##args);
#else
#define snd_ali_printk(format, args...)
#endif
/* /*
* Constants definition * Constants definition
*/ */
...@@ -321,7 +309,7 @@ static int snd_ali_codec_ready(struct snd_ali *codec, ...@@ -321,7 +309,7 @@ static int snd_ali_codec_ready(struct snd_ali *codec,
} }
snd_ali_5451_poke(codec, port, res & ~0x8000); snd_ali_5451_poke(codec, port, res & ~0x8000);
snd_printdd("ali_codec_ready: codec is not ready.\n "); dev_dbg(codec->card->dev, "ali_codec_ready: codec is not ready.\n ");
return -EIO; return -EIO;
} }
...@@ -342,7 +330,7 @@ static int snd_ali_stimer_ready(struct snd_ali *codec) ...@@ -342,7 +330,7 @@ static int snd_ali_stimer_ready(struct snd_ali *codec)
schedule_timeout_uninterruptible(1); schedule_timeout_uninterruptible(1);
} }
snd_printk(KERN_ERR "ali_stimer_read: stimer is not ready.\n"); dev_err(codec->card->dev, "ali_stimer_read: stimer is not ready.\n");
return -EIO; return -EIO;
} }
...@@ -354,7 +342,8 @@ static void snd_ali_codec_poke(struct snd_ali *codec,int secondary, ...@@ -354,7 +342,8 @@ static void snd_ali_codec_poke(struct snd_ali *codec,int secondary,
unsigned int port; unsigned int port;
if (reg >= 0x80) { if (reg >= 0x80) {
snd_printk(KERN_ERR "ali_codec_poke: reg(%xh) invalid.\n", reg); dev_err(codec->card->dev,
"ali_codec_poke: reg(%xh) invalid.\n", reg);
return; return;
} }
...@@ -385,7 +374,8 @@ static unsigned short snd_ali_codec_peek(struct snd_ali *codec, ...@@ -385,7 +374,8 @@ static unsigned short snd_ali_codec_peek(struct snd_ali *codec,
unsigned int port; unsigned int port;
if (reg >= 0x80) { if (reg >= 0x80) {
snd_printk(KERN_ERR "ali_codec_peek: reg(%xh) invalid.\n", reg); dev_err(codec->card->dev,
"ali_codec_peek: reg(%xh) invalid.\n", reg);
return ~0; return ~0;
} }
...@@ -417,7 +407,7 @@ static void snd_ali_codec_write(struct snd_ac97 *ac97, ...@@ -417,7 +407,7 @@ static void snd_ali_codec_write(struct snd_ac97 *ac97,
{ {
struct snd_ali *codec = ac97->private_data; struct snd_ali *codec = ac97->private_data;
snd_ali_printk("codec_write: reg=%xh data=%xh.\n", reg, val); dev_dbg(codec->card->dev, "codec_write: reg=%xh data=%xh.\n", reg, val);
if (reg == AC97_GPIO_STATUS) { if (reg == AC97_GPIO_STATUS) {
outl((val << ALI_AC97_GPIO_DATA_SHIFT) | ALI_AC97_GPIO_ENABLE, outl((val << ALI_AC97_GPIO_DATA_SHIFT) | ALI_AC97_GPIO_ENABLE,
ALI_REG(codec, ALI_AC97_GPIO)); ALI_REG(codec, ALI_AC97_GPIO));
...@@ -433,7 +423,7 @@ static unsigned short snd_ali_codec_read(struct snd_ac97 *ac97, ...@@ -433,7 +423,7 @@ static unsigned short snd_ali_codec_read(struct snd_ac97 *ac97,
{ {
struct snd_ali *codec = ac97->private_data; struct snd_ali *codec = ac97->private_data;
snd_ali_printk("codec_read reg=%xh.\n", reg); dev_dbg(codec->card->dev, "codec_read reg=%xh.\n", reg);
return snd_ali_codec_peek(codec, ac97->num, reg); return snd_ali_codec_peek(codec, ac97->num, reg);
} }
...@@ -474,7 +464,7 @@ static int snd_ali_reset_5451(struct snd_ali *codec) ...@@ -474,7 +464,7 @@ static int snd_ali_reset_5451(struct snd_ali *codec)
} }
/* non-fatal if you have a non PM capable codec */ /* non-fatal if you have a non PM capable codec */
/* snd_printk(KERN_WARNING "ali5451: reset time out\n"); */ /* dev_warn(codec->card->dev, "ali5451: reset time out\n"); */
return 0; return 0;
} }
...@@ -528,7 +518,7 @@ static void snd_ali_disable_voice_irq(struct snd_ali *codec, ...@@ -528,7 +518,7 @@ static void snd_ali_disable_voice_irq(struct snd_ali *codec,
unsigned int mask; unsigned int mask;
struct snd_ali_channel_control *pchregs = &(codec->chregs); struct snd_ali_channel_control *pchregs = &(codec->chregs);
snd_ali_printk("disable_voice_irq channel=%d\n",channel); dev_dbg(codec->card->dev, "disable_voice_irq channel=%d\n", channel);
mask = 1 << (channel & 0x1f); mask = 1 << (channel & 0x1f);
pchregs->data.ainten = inl(ALI_REG(codec, pchregs->regs.ainten)); pchregs->data.ainten = inl(ALI_REG(codec, pchregs->regs.ainten));
...@@ -541,7 +531,7 @@ static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel) ...@@ -541,7 +531,7 @@ static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel)
unsigned int idx = channel & 0x1f; unsigned int idx = channel & 0x1f;
if (codec->synth.chcnt >= ALI_CHANNELS){ if (codec->synth.chcnt >= ALI_CHANNELS){
snd_printk(KERN_ERR dev_err(codec->card->dev,
"ali_alloc_pcm_channel: no free channels.\n"); "ali_alloc_pcm_channel: no free channels.\n");
return -1; return -1;
} }
...@@ -549,7 +539,7 @@ static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel) ...@@ -549,7 +539,7 @@ static int snd_ali_alloc_pcm_channel(struct snd_ali *codec, int channel)
if (!(codec->synth.chmap & (1 << idx))) { if (!(codec->synth.chmap & (1 << idx))) {
codec->synth.chmap |= 1 << idx; codec->synth.chmap |= 1 << idx;
codec->synth.chcnt++; codec->synth.chcnt++;
snd_ali_printk("alloc_pcm_channel no. %d.\n",idx); dev_dbg(codec->card->dev, "alloc_pcm_channel no. %d.\n", idx);
return idx; return idx;
} }
return -1; return -1;
...@@ -560,7 +550,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec) ...@@ -560,7 +550,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
int idx; int idx;
int result = -1; int result = -1;
snd_ali_printk("find_free_channel: for %s\n",rec ? "rec" : "pcm"); dev_dbg(codec->card->dev,
"find_free_channel: for %s\n", rec ? "rec" : "pcm");
/* recording */ /* recording */
if (rec) { if (rec) {
...@@ -575,8 +566,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec) ...@@ -575,8 +566,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
if (result >= 0) if (result >= 0)
return result; return result;
else { else {
snd_printk(KERN_ERR "ali_find_free_channel: " dev_err(codec->card->dev,
"record channel is busy now.\n"); "ali_find_free_channel: record channel is busy now.\n");
return -1; return -1;
} }
} }
...@@ -590,8 +581,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec) ...@@ -590,8 +581,8 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
if (result >= 0) if (result >= 0)
return result; return result;
else else
snd_printk(KERN_ERR "ali_find_free_channel: " dev_err(codec->card->dev,
"S/PDIF out channel is in busy now.\n"); "ali_find_free_channel: S/PDIF out channel is in busy now.\n");
} }
for (idx = 0; idx < ALI_CHANNELS; idx++) { for (idx = 0; idx < ALI_CHANNELS; idx++) {
...@@ -599,7 +590,7 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec) ...@@ -599,7 +590,7 @@ static int snd_ali_find_free_channel(struct snd_ali * codec, int rec)
if (result >= 0) if (result >= 0)
return result; return result;
} }
snd_printk(KERN_ERR "ali_find_free_channel: no free channels.\n"); dev_err(codec->card->dev, "ali_find_free_channel: no free channels.\n");
return -1; return -1;
} }
...@@ -607,14 +598,15 @@ static void snd_ali_free_channel_pcm(struct snd_ali *codec, int channel) ...@@ -607,14 +598,15 @@ static void snd_ali_free_channel_pcm(struct snd_ali *codec, int channel)
{ {
unsigned int idx = channel & 0x0000001f; unsigned int idx = channel & 0x0000001f;
snd_ali_printk("free_channel_pcm channel=%d\n",channel); dev_dbg(codec->card->dev, "free_channel_pcm channel=%d\n", channel);
if (channel < 0 || channel >= ALI_CHANNELS) if (channel < 0 || channel >= ALI_CHANNELS)
return; return;
if (!(codec->synth.chmap & (1 << idx))) { if (!(codec->synth.chmap & (1 << idx))) {
snd_printk(KERN_ERR "ali_free_channel_pcm: " dev_err(codec->card->dev,
"channel %d is not in use.\n", channel); "ali_free_channel_pcm: channel %d is not in use.\n",
channel);
return; return;
} else { } else {
codec->synth.chmap &= ~(1 << idx); codec->synth.chmap &= ~(1 << idx);
...@@ -626,7 +618,7 @@ static void snd_ali_stop_voice(struct snd_ali *codec, unsigned int channel) ...@@ -626,7 +618,7 @@ static void snd_ali_stop_voice(struct snd_ali *codec, unsigned int channel)
{ {
unsigned int mask = 1 << (channel & 0x1f); unsigned int mask = 1 << (channel & 0x1f);
snd_ali_printk("stop_voice: channel=%d\n",channel); dev_dbg(codec->card->dev, "stop_voice: channel=%d\n", channel);
outl(mask, ALI_REG(codec, codec->chregs.regs.stop)); outl(mask, ALI_REG(codec, codec->chregs.regs.stop));
} }
...@@ -667,7 +659,7 @@ static void snd_ali_detect_spdif_rate(struct snd_ali *codec) ...@@ -667,7 +659,7 @@ static void snd_ali_detect_spdif_rate(struct snd_ali *codec)
} }
if (count > 50000) { if (count > 50000) {
snd_printk(KERN_ERR "ali_detect_spdif_rate: timeout!\n"); dev_err(codec->card->dev, "ali_detect_spdif_rate: timeout!\n");
return; return;
} }
...@@ -682,7 +674,7 @@ static void snd_ali_detect_spdif_rate(struct snd_ali *codec) ...@@ -682,7 +674,7 @@ static void snd_ali_detect_spdif_rate(struct snd_ali *codec)
} }
if (count > 50000) { if (count > 50000) {
snd_printk(KERN_ERR "ali_detect_spdif_rate: timeout!\n"); dev_err(codec->card->dev, "ali_detect_spdif_rate: timeout!\n");
return; return;
} }
...@@ -857,9 +849,6 @@ static void snd_ali_update_ptr(struct snd_ali *codec, int channel) ...@@ -857,9 +849,6 @@ static void snd_ali_update_ptr(struct snd_ali *codec, int channel)
struct snd_ali_voice *pvoice; struct snd_ali_voice *pvoice;
struct snd_ali_channel_control *pchregs; struct snd_ali_channel_control *pchregs;
unsigned int old, mask; unsigned int old, mask;
#ifdef ALI_DEBUG
unsigned int temp, cspf;
#endif
pchregs = &(codec->chregs); pchregs = &(codec->chregs);
...@@ -877,14 +866,11 @@ static void snd_ali_update_ptr(struct snd_ali *codec, int channel) ...@@ -877,14 +866,11 @@ static void snd_ali_update_ptr(struct snd_ali *codec, int channel)
if (pvoice->pcm && pvoice->substream) { if (pvoice->pcm && pvoice->substream) {
/* pcm interrupt */ /* pcm interrupt */
#ifdef ALI_DEBUG
outb((u8)(pvoice->number), ALI_REG(codec, ALI_GC_CIR));
temp = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
cspf = (inl(ALI_REG(codec, ALI_CSPF)) & mask) == mask;
#endif
if (pvoice->running) { if (pvoice->running) {
snd_ali_printk("update_ptr: cso=%4.4x cspf=%d.\n", dev_dbg(codec->card->dev,
(u16)temp, cspf); "update_ptr: cso=%4.4x cspf=%d.\n",
inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2)),
(inl(ALI_REG(codec, ALI_CSPF)) & mask) == mask);
spin_unlock(&codec->reg_lock); spin_unlock(&codec->reg_lock);
snd_pcm_period_elapsed(pvoice->substream); snd_pcm_period_elapsed(pvoice->substream);
spin_lock(&codec->reg_lock); spin_lock(&codec->reg_lock);
...@@ -940,14 +926,14 @@ static struct snd_ali_voice *snd_ali_alloc_voice(struct snd_ali * codec, ...@@ -940,14 +926,14 @@ static struct snd_ali_voice *snd_ali_alloc_voice(struct snd_ali * codec,
struct snd_ali_voice *pvoice; struct snd_ali_voice *pvoice;
int idx; int idx;
snd_ali_printk("alloc_voice: type=%d rec=%d\n", type, rec); dev_dbg(codec->card->dev, "alloc_voice: type=%d rec=%d\n", type, rec);
spin_lock_irq(&codec->voice_alloc); spin_lock_irq(&codec->voice_alloc);
if (type == SNDRV_ALI_VOICE_TYPE_PCM) { if (type == SNDRV_ALI_VOICE_TYPE_PCM) {
idx = channel > 0 ? snd_ali_alloc_pcm_channel(codec, channel) : idx = channel > 0 ? snd_ali_alloc_pcm_channel(codec, channel) :
snd_ali_find_free_channel(codec,rec); snd_ali_find_free_channel(codec,rec);
if (idx < 0) { if (idx < 0) {
snd_printk(KERN_ERR "ali_alloc_voice: err.\n"); dev_err(codec->card->dev, "ali_alloc_voice: err.\n");
spin_unlock_irq(&codec->voice_alloc); spin_unlock_irq(&codec->voice_alloc);
return NULL; return NULL;
} }
...@@ -970,7 +956,7 @@ static void snd_ali_free_voice(struct snd_ali * codec, ...@@ -970,7 +956,7 @@ static void snd_ali_free_voice(struct snd_ali * codec,
void (*private_free)(void *); void (*private_free)(void *);
void *private_data; void *private_data;
snd_ali_printk("free_voice: channel=%d\n",pvoice->number); dev_dbg(codec->card->dev, "free_voice: channel=%d\n", pvoice->number);
if (!pvoice->use) if (!pvoice->use)
return; return;
snd_ali_clear_voices(codec, pvoice->number, pvoice->number); snd_ali_clear_voices(codec, pvoice->number, pvoice->number);
...@@ -1153,7 +1139,7 @@ static int snd_ali_trigger(struct snd_pcm_substream *substream, ...@@ -1153,7 +1139,7 @@ static int snd_ali_trigger(struct snd_pcm_substream *substream,
outl(val, ALI_REG(codec, ALI_AINTEN)); outl(val, ALI_REG(codec, ALI_AINTEN));
if (do_start) if (do_start)
outl(what, ALI_REG(codec, ALI_START)); outl(what, ALI_REG(codec, ALI_START));
snd_ali_printk("trigger: what=%xh whati=%xh\n", what, whati); dev_dbg(codec->card->dev, "trigger: what=%xh whati=%xh\n", what, whati);
spin_unlock(&codec->reg_lock); spin_unlock(&codec->reg_lock);
return 0; return 0;
...@@ -1239,7 +1225,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream) ...@@ -1239,7 +1225,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
unsigned int VOL; unsigned int VOL;
unsigned int EC; unsigned int EC;
snd_ali_printk("playback_prepare ...\n"); dev_dbg(codec->card->dev, "playback_prepare ...\n");
spin_lock_irq(&codec->reg_lock); spin_lock_irq(&codec->reg_lock);
...@@ -1266,7 +1252,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream) ...@@ -1266,7 +1252,7 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
/* set target ESO for channel */ /* set target ESO for channel */
pvoice->eso = runtime->buffer_size; pvoice->eso = runtime->buffer_size;
snd_ali_printk("playback_prepare: eso=%xh count=%xh\n", dev_dbg(codec->card->dev, "playback_prepare: eso=%xh count=%xh\n",
pvoice->eso, pvoice->count); pvoice->eso, pvoice->count);
/* set ESO to capture first MIDLP interrupt */ /* set ESO to capture first MIDLP interrupt */
...@@ -1278,8 +1264,9 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream) ...@@ -1278,8 +1264,9 @@ static int snd_ali_playback_prepare(struct snd_pcm_substream *substream)
PAN = 0; PAN = 0;
VOL = 0; VOL = 0;
EC = 0; EC = 0;
snd_ali_printk("playback_prepare:\n"); dev_dbg(codec->card->dev, "playback_prepare:\n");
snd_ali_printk("ch=%d, Rate=%d Delta=%xh,GVSEL=%xh,PAN=%xh,CTRL=%xh\n", dev_dbg(codec->card->dev,
"ch=%d, Rate=%d Delta=%xh,GVSEL=%xh,PAN=%xh,CTRL=%xh\n",
pvoice->number,runtime->rate,Delta,GVSEL,PAN,CTRL); pvoice->number,runtime->rate,Delta,GVSEL,PAN,CTRL);
snd_ali_write_voice_regs(codec, snd_ali_write_voice_regs(codec,
pvoice->number, pvoice->number,
...@@ -1332,7 +1319,7 @@ static int snd_ali_prepare(struct snd_pcm_substream *substream) ...@@ -1332,7 +1319,7 @@ static int snd_ali_prepare(struct snd_pcm_substream *substream)
spin_lock_irq(&codec->reg_lock); spin_lock_irq(&codec->reg_lock);
snd_ali_printk("ali_prepare...\n"); dev_dbg(codec->card->dev, "ali_prepare...\n");
snd_ali_enable_special_channel(codec,pvoice->number); snd_ali_enable_special_channel(codec,pvoice->number);
...@@ -1351,15 +1338,16 @@ static int snd_ali_prepare(struct snd_pcm_substream *substream) ...@@ -1351,15 +1338,16 @@ static int snd_ali_prepare(struct snd_pcm_substream *substream)
rate = snd_ali_get_spdif_in_rate(codec); rate = snd_ali_get_spdif_in_rate(codec);
if (rate == 0) { if (rate == 0) {
snd_printk(KERN_WARNING "ali_capture_preapre: " dev_warn(codec->card->dev,
"spdif rate detect err!\n"); "ali_capture_preapre: spdif rate detect err!\n");
rate = 48000; rate = 48000;
} }
spin_lock_irq(&codec->reg_lock); spin_lock_irq(&codec->reg_lock);
bValue = inb(ALI_REG(codec,ALI_SPDIF_CTRL)); bValue = inb(ALI_REG(codec,ALI_SPDIF_CTRL));
if (bValue & 0x10) { if (bValue & 0x10) {
outb(bValue,ALI_REG(codec,ALI_SPDIF_CTRL)); outb(bValue,ALI_REG(codec,ALI_SPDIF_CTRL));
printk(KERN_WARNING "clear SPDIF parity error flag.\n"); dev_warn(codec->card->dev,
"clear SPDIF parity error flag.\n");
} }
if (rate != 48000) if (rate != 48000)
...@@ -1418,7 +1406,7 @@ snd_ali_playback_pointer(struct snd_pcm_substream *substream) ...@@ -1418,7 +1406,7 @@ snd_ali_playback_pointer(struct snd_pcm_substream *substream)
outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR)); outb(pvoice->number, ALI_REG(codec, ALI_GC_CIR));
cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2)); cso = inw(ALI_REG(codec, ALI_CSO_ALPHA_FMS + 2));
spin_unlock(&codec->reg_lock); spin_unlock(&codec->reg_lock);
snd_ali_printk("playback pointer returned cso=%xh.\n", cso); dev_dbg(codec->card->dev, "playback pointer returned cso=%xh.\n", cso);
return cso; return cso;
} }
...@@ -1685,7 +1673,8 @@ static int snd_ali_pcm(struct snd_ali *codec, int device, ...@@ -1685,7 +1673,8 @@ static int snd_ali_pcm(struct snd_ali *codec, int device,
err = snd_pcm_new(codec->card, desc->name, device, err = snd_pcm_new(codec->card, desc->name, device,
desc->playback_num, desc->capture_num, &pcm); desc->playback_num, desc->capture_num, &pcm);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "snd_ali_pcm: err called snd_pcm_new.\n"); dev_err(codec->card->dev,
"snd_ali_pcm: err called snd_pcm_new.\n");
return err; return err;
} }
pcm->private_data = codec; pcm->private_data = codec;
...@@ -1861,7 +1850,7 @@ static int snd_ali_mixer(struct snd_ali *codec) ...@@ -1861,7 +1850,7 @@ static int snd_ali_mixer(struct snd_ali *codec)
ac97.num = i; ac97.num = i;
err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i]); err = snd_ac97_mixer(codec->ac97_bus, &ac97, &codec->ac97[i]);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR dev_err(codec->card->dev,
"ali mixer %d creating error.\n", i); "ali mixer %d creating error.\n", i);
if (i == 0) if (i == 0)
return err; return err;
...@@ -1947,8 +1936,7 @@ static int ali_resume(struct device *dev) ...@@ -1947,8 +1936,7 @@ static int ali_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 "ali5451: 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;
} }
...@@ -2013,10 +2001,10 @@ static int snd_ali_chip_init(struct snd_ali *codec) ...@@ -2013,10 +2001,10 @@ static int snd_ali_chip_init(struct snd_ali *codec)
unsigned char temp; unsigned char temp;
struct pci_dev *pci_dev; struct pci_dev *pci_dev;
snd_ali_printk("chip initializing ... \n"); dev_dbg(codec->card->dev, "chip initializing ...\n");
if (snd_ali_reset_5451(codec)) { if (snd_ali_reset_5451(codec)) {
snd_printk(KERN_ERR "ali_chip_init: reset 5451 error.\n"); dev_err(codec->card->dev, "ali_chip_init: reset 5451 error.\n");
return -1; return -1;
} }
...@@ -2062,7 +2050,7 @@ static int snd_ali_chip_init(struct snd_ali *codec) ...@@ -2062,7 +2050,7 @@ static int snd_ali_chip_init(struct snd_ali *codec)
ALI_REG(codec, ALI_SCTRL)); ALI_REG(codec, ALI_SCTRL));
} }
snd_ali_printk("chip initialize succeed.\n"); dev_dbg(codec->card->dev, "chip initialize succeed.\n");
return 0; return 0;
} }
...@@ -2088,7 +2076,7 @@ static int snd_ali_resources(struct snd_ali *codec) ...@@ -2088,7 +2076,7 @@ static int snd_ali_resources(struct snd_ali *codec)
{ {
int err; int err;
snd_ali_printk("resources allocation ...\n"); dev_dbg(codec->card->dev, "resources allocation ...\n");
err = pci_request_regions(codec->pci, "ALI 5451"); err = pci_request_regions(codec->pci, "ALI 5451");
if (err < 0) if (err < 0)
return err; return err;
...@@ -2096,11 +2084,11 @@ static int snd_ali_resources(struct snd_ali *codec) ...@@ -2096,11 +2084,11 @@ static int snd_ali_resources(struct snd_ali *codec)
if (request_irq(codec->pci->irq, snd_ali_card_interrupt, if (request_irq(codec->pci->irq, snd_ali_card_interrupt,
IRQF_SHARED, KBUILD_MODNAME, codec)) { IRQF_SHARED, KBUILD_MODNAME, codec)) {
snd_printk(KERN_ERR "Unable to request irq.\n"); dev_err(codec->card->dev, "Unable to request irq.\n");
return -EBUSY; return -EBUSY;
} }
codec->irq = codec->pci->irq; codec->irq = codec->pci->irq;
snd_ali_printk("resources allocated.\n"); dev_dbg(codec->card->dev, "resources allocated.\n");
return 0; return 0;
} }
static int snd_ali_dev_free(struct snd_device *device) static int snd_ali_dev_free(struct snd_device *device)
...@@ -2125,7 +2113,7 @@ static int snd_ali_create(struct snd_card *card, ...@@ -2125,7 +2113,7 @@ static int snd_ali_create(struct snd_card *card,
*r_ali = NULL; *r_ali = NULL;
snd_ali_printk("creating ...\n"); dev_dbg(card->dev, "creating ...\n");
/* enable PCI device */ /* enable PCI device */
err = pci_enable_device(pci); err = pci_enable_device(pci);
...@@ -2134,8 +2122,8 @@ static int snd_ali_create(struct snd_card *card, ...@@ -2134,8 +2122,8 @@ static int snd_ali_create(struct snd_card *card,
/* check, if we can restrict PCI DMA transfers to 31 bits */ /* check, if we can restrict PCI DMA transfers to 31 bits */
if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 || if (pci_set_dma_mask(pci, DMA_BIT_MASK(31)) < 0 ||
pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) { pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(31)) < 0) {
snd_printk(KERN_ERR "architecture does not support " dev_err(card->dev,
"31bit PCI busmaster DMA\n"); "architecture does not support 31bit PCI busmaster DMA\n");
pci_disable_device(pci); pci_disable_device(pci);
return -ENXIO; return -ENXIO;
} }
...@@ -2199,19 +2187,19 @@ static int snd_ali_create(struct snd_card *card, ...@@ -2199,19 +2187,19 @@ static int snd_ali_create(struct snd_card *card,
/* M1533: southbridge */ /* M1533: southbridge */
codec->pci_m1533 = pci_get_device(0x10b9, 0x1533, NULL); codec->pci_m1533 = pci_get_device(0x10b9, 0x1533, NULL);
if (!codec->pci_m1533) { if (!codec->pci_m1533) {
snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); dev_err(card->dev, "cannot find ALi 1533 chip.\n");
snd_ali_free(codec); snd_ali_free(codec);
return -ENODEV; return -ENODEV;
} }
/* M7101: power management */ /* M7101: power management */
codec->pci_m7101 = pci_get_device(0x10b9, 0x7101, NULL); codec->pci_m7101 = pci_get_device(0x10b9, 0x7101, NULL);
if (!codec->pci_m7101 && codec->revision == ALI_5451_V02) { if (!codec->pci_m7101 && codec->revision == ALI_5451_V02) {
snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); dev_err(card->dev, "cannot find ALi 7101 chip.\n");
snd_ali_free(codec); snd_ali_free(codec);
return -ENODEV; return -ENODEV;
} }
snd_ali_printk("snd_device_new is called.\n"); dev_dbg(card->dev, "snd_device_new is called.\n");
err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, codec, &ops); err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, codec, &ops);
if (err < 0) { if (err < 0) {
snd_ali_free(codec); snd_ali_free(codec);
...@@ -2224,21 +2212,21 @@ static int snd_ali_create(struct snd_card *card, ...@@ -2224,21 +2212,21 @@ static int snd_ali_create(struct snd_card *card,
err = snd_ali_chip_init(codec); err = snd_ali_chip_init(codec);
if (err < 0) { if (err < 0) {
snd_printk(KERN_ERR "ali create: chip init error.\n"); dev_err(card->dev, "ali create: chip init error.\n");
return err; return err;
} }
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL); codec->image = kmalloc(sizeof(*codec->image), GFP_KERNEL);
if (!codec->image) if (!codec->image)
snd_printk(KERN_WARNING "can't allocate apm buffer\n"); dev_warn(card->dev, "can't allocate apm buffer\n");
#endif #endif
snd_ali_enable_address_interrupt(codec); snd_ali_enable_address_interrupt(codec);
codec->hw_initialized = 1; codec->hw_initialized = 1;
*r_ali = codec; *r_ali = codec;
snd_ali_printk("created.\n"); dev_dbg(card->dev, "created.\n");
return 0; return 0;
} }
...@@ -2249,7 +2237,7 @@ static int snd_ali_probe(struct pci_dev *pci, ...@@ -2249,7 +2237,7 @@ static int snd_ali_probe(struct pci_dev *pci,
struct snd_ali *codec; struct snd_ali *codec;
int err; int err;
snd_ali_printk("probe ...\n"); dev_dbg(&pci->dev, "probe ...\n");
err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card); err = snd_card_new(&pci->dev, index, id, THIS_MODULE, 0, &card);
if (err < 0) if (err < 0)
...@@ -2260,12 +2248,12 @@ static int snd_ali_probe(struct pci_dev *pci, ...@@ -2260,12 +2248,12 @@ static int snd_ali_probe(struct pci_dev *pci,
goto error; goto error;
card->private_data = codec; card->private_data = codec;
snd_ali_printk("mixer building ...\n"); dev_dbg(&pci->dev, "mixer building ...\n");
err = snd_ali_mixer(codec); err = snd_ali_mixer(codec);
if (err < 0) if (err < 0)
goto error; goto error;
snd_ali_printk("pcm building ...\n"); dev_dbg(&pci->dev, "pcm building ...\n");
err = snd_ali_build_pcms(codec); err = snd_ali_build_pcms(codec);
if (err < 0) if (err < 0)
goto error; goto error;
...@@ -2278,7 +2266,7 @@ static int snd_ali_probe(struct pci_dev *pci, ...@@ -2278,7 +2266,7 @@ static int snd_ali_probe(struct pci_dev *pci,
sprintf(card->longname, "%s at 0x%lx, irq %i", sprintf(card->longname, "%s at 0x%lx, irq %i",
card->shortname, codec->port, codec->irq); card->shortname, codec->port, codec->irq);
snd_ali_printk("register card.\n"); dev_dbg(&pci->dev, "register card.\n");
err = snd_card_register(card); err = snd_card_register(card);
if (err < 0) if (err < 0)
goto error; goto error;
......
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