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>
This commit is contained in:
Julius Werner
2021-09-08 17:58:34 -07:00
parent ab7006e4c4
commit 4757a7ea33
9 changed files with 188 additions and 296 deletions

View File

@@ -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:
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:
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:
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;