M7350v7_en_gpl
This commit is contained in:
@ -52,12 +52,16 @@ typedef unsigned int boolean;
|
||||
#define FALSE 0
|
||||
#endif
|
||||
|
||||
#define ID_GC9106 0x9106
|
||||
#define ID_GC9104 0x9104
|
||||
|
||||
// reset
|
||||
static int lcd_s90319_rsx;
|
||||
|
||||
static int lcd_s90319_cs;
|
||||
static int lcd_s90319_boost_en;
|
||||
|
||||
static unsigned int lcd_id = 0;
|
||||
|
||||
enum GPIO_LCD_S90319 {
|
||||
GPIO_LCD_CS = 0,
|
||||
GPIO_LCD_RESET,
|
||||
@ -65,6 +69,8 @@ enum GPIO_LCD_S90319 {
|
||||
GPIO_LCD_RSX,
|
||||
GPIO_LCD_VDD0,
|
||||
GPIO_LCD_VDD1,
|
||||
GPIO_LCD_MOSI,
|
||||
GPIO_LCD_CLK,
|
||||
|
||||
GPIO_LCD_END,
|
||||
};
|
||||
@ -76,7 +82,8 @@ static const char *dts_gpio_name[] = {
|
||||
[GPIO_LCD_RSX] = "qcom,oled-rsx-gpio",
|
||||
[GPIO_LCD_VDD0] = "qcom,oled-vdd0-gpio",
|
||||
[GPIO_LCD_VDD1] = "qcom,oled-vdd1-gpio",
|
||||
|
||||
[GPIO_LCD_MOSI] = "qcom,oled-mosi-gpio",
|
||||
[GPIO_LCD_CLK] = "qcom,oled-clk-gpio",
|
||||
[GPIO_LCD_END] = "",
|
||||
};
|
||||
|
||||
@ -98,8 +105,6 @@ static struct spi_device *s90319_spi;
|
||||
static uint8_t frame_data[COLUMN_NUM * ROW_NUM * 2] ={0};
|
||||
static uint8_t frame_data_buf[COLUMN_NUM * ROW_NUM * 2] ={0};
|
||||
|
||||
static int lcd_s90319_rsx;
|
||||
|
||||
static struct mutex flush_mutex;
|
||||
static struct mutex oled_panel_mutex;
|
||||
|
||||
@ -304,7 +309,6 @@ static int s90319_spi_txdata(uint8_t *txdata, const uint16_t length)
|
||||
return spi_sync(s90319_spi, &spi_msg);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
Function : s90319_spi_write_cmd
|
||||
Description: transfer cmd by spi
|
||||
@ -393,7 +397,6 @@ void wr_dat(uint8_t data)
|
||||
s90319_spi_write_data(&data, 1);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
Function : oled_s90319_fill_with_pic
|
||||
Description: write pic data on location assign
|
||||
@ -415,8 +418,17 @@ static int oled_s90319_fill_with_pic(const uint8_t *pic, const uint8_t x,
|
||||
|
||||
oled_s90319_set_col_addr[1] = x + X_OFFSET;
|
||||
oled_s90319_set_col_addr[3] = x + width - 1 + X_OFFSET;
|
||||
oled_s90319_set_row_addr[1] = y + Y_OFFSET;
|
||||
oled_s90319_set_row_addr[3] = y + height - 1 + Y_OFFSET;
|
||||
|
||||
if (lcd_id == ID_GC9106 || lcd_id == ID_GC9104)
|
||||
{
|
||||
oled_s90319_set_row_addr[1] = y + Y_OFFSET_GC9106;
|
||||
oled_s90319_set_row_addr[3] = y + height - 1 + Y_OFFSET_GC9106;
|
||||
}
|
||||
else
|
||||
{
|
||||
oled_s90319_set_row_addr[1] = y + Y_OFFSET;
|
||||
oled_s90319_set_row_addr[3] = y + height - 1 + Y_OFFSET;
|
||||
}
|
||||
|
||||
for (i = 0; i < height; i++){
|
||||
for (j = 0; j < width * 2; j++)
|
||||
@ -468,89 +480,485 @@ static void s90319fb_fillrect(struct fb_info *info, const struct fb_fillrect *re
|
||||
oled_s90319_fill_with_pic(info->screen_base, x, y, width, height);
|
||||
}
|
||||
|
||||
static void lcd_s90319_panel_init(void)
|
||||
/*******************************************************************************
|
||||
Function : spi_start
|
||||
Description : Start or restart spi communication
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
Others : None
|
||||
*******************************************************************************/
|
||||
void spi_start(void)
|
||||
{
|
||||
/* End Reset Sequence */
|
||||
wr_comm(0x11); //Sleep out
|
||||
mdelay (120); //Delay 120ms
|
||||
/* Frame Rate */
|
||||
wr_comm(0xB1);
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_CS], 0);
|
||||
//oled_udelay(SPI_SPEED_DURATION);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_CS], 0);/* start condition */
|
||||
//oled_udelay(SPI_SPEED_DURATION);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Function : spi_stop
|
||||
Description : stop spi communication
|
||||
Input : None
|
||||
Output : None
|
||||
Return : None
|
||||
Others : None
|
||||
*******************************************************************************/
|
||||
void spi_stop(void)
|
||||
{
|
||||
//gpio_set_value(lcd_s90319_gpio[GPIO_LCD_CS], 1); /* stop condition */
|
||||
//oled_udelay(SPI_SPEED_DURATION);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Function : s90319_spi_txdata_byte
|
||||
Description : Transfer data, from baseband chip to spi device.
|
||||
Input : data: Data to transfer
|
||||
Output : None
|
||||
Return : None
|
||||
Others : None
|
||||
*******************************************************************************/
|
||||
void s90319_spi_txdata_byte(uint8_t data)
|
||||
{
|
||||
int i = 0;
|
||||
|
||||
for(i = 7; (i >= 0)&&(i <= 7); i--) {
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_CLK], 0);
|
||||
//oled_udelay(SPI_SPEED_DURATION);
|
||||
if(i == 7) {
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_MOSI], 0);
|
||||
}
|
||||
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_MOSI], (data >> i) & 0x01);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_CLK], 1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int spi_txdata_by_gpio(uint8_t *txdata, const uint16_t length, int compress)
|
||||
{
|
||||
uint8_t j;
|
||||
signed char m;
|
||||
uint8_t data;
|
||||
uint8_t data_first;
|
||||
uint8_t data_second;
|
||||
|
||||
spi_start();
|
||||
if (compress){
|
||||
for(j = 0; j < length; j++, txdata++) {
|
||||
data = *txdata;
|
||||
for(m = 7; (m >= 0)&&(m <= 7); m--)
|
||||
{
|
||||
if((data >> m) & 0x01)
|
||||
{
|
||||
data_first = 0x00;
|
||||
data_second = 0x00;
|
||||
}
|
||||
else
|
||||
{
|
||||
data_first = 0xFF;
|
||||
data_second = 0xFF;
|
||||
}
|
||||
s90319_spi_txdata_byte(data_first);
|
||||
s90319_spi_txdata_byte(data_second);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for(j = 0; j < length; j++, txdata++) {
|
||||
s90319_spi_txdata_byte(*txdata);
|
||||
}
|
||||
}
|
||||
|
||||
spi_stop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Function : spi_write_cmd_by_gpio
|
||||
Description : Transfer cmd.
|
||||
Input : data: cmd to transfer
|
||||
len: length of cmd
|
||||
Output : None
|
||||
Return : None
|
||||
Others : None
|
||||
*******************************************************************************/
|
||||
int spi_write_cmd_by_gpio(const uint8_t *data, const uint16_t len)
|
||||
{
|
||||
int rc = 0;
|
||||
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RSX], 0);
|
||||
mdelay(1);
|
||||
|
||||
memcpy(frame_data, data, len);
|
||||
|
||||
rc = spi_txdata_by_gpio(frame_data, len, FALSE);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Function : wr_comm
|
||||
Description : write init cmd.
|
||||
Input :
|
||||
Output : None
|
||||
Return : None
|
||||
Others : None
|
||||
*******************************************************************************/
|
||||
void wr_comm_by_gpio(uint8_t cmd)
|
||||
{
|
||||
spi_write_cmd_by_gpio(&cmd, 1);
|
||||
}
|
||||
|
||||
void oled_gpio_spi_config(void)
|
||||
{
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_MOSI], 0);
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_CS], 0);
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_BOOST_EN], 0);
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_RESET], 0);
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_CLK], 0);
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_VDD0], 0);
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_VDD1], 0);
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_RSX], 0);
|
||||
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_VDD0], 1);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_VDD1], 1);
|
||||
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_CS], 0);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RSX], 0);
|
||||
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RESET], 1);
|
||||
mdelay(120);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RESET], 0);
|
||||
mdelay(100);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RESET], 1);
|
||||
mdelay(120);
|
||||
}
|
||||
|
||||
unsigned int oled_read_data(int num)
|
||||
{
|
||||
unsigned int i=0, dat=0;
|
||||
|
||||
for(i=0;i<num;i++)
|
||||
{
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_CLK], 0);
|
||||
gpio_direction_input(lcd_s90319_gpio[GPIO_LCD_MOSI]);
|
||||
dat=(dat<<1)|gpio_get_value(lcd_s90319_gpio[GPIO_LCD_MOSI]);
|
||||
gpio_direction_output(lcd_s90319_gpio[GPIO_LCD_MOSI], 1);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_CLK], 1);
|
||||
}
|
||||
|
||||
//printk("dat:%x\n", dat);
|
||||
return dat;
|
||||
}
|
||||
|
||||
unsigned int get_lcd_id(void)
|
||||
{
|
||||
unsigned int id=0, id1=0, id2=0, id3=0;
|
||||
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_CS], 0);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RSX], 0);
|
||||
wr_comm_by_gpio(0xda);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RSX], 1);
|
||||
id1=oled_read_data(8);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RSX], 0);
|
||||
wr_comm_by_gpio(0xdb);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RSX], 1);
|
||||
id2=oled_read_data(8);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RSX], 0);
|
||||
wr_comm_by_gpio(0xdc);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_RSX], 1);
|
||||
id3=oled_read_data(8);
|
||||
gpio_set_value(lcd_s90319_gpio[GPIO_LCD_CS], 1);
|
||||
|
||||
id = id1<<16|id2<<8|id3;
|
||||
|
||||
printk("id:%x\n", id);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Function : oled_st7735t_init
|
||||
Description : init oled panel.
|
||||
Input :
|
||||
Output : None
|
||||
Return : None
|
||||
Others : None
|
||||
*******************************************************************************/
|
||||
static void oled_st7735t_init(void)
|
||||
{
|
||||
/* End ST7735T Reset Sequence */
|
||||
wr_comm(0x11); //Sleep out
|
||||
mdelay (120); //Delay 120ms
|
||||
/* ST7735T Frame Rate */
|
||||
wr_comm(0xB1);
|
||||
wr_dat(0x01);
|
||||
wr_dat(0x24);
|
||||
wr_dat(0x24);
|
||||
wr_comm(0xB2);
|
||||
wr_dat(0x01);
|
||||
wr_dat(0x24);
|
||||
wr_dat(0x24);
|
||||
wr_comm(0xB3);
|
||||
wr_dat(0x01);
|
||||
wr_dat(0x24);
|
||||
wr_dat(0x24);
|
||||
wr_dat(0x01);
|
||||
wr_dat(0x24);
|
||||
wr_dat(0x24);
|
||||
/* End ST7735T Frame Rate */
|
||||
wr_comm(0xB4); //Column inversion
|
||||
wr_dat(0x01);
|
||||
/* ST7735T Power Sequence */
|
||||
wr_comm(0xC0);
|
||||
wr_dat(0xC8);
|
||||
wr_dat(0x08);
|
||||
wr_dat(0x84);
|
||||
wr_comm(0xC1);
|
||||
wr_dat(0XC5);
|
||||
wr_comm(0xC2);
|
||||
wr_dat(0x0A);
|
||||
wr_dat(0x00);
|
||||
wr_comm(0xC3);
|
||||
wr_dat(0x8A);
|
||||
wr_dat(0x2A);
|
||||
wr_comm(0xC4);
|
||||
wr_dat(0x8A);
|
||||
wr_dat(0xEE);
|
||||
/* End ST7735T Power Sequence */
|
||||
wr_comm(0xC5); //VCOM
|
||||
wr_dat(0x22);
|
||||
wr_comm(0x36); //MX, MY, RGB mode
|
||||
wr_dat(0xc8);
|
||||
/* ST7735T Gamma Sequence */
|
||||
wr_comm(0xE0);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x1A);
|
||||
wr_dat(0x0C);
|
||||
wr_dat(0x0E);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x34);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x2F);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x2A);
|
||||
wr_dat(0x2F);
|
||||
wr_dat(0x3C);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x01);
|
||||
wr_dat(0x02);
|
||||
wr_dat(0x10);
|
||||
wr_comm(0xE1);
|
||||
wr_dat(0x04);
|
||||
wr_dat(0x1B);
|
||||
wr_dat(0x0D);
|
||||
wr_dat(0x0E);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x29);
|
||||
wr_dat(0x24);
|
||||
wr_dat(0x29);
|
||||
wr_dat(0x28);
|
||||
wr_dat(0x26);
|
||||
wr_dat(0x31);
|
||||
wr_dat(0x3B);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x03);
|
||||
wr_dat(0x12);
|
||||
/* End ST7735T Gamma Sequence */
|
||||
wr_comm(0x3A); //65k mode
|
||||
wr_dat(0x05);
|
||||
|
||||
wr_comm(0x2a);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x02);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x81);
|
||||
|
||||
wr_comm(0x2b);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x03);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x82);
|
||||
wr_comm(0x29); //Display on
|
||||
wr_comm(0x2C);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Function : oled_st7735s_init
|
||||
Description : init oled panel.
|
||||
Input :
|
||||
Output : None
|
||||
Return : None
|
||||
Others : None
|
||||
*******************************************************************************/
|
||||
static void oled_st7735s_init(void)
|
||||
{
|
||||
/* End ST7735S Reset Sequence */
|
||||
wr_comm(0x11); //Sleep out
|
||||
mdelay (120); //Delay 120ms
|
||||
/* ST7735S Frame Rate */
|
||||
wr_comm(0xB1);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x3A);
|
||||
wr_comm(0xB2);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x3A);
|
||||
wr_comm(0xB3);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x3A);
|
||||
/* End ST7735S Frame Rate */
|
||||
wr_comm(0xB4); //Column inversion
|
||||
wr_dat(0x07);
|
||||
/* ST7735S Power Sequence */
|
||||
wr_comm(0xC0);
|
||||
wr_dat(0xC8);
|
||||
wr_dat(0x08);
|
||||
wr_dat(0x84);
|
||||
wr_comm(0xC1);
|
||||
wr_dat(0XC5);
|
||||
wr_comm(0xC2);
|
||||
wr_dat(0x0A);
|
||||
wr_dat(0x00);
|
||||
wr_comm(0xC3);
|
||||
wr_dat(0x8A);
|
||||
wr_dat(0x2A);
|
||||
wr_comm(0xC4);
|
||||
wr_dat(0x8A);
|
||||
wr_dat(0xEE);
|
||||
/* End ST7735S Power Sequence */
|
||||
wr_comm(0xC5); //VCOM
|
||||
wr_dat(0x0C);
|
||||
wr_comm(0x36); //MX, MY, RGB mode
|
||||
wr_dat(0xc8);
|
||||
/* ST7735S Gamma Sequence */
|
||||
wr_comm(0xE0);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x1A);
|
||||
wr_dat(0x0C);
|
||||
wr_dat(0x0E);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x34);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x2F);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x2A);
|
||||
wr_dat(0x2F);
|
||||
wr_dat(0x3C);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x01);
|
||||
wr_dat(0x02);
|
||||
wr_dat(0x10);
|
||||
wr_comm(0xE1);
|
||||
wr_dat(0x04);
|
||||
wr_dat(0x1B);
|
||||
wr_dat(0x0D);
|
||||
wr_dat(0x0E);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x29);
|
||||
wr_dat(0x24);
|
||||
wr_dat(0x29);
|
||||
wr_dat(0x28);
|
||||
wr_dat(0x26);
|
||||
wr_dat(0x31);
|
||||
wr_dat(0x3B);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x03);
|
||||
wr_dat(0x12);
|
||||
/* End ST7735S Gamma Sequence */
|
||||
wr_comm(0x3A); //65k mode
|
||||
wr_dat(0x05);
|
||||
|
||||
wr_comm(0x2a);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x02);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x81);
|
||||
|
||||
wr_comm(0x2b);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x03);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x82);
|
||||
wr_comm(0x29); //Display on
|
||||
wr_comm(0x2C);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void oled_gc9106_init(void)
|
||||
{
|
||||
wr_comm(0xfe);
|
||||
wr_comm(0xfe);
|
||||
wr_comm(0xef);
|
||||
|
||||
wr_comm(0xb3);
|
||||
wr_dat(0x03);
|
||||
|
||||
wr_comm(0x21);
|
||||
|
||||
wr_comm(0x36);
|
||||
wr_dat(0xd8);///
|
||||
|
||||
wr_comm(0x3a);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x3A);
|
||||
wr_comm(0xB2);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x3A);
|
||||
wr_comm(0xB3);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x3A);
|
||||
/* End Frame Rate */
|
||||
wr_comm(0xB4); //Column inversion
|
||||
wr_dat(0x07);
|
||||
/* Power Sequence */
|
||||
wr_comm(0xC0);
|
||||
wr_dat(0xC8);
|
||||
wr_dat(0x08);
|
||||
wr_dat(0x84);
|
||||
wr_comm(0xC1);
|
||||
wr_dat(0XC5);
|
||||
wr_comm(0xC2);
|
||||
wr_dat(0x0A);
|
||||
wr_dat(0x00);
|
||||
wr_comm(0xC3);
|
||||
wr_dat(0x8A);
|
||||
wr_dat(0x2A);
|
||||
wr_comm(0xC4);
|
||||
wr_dat(0x8A);
|
||||
wr_dat(0xEE);
|
||||
/* End Power Sequence*/
|
||||
wr_comm(0xC5); //VCOM
|
||||
wr_dat(0x0C);
|
||||
wr_comm(0x36); //MX, MY, RGB mode
|
||||
wr_dat(0xc8);
|
||||
/* Gamma Sequence */
|
||||
wr_comm(0xE0);
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x1A);
|
||||
wr_dat(0x0C);
|
||||
wr_dat(0x0E);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0x34);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x2F);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x2A);
|
||||
wr_dat(0x2F);
|
||||
wr_dat(0x3C);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x01);
|
||||
wr_dat(0x02);
|
||||
wr_dat(0x10);
|
||||
wr_comm(0xE1);
|
||||
wr_dat(0x04);
|
||||
|
||||
wr_comm(0xb4);
|
||||
wr_dat(0x21);
|
||||
//====================
|
||||
wr_comm(0xb1);
|
||||
wr_dat(0xc0);//e6_en e7_en
|
||||
wr_comm(0xe6);
|
||||
wr_dat(0x50);//50
|
||||
wr_dat(0x43);
|
||||
wr_comm(0xe7);
|
||||
wr_dat(0x56);//38 62
|
||||
wr_dat(0x43);
|
||||
//=================
|
||||
wr_comm(0xF0);
|
||||
wr_dat(0x0B);
|
||||
wr_dat(0x4D);
|
||||
wr_dat(0x1B);
|
||||
wr_dat(0x5E);
|
||||
wr_dat(0x8C);
|
||||
wr_dat(0x2C);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x10);
|
||||
wr_dat(0x12);
|
||||
wr_dat(0x15);
|
||||
wr_dat(0x14);
|
||||
wr_dat(0x0F);
|
||||
|
||||
wr_comm(0xF1);
|
||||
wr_dat(0x01);
|
||||
wr_dat(0x28);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x3A);
|
||||
wr_dat(0xB8);
|
||||
wr_dat(0x0D);
|
||||
wr_dat(0x0E);
|
||||
wr_dat(0x2D);
|
||||
wr_dat(0x29);
|
||||
wr_dat(0x24);
|
||||
wr_dat(0x29);
|
||||
wr_dat(0x28);
|
||||
wr_dat(0x26);
|
||||
wr_dat(0x31);
|
||||
wr_dat(0x3B);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x03);
|
||||
wr_dat(0x12);
|
||||
/* End Gamma Sequence */
|
||||
wr_comm(0x3A); //65k mode
|
||||
wr_dat(0x05);
|
||||
wr_dat(0x08);
|
||||
wr_dat(0x08);
|
||||
wr_dat(0x18);
|
||||
wr_dat(0x16);
|
||||
wr_dat(0x0F);
|
||||
|
||||
wr_comm(0xfe);
|
||||
wr_comm(0xff);
|
||||
|
||||
wr_comm(0x2a);
|
||||
wr_dat(0x00);
|
||||
@ -560,12 +968,27 @@ static void lcd_s90319_panel_init(void)
|
||||
|
||||
wr_comm(0x2b);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x03);
|
||||
wr_dat(0x01);
|
||||
wr_dat(0x00);
|
||||
wr_dat(0x82);
|
||||
wr_dat(0x80);
|
||||
|
||||
wr_comm(0x29); //Display on
|
||||
wr_comm(0x2C);
|
||||
wr_comm(0x11);
|
||||
wr_comm(0x29);
|
||||
mdelay(120);
|
||||
wr_comm(0x2c);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void lcd_s90319_panel_init(void)
|
||||
{
|
||||
if (lcd_id == 0x7C89F0)
|
||||
{
|
||||
oled_st7735s_init();
|
||||
}
|
||||
else
|
||||
{
|
||||
oled_st7735t_init();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -637,13 +1060,15 @@ static void s90319_disp_powerup(void)
|
||||
s90319_state.disp_powered_up = TRUE;
|
||||
oled_s90319_power_save(1);
|
||||
|
||||
oled_gpio_spi_config();
|
||||
lcd_id = get_lcd_id();
|
||||
|
||||
gpio_direction_output(lcd_s90319_cs, 0);
|
||||
/* 1 data, 0 command*/
|
||||
gpio_direction_output(lcd_s90319_rsx, 0);
|
||||
mdelay(5);
|
||||
|
||||
gpio_set_value_cansleep(lcd_s90319_cs, 0);
|
||||
|
||||
mdelay(3);
|
||||
}
|
||||
}
|
||||
@ -714,8 +1139,17 @@ static void s90319fb_clear_screen (const struct fb_fillrect *rect)
|
||||
|
||||
oled_s90319_set_col_addr[1] = x + X_OFFSET;
|
||||
oled_s90319_set_col_addr[3] = x + width - 1 + X_OFFSET;
|
||||
oled_s90319_set_row_addr[1] = y + Y_OFFSET;
|
||||
oled_s90319_set_row_addr[3] = y + height - 1 + Y_OFFSET;
|
||||
|
||||
if (lcd_id == ID_GC9106 || lcd_id == ID_GC9104)
|
||||
{
|
||||
oled_s90319_set_row_addr[1] = y + Y_OFFSET_GC9106;
|
||||
oled_s90319_set_row_addr[3] = y + height - 1 + Y_OFFSET_GC9106;
|
||||
}
|
||||
else
|
||||
{
|
||||
oled_s90319_set_row_addr[1] = y + Y_OFFSET;
|
||||
oled_s90319_set_row_addr[3] = y + height - 1 + Y_OFFSET;
|
||||
}
|
||||
|
||||
for (i = 0; i < height; i++){
|
||||
for (j = 0; j < width * 2; j++)
|
||||
@ -786,7 +1220,7 @@ static int __init s90319fb_map_fb_memory(struct fb_info *info)
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
Function : s90319fb_unmap_video_memory
|
||||
Function : s90319fb_unmap_vdeo_memory
|
||||
Description : Free the DRAM memory of the frame buffer.
|
||||
Input : info: Frame buffer structure.
|
||||
Output : None
|
||||
|
@ -48,6 +48,7 @@ struct s90319fb_display {
|
||||
|
||||
#define X_OFFSET 2
|
||||
#define Y_OFFSET 3
|
||||
#define Y_OFFSET_GC9106 1
|
||||
|
||||
uint8_t oled_s90319_set_col_addr[] = {
|
||||
0x00, 0x00, 0x00, 0x00
|
||||
|
Reference in New Issue
Block a user