From patchwork Wed Feb 17 14:49:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 8339911 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id EDA5FC0553 for ; Wed, 17 Feb 2016 14:53:34 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ED8E1203C0 for ; Wed, 17 Feb 2016 14:53:33 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 88C93203B7 for ; Wed, 17 Feb 2016 14:53:32 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 99923260692; Wed, 17 Feb 2016 15:53:26 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_NONE,UNPARSEABLE_RELAY autolearn=no version=3.3.1 Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 4124A266821; Wed, 17 Feb 2016 15:51:15 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 9C51C266822; Wed, 17 Feb 2016 15:51:14 +0100 (CET) Received: from bear.ext.ti.com (bear.ext.ti.com [192.94.94.41]) by alsa0.perex.cz (Postfix) with ESMTP id 51E072659E3 for ; Wed, 17 Feb 2016 15:49:34 +0100 (CET) Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id u1HEnXIt003194; Wed, 17 Feb 2016 08:49:33 -0600 Received: from DLEE70.ent.ti.com (dlee70.ent.ti.com [157.170.170.113]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id u1HEnXhw020572; Wed, 17 Feb 2016 08:49:33 -0600 Received: from dflp33.itg.ti.com (10.64.6.16) by DLEE70.ent.ti.com (157.170.170.113) with Microsoft SMTP Server id 14.3.224.2; Wed, 17 Feb 2016 08:49:33 -0600 Received: from imryr.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id u1HEnBBo021866; Wed, 17 Feb 2016 08:49:30 -0600 From: Jyri Sarha To: , , , , , Date: Wed, 17 Feb 2016 16:49:06 +0200 Message-ID: <604cedd48520f158053dda9c1a00c95858307476.1455720381.git.jsarha@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 Cc: peter.ujfalusi@ti.com, moinejf@free.fr, tony@atomide.com, broonie@kernel.org, arnaud.pouliquen@st.com, Jyri Sarha , liam.r.girdwood@linux.intel.com, tomi.valkeinen@ti.com, rmk+kernel@arm.linux.org.uk Subject: [alsa-devel] [PATCH RFC v5 5/8] drm/i2c: tda998x: Remove include/sound/tda998x.h and fix graph parsing X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 6db1663..b534f94 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -27,10 +27,14 @@ #include #include #include -#include #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; @@ -1209,9 +1213,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) @@ -1221,11 +1226,17 @@ static int tda998x_parse_ports(struct tda998x_priv *priv, if (ret < 0) continue; ret = of_property_read_u32(of_port, "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; } @@ -1235,11 +1246,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; @@ -1248,13 +1254,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; @@ -1364,24 +1370,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) { @@ -1390,6 +1387,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