Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1639729imm; Fri, 6 Jul 2018 03:58:31 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe4UK23TS9Hn0bLmYFTctGyBJHmDZ0LBNL4eGoaZbI1DQD2xTywX4SKlKqWQuLmrdCSxFo8 X-Received: by 2002:a62:3a9d:: with SMTP id v29-v6mr10140325pfj.215.1530874711793; Fri, 06 Jul 2018 03:58:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530874711; cv=none; d=google.com; s=arc-20160816; b=GBzuPwZQfOWrxpTeXZrTHBdOoDwDw9Ik6UXRTIkqDK6+iIGOqoOzW5/v2W2TJijEQd zbm4UktmlObKRGnc3YNrT2XF4hPf6mwZzcMbcImvNN+vAT1lixDL/tSCxMnkymHJ9+/A ihhD57suG6I5mKD04wmPqeMJlaodZfm4aD48w+CQq75FdjLDR2YuK2E7WHXzMihXyAvE wR72s7okNahqxpnCvKVE9f/uDY8Lo79O936UkQKBi4+rhULfej+nvPtZXGpB6Ac4TrXi 7phfh+16zH9g/P7xdbaA0OKcyOQVe9aYfyOWKVd8NL+TKcToSuu8lYt59zvMUPMzJkSo OwDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=JN8T7skhl6jKiqzb8rphCCSwFOcS96RWj0zA+brA7ok=; b=dbs0Y8bHEKLdGfwdxhruekrCTHbXzy4x9M7p00+Ii252fO0LiPXEbV6a8exQqi9l9B mNzVD0mGMYfKsBAKnf1UlbUtJqvhZhG0vlwYrTebXO9sC6H0AMHkJQsZYL2quxoZZB1n XDofpUmPzwBfYLrS9QN4gTxmwTdozRsYY6zNoWMArTN3BARwt8rUgdKAH7oJAwn2DTIU bGxXOHQl79bYeeR4K99mLE1bQ0CLRCVEcz1GfyUbot4LeFu+XGcjTPTXCqRFAAdoxLMg 2Z1tn0knKUrRyhKzV94yWbBo2CP7lejOXhAtbnooRWOCa5eWXu1YXQnhO+/a4gbvk3Q/ 5kXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=R3CVhpqp; 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 t67-v6si8654565pfd.364.2018.07.06.03.58.17; Fri, 06 Jul 2018 03:58:31 -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=R3CVhpqp; 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 S932360AbeGFK5c (ORCPT + 99 others); Fri, 6 Jul 2018 06:57:32 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:41264 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753598AbeGFK5a (ORCPT ); Fri, 6 Jul 2018 06:57:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding: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=JN8T7skhl6jKiqzb8rphCCSwFOcS96RWj0zA+brA7ok=; b=R3CVhpqp6t/DBc0kgvt3a3JTF 2JlhM9mDUvgWPsGS6U8Wz8Vu/pCRPUpjlim06RPj8odAwL91+JA1C5IAAIT19GeU7dFdjBRrzgwgU 3Z/DN5PJscLtVerChaCZfO7Eauh+TAqXe76lQt3IEd9TSUbSG8JrfJfV7wyzWuF0g00Yg=; Received: from n2100.armlinux.org.uk ([2002:4e20:1eda:1:214:fdff:fe10:4f86]:53155) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1fbOQT-0005O1-Fb; Fri, 06 Jul 2018 11:57:21 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.90_1) (envelope-from ) id 1fbOQQ-0000vh-Mo; Fri, 06 Jul 2018 11:57:18 +0100 Date: Fri, 6 Jul 2018 11:57:17 +0100 From: Russell King - ARM Linux To: Peter Rosin Cc: linux-kernel@vger.kernel.org, David Airlie , Rob Herring , Mark Rutland , Nicolas Ferre , Alexandre Belloni , Boris Brezillon , Laurent Pinchart , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Jyri Sarha , Daniel Vetter , Andrzej Hajda , Jacopo Mondi Subject: Re: [PATCH v5 5/7] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable Message-ID: <20180706105717.GW17271@n2100.armlinux.org.uk> References: <20180523093122.27859-1-peda@axentia.se> <20180523093122.27859-6-peda@axentia.se> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180523093122.27859-6-peda@axentia.se> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, May 23, 2018 at 11:31:20AM +0200, Peter Rosin wrote: > This fits better with the drm_bridge callbacks for when this > driver becomes a drm_bridge. > > Suggested-by: Laurent Pinchart > Signed-off-by: Peter Rosin > --- > drivers/gpu/drm/i2c/tda998x_drv.c | 64 ++++++++++++++++++++++----------------- > 1 file changed, 37 insertions(+), 27 deletions(-) > > diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c > index 933d309d2e0f..3dda07a2fd2f 100644 > --- a/drivers/gpu/drm/i2c/tda998x_drv.c > +++ b/drivers/gpu/drm/i2c/tda998x_drv.c > @@ -1163,36 +1163,42 @@ static int tda998x_connector_init(struct tda998x_priv *priv, > > /* DRM encoder functions */ > > -static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) > +static void tda998x_enable(struct tda998x_priv *priv) > { > - struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); > - bool on; > + if (priv->is_on) > + return; > > - /* we only care about on or off: */ > - on = mode == DRM_MODE_DPMS_ON; > + /* enable video ports, audio will be enabled later */ > + reg_write(priv, REG_ENA_VP_0, 0xff); > + reg_write(priv, REG_ENA_VP_1, 0xff); > + reg_write(priv, REG_ENA_VP_2, 0xff); > + /* set muxing after enabling ports: */ > + reg_write(priv, REG_VIP_CNTRL_0, priv->vip_cntrl_0); > + reg_write(priv, REG_VIP_CNTRL_1, priv->vip_cntrl_1); > + reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2); > > - if (on == priv->is_on) > - return; > + priv->is_on = true; > +} > > - if (on) { > - /* enable video ports, audio will be enabled later */ > - reg_write(priv, REG_ENA_VP_0, 0xff); > - reg_write(priv, REG_ENA_VP_1, 0xff); > - reg_write(priv, REG_ENA_VP_2, 0xff); > - /* set muxing after enabling ports: */ > - reg_write(priv, REG_VIP_CNTRL_0, priv->vip_cntrl_0); > - reg_write(priv, REG_VIP_CNTRL_1, priv->vip_cntrl_1); > - reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2); > - > - priv->is_on = true; > - } else { > - /* disable video ports */ > - reg_write(priv, REG_ENA_VP_0, 0x00); > - reg_write(priv, REG_ENA_VP_1, 0x00); > - reg_write(priv, REG_ENA_VP_2, 0x00); > +static void tda998x_disable(struct tda998x_priv *priv) > +{ > + /* disable video ports */ > + reg_write(priv, REG_ENA_VP_0, 0x00); > + reg_write(priv, REG_ENA_VP_1, 0x00); > + reg_write(priv, REG_ENA_VP_2, 0x00); > > - priv->is_on = false; > - } > + priv->is_on = false; > +} > + > +static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) > +{ > + struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); > + > + /* we only care about on or off: */ > + if (mode == DRM_MODE_DPMS_ON) > + tda998x_enable(priv); > + else > + tda998x_disable(priv); > } > > static void > @@ -1606,12 +1612,16 @@ static int tda998x_create(struct i2c_client *client, struct tda998x_priv *priv) > > static void tda998x_encoder_prepare(struct drm_encoder *encoder) > { > - tda998x_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); > + struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); > + > + tda998x_disable(priv); > } > > static void tda998x_encoder_commit(struct drm_encoder *encoder) > { > - tda998x_encoder_dpms(encoder, DRM_MODE_DPMS_ON); > + struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); > + > + tda998x_enable(priv); > } > > static const struct drm_encoder_helper_funcs tda998x_encoder_helper_funcs = { Please group the tda998x_encoder_* functions together, and in order of their use in the function vtables, and just above the function vtables. That'll mean that all the encoder veneers are together, all the bridge veneers are together, etc, and probably means later on it's easier to remove the encoder stuff (as all the encoder code will be in one hunk rather than scattered throughout the file.) Thanks. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 13.8Mbps down 630kbps up According to speedtest.net: 13Mbps down 490kbps up