Hung-Te Lin | 2c307a0 | 2019-02-20 14:31:23 +0800 | [diff] [blame] | 1 | /* |
| 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 Lin | 9ede2ff | 2019-08-15 09:43:55 +0800 | [diff] [blame^] | 22 | /* |
| 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 | */ |
| 27 | struct panel_serializable_data { |
Hung-Te Lin | 2c307a0 | 2019-02-20 14:31:23 +0800 | [diff] [blame] | 28 | struct edid edid; /* edid info of this panel */ |
Hung-Te Lin | 9ede2ff | 2019-08-15 09:43:55 +0800 | [diff] [blame^] | 29 | enum lb_fb_orientation orientation; /* Panel orientation */ |
| 30 | u8 init[]; /* A packed array of lcm_init_command */ |
| 31 | }; |
| 32 | |
| 33 | struct panel_description { |
| 34 | const char *name; /* Panel name for constructing CBFS file name */ |
| 35 | struct panel_serializable_data *s; |
Hung-Te Lin | 2c307a0 | 2019-02-20 14:31:23 +0800 | [diff] [blame] | 36 | void (*power_on)(void); /* Callback to turn on panel */ |
Hung-Te Lin | 2c307a0 | 2019-02-20 14:31:23 +0800 | [diff] [blame] | 37 | }; |
| 38 | |
| 39 | /* Returns the panel description from given ID. */ |
Hung-Te Lin | 9ede2ff | 2019-08-15 09:43:55 +0800 | [diff] [blame^] | 40 | struct panel_description *get_panel_description(int panel_id); |
| 41 | |
| 42 | /* Loads panel serializable data from CBFS. */ |
| 43 | struct panel_description *get_panel_from_cbfs(struct panel_description *desc); |
Hung-Te Lin | 2c307a0 | 2019-02-20 14:31:23 +0800 | [diff] [blame] | 44 | |
Hung-Te Lin | e366ba1 | 2019-08-07 16:28:08 +0800 | [diff] [blame] | 45 | #define INIT_DCS_CMD(...) \ |
| 46 | LCM_DCS_CMD, \ |
| 47 | sizeof((u8[]){__VA_ARGS__}), \ |
| 48 | __VA_ARGS__ |
Hung-Te Lin | 2c307a0 | 2019-02-20 14:31:23 +0800 | [diff] [blame] | 49 | |
Hung-Te Lin | e366ba1 | 2019-08-07 16:28:08 +0800 | [diff] [blame] | 50 | #define INIT_GENERIC_CMD(...) \ |
| 51 | LCM_GENERIC_CMD, \ |
| 52 | sizeof((u8[]){__VA_ARGS__}), \ |
| 53 | __VA_ARGS__ |
Hung-Te Lin | 2c307a0 | 2019-02-20 14:31:23 +0800 | [diff] [blame] | 54 | |
Hung-Te Lin | e366ba1 | 2019-08-07 16:28:08 +0800 | [diff] [blame] | 55 | #define INIT_DELAY_CMD(delay) \ |
| 56 | LCM_DELAY_CMD, \ |
| 57 | delay |
Hung-Te Lin | 2c307a0 | 2019-02-20 14:31:23 +0800 | [diff] [blame] | 58 | |
Hung-Te Lin | e366ba1 | 2019-08-07 16:28:08 +0800 | [diff] [blame] | 59 | #define INIT_END_CMD \ |
| 60 | LCM_END_CMD |
Hung-Te Lin | 2c307a0 | 2019-02-20 14:31:23 +0800 | [diff] [blame] | 61 | |
| 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__ */ |