From patchwork Fri Aug 14 09:30:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jyri Sarha X-Patchwork-Id: 7013271 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E766B9F358 for ; Fri, 14 Aug 2015 09:31:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0B5A4205B3 for ; Fri, 14 Aug 2015 09:31:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0296D206E5 for ; Fri, 14 Aug 2015 09:31:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754740AbbHNJbl (ORCPT ); Fri, 14 Aug 2015 05:31:41 -0400 Received: from devils.ext.ti.com ([198.47.26.153]:36592 "EHLO devils.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754724AbbHNJbj (ORCPT ); Fri, 14 Aug 2015 05:31:39 -0400 Received: from dflxv15.itg.ti.com ([128.247.5.124]) by devils.ext.ti.com (8.13.7/8.13.7) with ESMTP id t7E9VKfd022265; Fri, 14 Aug 2015 04:31:20 -0500 Received: from DFLE72.ent.ti.com (dfle72.ent.ti.com [128.247.5.109]) by dflxv15.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7E9VKbS011415; Fri, 14 Aug 2015 04:31:20 -0500 Received: from dlep33.itg.ti.com (157.170.170.75) by DFLE72.ent.ti.com (128.247.5.109) with Microsoft SMTP Server id 14.3.224.2; Fri, 14 Aug 2015 04:31:20 -0500 Received: from imryr.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dlep33.itg.ti.com (8.14.3/8.13.8) with ESMTP id t7E9V1Pj028704; Fri, 14 Aug 2015 04:31:17 -0500 From: Jyri Sarha To: , , , , , CC: , , , , , , , Jyri Sarha Subject: [PATCH RFC v3 5/7] drm/i2c: tda998x: Remove include/sound/tda998x.h and fix graph parsing Date: Fri, 14 Aug 2015 12:30:43 +0300 Message-ID: <6c25a61a82370101167b45ce9f19485b99782981.1439542916.git.jsarha@ti.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: References: MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.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 0952eac..4dc2dc0 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; @@ -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", ®); + 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