aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2015-02-04 15:57:04 -0500
committerMark Brown <broonie@kernel.org>2015-02-04 15:57:04 -0500
commitb47f8a5dfb4fcc906d93c42a22f050d69df96ea6 (patch)
tree4cca1bae26ab7fc6df207c14909f6d98f4e5dd0e
parentd01aa9b704afa8875c2ae919cfd639660b2a26bc (diff)
parentfcf6c5ea7abd42cfc2dde0ff0451b209951de9b4 (diff)
Merge remote-tracking branch 'asoc/topic/dapm' into asoc-next
-rw-r--r--include/sound/soc-dapm.h1
-rw-r--r--sound/soc/soc-core.c3
-rw-r--r--sound/soc/soc-dapm.c109
3 files changed, 18 insertions, 95 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index e8e0220404d4..a2a0cf6e74fd 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -431,7 +431,6 @@ int snd_soc_dapm_force_enable_pin_unlocked(struct snd_soc_dapm_context *dapm,
431 const char *pin); 431 const char *pin);
432int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm, 432int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
433 const char *pin); 433 const char *pin);
434void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card);
435unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol); 434unsigned int dapm_kcontrol_get_value(const struct snd_kcontrol *kcontrol);
436 435
437/* Mostly internal - should not normally be used */ 436/* Mostly internal - should not normally be used */
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 4bd4d77d4ba8..c2f800bfa16b 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1636,9 +1636,6 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1636 } 1636 }
1637 } 1637 }
1638 1638
1639 if (card->fully_routed)
1640 snd_soc_dapm_auto_nc_pins(card);
1641
1642 snd_soc_dapm_new_widgets(card); 1639 snd_soc_dapm_new_widgets(card);
1643 1640
1644 ret = snd_card_register(card->snd_card); 1641 ret = snd_card_register(card->snd_card);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 6c5cf7d1ff54..ff0bce1a2d2c 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -517,8 +517,8 @@ static int soc_dapm_update_bits(struct snd_soc_dapm_context *dapm,
517{ 517{
518 if (!dapm->component) 518 if (!dapm->component)
519 return -EIO; 519 return -EIO;
520 return snd_soc_component_update_bits_async(dapm->component, reg, 520 return snd_soc_component_update_bits(dapm->component, reg,
521 mask, value); 521 mask, value);
522} 522}
523 523
524static int soc_dapm_test_bits(struct snd_soc_dapm_context *dapm, 524static int soc_dapm_test_bits(struct snd_soc_dapm_context *dapm,
@@ -2274,6 +2274,9 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w)
2274 2274
2275 switch (w->id) { 2275 switch (w->id) {
2276 case snd_soc_dapm_input: 2276 case snd_soc_dapm_input:
2277 /* On a fully routed card a input is never a source */
2278 if (w->dapm->card->fully_routed)
2279 break;
2277 w->is_source = 1; 2280 w->is_source = 1;
2278 list_for_each_entry(p, &w->sources, list_sink) { 2281 list_for_each_entry(p, &w->sources, list_sink) {
2279 if (p->source->id == snd_soc_dapm_micbias || 2282 if (p->source->id == snd_soc_dapm_micbias ||
@@ -2286,6 +2289,9 @@ static void dapm_update_widget_flags(struct snd_soc_dapm_widget *w)
2286 } 2289 }
2287 break; 2290 break;
2288 case snd_soc_dapm_output: 2291 case snd_soc_dapm_output:
2292 /* On a fully routed card a output is never a sink */
2293 if (w->dapm->card->fully_routed)
2294 break;
2289 w->is_sink = 1; 2295 w->is_sink = 1;
2290 list_for_each_entry(p, &w->sinks, list_source) { 2296 list_for_each_entry(p, &w->sinks, list_source) {
2291 if (p->sink->id == snd_soc_dapm_spk || 2297 if (p->sink->id == snd_soc_dapm_spk ||
@@ -3080,16 +3086,24 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3080 3086
3081 switch (w->id) { 3087 switch (w->id) {
3082 case snd_soc_dapm_mic: 3088 case snd_soc_dapm_mic:
3083 case snd_soc_dapm_input:
3084 w->is_source = 1; 3089 w->is_source = 1;
3085 w->power_check = dapm_generic_check_power; 3090 w->power_check = dapm_generic_check_power;
3086 break; 3091 break;
3092 case snd_soc_dapm_input:
3093 if (!dapm->card->fully_routed)
3094 w->is_source = 1;
3095 w->power_check = dapm_generic_check_power;
3096 break;
3087 case snd_soc_dapm_spk: 3097 case snd_soc_dapm_spk:
3088 case snd_soc_dapm_hp: 3098 case snd_soc_dapm_hp:
3089 case snd_soc_dapm_output:
3090 w->is_sink = 1; 3099 w->is_sink = 1;
3091 w->power_check = dapm_generic_check_power; 3100 w->power_check = dapm_generic_check_power;
3092 break; 3101 break;
3102 case snd_soc_dapm_output:
3103 if (!dapm->card->fully_routed)
3104 w->is_sink = 1;
3105 w->power_check = dapm_generic_check_power;
3106 break;
3093 case snd_soc_dapm_vmid: 3107 case snd_soc_dapm_vmid:
3094 case snd_soc_dapm_siggen: 3108 case snd_soc_dapm_siggen:
3095 w->is_source = 1; 3109 w->is_source = 1;
@@ -3804,93 +3818,6 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
3804EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend); 3818EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend);
3805 3819
3806/** 3820/**
3807 * dapm_is_external_path() - Checks if a path is a external path
3808 * @card: The card the path belongs to
3809 * @path: The path to check
3810 *
3811 * Returns true if the path is either between two different DAPM contexts or
3812 * between two external pins of the same DAPM context. Otherwise returns
3813 * false.
3814 */
3815static bool dapm_is_external_path(struct snd_soc_card *card,
3816 struct snd_soc_dapm_path *path)
3817{
3818 dev_dbg(card->dev,
3819 "... Path %s(id:%d dapm:%p) - %s(id:%d dapm:%p)\n",
3820 path->source->name, path->source->id, path->source->dapm,
3821 path->sink->name, path->sink->id, path->sink->dapm);
3822
3823 /* Connection between two different DAPM contexts */
3824 if (path->source->dapm != path->sink->dapm)
3825 return true;
3826
3827 /* Loopback connection from external pin to external pin */
3828 if (path->sink->id == snd_soc_dapm_input) {
3829 switch (path->source->id) {
3830 case snd_soc_dapm_output:
3831 case snd_soc_dapm_micbias:
3832 return true;
3833 default:
3834 break;
3835 }
3836 }
3837
3838 return false;
3839}
3840
3841static bool snd_soc_dapm_widget_in_card_paths(struct snd_soc_card *card,
3842 struct snd_soc_dapm_widget *w)
3843{
3844 struct snd_soc_dapm_path *p;
3845
3846 list_for_each_entry(p, &w->sources, list_sink) {
3847 if (dapm_is_external_path(card, p))
3848 return true;
3849 }
3850
3851 list_for_each_entry(p, &w->sinks, list_source) {
3852 if (dapm_is_external_path(card, p))
3853 return true;
3854 }
3855
3856 return false;
3857}
3858
3859/**
3860 * snd_soc_dapm_auto_nc_pins - call snd_soc_dapm_nc_pin for unused pins
3861 * @card: The card whose pins should be processed
3862 *
3863 * Automatically call snd_soc_dapm_nc_pin() for any external pins in the card
3864 * which are unused. Pins are used if they are connected externally to a
3865 * component, whether that be to some other device, or a loop-back connection to
3866 * the component itself.
3867 */
3868void snd_soc_dapm_auto_nc_pins(struct snd_soc_card *card)
3869{
3870 struct snd_soc_dapm_widget *w;
3871
3872 dev_dbg(card->dev, "ASoC: Auto NC: DAPMs: card:%p\n", &card->dapm);
3873
3874 list_for_each_entry(w, &card->widgets, list) {
3875 switch (w->id) {
3876 case snd_soc_dapm_input:
3877 case snd_soc_dapm_output:
3878 case snd_soc_dapm_micbias:
3879 dev_dbg(card->dev, "ASoC: Auto NC: Checking widget %s\n",
3880 w->name);
3881 if (!snd_soc_dapm_widget_in_card_paths(card, w)) {
3882 dev_dbg(card->dev,
3883 "... Not in map; disabling\n");
3884 snd_soc_dapm_nc_pin(w->dapm, w->name);
3885 }
3886 break;
3887 default:
3888 break;
3889 }
3890 }
3891}
3892
3893/**
3894 * snd_soc_dapm_free - free dapm resources 3821 * snd_soc_dapm_free - free dapm resources
3895 * @dapm: DAPM context 3822 * @dapm: DAPM context
3896 * 3823 *