From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A7050C27C6E for ; Mon, 17 Jun 2024 06:17:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=60zeZXWHXHBwDs11QTLBG22SVSiDpOOF7b1DAQhvIYU=; b=4+0sIHa/K2Pt9bgvl9xX1s9STP mxELSLQ/7ER6NkbfD22323t26X1NNlwLhmHgQcUX4jtSvO385+Pprjyr2T7ca4NhyYq6INiZUMirL gQ+2s2BEnKh7Vl6fhmzmgZ7wmo5wBXMygeluIUDt2IEXQi54lHbtLAmUCUxKVOOpmXMbI7OOXeZ0/ D67rcPLM+75NjSMmQX9wGXaaWUOSaKeHlYHyqrebahSL+3jzLibOUyrVvX2aQMGSr3AJi9GP+5QdG fstysmX2JVBShW3KgxT+4OuvM5w/vJldyfEAOg/xQ/ruR6OpY3VVfpOC7TSlB61ilH2JueDFAhUQs H4eOxpWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJ5gB-00000009PAf-1xtZ; Mon, 17 Jun 2024 06:17:23 +0000 Received: from gw2.atmark-techno.com ([35.74.137.57]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sJ5g8-00000009P9S-1UNC for linux-arm-kernel@lists.infradead.org; Mon, 17 Jun 2024 06:17:21 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=atmark-techno.com; s=gw2_bookworm; t=1718605039; bh=VWekmmnDCFhOysdFb3773YHoJmKjjDsvt2a9l5bgUHY=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dv9NxAjSf9BqcXxD8rrLcKs5H2nJhPvC8JMac99qsgcNA1syVoIen+MLWPDYWQJju JmaB0gV55JJRp9CvQw1Diy7WE0rFvnWylcb7FypIoQsXQRyLAgSlFGoWtxsnI+96Qe HTDMSvyq9+9Y9gbuDNMXIV/WzXwSkfug0vwucmc4HqBdj1JADh/2uEcqu1lsipByLp 15I0x4gyIQAHqnrIAocYLJEKyhNx7YnMwD6D7VxvYkJCHdmajNNpmS1XQfXPdGO5Av fWGJsNOQY4x32s5Abzb1nblXMHYvUZqExJ6oeruaVnTKRwHQUssQm0aGsAhBrOTBGQ pkWlrjqdREcCQ== Received: from gw2.atmark-techno.com (localhost [127.0.0.1]) by gw2.atmark-techno.com (Postfix) with ESMTP id 5E5294A7 for ; Mon, 17 Jun 2024 15:17:19 +0900 (JST) Authentication-Results: gw2.atmark-techno.com; dkim=pass (2048-bit key; unprotected) header.d=atmark-techno.com header.i=@atmark-techno.com header.a=rsa-sha256 header.s=google header.b=XXqTvgp4; dkim-atps=neutral Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by gw2.atmark-techno.com (Postfix) with ESMTPS id 2AAD94A7 for ; Mon, 17 Jun 2024 15:17:19 +0900 (JST) Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6b07983a8adso100731006d6.0 for ; Sun, 16 Jun 2024 23:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=atmark-techno.com; s=google; t=1718605037; x=1719209837; darn=lists.infradead.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=60zeZXWHXHBwDs11QTLBG22SVSiDpOOF7b1DAQhvIYU=; b=XXqTvgp4H33sE8Kn1OhdkFzQiyQQacDMRhqZuoAujJ/YGGGO+x7oeSoBcfYos/I58u /7z7NkvWHW5Zyl7RHZMSqi+eIr987hdrFpZtNFQbYN2QRS2kiWkMLijzNFukbTBx+T/T Wqxw6qq9RcXb7fx1vVBHAxifLXAnOjzb9E/rrEYY6kg9+mXEPVb2o6+/nOXLexq4/C2M Q/gTogFgygPlQAFat3L+J3h79wROkeeFlv9e5JR9pjx+WNq2iEfgiewyqsFC4h6Xf9Og +eMp19TarUnLHZG17kMM0t878gd2zQjnmOu1zKevNflaE5gJobeoeqm5/Aue+Qi5iRiP RbJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718605037; x=1719209837; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=60zeZXWHXHBwDs11QTLBG22SVSiDpOOF7b1DAQhvIYU=; b=tUD1umq0HgfLULWeUClnr/q1cGPvJ3o7EIcGbUs9KhGtdC4uJzU4fdFLgiMN+WLcGq qsYi8norCvH60xe2lnxuc7YzeEqGk5W2lOC+PUS+5sLv/QshaUWfxm6KqPiJOBnHAuIA GA0rHAcOKam51io4TGalqz+KKcfsU8O++3l3i34S7vBT4ZVzeGJ35DwnN8nTlWokE0cS t757vn0ruCSnaGwYp+NNyMvHOZaaVIN32hra1LJQoemAU9JGjeCytzWplNK6/OW60Y4g fkt0rJLKYnTSprizMehsxCRezVC6w1mtwI3I4qI2q4M3+FY5fhwnY3ENZOmbsPQSnZN1 Mnyw== X-Gm-Message-State: AOJu0Yz1AO9xakMEhlU+/76lNbwhGwA0uSTPfl+SzefQVPsZeQpX3as8 nVsMBK+rSMPhiStaHkcmr2kUQjKdWG+R8mQCkbY91Mg6dx9oGN+Bal41YVb+0T6uWxma8cty9HS uzprnRlbn6WmChmqRH+FgVcF5PmTkx+7WmBIea3q9ZNXXDAWyE8RDm8gRNLf2AItXpeyGfZ8UxQ == X-Received: by 2002:a17:903:230c:b0:1f6:f318:71d7 with SMTP id d9443c01a7336-1f84e2ecf4amr202295525ad.19.1718605016621; Sun, 16 Jun 2024 23:16:56 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGupfMdS0WD6NixTdYr6ZfcWEtMhu5SpstN18VssrHrcsQGhmU5k6sNEo7ckq0TCT9O5Tg9zA== X-Received: by 2002:a17:903:230c:b0:1f6:f318:71d7 with SMTP id d9443c01a7336-1f84e2ecf4amr202295225ad.19.1718605016152; Sun, 16 Jun 2024 23:16:56 -0700 (PDT) Received: from pc-0182.atmarktech (35.112.198.104.bc.googleusercontent.com. [104.198.112.35]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-1f855f1b146sm73170955ad.244.2024.06.16.23.16.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 16 Jun 2024 23:16:55 -0700 (PDT) Received: from martinet by pc-0182.atmarktech with local (Exim 4.96) (envelope-from ) id 1sJ5fi-009Sm5-23; Mon, 17 Jun 2024 15:16:54 +0900 Date: Mon, 17 Jun 2024 15:16:44 +0900 From: Dominique MARTINET To: Lucas Stach , Adam Ford Cc: linux-arm-kernel@lists.infradead.org, marex@denx.de, Laurent Pinchart , Andrzej Hajda , Neil Armstrong , Robert Foss , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Vinod Koul , Kishon Vijay Abraham I , Liu Ying , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-phy@lists.infradead.org, Makoto Sato Subject: drm/bridge/imx8mp-hdmi-tx: Allow inexact pixel clock frequencies (Was: [PATCH V8 10/12] drm/bridge: imx: add bridge wrapper driver for i.MX8MP DWC HDMI) Message-ID: References: <20240203165307.7806-1-aford173@gmail.com> <20240203165307.7806-11-aford173@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20240203165307.7806-11-aford173@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240616_231720_519545_B22CA6EA X-CRM114-Status: GOOD ( 25.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Adam Ford wrote on Sat, Feb 03, 2024 at 10:52:50AM -0600: > From: Lucas Stach > > Add a simple wrapper driver for the DWC HDMI bridge driver that > implements the few bits that are necessary to abstract the i.MX8MP > SoC integration. Hi Lucas, Adam, (trimmed ccs a bit) First, thank you for the effort of upstreaming all of this!! It's really appreciated, and with display working I'll really be wanting to upstream our DTS as well as soon as I have time (which is going to be a while, but better late than never ?) Until then, it's been a few months but I've got a question on this bit: > diff --git a/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c > new file mode 100644 > index 000000000000..89fc432ac611 > --- /dev/null > +++ b/drivers/gpu/drm/bridge/imx/imx8mp-hdmi-tx.c > +static enum drm_mode_status > +imx8mp_hdmi_mode_valid(struct dw_hdmi *dw_hdmi, void *data, > + const struct drm_display_info *info, > + const struct drm_display_mode *mode) > +{ > + struct imx8mp_hdmi *hdmi = (struct imx8mp_hdmi *)data; > + > + if (mode->clock < 13500) > + return MODE_CLOCK_LOW; > + > + if (mode->clock > 297000) > + return MODE_CLOCK_HIGH; > + > + if (clk_round_rate(hdmi->pixclk, mode->clock * 1000) != > + mode->clock * 1000) > + return MODE_CLOCK_RANGE; Do you know why such a check is here? When plugging in a screen with no frequency identically supported in its EDID this check causes the screen to stay black, and we've been telling customers to override the EDID but it's a huge pain. Commit 6ad082bee902 ("phy: freescale: add Samsung HDMI PHY") already "fixed" the samsung hdmi phy driver to return the next frequency if an exact match hasn't been found (NXP tree's match frequencies exactly, but this gets the first clock with pixclk <= rate), so if this check is also relaxed our displays would work out of the box. I also don't see any other bridge doing this kind of check. drivers/gpu/drm/bridge/imx/imx93-mipi-dsi.c has a similar check with a 0.5% leeway, and all the other drivers don't check anything. If you want to add some level of safety, I think we could make this work with a 5% margin easily... Printing a warning in dmesg could work if you're worried about artifacts, but litteraly anything is better than a black screen with no error message in my opinion. In practice the screen I'm looking at has an EDID which only supports 51.2MHz and the closest frequency supported by the Samsung HDMI phy is 50.4MHz, so that's a ~1.5% difference and it'd be great if it could work out of the box. For reference, the output of edid-decode is as follow: --- edid-decode /sys/devices/platform/display-subsystem/drm/car d1/card1-HDMI-A-1/edid edid-decode (hex): 00 ff ff ff ff ff ff 00 3a 49 03 00 01 00 00 00 20 1e 01 03 80 10 09 00 0a 00 00 00 00 00 00 00 00 00 00 00 00 00 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 01 00 14 00 40 41 58 23 20 a0 20 c8 00 9a 56 00 00 00 18 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 10 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 9a ---------------- Block 0, Base EDID: EDID Structure Version & Revision: 1.3 Vendor & Product Identification: Manufacturer: NRI Model: 3 Serial Number: 1 Made in: week 32 of 2020 Basic Display Parameters & Features: Digital display Maximum image size: 16 cm x 9 cm Gamma: 1.00 RGB color display First detailed timing is the preferred timing Color Characteristics: Red : 0.0000, 0.0000 Green: 0.0000, 0.0000 Blue : 0.0000, 0.0000 White: 0.0000, 0.0000 Established Timings I & II: none Standard Timings: none Detailed Timing Descriptors: DTD 1: 1024x600 59.993 Hz 128:75 38.095 kHz 51.200 MHz (154 mm x 86 m m) Hfront 160 Hsync 32 Hback 128 Hpol N Vfront 12 Vsync 8 Vback 15 Vpol N Dummy Descriptor: Dummy Descriptor: Dummy Descriptor: Checksum: 0x9a --- Thanks, -- Dominique Martinet