summaryrefslogtreecommitdiffstats
path: root/src/drivers/mipi
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2021-09-08 17:58:34 -0700
committerJulius Werner <jwerner@chromium.org>2021-09-11 01:42:47 +0000
commit4757a7ea3390db9fb3a9147d43eeb7ac00eba45c (patch)
tree30fec2fcc2eb9c0fae98a9e482e1f31de68dbac3 /src/drivers/mipi
parentab7006e4c41bb6f8ed5dd809b4239c43393a8097 (diff)
downloadcoreboot-4757a7ea3390db9fb3a9147d43eeb7ac00eba45c.tar.gz
coreboot-4757a7ea3390db9fb3a9147d43eeb7ac00eba45c.tar.bz2
coreboot-4757a7ea3390db9fb3a9147d43eeb7ac00eba45c.zip
mipi: Make panel init callback work directly on DSI transaction types
Our MIPI panel initialization framework differentiates between DCS and GENERIC commands, but the exact interpretation of those terms is left to the platform drivers. In practice, the MIPI DSI transaction codes for these are standardized and platforms always need to do the same operation of combining the command length and transfer type into a correct DSI protocol code. This patch factors out the various platform-specific DSI protocol definitions into a single global one and moves the transaction type calculation into the common panel framework. The Qualcomm SC7180 implementation which previously only supported DCS commands is enhanced to (hopefully? untested for now...) also support GENERIC commands. While we're rewriting that whole section also fix some other issues about how exactly long and short commands need to be passed to that hardware which we identified in the meantime. Signed-off-by: Julius Werner <jwerner@chromium.org> Change-Id: I09ade7857ca04e89d286cf538b1a5ebb1eeb8c04 Reviewed-on: https://review.coreboot.org/c/coreboot/+/57150 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
Diffstat (limited to 'src/drivers/mipi')
-rw-r--r--src/drivers/mipi/panel.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/src/drivers/mipi/panel.c b/src/drivers/mipi/panel.c
index e8469a6e3612..f1d87c32d12f 100644
--- a/src/drivers/mipi/panel.c
+++ b/src/drivers/mipi/panel.c
@@ -7,6 +7,7 @@
cb_err_t mipi_panel_parse_init_commands(const void *buf, mipi_cmd_func_t cmd_func)
{
const struct panel_init_command *init = buf;
+ enum mipi_dsi_transaction type;
/*
* The given commands should be in a buffer containing a packed array of
@@ -23,25 +24,54 @@ cb_err_t mipi_panel_parse_init_commands(const void *buf, mipi_cmd_func_t cmd_fun
u32 cmd = init->cmd, len = init->len;
- switch (cmd) {
- case PANEL_CMD_DELAY:
+ if (cmd == PANEL_CMD_DELAY) {
mdelay(len);
- break;
+ continue;
+ }
+ switch (cmd) {
case PANEL_CMD_DCS:
+ switch (len) {
+ case 0:
+ printk(BIOS_ERR, "%s: DCS command length 0?\n", __func__);
+ return CB_ERR;
+ case 1:
+ type = MIPI_DSI_DCS_SHORT_WRITE;
+ break;
+ case 2:
+ type = MIPI_DSI_DCS_SHORT_WRITE_PARAM;
+ break;
+ default:
+ type = MIPI_DSI_DCS_LONG_WRITE;
+ break;
+ }
+ break;
case PANEL_CMD_GENERIC:
- buf += len;
-
- cb_err_t ret = cmd_func(cmd, init->data, len);
- if (ret != CB_SUCCESS)
- return ret;
+ switch (len) {
+ case 0:
+ type = MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM;
+ break;
+ case 1:
+ type = MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM;
+ break;
+ case 2:
+ type = MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM;
+ break;
+ default:
+ type = MIPI_DSI_GENERIC_LONG_WRITE;
+ break;
+ }
break;
-
default:
printk(BIOS_ERR, "%s: Unknown command code: %d, "
"abort panel initialization.\n", __func__, cmd);
return CB_ERR;
}
+
+ cb_err_t ret = cmd_func(type, init->data, len);
+ if (ret != CB_SUCCESS)
+ return ret;
+ buf += len;
}
return CB_SUCCESS;