From patchwork Mon Aug 29 13:11:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957861 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 23354ECAAD2 for ; Mon, 29 Aug 2022 13:20:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8A05310F1FA; Mon, 29 Aug 2022 13:20:54 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 0AB1110F2A1; Mon, 29 Aug 2022 13:20:48 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 590872B05FB1; Mon, 29 Aug 2022 09:12:08 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:12:11 -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=1661778727; x= 1661785927; bh=zJuhyh+MgUs2/ekVdAk6Kq0Wq9YXzzJHxtL6DSlw5Og=; b=k zHKsj20k4Y1V8oAN8pdbv09/LtrrxTfu6xKOFoSAUycKY4JOCCduqUyHRsntS+et IM7lsrOH6nm6Xvsq+47vfHBvEr0Y/tnvEYZ9AZRuwMvJKshBkHYwIr0rsrRUTbcy eshM1LtLdsFXNWZpBPBNeZdII53z+surSm2v4H52XqXT2iPAxWt6XWWmZJ3Szayn hKsvgPEb0g6q75CiYQFpjlWl5caWAQa+xouZv1UrhAnBpvEIVqPs1HqeTmm5ctzu KkdCker+kfOnOswaCFFSnMdAle5IJ+9lEAoYCy0CvxFx97g3zMgFm1NVJ/uDFRSf GihPrFbwQgqt0zuKmOTyw== 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=1661778727; x= 1661785927; bh=zJuhyh+MgUs2/ekVdAk6Kq0Wq9YXzzJHxtL6DSlw5Og=; b=c ftMy0ztc0ShuXT+IqZw9bSUt5U+hyi2h7n8R0hLq8ouh5wBvh8zAu21pCESuKn8W KI5HZPBSaCwI1wtEfCMioTeUGA3//z1fTeIsA6vwnhwzSG47jchavbSTLUm0p69H oTKi93f3Wp6v1t5Ewnb3dxc1s4KmxA3XKGTmQvOpH1wBToONSX5LjiER/4YqMiDf Ikccon49YxgN5GnbLTg6lQPa9MqR0IbVJnigiGqp2E6KD5OMq1IBDfNI45OuceV0 Hztcgf7kTuhCWGaiwZGHkAIsP0DZKSa8uAgTGz9FzqKlStgpybjelId3VGvucdxe FyDKkY9hH8yEXd0jLm18w== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:12:06 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:15 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-1-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=1038; i=maxime@cerno.tech; h=from:subject:message-id; bh=7wf09uYZmOlzEdMLSbfvbGYOI6J6pbrZA084PMpLFI8=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+QCtJc+19tw1dnPLoUp63uAlPSLTZNOzt7jFLTp8xRp vUd1HaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZiIxwyGvwJi6fvdU59tEF2+1WaTqG fLLKOP7P4v1x/7V8fsu+XSoRhGht/bauWCa76+r5Cz/DXnwv07FYkCMW2rF6967BCaNfWRFB8A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 01/41] drm/tests: Order Kunit tests in Makefile X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Since we've recently added a ton of tests, the list starts to be a bit of a mess and creates unneeded conflicts. Let's order it alphabetically. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/tests/Makefile b/drivers/gpu/drm/tests/Makefile index 91b70f7d2769..2d9f49b62ecb 100644 --- a/drivers/gpu/drm/tests/Makefile +++ b/drivers/gpu/drm/tests/Makefile @@ -1,5 +1,13 @@ # SPDX-License-Identifier: GPL-2.0 -obj-$(CONFIG_DRM_KUNIT_TEST) += drm_format_helper_test.o drm_damage_helper_test.o \ - drm_cmdline_parser_test.o drm_rect_test.o drm_format_test.o drm_plane_helper_test.o \ - drm_dp_mst_helper_test.o drm_framebuffer_test.o drm_buddy_test.o drm_mm_test.o +obj-$(CONFIG_DRM_KUNIT_TEST) += \ + drm_buddy_test.o \ + drm_cmdline_parser_test.o \ + drm_damage_helper_test.o \ + drm_dp_mst_helper_test.o \ + drm_format_helper_test.o \ + drm_format_test.o \ + drm_framebuffer_test.o \ + drm_mm_test.o \ + drm_plane_helper_test.o \ + drm_rect_test.o From patchwork Mon Aug 29 13:11:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957875 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 2AB5BECAAD5 for ; Mon, 29 Aug 2022 13:21:20 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CEFAB10F2D9; Mon, 29 Aug 2022 13:21:13 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id C0CD510F2CF; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 72EC62B05F9B; Mon, 29 Aug 2022 09:12:15 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 29 Aug 2022 09:12:18 -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=1661778734; x= 1661785934; bh=ELfkVxUr/la37A7msWR/2jnnu/mFwFNLuNnzkr6V0mg=; b=O 5gzqV7pYTkeD9LdWrNNZzPJ5npg15h0PMl0JEq/NEZwH5E5AFm5az6ZFcPLpToIb 5TjeWBhkrRrJNk2p0G6XUUV/0SOMr00N9NoQlffJrJRFh+MS1uSASARym+GT47OW esM33Tj8ZK6LII08ud8MjButKRh3DlQx98EnUzq0aeUEVeL1kmPAllng07KEKmWq Lmwy2eqsd/LAY2M20DeQxcMVaNgFF2escO1umOLxsxIOLlix9iDINm/m3WdpAOFd UPve3yeXAnbP3w90QobblR9uj3vLw4hZe/gGqn2/L0QRguVUSW9+6oM1szRTGl4e 5CDr2kqGGN0a4UWiR5EnQ== 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=1661778734; x= 1661785934; bh=ELfkVxUr/la37A7msWR/2jnnu/mFwFNLuNnzkr6V0mg=; b=G K0c86PPa4XUcKDqrVNDLDw+NEzkns7uXqzmwzJePQK2l17VlFmjoGwhzDFmeaSZK 4dKRPAHwsRIK6vAg3rnnrcFyZc3lPOQBRW8fc85VhLQfnibdRe4yVDL+weUyiSo8 vqeJtSIE6Z4JHifBsLQQagdUHyMMQLK/Q0XjP9jE2EwDTwMGy0KGE0UOj7TGKQpg 3Uvp5ZpaREBUFZOPgkKNbZ6guHd5k/Emn6ct3wgNpV2+lyHsrxpofY2SlqYhM09v PmpUxsze7vDLo0sd0K5/3dZ1TpLJW30JUiS4BbvetzA2SOks8Lc0b+Xi3BJBdP4O xahFOaMIq4nkEPF2xtowg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:12:13 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:16 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-2-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=2642; i=maxime@cerno.tech; h=from:subject:message-id; bh=epeQixwNzn3d4RRhZr1OO6FT9bd6N3aHX8QjcYiaO/E=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+QXbWpvWW/meZV/YSi7V3O/Ofv3//lZt0IEMz9bz9t9 Lo+5o5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABNZd5Dhf1r92Zv9Cuav0/P7mybwHA ldVZWw9bdPmkjD3d164mz5nxj+Rz1ZMF0lJ1S06Mg+q2PssQsu699Zt+hR3COJV3VTz/QbMQEA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 02/41] drm/tests: Add Kunit Helpers X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" As the number of kunit tests in KMS grows further, we start to have multiple test suites that, for example, need to register a mock DRM driver to interact with the KMS function they are supposed to test. Let's add a file meant to provide those kind of helpers to avoid duplication. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/tests/Makefile b/drivers/gpu/drm/tests/Makefile index 2d9f49b62ecb..b29ef1085cad 100644 --- a/drivers/gpu/drm/tests/Makefile +++ b/drivers/gpu/drm/tests/Makefile @@ -8,6 +8,7 @@ obj-$(CONFIG_DRM_KUNIT_TEST) += \ drm_format_helper_test.o \ drm_format_test.o \ drm_framebuffer_test.o \ + drm_kunit_helpers.o \ drm_mm_test.o \ drm_plane_helper_test.o \ drm_rect_test.o diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.c b/drivers/gpu/drm/tests/drm_kunit_helpers.c new file mode 100644 index 000000000000..7ebd620481c1 --- /dev/null +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.c @@ -0,0 +1,54 @@ +#include +#include + +#include + +static const struct drm_mode_config_funcs drm_mode_config_funcs = { +}; + +static const struct drm_driver drm_mode_driver = { +}; + +static void drm_kunit_free_device(struct drm_device *drm, void *ptr) +{ + struct device *dev = ptr; + + root_device_unregister(dev); +} + +struct drm_device *drm_kunit_device_init(const char *name) +{ + struct drm_device *drm; + struct device *dev; + int ret; + + dev = root_device_register(name); + if (IS_ERR(dev)) + return ERR_CAST(dev); + + drm = drm_dev_alloc(&drm_mode_driver, dev); + if (IS_ERR(drm)) { + root_device_unregister(dev); + return ERR_CAST(drm); + } + drm->mode_config.funcs = &drm_mode_config_funcs; + + ret = drmm_add_action_or_reset(drm, drm_kunit_free_device, dev); + if (ret) + goto err_put_device; + + ret = drmm_mode_config_init(drm); + if (ret) + return ERR_PTR(ret); + + return drm; + +err_put_device: + drm_dev_put(drm); + return ERR_PTR(ret); +} + +void drm_kunit_device_exit(struct drm_device *drm) +{ + drm_dev_put(drm); +} diff --git a/drivers/gpu/drm/tests/drm_kunit_helpers.h b/drivers/gpu/drm/tests/drm_kunit_helpers.h new file mode 100644 index 000000000000..5015a327a8c1 --- /dev/null +++ b/drivers/gpu/drm/tests/drm_kunit_helpers.h @@ -0,0 +1,9 @@ +#ifndef DRM_KUNIT_HELPERS_H_ +#define DRM_KUNIT_HELPERS_H_ + +struct drm_device; + +struct drm_device *drm_kunit_device_init(const char *name); +void drm_kunit_device_exit(struct drm_device *drm); + +#endif // DRM_KUNIT_HELPERS_H_ From patchwork Mon Aug 29 13:11:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957867 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 4910EECAAD5 for ; Mon, 29 Aug 2022 13:21:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1504710F298; Mon, 29 Aug 2022 13:21:03 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 596F910F299; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 1B2BE2B05FBA; Mon, 29 Aug 2022 09:12:22 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 09:12: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=1661778741; x= 1661785941; bh=ZOUld/v3fqwEg7IGW6tGDT41DPLt0Lfah3fjUTcgbpc=; b=g /ygx+NnVHUz6W/ywvCNFn+xh02OQ9tp8JwGbVFSgUpKdqiZgP+rMKsG+ccUmaZFD NfIVtp8ks3/1noWIAhRcteJNxYvp80NwrR7+7FnNrbC2NAn2DTzzgklKp6pm3O9U fOIJh7z1FGq2+Y/Nsij9cm2CXFHOpdbk9Ul+KRCdB7yc5iDVSOrrgh2Cdbs9K6A8 oX8Sk8Ubakai78jUa+snPaON4nMyYT3ljuenOGVTucwlcRCgN1nzeS8GYEODKkAE KrRRF46Se+tr81L1RcBSh3Qv3wAhbiARzvuZPgcc8tLNR17ZsLFKBPtEfC4rlPRE RHKQRigOW75k4r1FaureQ== 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=1661778741; x= 1661785941; bh=ZOUld/v3fqwEg7IGW6tGDT41DPLt0Lfah3fjUTcgbpc=; b=A TT3OGdl6RU9/Rm4elzm4Exq3UNekOVV2wqAtiTRgHBHxqEhxsvcJHGo1A2QcB+FM z9P1+/jteDn4vEXuQtKj9MHCbXjwyUIPZ6UMtjouSPE/v5pP2mf5p+kNrdvn2k4W seNi4/81QXJJ7f0llZVKhMijHBc56e4CQ5YAqH3MsvaqVWg3yBG7PKvuRj5pGXZ3 NqiUC7FGHjiFmwzhrVFU5JqBBzpYziDgO5xxzl9L0HxUqil1gh/aSdr8/ZwDkPBQ /zNw2skRv4k+x61ovk5t3DyzFEgzbHogPhlEILFDa+XIK6l/ypl0h3d1ZjuAVwH9 2NIXJAvKzNmK/GfMx1WyA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgiedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpedvueehkefhhefghedugefhieevhfdvudegleeuteetlefgudevgfet kedtlefhtdenucffohhmrghinhepmhgrrhhgihhnshdrthhophenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdr thgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:12:20 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:17 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-3-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=4933; i=maxime@cerno.tech; h=from:subject:message-id; bh=tneD6WL3cA9YngB/zjXILq0672FR3xbphbAAyAQ5g1M=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+QbFvh8k7rUZPI7asqriudtjVVuN1hUenat00m/7DPl pOSyjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEzEcwMjw5PSFv3OILffXmnnXGx5WO UO8j7eWrcwzU+1QSj45dfVsxgZWq8prj2292TmtwfhVY/0ixsCfq7S5b4jtTKHq5NrikAxEwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 03/41] drm/atomic-helper: Rename drm_atomic_helper_connector_tv_reset to avoid ambiguity X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" We currently have two sets of TV properties. The first one is there to deal with analog TV properties, creating properties such as the TV mode, subconnectors, saturation, hue and so on. It's created by calling the drm_mode_create_tv_properties() function. The second one is there to deal with properties that might be useful on a TV, creating the overscan margins for example. It's created by calling the drm_mode_create_tv_margin_properties(). However, we also have a drm_atomic_helper_connector_tv_reset() function that will reset the TV margin properties to their default values, and thus is supposed to be called for the latter set. This creates an ambiguity due to the inconsistent naming. We can thus rename the drm_atomic_helper_connector_tv_reset() function to drm_atomic_helper_connector_tv_margins_reset() to remove that ambiguity and hopefully make it more obvious. Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index bf31b9d92094..dfb57217253b 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -464,12 +464,12 @@ void drm_atomic_helper_connector_reset(struct drm_connector *connector) EXPORT_SYMBOL(drm_atomic_helper_connector_reset); /** - * drm_atomic_helper_connector_tv_reset - Resets TV connector properties + * drm_atomic_helper_connector_tv_margins_reset - Resets TV connector properties * @connector: DRM connector * * Resets the TV-related properties attached to a connector. */ -void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector) +void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connector) { struct drm_cmdline_mode *cmdline = &connector->cmdline_mode; struct drm_connector_state *state = connector->state; @@ -479,7 +479,7 @@ void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector) state->tv.margins.top = cmdline->tv_margins.top; state->tv.margins.bottom = cmdline->tv_margins.bottom; } -EXPORT_SYMBOL(drm_atomic_helper_connector_tv_reset); +EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_reset); /** * __drm_atomic_helper_connector_duplicate_state - copy atomic connector state diff --git a/drivers/gpu/drm/gud/gud_connector.c b/drivers/gpu/drm/gud/gud_connector.c index d0addd478815..fa636206f232 100644 --- a/drivers/gpu/drm/gud/gud_connector.c +++ b/drivers/gpu/drm/gud/gud_connector.c @@ -355,7 +355,7 @@ static void gud_connector_reset(struct drm_connector *connector) drm_atomic_helper_connector_reset(connector); connector->state->tv = gconn->initial_tv_state; /* Set margins from command line */ - drm_atomic_helper_connector_tv_reset(connector); + drm_atomic_helper_connector_tv_margins_reset(connector); if (gconn->initial_brightness >= 0) connector->state->tv.brightness = gconn->initial_brightness; } diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 84e5a91c2ea7..6877add8e1fa 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -396,7 +396,7 @@ static void vc4_hdmi_connector_reset(struct drm_connector *connector) new_state->base.max_bpc = 8; new_state->base.max_requested_bpc = 8; new_state->output_format = VC4_HDMI_OUTPUT_RGB; - drm_atomic_helper_connector_tv_reset(connector); + drm_atomic_helper_connector_tv_margins_reset(connector); } static struct drm_connector_state * diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index 3f8f1d627f7c..192766656b88 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h @@ -70,7 +70,7 @@ void __drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_ void __drm_atomic_helper_connector_reset(struct drm_connector *connector, struct drm_connector_state *conn_state); void drm_atomic_helper_connector_reset(struct drm_connector *connector); -void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector); +void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connector); void __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector, struct drm_connector_state *state); diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 248206bbd975..23112f0c11cf 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -692,7 +692,7 @@ struct drm_connector_tv_margins { /** * struct drm_tv_connector_state - TV connector related states - * @subconnector: selected subconnector + * @select_subconnector: selected subconnector * @margins: TV margins * @mode: TV mode * @brightness: brightness in percent From patchwork Mon Aug 29 13:11:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957871 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 59FADECAAD2 for ; Mon, 29 Aug 2022 13:21:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 40DE210F2C4; Mon, 29 Aug 2022 13:21:05 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id A84AA10F2C4; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 76BDF2B05FBF; Mon, 29 Aug 2022 09:12:28 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:12:31 -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=1661778747; x= 1661785947; bh=FUxBpFLSpEpdeB7d6rfKBhHHVk+Wnl894IA7RcPFbO8=; b=L tl2lzDZVHwS7dKQAe3f03jOfE/cEUgVzIdS1y01dn3utBM6GauzoQZVqOEQ/+UTu Vvbq5EooDy7chugsAWs6av2tt79+QSTEAqvhxsmnnM7Tt8aVYfgIF0MEtgcgZcD+ YoX1DZ6qDG3WrVrWhHu1vpESfxO+T7f7rlVpHmC/1gc1l7mwjrqlsT6MGGnMTo7+ EJGwTZzgBg7vKlB5ciW7BiP5ygTXjSC5yCdNvekfnMsYMktK68Vq9qS7F4VDfMWB hvfdhaUp4bGQyy+5DJ+JukNegFKykIQIaqj3kOk21sbXG/GnYYewvsh8SAD0quaQ fC2dS9EDfPKyLfLo2s06A== 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=1661778747; x= 1661785947; bh=FUxBpFLSpEpdeB7d6rfKBhHHVk+Wnl894IA7RcPFbO8=; b=c 9/GisJr+NTP2CPEeUms/aSkaZxXvDXxUQbUEu+/XS5oONSRkCVNc+s95U7KKVlZs jWEAns0Si4eiP6KVHOphd0cDDZhxqISNJ8qCyG7v8IFTMV6gj+d4b1Kk4yImX5jS 4B4UPABx2lenJGZ8DvkVhtmgp1wymi12IKLIbNIHFkAMWEzJ0jhS/xCAScjipP1O i0BZ1WKXb7G9LZUILo2mqFxFkk2gXoGVxeUwgzVeBLTY8Mdj1te207nlvXTdGcVa 5ZIpS4mYF7lvOZrvARcAGK9VsKX0ZNalTnjlLp3rUJJ4spL7Ah15NER/DIyDN5ka thZnHHgJxLirV4AKF4pKA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:12:26 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:18 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-4-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=2244; i=maxime@cerno.tech; h=from:subject:message-id; bh=OONh/z5JtUSoKCW+mxGXJavuhFd8shOk9r+qmSxAS9c=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+Q5fi2YG6d6zH7G9qCF3s0GW5TFeaaFteqEbHrqZ2N9 t9ywo5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABMRmMrIsLZKT5/j6mfTfk2pHd03dt dNc7xgFFWz3Hn1z1MmyvlNjxgZnk3vDbrm2/BatKtxy7rqr8L5rWa6fT8ruJZ43tq66WQvIwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 04/41] drm/connector: Rename subconnector state variable X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" There is two TV subconnector related properties registered by drm_mode_create_tv_properties(): subconnector and select subconnector. While the select subconnector property is stored in the kernel by the drm_tv_connector_state structure, the subconnector property isn't stored anywhere. Worse, the select subconnector property is stored in a field called subconnector, creating some ambiguity about which property content we're accessing. Let's rename that field to one called select_subconnector to make it move obvious what it's about. Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 79730fa1dd8e..c74c78a28171 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -687,7 +687,7 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, */ return -EINVAL; } else if (property == config->tv_select_subconnector_property) { - state->tv.subconnector = val; + state->tv.select_subconnector = val; } else if (property == config->tv_left_margin_property) { state->tv.margins.left = val; } else if (property == config->tv_right_margin_property) { @@ -795,7 +795,7 @@ drm_atomic_connector_get_property(struct drm_connector *connector, else *val = connector->dpms; } else if (property == config->tv_select_subconnector_property) { - *val = state->tv.subconnector; + *val = state->tv.select_subconnector; } else if (property == config->tv_left_margin_property) { *val = state->tv.margins.left; } else if (property == config->tv_right_margin_property) { diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 23112f0c11cf..60b5662dec7c 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -703,7 +703,7 @@ struct drm_connector_tv_margins { * @hue: hue in percent */ struct drm_tv_connector_state { - enum drm_mode_subconnector subconnector; + enum drm_mode_subconnector select_subconnector; struct drm_connector_tv_margins margins; unsigned int mode; unsigned int brightness; From patchwork Mon Aug 29 13:11:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957874 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 9686CC0502C for ; Mon, 29 Aug 2022 13:21:18 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id B3CCD10F2D8; Mon, 29 Aug 2022 13:21:13 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id D72FC10F2B8; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 0808E2B05FC1; Mon, 29 Aug 2022 09:12:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 29 Aug 2022 09:12:37 -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=1661778754; x= 1661785954; bh=wC1MCSMyamp+ianAX1wM6m9oLjQ/Jokt+gcamRRc2nc=; b=a r/767dE+02wlc8UfKbricPWsWDIA1SqfERwC5cOBvHG47iiop6R8a8R2LxI4b4jh 0hJhmpzDmNRY2jOw2y1EcWSjRZ3dHA3ecw/DxlrVBDmPN8s+nV0+Vbpf16v7h9Jz 0UVUylYYSv2jBWJuP7DgYeJx8RZs0/m5aUwDZRVSD9bP3MZmec7vTRqvdRy0PxX8 LQFTLeTP4a4R6VVKtl9op32qYaW7l1kAiiOWzUSClvAN/6Kt4X33uM3sRSvzvnVa X/nKyZsX5AALni0MRSG6E9YnDFS64Zgln9U0Ze3ngu83SZt33OGXv6gE2I6vAhS6 BIR0aD+00E/R6L0atU/YQ== 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=1661778754; x= 1661785954; bh=wC1MCSMyamp+ianAX1wM6m9oLjQ/Jokt+gcamRRc2nc=; b=V xB2TkUS2Gg3GAX6vzHidiTQP+yruJJx2eSEcnC4Os87sepZFX+z+IKlMP+9+FeRK hFIfnLxpGdk+rkBPPdwhmf4DlShUCwkT+NowCh5MqGZa/ANUnwPMxvA1D4+fx56Z 4ioW6x5wfO9h5pSWSpwHI9MGA9YmLbnAegsQxjAdxtNUdqfjzuZug7AFfKIbcBlv YmXaGz07DK7UguLGZR0oGgUWtBa1gEHdDkYhG8c/INpJochNBGFKuJBr/NCS9CAR scy4FbQzB5+NOKU//RZcz3FvAo+g0eZNMKCNEKTVh1N17Tb3e2naJHJ6t5B8FSKD W9HRbj7pYCXUSx659vHwQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:12:33 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:19 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-5-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=2320; i=maxime@cerno.tech; h=from:subject:message-id; bh=keMkoQHm0yMChbpLobWpiICEXyJzAsMIi/15U14W+ng=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+S1/dbq5VfKfn60+2hW4dng1dt7tYpCBZtU/LgL34i9 0V/dUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIlY5zEyfCuwzJXcwqU5Wb7XzPdWf4 HYybIfL/Xe1uz8WPCez+I4N8M/lQ/3pD80hn07G3I4mfmbwOSuD+YX9r+5KnD+0owFDkbO3AA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 05/41] drm/atomic: Add TV subconnector property to get/set_property X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The subconnector property was created by drm_mode_create_tv_properties(), but wasn't exposed to the userspace through the generic atomic_get/set_property implementation, and wasn't stored in any generic state structure. Let's solve this. Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index c74c78a28171..c06d0639d552 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -688,6 +688,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, return -EINVAL; } else if (property == config->tv_select_subconnector_property) { state->tv.select_subconnector = val; + } else if (property == config->tv_subconnector_property) { + state->tv.subconnector = val; } else if (property == config->tv_left_margin_property) { state->tv.margins.left = val; } else if (property == config->tv_right_margin_property) { @@ -796,6 +798,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val = connector->dpms; } else if (property == config->tv_select_subconnector_property) { *val = state->tv.select_subconnector; + } else if (property == config->tv_subconnector_property) { + *val = state->tv.subconnector; } else if (property == config->tv_left_margin_property) { *val = state->tv.margins.left; } else if (property == config->tv_right_margin_property) { diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 60b5662dec7c..1d5e3cccb9e3 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -693,6 +693,7 @@ struct drm_connector_tv_margins { /** * struct drm_tv_connector_state - TV connector related states * @select_subconnector: selected subconnector + * @subconnector: detected subconnector * @margins: TV margins * @mode: TV mode * @brightness: brightness in percent @@ -704,6 +705,7 @@ struct drm_connector_tv_margins { */ struct drm_tv_connector_state { enum drm_mode_subconnector select_subconnector; + enum drm_mode_subconnector subconnector; struct drm_connector_tv_margins margins; unsigned int mode; unsigned int brightness; From patchwork Mon Aug 29 13:11:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957868 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 D4BD4ECAAD2 for ; Mon, 29 Aug 2022 13:21:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1463C10F264; Mon, 29 Aug 2022 13:21:02 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6B9F010F2C7; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 9C5B52B05FC5; Mon, 29 Aug 2022 09:12:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 09:12:44 -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=1661778761; x= 1661785961; bh=8CnDkZ8kqQ6q5hGMkFvBP77iUldYY5FJB+9fy2fc26U=; b=f tm9H3pcpBcqeDmWCYcUsHgOphPMD3kWww6Ak4b8U8sHf0a+bRA0sGanB4oN0k6Z6 q1Zzlyq3nJ2xe5DdxUVSqNub0Hu+TeI7Qlun1vMEc/hzoK6Yd9GEy3yKsx60s9sD y89OogDs/+MQTnvPHnAmLfrK5Sk4R+PWvxUyAd7/Eru7/WNYLGMPdPxak1gFYYa5 qacsG59yslX62BuHbXHWjEjO5uwmVCdshGsBjW93kIEhllVtnLQBLAU9lakIrODm DoIn3VgWxuTJwpHx5M1rk/JNAandW6N59AaTjakXBDrDna3jzwOmMAxSmqgmmbkZ tjN8FIetOirWY8ISZWNHg== 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=1661778761; x= 1661785961; bh=8CnDkZ8kqQ6q5hGMkFvBP77iUldYY5FJB+9fy2fc26U=; b=z EqpP4aqEQ+xH46WKoW35kSxrDBqTJbFUeMrQDhO1Lrbb8ydxvpDy4Xpd4p857m49 0eV9TdJGp5w7Kx2qqhRhnzCvTFrHE2WIUq7Sw2dwATGosGE5IrQFq9nmSWWMFACC 04x/8SmQSN0IAwn2c8IHkW9LqijAIRrDnkcTG4MjYLIHQHjnCOpBveWVlheYTmxm 0BjHZxXkWPc4bChJtDY7Jb2Cfx1m/v1HCSBt0DGKdjHMuwdJlukIKYsiAzOgwR8S pSYZLI5xEcPpM2LtHoDK4wBB3KlCVFlMY3PJj2B2rmYN6MVsVRgr0mVXxdJXpcrU RKBcllo4WlCmeorsH78Lw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpedvueehkefhhefghedugefhieevhfdvudegleeuteetlefgudevgfet kedtlefhtdenucffohhmrghinhepmhgrrhhgihhnshdrthhophenucevlhhushhtvghruf hiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehmrgigihhmvgestggvrhhnohdr thgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:12:39 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:20 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-6-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=7447; i=maxime@cerno.tech; h=from:subject:message-id; bh=Vj71Vu7PJT9/n1eGtgjzDPlxAX4nAfOPbqCcT6vghwY=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+QrX04u/7d+e22QwOzul7v+8bx80+e/qI7nxZE9zr4/ L75y7ChlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBELDcz/LOfkNpR88L7TVJUZoNwi5 839/pl6o3/7FLeBh9Z8fOCURXDP7OT05uuLF6lZO3yTG2uvHJfyt4jy28qza2TYtxdfWqnKC8A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 06/41] drm/connector: Rename legacy TV property X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The current tv_mode has driver-specific values that don't allow to easily share code using it, either at the userspace or kernel level. Since we're going to introduce a new, generic, property that fit the same purpose, let's rename this one to legacy_tv_mode to make it obvious we should move away from it. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index c06d0639d552..7f2b9a07fbdf 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -698,8 +698,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, state->tv.margins.top = val; } else if (property == config->tv_bottom_margin_property) { state->tv.margins.bottom = val; - } else if (property == config->tv_mode_property) { - state->tv.mode = val; + } else if (property == config->legacy_tv_mode_property) { + state->tv.legacy_mode = val; } else if (property == config->tv_brightness_property) { state->tv.brightness = val; } else if (property == config->tv_contrast_property) { @@ -808,8 +808,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val = state->tv.margins.top; } else if (property == config->tv_bottom_margin_property) { *val = state->tv.margins.bottom; - } else if (property == config->tv_mode_property) { - *val = state->tv.mode; + } else if (property == config->legacy_tv_mode_property) { + *val = state->tv.legacy_mode; } else if (property == config->tv_brightness_property) { *val = state->tv.brightness; } else if (property == config->tv_contrast_property) { diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index e3142c8142b3..ede6025638d7 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1686,14 +1686,14 @@ int drm_mode_create_tv_properties(struct drm_device *dev, if (drm_mode_create_tv_margin_properties(dev)) goto nomem; - dev->mode_config.tv_mode_property = + dev->mode_config.legacy_tv_mode_property = drm_property_create(dev, DRM_MODE_PROP_ENUM, "mode", num_modes); - if (!dev->mode_config.tv_mode_property) + if (!dev->mode_config.legacy_tv_mode_property) goto nomem; for (i = 0; i < num_modes; i++) - drm_property_add_enum(dev->mode_config.tv_mode_property, + drm_property_add_enum(dev->mode_config.legacy_tv_mode_property, i, modes[i]); dev->mode_config.tv_brightness_property = diff --git a/drivers/gpu/drm/gud/gud_connector.c b/drivers/gpu/drm/gud/gud_connector.c index fa636206f232..caf82e9095b4 100644 --- a/drivers/gpu/drm/gud/gud_connector.c +++ b/drivers/gpu/drm/gud/gud_connector.c @@ -424,7 +424,7 @@ gud_connector_property_lookup(struct drm_connector *connector, u16 prop) case GUD_PROPERTY_TV_BOTTOM_MARGIN: return config->tv_bottom_margin_property; case GUD_PROPERTY_TV_MODE: - return config->tv_mode_property; + return config->legacy_tv_mode_property; case GUD_PROPERTY_TV_BRIGHTNESS: return config->tv_brightness_property; case GUD_PROPERTY_TV_CONTRAST: diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c index b91e48d2190d..d29b63fd6178 100644 --- a/drivers/gpu/drm/i2c/ch7006_drv.c +++ b/drivers/gpu/drm/i2c/ch7006_drv.c @@ -264,7 +264,7 @@ static int ch7006_encoder_create_resources(struct drm_encoder *encoder, priv->hmargin); drm_object_attach_property(&connector->base, conf->tv_bottom_margin_property, priv->vmargin); - drm_object_attach_property(&connector->base, conf->tv_mode_property, + drm_object_attach_property(&connector->base, conf->legacy_tv_mode_property, priv->norm); drm_object_attach_property(&connector->base, conf->tv_brightness_property, priv->brightness); @@ -315,7 +315,7 @@ static int ch7006_encoder_set_property(struct drm_encoder *encoder, ch7006_load_reg(client, state, CH7006_POV); ch7006_load_reg(client, state, CH7006_VPOS); - } else if (property == conf->tv_mode_property) { + } else if (property == conf->legacy_tv_mode_property) { if (connector->dpms != DRM_MODE_DPMS_OFF) return -EINVAL; diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c index be28e7bd7490..1a15534adc60 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c @@ -662,7 +662,7 @@ static int nv17_tv_create_resources(struct drm_encoder *encoder, conf->tv_subconnector_property, tv_enc->subconnector); drm_object_attach_property(&connector->base, - conf->tv_mode_property, + conf->legacy_tv_mode_property, tv_enc->tv_norm); drm_object_attach_property(&connector->base, conf->tv_flicker_reduction_property, @@ -722,7 +722,7 @@ static int nv17_tv_set_property(struct drm_encoder *encoder, if (encoder->crtc) nv17_tv_update_rescaler(encoder); - } else if (property == conf->tv_mode_property) { + } else if (property == conf->legacy_tv_mode_property) { if (connector->dpms != DRM_MODE_DPMS_OFF) return -EINVAL; diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 4a788c1c9058..dc33b7b9ce5e 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -366,7 +366,7 @@ static int vc4_vec_connector_init(struct drm_device *dev, struct vc4_vec *vec) drm_connector_helper_add(connector, &vc4_vec_connector_helper_funcs); drm_object_attach_property(&connector->base, - dev->mode_config.tv_mode_property, + dev->mode_config.legacy_tv_mode_property, VC4_VEC_TV_MODE_NTSC); vec->tv_mode = &vc4_vec_tv_modes[VC4_VEC_TV_MODE_NTSC]; diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 1d5e3cccb9e3..5cfad8b6ad83 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -695,7 +695,7 @@ struct drm_connector_tv_margins { * @select_subconnector: selected subconnector * @subconnector: detected subconnector * @margins: TV margins - * @mode: TV mode + * @legacy_mode: Legacy TV mode, driver specific value * @brightness: brightness in percent * @contrast: contrast in percent * @flicker_reduction: flicker reduction in percent @@ -707,7 +707,7 @@ struct drm_tv_connector_state { enum drm_mode_subconnector select_subconnector; enum drm_mode_subconnector subconnector; struct drm_connector_tv_margins margins; - unsigned int mode; + unsigned int legacy_mode; unsigned int brightness; unsigned int contrast; unsigned int flicker_reduction; diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 6b5e01295348..35a827175c24 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -714,11 +714,13 @@ struct drm_mode_config { * between different TV connector types. */ struct drm_property *tv_select_subconnector_property; + /** - * @tv_mode_property: Optional TV property to select + * @legacy_tv_mode_property: Optional TV property to select * the output TV mode. */ - struct drm_property *tv_mode_property; + struct drm_property *legacy_tv_mode_property; + /** * @tv_left_margin_property: Optional TV property to set the left * margin (expressed in pixels). From patchwork Mon Aug 29 13:11:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957873 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 A4662ECAAD2 for ; Mon, 29 Aug 2022 13:21:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A785110F2CF; Mon, 29 Aug 2022 13:21:11 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6F5C610F298; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 3A4012B05FD7; Mon, 29 Aug 2022 09:12:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:12:50 -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=1661778767; x= 1661785967; bh=6PNL3E05HqgK9IW/MtDEQBeUSg/jnNc6krZQZz7WWqU=; b=S CrmkmWG+i+etfnzZ/jW3Y/UWhtS9n8Tx3Mi1wBI/2ps7AfxEAHmgC9ChWUa9RSX/ fkIfNETMt9ipYhmeM2jNWGAeVHnDQeOdpzSivQXBg1z8viUKEHihiX6qUUwi8Icx WYELVnyFExAByIdK3vMTVoCIHtOiMAjEjtRl6UfBPOHkOQe6AAHqscTYxTunEdBR y0zBUpDKvNbHYKT2yKehiJXJ6DvcdgzrqEtSoOTsNAr6C5frVJGR91FZnsKJcn8S vI/I9R4rWZGVATEVVhWykj/ThLdsDQ5tHmxZy0lbzvkvsU4Soh0ABEuQbyiWyB0I /ko2ZM9j3xfI4EqgtVbfA== 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=1661778767; x= 1661785967; bh=6PNL3E05HqgK9IW/MtDEQBeUSg/jnNc6krZQZz7WWqU=; b=s bCXQbOmwgGQejzwb7lDjTyCP4/nXAv1nQzo9pqqyVqE7JxCZe8fwO/6vxIMhmPS+ 9jXzOHoH56gSFpxXdj6b8NxHUO/m6QWvT9lZjU3TlMXNMttfWoxf+5rrHYMzClzh lRLACh7k0K3BLb/3j0m1/PQ/mKpYfnfaJY62uWUVr/r1eLe8Ww32IMHJNQ3faCf/ G4iCgS8yZ+vB3vDgppF3MWGiUaExqKhHv9UsouScEg7Z+P3fwXRKqb/aqNKtTyyq uv5JMeFR0Dn0IUHQtdJfyQK5Iy8nrdJ5EcvqJLKl+RRGbOtq4ZUkNqTewP+RnYlR V2gQYsmjbYmJz02Pi8Nsw== 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:12:46 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:21 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-7-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=1503; i=maxime@cerno.tech; h=from:subject:message-id; bh=360DckfKUI/oiBSyUvmkKcjfDELX/wp7WZq7mSLzHYY=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+R9F749fcX+URp/0+mNklts/+osLbExydeqlHnk5xCx cO2hjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEzEdwfDf2eNYsvfu42bnU+zT+xnfO Q79+f8ozt6fzV8Prf4WvmC2SGMDP31u7j2GFU3anCHMd34KpJz8v3pBU7M7drctyrSzPUOsgEA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 07/41] drm/connector: Only register TV mode property if present X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The drm_create_tv_properties() will create the TV mode property unconditionally. However, since we'll gradually phase it out, let's register it only if we have a list passed as an argument. This will make the transition easier. Signed-off-by: Maxime Ripard Acked-by: Noralf Trønnes diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index ede6025638d7..17a5913cefe3 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1686,15 +1686,18 @@ int drm_mode_create_tv_properties(struct drm_device *dev, if (drm_mode_create_tv_margin_properties(dev)) goto nomem; - dev->mode_config.legacy_tv_mode_property = - drm_property_create(dev, DRM_MODE_PROP_ENUM, - "mode", num_modes); - if (!dev->mode_config.legacy_tv_mode_property) - goto nomem; - for (i = 0; i < num_modes; i++) - drm_property_add_enum(dev->mode_config.legacy_tv_mode_property, - i, modes[i]); + if (num_modes) { + dev->mode_config.legacy_tv_mode_property = + drm_property_create(dev, DRM_MODE_PROP_ENUM, + "mode", num_modes); + if (!dev->mode_config.legacy_tv_mode_property) + goto nomem; + + for (i = 0; i < num_modes; i++) + drm_property_add_enum(dev->mode_config.legacy_tv_mode_property, + i, modes[i]); + } dev->mode_config.tv_brightness_property = drm_property_create_range(dev, 0, "brightness", 0, 100); From patchwork Mon Aug 29 13:11:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957869 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 083FEECAAD4 for ; Mon, 29 Aug 2022 13:21:10 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 241E310F2A1; Mon, 29 Aug 2022 13:21:02 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id A02A110F2CB; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id BDAC82B05FE1; Mon, 29 Aug 2022 09:12:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:12:58 -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=1661778774; x= 1661785974; bh=si1bxfjnPtaos7SJL98QtkJ8dTa2iY1UsDoYupVOIdM=; b=I w1oPqsTN19R6VHLf19/FJnFt4RFNQ7A+zkVzHAn/IZj5EUerbJqWSnksBaGzaBw/ pRjAjqGEYh513ztuCGUa3gZxIj1SZ8xhDxH3vlAvfm89rxW1hOVhOyRQwWwWgylz 1ZlQly0e/ZHrVo4OJr6mDftH34oOp52tz/CGNXSVRfx2A/a/3y777FgDFh0MsCsN AswcV0i+rqV2dPLd8pHxiJP7mX8zI5BCW5tLFQoLaeLFDFoWFs81Fo58qwswMug6 xjTQIDG1R8WR+VEvXbg1M18mCUjLR8dOReFyhNafBSyu6jOPxG66bxnXBuTF51xz PVBFmdFKxu4bjtSpS2X1Q== 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=1661778774; x= 1661785974; bh=si1bxfjnPtaos7SJL98QtkJ8dTa2iY1UsDoYupVOIdM=; b=m y2C5fajjs/QBAychTGS3E74Kj9nKt8Q73wTijKEJB/JbotqX0VZdf+1RrSD1daqj KS6iHQQp/p/ZnYdWIRmHvuWKADD1zcEoPV7qtibW7gzY0KOOCIcdLTPc4sZP5Hwr 3zjj+yJGfIkO8wo8FB4vnAzU/z7kncaGVVJHrsWH0aFFMYf6z9R0FP+GNKkUW+Ap uiC6W/ul6HQjZbNYQQvY5RkVOD1j5h3W9MSbKFubLLPJSvrMDHd/1u/AMsKs+NsO 3u5OehM/X35ZuyMsrgBKRKov8WS+yLctRs/KAOcdVnYifauiG6C3DCFYbOcJREnR 5K+iPz3pRk8kW7sWcRHOA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:12:53 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:22 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-8-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=6689; i=maxime@cerno.tech; h=from:subject:message-id; bh=+iw2nStSubC0VD5uVsPkdKLlphYI/bRQ+mbI4HQjANY=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+Q3e27PFroTff9lujFHUW/LBjnD5PmP9tloZWy5ru8s O9ero5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABOpz2RkWLqy2+yn6oznd6UYNoe/Nl jKsd5bd9KxHO2s/i0GW38fv8LI8K2j58o0BY3gm31TnA7nRa+9++mH1r8ART/e/V7e57yvsQMA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 08/41] drm/connector: Rename drm_mode_create_tv_properties X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" drm_mode_create_tv_properties(), among other things, will create the "mode" property that stores the analog TV mode that connector is supposed to output. However, that property is getting deprecated, so let's rename that function to mention it's deprecated. We'll introduce a new variant of that function creating the property superseeding it in a later patch. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 17a5913cefe3..4e4fbc9e0049 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1600,7 +1600,7 @@ EXPORT_SYMBOL(drm_connector_attach_tv_margin_properties); * Called by a driver's HDMI connector initialization routine, this function * creates the TV margin properties for a given device. No need to call this * function for an SDTV connector, it's already called from - * drm_mode_create_tv_properties(). + * drm_mode_create_tv_properties_legacy(). * * Returns: * 0 on success or a negative error code on failure. @@ -1635,7 +1635,7 @@ int drm_mode_create_tv_margin_properties(struct drm_device *dev) EXPORT_SYMBOL(drm_mode_create_tv_margin_properties); /** - * drm_mode_create_tv_properties - create TV specific connector properties + * drm_mode_create_tv_properties_legacy - create TV specific connector properties * @dev: DRM device * @num_modes: number of different TV formats (modes) supported * @modes: array of pointers to strings containing name of each format @@ -1648,9 +1648,9 @@ EXPORT_SYMBOL(drm_mode_create_tv_margin_properties); * Returns: * 0 on success or a negative error code on failure. */ -int drm_mode_create_tv_properties(struct drm_device *dev, - unsigned int num_modes, - const char * const modes[]) +int drm_mode_create_tv_properties_legacy(struct drm_device *dev, + unsigned int num_modes, + const char * const modes[]) { struct drm_property *tv_selector; struct drm_property *tv_subconnector; @@ -1733,7 +1733,7 @@ int drm_mode_create_tv_properties(struct drm_device *dev, nomem: return -ENOMEM; } -EXPORT_SYMBOL(drm_mode_create_tv_properties); +EXPORT_SYMBOL(drm_mode_create_tv_properties_legacy); /** * drm_mode_create_scaling_mode_property - create scaling mode property diff --git a/drivers/gpu/drm/gud/gud_connector.c b/drivers/gpu/drm/gud/gud_connector.c index caf82e9095b4..4026eb0132bd 100644 --- a/drivers/gpu/drm/gud/gud_connector.c +++ b/drivers/gpu/drm/gud/gud_connector.c @@ -400,7 +400,7 @@ static int gud_connector_add_tv_mode(struct gud_device *gdrm, struct drm_connect for (i = 0; i < num_modes; i++) modes[i] = &buf[i * GUD_CONNECTOR_TV_MODE_NAME_LEN]; - ret = drm_mode_create_tv_properties(connector->dev, num_modes, modes); + ret = drm_mode_create_tv_properties_legacy(connector->dev, num_modes, modes); free: kfree(buf); if (ret < 0) @@ -539,7 +539,7 @@ static int gud_connector_add_properties(struct gud_device *gdrm, struct gud_conn fallthrough; case GUD_PROPERTY_TV_HUE: /* This is a no-op if already added. */ - ret = drm_mode_create_tv_properties(drm, 0, NULL); + ret = drm_mode_create_tv_properties_legacy(drm, 0, NULL); if (ret) goto out; break; diff --git a/drivers/gpu/drm/i2c/ch7006_drv.c b/drivers/gpu/drm/i2c/ch7006_drv.c index d29b63fd6178..506f6f932518 100644 --- a/drivers/gpu/drm/i2c/ch7006_drv.c +++ b/drivers/gpu/drm/i2c/ch7006_drv.c @@ -250,7 +250,7 @@ static int ch7006_encoder_create_resources(struct drm_encoder *encoder, struct drm_device *dev = encoder->dev; struct drm_mode_config *conf = &dev->mode_config; - drm_mode_create_tv_properties(dev, NUM_TV_NORMS, ch7006_tv_norm_names); + drm_mode_create_tv_properties_legacy(dev, NUM_TV_NORMS, ch7006_tv_norm_names); priv->scale_property = drm_property_create_range(dev, 0, "scale", 0, 2); if (!priv->scale_property) diff --git a/drivers/gpu/drm/i915/display/intel_tv.c b/drivers/gpu/drm/i915/display/intel_tv.c index 9379f3463344..7fd2c6f01ad6 100644 --- a/drivers/gpu/drm/i915/display/intel_tv.c +++ b/drivers/gpu/drm/i915/display/intel_tv.c @@ -1984,7 +1984,7 @@ intel_tv_init(struct drm_i915_private *dev_priv) tv_format_names[i] = tv_modes[i].name; } - drm_mode_create_tv_properties(dev, i, tv_format_names); + drm_mode_create_tv_properties_legacy(dev, i, tv_format_names); drm_object_attach_property(&connector->base, dev->mode_config.tv_mode_property, state->tv.mode); diff --git a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c index 1a15534adc60..e5480dab55e3 100644 --- a/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c +++ b/drivers/gpu/drm/nouveau/dispnv04/tvnv17.c @@ -653,7 +653,7 @@ static int nv17_tv_create_resources(struct drm_encoder *encoder, tv_enc->tv_norm = i; } - drm_mode_create_tv_properties(dev, num_tv_norms, nv17_tv_norm_names); + drm_mode_create_tv_properties_legacy(dev, num_tv_norms, nv17_tv_norm_names); drm_object_attach_property(&connector->base, conf->tv_select_subconnector_property, diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index dc33b7b9ce5e..d5140fe0be4f 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -573,8 +573,9 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data) struct vc4_vec *vec; int ret; - ret = drm_mode_create_tv_properties(drm, ARRAY_SIZE(tv_mode_names), - tv_mode_names); + ret = drm_mode_create_tv_properties_legacy(drm, + ARRAY_SIZE(tv_mode_names), + tv_mode_names); if (ret) return ret; diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 5cfad8b6ad83..d566b4a4709c 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1799,9 +1799,9 @@ int drm_mode_create_dvi_i_properties(struct drm_device *dev); void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector); int drm_mode_create_tv_margin_properties(struct drm_device *dev); -int drm_mode_create_tv_properties(struct drm_device *dev, - unsigned int num_modes, - const char * const modes[]); +int drm_mode_create_tv_properties_legacy(struct drm_device *dev, + unsigned int num_modes, + const char * const modes[]); void drm_connector_attach_tv_margin_properties(struct drm_connector *conn); int drm_mode_create_scaling_mode_property(struct drm_device *dev); int drm_connector_attach_content_type_property(struct drm_connector *dev); From patchwork Mon Aug 29 13:11:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957864 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 9BD8CECAAD2 for ; Mon, 29 Aug 2022 13:21:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3CD4010F275; Mon, 29 Aug 2022 13:21:00 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 015D210F29A; Mon, 29 Aug 2022 13:20:48 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 50F762B06051; Mon, 29 Aug 2022 09:13:02 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 29 Aug 2022 09:13:05 -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=1661778781; x= 1661785981; bh=pUcO8T1pRwVJWUV8j5AkJO7nJ/phgtzS7l6oijEk91k=; b=h jk77p72PHGwqdvEqsHEDJdrp59h9UVzI4KyqYLcBOusFW5OUwh2WxIopUiZEJZEb A7rJHnP2caSC+4AtlMk+IahxrWomMpNX4ZzZm+8WC8cgznTps1HzPbdPTtGMYFJk 9Z+E6kvgNMam9sNTsVVt/27/Y6XSd8b14Io+0F1wYV6A+oV06Q373O7cg/98YWF4 QC5YfoFiyFrpS474bfT4V+n0ox9tzkU4KGIdxtHe07Ko3WESplL0Z2VZasehYSM8 Pfmc/ANOTJrUFaxUtCfEf101vXS63YS4p3BM50RUj6TEeQFc8HeZCkVM/OVL+zK/ foCTww06TxuT1OWKdaiSA== 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=1661778781; x= 1661785981; bh=pUcO8T1pRwVJWUV8j5AkJO7nJ/phgtzS7l6oijEk91k=; b=Y xREWxW9XhwrXljndhgR4ufOrG6NShB8SW5oLtNps8h7Xl9eJdide4pX4jCYGIHAn ogpI2Aggdgnv/EsAdSmRVvUhx8V6AmuPEB20Js4jTCBuJCBdxA3KuY2C38Iy6pOv 26EgWBIIZkYPe57SDvDrnlocVM/0VeAsecBCL+scrBSDRqubuiPQYVtVTxeVErQA tHGguaMYQKnFJ7U6qB44j5B8KqzJjoJH5p+JT0yHrZMp1bhJbuqt2kWtdzyEYI5M vi+S0bFPBNBMdEHU9sgtAlwa4GEAJCFigcv6XLW2T97vH8w6/MhyMx0QFSXpeq4S e3PrtU58lkQKhj2KjCsZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:00 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:23 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-9-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=11994; i=maxime@cerno.tech; h=from:subject:message-id; bh=0imIXTKfc8i6bjpLPiDjTCY1QehnDS9P83WB+hmMDZk=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+Q/JdoJu7KuXb828Py/u8+Ytsa/9dr5ZOaWss9fHgak cSfbdpSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAiN5IYGWZIaBw4P4XB9paW4IIpnY tFc1ZEH7zvnXj2o7/62vrJE64zMtxr+Hw1s/dsQeq64P6L651XiFyVOxxRv3v31YWBnYeVj7IAAA== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 09/41] drm/connector: Add TV standard property X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The TV mode property has been around for a while now to select and get the current TV mode output on an analog TV connector. Despite that property name being generic, its content isn't and has been driver-specific which makes it hard to build any generic behaviour on top of it, both in kernel and user-space. Let's create a new bitmask tv norm property, that can contain any of the analog TV standards currently supported by kernel drivers. Each driver can then pass in a bitmask of the modes it supports. We'll then be able to phase out the older tv mode property. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c index 7f2b9a07fbdf..d867e7f9f2cd 100644 --- a/drivers/gpu/drm/drm_atomic_uapi.c +++ b/drivers/gpu/drm/drm_atomic_uapi.c @@ -700,6 +700,8 @@ static int drm_atomic_connector_set_property(struct drm_connector *connector, state->tv.margins.bottom = val; } else if (property == config->legacy_tv_mode_property) { state->tv.legacy_mode = val; + } else if (property == config->tv_mode_property) { + state->tv.mode = val; } else if (property == config->tv_brightness_property) { state->tv.brightness = val; } else if (property == config->tv_contrast_property) { @@ -810,6 +812,8 @@ drm_atomic_connector_get_property(struct drm_connector *connector, *val = state->tv.margins.bottom; } else if (property == config->legacy_tv_mode_property) { *val = state->tv.legacy_mode; + } else if (property == config->tv_mode_property) { + *val = state->tv.mode; } else if (property == config->tv_brightness_property) { *val = state->tv.brightness; } else if (property == config->tv_contrast_property) { diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 4e4fbc9e0049..b1fcacd150e8 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -980,6 +980,29 @@ static const struct drm_prop_enum_list drm_dvi_i_subconnector_enum_list[] = { DRM_ENUM_NAME_FN(drm_get_dvi_i_subconnector_name, drm_dvi_i_subconnector_enum_list) +static const struct drm_prop_enum_list drm_tv_mode_enum_list[] = { + { DRM_MODE_TV_MODE_NTSC_443, "NTSC-443" }, + { DRM_MODE_TV_MODE_NTSC_J, "NTSC-J" }, + { DRM_MODE_TV_MODE_NTSC_M, "NTSC-M" }, + { DRM_MODE_TV_MODE_PAL_60, "PAL-60" }, + { DRM_MODE_TV_MODE_PAL_B, "PAL-B" }, + { DRM_MODE_TV_MODE_PAL_D, "PAL-D" }, + { DRM_MODE_TV_MODE_PAL_G, "PAL-G" }, + { DRM_MODE_TV_MODE_PAL_H, "PAL-H" }, + { DRM_MODE_TV_MODE_PAL_I, "PAL-I" }, + { DRM_MODE_TV_MODE_PAL_M, "PAL-M" }, + { DRM_MODE_TV_MODE_PAL_N, "PAL-N" }, + { DRM_MODE_TV_MODE_PAL_NC, "PAL-Nc" }, + { DRM_MODE_TV_MODE_SECAM_60, "SECAM-60" }, + { DRM_MODE_TV_MODE_SECAM_B, "SECAM-B" }, + { DRM_MODE_TV_MODE_SECAM_D, "SECAM-D" }, + { DRM_MODE_TV_MODE_SECAM_G, "SECAM-G" }, + { DRM_MODE_TV_MODE_SECAM_K, "SECAM-K" }, + { DRM_MODE_TV_MODE_SECAM_K1, "SECAM-K1" }, + { DRM_MODE_TV_MODE_SECAM_L, "SECAM-L" }, +}; +DRM_ENUM_NAME_FN(drm_get_tv_mode_name, drm_tv_mode_enum_list) + static const struct drm_prop_enum_list drm_tv_select_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */ @@ -1645,6 +1668,10 @@ EXPORT_SYMBOL(drm_mode_create_tv_margin_properties); * responsible for allocating a list of format names and passing them to * this routine. * + * NOTE: This functions registers the deprecated "mode" connector + * property to select the analog TV mode (ie, NTSC, PAL, etc.). New + * drivers must use drm_mode_create_tv_properties() instead. + * * Returns: * 0 on success or a negative error code on failure. */ @@ -1686,7 +1713,6 @@ int drm_mode_create_tv_properties_legacy(struct drm_device *dev, if (drm_mode_create_tv_margin_properties(dev)) goto nomem; - if (num_modes) { dev->mode_config.legacy_tv_mode_property = drm_property_create(dev, DRM_MODE_PROP_ENUM, @@ -1735,6 +1761,46 @@ int drm_mode_create_tv_properties_legacy(struct drm_device *dev, } EXPORT_SYMBOL(drm_mode_create_tv_properties_legacy); +/** + * drm_mode_create_tv_properties - create TV specific connector properties + * @dev: DRM device + * @supported_tv_modes: Bitmask of TV modes supported (See DRM_MODE_TV_MODE_*) + + * Called by a driver's TV initialization routine, this function creates + * the TV specific connector properties for a given device. Caller is + * responsible for allocating a list of format names and passing them to + * this routine. + * + * Returns: + * 0 on success or a negative error code on failure. + */ +int drm_mode_create_tv_properties(struct drm_device *dev, + unsigned int supported_tv_modes) +{ + struct drm_prop_enum_list tv_mode_list[DRM_MODE_TV_MODE_MAX]; + struct drm_property *tv_mode; + unsigned int i, len = 0; + + for (i = 0; i < DRM_MODE_TV_MODE_MAX; i++) { + if (!(supported_tv_modes & BIT(i))) + continue; + + tv_mode_list[len].type = i; + tv_mode_list[len].name = drm_get_tv_mode_name(i); + len++; + } + + tv_mode = drm_property_create_enum(dev, 0, "TV mode", + tv_mode_list, len); + if (!tv_mode) + return -ENOMEM; + + dev->mode_config.tv_mode_property = tv_mode; + + return drm_mode_create_tv_properties_legacy(dev, 0, NULL); +} +EXPORT_SYMBOL(drm_mode_create_tv_properties); + /** * drm_mode_create_scaling_mode_property - create scaling mode property * @dev: DRM device diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index d566b4a4709c..7d3881f35e7c 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -143,6 +143,144 @@ enum subpixel_order { }; +/** + * enum drm_connector_tv_mode - Analog TV output mode + * + * This enum is used to indicate the TV output mode used on an analog TV + * connector. + * + * WARNING: The values of this enum is uABI since they're exposed in the + * "TV mode" connector property. + */ +enum drm_connector_tv_mode { + /** + * @DRM_MODE_TV_MODE_NTSC_443: Variant of + * @DRM_MODE_TV_MODE_NTSC_M. Uses a color subcarrier frequency + * of 4.43 MHz. + */ + DRM_MODE_TV_MODE_NTSC_443 = 0, + + /** + * @DRM_MODE_TV_MODE_NTSC_J: Variant of @DRM_MODE_TV_MODE_NTSC_M + * used in Japan. Uses a black level equals to the blanking + * level. + */ + DRM_MODE_TV_MODE_NTSC_J, + + /** + * @DRM_MODE_TV_MODE_NTSC_M: CCIR System M (aka 525-lines) + * together with the NTSC Color Encoding. + */ + DRM_MODE_TV_MODE_NTSC_M, + + /** + * @DRM_MODE_TV_MODE_PAL_60: CCIR System M (aka 525-lines) + * together with the PAL color encoding and color subcarrier + * frequency. + */ + DRM_MODE_TV_MODE_PAL_60, + + /** + * @DRM_MODE_TV_MODE_PAL_B: CCIR System B together with the PAL + * color system. + */ + DRM_MODE_TV_MODE_PAL_B, + + /** + * @DRM_MODE_TV_MODE_PAL_D: CCIR System D together with the PAL + * color system. + */ + DRM_MODE_TV_MODE_PAL_D, + + /** + * @DRM_MODE_TV_MODE_PAL_G: CCIR System G together with the PAL + * color system. Similar to @DRM_MODE_TV_MODE_PAL_B but uses a + * different channel bandwidth and transmission band. + */ + DRM_MODE_TV_MODE_PAL_G, + + /** + * @DRM_MODE_TV_MODE_PAL_H: CCIR System H together with the PAL + * color system. Similar to @DRM_MODE_TV_MODE_PAL_G but uses a + * narrower lower side band. + */ + DRM_MODE_TV_MODE_PAL_H, + + /** + * @DRM_MODE_TV_MODE_PAL_I: CCIR System I together with the PAL + * color system. Similar to @DRM_MODE_TV_MODE_PAL_B, but with a + * different audio encoding. + */ + DRM_MODE_TV_MODE_PAL_I, + + /** + * @DRM_MODE_TV_MODE_PAL_M: CCIR System M (aka 525-lines) + * together with the PAL color encoding + */ + DRM_MODE_TV_MODE_PAL_M, + + /** + * @DRM_MODE_TV_MODE_PAL_N: CCIR System N together with the PAL + * color encoding. It uses 625 lines, but has a color subcarrier + * frequency of 3.58MHz, the SECAM color space, and narrower + * channels compared to most of the other PAL variants. + */ + DRM_MODE_TV_MODE_PAL_N, + + /** + * @DRM_MODE_TV_MODE_PAL_NC: Seems equivalent to + * @DRM_MODE_TV_MODE_PAL_N. + */ + DRM_MODE_TV_MODE_PAL_NC, + + /** + * @DRM_MODE_TV_MODE_SECAM_60: CCIR System M (aka 525-lines) + * together with the SECAM color system. + */ + DRM_MODE_TV_MODE_SECAM_60, + + /** + * @DRM_MODE_TV_MODE_SECAM_B: CCIR System B together with the + * SECAM color system. + */ + DRM_MODE_TV_MODE_SECAM_B, + + /** + * @DRM_MODE_TV_MODE_SECAM_D: CCIR System D together with the + * SECAM color system. + */ + DRM_MODE_TV_MODE_SECAM_D, + + /** + * @DRM_MODE_TV_MODE_SECAM_G: CCIR System G together with the + * SECAM color system. Similar to @DRM_MODE_TV_MODE_SECAM_B but + * uses a different channel bandwidth and transmission band. + */ + DRM_MODE_TV_MODE_SECAM_G, + + /** + * @DRM_MODE_TV_MODE_SECAM_K: CCIR System G together with the + * SECAM color system. Similar to @DRM_MODE_TV_MODE_SECAM_G but + * with different channels. + */ + DRM_MODE_TV_MODE_SECAM_K, + + /** + * @DRM_MODE_TV_MODE_SECAM_K1: CCIR System G together with the + * SECAM color system. Similar to @DRM_MODE_TV_MODE_SECAM_G and + * @DRM_MODE_TV_MODE_SECAM_K but with different channels. + */ + DRM_MODE_TV_MODE_SECAM_K1, + + /** + * @DRM_MODE_TV_MODE_SECAM_L: CCIR System L together with the + * SECAM color system. + */ + DRM_MODE_TV_MODE_SECAM_L, + + DRM_MODE_TV_MODE_MAX, +}; + /** * struct drm_scrambling: sink's scrambling support. */ @@ -696,6 +834,7 @@ struct drm_connector_tv_margins { * @subconnector: detected subconnector * @margins: TV margins * @legacy_mode: Legacy TV mode, driver specific value + * @mode: TV mode * @brightness: brightness in percent * @contrast: contrast in percent * @flicker_reduction: flicker reduction in percent @@ -708,6 +847,7 @@ struct drm_tv_connector_state { enum drm_mode_subconnector subconnector; struct drm_connector_tv_margins margins; unsigned int legacy_mode; + unsigned int mode; unsigned int brightness; unsigned int contrast; unsigned int flicker_reduction; @@ -1789,6 +1929,7 @@ const char *drm_get_subpixel_order_name(enum subpixel_order order); const char *drm_get_dpms_name(int val); const char *drm_get_dvi_i_subconnector_name(int val); const char *drm_get_dvi_i_select_name(int val); +const char *drm_get_tv_mode_name(int val); const char *drm_get_tv_subconnector_name(int val); const char *drm_get_tv_select_name(int val); const char *drm_get_dp_subconnector_name(int val); @@ -1802,6 +1943,8 @@ int drm_mode_create_tv_margin_properties(struct drm_device *dev); int drm_mode_create_tv_properties_legacy(struct drm_device *dev, unsigned int num_modes, const char * const modes[]); +int drm_mode_create_tv_properties(struct drm_device *dev, + unsigned int supported_tv_modes); void drm_connector_attach_tv_margin_properties(struct drm_connector *conn); int drm_mode_create_scaling_mode_property(struct drm_device *dev); int drm_connector_attach_content_type_property(struct drm_connector *dev); diff --git a/include/drm/drm_mode_config.h b/include/drm/drm_mode_config.h index 35a827175c24..10a6f7d1df0d 100644 --- a/include/drm/drm_mode_config.h +++ b/include/drm/drm_mode_config.h @@ -718,9 +718,17 @@ struct drm_mode_config { /** * @legacy_tv_mode_property: Optional TV property to select * the output TV mode. + * + * Superseeded by @tv_mode_property */ struct drm_property *legacy_tv_mode_property; + /** + * @tv_mode_property: Optional TV property to select the TV + * standard output on the connector. + */ + struct drm_property *tv_mode_property; + /** * @tv_left_margin_property: Optional TV property to set the left * margin (expressed in pixels). From patchwork Mon Aug 29 13:11:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957872 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 D87E2ECAAD5 for ; Mon, 29 Aug 2022 13:21:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E8B3F10F278; Mon, 29 Aug 2022 13:21:08 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id C32EE10F2D0; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 7F4DD2B06053; Mon, 29 Aug 2022 09:13:09 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:13:12 -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=1661778789; x= 1661785989; bh=sHJoW4kxoDFCYcawvDpLOhSkPseUWosDT9lxsntMrMg=; b=o +eRFAwn1/QOg7ZYV3PsSPF8mDZ5IGmxlyDZEJb13k5qrkVq2TD2DzdvzrTrZbG/N GqX2374pGGod+GCfXlkZKRtXXlEx/yejsBXJX0WoMDAFtlGlfIDsn+WzIKJTVZ4K x/LJW3OvJHwYdkDT3P3c3bNnmxPsa1dmdN63QXmHdKNnxpOjgXYcpzEL+cMRJbXm Bc7srCN6WJ2OrIEqwRwt7Ol4qSqTCAoVFQXKXPh2VTttouwVuAHA3W7fIx0npndr Xhojm5DFhb5Kb6DdE0qsT310rb0tWrsvQvJ9np/PdrEavya7yP9reyPwWvQxQZIs hodHGQPeaK8HtcmR7mrKQ== 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=1661778789; x= 1661785989; bh=sHJoW4kxoDFCYcawvDpLOhSkPseUWosDT9lxsntMrMg=; b=H FJ/xKu18XpMb3WL1AvwZoSX4msm3uUKHg7BrY03AlQsetct6zMTQGZlHrMpfXu0d K8HoObnNHBc74zhZRMyU5U2GCHdkpn4eUqwK/grcFG90piJhGFxd56dPCoY2nQpl vw0nLOblH0HhD24Qht3lQ3cFN9Ff2alPiItbmk5P2rN5qOPotDqCxa+hZFBt8B6w Qn2eJxsAxQ4V3IrjmBE78k4FLzTZXjdZOQhUigAZxofGCcmkeHDx79lKwjrwjzGu L7wT04YhIo/c7EYqEQX3/4NKRUuqOC31na2CboiUeu4VHFg42Xf51bHsvTGFdUAI T1lBEwInbW6iODLvEB1sg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeeuffdtffduleffkeeugedvgfejvdeftdefheeijefhveekgeeuteeg geekhefhgeenucffohhmrghinheprghrtghhihhvvgdrohhrghdpkhholhhumhgsuhhsrd hfihdphhhinhhnvghrrdhinhhfohdpsggrthhsohgtkhhsrdgtohdruhhknecuvehluhhs thgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrgihimhgvsegtvg hrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:07 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:24 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-10-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=21417; i=maxime@cerno.tech; h=from:subject:message-id; bh=0Lj8QojJNaPOnib+aAarYKqf+VDM+SKzk/6SDFpneiA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+QPBlh6HK5LFF+/rtCoX+zVZ1cpTquvXguPH5F8eEJ1 h0p1RykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACbyfj3DP/2N319fSan6vH3Sy2Mmm1 ZWP/fT2PZj++GnW77VnkgIjuNn+MUUdGSrsO3quPifrcpPtqx7V3A6OWuF5SaOUsH0rIv7XvICAA== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 10/41] drm/modes: Add a function to generate analog display modes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Multiple drivers (meson, vc4, sun4i) define analog TV 525-lines and 625-lines modes in their drivers. Since those modes are fairly standard, and that we'll need to use them in more places in the future, it makes sense to move their definition into the core framework. However, analog display usually have fairly loose timings requirements, the only discrete parameters being the total number of lines and pixel clock frequency. Thus, we created a function that will create a display mode from the standard, the pixel frequency and the active area. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 304004fb80aa..ee581ee17171 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -116,6 +116,459 @@ void drm_mode_probed_add(struct drm_connector *connector, } EXPORT_SYMBOL(drm_mode_probed_add); +enum drm_mode_analog { + DRM_MODE_ANALOG_NTSC, + DRM_MODE_ANALOG_PAL, +}; + +/* + * The timings come from: + * - https://web.archive.org/web/20220406232708/http://www.kolumbus.fi/pami1/video/pal_ntsc.html + * - https://web.archive.org/web/20220406124914/http://martin.hinner.info/vga/pal.html + * - https://web.archive.org/web/20220609202433/http://www.batsocks.co.uk/readme/video_timing.htm + */ +#define NTSC_LINE_DURATION_NS 63556U +#define NTSC_LINES_NUMBER 525 + +#define NTSC_HBLK_DURATION_TYP_NS 10900U +#define NTSC_HBLK_DURATION_MIN_NS (NTSC_HBLK_DURATION_TYP_NS - 200) +#define NTSC_HBLK_DURATION_MAX_NS (NTSC_HBLK_DURATION_TYP_NS + 200) + +#define NTSC_HACT_DURATION_TYP_NS (NTSC_LINE_DURATION_NS - NTSC_HBLK_DURATION_TYP_NS) +#define NTSC_HACT_DURATION_MIN_NS (NTSC_LINE_DURATION_NS - NTSC_HBLK_DURATION_MAX_NS) +#define NTSC_HACT_DURATION_MAX_NS (NTSC_LINE_DURATION_NS - NTSC_HBLK_DURATION_MIN_NS) + +#define NTSC_HFP_DURATION_TYP_NS 1500 +#define NTSC_HFP_DURATION_MIN_NS 1270 +#define NTSC_HFP_DURATION_MAX_NS 2220 + +#define NTSC_HSLEN_DURATION_TYP_NS 4700 +#define NTSC_HSLEN_DURATION_MIN_NS (NTSC_HSLEN_DURATION_TYP_NS - 100) +#define NTSC_HSLEN_DURATION_MAX_NS (NTSC_HSLEN_DURATION_TYP_NS + 100) + +#define NTSC_HBP_DURATION_TYP_NS 4700 + +/* + * I couldn't find the actual tolerance for the back porch, so let's + * just reuse the sync length ones. + */ +#define NTSC_HBP_DURATION_MIN_NS (NTSC_HBP_DURATION_TYP_NS - 100) +#define NTSC_HBP_DURATION_MAX_NS (NTSC_HBP_DURATION_TYP_NS + 100) + +#define PAL_LINE_DURATION_NS 64000U +#define PAL_LINES_NUMBER 625 + +#define PAL_HACT_DURATION_TYP_NS 51950U +#define PAL_HACT_DURATION_MIN_NS (PAL_HACT_DURATION_TYP_NS - 100) +#define PAL_HACT_DURATION_MAX_NS (PAL_HACT_DURATION_TYP_NS + 400) + +#define PAL_HBLK_DURATION_TYP_NS (PAL_LINE_DURATION_NS - PAL_HACT_DURATION_TYP_NS) +#define PAL_HBLK_DURATION_MIN_NS (PAL_LINE_DURATION_NS - PAL_HACT_DURATION_MAX_NS) +#define PAL_HBLK_DURATION_MAX_NS (PAL_LINE_DURATION_NS - PAL_HACT_DURATION_MIN_NS) + +#define PAL_HFP_DURATION_TYP_NS 1650 +#define PAL_HFP_DURATION_MIN_NS (PAL_HFP_DURATION_TYP_NS - 100) +#define PAL_HFP_DURATION_MAX_NS (PAL_HFP_DURATION_TYP_NS + 400) + +#define PAL_HSLEN_DURATION_TYP_NS 4700 +#define PAL_HSLEN_DURATION_MIN_NS (PAL_HSLEN_DURATION_TYP_NS - 200) +#define PAL_HSLEN_DURATION_MAX_NS (PAL_HSLEN_DURATION_TYP_NS + 200) + +#define PAL_HBP_DURATION_TYP_NS 5700 +#define PAL_HBP_DURATION_MIN_NS (PAL_HBP_DURATION_TYP_NS - 200) +#define PAL_HBP_DURATION_MAX_NS (PAL_HBP_DURATION_TYP_NS + 200) + +#define PAL_VFP_INTERLACE_LINES 5 +#define PAL_VSLEN_INTERLACE_LINES 5 + +#define PAL_SHORT_SYNC_DURATION_NS ((2 + 30) * NSEC_PER_USEC) +#define PAL_LONG_SYNC_DURATION_NS ((30 + 2) * NSEC_PER_USEC) + +struct analog_param_field { + unsigned int even, odd; +}; + +#define PARAM_FIELD(_odd, _even) \ + { .even = _even, .odd = _odd } + +struct analog_param_range { + unsigned int min, typ, max; +}; + +#define PARAM_RANGE(_min, _typ, _max) \ + { .min = _min, .typ = _typ, .max = _max } + +struct analog_parameters { + unsigned int num_lines; + unsigned int line_duration_ns; + + struct analog_param_range hact_ns; + struct analog_param_range hfp_ns; + struct analog_param_range hslen_ns; + struct analog_param_range hbp_ns; + struct analog_param_range hblk_ns; + + struct analog_param_field vfp_lines; + struct analog_param_field vslen_lines; + struct analog_param_field vbp_lines; +}; + +#define TV_MODE_PARAMETER(_mode, _lines, _line_dur, _hact, _hfp, _hslen, _hbp, _hblk, _vfp, _vslen, _vbp) \ + [_mode] = { \ + .num_lines = _lines, \ + .line_duration_ns = _line_dur, \ + .hact_ns = _hact, \ + .hfp_ns = _hfp, \ + .hslen_ns = _hslen, \ + .hbp_ns = _hbp, \ + .hblk_ns = _hblk, \ + .vfp_lines = _vfp, \ + .vslen_lines = _vslen, \ + .vbp_lines = _vbp, \ + } + +const static struct analog_parameters tv_modes_parameters[] = { + TV_MODE_PARAMETER(DRM_MODE_ANALOG_NTSC, + NTSC_LINES_NUMBER, + NTSC_LINE_DURATION_NS, + PARAM_RANGE(NTSC_HACT_DURATION_MIN_NS, + NTSC_HACT_DURATION_TYP_NS, + NTSC_HACT_DURATION_MAX_NS), + PARAM_RANGE(NTSC_HFP_DURATION_MIN_NS, + NTSC_HFP_DURATION_TYP_NS, + NTSC_HFP_DURATION_MAX_NS), + PARAM_RANGE(NTSC_HSLEN_DURATION_MIN_NS, + NTSC_HSLEN_DURATION_TYP_NS, + NTSC_HSLEN_DURATION_MAX_NS), + PARAM_RANGE(NTSC_HBP_DURATION_MIN_NS, + NTSC_HBP_DURATION_TYP_NS, + NTSC_HBP_DURATION_MAX_NS), + PARAM_RANGE(NTSC_HBLK_DURATION_MIN_NS, + NTSC_HBLK_DURATION_TYP_NS, + NTSC_HBLK_DURATION_MAX_NS), + PARAM_FIELD(3, 3), + PARAM_FIELD(3, 3), + PARAM_FIELD(3, 3)), + TV_MODE_PARAMETER(DRM_MODE_ANALOG_PAL, + PAL_LINES_NUMBER, + PAL_LINE_DURATION_NS, + PARAM_RANGE(PAL_HACT_DURATION_MIN_NS, + PAL_HACT_DURATION_TYP_NS, + PAL_HACT_DURATION_MAX_NS), + PARAM_RANGE(PAL_HFP_DURATION_MIN_NS, + PAL_HFP_DURATION_TYP_NS, + PAL_HFP_DURATION_MAX_NS), + PARAM_RANGE(PAL_HSLEN_DURATION_MIN_NS, + PAL_HSLEN_DURATION_TYP_NS, + PAL_HSLEN_DURATION_MAX_NS), + PARAM_RANGE(PAL_HBP_DURATION_MIN_NS, + PAL_HBP_DURATION_TYP_NS, + PAL_HBP_DURATION_MAX_NS), + PARAM_RANGE(PAL_HBLK_DURATION_MIN_NS, + PAL_HBLK_DURATION_TYP_NS, + PAL_HBLK_DURATION_MAX_NS), + + /* + * The front porch is actually 6 short sync + * pulses for the even field, and 5 for the + * odd field. Each sync takes half a life so + * the odd field front porch is shorter by + * half a line. + * + * In progressive, we're supposed to use 6 + * pulses, so we're fine there + */ + PARAM_FIELD(3, 2), + + /* + * The vsync length is 5 long sync pulses, + * each field taking half a line. We're + * shorter for both fields by half a line. + * + * In progressive, we're supposed to use 5 + * pulses, so we're off by half + * a line. + * + * In interlace, we're now off by half a line + * for the even field and one line for the odd + * field. + */ + PARAM_FIELD(3, 3), + + /* + * The back porch is actually 5 short sync + * pulses for the even field, 4 for the odd + * field. In progressive, it's 5 short syncs. + * + * In progressive, we thus have 2.5 lines, + * plus the 0.5 line we were missing + * previously, so we should use 3 lines. + * + * In interlace, the even field is in the + * exact same case than progressive. For the + * odd field, we should be using 2 lines but + * we're one line short, so we'll make up for + * it here by using 3. + */ + PARAM_FIELD(3, 3)), +}; + +static int fill_analog_mode(struct drm_display_mode *mode, + const struct analog_parameters *params, + unsigned long pixel_clock_hz, + unsigned int hactive, + unsigned int vactive, + bool interlace) +{ + unsigned long pixel_duration_ns = NSEC_PER_SEC / pixel_clock_hz; + unsigned long long htotal; + unsigned int vtotal; + unsigned int max_hact, hact_duration_ns; + unsigned int hblk, hblk_duration_ns; + unsigned int hfp, hfp_min, hfp_duration_ns; + unsigned int hslen, hslen_duration_ns; + unsigned int hbp, hbp_min, hbp_duration_ns; + unsigned int porches, porches_duration_ns; + unsigned int vfp, vfp_min; + unsigned int vbp, vbp_min; + unsigned int vslen; + int porches_rem; + bool strict = true; + + max_hact = params->hact_ns.max / pixel_duration_ns; + if (pixel_clock_hz == 13500000 && hactive > max_hact && hactive <= 720) + strict = false; + + /* + * Our pixel duration is going to be round down by the division, + * so rounding up is probably going to introduce even more + * deviation. + */ + htotal = params->line_duration_ns * pixel_clock_hz / NSEC_PER_SEC; + + hact_duration_ns = hactive * pixel_duration_ns; + if (strict && + (hact_duration_ns < params->hact_ns.min || + hact_duration_ns > params->hact_ns.max)) { + DRM_ERROR("Invalid horizontal active area duration: %uns (min: %u, max %u)\n", + hact_duration_ns, params->hact_ns.min, params->hact_ns.max); + return -EINVAL; + } + + hblk = htotal - hactive; + hblk_duration_ns = hblk * pixel_duration_ns; + if (strict && + (hblk_duration_ns < params->hblk_ns.min || + hblk_duration_ns > params->hblk_ns.max)) { + DRM_ERROR("Invalid horizontal blanking duration: %uns (min: %u, max %u)\n", + hblk_duration_ns, params->hblk_ns.min, params->hblk_ns.max); + return -EINVAL; + } + + hslen = DIV_ROUND_UP(params->hslen_ns.typ, pixel_duration_ns); + hslen_duration_ns = hslen * pixel_duration_ns; + if (strict && + (hslen_duration_ns < params->hslen_ns.min || + hslen_duration_ns > params->hslen_ns.max)) { + DRM_ERROR("Invalid horizontal sync duration: %uns (min: %u, max %u)\n", + hslen_duration_ns, params->hslen_ns.min, params->hslen_ns.max); + return -EINVAL; + } + + porches = hblk - hslen; + porches_duration_ns = porches * pixel_duration_ns; + if (strict && + (porches_duration_ns > (params->hfp_ns.max + params->hbp_ns.max) || + porches_duration_ns < (params->hfp_ns.min + params->hbp_ns.min))) { + DRM_ERROR("Invalid horizontal porches duration: %uns\n", porches_duration_ns); + return -EINVAL; + } + + hfp_min = DIV_ROUND_UP(params->hfp_ns.min, pixel_duration_ns); + hbp_min = DIV_ROUND_UP(params->hbp_ns.min, pixel_duration_ns); + porches_rem = porches - hfp_min - hbp_min; + + hfp = hfp_min + DIV_ROUND_UP(porches_rem, 2); + hfp_duration_ns = hfp * pixel_duration_ns; + if (strict && + (hfp_duration_ns < params->hfp_ns.min || + hfp_duration_ns > params->hfp_ns.max)) { + DRM_ERROR("Invalid horizontal front porch duration: %uns (min: %u, max %u)\n", + hfp_duration_ns, params->hfp_ns.min, params->hfp_ns.max); + return -EINVAL; + } + + hbp = porches - hfp; + hbp_duration_ns = hbp * pixel_duration_ns; + if (strict && + (hbp_duration_ns < params->hbp_ns.min || + hbp_duration_ns > params->hbp_ns.max)) { + DRM_ERROR("Invalid horizontal back porch duration: %uns (min: %u, max %u)\n", + hbp_duration_ns, params->hbp_ns.min, params->hbp_ns.max); + return -EINVAL; + } + + if (htotal != (hactive + hfp + hslen + hbp)) + return -EINVAL; + + mode->clock = pixel_clock_hz / 1000; + mode->hdisplay = hactive; + mode->hsync_start = hactive + hfp; + mode->hsync_end = hactive + hfp + hslen; + mode->htotal = hactive + hfp + hslen + hbp; + + if (interlace) { + vfp_min = params->vfp_lines.even + params->vfp_lines.odd; + vbp_min = params->vbp_lines.even + params->vbp_lines.odd; + vslen = params->vslen_lines.even + params->vslen_lines.odd; + } else { + /* + * By convention, NSTC (aka 525/60) systems start with + * the even field, but PAL (aka 625/50) systems start + * with the odd one. + * + * PAL systems also have asymetric timings between the + * even and odd field, while NTSC is symetric. + * + * Moreover, if we want to create a progressive mode for + * PAL, we need to use the odd field timings. + * + * Since odd == even for NTSC, we can just use the odd + * one all the time to simplify the code a bit. + */ + vfp_min = params->vfp_lines.odd; + vbp_min = params->vbp_lines.odd; + vslen = params->vslen_lines.odd; + } + + porches = params->num_lines - vactive - vslen; + porches_rem = porches - vfp_min - vbp_min; + + vfp = vfp_min + (porches_rem / 2); + vbp = porches - vfp; + + vtotal = vactive + vfp + vslen + vbp; + if (params->num_lines != vtotal) { + DRM_ERROR("Invalid vertical total: %upx (expected %upx)\n", + vtotal, params->num_lines); + return -EINVAL; + } + + mode->vdisplay = vactive; + mode->vsync_start = vactive + vfp; + mode->vsync_end = vactive + vfp + vslen; + mode->vtotal = vactive + vfp + vslen + vbp; + + mode->type = DRM_MODE_TYPE_DRIVER; + mode->flags = DRM_MODE_FLAG_NVSYNC | DRM_MODE_FLAG_NHSYNC; + if (interlace) + mode->flags |= DRM_MODE_FLAG_INTERLACE; + + drm_mode_set_name(mode); + + if (mode->vtotal != params->num_lines) + return -EINVAL; + + return 0; +} + +/** + * drm_analog_tv_mode - create a display mode for an analog TV + * @dev: drm device + * @tv_mode: TV Mode standard to create a mode for. See DRM_MODE_TV_MODE_*. + * @pixel_clock_hz: Pixel Clock Frequency, in Hertz + * @hdisplay: hdisplay size + * @vdisplay: vdisplay size + * @interlace: whether to compute an interlaced mode + * + * This function creates a struct drm_display_mode instance suited for + * an analog TV output, for one of the usual analog TV mode. + * + * Note that @hdisplay is larger than the usual constraints for the PAL + * and NTSC timings, and we'll choose to ignore most timings constraints + * to reach those resolutions. + * + * Returns: + * + * A pointer to the mode, allocated with drm_mode_create(). Returns NULL + * on error. + */ +struct drm_display_mode *drm_analog_tv_mode(struct drm_device *dev, + enum drm_connector_tv_mode tv_mode, + unsigned long pixel_clock_hz, + unsigned int hdisplay, + unsigned int vdisplay, + bool interlace) +{ + struct drm_display_mode *mode; + enum drm_mode_analog analog; + int ret; + + switch (tv_mode) { + case DRM_MODE_TV_MODE_NTSC_443: + fallthrough; + case DRM_MODE_TV_MODE_NTSC_J: + fallthrough; + case DRM_MODE_TV_MODE_NTSC_M: + fallthrough; + case DRM_MODE_TV_MODE_PAL_60: + fallthrough; + case DRM_MODE_TV_MODE_PAL_M: + fallthrough; + case DRM_MODE_TV_MODE_SECAM_60: + analog = DRM_MODE_ANALOG_NTSC; + break; + + case DRM_MODE_TV_MODE_PAL_B: + fallthrough; + case DRM_MODE_TV_MODE_PAL_D: + fallthrough; + case DRM_MODE_TV_MODE_PAL_G: + fallthrough; + case DRM_MODE_TV_MODE_PAL_H: + fallthrough; + case DRM_MODE_TV_MODE_PAL_I: + fallthrough; + case DRM_MODE_TV_MODE_PAL_N: + fallthrough; + case DRM_MODE_TV_MODE_PAL_NC: + fallthrough; + case DRM_MODE_TV_MODE_SECAM_B: + fallthrough; + case DRM_MODE_TV_MODE_SECAM_D: + fallthrough; + case DRM_MODE_TV_MODE_SECAM_G: + fallthrough; + case DRM_MODE_TV_MODE_SECAM_K: + fallthrough; + case DRM_MODE_TV_MODE_SECAM_K1: + fallthrough; + case DRM_MODE_TV_MODE_SECAM_L: + analog = DRM_MODE_ANALOG_PAL; + break; + + default: + return NULL; + } + + mode = drm_mode_create(dev); + if (!mode) + return NULL; + + ret = fill_analog_mode(mode, + &tv_modes_parameters[analog], + pixel_clock_hz, hdisplay, vdisplay, interlace); + if (ret) + goto err_free_mode; + + return mode; + +err_free_mode: + drm_mode_destroy(dev, mode); + return NULL; +} +EXPORT_SYMBOL(drm_analog_tv_mode); + /** * drm_cvt_mode -create a modeline based on the CVT algorithm * @dev: drm device diff --git a/drivers/gpu/drm/tests/Makefile b/drivers/gpu/drm/tests/Makefile index b29ef1085cad..b22ac96fdd65 100644 --- a/drivers/gpu/drm/tests/Makefile +++ b/drivers/gpu/drm/tests/Makefile @@ -10,5 +10,6 @@ obj-$(CONFIG_DRM_KUNIT_TEST) += \ drm_framebuffer_test.o \ drm_kunit_helpers.o \ drm_mm_test.o \ + drm_modes_test.o \ drm_plane_helper_test.o \ drm_rect_test.o diff --git a/drivers/gpu/drm/tests/drm_modes_test.c b/drivers/gpu/drm/tests/drm_modes_test.c new file mode 100644 index 000000000000..87d398fcb99e --- /dev/null +++ b/drivers/gpu/drm/tests/drm_modes_test.c @@ -0,0 +1,131 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Kunit test for drm_modes functions + */ + +#include + +#include + +#include "drm_kunit_helpers.h" + +struct drm_modes_test_priv { + struct drm_device *drm; +}; + +static int drm_modes_test_init(struct kunit *test) +{ + struct drm_modes_test_priv *priv; + + priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + test->priv = priv; + + priv->drm = drm_kunit_device_init("drm-modes-test"); + if (IS_ERR(priv->drm)) + return PTR_ERR(priv->drm); + + return 0; +} + +static void drm_modes_test_exit(struct kunit *test) +{ + struct drm_modes_test_priv *priv = test->priv; + + drm_kunit_device_exit(priv->drm); +} + +static void drm_modes_analog_tv_ntsc_480i(struct kunit *test) +{ + struct drm_modes_test_priv *priv = test->priv; + struct drm_display_mode *mode; + + mode = drm_analog_tv_mode(priv->drm, + DRM_MODE_TV_MODE_NTSC_M, + 13500 * 1000, 720, 480, + true); + KUNIT_ASSERT_NOT_NULL(test, mode); + + KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 60); + KUNIT_EXPECT_EQ(test, mode->hdisplay, 720); + + /* 63.556us * 13.5MHz = 858 pixels */ + KUNIT_EXPECT_EQ(test, mode->htotal, 858); + KUNIT_EXPECT_EQ(test, mode->vdisplay, 480); + KUNIT_EXPECT_EQ(test, mode->vtotal, 525); +} + +static void drm_modes_analog_tv_ntsc_480i_inlined(struct kunit *test) +{ + struct drm_modes_test_priv *priv = test->priv; + struct drm_display_mode *expected, *mode; + + expected = drm_analog_tv_mode(priv->drm, + DRM_MODE_TV_MODE_NTSC_M, + 13500 * 1000, 720, 480, + true); + KUNIT_ASSERT_NOT_NULL(test, expected); + + mode = drm_mode_analog_ntsc_480i(priv->drm); + KUNIT_ASSERT_NOT_NULL(test, mode); + + KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode)); +} + +static void drm_modes_analog_tv_pal_576i(struct kunit *test) +{ + struct drm_modes_test_priv *priv = test->priv; + struct drm_display_mode *mode; + + mode = drm_analog_tv_mode(priv->drm, + DRM_MODE_TV_MODE_PAL_B, + 13500 * 1000, 720, 576, + true); + KUNIT_ASSERT_NOT_NULL(test, mode); + + KUNIT_EXPECT_EQ(test, drm_mode_vrefresh(mode), 50); + KUNIT_EXPECT_EQ(test, mode->hdisplay, 720); + + /* 64us * 13.5MHz = 864 pixels */ + KUNIT_EXPECT_EQ(test, mode->htotal, 864); + KUNIT_EXPECT_EQ(test, mode->vdisplay, 576); + KUNIT_EXPECT_EQ(test, mode->vtotal, 625); +} + +static void drm_modes_analog_tv_pal_576i_inlined(struct kunit *test) +{ + struct drm_modes_test_priv *priv = test->priv; + struct drm_display_mode *expected, *mode; + + expected = drm_analog_tv_mode(priv->drm, + DRM_MODE_TV_MODE_PAL_B, + 13500 * 1000, 720, 576, + true); + KUNIT_ASSERT_NOT_NULL(test, expected); + + mode = drm_mode_analog_pal_576i(priv->drm); + KUNIT_ASSERT_NOT_NULL(test, mode); + + KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected, mode)); +} + +static struct kunit_case drm_modes_analog_tv_tests[] = { + KUNIT_CASE(drm_modes_analog_tv_ntsc_480i), + KUNIT_CASE(drm_modes_analog_tv_ntsc_480i_inlined), + KUNIT_CASE(drm_modes_analog_tv_pal_576i), + KUNIT_CASE(drm_modes_analog_tv_pal_576i_inlined), + { } +}; + +static struct kunit_suite drm_modes_analog_tv_test_suite = { + .name = "drm_modes_analog_tv", + .init = drm_modes_test_init, + .exit = drm_modes_test_exit, + .test_cases = drm_modes_analog_tv_tests, +}; + +kunit_test_suites( + &drm_modes_analog_tv_test_suite +); +MODULE_LICENSE("GPL v2"); diff --git a/include/drm/drm_modes.h b/include/drm/drm_modes.h index a80ae9639e96..5ccf3d51d313 100644 --- a/include/drm/drm_modes.h +++ b/include/drm/drm_modes.h @@ -443,6 +443,23 @@ bool drm_mode_is_420_also(const struct drm_display_info *display, bool drm_mode_is_420(const struct drm_display_info *display, const struct drm_display_mode *mode); +struct drm_display_mode *drm_analog_tv_mode(struct drm_device *dev, + enum drm_connector_tv_mode mode, + unsigned long pixel_clock_hz, + unsigned int hdisplay, + unsigned int vdisplay, + bool interlace); + +static inline struct drm_display_mode *drm_mode_analog_ntsc_480i(struct drm_device *dev) +{ + return drm_analog_tv_mode(dev, DRM_MODE_TV_MODE_NTSC_M, 13500000, 720, 480, true); +} + +static inline struct drm_display_mode *drm_mode_analog_pal_576i(struct drm_device *dev) +{ + return drm_analog_tv_mode(dev, DRM_MODE_TV_MODE_PAL_B, 13500000, 720, 576, true); +} + struct drm_display_mode *drm_cvt_mode(struct drm_device *dev, int hdisplay, int vdisplay, int vrefresh, bool reduced, bool interlaced, From patchwork Mon Aug 29 13:11:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957870 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 2A63EECAAD2 for ; Mon, 29 Aug 2022 13:21:11 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A5CFB10F299; Mon, 29 Aug 2022 13:21:03 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 794E210F2C9; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id DE0332B06057; Mon, 29 Aug 2022 09:13:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 29 Aug 2022 09:13:18 -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=1661778795; x= 1661785995; bh=5SmMwyB9Gqo8FDnXGtfd83YIIFTn/fwrRNe//5Xw3dI=; b=t vkJx7SeS1Cy1yJQMfqERqufTAT+s42Q/fsY8BqGnHF2WH82nxv54orocvcQsDRSe xHEwnDwiAvdCRWdgtIvjdVG138mZX/FkxJqXEvuQ2j+3dljstbGtxuvN0NKS8cqm yrtyLvP1AF5gttBnR3m9QyGJWOHtqfHWm7ZVwmUsaAkcLptw6gsPBkO6fbBADeuW 5JpByOliaT/Dz6oYTS753tpSe8UO96aZOQaK+AdLwZeuUygTcELBH9EPS8rMva7m RDe16clj6vI4xOwZWXcKW/Iyl95azTUmuBDD9kbJuHdDOntoCfrQO6Bn4vaudqHD bg5dC3i1jsG08ffjD5y4Q== 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=1661778795; x= 1661785995; bh=5SmMwyB9Gqo8FDnXGtfd83YIIFTn/fwrRNe//5Xw3dI=; b=T DNq5wlW/QB6mLqqaE8+uTZxuMwFFIAAdRI99gXbGZGcs2Bp0L+7EnGqbP0ApWb32 E9+sbTKvmaSY29vURTvbnYqlD8Xc1Trl/mDCb117C/Oz83UyaShSxoiPmhGr1/o8 3UCcx6RpckiTNPH+uvYeSfzGrnAg1gLg/wjiJUMgpYNy4DYd2RDAG6icAguhH8Rx wYBH9bYFVYo+qJbG+5PajyHfJT4X6lf4OClsEi4HlK0zhyR8PymfIYw9kNVHzTh0 m1kx2cKWIQog50gFNd29gd48AyVJIpxZdi+amzF7hU0ds70gLTiTsHEwK/rADDsi Sw7P6ZMPx4x/qinOZSC7Q== 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:13:14 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:25 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-11-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=1602; i=maxime@cerno.tech; h=from:subject:message-id; bh=8m2oE9knJwjnJjXPGWMUzPqprWg4Yy2kfTXAOXrvUBw=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+TFb5186ny1/84sy/s5f/fZntb7tNzPRSPttvTSm1cN ez4c6ihlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBELosxMhxUVWW7O7lOLH3qibNR5y 7/5vyrydC9J37Pi3/7lBmPvqhl+GelPS+9T6HOxO6kutbhwMIzWZXcy7ojzn15b1s2dQ1nJTMA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 11/41] drm/modes: Only consider bpp and refresh before options X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Some video= options might have a value that contains a dash. However, the command line parsing mode considers all dashes as the separator between the mode and the bpp count. Let's rework the parsing code a bit to only consider a dash as the bpp separator if it before a comma, the options separator. A follow-up patch will add a unit-test for this once such an option is introduced. Signed-off-by: Maxime Ripard Reviewed-by: Geert Uytterhoeven diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index ee581ee17171..b4e1ff56b4d8 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2254,20 +2254,22 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, name = mode_option; + /* Locate the start of named options */ + options_ptr = strchr(name, ','); + if (options_ptr) + options_off = options_ptr - name; + else + options_off = strlen(name); + /* Try to locate the bpp and refresh specifiers, if any */ - bpp_ptr = strchr(name, '-'); + bpp_ptr = strnchr(name, options_off, '-'); if (bpp_ptr) bpp_off = bpp_ptr - name; - refresh_ptr = strchr(name, '@'); + refresh_ptr = strnchr(name, options_off, '@'); if (refresh_ptr) refresh_off = refresh_ptr - name; - /* Locate the start of named options */ - options_ptr = strchr(name, ','); - if (options_ptr) - options_off = options_ptr - name; - /* Locate the end of the name / resolution, and parse it */ if (bpp_ptr) { mode_end = bpp_off; From patchwork Mon Aug 29 13:11:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957866 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 F083CECAAD4 for ; Mon, 29 Aug 2022 13:21:06 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C9F2510F29A; Mon, 29 Aug 2022 13:21:00 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2401610F2BB; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 1BDC52B06056; Mon, 29 Aug 2022 09:13:22 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 29 Aug 2022 09:13: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=1661778801; x= 1661786001; bh=03XFcTJGiCv9x9hOMYU/IHnyg9+FpgYuQ7Ewjsv6kOA=; b=X c7Z5RIAZDbcktvpiPovFQfv/Y+JZDt9Or7HaQL73yJS0K4Gs5Og1xFOgCL66llUO AN19C9qauHvTD9elrKkpu6uU27pT+S7+BMmY8zxNEi9Z4eRSvJ7IfXJf95w5SW7B CVhJfNFpKTe0B6nHT1lD8RablUVX4mVkdNpB/yG7wuX3iIEeq+74faTTJ4WdJ3K9 NRLwKnNCuIKPGysxdxJ+RfElAn8MeE63zZMUEu8Dgp4cfXpFLDlfwG2InlkmiXHe Pj4SOefke/2JUw+3akKRVKmqoLNKzBteC5Vp28rCeeqSGIR387lbhtUqOkRI/FbZ 6c5vslviwQEL6X+3/9c4A== 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=1661778801; x= 1661786001; bh=03XFcTJGiCv9x9hOMYU/IHnyg9+FpgYuQ7Ewjsv6kOA=; b=M bBgXynKSTeXOi2Bq2ciTxgZr49tswVd1B67bm33Oe+jsfieBOiGE/jghr/rQau7Q jfXnxj108C5/GztijwkGIyt8hYMdZOZhuqYiR5jEICLEN8FsUQiTaB/PMqTwlsDr m5xOhYIudZVeAWMzFDlrUNp6lw61f5HB3bp+MZ4MpyQvCPeOTH6KhjCsPzsPIAHA 7hYNarsPIwcQLMivE+KQpBeAYDF2Ua8cyOUn61E4gzrMp+7N5RLnQQJYVTXwrao+ jjvXGcY8QVG2ldnvaGx+pHaZO87UEnqo2O94itRw0ttGLi50emoVMQf1M7M7OY11 ktMxMF29aSYCZnc3i2XFA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:20 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:26 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-12-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=1069; i=maxime@cerno.tech; h=from:subject:message-id; bh=Ce+TyjEkD5ms8VGGkYRw7EWiyTTKy0ScuMQtAi1SOoM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+STGJ7KXdfiCpu8Ly6soUhh28WTTV9uP/32bVpCR9ya VT6nO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjARk2eMDDOtWWM3xD1IOvu6Yy7n9E XnpnI6a4mdEj0moHq09aWj+0lGhmbh6am2ujO65oV/3/+qPFxaidez/2Xpil3L5COOa6z4yg4A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 12/41] drm/modes: parse_cmdline: Add support for named modes containing dashes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Geert Uytterhoeven It is fairly common for named video modes to contain dashes (e.g. "tt-mid" on Atari, "dblntsc-ff" on Amiga). Currently such mode names are not recognized, as the dash is considered to be a separator between mode name and bpp. Fix this by skipping any dashes that are not followed immediately by a digit when looking for the separator. Signed-off-by: Geert Uytterhoeven Reviewed-by: Hans de Goede Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index b4e1ff56b4d8..99a21e5cd00d 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2263,6 +2263,8 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, /* Try to locate the bpp and refresh specifiers, if any */ bpp_ptr = strnchr(name, options_off, '-'); + while (bpp_ptr && !isdigit(bpp_ptr[1])) + bpp_ptr = strnchr(bpp_ptr + 1, options_off, '-'); if (bpp_ptr) bpp_off = bpp_ptr - name; From patchwork Mon Aug 29 13:11:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957865 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 982C5ECAAD4 for ; Mon, 29 Aug 2022 13:21:04 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5643F10F28F; Mon, 29 Aug 2022 13:21:00 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1842610F2A6; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id 8A0532B0605A; Mon, 29 Aug 2022 09:13:29 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 29 Aug 2022 09:13:32 -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=1661778809; x= 1661786009; bh=brLbE95VBy9k5VrYGsPmloGy1lQZHCg9ZtxvtLcN1Qo=; b=j VkdkcClmfca8ElGpw0RAUt6m0Gv54+jM4X6lntwUEfv7lCmbcJuIth2VWei8y+cd 66vxd9smnQcFRnfejC9XHL3S/pFGm3WLbPCILUneIvSGk3FbOZvvx8rQZ54aD4H/ QESHl1LRxXzJ4lQsnoTMXHZwcX8kaQ8XHL7iFQcNHlrjJfsvqd1DW5rok2+9xKdo 2/ezTLRD3N85GwYKFj/d+b6Bfjv2THt9bzbFmMtpIarDyuTdJmhk/KDYz4AQRZBj ydDkQIwX1JY93ko3aHmBviKn27JS+SPSX2YpgqD9dsTXD8otEF8OKpEj/d2RbE63 FNX6zFHaMH5eWLAarNhjQ== 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=1661778809; x= 1661786009; bh=brLbE95VBy9k5VrYGsPmloGy1lQZHCg9ZtxvtLcN1Qo=; b=k ZHECdYLCXDeqxnapuI20tTO8mFMpxYBQYiVrjy+m6DUhl5NvVrBks99gMNPLfLAY 3D8/PGAc1flNRTn+dXSvw9R8UO5AGc6GPOKYt8NqCIXuCHOhRUu16hHRvtmoLRZH DotvcSUISFUVXeue3GIVZLJZoY84yQEE8IA1dsXYe+cv5h3k67XugSpptyOx2Qrp rWO0M5YRCDKFrYm5OKKzUNKit1Wq3hbZX6P/n9jObYnNyYevwieztoe2ZmWdgdjA Dfu6iHgyigQ7fYceitKtlN7DyGUZrxlcQUmBsshaUl6QedFeUKFNI4y6A0RIZRNZ WV7FFCRLoBXBkZDiNZcPg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:28 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:27 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-13-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=4333; i=maxime@cerno.tech; h=from:subject:message-id; bh=/dKwZjZwU+Jvp9SGqNZ5BX5aWEOsSsT2gHorhJZbBUM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+SZN0uElihtmCoZ1NGtY/5u1Y6L0ut/76w9svehzJqG 5a/XdJSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAiaw8xMkxar1m//ENZ/Xb9ul+GZb 8u6+nv9nNcbW2SapnN9TWGfTfDH37F6e/nPQjbtKnCjeH689/T3/ldbpyjo6/PfJUvxDOwnx0A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 13/41] drm/client: Add some tests for drm_connector_pick_cmdline_mode() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" drm_connector_pick_cmdline_mode() is in charge of finding a proper drm_display_mode from the definition we got in the video= command line argument. Let's add some unit tests to make sure we're not getting any regressions there. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_client_modeset.c b/drivers/gpu/drm/drm_client_modeset.c index bbc535cc50dd..d553e793e673 100644 --- a/drivers/gpu/drm/drm_client_modeset.c +++ b/drivers/gpu/drm/drm_client_modeset.c @@ -1237,3 +1237,7 @@ int drm_client_modeset_dpms(struct drm_client_dev *client, int mode) return ret; } EXPORT_SYMBOL(drm_client_modeset_dpms); + +#ifdef CONFIG_DRM_KUNIT_TEST +#include "tests/drm_client_modeset_test.c" +#endif diff --git a/drivers/gpu/drm/tests/drm_client_modeset_test.c b/drivers/gpu/drm/tests/drm_client_modeset_test.c new file mode 100644 index 000000000000..46335de7bc6b --- /dev/null +++ b/drivers/gpu/drm/tests/drm_client_modeset_test.c @@ -0,0 +1,114 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2022 Maxime Ripard + */ + +#include + +#include +#include +#include +#include +#include +#include + +#include "drm_kunit_helpers.h" + +struct drm_client_modeset_test_priv { + struct drm_device *drm; + struct drm_connector connector; +}; + +static int drm_client_modeset_connector_get_modes(struct drm_connector *connector) +{ + struct drm_display_mode *mode; + int count; + + count = drm_add_modes_noedid(connector, 1920, 1200); + + return count; +} + +static const struct drm_connector_helper_funcs drm_client_modeset_connector_helper_funcs = { + .get_modes = drm_client_modeset_connector_get_modes, +}; + +static const struct drm_connector_funcs drm_client_modeset_connector_funcs = { +}; + +static int drm_client_modeset_test_init(struct kunit *test) +{ + struct drm_client_modeset_test_priv *priv; + int ret; + + priv = kunit_kzalloc(test, sizeof(*priv), GFP_KERNEL); + if (!priv) + return -ENOMEM; + test->priv = priv; + + priv->drm = drm_kunit_device_init("drm-client-modeset-test"); + if (IS_ERR(priv->drm)) + return PTR_ERR(priv->drm); + + ret = drmm_connector_init(priv->drm, &priv->connector, + &drm_client_modeset_connector_funcs, + DRM_MODE_CONNECTOR_Unknown, + NULL); + if (ret) + return ret; + drm_connector_helper_add(&priv->connector, &drm_client_modeset_connector_helper_funcs); + + return 0; +} + +static void drm_client_modeset_test_exit(struct kunit *test) +{ + struct drm_client_modeset_test_priv *priv = test->priv; + + drm_kunit_device_exit(priv->drm); +} + +static void drm_pick_cmdline_res_1920_1080_60(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 *expected_mode, *mode; + const char *cmdline = "1920x1080@60"; + int ret; + + expected_mode = drm_mode_find_dmt(priv->drm, 1920, 1080, 60, false); + KUNIT_ASSERT_PTR_NE(test, expected_mode, NULL); + + 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(expected_mode, mode)); +} + +static struct kunit_case drm_pick_cmdline_tests[] = { + KUNIT_CASE(drm_pick_cmdline_res_1920_1080_60), + {} +}; + +static struct kunit_suite drm_pick_cmdline_test_suite = { + .name = "drm_pick_cmdline", + .init = drm_client_modeset_test_init, + .exit = drm_client_modeset_test_exit, + .test_cases = drm_pick_cmdline_tests +}; + +kunit_test_suite(drm_pick_cmdline_test_suite); +MODULE_AUTHOR("Maxime Ripard "); +MODULE_LICENSE("GPL"); From patchwork Mon Aug 29 13:11:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957863 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 83B97ECAAD4 for ; Mon, 29 Aug 2022 13:21:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A271010F26B; Mon, 29 Aug 2022 13:20:58 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5C87D10F2C5; Mon, 29 Aug 2022 13:20:49 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 1333B2B0605B; Mon, 29 Aug 2022 09:13:35 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 29 Aug 2022 09:13:38 -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=1661778815; x= 1661786015; bh=3cA2OufWoWcBPPMmarJbJeQBU07cKTKh4Zqak42tigI=; b=d fcn2HpCWlVWvu+ZDmYxNviyOJbpvJdb/sYJ199sfj/4zTzwqX3F3kDyz//ABqsXo QevIYkHKvr6IS4GSCa8GWgmPx/oMwFGPl4AlHQD3KldhC6xmaidxTK7aIDUY2FpU flWCO1wi140aovdzyz5hSXzeM/qvS7xwAwfXRdgbudGr7tAz0M+RentzR1vvL4fK fVCg87KGfcA1N54Y3gqqfnPrIMQ10sBmtIl2eX8MFYrYpk3QIP/r9HoX4sw0tJ6N HR+N2tu9TbdpYNOqEwsJQHYFz8nKz/vHNQ5eNDB0gfJPczKsqVrBl6oSFb7dQGss 7v8cDuWC9/6J/123S9Ksw== 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=1661778815; x= 1661786015; bh=3cA2OufWoWcBPPMmarJbJeQBU07cKTKh4Zqak42tigI=; b=A F8ztcmvlKScp5VD6dfscZkkYSH8pULe5JhGdlrn6D9tmou1xfNGuPyGsDapUuLfO /L8Gndt+HjsZafQiZmNFdj52f+hC+4MOM/1TLqmTd/Kx6RkAFBnfdA/Si3G4bvhV rXjRqc0RC8CwJ4et9/aqFiNNLRATcbyO/30ZJ5+dARQd4rqWwlglVrGpoK8z2gVy 38E+g6SB6s1Inbeni/IvT3orEwQxm/4Y1GCm71Gzn5s2sAlGm9FKt5jCo+kJDTuU TCvRzwecZ4o/jEis6VXvRuibvq7XHB+NfQE/de8Rk8sizcLhMZl/SVIuGqpkMKPg C1WgQ2XKAVj2D8yOcpKyQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:34 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:28 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-14-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=3500; i=maxime@cerno.tech; h=from:subject:message-id; bh=g78xF6eprUFyI1I3Lc8j/JkwaSEg8YsZvbc0EnOZ45M=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+SntIuc3+vdVhvklq0t6iPJ8vjeinP9jYWK700fLs99 pfqoo5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABMR2MDwm505M9T4i4pTmdgHn63Gea G1lZaxIpt3mp7btLm6aWVuM8P/RPs5Lz69DDuo1bb40m3fmT1qnnO1W/mW/XOZpPIu+9dufgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 14/41] drm/modes: Move named modes parsing to a separate function X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The current construction of the named mode parsing doesn't allow to extend it easily. Let's move it to a separate function so we can add more parameters and modes. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 99a21e5cd00d..0636cb707544 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -1909,6 +1909,9 @@ void drm_connector_list_update(struct drm_connector *connector) } EXPORT_SYMBOL(drm_connector_list_update); +#define STR_STRICT_EQ(str, len, cmp) \ + ((strlen(cmp) == len) && !strncmp(str, cmp, len)) + static int drm_mode_parse_cmdline_bpp(const char *str, char **end_ptr, struct drm_cmdline_mode *mode) { @@ -2208,6 +2211,52 @@ static const char * const drm_named_modes_whitelist[] = { "PAL", }; +static int drm_mode_parse_cmdline_named_mode(const char *name, + unsigned int name_end, + struct drm_cmdline_mode *cmdline_mode) +{ + unsigned int i; + + if (!name_end) + return 0; + + /* If the name starts with a digit, it's not a named mode */ + if (isdigit(name[0])) + return 0; + + /* + * If there's an equal sign in the name, the command-line + * contains only an option and no mode. + */ + if (strnchr(name, name_end, '=')) + return 0; + + /* The connection status extras can be set without a mode. */ + if (STR_STRICT_EQ(name, name_end, "d") || + STR_STRICT_EQ(name, name_end, "D") || + STR_STRICT_EQ(name, name_end, "e")) + return 0; + + /* + * We're sure we're a named mode at that point, iterate over the + * list of modes we're aware of. + */ + for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { + int ret; + + ret = str_has_prefix(name, drm_named_modes_whitelist[i]); + if (ret != name_end) + continue; + + strcpy(cmdline_mode->name, drm_named_modes_whitelist[i]); + cmdline_mode->specified = true; + + return 1; + } + + return -EINVAL; +} + /** * drm_mode_parse_command_line_for_connector - parse command line modeline for connector * @mode_option: optional per connector mode option @@ -2244,7 +2293,7 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, const char *bpp_ptr = NULL, *refresh_ptr = NULL, *extra_ptr = NULL; const char *options_ptr = NULL; char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL; - int i, len, ret; + int len, ret; memset(mode, 0, sizeof(*mode)); mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; @@ -2285,17 +2334,19 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, parse_extras = true; } - /* First check for a named mode */ - for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { - ret = str_has_prefix(name, drm_named_modes_whitelist[i]); - if (ret == mode_end) { - if (refresh_ptr) - return false; /* named + refresh is invalid */ - strcpy(mode->name, drm_named_modes_whitelist[i]); - mode->specified = true; - break; - } + if (mode_end) { + ret = drm_mode_parse_cmdline_named_mode(name, mode_end, mode); + if (ret < 0) + return false; + + /* + * Having a mode that starts by a letter (and thus is named) + * and an at-sign (used to specify a refresh rate) is + * disallowed. + */ + if (ret && refresh_ptr) + return false; } /* No named mode? Check for a normal mode argument, e.g. 1024x768 */ From patchwork Mon Aug 29 13:11:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957899 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 76CE5ECAAD2 for ; Mon, 29 Aug 2022 13:26:19 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A42C310F2D4; Mon, 29 Aug 2022 13:25:59 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6A0EF10F277; Mon, 29 Aug 2022 13:25:48 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 5CBD12B0605E; Mon, 29 Aug 2022 09:13:42 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 09:13:45 -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=1661778821; x= 1661786021; bh=ltOYRG7v3tJzbIBGGuYcDX0LFcNaJ6PQeW/ZDe0nh/k=; b=m 7cJL3Tx1R/AdRyXvg9fuTo+UkRM7I9GJqB3muCppd0uzMsB/u+S+VVVy0wfCEdl6 wqXmchU4kN9Yc7O8Yv0Gh8nFHpXTqcJpMQd3ekaHDCn6Z1Ztl9tSpvjZBommGqwE vPQvOhoQcmftregixxfdTKx33AtFhnIqO6c2TPiMWAsU056yLTQvE1fs8bEzReC+ dsK66EPukNp7njpMz+6Fers7BUpwGEJWYBvgtkE1pN3ig+CzJhnekQ32Xih+ZD3E Gh2WWZCvbqCBzeBPaGVmVDZOZkfOoZ6je/FTfd1DDQ+V8Pxf1FjXy+Vo+QSzp4mM wL4QDSD9lcQu7kVeuiyRg== 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=1661778821; x= 1661786021; bh=ltOYRG7v3tJzbIBGGuYcDX0LFcNaJ6PQeW/ZDe0nh/k=; b=E gQdFq4FpwAaoluysfo4+L8sX7Spy2I9XIpng5hfvx0hUvtTmCqkBPSwzxL4FuN/+ y//4E/PG4eAiYFk7qUyue7xGvXvYrJ46yrRPGJdxnK2eear8WV0bpy3sX83/M61x uvTPdAfdGOoaiv7AdM+KToUcKeg3AFpmnD2uVCCRVgGL6Am7XD40/AhRkOtoKazd uhiMDGAVQir7q2+XFLzmwVa2cb/+YwqSHM6uJPWV2jQ47Zo8X8XlP1nXLm69c3/h Fqlka9w81rdGt7Yclq2SdV5oy/ElCUqrbeLEFKLZVOQ6zEV+oI4Y2/LHXj7Al6tt THo2S9JTcNZ2BD0tNUp2g== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:40 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:29 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-15-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=1620; i=maxime@cerno.tech; h=from:subject:message-id; bh=dI9HvhesuJCadfdRJpcjt131uRCcHtdTs7qad6DvrlM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+SvxJRNvRO9PfP45cNP94Uk+JdUnqx/s6mu1+Psb7uL 9nycHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZiIZzYjw3bHY1dcZ9wR1rhUue3wpU kNuTsdojmEy87kM/sbR/OeuMDwz+ShxdZlsx66S8zcaZ/nz3DsW7MlczSju49UVLQBz4s1XAA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 15/41] drm/modes: Switch to named mode descriptors X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The current named mode parsing relies only the mode name, and doesn't allow to specify any other parameter. Let's convert that string list to an array of a custom structure that will hold the name and some additional parameters in the future. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 0636cb707544..1fdfa004b139 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2206,9 +2206,13 @@ static int drm_mode_parse_cmdline_options(const char *str, return 0; } -static const char * const drm_named_modes_whitelist[] = { - "NTSC", - "PAL", +struct drm_named_mode { + const char *name; +}; + +static const struct drm_named_mode drm_named_modes[] = { + { "NTSC", }, + { "PAL", }, }; static int drm_mode_parse_cmdline_named_mode(const char *name, @@ -2241,14 +2245,15 @@ static int drm_mode_parse_cmdline_named_mode(const char *name, * We're sure we're a named mode at that point, iterate over the * list of modes we're aware of. */ - for (i = 0; i < ARRAY_SIZE(drm_named_modes_whitelist); i++) { + for (i = 0; i < ARRAY_SIZE(drm_named_modes); i++) { + const struct drm_named_mode *mode = &drm_named_modes[i]; int ret; - ret = str_has_prefix(name, drm_named_modes_whitelist[i]); + ret = str_has_prefix(name, mode->name); if (ret != name_end) continue; - strcpy(cmdline_mode->name, drm_named_modes_whitelist[i]); + strcpy(cmdline_mode->name, mode->name); cmdline_mode->specified = true; return 1; From patchwork Mon Aug 29 13:11:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957901 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 E0F4BC0502C for ; Mon, 29 Aug 2022 13:26:22 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9BAC010F2E8; Mon, 29 Aug 2022 13:26:02 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7FDE110F299; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id A60042B0605D; Mon, 29 Aug 2022 09:13:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:13:51 -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=1661778828; x= 1661786028; bh=AAvXImFRqhXK3wzdRCgVDl9APZWKjeBdFuiGKB1+8lA=; b=O 3Ju7lSD9HBG2Jp2F5aPP1xNX7MinO6GQLZ1QfrCnLDMSS1OaLPtEww6liBm0C7AK 1W25pMbOBRD59a1kpko5mU92VQHgrxQn3NKxVuIUdL3vjbS/AnhQ33yp0PQS/Azp HfUI7mD2BILNiCwU4Y08fqhBmgIpxDHG57SaMG+muUzCCeab2JL0FAAwqzp6DpRO AtGZM+wAyNl02LsE7VrB446RlL95Y+Ab1KYOyGy6Y+zlrY2tBZjKZLv9nr0SeivU sxwhkaV80DT55n+8ot86G1y7T1QFeWQJe6bzM7fHnxrgH313kAXBY8jcVm0tRCYu 4GYWR2GWwuOn9oBF842Lg== 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=1661778828; x= 1661786028; bh=AAvXImFRqhXK3wzdRCgVDl9APZWKjeBdFuiGKB1+8lA=; b=r 7HiL1g/pL8NSYTqdGC8mulIobHbDSVRvB90imWhz2bioxrU71fBtvzh2iQhTOD0P fY6OuyimI2YOK6y1EeK+QB+VTylc5tM/G5tJOc2VSLHRvQJYX9gzUL8YPWh3bY2/ WtR/I6DZEHtkCKCQo/a90fKS9hh5DaO47jVEED9d7bqe9HfZeD+RWn50EkmzgnkZ 84RYzBF73EeOumdLJeVNNnQ23pX7csARnQ+HUc4qtQtD4VpGCWklnU8jTXKSwUJ6 /OMtztafTFh9AqrLgmCSfuJ2FAaLyCK8AhqcQt/ZpNz8dHQLoEKhvek1zLvtTBXg VtL+udw+acHjQqUK7ybhA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:47 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:30 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-16-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=1645; i=maxime@cerno.tech; h=from:subject:message-id; bh=cx3bZ2Z+vnsINoBvMJVTM9LZ3rHQTrc0mEfL62Vz/88=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8u+Rzt3OsVsjbJGv7UNrGwSXJqZuBm/2ZUZuby4QFFz5Y NU7tKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwESW8jMyHI33m2VpfF5wnZj/uaSObg 7Z31KKeUJrtxS89ApY86M4gZGhQUtZ/lNcn530bpOoYvOQe/8nLJQ+8uHtTHt94Td/M3ayAgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 16/41] drm/modes: Fill drm_cmdline mode from named modes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The current code to deal with named modes will only set the mode name, and then it's up to drivers to try to match that name to whatever mode or configuration they see fit. The plan is to remove that need and move the named mode handling out of drivers and into the core, and only rely on modes and properties. Let's start by properly filling drm_cmdline_mode from a named mode. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 1fdfa004b139..5e898699b532 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2208,11 +2208,22 @@ static int drm_mode_parse_cmdline_options(const char *str, struct drm_named_mode { const char *name; + unsigned int xres; + unsigned int yres; + unsigned int flags; }; +#define NAMED_MODE(_name, _x, _y, _flags) \ + { \ + .name = _name, \ + .xres = _x, \ + .yres = _y, \ + .flags = _flags, \ + } + static const struct drm_named_mode drm_named_modes[] = { - { "NTSC", }, - { "PAL", }, + NAMED_MODE("NTSC", 720, 480, DRM_MODE_FLAG_INTERLACE), + NAMED_MODE("PAL", 720, 576, DRM_MODE_FLAG_INTERLACE), }; static int drm_mode_parse_cmdline_named_mode(const char *name, @@ -2254,6 +2265,9 @@ static int drm_mode_parse_cmdline_named_mode(const char *name, continue; strcpy(cmdline_mode->name, mode->name); + cmdline_mode->xres = mode->xres; + cmdline_mode->yres = mode->yres; + cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); cmdline_mode->specified = true; return 1; From patchwork Mon Aug 29 13:11:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957893 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 E03C9ECAAD5 for ; Mon, 29 Aug 2022 13:25:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 29A8110F2CA; Mon, 29 Aug 2022 13:25:54 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id D953410F2C4; Mon, 29 Aug 2022 13:25:48 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 19C952B06060; Mon, 29 Aug 2022 09:13:55 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:13:57 -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=1661778834; x= 1661786034; bh=Xt4h71qgo36Lun6EJqBoeTJELWWLQIvV4RB+WH0LhHQ=; b=A URRgIN0UNq9YgAaMUAmS47vuw8XNqz5mG/9qj2U6JoVDiEIF4wL6gnT6QVoVhKVT lAae47kfEO1J5li7lDSMsRM3pylMMP+Ph9Kl57XBwr1rG/hKcyuaRZ12IuGyCLwH hkre6zhwHJ1t0IeAfqm3T5nnzfoynu4F349aVB2XEhd2PGhW3E8g9wMwf5/HXy8K GnTB9wEtlpCZIRxmdt6uHiPu/yqiT3TUTGCAa1Mri+hSezeG4EvUNoCeNuQdJdTE 2LgBQqDdlmsYtunHMd89JUbgYlSRAY3disQYPw7KcZ48fDlij/DS3ubs7WH/ffNT AdIKpoad30xnanhEdV+Tw== 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=1661778834; x= 1661786034; bh=Xt4h71qgo36Lun6EJqBoeTJELWWLQIvV4RB+WH0LhHQ=; b=y 9kG0RkitVaKWooVlwojzV9xib8E89NbQ9Gw7FKJkGFcyOXt6xZDe9mRJQccbVs9j rz3OfAO/Ue45qpg4H2oBeseZwqomZ0iLYApw9u1hLjd4YQ8hH71osulAJbcfs2JP otqCtX9pYSHsoI/ERw6zVDznKGpxoMwQPaL8EolkvBkzW1MujM2NeLbMDIEUZVhs vJMNL/DasLUTXwiZEqp0QJdWQzYC588ln4bsAPW9Cj/4wV4GrT9LWd5sf9BS0E9X jDSAI0ofDx7hbXKlSRJr0ZT5DKXnMrkwtowGCGQ4Qknv6bEzS6cSaPxUqLHWyZbt qgjbIRH6ZzFzyvP6UgDFw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:53 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:31 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-17-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=2061; i=maxime@cerno.tech; h=from:subject:message-id; bh=g8InIRf4u9qt8kxe4oCM32qGfcUWItUjH3nMpSZ44ak=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxS+ZRn27zx4v121K3itq9sdkSPCYYzLbkxMfrzTX27K tj2fO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjARcz2Gf7azWNkqq6+t2bDQMKGJ9+ cdL9Ot/IWFj2sXrzPRYmIMTWBkaK0s3shnor4oplDh+/Nvv1V3a1abeZm+9ajcXVaqP/E/KwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 17/41] drm/connector: Add pixel clock to cmdline mode X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 5e898699b532..73d01e755496 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2208,22 +2208,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, @@ -2265,6 +2267,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 7d3881f35e7c..bb39d2bb806e 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1352,6 +1352,13 @@ struct drm_cmdline_mode { */ bool bpp_specified; + /** + * @pixel_clock: + * + * Pixel Clock in kHz. Optional. + */ + unsigned int pixel_clock; + /** * @xres: * From patchwork Mon Aug 29 13:11:32 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957917 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 2BB46ECAAD5 for ; Mon, 29 Aug 2022 13:26:44 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C1EA10F2C4; Mon, 29 Aug 2022 13:26:10 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 2C21E10F2C4; Mon, 29 Aug 2022 13:25:50 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 0476E2B06062; Mon, 29 Aug 2022 09:14:01 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 29 Aug 2022 09:14:05 -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=1661778841; x= 1661786041; bh=yoaENtujWDk2YoyUfMlWzPbfHesL4mBWigqPk9djZvs=; b=f d9mQL3XqdfvxkmnIOAr4zeHb8+fyR98wQCL6yRhZGsZL9hiDIpvmv0HpX8Txvql7 Q9bWee+eLxH+EEYGTgo8BQYBI4j7bQj301VJI0O7r/aJkvkb8BcyJStBMYEiidYm txaVLVN5SVmtC20Y7sQBbZJRB3iuQNY7pVbUDLifp73Wzqr6u2kHsDhNubXQcqEl vHI15lEijNN1+rlj2tEKQtinuk5QKUw+CN2JoHBEGhC0rbiWKA7u4G4enTH4udVa hbNqiM7x+6F/u0vaZSfW1VfFmqQB66uefjwPJoPFVUGl0jFcGKnbjDa2wNoI9F1N uw6FSQ0vZ/jYKqLZOLB6Q== 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=1661778841; x= 1661786041; bh=yoaENtujWDk2YoyUfMlWzPbfHesL4mBWigqPk9djZvs=; b=d Zk9nwZmUpnx+HmXyKpkJCVr7ucshcCzqh0RWAW2vVqikaUE2XhsiK7xDEofNcCxb 9Y5RET5Qfpp5DZ+6+cqHcrH+4/nJf44AYd5SEYfmuMVD13Nc2ZjszQNFRxdz7g0W +zBpYpFxVQmo7o3jwrROWksR2nyR9PPjEnSdu7ASowlbkh7NaErSymJdsT6lPi6m 118EvdFCzeVvycRHKD4pmzh3yP9QBIzJ9+2p4oQ88cDwCX8B7lq1g8Rp86SVd63G ORYTQSzlsNiwTeLRbI4zyVxa1WBoHojra06jN5Lh++GMVM80DOc8ik4FqpGuPH6J CFLeI1nT+Z/NIz77Z1yfw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:13:59 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:32 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-18-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=2253; i=maxime@cerno.tech; h=from:subject:message-id; bh=aZsDW2fSgZ75fEDwwGs+4i//mN9OlBrWjoxn+bTDlQ8=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxQ0Od59aMvJeOlf+r7704+U5q/Xu9L2p4hudt7KdeN/ 3luBjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEyEK5yRocE8o/WP67Zfy0uWT3M43j 7bX/L3IbvtpSs1/CPaTl3bvYbhf16R29Onf/1nFLmkX1/6/Of5hpmyDR03D3me3PUwKfsqExcA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 18/41] drm/connector: Add a function to lookup a TV mode by its name X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" As part of the command line parsing rework coming in the next patches, we'll need to lookup drm_connector_tv_mode values by their name, already defined in drm_tv_mode_enum_list. In order to avoid any code duplication, let's do a function that will perform a lookup of a TV mode name and return its value. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index b1fcacd150e8..0fe01a1c20ad 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -1003,6 +1003,30 @@ static const struct drm_prop_enum_list drm_tv_mode_enum_list[] = { }; DRM_ENUM_NAME_FN(drm_get_tv_mode_name, drm_tv_mode_enum_list) +/** + * drm_get_tv_mode_from_name - Translates a TV mode name into its enum value + * @name: TV Mode name we want to convert + * @len: Length of @name + * + * Translates @name into an enum drm_connector_tv_mode. + * + * Returns: the enum value on success, a negative errno otherwise. + */ +int drm_get_tv_mode_from_name(const char *name, size_t len) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(drm_tv_mode_enum_list); i++) { + const struct drm_prop_enum_list *item = &drm_tv_mode_enum_list[i]; + + if (strlen(item->name) == len && !strncmp(item->name, name, len)) + return item->type; + } + + return -EINVAL; +} +EXPORT_SYMBOL(drm_get_tv_mode_from_name) + static const struct drm_prop_enum_list drm_tv_select_enum_list[] = { { DRM_MODE_SUBCONNECTOR_Automatic, "Automatic" }, /* DVI-I and TV-out */ { DRM_MODE_SUBCONNECTOR_Composite, "Composite" }, /* TV-out */ diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index bb39d2bb806e..49d261977d4e 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1943,6 +1943,8 @@ const char *drm_get_dp_subconnector_name(int val); const char *drm_get_content_protection_name(int val); const char *drm_get_hdcp_content_type_name(int val); +int drm_get_tv_mode_from_name(const char *name, size_t len); + int drm_mode_create_dvi_i_properties(struct drm_device *dev); void drm_connector_attach_dp_subconnector_property(struct drm_connector *connector); From patchwork Mon Aug 29 13:11:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957912 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 34D6DC0502E for ; Mon, 29 Aug 2022 13:26:38 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2D82010F30B; Mon, 29 Aug 2022 13:26:06 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id C940F10F2DF; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id B86CE2B06066; Mon, 29 Aug 2022 09:14:08 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 29 Aug 2022 09:14:11 -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=1661778848; x= 1661786048; bh=vGDBfdmuxgUQ4QJ2EO3YyCslKAl67xEK9kOPBn5ikEM=; b=d MNgifcNhTnevrazfsuCpNwA8ccw5/PQcnG0PkoOaHYtU/iBvNmK6rRiq7vyBZ1DN Gr9C9YOwQB2j1cjoxfcGpgf/o+y7TZ7zeF9IZuIJZbS2tgwIwhXBKuiztI4tyj1L K3HHg1vRauMP093WqfVfO6JpPD/qG3ZxAwMKEo7AHx6OpYx1A1ousM+/FfgRU85P 5m9/3nPOIOHH1yOIWkBrpjJ+hZk5XaMesRgC8EAIs1uMHB1UNyWtYCl+qQztZJuE nIP6DwTVOph7Joma3I2MlYwhvx1x+QJiedc01HelyygN9t6ycLhvO7XrQ6Xl/fOf /5a9Z2SlFcURoacptcOhw== 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=1661778848; x= 1661786048; bh=vGDBfdmuxgUQ4QJ2EO3YyCslKAl67xEK9kOPBn5ikEM=; b=F Nrc+3KWlslifeaTXCexiwt1w5Hgv45De91Vj1l/08DBog8Lw29VuZAOrqCC41AWy lymme6zCmcFK2H8Upy+r3xKFGjL4U9u+DjqT15dPJLd3mg5rBQmyBXerSc5YZgyH XuovPVtwKpMnQsYZFQTwBKNWiyDH94tFvS7gJ2lrhT2DNCTlfAmp7TaOJxGTpb9H acUtPlUq/VAXSs7wx+q1qWbvtx4sQfPfT0BokLbuOaHLuj8VnRMe5Q4JPuD8rVos vNu1et+dYSFKgyBp9fpOLZOLXwGiedFEpeB9tsGmvZ38/XxZUlLA3c4D3yxBbSgZ DGQKIpEFNen/7+CZpoAlg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:14:07 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:33 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-19-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=11213; i=maxime@cerno.tech; h=from:subject:message-id; bh=NDabIx53tuQKr6EzimhAU/xCP6zMPL7S96XwMvmuHj0=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxTSj/WbrfjxYmlFql+68tJ0WYdzvZxzDht91dy97dFk xYjQjlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEzE7iLD/+KXXAX5J/x/XjpsxNuzN7 jE69YR2wi2f1fPZ5i+lDOWj2f472iv++mu0//fHE86r7H2hZhv2ri6fNtkjWS/oobnDkyfGQA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 19/41] drm/modes: Introduce the tv_mode property as a command-line option X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Our new tv mode option allows to specify the TV mode from a property. However, it can still be useful, for example to avoid any boot time artifact, to set that property directly from the kernel command line. Let's add some code to allow it, and some unit tests to exercise that code. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index 73d01e755496..a759a4ba0036 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2115,6 +2115,30 @@ static int drm_mode_parse_panel_orientation(const char *delim, return 0; } +static int drm_mode_parse_tv_mode(const char *delim, + struct drm_cmdline_mode *mode) +{ + const char *value; + unsigned int len; + int ret; + + if (*delim != '=') + return -EINVAL; + + value = delim + 1; + delim = strchr(value, ','); + if (!delim) + delim = value + strlen(value); + + ret = drm_get_tv_mode_from_name(value, delim - value); + if (ret < 0) + return ret; + + mode->tv_mode = ret; + + return 0; +} + static int drm_mode_parse_cmdline_options(const char *str, bool freestanding, const struct drm_connector *connector, @@ -2184,6 +2208,9 @@ static int drm_mode_parse_cmdline_options(const char *str, } else if (!strncmp(option, "panel_orientation", delim - option)) { if (drm_mode_parse_panel_orientation(delim, mode)) return -EINVAL; + } else if (!strncmp(option, "tv_mode", delim - option)) { + if (drm_mode_parse_tv_mode(delim, mode)) + return -EINVAL; } else { return -EINVAL; } @@ -2212,20 +2239,22 @@ struct drm_named_mode { unsigned int xres; unsigned int yres; unsigned int flags; + unsigned int tv_mode; }; -#define NAMED_MODE(_name, _pclk, _x, _y, _flags) \ +#define NAMED_MODE(_name, _pclk, _x, _y, _flags, _mode) \ { \ .name = _name, \ .pixel_clock_khz = _pclk, \ .xres = _x, \ .yres = _y, \ .flags = _flags, \ + .tv_mode = _mode, \ } static const struct drm_named_mode drm_named_modes[] = { - NAMED_MODE("NTSC", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE), - NAMED_MODE("PAL", 13500, 720, 576, DRM_MODE_FLAG_INTERLACE), + NAMED_MODE("NTSC", 13500, 720, 480, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_NTSC_M), + NAMED_MODE("PAL", 13500, 720, 576, DRM_MODE_FLAG_INTERLACE, DRM_MODE_TV_MODE_PAL_B), }; static int drm_mode_parse_cmdline_named_mode(const char *name, @@ -2271,6 +2300,7 @@ static int drm_mode_parse_cmdline_named_mode(const char *name, cmdline_mode->xres = mode->xres; cmdline_mode->yres = mode->yres; cmdline_mode->interlace = !!(mode->flags & DRM_MODE_FLAG_INTERLACE); + cmdline_mode->tv_mode = mode->tv_mode; cmdline_mode->specified = true; return 1; diff --git a/drivers/gpu/drm/tests/drm_cmdline_parser_test.c b/drivers/gpu/drm/tests/drm_cmdline_parser_test.c index 59b29cdfdd35..f1e73ed65be0 100644 --- a/drivers/gpu/drm/tests/drm_cmdline_parser_test.c +++ b/drivers/gpu/drm/tests/drm_cmdline_parser_test.c @@ -885,6 +885,201 @@ static void drm_cmdline_test_multiple_options(struct kunit *test) KUNIT_EXPECT_EQ(test, mode.force, DRM_FORCE_UNSPECIFIED); } +static void drm_cmdline_test_tv_options(struct kunit *test, + const char *cmdline, + const struct drm_display_mode *expected_mode, + unsigned int expected_tv_mode) +{ + struct drm_cmdline_mode mode = { }; + + KUNIT_EXPECT_TRUE(test, drm_mode_parse_command_line_for_connector(cmdline, + &no_connector, &mode)); + KUNIT_EXPECT_TRUE(test, mode.specified); + KUNIT_EXPECT_EQ(test, mode.xres, expected_mode->hdisplay); + KUNIT_EXPECT_EQ(test, mode.yres, expected_mode->vdisplay); + KUNIT_EXPECT_EQ(test, mode.tv_mode, expected_tv_mode); + + KUNIT_EXPECT_FALSE(test, mode.refresh_specified); + + KUNIT_EXPECT_FALSE(test, mode.bpp_specified); + + KUNIT_EXPECT_FALSE(test, mode.rb); + KUNIT_EXPECT_FALSE(test, mode.cvt); + KUNIT_EXPECT_EQ(test, mode.interlace, !!(expected_mode->flags & DRM_MODE_FLAG_INTERLACE)); + KUNIT_EXPECT_FALSE(test, mode.margins); + KUNIT_EXPECT_EQ(test, mode.force, DRM_FORCE_UNSPECIFIED); +} + +static void drm_cmdline_test_tv_option_ntsc_443(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x480i,tv_mode=NTSC-443", + drm_mode_analog_ntsc_480i(NULL), + DRM_MODE_TV_MODE_NTSC_443); +} + +static void drm_cmdline_test_tv_option_ntsc_j(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x480i,tv_mode=NTSC-J", + drm_mode_analog_ntsc_480i(NULL), + DRM_MODE_TV_MODE_NTSC_J); +} + +static void drm_cmdline_test_tv_option_ntsc_m(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x480i,tv_mode=NTSC-M", + drm_mode_analog_ntsc_480i(NULL), + DRM_MODE_TV_MODE_NTSC_M); +} + +static void drm_cmdline_test_tv_option_pal_60(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=PAL-60", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_PAL_60); +} + +static void drm_cmdline_test_tv_option_pal_b(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=PAL-B", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_PAL_B); +} + +static void drm_cmdline_test_tv_option_pal_d(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=PAL-D", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_PAL_D); +} + +static void drm_cmdline_test_tv_option_pal_g(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=PAL-G", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_PAL_G); +} + +static void drm_cmdline_test_tv_option_pal_h(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=PAL-H", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_PAL_H); +} + +static void drm_cmdline_test_tv_option_pal_i(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=PAL-I", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_PAL_I); +} + +static void drm_cmdline_test_tv_option_pal_m(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x480i,tv_mode=PAL-M", + drm_mode_analog_ntsc_480i(NULL), + DRM_MODE_TV_MODE_PAL_M); +} + +static void drm_cmdline_test_tv_option_pal_n(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=PAL-N", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_PAL_N); +} + +static void drm_cmdline_test_tv_option_pal_nc(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=PAL-Nc", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_PAL_NC); +} + +static void drm_cmdline_test_tv_option_secam_60(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=SECAM-60", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_SECAM_60); +} + +static void drm_cmdline_test_tv_option_secam_b(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=SECAM-B", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_SECAM_B); +} + +static void drm_cmdline_test_tv_option_secam_d(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=SECAM-D", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_SECAM_D); +} + +static void drm_cmdline_test_tv_option_secam_g(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=SECAM-G", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_SECAM_G); +} + +static void drm_cmdline_test_tv_option_secam_k(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=SECAM-K", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_SECAM_K); +} + +static void drm_cmdline_test_tv_option_secam_k1(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=SECAM-K1", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_SECAM_K1); +} + +static void drm_cmdline_test_tv_option_secam_l(struct kunit *test) +{ + drm_cmdline_test_tv_options(test, + "720x576i,tv_mode=SECAM-L", + drm_mode_analog_pal_576i(NULL), + DRM_MODE_TV_MODE_SECAM_L); +} + +static void drm_cmdline_test_tv_option_invalid(struct kunit *test) +{ + struct drm_cmdline_mode mode = { }; + const char *cmdline = "720x480i,tv_mode=invalid"; + + KUNIT_EXPECT_FALSE(test, drm_mode_parse_command_line_for_connector(cmdline, + &no_connector, &mode)); +} + +static void drm_cmdline_test_tv_option_truncated(struct kunit *test) +{ + struct drm_cmdline_mode mode = { }; + const char *cmdline = "720x480i,tv_mode=NTSC"; + + KUNIT_EXPECT_FALSE(test, drm_mode_parse_command_line_for_connector(cmdline, + &no_connector, &mode)); +} + static void drm_cmdline_test_invalid_option(struct kunit *test) { struct drm_cmdline_mode mode = { }; @@ -1047,6 +1242,27 @@ static struct kunit_case drm_cmdline_parser_tests[] = { KUNIT_CASE(drm_cmdline_test_name_refresh_invalid_mode), KUNIT_CASE(drm_cmdline_test_name_option), KUNIT_CASE(drm_cmdline_test_name_bpp_option), + KUNIT_CASE(drm_cmdline_test_tv_option_ntsc_443), + KUNIT_CASE(drm_cmdline_test_tv_option_ntsc_j), + KUNIT_CASE(drm_cmdline_test_tv_option_ntsc_m), + KUNIT_CASE(drm_cmdline_test_tv_option_pal_60), + KUNIT_CASE(drm_cmdline_test_tv_option_pal_b), + KUNIT_CASE(drm_cmdline_test_tv_option_pal_d), + KUNIT_CASE(drm_cmdline_test_tv_option_pal_g), + KUNIT_CASE(drm_cmdline_test_tv_option_pal_h), + KUNIT_CASE(drm_cmdline_test_tv_option_pal_i), + KUNIT_CASE(drm_cmdline_test_tv_option_pal_m), + KUNIT_CASE(drm_cmdline_test_tv_option_pal_n), + KUNIT_CASE(drm_cmdline_test_tv_option_pal_nc), + KUNIT_CASE(drm_cmdline_test_tv_option_secam_60), + KUNIT_CASE(drm_cmdline_test_tv_option_secam_b), + KUNIT_CASE(drm_cmdline_test_tv_option_secam_d), + KUNIT_CASE(drm_cmdline_test_tv_option_secam_g), + KUNIT_CASE(drm_cmdline_test_tv_option_secam_k), + KUNIT_CASE(drm_cmdline_test_tv_option_secam_k1), + KUNIT_CASE(drm_cmdline_test_tv_option_secam_l), + KUNIT_CASE(drm_cmdline_test_tv_option_invalid), + KUNIT_CASE(drm_cmdline_test_tv_option_truncated), KUNIT_CASE(drm_cmdline_test_rotate_0), KUNIT_CASE(drm_cmdline_test_rotate_90), KUNIT_CASE(drm_cmdline_test_rotate_180), diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 49d261977d4e..9589108ba202 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -1447,6 +1447,11 @@ struct drm_cmdline_mode { * @tv_margins: TV margins to apply to the mode. */ struct drm_connector_tv_margins tv_margins; + + /** + * @tv_mode: TV mode standard. See DRM_MODE_TV_MODE_*. + */ + enum drm_connector_tv_mode tv_mode; }; /** From patchwork Mon Aug 29 13:11:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957910 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 C67D1ECAAD2 for ; Mon, 29 Aug 2022 13:26:35 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 461F010F337; Mon, 29 Aug 2022 13:26:08 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 338FE10F2EC; Mon, 29 Aug 2022 13:25:50 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 2237C2B06067; Mon, 29 Aug 2022 09:14:15 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:14:17 -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=1661778854; x= 1661786054; bh=G5gY1qx7f9Z8E9SSYubfd/6H1rSy67rmKoWXrDijZ/E=; b=Q AHIIMLmj0zMi9tyBNRCq7DLnTnBBsEYntJOCnTkGngz0/5t6ZAPAFa8DCLqjYcH/ wbDy/qJo0c7zz4Xof888GkCEDO5ZFTbUiVWHLo3O+6y4YwHo7yxCjahARmfChLxE 1KbI52PI9dAT161+O+Yt0iHUJ/BfAE73VUaoDpL2fx0v70eFb6J9rKuZGThPXcpM FG2N4Dm2/CKDBxWYGz8whbIyDe21tWfYbhwg+B4LUYiXahNge36oKYXIPhUXxbjY rx0xqo38bihmtidy0mxgJJrqI2aAIxvxKZ3y/id0ZMqonZXa/gT7Cde+dvt1rKNA Hw96afqiRxbtt59d6RYlA== 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=1661778854; x= 1661786054; bh=G5gY1qx7f9Z8E9SSYubfd/6H1rSy67rmKoWXrDijZ/E=; b=N sb0JxXEYr9wa2njuxwTWDjlLO8vIjITCi7CjlM5WxzU1uvCOr+PCIbgJaPGStYwB 6QZwMLfzGrwS3rKG3WZZijH0Fp8lsVDe05v6rZvbN/UVZ2/tcEAsfCx7O4eLnCq3 xM1dXdXje8Dy71MDQ4JPeB5x8H+0YGOZeu5CbuZX9t/Yrv6tWPEmlTt5Pu8cCjOj csohY+tWhr+kzeg/MgM3ofJw/2ESM93DX1wGpACbz0sqOI2HJee2uzjBqMWNJ5k4 7r8Y1qdgX599qYz0Gx2lu0NH14Q/kHoDvpPnQTqbnQrTWn2whIi9u+/XjwwKoLBV hMiCDzQw63/Jud6PP8cfg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf 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:13 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:34 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-20-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=5408; i=maxime@cerno.tech; h=from:subject:message-id; bh=f4QSeZ0rWQINmdtWk7imZFwLfgnxhFabi7NHwBgL+qA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxQOeO6Mr5xVf3/T1Q8LhD/yLk1ewOZgfDXKYoJcyyfD V56bO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRjdcYGR6sN753q/VR9oQjazv49u b3fD9UZ3jgqHt/7qpdwnG9ETqMDJ3L4+91JauGT783s1VT697F+gTFj4khvbX5oSzFuQrObAA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 20/41] drm/modes: Properly generate a drm_display_mode from a named mode X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The framework will get the drm_display_mode from the drm_cmdline_mode it got by parsing the video command line argument by calling drm_connector_pick_cmdline_mode(). The heavy lifting will then be done by the drm_mode_create_from_cmdline_mode() function. In the case of the named modes though, there's no real code to make that translation and we rely on the drivers to guess which actual display mode we meant. Let's modify drm_mode_create_from_cmdline_mode() to properly generate the drm_display_mode we mean when passing a named mode. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/drm_modes.c b/drivers/gpu/drm/drm_modes.c index a759a4ba0036..065dbfbd815e 100644 --- a/drivers/gpu/drm/drm_modes.c +++ b/drivers/gpu/drm/drm_modes.c @@ -2480,6 +2480,36 @@ bool drm_mode_parse_command_line_for_connector(const char *mode_option, } EXPORT_SYMBOL(drm_mode_parse_command_line_for_connector); +static struct drm_display_mode *drm_named_mode(struct drm_device *dev, + struct drm_cmdline_mode *cmd) +{ + struct drm_display_mode *mode; + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(drm_named_modes); i++) { + const struct drm_named_mode *named_mode = &drm_named_modes[i]; + + if (strcmp(cmd->name, named_mode->name)) + continue; + + if (!named_mode->tv_mode) + continue; + + mode = drm_analog_tv_mode(dev, + named_mode->tv_mode, + named_mode->pixel_clock_khz * 1000, + named_mode->xres, + named_mode->yres, + named_mode->flags & DRM_MODE_FLAG_INTERLACE); + if (!mode) + return NULL; + + return mode; + } + + return NULL; +} + /** * drm_mode_create_from_cmdline_mode - convert a command line modeline into a DRM display mode * @dev: DRM device to create the new mode for @@ -2497,7 +2527,9 @@ drm_mode_create_from_cmdline_mode(struct drm_device *dev, if (cmd->xres == 0 || cmd->yres == 0) return NULL; - if (cmd->cvt) + if (strlen(cmd->name)) + mode = drm_named_mode(dev, cmd); + else if (cmd->cvt) mode = drm_cvt_mode(dev, cmd->xres, cmd->yres, cmd->refresh_specified ? cmd->refresh : 60, diff --git a/drivers/gpu/drm/tests/drm_client_modeset_test.c b/drivers/gpu/drm/tests/drm_client_modeset_test.c index 46335de7bc6b..4380cf670fb4 100644 --- a/drivers/gpu/drm/tests/drm_client_modeset_test.c +++ b/drivers/gpu/drm/tests/drm_client_modeset_test.c @@ -26,6 +26,20 @@ static int drm_client_modeset_connector_get_modes(struct drm_connector *connecto count = drm_add_modes_noedid(connector, 1920, 1200); + mode = drm_mode_analog_ntsc_480i(connector->dev); + if (!mode) + return -ENOMEM; + + drm_mode_probed_add(connector, mode); + count += 1; + + mode = drm_mode_analog_pal_576i(connector->dev); + if (!mode) + return -ENOMEM; + + drm_mode_probed_add(connector, mode); + count += 1; + return count; } @@ -58,6 +72,9 @@ static int drm_client_modeset_test_init(struct kunit *test) return ret; drm_connector_helper_add(&priv->connector, &drm_client_modeset_connector_helper_funcs); + priv->connector.interlace_allowed = true; + priv->connector.doublescan_allowed = true; + return 0; } @@ -97,8 +114,62 @@ static void drm_pick_cmdline_res_1920_1080_60(struct kunit *test) KUNIT_EXPECT_TRUE(test, drm_mode_equal(expected_mode, mode)); } +static void drm_pick_cmdline_named_ntsc(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"; + 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; + 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"; + 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_pal_576i(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_pal), {} }; From patchwork Mon Aug 29 13:11:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957891 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 1DEEFECAAD2 for ; Mon, 29 Aug 2022 13:25:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A27F810F2C5; Mon, 29 Aug 2022 13:25:51 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id AC2A010F2C3; Mon, 29 Aug 2022 13:25:48 +0000 (UTC) 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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen 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 Subject: [Intel-gfx] [PATCH v2 21/41] drm/modes: Introduce more named modes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" 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), {} }; From patchwork Mon Aug 29 13:11:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957898 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 97834ECAAD5 for ; Mon, 29 Aug 2022 13:26:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A1A9210F2D2; Mon, 29 Aug 2022 13:25:59 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 34AF110F2CA; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 3E2FD2B0606B; Mon, 29 Aug 2022 09:14:28 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 09:14:30 -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=1661778867; x= 1661786067; bh=JaYvZqhoL+I2fhvomldPF+TuSJaxqGQFbEriKS3Go/A=; b=Y Xfs3mbm989aKrGXKe0mGPveD6TPj5bQ6DjeLA3Tr3o641EmcPbgVXNlHlKtrIIYc aQuCxg1mCEIHWdCyuTVoUCQgiNW7Pp3SCe7ZxiUUXG+Yn5XUkOkVv3qAjGgkMRWb UDuGRvsiFpf5S25z95YNTkn+mvx6qsrpqmgWlneSuCFpb4/bU9/nu7hdJtWoVLtp 6PQyT1TE24meqojJszFcGZhy7rlSK2ruX+HW76t6RJe7hrZhDgq4GHEsr2sYWB+h dvLP4njPB1WJKJZhHgiuqeW2cbFqgKsrKrNSiJPIT9Qud1Q3EVLCBnv4pehUxT5T NCap1Lv3409l86k+KWLtA== 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=1661778867; x= 1661786067; bh=JaYvZqhoL+I2fhvomldPF+TuSJaxqGQFbEriKS3Go/A=; b=J H3tunYjZBoytNo+XqAZeI9jkkrDEu/nhP3JhChpfadLKlkoo7/aiVLr5FjSqialA QeX8yxYIRhTu4mmd+VeEytRMZUzu+xnN2qkbg31TqMoipp2GKYZ8c3fJIksmJF6X 8XRm+muDJDNsKK9w3Vi2VcS/Rpd8kilUgF8+AuBce1WMwKiz5mScgdPhfLjtTR36 WRL3TEjsS+mpFotJwGsBNIrjRr6sCZf/OcdDqPW0gJcJudDJb3omC5X3ZiKZuEz4 x1mzzQwvqdlV4NRMqW+l/SNBNE1nVR0S6oUKFq0ep8JUjI5f9CUJOkZkTYSFHDdw Yp3/sBwHeeIVLC2KJl/tA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedunecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:14:26 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:36 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-22-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=4049; i=maxime@cerno.tech; h=from:subject:message-id; bh=svXKowsDyxo006OqnLCPuhwNUZ0/qgk/SYOpnaKRW24=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxTKjk3UUTvSvv657Fpvy6LIp1NYLpV5Sd7wf6jrsnXG 2iW3OkpZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCRqdUM/5Ryjs/53BAcc2qO6RbO/c emr/c5WTVHVfHa+yW39/hfvbmYkaHZbpJokZDgm83NFQFREkYP3xpMPSsyiyv0uGNb7a6QfcwA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 22/41] drm/atomic-helper: Add a TV properties reset helper X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The drm_tv_create_properties() function will create a bunch of properties, but it's up to each and every driver using that function to properly reset the state of these properties leading to inconsistent behaviours. Let's create a helper that will take care of it. Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index dfb57217253b..0373c3dc824b 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -481,6 +481,81 @@ void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connecto } EXPORT_SYMBOL(drm_atomic_helper_connector_tv_margins_reset); +/** + * drm_atomic_helper_connector_tv_reset - Resets Analog TV connector properties + * @connector: DRM connector + * + * Resets the analog TV properties attached to a connector + */ +void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector) +{ + struct drm_device *dev = connector->dev; + struct drm_cmdline_mode *cmdline = &connector->cmdline_mode; + struct drm_connector_state *state = connector->state; + struct drm_property *prop; + uint64_t val; + + prop = dev->mode_config.tv_mode_property; + if (prop) + if (!drm_object_property_get_default_value(&connector->base, + prop, &val)) + state->tv.mode = val; + + if (cmdline->tv_mode) + state->tv.mode = cmdline->tv_mode; + + prop = dev->mode_config.tv_select_subconnector_property; + if (prop) + if (!drm_object_property_get_default_value(&connector->base, + prop, &val)) + state->tv.select_subconnector = val; + + prop = dev->mode_config.tv_subconnector_property; + if (prop) + if (!drm_object_property_get_default_value(&connector->base, + prop, &val)) + state->tv.subconnector = val; + + prop = dev->mode_config.tv_brightness_property; + if (prop) + if (!drm_object_property_get_default_value(&connector->base, + prop, &val)) + state->tv.brightness = val; + + prop = dev->mode_config.tv_contrast_property; + if (prop) + if (!drm_object_property_get_default_value(&connector->base, + prop, &val)) + state->tv.contrast = val; + + prop = dev->mode_config.tv_flicker_reduction_property; + if (prop) + if (!drm_object_property_get_default_value(&connector->base, + prop, &val)) + state->tv.flicker_reduction = val; + + prop = dev->mode_config.tv_overscan_property; + if (prop) + if (!drm_object_property_get_default_value(&connector->base, + prop, &val)) + state->tv.overscan = val; + + prop = dev->mode_config.tv_saturation_property; + if (prop) + if (!drm_object_property_get_default_value(&connector->base, + prop, &val)) + state->tv.saturation = val; + + prop = dev->mode_config.tv_hue_property; + if (prop) + if (!drm_object_property_get_default_value(&connector->base, + prop, &val)) + state->tv.hue = val; + + drm_atomic_helper_connector_tv_margins_reset(connector); +} +EXPORT_SYMBOL(drm_atomic_helper_connector_tv_reset); + /** * __drm_atomic_helper_connector_duplicate_state - copy atomic connector state * @connector: connector object diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index 192766656b88..c8fbce795ee7 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h @@ -70,6 +70,7 @@ void __drm_atomic_helper_connector_state_reset(struct drm_connector_state *conn_ void __drm_atomic_helper_connector_reset(struct drm_connector *connector, struct drm_connector_state *conn_state); void drm_atomic_helper_connector_reset(struct drm_connector *connector); +void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector); void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connector); void __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector, From patchwork Mon Aug 29 13:11: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: 12957913 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 6D9ACECAAD5 for ; Mon, 29 Aug 2022 13:26:39 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 9777C10F2EE; Mon, 29 Aug 2022 13:26:05 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id DF57710F2E2; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id B22912B0606D; Mon, 29 Aug 2022 09:14:34 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 29 Aug 2022 09:14:37 -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=1661778874; x= 1661786074; bh=O2K8vY3bz7CqbtV7SDqiw++49YhOhYlXnJRYT6GaHo0=; b=G mx2HOjqpy8Vuvh7ofDmXwVGjdnqoscgUXD45ef0jj/VIxTBVoLcBrYJQs8sYRiqR Dij9Fq0CPWGv02esfBUo/xKVSg/Fo7C2x3FlueiZz7fLApbwaeIKaOM0fdg9ke0W DBXrqN68/DR7zgEZdlvOH4mqOiO0beAxYVgaEdg49TGwj3wzAMnBWlOwInQ+GBN6 eH3njcImHLuDrVVQHLNPiYowCAxj8+wf99sFfnRmPP1e6xXYKphDVf/H0mkQDdsX Ox13UDxzdwWzileclBwOVNjIbxg6xrz1Zt1vpV1kVzAzoOxoMwdIBlQ0jKeadwNb mqlg437OYD4VLtsWNm0/A== 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=1661778874; x= 1661786074; bh=O2K8vY3bz7CqbtV7SDqiw++49YhOhYlXnJRYT6GaHo0=; b=K 0hspOg0VCsB6jyOqPWfY4/sDjtqkAc0SYamNpCVVcVpTPSf9aLgwmKhvlwddAdhU Fcl3UIJijcevRdfTS6wlnaFFsa7dBe9DCaR626pTcZUM4c3nu8UMBSQffXzDDo6r nok/uuCfq+LUGqYK6ewj3PPuftAqO1UlwEV914t1B2aVCHfbOUUBPWF9J/wjSn9n jvX9xq7g3fpZw4zx2+1Rvu3XkhjKbXTKAnOSRcJPw1/1WdA5gitVV6z9P2+2Kh2X z53AGiXB49TRNB8zs3lby1yb8fluGTn2Rw8PZGL6YdVlAWG6Hk37cycmFliP5es/ FoOlNdNLdqGzfuJxcrybQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:14:33 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:37 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-23-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=2877; i=maxime@cerno.tech; h=from:subject:message-id; bh=tMMQ9LmYriVsBj4/ucBagVoAOsUAypD775BhY4mJj98=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxSEEpcYRiVtnm5f0vzng0aRVHzokRLm5M9q+ydZcLkv t6zvKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwEQ0tjD804uellbiNPGm/pk/Ua662V WPORQ/TUjzm+Ske/nLFOVzBxj+yr66VvabxS7y8fzzXlP2/43Wf+RRuDV0oay9+4SlaW8m8QEA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 23/41] drm/atomic-helper: Add an analog TV atomic_check implementation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The analog TV connector drivers share some atomic_check logic, and the new TV standard property have created a bunch of new constraints that needs to be shared across drivers too. Let's create an atomic_check helper for those use cases. Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 0373c3dc824b..d64733c6aae3 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -556,6 +556,42 @@ void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector) } EXPORT_SYMBOL(drm_atomic_helper_connector_tv_reset); +/** + * @drm_atomic_helper_connector_tv_check: Validate an analog TV connector state + * @connector: DRM Connector + * @state: the DRM State object + * + * Checks the state object to see if the requested state is valid for an + * analog TV connector. + * + * Returns: + * Zero for success, a negative error code on error. + */ +int drm_atomic_helper_connector_tv_check(struct drm_connector *connector, + struct drm_atomic_state *state) +{ + struct drm_connector_state *old_conn_state = + drm_atomic_get_old_connector_state(state, connector); + struct drm_connector_state *new_conn_state = + drm_atomic_get_new_connector_state(state, connector); + struct drm_crtc_state *crtc_state; + struct drm_crtc *crtc; + + crtc = new_conn_state->crtc; + if (!crtc) + return 0; + + crtc_state = drm_atomic_get_new_crtc_state(state, crtc); + if (!crtc_state) + return -EINVAL; + + if (old_conn_state->tv.mode != new_conn_state->tv.mode) + crtc_state->mode_changed = true; + + return 0; +} +EXPORT_SYMBOL(drm_atomic_helper_connector_tv_check); + /** * __drm_atomic_helper_connector_duplicate_state - copy atomic connector state * @connector: connector object diff --git a/include/drm/drm_atomic_state_helper.h b/include/drm/drm_atomic_state_helper.h index c8fbce795ee7..b9740edb2658 100644 --- a/include/drm/drm_atomic_state_helper.h +++ b/include/drm/drm_atomic_state_helper.h @@ -26,6 +26,7 @@ #include +struct drm_atomic_state; struct drm_bridge; struct drm_bridge_state; struct drm_crtc; @@ -71,6 +72,8 @@ void __drm_atomic_helper_connector_reset(struct drm_connector *connector, struct drm_connector_state *conn_state); void drm_atomic_helper_connector_reset(struct drm_connector *connector); void drm_atomic_helper_connector_tv_reset(struct drm_connector *connector); +int drm_atomic_helper_connector_tv_check(struct drm_connector *connector, + struct drm_atomic_state *state); void drm_atomic_helper_connector_tv_margins_reset(struct drm_connector *connector); void __drm_atomic_helper_connector_duplicate_state(struct drm_connector *connector, From patchwork Mon Aug 29 13:11:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957911 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 F0A46C0502C for ; Mon, 29 Aug 2022 13:26:36 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D353A10F335; Mon, 29 Aug 2022 13:26:07 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id DDD2710F2C5; Mon, 29 Aug 2022 13:25:48 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 1EB102B0606F; Mon, 29 Aug 2022 09:14:41 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 09:14:44 -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=1661778880; x= 1661786080; bh=j2xVn9DQqZPAbk7DRoXYb3Gc5hDkTHCbiLk8VjWo/kk=; b=e W3j3X3F1dNP+pa/mcTJLoDMJqZBef4D/FGT1sPX4/CUeEpPKponvnnrEfXDmFBgW 0Nub1MuB1jlLAg/EzhjXasY8BJUQ8rKpHIhcMKQh61X8TJfZsAxPI/jJnpc24i90 amfoHYudd41jeY0PkAw7Jp/Fcu79hBGKQIp4/5g8zG3whwSC2XXJxiqJUBJamYBs /SqSk4izVhzmg7fSYZdJkXJf8tSmPWUhoa6V49XHefL01GJA2dx5AR2S1A6oV3Gc FncuE4NhSo/1roMVoYOH1bKkMMq0z+E3bkpBugIXnIl2MM3fsGVUdg9EAZcujSKu 85ZZzfRCjIjbUg1WWfj6Q== 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=1661778880; x= 1661786080; bh=j2xVn9DQqZPAbk7DRoXYb3Gc5hDkTHCbiLk8VjWo/kk=; b=R HBNrPu/uPbhJTXjGYBfVwYJnJN3W4TTcnoJ3vA0o7bJq86e2MA+10nN6ul7AbD37 jVqeMevFjyloNkTLwRwQpNle6qq0HueW3Z1b3XTkmD61LWaWJIGRvOdgm32a/Xd0 TkifOGVrVAi9wCnTHlUdfeOcaXKQK6sRrTS5QreBHaSKp5KJhuCn6xAV85d66/Ow MW+sGOR0ogvbG9B94FjPdrFgp+P0q983icXxiPxEy0oJ4Vlp1DyHC6OVHN8onIHY UvZRZMbKEb/ELFDqnDG2OWte0uSu+63ry4ZDBYgcC7acx7bPmVZHu2+7S71OPgQl R7KxYA08ud/pbOMvcV8Cw== 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:39 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:38 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-24-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=1269; i=maxime@cerno.tech; h=from:subject:message-id; bh=wQYMsg2bmhLsKtW1lnmR3k72TWcOcF4pQQLI7ZjpLm0=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxQqthccT5d7kl7cGP7Z2vzITQYBtV97u7dd+v/Ya6bS jAb2jlIWBjEuBlkxRZYYYfMlcadmve5k45sHM4eVCWQIAxenAEzkqQ4jw9L3sqcktpqIlbzZcln/k6 C34ko95pNZC9sU98xq3jih5SwjQ5dQc8fjcOFz9xle79zLrRrpuTpw68Zld2Q5+rb8bPfN4QUA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 24/41] drm/vc4: vec: Remove empty mode_fixup X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The mode_fixup hooks are deprecated, and the behaviour we implement is the default one anyway. Let's remove it. Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index d5140fe0be4f..d521ffd8d75c 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -483,14 +483,6 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder) drm_dev_exit(idx); } - -static bool vc4_vec_encoder_mode_fixup(struct drm_encoder *encoder, - const struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - return true; -} - static void vc4_vec_encoder_atomic_mode_set(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) @@ -518,7 +510,6 @@ static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder, static const struct drm_encoder_helper_funcs vc4_vec_encoder_helper_funcs = { .disable = vc4_vec_encoder_disable, .enable = vc4_vec_encoder_enable, - .mode_fixup = vc4_vec_encoder_mode_fixup, .atomic_check = vc4_vec_encoder_atomic_check, .atomic_mode_set = vc4_vec_encoder_atomic_mode_set, }; From patchwork Mon Aug 29 13:11:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957900 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 384B1ECAAD5 for ; Mon, 29 Aug 2022 13:26:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 26EDC10F2F0; Mon, 29 Aug 2022 13:25:58 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 72FDC10F277; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id AE7762B06070; Mon, 29 Aug 2022 09:14:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 09:14:50 -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=1661778887; x= 1661786087; bh=1ES+VOTkYU9rnnkPaBougZFX79N+rt0kzSsceGA4Dk4=; b=M wZDwK3QFSLqZ36eWW+KO1/5GMbyX9ChUPOFrT6PvlScVECJOImCcBqpeht8w8ulb ogPSElJUwpgl9ERxHhdYtTltYUcuc61gN7734nHtlWtRaVv3W1oLgMUWs0WmovQd TL6I56S0tCInc4Z4C4chLyUtsSJi9VsUP9bt2BKQ1ZgAzovM6anF2q9X8VN+g//i X5XyOmrXV2k22dO7KJN9awbAlfPmFj71KIxS1T/sTAoJhJ9CGWHnTVr2sgJGxvxe dALbZFQR7Q1cAQjvFgIC//wXd/dGuWblC/yp8GYpDBodShNTCxP15gZntj7/kB1t Stm31oKJUNCzO79AbBQmA== 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=1661778887; x= 1661786087; bh=1ES+VOTkYU9rnnkPaBougZFX79N+rt0kzSsceGA4Dk4=; b=w 97fUtYA19t9UK+q9mCQiBJHAOH+axUa0YqjU5/XMg2iPAhrYN00M/6+SluyFgdvf +69/5+YyOapg1HP2UTkMEatEvoSPwR0PQCbSv/YotPgh4lz0W7BUzVnT30k8rzAg VKL4x5t9nxKpWEyWTlGWrfmfTFMLVq85MkX9iwj40BNVzDKqHVPbcvofyMQxSJHN joCulLM2R+sabLZx2wlXVUCXzLXm/v4rCL8Fv6/DwUT3AgFFRn8/FLXAWNortXTR aNbBzO2JuwTKj2hDrbcguqKooDv1VR8sEzLpZW4pzGWTxMa8d5GHgf4tx8/cQQjz orY73i1Jj6Vf+53W2hKGQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:14:46 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:39 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-25-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=1629; i=maxime@cerno.tech; h=from:subject:message-id; bh=SxDDz/o7uhOTCndIHsGuYDX1d+DNJtbtuvzEgbuAGH4=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxR+LFyY/Frnu8fpLtE/ZnOKX0TuDe6bF7j1w6svMbv/ emY87ihlYRDjYpAVU2SJETZfEndq1utONr55MHNYmUCGMHBxCsBEMtQZ/rtyan/KSFCUMIrkmjBRka PAOOmKk7KsuOHKvTGhUy0cHjH805uite6Zrn/J+68tOo77wpeGn/cQuD7t6ZTPD1ZZNcmeZgQA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 25/41] drm/vc4: vec: Convert to atomic helpers X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The VC4 VEC driver still uses legacy enable and disable hook implementation. Let's convert to the atomic variants. Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index d521ffd8d75c..72eee0cbb615 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -375,7 +375,8 @@ static int vc4_vec_connector_init(struct drm_device *dev, struct vc4_vec *vec) return 0; } -static void vc4_vec_encoder_disable(struct drm_encoder *encoder) +static void vc4_vec_encoder_disable(struct drm_encoder *encoder, + struct drm_atomic_state *state) { struct drm_device *drm = encoder->dev; struct vc4_vec *vec = encoder_to_vc4_vec(encoder); @@ -406,7 +407,8 @@ static void vc4_vec_encoder_disable(struct drm_encoder *encoder) drm_dev_exit(idx); } -static void vc4_vec_encoder_enable(struct drm_encoder *encoder) +static void vc4_vec_encoder_enable(struct drm_encoder *encoder, + struct drm_atomic_state *state) { struct drm_device *drm = encoder->dev; struct vc4_vec *vec = encoder_to_vc4_vec(encoder); @@ -508,9 +510,9 @@ static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder, } static const struct drm_encoder_helper_funcs vc4_vec_encoder_helper_funcs = { - .disable = vc4_vec_encoder_disable, - .enable = vc4_vec_encoder_enable, .atomic_check = vc4_vec_encoder_atomic_check, + .atomic_disable = vc4_vec_encoder_disable, + .atomic_enable = vc4_vec_encoder_enable, .atomic_mode_set = vc4_vec_encoder_atomic_mode_set, }; From patchwork Mon Aug 29 13:11:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957916 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 F3E1AECAAD2 for ; Mon, 29 Aug 2022 13:26:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8101010F34A; Mon, 29 Aug 2022 13:26:09 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 33FA710F2EE; Mon, 29 Aug 2022 13:25:50 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 24ECF2B06074; Mon, 29 Aug 2022 09:14:54 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 29 Aug 2022 09:14:56 -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=1661778893; x= 1661786093; bh=0AX96P1waKKRQkTO+iOcWMCk5MIh+zpbK0wX9UzjYxs=; b=p +u+j2z7mXJaKZNgbxLUPtn53RdJ5bct1pVsvyb9wppWuFKea+xJHiwNZNupcQb41 TSEQSHcCavgPmZzBmw6XvlNMjni4bUzt7vvbfg1HuOI0Otejn/tTJxzpLwEl3E5a sNp2Jorf32HqaUpmzr1P6eCoOr4GKtQNHP4TjT3pfj/2upNCjh0OahuYEBBa/9Nl amatbdQAMJlC0pdzbrOU6FbTi2glvJgqFI1ot6LNeNzijjU5zIDeylHhuSuBlaBE yozctptZENEcEZ8UIRQR5Jz3ISL2XdW3F29N9nzl1DDGAA9zmfEQ8VOtYVdqNed1 zj0XlEEbzxx9Akn8nyWrg== 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=1661778893; x= 1661786093; bh=0AX96P1waKKRQkTO+iOcWMCk5MIh+zpbK0wX9UzjYxs=; b=M +xoIfRFY5i+n71nasLyR7QMx+2AN1YXFrzIjiqfecUrFtipf0n6muHE0j9SfJ+1I V/kJD9C36blu2+1AOSF50ilV2qY6stjWCdpITOPol91iLTSSGTCVzDIC7WwmABKS OZpep9wl7ctamQvVQ7ndX5q/zPwy/MWNKspjljYzotxL+PNCLZ9y+NebbDe2FbdE 0PPuwQYY/1rqiMlyVdOIGRfPYT0pZtkDTangYO2LWIFKFeSrMPBeyduHNah53IH0 4ZTTxw8JYjHlnICdZv8mHJBoMQY7Bbiq2zTaioXz1Tugbd4AvpZJ0CKUxrYh0WUf 6BpLkXOkRrevK+LYdSgkw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:14:52 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:40 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-26-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=4170; i=maxime@cerno.tech; h=from:subject:message-id; bh=nZsI1zyDpc3LEVYskgEvCZJpXsuMlEITNi4SdhWkPfA=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxTu994+GFwZZFJ4SaDh2E0GzwLuaW/Opxqfezd52YK/ KQemdpSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAi0VEM/x33RIncND68/aFPOMvhDC Y+7w5Xscd1aretn73pudeQYcvI8FfidKSy6nf3+wwbsrQuFKhMLJE/odzNKSNn2dvfk/WSEwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 26/41] drm/vc4: vec: Refactor VEC TV mode setting X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Mateusz Kwiatkowski Change the mode_set function pointer logic to declarative config0, config1 and custom_freq fields, to make TV mode setting logic more concise and uniform. Signed-off-by: Mateusz Kwiatkowski Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 72eee0cbb615..9a37c3fcc295 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -194,7 +194,9 @@ enum vc4_vec_tv_mode_id { struct vc4_vec_tv_mode { const struct drm_display_mode *mode; - void (*mode_set)(struct vc4_vec *vec); + u32 config0; + u32 config1; + u32 custom_freq; }; static const struct debugfs_reg32 vec_regs[] = { @@ -224,34 +226,6 @@ static const struct debugfs_reg32 vec_regs[] = { VC4_REG32(VEC_DAC_MISC), }; -static void vc4_vec_ntsc_mode_set(struct vc4_vec *vec) -{ - struct drm_device *drm = vec->connector.dev; - int idx; - - if (!drm_dev_enter(drm, &idx)) - return; - - VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN); - VEC_WRITE(VEC_CONFIG1, VEC_CONFIG1_C_CVBS_CVBS); - - drm_dev_exit(idx); -} - -static void vc4_vec_ntsc_j_mode_set(struct vc4_vec *vec) -{ - struct drm_device *drm = vec->connector.dev; - int idx; - - if (!drm_dev_enter(drm, &idx)) - return; - - VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_NTSC_STD); - VEC_WRITE(VEC_CONFIG1, VEC_CONFIG1_C_CVBS_CVBS); - - drm_dev_exit(idx); -} - static const struct drm_display_mode ntsc_mode = { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0, @@ -259,37 +233,6 @@ static const struct drm_display_mode ntsc_mode = { DRM_MODE_FLAG_INTERLACE) }; -static void vc4_vec_pal_mode_set(struct vc4_vec *vec) -{ - struct drm_device *drm = vec->connector.dev; - int idx; - - if (!drm_dev_enter(drm, &idx)) - return; - - VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_BDGHI_STD); - VEC_WRITE(VEC_CONFIG1, VEC_CONFIG1_C_CVBS_CVBS); - - drm_dev_exit(idx); -} - -static void vc4_vec_pal_m_mode_set(struct vc4_vec *vec) -{ - struct drm_device *drm = vec->connector.dev; - int idx; - - if (!drm_dev_enter(drm, &idx)) - return; - - VEC_WRITE(VEC_CONFIG0, VEC_CONFIG0_PAL_BDGHI_STD); - VEC_WRITE(VEC_CONFIG1, - VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ); - VEC_WRITE(VEC_FREQ3_2, 0x223b); - VEC_WRITE(VEC_FREQ1_0, 0x61d1); - - drm_dev_exit(idx); -} - static const struct drm_display_mode pal_mode = { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, @@ -300,19 +243,24 @@ static const struct drm_display_mode pal_mode = { static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { [VC4_VEC_TV_MODE_NTSC] = { .mode = &ntsc_mode, - .mode_set = vc4_vec_ntsc_mode_set, + .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN, + .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, [VC4_VEC_TV_MODE_NTSC_J] = { .mode = &ntsc_mode, - .mode_set = vc4_vec_ntsc_j_mode_set, + .config0 = VEC_CONFIG0_NTSC_STD, + .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, [VC4_VEC_TV_MODE_PAL] = { .mode = &pal_mode, - .mode_set = vc4_vec_pal_mode_set, + .config0 = VEC_CONFIG0_PAL_BDGHI_STD, + .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, [VC4_VEC_TV_MODE_PAL_M] = { .mode = &pal_mode, - .mode_set = vc4_vec_pal_m_mode_set, + .config0 = VEC_CONFIG0_PAL_BDGHI_STD, + .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ, + .custom_freq = 0x223b61d1, }, }; @@ -470,7 +418,16 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, /* Mask all interrupts. */ VEC_WRITE(VEC_MASK0, 0); - vec->tv_mode->mode_set(vec); + VEC_WRITE(VEC_CONFIG0, vec->tv_mode->config0); + VEC_WRITE(VEC_CONFIG1, vec->tv_mode->config1); + + if (vec->tv_mode->custom_freq != 0) { + VEC_WRITE(VEC_FREQ3_2, + (vec->tv_mode->custom_freq >> 16) & + 0xffff); + VEC_WRITE(VEC_FREQ1_0, + vec->tv_mode->custom_freq & 0xffff); + } VEC_WRITE(VEC_DAC_MISC, VEC_DAC_MISC_VID_ACT | VEC_DAC_MISC_DAC_RST_N); From patchwork Mon Aug 29 13:11:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957906 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 480D4C0502C for ; Mon, 29 Aug 2022 13:26:30 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 4CC2310F2FC; Mon, 29 Aug 2022 13:26:03 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id E688F10F2E3; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 707D12B06076; Mon, 29 Aug 2022 09:15:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 09:15:03 -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=1661778899; x= 1661786099; bh=ReY7J5eErJiBY0rbxwL7vnhNBn09T/DT66uuFDXXy5o=; b=N 4aBI9wNpgH0ceAnmBkyvIF5Lu77njTisbo1TIyV+MRUDKNuwulNc4YbhWRKmMWKJ dMmbHy4NlVARJ71cduUN5bndKcGqo8JAA1V3MMlbU7gj2RVigr/12iQMd4qrtjTR 068iX8T9PUlEal4YDwm5TNEO/mByZnEOIfRoYuFPdfrfUMlRXdE9c3P19gsyqyXj ULyMUUW3+3BbIZxip3q0FnvBh2WgJ9dnK6bwrIPhSQ8jwWS0oUTKpTHV0Zx0Hc1l W2FKnIl25AbHCAn3CMWARmuupC2rggRMAEZFdpGGnE0LNPXQeoWvqeSqAa+Rme1h I6rVpG7lLlXdnj2mlt6yg== 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=1661778899; x= 1661786099; bh=ReY7J5eErJiBY0rbxwL7vnhNBn09T/DT66uuFDXXy5o=; b=o VKmlz4/W/h4tuO2rKshy4dLtdEoUzgZu3epYaNMaNiZt0AisN2tANX1ZniOGV8o/ Zr8hHGEYyaqvt/kyIHZfgQKZRLOuNEL08Q6NPh72AbG8zqv0YKyvo0/QUc/ahNXx OHORusfP8StHLkZSbT302o7kyPAQgMWNH+Uxb7NfWkPV2Fm5FVbqXv1TwxUlc9Pj lDb4SXb/cJMZ2vBJ2tRKZZAiRAcZNN1CulovQA4L/67dQL24Ss62DpW3Vl4ScGeP gCJSF6wBmQpFVDqSNKaPOr/nue5Uubipn1xysS4U07LHhACEjHMCEpdjKgLlGVRk 00smxhdUqCJ13zgW5eqdg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:14:58 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:41 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-27-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=3082; i=maxime@cerno.tech; h=from:subject:message-id; bh=QXOlllk5ml+SVmFRbPCWgY/56C60l8/t88mB+T2Hd8I=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxRarzw76nXbROFT8FTJfZ3vCgOyZc3+Rc1vzw7+F6jR czK6o5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABOp7GD4xTxX5aN6ObuKyquJYl93cv MypLxZ/fer0zGFZZyfLztEXGZkeBN54K165Hf/Iv1072wP+68Xg+pWPT0srdHbuOGba9J3XgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 27/41] drm/vc4: vec: Remove redundant atomic_mode_set X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Mateusz Kwiatkowski Let's remove the superfluous tv_mode field, which was redundant with the mode field in struct drm_tv_connector_state. Signed-off-by: Mateusz Kwiatkowski Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 9a37c3fcc295..4d7bc7c20704 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -171,8 +171,6 @@ struct vc4_vec { struct clk *clock; - const struct vc4_vec_tv_mode *tv_mode; - struct debugfs_regset32 regset; }; @@ -316,7 +314,6 @@ static int vc4_vec_connector_init(struct drm_device *dev, struct vc4_vec *vec) drm_object_attach_property(&connector->base, dev->mode_config.legacy_tv_mode_property, VC4_VEC_TV_MODE_NTSC); - vec->tv_mode = &vc4_vec_tv_modes[VC4_VEC_TV_MODE_NTSC]; drm_connector_attach_encoder(connector, &vec->encoder.base); @@ -360,6 +357,11 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, { struct drm_device *drm = encoder->dev; struct vc4_vec *vec = encoder_to_vc4_vec(encoder); + struct drm_connector *connector = &vec->connector; + struct drm_connector_state *conn_state = + drm_atomic_get_new_connector_state(state, connector); + const struct vc4_vec_tv_mode *tv_mode = + &vc4_vec_tv_modes[conn_state->tv.mode]; int idx, ret; if (!drm_dev_enter(drm, &idx)) @@ -418,15 +420,14 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, /* Mask all interrupts. */ VEC_WRITE(VEC_MASK0, 0); - VEC_WRITE(VEC_CONFIG0, vec->tv_mode->config0); - VEC_WRITE(VEC_CONFIG1, vec->tv_mode->config1); + VEC_WRITE(VEC_CONFIG0, tv_mode->config0); + VEC_WRITE(VEC_CONFIG1, tv_mode->config1); - if (vec->tv_mode->custom_freq != 0) { + if (tv_mode->custom_freq != 0) { VEC_WRITE(VEC_FREQ3_2, - (vec->tv_mode->custom_freq >> 16) & - 0xffff); + (tv_mode->custom_freq >> 16) & 0xffff); VEC_WRITE(VEC_FREQ1_0, - vec->tv_mode->custom_freq & 0xffff); + tv_mode->custom_freq & 0xffff); } VEC_WRITE(VEC_DAC_MISC, @@ -442,15 +443,6 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, drm_dev_exit(idx); } -static void vc4_vec_encoder_atomic_mode_set(struct drm_encoder *encoder, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) -{ - struct vc4_vec *vec = encoder_to_vc4_vec(encoder); - - vec->tv_mode = &vc4_vec_tv_modes[conn_state->tv.mode]; -} - static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state, struct drm_connector_state *conn_state) @@ -470,7 +462,6 @@ static const struct drm_encoder_helper_funcs vc4_vec_encoder_helper_funcs = { .atomic_check = vc4_vec_encoder_atomic_check, .atomic_disable = vc4_vec_encoder_disable, .atomic_enable = vc4_vec_encoder_enable, - .atomic_mode_set = vc4_vec_encoder_atomic_mode_set, }; static int vc4_vec_late_register(struct drm_encoder *encoder) From patchwork Mon Aug 29 13:11:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957903 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 316A7ECAAD2 for ; Mon, 29 Aug 2022 13:26:26 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 120AF10F2CB; Mon, 29 Aug 2022 13:26:01 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8F61210F2D4; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id D00CF2B06078; Mon, 29 Aug 2022 09:15:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Mon, 29 Aug 2022 09:15:09 -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=1661778906; x= 1661786106; bh=Geyfyn7lfIjW9QZzqjQEZrV6BKt6Cr6Jw67lImD/OP4=; b=h 33Sqoi3MkH+ZfTUG5VyM/1Yc4D0pxeQLMY9HSQHQ9Mo2IG1PDJUNCVB3pqA9rvnL LMEKXt4dmv0GP0ITDYj/FfUZCwY15kFl0QdezZEf+TDII8t/6NhrR2pG8lfdD++7 NeE/0udJEPaol0QQoe3yfkJzOzVLUneLEp+0Nt09Bxxgoaxmx2GmbU/qsgTiI0js ATh3k2IB2n00v5oUh/H8snvsQCI17AhnLXatMoWEKsQOsyi5mJbJ6TLo8dOUeDDm ebhsRkqfPzYj6g/0V/FWZMGcINYxs0eyHBG6ZAT85WMspC5azLuoHo+oyJg43Mvy IfUnKoNoU0/A19XLmZh5A== 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=1661778906; x= 1661786106; bh=Geyfyn7lfIjW9QZzqjQEZrV6BKt6Cr6Jw67lImD/OP4=; b=3 Bjv21wSh+GGHvc5hlBIDbzL3rKJF7MtA9EN/oaUUinAyKYv9FP8JEhwty3Gxx4Mc AVqF2CHgMXYa99YqyJGyr47vci3oBHhHtPT41H4FixhO8T2EkP2Xr11FsKcOEOte 3yH5F/kyqxt0IY5QDRMpUeKpvrmg5ERKdUWcatbn34ENW5F6gBo8JYwq3ok6x/wC 8oV9h9Mb6bsRWOEugQAZpZDfDx+l++ASlzQ4IsM1d7w1Q9FHtvc1fkXaR3s8+L4v Z8SbooHfl3vcmjVqdIQ9V3MNlcfpUEEna6w7Ll35wX7YeSPl9ZxbCpX7+/3P16kJ DUSmGdh31y/ZWOWPRX44Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:15:05 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:42 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-28-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=1306; i=maxime@cerno.tech; h=from:subject:message-id; bh=9tioiA5EY1yO34HzEK5H+VWpSJS31+Xh9uw365Ba2yU=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxRU4rkSg9yPxRosun83wiov2a7/nrxu9Y6Aph1rXLe0 7mLuKGVhEONikBVTZIkRNl8Sd2rW6042vnkwc1iZQIYwcHEKwETu7GZkmMWzwP741qhVqtP7flkdWf nO+EBY5h7n/M235WT1pRIuMDIyrP2h9Snyj8H1n6cVJOKSZlgmxAnPyzI2qlKMVZz4s/sLBwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 28/41] drm/vc4: vec: Fix timings for VEC modes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Mateusz Kwiatkowski This commit fixes vertical timings of the VEC (composite output) modes to accurately represent the 525-line ("NTSC") and 625-line ("PAL") ITU-R standards. Previous timings were actually defined as 502 and 601 lines, resulting in non-standard 62.69 Hz and 52 Hz signals being generated, respectively. Signed-off-by: Mateusz Kwiatkowski Signed-off-by: Maxime Ripard Acked-by: Noralf Trønnes diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 4d7bc7c20704..d1d40b69279e 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -227,14 +227,14 @@ static const struct debugfs_reg32 vec_regs[] = { static const struct drm_display_mode ntsc_mode = { DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0, - 480, 480 + 3, 480 + 3 + 3, 480 + 3 + 3 + 16, 0, + 480, 480 + 7, 480 + 7 + 6, 525, 0, DRM_MODE_FLAG_INTERLACE) }; static const struct drm_display_mode pal_mode = { DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500, 720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, - 576, 576 + 2, 576 + 2 + 3, 576 + 2 + 3 + 20, 0, + 576, 576 + 4, 576 + 4 + 6, 625, 0, DRM_MODE_FLAG_INTERLACE) }; From patchwork Mon Aug 29 13:11:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957902 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 B7E21ECAAD5 for ; Mon, 29 Aug 2022 13:26:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 412E010F2C3; Mon, 29 Aug 2022 13:26:02 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F40010F2D3; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 3C1002B06079; Mon, 29 Aug 2022 09:15:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:15:16 -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=1661778912; x= 1661786112; bh=Cy32MWV8KYEmUS1RyGwWX/yQEjQBWMj/hXAbB2FpSbs=; b=V s4RNIpSxGeLQo1UWIoyjlMUQe2kKesyCj00VfmTnmA9s9809cRUTc1FY6i9RyLIS o6oM8OQNSa+LoOX3ilxktbPyOqhY28lk4l95SvMzowQnC9i7p5nNgJ+rurtgqQyR aeKWX5TaqBTFDj86loR8aBpYmX7U5HYNwGwjezJukbNFdSVgPkdFtkecMyb2Lk+Y BnrNI8xva/TuVhnCFcRtSZawg0rT2jeMmFkJ2z/5yT9L202/xHzYGwr99BwEWN63 I4yy9eVWAtJNKlexbdCQaoYoXFei+8wrwoRNAdgdnLwDkxVPXxomadxKHK2vv7GG nI6r74d/X93ysd/fCssdA== 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=1661778912; x= 1661786112; bh=Cy32MWV8KYEmUS1RyGwWX/yQEjQBWMj/hXAbB2FpSbs=; b=1 SbjYncYrBzBlWAhPZio1zMuS1gF3Tuw/UJSvnjsxHB4IMZNtXjgSRIyC9PJzxZbY dZ0wibnoYzomzbiK8gCH2DqK5gu/uSlLRgnIhbGDbVNrgt79CGRwS5oUbG0UXwHe OES/fBSbLfjGtD65t7dVE8ckm8biUqW6CW1N9Oo0bS51SYvj/nZ0cAcK/0SvXnu+ /Ma6rIq0xRHU98/CSilD292MvmY81AkEeMY4RrQMI9oXLbK6YHxHL/CHX5c+TVN3 gqxrYZK/M0qmCBe3ZeoaJdishLgqIg+cWaIWH3zukyx17ec/M8EWR4E15cqPfAkZ N7O0RSVVjvdch78d1oTJA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeefnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:15:11 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:43 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-29-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=1771; i=maxime@cerno.tech; h=from:subject:message-id; bh=ul/McL233i67f1nEv4GMQq5Y+Mz3yULy3JKyqht7K6U=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxScppTyPA6c1CT3/72hZHRYkmxbl0+oeE+68H7NMBaG KYc7SlkYxLgYZMUUWWKEzZfEnZr1upONbx7MHFYmkCEMXJwCMBGp1YwMUyYynfdOaz62c20d82dHjm enCsvPav52uCj7gfsoe0FJFyPD2u7zHxnX1Zy8rrFL0sB8sodJRpxW3O6ym1V+q6tV0zx5AA== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 29/41] drm/vc4: vec: Switch for common modes X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Now that the core has a definition for the 525 and 625 lines analog TV modes, let's switch to it for vc4. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index d1d40b69279e..63e4e617e321 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -224,38 +224,24 @@ static const struct debugfs_reg32 vec_regs[] = { VC4_REG32(VEC_DAC_MISC), }; -static const struct drm_display_mode ntsc_mode = { - DRM_MODE("720x480", DRM_MODE_TYPE_DRIVER, 13500, - 720, 720 + 14, 720 + 14 + 64, 720 + 14 + 64 + 60, 0, - 480, 480 + 7, 480 + 7 + 6, 525, 0, - DRM_MODE_FLAG_INTERLACE) -}; - -static const struct drm_display_mode pal_mode = { - DRM_MODE("720x576", DRM_MODE_TYPE_DRIVER, 13500, - 720, 720 + 20, 720 + 20 + 64, 720 + 20 + 64 + 60, 0, - 576, 576 + 4, 576 + 4 + 6, 625, 0, - DRM_MODE_FLAG_INTERLACE) -}; - static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { [VC4_VEC_TV_MODE_NTSC] = { - .mode = &ntsc_mode, + .mode = &drm_mode_480i, .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN, .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, [VC4_VEC_TV_MODE_NTSC_J] = { - .mode = &ntsc_mode, + .mode = &drm_mode_480i, .config0 = VEC_CONFIG0_NTSC_STD, .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, [VC4_VEC_TV_MODE_PAL] = { - .mode = &pal_mode, + .mode = &drm_mode_576i, .config0 = VEC_CONFIG0_PAL_BDGHI_STD, .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, [VC4_VEC_TV_MODE_PAL_M] = { - .mode = &pal_mode, + .mode = &drm_mode_576i, .config0 = VEC_CONFIG0_PAL_BDGHI_STD, .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ, .custom_freq = 0x223b61d1, From patchwork Mon Aug 29 13:11:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957897 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 DDBC5C0502C for ; Mon, 29 Aug 2022 13:26:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 143D110F2DE; Mon, 29 Aug 2022 13:25:58 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3D05B10F2D2; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailnew.west.internal (Postfix) with ESMTP id 602492B0607B; Mon, 29 Aug 2022 09:15:21 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Mon, 29 Aug 2022 09:15: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=1661778920; x= 1661786120; bh=20eH8m8Xvl9FZJWw0WkzB+p4KU7I79tJhWItQe47inA=; b=k uxqj0ih+aOHhSP5Qm4mEZ5kfSow3hCD8Cs/dIsXVPHzOsgig7eGPxjog2FhvJbIk wHYYg6e4IIAMfrPos+4EDR3S/iXdcI9EfGN7EPb6dzCGn3QXksGTi1oDPgB0HqV8 tL+thL6C6yrkiA7WmenAZ/ZIvxudRvdcSVtoyho++rr5PKB85ABIwC2OYhb/u+mf tX+BhjZe10WgfKnZCUCf2MWfuG9Wl+7TRsvxJBZa3R0aZmyvcDwQYiOnSfe+FqJW k0GcfVir9gFg/ytgx+3R/Uc96ChQUgcRSdCEEw+AG0/fqlihOhMAzJGvCeEsOr+a XPd2JOwy9S0bcuO58djXQ== 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=1661778920; x= 1661786120; bh=20eH8m8Xvl9FZJWw0WkzB+p4KU7I79tJhWItQe47inA=; b=L qMQBH/6NfHLUBDZl4Y4xpC1Y5S4l3DStw0gU4ojS/iWXfPa1tfCdeQr/d5jaHlTW BIdMskj/lMe5Om8gDO9oOX6E8kG3ucp544bRhF//STt0Y34qEDgPkU77MSKI2JOa Mj8dn4MvXEa0Hb96Y6NIf4GFd5uJFw7Mzedy+PdQeVrQKXwd44D5Wy/VURR9Y1Q+ mMdlfEpz7Bul0qcHi+0YX4ShsB9M6n5EKr90dL/b5htxQgJ69iH9IKya0yz0PNfx zdTtRhLvANn1ZZJVuPqdWHPNTvbL408Qw+RiUx5vTlOoro1AEidK3+q6APQCq45r ytk26sfRTVurHg9ljAggw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:15:18 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:44 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-30-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=1296; i=maxime@cerno.tech; h=from:subject:message-id; bh=tPg6Z+QHYzTZRNoX2QE1L9br4U069DFxWgKf5hS1TGY=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxT+77r4asW9+0GuAtr263ZO8uXXLH4hEPO6r75P7OyT vVEPO0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCR+e4M/wyO82mumsTl7F17UOHbl9 9CvrYss4W6q3yCzrIE/T3bVMHI8MkgcH2syNyr/v4zrs1YnirDKHpjafUmHmb54Ae6h5i5uAA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 30/41] drm/vc4: vec: Fix definition of PAL-M mode X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Mateusz Kwiatkowski PAL-M is a Brazilian analog TV standard that uses a PAL-style chroma subcarrier at 3.575611[888111] MHz on top of 525-line (480i60) timings. This commit makes the driver actually use the proper VEC preset for this mode instead of just changing PAL subcarrier frequency. Signed-off-by: Mateusz Kwiatkowski Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 63e4e617e321..fa85dd260742 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -69,6 +69,7 @@ #define VEC_CONFIG0_STD_MASK GENMASK(1, 0) #define VEC_CONFIG0_NTSC_STD 0 #define VEC_CONFIG0_PAL_BDGHI_STD 1 +#define VEC_CONFIG0_PAL_M_STD 2 #define VEC_CONFIG0_PAL_N_STD 3 #define VEC_SCHPH 0x108 @@ -241,10 +242,9 @@ static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, [VC4_VEC_TV_MODE_PAL_M] = { - .mode = &drm_mode_576i, - .config0 = VEC_CONFIG0_PAL_BDGHI_STD, - .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ, - .custom_freq = 0x223b61d1, + .mode = &drm_mode_480i, + .config0 = VEC_CONFIG0_PAL_M_STD, + .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, }; From patchwork Mon Aug 29 13:11:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957892 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 4E60DECAAD5 for ; Mon, 29 Aug 2022 13:25:54 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 36A2B10F2C7; Mon, 29 Aug 2022 13:25:52 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 993DD10F299; Mon, 29 Aug 2022 13:25:48 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id C3CD12B0607D; Mon, 29 Aug 2022 09:15:27 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:15:30 -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=1661778927; x= 1661786127; bh=bQFyjpMNqkENbIjlSD35Zj5sFEYA6vUdCkuwZuqm7TI=; b=T 9IkExrnDo9ILGrnq65wN97FCrtXIWEkeAbP7nG+06RyRiXlLSVe3R7e00njnxjxW ihQ7N3hJahATrSjNUdUwxLJ/KsBVUDjsR0LCVAdPmE8DbuWPT/Cg1Gl32hPb2f26 CL+VqMnWH5A0hHYOTBqtn/d27OQN2g6B5v+Q3pFmZOQtA0H2RnhRRORhY08k0oGE J25NC+YLvd+tMlnu3jILDJuRAhEmalcH4sA4335YDZavHGur3s5grORCWCLpbHxZ 9l1yqbMR7z3zUAqS+qnCfb9kjs+PIlRFirN7otRAgE/53ijdKXHt9f98qaBejXEN N71z0ZXNz+okkgR24LbIg== 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=1661778927; x= 1661786127; bh=bQFyjpMNqkENbIjlSD35Zj5sFEYA6vUdCkuwZuqm7TI=; b=w 8Xcr7VMECbXJcl7zuFEBY1iPiaxVXjWlcOy4VKZovQgyi17NMpiUYtj155sYq0LZ N0edC6V1dOZAqqPSY2zHcS2D9PspSaBi3bp6u7JEi5u3DYjXWue66PIzdcNP/qmP jGOer/3WtP+mnVQyHlQ8EwMLq+2QOCbsXEdXqk1Hehsa700xtF47tSQa+3p4nj1e gnHEqXNuEZb8MeYGZuQMF6ZwWlIywbtt6Mp5fjkRVw7zBh2OVHL/hFRBEKz2I4Cz 2lMcKoIJIoAdorEeLBNKDWvOl7fLCxEnTqQ+bns1HY0JLI/Seqhu7R2kEWxQbmai fRDyRwrKoeVv/1kN8ccrw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeegnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:15:26 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:45 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-31-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=1413; i=maxime@cerno.tech; h=from:subject:message-id; bh=qDLYBra+oWv7qr1ofEsAPnJEYg3c17J8Q720Wj/k2mc=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxTUr6gwqegmf4jUmrupInBnsidH0hqHF5vePV/cONdk 29zdHaUsDGJcDLJiiiwxwuZL4k7Net3JxjcPZg4rE8gQBi5OAZjIETOGf9p7mWTvl6jclM39d6qm90 TxRs2+DTfepCVap7b/PPSIR4aR4fiBWr6yQ9N+Xb7aP/NzffBEvtS6Tl67ookBZXEGQQfCWQA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 31/41] drm/vc4: vec: Use TV Reset implementation X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The analog TV properties created by the drm_mode_create_tv_properties() are not properly initialised at reset. Let's switch our implementation to call drm_atomic_helper_connector_tv_reset(). Signed-off-by: Maxime Ripard Reviewed-by: Noralf Trønnes diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index fa85dd260742..ba6f81908923 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -254,6 +254,12 @@ vc4_vec_connector_detect(struct drm_connector *connector, bool force) return connector_status_unknown; } +static void vc4_vec_connector_reset(struct drm_connector *connector) +{ + drm_atomic_helper_connector_reset(connector); + drm_atomic_helper_connector_tv_reset(connector); +} + static int vc4_vec_connector_get_modes(struct drm_connector *connector) { struct drm_connector_state *state = connector->state; @@ -274,7 +280,7 @@ static int vc4_vec_connector_get_modes(struct drm_connector *connector) static const struct drm_connector_funcs vc4_vec_connector_funcs = { .detect = vc4_vec_connector_detect, .fill_modes = drm_helper_probe_single_connector_modes, - .reset = drm_atomic_helper_connector_reset, + .reset = vc4_vec_connector_reset, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; From patchwork Mon Aug 29 13:11:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957894 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 16809ECAAD2 for ; Mon, 29 Aug 2022 13:25:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 298A810F2C9; Mon, 29 Aug 2022 13:25:54 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id EF43210F2C9; Mon, 29 Aug 2022 13:25:48 +0000 (UTC) Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailnew.west.internal (Postfix) with ESMTP id 12B562B0607E; Mon, 29 Aug 2022 09:15:34 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Mon, 29 Aug 2022 09:15:37 -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=1661778934; x= 1661786134; bh=d74tP5iKS7wtiPkK9wp1T9Mx2zT0b5CzIXUZcq4F8kI=; b=h hmqCHmZ05R8wz+RuLpvYze/OuKbUQBZI6ODYaQ2icBRLaWjy9ut20laMImXzxxZ4 gR8SbG8q9Wnl34FzAYNXpuEZq8XTJBFFDwdTfd+PJRzyfSjtIZZoYyTRBbsgST0u WGSM1qYclKIyaI0JV5GhFcgEnxJ/wWcQQhstysIk5bTZeCndv3a11DpSU6zg3mfF vLYMXK7f/o34Qf8ZnlfBHkZPKqxplN1J1X6KJDlpEZberhgnRFjqrZ2nfp+vvIjG x2xauzJqL4TZSk+zIPKzkUCvqDY+0cf7FmQHqkbTM4B0lFmtUEHRipFEYABLEk/N tSpBeOCVzRNhCt8xV7jfg== 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=1661778934; x= 1661786134; bh=d74tP5iKS7wtiPkK9wp1T9Mx2zT0b5CzIXUZcq4F8kI=; b=m iM7JFVLOyjTjTvHinPsieIVJaGVBDCJy42PVT9KM+0KUBAkqAazD5tBHJOYXx6jq QhPYYSrffDJ1FhpJvJs5u4AOlB03mPNM4YKnGREKhG1qFmSalR78a8aM0YtDcs/c Bg/oqPDjwfS9UBGT8lUQBtTaktQS4yEtfmXLwUlLwo2sGm6kECR3Gny9Pev5vokX bo/cM1C6qg1rOciX6Ef9whhvkRpJoaIYZkj2uELz9lpXV7KvBr6Igea8MOz46lOB BRj7aaDc11RmsqSytkSauWpLQRbkS6KEUBlol/yJuaqYS9mL9ZQP2Z+oqQraCIGa 1gL9ol+cLeNKaH/iPQfYw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:15:32 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:46 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-32-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=9147; i=maxime@cerno.tech; h=from:subject:message-id; bh=lcNmN9CzcnK3ui/H7KmOX4lEfytOWT0LrcJRB2J9u68=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxTCUu9d4nvW1XSQx+qrpzdD6v0fTlN3fph7xXrHTucb X2bldZSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAie2Yw/E9k+ZLc/SlU+PSVj51eXu ZNlkrHOQwVA9+d4XiZcGHJgVhGhr//uV81tiXNFDscaOMbuHL1hMg+a/5n178/X+9rK1YwhxUA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 32/41] drm/vc4: vec: Convert to the new TV mode property X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Now that the core can deal fine with analog TV modes, let's convert the vc4 VEC driver to leverage those new features. We've added some backward compatibility to support the old TV mode property and translate it into the new TV norm property. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index ba6f81908923..58286acf4b9e 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -172,6 +172,8 @@ struct vc4_vec { struct clk *clock; + struct drm_property *legacy_tv_mode_property; + struct debugfs_regset32 regset; }; @@ -184,6 +186,12 @@ encoder_to_vc4_vec(struct drm_encoder *encoder) return container_of(encoder, struct vc4_vec, encoder.base); } +static inline struct vc4_vec * +connector_to_vc4_vec(struct drm_connector *connector) +{ + return container_of(connector, struct vc4_vec, connector); +} + enum vc4_vec_tv_mode_id { VC4_VEC_TV_MODE_NTSC, VC4_VEC_TV_MODE_NTSC_J, @@ -192,7 +200,7 @@ enum vc4_vec_tv_mode_id { }; struct vc4_vec_tv_mode { - const struct drm_display_mode *mode; + unsigned int mode; u32 config0; u32 config1; u32 custom_freq; @@ -226,28 +234,50 @@ static const struct debugfs_reg32 vec_regs[] = { }; static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { - [VC4_VEC_TV_MODE_NTSC] = { - .mode = &drm_mode_480i, + { + .mode = DRM_MODE_TV_MODE_NTSC_M, .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN, .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, - [VC4_VEC_TV_MODE_NTSC_J] = { - .mode = &drm_mode_480i, + { + .mode = DRM_MODE_TV_MODE_NTSC_J, .config0 = VEC_CONFIG0_NTSC_STD, .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, - [VC4_VEC_TV_MODE_PAL] = { - .mode = &drm_mode_576i, + { + .mode = DRM_MODE_TV_MODE_PAL_B, .config0 = VEC_CONFIG0_PAL_BDGHI_STD, .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, - [VC4_VEC_TV_MODE_PAL_M] = { - .mode = &drm_mode_480i, + { + .mode = DRM_MODE_TV_MODE_PAL_M, .config0 = VEC_CONFIG0_PAL_M_STD, .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, }; +static inline const struct vc4_vec_tv_mode * +vc4_vec_tv_mode_lookup(unsigned int mode) +{ + unsigned int i; + + for (i = 0; i < ARRAY_SIZE(vc4_vec_tv_modes); i++) { + const struct vc4_vec_tv_mode *tv_mode = &vc4_vec_tv_modes[i]; + + if (tv_mode->mode == mode) + return tv_mode; + } + + return NULL; +} + +static const struct drm_prop_enum_list tv_mode_names[] = { + { VC4_VEC_TV_MODE_NTSC, "NTSC", }, + { VC4_VEC_TV_MODE_NTSC_J, "NTSC-J", }, + { VC4_VEC_TV_MODE_PAL, "PAL", }, + { VC4_VEC_TV_MODE_PAL_M, "PAL-M", }, +}; + static enum drm_connector_status vc4_vec_connector_detect(struct drm_connector *connector, bool force) { @@ -262,19 +292,98 @@ static void vc4_vec_connector_reset(struct drm_connector *connector) static int vc4_vec_connector_get_modes(struct drm_connector *connector) { - struct drm_connector_state *state = connector->state; struct drm_display_mode *mode; + int count = 0; - mode = drm_mode_duplicate(connector->dev, - vc4_vec_tv_modes[state->tv.mode].mode); + mode = drm_mode_analog_ntsc_480i(connector->dev); if (!mode) { DRM_ERROR("Failed to create a new display mode\n"); return -ENOMEM; } drm_mode_probed_add(connector, mode); + count += 1; - return 1; + mode = drm_mode_analog_pal_576i(connector->dev); + if (!mode) { + DRM_ERROR("Failed to create a new display mode\n"); + return -ENOMEM; + } + + drm_mode_probed_add(connector, mode); + count += 1; + + return count; +} + +static int +vc4_vec_connector_set_property(struct drm_connector *connector, + struct drm_connector_state *state, + struct drm_property *property, + uint64_t val) +{ + struct vc4_vec *vec = connector_to_vc4_vec(connector); + + if (property != vec->legacy_tv_mode_property) + return -EINVAL; + + switch (val) { + case VC4_VEC_TV_MODE_NTSC: + state->tv.mode = DRM_MODE_TV_MODE_NTSC_M; + break; + + case VC4_VEC_TV_MODE_NTSC_J: + state->tv.mode = DRM_MODE_TV_MODE_NTSC_J; + break; + + case VC4_VEC_TV_MODE_PAL: + state->tv.mode = DRM_MODE_TV_MODE_PAL_B; + break; + + case VC4_VEC_TV_MODE_PAL_M: + state->tv.mode = DRM_MODE_TV_MODE_PAL_M; + break; + + default: + return -EINVAL; + } + + return 0; +} + +static int +vc4_vec_connector_get_property(struct drm_connector *connector, + const struct drm_connector_state *state, + struct drm_property *property, + uint64_t *val) +{ + struct vc4_vec *vec = connector_to_vc4_vec(connector); + + if (property != vec->legacy_tv_mode_property) + return -EINVAL; + + switch (state->tv.mode) { + case DRM_MODE_TV_MODE_NTSC_J: + *val = VC4_VEC_TV_MODE_NTSC_J; + break; + + case DRM_MODE_TV_MODE_NTSC_M: + *val = VC4_VEC_TV_MODE_NTSC; + break; + + case DRM_MODE_TV_MODE_PAL_B: + *val = VC4_VEC_TV_MODE_PAL; + break; + + case DRM_MODE_TV_MODE_PAL_M: + *val = VC4_VEC_TV_MODE_PAL_M; + break; + + default: + return -EINVAL; + } + + return 0; } static const struct drm_connector_funcs vc4_vec_connector_funcs = { @@ -283,15 +392,19 @@ static const struct drm_connector_funcs vc4_vec_connector_funcs = { .reset = vc4_vec_connector_reset, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, + .atomic_get_property = vc4_vec_connector_get_property, + .atomic_set_property = vc4_vec_connector_set_property, }; static const struct drm_connector_helper_funcs vc4_vec_connector_helper_funcs = { + .atomic_check = drm_atomic_helper_connector_tv_check, .get_modes = vc4_vec_connector_get_modes, }; static int vc4_vec_connector_init(struct drm_device *dev, struct vc4_vec *vec) { struct drm_connector *connector = &vec->connector; + struct drm_property *prop; int ret; connector->interlace_allowed = true; @@ -304,8 +417,16 @@ static int vc4_vec_connector_init(struct drm_device *dev, struct vc4_vec *vec) drm_connector_helper_add(connector, &vc4_vec_connector_helper_funcs); drm_object_attach_property(&connector->base, - dev->mode_config.legacy_tv_mode_property, - VC4_VEC_TV_MODE_NTSC); + dev->mode_config.tv_mode_property, + DRM_MODE_TV_MODE_NTSC_M); + + prop = drm_property_create_enum(dev, 0, "mode", + tv_mode_names, ARRAY_SIZE(tv_mode_names)); + if (!prop) + return -ENOMEM; + vec->legacy_tv_mode_property = prop; + + drm_object_attach_property(&connector->base, prop, VC4_VEC_TV_MODE_NTSC); drm_connector_attach_encoder(connector, &vec->encoder.base); @@ -352,13 +473,16 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, struct drm_connector *connector = &vec->connector; struct drm_connector_state *conn_state = drm_atomic_get_new_connector_state(state, connector); - const struct vc4_vec_tv_mode *tv_mode = - &vc4_vec_tv_modes[conn_state->tv.mode]; + const struct vc4_vec_tv_mode *tv_mode; int idx, ret; if (!drm_dev_enter(drm, &idx)) return; + tv_mode = vc4_vec_tv_mode_lookup(conn_state->tv.mode); + if (!tv_mode) + goto err_dev_exit; + ret = pm_runtime_get_sync(&vec->pdev->dev); if (ret < 0) { DRM_ERROR("Failed to retain power domain: %d\n", ret); @@ -435,23 +559,7 @@ static void vc4_vec_encoder_enable(struct drm_encoder *encoder, drm_dev_exit(idx); } -static int vc4_vec_encoder_atomic_check(struct drm_encoder *encoder, - struct drm_crtc_state *crtc_state, - struct drm_connector_state *conn_state) -{ - const struct vc4_vec_tv_mode *vec_mode; - - vec_mode = &vc4_vec_tv_modes[conn_state->tv.mode]; - - if (conn_state->crtc && - !drm_mode_equal(vec_mode->mode, &crtc_state->adjusted_mode)) - return -EINVAL; - - return 0; -} - static const struct drm_encoder_helper_funcs vc4_vec_encoder_helper_funcs = { - .atomic_check = vc4_vec_encoder_atomic_check, .atomic_disable = vc4_vec_encoder_disable, .atomic_enable = vc4_vec_encoder_enable, }; @@ -492,13 +600,6 @@ static const struct of_device_id vc4_vec_dt_match[] = { { /* sentinel */ }, }; -static const char * const tv_mode_names[] = { - [VC4_VEC_TV_MODE_NTSC] = "NTSC", - [VC4_VEC_TV_MODE_NTSC_J] = "NTSC-J", - [VC4_VEC_TV_MODE_PAL] = "PAL", - [VC4_VEC_TV_MODE_PAL_M] = "PAL-M", -}; - static int vc4_vec_bind(struct device *dev, struct device *master, void *data) { struct platform_device *pdev = to_platform_device(dev); @@ -506,9 +607,11 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data) struct vc4_vec *vec; int ret; - ret = drm_mode_create_tv_properties_legacy(drm, - ARRAY_SIZE(tv_mode_names), - tv_mode_names); + ret = drm_mode_create_tv_properties(drm, + BIT(DRM_MODE_TV_MODE_NTSC_J) | + BIT(DRM_MODE_TV_MODE_NTSC_M) | + BIT(DRM_MODE_TV_MODE_PAL_B) | + BIT(DRM_MODE_TV_MODE_PAL_M)); if (ret) return ret; From patchwork Mon Aug 29 13:11:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957896 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 E2614ECAAD2 for ; Mon, 29 Aug 2022 13:26:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0BE0C10F2DB; Mon, 29 Aug 2022 13:25:58 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35BF910F2CB; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 360F32B06082; Mon, 29 Aug 2022 09:15:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:15:43 -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=1661778940; x= 1661786140; bh=wfBLSlubLXJalTEhWev5uur9f+B7LIZiZbKRIJCYb+g=; b=M IsznkJ/OuhR6dLcTIvg6xEt2xwl6yCbHI0sCXVUam35yMlewp1q2gjTGj+TiOhG+ 3bMZnmvK8R5p3k3SzgqHmCyjadymmu7be5B97TFMGooLtOnpOSEANGoR/Tabr1vZ mmaGFw/J02wI0dnRl8HlXVLUVeWhs1xTeYBKBkueq2BeCUr4RQoZ12SB1+Io999r X67oEWm1M3Ot71x5XcpOFzV8cXSvhmFopun86CS/0pyHiTyVjSeMYzhfOhjDgfrK rKdRES20qoswpaxkC/UbA5RAYKyYv4SpYujoPB4hmmpvRU3rUxMy0WL5IdFk/Q0b VYxhoj/3/YVq0yPz5DDUA== 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=1661778940; x= 1661786140; bh=wfBLSlubLXJalTEhWev5uur9f+B7LIZiZbKRIJCYb+g=; b=I m5C/ztp/OPrqpNxvH2rv4fHrfwYgegyQytUpvXDy9oZKK1u5xiv9nhv2qPwGJ4Nj tL2clOP+tq9gUn+KiSZaNCDOSrweYXjDgBxTVXKH7x9h1gm4JT2fp4iEP3K9zUQ7 SkArVp30xBK46iKp5ZK0IB57k7El97d0W1e4eRLKF0dfaEZVQJdc5nXT5nTK3SjB ZVMHEG9CkleKksB6og2sg9HEJEX1QFeZBLd7OWWFnO4xXqtqAdIEd3ryRQcipMpO IFr2NgsOx9bhJr+SYK5+i29AS6g2O/ZPOQl/+FFGhsF4daN5DLJDsNIh9O3p8dvn yP53QiZUfXzCIBllCZSBw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:15:39 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:47 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-33-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=7769; i=maxime@cerno.tech; h=from:subject:message-id; bh=e55qQaypUDvDhsz0bG1RkxImTDd6VGSv09qX0RaaQDw=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxQFTtgK6It8SA/TPZpyMGZxj9vLjksus2c+VA5RYFX8 ePFgRykLgxgXg6yYIkuMsPmSuFOzXney8c2DmcPKBDKEgYtTACayegYjw1Ime7EwqTXP2u4W+wdaRV hc9/I53H30Rfwhp3nTM04ycDAyrLgbIF7rJLj7iR7fuilv4w2O1c+fWDFDTadt2e87K1b6cgMA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 33/41] drm/vc4: vec: Add support for more analog TV standards X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" From: Mateusz Kwiatkowski Add support for the following composite output modes (all of them are somewhat more obscure than the previously defined ones): - NTSC_443 - NTSC-style signal with the chroma subcarrier shifted to 4.43361875 MHz (the PAL subcarrier frequency). Never used for broadcasting, but sometimes used as a hack to play NTSC content in PAL regions (e.g. on VCRs). - PAL_N - PAL with alternative chroma subcarrier frequency, 3.58205625 MHz. Used as a broadcast standard in Argentina, Paraguay and Uruguay to fit 576i50 with colour in 6 MHz channel raster. - PAL60 - 480i60 signal with PAL-style color at normal European PAL frequency. Another non-standard, non-broadcast mode, used in similar contexts as NTSC_443. Some displays support one but not the other. - SECAM - French frequency-modulated analog color standard; also have been broadcast in Eastern Europe and various parts of Africa and Asia. Uses the same 576i50 timings as PAL. Also added some comments explaining color subcarrier frequency registers. Signed-off-by: Mateusz Kwiatkowski Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/vc4/vc4_vec.c b/drivers/gpu/drm/vc4/vc4_vec.c index 58286acf4b9e..55f6f490877c 100644 --- a/drivers/gpu/drm/vc4/vc4_vec.c +++ b/drivers/gpu/drm/vc4/vc4_vec.c @@ -46,6 +46,7 @@ #define VEC_CONFIG0_YDEL(x) ((x) << 26) #define VEC_CONFIG0_CDEL_MASK GENMASK(25, 24) #define VEC_CONFIG0_CDEL(x) ((x) << 24) +#define VEC_CONFIG0_SECAM_STD BIT(21) #define VEC_CONFIG0_PBPR_FIL BIT(18) #define VEC_CONFIG0_CHROMA_GAIN_MASK GENMASK(17, 16) #define VEC_CONFIG0_CHROMA_GAIN_UNITY (0 << 16) @@ -76,6 +77,27 @@ #define VEC_SOFT_RESET 0x10c #define VEC_CLMP0_START 0x144 #define VEC_CLMP0_END 0x148 + +/* + * These set the color subcarrier frequency + * if VEC_CONFIG1_CUSTOM_FREQ is enabled. + * + * VEC_FREQ1_0 contains the most significant 16-bit half-word, + * VEC_FREQ3_2 contains the least significant 16-bit half-word. + * 0x80000000 seems to be equivalent to the pixel clock + * (which itself is the VEC clock divided by 8). + * + * Reference values (with the default pixel clock of 13.5 MHz): + * + * NTSC (3579545.[45] Hz) - 0x21F07C1F + * PAL (4433618.75 Hz) - 0x2A098ACB + * PAL-M (3575611.[888111] Hz) - 0x21E6EFE3 + * PAL-N (3582056.25 Hz) - 0x21F69446 + * + * NOTE: For SECAM, it is used as the Dr center frequency, + * regardless of whether VEC_CONFIG1_CUSTOM_FREQ is enabled or not; + * that is specified as 4406250 Hz, which corresponds to 0x29C71C72. + */ #define VEC_FREQ3_2 0x180 #define VEC_FREQ1_0 0x184 @@ -118,6 +140,14 @@ #define VEC_INTERRUPT_CONTROL 0x190 #define VEC_INTERRUPT_STATUS 0x194 + +/* + * Db center frequency for SECAM; the clock for this is the same as for + * VEC_FREQ3_2/VEC_FREQ1_0, which is used for Dr center frequency. + * + * This is specified as 4250000 Hz, which corresponds to 0x284BDA13. + * That is also the default value, so no need to set it explicitly. + */ #define VEC_FCW_SECAM_B 0x198 #define VEC_SECAM_GAIN_VAL 0x19c @@ -194,9 +224,13 @@ connector_to_vc4_vec(struct drm_connector *connector) enum vc4_vec_tv_mode_id { VC4_VEC_TV_MODE_NTSC, + VC4_VEC_TV_MODE_NTSC_443, VC4_VEC_TV_MODE_NTSC_J, VC4_VEC_TV_MODE_PAL, + VC4_VEC_TV_MODE_PAL_60, VC4_VEC_TV_MODE_PAL_M, + VC4_VEC_TV_MODE_PAL_N, + VC4_VEC_TV_MODE_SECAM, }; struct vc4_vec_tv_mode { @@ -234,6 +268,12 @@ static const struct debugfs_reg32 vec_regs[] = { }; static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { + { + .mode = DRM_MODE_TV_MODE_NTSC_443, + .config0 = VEC_CONFIG0_NTSC_STD, + .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ, + .custom_freq = 0x2a098acb, + }, { .mode = DRM_MODE_TV_MODE_NTSC_M, .config0 = VEC_CONFIG0_NTSC_STD | VEC_CONFIG0_PDEN, @@ -244,6 +284,12 @@ static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { .config0 = VEC_CONFIG0_NTSC_STD, .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, + { + .mode = DRM_MODE_TV_MODE_PAL_60, + .config0 = VEC_CONFIG0_PAL_M_STD, + .config1 = VEC_CONFIG1_C_CVBS_CVBS | VEC_CONFIG1_CUSTOM_FREQ, + .custom_freq = 0x2a098acb, + }, { .mode = DRM_MODE_TV_MODE_PAL_B, .config0 = VEC_CONFIG0_PAL_BDGHI_STD, @@ -254,6 +300,17 @@ static const struct vc4_vec_tv_mode vc4_vec_tv_modes[] = { .config0 = VEC_CONFIG0_PAL_M_STD, .config1 = VEC_CONFIG1_C_CVBS_CVBS, }, + { + .mode = DRM_MODE_TV_MODE_PAL_N, + .config0 = VEC_CONFIG0_PAL_N_STD, + .config1 = VEC_CONFIG1_C_CVBS_CVBS, + }, + { + .mode = DRM_MODE_TV_MODE_SECAM_B, + .config0 = VEC_CONFIG0_SECAM_STD, + .config1 = VEC_CONFIG1_C_CVBS_CVBS, + .custom_freq = 0x29c71c72, + }, }; static inline const struct vc4_vec_tv_mode * @@ -273,9 +330,13 @@ vc4_vec_tv_mode_lookup(unsigned int mode) static const struct drm_prop_enum_list tv_mode_names[] = { { VC4_VEC_TV_MODE_NTSC, "NTSC", }, + { VC4_VEC_TV_MODE_NTSC_443, "NTSC-443", }, { VC4_VEC_TV_MODE_NTSC_J, "NTSC-J", }, { VC4_VEC_TV_MODE_PAL, "PAL", }, + { VC4_VEC_TV_MODE_PAL_60, "PAL-60", }, { VC4_VEC_TV_MODE_PAL_M, "PAL-M", }, + { VC4_VEC_TV_MODE_PAL_N, "PAL-N", }, + { VC4_VEC_TV_MODE_SECAM, "SECAM", }, }; static enum drm_connector_status @@ -332,6 +393,10 @@ vc4_vec_connector_set_property(struct drm_connector *connector, state->tv.mode = DRM_MODE_TV_MODE_NTSC_M; break; + case VC4_VEC_TV_MODE_NTSC_443: + state->tv.mode = DRM_MODE_TV_MODE_NTSC_443; + break; + case VC4_VEC_TV_MODE_NTSC_J: state->tv.mode = DRM_MODE_TV_MODE_NTSC_J; break; @@ -340,10 +405,22 @@ vc4_vec_connector_set_property(struct drm_connector *connector, state->tv.mode = DRM_MODE_TV_MODE_PAL_B; break; + case VC4_VEC_TV_MODE_PAL_60: + state->tv.mode = DRM_MODE_TV_MODE_PAL_60; + break; + case VC4_VEC_TV_MODE_PAL_M: state->tv.mode = DRM_MODE_TV_MODE_PAL_M; break; + case VC4_VEC_TV_MODE_PAL_N: + state->tv.mode = DRM_MODE_TV_MODE_PAL_N; + break; + + case VC4_VEC_TV_MODE_SECAM: + state->tv.mode = DRM_MODE_TV_MODE_SECAM_B; + break; + default: return -EINVAL; } @@ -363,6 +440,10 @@ vc4_vec_connector_get_property(struct drm_connector *connector, return -EINVAL; switch (state->tv.mode) { + case DRM_MODE_TV_MODE_NTSC_443: + *val = VC4_VEC_TV_MODE_NTSC_443; + break; + case DRM_MODE_TV_MODE_NTSC_J: *val = VC4_VEC_TV_MODE_NTSC_J; break; @@ -371,6 +452,10 @@ vc4_vec_connector_get_property(struct drm_connector *connector, *val = VC4_VEC_TV_MODE_NTSC; break; + case DRM_MODE_TV_MODE_PAL_60: + *val = VC4_VEC_TV_MODE_PAL_60; + break; + case DRM_MODE_TV_MODE_PAL_B: *val = VC4_VEC_TV_MODE_PAL; break; @@ -379,6 +464,14 @@ vc4_vec_connector_get_property(struct drm_connector *connector, *val = VC4_VEC_TV_MODE_PAL_M; break; + case DRM_MODE_TV_MODE_PAL_N: + *val = VC4_VEC_TV_MODE_PAL_N; + break; + + case DRM_MODE_TV_MODE_SECAM_B: + *val = VC4_VEC_TV_MODE_SECAM; + break; + default: return -EINVAL; } @@ -608,10 +701,14 @@ static int vc4_vec_bind(struct device *dev, struct device *master, void *data) int ret; ret = drm_mode_create_tv_properties(drm, + BIT(DRM_MODE_TV_MODE_NTSC_443) | BIT(DRM_MODE_TV_MODE_NTSC_J) | BIT(DRM_MODE_TV_MODE_NTSC_M) | + BIT(DRM_MODE_TV_MODE_PAL_60) | BIT(DRM_MODE_TV_MODE_PAL_B) | - BIT(DRM_MODE_TV_MODE_PAL_M)); + BIT(DRM_MODE_TV_MODE_PAL_M) | + BIT(DRM_MODE_TV_MODE_PAL_N) | + BIT(DRM_MODE_TV_MODE_SECAM_B)); if (ret) return ret; From patchwork Mon Aug 29 13:11:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957915 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 CDA4FC0502E for ; Mon, 29 Aug 2022 13:26:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5B7DC10F349; Mon, 29 Aug 2022 13:26:09 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1039B10F2EB; Mon, 29 Aug 2022 13:25:50 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 7E50E2B06083; Mon, 29 Aug 2022 09:15:47 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:15:50 -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=1661778947; x= 1661786147; bh=xPKClgXEhgbZIku/wD+WYQoXLvH5DXbkNRiUTcpaiXA=; b=D iq1Lken6FPUNY6rixKynLAYM0aUp0Y8hCQW8/cHoIUuRCQ3MIotHbVe3Oj1Wld9D q8rziTtUo6iwNwmgBwzXqq8hlsXqBdtfEso3aBerfVESdHyeQPog9SiNC948Ba/n Wni8XNvw5d5ayPhbMvLsKHl6a0Iog8XuQsL7V55NuD+KoGyPTGWEQzWhYx9OE+NI LMBjNxT45iB/T/VXCqETMvc0UZ8ingxcjJBfArIhWLg2zhVQ92r69H7FbYi6Ju/E n/2vAMOQRnMOdXHevDd5ycfIUhYEC0dkymlW+QZO5B61Jl6x9ONqD1IZ03uCVOYK Hrx4UTd7Ur7hCKtXj0iTQ== 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=1661778947; x= 1661786147; bh=xPKClgXEhgbZIku/wD+WYQoXLvH5DXbkNRiUTcpaiXA=; b=Q 6Ot/UO86TeWLcTnOqWGbhFftfW5ZYp54/HxY3lKQHK1wJ9ZN8Z1exXYYSbqUm+PI q/qjgyiU8y2EfM2n325LeqEMSsx/zJBL8HeecwCxLZAN1g5xwhCw+edHReuhiazL 3sTfnL45HjCYBV1csTzW8thlZ1abueJGlc4SBIerk5SZR0mQ0s9oeRTxjGueuslr L9JVUVmuzuhLWx1waPF/tiN/ZE1aaTKyJe6Oi85QjETFz4WyXKJ29bK96oCyKT8q DWr0iNmd2My7ue6ymNQkakb/YdcjGIMNLCd7kW1624dlXG7lATvZBHj53+iK6WjA 9cL5DAzdJMUXyEM1a+ngw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeeinecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:15:46 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:48 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-34-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=873; i=maxime@cerno.tech; h=from:subject:message-id; bh=WJLJuDlfN2CfTt2hGqbzVPVAYa+Qd5gtSkAkaL2kavM=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxTzLnKv3fU95cidZ/cME2bzmpemL61aKH77+n3X0G2u nwLOdpSyMIhxMciKKbLECJsviTs163UnG988mDmsTCBDGLg4BWAieocZGa74rSi88fc6b71wiKChU4 Hag72tny67LGHlMnsacnnXinSG/3ln25P3CD2Rae+ytG+e5/bso+vSBMtZvu61rz/Ixv/W5QAA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 34/41] drm/sun4i: tv: Remove unused mode_valid X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The mode_valid implementation is pretty much a nop, let's remove it. Signed-off-by: Maxime Ripard Reviewed-by: Jernej Skrabec diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index 94883abe0dfd..53152d77c392 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -497,16 +497,8 @@ static int sun4i_tv_comp_get_modes(struct drm_connector *connector) return i; } -static int sun4i_tv_comp_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) -{ - /* TODO */ - return MODE_OK; -} - static const struct drm_connector_helper_funcs sun4i_tv_comp_connector_helper_funcs = { .get_modes = sun4i_tv_comp_get_modes, - .mode_valid = sun4i_tv_comp_mode_valid, }; static void From patchwork Mon Aug 29 13:11:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957904 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 8D46FC0502E for ; Mon, 29 Aug 2022 13:26:27 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2695510F2D9; Mon, 29 Aug 2022 13:26:01 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 97A2610F2DB; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id DF5142B05E5E; Mon, 29 Aug 2022 09:15:53 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:15:56 -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=1661778953; x= 1661786153; bh=fGq4pxjwR9dhN8V94rScn9Z1raHP34bbSYZqQRlSHw0=; b=c VXAet/qyIapvApr4WQBJpPocgntulpZY1iMHgEOHg6IOdnmDSveEjj3Z8AKVmHc7 C3snlSKLgltL8UUmjsAtZfPms8eriiJSBQMJMMv96+UWrrIZbcihxTFOzArWyOUS WYbvYV1ir05vDLmz/OcTIJUsqeJPnF0O4HFr56HWO+O6dnm42EWhfga8x4dwhgm4 wj07s+IrTQg1peX5jGvfNDhFycYUccwXfFSFYh0v7Jin/SzkCTbbx2AUa2TCzJiH ZOqUGD7DJTplKseM17IJPtDX3OCWHkeNrc5iOZ/S0+nDdioFGvGvk9CX5VMP9WJr WMRsBmhG0wdCzBgWU2a+g== 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=1661778953; x= 1661786153; bh=fGq4pxjwR9dhN8V94rScn9Z1raHP34bbSYZqQRlSHw0=; b=t XOfZrOEyjM13jfV1nPLKePsnAo8mXNQfreTSb+SO/DhCM67pNDSwKfdu2lE9O7MZ 8dA6mZBcgOJSrU1zbEtdHJ3nNM0gmeERQXR0SI6jApcEXKgu+LWtYRQ+stQRcA9a 1QvQq/z/rLnXizwQ/LU4Oo+LlHDDwW4WWup/C9Hqderml0ot9FMIYHFIl9yKjHCM G1xzNsm/sPJCmUV741nzZ6KcIdYWeZ2Rj43M08xaNOAa3OmaXGiBsmPaCo+ewMmR dRWTGI8I//uQzxge+fvfoMw9BUx+yhAB5h0t3v5gU29SrQ5rypa+sry1bXeIbZ9+ rFvdyor2LMfebHEuijAZQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeejnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:15:52 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:49 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-35-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=1624; i=maxime@cerno.tech; h=from:subject:message-id; bh=EjOnDOZq2Ss8h1qrZ2KbpJgd2LCqDkVnUyJOEPlgRRU=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxSZmRf9TNF9MLFCtKDh5WYP9ySNxJebzPxF3ifKTegX //Oho5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABN5wc3I0C3w1OXska8Z0ziW3cybKH d28trNi/xnvNBh45Yo2PNjxhRGhkkfI1cdvB1c0TZjwVWp4y6Fs9e7/trsvM4iWiQ+JfzHEyYA X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 35/41] drm/sun4i: tv: Convert to atomic hooks X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The sun4i TV driver still uses legacy enable and disable hook implementation. Let's convert to the atomic variants. Signed-off-by: Maxime Ripard Acked-by: Jernej Skrabec diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index 53152d77c392..f7aad995ab5b 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -339,7 +339,8 @@ static void sun4i_tv_mode_to_drm_mode(const struct tv_mode *tv_mode, mode->vtotal = mode->vsync_end + tv_mode->vback_porch; } -static void sun4i_tv_disable(struct drm_encoder *encoder) +static void sun4i_tv_disable(struct drm_encoder *encoder, + struct drm_atomic_state *state) { struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); struct sun4i_crtc *crtc = drm_crtc_to_sun4i_crtc(encoder->crtc); @@ -353,7 +354,8 @@ static void sun4i_tv_disable(struct drm_encoder *encoder) sunxi_engine_disable_color_correction(crtc->engine); } -static void sun4i_tv_enable(struct drm_encoder *encoder) +static void sun4i_tv_enable(struct drm_encoder *encoder, + struct drm_atomic_state *state) { struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); struct sun4i_crtc *crtc = drm_crtc_to_sun4i_crtc(encoder->crtc); @@ -469,8 +471,8 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder, } static const struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = { - .disable = sun4i_tv_disable, - .enable = sun4i_tv_enable, + .atomic_disable = sun4i_tv_disable, + .atomic_enable = sun4i_tv_enable, .mode_set = sun4i_tv_mode_set, }; From patchwork Mon Aug 29 13:11:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957909 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 6309CECAAD5 for ; Mon, 29 Aug 2022 13:26:34 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EB0D710F322; Mon, 29 Aug 2022 13:26:06 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 07A1A10F2E8; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id 7FF612B06030; Mon, 29 Aug 2022 09:16:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Mon, 29 Aug 2022 09:16:03 -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=1661778960; x= 1661786160; bh=HaNtO91X8wVp/AZd+CLfPSi0rxBzaPaGsS0q1kMO3AQ=; b=P SspWNLxyOHIFND0XwCfhQ2aYf/rmiRHAWMqStot70EXQWCaBKE5b9+EZR1p2yb4r mY6KQiCJWyhVru8bpb0lcyIOmbJDydDVGL1Cc6Cp6ZR1E4CQHHrv8+c99MZ8uZDg LnDGUqf7eih9BeEDW5oGmBesvj6C4UlnA4okbHEc3Rj+iYlG095D+IbBOErKhOH8 b+u0UxlBaLEPFxtElyH2W+i2zb2nYjUs70b55okgmcIPOeJ1yHAwIMlWbNXMT5RR bllxPiteF6QrQGE6Q7CFkOIkG0xmLM8aOWNBvf1Vt7GknYG6sUYV9hn7uAqJt+10 jf7RBDrQjzydabB6RN1Ag== 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=1661778960; x= 1661786160; bh=HaNtO91X8wVp/AZd+CLfPSi0rxBzaPaGsS0q1kMO3AQ=; b=1 F0qVieGIST1yez16+8a4Mz82pbcvqCH9ddqWGKh/W2iGqvwP630MUUY7poBiK/ce TsC2Aa8fTkdtk0Abo6841ZDzQ6BDNbaQuuEH2srUpaEr1UIChcfDNxlQir0t/XWM x4hQqlPKNug31eeK6p0KlSahBhxZ15PB9Kfo8FZaKdsDZIlgNAeMF7zl7DigUlVN pEyceb1AcpT7fTacQks3HKQVxKfPnEdF+ybCCdE4xOTIPpNuZlh61cSPfwS6Hy2J 6USBNwlw2mTcGCEZDWntG9dx7ybGTa7bWkFwhTIPoSgg2OD+D6RgjBOvtHdhQLk2 1WxohkbZFdbdzUm2kqcRg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeehnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:15:58 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:50 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-36-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=2077; i=maxime@cerno.tech; h=from:subject:message-id; bh=8f83P3U97bSAZ8QzllfF75YiPBqFH3osodi8Teklke8=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxSPr+f6yCBW9/9izvzc6Iz4iQJvsqXPHAz1rYn9mCWQ 5jWlo5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABNJ42f475z7reFT0/X19t18drN6tj A9Yww4MbVAb8pibYbLPd+T+Bj+x64KOXCkcffFr7y8KhdXbdVe3POP/bi8xo8fe7oDjZI52AE= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 36/41] drm/sun4i: tv: Merge mode_set into atomic_enable X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Our mode_set implementation can be merged into our atomic_enable implementation to simplify things, so let's do this. Signed-off-by: Maxime Ripard Acked-by: Jernej Skrabec diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index f7aad995ab5b..3944da9a3c34 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -359,23 +359,13 @@ static void sun4i_tv_enable(struct drm_encoder *encoder, { struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); struct sun4i_crtc *crtc = drm_crtc_to_sun4i_crtc(encoder->crtc); - - DRM_DEBUG_DRIVER("Enabling the TV Output\n"); - - sunxi_engine_apply_color_correction(crtc->engine); - - regmap_update_bits(tv->regs, SUN4I_TVE_EN_REG, - SUN4I_TVE_EN_ENABLE, - SUN4I_TVE_EN_ENABLE); -} - -static void sun4i_tv_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) -{ - struct sun4i_tv *tv = drm_encoder_to_sun4i_tv(encoder); + struct drm_crtc_state *crtc_state = + drm_atomic_get_new_crtc_state(state, encoder->crtc); + struct drm_display_mode *mode = &crtc_state->mode; const struct tv_mode *tv_mode = sun4i_tv_find_tv_by_mode(mode); + DRM_DEBUG_DRIVER("Enabling the TV Output\n"); + /* Enable and map the DAC to the output */ regmap_update_bits(tv->regs, SUN4I_TVE_EN_REG, SUN4I_TVE_EN_DAC_MAP_MASK, @@ -468,12 +458,17 @@ static void sun4i_tv_mode_set(struct drm_encoder *encoder, SUN4I_TVE_RESYNC_FIELD : 0)); regmap_write(tv->regs, SUN4I_TVE_SLAVE_REG, 0); + + sunxi_engine_apply_color_correction(crtc->engine); + + regmap_update_bits(tv->regs, SUN4I_TVE_EN_REG, + SUN4I_TVE_EN_ENABLE, + SUN4I_TVE_EN_ENABLE); } static const struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = { .atomic_disable = sun4i_tv_disable, .atomic_enable = sun4i_tv_enable, - .mode_set = sun4i_tv_mode_set, }; static int sun4i_tv_comp_get_modes(struct drm_connector *connector) From patchwork Mon Aug 29 13:11:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957905 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 02C5EECAAD5 for ; Mon, 29 Aug 2022 13:26:29 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8890310F2F2; Mon, 29 Aug 2022 13:26:01 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id 973D310F2D9; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailnew.west.internal (Postfix) with ESMTP id D39432B06042; Mon, 29 Aug 2022 09:16:06 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Mon, 29 Aug 2022 09:16:09 -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=1661778966; x= 1661786166; bh=d7clZxO7I3eO98KnGdsmo+IO+/vbylIbR6+bBaeoXdw=; b=r Yebl8gxFwJmJvRJ+TAQrxa2mZzy9LMyCcQTFVma7R7SzwQUA66DgZlZqNF25NHMj L3PiguJJmWk8wMWPJ1rM6MNUecQMSEm8fy5qIcNGnvsQhfX5nnCLlfSsybShX22l vWfsR3ngGRm2NpwRJf+fA8PtwEDdW+JA4I2HLHHklLMvA6HW/rslBVjucJAuZe18 Y7lOxDLgPrHoIIwq3M4ps0KEl4jSUIzDH64039T3e7GEf0A0tnI5OO3r2kWHLdaY GSMnl2FhqCPnwbWJ/qkOndrSMZEz8Q7LgVKXGF5kKT3COz6R03cpb1ltx0fZQ5Db 2SJd4bUnl0g5wsdgSpfgw== 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=1661778966; x= 1661786166; bh=d7clZxO7I3eO98KnGdsmo+IO+/vbylIbR6+bBaeoXdw=; b=z 66An1LQGGHpif1xWysF2LJUXkLrlRKOYi0c6475Wq2Y1GRdr8iAr9H+sSmJBqPq9 JRSoTMwOoMgnvHOUyRp6Fus77Y1K/RL6NFw4O5Wv9SnON1KwCmhZqXz+f5gVTtnk zbtCbk0Jrnki19Vf3MDFReoWtVC3dxBrmQYpYOFW8xJxYkXBO6safcX1qOSi/Hkp YLHtEIEYFU71z2yNTAI4AB3A/ppZ3O799MnWm27eWTsj8xsIvRDE0JOP2aVDYpP/ rJ+aD0Cx7a8IYoKfWYMaLcEVu+KFdNY96I0ZwoUsXkTCnIGbRbsz/tOn+EOvwEJ/ GdLBJtpTW0Eb1I4V2hEOg== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeeinecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:16:05 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:51 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-37-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=761; i=maxime@cerno.tech; h=from:subject:message-id; bh=azl4tdJEs9Q+qPax/2oZwteOATZIm73l0YTHGZIqrtQ=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxQzNPYcqlDddEq8sk43uLttZt9+fX95AwGNtYZ8XFqf DH50lLIwiHExyIopssQImy+JOzXrdScb3zyYOaxMIEMYuDgFYCJVbYwMM98mf2BaJX7jtZ+YdP+7NW arv9/IWJm0yetM6Pb91oFVkQz/CzfcT/zIZWG291nTivZcq/Pzb/jf8hWXykjambbzUaoRGwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 37/41] drm/sun4i: tv: Remove useless function X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The drm_connector_to_sun4i_tv() function isn't used anywhere in the driver, so let's remove it. Signed-off-by: Maxime Ripard Acked-by: Jernej Skrabec diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index 3944da9a3c34..52bbba8f19dc 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -275,13 +275,6 @@ drm_encoder_to_sun4i_tv(struct drm_encoder *encoder) encoder); } -static inline struct sun4i_tv * -drm_connector_to_sun4i_tv(struct drm_connector *connector) -{ - return container_of(connector, struct sun4i_tv, - connector); -} - /* * FIXME: If only the drm_display_mode private field was usable, this * could go away... From patchwork Mon Aug 29 13:11:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957914 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 A2153C0502C for ; Mon, 29 Aug 2022 13:26:40 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC46210F345; Mon, 29 Aug 2022 13:26:08 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id BDB7710F2DE; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 440132B06089; Mon, 29 Aug 2022 09:16:13 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:16:16 -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=1661778972; x= 1661786172; bh=m0bX0yVVXPuP/oiIMrVxVPH8Yeb69EPj7qYI2Vvf/WI=; b=Z PfNQDvfQdg4O/9q5B6QdM4lFRA5ZWXziurkzxm7eLvq12NY96Cl0xdSvybGsKhPw L/R/NtZk/hRdkppkQ2vKyLZ92DTp+c/dcZJvzky6SugiRRbu8sViWJ2Ly8QirghV huf/UgU7uq/yxq13hVu8uEdLw1Aiofnn44QFVPZ1EacRWn8TfUvVMaATqKiU38IV hUvq/x38aUkWISJT7e+7L1nqgj6ZiAyVWZ1zI0hY2lQ4H8BggH8mhxJnSckk2FVN 5Kd3Y9vhCdmvylUwZ21w+wEmIJ4VXEscMiDBHDoPUsuTbsi/+s8SfifxCB/aDh86 /m3Mx+LXGp1g3k7bXuv0w== 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=1661778972; x= 1661786172; bh=m0bX0yVVXPuP/oiIMrVxVPH8Yeb69EPj7qYI2Vvf/WI=; b=W S5LLf8pI/X2rsE2aqg+J53OTUs72AvcN18KCU3py4vRy2VRNnFvF+upF5spN2gUZ /7zZkNpy6+mtGqyz/beYOidQfU5hUKT0RKVLPsCgU4mpYkcPKzhsF+dFlLsPHybU NOVsiGZSQW6RvAbQetYXEbvnwKvWcWX02FJ7Wo5CqBYVcqzmTA5MP1qauZIRmhfY y5e5M195xjUTZHG3joT1wkI8U3pA9JRyglm3qfI67RHiueZa3pJijuKqBbAg47il dwBud1K0F0PnkNm9vXP6YvHdsEk7U2B1yf8QTjnEXaO6lZJgtnO9O/D14IYw94rR oelDLHECeIJyt2LeVfHfw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeeknecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:16:11 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:52 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-38-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=1164; i=maxime@cerno.tech; h=from:subject:message-id; bh=54ghzoAkQN+pfS+MGQnqBXckT+/90z2OxxUOtpxMDb8=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxT7n319YvL7yoeD2997z8petNc1U6DvmO3Ucrtgd/9t Sk73O0pZGMS4GGTFFFlihM2XxJ2a9bqTjW8ezBxWJpAhDFycAjCR248ZGfZ9CtRb/kOU93rd4rlvhS e9m5vw8na/gvVqrc4Xh055Sd5n+Kf1vmrykkDm9B+JV/gMnyvO5bpgbzxLiltO9XRK7htPN24A X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 38/41] drm/sun4i: tv: Remove useless destroy function X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Our destroy implementation is just calling the generic helper, so let's just remove our function and directly use the helper. Signed-off-by: Maxime Ripard Reviewed-by: Jernej Skrabec diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index 52bbba8f19dc..6d7e1d51569a 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -491,15 +491,9 @@ static const struct drm_connector_helper_funcs sun4i_tv_comp_connector_helper_fu .get_modes = sun4i_tv_comp_get_modes, }; -static void -sun4i_tv_comp_connector_destroy(struct drm_connector *connector) -{ - drm_connector_cleanup(connector); -} - static const struct drm_connector_funcs sun4i_tv_comp_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = sun4i_tv_comp_connector_destroy, + .destroy = drm_connector_cleanup, .reset = drm_atomic_helper_connector_reset, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, From patchwork Mon Aug 29 13:11:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957908 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 166C1C0502C for ; Mon, 29 Aug 2022 13:26:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 71C9C10F2DF; Mon, 29 Aug 2022 13:26:05 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id F0DEC10F2C3; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 7C3232B0608B; Mon, 29 Aug 2022 09:16:19 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:16:22 -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=1661778979; x= 1661786179; bh=2pxPB8e3CUm+60/d+Ajs5F0Dd4Kd+gAOE9TGfZOvPi0=; b=s IFzr/KwlpJ8OIhfGNGLHBQZSFbYXA/GT17RVJbxwYyhlHyMA12oQDgfug6L0m9aD X0IDX/9OOlU5kSeAcMawyeLAQKO0XIgBCsm1ZFdVniAQWCHANKzHtpBNo3cAZww0 5MicvOD/rEkF3wNV/UB9O7nKs1xzJY9wLXTV/GogF93gLyWvVWJi4ngfOWMSnWh5 CwygGs605KWyBc1wCllQfe3TbNN6uVtsY9HtvpnE3O5Y/Zoag1prGyRPCSVL3nWo 0Gabzdw9tf46rgj4C8mlK+bWWDnD7Q6ujmZDRNy1TSiqfDM1t95jNN/epM1ns6UZ Ph43mk9o9BiUEA0LYSdaw== 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=1661778979; x= 1661786179; bh=2pxPB8e3CUm+60/d+Ajs5F0Dd4Kd+gAOE9TGfZOvPi0=; b=K amRuNAMz7RG67NNqG11/jS2FJetLjnF/YCqhACRhauGq6fVhcyl24R02JFViBwod kN9W9BEWH6Qnz/aarJGl7Btr7qRERvCqBl8TbrtR4A8V5KBA3t0837rb60apLAw9 xd7KmfwJlAIc76trDkH6gtlXNNURuAyRxS2nGYkKq8KXkIKHXNAyHKlfdtXQ+y6K HdJxeD4NiKCPAa6F9109Yq58K2kJCaWeFzj4dpW0sCMB9T281wJzF4SXFOh+wCG8 jJmAZsevO8Fyfym2peyHMM6WQdbYnl4/4zdiM1Pm4AItNfYQXOCRF+UGirJUNFkP +BKov0Dj/yu9diciK0emQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpeelnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:16:17 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:53 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-39-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=1217; i=maxime@cerno.tech; h=from:subject:message-id; bh=992aKe2/qrCZVBZV8U/tKPDwh4IEN+c9wkBDNYDBbNw=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxTL71furRMuLyvh3dMXLdC772S+DmPCi8cBU29O2WvA qFffUcrCIMbFICumyBIjbL4k7tSs151sfPNg5rAygQxh4OIUgIlsX8Hw36lcJjPlBVej+dHv2ofUdy 3jua8+67uphfXJTysbF+QuUmf4nzo9Nr7FyGiSnJlYzZNy83ZFqXeOm77bTWD/fCHy9fQybgA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 39/41] drm/sun4i: tv: Rename error label X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The other error labels in sun4i_tv_bind() are named after the task they perform (err_disable_clk to call clk_disable_unprepare for example). However, the err_cleanup_connector is named after the calling site (drm_connector_init failing) and will actually cleanup the encoder. Let's rename it to err_cleanup_encoder to be consistent. Signed-off-by: Maxime Ripard Reviewed-by: Jernej Skrabec diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index 6d7e1d51569a..ad6a3739bfa9 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -580,7 +580,7 @@ static int sun4i_tv_bind(struct device *dev, struct device *master, if (ret) { dev_err(dev, "Couldn't initialise the Composite connector\n"); - goto err_cleanup_connector; + goto err_cleanup_encoder; } tv->connector.interlace_allowed = true; @@ -588,7 +588,7 @@ static int sun4i_tv_bind(struct device *dev, struct device *master, return 0; -err_cleanup_connector: +err_cleanup_encoder: drm_encoder_cleanup(&tv->encoder); err_disable_clk: clk_disable_unprepare(tv->clk); From patchwork Mon Aug 29 13:11:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957895 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 50540ECAAD5 for ; Mon, 29 Aug 2022 13:26:12 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 0D2BB10F299; Mon, 29 Aug 2022 13:25:57 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id E25CD10F2C7; Mon, 29 Aug 2022 13:25:48 +0000 (UTC) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailnew.west.internal (Postfix) with ESMTP id 1F6682B0608F; Mon, 29 Aug 2022 09:16:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 29 Aug 2022 09:16:28 -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=1661778985; x= 1661786185; bh=lN7bNSOCMzy68afbhfiVt1hAVLOOacA7oPD2TeryXSs=; b=g aeOBAyFL3r2QIe8OCH1iFRgWnMODA4K0311mTQusoNqJTsW7pyd4XnwmegAiCpt9 +En8iXRtrSPElJv91UWRtxnyPn/aYJldPEebV0n95tUpwahYP6UyLB+LTesuYSeg Gbt4eFuQyw+NwzT2V6cB1qsCx0Y5yM78mV333wM/GHS5OjKxRw+dfph989WqMoR+ QgiGEf4sCj5YmcKNBvCAKvJLRD05ae0jQ27z5Exs4qJrN2jm07+5dIuL+zBCQCmW KB/CrUcgOdohHUrYImGxpXLotbR4wJaev5JNNlba7zadu67EqptVuogoxmSiLN1o 4L2wXaX/NLI+l7KxLpqfw== 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=1661778985; x= 1661786185; bh=lN7bNSOCMzy68afbhfiVt1hAVLOOacA7oPD2TeryXSs=; b=T NGs8CcQ9zOUdtTiQPSqj65UfjOy2DqmcoCtDZ+24PqWm9TtsDUYyWT9vrrwMliod MjooPslBJABqRez7Dy7PwgG5Aflf0XXeZ+m1qjiQycHYbjfRQc3UJhyv1SQl+j9L j9xQuhKPPBMlXGPbJZJuZNqtPiMNcqA1tPSRNSTyiotKgD/PK9BNTKbHXxk+hdyT XnLEVDrk+d8Ea2wtXa4vTAoIxOI75qlZ/M6t8xrMvyVcwgePO2L5SC4e05xm+sMo UvJy0VSVVvzB0BXjB6vUjsBj8zbnYVXrfTiEqp+WKms66VJPXNDuuib4fowtrrGY 8JRPKVGvPMsha+caC4cwQ== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpehmrgigihhmvgestggvrhhnohdrthgvtghh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:16:24 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:54 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-40-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=815; i=maxime@cerno.tech; h=from:subject:message-id; bh=r7LcpFs7qXcJi8XUdtLYEk3itduP1hTLzq2Bc5XOe7Q=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxR5qjSTzZ5o7LpVE7xN9dyhQ549wbl2azjmXeU0dlrf 906/o5SFQYyLQVZMkSVG2HxJ3KlZrzvZ+ObBzGFlAhnCwMUpABOZpcDIcE9cdX7DrmXcxb/Y7f67c/ IXqTOzfJ62UcRzrd/Wc9/NHjH8s779wy7khmruMYsYS3e5B3z58Ssabv2u33eslvGSVa0bAwA= X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 40/41] drm/sun4i: tv: Add missing reset assertion X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" The reset line is deasserted at bind, and asserted if we ever encounter an error there. However, it's never asserted in unbind which will lead to a resource unbalance. Signed-off-by: Maxime Ripard Reviewed-by: Jernej Skrabec diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index ad6a3739bfa9..74ff5ad6a8b9 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -605,6 +605,7 @@ static void sun4i_tv_unbind(struct device *dev, struct device *master, drm_connector_cleanup(&tv->connector); drm_encoder_cleanup(&tv->encoder); clk_disable_unprepare(tv->clk); + reset_control_assert(tv->reset); } static const struct component_ops sun4i_tv_ops = { From patchwork Mon Aug 29 13:11:55 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 12957907 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 9CC83ECAAD5 for ; Mon, 29 Aug 2022 13:26:31 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8675010F2EB; Mon, 29 Aug 2022 13:26:04 +0000 (UTC) Received: from wnew2-smtp.messagingengine.com (wnew2-smtp.messagingengine.com [64.147.123.27]) by gabe.freedesktop.org (Postfix) with ESMTPS id B07AA10F2DD; Mon, 29 Aug 2022 13:25:49 +0000 (UTC) Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailnew.west.internal (Postfix) with ESMTP id 41E262B06090; Mon, 29 Aug 2022 09:16:32 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Mon, 29 Aug 2022 09:16:35 -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=1661778991; x= 1661786191; bh=tVvgEA3a0r+6vtlMZVtwbeURRb1tj232wXwVtdz5EAA=; b=Y DYhrpZLyx6Cu7gyUw5RfgeBtn+vgeUVVHKm7O+6muotDy5gnRm+B3QouFqtRYjem pqINcrgzNuK+BiS9pvhc1OvRWL/z8iFgFebQkRYpHMhoKWikOLVSilCdIKiUCKTD YsnVD1SsWLTZ3ETC+WWMt0CsjJCGFFg99n8sF2cw8TlTw0f57Mg3ENC0Sh2meIiT X12JkCahvWQeU/dIoBwGmrbAiwjJDetDY+iwbBYPrc+fZXMRp/oZ/xc7ICqbukZm eAYzjLHMy9rEW6cGyNfzEWz/kTD8sRG0jWGhqygeqttaVqOhtrT1wnxfEEmRqf7O LUQBAXbqcDJZ6dWHIKdzA== 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=1661778991; x= 1661786191; bh=tVvgEA3a0r+6vtlMZVtwbeURRb1tj232wXwVtdz5EAA=; b=Y JCz984246F6DBA+LiY4JypkuMjvR08r2x1tvinmXECHpK4O1G6Yh5NXpvW9hYWGB RmpB9oX+Cif2uyV/xgbtw/Uu90iU+vn8YhCN53UCFbs4hbWyP5I3PcieYJYMlAst TRoZK1k5slZEAlY2xZtExNiqz57kCadMXYzscSRkmp4x48BXAOrZd/6/TkeeZHXt fcR51daVHwEcUbvr/BOULLD810yUGnJg0f5vYz3R3gRXOkOy9jt9ksCCp0eF99Hr Z4HkR6yx35yGsktrPmumsKUwMutD3mgyqJVyyVqDfVTgsGfHlcsmCFSoy3oGlRUz OsRpCth5gieuFSL9+9Uug== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrvdekuddgieegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvvefufffkofgjfhggtgfogfesthhqredtredtjeenucfhrhhomhepofgr gihimhgvucftihhprghrugcuoehmrgigihhmvgestggvrhhnohdrthgvtghhqeenucggtf frrghtthgvrhhnpeefiedvfefggffgffehveejieffuddtgffhjefggeetieduvdeileet lefgveegtdenucevlhhushhtvghrufhiiigvpedutdenucfrrghrrghmpehmrghilhhfrh homhepmhgrgihimhgvsegtvghrnhhordhtvggthh X-ME-Proxy: Feedback-ID: i8771445c:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 29 Aug 2022 09:16:30 -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_Tr=C3=B8nnes?= , Emma Anholt , Daniel Vetter , Joonas Lahtinen Date: Mon, 29 Aug 2022 15:11:55 +0200 Message-Id: <20220728-rpi-analog-tv-properties-v2-41-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=7619; i=maxime@cerno.tech; h=from:subject:message-id; bh=d9NyAFsgWE8A2NZjwZ98RGHmubqiSFwy9+VurUoUxG0=; b=owGbwMvMwCX2+D1vfrpE4FHG02pJDMk8uxQf7bWudXhyo1pYmyFXTLjggZ9+a376X+cky225yTWK TswdpSwMYlwMsmKKLDHC5kviTs163cnGNw9mDisTyBAGLk4BmAjXNEaGT+UujTzbSh+db4gQ7FcRu1 zH8+QNR3fYlQeXK/w564szGBmW5G1qV7G3Ydz78+1+xjV//P2bDDMsBHZq7p37Rldklw4XAA== X-Developer-Key: i=maxime@cerno.tech; a=openpgp; fpr=BE5675C37E818C8B5764241C254BCFC56BF6CE8D Subject: [Intel-gfx] [PATCH v2 41/41] drm/sun4i: tv: Convert to the new TV mode property X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Dom Cobley , Dave Stevenson , nouveau@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-sunxi@lists.linux.dev, Geert Uytterhoeven , Maxime Ripard , Mateusz Kwiatkowski , Phil Elwell , linux-arm-kernel@lists.infradead.org Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" Now that the core can deal fine with analog TV modes, let's convert the sun4i TV driver to leverage those new features. Signed-off-by: Maxime Ripard diff --git a/drivers/gpu/drm/sun4i/sun4i_tv.c b/drivers/gpu/drm/sun4i/sun4i_tv.c index 74ff5ad6a8b9..10c0d727d700 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tv.c +++ b/drivers/gpu/drm/sun4i/sun4i_tv.c @@ -140,23 +140,14 @@ struct resync_parameters { struct tv_mode { char *name; + unsigned int tv_mode; + u32 mode; u32 chroma_freq; u16 back_porch; u16 front_porch; - u16 line_number; u16 vblank_level; - u32 hdisplay; - u16 hfront_porch; - u16 hsync_len; - u16 hback_porch; - - u32 vdisplay; - u16 vfront_porch; - u16 vsync_len; - u16 vback_porch; - bool yc_en; bool dac3_en; bool dac_bit25_en; @@ -212,7 +203,7 @@ static const struct resync_parameters pal_resync_parameters = { static const struct tv_mode tv_modes[] = { { - .name = "NTSC", + .tv_mode = DRM_MODE_TV_MODE_NTSC_M, .mode = SUN4I_TVE_CFG0_RES_480i, .chroma_freq = 0x21f07c1f, .yc_en = true, @@ -221,17 +212,6 @@ static const struct tv_mode tv_modes[] = { .back_porch = 118, .front_porch = 32, - .line_number = 525, - - .hdisplay = 720, - .hfront_porch = 18, - .hsync_len = 2, - .hback_porch = 118, - - .vdisplay = 480, - .vfront_porch = 26, - .vsync_len = 2, - .vback_porch = 17, .vblank_level = 240, @@ -241,23 +221,12 @@ static const struct tv_mode tv_modes[] = { .resync_params = &ntsc_resync_parameters, }, { - .name = "PAL", + .tv_mode = DRM_MODE_TV_MODE_PAL_B, .mode = SUN4I_TVE_CFG0_RES_576i, .chroma_freq = 0x2a098acb, .back_porch = 138, .front_porch = 24, - .line_number = 625, - - .hdisplay = 720, - .hfront_porch = 3, - .hsync_len = 2, - .hback_porch = 139, - - .vdisplay = 576, - .vfront_porch = 28, - .vsync_len = 2, - .vback_porch = 19, .vblank_level = 252, @@ -275,63 +244,21 @@ drm_encoder_to_sun4i_tv(struct drm_encoder *encoder) encoder); } -/* - * FIXME: If only the drm_display_mode private field was usable, this - * could go away... - * - * So far, it doesn't seem to be preserved when the mode is passed by - * to mode_set for some reason. - */ -static const struct tv_mode *sun4i_tv_find_tv_by_mode(const struct drm_display_mode *mode) +static const struct tv_mode * +sun4i_tv_find_tv_by_mode(unsigned int mode) { int i; - /* First try to identify the mode by name */ for (i = 0; i < ARRAY_SIZE(tv_modes); i++) { const struct tv_mode *tv_mode = &tv_modes[i]; - DRM_DEBUG_DRIVER("Comparing mode %s vs %s", - mode->name, tv_mode->name); - - if (!strcmp(mode->name, tv_mode->name)) - return tv_mode; - } - - /* Then by number of lines */ - for (i = 0; i < ARRAY_SIZE(tv_modes); i++) { - const struct tv_mode *tv_mode = &tv_modes[i]; - - DRM_DEBUG_DRIVER("Comparing mode %s vs %s (X: %d vs %d)", - mode->name, tv_mode->name, - mode->vdisplay, tv_mode->vdisplay); - - if (mode->vdisplay == tv_mode->vdisplay) + if (tv_mode->tv_mode == mode) return tv_mode; } return NULL; } -static void sun4i_tv_mode_to_drm_mode(const struct tv_mode *tv_mode, - struct drm_display_mode *mode) -{ - DRM_DEBUG_DRIVER("Creating mode %s\n", mode->name); - - mode->type = DRM_MODE_TYPE_DRIVER; - mode->clock = 13500; - mode->flags = DRM_MODE_FLAG_INTERLACE; - - mode->hdisplay = tv_mode->hdisplay; - mode->hsync_start = mode->hdisplay + tv_mode->hfront_porch; - mode->hsync_end = mode->hsync_start + tv_mode->hsync_len; - mode->htotal = mode->hsync_end + tv_mode->hback_porch; - - mode->vdisplay = tv_mode->vdisplay; - mode->vsync_start = mode->vdisplay + tv_mode->vfront_porch; - mode->vsync_end = mode->vsync_start + tv_mode->vsync_len; - mode->vtotal = mode->vsync_end + tv_mode->vback_porch; -} - static void sun4i_tv_disable(struct drm_encoder *encoder, struct drm_atomic_state *state) { @@ -355,7 +282,11 @@ static void sun4i_tv_enable(struct drm_encoder *encoder, struct drm_crtc_state *crtc_state = drm_atomic_get_new_crtc_state(state, encoder->crtc); struct drm_display_mode *mode = &crtc_state->mode; - const struct tv_mode *tv_mode = sun4i_tv_find_tv_by_mode(mode); + struct drm_connector *connector = &tv->connector; + struct drm_connector_state *conn_state = + drm_atomic_get_new_connector_state(state, connector); + const struct tv_mode *tv_mode = + sun4i_tv_find_tv_by_mode(conn_state->tv.mode); DRM_DEBUG_DRIVER("Enabling the TV Output\n"); @@ -403,7 +334,7 @@ static void sun4i_tv_enable(struct drm_encoder *encoder, /* Set the lines setup */ regmap_write(tv->regs, SUN4I_TVE_LINE_REG, SUN4I_TVE_LINE_FIRST(22) | - SUN4I_TVE_LINE_NUMBER(tv_mode->line_number)); + SUN4I_TVE_LINE_NUMBER(mode->vtotal)); regmap_write(tv->regs, SUN4I_TVE_LEVEL_REG, SUN4I_TVE_LEVEL_BLANK(tv_mode->video_levels->blank) | @@ -466,35 +397,45 @@ static const struct drm_encoder_helper_funcs sun4i_tv_helper_funcs = { static int sun4i_tv_comp_get_modes(struct drm_connector *connector) { - int i; + struct drm_display_mode *mode; + int count = 0; - for (i = 0; i < ARRAY_SIZE(tv_modes); i++) { - struct drm_display_mode *mode; - const struct tv_mode *tv_mode = &tv_modes[i]; - - mode = drm_mode_create(connector->dev); - if (!mode) { - DRM_ERROR("Failed to create a new display mode\n"); - return 0; - } + mode = drm_mode_analog_ntsc_480i(connector->dev); + if (!mode) { + DRM_ERROR("Failed to create a new display mode\n"); + return -ENOMEM; + } - strcpy(mode->name, tv_mode->name); + drm_mode_probed_add(connector, mode); + count += 1; - sun4i_tv_mode_to_drm_mode(tv_mode, mode); - drm_mode_probed_add(connector, mode); + mode = drm_mode_analog_pal_576i(connector->dev); + if (!mode) { + DRM_ERROR("Failed to create a new display mode\n"); + return -ENOMEM; } - return i; + drm_mode_probed_add(connector, mode); + count += 1; + + return count; } static const struct drm_connector_helper_funcs sun4i_tv_comp_connector_helper_funcs = { + .atomic_check = drm_atomic_helper_connector_tv_check, .get_modes = sun4i_tv_comp_get_modes, }; +static void sun4i_tv_connector_reset(struct drm_connector *connector) +{ + drm_atomic_helper_connector_reset(connector); + drm_atomic_helper_connector_tv_reset(connector); +} + static const struct drm_connector_funcs sun4i_tv_comp_connector_funcs = { .fill_modes = drm_helper_probe_single_connector_modes, .destroy = drm_connector_cleanup, - .reset = drm_atomic_helper_connector_reset, + .reset = sun4i_tv_connector_reset, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; @@ -586,8 +527,20 @@ static int sun4i_tv_bind(struct device *dev, struct device *master, drm_connector_attach_encoder(&tv->connector, &tv->encoder); + ret = drm_mode_create_tv_properties(drm, + BIT(DRM_MODE_TV_MODE_NTSC_M) | + BIT(DRM_MODE_TV_MODE_PAL_B)); + if (ret) + goto err_cleanup_connector; + + drm_object_attach_property(&connector->base, + dev->mode_config.tv_mode_property, + DRM_MODE_TV_MODE_NTSC_M); + return 0; +err_cleanup_connector: + drm_connector_cleanup(&tv->connector); err_cleanup_encoder: drm_encoder_cleanup(&tv->encoder); err_disable_clk: