From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> To: Mark Brown <broonie@kernel.org> Cc: Linux-ALSA <alsa-devel@alsa-project.org>, Simon <horms@verge.net.au>, <linux-renesas-soc@vger.kernel.org> Subject: [PATCH 1/3] ASoC: rsnd: add support graph base DT phase 1 Date: Thu, 18 May 2017 01:27:48 +0000 [thread overview] Message-ID: <87inkzot58.wl%kuninori.morimoto.gx@renesas.com> (raw) In-Reply-To: <87k25fot6a.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> To enable OF-graph base DT on rsnd driver, and to keep compatible previous normal sound card style, it need to support both "rcar_sound,dai" and "ports" (or "port") on DT. This patch modify rsnd_dai_of_node() to parse "rcar_sound,dai" and "ports" (or "port") as phase 1. It can detect graph base style, but do nothing at this point. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> --- sound/soc/sh/rcar/core.c | 39 ++++++++++++++++++++++++++++++++++++++- sound/soc/sh/rcar/rsnd.h | 2 +- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 33e8f85..95390b3 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -825,6 +825,42 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai, of_node_put(node); } +static struct device_node *rsnd_dai_of_node(struct rsnd_priv *priv, + int *is_graph) +{ + struct device *dev = rsnd_priv_to_dev(priv); + struct device_node *np = dev->of_node; + struct device_node *dai_node; + struct device_node *ret; + + *is_graph = 0; + + /* + * parse both previous dai (= rcar_sound,dai), and + * graph dai (= ports/port) + */ + dai_node = of_get_child_by_name(np, RSND_NODE_DAI); + if (dai_node) { + ret = dai_node; + goto of_node_compatible; + } + + ret = np; + + dai_node = of_graph_get_next_endpoint(np, NULL); + if (dai_node) + goto of_node_graph; + + return NULL; + +of_node_graph: + *is_graph = 1; +of_node_compatible: + of_node_put(dai_node); + + return ret; +} + static int rsnd_dai_probe(struct rsnd_priv *priv) { struct device_node *dai_node; @@ -836,9 +872,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) struct rsnd_dai *rdai; struct device *dev = rsnd_priv_to_dev(priv); int nr, dai_i, io_i; + int is_graph; int ret; - dai_node = rsnd_dai_of_node(priv); + dai_node = rsnd_dai_of_node(priv, &is_graph); nr = of_get_child_count(dai_node); if (!nr) { ret = -EINVAL; diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index d0b969c..b6299dc 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -18,6 +18,7 @@ #include <linux/list.h> #include <linux/module.h> #include <linux/of_device.h> +#include <linux/of_graph.h> #include <linux/of_irq.h> #include <linux/sh_dma.h> #include <linux/workqueue.h> @@ -477,7 +478,6 @@ struct rsnd_dai { int rsnd_dai_connect(struct rsnd_mod *mod, struct rsnd_dai_stream *io, enum rsnd_mod_type type); -#define rsnd_dai_of_node(priv) rsnd_parse_of_node(priv, RSND_NODE_DAI) /* * R-Car Gen1/Gen2 -- 1.9.1
WARNING: multiple messages have this Message-ID (diff)
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> To: Mark Brown <broonie@kernel.org> Cc: Linux-ALSA <alsa-devel@alsa-project.org>, Simon <horms@verge.net.au>, linux-renesas-soc@vger.kernel.org Subject: [PATCH 1/3] ASoC: rsnd: add support graph base DT phase 1 Date: Thu, 18 May 2017 01:27:48 +0000 [thread overview] Message-ID: <87inkzot58.wl%kuninori.morimoto.gx@renesas.com> (raw) In-Reply-To: <87k25fot6a.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> To enable OF-graph base DT on rsnd driver, and to keep compatible previous normal sound card style, it need to support both "rcar_sound,dai" and "ports" (or "port") on DT. This patch modify rsnd_dai_of_node() to parse "rcar_sound,dai" and "ports" (or "port") as phase 1. It can detect graph base style, but do nothing at this point. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> --- sound/soc/sh/rcar/core.c | 39 ++++++++++++++++++++++++++++++++++++++- sound/soc/sh/rcar/rsnd.h | 2 +- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 33e8f85..95390b3 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -825,6 +825,42 @@ void rsnd_parse_connect_common(struct rsnd_dai *rdai, of_node_put(node); } +static struct device_node *rsnd_dai_of_node(struct rsnd_priv *priv, + int *is_graph) +{ + struct device *dev = rsnd_priv_to_dev(priv); + struct device_node *np = dev->of_node; + struct device_node *dai_node; + struct device_node *ret; + + *is_graph = 0; + + /* + * parse both previous dai (= rcar_sound,dai), and + * graph dai (= ports/port) + */ + dai_node = of_get_child_by_name(np, RSND_NODE_DAI); + if (dai_node) { + ret = dai_node; + goto of_node_compatible; + } + + ret = np; + + dai_node = of_graph_get_next_endpoint(np, NULL); + if (dai_node) + goto of_node_graph; + + return NULL; + +of_node_graph: + *is_graph = 1; +of_node_compatible: + of_node_put(dai_node); + + return ret; +} + static int rsnd_dai_probe(struct rsnd_priv *priv) { struct device_node *dai_node; @@ -836,9 +872,10 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) struct rsnd_dai *rdai; struct device *dev = rsnd_priv_to_dev(priv); int nr, dai_i, io_i; + int is_graph; int ret; - dai_node = rsnd_dai_of_node(priv); + dai_node = rsnd_dai_of_node(priv, &is_graph); nr = of_get_child_count(dai_node); if (!nr) { ret = -EINVAL; diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index d0b969c..b6299dc 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -18,6 +18,7 @@ #include <linux/list.h> #include <linux/module.h> #include <linux/of_device.h> +#include <linux/of_graph.h> #include <linux/of_irq.h> #include <linux/sh_dma.h> #include <linux/workqueue.h> @@ -477,7 +478,6 @@ struct rsnd_dai { int rsnd_dai_connect(struct rsnd_mod *mod, struct rsnd_dai_stream *io, enum rsnd_mod_type type); -#define rsnd_dai_of_node(priv) rsnd_parse_of_node(priv, RSND_NODE_DAI) /* * R-Car Gen1/Gen2 -- 1.9.1
next prev parent reply other threads:[~2017-05-18 1:27 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2017-05-18 1:27 [PATCH 0/3] ASoC: rsnd: HDMI sound support Kuninori Morimoto 2017-05-18 1:27 ` Kuninori Morimoto 2017-05-18 1:27 ` Kuninori Morimoto [this message] 2017-05-18 1:27 ` [PATCH 1/3] ASoC: rsnd: add support graph base DT phase 1 Kuninori Morimoto 2017-05-19 17:37 ` Applied "ASoC: rsnd: add support graph base DT phase 1" to the asoc tree Mark Brown 2017-05-19 17:37 ` Mark Brown 2017-05-18 1:28 ` [PATCH 2/3] ASoC: rsnd: add support graph base DT phase 2 Kuninori Morimoto 2017-05-18 1:28 ` Kuninori Morimoto 2017-05-19 17:37 ` Applied "ASoC: rsnd: add support graph base DT phase 2" to the asoc tree Mark Brown 2017-05-19 17:37 ` Mark Brown 2017-05-18 1:28 ` [PATCH 3/3] ASoC: rsnd: add HDMI output support Kuninori Morimoto 2017-05-18 1:28 ` Kuninori Morimoto 2017-05-19 17:37 ` Applied "ASoC: rsnd: add HDMI output support" to the asoc tree Mark Brown 2017-05-19 17:37 ` Mark Brown
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=87inkzot58.wl%kuninori.morimoto.gx@renesas.com \ --to=kuninori.morimoto.gx@renesas.com \ --cc=alsa-devel@alsa-project.org \ --cc=broonie@kernel.org \ --cc=horms@verge.net.au \ --cc=linux-renesas-soc@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.