drm: dw-hdmi-i2s: add .get_dai_id callback for ALSA SoC
[linux-2.6-microblaze.git] / drivers / gpu / drm / bridge / synopsys / dw-hdmi-i2s-audio.c
index aaf287d..b2cf59f 100644 (file)
@@ -82,9 +82,30 @@ static void dw_hdmi_i2s_audio_shutdown(struct device *dev, void *data)
        hdmi_write(audio, HDMI_AUD_CONF0_SW_RESET, HDMI_AUD_CONF0);
 }
 
+static int dw_hdmi_i2s_get_dai_id(struct snd_soc_component *component,
+                                 struct device_node *endpoint)
+{
+       struct of_endpoint of_ep;
+       int ret;
+
+       ret = of_graph_parse_endpoint(endpoint, &of_ep);
+       if (ret < 0)
+               return ret;
+
+       /*
+        * HDMI sound should be located as reg = <2>
+        * Then, it is sound port 0
+        */
+       if (of_ep.port == 2)
+               return 0;
+
+       return -EINVAL;
+}
+
 static struct hdmi_codec_ops dw_hdmi_i2s_ops = {
        .hw_params      = dw_hdmi_i2s_hw_params,
        .audio_shutdown = dw_hdmi_i2s_audio_shutdown,
+       .get_dai_id     = dw_hdmi_i2s_get_dai_id,
 };
 
 static int snd_dw_hdmi_probe(struct platform_device *pdev)