From patchwork Fri Jan 16 17:14:07 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1533 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768583708; bh=qMYnX5ZVdH1pVRxG01ZqnvtAdqztLvxdiLSTAQy/YXM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=FvQbW3GGQ2rxNOnrXyc/ExeGHfz/C9xS76BeVE6Ml5yJKFQisAb4/OjVE6tpSvqKm +1bg3IjqsUygNWHoCoch8n6AJnNwR4AlMVYeXvtnQjNwnJRrc+hKIWjZC5117KpZVC Q0D2E7NbLFdEClTHX5KAp8Ncv26UiXULJDwJPQCeTKYwt1aHz8exb080tGP2LvIA4Q 3FkBBQKPwTe9IzDxW6PESBRlY6crVAgsN8tc3eYcLV3MVG2U0ncevqdf5Tv80ha2p+ IZ5UIC464TLO5//r4agRBcaD4FEjGHO09HtU7fxygMDL64Q+4wcBkyobuG1/5gXGJT xWu96QvPkSBnA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 169C4693BE for ; Fri, 16 Jan 2026 10:15:08 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id wA2_AYWJKJbl for ; Fri, 16 Jan 2026 10:15:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768583706; bh=qMYnX5ZVdH1pVRxG01ZqnvtAdqztLvxdiLSTAQy/YXM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XCFYB7NslF+z6CQQ3mAD2W5dOhtgVPaAjk+WWfstgh7X9jOJE0rFkvHb4NlOAkJqs 1yqNz7LsTmdOesz7PCgaDvzUJlWRHr0zPykeI1QjDSaI2A4adSv90CFfyPS7QJeFZZ YxzfsMi6K1FaEwD9EmG3cQlsfcX7xnqfb1ZnY7boL/6zg8w/nsybGaGeIYM1uMZdkO 9yB+yWwN/2VEt04IM1TofmG61v67huwyYAUcOcaYovfxJQTB9+skGpDxkZWrQhf6XW OICQodwySoXVB0JWEYM8lA9LSDwdBKsUC+wg8KqtJ1lK57nykCoeUhWSXaaJ4iIteA EaksJepz2jqUQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2544F693C2 for ; Fri, 16 Jan 2026 10:15:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768583703; bh=HzOFlZn46KMv2KBmOEfD1jO0HuqX4X4hlS+fS3hRCx4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LNf5BT1ME06r2rAWWpISjxtn2LgWgjaj6CLNI2+DCU3/rkSdd7XcxTtA4RjVUUK5v tYrX4wJAlij4sS/bn3vs3zsRtfYhdj354HuYEewYmKC4s84BwqqKKP8Z149YuQ6Os2 06Pu27sEZ1WbOIZsc6L6IqJlfYI6UdgyF2zZjJewth91OSRX+b+cgkSo9X9TsciUbn 2SMFzv4l0iMarp+1zXwzROJqRG/T843XI5zOmZ1SKLM8X0nJdZ6YoVcjWZ9nRGXBlW o5Hp9h8FTI+C/AhS5hO/I0Gj1VBjTBVeZUk7lzmXpaitAlIwa3jadxScqAp/Xxw7gJ r8aV7/JsPM67A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3DEE2693BE; Fri, 16 Jan 2026 10:15:03 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id 9aJC5_MEcjSh; Fri, 16 Jan 2026 10:15:03 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768583702; bh=v1k1dgQQ1i67ekfi6DoeLt/FhFnRNQ/xBUx8+jN29eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pIbpCVRr3qUYFfJYrvGdNsSZ7wMj3GUCo06RiAaxucAhmfg6QvZWMrn8WTGFSyWS1 81G+cSYOBmGFhDoR923GWNF0odZx8YIj0BBGhmWE31hZdtktB17jJ29xDdsKKJkoxG zLmqu5Q09kWPG7NUS0EuvNHnqo3Ttak0BWwU8VQHyhAWYUBIsWT21GFnsbDCI2xkHu GpRbALZVgHkqTmOmRN7Ahz8PfgCDa+oJh5Qd/cBy6gLQkUdByPxqnoCycutH7I7Y5f 2ePh3cPNBrN/hN/ye4oSVMbIu8AolgB1wxGZ5JI4XqLQVYOwRoPL7zvde+kFM9Q7D/ q9HZUsCOEqVEw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4581E693B3; Fri, 16 Jan 2026 10:15:02 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Fri, 16 Jan 2026 10:14:07 -0700 Message-ID: <20260116171424.398597-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260116171424.398597-1-sjg@u-boot.org> References: <20260116171424.398597-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: EEFMJMMHT35SP3XUN6XKKK3OVCC6SJDC X-Message-ID-Hash: EEFMJMMHT35SP3XUN6XKKK3OVCC6SJDC X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/14] video: Add a helper to obtain the vidconsole context List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add a function which returns the default context for a vidconsole. Signed-off-by: Simon Glass --- drivers/video/vidconsole-uclass.c | 7 +++++++ include/video_console.h | 20 ++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/drivers/video/vidconsole-uclass.c b/drivers/video/vidconsole-uclass.c index 8ef9f4c90d6..e282c3de557 100644 --- a/drivers/video/vidconsole-uclass.c +++ b/drivers/video/vidconsole-uclass.c @@ -1015,3 +1015,10 @@ void vidconsole_readline_end(void) } } #endif /* CURSOR */ + +void *vidconsole_ctx(struct udevice *dev) +{ + struct vidconsole_priv *uc_priv = dev_get_uclass_priv(dev); + + return &uc_priv->ctx; +} diff --git a/include/video_console.h b/include/video_console.h index adc4537ceb7..d7e74f71171 100644 --- a/include/video_console.h +++ b/include/video_console.h @@ -121,6 +121,7 @@ struct vidconsole_ctx { */ struct vidconsole_priv { struct stdio_dev sdev; + struct vidconsole_ctx ctx; int xcur_frac; int ycur; int rows; @@ -421,6 +422,25 @@ struct vidconsole_ops { /* Get a pointer to the driver operations for a video console device */ #define vidconsole_get_ops(dev) ((struct vidconsole_ops *)(dev)->driver->ops) +/** + * vidconsole_ctx() - Get the default context for a vidconsole device + * + * @dev: vidconsole device to check + * Return: pointer to context + */ +void *vidconsole_ctx(struct udevice *dev); + +/** + * vidconsole_ctx_from_priv() - Get the default context for a vidconsole device + * + * @priv: vidconsole uclass-private data + * Return: pointer to context + */ +static inline void *vidconsole_ctx_from_priv(struct vidconsole_priv *uc_priv) +{ + return &uc_priv->ctx; +} + /** * vidconsole_get_font() - Obtain information about a font *