mirror of
https://github.com/torvalds/linux.git
synced 2024-11-21 19:41:42 +00:00
ALSA: ppc: Use standard print API
Use the standard print API with dev_*() instead of the old house-baked one. It gives better information and allows dynamically control of debug prints. Reviewed-by: Jaroslav Kysela <perex@perex.cz> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20240807133452.9424-50-tiwai@suse.de
This commit is contained in:
parent
7ba0212231
commit
76a6ef90d5
@ -39,7 +39,7 @@ static void snd_pmac_screamer_wait(struct snd_pmac *chip)
|
||||
while (!(in_le32(&chip->awacs->codec_stat) & MASK_VALID)) {
|
||||
mdelay(1);
|
||||
if (! --timeout) {
|
||||
snd_printd("snd_pmac_screamer_wait timeout\n");
|
||||
dev_dbg(chip->card->dev, "%s timeout\n", __func__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -58,7 +58,7 @@ snd_pmac_awacs_write(struct snd_pmac *chip, int val)
|
||||
out_le32(&chip->awacs->codec_ctrl, val | (chip->subframe << 22));
|
||||
while (in_le32(&chip->awacs->codec_ctrl) & MASK_NEWECMD) {
|
||||
if (! --timeout) {
|
||||
snd_printd("snd_pmac_awacs_write timeout\n");
|
||||
dev_dbg(chip->card->dev, "%s timeout\n", __func__);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ static int daca_set_volume(struct pmac_daca *mix)
|
||||
data[1] |= mix->deemphasis ? 0x40 : 0;
|
||||
if (i2c_smbus_write_block_data(mix->i2c.client, DACA_REG_AVOL,
|
||||
2, data) < 0) {
|
||||
snd_printk(KERN_ERR "failed to set volume \n");
|
||||
dev_err(&mix->i2c.client->dev, "failed to set volume\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
|
@ -113,7 +113,8 @@ int snd_pmac_tumbler_post_init(void)
|
||||
|
||||
err = keywest_ctx->init_client(keywest_ctx);
|
||||
if (err < 0) {
|
||||
snd_printk(KERN_ERR "tumbler: %i :cannot initialize the MCS\n", err);
|
||||
dev_err(&keywest_ctx->client->dev,
|
||||
"tumbler: %i :cannot initialize the MCS\n", err);
|
||||
return err;
|
||||
}
|
||||
return 0;
|
||||
@ -136,7 +137,7 @@ int snd_pmac_keywest_init(struct pmac_keywest *i2c)
|
||||
|
||||
err = i2c_add_driver(&keywest_driver);
|
||||
if (err) {
|
||||
snd_printk(KERN_ERR "cannot register keywest i2c driver\n");
|
||||
dev_err(&i2c->client->dev, "cannot register keywest i2c driver\n");
|
||||
i2c_put_adapter(adap);
|
||||
return err;
|
||||
}
|
||||
|
@ -269,7 +269,6 @@ static int snd_pmac_pcm_trigger(struct snd_pmac *chip, struct pmac_stream *rec,
|
||||
case SNDRV_PCM_TRIGGER_SUSPEND:
|
||||
spin_lock(&chip->reg_lock);
|
||||
rec->running = 0;
|
||||
/*printk(KERN_DEBUG "stopped!!\n");*/
|
||||
snd_pmac_dma_stop(rec);
|
||||
for (i = 0, cp = rec->cmd.cmds; i < rec->nperiods; i++, cp++)
|
||||
out_le16(&cp->command, DBDMA_STOP);
|
||||
@ -304,7 +303,6 @@ static snd_pcm_uframes_t snd_pmac_pcm_pointer(struct snd_pmac *chip,
|
||||
}
|
||||
#endif
|
||||
count += rec->cur_period * rec->period_size;
|
||||
/*printk(KERN_DEBUG "pointer=%d\n", count);*/
|
||||
return bytes_to_frames(subs->runtime, count);
|
||||
}
|
||||
|
||||
@ -384,8 +382,6 @@ static inline void snd_pmac_pcm_dead_xfer(struct pmac_stream *rec,
|
||||
unsigned short req, res ;
|
||||
unsigned int phy ;
|
||||
|
||||
/* printk(KERN_WARNING "snd-powermac: DMA died - patching it up!\n"); */
|
||||
|
||||
/* to clear DEAD status we must first clear RUN
|
||||
set it to quiescent to be on the safe side */
|
||||
(void)in_le32(&rec->dma->status);
|
||||
@ -456,7 +452,6 @@ static void snd_pmac_pcm_update(struct snd_pmac *chip, struct pmac_stream *rec)
|
||||
if (! (stat & ACTIVE))
|
||||
break;
|
||||
|
||||
/*printk(KERN_DEBUG "update frag %d\n", rec->cur_period);*/
|
||||
cp->xfer_status = cpu_to_le16(0);
|
||||
cp->req_count = cpu_to_le16(rec->period_size);
|
||||
/*cp->res_count = cpu_to_le16(0);*/
|
||||
@ -770,7 +765,6 @@ snd_pmac_ctrl_intr(int irq, void *devid)
|
||||
struct snd_pmac *chip = devid;
|
||||
int ctrl = in_le32(&chip->awacs->control);
|
||||
|
||||
/*printk(KERN_DEBUG "pmac: control interrupt.. 0x%x\n", ctrl);*/
|
||||
if (ctrl & MASK_PORTCHG) {
|
||||
/* do something when headphone is plugged/unplugged? */
|
||||
if (chip->update_automute)
|
||||
@ -779,7 +773,7 @@ snd_pmac_ctrl_intr(int irq, void *devid)
|
||||
if (ctrl & MASK_CNTLERR) {
|
||||
int err = (in_le32(&chip->awacs->codec_stat) & MASK_ERRCODE) >> 16;
|
||||
if (err && chip->model <= PMAC_SCREAMER)
|
||||
snd_printk(KERN_DEBUG "error %x\n", err);
|
||||
dev_dbg(chip->card->dev, "%s: error %x\n", __func__, err);
|
||||
}
|
||||
/* Writing 1s to the CNTLERR and PORTCHG bits clears them... */
|
||||
out_le32(&chip->awacs->control, ctrl);
|
||||
@ -964,9 +958,8 @@ static int snd_pmac_detect(struct snd_pmac *chip)
|
||||
if (prop) {
|
||||
/* partly deprecate snd-powermac, for those machines
|
||||
* that have a layout-id property for now */
|
||||
printk(KERN_INFO "snd-powermac no longer handles any "
|
||||
"machines with a layout-id property "
|
||||
"in the device-tree, use snd-aoa.\n");
|
||||
dev_info(chip->card->dev,
|
||||
"snd-powermac no longer handles any machines with a layout-id property in the device-tree, use snd-aoa.\n");
|
||||
of_node_put(sound);
|
||||
of_node_put(chip->node);
|
||||
chip->node = NULL;
|
||||
@ -1021,7 +1014,7 @@ static int snd_pmac_detect(struct snd_pmac *chip)
|
||||
*/
|
||||
macio = macio_find(chip->node, macio_unknown);
|
||||
if (macio == NULL)
|
||||
printk(KERN_WARNING "snd-powermac: can't locate macio !\n");
|
||||
dev_warn(chip->card->dev, "snd-powermac: can't locate macio !\n");
|
||||
else {
|
||||
struct pci_dev *pdev = NULL;
|
||||
|
||||
@ -1034,8 +1027,8 @@ static int snd_pmac_detect(struct snd_pmac *chip)
|
||||
}
|
||||
}
|
||||
if (chip->pdev == NULL)
|
||||
printk(KERN_WARNING "snd-powermac: can't locate macio PCI"
|
||||
" device !\n");
|
||||
dev_warn(chip->card->dev,
|
||||
"snd-powermac: can't locate macio PCI device !\n");
|
||||
|
||||
detect_byte_swap(chip);
|
||||
|
||||
@ -1125,7 +1118,8 @@ int snd_pmac_add_automute(struct snd_pmac *chip)
|
||||
chip->auto_mute = 1;
|
||||
err = snd_ctl_add(chip->card, snd_ctl_new1(&auto_mute_controls[0], chip));
|
||||
if (err < 0) {
|
||||
printk(KERN_ERR "snd-powermac: Failed to add automute control\n");
|
||||
dev_err(chip->card->dev,
|
||||
"snd-powermac: Failed to add automute control\n");
|
||||
return err;
|
||||
}
|
||||
chip->hp_detect_ctl = snd_ctl_new1(&auto_mute_controls[1], chip);
|
||||
@ -1180,16 +1174,17 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
|
||||
for (i = 0; i < 2; i ++) {
|
||||
if (of_address_to_resource(np->parent, i,
|
||||
&chip->rsrc[i])) {
|
||||
printk(KERN_ERR "snd: can't translate rsrc "
|
||||
" %d (%s)\n", i, rnames[i]);
|
||||
dev_err(chip->card->dev,
|
||||
"snd: can't translate rsrc %d (%s)\n",
|
||||
i, rnames[i]);
|
||||
err = -ENODEV;
|
||||
goto __error;
|
||||
}
|
||||
if (request_mem_region(chip->rsrc[i].start,
|
||||
resource_size(&chip->rsrc[i]),
|
||||
rnames[i]) == NULL) {
|
||||
printk(KERN_ERR "snd: can't request rsrc "
|
||||
" %d (%s: %pR)\n",
|
||||
dev_err(chip->card->dev,
|
||||
"snd: can't request rsrc %d (%s: %pR)\n",
|
||||
i, rnames[i], &chip->rsrc[i]);
|
||||
err = -ENODEV;
|
||||
goto __error;
|
||||
@ -1205,16 +1200,17 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
|
||||
for (i = 0; i < 3; i ++) {
|
||||
if (of_address_to_resource(np, i,
|
||||
&chip->rsrc[i])) {
|
||||
printk(KERN_ERR "snd: can't translate rsrc "
|
||||
" %d (%s)\n", i, rnames[i]);
|
||||
dev_err(chip->card->dev,
|
||||
"snd: can't translate rsrc %d (%s)\n",
|
||||
i, rnames[i]);
|
||||
err = -ENODEV;
|
||||
goto __error;
|
||||
}
|
||||
if (request_mem_region(chip->rsrc[i].start,
|
||||
resource_size(&chip->rsrc[i]),
|
||||
rnames[i]) == NULL) {
|
||||
printk(KERN_ERR "snd: can't request rsrc "
|
||||
" %d (%s: %pR)\n",
|
||||
dev_err(chip->card->dev,
|
||||
"snd: can't request rsrc %d (%s: %pR)\n",
|
||||
i, rnames[i], &chip->rsrc[i]);
|
||||
err = -ENODEV;
|
||||
goto __error;
|
||||
@ -1233,8 +1229,8 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
|
||||
irq = irq_of_parse_and_map(np, 0);
|
||||
if (request_irq(irq, snd_pmac_ctrl_intr, 0,
|
||||
"PMac", (void*)chip)) {
|
||||
snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n",
|
||||
irq);
|
||||
dev_err(chip->card->dev,
|
||||
"pmac: unable to grab IRQ %d\n", irq);
|
||||
err = -EBUSY;
|
||||
goto __error;
|
||||
}
|
||||
@ -1242,14 +1238,14 @@ int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
|
||||
}
|
||||
irq = irq_of_parse_and_map(np, 1);
|
||||
if (request_irq(irq, snd_pmac_tx_intr, 0, "PMac Output", (void*)chip)){
|
||||
snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", irq);
|
||||
dev_err(chip->card->dev, "pmac: unable to grab IRQ %d\n", irq);
|
||||
err = -EBUSY;
|
||||
goto __error;
|
||||
}
|
||||
chip->tx_irq = irq;
|
||||
irq = irq_of_parse_and_map(np, 2);
|
||||
if (request_irq(irq, snd_pmac_rx_intr, 0, "PMac Input", (void*)chip)) {
|
||||
snd_printk(KERN_ERR "pmac: unable to grab IRQ %d\n", irq);
|
||||
dev_err(chip->card->dev, "pmac: unable to grab IRQ %d\n", irq);
|
||||
err = -EBUSY;
|
||||
goto __error;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ static int snd_pmac_probe(struct platform_device *devptr)
|
||||
goto __error;
|
||||
break;
|
||||
default:
|
||||
snd_printk(KERN_ERR "unsupported hardware %d\n", chip->model);
|
||||
dev_err(&devptr->dev, "unsupported hardware %d\n", chip->model);
|
||||
err = -EINVAL;
|
||||
goto __error;
|
||||
}
|
||||
|
@ -29,7 +29,7 @@
|
||||
#undef DEBUG
|
||||
|
||||
#ifdef DEBUG
|
||||
#define DBG(fmt...) printk(KERN_DEBUG fmt)
|
||||
#define DBG(fmt...) pr_debug(fmt)
|
||||
#else
|
||||
#define DBG(fmt...)
|
||||
#endif
|
||||
@ -230,7 +230,7 @@ static int tumbler_set_master_volume(struct pmac_tumbler *mix)
|
||||
|
||||
if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_VOL, 6,
|
||||
block) < 0) {
|
||||
snd_printk(KERN_ERR "failed to set volume \n");
|
||||
dev_err(&mix->i2c.client->dev, "failed to set volume\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
DBG("(I) succeeded to set volume (%u, %u)\n", left_vol, right_vol);
|
||||
@ -341,7 +341,7 @@ static int tumbler_set_drc(struct pmac_tumbler *mix)
|
||||
|
||||
if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
|
||||
2, val) < 0) {
|
||||
snd_printk(KERN_ERR "failed to set DRC\n");
|
||||
dev_err(&mix->i2c.client->dev, "failed to set DRC\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
DBG("(I) succeeded to set DRC (%u, %u)\n", val[0], val[1]);
|
||||
@ -378,7 +378,7 @@ static int snapper_set_drc(struct pmac_tumbler *mix)
|
||||
|
||||
if (i2c_smbus_write_i2c_block_data(mix->i2c.client, TAS_REG_DRC,
|
||||
6, val) < 0) {
|
||||
snd_printk(KERN_ERR "failed to set DRC\n");
|
||||
dev_err(&mix->i2c.client->dev, "failed to set DRC\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
DBG("(I) succeeded to set DRC (%u, %u)\n", val[0], val[1]);
|
||||
@ -503,7 +503,7 @@ static int tumbler_set_mono_volume(struct pmac_tumbler *mix,
|
||||
block[i] = (vol >> ((info->bytes - i - 1) * 8)) & 0xff;
|
||||
if (i2c_smbus_write_i2c_block_data(mix->i2c.client, info->reg,
|
||||
info->bytes, block) < 0) {
|
||||
snd_printk(KERN_ERR "failed to set mono volume %d\n",
|
||||
dev_err(&mix->i2c.client->dev, "failed to set mono volume %d\n",
|
||||
info->index);
|
||||
return -EINVAL;
|
||||
}
|
||||
@ -643,7 +643,8 @@ static int snapper_set_mix_vol1(struct pmac_tumbler *mix, int idx, int ch, int r
|
||||
}
|
||||
if (i2c_smbus_write_i2c_block_data(mix->i2c.client, reg,
|
||||
9, block) < 0) {
|
||||
snd_printk(KERN_ERR "failed to set mono volume %d\n", reg);
|
||||
dev_err(&mix->i2c.client->dev,
|
||||
"failed to set mono volume %d\n", reg);
|
||||
return -EINVAL;
|
||||
}
|
||||
return 0;
|
||||
@ -1102,7 +1103,6 @@ static long tumbler_find_device(const char *device, const char *platform,
|
||||
node = find_audio_device(device);
|
||||
if (! node) {
|
||||
DBG("(W) cannot find audio device %s !\n", device);
|
||||
snd_printdd("cannot find device %s\n", device);
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
@ -1111,7 +1111,6 @@ static long tumbler_find_device(const char *device, const char *platform,
|
||||
base = of_get_property(node, "reg", NULL);
|
||||
if (!base) {
|
||||
DBG("(E) cannot find address for device %s !\n", device);
|
||||
snd_printd("cannot find address for device %s\n", device);
|
||||
of_node_put(node);
|
||||
return -ENODEV;
|
||||
}
|
||||
@ -1232,9 +1231,9 @@ static void tumbler_resume(struct snd_pmac *chip)
|
||||
tumbler_reset_audio(chip);
|
||||
if (mix->i2c.client && mix->i2c.init_client) {
|
||||
if (mix->i2c.init_client(&mix->i2c) < 0)
|
||||
printk(KERN_ERR "tumbler_init_client error\n");
|
||||
dev_err(chip->card->dev, "tumbler_init_client error\n");
|
||||
} else
|
||||
printk(KERN_ERR "tumbler: i2c is not initialized\n");
|
||||
dev_err(chip->card->dev, "tumbler: i2c is not initialized\n");
|
||||
if (chip->model == PMAC_TUMBLER) {
|
||||
tumbler_set_mono_volume(mix, &tumbler_pcm_vol_info);
|
||||
tumbler_set_mono_volume(mix, &tumbler_bass_vol_info);
|
||||
|
Loading…
Reference in New Issue
Block a user