From 9fee745b2a53bc225a0c7edfde8c8f1cbd835eae Mon Sep 17 00:00:00 2001 From: Weiming Liu Date: Thu, 18 Jan 2018 10:21:13 +0800 Subject: [PATCH] lcd: add lcd_extern p070acb driver PD#159016: lcd_extern: add p070acb driver Change-Id: Id2fd949f37815de1ec9bbd90170dce459b661256 Signed-off-by: Weiming Liu --- MAINTAINERS | 4 + .../boot/dts/amlogic/mesonaxg_s400-panel.dtsi | 49 +++++ arch/arm64/configs/meson64_defconfig | 1 + drivers/amlogic/media/vout/lcd/lcd_extern/Kconfig | 10 + drivers/amlogic/media/vout/lcd/lcd_extern/Makefile | 1 + .../amlogic/media/vout/lcd/lcd_extern/lcd_extern.c | 4 + .../amlogic/media/vout/lcd/lcd_extern/lcd_extern.h | 4 + .../media/vout/lcd/lcd_extern/mipi_P070ACB.c | 233 +++++++++++++++++++++ 8 files changed, 306 insertions(+) create mode 100644 drivers/amlogic/media/vout/lcd/lcd_extern/mipi_P070ACB.c diff --git a/MAINTAINERS b/MAINTAINERS index 80d06da..4ad7b3d 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -14257,3 +14257,7 @@ F: Documentation/devicetree/bindings/amlogic/input/amlogic-ts.txt F: drivers/amlogic/input/touchscreen/* F: drivers/amlogic/input/touchscreen/focaltech_touch/* F: drivers/amlogic/input/touchscreen/goodix_gt1x/* + +AMLOGIC ADD LCD_EXTERN P070ACB DRIVER +M: Weiming Liu +F: drivers/amlogic/media/vout/lcd/lcd_extern/mipi_P070ACB.c diff --git a/arch/arm64/boot/dts/amlogic/mesonaxg_s400-panel.dtsi b/arch/arm64/boot/dts/amlogic/mesonaxg_s400-panel.dtsi index e2668f7..30dff0c 100644 --- a/arch/arm64/boot/dts/amlogic/mesonaxg_s400-panel.dtsi +++ b/arch/arm64/boot/dts/amlogic/mesonaxg_s400-panel.dtsi @@ -176,6 +176,48 @@ 0xff 0 0 0>; backlight_index = <0>; }; + + lcd_3{ + model_name = "P070ACB"; + /*interface(ttl,lvds,mipi)*/ + interface = "mipi"; + basic_setting = <600 1024 /*h_active, v_active*/ + 680 1194 /*h_period, v_period*/ + 8 /*lcd_bits*/ + 3 5>; /*screen_widht, screen_height*/ + lcd_timing = <24 36 0 /*hs_width,hs_bp,hs_pol*/ + 10 80 0>; /*vs_width,vs_bp,vs_pol*/ + clk_attr = <0 /*fr_adj_type(0=clock,1=htotal,2=vtotal)*/ + 0 /*clk_ss_level*/ + 1 /*clk_auto_generate*/ + 48715200>; /*pixel_clk(unit in Hz)*/ + mipi_attr = <4 /*lane_num*/ + 300 /*bit_rate_max(MHz)*/ + 0 /*factor(*100, default 0 for auto)*/ + 1 /*operation_mode_init(0=video, 1=command)*/ + 0 /*operation_mode_display(0=video, 1=command)*/ + 2 /* + *video_mode_type + *(0=sync_pulse,1=sync_event,2=burst) + */ + 1 /*clk_lp_continuous(0=stop,1=continue)*/ + 0>; /*phy_stop_wait(0=auto,1=standard,2=slow)*/ + /* dsi_init: data_type, num, data... */ + dsi_init_on = <0xff 0xff>; /* ending flag */ + dsi_init_off = <0xff 0xff>; /* ending flag */ + /* extern_init: 0xff for invalid */ + extern_init = <4>; + /* power step: type,index,value,delay(ms) */ + power_on_step = <0 0 1 20 + 0 0 0 10 + 0 0 1 20 + 2 0 0 0 + 0xff 0 0 0>; + power_off_step = <2 0 0 50 + 0 0 0 100 + 0xff 0 0 0>; + backlight_index = <0>; + }; }; lcd_extern{ @@ -275,6 +317,13 @@ status = "okay"; type = <2>; /* 0=i2c, 1=spi, 2=mipi */ }; + + extern_4{ + index = <4>; + extern_name = "mipi_P070ACB"; + status = "okay"; + type = <2>; /* 0=i2c, 1=spi, 2=mipi */ + }; }; backlight{ diff --git a/arch/arm64/configs/meson64_defconfig b/arch/arm64/configs/meson64_defconfig index 9c4b6c6..1e7a0a5 100644 --- a/arch/arm64/configs/meson64_defconfig +++ b/arch/arm64/configs/meson64_defconfig @@ -270,6 +270,7 @@ CONFIG_AMLOGIC_LCD_EXTERN=y CONFIG_AMLOGIC_LCD_EXTERN_MIPI_KD080D13=y CONFIG_AMLOGIC_LCD_EXTERN_MIPI_TV070WSM=y CONFIG_AMLOGIC_LCD_EXTERN_MIPI_ST7701=y +CONFIG_AMLOGIC_LCD_EXTERN_MIPI_P070ACB=y CONFIG_AMLOGIC_BACKLIGHT=y CONFIG_AMLOGIC_BL_EXTERN=y CONFIG_AMLOGIC_BL_EXTERN_I2C_LP8556=y diff --git a/drivers/amlogic/media/vout/lcd/lcd_extern/Kconfig b/drivers/amlogic/media/vout/lcd/lcd_extern/Kconfig index f11d174..6c4413a 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_extern/Kconfig +++ b/drivers/amlogic/media/vout/lcd/lcd_extern/Kconfig @@ -93,4 +93,14 @@ config AMLOGIC_LCD_EXTERN_MIPI_ST7701 Amlogic LCD external mipi_ST7701 init driver support Once the power on, according to the timing requirements, through the mipi interface to write data to the LCD, + make its initialization + +config AMLOGIC_LCD_EXTERN_MIPI_P070ACB + bool "lcd external mipi P070ACB init driver" + default n + depends on AMLOGIC_LCD_EXTERN + help + Amlogic LCD external mipi_P070ACB init driver support + Once the power on, according to the timing requirements, + through the mipi interface to write data to the LCD, make its initialization \ No newline at end of file diff --git a/drivers/amlogic/media/vout/lcd/lcd_extern/Makefile b/drivers/amlogic/media/vout/lcd/lcd_extern/Makefile index fbbda04..3fc0828 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_extern/Makefile +++ b/drivers/amlogic/media/vout/lcd/lcd_extern/Makefile @@ -5,3 +5,4 @@ obj-$(CONFIG_AMLOGIC_LCD_EXTERN_I2C_DLPC3439) += i2c_DLPC3439.o obj-$(CONFIG_AMLOGIC_LCD_EXTERN_MIPI_KD080D13) += mipi_KD080D13.o obj-$(CONFIG_AMLOGIC_LCD_EXTERN_MIPI_TV070WSM) += mipi_TV070WSM.o obj-$(CONFIG_AMLOGIC_LCD_EXTERN_MIPI_ST7701) += mipi_ST7701.o +obj-$(CONFIG_AMLOGIC_LCD_EXTERN_MIPI_P070ACB) += mipi_P070ACB.o diff --git a/drivers/amlogic/media/vout/lcd/lcd_extern/lcd_extern.c b/drivers/amlogic/media/vout/lcd/lcd_extern/lcd_extern.c index e7cebf7..c09dfa8 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_extern/lcd_extern.c +++ b/drivers/amlogic/media/vout/lcd/lcd_extern/lcd_extern.c @@ -1128,6 +1128,10 @@ static int lcd_extern_add_mipi(struct aml_lcd_extern_driver_s *ext_drv) #ifdef CONFIG_AMLOGIC_LCD_EXTERN_MIPI_ST7701 ret = aml_lcd_extern_mipi_st7701_probe(ext_drv); #endif + } else if (strcmp(ext_drv->config.name, "mipi_P070ACB") == 0) { +#ifdef CONFIG_AMLOGIC_LCD_EXTERN_MIPI_P070ACB + ret = aml_lcd_extern_mipi_p070acb_probe(ext_drv); +#endif } else { EXTERR("invalid driver name: %s\n", ext_drv->config.name); ret = -1; diff --git a/drivers/amlogic/media/vout/lcd/lcd_extern/lcd_extern.h b/drivers/amlogic/media/vout/lcd/lcd_extern/lcd_extern.h index 104b0e5..390f7fe 100644 --- a/drivers/amlogic/media/vout/lcd/lcd_extern/lcd_extern.h +++ b/drivers/amlogic/media/vout/lcd/lcd_extern/lcd_extern.h @@ -77,6 +77,10 @@ extern int aml_lcd_extern_mipi_TV070WSM_probe( extern int aml_lcd_extern_mipi_st7701_probe( struct aml_lcd_extern_driver_s *ext_drv); #endif +#ifdef CONFIG_AMLOGIC_LCD_EXTERN_MIPI_P070ACB +extern int aml_lcd_extern_mipi_p070acb_probe( + struct aml_lcd_extern_driver_s *ext_drv); +#endif #endif diff --git a/drivers/amlogic/media/vout/lcd/lcd_extern/mipi_P070ACB.c b/drivers/amlogic/media/vout/lcd/lcd_extern/mipi_P070ACB.c new file mode 100644 index 0000000..40a80614 --- /dev/null +++ b/drivers/amlogic/media/vout/lcd/lcd_extern/mipi_P070ACB.c @@ -0,0 +1,233 @@ +/* + * drivers/amlogic/media/vout/lcd/lcd_extern/mipi_P070ACB.c + * + * Copyright (C) 2017 Amlogic, Inc. All rights reserved. + * + * 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; either version 2 of the License, or + * (at your option) any later version. + * + * 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 +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "lcd_extern.h" + +#define LCD_EXTERN_NAME "mipi_P070ACB" + +/* ******************** mipi command ******************** + * format: data_type, num, data.... + * special: data_type=0xff, num<0xff means delay ms, num=0xff means ending. + */ +static unsigned char mipi_init_on_table[] = { + 0x29, 5, 0xFF, 0xAA, 0x55, 0x25, 0x01, + 0x23, 2, 0xFC, 0x08, + 0xFF, 1, /* delay(ms) */ + 0x23, 2, 0xFC, 0x00, + + 0xFF, 1, /* delay(ms) */ + 0x23, 2, 0x6F, 0x21, + 0x23, 2, 0xF7, 0x01, + 0xFF, 1, /* delay(ms) */ + 0x23, 2, 0x6F, 0x21, + 0x23, 2, 0xF7, 0x00, + 0xFF, 1, /* delay(ms) */ + + 0x23, 2, 0x6F, 0x1A, + 0x23, 2, 0xF7, 0x05, + 0xFF, 1, /* delay(ms) */ + + 0x29, 5, 0xFF, 0xAA, 0x55, 0x25, 0x00, + + 0x29, 6, 0xF0, 0x55, 0xAA, 0x52, 0x08, 0x00, + 0x29, 3, 0xB1, 0x68, 0x41, + 0x23, 2, 0xB5, 0x88, + 0x29, 6, 0xBD, 0x02, 0xB0, 0x0C, 0x14, 0x00, + 0x23, 2, 0xC8, 0x80, + + 0x29, 6, 0xF0, 0x55, 0xAA, 0x52, 0x08, 0x01, + 0x29, 3, 0xB3, 0x2D, 0x2D, + 0x29, 3, 0xB4, 0x19, 0x19, + 0x23, 2, 0xB5, 0x06, + 0x29, 3, 0xB9, 0x36, 0x36, + 0x29, 3, 0xBA, 0x26, 0x26, + 0x29, 3, 0xBC, 0xA8, 0x01, + 0x29, 3, 0xBD, 0xAB, 0x01, + 0x23, 2, 0xC0, 0x0C, + + 0x29, 6, 0xF0, 0x55, 0xAA, 0x52, 0x08, 0x02, + 0x23, 2, 0xEE, 0x02, + 0x29, 7, 0xB0, 0x00, 0x50, 0x00, 0x52, 0x00, 0x73, + 0x23, 2, 0x6F, 0x06, + 0x29, 7, 0xB0, 0x00, 0x8F, 0x00, 0xA5, 0x00, 0xCA, + 0x23, 2, 0x6F, 0x0C, + 0x29, 5, 0xB0, 0x00, 0xEA, 0x01, 0x1B, + 0x29, 7, 0xB1, 0x01, 0x42, 0x01, 0x82, 0x01, 0xB3, + 0x23, 2, 0x6F, 0x06, + 0x29, 7, 0xB1, 0x02, 0x00, 0x02, 0x41, 0x02, 0x42, + 0x23, 2, 0x6F, 0x0C, + 0x29, 5, 0xB1, 0x02, 0x78, 0x02, 0xB5, + 0x29, 7, 0xB2, 0x02, 0xDA, 0x03, 0x12, 0x03, 0x3A, + 0x23, 2, 0x6F, 0x06, + 0x29, 7, 0xB2, 0x03, 0x6E, 0x03, 0x8D, 0x03, 0xB1, + 0x23, 2, 0x6F, 0x0C, + 0x29, 5, 0xB2, 0x03, 0xCA, 0x03, 0xE8, + 0x29, 5, 0xB3, 0x03, 0xF4, 0x03, 0xFF, + + 0x29, 7, 0xBC, 0x00, 0x05, 0x00, 0x52, 0x00, 0x73, + 0x23, 2, 0x6F, 0x06, + 0x29, 7, 0xBC, 0x00, 0x8F, 0x00, 0xA5, 0x00, 0xCA, + 0x23, 2, 0x6F, 0x0C, + 0x29, 5, 0xBC, 0x00, 0xEA, 0x01, 0x1B, + 0x29, 7, 0xBD, 0x01, 0x42, 0x01, 0x82, 0x01, 0xB3, + 0x23, 2, 0x6F, 0x06, + 0x29, 7, 0xBD, 0x02, 0x00, 0x02, 0x41, 0x02, 0x42, + 0x23, 2, 0x6F, 0x0C, + 0x29, 5, 0xBD, 0x02, 0x78, 0x02, 0xB5, + 0x29, 7, 0xBE, 0x02, 0xDA, 0x03, 0x12, 0x03, 0x3A, + 0x23, 2, 0x6F, 0x06, + 0x29, 7, 0xBE, 0x03, 0x6E, 0x03, 0x8D, 0x03, 0xB1, + 0x23, 2, 0x6F, 0x0C, + 0x29, 5, 0xBE, 0x03, 0xCA, 0x03, 0xE8, + 0x29, 5, 0xBF, 0x03, 0xF4, 0x03, 0xFF, + + 0x29, 6, 0xF0, 0x55, 0xAA, 0x52, 0x08, 0x03, + 0x29, 6, 0xB2, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x29, 6, 0xB6, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x29, 6, 0xB7, 0x05, 0x00, 0x00, 0x00, 0x00, + 0x29, 6, 0xBA, 0x57, 0x00, 0x00, 0x00, 0x00, + 0x29, 6, 0xBB, 0x57, 0x00, 0x00, 0x00, 0x00, + 0x29, 5, 0xC0, 0x00, 0x34, 0x00, 0x00, + 0x29, 5, 0xC1, 0x00, 0x00, 0x34, 0x00, + 0x23, 2, 0xC4, 0x40, + + 0x29, 6, 0xF0, 0x55, 0xAA, 0x52, 0x08, 0x05, + 0x29, 3, 0xB0, 0x17, 0x06, + 0x29, 3, 0xB1, 0x17, 0x06, + 0x29, 3, 0xB2, 0x17, 0x06, + 0x29, 3, 0xB3, 0x17, 0x06, + 0x29, 3, 0xB4, 0x17, 0x06, + + 0x29, 6, 0xBD, 0x03, 0x01, 0x03, 0x03, 0x01, + 0x23, 2, 0xC0, 0x05, + 0x23, 2, 0xC4, 0x82, + 0x23, 2, 0xC5, 0xA2, + 0x29, 3, 0xC8, 0x03, 0x30, + 0x29, 3, 0xC9, 0x03, 0x31, + 0x29, 4, 0xCC, 0x00, 0x00, 0x3C, + 0x29, 4, 0xCD, 0x00, 0x00, 0x3C, + 0x29, 6, 0xD1, 0x00, 0x44, 0x09, 0x00, 0x00, + 0x29, 6, 0xD2, 0x00, 0x04, 0x0B, 0x00, 0x00, + + 0x29, 6, 0xF0, 0x55, 0xAA, 0x52, 0x08, 0x06, + 0x29, 3, 0xB0, 0x0B, 0x2D, + 0x29, 3, 0xB1, 0x2D, 0x09, + 0x29, 3, 0xB2, 0x2A, 0x29, + 0x29, 3, 0xB3, 0x34, 0x1B, + 0x29, 3, 0xB4, 0x19, 0x17, + 0x29, 3, 0xB5, 0x15, 0x13, + 0x29, 3, 0xB6, 0x11, 0x01, + 0x29, 3, 0xB7, 0x34, 0x34, + 0x29, 3, 0xB8, 0x34, 0x2D, + 0x29, 3, 0xB9, 0x2D, 0x34, + 0x29, 3, 0xBA, 0x2D, 0x2D, + 0x29, 3, 0xBB, 0x34, 0x34, + 0x29, 3, 0xBC, 0x34, 0x34, + 0x29, 3, 0xBD, 0x00, 0x10, + 0x29, 3, 0xBE, 0x12, 0x14, + 0x29, 3, 0xBF, 0x16, 0x18, + + 0x29, 3, 0xC0, 0x1A, 0x34, + 0x29, 3, 0xC1, 0x29, 0x2A, + 0x29, 3, 0xC2, 0x08, 0x2D, + 0x29, 3, 0xC3, 0x2D, 0x0A, + 0x29, 3, 0xC4, 0x0A, 0x2D, + 0x29, 3, 0xC5, 0x2D, 0x00, + 0x29, 3, 0xC6, 0x2A, 0x29, + 0x29, 3, 0xC7, 0x34, 0x14, + 0x29, 3, 0xC8, 0x16, 0x18, + 0x29, 3, 0xC9, 0x1A, 0x10, + 0x29, 3, 0xCA, 0x12, 0x08, + 0x29, 3, 0xCB, 0x34, 0x34, + 0x29, 3, 0xCC, 0x34, 0x2D, + 0x29, 3, 0xCD, 0x2D, 0x34, + 0x29, 3, 0xCE, 0x2D, 0x2D, + 0x29, 3, 0xCF, 0x34, 0x34, + + 0x29, 3, 0xD0, 0x34, 0x34, + 0x29, 3, 0xD1, 0x09, 0x13, + 0x29, 3, 0xD2, 0x11, 0x1B, + 0x29, 3, 0xD3, 0x19, 0x17, + 0x29, 3, 0xD4, 0x15, 0x34, + 0x29, 3, 0xD5, 0x29, 0x2A, + 0x29, 3, 0xD6, 0x01, 0x2D, + 0x29, 3, 0xD7, 0x2D, 0x0B, + 0x29, 6, 0xD8, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x29, 6, 0xD9, 0x00, 0x00, 0x00, 0x00, 0x00, + + 0x29, 3, 0xE5, 0x34, 0x34, + 0x29, 3, 0xE6, 0x34, 0x34, + 0x23, 2, 0xE7, 0x00, + 0x29, 3, 0xE8, 0x34, 0x34, + 0x29, 3, 0xE9, 0x34, 0x34, + 0x23, 2, 0xEA, 0x00, + + 0x29, 6, 0xF0, 0x55, 0xAA, 0x52, 0x00, 0x00, + + 0x13, 1, 0x35, + 0x13, 1, 0x11, + 0xFF, 120, /* delay(ms) */ + 0x13, 1, 0x29, + 0xFF, 20, /* delay(ms) */ + 0xFF, 0xFF, /* ending flag */ +}; + +static unsigned char mipi_init_off_table[] = { + 0x05, 1, 0x28, /* display off */ + 0xff, 10, /* delay 10ms */ + 0x05, 1, 0x10, /* sleep in */ + 0xff, 150, /* delay 150ms */ + 0xff, 0xff, /* ending flag */ +}; + +static int lcd_extern_driver_update(struct aml_lcd_extern_driver_s *ext_drv) +{ + int ret = 0; + + if (ext_drv) { + ext_drv->config.table_init_on = &mipi_init_on_table[0]; + ext_drv->config.table_init_off = &mipi_init_off_table[0]; + } else { + EXTERR("%s driver is null\n", LCD_EXTERN_NAME); + ret = -1; + } + + return ret; +} + +int aml_lcd_extern_mipi_p070acb_probe(struct aml_lcd_extern_driver_s *ext_drv) +{ + int ret = 0; + + ret = lcd_extern_driver_update(ext_drv); + + if (lcd_debug_print_flag) + EXTPR("%s: %d\n", __func__, ret); + return ret; +} + -- 2.7.4