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 64632C54EE9 for ; Thu, 22 Sep 2022 14:54:30 +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=IOI3e4nJSAcC14xw59uqM5XgyNKZwQzmVdPGSQrvzGY=; b=gNzbWeSzBNtING T1QUTlBfCXgdTDh0lKnwzYqLGhPyyAJJvk8t8rEZIZ7E9ZCufNKGmSA8Zx4WmxO4APup1M65PkDTR 7zw9exg5Ud7z3DDdm8DmhHCfru8KNO3K0XLsZ31OGD8RPJeSWIPKnWcOQ8egDeKUBGTnRjMseiOxa sAs+aHV+Y5g2x96Nx2+xuR6mHh25DkZJV9kHEUybMGObx9HNj5pWa2XZKi0YAlDBJO25cJqPcHTef Em7HNVsrlZN9Gm7gFhcBa2B0n2UmR0WBjMTmrnfUbtPUxNgLAAuYOQkq03tD2vEAwoGFYg6ME6xoc 2f29c5YDc/tpL1LEjM6g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1obNZX-00GC1V-Rw; Thu, 22 Sep 2022 14:53:05 +0000 Received: from wnew4-smtp.messagingengine.com ([64.147.123.18]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1obNBs-00G1Y5-KF for linux-arm-kernel@lists.infradead.org; Thu, 22 Sep 2022 14:28:38 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 6A2312B05B39; Thu, 22 Sep 2022 10:28:33 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 22 Sep 2022 10:28:36 -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=fm2; t=1663856912; x= 1663864112; bh=VGkHjiQhMRMCyVL2ijEh5S+Moy8bI1ArbHDDZMqvbZY=; b=3 HZfX0k4mXhlZJWQoKk7Bw1VeMc3Enk8nYjuICm6K0p0REO5t03A3VAr8Src+rkhp xmafeBya43sbbPqA3hCR6zw000FmK13d3KS1ujAgAwSlNG5Gsozd4UQoPJ4gBNTl WyC23mZCKua9rM5najnrq0fRj1skavyvDZXx4gvXTsslJZUxWx8jSgXlCqzPC+Hy 4tFqaFB8CBKUfhrFnJ/MBHhMvG3EsOBQelVxpg4jo+ZttJfaWnhO0knyEQKuSDuF U4kfWL3f/lwNnarOAPOJBZLpMjQRqmzSOS90L9vcKmENacmGvtDUYcGKeraeuFKQ 0YXth2NyMEogF5DyQcQdw== 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=fm2; t=1663856912; x= 1663864112; bh=VGkHjiQhMRMCyVL2ijEh5S+Moy8bI1ArbHDDZMqvbZY=; b=k mq4h+C1uVj0SWnT+1QEIb11wpQnn1KA8Mal96p/kZJx3vu93wdai7XnhFFIchg2e CcZpkQRniLD8V84/+McZ/f3LXFXIRMEnWtrA4L5ZCWCuH4vAc3uRc9xhW4Kuxn7O 88YUi+3XuZ4iXBFFfBAYkYMr4AvLEJ7H54DVO6XSFVPRRURbYHsZtsB4m3XZSCFN 3NE8eBfym/1zM1gEreP9hz9j70/I2WmXk3i1htOM1zLduMAvlsEbgst06rhVe9+B YvcJzE8+7hLtZqdvVURajUptjKrNRS9rLdepQvYHmT3Qs6DnX59Tguu8PP6xo2bW aUAYJaMZYN8zMWWwDpoXg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrfeefgedgudejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephfffufggtgfgkfhfjgfvvefosehtkeertdertdejnecuhfhrohhmpeforgig ihhmvgcutfhiphgrrhguuceomhgrgihimhgvsegtvghrnhhordhtvggthheqnecuggftrf grthhtvghrnhepudduudfhveejteefgedvffdvvedvjedugedukeejhedtlefhffevtefh jeeltdevnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomh epmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 22 Sep 2022 10:28:31 -0400 (EDT) From: Maxime Ripard Date: Thu, 22 Sep 2022 16:25:42 +0200 Subject: [PATCH v2 25/33] drm/modes: Introduce more named modes MIME-Version: 1.0 Message-Id: <20220728-rpi-analog-tv-properties-v2-25-f733a0ed9f90@cerno.tech> References: <20220728-rpi-analog-tv-properties-v2-0-f733a0ed9f90@cerno.tech> In-Reply-To: <20220728-rpi-analog-tv-properties-v2-0-f733a0ed9f90@cerno.tech> To: Jernej Skrabec , Rodrigo Vivi , Ben Skeggs , David Airlie , Maxime Ripard , Joonas Lahtinen , Emma Anholt , Karol Herbst , Samuel Holland , Jani Nikula , Thomas Zimmermann , Daniel Vetter , Lyude Paul , Maarten Lankhorst , Tvrtko Ursulin , Chen-Yu Tsai Cc: Hans de Goede , nouveau@lists.freedesktop.org, Geert Uytterhoeven , Dave Stevenson , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Phil Elwell , intel-gfx@lists.freedesktop.org, Noralf Trønnes , Dom Cobley , linux-sunxi@lists.linux.dev, Maxime Ripard , Mateusz Kwiatkowski , dri-devel@lists.freedesktop.org X-Mailer: b4 0.10.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3786; i=maxime@cerno.tech; h=from:subject:message-id; bh=NRfar4ttIL47tq1ByN+4ob7iKyuG0IhiwfgL1fWLpPE=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk6BYH50T99F6+68zFn6YmTH2a2GGhH6BacnVd/WJTJwk1D +oh/RykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACZSVcbwT3+S9LdX758evpaXk9X/hi XgTbSKbPqOkOlFh2OWn75gycTI8OZpWr3KCVOZJoezf/Tn3V+9rGHfHbmuox9UPvxJOrvsJgcA 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-20220922_072836_763899_D8E578F1 X-CRM114-Status: GOOD ( 10.81 ) 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 1ca1f82dfd12..6f315385bd02 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2271,7 +2271,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), + 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), + 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..521505753af9 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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel