From patchwork Wed Feb 28 16:14:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 10248637 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F003160211 for ; Wed, 28 Feb 2018 16:42:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E37B128DE8 for ; Wed, 28 Feb 2018 16:42:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D7E0028DF5; Wed, 28 Feb 2018 16:42:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id BC26E28ECE for ; Wed, 28 Feb 2018 16:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=ay6eg81xDXK/6y9KsKqpkwi8qfqUovY9w1N0WXV4+YU=; b=l3o B9VKwMLl4Zhn1J+RcYogfzFBqKd2ZDNbaMz8kJYRjL1VfT0w49pxMmqn/DBzY1f4pjvs43zP1KCPB 6/BH+G9rR7t15m7wFPKLY+gy/rjWRsUzi4+gvEQUToG8obhKrVXL+BdCs9V6u1RK37S6lmdKYvS+2 CwNptjKE7nNBjEmA4BN4LPEMNR1qMf8emEnpHtgs6xMdPCDgTrkEAVWatUwJ+QRuoMlaaUgkLDvCg 9/pLBLiqRMjBWlO22f0qBaqIR1v7L1gnmEu+2pUZQgutAz5dqaciXMxXpZKNDxf/vYxHtXVOZJ6mO 0qM9q8Zl/Fzxcl+dYO4nNo2cV4bqdBg==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1er4nT-0006fa-FR; Wed, 28 Feb 2018 16:41:39 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1er4nR-0006bu-2t for linux-arm-kernel@bombadil.infradead.org; Wed, 28 Feb 2018 16:41:37 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=QOf0yzXamPVx5Rk7wyAJyAuvYYFYKefXM1qSCFQzqGc=; b=3UizhsgBFU5DIfGb6M16gbLWH W0s8oSaX/tRkosgupsKU/1+x5QiVx7+I+Ceckml9BdBILN1tIkqQGwToxJJk+uWqIz+/t/Q3KD0Sr 6LEc3vUAEzaHiwq68UmUeqFXqihvs4+9XqGSNpwQbnu4UttB1PgZ8P5y73af3KAQJnHLxN3BOpMtx pg2NykAXgIbB4Doi7veZVsqRYT8T9oZE+uxHZCvfbcpk+JjRnAt13JU0BxKk/i7ijvJKnVfqVc4IA biIaUYlyjl3Z1Gd9aDCZBtvTilRxwtkuY7dPa4aJEe/oqXHGwOk6vvX1ZgSEwJXJ3H4orIGzvv9R1 IaRvbr61A==; Received: from mail.micronovasrl.com ([212.103.203.10]) by merlin.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1er4OY-0000jy-AD for linux-arm-kernel@lists.infradead.org; Wed, 28 Feb 2018 16:15:54 +0000 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 07F6BB00A92 for ; Wed, 28 Feb 2018 17:15:43 +0100 (CET) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=x-mailer:message-id:date:date:subject:subject:to:from:from; s=dkim; t=1519834541; x=1520698542; bh=CGx4eI1mrq8OFqxatol/S+jj d08b7kc0VtqjBAgaOo4=; b=FLrQj150BvQEmj+Vo6Htv/ElBk2q7Dv9UG7VqHi2 1vqtF3bkLZ7BpPSDLecnzAORSAJHFTo9ldkEKyMiRCqNfXxGVFSm2anWLRszkClX 61gfZ75QMHjs9DqGemXLqnYaEb/3D/R5xZbRzwtL57zqzN/hzvWlQg4FtTmintHK vwk= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id OMFqYy5rayUj for ; Wed, 28 Feb 2018 17:15:41 +0100 (CET) Received: from localhost.localdomain (62-11-51-166.dialup.tiscali.it [62.11.51.166]) by mail.micronovasrl.com (Postfix) with ESMTPSA id 3CB77B005AE; Wed, 28 Feb 2018 17:15:41 +0100 (CET) From: Giulio Benetti To: Maxime Ripard Subject: [PATCH] drm/sun4i: Handle DRM_BUS_FLAG_PIXDATA_*EDGE Date: Wed, 28 Feb 2018 17:14:52 +0100 Message-Id: <1519834492-30559-1-git-send-email-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180228_111554_502691_4A5A6758 X-CRM114-Status: GOOD ( 10.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Chen-Yu Tsai , Giulio Benetti , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Handle both positive and negative dclk polarity, according to bus_flags. Signed-off-by: Giulio Benetti --- drivers/gpu/drm/sun4i/sun4i_tcon.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index aaf911a..534e5ee 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -17,6 +17,7 @@ #include #include #include +#include #include @@ -340,6 +341,9 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon, static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, const struct drm_display_mode *mode) { + struct drm_panel *panel = tcon->panel; + struct drm_connector *connector = panel->connector; + struct drm_display_info display_info = connector->display_info; unsigned int bp, hsync, vsync; u8 clk_delay; u32 val = 0; @@ -395,8 +399,15 @@ 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_PIXDATA_POSEDGE) + clk_set_phase(tcon->dclk, 240); + + 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, + SUN4I_TCON0_IO_POL_HSYNC_POSITIVE | + SUN4I_TCON0_IO_POL_VSYNC_POSITIVE, val); /* Map output pins to channel 0 */