From patchwork Mon Nov 14 13:00:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13042354 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 69FFAC4332F for ; Mon, 14 Nov 2022 13:09:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Cun0GTvKQymeqU9TEhR9dayzqKYiKuXUSpMMLfa8/zI=; b=DS81VAzUQB6CIQ ExHlLh1LB+glisZ1M74yYdNVvbvayxw/qi1FwcFmmYJ0n9UjV71guCeUbTjeV7W+cMV/V1mMiBcy+ eaEAJuh5zSiY+jHs1HKUhdafcd5rhRQD5pJSWbecWh6UnF3xZSSOS2HkhDjys28gVTqC9K3sXjW4+ xFHyKm2GoiuQrETlnuKByUK7naw2V3n55NdvbW6CBa3woRYnFRTyV0Z6R9JI4t8A5cN7yygGMDzyG CTEaoI41CsVf0SR825CDNjOTREkCjOYKNhAMnBenTy0G1zhRrjp9clPGUpKqZqSLrZ/gBNwNY5DXW Y1TVRSGZMwMhfGo/dNPA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouZC3-0014s6-9G; Mon, 14 Nov 2022 13:08:08 +0000 Received: from new4-smtp.messagingengine.com ([66.111.4.230]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ouZ5C-0010iV-5y for linux-arm-kernel@lists.infradead.org; Mon, 14 Nov 2022 13:01:06 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.nyi.internal (Postfix) with ESMTP id 81A68580242; Mon, 14 Nov 2022 08:01:01 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Mon, 14 Nov 2022 08:01:01 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cerno.tech; h=cc :cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm2; t=1668430861; x= 1668438061; bh=61rty2/E8oljmyBXznF/xHiRnimp90eqyhoo5j5+1vg=; b=k vn0/gcOe2bcD3T4vnTzJZXYFDndXfI717ZkXcOtDUrMmOSp9b12s8ROTiuWzZyWY 8e06oDboqNct+HWt+UyZOUmYwPrRHZ0m18y6ZGvkMv3cQHNwMmALa3OaPL2vK5GV 81Xk4g8cATjNXXj4cm4TnTURvtSWyzqRqT6ouJfUA5cRf5gdR+G9dKHLAPtmfPzR pMwERWez8f2QecPyk+A6CRsdAUnw0hOV6Ej9oodRepq+4gRKQ/4LSdCky8FlM/vq InfMktLwXtPUdQK0xJkD42IYtiwUWDObZo1s/28f6TC2A1xw0HefEA8MsKfqWjz1 S1BL0Htk0naZywF6iWvZw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1668430861; x= 1668438061; bh=61rty2/E8oljmyBXznF/xHiRnimp90eqyhoo5j5+1vg=; b=F L6zwW4/YPquvmOagnK7qGqybwqixm+D3VbzF6+AETr7fFW6ajBEc6tdetAGABPZn Mg/3pia98WlXPaQ4sQwGUmbuYo/fctxnPuXm960hC8r2ZC2kvktADPak5ATwBsgR T5w7W96epWx74wfFny8lcSMJNLCYA2+ehcv8WCqshHiWU+6fvlTBihX9lZmthFxF Hsnu7MDx/dvq8BFKn8QJQR/WAGADj4/GRwZ6ZGxBnmaCxlMfFKjpO8dcEtqUzjaN N++DT3//zfubYJu5X07gciWIYPMxseXvqgfHYq601YkAZS9TPVQg0X65Hsy2Avn3 i+SNly0X0MrkEiIGHpcdg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrgedvgddvtdcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffuggfgtgfkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpedvgfevjefhtdetveevhfelieeuueetgfdvgeevkeegudejffegfffgtedt leelhfenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 14 Nov 2022 08:00:59 -0500 (EST) From: Maxime Ripard Date: Mon, 14 Nov 2022 14:00:31 +0100 Subject: [PATCH v9 12/25] drm/connector: Add pixel clock to cmdline mode MIME-Version: 1.0 Message-Id: <20220728-rpi-analog-tv-properties-v9-12-24b168e5bcd5@cerno.tech> References: <20220728-rpi-analog-tv-properties-v9-0-24b168e5bcd5@cerno.tech> In-Reply-To: <20220728-rpi-analog-tv-properties-v9-0-24b168e5bcd5@cerno.tech> To: Maxime Ripard , Karol Herbst , Samuel Holland , Joonas Lahtinen , Daniel Vetter , Chen-Yu Tsai , Maarten Lankhorst , Lyude Paul , Thomas Zimmermann , Emma Anholt , Jani Nikula , Rodrigo Vivi , Ben Skeggs , Tvrtko Ursulin , David Airlie , Jernej Skrabec Cc: =?unknown-8bit?q?Dom_Cobley_=3Cdom=40raspberrypi=2Ecom=3E=2C_Phil_Elwell?= =?unknown-8bit?q?_=3Cphil=40raspberrypi=2Ecom=3E=2C?= =?unknown-8bit?q?_Mateusz_Kwiatkowski_=3Ckfyatek+publicgit=40gmail=2Ecom=3E?= =?unknown-8bit?q?=2C_nouveau=40lists=2Efreedesktop=2Eorg=2C?= =?unknown-8bit?q?_Dave_Stevenson_=3Cdave=2Estevenson=40raspberrypi=2Ecom=3E?= =?unknown-8bit?q?=2C_Hans_de_Goede_=3Chdegoede=40redhat=2Ecom=3E=2C_intel-g?= =?unknown-8bit?q?fx=40lists=2Efreedesktop=2Eorg=2C?= =?unknown-8bit?q?_dri-devel=40lists=2Efreedesktop=2Eorg=2C_linux-kernel=40vg?= =?unknown-8bit?q?er=2Ekernel=2Eorg=2C_linux-arm-kernel=40lists=2Einfradead?= =?unknown-8bit?q?=2Eorg=2C?= =?unknown-8bit?q?_Noralf_Tr=C3=B8nnes_=3Cnoralf=40tronnes=2Eorg=3E=2C_Geert_?= =?unknown-8bit?q?Uytterhoeven_=3Cgeert=40linux-m68k=2Eorg=3E=2C_Maxime_Ripa?= =?unknown-8bit?q?rd_=3Cmaxime=40cerno=2Etech=3E=2C?= =?unknown-8bit?q?_linux-sunxi=40lists=2Elinux=2Edev?= X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2368; i=maxime@cerno.tech; h=from:subject:message-id; bh=tc8kW46OoOxieuA+Cy7NUL9yuFca/SG7rd9wEiGcUPg=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMlF1q9jO/4xvl+6ZGJE/+ntXcK+V/+yr3a9fPyf6Nw1c/+p f1nm31HKwiDGxSArpsgSI2y+JO7UrNedbHzzYOawMoEMYeDiFICJqIgwMjxPP7K0I4V97wX5GX92ZL XWTLOIyvfzdOVi8qp6taMo6iPDfx/diPP+Z31TTFJjqrzVXGdaTrg9XWtN4Ufv8Gy7ByF57AA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221114_050105_074357_46C48CD4 X-CRM114-Status: GOOD ( 11.90 ) 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 We'll need to get the pixel clock to generate proper display modes for all the current named modes. Let's add it to struct drm_cmdline_mode and fill it when parsing the named mode. Reviewed-by: Noralf Trønnes Tested-by: Mateusz Kwiatkowski Signed-off-by: Maxime Ripard --- Changes in v7: - Add Noralf Reviewed-by:w --- drivers/gpu/drm/drm_modes.c | 9 ++++++--- include/drm/drm_connector.h | 7 +++++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index acee23e1a8b7..c826f9583a1d 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2226,22 +2226,24 @@ static int drm_mode_parse_cmdline_options(const char *str, struct drm_named_mode { const char *name; + unsigned int pixel_clock_khz; unsigned int xres; unsigned int yres; unsigned int flags; }; -#define NAMED_MODE(_name, _x, _y, _flags) \ +#define NAMED_MODE(_name, _pclk, _x, _y, _flags) \ { \ .name = _name, \ + .pixel_clock_khz = _pclk, \ .xres = _x, \ .yres = _y, \ .flags = _flags, \ } static const struct drm_named_mode drm_named_modes[] = { - NAMED_MODE("NTSC", 720, 480, DRM_MODE_FLAG_INTERLACE), - NAMED_MODE("PAL", 720, 576, DRM_MODE_FLAG_INTERLACE), + NAMED_MODE("NTSC", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE), + NAMED_MODE("PAL", 13500, 720, 576, DRM_MODE_FLAG_INTERLACE), }; static int drm_mode_parse_cmdline_named_mode(const char *name, @@ -2282,6 +2284,7 @@ static int drm_mode_parse_cmdline_named_mode(const char *name, continue; strcpy(cmdline_mode->name, mode->name); + cmdline_mode->pixel_clock = mode->pixel_clock_khz; cmdline_mode->xres = mode->xres; cmdline_mode->yres = mode->yres; cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 9afc7956fdc6..4927dcb2573f 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1273,6 +1273,13 @@ struct drm_cmdline_mode { */ bool bpp_specified; + /** + * @pixel_clock: + * + * Pixel Clock in kHz. Optional. + */ + unsigned int pixel_clock; + /** * @xres: *