1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
5 #include <mipi/panel.h>
8 enum cb_err
mipi_panel_parse_init_commands(const void *buf
, mipi_cmd_func_t cmd_func
)
10 const struct panel_init_command
*init
= buf
;
11 enum mipi_dsi_transaction type
;
14 * The given commands should be in a buffer containing a packed array of
15 * panel_init_command and each element may be in variable size so we have
19 for (; init
->cmd
!= PANEL_CMD_END
; init
= (const void *)buf
) {
21 * For some commands like DELAY, the init->len should not be
26 u32 cmd
= init
->cmd
, len
= init
->len
;
28 if (cmd
== PANEL_CMD_DELAY
) {
37 printk(BIOS_ERR
, "%s: DCS command length 0?\n", __func__
);
40 type
= MIPI_DSI_DCS_SHORT_WRITE
;
43 type
= MIPI_DSI_DCS_SHORT_WRITE_PARAM
;
46 type
= MIPI_DSI_DCS_LONG_WRITE
;
50 case PANEL_CMD_GENERIC
:
53 type
= MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM
;
56 type
= MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM
;
59 type
= MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM
;
62 type
= MIPI_DSI_GENERIC_LONG_WRITE
;
67 printk(BIOS_ERR
, "%s: Unknown command code: %d, "
68 "abort panel initialization.\n", __func__
, cmd
);
72 enum cb_err ret
= cmd_func(type
, init
->data
, len
);
73 if (ret
!= CB_SUCCESS
)