Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1872520imm; Fri, 6 Jul 2018 08:00:38 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdWp5pfyMbG8GOyCul5neZuxSlzpL9SIbNcHfywyY7/sIhmBJlgOC2sZuqYByD+enCdKT+u X-Received: by 2002:a63:1262:: with SMTP id 34-v6mr3711706pgs.154.1530889238313; Fri, 06 Jul 2018 08:00:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530889238; cv=none; d=google.com; s=arc-20160816; b=hBbQzX59tXe9IjOxsRo4EVxl2kVTbq7+LEX0qu36ufdKpI8+WYm7XNikQFweZQl810 wM9D7DRSvIljy4da79LRaOWL9+Rfj6ddkvvzhPYB8iaT5P7A/Td3zkMpMoWTh5bfEewV tM1aL0jYrTO6EyB0NevF1kSR88yat7wLhzWUHgaaS50Ytfl8sgZK21+CISLgckz9GmyB AANAYo8vzPWPjoCZCHqbjDSHs3OLS1RrSat5WQ/Gn303Lk41RNncEZ8PwvSjfC4pL+y3 8VZHcllRjrElJOeBPwapNNr+Q91YCsctnUrUBM3TRW/jM4q/81KdXAJul5gsica58bbB Vxkw== 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=kGt6vzS/H42JUC4NgT6W9qMNXW28pa0z6LBzPRpAuEQ=; b=q7sPNrqGit3dtSqX1fQJckqb5+XER3FocQnwvbUIGpRA8PCpWNdZ6rA4O458b7cz+M zpa3sxFrc1a9Si3Tj7eGPZ9yyphFBj7HqDp9a0RQAxrb1XG4wbcAv2jQTqrxjsyMN/W3 grRZzz/lhZM09fjWkzTmBBjlacHxt8iOs7NbWV/he8OdysARonVJnLmkl5IAhRAvaNs0 FwUxOXgTScMpZPHIfYlcAQwsIAHiVZk50/tLMJBHHG6S2iPMxj1BQsKZp8eaC/LBqCEK PIoOw1sPYAzPWyYZIdfqdtMcwHd4mopEBigRemUdrJrCECALaB+n6mwhzwfGzQ1C2pUz 0YEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=T8HYurWD; 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 d24-v6si9157478pfb.262.2018.07.06.08.00.23; Fri, 06 Jul 2018 08:00:38 -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=T8HYurWD; 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 S933380AbeGFO7R (ORCPT + 99 others); Fri, 6 Jul 2018 10:59:17 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:44254 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932769AbeGFO7N (ORCPT ); Fri, 6 Jul 2018 10:59:13 -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=kGt6vzS/H42JUC4NgT6W9qMNXW28pa0z6LBzPRpAuEQ=; b=T8HYurWD7j8ZSmuZwl2S6xSdPQ 8mmzMMUvfv7Z0m1th75/aXygqhx/SCLQmzYR6l+7tsGoWkgg0IzuEV+Qp71SiG2EVCXfnQgcx9pqt wGkLr+ojYIdsBtp4fvBz+bV8lwxlAy+IFM7yWatlToBmJgIIvb31WbvJy/AFRREfSIIw=; Received: from e0022681537dd.dyn.armlinux.org.uk ([2002:4e20:1eda:1:222:68ff:fe15:37dd]:45958 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 1fbSCF-0006Nq-7o; Fri, 06 Jul 2018 15:58:55 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1fbSCE-00076b-EO; Fri, 06 Jul 2018 15:58:54 +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 2/6] drm/i2c: tda998x: split tda998x_encoder_dpms into enable/disable 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:54 +0100 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Peter Rosin 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 [edited by rmk to just split the tda998x_encoder_dpms() function and restore the double-disable protection we originally had, preserving original behaviour.] Signed-off-by: Russell King --- drivers/gpu/drm/i2c/tda998x_drv.c | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i2c/tda998x_drv.c b/drivers/gpu/drm/i2c/tda998x_drv.c index 4061e293e671..e9a038a7bb30 100644 --- a/drivers/gpu/drm/i2c/tda998x_drv.c +++ b/drivers/gpu/drm/i2c/tda998x_drv.c @@ -1299,18 +1299,9 @@ 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; - - /* we only care about on or off: */ - on = mode == DRM_MODE_DPMS_ON; - - if (on == priv->is_on) - return; - - if (on) { + if (!priv->is_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); @@ -1321,7 +1312,12 @@ static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) reg_write(priv, REG_VIP_CNTRL_2, priv->vip_cntrl_2); priv->is_on = true; - } else { + } +} + +static void tda998x_disable(struct tda998x_priv *priv) +{ + if (!priv->is_on) { /* disable video ports */ reg_write(priv, REG_ENA_VP_0, 0x00); reg_write(priv, REG_ENA_VP_1, 0x00); @@ -1331,6 +1327,23 @@ static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) } } +static void tda998x_encoder_dpms(struct drm_encoder *encoder, int mode) +{ + struct tda998x_priv *priv = enc_to_tda998x_priv(encoder); + bool on; + + /* we only care about on or off: */ + on = mode == DRM_MODE_DPMS_ON; + + if (on == priv->is_on) + return; + + if (on) + tda998x_enable(priv); + else + tda998x_disable(priv); +} + static void tda998x_encoder_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, -- 2.7.4