lcd_extern: add st7701 driver

PD#157223: lcd_extern: add st7701 driver for CES

Change-Id: I49d6930c4a4358a8a97a73cbe0194a77f39f55e3
Signed-off-by: Weiming Liu <weiming.liu@amlogic.com>
This commit is contained in:
Weiming Liu
2017-12-21 18:16:25 +08:00
parent 4f40b91e06
commit 25dada32d3
8 changed files with 229 additions and 28 deletions

View File

@@ -14207,3 +14207,7 @@ AMLOGIC TXLX[R311] ADD LCD DRIVER SUPPORT
M: Weiming Liu <weiming.liu@amlogic.com>
F: arch/arm64/boot/dts/amlogic/mesontxlx_r311-panel.dtsi
F: drivers/amlogic/media/vout/backlight/aml_ldim/*
AMLOGIC ADD LCD_EXTERN ST7701 DRIVER
M: Weiming Liu <weiming.liu@amlogic.com>
F: drivers/amlogic/media/vout/lcd/lcd_extern/mipi_ST7701.c

View File

@@ -99,32 +99,27 @@
model_name = "TV070WSM";
/*interface(ttl,lvds,mipi)*/
interface = "mipi";
/* basic_setting:
* h_active,v_active,h_period,v_period,
* lcd_bits,screen_widht,screen_height
*/
basic_setting = <600 1024 680 1040 8 95 163>;
/* lcd_timing:
* hs_width,hs_bp,hs_pol,vs_width,vs_bp,vs_pol
*/
lcd_timing = <24 36 0 2 8 0>;
/* clk_attr:
* fr_adj_type(0=clock,1=htotal,2=vtotal),
* clk_ss_level,clk_auto_generate,
* pixel_clk(unit in Hz)
*/
clk_attr = <0 0 1 42400000>;
/* mipi_attr:
* lane_num, bit_rate_max(MHz),
* factor(*100, default 0 for auto),
* operation_mode_init(0=video, 1=command),
* operation_mode_display(0=video, 1=command),
* video_mode_type
* (0=sync_pulse,1=sync_event,2=burst),
* clk_lp_continuous(0=stop,1=continue),
* phy_stop_wait(0=auto,1=standard,2=slow)
*/
mipi_attr = <4 350 0 1 0 2 1 0>;
basic_setting = <600 1024 /*h_active, v_active*/
680 1040 /*h_period, v_period*/
8 /*lcd_bits*/
95 163>; /*screen_widht, screen_height*/
lcd_timing = <24 36 0 /*hs_width,hs_bp,hs_pol*/
2 8 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*/
42400000>; /*pixel_clk(unit in Hz)*/
mipi_attr = <4 /*lane_num*/
350 /*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 */
@@ -139,6 +134,48 @@
0xff 0 0 0>;
backlight_index = <0>;
};
lcd_2{
model_name = "ST7701";
/*interface(ttl,lvds,mipi)*/
interface = "mipi";
basic_setting = <480 854 /*h_active, v_active*/
570 929 /*h_period, v_period*/
8 /*lcd_bits*/
8 15>; /*screen_widht, screen_height*/
lcd_timing = <30 30 0 /*hs_width,hs_bp,hs_pol*/
5 40 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*/
31771800>; /*pixel_clk(unit in Hz)*/
mipi_attr = <2 /*lane_num*/
400 /*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 = <3>;
/* 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{
@@ -160,7 +197,7 @@
/* init on/off: (type, value..., delay),
* must match cmd_size for every group
* type: 0x00=cmd(bit[3:0]=1 for second_addr),
* 0x10=gpio, 0xff=ending
* 0xf0=gpio, 0xff=ending
* value: i2c or spi cmd, or gpio index & level,
* fill 0x0 for no use
* delay: unit ms
@@ -231,6 +268,13 @@
status = "okay";
type = <2>; /* 0=i2c, 1=spi, 2=mipi */
};
extern_3{
index = <3>;
extern_name = "mipi_ST7701";
status = "okay";
type = <2>; /* 0=i2c, 1=spi, 2=mipi */
};
};
backlight{

View File

@@ -263,6 +263,7 @@ CONFIG_AMLOGIC_LCD_TABLET=y
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_BACKLIGHT=y
CONFIG_AMLOGIC_BL_EXTERN=y
CONFIG_AMLOGIC_BL_EXTERN_I2C_LP8556=y

View File

@@ -84,3 +84,13 @@ config AMLOGIC_LCD_EXTERN_MIPI_TV070WSM
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_ST7701
bool "lcd external mipi ST7701 init driver"
default n
depends on AMLOGIC_LCD_EXTERN
help
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

View File

@@ -4,4 +4,4 @@ obj-$(CONFIG_AMLOGIC_LCD_EXTERN_SPI_LD070WS2) += spi_LD070WS2.o
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

View File

@@ -1071,6 +1071,10 @@ static int lcd_extern_add_mipi(struct aml_lcd_extern_driver_s *ext_drv)
} else if (strcmp(ext_drv->config.name, "mipi_TV070WSM") == 0) {
#ifdef CONFIG_AMLOGIC_LCD_EXTERN_MIPI_TV070WSM
ret = aml_lcd_extern_mipi_TV070WSM_probe(ext_drv);
#endif
} else if (strcmp(ext_drv->config.name, "mipi_ST7701") == 0) {
#ifdef CONFIG_AMLOGIC_LCD_EXTERN_MIPI_ST7701
ret = aml_lcd_extern_mipi_st7701_probe(ext_drv);
#endif
} else {
EXTERR("invalid driver name: %s\n", ext_drv->config.name);

View File

@@ -73,6 +73,10 @@ extern int aml_lcd_extern_mipi_KD080D13_probe(
extern int aml_lcd_extern_mipi_TV070WSM_probe(
struct aml_lcd_extern_driver_s *ext_drv);
#endif
#ifdef CONFIG_AMLOGIC_LCD_EXTERN_MIPI_ST7701
extern int aml_lcd_extern_mipi_st7701_probe(
struct aml_lcd_extern_driver_s *ext_drv);
#endif
#endif

View File

@@ -0,0 +1,134 @@
/*
* drivers/amlogic/media/vout/lcd/lcd_extern/mipi_ST7701.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 <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/platform_device.h>
#include <linux/i2c.h>
#include <linux/amlogic/i2c-amlogic.h>
#include <linux/clk.h>
#include <linux/delay.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/amlogic/media/vout/lcd/lcd_extern.h>
#include "lcd_extern.h"
#define LCD_EXTERN_NAME "mipi_ST7701"
/* ******************** 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[] = {
0x13, 1, 0x11,
//0x13, 1, 0x21,
//0x23, 2, 0x36, 0x00,
0xff, 200, /* delay(ms) */
0x29, 6, 0xff, 0x77, 0x01, 0x00, 0x00, 0x10,
0x29, 3, 0xc0, 0xe9, 0x03,
0x29, 3, 0xc1, 0x11, 0x02,
0x29, 3, 0xc2, 0x31, 0x08,
0x29, 17, 0xb0, 0x00, 0x06, 0x11, 0x12, 0x18,
0x0a, 0x0a, 0x09, 0x09, 0x1d, 0x09, 0x14,
0x10, 0x0e, 0x11, 0x19,
0x29, 17, 0xb1, 0x00, 0x06, 0x11, 0x11, 0x15,
0x09, 0x0b, 0x09, 0x09, 0x23, 0x09, 0x17,
0x14, 0x18, 0x1e, 0x19,
0x29, 6, 0xff, 0x77, 0x01, 0x00, 0x00, 0x11,
0x23, 2, 0xb0, 0x4d,
//---------Vcom Setting----------------
0x23, 2, 0xb1, 0x3a,
//---------End Vcom Setting--------------
0x23, 2, 0xb2, 0x07,
0x23, 2, 0xb3, 0x80,
0x23, 2, 0xb5, 0x47,
0x23, 2, 0xb7, 0x8a,
0x23, 2, 0xb8, 0x21,
0x23, 2, 0xc1, 0x78,
0x23, 2, 0xc2, 0x78,
0x23, 2, 0xd0, 0x88,
//-------End Power Control Registers Initial --
0xff, 100, /* delay(ms) */
//-----------GIP Setting---------------
0x29, 4, 0xe0, 0x00, 0x00, 0x02,
0x29, 12, 0xe1, 0x08, 0x00, 0x0a, 0x00, 0x07,
0x00, 0x09, 0x00, 0x00, 0x33, 0x33,
0x29, 14, 0xe2, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x29, 5, 0xe3, 0x00, 0x00, 0x33, 0x33,
0x29, 3, 0xe4, 0x44, 0x44,
0x29, 17, 0xe5, 0x0e, 0x60, 0xaf, 0xaf, 0x10, 0x60,
0xaf, 0xaf, 0x0a, 0x60, 0xaf, 0xaf, 0x0c, 0x60,
0xaf, 0xaf,
0x29, 5, 0xe6, 0x00, 0x00, 0x33, 0x33,
0x29, 3, 0xe7, 0x44, 0x44,
0x29, 17, 0xe8, 0x0d, 0x60, 0xa0, 0xa0, 0x0f, 0x60,
0xaf, 0xaf, 0x09, 0x60, 0xaf, 0xaf, 0x0b, 0x60,
0xaf, 0xaf,
0x29, 8, 0xeb, 0x02, 0x01, 0xe4, 0xe4, 0x44, 0x00, 0x40,
0x29, 3, 0xec, 0x02, 0x01,
0x29, 17, 0xed, 0xab, 0x89, 0x76, 0x54, 0x01, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0x10, 0x45, 0x67, 0x98, 0xba,
//------- Power Control Registers Initial End-----
0xff, 10, /* delay(ms) */
0x29, 6, 0xff, 0x77, 0x01, 0x00, 0x00, 0x00,
0x13, 1, 0x29,
//0x13, 1, 0x2c,
0xff, 200, /* 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_st7701_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;
}