1bba09e9fSDonghwa Lee /* 2bba09e9fSDonghwa Lee * Copyright (C) 2012 Samsung Electronics 3bba09e9fSDonghwa Lee * 4bba09e9fSDonghwa Lee * Author: Donghwa Lee <dh09.lee@samsung.com> 5bba09e9fSDonghwa Lee * 6bba09e9fSDonghwa Lee * This program is free software; you can redistribute it and/or 7bba09e9fSDonghwa Lee * modify it under the terms of the GNU General Public License as 8bba09e9fSDonghwa Lee * published by the Free Software Foundation; either version 2 of 9bba09e9fSDonghwa Lee * the License, or (at your option) any later version. 10bba09e9fSDonghwa Lee * 11bba09e9fSDonghwa Lee * This program is distributed in the hope that it will be useful, 12bba09e9fSDonghwa Lee * but WITHOUT ANY WARRANTY; without even the implied warranty of 13bba09e9fSDonghwa Lee * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14bba09e9fSDonghwa Lee * GNU General Public License for more details. 15bba09e9fSDonghwa Lee * 16bba09e9fSDonghwa Lee * You should have received a copy of the GNU General Public License 17bba09e9fSDonghwa Lee * along with this program; if not, write to the Free Software 18bba09e9fSDonghwa Lee * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 19bba09e9fSDonghwa Lee * MA 02111-1307 USA 20bba09e9fSDonghwa Lee */ 21bba09e9fSDonghwa Lee 22bba09e9fSDonghwa Lee #include <common.h> 23bba09e9fSDonghwa Lee #include <asm/arch/mipi_dsim.h> 24bba09e9fSDonghwa Lee 25bba09e9fSDonghwa Lee #include "exynos_mipi_dsi_lowlevel.h" 26bba09e9fSDonghwa Lee #include "exynos_mipi_dsi_common.h" 27bba09e9fSDonghwa Lee 28bba09e9fSDonghwa Lee static void s6e8ax0_panel_cond(struct mipi_dsim_device *dsim_dev) 29bba09e9fSDonghwa Lee { 30bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 31*3d024086SDonghwa Lee int reverse = dsim_dev->dsim_lcd_dev->reverse_panel; 32bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 33bba09e9fSDonghwa Lee 0xf8, 0x3d, 0x35, 0x00, 0x00, 0x00, 0x8d, 0x00, 0x4c, 34bba09e9fSDonghwa Lee 0x6e, 0x10, 0x27, 0x7d, 0x3f, 0x10, 0x00, 0x00, 0x20, 35bba09e9fSDonghwa Lee 0x04, 0x08, 0x6e, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 36bba09e9fSDonghwa Lee 0x23, 0x23, 0xc0, 0xc8, 0x08, 0x48, 0xc1, 0x00, 0xc3, 37bba09e9fSDonghwa Lee 0xff, 0xff, 0xc8 38bba09e9fSDonghwa Lee }; 39bba09e9fSDonghwa Lee 40*3d024086SDonghwa Lee const unsigned char data_to_send_reverse[] = { 41*3d024086SDonghwa Lee 0xf8, 0x19, 0x35, 0x00, 0x00, 0x00, 0x93, 0x00, 0x3c, 42*3d024086SDonghwa Lee 0x7d, 0x08, 0x27, 0x7d, 0x3f, 0x00, 0x00, 0x00, 0x20, 43*3d024086SDonghwa Lee 0x04, 0x08, 0x6e, 0x00, 0x00, 0x00, 0x02, 0x08, 0x08, 44*3d024086SDonghwa Lee 0x23, 0x23, 0xc0, 0xc1, 0x01, 0x41, 0xc1, 0x00, 0xc1, 45*3d024086SDonghwa Lee 0xf6, 0xf6, 0xc1 46*3d024086SDonghwa Lee }; 47*3d024086SDonghwa Lee 48*3d024086SDonghwa Lee if (reverse) { 49*3d024086SDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 50*3d024086SDonghwa Lee (unsigned int)data_to_send_reverse, 51*3d024086SDonghwa Lee ARRAY_SIZE(data_to_send_reverse)); 52*3d024086SDonghwa Lee } else { 53bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 54bba09e9fSDonghwa Lee (unsigned int)data_to_send, ARRAY_SIZE(data_to_send)); 55bba09e9fSDonghwa Lee } 56*3d024086SDonghwa Lee } 57bba09e9fSDonghwa Lee 58bba09e9fSDonghwa Lee static void s6e8ax0_display_cond(struct mipi_dsim_device *dsim_dev) 59bba09e9fSDonghwa Lee { 60bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 61bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 62bba09e9fSDonghwa Lee 0xf2, 0x80, 0x03, 0x0d 63bba09e9fSDonghwa Lee }; 64bba09e9fSDonghwa Lee 65bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 66bba09e9fSDonghwa Lee (unsigned int)data_to_send, 67bba09e9fSDonghwa Lee ARRAY_SIZE(data_to_send)); 68bba09e9fSDonghwa Lee } 69bba09e9fSDonghwa Lee 70bba09e9fSDonghwa Lee static void s6e8ax0_gamma_cond(struct mipi_dsim_device *dsim_dev) 71bba09e9fSDonghwa Lee { 72bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 738ecb4c64SDonghwa Lee /* 7500K 2.2 Set : 30cd */ 74bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 758ecb4c64SDonghwa Lee 0xfa, 0x01, 0x60, 0x10, 0x60, 0xf5, 0x00, 0xff, 0xad, 768ecb4c64SDonghwa Lee 0xaf, 0xba, 0xc3, 0xd8, 0xc5, 0x9f, 0xc6, 0x9e, 0xc1, 778ecb4c64SDonghwa Lee 0xdc, 0xc0, 0x00, 0x61, 0x00, 0x5a, 0x00, 0x74, 78bba09e9fSDonghwa Lee }; 79bba09e9fSDonghwa Lee 80bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 81bba09e9fSDonghwa Lee (unsigned int)data_to_send, 82bba09e9fSDonghwa Lee ARRAY_SIZE(data_to_send)); 83bba09e9fSDonghwa Lee } 84bba09e9fSDonghwa Lee 85bba09e9fSDonghwa Lee static void s6e8ax0_gamma_update(struct mipi_dsim_device *dsim_dev) 86bba09e9fSDonghwa Lee { 87bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 88bba09e9fSDonghwa Lee 89bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0xf7, 0x3); 90bba09e9fSDonghwa Lee } 91bba09e9fSDonghwa Lee 92bba09e9fSDonghwa Lee static void s6e8ax0_etc_source_control(struct mipi_dsim_device *dsim_dev) 93bba09e9fSDonghwa Lee { 94bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 95bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 96bba09e9fSDonghwa Lee 0xf6, 0x00, 0x02, 0x00 97bba09e9fSDonghwa Lee }; 98bba09e9fSDonghwa Lee 99bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 100bba09e9fSDonghwa Lee (unsigned int)data_to_send, 101bba09e9fSDonghwa Lee ARRAY_SIZE(data_to_send)); 102bba09e9fSDonghwa Lee } 103bba09e9fSDonghwa Lee 104bba09e9fSDonghwa Lee static void s6e8ax0_etc_pentile_control(struct mipi_dsim_device *dsim_dev) 105bba09e9fSDonghwa Lee { 106bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 107bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 108bba09e9fSDonghwa Lee 0xb6, 0x0c, 0x02, 0x03, 0x32, 0xff, 0x44, 0x44, 0xc0, 109bba09e9fSDonghwa Lee 0x00 110bba09e9fSDonghwa Lee }; 111bba09e9fSDonghwa Lee 112bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 113bba09e9fSDonghwa Lee (unsigned int)data_to_send, 114bba09e9fSDonghwa Lee ARRAY_SIZE(data_to_send)); 115bba09e9fSDonghwa Lee } 116bba09e9fSDonghwa Lee 117bba09e9fSDonghwa Lee static void s6e8ax0_etc_mipi_control1(struct mipi_dsim_device *dsim_dev) 118bba09e9fSDonghwa Lee { 119bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 120bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 121bba09e9fSDonghwa Lee 0xe1, 0x10, 0x1c, 0x17, 0x08, 0x1d 122bba09e9fSDonghwa Lee }; 123bba09e9fSDonghwa Lee 124bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 125bba09e9fSDonghwa Lee (unsigned int)data_to_send, 126bba09e9fSDonghwa Lee ARRAY_SIZE(data_to_send)); 127bba09e9fSDonghwa Lee } 128bba09e9fSDonghwa Lee 129bba09e9fSDonghwa Lee static void s6e8ax0_etc_mipi_control2(struct mipi_dsim_device *dsim_dev) 130bba09e9fSDonghwa Lee { 131bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 132bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 133bba09e9fSDonghwa Lee 0xe2, 0xed, 0x07, 0xc3, 0x13, 0x0d, 0x03 134bba09e9fSDonghwa Lee }; 135bba09e9fSDonghwa Lee 136bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 137bba09e9fSDonghwa Lee (unsigned int)data_to_send, 138bba09e9fSDonghwa Lee ARRAY_SIZE(data_to_send)); 139bba09e9fSDonghwa Lee } 140bba09e9fSDonghwa Lee 141bba09e9fSDonghwa Lee static void s6e8ax0_etc_power_control(struct mipi_dsim_device *dsim_dev) 142bba09e9fSDonghwa Lee { 143bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 144bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 145bba09e9fSDonghwa Lee 0xf4, 0xcf, 0x0a, 0x12, 0x10, 0x19, 0x33, 0x02 146bba09e9fSDonghwa Lee }; 147bba09e9fSDonghwa Lee 148bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 149bba09e9fSDonghwa Lee (unsigned int)data_to_send, ARRAY_SIZE(data_to_send)); 150bba09e9fSDonghwa Lee } 151bba09e9fSDonghwa Lee 152bba09e9fSDonghwa Lee static void s6e8ax0_etc_mipi_control3(struct mipi_dsim_device *dsim_dev) 153bba09e9fSDonghwa Lee { 154bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 155bba09e9fSDonghwa Lee 156bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_SHORT_WRITE_PARAM, 0xe3, 0x40); 157bba09e9fSDonghwa Lee } 158bba09e9fSDonghwa Lee 159bba09e9fSDonghwa Lee static void s6e8ax0_etc_mipi_control4(struct mipi_dsim_device *dsim_dev) 160bba09e9fSDonghwa Lee { 161bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 162bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 163bba09e9fSDonghwa Lee 0xe4, 0x00, 0x00, 0x14, 0x80, 0x00, 0x00, 0x00 164bba09e9fSDonghwa Lee }; 165bba09e9fSDonghwa Lee 166bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 167bba09e9fSDonghwa Lee (unsigned int)data_to_send, ARRAY_SIZE(data_to_send)); 168bba09e9fSDonghwa Lee } 169bba09e9fSDonghwa Lee 170bba09e9fSDonghwa Lee static void s6e8ax0_elvss_set(struct mipi_dsim_device *dsim_dev) 171bba09e9fSDonghwa Lee { 172bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 173bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 174bba09e9fSDonghwa Lee 0xb1, 0x04, 0x00 175bba09e9fSDonghwa Lee }; 176bba09e9fSDonghwa Lee 177bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 178bba09e9fSDonghwa Lee (unsigned int)data_to_send, 179bba09e9fSDonghwa Lee ARRAY_SIZE(data_to_send)); 180bba09e9fSDonghwa Lee } 181bba09e9fSDonghwa Lee 182bba09e9fSDonghwa Lee static void s6e8ax0_display_on(struct mipi_dsim_device *dsim_dev) 183bba09e9fSDonghwa Lee { 184bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 185bba09e9fSDonghwa Lee 186bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, 187bba09e9fSDonghwa Lee MIPI_DSI_DCS_SHORT_WRITE, 0x29, 0x00); 188bba09e9fSDonghwa Lee } 189bba09e9fSDonghwa Lee 190bba09e9fSDonghwa Lee static void s6e8ax0_sleep_out(struct mipi_dsim_device *dsim_dev) 191bba09e9fSDonghwa Lee { 192bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 193bba09e9fSDonghwa Lee 194bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, 195bba09e9fSDonghwa Lee MIPI_DSI_DCS_SHORT_WRITE, 0x11, 0x00); 196bba09e9fSDonghwa Lee } 197bba09e9fSDonghwa Lee 198bba09e9fSDonghwa Lee static void s6e8ax0_apply_level1_key(struct mipi_dsim_device *dsim_dev) 199bba09e9fSDonghwa Lee { 200bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 201bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 202bba09e9fSDonghwa Lee 0xf0, 0x5a, 0x5a 203bba09e9fSDonghwa Lee }; 204bba09e9fSDonghwa Lee 205bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 206bba09e9fSDonghwa Lee (unsigned int)data_to_send, ARRAY_SIZE(data_to_send)); 207bba09e9fSDonghwa Lee } 208bba09e9fSDonghwa Lee 209bba09e9fSDonghwa Lee static void s6e8ax0_apply_mtp_key(struct mipi_dsim_device *dsim_dev) 210bba09e9fSDonghwa Lee { 211bba09e9fSDonghwa Lee struct mipi_dsim_master_ops *ops = dsim_dev->master_ops; 212bba09e9fSDonghwa Lee const unsigned char data_to_send[] = { 213bba09e9fSDonghwa Lee 0xf1, 0x5a, 0x5a 214bba09e9fSDonghwa Lee }; 215bba09e9fSDonghwa Lee 216bba09e9fSDonghwa Lee ops->cmd_write(dsim_dev, MIPI_DSI_DCS_LONG_WRITE, 217bba09e9fSDonghwa Lee (unsigned int)data_to_send, ARRAY_SIZE(data_to_send)); 218bba09e9fSDonghwa Lee } 219bba09e9fSDonghwa Lee 220bba09e9fSDonghwa Lee static void s6e8ax0_panel_init(struct mipi_dsim_device *dsim_dev) 221bba09e9fSDonghwa Lee { 222bba09e9fSDonghwa Lee /* 223bba09e9fSDonghwa Lee * in case of setting gamma and panel condition at first, 224bba09e9fSDonghwa Lee * it shuold be setting like below. 225bba09e9fSDonghwa Lee * set_gamma() -> set_panel_condition() 226bba09e9fSDonghwa Lee */ 227bba09e9fSDonghwa Lee 228bba09e9fSDonghwa Lee s6e8ax0_apply_level1_key(dsim_dev); 229bba09e9fSDonghwa Lee s6e8ax0_apply_mtp_key(dsim_dev); 230bba09e9fSDonghwa Lee 231bba09e9fSDonghwa Lee s6e8ax0_sleep_out(dsim_dev); 232bba09e9fSDonghwa Lee mdelay(5); 233bba09e9fSDonghwa Lee s6e8ax0_panel_cond(dsim_dev); 234bba09e9fSDonghwa Lee s6e8ax0_display_cond(dsim_dev); 235bba09e9fSDonghwa Lee s6e8ax0_gamma_cond(dsim_dev); 236bba09e9fSDonghwa Lee s6e8ax0_gamma_update(dsim_dev); 237bba09e9fSDonghwa Lee 238bba09e9fSDonghwa Lee s6e8ax0_etc_source_control(dsim_dev); 239bba09e9fSDonghwa Lee s6e8ax0_elvss_set(dsim_dev); 240bba09e9fSDonghwa Lee s6e8ax0_etc_pentile_control(dsim_dev); 241bba09e9fSDonghwa Lee s6e8ax0_etc_mipi_control1(dsim_dev); 242bba09e9fSDonghwa Lee s6e8ax0_etc_mipi_control2(dsim_dev); 243bba09e9fSDonghwa Lee s6e8ax0_etc_power_control(dsim_dev); 244bba09e9fSDonghwa Lee s6e8ax0_etc_mipi_control3(dsim_dev); 245bba09e9fSDonghwa Lee s6e8ax0_etc_mipi_control4(dsim_dev); 246bba09e9fSDonghwa Lee } 247bba09e9fSDonghwa Lee 248bba09e9fSDonghwa Lee static int s6e8ax0_panel_set(struct mipi_dsim_device *dsim_dev) 249bba09e9fSDonghwa Lee { 250bba09e9fSDonghwa Lee s6e8ax0_panel_init(dsim_dev); 251bba09e9fSDonghwa Lee 252bba09e9fSDonghwa Lee return 0; 253bba09e9fSDonghwa Lee } 254bba09e9fSDonghwa Lee 255bba09e9fSDonghwa Lee static void s6e8ax0_display_enable(struct mipi_dsim_device *dsim_dev) 256bba09e9fSDonghwa Lee { 257bba09e9fSDonghwa Lee s6e8ax0_display_on(dsim_dev); 258bba09e9fSDonghwa Lee } 259bba09e9fSDonghwa Lee 260bba09e9fSDonghwa Lee static struct mipi_dsim_lcd_driver s6e8ax0_dsim_ddi_driver = { 261bba09e9fSDonghwa Lee .name = "s6e8ax0", 262bba09e9fSDonghwa Lee .id = -1, 263bba09e9fSDonghwa Lee 264bba09e9fSDonghwa Lee .mipi_panel_init = s6e8ax0_panel_set, 265bba09e9fSDonghwa Lee .mipi_display_on = s6e8ax0_display_enable, 266bba09e9fSDonghwa Lee }; 267bba09e9fSDonghwa Lee 268bba09e9fSDonghwa Lee void s6e8ax0_init(void) 269bba09e9fSDonghwa Lee { 270bba09e9fSDonghwa Lee exynos_mipi_dsi_register_lcd_driver(&s6e8ax0_dsim_ddi_driver); 271bba09e9fSDonghwa Lee } 272