| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488 |
- /*
- * Copyright (C) 2015 MediaTek Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * 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.
- */
- #define LOG_TAG "LCM"
- #ifndef BUILD_LK
- #include <linux/string.h>
- #endif
- #ifdef BUILD_LK
- #include <platform/upmu_common.h>
- #include <platform/mt_gpio.h>
- #include <platform/mt_i2c.h>
- #include <platform/mt_pmic.h>
- #include <string.h>
- #ifndef MACH_FPGA
- #include <lcm_pmic.h>
- #endif
- #include "lcm_drv.h"
- #elif defined(BUILD_UBOOT)
- #include <asm/arch/mt_gpio.h>
- #include "lcm_drv.h"
- #else
- #include "lcm_drv.h"
- #include <linux/gpio.h>
- #include <linux/of.h>
- #include <linux/of_address.h>
- #include <linux/of_device.h>
- #include <linux/of_gpio.h>
- #include <mt-plat/upmu_common.h>//add by hxq
- #include <mach/mtk_pmic.h>//add by hxq for vldo28
- #ifdef CONFIG_OF
- #include <linux/regulator/consumer.h>
- #endif
- #endif
- #ifdef BUILD_LK
- #define LCM_LOGI(string, args...) dprintf(0, "[LK/"LOG_TAG"]"string, ##args)
- #define LCM_LOGD(string, args...) dprintf(1, "[LK/"LOG_TAG"]"string, ##args)
- #else
- #define LCM_LOGI(fmt, args...) pr_debug("[KERNEL/"LOG_TAG"]"fmt, ##args)
- #define LCM_LOGD(fmt, args...) pr_debug("[KERNEL/"LOG_TAG"]"fmt, ##args)
- #endif
- #define LCM_ID (0x98)
- static const unsigned int BL_MIN_LEVEL = 20;
- static LCM_UTIL_FUNCS lcm_util;
- #define SET_RESET_PIN(v) (lcm_util.set_reset_pin((v)))
- #define MDELAY(n) (lcm_util.mdelay(n))
- #define UDELAY(n) (lcm_util.udelay(n))
- // ---------------------------------------------------------------------------
- // Local Functions
- // ---------------------------------------------------------------------------
- #define GPIO_LCD_DVDD (GPIO55 | 0x80000000)
- #define GPIO_TP_RESET (GPIO54 | 0x80000000)
- #define GPIO_LCD_RST (GPIO45 | 0x80000000)//lcd rst stbyb
- #define dsi_set_cmdq_V22(cmdq, cmd, count, ppara, force_update) \
- lcm_util.dsi_set_cmdq_V22(cmdq, cmd, count, ppara, force_update)
- #define dsi_set_cmdq_V2(cmd, count, ppara, force_update) \
- lcm_util.dsi_set_cmdq_V2(cmd, count, ppara, force_update)
- #define dsi_set_cmdq(pdata, queue_size, force_update) \
- lcm_util.dsi_set_cmdq(pdata, queue_size, force_update)
- #define wrtie_cmd(cmd) lcm_util.dsi_write_cmd(cmd)
- #define write_regs(addr, pdata, byte_nums) \
- lcm_util.dsi_write_regs(addr, pdata, byte_nums)
- #define read_reg(cmd) \
- lcm_util.dsi_dcs_read_lcm_reg(cmd)
- #define read_reg_v2(cmd, buffer, buffer_size) \
- lcm_util.dsi_dcs_read_lcm_reg_v2(cmd, buffer, buffer_size)
- #ifndef BUILD_LK
- #include <linux/kernel.h>
- #include <linux/module.h>
- #include <linux/fs.h>
- #include <linux/slab.h>
- #include <linux/init.h>
- #include <linux/list.h>
- #include <linux/i2c.h>
- #include <linux/irq.h>
- /* #include <linux/jiffies.h> */
- /* #include <linux/delay.h> */
- #include <linux/uaccess.h>
- #include <linux/interrupt.h>
- #include <linux/io.h>
- #include <linux/platform_device.h>
- #endif
- /* static unsigned char lcd_id_pins_value = 0xFF; */
- static const unsigned char LCD_MODULE_ID = 0x01;
- #define LCM_DSI_CMD_MODE 0
- #define FRAME_WIDTH (576)
- #define FRAME_HEIGHT (1440)
- #define REGFLAG_DELAY 0xFFFC
- #define REGFLAG_UDELAY 0xFFFB
- #define REGFLAG_END_OF_TABLE 0xFFFD
- #ifndef TRUE
- #define TRUE 1
- #endif
- #ifndef FALSE
- #define FALSE 0
- #endif
- struct LCM_setting_table {
- unsigned int cmd;
- unsigned char count;
- unsigned char para_list[64];
- };
- static struct LCM_setting_table lcm_suspend_setting[] = {
-
- {0x28, 0, {} },
- {REGFLAG_DELAY, 20, {} },
- {0x10, 0, {} },
- {REGFLAG_DELAY, 120, {} },
- {REGFLAG_END_OF_TABLE, 0x00, {} }
- };
- static struct LCM_setting_table init_setting_vdo[] = {
- //------------- Display Initial Code Setting -------------------------
- //Stop reload
- {0x41, 1, {0x5A} },
-
- //INT CANCEL
- {0x4C, 1, {0x03} },
-
- //VCOM
- {0x41, 2, {0x5A,0x03} },
- {0x80, 2, {0xB0,0x00} },
- //----------------------LCD initial code start----------------------//
- //Blank 9
- {0x41, 2, {0x5A,0x09} },
- {0x80, 5, {0xa5,0x00,0xa5,0x00,0x01} },//
- //Blank 10
- {0x41, 2, {0x5A,0x0A} },
- {0x80, 16, {0xA5,0x15,0xA5,0xAA,0xA5,0x88,0x42,0x38,0x03,0x03,0x03,0x07,0x70,0x35,0x65,0x34} },
- {0x90, 16, {0x0C,0x0F,0x22,0x00,0x2A,0x18,0x64,0x00,0x88,0x03,0x03,0xEE,0xEE,0x00,0x3F,0x2A} },
- {0xA0, 16, {0x00,0x30,0x02,0x32,0x11,0x0D,0x60,0x01,0xFF,0xFF,0x03,0x40,0x42,0x0F,0x94,0x11} },
- {0xB0, 16, {0xE8,0x03,0x00,0x00,0x11,0x0D,0x60,0x00,0xFF,0xFF,0x03,0xFF,0x34,0x0C,0x0F,0x0E} },
- {0xC0, 10, {0x1F,0x03,0x00,0x08,0x20,0x34,0x00,0x00,0x00,0x00} },
- //Blank 11
- // {0x41, 2, 0x5A,0x0B} },
- //{0x80, 16, 0xFF,0xAA,0xAA,0x00,0x00,0x05,0x20,0x38,0x43,0x53,0x62,0x6F,0x70,0x7C,0x7C,0x8F} },
- //{0x90, 16, 0x76,0x65,0x67,0x5E,0x57,0x4C,0x3D,0x36,0x29,0x1A,0x07,0x03,0x00,0x05,0x20,0x38} },
- //{0xA0, 16, 0x43,0x53,0x62,0x6F,0x70,0x7C,0x7C,0x8F,0x76,0x65,0x67,0x5E,0x57,0x4C,0x3D,0x36} },
- //{0xB0, 5, 0x29,0x1A,0x07,0x03,0x00} },
- {0x41, 2, {0x5A,0x0B} },
- {0x80, 16, {0xFF,0xAA,0xAA,0x00,0x00,0x07,0x18,0x27,0x31,0x3B,0x4C,0x59,0x5B,0x67,0x69,0x7E} },
- {0x90, 16, {0x86,0x73,0x74,0x68,0x60,0x55,0x43,0x39,0x30,0x1E,0x09,0x03,0x00,0x07,0x18,0x27} },
- {0xA0, 16, {0x31,0x3B,0x4C,0x59,0x5B,0x67,0x69,0x7E,0x86,0x73,0x74,0x68,0x60,0x55,0x43,0x39} },
- {0xB0, 5, {0x30,0x1E,0x09,0x03,0x00} },
- //Blank 12
- {0x41, 2, {0x5A,0x0C} },
- {0x80, 16, {0x00,0x00,0x20,0x42,0x00,0x00,0x80,0x05,0x54,0x00,0x00,0x00,0x20,0x42,0x00,0x00} },
- {0x90, 2, {0x80,0x05} },
- //Blank 13
- {0x41, 2, {0x5A,0x0D} },
- {0x80, 16, {0x7A,0x40,0x02,0xA0,0x05,0x6E,0x01,0xE6,0x00,0x0A,0x0A,0x0A,0x0A,0x00,0x01,0x03} },
- {0x90, 16, {0x00,0x00,0x00,0x00,0xAC,0xA2,0x2A,0x00,0x00,0x00,0xAC,0xA2,0x2A,0x57,0x31,0x00} },
- {0xA0, 16, {0x01,0x00,0x00,0x00,0x00,0xAC,0xA2,0x2A,0xAA,0xC2,0x2A,0xAC,0xA2,0x2A,0xAA,0xC2} },
- {0xB0, 6, {0x2A,0x00,0x00,0x00,0xAA,0x52} },
- //Blank 14
- {0x41, 2, {0x5A,0x0E} },
- {0x80, 12, {0xF0,0xB1,0x71,0xEF,0x4B,0x00,0x37,0x0F,0xAA,0xAA,0x00,0x00} },
- //Blank 15
- {0x41, 2, {0x5A,0x0F} },
- {0x80, 11, {0xFF,0x00,0x55,0x55,0x23,0x88,0x88,0x1C,0x00,0x5A,0x5A} },
- //Blank 16
- {0x41, 2, {0x5A,0x10} },
- {0x80, 16, {0xB5,0x45,0x09,0x18,0x01,0x3C,0x94,0x32,0x10,0xC4,0xC4,0x04,0x00,0x60,0xC0,0x00} },
- {0x90, 16, {0x04,0x00,0x00,0x86,0x10,0x31,0x98,0x34,0x34,0x34,0x26,0x26,0x3E,0x1A,0x62,0x20} },
- {0xA0, 4, {0x0C,0x40,0x00,0x8A} },
- //Blank 17
- {0x41, 2, {0x5A,0x11} },
- {0x80, 16, {0x00,0x00,0x03,0xE7,0x1F,0x57,0x80,0x39,0x40,0x02,0x8F,0x1A,0x30,0x88,0x41,0x8A} },
- {0x90, 15, {0x39,0x28,0xA9,0xC5,0x9A,0x7B,0xF0,0x07,0x7E,0xE0,0x07,0x7E,0x20,0x10,0x00} },
- //Blank 18
- {0x41, 2, {0x5A,0x12} },
- {0x80, 16, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x41,0x37} },
- {0x90, 16, {0x2D,0x23,0x19,0x0F,0x05,0xFB,0xF1,0xE7,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} },
- {0xA0, 16, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} },
- {0xB0, 16, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x2D,0x23,0x05,0xFB,0x00,0x2D,0x23} },
- {0xC0, 4, {0x05,0xFB,0x00,0x01} },
- //Blank 19
- {0x41, 2, {0x5A,0x13} },
- {0x80, 16, {0xFD,0x0F,0x00,0x0C,0x00,0x80,0x00,0x81,0x00,0x07,0x22,0x06,0xE7,0xB9,0x86,0x1A} },
- {0x90, 16, {0x32,0x00,0xA2,0x2D,0x65,0x00,0x00,0x00,0x00,0xD0,0xC9,0xB7,0xFE,0x26,0x6F,0x32} },
- {0xA0, 3, {0x22,0x90,0x04} },
- //Blank 20
- {0x41, 2, {0x5A,0x14} },
- {0x80, 16, {0x91,0x01,0x80,0xA6,0xD0,0xDF,0xEF,0xF7,0xFB,0xFD,0x00,0x00,0x00,0xD0,0x8A,0x11} },
- {0x90, 16, {0x4D,0x7A,0x40,0x7C,0x68,0xD2,0x03,0x62,0x43,0x93,0x1E,0x10,0x17,0x9A,0xF4,0x80} },
- {0xA0, 16, {0x98,0xD1,0xA4,0x47,0x98,0x81,0x26,0x8D,0x00,0xA7,0x95,0xE1,0x60,0x20,0x40,0x00} },
- {0xB0, 16, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x38,0x5A,0xA3,0x55,0x00,0x80,0x42} },
- {0xC0, 16, {0xA1,0xF0,0x16,0xFE,0x5F,0x02,0xE7,0x00,0xDE,0xC1,0xFF,0x4B,0xE0,0x1C,0xC0,0x1B} },
- {0xD0, 16, {0xF8,0x7F,0x09,0x9C,0x03,0x78,0x01,0xFF,0x2F,0x81,0x73,0x00,0x6F,0xE3,0xFF,0x25} },
- {0xE0, 16, {0x70,0x0E,0xE0,0x5D,0xFC,0xBF,0x04,0xCE,0x01,0xBC,0x89,0xFF,0x97,0xC0,0x39,0x80} },
- {0xF0, 16, {0xF7,0xF0,0xFF,0x12,0x38,0x07,0x30,0x02,0x7E,0xBF,0x11,0x00,0x00,0x00,0x00,0x00} },
- //Blank 21
- {0x41, 2, {0x5A,0x15} },
- {0x80, 16, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xA4,0xAD,0xC1,0xEF} },
- {0x90, 16, {0xE7,0x01,0xA9,0x95,0x90,0x51,0xAB,0x0D,0xA1,0xD5,0x2E,0x64,0xD4,0x6A,0x43,0x68} },
- {0xA0, 16, {0xB5,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} },
- {0xB0, 16, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x26,0x00,0xE0,0x01,0x28,0x6D,0xB8,0x62} },
- {0xC0, 16, {0xE0,0xBA,0xAA,0x00,0x40,0x10,0x08,0xC2,0x30,0x10,0xD5,0xB6,0x6D,0xDB,0x86,0x2A} },
- {0xD0, 16, {0x06,0xAE,0xEB,0xEA,0x38,0x8A,0x62,0x18,0x82,0x60,0x49,0x6D,0xDB,0xB6,0x6D,0xB8} },
- {0xE0, 16, {0x62,0xE0,0xBA,0xAA,0x82,0x60,0x18,0x8A,0xE2,0x38,0x92,0xD5,0xB6,0x6D,0xDB,0x86} },
- {0xF0, 16, {0x2A,0x06,0xAE,0xEB,0xCA,0x30,0x08,0x42,0x10,0x00,0x40,0x41,0x6D,0xDB,0xB6,0x00} },
- //Blank 22
- {0x41, 2, {0x5A,0x16} },
- {0x80, 16, {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00} },
- {0x90, 10, {0x00,0x00,0x00,0x00,0x80,0x42,0x26,0x01,0x00,0x00} },
- //Blank 24
- {0x41, 2, {0x5A,0x18} },
- {0x80, 16, {0xEF,0xBD,0xF7,0xDE,0x7B,0xEF,0xBD,0x07,0x08,0x08,0x0A,0x0C,0x0C,0x0C,0x0C,0x0C} },
- {0x90, 16, {0x0C,0x0C,0x0C,0x5C,0x09,0xA8,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0xAA,0x5A} },
- {0xA0, 16, {0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x59,0x09,0x04,0xFF,0x00,0x80} },
- {0xB0, 15, {0x80,0x00,0x04,0x20,0x00,0x01,0x08,0x40,0x00,0x02,0x10,0x80,0x00,0x04,0x00} },
- //Blank 25
- {0x41, 2, {0x5A,0x19} },
- {0x80, 16, {0xF0,0xD9,0xC8,0xBA,0xAF,0xA6,0x9E,0x98,0x92,0x8D,0x88,0x84,0x00,0x60,0xF6,0xCF} },
- {0x90, 16, {0xFC,0x6F,0xF6,0xEF,0xCF,0xAF,0x0F,0xFF,0xAF,0xB5,0x71,0x0E,0x6C,0x4A,0x69,0x08} },
- {0xA0, 4, {0x00,0x00,0x02,0x00} },
- //Blank 26
- {0x41, 2, {0x5A,0x1A} },
- {0x80, 16, {0xFF,0x04,0x04,0x08,0x0C,0x00,0x10,0x14,0x18,0x1C,0x00,0x20,0x28,0x30,0x38,0x00} },
- {0x90, 16, {0x40,0x48,0x50,0x58,0x00,0x60,0x68,0x70,0x78,0x00,0x80,0x88,0x90,0x98,0x00,0xA0} },
- {0xA0, 16, {0xA8,0xB0,0xB8,0x00,0xC0,0xC8,0xD0,0xD8,0x00,0xE0,0xE8,0xF0,0xF8,0x00,0xFC,0xFE} },
- {0xB0, 16, {0xFF,0x00,0x00,0x04,0x08,0x0C,0x00,0x10,0x14,0x18,0x1C,0x00,0x20,0x28,0x30,0x38} },
- {0xC0, 16, {0x00,0x40,0x48,0x50,0x58,0x00,0x60,0x68,0x70,0x78,0x00,0x80,0x88,0x90,0x98,0x00} },
- {0xD0, 16, {0xA0,0xA8,0xB0,0xB8,0x00,0xC0,0xC8,0xD0,0xD8,0x00,0xE0,0xE8,0xF0,0xF8,0x00,0xFC} },
- {0xE0, 16, {0xFE,0xFF,0x00,0x00,0x04,0x08,0x0C,0x00,0x10,0x14,0x18,0x1C,0x00,0x20,0x28,0x30} },
- {0xF0, 16, {0x38,0x00,0x40,0x48,0x50,0x58,0x00,0x60,0x68,0x70,0x78,0x00,0x80,0x88,0x90,0x98} },
- //Blank 27
- {0x41, 2, {0x5A,0x1B} },
- {0x80, 16, {0x00,0xA0,0xA8,0xB0,0xB8,0x00,0xC0,0xC8,0xD0,0xD8,0x00,0xE0,0xE8,0xF0,0xF8,0x00} },
- {0x90, 5, {0xFC,0xFE,0xFF,0x00,0x00} },
- //Blank 28
- {0x41, 2, {0x5A,0x1C} },
- {0x80, 16, {0x33,0x22,0x00,0x03,0x5A,0x02,0x5A,0x54,0xE5,0xFF,0xC7,0x20,0x18,0x28,0x18,0x08} },
- {0x90, 16, {0x10,0x0C,0x07,0x09,0x06,0x06,0x0A,0x10,0x0C,0x09,0x0B,0x06,0x26,0xF2,0x78,0x40} },
- {0xA0, 16, {0x20,0x08,0x08,0x06,0x13,0xC0,0x34,0x1E,0x0A,0x08,0x66,0xD1,0xA0,0x1C,0x20,0x20} },
- {0xB0, 16, {0x18,0x04,0x20,0x00,0xC0,0x04,0x28,0x01,0x4C,0x00,0x23,0x18,0x10,0x0A,0x06,0xC9} },
- {0xC0, 16, {0x04,0x70,0x41,0x58,0x54,0xB5,0x4A,0x55,0x15,0x00,0x78,0xF8,0x99,0x99,0x99,0x99} },
- {0xD0, 16, {0x99,0x99,0x88,0x88,0x88,0x88,0x88,0x88,0x08,0xC4,0xE3,0x81,0x00,0x20,0x80,0x27} },
- {0xE0, 16, {0xE2,0x89,0x00,0x00,0x00,0x00,0x40,0x00,0x80,0x30,0x04,0x41,0x06,0x00,0x00,0x00} },
- {0xF0, 16, {0x00,0x92,0x24,0x49,0x92,0x04,0x00,0x00,0x00,0x00,0x92,0x04,0x00,0xC0,0x03,0x40} },
- //Blank 29
- {0x41, 2, {0x5A,0x1D} },
- {0x80, 16, {0x00,0x01,0x54,0x0B,0x23,0x18,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00} },
- //Blank 34
- {0x41, 2, {0x5A,0x22} },
- {0x80, 16, {0x00,0x5E,0x00,0x00,0x00,0x00,0x00,0x00,0x5E,0x00,0x00,0x00,0x00,0x00,0x00} },
- //Blank 36
- {0x41, 2, {0x5A,0x24} },
- {0x80, 16, {0x2D,0xD3,0x00,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x1F,0x00,0xAA,0x3E,0x00} },
- {0x90, 4, {0x00,0x00,0x00,0x00} },
- //Blank 37
- {0x41, 2, {0x5A,0x25} },
- {0x80, 16, {0x01,0x05,0x00,0x05,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF} },
- {0x90, 11, {0x0F,0x00,0x00,0x24,0x00,0x00,0x00,0x00,0xFF,0x07,0x35} },
- //Blank 38
- {0x41, 2, {0x5A,0x26} },
- {0x80, 16, {0x00,0x83,0x00,0xFF,0xFF,0x60,0x00,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0xB4,0x85} },
- {0x90, 3, {0x5A,0xA5,0x5A} },
- //----------------------LCD initial code End----------------------//
- //SPI FINISH
- {0x90, 1, {0xA5} },
- //Blank select 2F
- {0x41, 2, {0x00,0x2F} },
- { 0x11, 0x01, {0x00} },
- {REGFLAG_DELAY, 120, {} },
- { 0x29, 0x01, {0x00} },
- {REGFLAG_DELAY, 50, {} },
- { REGFLAG_END_OF_TABLE, 0x00, {} }
- };
- static void push_table(struct LCM_setting_table *table, unsigned int count, unsigned char force_update)
- {
- unsigned int i;
- for(i = 0; i < count; i++)
- {
- unsigned cmd;
- cmd = table[i].cmd;
- switch (cmd) {
- case REGFLAG_DELAY :
- if(table[i].count <= 10)
- MDELAY(table[i].count);
- else
- MDELAY(table[i].count);
- break;
-
- case REGFLAG_UDELAY :
- UDELAY(table[i].count);
- break;
- case REGFLAG_END_OF_TABLE :
- break;
- default:
- dsi_set_cmdq_V2(cmd, table[i].count, table[i].para_list, force_update);
- }
- }
- }
- static void lcm_set_util_funcs(const LCM_UTIL_FUNCS *util)
- {
- memcpy(&lcm_util, util, sizeof(LCM_UTIL_FUNCS));
- }
- static void lcm_get_params(LCM_PARAMS *params)
- {
- memset(params, 0, sizeof(LCM_PARAMS));
- params->type = LCM_TYPE_DSI;
- params->width = FRAME_WIDTH;
- params->height = FRAME_HEIGHT;
-
- params->physical_width = 48;
- params->physical_height = 119;
- #if (LCM_DSI_CMD_MODE)
- params->dsi.mode = CMD_MODE;
- #else
- params->dsi.mode = SYNC_PULSE_VDO_MODE;//SYNC_EVENT_VDO_MODE; //SYNC_PULSE_VDO_MODE;
- #endif
- /* DSI */
- /* Command mode setting */
- params->dsi.LANE_NUM = LCM_FOUR_LANE;
- /* The following defined the fomat for data coming from LCD engine. */
- //params->dsi.data_format.color_order = LCM_COLOR_ORDER_RGB;
- //params->dsi.data_format.trans_seq = LCM_DSI_TRANS_SEQ_MSB_FIRST;
- //params->dsi.data_format.padding = LCM_DSI_PADDING_ON_LSB;
- params->dsi.data_format.format = LCM_DSI_FORMAT_RGB888;
- /* Highly depends on LCD driver capability. */
- params->dsi.packet_size = 256;
- /* video mode timing */
- params->dsi.PS = LCM_PACKED_PS_24BIT_RGB888;
- params->dsi.vertical_sync_active = 8;
- params->dsi.vertical_backporch = 50;
- params->dsi.vertical_frontporch = 180;
- //params->dsi.vertical_frontporch_for_low_power = 540;
- params->dsi.vertical_active_line = FRAME_HEIGHT;
- params->dsi.horizontal_sync_active = 14;
- params->dsi.horizontal_backporch = 25;
- params->dsi.horizontal_frontporch = 45;
- params->dsi.horizontal_active_pixel = FRAME_WIDTH;
- //params->dsi.ssc_disable = 1;
- #if (LCM_DSI_CMD_MODE)
- params->dsi.PLL_CLOCK = 240;
- #else
- params->dsi.PLL_CLOCK = 240;
- #endif
- /*
- params->dsi.clk_lp_per_line_enable = 0;
- params->dsi.esd_check_enable = 1;
- params->dsi.customization_esd_check_enable = 0;
- params->dsi.lcm_esd_check_table[0].cmd = 0x0A;
- params->dsi.lcm_esd_check_table[0].count = 1;
- params->dsi.lcm_esd_check_table[0].para_list[0] = 0x9C;
- */
- }
- //add vldo28_sw_en by rq start 20181222
- #if 1
- void pmic_ldo_vldo28_sw_en(int en_value)
- {
- unsigned short read_back;
- printf("ldo : VLDO28; sw enable = %d\n", en_value);
- pmic_set_register_value(PMIC_RG_LDO_VLDO28_EN_0, en_value);
- pmic_set_register_value(PMIC_RG_LDO_VLDO28_EN_1, en_value);
- /* read back check */
- read_back = pmic_get_register_value(PMIC_RG_LDO_VLDO28_EN_0);
- printf("ldo : VLDO28; sw en_value readback = %d\n", read_back);
- }
- #endif
- //add vldo28_sw_en by rq end 20181222
- static void lcm_init(void)
- {
- int ret = 0;
- LCM_LOGD("lcm_init\n");
- mt_set_gpio_mode(GPIO_LCD_DVDD, GPIO_MODE_00);
- mt_set_gpio_dir(GPIO_LCD_DVDD, GPIO_DIR_OUT);
- mt_set_gpio_out(GPIO_LCD_DVDD, 1);//add for power
- //add power_en by rq start 20181222
- pmic_ldo_vldo28_sw_en(1);//TP power
- MDELAY(5);
- mt_set_gpio_mode(GPIO_LCD_RST, GPIO_MODE_00);
- mt_set_gpio_dir(GPIO_LCD_RST, GPIO_DIR_OUT);
- mt_set_gpio_out(GPIO_LCD_RST, 0);
- MDELAY(5);
- mt_set_gpio_mode(GPIO_TP_RESET, GPIO_MODE_00);
- mt_set_gpio_dir(GPIO_TP_RESET, GPIO_DIR_OUT);
- mt_set_gpio_out(GPIO_TP_RESET, 0);
- //add power_en by rq end 20181222
- MDELAY(10);
- mt_set_gpio_out(GPIO_TP_RESET, 1);//TP_RST on
- MDELAY(20);
- mt_set_gpio_out(GPIO_LCD_RST, 1);
- MDELAY(10);
- mt_set_gpio_out(GPIO_LCD_RST, 0);
- MDELAY(20);
- mt_set_gpio_out(GPIO_LCD_RST, 1);//LCD_RST on
- //SET_RESET_PIN(1);
- MDELAY(120);//need > 50mS
- push_table(init_setting_vdo, sizeof(init_setting_vdo) / sizeof(struct LCM_setting_table), 1);
- //MDELAY(200);
- LCM_LOGI("ft8006p----rt5081----lcm mode = vdo mode ----\n");
- }
- static void lcm_suspend(void)
- {
- int ret = 0;
- LCM_LOGD("lcm_suspend\n");
- push_table(lcm_suspend_setting, sizeof(lcm_suspend_setting) / sizeof(struct LCM_setting_table), 1);
- MDELAY(10);
- /* SET_RESET_PIN(0); */
- }
- static void lcm_resume(void)
- {
- /*LCM_LOGD("lcm_resume\n");*/
- lcm_init();
- }
- static unsigned int lcm_compare_id(void)
- {
- return 1;
- }
- /* return TRUE: need recovery */
- /* return FALSE: No need recovery */
- LCM_DRIVER ft8006p_hd720_dsi_vdo_lcm_drv = {
- .name = "ft8006p_hd720_dsi_vdo",
- .set_util_funcs = lcm_set_util_funcs,
- .get_params = lcm_get_params,
- .init = lcm_init,
- .suspend = lcm_suspend,
- .resume = lcm_resume,
- .compare_id = lcm_compare_id,
- };
|