video: Move console colours to the video uclass
At present these are attached to vidconsole which means that the video
uclass requires that a console is enabled. This is not the intention.
The colours are a reasonable way of indexing common colours in any case,
so move them to the video uclass instead.
Rename vid_console_color() to video_index_to_colour() now that it is more
generic. Also fix the inconsistent spelling in these functions.
Signed-off-by: Simon Glass <sjg@chromium.org>
diff --git a/include/video.h b/include/video.h
index 43e2c89..1c30aea7 100644
--- a/include/video.h
+++ b/include/video.h
@@ -131,6 +131,41 @@
#define video_get_ops(dev) ((struct video_ops *)(dev)->driver->ops)
+/** enum colour_idx - the 16 colors supported by consoles */
+enum colour_idx {
+ VID_BLACK = 0,
+ VID_RED,
+ VID_GREEN,
+ VID_BROWN,
+ VID_BLUE,
+ VID_MAGENTA,
+ VID_CYAN,
+ VID_LIGHT_GRAY,
+ VID_GRAY,
+ VID_LIGHT_RED,
+ VID_LIGHT_GREEN,
+ VID_YELLOW,
+ VID_LIGHT_BLUE,
+ VID_LIGHT_MAGENTA,
+ VID_LIGHT_CYAN,
+ VID_WHITE,
+
+ VID_COLOUR_COUNT
+};
+
+/**
+ * video_index_to_colour() - convert a color code to a pixel's internal
+ * representation
+ *
+ * The caller has to guarantee that the color index is less than
+ * VID_COLOR_COUNT.
+ *
+ * @priv private data of the console device
+ * @idx color index
+ * Return: color value
+ */
+u32 video_index_to_colour(struct video_priv *priv, unsigned int idx);
+
/**
* video_reserve() - Reserve frame-buffer memory for video devices
*