From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Fri, 27 Sep 2024 12:43:28 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1su8Rb-003N4S-1X for lore@lore.pengutronix.de; Fri, 27 Sep 2024 12:43:28 +0200 Received: from bombadil.infradead.org ([2607:7c80:54:3::133]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1su8RL-0005nI-HU for lore@pengutronix.de; Fri, 27 Sep 2024 12:43:28 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:To:In-Reply-To:References: Message-Id:Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date: From:Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=usGbUqLDI7GvBDYVEfQMk+z+Kl2GN3gJq99rqwdgTII=; b=OTHUhGq+xLksl1ORgBMui8ZDOJ LGbsFJpPwHsGyKuELt5Ohky5Ir1J8WcqkdGK/MH991fZ3HTvIKVwvDDAzqvA4wQlyGyFDEvfJrB7H kki4YdbXLo+l8e0xeBtjE0jx38RFhFh+d7V04j9DMouCykKexpfO6+zgZh09aVd70vs9jLNTMDBzg a5OOqEmDqqHs6evw9etS+d+GjF42L3gFadCV2C7JKQpbM1w7xF+TWDg7USJDLXtOcpCzRa1d1qH0P e22j1GQWlnWfIPsweKLF/zoh65zAh8RFRPJBpK9RodftHWYA7g4DxJieHn81+WigsCZuUgB+k3xP4 L8u59YLw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1su8QA-0000000AqhR-18JZ; Fri, 27 Sep 2024 10:41:58 +0000 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1su8Ly-0000000ApvH-2vzz for barebox@lists.infradead.org; Fri, 27 Sep 2024 10:37:42 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1su8Lv-0002cx-FC; Fri, 27 Sep 2024 12:37:35 +0200 Received: from [2a0a:edc0:0:1101:1d::28] (helo=dude02.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1su8Lv-001tyy-1B; Fri, 27 Sep 2024 12:37:35 +0200 Received: from localhost ([::1] helo=dude02.red.stw.pengutronix.de) by dude02.red.stw.pengutronix.de with esmtp (Exim 4.96) (envelope-from ) id 1su8Lv-000PJg-1L; Fri, 27 Sep 2024 12:37:34 +0200 From: Sascha Hauer Date: Fri, 27 Sep 2024 12:37:35 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240927-vop2-v2-2-dc8dcfc651d5@pengutronix.de> References: <20240927-vop2-v2-0-dc8dcfc651d5@pengutronix.de> In-Reply-To: <20240927-vop2-v2-0-dc8dcfc651d5@pengutronix.de> To: "open list:BAREBOX" X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1727433454; l=29203; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=rXqY8fTLqldiEki0BMNg3GI2uhMsm3jST7UdzjC6mQ8=; b=ll7OL8g3HkTO/ZT1VwPMEMPizLxjL0vLuweuhhCAAGzeHzaBUb35NYL3Q47lZLceRoqUD2csa nE2lQiAV31ACfWaCO1IWkxSb/W63n8V/5xgVHhuj1Q9ncjOag4Cln8R X-Developer-Key: i=s.hauer@pengutronix.de; a=ed25519; pk=4kuc9ocmECiBJKWxYgqyhtZOHj5AWi7+d0n/UjhkwTg= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240927_033739_256237_24D85499 X-CRM114-Status: GOOD ( 29.60 ) X-BeenThere: barebox@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "barebox" X-SA-Exim-Connect-IP: 2607:7c80:54:3::133 X-SA-Exim-Mail-From: barebox-bounces+lore=pengutronix.de@lists.infradead.org X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on metis.whiteo.stw.pengutronix.de X-Spam-Level: X-Spam-Status: No, score=-4.0 required=4.0 tests=AWL,BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.2 Subject: [PATCH v2 02/15] video: add videomode helpers X-SA-Exim-Version: 4.2.1 (built Wed, 08 May 2019 21:11:16 +0000) X-SA-Exim-Scanned: Yes (on metis.whiteo.stw.pengutronix.de) Linux has three different structures to describle video modes: The FB subsystem specific struct fb_videomode, the DRM subsystem specific struct drm_display_mode and one to rule them all, struct videomode. In barebox we used to stick to struct fb_videomode, but as new graphic drivers are likely to be derived from the DRM subsystem, add the remaining struct types and add functions to convert between them. The functions are taken from Linux with some adjustments of the function names for consistency. Signed-off-by: Sascha Hauer --- drivers/video/Makefile | 2 +- drivers/video/mode-helpers.c | 174 ++++++++++++++++++ include/fb.h | 12 ++ include/uapi/drm/drm_mode.h | 93 ++++++++++ include/video/drm/drm_modes.h | 409 ++++++++++++++++++++++++++++++++++++++++++ include/video/videomode.h | 40 +++++ 6 files changed, 729 insertions(+), 1 deletion(-) diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 85cffb5a33..9e6a241a33 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile @@ -1,5 +1,5 @@ # SPDX-License-Identifier: GPL-2.0-only -obj-$(CONFIG_VIDEO) += fb.o +obj-$(CONFIG_VIDEO) += fb.o mode-helpers.o obj-$(CONFIG_DRIVER_VIDEO_EDID) += edid.o obj-$(CONFIG_OFDEVICE) += of_display_timing.o obj-$(CONFIG_DRIVER_VIDEO_BACKLIGHT) += backlight.o diff --git a/drivers/video/mode-helpers.c b/drivers/video/mode-helpers.c new file mode 100644 index 0000000000..2ad3d6b8c0 --- /dev/null +++ b/drivers/video/mode-helpers.c @@ -0,0 +1,174 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +#include +#include