Commit beed78ae authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: rsnd: move HDMI information from ssi.c to core.c

Current driver is supporting HDMI output, and its information
are handled under ssi.c. But, it is stream information.
Let's move it from ssi.c to core.c.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 9328882e
...@@ -1005,6 +1005,29 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { ...@@ -1005,6 +1005,29 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = {
.prepare = rsnd_soc_dai_prepare, .prepare = rsnd_soc_dai_prepare,
}; };
static void rsnd_parse_connect_graph(struct rsnd_priv *priv,
struct rsnd_dai_stream *io,
struct device_node *endpoint)
{
struct device *dev = rsnd_priv_to_dev(priv);
struct device_node *remote_node = of_graph_get_remote_port_parent(endpoint);
if (!rsnd_io_to_mod_ssi(io))
return;
/* HDMI0 */
if (strstr(remote_node->full_name, "hdmi@fead0000")) {
rsnd_flags_set(io, RSND_STREAM_HDMI0);
dev_dbg(dev, "%s connected to HDMI0\n", io->name);
}
/* HDMI1 */
if (strstr(remote_node->full_name, "hdmi@feae0000")) {
rsnd_flags_set(io, RSND_STREAM_HDMI1);
dev_dbg(dev, "%s connected to HDMI1\n", io->name);
}
}
void rsnd_parse_connect_common(struct rsnd_dai *rdai, void rsnd_parse_connect_common(struct rsnd_dai *rdai,
struct rsnd_mod* (*mod_get)(struct rsnd_priv *priv, int id), struct rsnd_mod* (*mod_get)(struct rsnd_priv *priv, int id),
struct device_node *node, struct device_node *node,
...@@ -1177,7 +1200,12 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) ...@@ -1177,7 +1200,12 @@ static int rsnd_dai_probe(struct rsnd_priv *priv)
if (is_graph) { if (is_graph) {
for_each_endpoint_of_node(dai_node, dai_np) { for_each_endpoint_of_node(dai_node, dai_np) {
__rsnd_dai_probe(priv, dai_np, dai_i); __rsnd_dai_probe(priv, dai_np, dai_i);
rsnd_ssi_parse_hdmi_connection(priv, dai_np, dai_i); if (rsnd_is_gen3(priv)) {
struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i);
rsnd_parse_connect_graph(priv, &rdai->playback, dai_np);
rsnd_parse_connect_graph(priv, &rdai->capture, dai_np);
}
dai_i++; dai_i++;
} }
} else { } else {
......
...@@ -458,7 +458,13 @@ struct rsnd_dai_stream { ...@@ -458,7 +458,13 @@ struct rsnd_dai_stream {
struct rsnd_dai *rdai; struct rsnd_dai *rdai;
struct device *dmac_dev; /* for IPMMU */ struct device *dmac_dev; /* for IPMMU */
u32 parent_ssi_status; u32 parent_ssi_status;
u32 flags;
}; };
/* flags */
#define RSND_STREAM_HDMI0 (1 << 0) /* for HDMI0 */
#define RSND_STREAM_HDMI1 (1 << 1) /* for HDMI1 */
#define rsnd_io_to_mod(io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL) #define rsnd_io_to_mod(io, i) ((i) < RSND_MOD_MAX ? (io)->mod[(i)] : NULL)
#define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI) #define rsnd_io_to_mod_ssi(io) rsnd_io_to_mod((io), RSND_MOD_SSI)
#define rsnd_io_to_mod_ssiu(io) rsnd_io_to_mod((io), RSND_MOD_SSIU) #define rsnd_io_to_mod_ssiu(io) rsnd_io_to_mod((io), RSND_MOD_SSIU)
...@@ -718,13 +724,6 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io); ...@@ -718,13 +724,6 @@ int rsnd_ssi_use_busif(struct rsnd_dai_stream *io);
int rsnd_ssi_get_busif(struct rsnd_dai_stream *io); int rsnd_ssi_get_busif(struct rsnd_dai_stream *io);
u32 rsnd_ssi_multi_slaves_runtime(struct rsnd_dai_stream *io); u32 rsnd_ssi_multi_slaves_runtime(struct rsnd_dai_stream *io);
#define RSND_SSI_HDMI_PORT0 0xf0
#define RSND_SSI_HDMI_PORT1 0xf1
int rsnd_ssi_hdmi_port(struct rsnd_dai_stream *io);
void rsnd_ssi_parse_hdmi_connection(struct rsnd_priv *priv,
struct device_node *endpoint,
int dai_i);
#define rsnd_ssi_is_pin_sharing(io) \ #define rsnd_ssi_is_pin_sharing(io) \
__rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io)) __rsnd_ssi_is_pin_sharing(rsnd_io_to_mod_ssi(io))
int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod); int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod);
......
...@@ -99,9 +99,7 @@ struct rsnd_ssi { ...@@ -99,9 +99,7 @@ struct rsnd_ssi {
/* flags */ /* flags */
#define RSND_SSI_CLK_PIN_SHARE (1 << 0) #define RSND_SSI_CLK_PIN_SHARE (1 << 0)
#define RSND_SSI_NO_BUSIF (1 << 1) /* SSI+DMA without BUSIF */ #define RSND_SSI_NO_BUSIF (1 << 1) /* SSI+DMA without BUSIF */
#define RSND_SSI_HDMI0 (1 << 2) /* for HDMI0 */ #define RSND_SSI_PROBED (1 << 2)
#define RSND_SSI_HDMI1 (1 << 3) /* for HDMI1 */
#define RSND_SSI_PROBED (1 << 4)
#define for_each_rsnd_ssi(pos, priv, i) \ #define for_each_rsnd_ssi(pos, priv, i) \
for (i = 0; \ for (i = 0; \
...@@ -119,20 +117,6 @@ struct rsnd_ssi { ...@@ -119,20 +117,6 @@ struct rsnd_ssi {
(rsnd_ssi_run_mods(io) & (1 << rsnd_mod_id(mod))) (rsnd_ssi_run_mods(io) & (1 << rsnd_mod_id(mod)))
#define rsnd_ssi_can_output_clk(mod) (!__rsnd_ssi_is_pin_sharing(mod)) #define rsnd_ssi_can_output_clk(mod) (!__rsnd_ssi_is_pin_sharing(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_flags_has(ssi, RSND_SSI_HDMI0))
return RSND_SSI_HDMI_PORT0;
if (rsnd_flags_has(ssi, RSND_SSI_HDMI1))
return RSND_SSI_HDMI_PORT1;
return 0;
}
int rsnd_ssi_use_busif(struct rsnd_dai_stream *io) int rsnd_ssi_use_busif(struct rsnd_dai_stream *io)
{ {
struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io); struct rsnd_mod *mod = rsnd_io_to_mod_ssi(io);
...@@ -1059,48 +1043,6 @@ void rsnd_parse_connect_ssi(struct rsnd_dai *rdai, ...@@ -1059,48 +1043,6 @@ void rsnd_parse_connect_ssi(struct rsnd_dai *rdai,
of_node_put(node); 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;
struct device_node *remote_node = of_graph_get_port_parent(remote_ep);
/* support Gen3 only */
if (!rsnd_is_gen3(priv))
return;
if (!mod)
return;
ssi = rsnd_mod_to_ssi(mod);
/* HDMI0 */
if (strstr(remote_node->full_name, "hdmi@fead0000")) {
rsnd_flags_set(ssi, RSND_SSI_HDMI0);
dev_dbg(dev, "%s connected to HDMI0\n", rsnd_mod_name(mod));
}
/* HDMI1 */
if (strstr(remote_node->full_name, "hdmi@feae0000")) {
rsnd_flags_set(ssi, RSND_SSI_HDMI1);
dev_dbg(dev, "%s connected to HDMI1\n", rsnd_mod_name(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 = of_graph_get_remote_endpoint(endpoint);
__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) struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id)
{ {
if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv))) if (WARN_ON(id < 0 || id >= rsnd_ssi_nr(priv)))
......
...@@ -135,7 +135,8 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, ...@@ -135,7 +135,8 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
struct rsnd_priv *priv) struct rsnd_priv *priv)
{ {
struct rsnd_ssiu *ssiu = rsnd_mod_to_ssiu(mod); struct rsnd_ssiu *ssiu = rsnd_mod_to_ssiu(mod);
int hdmi = rsnd_ssi_hdmi_port(io); u32 has_hdmi0 = rsnd_flags_has(io, RSND_STREAM_HDMI0);
u32 has_hdmi1 = rsnd_flags_has(io, RSND_STREAM_HDMI1);
int ret; int ret;
u32 mode = 0; u32 mode = 0;
...@@ -212,7 +213,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, ...@@ -212,7 +213,7 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
} }
} }
if (hdmi) { if (has_hdmi0 || has_hdmi1) {
enum rsnd_mod_type rsnd_ssi_array[] = { enum rsnd_mod_type rsnd_ssi_array[] = {
RSND_MOD_SSIM1, RSND_MOD_SSIM1,
RSND_MOD_SSIM2, RSND_MOD_SSIM2,
...@@ -238,14 +239,10 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod, ...@@ -238,14 +239,10 @@ static int rsnd_ssiu_init_gen2(struct rsnd_mod *mod,
rsnd_mod_id(pos) << shift; rsnd_mod_id(pos) << shift;
} }
switch (hdmi) { if (has_hdmi0)
case RSND_SSI_HDMI_PORT0:
rsnd_mod_write(mod, HDMI0_SEL, val); rsnd_mod_write(mod, HDMI0_SEL, val);
break; if (has_hdmi1)
case RSND_SSI_HDMI_PORT1:
rsnd_mod_write(mod, HDMI1_SEL, val); rsnd_mod_write(mod, HDMI1_SEL, val);
break;
}
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment