summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2025-04-02 06:29:33 +1300
committerTom Rini <trini@konsulko.com>2025-05-02 13:40:25 -0600
commit3ad5f49b5db4337626004629842d3dea30467c92 (patch)
tree69750f930abdf9a1ea05df347db979eb535c489b /drivers
parentfe2d4d4cef093d24da389fda29a556b15c84829b (diff)
video: Make white-on-black a video-device property
The CONFIG_WHITE_ON_BLACK setting is hard-coded at build-time. It is useful to be able to control this when showing menus. Create a property to hold this information, using the CONFIG as the initial value. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/video-uclass.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/video/video-uclass.c b/drivers/video/video-uclass.c
index 503cdb9f025..1c372bd58b7 100644
--- a/drivers/video/video-uclass.c
+++ b/drivers/video/video-uclass.c
@@ -345,7 +345,7 @@ void video_set_default_colors(struct udevice *dev, bool invert)
struct video_priv *priv = dev_get_uclass_priv(dev);
int fore, back;
- if (CONFIG_IS_ENABLED(SYS_WHITE_ON_BLACK)) {
+ if (priv->white_on_black) {
/* White is used when switching to bold, use light gray here */
fore = VID_LIGHT_GRAY;
back = VID_BLACK;
@@ -582,6 +582,18 @@ static void video_idle(struct cyclic_info *cyc)
video_sync_all();
}
+void video_set_white_on_black(struct udevice *dev, bool white_on_black)
+{
+ struct video_priv *priv = dev_get_uclass_priv(dev);
+
+ if (priv->white_on_black != white_on_black) {
+ priv->white_on_black = white_on_black;
+ video_set_default_colors(dev, false);
+
+ video_clear(dev);
+ }
+}
+
/* Set up the display ready for use */
static int video_post_probe(struct udevice *dev)
{
@@ -624,6 +636,8 @@ static int video_post_probe(struct udevice *dev)
if (IS_ENABLED(CONFIG_VIDEO_COPY) && plat->copy_base)
priv->copy_fb = map_sysmem(plat->copy_base, plat->size);
+ priv->white_on_black = CONFIG_IS_ENABLED(SYS_WHITE_ON_BLACK);
+
/* Set up colors */
video_set_default_colors(dev, false);