Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp1473512lqs; Sat, 15 Jun 2024 10:07:31 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWfzkNL7zfwX3V3g8Fcm7VFXBIu5z5a4BViID5iTZ8wsYE1bmBDsjWG1oQuc17QNXTZnbK2kIqoMT+jUZa2dIuxvQ5+euAr25ApaF35Cw== X-Google-Smtp-Source: AGHT+IHi2d49BndFjCYbdV23DFmth4S1Blc6hqRF3gwpaPd0lS50st9MVNLvr3/gT8Sgzi0C6CLJ X-Received: by 2002:a17:907:bb8e:b0:a6c:73fe:4aaa with SMTP id a640c23a62f3a-a6f60cef6d7mr309848666b.7.1718471251806; Sat, 15 Jun 2024 10:07:31 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718471251; cv=pass; d=google.com; s=arc-20160816; b=X6glMwnZoDaruGiWZ7kOX9deg2CvDYNb1QRd6lesHYfwfcLxtjR1FjbEz2UNH5aaoY 11U6LdVBSoWEiBH3q5bl96zBxJxPAG6+PwqLqBITQ134ejvTktGZeG0uiPWFz0t9xFyo VlVuNN60GxK4tqesR6rfwH5xIxpvE2S8YrRCGCgoGGVGSvMgIleN/6/dcKGYvvfl+Nl6 74yAcC9U3N8ikStFcDifDPc3hxP9zbqJyLWrgDb3FlN2YiVVTZYg8cDG/mfPwAMQDKLx CvFIKOCmzM95V/DLyrdHGDg8Q+wLGRLaBQREqTxZfb8zXjXnbliBTu79+DZyGxAyrs8I xDiA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Z5bcZuna/6T6AIQbROeIpQ8rnzmEdCJTM7frZTMAnTU=; fh=qOS3iqwcHUbDHPMP4XEqWnlrZgXeUMNZ2Jcr6wul/VU=; b=CL1i2MJwOeLXZhwZXoqduxVLu5ciVOKiWFrCQNF2wYR119ncD/dVVBjkBewihbTltK dcnt9ermXWdcgULP56TdbJJUPKEujcarR5pk5S+B0p9BCBwx2Jjtdj7lMcgMJvE4jT7E FHeiiZnfEjK+uLXD/lmA665pDzI6q2yTjJkHtP5Uxn6OR1qbPRHL5dlbtVUWREURepq8 SnW2X/wPrMWAlwbHuYE7vnsihoM7B6QhGnNpUMruvzdb7AkzBJSZMeh2n6eLy/Sl8k4R kLXTf55X2SoauRsTqihQyk2SS+vEhaBnn6Ug/+KF86WfW/29s/vfBwQyYNOWYG8p4LYL Xwuw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b=xS0K+bSo; arc=pass (i=1 spf=pass spfdomain=fe-bounces.kwiboo.se dkim=pass dkdomain=kwiboo.se dmarc=pass fromdomain=kwiboo.se); spf=pass (google.com: domain of linux-kernel+bounces-215950-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215950-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kwiboo.se Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a6f56e7da60si280054266b.945.2024.06.15.10.07.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jun 2024 10:07:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-215950-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kwiboo.se header.s=fe-e1b5cab7be header.b=xS0K+bSo; arc=pass (i=1 spf=pass spfdomain=fe-bounces.kwiboo.se dkim=pass dkdomain=kwiboo.se dmarc=pass fromdomain=kwiboo.se); spf=pass (google.com: domain of linux-kernel+bounces-215950-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-215950-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kwiboo.se Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 54D731F2217A for ; Sat, 15 Jun 2024 17:07:31 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 88B425B1E8; Sat, 15 Jun 2024 17:06:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b="xS0K+bSo" Received: from smtp.forwardemail.net (smtp.forwardemail.net [167.172.40.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13958535A4 for ; Sat, 15 Jun 2024 17:06:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.172.40.54 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718471165; cv=none; b=DZm0sQrELqGO+idjN2R0GcP7kxx+m5g+8DFXOJYqVs2joO/deSfj/d+1DsYYMMMDJ3ynvAHTl3ckodZx0BNIGtV9MN5xrGkGCm6oFPKq1ZMTxBpAH75jKEUDzhB1iw95iR4aeWKcYPxj0IDGJzYJJ8uYjq06SCj60yd6tDm/C2g= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718471165; c=relaxed/simple; bh=WR/YAgT5vHlMLJV6CkAuetiMd/bdzpn/msSteJt8Mg8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UiTUcf77cct3QDUBOfwkwo6JS8jx1vk92Df4ys3uCtyc3bPXSBK3NCVZx7VbcWJx0RgZHW9GZYfPS8XQ0STj4uGhkx/HqSlDrDKR3xCniHYaDO4fdQZap/OX9y3q3QXto1q0DOM8ov/3sT0QYIZxb2Wc5Uauu3PLuh9K9HqPZL8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kwiboo.se; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se; dkim=pass (2048-bit key) header.d=kwiboo.se header.i=@kwiboo.se header.b=xS0K+bSo; arc=none smtp.client-ip=167.172.40.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=kwiboo.se Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fe-bounces.kwiboo.se DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kwiboo.se; h=Content-Transfer-Encoding: MIME-Version: References: In-Reply-To: Message-ID: Date: Subject: Cc: To: From; q=dns/txt; s=fe-e1b5cab7be; t=1718471120; bh=Z5bcZuna/6T6AIQbROeIpQ8rnzmEdCJTM7frZTMAnTU=; b=xS0K+bSo9Vgh7Xeg3iAd/D84EhJtdOG1+/nOBTj8QqXl6V3jsPkUtCZIU3hO9EcR2eHQlPv6E wkj2U3I1nCw+tWCgAdqkBI558KFvEpotEKDst+GMvauhRzZXVYuUq88G2MFvFDTTMjzoLc9YGYV oPJ4WNcVBtIqKUp/DGwDxqGTjD9mjSMq8urJUDVGgtc3xcgfp/egnee9N91wCGZu+z1s1ANCtqf f8JTsM6UQt63RrbUz4f5ul57dN6e5kBCPm244MJ2baeyUfX1qnylCgduXXukH3y4EDOa19d5mWB WFTM1lpahoiW3zVaXLvixWE94O5bWBWgC0UPq06y5lWw== From: Jonas Karlman To: dri-devel@lists.freedesktop.org, Sandy Huang , "=?UTF-8?q?Heiko=20St=C3=BCbner?=" , Andy Yan , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter Cc: linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Jonas Karlman , Douglas Anderson , Yakir Yang Subject: [PATCH 11/13] drm/rockchip: dw_hdmi: Use auto-generated tables Date: Sat, 15 Jun 2024 17:04:02 +0000 Message-ID: <20240615170417.3134517-12-jonas@kwiboo.se> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240615170417.3134517-1-jonas@kwiboo.se> References: <20240615170417.3134517-1-jonas@kwiboo.se> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Report-Abuse-To: abuse@forwardemail.net X-Report-Abuse: abuse@forwardemail.net X-Complaints-To: abuse@forwardemail.net X-ForwardEmail-Version: 0.4.40 X-ForwardEmail-Sender: rfc822; jonas@kwiboo.se, smtp.forwardemail.net, 167.172.40.54 X-ForwardEmail-ID: 666dc9ca24e0254b39804099 From: Douglas Anderson The previous tables for mpll_cfg and curr_ctrl were created using the 20-pages of example settings provided by the PHY vendor. Those example settings weren't particularly dense, so there were places where we were guessing what the settings would be for 10-bit and 12-bit (not that we use those anyway). It was also always a lot of extra work every time we wanted to add a new clock rate since we had to cross-reference several tables. In I've gone through the work to figure out how to generate this table automatically. Let's now use the automatically generated table and then we'll never need to look at it again. We only support 8-bit mode right now and only support a small number of clock rates and I've verified that the only 8-bit rate that was affected was 148.5. That mode appears to have been wrong in the old table. Signed-off-by: Douglas Anderson Signed-off-by: Yakir Yang Signed-off-by: Jonas Karlman --- drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c | 104 ++++++++++---------- 1 file changed, 53 insertions(+), 51 deletions(-) diff --git a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c index e532c6d294dc..d9886b1c299c 100644 --- a/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c +++ b/drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c @@ -94,74 +94,70 @@ static struct rockchip_hdmi *to_rockchip_hdmi(struct drm_encoder *encoder) static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { { - 27000000, { - { 0x00b3, 0x0000}, - { 0x2153, 0x0000}, - { 0x40f3, 0x0000} + 30666000, { + { 0x00b3, 0x0000 }, + { 0x2153, 0x0000 }, + { 0x40f3, 0x0000 }, }, }, { - 36000000, { - { 0x00b3, 0x0000}, - { 0x2153, 0x0000}, - { 0x40f3, 0x0000} + 36800000, { + { 0x00b3, 0x0000 }, + { 0x2153, 0x0000 }, + { 0x40a2, 0x0001 }, }, }, { - 40000000, { - { 0x00b3, 0x0000}, - { 0x2153, 0x0000}, - { 0x40f3, 0x0000} + 46000000, { + { 0x00b3, 0x0000 }, + { 0x2142, 0x0001 }, + { 0x40a2, 0x0001 }, }, }, { - 54000000, { - { 0x0072, 0x0001}, - { 0x2142, 0x0001}, - { 0x40a2, 0x0001}, + 61333000, { + { 0x0072, 0x0001 }, + { 0x2142, 0x0001 }, + { 0x40a2, 0x0001 }, }, }, { - 65000000, { - { 0x0072, 0x0001}, - { 0x2142, 0x0001}, - { 0x40a2, 0x0001}, + 73600000, { + { 0x0072, 0x0001 }, + { 0x2142, 0x0001 }, + { 0x4061, 0x0002 }, }, }, { - 66000000, { - { 0x013e, 0x0003}, - { 0x217e, 0x0002}, - { 0x4061, 0x0002} + 92000000, { + { 0x0072, 0x0001 }, + { 0x2145, 0x0002 }, + { 0x4061, 0x0002 }, }, }, { - 74250000, { - { 0x0072, 0x0001}, - { 0x2145, 0x0002}, - { 0x4061, 0x0002} + 122666000, { + { 0x0051, 0x0002 }, + { 0x2145, 0x0002 }, + { 0x4061, 0x0002 }, }, }, { - 83500000, { - { 0x0072, 0x0001}, + 147200000, { + { 0x0051, 0x0002 }, + { 0x2145, 0x0002 }, + { 0x4064, 0x0003 }, }, }, { - 108000000, { - { 0x0051, 0x0002}, - { 0x2145, 0x0002}, - { 0x4061, 0x0002} + 184000000, { + { 0x0051, 0x0002 }, + { 0x214c, 0x0003 }, + { 0x4064, 0x0003 }, }, }, { - 106500000, { - { 0x0051, 0x0002}, - { 0x2145, 0x0002}, - { 0x4061, 0x0002} - }, - }, { - 146250000, { - { 0x0051, 0x0002}, - { 0x2145, 0x0002}, - { 0x4061, 0x0002} + 226666000, { + { 0x0040, 0x0003 }, + { 0x214c, 0x0003 }, + { 0x4064, 0x0003 }, }, }, { - 148500000, { - { 0x0051, 0x0003}, - { 0x214c, 0x0003}, - { 0x4064, 0x0003} + 272000000, { + { 0x0040, 0x0003 }, + { 0x214c, 0x0003 }, + { 0x5a64, 0x0003 }, }, }, { 340000000, { @@ -169,11 +165,17 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = { { 0x3b4c, 0x0003 }, { 0x5a64, 0x0003 }, }, + }, { + 600000000, { + { 0x1a40, 0x0003 }, + { 0x3b4c, 0x0003 }, + { 0x5a64, 0x0003 }, + }, }, { ~0UL, { - { 0x00a0, 0x000a }, - { 0x2001, 0x000f }, - { 0x4002, 0x000f }, + { 0x0000, 0x0000 }, + { 0x0000, 0x0000 }, + { 0x0000, 0x0000 }, }, } }; -- 2.45.2