diff options
Diffstat (limited to 'src/soc/mediatek/common/dsi.c')
-rw-r--r-- | src/soc/mediatek/common/dsi.c | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/src/soc/mediatek/common/dsi.c b/src/soc/mediatek/common/dsi.c index 166bc17eee..679bec8d75 100644 --- a/src/soc/mediatek/common/dsi.c +++ b/src/soc/mediatek/common/dsi.c @@ -321,12 +321,25 @@ static void mtk_dsi_cmdq(const u8 *data, u8 len, u32 type) } } -static void mtk_dsi_send_init_commands(const struct lcm_init_command *init) +static void mtk_dsi_send_init_commands(const u8 *buf) { - if (!init) + if (!buf) return; + const struct lcm_init_command *init = (const void *)buf; + + /* + * The given commands should be in a buffer containing a packed array of + * lcm_init_command and each element may be in variable size so we have + * to parse and scan. + */ + + for (; init->cmd != LCM_END_CMD; init = (const void *)buf) { + /* + * For some commands like DELAY, the init->len should not be + * counted for buf. + */ + buf += sizeof(*init); - for (; init->cmd != LCM_END_CMD; init++) { u32 cmd = init->cmd, len = init->len; u32 type; @@ -374,13 +387,13 @@ static void mtk_dsi_send_init_commands(const struct lcm_init_command *init) return; } - assert(len <= sizeof(init->data)); + buf += len; mtk_dsi_cmdq(init->data, len, type); } } int mtk_dsi_init(u32 mode_flags, u32 format, u32 lanes, const struct edid *edid, - const struct lcm_init_command *init_commands) + const u8 *init_commands) { int data_rate; u32 bits_per_pixel = mtk_dsi_get_bits_per_pixel(format); |