coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
panel.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #include <console/console.h>
4 #include <delay.h>
5 #include <mipi/panel.h>
6 
8 {
9  const struct panel_init_command *init = buf;
11 
12  /*
13  * The given commands should be in a buffer containing a packed array of
14  * panel_init_command and each element may be in variable size so we have
15  * to parse and scan.
16  */
17 
18  for (; init->cmd != PANEL_CMD_END; init = (const void *)buf) {
19  /*
20  * For some commands like DELAY, the init->len should not be
21  * counted for buf.
22  */
23  buf += sizeof(*init);
24 
25  u32 cmd = init->cmd, len = init->len;
26 
27  if (cmd == PANEL_CMD_DELAY) {
28  mdelay(len);
29  continue;
30  }
31 
32  switch (cmd) {
33  case PANEL_CMD_DCS:
34  switch (len) {
35  case 0:
36  printk(BIOS_ERR, "%s: DCS command length 0?\n", __func__);
37  return CB_ERR;
38  case 1:
40  break;
41  case 2:
43  break;
44  default:
46  break;
47  }
48  break;
49  case PANEL_CMD_GENERIC:
50  switch (len) {
51  case 0:
53  break;
54  case 1:
56  break;
57  case 2:
59  break;
60  default:
62  break;
63  }
64  break;
65  default:
66  printk(BIOS_ERR, "%s: Unknown command code: %d, "
67  "abort panel initialization.\n", __func__, cmd);
68  return CB_ERR;
69  }
70 
71  enum cb_err ret = cmd_func(type, init->data, len);
72  if (ret != CB_SUCCESS)
73  return ret;
74  buf += len;
75  }
76 
77  return CB_SUCCESS;
78 }
cb_err
coreboot error codes
Definition: cb_err.h:15
@ CB_ERR
Generic error code.
Definition: cb_err.h:17
@ CB_SUCCESS
Call completed successfully.
Definition: cb_err.h:16
#define printk(level,...)
Definition: stdlib.h:16
void mdelay(unsigned int msecs)
Definition: delay.c:2
static void init(struct device *dev)
This function is the driver entry point for the init phase of the PCI bus allocator.
Definition: i210.c:181
mipi_dsi_transaction
Definition: dsi.h:7
@ MIPI_DSI_GENERIC_SHORT_WRITE_1_PARAM
Definition: dsi.h:19
@ MIPI_DSI_DCS_LONG_WRITE
Definition: dsi.h:38
@ MIPI_DSI_DCS_SHORT_WRITE_PARAM
Definition: dsi.h:27
@ MIPI_DSI_GENERIC_LONG_WRITE
Definition: dsi.h:37
@ MIPI_DSI_DCS_SHORT_WRITE
Definition: dsi.h:26
@ MIPI_DSI_GENERIC_SHORT_WRITE_0_PARAM
Definition: dsi.h:18
@ MIPI_DSI_GENERIC_SHORT_WRITE_2_PARAM
Definition: dsi.h:20
@ PANEL_CMD_DCS
Definition: panel.h:15
@ PANEL_CMD_GENERIC
Definition: panel.h:14
@ PANEL_CMD_END
Definition: panel.h:12
@ PANEL_CMD_DELAY
Definition: panel.h:13
enum cb_err(* mipi_cmd_func_t)(enum mipi_dsi_transaction type, const u8 *data, u8 len)
Definition: panel.h:34
unsigned int type
Definition: edid.c:57
#define BIOS_ERR
BIOS_ERR - System in incomplete state.
Definition: loglevel.h:72
static uint8_t * buf
Definition: uart.c:7
enum cb_err mipi_panel_parse_init_commands(const void *buf, mipi_cmd_func_t cmd_func)
Definition: panel.c:7
uint32_t u32
Definition: stdint.h:51