Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3440280imu; Wed, 7 Nov 2018 10:20:23 -0800 (PST) X-Google-Smtp-Source: AJdET5eX8L1DlB5DGaaD6j+/C8VLJSbbuLCoyzeTCo0+h3ejm6fXZai7GKy8H72DCzjAtwvs3zue X-Received: by 2002:a63:1258:: with SMTP id 24mr1066960pgs.114.1541614823367; Wed, 07 Nov 2018 10:20:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541614823; cv=none; d=google.com; s=arc-20160816; b=ghFZq2vGSkflVwsi+L2vxSClT0QxxqPbPj3vPu3xp/Hptu2fxqUTQJ29/+ca9uIETx FkHc3EbWw3T6G+r1LZxeXkd86rax+pV3VoIBMDdFp3R8fjdaAVlJDIR8/R1QPWgk7m7n 8Z1X5toZS7sHRF2wf+9iE/NEUr4+DrRqOeKWEX4O6AZneSM9DqbAYIoO7xZjdPJhY0vI HwTXN6lNG8SFVlBprM1L0VUuboWsmsXyoyeI9yn4UEEN3jBvyXFVReGWY0YVzBDcRPRg G6lqJo4AVD6CGdRvzQMHJzuYy+5a+SPsG6A4xVIyFaaFfAVs84vZA5Hgv3SrZMlrpjsJ XAGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=4b3OH//ZjmAPdbj16dWpiKmoyFwpeoXSiQvLf6WF7fY=; b=HUTWX5Vw1ApAshPDmXFjY8x5pK+RGSidb1Z7AsV0Qx+kQfRFUhgay/u4r6A5H5z4Gl th1HyTzMdSPih3qSC4v7aPMrtaek6c2VmM2jER8JoLzvycQZBXqsD+/dPuThChMgi2rz 1d+W5MAq3IWrqL2WNZmbikOC6zKRsTcEbFZmx9vFodDOimdV9J9FmpGs/yRedlC1/6Bo CJPWs8+i4gyuF/KcvQLb/pF4Kq1hYYVA56pkfmOJeVKedSqXEsUbCtpPi+UM84D5w51k XM2pmwS1BQVhD22gdjfE3sQJKt3lYZTF88xdgVzZvyUdBGb0+DVlHun5GSsiJgz8uSQe Xa1A== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 62-v6si1281502plf.308.2018.11.07.10.20.08; Wed, 07 Nov 2018 10:20:23 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728135AbeKHDut (ORCPT + 99 others); Wed, 7 Nov 2018 22:50:49 -0500 Received: from leonov.paulk.fr ([185.233.101.22]:48908 "EHLO leonov.paulk.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726363AbeKHDut (ORCPT ); Wed, 7 Nov 2018 22:50:49 -0500 Received: from gagarine.paulk.fr (gagarine [192.168.1.127]) by leonov.paulk.fr (Postfix) with ESMTPS id 5578CBFCAE; Wed, 7 Nov 2018 19:19:14 +0100 (CET) Received: by gagarine.paulk.fr (Postfix, from userid 114) id 3CD18C1082; Wed, 7 Nov 2018 19:19:13 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on gagarine.paulk.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=unavailable autolearn_force=no version=3.4.1 Received: from localhost.localdomain (collins [192.168.1.129]) by gagarine.paulk.fr (Postfix) with ESMTP id 67254C1069; Wed, 7 Nov 2018 19:17:57 +0100 (CET) From: Paul Kocialkowski To: dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: Thierry Reding , David Airlie , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , linux-sunxi@googlegroups.com, Mark Van den Borre , Gerry Demaret , Luc Verhaegen , Paul Kocialkowski Subject: [PATCH v3 3/8] drm/sun4i: tcon: Support an active-low DE signal with RGB interface Date: Wed, 7 Nov 2018 19:18:38 +0100 Message-Id: <20181107181843.27628-4-contact@paulk.fr> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181107181843.27628-1-contact@paulk.fr> References: <20181107181843.27628-1-contact@paulk.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some panels need an active-low data enable (DE) signal for the RGB interface. This requires flipping a bit in the TCON0 polarity register when setting up the mode for the RGB interface. Match the associated bus flag and use it to set the polarity inversion bit for the DE signal when required. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 7 ++++++- drivers/gpu/drm/sun4i/sun4i_tcon.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 262ffb6b0f82..0420f5c978b9 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -543,6 +543,9 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, if (mode->flags & DRM_MODE_FLAG_PVSYNC) val |= SUN4I_TCON0_IO_POL_VSYNC_POSITIVE; + if (display_info.bus_flags & DRM_BUS_FLAG_DE_LOW) + val |= SUN4I_TCON0_IO_POL_DE_NEGATIVE; + /* * On A20 and similar SoCs, the only way to achieve Positive Edge * (Rising Edge), is setting dclk clock phase to 2/3(240°). @@ -565,7 +568,9 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, clk_set_phase(tcon->dclk, 0); regmap_update_bits(tcon->regs, SUN4I_TCON0_IO_POL_REG, - SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | SUN4I_TCON0_IO_POL_VSYNC_POSITIVE, + SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | + SUN4I_TCON0_IO_POL_VSYNC_POSITIVE | + SUN4I_TCON0_IO_POL_DE_NEGATIVE, val); /* Map output pins to channel 0 */ diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.h b/drivers/gpu/drm/sun4i/sun4i_tcon.h index 3d492c8be1fc..b5214d71610f 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.h +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.h @@ -116,6 +116,7 @@ #define SUN4I_TCON0_IO_POL_REG 0x88 #define SUN4I_TCON0_IO_POL_DCLK_PHASE(phase) ((phase & 3) << 28) +#define SUN4I_TCON0_IO_POL_DE_NEGATIVE BIT(27) #define SUN4I_TCON0_IO_POL_HSYNC_POSITIVE BIT(25) #define SUN4I_TCON0_IO_POL_VSYNC_POSITIVE BIT(24) -- 2.19.1