Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1873213imm; Fri, 6 Jul 2018 08:01:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdp6gutnvL4YvoicuwE73mg1VqP318sSdboMh0dwjIMKm0qVqK3YlUzwUA+1ORbWZ7mGHBa X-Received: by 2002:a17:902:262:: with SMTP id 89-v6mr10710341plc.252.1530889265577; Fri, 06 Jul 2018 08:01:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530889265; cv=none; d=google.com; s=arc-20160816; b=a2uIllX8TwhrKUz3BLDn3phDi2/niLr/qsu9iIzdwoiuiM8YS9kjVFR4oqoTSotkI0 rfjlEwRzlVhKxYm4IuzZQa26TBYhjyg6o8l3NmB6iMZGnSbRXtL6IHj6uBJqZKTqkP5K kvaheuzXM7hA1z3nzIjnHNnI6kO4u60xHUDB2TshRtKdONQAEHvyhmqk4my7GqgORgne oSepfKkyQrTCOtooWUyGlk5UnGobpRzwRjBUPlwRotHyQagCKIaD74NmshEaK9UF3R2M ddLVyB1DSNml76MWT6XPEbWjurew/+jHQBJ7C49iBtU0lREtrpqjAvHEaEr0FoB/y4g6 RxpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:date:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature:arc-authentication-results; bh=WO5xgQ41AkjI0W4qPuMo00Xflz8g696ogpKJmfkc97A=; b=Eu4gu8jJbz82R5RsVWKQNq3ISiFZisd/fpjl/+K8eFLeD+1UgigE0cyZawy/p3rhEO 9/mUp9huWY6jEMCVVtxFcAkzua8Cp8DuCdaBmS3RSmC+G6ASSx2G5ms1a8VDE/LyG7B4 afdQMg6aBBJStYZUzxoTgSn6PZVySK9jHQbdWAx7RqT8YcUTO/ee/Yuox7QGue59nnUp Aae/elbPE9cEZz7kYyuuhIey8PM+qC9DSpUIH3tnDOZyht8jgQ+oTMRbuEnSU4TxF2Ew L9kBpMEMMla8gph8ozor4YCFMJ16590XkGYAnfVFoux2IMSfrJxKGqKWlTV5nANC3pJo yefA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=gkASNnzu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7-v6si8674859pll.212.2018.07.06.08.00.50; Fri, 06 Jul 2018 08:01:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=gkASNnzu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933458AbeGFO7g (ORCPT + 99 others); Fri, 6 Jul 2018 10:59:36 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:44298 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932984AbeGFO7d (ORCPT ); Fri, 6 Jul 2018 10:59:33 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=WO5xgQ41AkjI0W4qPuMo00Xflz8g696ogpKJmfkc97A=; b=gkASNnzuDbIJxRLZPR/WMgFQLl cJcmpVNBExqaqNF3fKVl2klfBG8y5i7fZSUnm/MNwHHU0SJSGx9GJN/MO/rKeH3Tamz/tPEJyKk5c fFjwe70QH5gat4GS2bX8vLrIz2oJF/okrKLcS8Y1mA9+M/0RwWlg8mvLFnJ49CtVDstU=; Received: from e0022681537dd.dyn.armlinux.org.uk ([2001:4d48:ad52:3201:222:68ff:fe15:37dd]:46474 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1fbSCM-0006O1-5g; Fri, 06 Jul 2018 15:59:02 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1fbSCJ-00076i-Hr; Fri, 06 Jul 2018 15:58:59 +0100 In-Reply-To: <20180706145748.GA17271@n2100.armlinux.org.uk> References: <20180706145748.GA17271@n2100.armlinux.org.uk> From: Russell King To: Peter Rosin Cc: Mark Rutland , devicetree@vger.kernel.org, Alexandre Belloni , Andrzej Hajda , David Airlie , Jyri Sarha , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Boris Brezillon , Rob Herring , Jacopo Mondi , Laurent Pinchart , Daniel Vetter , linux-arm-kernel@lists.infradead.org Subject: [PATCH 3/6] drm/i2c: tda998x: move tda998x_set_config() into tda998x_create() MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Date: Fri, 06 Jul 2018 15:58:59 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move the non-DT configuration of the TDA998x into tda998x_create() so that we do all setup in one place. Signed-off-by: Russell King --- drivers/gpu/drm/i2c/tda998x_drv.c | 75 ++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index e9a038a7bb30..931135db979c 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1621,6 +1621,25 @@ static int tda998x_get_audio_ports(struct tda998x_priv *priv, return 0; } +static void tda998x_set_config(struct tda998x_priv *priv, + const struct tda998x_encoder_params *p) +{ + priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(p->swap_a) | + (p->mirr_a ? VIP_CNTRL_0_MIRR_A : 0) | + VIP_CNTRL_0_SWAP_B(p->swap_b) | + (p->mirr_b ? VIP_CNTRL_0_MIRR_B : 0); + priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(p->swap_c) | + (p->mirr_c ? VIP_CNTRL_1_MIRR_C : 0) | + VIP_CNTRL_1_SWAP_D(p->swap_d) | + (p->mirr_d ? VIP_CNTRL_1_MIRR_D : 0); + priv->vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(p->swap_e) | + (p->mirr_e ? VIP_CNTRL_2_MIRR_E : 0) | + VIP_CNTRL_2_SWAP_F(p->swap_f) | + (p->mirr_f ? VIP_CNTRL_2_MIRR_F : 0); + + priv->audio_params = p->audio_params; +} + static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) { struct device_node *np = client->dev.of_node; @@ -1772,23 +1791,28 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) /* enable EDID read irq: */ reg_set(priv, REG_INT_FLAGS_2, INT_FLAGS_2_EDID_BLK_RD); - if (!np) - return 0; /* non-DT */ + if (np) { + /* get the device tree parameters */ + ret = of_property_read_u32(np, "video-ports", &video); + if (ret == 0) { + priv->vip_cntrl_0 = video >> 16; + priv->vip_cntrl_1 = video >> 8; + priv->vip_cntrl_2 = video; + } - /* get the device tree parameters */ - ret = of_property_read_u32(np, "video-ports", &video); - if (ret == 0) { - priv->vip_cntrl_0 = video >> 16; - priv->vip_cntrl_1 = video >> 8; - priv->vip_cntrl_2 = video; - } + ret = tda998x_get_audio_ports(priv, np); + if (ret) + goto fail; - ret = tda998x_get_audio_ports(priv, np); - if (ret) - goto fail; + if (priv->audio_port[0].format != AFMT_UNUSED) + tda998x_audio_codec_init(priv, &client->dev); + } else { + struct tda998x_encoder_params *params; - if (priv->audio_port[0].format != AFMT_UNUSED) - tda998x_audio_codec_init(priv, &client->dev); + params = client->dev.platform_data; + if (params) + tda998x_set_config(priv, params); + } return 0; @@ -1835,28 +1859,8 @@ static const struct drm_encoder_funcs tda998x_encoder_funcs = { .destroy = tda998x_encoder_destroy, }; -static void tda998x_set_config(struct tda998x_priv *priv, - const struct tda998x_encoder_params *p) -{ - priv->vip_cntrl_0 = VIP_CNTRL_0_SWAP_A(p->swap_a) | - (p->mirr_a ? VIP_CNTRL_0_MIRR_A : 0) | - VIP_CNTRL_0_SWAP_B(p->swap_b) | - (p->mirr_b ? VIP_CNTRL_0_MIRR_B : 0); - priv->vip_cntrl_1 = VIP_CNTRL_1_SWAP_C(p->swap_c) | - (p->mirr_c ? VIP_CNTRL_1_MIRR_C : 0) | - VIP_CNTRL_1_SWAP_D(p->swap_d) | - (p->mirr_d ? VIP_CNTRL_1_MIRR_D : 0); - priv->vip_cntrl_2 = VIP_CNTRL_2_SWAP_E(p->swap_e) | - (p->mirr_e ? VIP_CNTRL_2_MIRR_E : 0) | - VIP_CNTRL_2_SWAP_F(p->swap_f) | - (p->mirr_f ? VIP_CNTRL_2_MIRR_F : 0); - - priv->audio_params = p->audio_params; -} - static int tda998x_bind(struct device *dev, struct device *master, void *data) { - struct tda998x_encoder_params *params = dev->platform_data; struct i2c_client *client = to_i2c_client(dev); struct drm_device *drm = data; struct tda998x_priv *priv; @@ -1884,9 +1888,6 @@ static int tda998x_bind(struct device *dev, struct device *master, void *data) if (ret) return ret; - if (!dev->of_node && params) - tda998x_set_config(priv, params); - drm_encoder_helper_add(&priv->encoder, &tda998x_encoder_helper_funcs); ret = drm_encoder_init(drm, &priv->encoder, &tda998x_encoder_funcs, DRM_MODE_ENCODER_TMDS, NULL); -- 2.7.4