From patchwork Mon Nov 7 14:16:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 13034476 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 5E54EC433FE for ; Mon, 7 Nov 2022 14:24:27 +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=FfwzNZKlQ4oj9jGf5mUAVXDsBKDFx8yomf8jQb8r95w=; b=WQTF3TC8L2vduk /Ftq3/LBZdS2jpD8VR+UbkpmnDDRZwcV8pvxYiOlEQjWcdzERIGR5bjkpCCSFmEk3+SLsXiRJu9rC XKJJ/guo8JtLRfLZv9eCzsJ9RMCUMzPfJFqnou/ba+nuv/Ftcbjy7rl4whxnIxfa4BORZ+MhZCW8w 10gbyrJYaJmIAfyNVXSHqUXgKkW1zVclnxu25H+l4NSzLJ7ChMFjsfkOL1Cxs7wGypkG1SSIs5Jqs noZfJpDWAVTLWiaAuQUDPzYV4sn1ed4yUTq4afzwHf1bd57XtG8XDebzniWGlTxWFqMV7+PQ+zZYf UoRKLArvCXHOJFwHCrPQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1os31r-00FCnt-AE; Mon, 07 Nov 2022 14:23:14 +0000 Received: from wnew2-smtp.messagingengine.com ([64.147.123.27]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1os2wP-00FA5C-V9 for linux-arm-kernel@lists.infradead.org; Mon, 07 Nov 2022 14:17:35 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 54CB12B066F5; Mon, 7 Nov 2022 09:17:31 -0500 (EST) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 07 Nov 2022 09:17:33 -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=1667830650; x= 1667837850; bh=yoj5WKvcN+DitFS3PC/brG0rlVlDPy2pHx+FgtWCUOQ=; b=F 4yMM16gNESoKQxrnq06Wlr9Vne62jGwIu3bpBYF2RiZ7tjGsgy7WUUQed+aA/0W3 qQ2MpC+KD7f9Bt3/VRLYVqNaUxOo4+0U93Or63Lx5tn6B5JzIODWmNwLjv+jawFM VrfREupvUX0DPB0bQuLlaZ9qmCmycKljp7uu1pYxHZwAN4MhQE5i6VN44pui4BAX KGl3rY2GrrT+fYSwx1OD34jQEvxZQ42bOdfbLlyDlJfZ4pb4tsPD6qM2au3cbGFN QcGWyHjztiHr9g/Uh0yHmnZ28u6Z2+iPHjBhtihE8gl7mM3je7ldqFcpEk0HKkJE xBH2eHEYrtJDNe4al/GKA== 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=1667830650; x= 1667837850; bh=yoj5WKvcN+DitFS3PC/brG0rlVlDPy2pHx+FgtWCUOQ=; b=a Um4mBk/m1lnzZ+IBrWdO75uNC8APlMQ2D0NmyPv0XrimHhK1oezgifDjKnyn7RHk MLtX7lDVKOw5QG3WVI+wMSL/sWQSLgNWUkifAEhxqBkuGSZw2aaNDFp/GN0G54sZ ZqKLBE5Vz81CM4I2UvIpqo14ednf8a17f0HdXPLW1QSb2wRWZ3POOzK/jrlE15t5 G5J9DULRp+bnlcDbT54vo7Xcp1+X2OHJVUk/BQOEnkW6ZSy/opYYlKp0y+tera47 tsUhy190O5sj1t+H8Fqd5vt9ORB/OFR7OG1fa6etoCYmwZ7hVsLX03coL8Kg6rjo MEYFF2xHQWiK++zGn3R6g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrvdekgdeiudcutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhfffuggfgtgfkfhgjvfevofesthekredtredtjeenucfhrhhomhepofgrgihi mhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtffrrg htthgvrhhnpedvgfevjefhtdetveevhfelieeuueetgfdvgeevkeegudejffegfffgtedt leelhfenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhrohhmpe hmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 7 Nov 2022 09:17:30 -0500 (EST) From: Maxime Ripard Date: Mon, 07 Nov 2022 15:16:37 +0100 Subject: [PATCH v7 11/23] drm/connector: Add pixel clock to cmdline mode MIME-Version: 1.0 Message-Id: <20220728-rpi-analog-tv-properties-v7-11-7072a478c6b3@cerno.tech> References: <20220728-rpi-analog-tv-properties-v7-0-7072a478c6b3@cerno.tech> In-Reply-To: <20220728-rpi-analog-tv-properties-v7-0-7072a478c6b3@cerno.tech> To: Jani Nikula , Joonas Lahtinen , Tvrtko Ursulin , Ben Skeggs , Rodrigo Vivi , Maxime Ripard , Samuel Holland , Jernej Skrabec , Maarten Lankhorst , Emma Anholt , Karol Herbst , Daniel Vetter , Chen-Yu Tsai , Lyude Paul , Thomas Zimmermann , David Airlie Cc: =?unknown-8bit?q?Phil_Elwell_=3Cphil=40raspberrypi=2Ecom=3E=2C_Maxime_Ri?= =?unknown-8bit?q?pard_=3Cmaxime=40cerno=2Etech=3E=2C_Hans_de_Goede_=3Chdego?= =?unknown-8bit?q?ede=40redhat=2Ecom=3E=2C?= =?unknown-8bit?q?_linux-sunxi=40lists=2Elinux=2Edev=2C_linux-kernel=40vger?= =?unknown-8bit?q?=2Ekernel=2Eorg=2C_Geert_Uytterhoeven_=3Cgeert=40linux-m68?= =?unknown-8bit?q?k=2Eorg=3E=2C?= =?unknown-8bit?q?_Dave_Stevenson_=3Cdave=2Estevenson=40raspberrypi=2Ecom=3E?= =?unknown-8bit?q?=2C_linux-arm-kernel=40lists=2Einfradead=2Eorg=2C_Dom_Cobl?= =?unknown-8bit?q?ey_=3Cdom=40raspberrypi=2Ecom=3E=2C?= =?unknown-8bit?q?_Mateusz_Kwiatkowski_=3Ckfyatek+publicgit=40gmail=2Ecom=3E?= =?unknown-8bit?q?=2C_dri-devel=40lists=2Efreedesktop=2Eorg=2C_intel-gfx=40l?= =?unknown-8bit?q?ists=2Efreedesktop=2Eorg=2C?= =?unknown-8bit?q?_nouveau=40lists=2Efreedesktop=2Eorg=2C_Noralf_Tr=C3=B8nnes?= =?unknown-8bit?q?_=3Cnoralf=40tronnes=2Eorg=3E?= X-Mailer: b4 0.11.0-dev-99e3a X-Developer-Signature: v=1; a=openpgp-sha256; l=2306; i=maxime@cerno.tech; h=from:subject:message-id; bh=5aHCX2d0S94yyJeG+Ur00vibzmjncq+gbdTOB8Bo01E=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMmZwg6/ZdpMwvc5vtVXfOdQ+zv3qdW0P9fF3ct1O/QmuWTs KNDvKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwES4vzMy3Dl7dkr8x9Pqs8Tl/4jrnl 3+74qW8pSjs/3dHMOm/JNwcWf4n/qsZrvvKu8JGT/MOKeJzdfObbp956NxwvcsmY+Xd8+5wQ0A 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-20221107_061734_110942_D4E9949A X-CRM114-Status: GOOD ( 11.85 ) 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 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: *