diff options
author | Julius Werner <jwerner@chromium.org> | 2021-09-08 17:58:34 -0700 |
---|---|---|
committer | Julius Werner <jwerner@chromium.org> | 2021-09-11 01:42:47 +0000 |
commit | 4757a7ea3390db9fb3a9147d43eeb7ac00eba45c (patch) | |
tree | 30fec2fcc2eb9c0fae98a9e482e1f31de68dbac3 /src/soc/qualcomm | |
parent | ab7006e4c41bb6f8ed5dd809b4239c43393a8097 (diff) |
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/soc/qualcomm')
-rw-r--r-- | src/soc/qualcomm/sc7180/display/dsi.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/src/soc/qualcomm/sc7180/display/dsi.c b/src/soc/qualcomm/sc7180/display/dsi.c index e9bd702159..15d36ed0b8 100644 --- a/src/soc/qualcomm/sc7180/display/dsi.c +++ b/src/soc/qualcomm/sc7180/display/dsi.c @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ +#include <mipi/dsi.h> #include <mipi/panel.h> #include <device/mmio.h> #include <console/console.h> @@ -210,7 +211,7 @@ static int mdss_dsi_cmd_dma_trigger_for_panel(void) return status; } -static cb_err_t mdss_dsi_send_init_cmd(enum panel_init_cmd cmd, const u8 *body, u8 len) +static cb_err_t mdss_dsi_send_init_cmd(enum mipi_dsi_transaction type, const u8 *body, u8 len) { uint8_t *pload = _dma_coherent; uint32_t size; @@ -218,14 +219,24 @@ static cb_err_t mdss_dsi_send_init_cmd(enum panel_init_cmd cmd, const u8 *body, int data = 0; uint32_t *bp = NULL; - /* This implementation only supports DCS commands (I think?). */ - assert(cmd == PANEL_CMD_DCS); - - /* The payload size has to be a multiple of 4 */ - memcpy(pload, body, len); - size = ALIGN_UP(len, DSI_PAYLOAD_SIZE_ALIGN); - memset(pload + len, 0xff, size - len); - assert(size < DSI_PAYLOAD_BYTE_BOUND); + if (len > 2) { + pload[0] = len; + pload[1] = 0; + pload[2] = type; + pload[3] = BIT(7) | BIT(6); + + /* The payload size has to be a multiple of 4 */ + memcpy(pload + 4, body, len); + size = ALIGN_UP(len + 4, DSI_PAYLOAD_SIZE_ALIGN); + memset(pload + 4 + len, 0, size - 4 - len); + assert(size < DSI_PAYLOAD_BYTE_BOUND); + } else { + pload[0] = body[0]; + pload[1] = len > 1 ? body[1] : 0; + pload[2] = type; + pload[3] = BIT(7); + size = 4; + } bp = (uint32_t *)pload; |