]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
ASoC: hdmi-codec: add .get_dai_id support
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Thu, 18 May 2017 01:40:20 +0000 (01:40 +0000)
committerMark Brown <broonie@kernel.org>
Wed, 24 May 2017 17:45:29 +0000 (18:45 +0100)
ALSA SoC needs to know connected DAI ID for probing.
It is not a big problem if device/driver was only for sound,
but getting DAI ID will be difficult if device includes both
Video/Sound, like HDMI.
To solve this issue, this patch adds new .get_dai_id callback
on hdmi_codec_ops

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
include/sound/hdmi-codec.h
sound/soc/codecs/hdmi-codec.c

index 915c4357945c27992aa3b7561ab705dedff082ad..9483c55f871b992b78e8059f70017848c3d2ad09 100644 (file)
 #ifndef __HDMI_CODEC_H__
 #define __HDMI_CODEC_H__
 
+#include <linux/of_graph.h>
 #include <linux/hdmi.h>
 #include <drm/drm_edid.h>
 #include <sound/asoundef.h>
+#include <sound/soc.h>
 #include <uapi/sound/asound.h>
 
 /*
@@ -87,6 +89,13 @@ struct hdmi_codec_ops {
         */
        int (*get_eld)(struct device *dev, void *data,
                       uint8_t *buf, size_t len);
+
+       /*
+        * Getting DAI ID
+        * Optional
+        */
+       int (*get_dai_id)(struct snd_soc_component *comment,
+                         struct device_node *endpoint);
 };
 
 /* HDMI codec initalization data */
index 8659b76b066abc68065a8bd16ffed0cca286c07c..6d05161b625dee2a7968d39482b6d837bc0321f7 100644 (file)
@@ -719,6 +719,18 @@ static const struct snd_soc_dai_driver hdmi_spdif_dai = {
        .pcm_new = hdmi_codec_pcm_new,
 };
 
+static int hdmi_of_xlate_dai_id(struct snd_soc_component *component,
+                                struct device_node *endpoint)
+{
+       struct hdmi_codec_priv *hcp = snd_soc_component_get_drvdata(component);
+       int ret = -ENOTSUPP; /* see snd_soc_get_dai_id() */
+
+       if (hcp->hcd.ops->get_dai_id)
+               ret = hcp->hcd.ops->get_dai_id(component, endpoint);
+
+       return ret;
+}
+
 static struct snd_soc_codec_driver hdmi_codec = {
        .component_driver = {
                .controls               = hdmi_controls,
@@ -727,6 +739,7 @@ static struct snd_soc_codec_driver hdmi_codec = {
                .num_dapm_widgets       = ARRAY_SIZE(hdmi_widgets),
                .dapm_routes            = hdmi_routes,
                .num_dapm_routes        = ARRAY_SIZE(hdmi_routes),
+               .of_xlate_dai_id        = hdmi_of_xlate_dai_id,
        },
 };