Merge tag 'mips-pull-2020-06-29' of https://gitlab.denx.de/u-boot/custodians/u-boot...
[platform/kernel/u-boot.git] / drivers / video / vidconsole-uclass.c
index 75c7e25..3f20f70 100644 (file)
@@ -8,6 +8,8 @@
  */
 
 #include <common.h>
+#include <command.h>
+#include <log.h>
 #include <linux/ctype.h>
 #include <dm.h>
 #include <video.h>
@@ -144,22 +146,26 @@ u32 vid_console_color(struct video_priv *priv, unsigned int idx)
                               ((colors[idx].g >> 2) <<  5) |
                               ((colors[idx].b >> 3) <<  0);
                }
+               break;
        case VIDEO_BPP32:
                if (CONFIG_IS_ENABLED(VIDEO_BPP32)) {
                        return (colors[idx].r << 16) |
                               (colors[idx].g <<  8) |
                               (colors[idx].b <<  0);
                }
+               break;
        default:
-               /*
-                * For unknown bit arrangements just support
-                * black and white.
-                */
-               if (idx)
-                       return 0xffffff; /* white */
-               else
-                       return 0x000000; /* black */
+               break;
        }
+
+       /*
+        * For unknown bit arrangements just support
+        * black and white.
+        */
+       if (idx)
+               return 0xffffff; /* white */
+
+       return 0x000000; /* black */
 }
 
 static char *parsenum(char *s, int *num)
@@ -607,6 +613,7 @@ UCLASS_DRIVER(vidconsole) = {
        .per_device_auto_alloc_size     = sizeof(struct vidconsole_priv),
 };
 
+#if CONFIG_IS_ENABLED(CMD_VIDCONSOLE)
 void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row)
 {
        struct vidconsole_priv *priv = dev_get_uclass_priv(dev);
@@ -616,10 +623,11 @@ void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row)
        col *= priv->x_charsize;
        row *= priv->y_charsize;
        priv->xcur_frac = VID_TO_POS(min_t(short, col, vid_priv->xsize - 1));
+       priv->xstart_frac = priv->xcur_frac;
        priv->ycur = min_t(short, row, vid_priv->ysize - 1);
 }
 
-static int do_video_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_video_setcursor(struct cmd_tbl *cmdtp, int flag, int argc,
                              char *const argv[])
 {
        unsigned int col, row;
@@ -637,7 +645,7 @@ static int do_video_setcursor(cmd_tbl_t *cmdtp, int flag, int argc,
        return 0;
 }
 
-static int do_video_puts(cmd_tbl_t *cmdtp, int flag, int argc,
+static int do_video_puts(struct cmd_tbl *cmdtp, int flag, int argc,
                         char *const argv[])
 {
        struct udevice *dev;
@@ -667,3 +675,4 @@ U_BOOT_CMD(
        "print string on video framebuffer",
        "    <string>"
 );
+#endif /* CONFIG_IS_ENABLED(CMD_VIDCONSOLE) */