video: simplefb: Add rotation support
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
@@ -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
Quoted 13 lines · Takumi Sueda
It introduces the way to rotate the screen for boards with rotated screen.
Signed-off-by Takumi Sueda <[email protected]>--- drivers/video/simplefb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/video/simplefb.c +0
-0
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 whenCONFIG_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
Quoted 37 lines · Simon Glass
Quoted 13 lines · Takumi Sueda
It introduces the way to rotate the screen for boards with rotated screen.
Signed-off-by Takumi Sueda <[email protected]>--- drivers/video/simplefb.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/video/simplefb.c +0
-0drivers/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_RETURNis enabled.Quoted 2 lines
drivers/video/simplefb.c +1
-0+ }
Quoted 8 lines
Quoted 5 lines
drivers/video/simplefb.c +0
-1format =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