From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Thu, 26 Sep 2024 15:16:13 +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 1stoLs-0030sy-0K for lore@lore.pengutronix.de; Thu, 26 Sep 2024 15:16:13 +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 1stoLn-0005tv-B5 for lore@pengutronix.de; Thu, 26 Sep 2024 15:16:12 +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=SrLPpp5QWSquiOfvvob0iqSx05 2TYnFs1b7QJ+cimVb4qI5BC1ztv7w+8LxWPpLQcrvrMitTonUMEPMV3qpBso8vpITVB3qxg60EzGI sOHvIKceBYXV0F6sR/TTcKslJtntwz1DSOFFqa+IUXyIV+BVFp0nVGWdCU7d0+dPb9x5NHQmhafx8 bDJkzDj4cOvjYqyAgbdItunfR/gwpNCAoecSykjo9PNz7wSzUVeOfrSi+idWhU5YryRfZP+PuiOzF xiOlTQC9A0+6S8TiCWHPUTK9kPo4SkAV5R7kb5DmNM5uJi7Jgkcpj18E+8OuRdW5f1xFKP885TLSu Ro1DwVfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1stoKy-00000008R0F-1ftj; Thu, 26 Sep 2024 13:15:16 +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 1stoKn-00000008Qvr-3Vu4 for barebox@lists.infradead.org; Thu, 26 Sep 2024 13:15:11 +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 1stoKl-0004um-Lq; Thu, 26 Sep 2024 15:15:03 +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 1stoKl-001h7B-4R; Thu, 26 Sep 2024 15:15:03 +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 1stoKl-00GZyn-1d; Thu, 26 Sep 2024 15:15:03 +0200 From: Sascha Hauer Date: Thu, 26 Sep 2024 15:15:00 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Message-Id: <20240926-vop2-v1-2-fe0581f2020b@pengutronix.de> References: <20240926-vop2-v1-0-fe0581f2020b@pengutronix.de> In-Reply-To: <20240926-vop2-v1-0-fe0581f2020b@pengutronix.de> To: "open list:BAREBOX" X-Mailer: b4 0.12.3 X-Developer-Signature: v=1; a=ed25519-sha256; t=1727356502; l=29203; i=s.hauer@pengutronix.de; s=20230412; h=from:subject:message-id; bh=rXqY8fTLqldiEki0BMNg3GI2uhMsm3jST7UdzjC6mQ8=; b=Mtl5FSoxPwrhuuY9LKlHPH9OwIftJgj92s1oItK9Bfk97aIRAZIE+dVahES6aWvy+ZIHwoe5y d5vVU37cuP5C1ogexthSUSIG7iYDtm8G61AB5IaUhxOkv44lFC49F3H 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-20240926_061506_265101_E0ABBFE8 X-CRM114-Status: GOOD ( 29.36 ) 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 02/13] 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