Merge branch 'master' of git://git.denx.de/u-boot-spi
[platform/kernel/u-boot.git] / drivers / video / vidconsole-uclass.c
index 7f95e9c..2ca19d4 100644 (file)
@@ -86,7 +86,7 @@ static int vidconsole_back(struct udevice *dev)
                if (priv->ycur < 0)
                        priv->ycur = 0;
        }
-       video_sync(dev->parent);
+       video_sync(dev->parent, false);
 
        return 0;
 }
@@ -113,7 +113,7 @@ static void vidconsole_newline(struct udevice *dev)
        }
        priv->last_ch = 0;
 
-       video_sync(dev->parent);
+       video_sync(dev->parent, false);
 }
 
 static const struct vid_rgb colors[VID_COLOR_COUNT] = {
@@ -272,6 +272,14 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
                s++;    /* ; */
                s = parsenum(s, &col);
 
+               /*
+                * Video origin is [0, 0], terminal origin is [1, 1].
+                */
+               if (row)
+                       --row;
+               if (col)
+                       --col;
+
                set_cursor_position(priv, row, col);
 
                break;
@@ -293,7 +301,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
 
                if (mode == 2) {
                        video_clear(dev->parent);
-                       video_sync(dev->parent);
+                       video_sync(dev->parent, false);
                        priv->ycur = 0;
                        priv->xcur_frac = priv->xstart_frac;
                } else {
@@ -344,7 +352,7 @@ static void vidconsole_escape_char(struct udevice *dev, char ch)
                        switch (val) {
                        case 0:
                                /* all attributes off */
-                               video_set_default_colors(vid_priv);
+                               video_set_default_colors(dev->parent, false);
                                break;
                        case 1:
                                /* bold */
@@ -449,7 +457,7 @@ static void vidconsole_putc(struct stdio_dev *sdev, const char ch)
        struct udevice *dev = sdev->priv;
 
        vidconsole_put_char(dev, ch);
-       video_sync(dev->parent);
+       video_sync(dev->parent, false);
 }
 
 static void vidconsole_puts(struct stdio_dev *sdev, const char *s)
@@ -458,7 +466,7 @@ static void vidconsole_puts(struct stdio_dev *sdev, const char *s)
 
        while (*s)
                vidconsole_put_char(dev, *s++);
-       video_sync(dev->parent);
+       video_sync(dev->parent, false);
 }
 
 /* Set up the number of rows and colours (rotated drivers override this) */
@@ -511,6 +519,8 @@ void vidconsole_position_cursor(struct udevice *dev, unsigned col, unsigned row)
        struct udevice *vid_dev = dev->parent;
        struct video_priv *vid_priv = dev_get_uclass_priv(vid_dev);
 
+       col *= priv->x_charsize;
+       row *= priv->y_charsize;
        priv->xcur_frac = VID_TO_POS(min_t(short, col, vid_priv->xsize - 1));
        priv->ycur = min_t(short, row, vid_priv->ysize - 1);
 }
@@ -547,7 +557,7 @@ static int do_video_puts(cmd_tbl_t *cmdtp, int flag, int argc,
        for (s = argv[1]; *s; s++)
                vidconsole_put_char(dev, *s);
 
-       video_sync(dev->parent);
+       video_sync(dev->parent, false);
 
        return 0;
 }