ASoC: Update DAPM debug and error prints
Switch printk and pr_ prints to dev_ variants. It is helpful to see parent device of DAPM context especially when there are multiple DAPM contexts (codecs currently). This is mostly simple conversion. Exceptions are in snd_soc_dapm_set_pin that prints also pin state, uniform "dapm: unknown pin" error prints from snd_soc_dapm_set_pin, snd_soc_dapm_force_enable_pin and snd_soc_dapm_ignore_suspend, and pop_dbg which is converted by an another patch. Signed-off-by: Jarkko Nikula <jhnikula@gmail.com> Acked-by: Liam Girdwood <lrg@slimlogic.co.uk> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
This commit is contained in:
parent
b95fccbc02
commit
f7d41ae836
@ -319,8 +319,8 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
|
|||||||
pop_wait(card->pop_time);
|
pop_wait(card->pop_time);
|
||||||
snd_soc_write(codec, widget->reg, new);
|
snd_soc_write(codec, widget->reg, new);
|
||||||
}
|
}
|
||||||
pr_debug("reg %x old %x new %x change %d\n", widget->reg,
|
dev_dbg(dapm->dev, "reg %x old %x new %x change %d\n", widget->reg,
|
||||||
old, new, change);
|
old, new, change);
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,9 +375,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
|
|||||||
path->long_name);
|
path->long_name);
|
||||||
ret = snd_ctl_add(card, path->kcontrol);
|
ret = snd_ctl_add(card, path->kcontrol);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printk(KERN_ERR "asoc: failed to add dapm kcontrol %s: %d\n",
|
dev_err(dapm->dev,
|
||||||
path->long_name,
|
"asoc: failed to add dapm kcontrol %s: %d\n",
|
||||||
ret);
|
path->long_name, ret);
|
||||||
kfree(path->long_name);
|
kfree(path->long_name);
|
||||||
path->long_name = NULL;
|
path->long_name = NULL;
|
||||||
return ret;
|
return ret;
|
||||||
@ -397,7 +397,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
|
|||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (!w->num_kcontrols) {
|
if (!w->num_kcontrols) {
|
||||||
printk(KERN_ERR "asoc: mux %s has no controls\n", w->name);
|
dev_err(dapm->dev, "asoc: mux %s has no controls\n", w->name);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -413,7 +413,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
|
|||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
printk(KERN_ERR "asoc: failed to add kcontrol %s\n", w->name);
|
dev_err(dapm->dev, "asoc: failed to add kcontrol %s\n", w->name);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -422,7 +422,8 @@ static int dapm_new_pga(struct snd_soc_dapm_context *dapm,
|
|||||||
struct snd_soc_dapm_widget *w)
|
struct snd_soc_dapm_widget *w)
|
||||||
{
|
{
|
||||||
if (w->num_kcontrols)
|
if (w->num_kcontrols)
|
||||||
pr_err("asoc: PGA controls not supported: '%s'\n", w->name);
|
dev_err(w->dapm->dev,
|
||||||
|
"asoc: PGA controls not supported: '%s'\n", w->name);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -448,7 +449,8 @@ static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget)
|
|||||||
case SNDRV_CTL_POWER_D3hot:
|
case SNDRV_CTL_POWER_D3hot:
|
||||||
case SNDRV_CTL_POWER_D3cold:
|
case SNDRV_CTL_POWER_D3cold:
|
||||||
if (widget->ignore_suspend)
|
if (widget->ignore_suspend)
|
||||||
pr_debug("%s ignoring suspend\n", widget->name);
|
dev_dbg(widget->dapm->dev, "%s ignoring suspend\n",
|
||||||
|
widget->name);
|
||||||
return widget->ignore_suspend;
|
return widget->ignore_suspend;
|
||||||
default:
|
default:
|
||||||
return 1;
|
return 1;
|
||||||
@ -579,7 +581,7 @@ static int dapm_generic_apply_power(struct snd_soc_dapm_widget *w)
|
|||||||
|
|
||||||
/* call any power change event handlers */
|
/* call any power change event handlers */
|
||||||
if (w->event)
|
if (w->event)
|
||||||
pr_debug("power %s event for %s flags %x\n",
|
dev_dbg(w->dapm->dev, "power %s event for %s flags %x\n",
|
||||||
w->power ? "on" : "off",
|
w->power ? "on" : "off",
|
||||||
w->name, w->event_flags);
|
w->name, w->event_flags);
|
||||||
|
|
||||||
@ -754,8 +756,9 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,
|
|||||||
w->name);
|
w->name);
|
||||||
ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU);
|
ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_err("%s: pre event failed: %d\n",
|
dev_err(dapm->dev,
|
||||||
w->name, ret);
|
"%s: pre event failed: %d\n",
|
||||||
|
w->name, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* power down pre event */
|
/* power down pre event */
|
||||||
@ -765,8 +768,9 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,
|
|||||||
w->name);
|
w->name);
|
||||||
ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD);
|
ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_err("%s: pre event failed: %d\n",
|
dev_err(dapm->dev,
|
||||||
w->name, ret);
|
"%s: pre event failed: %d\n",
|
||||||
|
w->name, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -787,8 +791,9 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,
|
|||||||
ret = w->event(w,
|
ret = w->event(w,
|
||||||
NULL, SND_SOC_DAPM_POST_PMU);
|
NULL, SND_SOC_DAPM_POST_PMU);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_err("%s: post event failed: %d\n",
|
dev_err(dapm->dev,
|
||||||
w->name, ret);
|
"%s: post event failed: %d\n",
|
||||||
|
w->name, ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* power down post event */
|
/* power down post event */
|
||||||
@ -798,8 +803,9 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,
|
|||||||
w->name);
|
w->name);
|
||||||
ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD);
|
ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_err("%s: post event failed: %d\n",
|
dev_err(dapm->dev,
|
||||||
w->name, ret);
|
"%s: post event failed: %d\n",
|
||||||
|
w->name, ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -880,8 +886,8 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
pr_err("Failed to apply widget power: %d\n",
|
dev_err(w->dapm->dev,
|
||||||
ret);
|
"Failed to apply widget power: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!list_empty(&pending))
|
if (!list_empty(&pending))
|
||||||
@ -975,7 +981,8 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
|
|||||||
ret = snd_soc_dapm_set_bias_level(card, dapm,
|
ret = snd_soc_dapm_set_bias_level(card, dapm,
|
||||||
SND_SOC_BIAS_STANDBY);
|
SND_SOC_BIAS_STANDBY);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
pr_err("Failed to turn on bias: %d\n", ret);
|
dev_err(dapm->dev,
|
||||||
|
"Failed to turn on bias: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're changing to all on or all off then prepare */
|
/* If we're changing to all on or all off then prepare */
|
||||||
@ -983,7 +990,8 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
|
|||||||
(!sys_power && dapm->bias_level == SND_SOC_BIAS_ON)) {
|
(!sys_power && dapm->bias_level == SND_SOC_BIAS_ON)) {
|
||||||
ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_PREPARE);
|
ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_PREPARE);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
pr_err("Failed to prepare bias: %d\n", ret);
|
dev_err(dapm->dev,
|
||||||
|
"Failed to prepare bias: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Power down widgets first; try to avoid amplifying pops. */
|
/* Power down widgets first; try to avoid amplifying pops. */
|
||||||
@ -996,7 +1004,8 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
|
|||||||
if (dapm->bias_level == SND_SOC_BIAS_PREPARE && !sys_power) {
|
if (dapm->bias_level == SND_SOC_BIAS_PREPARE && !sys_power) {
|
||||||
ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_STANDBY);
|
ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_STANDBY);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
pr_err("Failed to apply standby bias: %d\n", ret);
|
dev_err(dapm->dev,
|
||||||
|
"Failed to apply standby bias: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we're in standby and can support bias off then do that */
|
/* If we're in standby and can support bias off then do that */
|
||||||
@ -1004,14 +1013,16 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
|
|||||||
dapm->idle_bias_off) {
|
dapm->idle_bias_off) {
|
||||||
ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_OFF);
|
ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_OFF);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
pr_err("Failed to turn off bias: %d\n", ret);
|
dev_err(dapm->dev,
|
||||||
|
"Failed to turn off bias: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we just powered up then move to active bias */
|
/* If we just powered up then move to active bias */
|
||||||
if (dapm->bias_level == SND_SOC_BIAS_PREPARE && sys_power) {
|
if (dapm->bias_level == SND_SOC_BIAS_PREPARE && sys_power) {
|
||||||
ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_ON);
|
ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_ON);
|
||||||
if (ret != 0)
|
if (ret != 0)
|
||||||
pr_err("Failed to apply active bias: %d\n", ret);
|
dev_err(dapm->dev,
|
||||||
|
"Failed to apply active bias: %d\n", ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
pop_dbg(card->pop_time, "DAPM sequencing finished, waiting %dms\n",
|
pop_dbg(card->pop_time, "DAPM sequencing finished, waiting %dms\n",
|
||||||
@ -1111,9 +1122,9 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm)
|
|||||||
dapm->debugfs_dapm, w,
|
dapm->debugfs_dapm, w,
|
||||||
&dapm_widget_power_fops);
|
&dapm_widget_power_fops);
|
||||||
if (!d)
|
if (!d)
|
||||||
printk(KERN_WARNING
|
dev_warn(w->dapm->dev,
|
||||||
"ASoC: Failed to create %s debugfs file\n",
|
"ASoC: Failed to create %s debugfs file\n",
|
||||||
w->name);
|
w->name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
@ -1279,7 +1290,8 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
|
|||||||
|
|
||||||
list_for_each_entry(w, &dapm->widgets, list) {
|
list_for_each_entry(w, &dapm->widgets, list) {
|
||||||
if (!strcmp(w->name, pin)) {
|
if (!strcmp(w->name, pin)) {
|
||||||
pr_debug("dapm: %s: pin %s\n", dapm->codec->name, pin);
|
dev_dbg(w->dapm->dev, "dapm: pin %s = %d\n",
|
||||||
|
pin, status);
|
||||||
w->connected = status;
|
w->connected = status;
|
||||||
/* Allow disabling of forced pins */
|
/* Allow disabling of forced pins */
|
||||||
if (status == 0)
|
if (status == 0)
|
||||||
@ -1288,8 +1300,7 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_err("dapm: %s: configuring unknown pin %s\n",
|
dev_err(dapm->dev, "dapm: unknown pin %s\n", pin);
|
||||||
dapm->codec->name, pin);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1415,8 +1426,8 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
err:
|
err:
|
||||||
printk(KERN_WARNING "asoc: no dapm match for %s --> %s --> %s\n", source,
|
dev_warn(dapm->dev, "asoc: no dapm match for %s --> %s --> %s\n",
|
||||||
control, sink);
|
source, control, sink);
|
||||||
kfree(path);
|
kfree(path);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -1442,9 +1453,8 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
|
|||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
ret = snd_soc_dapm_add_route(dapm, route);
|
ret = snd_soc_dapm_add_route(dapm, route);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printk(KERN_ERR "Failed to add route %s->%s\n",
|
dev_err(dapm->dev, "Failed to add route %s->%s\n",
|
||||||
route->source,
|
route->source, route->sink);
|
||||||
route->sink);
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
route++;
|
route++;
|
||||||
@ -1982,9 +1992,9 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
|
|||||||
for (i = 0; i < num; i++) {
|
for (i = 0; i < num; i++) {
|
||||||
ret = snd_soc_dapm_new_control(dapm, widget);
|
ret = snd_soc_dapm_new_control(dapm, widget);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
printk(KERN_ERR
|
dev_err(dapm->dev,
|
||||||
"ASoC: Failed to create DAPM control %s: %d\n",
|
"ASoC: Failed to create DAPM control %s: %d\n",
|
||||||
widget->name, ret);
|
widget->name, ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
widget++;
|
widget++;
|
||||||
@ -2002,8 +2012,8 @@ static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm,
|
|||||||
{
|
{
|
||||||
if (!w->sname)
|
if (!w->sname)
|
||||||
continue;
|
continue;
|
||||||
pr_debug("widget %s\n %s stream %s event %d\n",
|
dev_dbg(w->dapm->dev, "widget %s\n %s stream %s event %d\n",
|
||||||
w->name, w->sname, stream, event);
|
w->name, w->sname, stream, event);
|
||||||
if (strstr(w->sname, stream)) {
|
if (strstr(w->sname, stream)) {
|
||||||
switch(event) {
|
switch(event) {
|
||||||
case SND_SOC_DAPM_STREAM_START:
|
case SND_SOC_DAPM_STREAM_START:
|
||||||
@ -2085,15 +2095,15 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
|
|||||||
|
|
||||||
list_for_each_entry(w, &dapm->widgets, list) {
|
list_for_each_entry(w, &dapm->widgets, list) {
|
||||||
if (!strcmp(w->name, pin)) {
|
if (!strcmp(w->name, pin)) {
|
||||||
pr_debug("dapm: %s: pin %s\n", dapm->codec->name, pin);
|
dev_dbg(w->dapm->dev,
|
||||||
|
"dapm: force enable pin %s\n", pin);
|
||||||
w->connected = 1;
|
w->connected = 1;
|
||||||
w->force = 1;
|
w->force = 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_err("dapm: %s: configuring unknown pin %s\n",
|
dev_err(dapm->dev, "dapm: unknown pin %s\n", pin);
|
||||||
dapm->codec->name, pin);
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin);
|
EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin);
|
||||||
@ -2180,7 +2190,7 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pr_err("Unknown DAPM pin: %s\n", pin);
|
dev_err(dapm->dev, "dapm: unknown pin %s\n", pin);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend);
|
EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend);
|
||||||
|
Loading…
Reference in New Issue
Block a user