Skip to content

Commit

Permalink
lcd: lcd: add g12b support [1/2]
Browse files Browse the repository at this point in the history
PD#165090

Problem:
g12b chip bringup

Solution:
add g12b support

Verify:
g12b w400

Change-Id: I98199805fcde26975d04804ec3a7c9ed29679ac5
Signed-off-by: Evoke Zhang <[email protected]>
  • Loading branch information
Evoke Zhang authored and xiaobo gu committed Jun 25, 2018
1 parent f148504 commit 8a2b031
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 23 deletions.
4 changes: 1 addition & 3 deletions board/amlogic/configs/g12b_skt_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,7 @@
// #define CONFIG_AML_LCD 1
// #define CONFIG_AML_LCD_TABLET 1
// #define CONFIG_AML_LCD_EXTERN 1
// #define CONFIG_AML_LCD_EXTERN_MIPI_TV070WSM 1
// #define CONFIG_AML_LCD_EXTERN_MIPI_P070ACB 1
// #define CONFIG_AML_LCD_EXTERN_MIPI_TL050FHV02CT 1


/* USB
* Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard
Expand Down
4 changes: 1 addition & 3 deletions board/amlogic/configs/g12b_w400_v1.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,7 @@
// #define CONFIG_AML_LCD 1
// #define CONFIG_AML_LCD_TABLET 1
// #define CONFIG_AML_LCD_EXTERN 1
// #define CONFIG_AML_LCD_EXTERN_MIPI_TV070WSM 1
// #define CONFIG_AML_LCD_EXTERN_MIPI_P070ACB 1
// #define CONFIG_AML_LCD_EXTERN_MIPI_TL050FHV02CT 1


/* USB
* Enable CONFIG_MUSB_HCD for Host functionalities MSC, keyboard
Expand Down
11 changes: 5 additions & 6 deletions board/amlogic/g12b_skt_v1/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ static unsigned char mipi_init_on_table_TV070WSM[DSI_INIT_ON_MAX] = {//table siz
0xf0, 3, 0, 0, 10, /* reset low, delay 10ms */
0xf0, 3, 0, 1, 30, /* reset high, delay 30ms */
0xfc, 2, 0x04, 3, /* check_reg, check_cnt */
0xff, 100, /* delay */
0xff, 0xff, //ending flag
};
static unsigned char mipi_init_off_table_TV070WSM[DSI_INIT_OFF_MAX] = {//table size < 50
Expand Down Expand Up @@ -425,7 +424,7 @@ struct lcd_extern_config_s ext_config_dtf[LCD_EXTERN_NUM_MAX] = {
.table_init_on = ext_init_on_table,
.table_init_off = ext_init_off_table,
},
{
{ /* TV070WSM */
.index = 1,
.name = "mipi_default",
.type = LCD_EXTERN_MIPI, /* LCD_EXTERN_I2C, LCD_EXTERN_SPI, LCD_EXTERN_MIPI, LCD_EXTERN_MAX */
Expand All @@ -434,7 +433,7 @@ struct lcd_extern_config_s ext_config_dtf[LCD_EXTERN_NUM_MAX] = {
.table_init_on = ext_init_on_table_TV070WSM,
.table_init_off = ext_init_off_table_TV070WSM,
},
{
{ /* P070ACB */
.index = 2,
.name = "mipi_default",
.type = LCD_EXTERN_MIPI, /* LCD_EXTERN_I2C, LCD_EXTERN_SPI, LCD_EXTERN_MIPI, LCD_EXTERN_MAX */
Expand All @@ -443,7 +442,7 @@ struct lcd_extern_config_s ext_config_dtf[LCD_EXTERN_NUM_MAX] = {
.table_init_on = ext_init_on_table_P070ACB,
.table_init_off = ext_init_off_table_P070ACB,
},
{
{ /* TL050FHV02CT */
.index = 3,
.name = "mipi_default",
.type = LCD_EXTERN_MIPI, /* LCD_EXTERN_I2C, LCD_EXTERN_SPI, LCD_EXTERN_MIPI, LCD_EXTERN_MAX */
Expand Down Expand Up @@ -515,11 +514,11 @@ void lcd_config_bsp_init(void)
ext_lcd = &ext_lcd_config[i];
if (strcmp(ext_lcd->panel_type, str) == 0) {
switch (i) {
case 1:
case 1:/* TV070WSM*/
lcd_mipi_config.dsi_init_on = mipi_init_on_table_TV070WSM;
lcd_mipi_config.dsi_init_off = mipi_init_off_table_TV070WSM;
break;
case 2:
case 2:/* P070ACB*/
lcd_mipi_config.dsi_init_on = mipi_init_on_table_P070ACB;
lcd_mipi_config.dsi_init_off = mipi_init_off_table_P070ACB;
break;
Expand Down
11 changes: 5 additions & 6 deletions board/amlogic/g12b_w400_v1/lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ static unsigned char mipi_init_on_table_TV070WSM[DSI_INIT_ON_MAX] = {//table siz
0xf0, 3, 0, 0, 10, /* reset low, delay 10ms */
0xf0, 3, 0, 1, 30, /* reset high, delay 30ms */
0xfc, 2, 0x04, 3, /* check_reg, check_cnt */
0xff, 100, /* delay */
0xff, 0xff, //ending flag
};
static unsigned char mipi_init_off_table_TV070WSM[DSI_INIT_OFF_MAX] = {//table size < 50
Expand Down Expand Up @@ -425,7 +424,7 @@ struct lcd_extern_config_s ext_config_dtf[LCD_EXTERN_NUM_MAX] = {
.table_init_on = ext_init_on_table,
.table_init_off = ext_init_off_table,
},
{
{ /* TV070WSM */
.index = 1,
.name = "mipi_default",
.type = LCD_EXTERN_MIPI, /* LCD_EXTERN_I2C, LCD_EXTERN_SPI, LCD_EXTERN_MIPI, LCD_EXTERN_MAX */
Expand All @@ -434,7 +433,7 @@ struct lcd_extern_config_s ext_config_dtf[LCD_EXTERN_NUM_MAX] = {
.table_init_on = ext_init_on_table_TV070WSM,
.table_init_off = ext_init_off_table_TV070WSM,
},
{
{ /* P070ACB */
.index = 2,
.name = "mipi_default",
.type = LCD_EXTERN_MIPI, /* LCD_EXTERN_I2C, LCD_EXTERN_SPI, LCD_EXTERN_MIPI, LCD_EXTERN_MAX */
Expand All @@ -443,7 +442,7 @@ struct lcd_extern_config_s ext_config_dtf[LCD_EXTERN_NUM_MAX] = {
.table_init_on = ext_init_on_table_P070ACB,
.table_init_off = ext_init_off_table_P070ACB,
},
{
{ /* TL050FHV02CT */
.index = 3,
.name = "mipi_default",
.type = LCD_EXTERN_MIPI, /* LCD_EXTERN_I2C, LCD_EXTERN_SPI, LCD_EXTERN_MIPI, LCD_EXTERN_MAX */
Expand Down Expand Up @@ -515,11 +514,11 @@ void lcd_config_bsp_init(void)
ext_lcd = &ext_lcd_config[i];
if (strcmp(ext_lcd->panel_type, str) == 0) {
switch (i) {
case 1:
case 1:/* TV070WSM*/
lcd_mipi_config.dsi_init_on = mipi_init_on_table_TV070WSM;
lcd_mipi_config.dsi_init_off = mipi_init_off_table_TV070WSM;
break;
case 2:
case 2:/* P070ACB*/
lcd_mipi_config.dsi_init_on = mipi_init_on_table_P070ACB;
lcd_mipi_config.dsi_init_off = mipi_init_off_table_P070ACB;
break;
Expand Down
6 changes: 5 additions & 1 deletion drivers/display/lcd/aml_lcd.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,14 @@ static void lcd_chip_detect(void)
case MESON_CPU_MAJOR_ID_G12A:
aml_lcd_driver.chip_type = LCD_CHIP_G12A;
break;
case MESON_CPU_MAJOR_ID_G12B:
aml_lcd_driver.chip_type = LCD_CHIP_G12B;
break;
default:
aml_lcd_driver.chip_type = LCD_CHIP_MAX;
}
#else
aml_lcd_driver.chip_type = LCD_CHIP_G12A;
aml_lcd_driver.chip_type = LCD_CHIP_G12B;
#endif
if (lcd_debug_print_flag)
LCDPR("check chip: %d\n", aml_lcd_driver.chip_type);
Expand Down Expand Up @@ -866,6 +869,7 @@ static void lcd_reg_print(void)
printf("clk registers:\n");
switch (aml_lcd_driver.chip_type) {
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
if (lcd_drv->lcd_config->lcd_clk_path) {
for (i = 0; i < ARRAY_SIZE(lcd_reg_dump_clk_gp0_g12a); i++) {
printf("hiu [0x%08x] = 0x%08x\n",
Expand Down
8 changes: 8 additions & 0 deletions drivers/display/lcd/aml_lcd_clk_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ static void lcd_clk_config_init_print(void)
switch (lcd_drv->chip_type) {
case LCD_CHIP_AXG:
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
LCDPR("lcd clk config init:\n"
"pll_m_max: %d\n"
"pll_m_min: %d\n"
Expand Down Expand Up @@ -199,6 +200,7 @@ void lcd_clk_config_print(void)

switch (lcd_drv->chip_type) {
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
if (lcd_drv->lcd_config->lcd_clk_path) {
LCDPR("lcd clk config:\n"
"clk_path %d\n"
Expand Down Expand Up @@ -426,6 +428,7 @@ static void lcd_clk_config_chip_init(void)
cConf->xd_out_fmax = ENCL_CLK_IN_MAX_TXHD;
break;
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
if (lcd_drv->lcd_config->lcd_clk_path) {
cConf->od_fb = PLL_FRAC_OD_FB_GP0_G12A;
cConf->ss_level_max = SS_LEVEL_MAX_GP0_G12A;
Expand Down Expand Up @@ -1272,6 +1275,7 @@ static void lcd_set_vclk_crt(int lcd_type, struct lcd_clk_config_s *cConf)
/* select vid_pll_clk */
switch (lcd_drv->chip_type) {
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
if (lcd_drv->lcd_config->lcd_clk_path)
lcd_hiu_setb(HHI_VIID_CLK_CNTL, 1, VCLK2_CLK_IN_SEL, 3);
else
Expand Down Expand Up @@ -2444,6 +2448,7 @@ void lcd_clk_generate_parameter(struct lcd_config_s *pconf)
lcd_clk_generate_axg(pconf);
break;
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
if (lcd_drv->lcd_config->lcd_clk_path)
lcd_clk_generate_axg(pconf);
else
Expand Down Expand Up @@ -2551,6 +2556,7 @@ void lcd_clk_update(struct lcd_config_s *pconf)
lcd_update_pll_frac_axg(&clk_conf);
break;
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
if (lcd_drv->lcd_config->lcd_clk_path) {
lcd_pll_frac_generate_axg(pconf);
lcd_update_gp0_pll_frac_g12a(&clk_conf);
Expand Down Expand Up @@ -2597,6 +2603,7 @@ void lcd_clk_set(struct lcd_config_s *pconf)
lcd_set_dsi_meas_clk();
break;
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
if (lcd_drv->lcd_config->lcd_clk_path) {
lcd_set_gp0_pll_g12a(&clk_conf);
lcd_set_dsi_meas_clk();
Expand Down Expand Up @@ -2648,6 +2655,7 @@ void lcd_clk_disable(void)
lcd_hiu_setb(HHI_GP0_PLL_CNTL, 0, LCD_PLL_EN_AXG, 1);
break;
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
if (lcd_drv->lcd_config->lcd_clk_path) {
lcd_hiu_setb(HHI_GP0_PLL_CNTL0, 0, LCD_PLL_EN_GP0_G12A, 1);
} else {
Expand Down
29 changes: 25 additions & 4 deletions drivers/display/lcd/aml_lcd_dummy_reg.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,22 +133,43 @@
#ifndef HHI_MIPIDSI_PHY_CLK_CNTL
#define HHI_MIPIDSI_PHY_CLK_CNTL (0xff63c000 + (0x95 << 2))
#endif


#if (defined(CONFIG_AML_MESON_AXG) || \
defined(CONFIG_AML_MESON_G12A))
#ifndef HHI_DIF_CSI_PHY_CNTL0
#define HHI_DIF_CSI_PHY_CNTL0 (0xff63c000 + (0xd8 << 2))
#endif
#ifndef HHI_DIF_CSI_PHY_CNTL1
#define HHI_DIF_CSI_PHY_CNTL1 (0xff63c000 + (0xd9 << 2))
#endif
#ifndef HHI_DIF_CSI_PHY_CNTL2
#define HHI_DIF_CSI_PHY_CNTL2 (0xff63c000 + (0xda << 2))
#endif
#ifndef HHI_DIF_CSI_PHY_CNTL3
#define HHI_DIF_CSI_PHY_CNTL3 (0xff63c000 + (0xdb << 2))
#endif
#ifndef HHI_DIF_CSI_PHY_CNTL4
#define HHI_DIF_CSI_PHY_CNTL4 (0xff63c000 + (0xdc << 2))
#endif
#ifndef HHI_DIF_CSI_PHY_CNTL5
#define HHI_DIF_CSI_PHY_CNTL5 (0xff63c000 + (0xdd << 2))
#endif
#ifndef HHI_DSI_LVDS_EDP_CNTL0
#define HHI_DSI_LVDS_EDP_CNTL0 (0xff63c000 + (0xd1 << 2))
#endif
#ifndef HHI_DSI_LVDS_EDP_CNTL1
#define HHI_DSI_LVDS_EDP_CNTL1 (0xff63c000 + (0xd2 << 2))
#endif
#ifndef HHI_CSI_PHY_CNTL1
#define HHI_CSI_PHY_CNTL1 (0xff63c000 + (0xd4 << 2))
#endif
#ifndef HHI_CSI_PHY_CNTL2
#define HHI_CSI_PHY_CNTL2 (0xff63c000 + (0xd5 << 2))
#endif
#ifndef HHI_CSI_PHY_CNTL3
#define HHI_CSI_PHY_CNTL3 (0xff63c000 + (0xd6 << 2))
#endif
#ifndef HHI_LVDS_TX_PHY_CNTL0
#define HHI_LVDS_TX_PHY_CNTL0 (0xff63c000 + (0xde << 2))
#endif
#ifndef HHI_LVDS_TX_PHY_CNTL1
#define HHI_LVDS_TX_PHY_CNTL1 (0xff63c000 + (0xdf << 2))
#endif

Expand Down
2 changes: 2 additions & 0 deletions drivers/display/lcd/lcd_tablet/lcd_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ static void lcd_mipi_phy_set(struct lcd_config_s *pconf, int status)
if (status) {
switch (lcd_drv->chip_type) {
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
/* HHI_MIPI_CNTL0 */
/* DIF_REF_CTL1:31-16bit, DIF_REF_CTL0:15-0bit */
lcd_hiu_write(HHI_MIPI_CNTL0, (0xa487 << 16) | (0x8 << 0));
Expand Down Expand Up @@ -109,6 +110,7 @@ static void lcd_mipi_phy_set(struct lcd_config_s *pconf, int status)
} else {
switch (lcd_drv->chip_type) {
case LCD_CHIP_G12A:
case LCD_CHIP_G12B:
lcd_hiu_write(HHI_MIPI_CNTL0, 0);
lcd_hiu_write(HHI_MIPI_CNTL1, 0);
lcd_hiu_write(HHI_MIPI_CNTL2, 0);
Expand Down
1 change: 1 addition & 0 deletions include/amlogic/aml_lcd_vout.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ enum lcd_chip_e {
LCD_CHIP_AXG, /* 5 */
LCD_CHIP_TXHD, /* 6 */
LCD_CHIP_G12A, /* 7 */
LCD_CHIP_G12B, /* 8 */
LCD_CHIP_MAX,
};

Expand Down

0 comments on commit 8a2b031

Please sign in to comment.