All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jyri Sarha <jsarha@ti.com>
To: dri-devel@lists.freedesktop.org, airlied@linux.ie,
	linux-omap@vger.kernel.org, devicetree@vger.kernel.org,
	bcousson@baylibre.com, alsa-devel@alsa-project.org
Cc: peter.ujfalusi@ti.com, tony@atomide.com, broonie@kernel.org,
	Jyri Sarha <jsarha@ti.com>,
	liam.r.girdwood@linux.intel.com, tomi.valkeinen@ti.com,
	rmk+kernel@arm.linux.org.uk
Subject: [PATCH RFC v4 5/8] drm/i2c: tda998x: Remove include/sound/tda998x.h and fix graph parsing
Date: Fri, 18 Sep 2015 14:06:42 +0300	[thread overview]
Message-ID: <b038d2199507ecf286b76a60d697827b0e66afd1.1442572860.git.jsarha@ti.com> (raw)
In-Reply-To: <cover.1442572860.git.jsarha@ti.com>

Move struct tda998x_audio definition to tda998x_drv.c and remove
include/sound/tda998x.h. There is no external use for struct
tda998x_audio.

Fix graph parsing to allow ports to be inside a separate "ports"-node as
specified in Documentation/devicetree/bindings/graph.txt.

Signed-off-by: Jyri Sarha <jsarha@ti.com>
---
 drivers/gpu/drm/i2c/tda998x_drv.c | 59 +++++++++++++++++++++------------------
 include/sound/tda998x.h           |  8 ------
 2 files changed, 32 insertions(+), 35 deletions(-)
 delete mode 100644 include/sound/tda998x.h

diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c
index 0952eac..4dc2dc0 100644
--- a/drivers/gpu/drm/i2c/tda998x_drv.c
+++ b/drivers/gpu/drm/i2c/tda998x_drv.c
@@ -27,10 +27,14 @@
 #include <drm/drm_edid.h>
 #include <drm/drm_of.h>
 #include <drm/i2c/tda998x.h>
-#include <sound/tda998x.h>
 
 #define DBG(fmt, ...) DRM_DEBUG(fmt"\n", ##__VA_ARGS__)
 
+struct tda998x_audio {
+	u8 ports[2];			/* AP value */
+	u8 port_types[2];		/* AFMT_xxx */
+};
+
 struct tda998x_priv {
 	struct i2c_client *cec;
 	struct i2c_client *hdmi;
@@ -1240,9 +1244,10 @@ static int tda998x_parse_ports(struct tda998x_priv *priv,
 {
 	struct device_node *of_port;
 	const char *port_type;
-	int ret, audio_index, reg, afmt;
+	int ret, audio_index, reg, afmt, rgb_initialized;
 
 	audio_index = 0;
+	rgb_initialized = 0;
 	for_each_child_of_node(np, of_port) {
 		if (!of_port->name
 		 || of_node_cmp(of_port->name, "port") != 0)
@@ -1252,11 +1257,17 @@ static int tda998x_parse_ports(struct tda998x_priv *priv,
 		if (ret < 0)
 			continue;
 		ret = of_property_read_u32(of_port, "reg", &reg);
+		if (ret < 0) {
+			dev_err(&priv->hdmi->dev, "missing reg for %s\n",
+				port_type);
+			return ret;
+		}
 		if (strcmp(port_type, "rgb") == 0) {
 			if (!ret) {		/* video reg is optional */
 				priv->vip_cntrl_0 = reg >> 16;
 				priv->vip_cntrl_1 = reg >> 8;
 				priv->vip_cntrl_2 = reg;
+				rgb_initialized = 1;
 			}
 			continue;
 		}
@@ -1266,11 +1277,6 @@ static int tda998x_parse_ports(struct tda998x_priv *priv,
 			afmt = AFMT_SPDIF;
 		else
 			continue;
-		if (ret < 0) {
-			dev_err(&priv->hdmi->dev, "missing reg for %s\n",
-				port_type);
-			return ret;
-		}
 		if (audio_index >= ARRAY_SIZE(priv->audio.ports)) {
 			dev_err(&priv->hdmi->dev, "too many audio ports\n");
 			break;
@@ -1279,13 +1285,13 @@ static int tda998x_parse_ports(struct tda998x_priv *priv,
 		priv->audio.port_types[audio_index] = afmt;
 		audio_index++;
 	}
-	return 0;
+	return rgb_initialized;
 }
 
 static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
 {
 	struct device_node *np = client->dev.of_node;
-	struct device_node *of_port;
+	struct device_node *ports;
 	u32 video;
 	int rev_lo, rev_hi, ret;
 	unsigned short cec_addr;
@@ -1392,24 +1398,15 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
 
 	/* get the device tree parameters */
 	if (np) {
-		of_port = of_get_child_by_name(np, "port");
-		if (of_port) {				/* graph of ports */
-			of_node_put(of_port);
-			ret = tda998x_parse_ports(priv, np);
-			if (ret < 0)
-				goto fail;
-
-			/* initialize the default audio configuration */
-			if (priv->audio.ports[0]) {
-				priv->params.audio_cfg = priv->audio.ports[0];
-				priv->params.audio_format =
-						priv->audio.port_types[0];
-				priv->params.audio_clk_cfg =
-					priv->params.audio_format ==
-							AFMT_SPDIF ? 0 : 1;
-			}
-		} else {
-
+		ports = of_get_child_by_name(np, "ports");
+		if (!ports)
+			ports = of_node_get(np);
+		/* graph of ports */
+		ret = tda998x_parse_ports(priv, ports);
+		of_node_put(ports);
+		if (ret < 0)
+			goto fail;
+		if (ret == 0) {
 			/* optional video properties */
 			ret = of_property_read_u32(np, "video-ports", &video);
 			if (ret == 0) {
@@ -1418,6 +1415,14 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv)
 				priv->vip_cntrl_2 = video;
 			}
 		}
+		if (priv->audio.ports[0]) {
+			priv->params.audio_cfg = priv->audio.ports[0];
+			priv->params.audio_format =
+				priv->audio.port_types[0];
+			priv->params.audio_clk_cfg =
+				priv->params.audio_format ==
+				AFMT_SPDIF ? 0 : 1;
+		}
 	}
 
 	return 0;
diff --git a/include/sound/tda998x.h b/include/sound/tda998x.h
deleted file mode 100644
index bef1da7..0000000
--- a/include/sound/tda998x.h
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef SND_TDA998X_H
-#define SND_TDA998X_H
-
-struct tda998x_audio {
-	u8 ports[2];			/* AP value */
-	u8 port_types[2];		/* AFMT_xxx */
-};
-#endif
-- 
1.9.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

  parent reply	other threads:[~2015-09-18 11:06 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-18 11:06 [PATCH RFC v4 0/8] Implement generic ASoC HDMI codec and use it in tda998x Jyri Sarha
2015-09-18 11:06 ` [PATCH RFC v4 3/8] ASoC: hdmi-codec: Add hdmi-codec for external HDMI-encoders Jyri Sarha
     [not found]   ` <6fe9ab5dff972e6f228259d6818f3f481a11577d.1442572860.git.jsarha-l0cyMroinI0@public.gmane.org>
2015-09-19 17:54     ` Mark Brown
2015-09-21  9:31       ` Russell King - ARM Linux
2015-09-21 13:41         ` Jyri Sarha
2015-09-21 17:18           ` Mark Brown
     [not found] ` <cover.1442572860.git.jsarha-l0cyMroinI0@public.gmane.org>
2015-09-18 11:06   ` [PATCH RFC v4 1/8] ASoC: hdmi: Remove obsolete dummy HDMI codec Jyri Sarha
2015-09-18 11:06   ` [PATCH RFC v4 2/8] ALSA: pcm: add IEC958 channel status helper for hw_params Jyri Sarha
     [not found]     ` <a7b69fb075b0ae993846cfb65abb20ecab5c9805.1442572860.git.jsarha-l0cyMroinI0@public.gmane.org>
2015-09-19 17:46       ` Mark Brown
2015-09-21  9:37     ` Russell King - ARM Linux
2015-09-21 14:39       ` Jyri Sarha
2015-09-21 15:08         ` Clemens Ladisch
2015-09-21 17:25           ` Jyri Sarha
2015-09-18 11:06   ` [PATCH RFC v4 4/8] drm/i2c: tda998x: Add support of a DT graph of ports Jyri Sarha
     [not found]     ` <e9ebb04f781fef7cff99190d301fb64805b97d39.1442572860.git.jsarha-l0cyMroinI0@public.gmane.org>
2015-09-21 15:19       ` Rob Herring
2015-09-24 10:36         ` Jean-Francois Moine
2015-09-24 16:29           ` Rob Herring
2015-09-18 11:06   ` [PATCH RFC v4 6/8] drm/i2c: tda998x: Improve tda998x_configure_audio() audio related pdata Jyri Sarha
2015-09-18 11:06 ` Jyri Sarha [this message]
2015-09-18 11:06 ` [PATCH RFC v4 7/8] drm/i2c: tda998x: Register ASoC HDMI codec for audio functionality Jyri Sarha
2015-09-18 11:06 ` [PATCH RFC v4 8/8] ARM: dts: am335x-boneblack: Add HDMI audio support Jyri Sarha

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=b038d2199507ecf286b76a60d697827b0e66afd1.1442572860.git.jsarha@ti.com \
    --to=jsarha@ti.com \
    --cc=airlied@linux.ie \
    --cc=alsa-devel@alsa-project.org \
    --cc=bcousson@baylibre.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=peter.ujfalusi@ti.com \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=tomi.valkeinen@ti.com \
    --cc=tony@atomide.com \
    /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: link
Be 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.