[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <878tlvosk9.wl%kuninori.morimoto.gx@renesas.com>
Date: Thu, 18 May 2017 01:40:20 +0000
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
To: Mark Brown <broonie@...nel.org>,
Archit Taneja <architt@...eaurora.org>
CC: Linux-ALSA <alsa-devel@...a-project.org>,
Simon <horms@...ge.net.au>, <linux-renesas-soc@...r.kernel.org>,
David Airlie <airlied@...ux.ie>,
Laurent Pinchart <laurent.pinchart+renesas@...asonboard.com>,
Russell King <rmk+kernel@...linux.org.uk>,
Jose Abreu <joabreu@...opsys.com>,
<dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH 4/5] ASoC: hdmi-codec: add .get_dai_id support
From: Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>
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@...esas.com>
---
include/sound/hdmi-codec.h | 9 +++++++++
sound/soc/codecs/hdmi-codec.c | 13 +++++++++++++
2 files changed, 22 insertions(+)
diff --git a/include/sound/hdmi-codec.h b/include/sound/hdmi-codec.h
index 915c435..9483c55 100644
--- a/include/sound/hdmi-codec.h
+++ b/include/sound/hdmi-codec.h
@@ -18,9 +18,11 @@
#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 */
diff --git a/sound/soc/codecs/hdmi-codec.c b/sound/soc/codecs/hdmi-codec.c
index 8659b76..6d05161 100644
--- a/sound/soc/codecs/hdmi-codec.c
+++ b/sound/soc/codecs/hdmi-codec.c
@@ -719,6 +719,18 @@ static int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
.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 int hdmi_codec_pcm_new(struct snd_soc_pcm_runtime *rtd,
.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,
},
};
--
1.9.1
Powered by blists - more mailing lists