diff options
Diffstat (limited to 'sound/pci/lx6464es/lx6464es.c')
-rw-r--r-- | sound/pci/lx6464es/lx6464es.c | 162 |
1 files changed, 81 insertions, 81 deletions
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c index 5fcaaa6da4a8..27f60ce8a55c 100644 --- a/sound/pci/lx6464es/lx6464es.c +++ b/sound/pci/lx6464es/lx6464es.c @@ -112,16 +112,16 @@ static int lx_hardware_open(struct lx6464es *chip, snd_pcm_uframes_t period_size = runtime->period_size; - snd_printd(LXP "allocating pipe for %d channels\n", channels); + dev_dbg(chip->card->dev, "allocating pipe for %d channels\n", channels); err = lx_pipe_allocate(chip, 0, is_capture, channels); if (err < 0) { - snd_printk(KERN_ERR LXP "allocating pipe failed\n"); + dev_err(chip->card->dev, LXP "allocating pipe failed\n"); return err; } err = lx_set_granularity(chip, period_size); if (err < 0) { - snd_printk(KERN_ERR LXP "setting granularity to %ld failed\n", + dev_err(chip->card->dev, "setting granularity to %ld failed\n", period_size); return err; } @@ -136,24 +136,24 @@ static int lx_hardware_start(struct lx6464es *chip, struct snd_pcm_runtime *runtime = substream->runtime; int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); - snd_printd(LXP "setting stream format\n"); + dev_dbg(chip->card->dev, "setting stream format\n"); err = lx_stream_set_format(chip, runtime, 0, is_capture); if (err < 0) { - snd_printk(KERN_ERR LXP "setting stream format failed\n"); + dev_err(chip->card->dev, "setting stream format failed\n"); return err; } - snd_printd(LXP "starting pipe\n"); + dev_dbg(chip->card->dev, "starting pipe\n"); err = lx_pipe_start(chip, 0, is_capture); if (err < 0) { - snd_printk(KERN_ERR LXP "starting pipe failed\n"); + dev_err(chip->card->dev, "starting pipe failed\n"); return err; } - snd_printd(LXP "waiting for pipe to start\n"); + dev_dbg(chip->card->dev, "waiting for pipe to start\n"); err = lx_pipe_wait_for_start(chip, 0, is_capture); if (err < 0) { - snd_printk(KERN_ERR LXP "waiting for pipe failed\n"); + dev_err(chip->card->dev, "waiting for pipe failed\n"); return err; } @@ -167,24 +167,24 @@ static int lx_hardware_stop(struct lx6464es *chip, int err = 0; int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); - snd_printd(LXP "pausing pipe\n"); + dev_dbg(chip->card->dev, "pausing pipe\n"); err = lx_pipe_pause(chip, 0, is_capture); if (err < 0) { - snd_printk(KERN_ERR LXP "pausing pipe failed\n"); + dev_err(chip->card->dev, "pausing pipe failed\n"); return err; } - snd_printd(LXP "waiting for pipe to become idle\n"); + dev_dbg(chip->card->dev, "waiting for pipe to become idle\n"); err = lx_pipe_wait_for_idle(chip, 0, is_capture); if (err < 0) { - snd_printk(KERN_ERR LXP "waiting for pipe failed\n"); + dev_err(chip->card->dev, "waiting for pipe failed\n"); return err; } - snd_printd(LXP "stopping pipe\n"); + dev_dbg(chip->card->dev, "stopping pipe\n"); err = lx_pipe_stop(chip, 0, is_capture); if (err < 0) { - snd_printk(LXP "stopping pipe failed\n"); + dev_err(chip->card->dev, "stopping pipe failed\n"); return err; } @@ -198,10 +198,10 @@ static int lx_hardware_close(struct lx6464es *chip, int err = 0; int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); - snd_printd(LXP "releasing pipe\n"); + dev_dbg(chip->card->dev, "releasing pipe\n"); err = lx_pipe_release(chip, 0, is_capture); if (err < 0) { - snd_printk(LXP "releasing pipe failed\n"); + dev_err(chip->card->dev, "releasing pipe failed\n"); return err; } @@ -216,7 +216,7 @@ static int lx_pcm_open(struct snd_pcm_substream *substream) int err = 0; int board_rate; - snd_printdd("->lx_pcm_open\n"); + dev_dbg(chip->card->dev, "->lx_pcm_open\n"); mutex_lock(&chip->setup_mutex); /* copy the struct snd_pcm_hardware struct */ @@ -227,7 +227,7 @@ static int lx_pcm_open(struct snd_pcm_substream *substream) err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); if (err < 0) { - snd_printk(KERN_WARNING LXP "could not constrain periods\n"); + dev_warn(chip->card->dev, "could not constrain periods\n"); goto exit; } #endif @@ -238,7 +238,7 @@ static int lx_pcm_open(struct snd_pcm_substream *substream) board_rate, board_rate); if (err < 0) { - snd_printk(KERN_WARNING LXP "could not constrain periods\n"); + dev_warn(chip->card->dev, "could not constrain periods\n"); goto exit; } @@ -248,7 +248,7 @@ static int lx_pcm_open(struct snd_pcm_substream *substream) MICROBLAZE_IBL_MIN, MICROBLAZE_IBL_MAX); if (err < 0) { - snd_printk(KERN_WARNING LXP + dev_warn(chip->card->dev, "could not constrain period size\n"); goto exit; } @@ -263,14 +263,14 @@ exit: runtime->private_data = chip; mutex_unlock(&chip->setup_mutex); - snd_printdd("<-lx_pcm_open, %d\n", err); + dev_dbg(chip->card->dev, "<-lx_pcm_open, %d\n", err); return err; } static int lx_pcm_close(struct snd_pcm_substream *substream) { int err = 0; - snd_printdd("->lx_pcm_close\n"); + dev_dbg(substream->pcm->card->dev, "->lx_pcm_close\n"); return err; } @@ -285,13 +285,13 @@ static snd_pcm_uframes_t lx_pcm_stream_pointer(struct snd_pcm_substream struct lx_stream *lx_stream = is_capture ? &chip->capture_stream : &chip->playback_stream; - snd_printdd("->lx_pcm_stream_pointer\n"); + dev_dbg(chip->card->dev, "->lx_pcm_stream_pointer\n"); spin_lock_irqsave(&chip->lock, flags); pos = lx_stream->frame_pos * substream->runtime->period_size; spin_unlock_irqrestore(&chip->lock, flags); - snd_printdd(LXP "stream_pointer at %ld\n", pos); + dev_dbg(chip->card->dev, "stream_pointer at %ld\n", pos); return pos; } @@ -301,37 +301,37 @@ static int lx_pcm_prepare(struct snd_pcm_substream *substream) int err = 0; const int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); - snd_printdd("->lx_pcm_prepare\n"); + dev_dbg(chip->card->dev, "->lx_pcm_prepare\n"); mutex_lock(&chip->setup_mutex); if (chip->hardware_running[is_capture]) { err = lx_hardware_stop(chip, substream); if (err < 0) { - snd_printk(KERN_ERR LXP "failed to stop hardware. " + dev_err(chip->card->dev, "failed to stop hardware. " "Error code %d\n", err); goto exit; } err = lx_hardware_close(chip, substream); if (err < 0) { - snd_printk(KERN_ERR LXP "failed to close hardware. " + dev_err(chip->card->dev, "failed to close hardware. " "Error code %d\n", err); goto exit; } } - snd_printd(LXP "opening hardware\n"); + dev_dbg(chip->card->dev, "opening hardware\n"); err = lx_hardware_open(chip, substream); if (err < 0) { - snd_printk(KERN_ERR LXP "failed to open hardware. " + dev_err(chip->card->dev, "failed to open hardware. " "Error code %d\n", err); goto exit; } err = lx_hardware_start(chip, substream); if (err < 0) { - snd_printk(KERN_ERR LXP "failed to start hardware. " + dev_err(chip->card->dev, "failed to start hardware. " "Error code %d\n", err); goto exit; } @@ -354,7 +354,7 @@ static int lx_pcm_hw_params(struct snd_pcm_substream *substream, struct lx6464es *chip = snd_pcm_substream_chip(substream); int err = 0; - snd_printdd("->lx_pcm_hw_params\n"); + dev_dbg(chip->card->dev, "->lx_pcm_hw_params\n"); mutex_lock(&chip->setup_mutex); @@ -389,20 +389,20 @@ static int lx_pcm_hw_free(struct snd_pcm_substream *substream) int err = 0; int is_capture = (substream->stream == SNDRV_PCM_STREAM_CAPTURE); - snd_printdd("->lx_pcm_hw_free\n"); + dev_dbg(chip->card->dev, "->lx_pcm_hw_free\n"); mutex_lock(&chip->setup_mutex); if (chip->hardware_running[is_capture]) { err = lx_hardware_stop(chip, substream); if (err < 0) { - snd_printk(KERN_ERR LXP "failed to stop hardware. " + dev_err(chip->card->dev, "failed to stop hardware. " "Error code %d\n", err); goto exit; } err = lx_hardware_close(chip, substream); if (err < 0) { - snd_printk(KERN_ERR LXP "failed to close hardware. " + dev_err(chip->card->dev, "failed to close hardware. " "Error code %d\n", err); goto exit; } @@ -446,25 +446,25 @@ static void lx_trigger_start(struct lx6464es *chip, struct lx_stream *lx_stream) err = lx_buffer_ask(chip, 0, is_capture, &needed, &freed, size_array); - snd_printdd(LXP "starting: needed %d, freed %d\n", + dev_dbg(chip->card->dev, "starting: needed %d, freed %d\n", needed, freed); err = lx_buffer_give(chip, 0, is_capture, period_bytes, lower_32_bits(buf), upper_32_bits(buf), &buffer_index); - snd_printdd(LXP "starting: buffer index %x on 0x%lx (%d bytes)\n", + dev_dbg(chip->card->dev, "starting: buffer index %x on 0x%lx (%d bytes)\n", buffer_index, (unsigned long)buf, period_bytes); buf += period_bytes; } err = lx_buffer_ask(chip, 0, is_capture, &needed, &freed, size_array); - snd_printdd(LXP "starting: needed %d, freed %d\n", needed, freed); + dev_dbg(chip->card->dev, "starting: needed %d, freed %d\n", needed, freed); - snd_printd(LXP "starting: starting stream\n"); + dev_dbg(chip->card->dev, "starting: starting stream\n"); err = lx_stream_start(chip, 0, is_capture); if (err < 0) - snd_printk(KERN_ERR LXP "couldn't start stream\n"); + dev_err(chip->card->dev, "couldn't start stream\n"); else lx_stream->status = LX_STREAM_STATUS_RUNNING; @@ -476,10 +476,10 @@ static void lx_trigger_stop(struct lx6464es *chip, struct lx_stream *lx_stream) const unsigned int is_capture = lx_stream->is_capture; int err; - snd_printd(LXP "stopping: stopping stream\n"); + dev_dbg(chip->card->dev, "stopping: stopping stream\n"); err = lx_stream_stop(chip, 0, is_capture); if (err < 0) - snd_printk(KERN_ERR LXP "couldn't stop stream\n"); + dev_err(chip->card->dev, "couldn't stop stream\n"); else lx_stream->status = LX_STREAM_STATUS_FREE; @@ -507,7 +507,7 @@ static void lx_trigger_tasklet(unsigned long data) struct lx6464es *chip = (struct lx6464es *)data; unsigned long flags; - snd_printdd("->lx_trigger_tasklet\n"); + dev_dbg(chip->card->dev, "->lx_trigger_tasklet\n"); spin_lock_irqsave(&chip->lock, flags); lx_trigger_tasklet_dispatch_stream(chip, &chip->capture_stream); @@ -547,14 +547,14 @@ static int lx_pcm_trigger(struct snd_pcm_substream *substream, int cmd) struct lx_stream *stream = is_capture ? &chip->capture_stream : &chip->playback_stream; - snd_printdd("->lx_pcm_trigger\n"); + dev_dbg(chip->card->dev, "->lx_pcm_trigger\n"); return lx_pcm_trigger_dispatch(chip, stream, cmd); } static int snd_lx6464es_free(struct lx6464es *chip) { - snd_printdd("->snd_lx6464es_free\n"); + dev_dbg(chip->card->dev, "->snd_lx6464es_free\n"); lx_irq_disable(chip); @@ -583,7 +583,7 @@ static int lx_init_xilinx_reset(struct lx6464es *chip) int i; u32 plx_reg = lx_plx_reg_read(chip, ePLX_CHIPSC); - snd_printdd("->lx_init_xilinx_reset\n"); + dev_dbg(chip->card->dev, "->lx_init_xilinx_reset\n"); /* activate reset of xilinx */ plx_reg &= ~CHIPSC_RESET_XILINX; @@ -603,8 +603,8 @@ static int lx_init_xilinx_reset(struct lx6464es *chip) msleep(10); reg_mbox3 = lx_plx_reg_read(chip, ePLX_MBOX3); if (reg_mbox3) { - snd_printd(LXP "xilinx reset done\n"); - snd_printdd(LXP "xilinx took %d loops\n", i); + dev_dbg(chip->card->dev, "xilinx reset done\n"); + dev_dbg(chip->card->dev, "xilinx took %d loops\n", i); break; } } @@ -624,7 +624,7 @@ static int lx_init_xilinx_test(struct lx6464es *chip) { u32 reg; - snd_printdd("->lx_init_xilinx_test\n"); + dev_dbg(chip->card->dev, "->lx_init_xilinx_test\n"); /* TEST if we have access to Xilinx/MicroBlaze */ lx_dsp_reg_write(chip, eReg_CSM, 0); @@ -632,19 +632,19 @@ static int lx_init_xilinx_test(struct lx6464es *chip) reg = lx_dsp_reg_read(chip, eReg_CSM); if (reg) { - snd_printk(KERN_ERR LXP "Problem: Reg_CSM %x.\n", reg); + dev_err(chip->card->dev, "Problem: Reg_CSM %x.\n", reg); /* PCI9056_SPACE0_REMAP */ lx_plx_reg_write(chip, ePLX_PCICR, 1); reg = lx_dsp_reg_read(chip, eReg_CSM); if (reg) { - snd_printk(KERN_ERR LXP "Error: Reg_CSM %x.\n", reg); + dev_err(chip->card->dev, "Error: Reg_CSM %x.\n", reg); return -EAGAIN; /* seems to be appropriate */ } } - snd_printd(LXP "Xilinx/MicroBlaze access test successful\n"); + dev_dbg(chip->card->dev, "Xilinx/MicroBlaze access test successful\n"); return 0; } @@ -661,7 +661,7 @@ static int lx_init_ethersound_config(struct lx6464es *chip) (64 << IOCR_OUTPUTS_OFFSET) | (FREQ_RATIO_SINGLE_MODE << FREQ_RATIO_OFFSET); - snd_printdd("->lx_init_ethersound\n"); + dev_dbg(chip->card->dev, "->lx_init_ethersound\n"); chip->freq_ratio = FREQ_RATIO_SINGLE_MODE; @@ -675,18 +675,18 @@ static int lx_init_ethersound_config(struct lx6464es *chip) for (i = 0; i != 1000; ++i) { if (lx_dsp_reg_read(chip, eReg_CSES) & 4) { - snd_printd(LXP "ethersound initialized after %dms\n", + dev_dbg(chip->card->dev, "ethersound initialized after %dms\n", i); goto ethersound_initialized; } msleep(1); } - snd_printk(KERN_WARNING LXP + dev_warn(chip->card->dev, "ethersound could not be initialized after %dms\n", i); return -ETIMEDOUT; ethersound_initialized: - snd_printd(LXP "ethersound initialized\n"); + dev_dbg(chip->card->dev, "ethersound initialized\n"); return 0; } @@ -696,14 +696,14 @@ static int lx_init_get_version_features(struct lx6464es *chip) int err; - snd_printdd("->lx_init_get_version_features\n"); + dev_dbg(chip->card->dev, "->lx_init_get_version_features\n"); err = lx_dsp_get_version(chip, &dsp_version); if (err == 0) { u32 freq; - snd_printk(LXP "DSP version: V%02d.%02d #%d\n", + dev_info(chip->card->dev, "DSP version: V%02d.%02d #%d\n", (dsp_version>>16) & 0xff, (dsp_version>>8) & 0xff, dsp_version & 0xff); @@ -718,9 +718,9 @@ static int lx_init_get_version_features(struct lx6464es *chip) err = lx_dsp_get_clock_frequency(chip, &freq); if (err == 0) chip->board_sample_rate = freq; - snd_printd(LXP "actual clock frequency %d\n", freq); + dev_dbg(chip->card->dev, "actual clock frequency %d\n", freq); } else { - snd_printk(KERN_ERR LXP "DSP corrupted \n"); + dev_err(chip->card->dev, "DSP corrupted \n"); err = -EAGAIN; } @@ -732,7 +732,7 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran) int err = 0; u32 snapped_gran = MICROBLAZE_IBL_MIN; - snd_printdd("->lx_set_granularity\n"); + dev_dbg(chip->card->dev, "->lx_set_granularity\n"); /* blocksize is a power of 2 */ while ((snapped_gran < gran) && @@ -745,14 +745,14 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran) err = lx_dsp_set_granularity(chip, snapped_gran); if (err < 0) { - snd_printk(KERN_WARNING LXP "could not set granularity\n"); + dev_warn(chip->card->dev, "could not set granularity\n"); err = -EAGAIN; } if (snapped_gran != gran) - snd_printk(LXP "snapped blocksize to %d\n", snapped_gran); + dev_err(chip->card->dev, "snapped blocksize to %d\n", snapped_gran); - snd_printd(LXP "set blocksize on board %d\n", snapped_gran); + dev_dbg(chip->card->dev, "set blocksize on board %d\n", snapped_gran); chip->pcm_granularity = snapped_gran; return err; @@ -764,19 +764,19 @@ static int lx_init_dsp(struct lx6464es *chip) int err; int i; - snd_printdd("->lx_init_dsp\n"); + dev_dbg(chip->card->dev, "->lx_init_dsp\n"); - snd_printd(LXP "initialize board\n"); + dev_dbg(chip->card->dev, "initialize board\n"); err = lx_init_xilinx_reset(chip); if (err) return err; - snd_printd(LXP "testing board\n"); + dev_dbg(chip->card->dev, "testing board\n"); err = lx_init_xilinx_test(chip); if (err) return err; - snd_printd(LXP "initialize ethersound configuration\n"); + dev_dbg(chip->card->dev, "initialize ethersound configuration\n"); err = lx_init_ethersound_config(chip); if (err) return err; @@ -797,8 +797,9 @@ static int lx_init_dsp(struct lx6464es *chip) return -ETIMEDOUT; mac_ready: - snd_printd(LXP "mac address ready read after: %dms\n", i); - snd_printk(LXP "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n", + dev_dbg(chip->card->dev, "mac address ready read after: %dms\n", i); + dev_info(chip->card->dev, + "mac address: %02X.%02X.%02X.%02X.%02X.%02X\n", chip->mac_address[0], chip->mac_address[1], chip->mac_address[2], chip->mac_address[3], chip->mac_address[4], chip->mac_address[5]); @@ -977,7 +978,7 @@ static int snd_lx6464es_create(struct snd_card *card, .dev_free = snd_lx6464es_dev_free, }; - snd_printdd("->snd_lx6464es_create\n"); + dev_dbg(card->dev, "->snd_lx6464es_create\n"); *rchip = NULL; @@ -991,8 +992,8 @@ static int snd_lx6464es_create(struct snd_card *card, /* check if we can restrict PCI DMA transfers to 32 bits */ err = pci_set_dma_mask(pci, DMA_BIT_MASK(32)); if (err < 0) { - snd_printk(KERN_ERR "architecture does not support " - "32bit PCI busmaster DMA\n"); + dev_err(card->dev, + "architecture does not support 32bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; } @@ -1034,7 +1035,7 @@ static int snd_lx6464es_create(struct snd_card *card, err = request_irq(pci->irq, lx_interrupt, IRQF_SHARED, KBUILD_MODNAME, chip); if (err) { - snd_printk(KERN_ERR LXP "unable to grab IRQ %d\n", pci->irq); + dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); goto request_irq_failed; } chip->irq = pci->irq; @@ -1045,7 +1046,7 @@ static int snd_lx6464es_create(struct snd_card *card, err = lx_init_dsp(chip); if (err < 0) { - snd_printk(KERN_ERR LXP "error during DSP initialization\n"); + dev_err(card->dev, "error during DSP initialization\n"); return err; } @@ -1062,8 +1063,6 @@ static int snd_lx6464es_create(struct snd_card *card, if (err < 0) return err; - snd_card_set_dev(card, &pci->dev); - *rchip = chip; return 0; @@ -1090,7 +1089,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci, struct lx6464es *chip; int err; - snd_printdd("->snd_lx6464es_probe\n"); + dev_dbg(&pci->dev, "->snd_lx6464es_probe\n"); if (dev >= SNDRV_CARDS) return -ENODEV; @@ -1099,13 +1098,14 @@ static int snd_lx6464es_probe(struct pci_dev *pci, return -ENOENT; } - err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); + err = snd_card_new(&pci->dev, index[dev], id[dev], THIS_MODULE, + 0, &card); if (err < 0) return err; err = snd_lx6464es_create(card, pci, &chip); if (err < 0) { - snd_printk(KERN_ERR LXP "error during snd_lx6464es_create\n"); + dev_err(card->dev, "error during snd_lx6464es_create\n"); goto out_free; } @@ -1125,7 +1125,7 @@ static int snd_lx6464es_probe(struct pci_dev *pci, if (err < 0) goto out_free; - snd_printdd(LXP "initialization successful\n"); + dev_dbg(chip->card->dev, "initialization successful\n"); pci_set_drvdata(pci, card); dev++; return 0; |