Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3439669imu; Wed, 7 Nov 2018 10:19:51 -0800 (PST) X-Google-Smtp-Source: AJdET5cj16rl1GnOh6ISOKITAU1yURxnQGfUzRscstnvKHTQpbCRFOiY1VTD/83UxGuS7ZS5xU67 X-Received: by 2002:a17:902:8486:: with SMTP id c6-v6mr1211345plo.119.1541614791621; Wed, 07 Nov 2018 10:19:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541614791; cv=none; d=google.com; s=arc-20160816; b=iTxwqJJMSae+Xy1+FmR4ka7ydFs3OIzSIPaH8shstybUzyCW0C1TT30Mbl+K1VNCfE gxL932MEb6TgI6reLb9nezOOy6SHYuFmRnZF6O4j0OHqhNTDFj1jQYcn4h/xAjjZiusD /mxYO5+MwXuRTdyz/YYm/tNMuL+LUyET+xoWStZr0Ebx/W+94tG3f1DKTRUKACjIrnsL gYCJvr8higrrvbdYgldUmsTIJn1ltIjJ37vXu6F9HLiTXww90jyHe6zrNyB5jpli/mEk 8ctMZHQymSdZ5iWO6wrfjmhwQtyAL1HIVMC+EfYbeSo3ea0I9xWQNt451q1xVNiAR1Si FX7Q== 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=2/Hg0RQ/sh2boRi84q3dqsfuH3bP1vtA1XkRHD8zid4=; b=QQTszyKncV698CHtFKJ2YY1uEUKrfvzhRkSB7TiV0JmPKhajHbBHhozpfKaIlbg8AX 3mFRy02U/ONinwQWqX/tM6QhE5pT/TYaqniSKZEkQr7hDD8DS6NlglQYPy9oIJs0Xy4k g3jOYJvQY1rTNLZRL1Sv7ZoS1abL6NMFcYrbgk5sEnVMK+b6bPTgvFSERraykPneLVXi 2Gn1pQiK9ztJUhgKm13C/PsgJQql8ygoeS2N+WF/zRAbhBKOztAF8L9jIOXGCWhIvoss ygf5PeT6yGVu2sU8nWtJzguP0zVzJryfP99mYJyyVYAbLFN7qqw3ff7Mg+nXK+gB02lU ggTA== 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 g9-v6si1204031pge.245.2018.11.07.10.19.36; Wed, 07 Nov 2018 10:19:51 -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 S1728026AbeKHDuc (ORCPT + 99 others); Wed, 7 Nov 2018 22:50:32 -0500 Received: from leonov.paulk.fr ([185.233.101.22]:48880 "EHLO leonov.paulk.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726363AbeKHDub (ORCPT ); Wed, 7 Nov 2018 22:50:31 -0500 Received: from gagarine.paulk.fr (gagarine [192.168.1.127]) by leonov.paulk.fr (Postfix) with ESMTPS id 02E5FBFE1D; Wed, 7 Nov 2018 19:18:56 +0100 (CET) Received: by gagarine.paulk.fr (Postfix, from userid 114) id 43284C1081; Wed, 7 Nov 2018 19:18:56 +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 1AE8FC1068; 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 2/8] drm/sun4i: tcon: Get the connector from the encoder in RGB setup Date: Wed, 7 Nov 2018 19:18:37 +0100 Message-Id: <20181107181843.27628-3-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-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Features such as dithering and pixel data edge configuration currently rely on the panel registered with the TCON driver. However, bridges are also supported in addition to panels for RGB setup. Instead of retrieving the connector from the panel, get it from the encoder with the dedicated helper. Even in the case of bridges, the connector is registered with the encoder from our driver and is accessible when iterating connectors. Signed-off-by: Paul Kocialkowski --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index 5e1f762fc3db..262ffb6b0f82 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -481,6 +481,8 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, const struct drm_encoder *encoder, const struct drm_display_mode *mode) { + struct drm_connector *connector = sun4i_tcon_get_connector(encoder); + struct drm_display_info display_info = connector->display_info; unsigned int bp, hsync, vsync; u8 clk_delay; u32 val = 0; @@ -492,8 +494,7 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, sun4i_tcon0_mode_set_common(tcon, mode); /* Set dithering if needed */ - if (tcon->panel) - sun4i_tcon0_mode_set_dithering(tcon, tcon->panel->connector); + sun4i_tcon0_mode_set_dithering(tcon, connector); /* Adjust clock delay */ clk_delay = sun4i_tcon_get_clk_delay(mode, 0); @@ -557,17 +558,11 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, * Following code is a way to avoid quirks all around TCON * and DOTCLOCK drivers. */ - if (tcon->panel) { - struct drm_panel *panel = tcon->panel; - struct drm_connector *connector = panel->connector; - struct drm_display_info display_info = connector->display_info; + if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE) + clk_set_phase(tcon->dclk, 240); - if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_POSEDGE) - clk_set_phase(tcon->dclk, 240); - - if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE) - clk_set_phase(tcon->dclk, 0); - } + if (display_info.bus_flags & DRM_BUS_FLAG_PIXDATA_NEGEDGE) + 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, -- 2.19.1