summaryrefslogtreecommitdiffstats
path: root/sound/soc/sh/rcar/ssi.c
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2017-05-18 01:28:22 +0000
committerMark Brown <broonie@kernel.org>2017-05-19 18:36:25 +0100
commit7fa72cca39a042228965a578b9249216082591e0 (patch)
treec1f63680540727418f6cc2703db22fdd6ffd1ca5 /sound/soc/sh/rcar/ssi.c
parent4d4b334bda47f1b7b57f7aca9bc19b7e317d764d (diff)
downloadop-kernel-dev-7fa72cca39a042228965a578b9249216082591e0.zip
op-kernel-dev-7fa72cca39a042228965a578b9249216082591e0.tar.gz
ASoC: rsnd: add HDMI output support
Renesas R-Car Gen3 can output HDMI sound if SSIU/SSI are connected to R-Car built-in HDMI device (R-Car Gen3 built-in HDMI device will be controlled by DRM/KMS driver). If SSIx was connected to HDMI0/1 on DT, SSI driver will detect it automatically by this patch. Note is that now Renesas R-Car sound driver is assuming that it is using OF-graph base simple card for HDMI sound. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sh/rcar/ssi.c')
-rw-r--r--sound/soc/sh/rcar/ssi.c58
1 files changed, 58 insertions, 0 deletions
diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 135c566..d0602c1 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -11,6 +11,7 @@
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*/
+#include <sound/simple_card_utils.h>
#include <linux/delay.h>
#include "rsnd.h"
#define RSND_SSI_NAME_SIZE 16
@@ -81,6 +82,8 @@ struct rsnd_ssi {
/* flags */
#define RSND_SSI_CLK_PIN_SHARE (1 << 0)
#define RSND_SSI_NO_BUSIF (1 << 1) /* SSI+DMA without BUSIF */
+#define RSND_SSI_HDMI0 (1 << 2) /* for HDMI0 */
+#define RSND_SSI_HDMI1 (1 << 3) /* for HDMI1 */
#define for_each_rsnd_ssi(pos, priv, i) \
for (i = 0; \
@@ -99,6 +102,20 @@ struct rsnd_ssi {
#define rsnd_ssi_is_run_mods(mod, io) \
(rsnd_ssi_run_mods(io) & (1 << rsnd_mod_id(mod)))
+int rsnd_ssi_hdmi_port(struct rsnd_dai_stream *io)
+{
+ struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io);
+ struct rsnd_ssi *ssi = rsnd_mod_to_ssi(mod);
+
+ if (rsnd_ssi_mode_flags(ssi) & RSND_SSI_HDMI0)
+ return RSND_SSI_HDMI_PORT0;
+
+ if (rsnd_ssi_mode_flags(ssi) & RSND_SSI_HDMI1)
+ return RSND_SSI_HDMI_PORT1;
+
+ return 0;
+}
+
int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
{
struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io);
@@ -835,6 +852,47 @@ void rsnd_parse_connect_ssi(struct rsnd_dai *rdai,
of_node_put(node);
}
+static void __rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv,
+ struct rsnd_dai_stream *io,
+ struct device_node *remote_ep)
+{
+ struct device *dev = rsnd_priv_to_dev(priv);
+ struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io);
+ struct rsnd_ssi *ssi;
+
+ if (!mod)
+ return;
+
+ ssi = rsnd_mod_to_ssi(mod);
+
+ if (strstr(remote_ep->full_name, "hdmi0")) {
+ ssi->flags |= RSND_SSI_HDMI0;
+ dev_dbg(dev, "%s[%d] connected to HDMI0\n",
+ rsnd_mod_name(mod), rsnd_mod_id(mod));
+ }
+
+ if (strstr(remote_ep->full_name, "hdmi1")) {
+ ssi->flags |= RSND_SSI_HDMI1;
+ dev_dbg(dev, "%s[%d] connected to HDMI1\n",
+ rsnd_mod_name(mod), rsnd_mod_id(mod));
+ }
+}
+
+void rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv,
+ struct device_node *endpoint,
+ int dai_i)
+{
+ struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
+ struct device_node *remote_ep;
+
+ remote_ep = of_graph_get_remote_endpoint(endpoint);
+ if (!remote_ep)
+ return;
+
+ __rsnd_ssi_parse_hdmi_connection(priv, &rdai->playback, remote_ep);
+ __rsnd_ssi_parse_hdmi_connection(priv, &rdai->capture, remote_ep);
+}
+
struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id)
{
if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv)))
OpenPOWER on IntegriCloud