aboutsummaryrefslogtreecommitdiff
path: root/src/include
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2021-08-12 16:48:12 -0700
committerFelix Held <felix-coreboot@felixheld.de>2021-08-18 14:21:28 +0000
commitb2a14801916ad9dfa2a6b4fa9ceb6de7d2d03e24 (patch)
tree75788742da59525637ea977bcb419891f98d0c2e /src/include
parent4080e08c09a4f063ed1df280e74fa2b87d304b87 (diff)
device: Move MIPI panel library from mainboard/google/kukui into common
All boards that are trying to use MIPI panels eventually run into the problem that they need to store physical parameters and a list of DCS initialization commands for each panel, and these commands can be very different (e.g. a large amount of very short commands, a few very large commands, etc.). Finding a data format to fit all these different cases efficiently into the same structures keeps being a challenge, and the Kukui mainboard already once put a lot of effort into designing a clean, flexible and efficient solution for this. This patch moves that framework into a common src/device/mipi/ library where it can be used by other boards as well. (Also, this will hopefully allow us to save some duplicated work when using the same panel on different boards at some point.) Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I877f2b0c7ab984412b288e2ed27f37cd93c70863 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56965 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Yu-Ping Wu <yupingso@google.com> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'src/include')
-rw-r--r--src/include/device/mipi_panel.h56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/include/device/mipi_panel.h b/src/include/device/mipi_panel.h
new file mode 100644
index 0000000000..95fcb69633
--- /dev/null
+++ b/src/include/device/mipi_panel.h
@@ -0,0 +1,56 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef __DEVICE_MIPI_PANEL_H__
+#define __DEVICE_MIPI_PANEL_H__
+
+#include <edid.h>
+#include <types.h>
+
+/* Definitions for cmd in panel_init_command */
+enum panel_init_cmd {
+ PANEL_CMD_END = 0,
+ PANEL_CMD_DELAY = 1,
+ PANEL_CMD_GENERIC = 2,
+ PANEL_CMD_DCS = 3,
+};
+
+struct panel_init_command {
+ u8 cmd;
+ u8 len;
+ u8 data[];
+};
+
+/*
+ * The data to be serialized and put into CBFS.
+ * Note some fields, for example edid.mode.name, were actually pointers and
+ * cannot be really serialized.
+ */
+struct panel_serializable_data {
+ struct edid edid; /* edid info of this panel */
+ enum lb_fb_orientation orientation; /* Panel orientation */
+ u8 init[]; /* A packed array of panel_init_command */
+};
+
+typedef cb_err_t (*mipi_cmd_func_t)(enum panel_init_cmd cmd, const u8 *data, u8 len);
+
+/* Parse a command array and call cmd_func() for each entry. Delays get handled internally. */
+cb_err_t mipi_panel_parse_init_commands(const void *buf, mipi_cmd_func_t cmd_func);
+
+#define PANEL_DCS(...) \
+ PANEL_CMD_DCS, \
+ sizeof((u8[]){__VA_ARGS__}), \
+ __VA_ARGS__
+
+#define PANEL_GENERIC(...) \
+ PANEL_CMD_GENERIC, \
+ sizeof((u8[]){__VA_ARGS__}), \
+ __VA_ARGS__
+
+#define PANEL_DELAY(delay) \
+ PANEL_CMD_DELAY, \
+ delay
+
+#define PANEL_END \
+ PANEL_CMD_END
+
+#endif /* __DEVICE_MIPI_PANEL_H__ */