blob: 0156cd68bf436ba72d3950b4fcad1ed50361e37f [file] [log] [blame]
Hung-Te Lin2c307a02019-02-20 14:31:23 +08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright 2019 Huaqin Telecom Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; version 2 of the License.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#ifndef __MAINBOARD_GOOGLE_KUKUI_PANEL_H__
17#define __MAINBOARD_GOOGLE_KUKUI_PANEL_H__
18
19#include <edid.h>
20#include <soc/dsi.h>
21
Hung-Te Lin9ede2ff2019-08-15 09:43:55 +080022/*
23 * The data that to be serialized and put into CBFS.
24 * Note some fields, for example edid.mode.name, were actually pointers and
25 * cannot be really serialized.
26 */
27struct panel_serializable_data {
Hung-Te Lin2c307a02019-02-20 14:31:23 +080028 struct edid edid; /* edid info of this panel */
Hung-Te Lin9ede2ff2019-08-15 09:43:55 +080029 enum lb_fb_orientation orientation; /* Panel orientation */
30 u8 init[]; /* A packed array of lcm_init_command */
31};
32
33struct panel_description {
34 const char *name; /* Panel name for constructing CBFS file name */
35 struct panel_serializable_data *s;
Hung-Te Lin2c307a02019-02-20 14:31:23 +080036 void (*power_on)(void); /* Callback to turn on panel */
Hung-Te Lin2c307a02019-02-20 14:31:23 +080037};
38
39/* Returns the panel description from given ID. */
Hung-Te Lin9ede2ff2019-08-15 09:43:55 +080040struct panel_description *get_panel_description(int panel_id);
41
42/* Loads panel serializable data from CBFS. */
43struct panel_description *get_panel_from_cbfs(struct panel_description *desc);
Hung-Te Lin2c307a02019-02-20 14:31:23 +080044
Hung-Te Line366ba12019-08-07 16:28:08 +080045#define INIT_DCS_CMD(...) \
46 LCM_DCS_CMD, \
47 sizeof((u8[]){__VA_ARGS__}), \
48 __VA_ARGS__
Hung-Te Lin2c307a02019-02-20 14:31:23 +080049
Hung-Te Line366ba12019-08-07 16:28:08 +080050#define INIT_GENERIC_CMD(...) \
51 LCM_GENERIC_CMD, \
52 sizeof((u8[]){__VA_ARGS__}), \
53 __VA_ARGS__
Hung-Te Lin2c307a02019-02-20 14:31:23 +080054
Hung-Te Line366ba12019-08-07 16:28:08 +080055#define INIT_DELAY_CMD(delay) \
56 LCM_DELAY_CMD, \
57 delay
Hung-Te Lin2c307a02019-02-20 14:31:23 +080058
Hung-Te Line366ba12019-08-07 16:28:08 +080059#define INIT_END_CMD \
60 LCM_END_CMD
Hung-Te Lin2c307a02019-02-20 14:31:23 +080061
62/* GPIO names */
63#define GPIO_LCM_RST_1V8 GPIO(LCM_RST) /* 45 */
64#define GPIO_MIPIBRDG_PWRDN_L_1V8 GPIO(LCM_RST) /* 45 */
65#define GPIO_MIPIBRDG_RST_L_1V8 GPIO(BPI_BUS3) /* 73 */
66#define GPIO_PP1200_MIPIBRDG_EN GPIO(BPI_OLAT1) /* 54 */
67#define GPIO_PP1800_LCM_EN GPIO(SIM2_SRST) /* 36 */
68#define GPIO_PP3300_LCM_EN GPIO(SIM2_SIO) /* 35 */
69#define GPIO_PPVARN_LCD_EN GPIO(PERIPHERAL_EN9) /* 166 */
70#define GPIO_PPVARP_LCD_EN GPIO(MISC_BSI_CK_3) /* 66 */
71#define GPIO_VDDIO_MIPIBRDG_EN GPIO(SIM2_SCLK) /* 37 */
72
73#endif /* __MAINBOARD_GOOGLE_KUKUI_PANEL_H__ */