aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorJarkko Nikula <jhnikula@gmail.com>2010-11-09 07:40:27 -0500
committerMark Brown <broonie@opensource.wolfsonmicro.com>2010-11-10 10:09:16 -0500
commitf7d41ae8361fb2d16fe059f65075d92c4efe562c (patch)
tree4728d5b9f53bf931ff7ea97e96f8af00daf502b9 /sound/soc/soc-dapm.c
parentb95fccbc025cb5788776ed8b80dba20b24529b15 (diff)
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>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c100
1 files changed, 55 insertions, 45 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 960790cc6fbc..e8997bb97890 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -319,8 +319,8 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget)
319 pop_wait(card->pop_time); 319 pop_wait(card->pop_time);
320 snd_soc_write(codec, widget->reg, new); 320 snd_soc_write(codec, widget->reg, new);
321 } 321 }
322 pr_debug("reg %x old %x new %x change %d\n", widget->reg, 322 dev_dbg(dapm->dev, "reg %x old %x new %x change %d\n", widget->reg,
323 old, new, change); 323 old, new, change);
324 return change; 324 return change;
325} 325}
326 326
@@ -375,9 +375,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_context *dapm,
375 path->long_name); 375 path->long_name);
376 ret = snd_ctl_add(card, path->kcontrol); 376 ret = snd_ctl_add(card, path->kcontrol);
377 if (ret < 0) { 377 if (ret < 0) {
378 printk(KERN_ERR "asoc: failed to add dapm kcontrol %s: %d\n", 378 dev_err(dapm->dev,
379 path->long_name, 379 "asoc: failed to add dapm kcontrol %s: %d\n",
380 ret); 380 path->long_name, ret);
381 kfree(path->long_name); 381 kfree(path->long_name);
382 path->long_name = NULL; 382 path->long_name = NULL;
383 return ret; 383 return ret;
@@ -397,7 +397,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
397 int ret = 0; 397 int ret = 0;
398 398
399 if (!w->num_kcontrols) { 399 if (!w->num_kcontrols) {
400 printk(KERN_ERR "asoc: mux %s has no controls\n", w->name); 400 dev_err(dapm->dev, "asoc: mux %s has no controls\n", w->name);
401 return -EINVAL; 401 return -EINVAL;
402 } 402 }
403 403
@@ -413,7 +413,7 @@ static int dapm_new_mux(struct snd_soc_dapm_context *dapm,
413 return ret; 413 return ret;
414 414
415err: 415err:
416 printk(KERN_ERR "asoc: failed to add kcontrol %s\n", w->name); 416 dev_err(dapm->dev, "asoc: failed to add kcontrol %s\n", w->name);
417 return ret; 417 return ret;
418} 418}
419 419
@@ -422,7 +422,8 @@ static int dapm_new_pga(struct snd_soc_dapm_context *dapm,
422 struct snd_soc_dapm_widget *w) 422 struct snd_soc_dapm_widget *w)
423{ 423{
424 if (w->num_kcontrols) 424 if (w->num_kcontrols)
425 pr_err("asoc: PGA controls not supported: '%s'\n", w->name); 425 dev_err(w->dapm->dev,
426 "asoc: PGA controls not supported: '%s'\n", w->name);
426 427
427 return 0; 428 return 0;
428} 429}
@@ -448,7 +449,8 @@ static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget)
448 case SNDRV_CTL_POWER_D3hot: 449 case SNDRV_CTL_POWER_D3hot:
449 case SNDRV_CTL_POWER_D3cold: 450 case SNDRV_CTL_POWER_D3cold:
450 if (widget->ignore_suspend) 451 if (widget->ignore_suspend)
451 pr_debug("%s ignoring suspend\n", widget->name); 452 dev_dbg(widget->dapm->dev, "%s ignoring suspend\n",
453 widget->name);
452 return widget->ignore_suspend; 454 return widget->ignore_suspend;
453 default: 455 default:
454 return 1; 456 return 1;
@@ -579,7 +581,7 @@ static int dapm_generic_apply_power(struct snd_soc_dapm_widget *w)
579 581
580 /* call any power change event handlers */ 582 /* call any power change event handlers */
581 if (w->event) 583 if (w->event)
582 pr_debug("power %s event for %s flags %x\n", 584 dev_dbg(w->dapm->dev, "power %s event for %s flags %x\n",
583 w->power ? "on" : "off", 585 w->power ? "on" : "off",
584 w->name, w->event_flags); 586 w->name, w->event_flags);
585 587
@@ -754,8 +756,9 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,
754 w->name); 756 w->name);
755 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU); 757 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU);
756 if (ret < 0) 758 if (ret < 0)
757 pr_err("%s: pre event failed: %d\n", 759 dev_err(dapm->dev,
758 w->name, ret); 760 "%s: pre event failed: %d\n",
761 w->name, ret);
759 } 762 }
760 763
761 /* power down pre event */ 764 /* power down pre event */
@@ -765,8 +768,9 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,
765 w->name); 768 w->name);
766 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD); 769 ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD);
767 if (ret < 0) 770 if (ret < 0)
768 pr_err("%s: pre event failed: %d\n", 771 dev_err(dapm->dev,
769 w->name, ret); 772 "%s: pre event failed: %d\n",
773 w->name, ret);
770 } 774 }
771 } 775 }
772 776
@@ -787,8 +791,9 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,
787 ret = w->event(w, 791 ret = w->event(w,
788 NULL, SND_SOC_DAPM_POST_PMU); 792 NULL, SND_SOC_DAPM_POST_PMU);
789 if (ret < 0) 793 if (ret < 0)
790 pr_err("%s: post event failed: %d\n", 794 dev_err(dapm->dev,
791 w->name, ret); 795 "%s: post event failed: %d\n",
796 w->name, ret);
792 } 797 }
793 798
794 /* power down post event */ 799 /* power down post event */
@@ -798,8 +803,9 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm,
798 w->name); 803 w->name);
799 ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD); 804 ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD);
800 if (ret < 0) 805 if (ret < 0)
801 pr_err("%s: post event failed: %d\n", 806 dev_err(dapm->dev,
802 w->name, ret); 807 "%s: post event failed: %d\n",
808 w->name, ret);
803 } 809 }
804 } 810 }
805} 811}
@@ -880,8 +886,8 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
880 } 886 }
881 887
882 if (ret < 0) 888 if (ret < 0)
883 pr_err("Failed to apply widget power: %d\n", 889 dev_err(w->dapm->dev,
884 ret); 890 "Failed to apply widget power: %d\n", ret);
885 } 891 }
886 892
887 if (!list_empty(&pending)) 893 if (!list_empty(&pending))
@@ -975,7 +981,8 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
975 ret = snd_soc_dapm_set_bias_level(card, dapm, 981 ret = snd_soc_dapm_set_bias_level(card, dapm,
976 SND_SOC_BIAS_STANDBY); 982 SND_SOC_BIAS_STANDBY);
977 if (ret != 0) 983 if (ret != 0)
978 pr_err("Failed to turn on bias: %d\n", ret); 984 dev_err(dapm->dev,
985 "Failed to turn on bias: %d\n", ret);
979 } 986 }
980 987
981 /* If we're changing to all on or all off then prepare */ 988 /* 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)
983 (!sys_power && dapm->bias_level == SND_SOC_BIAS_ON)) { 990 (!sys_power && dapm->bias_level == SND_SOC_BIAS_ON)) {
984 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_PREPARE); 991 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_PREPARE);
985 if (ret != 0) 992 if (ret != 0)
986 pr_err("Failed to prepare bias: %d\n", ret); 993 dev_err(dapm->dev,
994 "Failed to prepare bias: %d\n", ret);
987 } 995 }
988 996
989 /* Power down widgets first; try to avoid amplifying pops. */ 997 /* 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)
996 if (dapm->bias_level == SND_SOC_BIAS_PREPARE && !sys_power) { 1004 if (dapm->bias_level == SND_SOC_BIAS_PREPARE && !sys_power) {
997 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_STANDBY); 1005 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_STANDBY);
998 if (ret != 0) 1006 if (ret != 0)
999 pr_err("Failed to apply standby bias: %d\n", ret); 1007 dev_err(dapm->dev,
1008 "Failed to apply standby bias: %d\n", ret);
1000 } 1009 }
1001 1010
1002 /* If we're in standby and can support bias off then do that */ 1011 /* 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)
1004 dapm->idle_bias_off) { 1013 dapm->idle_bias_off) {
1005 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_OFF); 1014 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_OFF);
1006 if (ret != 0) 1015 if (ret != 0)
1007 pr_err("Failed to turn off bias: %d\n", ret); 1016 dev_err(dapm->dev,
1017 "Failed to turn off bias: %d\n", ret);
1008 } 1018 }
1009 1019
1010 /* If we just powered up then move to active bias */ 1020 /* If we just powered up then move to active bias */
1011 if (dapm->bias_level == SND_SOC_BIAS_PREPARE && sys_power) { 1021 if (dapm->bias_level == SND_SOC_BIAS_PREPARE && sys_power) {
1012 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_ON); 1022 ret = snd_soc_dapm_set_bias_level(card, dapm, SND_SOC_BIAS_ON);
1013 if (ret != 0) 1023 if (ret != 0)
1014 pr_err("Failed to apply active bias: %d\n", ret); 1024 dev_err(dapm->dev,
1025 "Failed to apply active bias: %d\n", ret);
1015 } 1026 }
1016 1027
1017 pop_dbg(card->pop_time, "DAPM sequencing finished, waiting %dms\n", 1028 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)
1111 dapm->debugfs_dapm, w, 1122 dapm->debugfs_dapm, w,
1112 &dapm_widget_power_fops); 1123 &dapm_widget_power_fops);
1113 if (!d) 1124 if (!d)
1114 printk(KERN_WARNING 1125 dev_warn(w->dapm->dev,
1115 "ASoC: Failed to create %s debugfs file\n", 1126 "ASoC: Failed to create %s debugfs file\n",
1116 w->name); 1127 w->name);
1117 } 1128 }
1118} 1129}
1119#else 1130#else
@@ -1279,7 +1290,8 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
1279 1290
1280 list_for_each_entry(w, &dapm->widgets, list) { 1291 list_for_each_entry(w, &dapm->widgets, list) {
1281 if (!strcmp(w->name, pin)) { 1292 if (!strcmp(w->name, pin)) {
1282 pr_debug("dapm: %s: pin %s\n", dapm->codec->name, pin); 1293 dev_dbg(w->dapm->dev, "dapm: pin %s = %d\n",
1294 pin, status);
1283 w->connected = status; 1295 w->connected = status;
1284 /* Allow disabling of forced pins */ 1296 /* Allow disabling of forced pins */
1285 if (status == 0) 1297 if (status == 0)
@@ -1288,8 +1300,7 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
1288 } 1300 }
1289 } 1301 }
1290 1302
1291 pr_err("dapm: %s: configuring unknown pin %s\n", 1303 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin);
1292 dapm->codec->name, pin);
1293 return -EINVAL; 1304 return -EINVAL;
1294} 1305}
1295 1306
@@ -1415,8 +1426,8 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
1415 return 0; 1426 return 0;
1416 1427
1417err: 1428err:
1418 printk(KERN_WARNING "asoc: no dapm match for %s --> %s --> %s\n", source, 1429 dev_warn(dapm->dev, "asoc: no dapm match for %s --> %s --> %s\n",
1419 control, sink); 1430 source, control, sink);
1420 kfree(path); 1431 kfree(path);
1421 return ret; 1432 return ret;
1422} 1433}
@@ -1442,9 +1453,8 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
1442 for (i = 0; i < num; i++) { 1453 for (i = 0; i < num; i++) {
1443 ret = snd_soc_dapm_add_route(dapm, route); 1454 ret = snd_soc_dapm_add_route(dapm, route);
1444 if (ret < 0) { 1455 if (ret < 0) {
1445 printk(KERN_ERR "Failed to add route %s->%s\n", 1456 dev_err(dapm->dev, "Failed to add route %s->%s\n",
1446 route->source, 1457 route->source, route->sink);
1447 route->sink);
1448 return ret; 1458 return ret;
1449 } 1459 }
1450 route++; 1460 route++;
@@ -1982,9 +1992,9 @@ int snd_soc_dapm_new_controls(struct snd_soc_dapm_context *dapm,
1982 for (i = 0; i < num; i++) { 1992 for (i = 0; i < num; i++) {
1983 ret = snd_soc_dapm_new_control(dapm, widget); 1993 ret = snd_soc_dapm_new_control(dapm, widget);
1984 if (ret < 0) { 1994 if (ret < 0) {
1985 printk(KERN_ERR 1995 dev_err(dapm->dev,
1986 "ASoC: Failed to create DAPM control %s: %d\n", 1996 "ASoC: Failed to create DAPM control %s: %d\n",
1987 widget->name, ret); 1997 widget->name, ret);
1988 return ret; 1998 return ret;
1989 } 1999 }
1990 widget++; 2000 widget++;
@@ -2002,8 +2012,8 @@ static void soc_dapm_stream_event(struct snd_soc_dapm_context *dapm,
2002 { 2012 {
2003 if (!w->sname) 2013 if (!w->sname)
2004 continue; 2014 continue;
2005 pr_debug("widget %s\n %s stream %s event %d\n", 2015 dev_dbg(w->dapm->dev, "widget %s\n %s stream %s event %d\n",
2006 w->name, w->sname, stream, event); 2016 w->name, w->sname, stream, event);
2007 if (strstr(w->sname, stream)) { 2017 if (strstr(w->sname, stream)) {
2008 switch(event) { 2018 switch(event) {
2009 case SND_SOC_DAPM_STREAM_START: 2019 case SND_SOC_DAPM_STREAM_START:
@@ -2085,15 +2095,15 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
2085 2095
2086 list_for_each_entry(w, &dapm->widgets, list) { 2096 list_for_each_entry(w, &dapm->widgets, list) {
2087 if (!strcmp(w->name, pin)) { 2097 if (!strcmp(w->name, pin)) {
2088 pr_debug("dapm: %s: pin %s\n", dapm->codec->name, pin); 2098 dev_dbg(w->dapm->dev,
2099 "dapm: force enable pin %s\n", pin);
2089 w->connected = 1; 2100 w->connected = 1;
2090 w->force = 1; 2101 w->force = 1;
2091 return 0; 2102 return 0;
2092 } 2103 }
2093 } 2104 }
2094 2105
2095 pr_err("dapm: %s: configuring unknown pin %s\n", 2106 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin);
2096 dapm->codec->name, pin);
2097 return -EINVAL; 2107 return -EINVAL;
2098} 2108}
2099EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin); 2109EXPORT_SYMBOL_GPL(snd_soc_dapm_force_enable_pin);
@@ -2180,7 +2190,7 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
2180 } 2190 }
2181 } 2191 }
2182 2192
2183 pr_err("Unknown DAPM pin: %s\n", pin); 2193 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin);
2184 return -EINVAL; 2194 return -EINVAL;
2185} 2195}
2186EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend); 2196EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend);