Peichao Li has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/34505 )
Change subject: mediatek/mt8183: add a new panel configuration for Kodama ......................................................................
mediatek/mt8183: add a new panel configuration for Kodama
BUG=b:138156559 TEST=panel should be working properly in the coreboot phase
Signed-off-by: Peichao Wang peichao.wang@bitland.corp-partner.google.com Change-Id: I129cb6bf084b76da3ad33b7a19e38e884442b1aa --- M src/mainboard/google/kukui/Makefile.inc A src/mainboard/google/kukui/display.h A src/mainboard/google/kukui/panel_kodama.c 3 files changed, 569 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/05/34505/1
diff --git a/src/mainboard/google/kukui/Makefile.inc b/src/mainboard/google/kukui/Makefile.inc index a0556c1..5f01134 100644 --- a/src/mainboard/google/kukui/Makefile.inc +++ b/src/mainboard/google/kukui/Makefile.inc @@ -22,6 +22,10 @@
ramstage-y += boardid.c ramstage-y += chromeos.c +ramstage-y += display.c +ramstage-$(CONFIG_BOARD_GOOGLE_KUKUI) += panel_kukui.c +ramstage-$(CONFIG_BOARD_GOOGLE_KRANE) += panel_krane.c +ramstage-$(CONFIG_BOARD_GOOGLE_KODAMA) += panel_kodama.c ramstage-y += mainboard.c ramstage-y += memlayout.ld ramstage-y += reset.c diff --git a/src/mainboard/google/kukui/display.h b/src/mainboard/google/kukui/display.h new file mode 100644 index 0000000..8e0f10a --- /dev/null +++ b/src/mainboard/google/kukui/display.h @@ -0,0 +1,119 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 Bitland Tech Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef __MAINBOARD_GOOGLE_DISPLAY_H__ +#define __MAINBOARD_GOOGLE_DISPLAY_H__ + +#include <soc/dsi.h> +#include <soc/gpio.h> + +#define MAKE_AS_A_STRING(arg) #arg + +enum kukui_panel_id { + PANEL_KUKUI_FIRST = 0, + PANEL_KUKUI_INNOLUX = 0, + PANEL_KUKUI_P097PFG_SSD2858, + PANEL_KUKUI_UNKNOWN, + PANEL_KUKUI_COUNT, + PANEL_KUKUI_UNINITIALIZED +}; + +enum krane_panel_id { + PANEL_KRANE_FIRST = 0, + PANEL_KRANE_BOE_TV101WUM_NL6, + PANEL_KRANE_UNKNOWN, + PANEL_KRANE_COUNT, + PANEL_KRANE_UNINITIALIZED +}; + +enum flapjack_panel_id { + PANEL_FLAPJACK_FIRST = 0, + PANEL_FLAPJACK_BOE_TV101WUM_NG0, + PANEL_FLAPJACK_BOE_TV080WUM_NG0, + PANEL_FLAPJACK_INX_OTA7290D10P, + PANEL_FLAPJACK_AUO_NT51021D8P, + PANEL_FLAPJACK_UNKNOWN, + PANEL_FLAPJACK_COUNT, + PANEL_FLAPJACK_UNINITIALIZED +}; + +enum kodama_panel_id { + PANEL_KODAMA_FIRST = 0, + PANEL_KODAMA_BOE_TV101WUM_NL6, + PANEL_KODAMA_UNKNOWN, + PANEL_KODAMA_COUNT, + PANEL_KODAMA_UNINITIALIZED +}; + +union panel_id { + enum kukui_panel_id kukui_panel; + enum krane_panel_id krane_panel; + enum flapjack_panel_id flapjack_panel; + enum kodama_panel_id kodama_panel; + int value; +}; + +struct panel_info { + union panel_id disp_id; /* the ID for panel */ + const char *panel_name; /* display panel name */ + int voltage; /* voltage of LCM_ID */ + struct edid *edid; /* edid info of this panel */ + struct lcm_init_table *init_table; /* init command table */ + u32 table_size; /* init command table size */ +}; + +#define PANEL(_panel_id, _voltage, _edid, _init_table) \ + { \ + .disp_id = {_panel_id},\ + .panel_name = MAKE_AS_A_STRING(_panel_id),\ + .voltage = _voltage,\ + .edid = &_edid,\ + .init_table = _init_table,\ + .table_size = ARRAY_SIZE(_init_table)} \ + + +struct board_display_intf { + const char *board; /* board name */ + struct panel_info *all_panel_info; /* all supported panel info */ + u32 all_panel_info_size; /* num of supported panel */ + /* + * Runtime member + */ + struct panel_info *cur_panel_info; /* detected panel info */ + /* + * board related functions + */ + + union panel_id (*get_panel_id)(struct board_display_intf *intf); + bool (*is_panel_id_valid)(union panel_id id); + int (*backlight)(struct board_display_intf *intf); + int (*power)(struct board_display_intf *intf); +}; + +/* + * Exported functions + */ + +struct board_display_intf *get_current_display_intf(void); +int update_panel_info(struct board_display_intf *intf); +void display_startup(struct board_display_intf *intf); + + +/* + * Panel Interface for boards + */ +extern struct board_display_intf panel_display_intf; + +#endif diff --git a/src/mainboard/google/kukui/panel_kodama.c b/src/mainboard/google/kukui/panel_kodama.c new file mode 100644 index 0000000..b8e6338 --- /dev/null +++ b/src/mainboard/google/kukui/panel_kodama.c @@ -0,0 +1,446 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 Bitland Tech Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <console/console.h> +#include <delay.h> +#include <device/device.h> +#include <edid.h> +#include <gpio.h> +#include <soc/auxadc.h> +#include <soc/ddp.h> +#include <soc/dsi.h> +#include <soc/gpio.h> +#include <boardid.h> + +#include "display.h" +#include "gpio.h" + +#define KODAMA_PANEL_ADC_ID 2 +#define KODAMA_PANEL_ID_BIT_POSITION 16 + +const int tolerance = 82000; /* 82,000 uV */ + +/* Kodama BOE tv101wum-NL6 panel : PANEL_KODAMA_BOE_TV101WUM_NL6 */ +static struct edid kodama_boe_tv101wum_edid = { + .panel_bits_per_color = 8, + .panel_bits_per_pixel = 24, + .mode = { + .name = "1200x1920@60Hz", + .pixel_clock = 159425, + .lvds_dual_channel = 0, + .refresh = 60, + .ha = 1200, .hbl = 143, .hso = 110, .hspw = 1, .hborder = 0, + .va = 1920, .vbl = 26, .vso = 11, .vspw = 1, .vborder = 0, + .phsync = '-', .pvsync = '-', + .x_mm = 135, .y_mm = 216, + }, +}; + +static struct lcm_init_table boe_tv101wum_lcm_INIT_DCS_CMD[] = { + {INIT_DCS_CMD, 1, {0x10} }, + {DELAY_CMD, 0x22, {} }, + {INIT_DCS_CMD, 2, {0xB0, 0x05} }, + {INIT_DCS_CMD, 2, {0xB1, 0xE5} }, + {INIT_DCS_CMD, 2, {0xB3, 0x52} }, + {INIT_DCS_CMD, 2, {0xB0, 0x00} }, + {INIT_DCS_CMD, 2, {0xB3, 0x88} }, + {INIT_DCS_CMD, 2, {0xB0, 0x04} }, + {INIT_DCS_CMD, 2, {0xB8, 0x00} }, + {INIT_DCS_CMD, 2, {0xB0, 0x00} }, + {INIT_DCS_CMD, 2, {0xB2, 0x50} }, + {INIT_DCS_CMD, 2, {0xB6, 0x03} }, + {INIT_DCS_CMD, 2, {0xBA, 0x8B} }, + {INIT_DCS_CMD, 2, {0xBF, 0x15} }, + {INIT_DCS_CMD, 2, {0xC0, 0x0F} }, + {INIT_DCS_CMD, 2, {0xC2, 0x0C} }, + {INIT_DCS_CMD, 2, {0xC3, 0x02} }, + {INIT_DCS_CMD, 2, {0xC4, 0x0C} }, + {INIT_DCS_CMD, 2, {0xC5, 0x02} }, + {INIT_DCS_CMD, 2, {0xB0, 0x01} }, + {INIT_DCS_CMD, 2, {0xE0, 0x26} }, + {INIT_DCS_CMD, 2, {0xE1, 0x26} }, + {INIT_DCS_CMD, 2, {0xDC, 0x00} }, + {INIT_DCS_CMD, 2, {0xDD, 0x00} }, + {INIT_DCS_CMD, 2, {0xCC, 0x26} }, + {INIT_DCS_CMD, 2, {0xCD, 0x26} }, + {INIT_DCS_CMD, 2, {0xC8, 0x00} }, + {INIT_DCS_CMD, 2, {0xC9, 0x00} }, + {INIT_DCS_CMD, 2, {0xD2, 0x04} }, + {INIT_DCS_CMD, 2, {0xD3, 0x04} }, + {INIT_DCS_CMD, 2, {0xE6, 0x03} }, + {INIT_DCS_CMD, 2, {0xE7, 0x03} }, + {INIT_DCS_CMD, 2, {0xC4, 0x08} }, + {INIT_DCS_CMD, 2, {0xC5, 0x08} }, + {INIT_DCS_CMD, 2, {0xD8, 0x07} }, + {INIT_DCS_CMD, 2, {0xD9, 0x07} }, + {INIT_DCS_CMD, 2, {0xC2, 0x06} }, + {INIT_DCS_CMD, 2, {0xC3, 0x06} }, + {INIT_DCS_CMD, 2, {0xD6, 0x05} }, + {INIT_DCS_CMD, 2, {0xD7, 0x05} }, + {INIT_DCS_CMD, 2, {0xC0, 0x0C} }, + {INIT_DCS_CMD, 2, {0xC1, 0x0C} }, + {INIT_DCS_CMD, 2, {0xD4, 0x0B} }, + {INIT_DCS_CMD, 2, {0xD5, 0x0B} }, + {INIT_DCS_CMD, 2, {0xCA, 0x0A} }, + {INIT_DCS_CMD, 2, {0xCB, 0x0A} }, + {INIT_DCS_CMD, 2, {0xDE, 0x09} }, + {INIT_DCS_CMD, 2, {0xDF, 0x09} }, + {INIT_DCS_CMD, 2, {0xC6, 0x26} }, + {INIT_DCS_CMD, 2, {0xC7, 0x26} }, + {INIT_DCS_CMD, 2, {0xCE, 0x00} }, + {INIT_DCS_CMD, 2, {0xCF, 0x00} }, + {INIT_DCS_CMD, 2, {0xDA, 0x26} }, + {INIT_DCS_CMD, 2, {0xDB, 0x26} }, + {INIT_DCS_CMD, 2, {0xE2, 0x00} }, + {INIT_DCS_CMD, 2, {0xE3, 0x00} }, + {INIT_DCS_CMD, 2, {0xB0, 0x02} }, + {INIT_DCS_CMD, 2, {0xC0, 0x00} }, + {INIT_DCS_CMD, 2, {0xC1, 0x07} }, + {INIT_DCS_CMD, 2, {0xC2, 0x0D} }, + {INIT_DCS_CMD, 2, {0xC3, 0x18} }, + {INIT_DCS_CMD, 2, {0xC4, 0x27} }, + {INIT_DCS_CMD, 2, {0xC5, 0x28} }, + {INIT_DCS_CMD, 2, {0xC6, 0x30} }, + {INIT_DCS_CMD, 2, {0xC7, 0x2E} }, + {INIT_DCS_CMD, 2, {0xC8, 0x2F} }, + {INIT_DCS_CMD, 2, {0xC9, 0x1A} }, + {INIT_DCS_CMD, 2, {0xCA, 0x20} }, + {INIT_DCS_CMD, 2, {0xCB, 0x29} }, + {INIT_DCS_CMD, 2, {0xCC, 0x26} }, + {INIT_DCS_CMD, 2, {0xCD, 0x32} }, + {INIT_DCS_CMD, 2, {0xCE, 0x33} }, + {INIT_DCS_CMD, 2, {0xCF, 0x31} }, + {INIT_DCS_CMD, 2, {0xD0, 0x06} }, + {INIT_DCS_CMD, 2, {0xD2, 0x00} }, + {INIT_DCS_CMD, 2, {0xD3, 0x07} }, + {INIT_DCS_CMD, 2, {0xD4, 0x12} }, + {INIT_DCS_CMD, 2, {0xD5, 0x26} }, + {INIT_DCS_CMD, 2, {0xD6, 0x3D} }, + {INIT_DCS_CMD, 2, {0xD7, 0x3F} }, + {INIT_DCS_CMD, 2, {0xD8, 0x3F} }, + {INIT_DCS_CMD, 2, {0xD9, 0x3F} }, + {INIT_DCS_CMD, 2, {0xDA, 0x3F} }, + {INIT_DCS_CMD, 2, {0xDB, 0x3F} }, + {INIT_DCS_CMD, 2, {0xDC, 0x3F} }, + {INIT_DCS_CMD, 2, {0xDD, 0x3F} }, + {INIT_DCS_CMD, 2, {0xDE, 0x3F} }, + {INIT_DCS_CMD, 2, {0xDF, 0x3A} }, + {INIT_DCS_CMD, 2, {0xE0, 0x37} }, + {INIT_DCS_CMD, 2, {0xE1, 0x35} }, + {INIT_DCS_CMD, 2, {0xE2, 0x07} }, + {INIT_DCS_CMD, 2, {0xB0, 0x03} }, + {INIT_DCS_CMD, 2, {0xC8, 0x0B} }, + {INIT_DCS_CMD, 2, {0xC9, 0x07} }, + {INIT_DCS_CMD, 2, {0xC3, 0x00} }, + {INIT_DCS_CMD, 2, {0xE7, 0x00} }, + {INIT_DCS_CMD, 2, {0xC5, 0x2A} }, + {INIT_DCS_CMD, 2, {0xDE, 0x2A} }, + {INIT_DCS_CMD, 2, {0xCA, 0x43} }, + {INIT_DCS_CMD, 2, {0xC9, 0x07} }, + {INIT_DCS_CMD, 2, {0xE4, 0xC0} }, + {INIT_DCS_CMD, 2, {0xE5, 0x0D} }, + {INIT_DCS_CMD, 2, {0xCB, 0x00} }, + {INIT_DCS_CMD, 2, {0xB0, 0x06} }, + {INIT_DCS_CMD, 2, {0xB8, 0xA5} }, + {INIT_DCS_CMD, 2, {0xC0, 0xA5} }, + {INIT_DCS_CMD, 2, {0xC7, 0x0F} }, + {INIT_DCS_CMD, 2, {0xD5, 0x32} }, + {INIT_DCS_CMD, 2, {0xB8, 0x00} }, + {INIT_DCS_CMD, 2, {0xC0, 0x00} }, + {INIT_DCS_CMD, 2, {0xBC, 0x00} }, + {INIT_DCS_CMD, 2, {0xB0, 0x07} }, + {INIT_DCS_CMD, 2, {0xB1, 0x00} }, + {INIT_DCS_CMD, 2, {0xB2, 0x09} }, + {INIT_DCS_CMD, 2, {0xB3, 0x19} }, + {INIT_DCS_CMD, 2, {0xB4, 0x2F} }, + {INIT_DCS_CMD, 2, {0xB5, 0x44} }, + {INIT_DCS_CMD, 2, {0xB6, 0x52} }, + {INIT_DCS_CMD, 2, {0xB7, 0x6A} }, + {INIT_DCS_CMD, 2, {0xB8, 0x8A} }, + {INIT_DCS_CMD, 2, {0xB9, 0xCA} }, + {INIT_DCS_CMD, 2, {0xBA, 0x0C} }, + {INIT_DCS_CMD, 2, {0xBB, 0x87} }, + {DELAY_CMD, 0x05, {} }, + {INIT_DCS_CMD, 2, {0xBC, 0x06} }, + {INIT_DCS_CMD, 2, {0xBD, 0x0A} }, + {INIT_DCS_CMD, 2, {0xBE, 0x9B} }, + {INIT_DCS_CMD, 2, {0xBF, 0x0C} }, + {INIT_DCS_CMD, 2, {0xC0, 0x3D} }, + {INIT_DCS_CMD, 2, {0xC1, 0x71} }, + {INIT_DCS_CMD, 2, {0xC2, 0x90} }, + {INIT_DCS_CMD, 2, {0xC3, 0xA0} }, + {INIT_DCS_CMD, 2, {0xC4, 0xA8} }, + {INIT_DCS_CMD, 2, {0xC5, 0xB1} }, + {INIT_DCS_CMD, 2, {0xC6, 0xBB} }, + {INIT_DCS_CMD, 2, {0xC7, 0xC0} }, + {INIT_DCS_CMD, 2, {0xC8, 0xC4} }, + {INIT_DCS_CMD, 2, {0xC9, 0x00} }, + {INIT_DCS_CMD, 2, {0xCA, 0x00} }, + {INIT_DCS_CMD, 2, {0xCB, 0x16} }, + {INIT_DCS_CMD, 2, {0xCC, 0xAF} }, + {INIT_DCS_CMD, 2, {0xCD, 0xFF} }, + {INIT_DCS_CMD, 2, {0xCE, 0xFF} }, + {INIT_DCS_CMD, 2, {0xB0, 0x08} }, + {INIT_DCS_CMD, 2, {0xB1, 0x04} }, + {INIT_DCS_CMD, 2, {0xB2, 0x08} }, + {INIT_DCS_CMD, 2, {0xB3, 0x19} }, + {INIT_DCS_CMD, 2, {0xB4, 0x31} }, + {INIT_DCS_CMD, 2, {0xB5, 0x46} }, + {INIT_DCS_CMD, 2, {0xB6, 0x55} }, + {INIT_DCS_CMD, 2, {0xB7, 0x6E} }, + {INIT_DCS_CMD, 2, {0xB8, 0x92} }, + {INIT_DCS_CMD, 2, {0xB9, 0xD4} }, + {INIT_DCS_CMD, 2, {0xBA, 0x1B} }, + {INIT_DCS_CMD, 2, {0xBB, 0x9B} }, + {DELAY_CMD, 0x05, {} }, + {INIT_DCS_CMD, 2, {0xBC, 0x28} }, + {INIT_DCS_CMD, 2, {0xBD, 0x2D} }, + {INIT_DCS_CMD, 2, {0xBE, 0xC3} }, + {INIT_DCS_CMD, 2, {0xBF, 0x2F} }, + {INIT_DCS_CMD, 2, {0xC0, 0x62} }, + {INIT_DCS_CMD, 2, {0xC1, 0x99} }, + {INIT_DCS_CMD, 2, {0xC2, 0xAB} }, + {INIT_DCS_CMD, 2, {0xC3, 0xBF} }, + {INIT_DCS_CMD, 2, {0xC4, 0xCF} }, + {INIT_DCS_CMD, 2, {0xC5, 0xDF} }, + {INIT_DCS_CMD, 2, {0xC6, 0xF0} }, + {INIT_DCS_CMD, 2, {0xC7, 0xF9} }, + {INIT_DCS_CMD, 2, {0xC8, 0xFC} }, + {INIT_DCS_CMD, 2, {0xC9, 0x00} }, + {INIT_DCS_CMD, 2, {0xCA, 0x00} }, + {INIT_DCS_CMD, 2, {0xCB, 0x16} }, + {INIT_DCS_CMD, 2, {0xCC, 0xAF} }, + {INIT_DCS_CMD, 2, {0xCD, 0xFF} }, + {INIT_DCS_CMD, 2, {0xCE, 0xFF} }, + {INIT_DCS_CMD, 2, {0xB0, 0x09} }, + {INIT_DCS_CMD, 2, {0xB1, 0x04} }, + {INIT_DCS_CMD, 2, {0xB2, 0x05} }, + {INIT_DCS_CMD, 2, {0xB3, 0x17} }, + {INIT_DCS_CMD, 2, {0xB4, 0x2E} }, + {INIT_DCS_CMD, 2, {0xB5, 0x42} }, + {INIT_DCS_CMD, 2, {0xB6, 0x51} }, + {INIT_DCS_CMD, 2, {0xB7, 0x69} }, + {INIT_DCS_CMD, 2, {0xB8, 0x88} }, + {INIT_DCS_CMD, 2, {0xB9, 0xC9} }, + {INIT_DCS_CMD, 2, {0xBA, 0x0C} }, + {INIT_DCS_CMD, 2, {0xBB, 0x86} }, + {DELAY_CMD, 0x05, {} }, + {INIT_DCS_CMD, 2, {0xBC, 0x03} }, + {INIT_DCS_CMD, 2, {0xBD, 0x08} }, + {INIT_DCS_CMD, 2, {0xBE, 0x95} }, + {INIT_DCS_CMD, 2, {0xBF, 0x05} }, + {INIT_DCS_CMD, 2, {0xC0, 0x35} }, + {INIT_DCS_CMD, 2, {0xC1, 0x62} }, + {INIT_DCS_CMD, 2, {0xC2, 0x81} }, + {INIT_DCS_CMD, 2, {0xC3, 0x96} }, + {INIT_DCS_CMD, 2, {0xC4, 0x9E} }, + {INIT_DCS_CMD, 2, {0xC5, 0xA5} }, + {INIT_DCS_CMD, 2, {0xC6, 0xAD} }, + {INIT_DCS_CMD, 2, {0xC7, 0xB1} }, + {INIT_DCS_CMD, 2, {0xC8, 0xB4} }, + {INIT_DCS_CMD, 2, {0xC9, 0x00} }, + {INIT_DCS_CMD, 2, {0xCA, 0x00} }, + {INIT_DCS_CMD, 2, {0xCB, 0x16} }, + {INIT_DCS_CMD, 2, {0xCC, 0xAF} }, + {INIT_DCS_CMD, 2, {0xCD, 0xFF} }, + {INIT_DCS_CMD, 2, {0xCE, 0xFF} }, + {INIT_DCS_CMD, 2, {0xB0, 0x0A} }, + {INIT_DCS_CMD, 2, {0xB1, 0x00} }, + {INIT_DCS_CMD, 2, {0xB2, 0x09} }, + {INIT_DCS_CMD, 2, {0xB3, 0x19} }, + {INIT_DCS_CMD, 2, {0xB4, 0x2F} }, + {INIT_DCS_CMD, 2, {0xB5, 0x44} }, + {INIT_DCS_CMD, 2, {0xB6, 0x52} }, + {INIT_DCS_CMD, 2, {0xB7, 0x6A} }, + {INIT_DCS_CMD, 2, {0xB8, 0x8A} }, + {INIT_DCS_CMD, 2, {0xB9, 0xCA} }, + {INIT_DCS_CMD, 2, {0xBA, 0x0C} }, + {INIT_DCS_CMD, 2, {0xBB, 0x87} }, + {DELAY_CMD, 0x05, {} }, + {INIT_DCS_CMD, 2, {0xBC, 0x06} }, + {INIT_DCS_CMD, 2, {0xBD, 0x0A} }, + {INIT_DCS_CMD, 2, {0xBE, 0x9B} }, + {INIT_DCS_CMD, 2, {0xBF, 0x0C} }, + {INIT_DCS_CMD, 2, {0xC0, 0x3D} }, + {INIT_DCS_CMD, 2, {0xC1, 0x71} }, + {INIT_DCS_CMD, 2, {0xC2, 0x90} }, + {INIT_DCS_CMD, 2, {0xC3, 0xA0} }, + {INIT_DCS_CMD, 2, {0xC4, 0xA8} }, + {INIT_DCS_CMD, 2, {0xC5, 0xB1} }, + {INIT_DCS_CMD, 2, {0xC6, 0xBB} }, + {INIT_DCS_CMD, 2, {0xC7, 0xC0} }, + {INIT_DCS_CMD, 2, {0xC8, 0xC4} }, + {INIT_DCS_CMD, 2, {0xC9, 0x00} }, + {INIT_DCS_CMD, 2, {0xCA, 0x00} }, + {INIT_DCS_CMD, 2, {0xCB, 0x16} }, + {INIT_DCS_CMD, 2, {0xCC, 0xAF} }, + {INIT_DCS_CMD, 2, {0xCD, 0xFF} }, + {INIT_DCS_CMD, 2, {0xCE, 0xFF} }, + {INIT_DCS_CMD, 2, {0xB0, 0x0B} }, + {INIT_DCS_CMD, 2, {0xB1, 0x04} }, + {INIT_DCS_CMD, 2, {0xB2, 0x08} }, + {INIT_DCS_CMD, 2, {0xB3, 0x19} }, + {INIT_DCS_CMD, 2, {0xB4, 0x31} }, + {INIT_DCS_CMD, 2, {0xB5, 0x46} }, + {INIT_DCS_CMD, 2, {0xB6, 0x55} }, + {INIT_DCS_CMD, 2, {0xB7, 0x6E} }, + {INIT_DCS_CMD, 2, {0xB8, 0x92} }, + {INIT_DCS_CMD, 2, {0xB9, 0xD4} }, + {INIT_DCS_CMD, 2, {0xBA, 0x1B} }, + {INIT_DCS_CMD, 2, {0xBB, 0x9B} }, + {DELAY_CMD, 0x05, {} }, + {INIT_DCS_CMD, 2, {0xBC, 0x28} }, + {INIT_DCS_CMD, 2, {0xBD, 0x2D} }, + {INIT_DCS_CMD, 2, {0xBE, 0xC3} }, + {INIT_DCS_CMD, 2, {0xBF, 0x2F} }, + {INIT_DCS_CMD, 2, {0xC0, 0x62} }, + {INIT_DCS_CMD, 2, {0xC1, 0x99} }, + {INIT_DCS_CMD, 2, {0xC2, 0xAB} }, + {INIT_DCS_CMD, 2, {0xC3, 0xBF} }, + {INIT_DCS_CMD, 2, {0xC4, 0xCF} }, + {INIT_DCS_CMD, 2, {0xC5, 0xDF} }, + {INIT_DCS_CMD, 2, {0xC6, 0xF0} }, + {INIT_DCS_CMD, 2, {0xC7, 0xF9} }, + {INIT_DCS_CMD, 2, {0xC8, 0xFC} }, + {INIT_DCS_CMD, 2, {0xC9, 0x00} }, + {INIT_DCS_CMD, 2, {0xCA, 0x00} }, + {INIT_DCS_CMD, 2, {0xCB, 0x16} }, + {INIT_DCS_CMD, 2, {0xCC, 0xAF} }, + {INIT_DCS_CMD, 2, {0xCD, 0xFF} }, + {INIT_DCS_CMD, 2, {0xCE, 0xFF} }, + {INIT_DCS_CMD, 2, {0xB0, 0x0C} }, + {INIT_DCS_CMD, 2, {0xB1, 0x04} }, + {INIT_DCS_CMD, 2, {0xB2, 0x05} }, + {INIT_DCS_CMD, 2, {0xB3, 0x17} }, + {INIT_DCS_CMD, 2, {0xB4, 0x2E} }, + {INIT_DCS_CMD, 2, {0xB5, 0x42} }, + {INIT_DCS_CMD, 2, {0xB6, 0x51} }, + {INIT_DCS_CMD, 2, {0xB7, 0x69} }, + {INIT_DCS_CMD, 2, {0xB8, 0x88} }, + {INIT_DCS_CMD, 2, {0xB9, 0xC9} }, + {INIT_DCS_CMD, 2, {0xBA, 0x0C} }, + {INIT_DCS_CMD, 2, {0xBB, 0x86} }, + {DELAY_CMD, 0x05, {} }, + {INIT_DCS_CMD, 2, {0xBC, 0x03} }, + {INIT_DCS_CMD, 2, {0xBD, 0x08} }, + {INIT_DCS_CMD, 2, {0xBE, 0x95} }, + {INIT_DCS_CMD, 2, {0xBF, 0x05} }, + {INIT_DCS_CMD, 2, {0xC0, 0x35} }, + {INIT_DCS_CMD, 2, {0xC1, 0x62} }, + {INIT_DCS_CMD, 2, {0xC2, 0x81} }, + {INIT_DCS_CMD, 2, {0xC3, 0x96} }, + {INIT_DCS_CMD, 2, {0xC4, 0x9E} }, + {INIT_DCS_CMD, 2, {0xC5, 0xA5} }, + {INIT_DCS_CMD, 2, {0xC6, 0xAD} }, + {INIT_DCS_CMD, 2, {0xC7, 0xB1} }, + {INIT_DCS_CMD, 2, {0xC8, 0xB4} }, + {INIT_DCS_CMD, 2, {0xC9, 0x00} }, + {INIT_DCS_CMD, 2, {0xCA, 0x00} }, + {INIT_DCS_CMD, 2, {0xCB, 0x16} }, + {INIT_DCS_CMD, 2, {0xCC, 0xAF} }, + {INIT_DCS_CMD, 2, {0xCD, 0xFF} }, + {INIT_DCS_CMD, 2, {0xCE, 0xFF} }, + {DELAY_CMD, 0x64, {} }, + {INIT_DCS_CMD, 2, {0xB0, 0x00} }, + {INIT_DCS_CMD, 2, {0xB3, 0x08} }, + {INIT_DCS_CMD, 2, {0xB0, 0x04} }, + {INIT_DCS_CMD, 2, {0xB8, 0x68} }, + {DELAY_CMD, 0x0A, {} }, + {INIT_DCS_CMD, 1, {0x11} }, + {DELAY_CMD, 0x78, {} }, + {INIT_DCS_CMD, 1, {0x29} }, + {DELAY_CMD, 0x14, {} }, +}; + +struct panel_info kodama_panel_info[] = { + PANEL(PANEL_KODAMA_BOE_TV101WUM_NL6, + 1417000, + kodama_boe_tv101wum_edid, + boe_tv101wum_lcm_INIT_DCS_CMD), + {{PANEL_KODAMA_UNKNOWN}, "PANEL_KODAMA_UNKNOWN", + 0, NULL, NULL, 0}, +}; + + +static union panel_id get_panel_id_from_adc(int channel, + struct board_display_intf *intf) +{ + uint32_t ver = board_id(); + if (ver == 0 || ver < 3) { + int id; + int value = auxadc_get_voltage(channel); + for (id = 0; id < intf->all_panel_info_size; id++) { + if (ABS(value - intf->all_panel_info[id].voltage) + < tolerance) { + return intf->all_panel_info[id].disp_id; + } + else + return intf->all_panel_info[id+1].disp_id; + } + + return (union panel_id)PANEL_KODAMA_UNKNOWN; + } else + return (union panel_id)PANEL_KODAMA_UNKNOWN; +} + + +static union panel_id kodama_get_panel_id(struct board_display_intf *intf) +{ + union panel_id id; + + id = get_panel_id_from_adc(KODAMA_PANEL_ADC_ID, + intf); + return id; +}; + +static bool kodama_is_panel_id_valid(union panel_id id) +{ + if (id.value < PANEL_KODAMA_UNKNOWN) + return true; + return false; +}; + +static int kodama_backlight(struct board_display_intf *intf) +{ + gpio_output(GPIO(PERIPHERAL_EN13), 1); + gpio_output(GPIO(DISP_PWM), 1); /* DISP_PWM0 */ + + return 0; +}; + +static int kodama_power(struct board_display_intf *intf) +{ + gpio_output(GPIO(LCM_RST), 0); + gpio_output(GPIO(MISC_BSI_CK_3), 1); + gpio_output(GPIO(PERIPHERAL_EN9), 1); + gpio_output(GPIO(SIM2_SRST), 1); + gpio_output(GPIO(LCM_RST), 0); + mdelay(20); + gpio_output(GPIO(LCM_RST), 1); + mdelay(10); + return 0; +}; + +struct board_display_intf panel_display_intf = { + .board = "kodama", + .all_panel_info = kodama_panel_info, + .all_panel_info_size = ARRAY_SIZE(kodama_panel_info), + .cur_panel_info = NULL, + .get_panel_id = &kodama_get_panel_id, + .is_panel_id_valid = &kodama_is_panel_id_valid, + .backlight = &kodama_backlight, + .power = &kodama_power, +}; +