diff options
-rw-r--r-- | sound/soc/soc-dapm.c | 44 |
1 files changed, 26 insertions, 18 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index e8997bb97890..450307ccaf68 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c | |||
@@ -91,17 +91,24 @@ static void pop_wait(u32 pop_time) | |||
91 | schedule_timeout_uninterruptible(msecs_to_jiffies(pop_time)); | 91 | schedule_timeout_uninterruptible(msecs_to_jiffies(pop_time)); |
92 | } | 92 | } |
93 | 93 | ||
94 | static void pop_dbg(u32 pop_time, const char *fmt, ...) | 94 | static void pop_dbg(struct device *dev, u32 pop_time, const char *fmt, ...) |
95 | { | 95 | { |
96 | va_list args; | 96 | va_list args; |
97 | char *buf; | ||
97 | 98 | ||
98 | va_start(args, fmt); | 99 | if (!pop_time) |
100 | return; | ||
99 | 101 | ||
100 | if (pop_time) { | 102 | buf = kmalloc(PAGE_SIZE, GFP_KERNEL); |
101 | vprintk(fmt, args); | 103 | if (buf == NULL) |
102 | } | 104 | return; |
103 | 105 | ||
106 | va_start(args, fmt); | ||
107 | vsnprintf(buf, PAGE_SIZE, fmt, args); | ||
108 | dev_info(dev, buf); | ||
104 | va_end(args); | 109 | va_end(args); |
110 | |||
111 | kfree(buf); | ||
105 | } | 112 | } |
106 | 113 | ||
107 | /* create a new dapm widget */ | 114 | /* create a new dapm widget */ |
@@ -313,7 +320,8 @@ static int dapm_update_bits(struct snd_soc_dapm_widget *widget) | |||
313 | 320 | ||
314 | change = old != new; | 321 | change = old != new; |
315 | if (change) { | 322 | if (change) { |
316 | pop_dbg(card->pop_time, "pop test %s : %s in %d ms\n", | 323 | pop_dbg(dapm->dev, card->pop_time, |
324 | "pop test %s : %s in %d ms\n", | ||
317 | widget->name, widget->power ? "on" : "off", | 325 | widget->name, widget->power ? "on" : "off", |
318 | card->pop_time); | 326 | card->pop_time); |
319 | pop_wait(card->pop_time); | 327 | pop_wait(card->pop_time); |
@@ -745,15 +753,15 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
745 | if (power) | 753 | if (power) |
746 | value |= cur_mask; | 754 | value |= cur_mask; |
747 | 755 | ||
748 | pop_dbg(card->pop_time, | 756 | pop_dbg(dapm->dev, card->pop_time, |
749 | "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", | 757 | "pop test : Queue %s: reg=0x%x, 0x%x/0x%x\n", |
750 | w->name, reg, value, mask); | 758 | w->name, reg, value, mask); |
751 | 759 | ||
752 | /* power up pre event */ | 760 | /* power up pre event */ |
753 | if (w->power && w->event && | 761 | if (w->power && w->event && |
754 | (w->event_flags & SND_SOC_DAPM_PRE_PMU)) { | 762 | (w->event_flags & SND_SOC_DAPM_PRE_PMU)) { |
755 | pop_dbg(card->pop_time, "pop test : %s PRE_PMU\n", | 763 | pop_dbg(dapm->dev, card->pop_time, |
756 | w->name); | 764 | "pop test : %s PRE_PMU\n", w->name); |
757 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU); | 765 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMU); |
758 | if (ret < 0) | 766 | if (ret < 0) |
759 | dev_err(dapm->dev, | 767 | dev_err(dapm->dev, |
@@ -764,8 +772,8 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
764 | /* power down pre event */ | 772 | /* power down pre event */ |
765 | if (!w->power && w->event && | 773 | if (!w->power && w->event && |
766 | (w->event_flags & SND_SOC_DAPM_PRE_PMD)) { | 774 | (w->event_flags & SND_SOC_DAPM_PRE_PMD)) { |
767 | pop_dbg(card->pop_time, "pop test : %s PRE_PMD\n", | 775 | pop_dbg(dapm->dev, card->pop_time, |
768 | w->name); | 776 | "pop test : %s PRE_PMD\n", w->name); |
769 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD); | 777 | ret = w->event(w, NULL, SND_SOC_DAPM_PRE_PMD); |
770 | if (ret < 0) | 778 | if (ret < 0) |
771 | dev_err(dapm->dev, | 779 | dev_err(dapm->dev, |
@@ -775,7 +783,7 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
775 | } | 783 | } |
776 | 784 | ||
777 | if (reg >= 0) { | 785 | if (reg >= 0) { |
778 | pop_dbg(card->pop_time, | 786 | pop_dbg(dapm->dev, card->pop_time, |
779 | "pop test : Applying 0x%x/0x%x to %x in %dms\n", | 787 | "pop test : Applying 0x%x/0x%x to %x in %dms\n", |
780 | value, mask, reg, card->pop_time); | 788 | value, mask, reg, card->pop_time); |
781 | pop_wait(card->pop_time); | 789 | pop_wait(card->pop_time); |
@@ -786,8 +794,8 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
786 | /* power up post event */ | 794 | /* power up post event */ |
787 | if (w->power && w->event && | 795 | if (w->power && w->event && |
788 | (w->event_flags & SND_SOC_DAPM_POST_PMU)) { | 796 | (w->event_flags & SND_SOC_DAPM_POST_PMU)) { |
789 | pop_dbg(card->pop_time, "pop test : %s POST_PMU\n", | 797 | pop_dbg(dapm->dev, card->pop_time, |
790 | w->name); | 798 | "pop test : %s POST_PMU\n", w->name); |
791 | ret = w->event(w, | 799 | ret = w->event(w, |
792 | NULL, SND_SOC_DAPM_POST_PMU); | 800 | NULL, SND_SOC_DAPM_POST_PMU); |
793 | if (ret < 0) | 801 | if (ret < 0) |
@@ -799,8 +807,8 @@ static void dapm_seq_run_coalesced(struct snd_soc_dapm_context *dapm, | |||
799 | /* power down post event */ | 807 | /* power down post event */ |
800 | if (!w->power && w->event && | 808 | if (!w->power && w->event && |
801 | (w->event_flags & SND_SOC_DAPM_POST_PMD)) { | 809 | (w->event_flags & SND_SOC_DAPM_POST_PMD)) { |
802 | pop_dbg(card->pop_time, "pop test : %s POST_PMD\n", | 810 | pop_dbg(dapm->dev, card->pop_time, |
803 | w->name); | 811 | "pop test : %s POST_PMD\n", w->name); |
804 | ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD); | 812 | ret = w->event(w, NULL, SND_SOC_DAPM_POST_PMD); |
805 | if (ret < 0) | 813 | if (ret < 0) |
806 | dev_err(dapm->dev, | 814 | dev_err(dapm->dev, |
@@ -1025,8 +1033,8 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event) | |||
1025 | "Failed to apply active bias: %d\n", ret); | 1033 | "Failed to apply active bias: %d\n", ret); |
1026 | } | 1034 | } |
1027 | 1035 | ||
1028 | pop_dbg(card->pop_time, "DAPM sequencing finished, waiting %dms\n", | 1036 | pop_dbg(dapm->dev, card->pop_time, |
1029 | card->pop_time); | 1037 | "DAPM sequencing finished, waiting %dms\n", card->pop_time); |
1030 | pop_wait(card->pop_time); | 1038 | pop_wait(card->pop_time); |
1031 | 1039 | ||
1032 | return 0; | 1040 | return 0; |