From patchwork Fri Nov 23 14:02:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Neil Armstrong X-Patchwork-Id: 10695801 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 45F0C15A7 for ; Fri, 23 Nov 2018 14:02:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 34CDC2C260 for ; Fri, 23 Nov 2018 14:02:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 28B282C265; Fri, 23 Nov 2018 14:02:44 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 C6F512C264 for ; Fri, 23 Nov 2018 14:02:43 +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:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: 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: List-Owner; bh=8bRc+rX/TDh/gNaaZGfw4EYHO7+RdVDPA4fOS4lZ7lU=; b=JhXA4mn/d0EiE5 uBvH6mXXN0C7uG5RHFq/D/uyvAwUwS1HghZiNP3hkHb6Zl0ieLGCzHfdpfd4kRx0ZCrinVnNsgqKk tcPog7AUnk927dHR6qWMAKSN/+XabxbYSx6U4Ea/QtAvMw5C/7OWabKaPXTt+GmOfxMash50IkbkS M2Ze7JBJAteLWch/Bd6Q7K+KM3hwepvjcPJObYnAT0FighZo7TCeT2SLM6MmIA7l37w066bURTYQ4 +NZfrw5/DQHAv8aMVlx0SrQQOCVqw0dMK7ODBt/lGQoXb4aQ3r92lx+HXaw5tkXckhvXIgDDGrEK5 oY2/S8DscXs97w0iD8Ew==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gQC2d-0003R4-FG; Fri, 23 Nov 2018 14:02:43 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gQC2Y-0003Oj-Rd for linux-amlogic@lists.infradead.org; Fri, 23 Nov 2018 14:02:42 +0000 Received: by mail-wr1-x444.google.com with SMTP id c14so6822413wrr.0 for ; Fri, 23 Nov 2018 06:02:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=C6neJLTpBin4DVsYLiqj428FtdsYuJZgCkxB/kTMWMc=; b=uuIUs128AACwGfdXPAHeCrKkJ/0sHj6YLHrYwscTB00RCysXIJ4cqrhoekdp6h1BV7 lTrfLudgUmHw6dLknH29WZuDLPZ8n89FzASN1C0HFPwnRzPgwvaZ0Ii5t7u0qol6Y8K4 wTm4AbF8INAh6gRF+nEmnuizWUxZfDJegOP91u2ZB5kP4RuDHWVXR3DkNoTCq4kEdFUm Ii+I318+GB7+4NbMVZXd1/KYaDI+to35X7O5DVDu9nJ9pw+f8nr/m60NeJv9id4QgVC7 lv4fozusJl0tX6kuLUk0wmUQ4nJX4Mg7QqWkD8di6ndV85j3SuDrNCWHyKLhaT6zgXQn dyjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=C6neJLTpBin4DVsYLiqj428FtdsYuJZgCkxB/kTMWMc=; b=SIfd4s1KnvwUDD1UOzTNwo9j6chOenuuZR/9Zp1mJeNkiBCWhhcaqMGzBKQ/0fCoJt im7+/8FXurzru+c6DEMgEGzQxNrznygYJxXU08ucWUuzFFKPqHc78xHy1kLC1jC+PPLb 7BygQ+p11cxBvugKE3TctQWCCiF0FUPrh9akbQGTILiEwcUhx9/YY6cnW0uEnmKIJ9Qa c6XWik959oubat4jmgb5N6LjEZJupxWIShm6bZ5sByFfmOdRnRadZZ+E7ESrrx+yAqWK jREkYah59DdoHzZI5pwBVJLljIjQFEqGnAEG6XTBSnA4pZZXlWXjZe1PBwz1CZowuBwA GOhQ== X-Gm-Message-State: AA+aEWae77paUdlyJoY12qwCk4NSHOd+NFFp+SLloRfAJKwKfjffZaeS ppfcDvUpOb9H6FgU5Z/EqzSpwA== X-Google-Smtp-Source: AFSGD/V6Q4HaeuAw4UE1omdxl8oGKEwfebqNpAKjR7MIrnwe1yZE6sDCa2cYBsXXg9Mc7spICCNYDw== X-Received: by 2002:adf:e8c1:: with SMTP id k1mr13342067wrn.104.1542981750503; Fri, 23 Nov 2018 06:02:30 -0800 (PST) Received: from bender.baylibre.local (lmontsouris-657-1-212-31.w90-63.abo.wanadoo.fr. [90.63.244.31]) by smtp.gmail.com with ESMTPSA id x8sm15172185wrd.53.2018.11.23.06.02.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 23 Nov 2018 06:02:29 -0800 (PST) From: Neil Armstrong To: architt@codeaurora.org, a.hajda@samsung.com, Laurent.pinchart@ideasonboard.com Subject: [PATCH RFC 2/8] drm/meson: add HDMI div40 TMDS mode Date: Fri, 23 Nov 2018 15:02:15 +0100 Message-Id: <20181123140221.15700-3-narmstrong@baylibre.com> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181123140221.15700-1-narmstrong@baylibre.com> References: <20181123140221.15700-1-narmstrong@baylibre.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181123_060238_895267_DD5F8ED9 X-CRM114-Status: GOOD ( 11.98 ) X-BeenThere: linux-amlogic@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Neil Armstrong Sender: "linux-amlogic" Errors-To: linux-amlogic-bounces+patchwork-linux-amlogic=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add support for TMDS Clock > 3.4GHz for HDMI2.0 display modes. Signed-off-by: Neil Armstrong --- drivers/gpu/drm/meson/meson_dw_hdmi.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/meson/meson_dw_hdmi.c b/drivers/gpu/drm/meson/meson_dw_hdmi.c index d8c5cc34e22e..118c49e054b0 100644 --- a/drivers/gpu/drm/meson/meson_dw_hdmi.c +++ b/drivers/gpu/drm/meson/meson_dw_hdmi.c @@ -365,7 +365,8 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, unsigned int wr_clk = readl_relaxed(priv->io_base + _REG(VPU_HDMI_SETTING)); - DRM_DEBUG_DRIVER("%d:\"%s\"\n", mode->base.id, mode->name); + DRM_DEBUG_DRIVER("%d:\"%s\" div%d\n", mode->base.id, mode->name, + mode->clock > 340000 ? 40 : 10); /* Enable clocks */ regmap_update_bits(priv->hhi, HHI_HDMI_CLK_CNTL, 0xffff, 0x100); @@ -385,9 +386,17 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, /* Enable normal output to PHY */ dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12)); - /* TMDS pattern setup (TOFIX pattern for 4k2k scrambling) */ - dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01, 0x001f001f); - dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_23, 0x001f001f); + /* TMDS pattern setup (TOFIX Handle the YUV420 case) */ + if (mode->clock > 340000) { + dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01, 0); + dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_23, + 0x03ff03ff); + } else { + dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01, + 0x001f001f); + dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_23, + 0x001f001f); + } /* Load TMDS pattern */ dw_hdmi_top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_CNTL, 0x1); @@ -413,6 +422,8 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data, /* Disable clock, fifo, fifo_wr */ regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0); + dw_hdmi_set_high_tmds_clock_ratio(hdmi); + msleep(100); /* Reset PHY 3 times in a row */ @@ -562,6 +573,11 @@ dw_hdmi_mode_valid(struct drm_connector *connector, mode->vdisplay, mode->vsync_start, mode->vsync_end, mode->vtotal, mode->type, mode->flags); + /* If sink max TMDS clock < 340MHz, we reject the HDMI2.0 modes */ + if (mode->clock > 340000 && + connector->display_info.max_tmds_clock < 340000) + return MODE_BAD; + /* Check against non-VIC supported modes */ if (!vic) { status = meson_venc_hdmi_supported_mode(mode);