diff options
Diffstat (limited to 'sound/pci/ice1712')
-rw-r--r-- | sound/pci/ice1712/aureon.c | 7 | ||||
-rw-r--r-- | sound/pci/ice1712/delta.c | 35 | ||||
-rw-r--r-- | sound/pci/ice1712/ews.c | 12 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1712.c | 123 | ||||
-rw-r--r-- | sound/pci/ice1712/ice1724.c | 50 | ||||
-rw-r--r-- | sound/pci/ice1712/juli.c | 14 | ||||
-rw-r--r-- | sound/pci/ice1712/prodigy192.c | 13 | ||||
-rw-r--r-- | sound/pci/ice1712/quartet.c | 6 |
8 files changed, 186 insertions, 74 deletions
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c index 55902ec40344..3b3cf4ac9060 100644 --- a/sound/pci/ice1712/aureon.c +++ b/sound/pci/ice1712/aureon.c @@ -1937,9 +1937,12 @@ static int aureon_add_controls(struct snd_ice1712 *ice) snd_ice1712_save_gpio_status(ice); id = aureon_cs8415_get(ice, CS8415_ID); if (id != 0x41) - snd_printk(KERN_INFO "No CS8415 chip. Skipping CS8415 controls.\n"); + dev_info(ice->card->dev, + "No CS8415 chip. Skipping CS8415 controls.\n"); else if ((id & 0x0F) != 0x01) - snd_printk(KERN_INFO "Detected unsupported CS8415 rev. (%c)\n", (char)((id & 0x0F) + 'A' - 1)); + dev_info(ice->card->dev, + "Detected unsupported CS8415 rev. (%c)\n", + (char)((id & 0x0F) + 'A' - 1)); else { for (i = 0; i < ARRAY_SIZE(cs8415_controls); i++) { struct snd_kcontrol *kctl; diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c index 9e28cc12969b..ed2144eee38a 100644 --- a/sound/pci/ice1712/delta.c +++ b/sound/pci/ice1712/delta.c @@ -425,7 +425,8 @@ static int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol *kco struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol); if (snd_i2c_sendbytes(ice->cs8427, ®, 1) != 1) - snd_printk(KERN_ERR "unable to send register 0x%x byte to CS8427\n", reg); + dev_err(ice->card->dev, + "unable to send register 0x%x byte to CS8427\n", reg); snd_i2c_readbytes(ice->cs8427, ®, 1); ucontrol->value.integer.value[0] = (reg & CS8427_UNLOCK) ? 1 : 0; return 0; @@ -575,6 +576,30 @@ static struct snd_ak4xxx_private akm_vx442_priv = { .mask_flags = 0, }; +#ifdef CONFIG_PM_SLEEP +static int snd_ice1712_delta_resume(struct snd_ice1712 *ice) +{ + unsigned char akm_backup[AK4XXX_IMAGE_SIZE]; + /* init codec and restore registers */ + if (ice->akm_codecs) { + memcpy(akm_backup, ice->akm->images, sizeof(akm_backup)); + snd_akm4xxx_init(ice->akm); + memcpy(ice->akm->images, akm_backup, sizeof(akm_backup)); + snd_akm4xxx_reset(ice->akm, 0); + } + + return 0; +} + +static int snd_ice1712_delta_suspend(struct snd_ice1712 *ice) +{ + if (ice->akm_codecs) /* reset & mute codec */ + snd_akm4xxx_reset(ice->akm, 1); + + return 0; +} +#endif + static int snd_ice1712_delta_init(struct snd_ice1712 *ice) { int err; @@ -621,7 +646,11 @@ static int snd_ice1712_delta_init(struct snd_ice1712 *ice) ice->num_total_adcs = 4; break; } - +#ifdef CONFIG_PM_SLEEP + ice->pm_resume = snd_ice1712_delta_resume; + ice->pm_suspend = snd_ice1712_delta_suspend; + ice->pm_suspend_enabled = 1; +#endif /* initialize the SPI clock to high */ tmp = snd_ice1712_read(ice, ICE1712_IREG_GPIO_DATA); tmp |= ICE1712_DELTA_AP_CCLK; @@ -637,7 +666,7 @@ static int snd_ice1712_delta_init(struct snd_ice1712 *ice) case ICE1712_SUBDEVICE_VX442: case ICE1712_SUBDEVICE_DELTA66E: if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { - snd_printk(KERN_ERR "unable to create I2C bus\n"); + dev_err(ice->card->dev, "unable to create I2C bus\n"); return err; } ice->i2c->private_data = ice; diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c index bc2e7011c55d..817a1bc50a60 100644 --- a/sound/pci/ice1712/ews.c +++ b/sound/pci/ice1712/ews.c @@ -163,7 +163,8 @@ static int snd_ice1712_ews88mt_chip_select(struct snd_ice1712 *ice, int chip_mas __error: snd_i2c_unlock(ice->i2c); - snd_printk(KERN_ERR "AK4524 chip select failed, check cable to the front module\n"); + dev_err(ice->card->dev, + "AK4524 chip select failed, check cable to the front module\n"); return -EIO; } @@ -174,7 +175,7 @@ static void ews88mt_ak4524_lock(struct snd_akm4xxx *ak, int chip) unsigned char tmp; /* assert AK4524 CS */ if (snd_ice1712_ews88mt_chip_select(ice, ~(1 << chip) & 0x0f) < 0) - snd_printk(KERN_ERR "fatal error (ews88mt chip select)\n"); + dev_err(ice->card->dev, "fatal error (ews88mt chip select)\n"); snd_ice1712_save_gpio_status(ice); tmp = ICE1712_EWS88_SERIAL_DATA | ICE1712_EWS88_SERIAL_CLOCK | @@ -456,7 +457,7 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice) /* create i2c */ if ((err = snd_i2c_bus_create(ice->card, "ICE1712 GPIO 1", NULL, &ice->i2c)) < 0) { - snd_printk(KERN_ERR "unable to create I2C bus\n"); + dev_err(ice->card->dev, "unable to create I2C bus\n"); return err; } ice->i2c->private_data = ice; @@ -469,7 +470,8 @@ static int snd_ice1712_ews_init(struct snd_ice1712 *ice) ICE1712_6FIRE_PCF9554_ADDR, &spec->i2cdevs[EWS_I2C_6FIRE]); if (err < 0) { - snd_printk(KERN_ERR "PCF9554 initialization failed\n"); + dev_err(ice->card->dev, + "PCF9554 initialization failed\n"); return err; } snd_ice1712_6fire_write_pca(ice, PCF9554_REG_CONFIG, 0x80); @@ -834,7 +836,7 @@ static int snd_ice1712_6fire_read_pca(struct snd_ice1712 *ice, unsigned char reg byte = 0; if (snd_i2c_readbytes(spec->i2cdevs[EWS_I2C_6FIRE], &byte, 1) != 1) { snd_i2c_unlock(ice->i2c); - printk(KERN_ERR "cannot read pca\n"); + dev_err(ice->card->dev, "cannot read pca\n"); return -EIO; } snd_i2c_unlock(ice->i2c); diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c index 28ec872e54c0..291672fc4a99 100644 --- a/sound/pci/ice1712/ice1712.c +++ b/sound/pci/ice1712/ice1712.c @@ -394,7 +394,7 @@ int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr) err = snd_cs8427_create(ice->i2c, addr, (ice->cs8427_timeout * HZ) / 1000, &ice->cs8427); if (err < 0) { - snd_printk(KERN_ERR "CS8427 initialization failed\n"); + dev_err(ice->card->dev, "CS8427 initialization failed\n"); return err; } ice->spdif.ops.open = open_cs8427; @@ -467,7 +467,7 @@ static irqreturn_t snd_ice1712_interrupt(int irq, void *dev_id) u16 pbkstatus; struct snd_pcm_substream *substream; pbkstatus = inw(ICEDS(ice, INTSTAT)); - /* printk(KERN_DEBUG "pbkstatus = 0x%x\n", pbkstatus); */ + /* dev_dbg(ice->card->dev, "pbkstatus = 0x%x\n", pbkstatus); */ for (idx = 0; idx < 6; idx++) { if ((pbkstatus & (3 << (idx * 2))) == 0) continue; @@ -903,7 +903,8 @@ static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm * if (rpcm) *rpcm = pcm; - printk(KERN_WARNING "Consumer PCM code does not work well at the moment --jk\n"); + dev_warn(ice->card->dev, + "Consumer PCM code does not work well at the moment --jk\n"); return 0; } @@ -1534,7 +1535,8 @@ static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice) ac97.private_free = snd_ice1712_mixer_free_ac97; err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); if (err < 0) - printk(KERN_WARNING "ice1712: cannot initialize ac97 for consumer, skipped\n"); + dev_warn(ice->card->dev, + "cannot initialize ac97 for consumer, skipped\n"); else { err = snd_ctl_add(ice->card, snd_ctl_new1(&snd_ice1712_mixer_digmix_route_ac97, ice)); if (err < 0) @@ -1552,7 +1554,8 @@ static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice) ac97.private_free = snd_ice1712_mixer_free_ac97; err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); if (err < 0) - printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); + dev_warn(ice->card->dev, + "cannot initialize pro ac97, skipped\n"); else return 0; } @@ -2332,7 +2335,8 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice, pci_read_config_word(ice->pci, PCI_SUBSYSTEM_ID, &device); ice->eeprom.subvendor = ((unsigned int)swab16(vendor) << 16) | swab16(device); if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) { - printk(KERN_ERR "ice1712: No valid ID is found\n"); + dev_err(ice->card->dev, + "No valid ID is found\n"); return -ENXIO; } } @@ -2340,21 +2344,22 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice, for (tbl = card_tables; *tbl; tbl++) { for (c = *tbl; c->subvendor; c++) { if (modelname && c->model && !strcmp(modelname, c->model)) { - printk(KERN_INFO "ice1712: Using board model %s\n", c->name); + dev_info(ice->card->dev, + "Using board model %s\n", c->name); ice->eeprom.subvendor = c->subvendor; } else if (c->subvendor != ice->eeprom.subvendor) continue; if (!c->eeprom_size || !c->eeprom_data) goto found; /* if the EEPROM is given by the driver, use it */ - snd_printdd("using the defined eeprom..\n"); + dev_dbg(ice->card->dev, "using the defined eeprom..\n"); ice->eeprom.version = 1; ice->eeprom.size = c->eeprom_size + 6; memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); goto read_skipped; } } - printk(KERN_WARNING "ice1712: No matching model found for ID 0x%x\n", + dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n", ice->eeprom.subvendor); found: @@ -2362,12 +2367,13 @@ static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice, if (ice->eeprom.size < 6) ice->eeprom.size = 32; /* FIXME: any cards without the correct size? */ else if (ice->eeprom.size > 32) { - snd_printk(KERN_ERR "invalid EEPROM (size = %i)\n", ice->eeprom.size); + dev_err(ice->card->dev, + "invalid EEPROM (size = %i)\n", ice->eeprom.size); return -EIO; } ice->eeprom.version = snd_ice1712_read_i2c(ice, dev, 0x05); if (ice->eeprom.version != 1) { - snd_printk(KERN_ERR "invalid EEPROM version %i\n", + dev_err(ice->card->dev, "invalid EEPROM version %i\n", ice->eeprom.version); /* return -EIO; */ } @@ -2428,6 +2434,13 @@ static int snd_ice1712_chip_init(struct snd_ice1712 *ice) snd_ice1712_write(ice, ICE1712_IREG_CONSUMER_POWERDOWN, 0); } snd_ice1712_set_pro_rate(ice, 48000, 1); + /* unmask used interrupts */ + outb(((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) == 0 ? + ICE1712_IRQ_MPU2 : 0) | + ((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97) ? + ICE1712_IRQ_PBKDS | ICE1712_IRQ_CONCAP | ICE1712_IRQ_CONPBK : 0), + ICEREG(ice, IRQMASK)); + outb(0x00, ICEMT(ice, IRQ)); return 0; } @@ -2553,7 +2566,8 @@ static int snd_ice1712_create(struct snd_card *card, /* check, if we can restrict PCI DMA transfers to 28 bits */ if (pci_set_dma_mask(pci, DMA_BIT_MASK(28)) < 0 || pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(28)) < 0) { - snd_printk(KERN_ERR "architecture does not support 28bit PCI busmaster DMA\n"); + dev_err(card->dev, + "architecture does not support 28bit PCI busmaster DMA\n"); pci_disable_device(pci); return -ENXIO; } @@ -2589,6 +2603,7 @@ static int snd_ice1712_create(struct snd_card *card, ice->pci = pci; ice->irq = -1; pci_set_master(pci); + /* disable legacy emulation */ pci_write_config_word(ice->pci, 0x40, 0x807f); pci_write_config_word(ice->pci, 0x42, 0x0006); snd_ice1712_proc_init(ice); @@ -2609,7 +2624,7 @@ static int snd_ice1712_create(struct snd_card *card, if (request_irq(pci->irq, snd_ice1712_interrupt, IRQF_SHARED, KBUILD_MODNAME, ice)) { - 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_ice1712_free(ice); return -EIO; } @@ -2625,22 +2640,12 @@ static int snd_ice1712_create(struct snd_card *card, return -EIO; } - /* unmask used interrupts */ - outb(((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_2xMPU401) == 0 ? - ICE1712_IRQ_MPU2 : 0) | - ((ice->eeprom.data[ICE_EEP1_CODEC] & ICE1712_CFG_NO_CON_AC97) ? - ICE1712_IRQ_PBKDS | ICE1712_IRQ_CONCAP | ICE1712_IRQ_CONPBK : 0), - ICEREG(ice, IRQMASK)); - outb(0x00, ICEMT(ice, IRQ)); - err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, ice, &ops); if (err < 0) { snd_ice1712_free(ice); return err; } - snd_card_set_dev(card, &pci->dev); - *r_ice1712 = ice; return 0; } @@ -2670,7 +2675,8 @@ static int snd_ice1712_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; @@ -2809,11 +2815,80 @@ static void snd_ice1712_remove(struct pci_dev *pci) snd_card_free(card); } +#ifdef CONFIG_PM_SLEEP +static int snd_ice1712_suspend(struct device *dev) +{ + struct pci_dev *pci = to_pci_dev(dev); + struct snd_card *card = dev_get_drvdata(dev); + struct snd_ice1712 *ice = card->private_data; + + if (!ice->pm_suspend_enabled) + return 0; + + snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); + + snd_pcm_suspend_all(ice->pcm); + snd_pcm_suspend_all(ice->pcm_pro); + snd_pcm_suspend_all(ice->pcm_ds); + snd_ac97_suspend(ice->ac97); + + if (ice->pm_suspend) + ice->pm_suspend(ice); + + pci_disable_device(pci); + pci_save_state(pci); + pci_set_power_state(pci, PCI_D3hot); + return 0; +} + +static int snd_ice1712_resume(struct device *dev) +{ + struct pci_dev *pci = to_pci_dev(dev); + struct snd_card *card = dev_get_drvdata(dev); + struct snd_ice1712 *ice = card->private_data; + + if (!ice->pm_suspend_enabled) + return 0; + + pci_set_power_state(pci, PCI_D0); + pci_restore_state(pci); + + if (pci_enable_device(pci) < 0) { + snd_card_disconnect(card); + return -EIO; + } + + pci_set_master(pci); + + if (snd_ice1712_chip_init(ice) < 0) { + snd_card_disconnect(card); + return -EIO; + } + + if (ice->pm_resume) + ice->pm_resume(ice); + + if (ice->ac97) + snd_ac97_resume(ice->ac97); + + snd_power_change_state(card, SNDRV_CTL_POWER_D0); + return 0; +} + +static SIMPLE_DEV_PM_OPS(snd_ice1712_pm, snd_ice1712_suspend, snd_ice1712_resume); +#define SND_VT1712_PM_OPS &snd_ice1712_pm +#else +#define SND_VT1712_PM_OPS NULL +#endif /* CONFIG_PM_SLEEP */ + static struct pci_driver ice1712_driver = { .name = KBUILD_MODNAME, .id_table = snd_ice1712_ids, .probe = snd_ice1712_probe, .remove = snd_ice1712_remove, + .driver = { + .pm = SND_VT1712_PM_OPS, + }, }; module_pci_driver(ice1712_driver); diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c index 500471778291..5e7948f3efe9 100644 --- a/sound/pci/ice1712/ice1724.c +++ b/sound/pci/ice1712/ice1724.c @@ -146,7 +146,7 @@ static unsigned char snd_vt1724_ac97_ready(struct snd_ice1712 *ice) continue; return old_cmd; } - snd_printd(KERN_ERR "snd_vt1724_ac97_ready: timeout\n"); + dev_dbg(ice->card->dev, "snd_vt1724_ac97_ready: timeout\n"); return old_cmd; } @@ -156,7 +156,7 @@ static int snd_vt1724_ac97_wait_bit(struct snd_ice1712 *ice, unsigned char bit) for (tm = 0; tm < 0x10000; tm++) if ((inb(ICEMT1724(ice, AC97_CMD)) & bit) == 0) return 0; - snd_printd(KERN_ERR "snd_vt1724_ac97_wait_bit: timeout\n"); + dev_dbg(ice->card->dev, "snd_vt1724_ac97_wait_bit: timeout\n"); return -EIO; } @@ -430,10 +430,10 @@ static irqreturn_t snd_vt1724_interrupt(int irq, void *dev_id) spin_lock(&ice->reg_lock); if (++timeout > 10) { status = inb(ICEREG1724(ice, IRQSTAT)); - printk(KERN_ERR "ice1724: Too long irq loop, " - "status = 0x%x\n", status); + dev_err(ice->card->dev, + "Too long irq loop, status = 0x%x\n", status); if (status & VT1724_IRQ_MPU_TX) { - printk(KERN_ERR "ice1724: Disabling MPU_TX\n"); + dev_err(ice->card->dev, "Disabling MPU_TX\n"); enable_midi_irq(ice, VT1724_IRQ_MPU_TX, 0); } spin_unlock(&ice->reg_lock); @@ -801,7 +801,7 @@ static int snd_vt1724_playback_pro_prepare(struct snd_pcm_substream *substream) spin_unlock_irq(&ice->reg_lock); /* - printk(KERN_DEBUG "pro prepare: ch = %d, addr = 0x%x, " + dev_dbg(ice->card->dev, "pro prepare: ch = %d, addr = 0x%x, " "buffer = 0x%x, period = 0x%x\n", substream->runtime->channels, (unsigned int)substream->runtime->dma_addr, @@ -821,13 +821,13 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea #if 0 /* read PLAYBACK_ADDR */ ptr = inl(ICEMT1724(ice, PLAYBACK_ADDR)); if (ptr < substream->runtime->dma_addr) { - snd_printd("ice1724: invalid negative ptr\n"); + dev_dbg(ice->card->dev, "invalid negative ptr\n"); return 0; } ptr -= substream->runtime->dma_addr; ptr = bytes_to_frames(substream->runtime, ptr); if (ptr >= substream->runtime->buffer_size) { - snd_printd("ice1724: invalid ptr %d (size=%d)\n", + dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n", (int)ptr, (int)substream->runtime->period_size); return 0; } @@ -840,7 +840,7 @@ static snd_pcm_uframes_t snd_vt1724_playback_pro_pointer(struct snd_pcm_substrea else if (ptr <= substream->runtime->buffer_size) ptr = substream->runtime->buffer_size - ptr; else { - snd_printd("ice1724: invalid ptr %d (size=%d)\n", + dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n", (int)ptr, (int)substream->runtime->buffer_size); ptr = 0; } @@ -884,7 +884,7 @@ static snd_pcm_uframes_t snd_vt1724_pcm_pointer(struct snd_pcm_substream *substr else if (ptr <= substream->runtime->buffer_size) ptr = substream->runtime->buffer_size - ptr; else { - snd_printd("ice1724: invalid ptr %d (size=%d)\n", + dev_dbg(ice->card->dev, "invalid ptr %d (size=%d)\n", (int)ptr, (int)substream->runtime->buffer_size); ptr = 0; } @@ -1508,7 +1508,8 @@ static int snd_vt1724_ac97_mixer(struct snd_ice1712 *ice) ac97.private_data = ice; err = snd_ac97_mixer(pbus, &ac97, &ice->ac97); if (err < 0) - printk(KERN_WARNING "ice1712: cannot initialize pro ac97, skipped\n"); + dev_warn(ice->card->dev, + "cannot initialize pro ac97, skipped\n"); else return 0; } @@ -2271,7 +2272,7 @@ static void wait_i2c_busy(struct snd_ice1712 *ice) while ((inb(ICEREG1724(ice, I2C_CTRL)) & VT1724_I2C_BUSY) && t--) ; if (t == -1) - printk(KERN_ERR "ice1724: i2c busy timeout\n"); + dev_err(ice->card->dev, "i2c busy timeout\n"); } unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice, @@ -2287,7 +2288,7 @@ unsigned char snd_vt1724_read_i2c(struct snd_ice1712 *ice, val = inb(ICEREG1724(ice, I2C_DATA)); mutex_unlock(&ice->i2c_mutex); /* - printk(KERN_DEBUG "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); + dev_dbg(ice->card->dev, "i2c_read: [0x%x,0x%x] = 0x%x\n", dev, addr, val); */ return val; } @@ -2298,7 +2299,7 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice, mutex_lock(&ice->i2c_mutex); wait_i2c_busy(ice); /* - printk(KERN_DEBUG "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); + dev_dbg(ice->card->dev, "i2c_write: [0x%x,0x%x] = 0x%x\n", dev, addr, data); */ outb(addr, ICEREG1724(ice, I2C_BYTE_ADDR)); outb(data, ICEREG1724(ice, I2C_DATA)); @@ -2335,7 +2336,8 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice, ((unsigned int)swab16(vendor) << 16) | swab16(device); if (ice->eeprom.subvendor == 0 || ice->eeprom.subvendor == (unsigned int)-1) { - printk(KERN_ERR "ice1724: No valid ID is found\n"); + dev_err(ice->card->dev, + "No valid ID is found\n"); return -ENXIO; } } @@ -2344,7 +2346,8 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice, for (c = *tbl; c->name; c++) { if (modelname && c->model && !strcmp(modelname, c->model)) { - printk(KERN_INFO "ice1724: Using board model %s\n", + dev_info(ice->card->dev, + "Using board model %s\n", c->name); ice->eeprom.subvendor = c->subvendor; } else if (c->subvendor != ice->eeprom.subvendor) @@ -2353,14 +2356,14 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice, if (!c->eeprom_size || !c->eeprom_data) goto found; /* if the EEPROM is given by the driver, use it */ - snd_printdd("using the defined eeprom..\n"); + dev_dbg(ice->card->dev, "using the defined eeprom..\n"); ice->eeprom.version = 2; ice->eeprom.size = c->eeprom_size + 6; memcpy(ice->eeprom.data, c->eeprom_data, c->eeprom_size); goto read_skipped; } } - printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n", + dev_warn(ice->card->dev, "No matching model found for ID 0x%x\n", ice->eeprom.subvendor); #ifdef CONFIG_PM_SLEEP /* assume AC97-only card which can suspend without additional code */ @@ -2372,13 +2375,13 @@ static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice, if (ice->eeprom.size < 6) ice->eeprom.size = 32; else if (ice->eeprom.size > 32) { - printk(KERN_ERR "ice1724: Invalid EEPROM (size = %i)\n", + dev_err(ice->card->dev, "Invalid EEPROM (size = %i)\n", ice->eeprom.size); return -EIO; } ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05); if (ice->eeprom.version != 1 && ice->eeprom.version != 2) - printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n", + dev_warn(ice->card->dev, "Invalid EEPROM version %i\n", ice->eeprom.version); size = ice->eeprom.size - 6; for (i = 0; i < size; i++) @@ -2586,7 +2589,7 @@ static int snd_vt1724_create(struct snd_card *card, if (request_irq(pci->irq, snd_vt1724_interrupt, IRQF_SHARED, KBUILD_MODNAME, ice)) { - 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_vt1724_free(ice); return -EIO; } @@ -2609,8 +2612,6 @@ static int snd_vt1724_create(struct snd_card *card, return err; } - snd_card_set_dev(card, &pci->dev); - *r_ice1712 = ice; return 0; } @@ -2638,7 +2639,8 @@ static int snd_vt1724_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; diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c index 8855933e710d..7a6c0786c55c 100644 --- a/sound/pci/ice1712/juli.c +++ b/sound/pci/ice1712/juli.c @@ -244,7 +244,7 @@ static void juli_akm_set_rate_val(struct snd_akm4xxx *ak, unsigned int rate) /* AK5385 first, since it requires cold reset affecting both codecs */ old_gpio = ice->gpio.get_data(ice); new_gpio = (old_gpio & ~GPIO_AK5385A_MASK) | ak5385_pins; - /* printk(KERN_DEBUG "JULI - ak5385 set_rate_val: new gpio 0x%x\n", + /* dev_dbg(ice->card->dev, "JULI - ak5385 set_rate_val: new gpio 0x%x\n", new_gpio); */ ice->gpio.set_data(ice, new_gpio); @@ -344,7 +344,7 @@ static int juli_mute_put(struct snd_kcontrol *kcontrol, new_gpio = old_gpio & ~((unsigned int) kcontrol->private_value); } - /* printk(KERN_DEBUG + /* dev_dbg(ice->card->dev, "JULI - mute/unmute: control_value: 0x%x, old_gpio: 0x%x, " "new_gpio 0x%x\n", (unsigned int)ucontrol->value.integer.value[0], old_gpio, @@ -439,9 +439,9 @@ static void add_slaves(struct snd_card *card, { for (; *list; list++) { struct snd_kcontrol *slave = ctl_find(card, *list); - /* printk(KERN_DEBUG "add_slaves - %s\n", *list); */ + /* dev_dbg(card->dev, "add_slaves - %s\n", *list); */ if (slave) { - /* printk(KERN_DEBUG "slave %s found\n", *list); */ + /* dev_dbg(card->dev, "slave %s found\n", *list); */ snd_ctl_add_slave(master, slave); } } @@ -536,7 +536,7 @@ static void juli_set_rate(struct snd_ice1712 *ice, unsigned int rate) old = ice->gpio.get_data(ice); new = (old & ~GPIO_RATE_MASK) | get_gpio_val(rate); - /* printk(KERN_DEBUG "JULI - set_rate: old %x, new %x\n", + /* dev_dbg(ice->card->dev, "JULI - set_rate: old %x, new %x\n", old & GPIO_RATE_MASK, new & GPIO_RATE_MASK); */ @@ -573,7 +573,7 @@ static void juli_ak4114_change(struct ak4114 *ak4114, unsigned char c0, if (ice->is_spdif_master(ice) && c1) { /* only for SPDIF master mode, rate was changed */ rate = snd_ak4114_external_rate(ak4114); - /* printk(KERN_DEBUG "ak4114 - input rate changed to %d\n", + /* dev_dbg(ice->card->dev, "ak4114 - input rate changed to %d\n", rate); */ juli_akm_set_rate_val(ice->akm, rate); } @@ -628,7 +628,7 @@ static int juli_init(struct snd_ice1712 *ice) #endif if (spec->analog) { - printk(KERN_INFO "juli@: analog I/O detected\n"); + dev_info(ice->card->dev, "juli@: analog I/O detected\n"); ice->num_total_dacs = 2; ice->num_total_adcs = 2; diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c index e610339f7601..f3b491aa3e22 100644 --- a/sound/pci/ice1712/prodigy192.c +++ b/sound/pci/ice1712/prodigy192.c @@ -98,7 +98,7 @@ static int stac9460_dac_mute(struct snd_ice1712 *ice, int idx, new = (~mute << 7 & 0x80) | (old & ~0x80); change = (new != old); if (change) - /*printk ("Volume register 0x%02x: 0x%02x\n", idx, new);*/ + /* dev_dbg(ice->card->dev, "Volume register 0x%02x: 0x%02x\n", idx, new);*/ stac9460_put(ice, idx, new); return change; } @@ -133,7 +133,7 @@ static int stac9460_dac_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_e /* due to possible conflicts with stac9460_set_rate_val, mutexing */ mutex_lock(&spec->mute_mutex); /* - printk(KERN_DEBUG "Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, + dev_dbg(ice->card->dev, "Mute put: reg 0x%02x, ctrl value: 0x%02x\n", idx, ucontrol->value.integer.value[0]); */ change = stac9460_dac_mute(ice, idx, ucontrol->value.integer.value[0]); @@ -187,7 +187,7 @@ static int stac9460_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el if (change) { ovol = (0x7f - nvol) | (tmp & 0x80); /* - printk(KERN_DEBUG "DAC Volume: reg 0x%02x: 0x%02x\n", + dev_dbg(ice->card->dev, "DAC Volume: reg 0x%02x: 0x%02x\n", idx, ovol); */ stac9460_put(ice, idx, (0x7f - nvol) | (tmp & 0x80)); @@ -348,7 +348,7 @@ static void stac9460_set_rate_val(struct snd_ice1712 *ice, unsigned int rate) for (idx = 0; idx < 7 ; ++idx) changed[idx] = stac9460_dac_mute(ice, STAC946X_MASTER_VOLUME + idx, 0); - /*printk(KERN_DEBUG "Rate change: %d, new MC: 0x%02x\n", rate, new);*/ + /*dev_dbg(ice->card->dev, "Rate change: %d, new MC: 0x%02x\n", rate, new);*/ stac9460_put(ice, STAC946X_MASTER_CLOCKING, new); udelay(10); /* unmuting - only originally unmuted dacs - @@ -768,9 +768,10 @@ static int prodigy192_init(struct snd_ice1712 *ice) /* from this moment if err = 0 then * spec->ak4114 should not be null */ - snd_printdd("AK4114 initialized with status %d\n", err); + dev_dbg(ice->card->dev, + "AK4114 initialized with status %d\n", err); } else - snd_printdd("AK4114 not found\n"); + dev_dbg(ice->card->dev, "AK4114 not found\n"); if (err < 0) return err; diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c index 71c6003ef338..2c2df4b74e01 100644 --- a/sound/pci/ice1712/quartet.c +++ b/sound/pci/ice1712/quartet.c @@ -280,7 +280,7 @@ static void qtet_akm_write(struct snd_akm4xxx *ak, int chip, if (snd_BUG_ON(chip < 0 || chip >= 4)) return; - /*printk(KERN_DEBUG "Writing to AK4620: chip=%d, addr=0x%x, + /*dev_dbg(ice->card->dev, "Writing to AK4620: chip=%d, addr=0x%x, data=0x%x\n", chip, addr, data);*/ orig_dir = ice->gpio.get_dir(ice); ice->gpio.set_dir(ice, orig_dir | GPIO_SPI_ALL); @@ -898,7 +898,7 @@ static void qtet_set_rate(struct snd_ice1712 *ice, unsigned int rate) new = (get_cpld(ice) & ~CPLD_CKS_MASK) | get_cks_val(rate); /* switch to internal clock, drop CPLD_SYNC_SEL */ new &= ~CPLD_SYNC_SEL; - /* printk(KERN_DEBUG "QT - set_rate: old %x, new %x\n", + /* dev_dbg(ice->card->dev, "QT - set_rate: old %x, new %x\n", get_cpld(ice), new); */ set_cpld(ice, new); } @@ -978,7 +978,7 @@ static void qtet_ak4113_change(struct ak4113 *ak4113, unsigned char c0, c1) { /* only for SPDIF master mode, rate was changed */ rate = snd_ak4113_external_rate(ak4113); - /* printk(KERN_DEBUG "ak4113 - input rate changed to %d\n", + /* dev_dbg(ice->card->dev, "ak4113 - input rate changed to %d\n", rate); */ qtet_akm_set_rate_val(ice->akm, rate); } |