ASoC: Fix SND_SOC_DAPM_LINE handling
authorPeter Ujfalusi <peter.ujfalusi@nokia.com>
Wed, 30 Sep 2009 06:27:24 +0000 (09:27 +0300)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 2 Oct 2009 10:23:21 +0000 (11:23 +0100)
Since the SND_SOC_DAPM_LINE can be input or output, additional check is
needed in order to determine if the widget is connected as input or
output.
When checking for connected outputs, if the widget is line, than check
if the sources list is not empty (line is connected as output)
For input endpoint check, when the widget is line, also check if the
sinks list is not empty (line is connected as input).

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
sound/soc/soc-dapm.c

index f79711b..8de6f9d 100644 (file)
@@ -524,7 +524,7 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget)
 
                /* connected jack or spk ? */
                if (widget->id == snd_soc_dapm_hp || widget->id == snd_soc_dapm_spk ||
-                       widget->id == snd_soc_dapm_line)
+                   (widget->id == snd_soc_dapm_line && !list_empty(&widget->sources)))
                        return 1;
        }
 
@@ -573,7 +573,8 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget)
                        return 1;
 
                /* connected jack ? */
-               if (widget->id == snd_soc_dapm_mic || widget->id == snd_soc_dapm_line)
+               if (widget->id == snd_soc_dapm_mic ||
+                   (widget->id == snd_soc_dapm_line && !list_empty(&widget->sinks)))
                        return 1;
        }