int status;
int retry;
if ((reg > 0x7f) || (value > 0x1ff)) {
- snd_printk(KERN_ERR "i2c_write: invalid values.\n");
+ dev_err(emu->card->dev, "i2c_write: invalid values.\n");
return -EINVAL;
}
tmp = reg << 25 | value << 16;
/*
- snd_printk(KERN_DEBUG "I2C-write:reg=0x%x, value=0x%x\n", reg, value);
+ dev_dbg(emu->card->dev, "I2C-write:reg=0x%x, value=0x%x\n", reg, value);
*/
/* Not sure what this I2C channel controls. */
/* snd_ca0106_ptr_write(emu, I2C_D0, 0, tmp); */
/* Wait till the transaction ends */
while (1) {
status = snd_ca0106_ptr_read(emu, I2C_A, 0);
- /*snd_printk(KERN_DEBUG "I2C:status=0x%x\n", status);*/
+ /*dev_dbg(emu->card->dev, "I2C:status=0x%x\n", status);*/
timeout++;
if ((status & I2C_A_ADC_START) == 0)
break;
}
if (retry == 10) {
- snd_printk(KERN_ERR "Writing to ADC failed!\n");
+ dev_err(emu->card->dev, "Writing to ADC failed!\n");
return -EINVAL;
}
}
}
-static int snd_ca0106_channel_dac(struct snd_ca0106_details *details,
+static int snd_ca0106_channel_dac(struct snd_ca0106 *chip,
+ struct snd_ca0106_details *details,
int channel_id)
{
switch (channel_id) {
case PCM_UNKNOWN_CHANNEL:
return (details->spi_dac & 0x000f) >> (4 * 0);
default:
- snd_printk(KERN_DEBUG "ca0106: unknown channel_id %d\n",
+ dev_dbg(chip->card->dev, "ca0106: unknown channel_id %d\n",
channel_id);
}
return 0;
int power)
{
if (chip->details->spi_dac) {
- const int dac = snd_ca0106_channel_dac(chip->details,
+ const int dac = snd_ca0106_channel_dac(chip, chip->details,
channel_id);
const int reg = spi_dacd_reg[dac];
const int bit = spi_dacd_bit[dac];
channel->use = 1;
/*
- printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n",
+ dev_dbg(chip->card->dev, "open:channel_id=%d, chip=%p, channel=%p\n",
channel_id, chip, channel);
*/
//channel->interrupt = snd_ca0106_pcm_channel_interrupt;
epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
if (epcm == NULL) {
- snd_printk(KERN_ERR "open_capture_channel: failed epcm alloc\n");
+ dev_err(chip->card->dev,
+ "open_capture_channel: failed epcm alloc\n");
return -ENOMEM;
}
epcm->emu = chip;
channel->use = 1;
/*
- printk(KERN_DEBUG "open:channel_id=%d, chip=%p, channel=%p\n",
+ dev_dbg(chip->card->dev, "open:channel_id=%d, chip=%p, channel=%p\n",
channel_id, chip, channel);
*/
//channel->interrupt = snd_ca0106_pcm_channel_interrupt;
int i;
#if 0 /* debug */
- snd_printk(KERN_DEBUG
+ dev_dbg(emu->card->dev,
"prepare:channel_number=%d, rate=%d, format=0x%x, "
"channels=%d, buffer_size=%ld, period_size=%ld, "
"periods=%u, frames_to_bytes=%d\n",
runtime->channels, runtime->buffer_size,
runtime->period_size, runtime->periods,
frames_to_bytes(runtime, 1));
- snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n",
+ dev_dbg(emu->card->dev,
+ "dma_addr=%x, dma_area=%p, table_base=%p\n",
runtime->dma_addr, runtime->dma_area, table_base);
- snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
+ dev_dbg(emu->card->dev,
+ "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
emu->buffer.addr, emu->buffer.area, emu->buffer.bytes);
#endif /* debug */
/* Rate can be set per channel. */
u32 reg71;
#if 0 /* debug */
- snd_printk(KERN_DEBUG
+ dev_dbg(emu->card->dev,
"prepare:channel_number=%d, rate=%d, format=0x%x, "
"channels=%d, buffer_size=%ld, period_size=%ld, "
"periods=%u, frames_to_bytes=%d\n",
runtime->channels, runtime->buffer_size,
runtime->period_size, runtime->periods,
frames_to_bytes(runtime, 1));
- snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, table_base=%p\n",
+ dev_dbg(emu->card->dev,
+ "dma_addr=%x, dma_area=%p, table_base=%p\n",
runtime->dma_addr, runtime->dma_area, table_base);
- snd_printk(KERN_DEBUG "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
+ dev_dbg(emu->card->dev,
+ "dma_addr=%x, dma_area=%p, dma_bytes(size)=%x\n",
emu->buffer.addr, emu->buffer.area, emu->buffer.bytes);
#endif /* debug */
/* reg71 controls ADC rate. */
/*
- printk(KERN_DEBUG
+ dev_dbg(emu->card->dev,
"prepare:channel_number=%d, rate=%d, format=0x%x, channels=%d, "
"buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",
channel, runtime->rate, runtime->format, runtime->channels,
runtime = s->runtime;
epcm = runtime->private_data;
channel = epcm->channel_id;
- /* snd_printk(KERN_DEBUG "channel=%d\n", channel); */
+ /* dev_dbg(emu->card->dev, "channel=%d\n", channel); */
epcm->running = running;
basic |= (0x1 << channel);
extended |= (0x10 << channel);
snd_pcm_trigger_done(s, substream);
}
- /* snd_printk(KERN_DEBUG "basic=0x%x, extended=0x%x\n",basic, extended); */
+ /* dev_dbg(emu->card->dev, "basic=0x%x, extended=0x%x\n",basic, extended); */
switch (cmd) {
case SNDRV_PCM_TRIGGER_START:
return ptr;
prev_ptr = ptr;
} while (--timeout);
- snd_printk(KERN_WARNING "ca0106: unstable DMA pointer!\n");
+ dev_warn(emu->card->dev, "ca0106: unstable DMA pointer!\n");
return 0;
}
if (ptr >= runtime->buffer_size)
ptr -= runtime->buffer_size;
/*
- printk(KERN_DEBUG "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, "
+ dev_dbg(emu->card->dev, "ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, "
"buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n",
ptr1, ptr2, ptr, (int)runtime->buffer_size,
(int)runtime->period_size, (int)runtime->frame_bits,
stat76 = snd_ca0106_ptr_read(chip, EXTENDED_INT, 0);
/*
- snd_printk(KERN_DEBUG "interrupt status = 0x%08x, stat76=0x%08x\n",
+ dev_dbg(emu->card->dev, "interrupt status = 0x%08x, stat76=0x%08x\n",
status, stat76);
- snd_printk(KERN_DEBUG "ptr=0x%08x\n",
+ dev_dbg(emu->card->dev, "ptr=0x%08x\n",
snd_ca0106_ptr_read(chip, PLAYBACK_POINTER, 0));
*/
mask = 0x11; /* 0x1 for one half, 0x10 for the other half period. */
/* FIXME: Select the correct substream for period elapsed */
if(pchannel->use) {
snd_pcm_period_elapsed(pchannel->epcm->substream);
- //printk(KERN_INFO "interrupt [%d] used\n", i);
+ /* dev_dbg(emu->card->dev, "interrupt [%d] used\n", i); */
}
}
- //printk(KERN_INFO "channel=%p\n",pchannel);
- //printk(KERN_INFO "interrupt stat76[%d] = %08x, use=%d, channel=%d\n", i, stat76, pchannel->use, pchannel->number);
+ /*
+ dev_dbg(emu->card->dev, "channel=%p\n", pchannel);
+ dev_dbg(emu->card->dev, "interrupt stat76[%d] = %08x, use=%d, channel=%d\n", i, stat76, pchannel->use, pchannel->number);
+ */
mask <<= 1;
}
mask = 0x110000; /* 0x1 for one half, 0x10 for the other half period. */
/* FIXME: Select the correct substream for period elapsed */
if(pchannel->use) {
snd_pcm_period_elapsed(pchannel->epcm->substream);
- //printk(KERN_INFO "interrupt [%d] used\n", i);
+ /* dev_dbg(emu->card->dev, "interrupt [%d] used\n", i); */
}
}
- //printk(KERN_INFO "channel=%p\n",pchannel);
- //printk(KERN_INFO "interrupt stat76[%d] = %08x, use=%d, channel=%d\n", i, stat76, pchannel->use, pchannel->number);
+ /*
+ dev_dbg(emu->card->dev, "channel=%p\n", pchannel);
+ dev_dbg(emu->card->dev, "interrupt stat76[%d] = %08x, use=%d, channel=%d\n", i, stat76, pchannel->use, pchannel->number);
+ */
mask <<= 1;
}
int size, n;
size = ARRAY_SIZE(i2c_adc_init);
- /* snd_printk(KERN_DEBUG "I2C:array size=0x%x\n", size); */
+ /* dev_dbg(emu->card->dev, "I2C:array size=0x%x\n", size); */
for (n = 0; n < size; n++)
snd_ca0106_i2c_write(chip, i2c_adc_init[n][0],
i2c_adc_init[n][1]);
return err;
if (pci_set_dma_mask(pci, DMA_BIT_MASK(32)) < 0 ||
pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32)) < 0) {
- printk(KERN_ERR "error to set 32bit mask DMA\n");
+ dev_err(card->dev, "error to set 32bit mask DMA\n");
pci_disable_device(pci);
return -ENXIO;
}
chip->res_port = request_region(chip->port, 0x20, "snd_ca0106");
if (!chip->res_port) {
snd_ca0106_free(chip);
- printk(KERN_ERR "cannot allocate the port\n");
+ dev_err(card->dev, "cannot allocate the port\n");
return -EBUSY;
}
if (request_irq(pci->irq, snd_ca0106_interrupt,
IRQF_SHARED, KBUILD_MODNAME, chip)) {
snd_ca0106_free(chip);
- printk(KERN_ERR "cannot grab irq\n");
+ dev_err(card->dev, "cannot grab irq\n");
return -EBUSY;
}
chip->irq = pci->irq;
/* read serial */
pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
- printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n",
+ dev_info(card->dev, "Model %04x Rev %08x Serial %08x\n",
chip->model, pci->revision, chip->serial);
strcpy(card->driver, "CA0106");
strcpy(card->shortname, "CA0106");
}
chip->details = c;
if (subsystem[dev]) {
- printk(KERN_INFO "snd-ca0106: Sound card name=%s, "
+ dev_info(card->dev, "Sound card name=%s, "
"subsystem=0x%x. Forced to subsystem=0x%x\n",
c->name, chip->serial, subsystem[dev]);
}
if (err < 0)
goto error;
- snd_printdd("ca0106: probe for MIDI channel A ...");
+ dev_dbg(card->dev, "probe for MIDI channel A ...");
err = snd_ca0106_midi(chip, CA0106_MIDI_CHAN_A);
if (err < 0)
goto error;
- snd_printdd(" done.\n");
+ dev_dbg(card->dev, " done.\n");
#ifdef CONFIG_PROC_FS
snd_ca0106_proc_init(chip);