Skip to contentSkip to conversation

video: simplefb: Add rotation support

PATCH Superseded Takumi Sueda 2 participants 3 messages Sep 12, 2022 – Sep 13, 2022 Framebuffer layer

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 video: simplefb: Add rotation support

It introduces the way to rotate the screen for boards with rotated screen.

---
 drivers/video/simplefb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/video/simplefb.c +5 -1
index 2b0d8835e3..dbf55ba64d 100644
@@ -43,7 +43,11 @@ static int simple_video_probe(struct udevice *dev)
 
 	uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
 	uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
-	uc_priv->rot = 0;
+	uc_priv->rot = fdtdec_get_uint(blob, node, "rot", 0);
+	if (uc_priv->rot > 3) {
+		printf("%s: invalid rot\n", __func__);
+		return -EINVAL;
+	}
 
 	format = fdt_getprop(blob, node, "format", NULL);
 	debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, format);
Signature · 1 line
2.20.1
#1 lore raw
Quoted 13 lines · Takumi Sueda

It introduces the way to rotate the screen for boards with rotated screen.

---
 drivers/video/simplefb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/video/simplefb.c +0 -0
index 2b0d8835e3..dbf55ba64d 100644

drivers/video/simplefb.c static int simple_video_probe(struct udevice *dev) · line 48

Quoted 7 lines
drivers/video/simplefb.c +3 -1
@@ -43,7 +43,11 @@ static int simple_video_probe(struct udevice *dev)
 
        uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
        uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
-       uc_priv->rot = 0;
+       uc_priv->rot = fdtdec_get_uint(blob, node, "rot", 0);
+       if (uc_priv->rot > 3) {
+               printf("%s: invalid rot\n", __func__);

log_debug()

This is a driver so should not print messages

drivers/video/simplefb.c static int simple_video_probe(struct udevice *dev) · line 49

Quoted 1 line
drivers/video/simplefb.c +1 -0
+               return -EINVAL;

You can use

return log_msg_ret("rot", -EINVAL)

if you like, since then it could be logged when
CONFIG_LOG_ERROR_RETURN is enabled.

Quoted 7 lines
drivers/video/simplefb.c +1 -1
+       }
 
        format = fdt_getprop(blob, node, "format", NULL);
        debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, format);
--

2.20.1

Regards,
Simon

#2 lore raw
Quoted 37 lines · Simon Glass
Quoted 13 lines · Takumi Sueda

It introduces the way to rotate the screen for boards with rotated screen.

---
 drivers/video/simplefb.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/video/simplefb.c +0 -0
index 2b0d8835e3..dbf55ba64d 100644

drivers/video/simplefb.c static int simple_video_probe(struct udevice *dev) · line 48

Quoted 7 lines
drivers/video/simplefb.c +3 -1
@@ -43,7 +43,11 @@ static int simple_video_probe(struct udevice *dev)
 
        uc_priv->xsize = fdtdec_get_uint(blob, node, "width", 0);
        uc_priv->ysize = fdtdec_get_uint(blob, node, "height", 0);
-       uc_priv->rot = 0;
+       uc_priv->rot = fdtdec_get_uint(blob, node, "rot", 0);
+       if (uc_priv->rot > 3) {
+               printf("%s: invalid rot\n", __func__);

log_debug()

This is a driver so should not print messages

drivers/video/simplefb.c static int simple_video_probe(struct udevice *dev) · line 49

Quoted 1 line
drivers/video/simplefb.c +1 -0
+               return -EINVAL;

You can use

return log_msg_ret("rot", -EINVAL)

if you like, since then it could be logged when
CONFIG_LOG_ERROR_RETURN is enabled.

Quoted 2 lines
drivers/video/simplefb.c +1 -0
+       }
 
Quoted 8 lines
Quoted 5 lines
drivers/video/simplefb.c +0 -1
        format = fdt_getprop(blob, node, "format", NULL);
        debug("%s: %dx%d@%s\n", __func__, uc_priv->xsize, uc_priv->ysize, format);
--

2.20.1

Regards,
Simon

Hi Simon, thanks for the review.

The printf() was copied from the next error return, but the method you proposed me sounds better for debugging since printf() is uncontrollable.

I'll send a v2 patch later.

Thanks again,
Takumi