summaryrefslogtreecommitdiff
path: root/common/wmt_display/devices
diff options
context:
space:
mode:
Diffstat (limited to 'common/wmt_display/devices')
-rwxr-xr-xcommon/wmt_display/devices/cs8556.c400
-rwxr-xr-xcommon/wmt_display/devices/lcd-AUO-A080SN01.c95
-rwxr-xr-xcommon/wmt_display/devices/lcd-CHILIN-LW700at9003.c104
-rwxr-xr-xcommon/wmt_display/devices/lcd-EKING-EK08009-70135.c103
-rwxr-xr-xcommon/wmt_display/devices/lcd-HANNSTAR-HSD101PFW2.c103
-rwxr-xr-xcommon/wmt_display/devices/lcd-INNOLUX-AT070TN83.c118
-rwxr-xr-xcommon/wmt_display/devices/lcd-lvds-1024x600.c94
-rwxr-xr-xcommon/wmt_display/devices/lcd-mipi-ssd2828.c375
-rwxr-xr-xcommon/wmt_display/devices/lcd-oem.c408
-rwxr-xr-xcommon/wmt_display/devices/lcd-setup.c212
-rwxr-xr-xcommon/wmt_display/devices/lcd.c448
-rwxr-xr-xcommon/wmt_display/devices/sil902x.c74
-rwxr-xr-xcommon/wmt_display/devices/sil902x.h71
-rwxr-xr-xcommon/wmt_display/devices/ts8224b.h446
-rwxr-xr-xcommon/wmt_display/devices/vt1625.c949
-rwxr-xr-xcommon/wmt_display/devices/vt1632.c157
16 files changed, 4157 insertions, 0 deletions
diff --git a/common/wmt_display/devices/cs8556.c b/common/wmt_display/devices/cs8556.c
new file mode 100755
index 0000000..81a6455
--- /dev/null
+++ b/common/wmt_display/devices/cs8556.c
@@ -0,0 +1,400 @@
+/*++
+ * linux/drivers/video/wmt/cs8556.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2013 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define CS8556_C
+// #define DEBUG
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../vout.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define VT1632_XXXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define VT1632_XXXX 1 *//*Example*/
+#define CS8556_ADDR 0x3d
+#define CS8556_NAME "CS8556"
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx vt1632_xxx_t; *//*Example*/
+typedef enum {
+ TV_PAL,
+ TV_NTSC,
+ TV_UNDEFINED,
+ TV_MAX
+} vout_tvformat_t;
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in vt1632.h -------------*/
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int vt1632_xxx; *//*Example*/
+static int s_cs8556_ready;
+static int s_cs8556_init;
+static int i2c_no = 1;
+static vout_tvformat_t s_tvformat = TV_MAX;
+
+static unsigned char s_CS8556_Original_Offset0[]={
+ 0xF0,0x7F,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x00,0x00,0x02,0x01,0x00,0x00,0x01,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
+};
+
+static unsigned char s_RGB888_To_PAL_Offset0[]={
+ 0x01,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x00,
+ 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x5F,0x03,0x3F,0x00,0x7D,0x00,0x53,0x03,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,
+ 0x70,0x02,0x04,0x00,0x2E,0x00,0x62,0x02,0x00,0x00,0x84,0x00,0x2B,0x00,0x36,0x00,
+ 0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xBF,0x06,0x7F,0x00,0xFE,0x00,0xA4,0x06,0x00,0x00,0x2D,0x11,0x3C,0x01,0x3A,0x01,
+ 0x70,0x02,0x04,0x00,0x12,0x00,0x34,0x01,0x00,0x00,0x70,0x70,0x70,0x00,0x00,0x00,
+ 0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x04,0x41,0x18,0x09,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0x80,0x80,0x00,0x00,0x80,0x80,0x00,0x00,
+ 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
+ 0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x24,0x1A,0x00,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x04,0x01,0xA4,0x06,0x0B,0x00,0x07,0x01,0xF0,0x00,0x00,0x00,0x00,0x04,0x40,0x01
+};
+
+static unsigned char s_RGB888_To_NTSC_Offset0[]={
+ 0x01,0x80,0x00,0x00,0x80,0x00,0x00,0x00,0x00,0x00,0x02,0x02,0x00,0x00,0x00,0x00,
+ 0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x59,0x03,0x3D,0x00,0x7E,0x00,0x49,0x03,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x00,
+ 0x0C,0x02,0x05,0x00,0x21,0x00,0x03,0x02,0x00,0x00,0x7A,0x00,0x23,0x00,0x16,0x00,
+ 0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xB3,0x06,0x7F,0x00,0x00,0x01,0xA4,0x06,0x00,0x00,0x05,0x50,0x00,0x01,0x07,0x01,
+ 0x0C,0x02,0x02,0x00,0x12,0x00,0x07,0x01,0x00,0x00,0x70,0x70,0x70,0x00,0x00,0x00,
+ 0x22,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x04,0x41,0x18,0x09,0x00,0x00,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0xFF,0xFF,0x00,0x00,0xFF,0xFF,0x00,0x00,0x80,0x80,0x00,0x00,0x80,0x80,0x00,0x00,
+ 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x80,0x80,0x80,0x80,0x00,0x00,0x00,0x00,
+ 0xFF,0x00,0xFF,0x00,0xFF,0x00,0xFF,0x00,0x80,0x00,0x80,0x00,0x80,0x00,0x80,0x00,
+ 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x01,0x24,0x1A,0x00,0x01,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+ 0x04,0x01,0xA4,0x06,0x0B,0x00,0x07,0x01,0xF0,0x00,0x00,0x00,0x00,0x04,0x00,0x00
+};
+
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void vt1632_xxx(void); *//*Example*/
+static int I2CMultiPageRead(uchar maddr, uchar page, uchar saddr, int number, uchar *value)
+{
+ int ret;
+ uchar wbuf[2];
+ struct i2c_msg_s rd[2];
+
+ wbuf[0] = page;
+ wbuf[1] = saddr;
+
+ rd[0].addr = maddr;
+ rd[0].flags = I2C_M_WR;
+ rd[0].len = 2;
+ rd[0].buf = wbuf;
+
+ rd[1].addr = maddr;
+ rd[1].flags = I2C_M_RD;
+ rd[1].len = number;
+ rd[1].buf = value;
+
+ switch(i2c_no) {
+ case 0:
+ ret = i2c_transfer(rd, 2);
+ break;
+ case 1:
+ ret = i2c1_transfer(rd, 2);
+ break;
+ case 2:
+ ret = i2c2_transfer(rd, 2);
+ break;
+ case 3:
+ ret = i2c3_transfer(rd, 2);
+ break;
+ default:
+ DBG_ERR("i2c%d isn't exist in wm8880\n", i2c_no);
+ return -1;
+
+ }
+
+ if (ret != 2) {
+ DBG_ERR("fail\n", i2c_no);
+ return -1;
+ }
+
+ return 0;
+}
+
+static int I2CMultiPageWrite(uchar maddr,uchar page,uchar saddr,int number,uchar *value)
+{
+ int ret;
+ uchar *pbuf;
+ struct i2c_msg_s wr[1];
+
+ pbuf = calloc(number + 2, sizeof(uchar));
+
+ pbuf[0] = page;
+ pbuf[1] = saddr;
+
+ memcpy(pbuf + 2, value, number);
+
+ wr[0].addr = maddr;
+ wr[0].flags = I2C_M_WR;
+ wr[0].len = number + 2;
+ wr[0].buf = pbuf;
+
+ switch(i2c_no) {
+ case 0:
+ ret = i2c_transfer(wr, 1);
+ break;
+ case 1:
+ ret = i2c1_transfer(wr, 1);
+ break;
+ case 2:
+ ret = i2c2_transfer(wr, 1);
+ break;
+ case 3:
+ ret = i2c3_transfer(wr, 1);
+ break;
+ default:
+ DBG_ERR("i2c%d isn't exist in wm8880\n", i2c_no);
+ return -1;
+
+ }
+
+ if (ret != 1) {
+ DBG_ERR("fail\n", i2c_no);
+ free(pbuf);
+ return -1;
+ }
+
+ free(pbuf);
+ return 0 ;
+}
+
+/*----------------------- Function Body --------------------------------------*/
+
+static int cs8556_check_plugin(int hotplug)
+{
+ return 1;
+}
+
+static int cs8556_init(struct vout_s *vo)
+{
+ int ret;
+ char buf[40];
+ int varlen = 40;
+ unsigned char rbuf[256] = {0};
+
+ if(s_tvformat == TV_MAX) {
+ if(wmt_getsyspara("wmt.display.tvformat", buf, &varlen) == 0) {
+ if(!strnicmp(buf, "PAL", 3))
+ s_tvformat = TV_PAL;
+ else if(!strnicmp(buf, "NTSC", 4))
+ s_tvformat = TV_NTSC;
+ else
+ s_tvformat = TV_UNDEFINED;
+ }
+ else
+ s_tvformat = TV_UNDEFINED;
+ }
+
+ if(s_tvformat == TV_UNDEFINED)
+ return -1;
+
+ if(!s_cs8556_init) {
+ if(wmt_getsyspara("wmt.cs8556.i2c", buf, &varlen) == 0) {
+ if(strlen(buf) > 0)
+ i2c_no = buf[0] - '0';
+ }
+
+ switch (i2c_no) {
+ case 0:
+ i2c_init(I2C_FAST_MODE, 0);
+ break;
+ case 1:
+ i2c1_init(I2C_FAST_MODE, 0);
+ break;
+ case 2:
+ i2c2_init(I2C_FAST_MODE, 0);
+ break;
+ case 3:
+ i2c3_init(I2C_FAST_MODE, 0);
+ break;
+ default:
+ DBG_ERR("i2c%d isn't exist in wm8850\n", i2c_no);
+ return -1;
+ }
+
+ s_cs8556_init = 1;
+ }
+
+ ret = I2CMultiPageRead(CS8556_ADDR, 0x00, 0x00, 256, rbuf);
+ if(ret) {
+ DBG_ERR("I2C address 0x%02X is not found\n", CS8556_ADDR);
+ return -1;
+ }
+
+ switch(s_tvformat) {
+ case TV_PAL:
+ ret = I2CMultiPageWrite(CS8556_ADDR, 0x00, 0x00, 256, s_RGB888_To_PAL_Offset0);
+ if(ret) {
+ DBG_ERR("PAL init fail\n");
+ return -1;
+ }
+ break;
+
+ case TV_NTSC:
+ ret = I2CMultiPageWrite(CS8556_ADDR, 0x00, 0x00, 256, s_RGB888_To_NTSC_Offset0);
+ if(ret) {
+ DBG_ERR("NTSC init fail\n");
+ return -1;
+ }
+ break;
+
+ default:
+ return -1;
+ break;
+ }
+
+ s_cs8556_ready = 1;
+
+ DPRINT("cs8556 init ok\n");
+
+ return 0;
+}
+
+int cs8556_set_mode(unsigned int *option)
+{
+ if(!s_cs8556_ready )
+ return -1;
+
+ return 0;
+}
+
+void cs8556_set_power_down(int enable)
+{
+ int ret;
+ unsigned char rbuf[256] = {0};
+
+ if( !s_cs8556_ready )
+ return;
+
+ //DPRINT("cs8556_set_power_down(%d)\n",enable);
+
+ if(enable == 0) {
+ if(hdmi_get_plugin()) {
+ DPRINT("[CVBS] HDMI plugin. CVBS power down\n");
+ enable = 1;
+ } else
+ DPRINT("[CVBS] HDMI plugout. CVBS power up\n");
+ } else
+ DPRINT("[CVBS] CVBS power down\n");
+
+ ret = I2CMultiPageRead(CS8556_ADDR, 0x00, 0x00, 256, rbuf);
+ if(ret) {
+ DBG_ERR("I2C read Offset0 fail\n");
+ return;
+ }
+
+ if( enable ){
+ if(memcmp(rbuf, s_CS8556_Original_Offset0, 5) != 0) {
+ ret = I2CMultiPageWrite(CS8556_ADDR, 0x00, 0x00, 5, s_CS8556_Original_Offset0);
+ if(ret)
+ DBG_ERR("I2C write Original_Offset0 fail\n");
+ }
+ }
+ else {
+ switch(s_tvformat) {
+ case TV_PAL:
+ if(memcmp(rbuf, s_RGB888_To_PAL_Offset0, 0x50) != 0) {
+ ret = I2CMultiPageWrite(CS8556_ADDR, 0x00, 0x00, 256, s_RGB888_To_PAL_Offset0);
+ if(ret)
+ DBG_ERR("I2C write PAL_Offset0 fail\n");
+ }
+ break;
+ case TV_NTSC:
+ if(memcmp(rbuf, s_RGB888_To_NTSC_Offset0, 0x50) !=0) {
+ ret = I2CMultiPageWrite(CS8556_ADDR, 0x00, 0x00, 256, s_RGB888_To_NTSC_Offset0);
+ if(ret)
+ DBG_ERR("I2C write NTSC_Offset0 fail\n");
+ }
+ break;
+ default:
+ break;
+ }
+ }
+}
+
+static int cs8556_config(vout_info_t *info)
+{
+ return 0;
+}
+
+static int cs8556_get_edid(char *buf)
+{
+ return -1;
+}
+
+/*
+static int cs8556_interrupt(void)
+{
+ return cs8556_check_plugin(1);
+}
+*/
+/*----------------------- vout device plugin --------------------------------------*/
+vout_dev_t cs8556_vout_dev_ops = {
+ .name = CS8556_NAME,
+ .mode = VOUT_INF_DVI,
+
+ .init = cs8556_init,
+ .set_power_down = cs8556_set_power_down,
+ .set_mode = cs8556_set_mode,
+ .config = cs8556_config,
+ .check_plugin = cs8556_check_plugin,
+ .get_edid = cs8556_get_edid,
+ //.interrupt = cs8556_interrupt,
+};
+
+int cs8556_module_init(void)
+{
+ vout_device_register(&cs8556_vout_dev_ops);
+ return 0;
+} /* End of cs8556_module_init */
+module_init(cs8556_module_init);
+
+/*--------------------End of Function Body -----------------------------------*/
+#undef CS8556_C
+
diff --git a/common/wmt_display/devices/lcd-AUO-A080SN01.c b/common/wmt_display/devices/lcd-AUO-A080SN01.c
new file mode 100755
index 0000000..f4602a1
--- /dev/null
+++ b/common/wmt_display/devices/lcd-AUO-A080SN01.c
@@ -0,0 +1,95 @@
+/*++
+ * linux/drivers/video/wmt/lcd-AUO-A080SN01.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define LCD_AUO_A080SN01_C
+/* #define DEBUG */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../lcd.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define LCD_A080SN01_XXXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define LCD_A080SN01_XXXX 1 *//*Example*/
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx lcd_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in lcd.h -------------*/
+static void lcd_a080sn01_initial(void);
+
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int lcd_xxx; *//*Example*/
+struct lcd_parm_t lcd_a080sn01_parm = {
+ .bits_per_pixel = 24,
+ .capability = 0,
+ .vmode = {
+ .name = "AUO A080SN01",
+ .refresh = 60,
+ .xres = 800,
+ .yres = 600,
+ .pixclock = KHZ2PICOS(40000),
+ .left_margin = 88,
+ .right_margin = 40,
+ .upper_margin = 24,
+ .lower_margin = 1,
+ .hsync_len = 128,
+ .vsync_len = 3,
+ .sync = 0,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 162,
+ .height = 121,
+ .initial = lcd_a080sn01_initial,
+};
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void lcd_xxx(void); *//*Example*/
+
+/*----------------------- Function Body --------------------------------------*/
+static void lcd_a080sn01_initial(void)
+{
+ DPRINT("lcd_a080sn01_initial\n");
+
+ /* TODO */
+}
+
+struct lcd_parm_t *lcd_a080sn01_get_parm(int arg)
+{
+ return &lcd_a080sn01_parm;
+}
+
+int lcd_a080sn01_init(void)
+{
+ int ret;
+
+ ret = lcd_panel_register(LCD_AUO_A080SN01,
+ (void *) lcd_a080sn01_get_parm);
+ return ret;
+} /* End of lcd_a080sn01_init */
+module_init(lcd_a080sn01_init);
+
+/*--------------------End of Function Body -----------------------------------*/
+#undef LCD_AUO_A080SN01_C
+
diff --git a/common/wmt_display/devices/lcd-CHILIN-LW700at9003.c b/common/wmt_display/devices/lcd-CHILIN-LW700at9003.c
new file mode 100755
index 0000000..af9752b
--- /dev/null
+++ b/common/wmt_display/devices/lcd-CHILIN-LW700at9003.c
@@ -0,0 +1,104 @@
+/*++
+ * linux/drivers/video/wmt/lcd-CHILIN-LW700at9003.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define LCD_CHILIN_LW700AT9003_C
+/* #define DEBUG */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../lcd.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define LCD_LW700AT9003_XXXX xxxx *//*Example*/
+
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define LCD_LW700AT9003_XXXX 1 *//*Example*/
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx lcd_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in lcd.h -------------*/
+static void lcd_lw700at9003_power_on(void);
+static void lcd_lw700at9003_power_off(void);
+
+/*----------------------- INTERNAL PRIVATE VARIABLES ------------------------*/
+/* int lcd_xxx; *//*Example*/
+struct lcd_parm_t lcd_lw700at9003_parm = {
+ .bits_per_pixel = 18,
+ .capability = LCD_CAP_CLK_HI,
+ .vmode = {
+ .name = "CHILIN LW700AT9003",
+ .refresh = 48,
+ .xres = 800,
+ .yres = 480,
+ .pixclock = KHZ2PICOS(33260),
+ .left_margin = 105,
+ .right_margin = 105,
+ .upper_margin = 23,
+ .lower_margin = 22,
+ .hsync_len = 40,
+ .vsync_len = 5,
+ .sync = 0,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 152,
+ .height = 91,
+ .initial = lcd_lw700at9003_power_on,
+ .uninitial = lcd_lw700at9003_power_off,
+};
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void lcd_xxx(void); *//*Example*/
+
+/*----------------------- Function Body --------------------------------------*/
+static void lcd_lw700at9003_power_on(void)
+{
+ DPRINT("lcd_lw700at9003_power_on\n");
+ /* TODO */
+}
+
+static void lcd_lw700at9003_power_off(void)
+{
+ DPRINT("lcd_lw700at9003_power_off\n");
+
+ /* TODO */
+}
+
+struct lcd_parm_t *lcd_lw700at9003_get_parm(int arg)
+{
+ lcd_lw700at9003_parm.bits_per_pixel = arg;
+ return &lcd_lw700at9003_parm;
+}
+
+int lcd_lw700at9003_init(void)
+{
+ int ret;
+
+ ret = lcd_panel_register(LCD_CHILIN_LW0700AT9003,
+ (void *) lcd_lw700at9003_get_parm);
+ return ret;
+} /* End of lcd_oem_init */
+module_init(lcd_lw700at9003_init);
+
+/*--------------------End of Function Body -----------------------------------*/
+#undef LCD_CHILIN_LW700AT9003_C
diff --git a/common/wmt_display/devices/lcd-EKING-EK08009-70135.c b/common/wmt_display/devices/lcd-EKING-EK08009-70135.c
new file mode 100755
index 0000000..1d40188
--- /dev/null
+++ b/common/wmt_display/devices/lcd-EKING-EK08009-70135.c
@@ -0,0 +1,103 @@
+/*++
+ * linux/drivers/video/wmt/lcd-EKING_EK08009-70135.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define LCD_EKING_EK08009_C
+/* #define DEBUG */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../lcd.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define LCD_EK08009_XXXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define LCD_EK08009_XXXX 1 *//*Example*/
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx lcd_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in lcd.h -------------*/
+static void lcd_ek08009_power_on(void);
+static void lcd_ek08009_power_off(void);
+
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int lcd_xxx; *//*Example*/
+struct lcd_parm_t lcd_ek08009_parm = {
+ .bits_per_pixel = 18,
+ .capability = LCD_CAP_CLK_HI,
+ .vmode = {
+ .name = "EKING EK08009",
+ .refresh = 60,
+ .xres = 800,
+ .yres = 600,
+ .pixclock = KHZ2PICOS(40000),
+ .left_margin = 46,
+ .right_margin = 210,
+ .upper_margin = 24,
+ .lower_margin = 12,
+ .hsync_len = 1,
+ .vsync_len = 1,
+ .sync = 0,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 162,
+ .height = 162,
+ .initial = lcd_ek08009_power_on,
+ .uninitial = lcd_ek08009_power_off,
+};
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void lcd_xxx(void); *//*Example*/
+
+/*----------------------- Function Body --------------------------------------*/
+static void lcd_ek08009_power_on(void)
+{
+ DPRINT("lcd_ek08009_power_on\n");
+
+ /* TODO */
+}
+
+static void lcd_ek08009_power_off(void)
+{
+ DPRINT("lcd_ek08009_power_off\n");
+
+ /* TODO */
+}
+
+struct lcd_parm_t *lcd_ek08009_get_parm(int arg)
+{
+ return &lcd_ek08009_parm;
+}
+
+int lcd_ek08009_init(void)
+{
+ int ret;
+
+ ret = lcd_panel_register(LCD_EKING_EK08009,
+ (void *) lcd_ek08009_get_parm);
+ return ret;
+} /* End of lcd_oem_init */
+module_init(lcd_ek08009_init);
+
+/*--------------------End of Function Body -----------------------------------*/
+#undef LCD_EKING_EK08009_C
diff --git a/common/wmt_display/devices/lcd-HANNSTAR-HSD101PFW2.c b/common/wmt_display/devices/lcd-HANNSTAR-HSD101PFW2.c
new file mode 100755
index 0000000..438e3fe
--- /dev/null
+++ b/common/wmt_display/devices/lcd-HANNSTAR-HSD101PFW2.c
@@ -0,0 +1,103 @@
+/*++
+ * linux/drivers/video/wmt/lcd-HANNSTAR-HSD101PFW2.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define LCD_EKING_HSD101PFW2_C
+/* #define DEBUG */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../lcd.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define LCD_HSD101PFW2_XXXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define LCD_HSD101PFW2_XXXX 1 *//*Example*/
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx lcd_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in lcd.h -------------*/
+static void lcd_HSD101PFW2_power_on(void);
+static void lcd_HSD101PFW2_power_off(void);
+
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int lcd_xxx; *//*Example*/
+struct lcd_parm_t lcd_HSD101PFW2_parm = {
+ .bits_per_pixel = 18,
+ .capability = 0,
+ .vmode = {
+ .name = "HANNSTAR HSD101PFW2",
+ .refresh = 60,
+ .xres = 1024,
+ .yres = 600,
+ .pixclock = KHZ2PICOS(45000),
+ .left_margin = 44,
+ .right_margin = 88,
+ .upper_margin = 10,
+ .lower_margin = 5,
+ .hsync_len = 44,
+ .vsync_len = 10,
+ .sync = FB_SYNC_VERT_HIGH_ACT,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 222,
+ .height = 125,
+ .initial = lcd_HSD101PFW2_power_on,
+ .uninitial = lcd_HSD101PFW2_power_off,
+};
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void lcd_xxx(void); *//*Example*/
+
+/*----------------------- Function Body --------------------------------------*/
+static void lcd_HSD101PFW2_power_on(void)
+{
+ DPRINT("lcd_HSD101PFW2_power_on\n");
+
+ /* TODO */
+}
+
+static void lcd_HSD101PFW2_power_off(void)
+{
+ DPRINT("lcd_HSD101PFW2_power_off\n");
+
+ /* TODO */
+}
+
+struct lcd_parm_t *lcd_HSD101PFW2_get_parm(int arg)
+{
+ return &lcd_HSD101PFW2_parm;
+}
+
+int lcd_HSD101PFW2_init(void)
+{
+ int ret;
+
+ ret = lcd_panel_register(LCD_HANNSTAR_HSD101PFW2,
+ (void *) lcd_HSD101PFW2_get_parm);
+ return ret;
+} /* End of lcd_oem_init */
+module_init(lcd_HSD101PFW2_init);
+
+/*--------------------End of Function Body -----------------------------------*/
+#undef LCD_EKING_HSD101PFW2_C
diff --git a/common/wmt_display/devices/lcd-INNOLUX-AT070TN83.c b/common/wmt_display/devices/lcd-INNOLUX-AT070TN83.c
new file mode 100755
index 0000000..7c1da49
--- /dev/null
+++ b/common/wmt_display/devices/lcd-INNOLUX-AT070TN83.c
@@ -0,0 +1,118 @@
+/*++
+ * linux/drivers/video/wmt/lcd-INNOLUX-AT070TN83.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define LCD_INNOLUX_AT070TN83_C
+/* #define DEBUG */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../lcd.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define LCD_AT070TN83_XXXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define LCD_AT070TN83_XXXX 1 *//*Example*/
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx lcd_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in lcd.h -------------*/
+static void lcd_at070tn83_initial(void);
+static void lcd_at070tn83_uninitial(void);
+
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int lcd_xxx; *//*Example*/
+struct lcd_parm_t lcd_at070tn83_parm = {
+ .bits_per_pixel = 18,
+ .capability = LCD_CAP_CLK_HI,
+ .vmode = {
+ .name = "INNOLUX AT707TN83",
+ .refresh = 60,
+ .xres = 800,
+ .yres = 480,
+ .pixclock = KHZ2PICOS(33333),
+ .left_margin = 45,
+ .right_margin = 210,
+ .upper_margin = 22,
+ .lower_margin = 22,
+ .hsync_len = 1,
+ .vsync_len = 1,
+ .sync = 0,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 154,
+ .height = 85,
+ .initial = lcd_at070tn83_initial,
+ .uninitial = lcd_at070tn83_uninitial,
+};
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void lcd_xxx(void); *//*Example*/
+
+/*----------------------- Function Body --------------------------------------*/
+static void lcd_at070tn83_initial(void)
+{
+#if 0
+ outl(inl(GPIO_BASE_ADDR + 0x80) | BIT0, GPIO_BASE_ADDR + 0x80);
+ outl(inl(GPIO_BASE_ADDR + 0x4C) | BIT28, GPIO_BASE_ADDR + 0x4C);
+ outl(inl(GPIO_BASE_ADDR + 0x8C) | BIT28, GPIO_BASE_ADDR + 0x8C);
+ /* DVDD */
+ /* T2 > 0ms */ /* AVDD/VCOM(NANDQS) */
+ outl(inl(GPIO_BASE_ADDR + 0xCC) | BIT28, GPIO_BASE_ADDR + 0xCC);
+ /* T4 > 0ms */
+ /* VGH */
+ /* 0 < T6 <= 10ms */
+ lcd_enable_signal(1); /* signal, DVO enable */
+ lcd_oem_enable_backlight(200); /* T12 > 200ms, BL(bit0) */
+#endif
+}
+
+static void lcd_at070tn83_uninitial(void)
+{
+#if 0
+ /* BL(bit0) */
+ outl(inl(GPIO_BASE_ADDR + 0xC0) & ~BIT0, GPIO_BASE_ADDR + 0xC0);
+ mdelay(200); /* T12 > 200ms */
+ lcd_enable_signal(0); /* singal, DVO enable */
+ /* AVDD/VCOM(NANDQS) */
+ outl(inl(GPIO_BASE_ADDR + 0xCC) & ~BIT28, GPIO_BASE_ADDR + 0xCC);
+#endif
+}
+
+struct lcd_parm_t *lcd_at070tn83_get_parm(int arg)
+{
+ return &lcd_at070tn83_parm;
+}
+
+int lcd_at070tn83_init(void)
+{
+ int ret;
+
+ ret = lcd_panel_register(LCD_INNOLUX_AT070TN83,
+ (void *) lcd_at070tn83_get_parm);
+ return ret;
+} /* End of lcd_oem_init */
+module_init(lcd_at070tn83_init);
+
+/*--------------------End of Function Body -----------------------------------*/
+#undef LCD_INNOLUX_AT070TN83_C
diff --git a/common/wmt_display/devices/lcd-lvds-1024x600.c b/common/wmt_display/devices/lcd-lvds-1024x600.c
new file mode 100755
index 0000000..952a276
--- /dev/null
+++ b/common/wmt_display/devices/lcd-lvds-1024x600.c
@@ -0,0 +1,94 @@
+/*++
+ * linux/drivers/video/wmt/lcd-lvds-1024x600.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define LCD_LVDS_1024x600_C
+/* #define DEBUG */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../lcd.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define LCD_LVDS_1024x600_XXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define LCD_LVDS_1024x600_XXXX 1 *//*Example*/
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx lcd_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in lcd.h -------------*/
+static void lcd_LVDS_1024x600_initial(void);
+
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int lcd_xxx; *//*Example*/
+struct lcd_parm_t lcd_LVDS_1024x600_parm = {
+ .bits_per_pixel = 24,
+ .capability = LCD_CAP_VSYNC_HI,
+ .vmode = {
+ .name = "ePAD 1024x600", /* LVDS_1024x600 */
+ .refresh = 60,
+ .xres = 1024,
+ .yres = 600,
+ .pixclock = KHZ2PICOS(45000),
+ .left_margin = 50,
+ .right_margin = 50,
+ .upper_margin = 10,
+ .lower_margin = 10,
+ .hsync_len = 4,
+ .vsync_len = 4,
+ .sync = FB_SYNC_VERT_HIGH_ACT,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 222,
+ .height = 125,
+ .initial = lcd_LVDS_1024x600_initial,
+};
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void lcd_xxx(void); *//*Example*/
+
+/*----------------------- Function Body --------------------------------------*/
+static void lcd_LVDS_1024x600_initial(void)
+{
+ DPRINT("lcd_LVDS_1024x600_initial\n");
+
+ /* TODO */
+}
+
+struct lcd_parm_t *lcd_LVDS_1024x600_get_parm(int arg)
+{
+ return &lcd_LVDS_1024x600_parm;
+}
+
+int lcd_LVDS_1024x600_init(void)
+{
+ int ret;
+
+ ret = lcd_panel_register(LCD_LVDS_1024x600,
+ (void *) lcd_LVDS_1024x600_get_parm);
+ return ret;
+} /* End of lcd_oem_init */
+module_init(lcd_LVDS_1024x600_init);
+
+/*--------------------End of Function Body -----------------------------------*/
+#undef LCD_1024x600_C
diff --git a/common/wmt_display/devices/lcd-mipi-ssd2828.c b/common/wmt_display/devices/lcd-mipi-ssd2828.c
new file mode 100755
index 0000000..92d0b98
--- /dev/null
+++ b/common/wmt_display/devices/lcd-mipi-ssd2828.c
@@ -0,0 +1,375 @@
+/*
+ * ==========================================================================
+ *
+ * Filename: lcd-b079xan01.c
+ *
+ * Description:
+ *
+ * Version: 0.01
+ * Created: Thursday, December 27, 2012 02:50:05 HKT
+ *
+ * Author: Sam Mei (),
+ * Company:
+ *
+ * ==========================================================================
+ */
+
+#include <common.h>
+#include <command.h>
+#include <asm/types.h>
+#include <asm/byteorder.h>
+
+#include "../../../board/wmt/include/wmt_spi.h"
+#include "../../../board/wmt/include/wmt_iomux.h"
+
+#include "../lcd.h"
+
+#define DELAY_MASK 0xff000000
+#define CHIPSELECT 0
+
+extern void spi1_write_then_read_data(unsigned char *wbuf, unsigned char *rbuf,
+ int num, int clk_mode, int chip_sel);
+
+static inline void __spi_write(u8 *buf, int len)
+{
+ spi1_write_then_read_data(buf, buf, sizeof(buf), SPI_MODE_3, CHIPSELECT);
+ udelay(10);
+}
+
+static void ssd2828_read(uint8_t reg, uint16_t *data)
+{
+ uint8_t buf1[3] = { 0x70, 0x00, 0x00 };
+ uint8_t buf2[3] = { 0x73, 0x00, 0x00 };
+
+ buf1[2] = reg;
+
+ spi1_write_then_read_data(buf1, buf1, sizeof(buf1), SPI_MODE_3, CHIPSELECT);
+ udelay(10);
+
+ spi1_write_then_read_data(buf2, buf1, sizeof(buf2), SPI_MODE_3, CHIPSELECT);
+ udelay(10);
+
+ *data = (buf1[1] << 8) | buf1[2];
+}
+
+static inline void spi_write_24bit(uint32_t data)
+{
+ uint8_t buf[3];
+
+ buf[0] = (data >> 16) & 0xff;
+ buf[1] = (data >> 8) & 0xff;
+ buf[2] = data & 0xff;
+
+ __spi_write(buf, 3);
+}
+
+static void ssd2828_reset(void)
+{
+ gpio_direction_output(14, 1);
+ mdelay(10);
+
+ gpio_direction_output(WMT_PIN_GP0_GPIO0, 1);
+ mdelay(10);
+ gpio_direction_output(WMT_PIN_GP0_GPIO0, 0);
+ mdelay(20);
+ gpio_direction_output(WMT_PIN_GP0_GPIO0, 1);
+ mdelay(20);
+}
+
+// BP080WX7
+
+static const uint32_t ssd2828_bp080wx7[] = {
+ 0x7000B1, // VSA=02 , HSA=02
+ 0x720202,
+ 0x7000B2, // VBP+VSA=8, HBP+HSA=40
+ 0x720828,
+ 0x7000B3, // VFP=04 , HFP=10
+ 0x72040A,
+ 0x7000B4, // HACT=1280
+ 0x720500,
+ 0x7000B5, // vACT=800
+ 0x720320,
+ 0x7000B6, // Non burst mode with sync event 24bpp
+ 0x720007,
+
+ //DELAY_MASK + 10,
+
+ 0x7000DE, // 4lanes
+ 0x720003,
+ 0x7000D6, //BGR
+ 0x720005,
+ 0x7000B9,
+ 0x720000,
+
+ //DELAY_MASK + 10,
+ 0x7000BA, //PLL=24*16 = 384MHz
+ 0x72C012,
+ 0x7000BB, //LP CLK=8.3MHz
+ 0x720008,
+ 0x7000B9,
+ 0x720001,
+
+ //DELAY_MASK + 200,
+ 0x7000B8, // Virtual Channel 0
+ 0x720000,
+
+ 0x7000B7, //LP Mode
+ 0x720342,
+
+ //DELAY_MASK + 10,
+ 0x7000BC,
+ 0x720000,
+ 0x700011, //sleep out
+
+ DELAY_MASK + 200,
+ 0x7000BC,
+ 0x720000,
+ 0x700029, //display on
+
+ // DELAY_MASK + 50, //Video Mode
+ 0x7000B7,
+ 0x72034B,
+
+ DELAY_MASK + 200,
+ 0x7000BC,
+ 0x720000,
+ 0x700029, //display on
+};
+
+static int bp080wx7_init(void)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(ssd2828_bp080wx7); i++) {
+ if ((ssd2828_bp080wx7[i] & DELAY_MASK) == DELAY_MASK) {
+ mdelay(ssd2828_bp080wx7[i] & 0xff);
+ } else {
+ spi_write_24bit(ssd2828_bp080wx7[i]);
+ }
+ }
+
+ return 0;
+}
+
+static void lcd_bp080wx7_on(void)
+{
+ uint16_t id;
+
+ printf("%s\n", __FUNCTION__);
+ ssd2828_reset();
+
+ ssd2828_read(0xb0, &id);
+ if (id == 0x2828) {
+ printf("found SSD2828!\n");
+ bp080wx7_init();
+ lcd_enable_signal(1); /* singal on */
+ } else
+ printf("Error: SSD2828 not found! (0x%x)\n", id);
+}
+
+static void lcd_bp080wx7_off(void)
+{
+ lcd_enable_signal(0); /* singal on */
+ printf("lcd_b079xan01_power_off\n");
+}
+
+//Timing parameter for 3.0" QVGA LCD
+#define VBPD (6)
+#define VFPD (4)
+#define VSPW (2)
+
+#define HBPD (38)
+#define HFPD (10)
+#define HSPW (2)
+
+static struct lcd_parm_t lcd_bp080wx7_parm = {
+ .bits_per_pixel = 24,
+ .capability = 0,
+ .vmode = {
+ .name = "BP080WX7",
+ .refresh = 60,
+ .xres = 1280,
+ .yres = 800,
+ .pixclock = KHZ2PICOS(64800),
+ .left_margin = HBPD,
+ .right_margin = HFPD,
+ .upper_margin = VBPD,
+ .lower_margin = VFPD,
+ .hsync_len = HSPW,
+ .vsync_len = VSPW,
+ .sync = 0, //FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .initial = lcd_bp080wx7_on,
+ .uninitial = lcd_bp080wx7_off,
+};
+
+static struct lcd_parm_t *lcd_bp080wx7_get_parm(int arg)
+{
+ return &lcd_bp080wx7_parm;
+}
+
+// B079XAN01
+
+static const uint32_t ssd2828_b079xan01[] = {
+ 0x7000B1, //VSA=50, HAS=64
+ 0x723240,
+ 0x7000B2, //VBP=30+50, HBP=56+64
+ 0x725078,
+ 0x7000B3, //VFP=36, HFP=60
+ 0x72243C,
+ 0x7000B4, //HACT=768
+ 0x720300,
+ 0x7000B5, //VACT=1024
+ 0x720400,
+ 0x7000B6,
+ 0x72000b, //burst mode, 24bpp loosely packed
+ 0x7000DE, //no of lane=4
+ 0x720003,
+ 0x7000D6, //RGB order and packet number in blanking period
+ 0x720005,
+ 0x7000B9, //disable PLL
+ 0x720000,
+ 0x7000BA, //lane speed=576 (24MHz * 24 = 576)
+ 0x728018, //may modify according to requirement, 500Mbps to 560Mbps
+ 0x7000BB, //LP clock
+ 0x720008, // 576 / 9 / 8 = 8 MHz
+ 0x7000B9, //enable PPL
+ 0x720001,
+ 0x7000C4, //enable BTA
+ 0x720001,
+ 0x7000B7, //enter LP mode
+ 0x720342,
+ 0x7000B8, //VC
+ 0x720000,
+ 0x7000BC, //set packet size
+ 0x720000,
+ 0x700011, //sleep out cmd
+
+ DELAY_MASK + 200,
+ 0x700029, //display on
+ DELAY_MASK + 200,
+ 0x7000B7, //video mode on
+ 0x72030b,
+};
+
+static int b079xan01_init(void)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(ssd2828_b079xan01); i++) {
+ if ((ssd2828_b079xan01[i] & DELAY_MASK) == DELAY_MASK) {
+ mdelay(ssd2828_b079xan01[i] & 0xff);
+ } else {
+ spi_write_24bit(ssd2828_b079xan01[i]);
+ }
+ }
+ return 0;
+}
+
+static void lcd_b079xan01_initial(void)
+{
+ uint16_t id;
+
+ printf("%s\n", __FUNCTION__);
+ ssd2828_reset();
+
+ ssd2828_read(0xb0, &id);
+ if (id == 0x2828) {
+ printf("found SSD2828!\n");
+ b079xan01_init();
+ lcd_enable_signal(1); /* singal on */
+ } else
+ printf("Error: SSD2828 not found! (0x%x)\n", id);
+}
+
+static void lcd_b079xan01_uninitial(void)
+{
+ lcd_enable_signal(0); /* singal on */
+ printf("lcd_b079xan01_power_off\n");
+}
+
+static struct lcd_parm_t lcd_b079xan01_parm = {
+ .bits_per_pixel = 24,
+ .capability = 0,
+ .vmode = {
+ .name = "B079XAN01",
+ .refresh = 60,
+ .xres = 768,
+ .yres = 1024,
+ .pixclock = KHZ2PICOS(64800),
+ .left_margin = 56,
+ .right_margin = 60,
+ .upper_margin = 30,
+ .lower_margin = 36,
+ .hsync_len = 64,
+ .vsync_len = 50,
+ .sync = 0, //FB_SYNC_VERT_HIGH_ACT | FB_SYNC_HOR_HIGH_ACT,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .initial = lcd_b079xan01_initial,
+ .uninitial = lcd_b079xan01_uninitial,
+};
+
+static struct lcd_parm_t *lcd_b079xan01_get_parm(int arg)
+{
+ return &lcd_b079xan01_parm;
+}
+
+int lcd_ssd2828_init(void)
+{
+ lcd_panel_register(LCD_B079XAN01, (void *) lcd_b079xan01_get_parm);
+ lcd_panel_register(LCD_BP080WX7, (void *) lcd_bp080wx7_get_parm);
+ return 0;
+}
+
+module_init(lcd_ssd2828_init);
+
+static void ssd2828_register_dump(void)
+{
+ int reg;
+ uint16_t data;
+
+ for (reg = 0xb0; reg <= 0xff; reg++) {
+ ssd2828_read(reg, &data);
+ printf("reg 0x%02X : 0x%04x\n", reg, data);
+ }
+}
+
+static int do_b0lcd(cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
+{
+ if (argc == 1)
+ return 0;
+
+ if (!strcmp(argv[1], "fill")) {
+ mv_Rect rect;
+ uint32_t color;
+
+ if (argc != 7) {
+ printf("hx fill left top right bottom color\n");
+ return 0;
+ }
+
+ rect.left = simple_strtoul(argv[2], NULL, 10);
+ rect.top = simple_strtoul(argv[3], NULL, 10);
+ rect.right = simple_strtoul(argv[4], NULL, 10);
+ rect.bottom = simple_strtoul(argv[5], NULL, 10);
+
+ color = simple_strtoul(argv[6], NULL, 16);
+
+ printf("fill %d %d %d %d 0x%x\n",
+ rect.left, rect.top, rect.right, rect.bottom, color);
+ mv_fillRect(&rect, (color >> 16) & 0xff, (color >> 8) & 0xff, color & 0xff);
+ } else if (!strcmp(argv[1], "dump")) {
+ ssd2828_register_dump();
+ }
+
+ return 0;
+}
+
+U_BOOT_CMD(b0, 10, 1, do_b0lcd,
+ "bmp - manipulate BMP image data\n",
+ "info <imageAddr> - display image info\n"
+ "bmp display <imageAddr> [x y] - display image at x,y\n");
diff --git a/common/wmt_display/devices/lcd-oem.c b/common/wmt_display/devices/lcd-oem.c
new file mode 100755
index 0000000..387f42c
--- /dev/null
+++ b/common/wmt_display/devices/lcd-oem.c
@@ -0,0 +1,408 @@
+/*++
+ * linux/drivers/video/wmt/lcd-oem.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define LCD_OEM_C
+/* #define DEBUG */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../lcd.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define LCD_OEM_XXXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define LCD_OEM_XXXX 1 *//*Example*/
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx lcd_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in lcd.h -------------*/
+
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int lcd_xxx; *//*Example*/
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void lcd_xxx(void); *//*Example*/
+#ifdef CONFIG_UBOOT
+int lcd_bl_time;
+void lcd_uboot_set_backlight(void)
+{
+ int cur;
+ do {
+ wmt_read_ostc(&cur);
+ } while (cur < lcd_bl_time);
+ REG32_VAL(GPIO_BASE_ADDR + 0xC0) |= 0x800; /* BL( bit 11 ) */
+}
+
+#endif
+
+void lcd_oem_enable_backlight(int wait_ms)
+{
+#ifdef CONFIG_UBOOT
+ wmt_read_ostc(&lcd_bl_time);
+ lcd_bl_time += (wait_ms * 1000);
+#else
+ mdelay(wait_ms);
+ REG32_VAL(GPIO_BASE_ADDR + 0xC0) |= 0x800;
+#endif
+}
+
+#ifndef CONFIG_VPP_SHENZHEN
+static void lcd_oem_initial(void)
+{
+ outl(inl(GPIO_BASE_ADDR + 0x80) | 0x801, GPIO_BASE_ADDR + 0x80);
+ outl(inl(GPIO_BASE_ADDR + 0xC0) | 0x801, GPIO_BASE_ADDR + 0xC0);
+ lcd_enable_signal(1);
+}
+
+static void lcd_oem_uninitial(void)
+{
+ outl(inl(GPIO_BASE_ADDR + 0xC0) & ~0x801, GPIO_BASE_ADDR + 0xC0);
+ lcd_enable_signal(0);
+}
+#endif
+
+struct lcd_parm_t lcd_oem_parm = {
+ .bits_per_pixel = 24,
+ .capability = LCD_CAP_VSYNC_HI,
+ .vmode = {
+ .name = "WonderMedia OEM LCD (VGA 1024x768)",
+ .refresh = 60,
+ .xres = 1024,
+ .yres = 768,
+ .pixclock = KHZ2PICOS(63500),
+ .left_margin = 152,
+ .right_margin = 48,
+ .upper_margin = 23,
+ .lower_margin = 3,
+ .hsync_len = 104,
+ .vsync_len = 4,
+ .sync = FB_SYNC_VERT_HIGH_ACT,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 222,
+ .height = 125,
+#ifndef CONFIG_VPP_SHENZHEN
+ .initial = lcd_oem_initial,
+ .uninitial = lcd_oem_uninitial
+#endif
+};
+
+#ifndef CONFIG_VPP_SHENZHEN
+static void lcd_oem_1024x600_initial(void)
+{
+ outl(inl(GPIO_BASE_ADDR + 0x80) | 0x801, GPIO_BASE_ADDR + 0x80);
+
+ /* DVDD */
+ /* T2 > 0ms */ /* AVDD/VCOM( bit 0 ) */
+ outl(inl(GPIO_BASE_ADDR + 0xC0) | 0x01, GPIO_BASE_ADDR + 0xC0);
+ /* T4 > 0ms */
+ /* VGH */
+ /* 0 < T6 <= 10ms */
+ lcd_enable_signal(1); /* singal, DVO enable */
+ mdelay(200); /* T12 > 200ms */
+ outl(inl(GPIO_BASE_ADDR + 0xC0) | 0x800, GPIO_BASE_ADDR + 0xC0);
+}
+
+static void lcd_oem_1024x600_uninitial(void)
+{
+ /* BL( bit 11 ) */
+ outl(inl(GPIO_BASE_ADDR + 0xC0) & ~0x800, GPIO_BASE_ADDR + 0xC0);
+ mdelay(200); /* T12 > 200ms */
+ lcd_enable_signal(0); /* singal, DVO enable */
+ /* AVDD/VCOM( bit 0 ) */
+ outl(inl(GPIO_BASE_ADDR + 0xC0) & ~0x01, GPIO_BASE_ADDR + 0xC0);
+}
+#endif
+
+struct lcd_parm_t lcd_oem_parm_1024x600 = {
+ .bits_per_pixel = 24,
+ .capability = LCD_CAP_VSYNC_HI,
+ .vmode = {
+#if 1 /* 7" HHX070ML208CP21A */
+ .name = "HHX070ML208CP21A",
+ .refresh = 60,
+ .xres = 1024,
+ .yres = 600,
+ .pixclock = KHZ2PICOS(51200),
+ .left_margin = 140,
+ .right_margin = 160,
+ .upper_margin = 20,
+ .lower_margin = 12,
+ .hsync_len = 20,
+ .vsync_len = 3,
+ .sync = FB_SYNC_VERT_HIGH_ACT,
+ .vmode = 0,
+ .flag = 0,
+#else
+ .name = "ePAD 1024x600", /* HannStar HSD070PFW3 */
+ .refresh = 60,
+ .xres = 1024,
+ .yres = 600,
+ .pixclock = KHZ2PICOS(45000),
+ .left_margin = 50,
+ .right_margin = 50,
+ .upper_margin = 10,
+ .lower_margin = 10,
+ .hsync_len = 4,
+ .vsync_len = 4,
+ .sync = FB_SYNC_VERT_HIGH_ACT,
+ .vmode = 0,
+ .flag = 0,
+#endif
+ },
+#ifndef CONFIG_VPP_SHENZHEN
+ .initial = lcd_oem_1024x600_initial,
+ .uninitial = lcd_oem_1024x600_uninitial,
+#endif
+};
+
+struct lcd_parm_t lcd_oem_parm_1024x768 = {
+ .bits_per_pixel = 24,
+ .capability = LCD_CAP_VSYNC_HI,
+ .vmode = {
+ .name = "OEM 1024x768", /* VGA 1024x768 */
+ .refresh = 60,
+ .xres = 1024,
+ .yres = 768,
+ .pixclock = KHZ2PICOS(63500),
+ .left_margin = 152,
+ .right_margin = 48,
+ .upper_margin = 23,
+ .lower_margin = 3,
+ .hsync_len = 104,
+ .vsync_len = 4,
+ .sync = FB_SYNC_VERT_HIGH_ACT,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 222,
+ .height = 125,
+#ifndef CONFIG_VPP_SHENZHEN
+ .initial = lcd_oem_initial,
+ .uninitial = lcd_oem_uninitial
+#endif
+};
+
+struct lcd_parm_t lcd_oem_parm_1366x768 = {
+ .bits_per_pixel = 18,
+ .capability = LCD_CAP_CLK_HI,
+ .vmode = {
+ .name = "OEM 1366X768",
+ .refresh = 60,
+ .xres = 1366,
+ .yres = 768,
+ .pixclock = KHZ2PICOS(75440),
+ .left_margin = 98,
+ .right_margin = 31,
+ .upper_margin = 22,
+ .lower_margin = 4,
+ .hsync_len = 65,
+ .vsync_len = 12,
+ .sync = 0,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 293,
+ .height = 164,
+#ifndef CONFIG_VPP_SHENZHEN
+ .initial = lcd_oem_initial,
+ .uninitial = lcd_oem_uninitial
+#endif
+};
+
+struct lcd_parm_t lcd_oem_parm_480x800 = {
+ .bits_per_pixel = 18,
+ .capability = LCD_CAP_CLK_HI,
+ .vmode = {
+ .name = "OEM 480x800",
+ .refresh = 60,
+ .xres = 480,
+ .yres = 800,
+ .pixclock = KHZ2PICOS(27000),
+ .left_margin = 78,
+ .right_margin = 78,
+ .upper_margin = 60,
+ .lower_margin = 60,
+ .hsync_len = 4,
+ .vsync_len = 4,
+ .sync = 0,
+ .vmode = 0,
+ .flag = 0,
+ },
+#ifndef CONFIG_VPP_SHENZHEN
+ .initial = lcd_oem_initial,
+ .uninitial = lcd_oem_uninitial
+#endif
+};
+
+struct lcd_parm_t lcd_oem_parm_800x480 = {
+ .bits_per_pixel = 18,
+ .capability = LCD_CAP_CLK_HI,
+ .vmode = {
+ .name = "OEM 800x480",
+ .refresh = 48,
+ .xres = 800,
+ .yres = 480,
+ .pixclock = KHZ2PICOS(27000),
+ .left_margin = 50,
+ .right_margin = 50,
+ .upper_margin = 17,
+ .lower_margin = 16,
+ .hsync_len = 10,
+ .vsync_len = 5,
+ .sync = 0,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 154,
+ .height = 85,
+#ifndef CONFIG_VPP_SHENZHEN
+ .initial = lcd_oem_initial,
+ .uninitial = lcd_oem_uninitial
+#endif
+};
+
+#ifndef CONFIG_VPP_SHENZHEN
+static void lcd_oem_1280x800_initial(void)
+{
+ DBG_MSG("lcd 10 power sequence\n");
+ outl(inl(GPIO_BASE_ADDR + 0x80) | 0x801, GPIO_BASE_ADDR + 0x80);
+
+ /* VDD on */
+ /* 0 < T < 50ms */
+ lcd_enable_signal(1); /* singal on */
+ /* VGH,VGL low */ /* AVDD/VCOM( bit 0 ) */
+ outl(inl(GPIO_BASE_ADDR + 0xC0) | 0x01, GPIO_BASE_ADDR + 0xC0);
+ mdelay(150); /* T5 > 120ms */
+ outl(inl(GPIO_BASE_ADDR + 0xC0) | 0x800, GPIO_BASE_ADDR + 0xC0);
+}
+
+static void lcd_oem_1280x800_uninitial(void)
+{
+ /* turn off backlight */
+ outl(inl(GPIO_BASE_ADDR + 0xC0) & ~0x800, GPIO_BASE_ADDR + 0xC0);
+ mdelay(150);
+ /* turn off LCD */
+ outl(inl(GPIO_BASE_ADDR + 0xC0) & ~0x01, GPIO_BASE_ADDR + 0xC0);
+ lcd_enable_signal(0); /* turn off singal */
+}
+#endif
+
+struct lcd_parm_t lcd_oem_parm_800x1280 = {
+ .bits_per_pixel = 24,
+ .capability = LCD_CAP_CLK_HI,
+ .vmode = {
+ .name = "WY101ML369IN30A",
+ .refresh = 60,
+ .xres = 800,
+ .yres = 1280,
+ .pixclock = KHZ2PICOS(71100),
+ .left_margin = 70,
+ .right_margin = 80,
+ .upper_margin = 10,
+ .lower_margin = 10,
+ .hsync_len = 10,
+ .vsync_len = 3,
+ .sync = 0,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 135,
+ .height = 217,
+#ifndef CONFIG_VPP_SHENZHEN
+ .initial = lcd_oem_1280x800_initial,
+ .uninitial = lcd_oem_1280x800_uninitial,
+#endif
+};
+
+struct lcd_parm_t lcd_oem_parm_1280x800 = {
+ .bits_per_pixel = 24,
+ .capability = LCD_CAP_CLK_HI,
+ .vmode = {
+ .name = "WY101ML369IN30A",
+ .refresh = 60,
+ .xres = 1280,
+ .yres = 800,
+ .pixclock = KHZ2PICOS(71100),
+ .left_margin = 70,
+ .right_margin = 80,
+ .upper_margin = 10,
+ .lower_margin = 10,
+ .hsync_len = 10,
+ .vsync_len = 3,
+ .sync = 0,
+ .vmode = 0,
+ .flag = 0,
+ },
+ .width = 217,
+ .height = 135,
+#ifndef CONFIG_VPP_SHENZHEN
+ .initial = lcd_oem_1280x800_initial,
+ .uninitial = lcd_oem_1280x800_uninitial,
+#endif
+};
+
+/*----------------------- Function Body --------------------------------------*/
+struct lcd_parm_t *lcd_oem_get_parm(int arg)
+{
+ return &lcd_oem_parm;
+}
+
+int lcd_oem_init(void)
+{
+ int ret;
+
+ ret = lcd_panel_register(LCD_WMT_OEM, (void *)lcd_oem_get_parm);
+ return ret;
+} /* End of lcd_oem_init */
+module_init(lcd_oem_init);
+
+struct lcd_parm_t *lcd_get_oem_parm(int resx, int resy)
+{
+ struct lcd_parm_t *oem_parm[] = {
+ &lcd_oem_parm_480x800,
+ &lcd_oem_parm_1024x600,
+ &lcd_oem_parm_1024x768,
+ &lcd_oem_parm_1366x768,
+ &lcd_oem_parm_800x480,
+ &lcd_oem_parm_800x1280,
+ &lcd_oem_parm_1280x800,
+ 0
+ };
+ struct lcd_parm_t *p;
+ int i;
+
+ for (i = 0; ; i++) {
+ p = oem_parm[i];
+ if (p == 0) {
+ p = oem_parm[0];
+ break;
+ }
+ if ((resx == p->vmode.xres) && (resy == p->vmode.yres))
+ break;
+ }
+ return p;
+}
+/*--------------------End of Function Body -----------------------------------*/
+#undef LCD_OEM_C
diff --git a/common/wmt_display/devices/lcd-setup.c b/common/wmt_display/devices/lcd-setup.c
new file mode 100755
index 0000000..6653fdc
--- /dev/null
+++ b/common/wmt_display/devices/lcd-setup.c
@@ -0,0 +1,212 @@
+/*
+ * ==========================================================================
+ *
+ * Filename: lcd-spi.c
+ *
+ * Description:
+ *
+ * Version: 0.01
+ * Created: Thursday, December 27, 2012 02:50:05 HKT
+ *
+ * Author: Sam Mei (),
+ * Company:
+ *
+ * ==========================================================================
+ */
+
+#include <common.h>
+#include <command.h>
+#include <asm/types.h>
+#include <asm/errno.h>
+#include <asm/byteorder.h>
+
+#include "../../../board/wmt/include/wmt_spi.h"
+#include "../../../board/wmt/include/wmt_iomux.h"
+
+#include "../lcd.h"
+
+#define CHIPSELECT 0
+
+#ifndef SPI_GPIO
+static void spi_ctrl_9bit_tx(u8 val, int cmd_data)
+{
+ uint8_t buf[2],rbuf[2];
+
+ if (cmd_data)
+ buf[0] = (val >> 1) | BIT7;
+ else
+ buf[0] = (val >> 1) & 0x7f;
+
+ buf[1] = (val << 7);
+
+ spi_write_then_read_data(buf, rbuf, sizeof(buf), SPI_MODE_1, CHIPSELECT);
+}
+
+#else
+
+#define CLK WMT_PIN_GP12_SPI0CLK
+#define MOSI WMT_PIN_GP12_SPI0MOSI
+#define MISO WMT_PIN_GP12_SPI0MISO
+#define SS WMT_PIN_GP12_SPI0SS0
+
+static void spi_gpio_9bit_tx(u8 val, int cmd_data)
+{
+ int i;
+
+ // CS
+ gpio_direction_output(SS, 1);
+ gpio_direction_output(SS, 0);
+
+ // D/C
+ gpio_direction_output(MOSI, cmd_data);
+ gpio_direction_output(CLK, 0);
+ gpio_direction_output(CLK, 1);
+
+ // 8-bit value
+ for (i = 7; i >= 0; i--) {
+ gpio_direction_output(MOSI, !!(val & (1 << i)));
+ gpio_direction_output(CLK, 0);
+ gpio_direction_output(CLK, 1);
+ }
+
+ // CS
+ gpio_direction_output(SS, 1);
+}
+#endif
+
+static inline void spi_9bit_tx(u8 val, int cmd_data)
+{
+#ifdef SPI_GPIO
+ spi_gpio_9bit_tx(val, cmd_data);
+#else
+ spi_ctrl_9bit_tx(val, cmd_data);
+#endif
+}
+
+static int ts8224b_cmd(u8 cmd)
+{
+ spi_9bit_tx(cmd, 0);
+ return 0;
+}
+
+static int ts8224b_data(u8 data)
+{
+ spi_9bit_tx(data, 1);
+ return 0;
+}
+
+/*
+ * setenv wmt.lcd.setup 0
+ * setenv wmt.display.param 2:0:24:1024:600:60
+ * setenv wmt.display.tmr 30000:0:78:78:480:78:4:60:800:60
+ */
+static int ts8224b_init(void)
+{
+
+ static uint16_t settings[] = {
+ #include "ts8224b.h"
+ };
+ int i;
+
+ printf(" ## %s \n", __FUNCTION__);
+ for (i = 0; i < ARRAY_SIZE(settings); i += 2) {
+ ts8224b_cmd(settings[i] >> 8);
+ ts8224b_data(settings[i+1]);
+ }
+
+ ts8224b_cmd(0x11);
+ mdelay(120);
+
+ ts8224b_cmd(0x29);
+ mdelay(50);
+ ts8224b_cmd(0x2c);
+ return 0;
+}
+
+static int i2c_write(int i2c_idx, uint8_t reg, uint8_t value)
+{
+ unsigned char data[2] = { reg, value };
+ struct i2c_msg_s msg[1] = {
+ {
+ .addr = 0xE0 >> 1,
+ .flags = I2C_M_WR,
+ .len = 2,
+ .buf = data,
+ },
+ };
+
+ if (wmt_i2c_transfer(&msg[0], 1, i2c_idx) > 0)
+ return 0;
+
+ printf(" ## lcd i2c1 write error %s, %d\n", __func__, __LINE__);
+ return -1;
+}
+
+static uint8_t init_data[] = {
+ 0x4b, 0x01,
+ 0x0c, 0x01,
+ 0x05, 0x03,
+ 0x41, 0x03,
+ 0x10, 0x06,
+ 0x11, 0xE0,
+ 0x12, 0x00,
+ 0x13, 0x3C,
+ 0x14, 0x06,
+ 0x15, 0x40,
+ 0x16, 0x03,
+ 0x17, 0x9E,
+ 0x18, 0x00,
+ 0x19, 0x10,
+ 0x1a, 0x03,
+ 0x1b, 0x84,
+ 0x1c, 0x80,
+ 0x1d, 0x0A,
+ 0x1e, 0x80,
+ 0x1f, 0x06,
+ 0x3c, 0x17,
+ 0x3e, 0x16,
+ 0x36, 0x00,
+ 0x31, 0x00,
+ 0x35, 0x41,
+ 0x30, 0xB0,
+ 0x30, 0xB1,
+ 0x00, 0x0B,
+};
+
+static int chunghwa_init(void)
+{
+ int i;
+
+ printf(" ## %s, %d\n", __FUNCTION__, __LINE__);
+ for (i = 0; i < ARRAY_SIZE(init_data); i += 2) {
+ i2c_write(1, init_data[i], init_data[i+1]);
+ }
+
+ return 0;
+}
+
+enum {
+ LCD_SETUP_TS8224B,
+ LCD_SETUP_CHUNGHWA,
+ LCD_SETUP_MAX,
+};
+
+int lcd_spi_setup(void)
+{
+ int id;
+ char *s = getenv("wmt.lcd.setup");
+
+ if (!s)
+ return -ENODEV;
+
+ id = simple_strtoul(s, NULL, 10);
+ switch (id) {
+ case LCD_SETUP_TS8224B:
+ return ts8224b_init();
+ case LCD_SETUP_CHUNGHWA:
+ return chunghwa_init();
+ default:
+ return -EINVAL;
+ }
+}
+
diff --git a/common/wmt_display/devices/lcd.c b/common/wmt_display/devices/lcd.c
new file mode 100755
index 0000000..2e42a95
--- /dev/null
+++ b/common/wmt_display/devices/lcd.c
@@ -0,0 +1,448 @@
+/*++
+ * linux/drivers/video/wmt/lcd.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define LCD_C
+#undef DEBUG
+/* #define DEBUG */
+/* #define DEBUG_DETAIL */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#ifdef CONFIG_KERNEL
+#include <linux/gpio.h>
+#endif
+#include "../lcd.h"
+#include "../vout.h"
+
+#ifdef CONFIG_VPP_SHENZHEN
+#include "../../../board/wmt/include/wmt_iomux.h"
+#endif
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define LCD_XXXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define LCD_XXXX 1 *//*Example*/
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx lcd_xxx_t; *//*Example*/
+struct lcd_device_t {
+ struct lcd_parm_t* (*get_parm)(int arg);
+};
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in lcd.h -------------*/
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int lcd_xxx; *//*Example*/
+struct lcd_device_t lcd_device_array[LCD_PANEL_MAX];
+int lcd_panel_on = 1;
+int lcd_pwm_enable;
+enum lcd_panel_t lcd_panel_id = LCD_PANEL_MAX;
+int lcd_panel_bpp = 24;
+
+struct vout_dev_t lcd_vout_dev_ops;
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void lcd_xxx(void); *//*Example*/
+enum lcd_panel_t lcd_lvds_id = LCD_PANEL_MAX;
+int lcd_type;
+
+/*----------------------- Function Body --------------------------------------*/
+/*----------------------- Backlight --------------------------------------*/
+void lcd_set_type(int type)
+{
+ lcd_type = type; /* 0-LCD, 1-LVDS */
+}
+
+int lcd_get_type(void)
+{
+ return lcd_type;
+}
+
+#ifdef CONFIG_VPP_SHENZHEN
+
+#define MAX_LCD_GPIO_NUM 5
+
+static struct {
+ int gpio;
+ int active;
+} lcd_power[MAX_LCD_GPIO_NUM] = {{-1, 0}};
+
+static int parse_uboot_param(void)
+{
+ char buf[64];
+ unsigned int parm[32];
+ int l = sizeof(buf);
+ int i, gpio_num;
+
+ for(i = 0; i < MAX_LCD_GPIO_NUM; i++)
+ lcd_power[i].gpio = -1;
+
+ /*
+ * In hardware, maybe there are several gpio to control LCD power
+ * We can set the wmt.lcd.power as follows:
+ * setenv wmt.lcd.power gpio0:active0,gpio1:active1,....,gpio4:active4
+ */
+ if (wmt_getsyspara("wmt.lcd.power", buf, &l)) {
+ DBG_ERR("please set wmt.lcd.power\n");
+ return -22;
+ }
+
+ i = vpp_parse_param(buf, parm, 2 * MAX_LCD_GPIO_NUM, 0);
+ gpio_num = i / 2;
+
+ for(i = 0; i < gpio_num; i++) {
+
+ lcd_power[i].gpio = parm[i * 2];
+ lcd_power[i].active = parm[i * 2 + 1];
+
+ printf("lcd power%d: gpio%d, active %d\n",
+ i, lcd_power[i].gpio, lcd_power[i].active);
+ }
+
+ return 0;
+}
+
+void lcd_power_on(bool on)
+{
+ int i;
+
+ for(i = 0; i < MAX_LCD_GPIO_NUM; i++) {
+ if (lcd_power[i].gpio < 0)
+ return;
+
+ gpio_direction_output(lcd_power[i].gpio, on ?
+ lcd_power[i].active : !lcd_power[i].active);
+
+ DBG_MSG("lcd_power_on: i = %d, on = %d, gpio = %d, active = %d\n",
+ i, on, lcd_power[i].gpio, lcd_power[i].active);
+ }
+}
+
+#endif
+
+void lcd_set_lvds_id(int id)
+{
+ lcd_lvds_id = id;
+}
+
+int lcd_get_lvds_id(void)
+{
+ return lcd_lvds_id;
+}
+
+void lcd_set_parm(int id, int bpp)
+{
+ lcd_panel_id = id;
+ lcd_panel_bpp = bpp;
+}
+
+struct lcd_parm_t *lcd_get_parm(enum lcd_panel_t id, unsigned int arg)
+{
+ struct lcd_device_t *p;
+
+ p = &lcd_device_array[id];
+ if (p && p->get_parm)
+ return p->get_parm(arg);
+ return 0;
+}
+
+struct vout_dev_t *lcd_get_dev(void)
+{
+ if (lcd_panel_id >= LCD_PANEL_MAX)
+ return 0;
+ return &lcd_vout_dev_ops;
+}
+
+#ifdef CONFIG_KERNEL
+static DEFINE_SEMAPHORE(lcd_sem);
+#endif
+void lcd_set_mutex(int lock)
+{
+#ifdef CONFIG_KERNEL
+ if (lock)
+ down(&lcd_sem);
+ else
+ up(&lcd_sem);
+#endif
+}
+
+void lcd_set_enable(int enable)
+{
+ DBG_MSG("%d\n", enable);
+ if (!p_lcd)
+ return;
+
+ lcd_set_mutex(1);
+ if (enable) {
+ if (p_lcd->initial)
+ p_lcd->initial();
+ else {
+ lcd_enable_signal(1); /* singal enable */
+#ifndef CONFIG_VPP_SHENZHEN
+ outl(inl(GPIO_BASE_ADDR + 0x80) | 0x801,
+ GPIO_BASE_ADDR + 0x80);
+ outl(inl(GPIO_BASE_ADDR + 0xC0) | 0x801,
+ GPIO_BASE_ADDR + 0xC0);
+#endif
+ }
+ } else {
+ if (p_lcd->uninitial)
+ p_lcd->uninitial();
+ else {
+ lcd_enable_signal(0); /* singal disable */
+#ifndef CONFIG_VPP_SHENZHEN
+ outl(inl(GPIO_BASE_ADDR + 0xC0) & ~0x801,
+ GPIO_BASE_ADDR + 0xC0);
+#endif
+ }
+ }
+ lcd_set_mutex(0);
+}
+
+void lcd_enable_signal(int enable)
+{
+ int hdmi_off;
+
+ DBG_MSG("%d\n", enable);
+ if (lcd_get_type()) { /* LVDS */
+ /* TODO */
+ } else { /* LCD */
+ govrh_set_dvo_enable(p_govrh2, enable);
+ }
+
+ hdmi_off = (govrh_get_MIF_enable(p_govrh)) ? 0 : 1;
+ vpp_set_clock_enable(DEV_DVO, (hdmi_off && !enable) ? 0 : 1, 1);
+}
+
+#ifdef __KERNEL__
+/*----------------------- LCD --------------------------------------*/
+static int __init lcd_arg_panel_id
+(
+ char *str /*!<; // argument string */
+)
+{
+ sscanf(str, "%d", (int *) &lcd_panel_id);
+ if (lcd_panel_id >= LCD_PANEL_MAX)
+ lcd_panel_id = LCD_PANEL_MAX;
+ DBGMSG(KERN_INFO "set lcd panel id = %d\n", lcd_panel_id);
+ return 1;
+} /* End of lcd_arg_panel_id */
+
+__setup("lcdid=", lcd_arg_panel_id);
+#endif
+int lcd_panel_register(int no, void (*get_parm)(int mode))
+{
+ struct lcd_device_t *p;
+
+ if (no >= LCD_PANEL_MAX) {
+ DBGMSG(KERN_ERR "*E* lcd device no max is %d !\n",
+ LCD_PANEL_MAX);
+ return -1;
+ }
+
+ p = &lcd_device_array[no];
+ if (p->get_parm) {
+ DBGMSG(KERN_ERR "*E* lcd device %d exist !\n", no);
+ return -1;
+ }
+ p->get_parm = (void *) get_parm;
+ return 0;
+} /* End of lcd_device_register */
+
+/*----------------------- vout device plugin --------------------------------*/
+void lcd_set_power_down(int enable)
+{
+#ifdef CONFIG_VPP_SHENZHEN
+ static int save_state = -1;
+
+ if (save_state != enable) {
+ /* lcd enable control by user */
+ lcd_power_on(enable ? 0: 1);
+ lcd_set_enable(enable ? 0 : 1);
+ save_state = enable;
+ }
+#endif
+}
+
+#ifdef CONFIG_VPP_SHENZHEN
+void lcd_backlight_power_on(int on)
+{
+ if (parse_backlight_params())
+ return;
+
+ if (g_backlight_param.gpio < 0)
+ return;
+
+ gpio_direction_output(g_backlight_param.gpio,
+ on ? g_backlight_param.active : !g_backlight_param.active);
+}
+#endif
+
+static void wmt_config_govrh_polar(struct vout_t *vo)
+{
+ /* wmt.display.polar [clock polar]:[hsync polart]:[vsync polar]*/
+ char buf[64];
+ int l = sizeof(buf);
+ int clk_pol, hsync_pol, vsync_pol;
+ unsigned int parm[3];
+
+ if (wmt_getsyspara("wmt.display.polar", buf, &l))
+ return;
+
+ vpp_parse_param(buf, (unsigned int *)parm, 3, 0);
+ clk_pol = parm[0];
+ hsync_pol = parm[1];
+ vsync_pol = parm[2];
+ DBG_MSG("govrh polar: clk-pol %d, hsync %d, vsync %d\n",
+ clk_pol, hsync_pol, vsync_pol);
+ govrh_set_dvo_clock_delay(vo->govr, clk_pol ? 0 : 1, 0);
+ govrh_set_dvo_sync_polar(vo->govr,
+ hsync_pol ? 0 : 1, vsync_pol ? 0 : 1);
+}
+
+int lcd_set_mode(unsigned int *option)
+{
+ struct vout_t *vo;
+ enum vout_inf_mode_t inf_mode;
+
+ DBG_MSG("option %d,%d\n", option[0], option[1]);
+
+ vo = lcd_vout_dev_ops.vout;
+ inf_mode = vo->inf->mode;
+ if (option) {
+ unsigned int capability;
+
+ if (lcd_panel_id == 0)
+ p_lcd = lcd_get_oem_parm(vo->resx, vo->resy);
+ else
+ p_lcd = lcd_get_parm(lcd_panel_id, lcd_panel_bpp);
+
+ if (!p_lcd) {
+ DBG_ERR("lcd %d not support\n", lcd_panel_id);
+ return -1;
+ }
+ DBG_MSG("[%s] %s (id %d,bpp %d)\n", vout_inf_str[inf_mode],
+ p_lcd->vmode.name, lcd_panel_id, lcd_panel_bpp);
+ capability = p_lcd->capability;
+ switch (inf_mode) {
+ case VOUT_INF_LVDS:
+ lvds_set_sync_polar(
+ (capability & LCD_CAP_HSYNC_HI) ? 0 : 1,
+ (capability & LCD_CAP_VSYNC_HI) ? 0 : 1);
+ lvds_set_rgb_type(lcd_panel_bpp);
+ break;
+ case VOUT_INF_DVI:
+ govrh_set_dvo_clock_delay(vo->govr,
+ (capability & LCD_CAP_CLK_HI) ? 0 : 1, 0);
+ govrh_set_dvo_sync_polar(vo->govr,
+ (capability & LCD_CAP_HSYNC_HI) ? 0 : 1,
+ (capability & LCD_CAP_VSYNC_HI) ? 0 : 1);
+ switch (lcd_panel_bpp) {
+ case 15:
+ govrh_IGS_set_mode(vo->govr, 0, 1, 1);
+ break;
+ case 16:
+ govrh_IGS_set_mode(vo->govr, 0, 3, 1);
+ break;
+ case 18:
+ govrh_IGS_set_mode(vo->govr, 0, 2, 1);
+ break;
+ case 24:
+ govrh_IGS_set_mode(vo->govr, 0, 0, 0);
+ break;
+ default:
+ break;
+ }
+ break;
+ default:
+ break;
+ }
+ } else
+ p_lcd = 0;
+
+ wmt_config_govrh_polar(vo);
+ return 0;
+}
+
+int lcd_check_plugin(int hotplug)
+{
+ return (p_lcd) ? 1 : 0;
+}
+
+int lcd_get_edid(char *buf)
+{
+ return 1;
+}
+
+int lcd_config(struct vout_info_t *info)
+{
+ info->resx = p_lcd->vmode.xres;
+ info->resy = p_lcd->vmode.yres;
+ info->fps = p_lcd->vmode.refresh;
+ return 0;
+}
+
+int lcd_init(struct vout_t *vo)
+{
+ DBG_MSG("%d\n", lcd_panel_id);
+
+ /* vo_set_lcd_id(LCD_CHILIN_LW0700AT9003); */
+ if (lcd_panel_id >= LCD_PANEL_MAX)
+ return -1;
+
+ if (lcd_panel_id == 0)
+ p_lcd = lcd_get_oem_parm(vo->resx, vo->resy);
+ else
+ p_lcd = lcd_get_parm(lcd_panel_id, 24);
+
+ if (p_lcd == 0)
+ return -1;
+
+ /* set default parameters */
+ vo->resx = p_lcd->vmode.xres;
+ vo->resy = p_lcd->vmode.yres;
+ vo->pixclk = PICOS2KHZ(p_lcd->vmode.pixclock) * 1000;
+ return 0;
+}
+
+struct vout_dev_t lcd_vout_dev_ops = {
+ .name = "LCD",
+ .mode = VOUT_INF_DVI,
+ .capability = VOUT_DEV_CAP_FIX_RES + VOUT_DEV_CAP_FIX_PLUG,
+
+ .init = lcd_init,
+ .set_power_down = lcd_set_power_down,
+ .set_mode = lcd_set_mode,
+ .config = lcd_config,
+ .check_plugin = lcd_check_plugin,
+ .get_edid = lcd_get_edid,
+};
+
+int lcd_module_init(void)
+{
+ parse_uboot_param();
+
+ vout_device_register(&lcd_vout_dev_ops);
+ return 0;
+} /* End of lcd_module_init */
+module_init(lcd_module_init);
+/*--------------------End of Function Body -----------------------------------*/
+#undef LCD_C
diff --git a/common/wmt_display/devices/sil902x.c b/common/wmt_display/devices/sil902x.c
new file mode 100755
index 0000000..186bb02
--- /dev/null
+++ b/common/wmt_display/devices/sil902x.c
@@ -0,0 +1,74 @@
+/*++
+ * linux/drivers/video/wmt/sil902x.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define SIL902X_C
+/*--------------------------------------------------------------------*
+SiI902x Software customization for PC platform.
+Based on :
+ Video input configuration=
+ 24 bit RGB in + Hsync + Vsync + DE + PCLK
+ rising edge is the 1st clock after DE=High
+ Audio input configuration=
+ SPDIF, word size, sample frequency all refer to stream header
+
+ SiI902x i2c device address=0x72. ( CI2CA pin=LOW)
+//================== i2c routine =========================
+SiI902x i2c max speed is 100KHz.
+A version max speed is 400KHz
+
+Data = I2C_ReadByte(TX_SLAVE_ADDR, RegOffset);
+I2C_WriteByte(TPI_BASE_ADDR, RegOffset, Data);
+I2C_WriteBlock(TPI_BASE_ADDR, TPI_Offset, pData, NBytes);
+I2C_ReadBlock(TPI_BASE_ADDR, TPI_Offset, pData, NBytes);
+
+------------------------------------------------------------------------------*/
+//#define DEBUG
+//#define DEBUG_DETAIL
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../vout.h"
+#include "sil902x.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define SIL902X_XXXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define SIL902X_XXXX 1 *//*Example*/
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx sil902x_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in sil902x.h -------------*/
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int sil902x_xxx; *//*Example*/
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void sil902x_xxx(void); *//*Example*/
+int sil902x_module_init(void)
+{
+// vout_device_register(&sil902x_vout_dev_ops);
+ return 0;
+} /* End of sil902x_module_init */
+module_init(sil902x_module_init);
+/*--------------------End of Function Body -----------------------------------*/
+#undef SIL902X_C
+
diff --git a/common/wmt_display/devices/sil902x.h b/common/wmt_display/devices/sil902x.h
new file mode 100755
index 0000000..a7e0f0d
--- /dev/null
+++ b/common/wmt_display/devices/sil902x.h
@@ -0,0 +1,71 @@
+/*++
+ * linux/drivers/video/wmt/devices/sil902x.h
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#ifndef SIL902X_H
+/* To assert that only one occurrence is included */
+#define SIL902X_H
+/*-------------------- MODULE DEPENDENCY -------------------------------------*/
+
+/* following is the C++ header */
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*-------------------- EXPORTED PRIVATE CONSTANTS ----------------------------*/
+/* #define SIL902X_XXXX 1 *//*Example*/
+#define SIL902X_STATUS_ARG_NUM 3
+
+/*-------------------- EXPORTED PRIVATE TYPES---------------------------------*/
+/* typedef void sil902x_xxx_t; *//*Example*/
+typedef struct {
+ int (*init)(void);
+ int (*poll)(void);
+ void (*cp_enable)(int enable);
+ void (*get_status)(int *arg);
+ void (*config)(int vic);
+} sil902x_ko_ops_t;
+
+/*-------------------- EXPORTED PRIVATE VARIABLES -----------------------------*/
+#ifdef SIL902X_C /* allocate memory for variables only in xxx.c */
+#define EXTERN
+#else
+#define EXTERN extern
+#endif /* ifdef SIL902X_C */
+
+/* EXTERN int sil902x_xxx; *//*Example*/
+EXTERN void sil902x_init_module(int ko);
+EXTERN int sil902x_enable_access(void);
+EXTERN int sil902x_get_cp_support(void);
+
+#undef EXTERN
+
+/*--------------------- EXPORTED PRIVATE MACROS -------------------------------*/
+/* #define SIL902X_XXX_YYY xxxx *//*Example*/
+/*--------------------- EXPORTED PRIVATE FUNCTIONS ---------------------------*/
+/* extern void sil902x_xxx(void); *//*Example*/
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* ifndef SIL902X_H */
+
diff --git a/common/wmt_display/devices/ts8224b.h b/common/wmt_display/devices/ts8224b.h
new file mode 100755
index 0000000..8786628
--- /dev/null
+++ b/common/wmt_display/devices/ts8224b.h
@@ -0,0 +1,446 @@
+#ifndef _TS8224B_H_
+#define _TS8224B_H_
+
+//Enable Page1 hsd4.0
+0xFF00, 0x55,
+0xFF01, 0xAA,
+0xFF02, 0x52,
+0xFF03, 0x08,
+0xFF04, 0x80,
+
+0xF200, 0x00,
+0xF201, 0x84,
+0xF202, 0x02,
+
+0xF40A, 0x13,
+
+0xF000, 0x55,
+0xF001, 0xAA,
+0xF002, 0x52,
+0xF003, 0x08,
+0xF004, 0x01,
+
+0xB000, 0x0D,
+0xB001, 0x0D,
+0xB002, 0x0D,
+
+0xB600, 0x34,
+0xB601, 0x34,
+0xB602, 0x34,
+
+0xB100, 0x0D,
+0xB101, 0x0D,
+0xB102, 0x0D,
+
+// AVEE: manual, -6V : -2.5xVCI)
+0xB700, 0x34,
+0xB701, 0x34,
+0xB702, 0x34,
+
+//Power Control for VCL
+0xB200, 0x00,
+0xB201, 0x00,
+0xB202, 0x00,
+
+0xB800, 0x24,
+0xB801, 0x24,
+0xB802, 0x24,
+
+// VGH: Clamp Enable, 2*AVDD-AVEE, //11V
+0xBF00, 0X01,
+
+0xB300, 0x0F,
+0xB301, 0x0F,
+0xB302, 0x0F,
+
+0xB900, 0x34,//34
+0xB901, 0x34,
+0xB902, 0x34,
+
+// VGL_REG(VGLO):-10V
+0xB500, 0x08,
+0xB501, 0x08,
+0xB502, 0x08,
+
+0xC200, 0x03,
+
+//VGL(LVGL):
+0xBA00, 0x24,
+0xBA01, 0x24,
+0xBA02, 0x24,
+
+
+// VGMP/VGSP: 4.8v
+0xBC00, 0X00,
+0xBC01, 0x78,
+0xBC02, 0X00,
+
+// VGMN/VGSN -4.8v
+0xBD00, 0x00,
+0xBD01, 0x78,
+0xBD02, 0x00,
+
+// VCOM=-0.1
+0xBE00, 0x00,
+0xBE01, 0x80, //2f
+//R+
+0xD100, 0x00,
+0xD101, 0x05,
+0xD102, 0x00,
+0xD103, 0x06,
+0xD104, 0x00,
+0xD105, 0x0E,
+0xD106, 0x00,
+0xD107, 0x19,
+0xD108, 0x00,
+0xD109, 0x29,
+0xD10A, 0x00,
+0xD10B, 0x55,
+0xD10C, 0x00,
+0xD10D, 0x80,
+0xD10E, 0x00,
+0xD10F, 0xC7,
+0xD110, 0x00,
+0xD111, 0xFC,
+0xD112, 0x01,
+0xD113, 0x48,
+0xD114, 0x01,
+0xD115, 0x7C,
+0xD116, 0x01,
+0xD117, 0xC5,
+0xD118, 0x01,
+0xD119, 0xFE,
+0xD11A, 0x02,
+0xD11B, 0x00,
+0xD11C, 0x02,
+0xD11D, 0x30,
+0xD11E, 0x02,
+0xD11F, 0x60,
+0xD120, 0x02,
+0xD121, 0x7A,
+0xD122, 0x02,
+0xD123, 0x9A,
+0xD124, 0x02,
+0xD125, 0xAC,
+0xD126, 0x02,
+0xD127, 0xC4,
+0xD128, 0x02,
+0xD129, 0xD3,
+0xD12A, 0x02,
+0xD12B, 0xE9,
+0xD12C, 0x02,
+0xD12D, 0xF8,
+0xD12E, 0x03,
+0xD12F, 0x0D,
+0xD130, 0x03,
+0xD131, 0x3B,
+0xD132, 0x05,
+0xD133, 0xB5,
+//G+
+0xD200, 0x00,
+0xD201, 0x05,
+0xD202, 0x00,
+0xD203, 0x06,
+0xD204, 0x00,
+0xD205, 0x0E,
+0xD206, 0x00,
+0xD207, 0x19,
+0xD208, 0x00,
+0xD209, 0x29,
+0xD20A, 0x00,
+0xD20B, 0x55,
+0xD20C, 0x00,
+0xD20D, 0x80,
+0xD20E, 0x00,
+0xD20F, 0xC7,
+0xD210, 0x00,
+0xD211, 0xFC,
+0xD212, 0x01,
+0xD213, 0x48,
+0xD214, 0x01,
+0xD215, 0x7C,
+0xD216, 0x01,
+0xD217, 0xC5,
+0xD218, 0x01,
+0xD219, 0xFE,
+0xD21A, 0x02,
+0xD21B, 0x00,
+0xD21C, 0x02,
+0xD21D, 0x30,
+0xD21E, 0x02,
+0xD21F, 0x60,
+0xD220, 0x02,
+0xD221, 0x7A,
+0xD222, 0x02,
+0xD223, 0x9A,
+0xD224, 0x02,
+0xD225, 0xAC,
+0xD226, 0x02,
+0xD227, 0xC4,
+0xD228, 0x02,
+0xD229, 0xD3,
+0xD22A, 0x02,
+0xD22B, 0xE9,
+0xD22C, 0x02,
+0xD22D, 0xF8,
+0xD22E, 0x03,
+0xD22F, 0x0D,
+0xD230, 0x03,
+0xD231, 0x3B,
+0xD232, 0x05,
+0xD233, 0xB5,
+//B+
+0xD300, 0x00,
+0xD301, 0x05,
+0xD302, 0x00,
+0xD303, 0x06,
+0xD304, 0x00,
+0xD305, 0x0E,
+0xD306, 0x00,
+0xD307, 0x19,
+0xD308, 0x00,
+0xD309, 0x29,
+0xD30A, 0x00,
+0xD30B, 0x55,
+0xD30C, 0x00,
+0xD30D, 0x80,
+0xD30E, 0x00,
+0xD30F, 0xC7,
+0xD310, 0x00,
+0xD311, 0xFC,
+0xD312, 0x01,
+0xD313, 0x48,
+0xD314, 0x01,
+0xD315, 0x7C,
+0xD316, 0x01,
+0xD317, 0xC5,
+0xD318, 0x01,
+0xD319, 0xFE,
+0xD31A, 0x02,
+0xD31B, 0x00,
+0xD31C, 0x02,
+0xD31D, 0x30,
+0xD31E, 0x02,
+0xD31F, 0x60,
+0xD320, 0x02,
+0xD321, 0x7A,
+0xD322, 0x02,
+0xD323, 0x9A,
+0xD324, 0x02,
+0xD325, 0xAC,
+0xD326, 0x02,
+0xD327, 0xC4,
+0xD328, 0x02,
+0xD329, 0xD3,
+0xD32A, 0x02,
+0xD32B, 0xE9,
+0xD32C, 0x02,
+0xD32D, 0xF8,
+0xD32E, 0x03,
+0xD32F, 0x0D,
+0xD330, 0x03,
+0xD331, 0x3B,
+0xD332, 0x05,
+0xD333, 0xB5,
+//R-
+0xD400, 0x00,
+0xD401, 0x05,
+0xD402, 0x00,
+0xD403, 0x06,
+0xD404, 0x00,
+0xD405, 0x0E,
+0xD406, 0x00,
+0xD407, 0x19,
+0xD408, 0x00,
+0xD409, 0x29,
+0xD40A, 0x00,
+0xD40B, 0x55,
+0xD40C, 0x00,
+0xD40D, 0x80,
+0xD40E, 0x00,
+0xD40F, 0xC7,
+0xD410, 0x00,
+0xD411, 0xFC,
+0xD412, 0x01,
+0xD413, 0x48,
+0xD414, 0x01,
+0xD415, 0x7C,
+0xD416, 0x01,
+0xD417, 0xC5,
+0xD418, 0x01,
+0xD419, 0xFE,
+0xD41A, 0x02,
+0xD41B, 0x00,
+0xD41C, 0x02,
+0xD41D, 0x30,
+0xD41E, 0x02,
+0xD41F, 0x60,
+0xD420, 0x02,
+0xD421, 0x7A,
+0xD422, 0x02,
+0xD423, 0x9A,
+0xD424, 0x02,
+0xD425, 0xAC,
+0xD426, 0x02,
+0xD427, 0xC4,
+0xD428, 0x02,
+0xD429, 0xD3,
+0xD42A, 0x02,
+0xD42B, 0xE9,
+0xD42C, 0x02,
+0xD42D, 0xF8,
+0xD42E, 0x03,
+0xD42F, 0x0D,
+0xD430, 0x03,
+0xD431, 0x3B,
+0xD432, 0x05,
+0xD433, 0xB5,
+//G-
+0xD500, 0x00,
+0xD501, 0x05,
+0xD502, 0x00,
+0xD503, 0x06,
+0xD504, 0x00,
+0xD505, 0x0E,
+0xD506, 0x00,
+0xD507, 0x19,
+0xD508, 0x00,
+0xD509, 0x29,
+0xD50A, 0x00,
+0xD50B, 0x55,
+0xD50C, 0x00,
+0xD50D, 0x80,
+0xD50E, 0x00,
+0xD50F, 0xC7,
+0xD510, 0x00,
+0xD511, 0xFC,
+0xD512, 0x01,
+0xD513, 0x48,
+0xD514, 0x01,
+0xD515, 0x7C,
+0xD516, 0x01,
+0xD517, 0xC5,
+0xD518, 0x01,
+0xD519, 0xFE,
+0xD51A, 0x02,
+0xD51B, 0x00,
+0xD51C, 0x02,
+0xD51D, 0x30,
+0xD51E, 0x02,
+0xD51F, 0x60,
+0xD520, 0x02,
+0xD521, 0x7A,
+0xD522, 0x02,
+0xD523, 0x9A,
+0xD524, 0x02,
+0xD525, 0xAC,
+0xD526, 0x02,
+0xD527, 0xC4,
+0xD528, 0x02,
+0xD529, 0xD3,
+0xD52A, 0x02,
+0xD52B, 0xE9,
+0xD52C, 0x02,
+0xD52D, 0xF8,
+0xD52E, 0x03,
+0xD52F, 0x0D,
+0xD530, 0x03,
+0xD531, 0x3B,
+0xD532, 0x05,
+0xD533, 0xB5,
+//B-
+0xD600, 0x00,
+0xD601, 0x05,
+0xD602, 0x00,
+0xD603, 0x06,
+0xD604, 0x00,
+0xD605, 0x0E,
+0xD606, 0x00,
+0xD607, 0x19,
+0xD608, 0x00,
+0xD609, 0x29,
+0xD60A, 0x00,
+0xD60B, 0x55,
+0xD60C, 0x00,
+0xD60D, 0x80,
+0xD60E, 0x00,
+0xD60F, 0xC7,
+0xD610, 0x00,
+0xD611, 0xFC,
+0xD612, 0x01,
+0xD613, 0x48,
+0xD614, 0x01,
+0xD615, 0x7C,
+0xD616, 0x01,
+0xD617, 0xC5,
+0xD618, 0x01,
+0xD619, 0xFE,
+0xD61A, 0x02,
+0xD61B, 0x00,
+0xD61C, 0x02,
+0xD61D, 0x30,
+0xD61E, 0x02,
+0xD61F, 0x60,
+0xD620, 0x02,
+0xD621, 0x7A,
+0xD622, 0x02,
+0xD623, 0x9A,
+0xD624, 0x02,
+0xD625, 0xAC,
+0xD626, 0x02,
+0xD627, 0xC4,
+0xD628, 0x02,
+0xD629, 0xD3,
+0xD62A, 0x02,
+0xD62B, 0xE9,
+0xD62C, 0x02,
+0xD62D, 0xF8,
+0xD62E, 0x03,
+0xD62F, 0x0D,
+0xD630, 0x03,
+0xD631, 0x3B,
+0xD632, 0x05,
+0xD633, 0xB5,
+
+//Enable Page0
+0xF000, 0x55,
+0xF001, 0xAA,
+0xF002, 0x52,
+0xF003, 0x08,
+0xF004, 0x00,
+
+
+0xB100, 0xcc,
+0xB101, 0x00,
+
+0xB600, 0x05,
+
+//// Gate EQ:
+0xB700, 0x70,
+0xB701, 0x70,
+
+//// Source EQ:
+0xB800, 0x01,
+0xB801, 0x03,
+0xB802, 0x03,
+0xB803, 0x03,
+
+// #Inversion mode (2-dot)
+0xBC00, 0x02,
+0xBC01, 0x00,
+0xBC02, 0x00,
+
+// Timing control 4H w/ 4-delay
+0xC900, 0xD0,
+0xC901, 0x02,
+0xC902, 0x50,
+0xC903, 0x50,
+0xC904, 0x50,
+// Display Timing:
+
+0x3600, 0x00,
+0x3500, 0x00,
+
+0x3a00, 0x66,
+
+#endif
diff --git a/common/wmt_display/devices/vt1625.c b/common/wmt_display/devices/vt1625.c
new file mode 100755
index 0000000..35b60d7
--- /dev/null
+++ b/common/wmt_display/devices/vt1625.c
@@ -0,0 +1,949 @@
+/*++
+ * linux/drivers/video/wmt/vt1625.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define VT1625_C
+/* #define DEBUG */
+/* #define DEBUG_DETAIL */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../vout.h"
+
+#ifdef CONFIG_KERNEL
+#include <linux/workqueue.h>
+#endif
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define VT1625_XXXX xxxx *//*Example*/
+#ifdef CONFIG_KERNEL
+#define CONFIG_VT1625_INTERRUPT
+#endif
+#define CONFIG_VT1625_POWER
+#define CONFIG_VM700
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define VT1625_XXXX 1 *//*Example*/
+#define VT1625_ADDR 0x40
+
+enum {
+ VT1625_INPUT_SELECTION = 0x00,
+ VT1625_SYNC_SELECTION_0 = 0x01,
+ VT1625_SYNC_SELECTION_1 = 0x02,
+ VT1625_FILTER_SELECTION = 0x03,
+ VT1625_OUTPUT_MODE = 0x04,
+ VT1625_CLOCK_CONTROL = 0x05,
+
+ /* start position & overflow */
+ VT1625_OVERFLOW = 0x06,
+ VT1625_START_ACTIVE_VIDEO = 0x07,
+ VT1625_START_HORIZONTAL_POSITION = 0x08,
+ VT1625_START_VERTICAL_POSITION = 0x09,
+
+ /* amplitude factor */
+ VT1625_CR_AMPLITUDE_FACTOR = 0x0A,
+ VT1625_BLACK_LEVEL = 0x0B,
+ VT1625_Y_AMPLITUDE_FACTOR = 0x0C,
+ VT1625_CB_AMPLITUDE_FACTOR = 0x0D,
+
+ VT1625_POWER_MANAGEMENT = 0x0E,
+ VT1625_STATUS = 0x0F,
+
+ /* Hue */
+ VT1625_HUE_ADJUSTMENT = 0x10,
+ VT1625_OVERFLOW_MISC = 0x11,
+
+ /* PLL */
+ VT1625_PLL_P2 = 0x12,
+ VT1625_PLL_D = 0x13,
+ VT1625_PLL_N = 0x14,
+ VT1625_PLL_OVERFLOW = 0x15,
+
+ /* Sub Carrier */
+ VT1625_SUBCARRIER_VALUE_0 = 0x16,
+ VT1625_SUBCARRIER_VALUE_1 = 0x17,
+ VT1625_SUBCARRIER_VALUE_2 = 0x18,
+ VT1625_SUBCARRIER_VALUE_3 = 0x19,
+
+ VT1625_VERSION_ID = 0x1B,
+ VT1625_DAC_OVERFLOW = 0x1C,
+
+ /* test */
+ VT1625_TEST_0 = 0x1D,
+ VT1625_TEST_1 = 0x1E,
+
+ VT1625_FILTER_SWITCH = 0x1F,
+ VT1625_TV_SYNC_STEP = 0x20,
+ VT1625_TV_BURST_ENVELOPE_STEP = 0x21,
+ VT1625_TV_SUB_CARRIER_PHASE_ADJUST = 0x22,
+ VT1625_TV_BLANK_LEVEL = 0x23,
+ VT1625_TV_SIGNAL_OVERFLOW = 0x24,
+
+ /* DAC & GPO */
+ VT1625_DAC_SELECTION_0 = 0x4A,
+ VT1625_DAC_SELECTION_1 = 0x4B,
+ VT1625_GPO = 0x4C,
+
+ VT1625_COLBAR_LUMA_DELAY = 0x4D,
+ VT1625_UV_DELAY = 0x4E,
+ VT1625_BURST_MAX_AMPLITUDE = 0x4F,
+
+ /* Graphic timing */
+ VT1625_GRAPHIC_H_TOTAL = 0x50,
+ VT1625_GRAPHIC_H_ACTIVE = 0x51,
+ VT1625_GRAPHIC_H_OVERFLOW = 0x52,
+ VT1625_GRAPHIC_V_TOTAL = 0x53,
+ VT1625_GRAPHIC_V_OVERFLOW = 0x54,
+
+ /* TV timing */
+ VT1625_TV_H_TOTAL = 0x55,
+ VT1625_TV_H_ACTIVE = 0x56,
+ VT1625_TV_H_SYNC_WIDTH = 0x57,
+ VT1625_TV_H_OVERFLOW = 0x58,
+ VT1625_TV_BURST_START = 0x59,
+ VT1625_TV_BURST_END = 0x5A,
+ VT1625_TV_VIDEO_START = 0x5B,
+ VT1625_TV_VIDEO_END = 0x5C,
+ VT1625_TV_VIDEO_OVERFLOW = 0x5D,
+
+ /* scale factor */
+ VT1625_V_SCALE_FACTOR = 0x5E,
+ VT1625_H_SCALE_FACTOR = 0x5F,
+ VT1625_SCALE_OVERFLOW = 0x60,
+ VT1625_H_BLUR_SCALE_OVERFLOW = 0x61,
+ VT1625_ADAPTIVE_DEFLICKER_THR = 0x62,
+ VT1625_SCALE_H_TOTAL = 0x63,
+ VT1625_SCALE_H_TOTAL_OVERFLOW = 0x64,
+
+ /* Amplitude factor */
+ VT1625_PY_AMP_FACTOR = 0x65,
+ VT1625_PB_AMP_FACTOR = 0x66,
+ VT1625_PR_AMP_FACTOR = 0x67,
+
+ VT1625_POST_ADJUST = 0x68,
+ VT1625_AUTO_CORRECT_SENSE = 0x69,
+
+ /* WSS 0x6A - 0x73 */
+ VT1625_INT_WSS_2 = 0x71,
+
+ /* Close Caption 0x74 - 0x7A */
+
+ /* Signature Value 0x7B - 0x82 */
+} vt1625_reg_t;
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx vt1625_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in vt1625.h -------------*/
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int vt1625_xxx; *//*Example*/
+
+static char vt1625_ntsc_param[] = {
+ 0x03, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x82, /* 00 - 07 */
+#ifdef CONFIG_VM700
+ 0x14, 0x05, 0x6E, 0x15, 0x51, 0x50, 0x37, 0xB7, /* 08 - 0f */
+ 0x00, 0x80, 0x04, 0x08, 0x08, 0x90, 0xD6, 0x7B, /* 10 - 17 */
+#else
+ 0x14, 0x05, 0x6E, 0x15, 0x52, 0x4E, 0x37, 0xB7, /* 08 - 0f */
+ 0x08, 0x80, 0x04, 0x08, 0x08, 0x90, 0xD6, 0x7B, /* 10 - 17 */
+#endif
+ 0xF0, 0x21, 0x02, 0x50, 0x43, 0x80, 0x00, 0xFC, /* 18 - 1f */
+ 0x16, 0x08, 0xDC, 0x7D, 0x02, 0x56, 0x33, 0x8F, /* 20 - 27 */
+ 0x58, 0x00, 0x00, 0xA6, 0x29, 0xD4, 0x81, 0x00, /* 28 - 2f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 30 - 37 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38 - 3f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 40 - 47 */
+#ifdef CONFIG_VM700
+ 0x00, 0x00, 0xC5, 0x0F, 0x08, 0x01, 0x01, 0x43, /* 48 - 4f */
+#else
+ 0x00, 0x00, 0xC5, 0x0F, 0x00, 0x01, 0x10, 0x44, /* 48 - 4f */
+#endif
+ 0x59, 0xCF, 0x23, 0x0C, 0x02, 0x59, 0xCF, 0x7F, /* 50 - 57 */
+ 0x23, 0x94, 0xD6, 0x00, 0x9C, 0x06, 0x00, 0x00, /* 58 - 5f */
+ 0x80, 0x28, 0xFF, 0x59, 0x03, 0x55, 0x56, 0x56, /* 60 - 67 */
+ 0x00, 0x90, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, /* 68 - 6f */
+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 70 - 77 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 78 - 7f */
+ 0x00, 0x00, 0x00
+};
+
+static char vt1625_pal_param[] = {
+ 0x03, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x8C, /* 00 - 07 */
+#ifdef CONFIG_VM700
+ 0x0E, 0x01, 0x6E, 0x00, 0x51, 0x50, 0x37, 0xB7, /* 08 - 0f */
+ 0x00, 0x80, 0x04, 0x08, 0x08, 0x90, 0xCB, 0x8A, /* 10 - 17 */
+#else
+ 0x0E, 0x01, 0x7a, 0x00, 0x55, 0x58, 0x37, 0xB7, /* 08 - 0f */
+ 0xff, 0x87, 0x04, 0x08, 0x08, 0x90, 0xCB, 0x8A, /* 10 - 17 */
+#endif
+ 0x09, 0x2A, 0x06, 0x50, 0x41, 0x80, 0x00, 0xFC, /* 18 - 1f */
+ 0x17, 0x0C, 0x4E, 0x76, 0x02, 0x5F, 0x34, 0x8C, /* 20 - 27 */
+ 0x4F, 0x5E, 0x15, 0xA2, 0x22, 0x80, 0xD3, 0x10, /* 28 - 2f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 30 - 37 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 38 - 3f */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 40 - 47 */
+#ifdef CONFIG_VM700
+ 0x00, 0x00, 0xC5, 0x0F, 0x08, 0x02, 0x01, 0x43, /* 48 - 4f */
+#else
+ 0x00, 0x00, 0xC5, 0x0F, 0x00, 0x02, 0x10, 0x4C, /* 48 - 4f */
+#endif
+ 0x5f, 0xCF, 0x23, 0x70, 0x02, 0x5F, 0xD0, 0x7F, /* 50 - 57 */
+ 0x23, 0x92, 0xCE, 0xDF, 0xA0, 0x06, 0x00, 0x00, /* 58 - 5f */
+ 0x80, 0x20, 0xFF, 0x5F, 0x03, 0x5f, 0x00, 0x00, /* 60 - 67 */
+ 0x00, 0x90, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, /* 68 - 6f */
+ 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 70 - 77 */
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 78 - 7f */
+ 0x00, 0x00, 0x00
+};
+
+enum vt1625_out_t {
+ VT1625_OUT_CVBS,
+ VT1625_OUT_YUV,
+ VT1625_OUT_VGA,
+ VT1625_OUT_MAX
+};
+
+enum vt1625_out_t vt1625_out_mode;
+
+int vt1625_tv_mode;
+vdo_color_fmt vt1625_colfmt;
+
+static int pre_plugin;
+
+/*
+* VT1625 U-Boot Env to Set Register
+*/
+typedef struct {
+ unsigned char offset;
+ unsigned char value;
+} vt1625_reg_env_t;
+
+#define VT1625_REG_MAX_OFFSET 0x82 /* Register Offset: 0x00 ~ 0x82 */
+/*
+* setenv wmt.vt1625.pal.reg regOffset1=regValue1,regOffset2=regValue2,...
+* for example:
+* setenv wmt.vt1625.pal.reg 0a=75,0c=53,23=7a,4f=48
+* setenv wmt.vt1625.ntsc.reg 0a=75,0c=53,23=7a,4f=48
+*/
+#define VT1625_PAL_REG_ENV "wmt.vt1625.pal.reg"
+#define VT1625_NTSC_REG_ENV "wmt.vt1625.ntsc.reg"
+
+/*
+* setenv wmt.vt1625.cvbs.always.turnon 1
+* The cvbs is always turned on event if the av line is pluged out
+* setenv wmt.vt1625.cvbs.always.turnon 0
+* The cvbs is turned on if the av line is pluged in.
+* And the cvbs is turned off if the av line is pluged out
+*/
+#define VT1625_CVBS_ALWAYS_TURNON "wmt.vt1625.cvbs.always.turnon"
+
+static int vt1625_cvbs_always_turnon;
+
+#ifdef CONFIG_KERNEL
+/*
+* VT1625 Timer to Monitor Register
+*/
+/*
+* Monitor the vt1625 register for avoiding the register is cleared.
+* setenv wmt.vt1625.reg.monitor 1
+*
+* If the wmt.vt1625.reg.monitor is Not set or set to 0,
+* it will not monitor the register
+*
+*/
+#define VT1625_REG_MONITOR_ENV "wmt.vt1625.reg.monitor"
+
+#define VT1625_TIMER_INTERVAL 1000 // 1000 ms
+
+static struct timer_list vt1625_timer;
+static struct work_struct vt1625_work;
+
+static void vt1625_set_tv_mode(int ntsc);
+
+#endif
+
+#ifdef CONFIG_UBOOT
+#define msleep mdelay
+#endif
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void vt1625_xxx(void); *//*Example*/
+
+/*----------------------- Function Body --------------------------------------*/
+/*
+* Function: register_is_right()
+* Parametr:
+* ntsc = 0: PAL
+* ntsc = 1: NTSC
+* Return :
+* 0: the register's values is wrong
+* 1: the register's values is right
+*/
+static int register_is_right(int ntsc)
+{
+ int i;
+ char buf[32];
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_INPUT_SELECTION, buf, 32);
+
+ for(i = 0; i < 32; i++) {
+ /*
+ * reg 0x0E is power management register. Skip it
+ * reg 0x0F is status register. it is volatile. Skip it
+ */
+ if(i == 14 || i == 15)
+ continue;
+
+
+ if(i == 0) {
+ if(vt1625_colfmt == VDO_COL_FMT_YUV444) {
+ if(buf[0] != 0x3A)
+ break;
+ } else {
+ if(buf[0] != 0x03)
+ break;
+ }
+ } else {
+ if(ntsc) {
+ /*
+ * NTSC
+ */
+ if(buf[i] != vt1625_ntsc_param[i])
+ break;
+ } else {
+ /*
+ * PAL
+ */
+ if(buf[i] != vt1625_pal_param[i])
+ break;
+ }
+ }
+ }
+
+ if(i != 32)
+ return 0;
+ else
+ return 1;
+}
+
+#ifdef CONFIG_KERNEL
+static void vt1625_reconfig(struct work_struct *work)
+{
+ int right;
+
+ if(vt1625_tv_mode) {
+ right = register_is_right((vt1625_tv_mode == 1) ? 1 : 0);
+ if(right == 0) {
+ DBG_ERR("VT1625 Reg Error, re-init the register\n");
+
+ vt1625_set_tv_mode((vt1625_tv_mode == 1) ? 1 : 0);
+ }
+ }
+
+ mod_timer(&vt1625_timer, jiffies + msecs_to_jiffies(VT1625_TIMER_INTERVAL));
+}
+
+static DECLARE_WORK(vt1625_work, vt1625_reconfig);
+
+static void vt1625_config_timer(unsigned long fcontext)
+{
+ schedule_work(&vt1625_work);
+}
+
+static void init_vt1625_timer(void)
+{
+ char buf[40];
+ int varlen = 40;
+ char *endp;
+ int value, reg_monitor;
+
+ reg_monitor = 0;
+
+ if (wmt_getsyspara(VT1625_REG_MONITOR_ENV, buf, &varlen) == 0) {
+ value = simple_strtoul(buf, &endp, 0);
+ if( value != 0)
+ reg_monitor = 1;
+ }
+
+ if(reg_monitor) {
+ init_timer(&vt1625_timer);
+ vt1625_timer.function = vt1625_config_timer;
+ vt1625_timer.data = 0;
+ } else
+ vt1625_timer.function = NULL;
+
+}
+
+static void start_vt1625_timer(void)
+{
+ if(vt1625_timer.function)
+ mod_timer(&vt1625_timer, jiffies + msecs_to_jiffies(VT1625_TIMER_INTERVAL));
+}
+
+static void stop_vt1625_timer(void)
+{
+ if(vt1625_timer.function)
+ del_timer_sync(&vt1625_timer);
+}
+#endif
+
+/*
+* Function : vt1625_parse_reg_env
+* Parameter:
+* p_env : env name
+* p_reg : store the vt1625 register offset and value
+* p_regnum: register number
+* Return:
+* 0 : the env is set and the env's value is available
+* -1 : the env is Not set or the env's value is wrong
+* -12 : no memory for parsing register env
+*/
+static int vt1625_parse_reg_env(char *p_env,
+ vt1625_reg_env_t *p_reg, int *p_regnum)
+{
+ int i;
+ char *buf;
+ int buflen = 1024;
+ unsigned int value;
+ const char *p;
+ char *endp;
+
+ buf = kmalloc(buflen, GFP_KERNEL);
+ if(buf == NULL) {
+ DBG_ERR("kzalloc fail\n");
+ return -12;
+ }
+
+ if(wmt_getsyspara(p_env, buf, &buflen) != 0) {
+ kfree(buf);
+ return -1;
+ }
+
+ *p_regnum = 0;
+ p = buf;
+
+ for(i = 0; i <= VT1625_REG_MAX_OFFSET; i++) {
+ value = simple_strtoul(p, &endp, 16);
+ if(value > VT1625_REG_MAX_OFFSET) {
+ DBG_ERR("wrong register offset\n");
+ kfree(buf);
+ return -1;
+ }
+ (p_reg + i)->offset = value;
+ /*
+ * reg_offset must be followed reg_value
+ * If reg_offset is NOT followed any reg_value, It is wrong format
+ */
+ if(*endp == '\0'|| *(endp + 1) == '\0') {
+ DBG_ERR("wrong env(%s) format\n", p_env);
+ kfree(buf);
+ return -1;
+ }
+
+ p = endp + 1;
+
+ value = simple_strtoul(p, &endp, 16);
+ if(value > 0xFF) {
+ DBG_ERR("wrong register value\n");
+ kfree(buf);
+ return -1;
+ }
+ (p_reg + i)->value = value;
+ *p_regnum = *p_regnum + 1;
+
+ if(*endp == '\0')
+ break;
+
+ p = endp + 1;
+ }
+
+ kfree(buf);
+ return 0;
+}
+
+/*the define and struct i2c_msg were declared int linux/i2c.h*/
+void vt1625_reg_dump(void)
+{
+ int i;
+ char buf[256];
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR, VT1625_INPUT_SELECTION,
+ buf, 128);
+ for (i = 0; i < 128; i += 8) {
+ MSG("0x%02X : 0x%02X,0x%02X,0x%02X,0x%02X",
+ i, buf[i], buf[i + 1], buf[i + 2], buf[i + 3]);
+ MSG(",0x%02X,0x%02X,0x%02X,0x%02X\n",
+ buf[i + 4], buf[i + 5], buf[i + 6], buf[i + 7]);
+ }
+}
+
+static char vt1625_get_dac_val(enum vt1625_out_t mode)
+{
+ char ret;
+
+ switch (mode) {
+ case VT1625_OUT_CVBS:
+ ret = 0x37;
+ break;
+ case VT1625_OUT_VGA:
+ ret = 0x38;
+ break;
+ case VT1625_OUT_YUV:
+ default:
+ ret = 0x0;
+ break;
+ }
+ return ret;
+}
+
+static void vt1625_set_tv_mode(int ntsc)
+{
+ char *p;
+ char buf[10];
+
+/*
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_INPUT_SELECTION, buf, 5);
+ DBG_MSG("ntsc %d, 0x%x, 0x%x\n", ntsc, buf[0], buf[4]);
+ vt1625_tv_mode = (ntsc) ? 1 : 2;
+#ifdef CONFIG_KERNEL
+ if (buf[0] && (vt1625_out_mode != VT1625_OUT_MAX)) {
+ if (ntsc && !(buf[4] & BIT0))
+ return;
+ if (!ntsc && (buf[4] & BIT0))
+ return;
+ }
+#endif
+*/
+ vt1625_tv_mode = (ntsc) ? 1 : 2;
+ if(register_is_right(ntsc))
+ return;
+
+ DBG_MSG("tv %s,mode %d\n", (ntsc) ? "NTSC" : "PAL", vt1625_out_mode);
+
+ p = (char *)((ntsc) ? vt1625_ntsc_param : vt1625_pal_param);
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR, VT1625_INPUT_SELECTION,
+ &p[VT1625_INPUT_SELECTION], 0x71);
+ if (vt1625_out_mode == VT1625_OUT_MAX) { /* not stable so no use */
+ buf[0] = 0x0;
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, buf, 1);
+ mdelay(10);
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_STATUS, buf, 1);
+ vt1625_out_mode = (buf[0] & 0x7) ?
+ VT1625_OUT_CVBS : VT1625_OUT_VGA;
+ DBG_MSG("get out mode %d, 0x%x\n", vt1625_out_mode, buf[0]);
+ }
+
+ if (vt1625_out_mode == VT1625_OUT_VGA) {
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_SYNC_SELECTION_1, buf, 1);
+ buf[0] |= 0xA0;
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_SYNC_SELECTION_1, buf, 1);
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_DAC_OVERFLOW, buf, 1);
+ buf[0] |= 0x20;
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_DAC_OVERFLOW, buf, 1);
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_TEST_1, buf, 1);
+ buf[0] |= 0x40;
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_TEST_1, buf, 1);
+ } else {
+#ifdef CONFIG_VT1625_INTERRUPT
+ /* interrupt (VGA no work) */
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_INT_WSS_2, buf, 1);
+ buf[0] |= 0xA0; /* enable sense interrupt */
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_INT_WSS_2, buf, 1);
+#endif
+ }
+
+ if (vt1625_colfmt == VDO_COL_FMT_YUV444) {
+ /*
+ * Force write reg0x00 and reg0x4C
+ */
+ buf[0] = 0x3A;
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_INPUT_SELECTION, buf, 1);
+ buf[0] = 0x08;
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_GPO, buf, 1);
+ }
+
+#ifdef CONFIG_VT1625_POWER
+ buf[0] = vt1625_get_dac_val(vt1625_out_mode);
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, buf, 1);
+#endif
+}
+
+static int vt1625_check_plugin(int hotplug)
+{
+ char buf[2];
+ char cur[1];
+ int plugin;
+
+ /*
+ * Enable VT1625 Power First
+ */
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, cur, 1);
+
+ buf[0] = vt1625_get_dac_val(vt1625_out_mode);
+
+ if(cur[0] != buf[0]) {
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, buf, 1);
+
+ msleep(10);
+ }
+
+ if((vt1625_out_mode == VT1625_OUT_CVBS) && vt1625_cvbs_always_turnon)
+ return 1;
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR, VT1625_POWER_MANAGEMENT,
+ buf, 2);
+ plugin = ~buf[1] & (~buf[0] & 0x3F);
+ DBG_MSG("[VT1625] DAC A %d, B %d, C %d, D %d, E %d, F %d\n",
+ (plugin & 0x20) ? 1 : 0, (plugin & 0x10) ? 1 : 0,
+ (plugin & 0x08) ? 1 : 0, (plugin & 0x04) ? 1 : 0,
+ (plugin & 0x02) ? 1 : 0, (plugin & 0x01) ? 1 : 0);
+ return (plugin) ? 1 : 0;
+}
+
+static int vt1625_init(struct vout_t *vo)
+{
+ char buf[40];
+ int varlen = 40;
+ char *endp;
+ unsigned int value;
+
+ DBG_MSG("\n");
+
+#ifndef CONFIG_UBOOT
+ if (vt1625_tv_mode) { /* resume reinit */
+ MSG("[VT1625] DVI reinit\n");
+ vt1625_set_tv_mode((vt1625_tv_mode == 1) ? 1 : 0);
+ if (govrh_get_dvo_enable(p_govrh2) == 0)
+ govrh_set_dvo_enable(p_govrh2, VPP_FLAG_ENABLE);
+ pre_plugin = 0;
+ return 0;
+ }
+#endif
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR, VT1625_VERSION_ID, buf, 1);
+ if (buf[0] != 0x50) /* check version id */
+ return -1;
+
+ if (wmt_getsyspara("wmt.display.vt1625.mode", buf, &varlen) == 0) {
+ if (memcmp(buf, "yuv", 3) == 0)
+ vt1625_out_mode = VT1625_OUT_YUV;
+ else if (memcmp(buf, "vga", 3) == 0)
+ vt1625_out_mode = VT1625_OUT_VGA;
+ else
+ vt1625_out_mode = VT1625_OUT_CVBS;
+ DPRINT("[VT1625] mode %d\n", vt1625_out_mode);
+ } else
+ vt1625_out_mode = VT1625_OUT_CVBS; /* VT1625_OUT_MAX; */
+
+#ifdef CONFIG_VM700
+ vt1625_colfmt = VDO_COL_FMT_YUV444;
+#else
+ vt1625_colfmt = VDO_COL_FMT_ARGB;
+#endif
+ if (wmt_getsyspara("wmt.display.vt1625.colfmt", buf, &varlen) == 0) {
+ if (memcmp(buf, "yuv", 3) == 0)
+ vt1625_colfmt = VDO_COL_FMT_YUV444;
+ else if (memcmp(buf, "rgb", 3) == 0)
+ vt1625_colfmt = VDO_COL_FMT_ARGB;
+ }
+
+ vo->option[0] = (unsigned int) vt1625_colfmt;
+ vo->option[1] = (unsigned int) VPP_DATAWIDHT_12;
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_INPUT_SELECTION, buf, 5);
+ if (buf[0])
+ vt1625_tv_mode = (buf[4]) ? 2 : 1;
+
+ p_govrh2->fb_p->csc_mode = VPP_CSC_RGB2YUV_SDTV_0_255;
+
+ if (wmt_getsyspara(VT1625_CVBS_ALWAYS_TURNON, buf, &varlen) == 0) {
+ value = simple_strtoul(buf, &endp, 0);
+ if(value != 0)
+ vt1625_cvbs_always_turnon = 1;
+ else
+ vt1625_cvbs_always_turnon = 0;
+ } else
+ vt1625_cvbs_always_turnon = 0;
+
+#ifdef CONFIG_KERNEL
+ vt1625_set_tv_mode((vt1625_tv_mode == 1) ? 1 : 0);
+
+ start_vt1625_timer();
+#endif
+
+ MSG("[VT1625] DVI ext device\n");
+ return 0;
+}
+
+static int vt1625_set_mode(unsigned int *option)
+{
+#ifdef CONFIG_VT1625_INTERRUPT
+ char buf[1];
+#endif
+
+ DBG_MSG("\n");
+#ifdef CONFIG_VT1625_INTERRUPT
+ if (!g_vpp.dvi_int_disable) {
+ vout_set_int_type(1);
+ vout_set_int_enable(1);
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_INT_WSS_2, buf, 1);
+ buf[0] |= 0xA0; /* enable sense interrupt */
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_INT_WSS_2, buf, 1);
+ }
+#endif
+ return 0;
+}
+
+static void vt1625_set_power_down(int enable)
+{
+ struct vout_t *vo;
+ char buf[1];
+ char cur[1];
+
+ /*
+ bit 0-2 : DAC D/E/F - VGA
+ bit 3 : DAC C - CVBS
+ bit 3-5 : DAC A/B/C - YPbPr
+ bit 6 : PLL
+ bit 7 : IO pad
+ */
+ vo = vout_get_entry(VPP_VOUT_NUM_DVI);
+ if (vo->status & (VPP_VOUT_STS_BLANK + VPP_VOUT_STS_POWERDN))
+ enable = 1;
+
+ /* power down for not support resolution */
+//#ifndef CONFIG_VT1625_INTERRUPT
+ if ((vt1625_tv_mode != 0) && enable && g_vpp.dvi_int_disable)
+ buf[0] = 0xFF;
+ else
+//#endif
+ buf[0] = vt1625_get_dac_val(vt1625_out_mode);
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, cur, 1);
+
+ if (cur[0] == buf[0])
+ return;
+
+ DBG_MSG("enable %d,cur 0x%x,new 0x%x\n", enable, cur[0], buf[0]);
+#if 1
+ if (enable == 0) {
+ cur[0] &= ~0x40; /* turn on PLL */
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, cur, 1);
+ mdelay(3);
+
+ cur[0] &= ~0x80; /* turn on IO pad */
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, cur, 1);
+ mdelay(3);
+ }
+#endif
+#ifdef CONFIG_VT1625_POWER
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, buf, 1);
+#endif
+}
+
+static int vt1625_config(struct vout_info_t *info)
+{
+ int ntsc = -1;
+
+ DBG_MSG("%d,%d\n", info->resx, info->resy);
+ if (info->resx == 720) {
+ switch (info->resy) {
+ case 480:
+ ntsc = 1;
+ break;
+ case 576:
+ ntsc = 0;
+ break;
+ default:
+ break;
+ }
+ }
+
+ if (ntsc != -1)
+ vt1625_set_tv_mode(ntsc);
+ else
+ vt1625_tv_mode = 0;
+ DBG_MSG("end\n");
+ return 0;
+}
+
+static int vt1625_get_edid(char *buf)
+{
+ return 0;
+}
+
+#ifdef CONFIG_VT1625_INTERRUPT
+static int vt1625_interrupt(void)
+{
+ char buf[1];
+
+ vppif_reg32_write(GPIO_BASE_ADDR + 0x4c0, 0x1 << VPP_VOINT_NO,
+ VPP_VOINT_NO, 0x0); /* GPIO pull-up */
+ /* interrupt */
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR, VT1625_INT_WSS_2, buf, 1);
+ DBG_MSG("0x%x\n", buf[0]);
+ buf[0] &= ~0x40; /* clear interrupt */
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR, VT1625_INT_WSS_2, buf, 1);
+ return vt1625_check_plugin(1);
+}
+#endif
+
+static void vt1625_poll(void)
+{
+ int plugin;
+ char buf[1];
+ char cur[1];
+
+ if (govrh_get_dvo_enable(p_govrh2) == 0)
+ govrh_set_dvo_enable(p_govrh2, VPP_FLAG_ENABLE);
+
+ plugin = vt1625_check_plugin(0);
+ if (plugin != pre_plugin) {
+ struct vout_t *vo;
+
+ vo = vout_get_entry(VPP_VOUT_NUM_DVI);
+ vout_change_status(vo, VPP_VOUT_STS_PLUGIN, plugin);
+#ifdef CONFIG_KERNEL
+ vpp_netlink_notify_plug(VPP_VOUT_NUM_DVI, plugin);
+#endif
+ pre_plugin = plugin;
+ DMSG("%d\n", plugin);
+ }
+
+ /*
+ * Disable VT1625 Power if CVBS Not plugin
+ */
+ if(plugin == 0) {
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, cur, 1);
+
+ buf[0] = 0xFF;
+
+ if(cur[0] != buf[0]) {
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1625_ADDR,
+ VT1625_POWER_MANAGEMENT, buf, 1);
+ }
+ }
+}
+
+static int vt1625_suspend(void)
+{
+ DMSG("\n");
+
+#ifdef CONFIG_KERNEL
+ stop_vt1625_timer();
+#endif
+
+ return 0;
+}
+
+static int vt1625_resume(void)
+{
+ DMSG("\n");
+
+#ifdef CONFIG_KERNEL
+ start_vt1625_timer();
+#endif
+ return 0;
+}
+
+/*----------------------- vout device plugin ---------------------------------*/
+struct vout_dev_t vt1625_vout_dev_ops = {
+ .name = "VT1625",
+ .mode = VOUT_INF_DVI,
+
+ .init = vt1625_init,
+ .set_power_down = vt1625_set_power_down,
+ .set_mode = vt1625_set_mode,
+ .config = vt1625_config,
+ .check_plugin = vt1625_check_plugin,
+ .get_edid = vt1625_get_edid,
+#ifdef CONFIG_VT1625_INTERRUPT
+ .interrupt = vt1625_interrupt,
+#endif
+ .poll = vt1625_poll,
+ .suspend = vt1625_suspend,
+ .resume = vt1625_resume,
+};
+
+int vt1625_module_init(void)
+{
+ vt1625_reg_env_t *p_reg;
+ int i, ret, regnum;
+
+ p_reg = kmalloc((VT1625_REG_MAX_OFFSET + 1) * sizeof(vt1625_reg_env_t),
+ GFP_KERNEL);
+ if(p_reg) {
+ ret = vt1625_parse_reg_env(VT1625_PAL_REG_ENV, p_reg, &regnum);
+ if(ret == 0) {
+ for(i = 0; i < regnum; i++)
+ vt1625_pal_param[(p_reg + i)->offset] =
+ (p_reg + i)->value;
+ }
+
+ ret = vt1625_parse_reg_env(VT1625_NTSC_REG_ENV, p_reg, &regnum);
+ if(ret == 0) {
+ for(i = 0; i < regnum; i++)
+ vt1625_ntsc_param[(p_reg + i)->offset] =
+ (p_reg + i)->value;
+ }
+
+ kfree(p_reg);
+ } else
+ DBG_ERR("kzalloc fail\n");
+
+#ifdef CONFIG_KERNEL
+ init_vt1625_timer();
+#endif
+
+ vout_device_register(&vt1625_vout_dev_ops);
+
+ return 0;
+}
+module_init(vt1625_module_init);
+/*--------------------End of Function Body -----------------------------------*/
+#undef VT1625_C
diff --git a/common/wmt_display/devices/vt1632.c b/common/wmt_display/devices/vt1632.c
new file mode 100755
index 0000000..b3950c0
--- /dev/null
+++ b/common/wmt_display/devices/vt1632.c
@@ -0,0 +1,157 @@
+/*++
+ * linux/drivers/video/wmt/vt1632.c
+ * WonderMedia video post processor (VPP) driver
+ *
+ * Copyright c 2014 WonderMedia Technologies, Inc.
+ *
+ * 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.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * WonderMedia Technologies, Inc.
+ * 4F, 533, Chung-Cheng Road, Hsin-Tien, Taipei 231, R.O.C
+--*/
+
+#define VT1632_C
+/* #define DEBUG */
+/*----------------------- DEPENDENCE -----------------------------------------*/
+#include "../vout.h"
+
+/*----------------------- PRIVATE MACRO --------------------------------------*/
+/* #define VT1632_XXXX xxxx *//*Example*/
+
+/*----------------------- PRIVATE CONSTANTS ----------------------------------*/
+/* #define VT1632_XXXX 1 *//*Example*/
+#define VT1632_ADDR 0x10
+
+/*----------------------- PRIVATE TYPE --------------------------------------*/
+/* typedef xxxx vt1632_xxx_t; *//*Example*/
+
+/*----------EXPORTED PRIVATE VARIABLES are defined in vt1632.h -------------*/
+/*----------------------- INTERNAL PRIVATE VARIABLES - -----------------------*/
+/* int vt1632_xxx; *//*Example*/
+static int vt1632_not_ready;
+
+/*--------------------- INTERNAL PRIVATE FUNCTIONS ---------------------------*/
+/* void vt1632_xxx(void); *//*Example*/
+
+/*----------------------- Function Body --------------------------------------*/
+
+/*the define and struct i2c_msg were declared int linux/i2c.h*/
+int vt1632_check_plugin(int hotplug)
+{
+ char buf[1];
+ int plugin;
+
+ if (vt1632_not_ready)
+ return 1;
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1632_ADDR, 0x9, buf, 1);
+ plugin = (buf[0] & 0x4) ? 1 : 0;
+ DPRINT("[VT1632] DVI plug%s\n", (plugin) ? "in" : "out");
+ vout_set_int_type(4);
+ return plugin;
+}
+
+int vt1632_init(struct vout_t *vo)
+{
+ char buf[16];
+
+ vt1632_not_ready = 1;
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1632_ADDR, 0x0, buf, 2);
+ if ((buf[0] != 0x06) || (buf[1] != 0x11)) /* check vender id */
+ return -1;
+ vt1632_not_ready = 0;
+
+ buf[0x0] = 0x37;
+ buf[0x1] = 0x20;
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1632_ADDR, 0x8, buf, 2);
+ DPRINT("[VT1632] DVI ext device\n");
+ return 0;
+}
+
+int vt1632_set_mode(unsigned int *option)
+{
+ char buf[1];
+ vpp_datawidht_t dwidth;
+
+ if (vt1632_not_ready)
+ return -1;
+
+ dwidth = option[1] & BIT0;
+ DBGMSG("vt1632_set_mode(%d)\n", (dwidth) ? 24 : 12);
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1632_ADDR, 0x8, buf, 1);
+ if (dwidth == VPP_DATAWIDHT_12) {
+ buf[0] &= ~BIT2;
+ buf[0] |= BIT3;
+ } else {
+ buf[0] |= BIT2;
+ buf[0] &= ~BIT3;
+ }
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1632_ADDR, 0x8, buf, 1);
+ return 0;
+}
+
+void vt1632_set_power_down(int enable)
+{
+ char buf[1];
+
+ if (vt1632_not_ready)
+ return;
+
+ DBGMSG("vt1632_set_power_down(%d)\n", enable);
+
+ vpp_i2c_read(VPP_DVI_I2C_ID, VT1632_ADDR, 0x8, buf, 1);
+ if (enable)
+ buf[0] &= ~BIT0;
+ else
+ buf[0] |= BIT0;
+ vpp_i2c_write(VPP_DVI_I2C_ID, VT1632_ADDR, 0x8, buf, 1);
+}
+
+int vt1632_config(struct vout_info_t *info)
+{
+ return 0;
+}
+
+int vt1632_get_edid(char *buf)
+{
+ return 0;
+}
+
+int vt1632_interrupt(void)
+{
+ return vt1632_check_plugin(1);
+}
+/*----------------------- vout device plugin ---------------------------------*/
+struct vout_dev_t vt1632_vout_dev_ops = {
+ .name = "VT1632",
+ .mode = VOUT_INF_DVI,
+
+ .init = vt1632_init,
+ .set_power_down = vt1632_set_power_down,
+ .set_mode = vt1632_set_mode,
+ .config = vt1632_config,
+ .check_plugin = vt1632_check_plugin,
+ .get_edid = vt1632_get_edid,
+ .interrupt = vt1632_interrupt,
+};
+
+int vt1632_module_init(void)
+{
+ vout_device_register(&vt1632_vout_dev_ops);
+ return 0;
+} /* End of vt1632_module_init */
+module_init(vt1632_module_init);
+/*--------------------End of Function Body -----------------------------------*/
+#undef VT1632_C