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 9A47CECAAD2 for ; Mon, 29 Aug 2022 13:32: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: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Q9KCHX6r7+bzFdYwReNfeiK2cRp49JvUzcDwuXyEiJU=; b=EVIxYFI2Ts4k1L 8q9try7l32XrzebV/3tXHc/OJ62Z7Dgt+gGvJpF7/yUcY1Q2g/QaXnSyUFcnwCqms4IZfmrWxKTr2 A8TO+slX3sx4Sf3FGm5Me1EQn2n05UWIxwDMzX8JBaZPz8me8Vr1+BjbiWL91v51CMY/BdUN04TeL htf/vrXO6T0kdGme8GW+URPe4W+EikVbiOFS/qTqD68PhOPk1rmZQzZcka+aYf8OPM1k+BUzx1csO qmMvSNYiDbhzM5JJat4Y6agETk5WOoBJggBXZGyifH2fBQ5AtIRWBECBwqOBvrO6GEmZPsVQxChaC yrKRnWLKCnckBBcM5Dfw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oSeqs-00Ajb7-Mh; Mon, 29 Aug 2022 13:30:58 +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 1oSeau-00Aanv-Qu for linux-arm-kernel@lists.infradead.org; Mon, 29 Aug 2022 13:14:29 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 86C652B06068; Mon, 29 Aug 2022 09:14:21 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 29 Aug 2022 09:14:24 -0400 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=fm3; t=1661778861; x= 1661786061; bh=xUx69T5hX2fgzzekWs43tH6MuWLfYP/NBJA83S5iUhw=; b=n Hy/7HUsYkgrW14q8p1uy250uAZbY1KARPRC0O0Sy4Ypv/7S93iuq1fpjUdC/0sls LAeU1IZCq6vcxzfZdoNkycdvXaXfqhk5wefGc9e3SLhituyood978j4RjIWrqOkA bSyHJGOr9SvDjPXb+PRV/aZwyYIUWcV8zJCAsUWMXVy2/RlA56naS/1to2iIr5yS YmNLMB9PsKL4yFAfRqEI3NZLCAjBxmKA1DBnSMjRfGnX0HNOm0ZFR7GRVaA+gn2i i6ScUh6a7b7txa9sLSXmyew8l9b91Jr3FzfvAQBU+xV7UjO67bYN9FWgK51D7g68 HShIg3o5jZOJC2BEdPl6g== 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=1661778861; x= 1661786061; bh=xUx69T5hX2fgzzekWs43tH6MuWLfYP/NBJA83S5iUhw=; b=E DrVv8npucDXn8znu1Xw/Cg/2kCDmlNTJEE3eTfRJclXfKCYQnzxRtsOLfzEuuS4x XXfM4kjKJGf3LKOAaQ+bBz5HfE7vECbPTItsx11CxozlX1WBUG2b/xjsW4ssKMq/ 8I/7CpHL12sIjg6QkOUfzaQ3sSdKujcj97GpMVkpqgbHfdToyOaVV9oPioFqglFS 0fZ06H18MaffNnN+TLtt7hMZ2NVlbB8K7N0qb/88SriKuhwqb/93v0IzisdxgP9w RuxnfhS+kTgKr2OiTgw42X2gI7R7wdgB2C2PcPagKCleZknqE/PJObV8U8qvIlta 9T7YSwZJ/tLYlpFlt67MQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:14:19 -0400 (EDT) From: Maxime Ripard To: Maxime Ripard , Ben Skeggs , David Airlie , Chen-Yu Tsai , Thomas Zimmermann , Jani Nikula , Lyude Paul , Philipp Zabel , Maarten Lankhorst , Rodrigo Vivi , Tvrtko Ursulin , Jernej Skrabec , Samuel Holland , Karol Herbst , =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Cc: Maxime Ripard , Hans de Goede , linux-arm-kernel@lists.infradead.org, Phil Elwell , intel-gfx@lists.freedesktop.org, Dave Stevenson , dri-devel@lists.freedesktop.org, Dom Cobley , linux-kernel@vger.kernel.org, nouveau@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Mateusz Kwiatkowski , Geert Uytterhoeven Subject: [PATCH v2 21/41] drm/modes: Introduce more named modes Date: Mon, 29 Aug 2022 15:11:35 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-21-459522d653a7@cerno.tech> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20220728-rpi-analog-tv-properties-v2-0-459522d653a7@cerno.tech> References: <20220728-rpi-analog-tv-properties-v2-0-459522d653a7@cerno.tech> MIME-Version: 1.0 X-Mailer: b4 0.10.0-dev-65ba7 X-Developer-Signature: v=1; a=openpgp-sha256; l=3800; i=maxime@cerno.tech; h=from:subject:message-id; bh=MTZV8fIdkeaI3gBczvsnL6767uj0eKwoOw+fn2Eyp+g=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxRWxrxndmPbOMnEY/o9m4c6jcZly8Ivhs2Zuejp2hea D7WfdpSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAiSR6MDFvjroqr7pA2NDPrPO2rVH QqfA+fdt69P52FcWGcmhv/CTD8M7Xdvbdq8/cN91UC71Sw7mCM2cLc92+p8JbEy6Zq03nrOQE= 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-20220829_061425_008228_B9558832 X-CRM114-Status: UNSURE ( 9.07 ) X-CRM114-Notice: Please train this message. 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that we can easily extend the named modes list, let's add a few more analog TV modes that were used in the wild, and some unit tests to make sure it works as intended. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 065dbfbd815e..7d769de4d31b 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2254,7 +2254,9 @@ struct drm_named_mode { static const struct drm_named_mode drm_named_modes[] = { NAMED_MODE("NTSC", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_NTSC_M), + NAMED_MODE("NTSC_J", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_NTSC_J), NAMED_MODE("PAL", 13500, 720, 576, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_PAL_B), + NAMED_MODE("PAL_M", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_PAL_M), }; static int drm_mode_parse_cmdline_named_mode(const char *name, diff --git a/drivers/gpu/drm/tests/drm_client_modeset_test.c b/drivers/gpu/drm/tests/drm_client_modeset_test.c index 4380cf670fb4..d6ecb5fbe159 100644 --- a/drivers/gpu/drm/tests/drm_client_modeset_test.c +++ b/drivers/gpu/drm/tests/drm_client_modeset_test.c @@ -140,6 +140,32 @@ static void drm_pick_cmdline_named_ntsc(struct kunit *test) KUNIT_EXPECT_TRUE(test, drm_mode_equal(drm_mode_analog_ntsc_480i(drm), mode)); } +static void drm_pick_cmdline_named_ntsc_j(struct kunit *test) +{ + struct drm_client_modeset_test_priv *priv = test->priv; + struct drm_device *drm = priv->drm; + struct drm_connector *connector = &priv->connector; + struct drm_cmdline_mode *cmdline_mode = &connector->cmdline_mode; + struct drm_display_mode *mode; + const char *cmdline = "NTSC_J"; + int ret; + + KUNIT_ASSERT_TRUE(test, + drm_mode_parse_command_line_for_connector(cmdline, + connector, + cmdline_mode)); + + mutex_lock(&drm->mode_config.mutex); + ret = drm_helper_probe_single_connector_modes(connector, 1920, 1080); + mutex_unlock(&drm->mode_config.mutex); + KUNIT_ASSERT_GT(test, ret, 0); + + mode = drm_connector_pick_cmdline_mode(connector); + KUNIT_ASSERT_PTR_NE(test, mode, NULL); + + KUNIT_EXPECT_TRUE(test, drm_mode_equal(drm_mode_analog_ntsc_480i(drm), mode)); +} + static void drm_pick_cmdline_named_pal(struct kunit *test) { struct drm_client_modeset_test_priv *priv = test->priv; @@ -166,10 +192,38 @@ static void drm_pick_cmdline_named_pal(struct kunit *test) KUNIT_EXPECT_TRUE(test, drm_mode_equal(drm_mode_analog_pal_576i(drm), mode)); } +static void drm_pick_cmdline_named_pal_m(struct kunit *test) +{ + struct drm_client_modeset_test_priv *priv = test->priv; + struct drm_device *drm = priv->drm; + struct drm_connector *connector = &priv->connector; + struct drm_cmdline_mode *cmdline_mode = &connector->cmdline_mode; + struct drm_display_mode *mode; + const char *cmdline = "PAL_M"; + int ret; + + KUNIT_ASSERT_TRUE(test, + drm_mode_parse_command_line_for_connector(cmdline, + connector, + cmdline_mode)); + + mutex_lock(&drm->mode_config.mutex); + ret = drm_helper_probe_single_connector_modes(connector, 1920, 1080); + mutex_unlock(&drm->mode_config.mutex); + KUNIT_ASSERT_GT(test, ret, 0); + + mode = drm_connector_pick_cmdline_mode(connector); + KUNIT_ASSERT_PTR_NE(test, mode, NULL); + + KUNIT_EXPECT_TRUE(test, drm_mode_equal(drm_mode_analog_ntsc_480i(drm), mode)); +} + static struct kunit_case drm_pick_cmdline_tests[] = { KUNIT_CASE(drm_pick_cmdline_res_1920_1080_60), KUNIT_CASE(drm_pick_cmdline_named_ntsc), + KUNIT_CASE(drm_pick_cmdline_named_ntsc_j), KUNIT_CASE(drm_pick_cmdline_named_pal), + KUNIT_CASE(drm_pick_cmdline_named_pal_m), {} }; -- b4 0.10.0-dev-65ba7 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel