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