--- /dev/null
+/* linux/drivers/video/decon_display/s6e3fa0_gamma.h
+ *
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ *
+ * Haowe Li <haowei.li@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __S6E3FA0_GAMMA_H__
+#define __S6E3FA0_GAMMA_H__
+
+static const unsigned char gamma22_30[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xDF, 0x86, 0xF5,
+ 0xD5, 0xC7, 0xCF, 0xDF, 0xE0, 0xE0,
+ 0xC9, 0xC9, 0xCC, 0xD7, 0xD6, 0xD5,
+ 0x00, 0x68, 0x00, 0x68, 0x00, 0x75,
+};
+
+static const unsigned char gamma22_40[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xE5, 0xAA, 0xF2,
+ 0xD6, 0xCC, 0xCF, 0xE0, 0xE2, 0xE2,
+ 0xC8, 0xC9, 0xCA, 0xD2, 0xD2, 0xCF,
+ 0x00, 0x71, 0x00, 0x70, 0x00, 0x80,
+};
+
+static const unsigned char gamma22_50[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xE7, 0xBB, 0xEE,
+ 0xD6, 0xCE, 0xD0, 0xE0, 0xE3, 0xE4,
+ 0xC5, 0xC4, 0xC5, 0xD2, 0xD2, 0xCF,
+ 0x00, 0x78, 0x00, 0x78, 0x00, 0x88,
+};
+
+static const unsigned char gamma22_60[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xE9, 0xC4, 0xEB,
+ 0xD6, 0xD0, 0xD1, 0xE0, 0xE3, 0xE4,
+ 0xC3, 0xC2, 0xC2, 0xD2, 0xD1, 0xCF,
+ 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x8F,
+};
+
+static const unsigned char gamma22_70[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEA, 0xC9, 0xEA,
+ 0xD6, 0xD2, 0xD2, 0xDF, 0xE1, 0xE3,
+ 0xC2, 0xC1, 0xC0, 0xD1, 0xD0, 0xCE,
+ 0x00, 0x84, 0x00, 0x84, 0x00, 0x96,
+};
+
+static const unsigned char gamma22_80[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEB, 0xCC, 0xE9,
+ 0xD5, 0xD4, 0xD3, 0xDE, 0xE1, 0xE2,
+ 0xC2, 0xBF, 0xBF, 0xCF, 0xCF, 0xCC,
+ 0x00, 0x89, 0x00, 0x89, 0x00, 0x9C,
+};
+
+static const unsigned char gamma22_90[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEB, 0xD0, 0xE9,
+ 0xD4, 0xD5, 0xD4, 0xDF, 0xE0, 0xE1,
+ 0xC1, 0xBE, 0xBD, 0xCD, 0xCD, 0xCA,
+ 0x00, 0x8E, 0x00, 0x8F, 0x00, 0xA2,
+};
+
+static const unsigned char gamma22_100[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEA, 0xD2, 0xE7,
+ 0xD7, 0xD6, 0xD6, 0xDF, 0xDF, 0xE2,
+ 0xBF, 0xBD, 0xBC, 0xCD, 0xCD, 0xC9,
+ 0x00, 0x92, 0x00, 0x93, 0x00, 0xA7,
+};
+
+static const unsigned char gamma22_110[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEB, 0xD4, 0xE5,
+ 0xD6, 0xD6, 0xD7, 0xDE, 0xDF, 0xE0,
+ 0xBE, 0xBC, 0xBB, 0xCE, 0xCC, 0xC9,
+ 0x00, 0x96, 0x00, 0x97, 0x00, 0xAC,
+};
+
+static const unsigned char gamma22_120[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xD6, 0xE6,
+ 0xD6, 0xD7, 0xD8, 0xDE, 0xDE, 0xE0,
+ 0xBC, 0xBC, 0xB9, 0xCD, 0xCA, 0xC8,
+ 0x00, 0x9A, 0x00, 0x9C, 0x00, 0xB1,
+};
+
+static const unsigned char gamma22_130[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEC, 0xD7, 0xE6,
+ 0xD3, 0xD8, 0xD7, 0xDE, 0xDD, 0xDF,
+ 0xBD, 0xBB, 0xB8, 0xCA, 0xC9, 0xC6,
+ 0x00, 0x9F, 0x00, 0xA0, 0x00, 0xB7,
+};
+
+static const unsigned char gamma22_140[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEC, 0xD9, 0xE5,
+ 0xD4, 0xD8, 0xD9, 0xDE, 0xDD, 0xDF,
+ 0xBB, 0xB9, 0xB7, 0xCA, 0xC9, 0xC5,
+ 0x00, 0xA3, 0x00, 0xA4, 0x00, 0xBB,
+};
+
+static const unsigned char gamma22_150[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEC, 0xDA, 0xE5,
+ 0xD4, 0xD8, 0xD9, 0xDD, 0xDD, 0xDD,
+ 0xBB, 0xB9, 0xB6, 0xC9, 0xC7, 0xC5,
+ 0x00, 0xA6, 0x00, 0xA8, 0x00, 0xBF,
+};
+
+static const unsigned char gamma22_160[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xDB, 0xE6,
+ 0xD4, 0xD7, 0xD9, 0xDC, 0xDD, 0xDD,
+ 0xB9, 0xB8, 0xB4, 0xC9, 0xC6, 0xC4,
+ 0x00, 0xAA, 0x00, 0xAC, 0x00, 0xC4,
+};
+
+static const unsigned char gamma22_170[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEC, 0xDC, 0xE5,
+ 0xD5, 0xD8, 0xD9, 0xDD, 0xDC, 0xDD,
+ 0xBA, 0xB7, 0xB5, 0xC7, 0xC6, 0xC3,
+ 0x00, 0xAD, 0x00, 0xAF, 0x00, 0xC7,
+};
+
+static const unsigned char gamma22_180[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEE, 0xDD, 0xE6,
+ 0xD4, 0xD7, 0xD9, 0xDB, 0xDC, 0xDB,
+ 0xB9, 0xB7, 0xB4, 0xC6, 0xC4, 0xC2,
+ 0x00, 0xB1, 0x00, 0xB3, 0x00, 0xCC,
+};
+
+static const unsigned char gamma22_190[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xDE, 0xE6,
+ 0xD3, 0xD8, 0xD8, 0xDD, 0xDB, 0xDC,
+ 0xB9, 0xB6, 0xB4, 0xC5, 0xC4, 0xC0,
+ 0x00, 0xB4, 0x00, 0xB6, 0x00, 0xD0,
+};
+
+static const unsigned char gamma22_200[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xDF, 0xE6,
+ 0xD3, 0xD7, 0xD8, 0xDB, 0xDB, 0xDA,
+ 0xB8, 0xB6, 0xB3, 0xC4, 0xC3, 0xC0,
+ 0x00, 0xB8, 0x00, 0xB9, 0x00, 0xD4,
+};
+
+static const unsigned char gamma22_210[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEC, 0xE0, 0xE5,
+ 0xD5, 0xD7, 0xD9, 0xDB, 0xDA, 0xDA,
+ 0xB7, 0xB5, 0xB1, 0xC4, 0xC2, 0xC0,
+ 0x00, 0xBA, 0x00, 0xBD, 0x00, 0xD7,
+};
+
+static const unsigned char gamma22_220[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xE0, 0xE6,
+ 0xD4, 0xD7, 0xD9, 0xDA, 0xDA, 0xD9,
+ 0xB7, 0xB4, 0xB1, 0xC2, 0xC2, 0xBE,
+ 0x00, 0xBE, 0x00, 0xC0, 0x00, 0xDC,
+};
+
+static const unsigned char gamma22_230[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEC, 0xE2, 0xE6,
+ 0xD3, 0xD6, 0xD8, 0xDC, 0xD9, 0xD9,
+ 0xB6, 0xB4, 0xB1, 0xC1, 0xC1, 0xBD,
+ 0x00, 0xC1, 0x00, 0xC3, 0x00, 0xDF,
+};
+
+static const unsigned char gamma22_240[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xE2, 0xE6,
+ 0xD4, 0xD6, 0xD8, 0xDA, 0xDA, 0xDA,
+ 0xB6, 0xB3, 0xB0, 0xC1, 0xBF, 0xBC,
+ 0x00, 0xC4, 0x00, 0xC7, 0x00, 0xE3,
+};
+
+static const unsigned char gamma22_250[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xE3, 0xE7,
+ 0xD4, 0xD6, 0xD8, 0xDB, 0xD9, 0xD9,
+ 0xB3, 0xB2, 0xAE, 0xC1, 0xC0, 0xBC,
+ 0x00, 0xC7, 0x00, 0xC9, 0x00, 0xE7,
+};
+
+static const unsigned char gamma22_260[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xE4, 0xE7,
+ 0xD4, 0xD5, 0xD7, 0xDA, 0xD9, 0xD9,
+ 0xB3, 0xB2, 0xAD, 0xC1, 0xBE, 0xBC,
+ 0x00, 0xC9, 0x00, 0xCD, 0x00, 0xEA,
+};
+
+static const unsigned char gamma22_270[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xE5, 0xE8,
+ 0xD3, 0xD5, 0xD5, 0xDB, 0xD9, 0xD9,
+ 0xB3, 0xB1, 0xAE, 0xBF, 0xBE, 0xBA,
+ 0x00, 0xCC, 0x00, 0xD0, 0x00, 0xEE,
+};
+
+static const unsigned char gamma22_280[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEC, 0xE5, 0xE6,
+ 0xD2, 0xD4, 0xD6, 0xDA, 0xD9, 0xD8,
+ 0xB3, 0xB1, 0xAD, 0xBF, 0xBD, 0xBA,
+ 0x00, 0xCF, 0x00, 0xD3, 0x00, 0xF1,
+};
+
+static const unsigned char gamma22_290[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xEC, 0xE6, 0xE7,
+ 0xD2, 0xD4, 0xD5, 0xDB, 0xD8, 0xD8,
+ 0xB1, 0xB0, 0xAC, 0xBE, 0xBD, 0xB9,
+ 0x00, 0xD3, 0x00, 0xD6, 0x00, 0xF5,
+};
+
+static const unsigned char gamma22_300[] = {
+ 0xFA, 0x01,
+ 0x1F, 0x1F, 0x1F, 0xED, 0xE6, 0xE7,
+ 0xD1, 0xD3, 0xD4, 0xDA, 0xD8, 0xD7,
+ 0xB1, 0xAF, 0xAB, 0xBD, 0xBB, 0xB8,
+ 0x00, 0xD6, 0x00, 0xDA, 0x00, 0xFA,
+};
+
+
+static const unsigned char *gamma22_table[] = {
+ gamma22_30,
+ gamma22_40,
+ gamma22_50,
+ gamma22_60,
+ gamma22_70,
+ gamma22_80,
+ gamma22_90,
+ gamma22_100,
+ gamma22_110,
+ gamma22_120,
+ gamma22_130,
+ gamma22_140,
+ gamma22_150,
+ gamma22_160,
+ gamma22_170,
+ gamma22_180,
+ gamma22_190,
+ gamma22_200,
+ gamma22_210,
+ gamma22_220,
+ gamma22_230,
+ gamma22_240,
+ gamma22_250,
+ gamma22_260,
+ gamma22_270,
+ gamma22_280,
+ gamma22_290,
+};
+
+#endif /* __S6E3FA0_GAMMA_H__ */
--- /dev/null
+/* drivers/video/exynos/panels/s6e3fa0_lcd_ctrl.c
+ *
+ * Samsung SoC MIPI LCD CONTROL functions
+ *
+ * Copyright (c) 2014 Samsung Electronics
+ *
+ * Jiun Yu, <jiun.yu@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+#include "s6e3fa0_gamma.h"
+#include "s6e3fa0_param.h"
+#include "lcd_ctrl.h"
+
+/* use FW_TEST definition when you test CAL on firmware */
+/* #define FW_TEST */
+#ifdef FW_TEST
+#include "../dsim_fw.h"
+#include "mipi_display.h"
+#else
+#include "../dsim.h"
+#include <video/mipi_display.h>
+#endif
+
+#define GAMMA_PARAM_SIZE 26
+
+/* Porch values. It depends on command or video mode */
+#define S6E3FA0_CMD_VBP 10
+#define S6E3FA0_CMD_VFP 1
+#define S6E3FA0_CMD_VSA 1
+#define S6E3FA0_CMD_HBP 1
+#define S6E3FA0_CMD_HFP 1
+#define S6E3FA0_CMD_HSA 1
+
+#define S6E3FA0_VIDEO_VBP 2
+#define S6E3FA0_VIDEO_VFP 20
+#define S6E3FA0_VIDEO_VSA 2
+#define S6E3FA0_VIDEO_HBP 20
+#define S6E3FA0_VIDEO_HFP 20
+#define S6E3FA0_VIDEO_HSA 20
+
+#define S6E3FA0_HORIZONTAL 1080
+#define S6E3FA0_VERTICAL 1920
+
+#ifdef FW_TEST /* This information is moved to DT */
+#define CONFIG_FB_I80_COMMAND_MODE
+
+struct decon_lcd s6e3fa0_lcd_info = {
+#ifdef CONFIG_FB_I80_COMMAND_MODE
+ .mode = DECON_MIPI_COMMAND_MODE,
+ .vfp = S6E3FA0_CMD_VFP,
+ .vbp = S6E3FA0_CMD_VBP,
+ .hfp = S6E3FA0_CMD_HFP,
+ .hbp = S6E3FA0_CMD_HBP,
+ .vsa = S6E3FA0_CMD_VSA,
+ .hsa = S6E3FA0_CMD_HSA,
+#else
+ .mode = DECON_VIDEO_MODE,
+ .vfp = S6E3FA0_VIDEO_VFP,
+ .vbp = S6E3FA0_VIDEO_VBP,
+ .hfp = S6E3FA0_VIDEO_HFP,
+ .hbp = S6E3FA0_VIDEO_HBP,
+ .vsa = S6E3FA0_VIDEO_VSA,
+ .hsa = S6E3FA0_VIDEO_HSA,
+#endif
+ .xres = S6E3FA0_HORIZONTAL,
+ .yres = S6E3FA0_VERTICAL,
+
+ /* Maybe, width and height will be removed */
+ .width = 70,
+ .height = 121,
+
+ /* Mhz */
+ .hs_clk = 1100,
+ .esc_clk = 20,
+
+ .fps = 60,
+ .mic_enabled = 0,
+ .mic_ver = MIC_VER_1_2,
+};
+#endif
+
+/*
+ * 3FAH0 lcd init sequence
+ *
+ * Parameters
+ * - mic : if mic is enabled, MIC_ENABLE command must be sent
+ * - mode : LCD init sequence depends on command or video mode
+ */
+void lcd_init(int id, struct decon_lcd *lcd)
+{
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_TEST_KEY_ON_F0,
+ ARRAY_SIZE(SEQ_TEST_KEY_ON_F0)) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_F0 command.\n");
+ msleep(12);
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_TEST_KEY_ON_F1,
+ ARRAY_SIZE(SEQ_TEST_KEY_ON_F1)) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_F1 command.\n");
+ msleep(12);
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_TEST_KEY_ON_FC,
+ ARRAY_SIZE(SEQ_TEST_KEY_ON_FC)) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_FC command.\n");
+ msleep(12);
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_TEST_KEY_ON_ED,
+ ARRAY_SIZE(SEQ_TEST_KEY_ON_ED)) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_ED command.\n");
+ msleep(12);
+
+ if (lcd->mode == DECON_MIPI_COMMAND_MODE) {
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_TEST_KEY_ON_FD,
+ ARRAY_SIZE(SEQ_TEST_KEY_ON_FD)) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_FD command.\n");
+ msleep(12);
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE_PARAM, SEQ_TEST_KEY_ON_F6[0],
+ SEQ_TEST_KEY_ON_F6[1]) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_F6 command.\n");
+ mdelay(12);
+ } else {
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_TEST_KEY_ON_E7,
+ ARRAY_SIZE(SEQ_TEST_KEY_ON_E7)) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_E7 command.\n");
+ msleep(120);
+ }
+
+ if (lcd->mic_enabled)
+ dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE_PARAM, SEQ_MIC_ENABLE[0],
+ SEQ_MIC_ENABLE[1]);
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE, SEQ_SLEEP_OUT[0], 0) < 0)
+ dsim_err("fail to send SEQ_SLEEP_OUT command.\n");
+ mdelay(20);
+
+ if (lcd->mode == DECON_VIDEO_MODE) {
+ if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE, SEQ_DISPLAY_ON[0], 0) < 0)
+ dsim_err("fail to send SEQ_DISPLAY_ON command.\n");
+ mdelay(120);
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE_PARAM, SEQ_TEST_KEY_ON_F2[0],
+ SEQ_TEST_KEY_ON_F2[1]) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_F2 command.\n");
+ mdelay(12);
+ }
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_TEST_KEY_ON_EB,
+ ARRAY_SIZE(SEQ_TEST_KEY_ON_EB)) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_EB command.\n");
+ mdelay(12);
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_TEST_KEY_ON_C0,
+ ARRAY_SIZE(SEQ_TEST_KEY_ON_C0)) < 0)
+ dsim_err("fail to send SEQ_TEST_KEY_ON_C0 command.\n");
+ mdelay(12);
+
+ if (lcd->mode == DECON_MIPI_COMMAND_MODE) {
+ if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE, SEQ_TE_ON[0], 0) < 0)
+ dsim_err("fail to send SEQ_TE_ON command.\n");
+ mdelay(12);
+ }
+}
+
+void lcd_enable(int id)
+{
+ if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE, SEQ_DISPLAY_ON[0], 0) < 0)
+ dsim_err("fail to send SEQ_DISPLAY_ON command.\n");
+}
+
+void lcd_disable(int id)
+{
+ /* This function needs to implement */
+}
+
+/*
+ * Set gamma values
+ *
+ * Parameter
+ * - backlightlevel : It is from 0 to 26.
+ */
+int lcd_gamma_ctrl(int id, u32 backlightlevel)
+{
+ int ret;
+
+ ret = dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)gamma22_table[backlightlevel],
+ GAMMA_PARAM_SIZE);
+ if (ret) {
+ dsim_err("fail to write gamma value.\n");
+ return ret;
+ }
+
+ return 0;
+}
+
+int lcd_gamma_update(int id)
+{
+ int ret;
+
+ ret = dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_GAMMA_UPDATE,
+ ARRAY_SIZE(SEQ_GAMMA_UPDATE));
+ if (ret) {
+ dsim_err("fail to update gamma value.\n");
+ return ret;
+ }
+
+ return 0;
+}
--- /dev/null
+/* drivers/video/exynos/panels/s6e3fa0_mipi_lcd.c
+ *
+ * Samsung SoC MIPI LCD driver.
+ *
+ * Copyright (c) 2014 Samsung Electronics
+ *
+ * Haowei Li, <haowei.li@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#include <linux/delay.h>
+#include <linux/gpio.h>
+#include <linux/kernel.h>
+#include <linux/backlight.h>
+#include <video/mipi_display.h>
+#include <linux/platform_device.h>
+
+#include "s6e3fa0_param.h"
+#include "lcd_ctrl.h"
+#include "decon_lcd.h"
+#include "../dsim.h"
+
+#define MAX_BRIGHTNESS 255
+/* set the minimum brightness value to see the screen */
+#define MIN_BRIGHTNESS 0
+#define DEFAULT_BRIGHTNESS 170
+#define CMD_SIZE 34
+
+static int s6e3fa0_get_brightness(struct backlight_device *bd)
+{
+ return bd->props.brightness;
+}
+
+static int get_backlight_level(int brightness)
+{
+ int backlightlevel;
+
+ switch (brightness) {
+ case 0:
+ backlightlevel = 0;
+ break;
+ case 1 ... 29:
+ backlightlevel = 0;
+ break;
+ case 30 ... 34:
+ backlightlevel = 1;
+ break;
+ case 35 ... 39:
+ backlightlevel = 2;
+ break;
+ case 40 ... 44:
+ backlightlevel = 3;
+ break;
+ case 45 ... 49:
+ backlightlevel = 4;
+ break;
+ case 50 ... 54:
+ backlightlevel = 5;
+ break;
+ case 55 ... 64:
+ backlightlevel = 6;
+ break;
+ case 65 ... 74:
+ backlightlevel = 7;
+ break;
+ case 75 ... 83:
+ backlightlevel = 8;
+ break;
+ case 84 ... 93:
+ backlightlevel = 9;
+ break;
+ case 94 ... 103:
+ backlightlevel = 10;
+ break;
+ case 104 ... 113:
+ backlightlevel = 11;
+ break;
+ case 114 ... 122:
+ backlightlevel = 12;
+ break;
+ case 123 ... 132:
+ backlightlevel = 13;
+ break;
+ case 133 ... 142:
+ backlightlevel = 14;
+ break;
+ case 143 ... 152:
+ backlightlevel = 15;
+ break;
+ case 153 ... 162:
+ backlightlevel = 16;
+ break;
+ case 163 ... 171:
+ backlightlevel = 17;
+ break;
+ case 172 ... 181:
+ backlightlevel = 18;
+ break;
+ case 182 ... 191:
+ backlightlevel = 19;
+ break;
+ case 192 ... 201:
+ backlightlevel = 20;
+ break;
+ case 202 ... 210:
+ backlightlevel = 21;
+ break;
+ case 211 ... 220:
+ backlightlevel = 22;
+ break;
+ case 221 ... 230:
+ backlightlevel = 23;
+ break;
+ case 231 ... 240:
+ backlightlevel = 24;
+ break;
+ case 241 ... 250:
+ backlightlevel = 25;
+ break;
+ case 251 ... 255:
+ backlightlevel = 26;
+ break;
+ default:
+ backlightlevel = 12;
+ break;
+ }
+
+ return backlightlevel;
+}
+
+static int update_brightness(struct dsim_device *dsim, int brightness)
+{
+ int backlightlevel;
+
+ /* unused line */
+ backlightlevel = get_backlight_level(brightness);
+#if 0
+ int real_br = brightness / 2;
+ int id = dsim->id;
+ unsigned char gamma_control[CMD_SIZE];
+ unsigned char gamma_update[3];
+
+ memcpy(gamma_control, SEQ_GAMMA_CONTROL_SET_300CD, CMD_SIZE);
+ memcpy(gamma_update, SEQ_GAMMA_UPDATE, 3);
+
+ /*
+ * In order to change brightness to be set to one of values in the
+ * gamma_control parameter. Brightness value(real_br) from 0 to 255.
+ * This value is controlled by the control bar.
+ */
+
+ if (brightness < 70)
+ real_br = 35;
+
+ gamma_control[1] = 0;
+ gamma_control[3] = 0;
+ gamma_control[5] = 0;
+
+ gamma_control[2] = real_br * 2;
+ gamma_control[4] = real_br * 2;
+ gamma_control[6] = real_br * 2;
+
+ gamma_control[28] = real_br;
+ gamma_control[29] = real_br;
+ gamma_control[30] = real_br;
+
+ /* It updates the changed brightness value to ddi */
+ gamma_update[1] = 0x01;
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)gamma_control,
+ ARRAY_SIZE(gamma_control)) < 0)
+ dsim_err("fail to send gamma_control command.\n");
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)SEQ_GAMMA_UPDATE,
+ ARRAY_SIZE(SEQ_GAMMA_UPDATE)) < 0)
+ dsim_err("fail to send SEQ_GAMMA_UPDATE command.\n");
+
+ if (dsim_wr_data(id, MIPI_DSI_DCS_LONG_WRITE, (unsigned long)gamma_update,
+ ARRAY_SIZE(gamma_update)) < 0)
+ dsim_err("fail to send gamma_update command.\n");
+#endif
+ return 0;
+}
+
+static int s6e3fa0_set_brightness(struct backlight_device *bd)
+{
+ struct dsim_device *dsim;
+ int brightness = bd->props.brightness;
+#if 0
+ struct v4l2_subdev *sd;
+
+ sd = dev_get_drvdata(bd->dev.parent);
+ dsim = container_of(sd, struct dsim_device, sd);
+#endif
+
+ if (brightness < MIN_BRIGHTNESS || brightness > MAX_BRIGHTNESS) {
+ printk(KERN_ALERT "Brightness should be in the range of 0 ~ 255\n");
+ return -EINVAL;
+ }
+
+ update_brightness(dsim, brightness);
+ return 1;
+}
+
+static const struct backlight_ops s6e3fa0_backlight_ops = {
+ .get_brightness = s6e3fa0_get_brightness,
+ .update_status = s6e3fa0_set_brightness,
+};
+
+static int s6e3fa0_probe(struct dsim_device *dsim)
+{
+ dsim->bd = backlight_device_register("panel", dsim->dev,
+ NULL, &s6e3fa0_backlight_ops, NULL);
+ if (IS_ERR(dsim->bd))
+ printk(KERN_ALERT "failed to register backlight device!\n");
+
+ dsim->bd->props.max_brightness = MAX_BRIGHTNESS;
+ dsim->bd->props.brightness = DEFAULT_BRIGHTNESS;
+
+ return 1;
+}
+
+static int s6e3fa0_displayon(struct dsim_device *dsim)
+{
+ lcd_init(dsim->id, &dsim->lcd_info);
+ lcd_enable(dsim->id);
+ return 1;
+}
+
+static int s6e3fa0_suspend(struct dsim_device *dsim)
+{
+ return 1;
+}
+
+static int s6e3fa0_resume(struct dsim_device *dsim)
+{
+ return 1;
+}
+
+struct dsim_lcd_driver s6e3fa0_mipi_lcd_driver = {
+ .probe = s6e3fa0_probe,
+ .displayon = s6e3fa0_displayon,
+ .suspend = s6e3fa0_suspend,
+ .resume = s6e3fa0_resume,
+};
--- /dev/null
+/* linux/drivers/video/decon_display/s6e3fa0_param.h
+ *
+ * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ *
+ * Jiun Yu <jiun.yu@samsung.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+*/
+
+#ifndef __S6E3FA0_PARAM_H__
+#define __S6E3FA0_PARAM_H__
+
+/* MIPI commands list */
+static const unsigned char SEQ_TEST_KEY_ON_C0[] = {
+ 0xc0,
+ 0x63, 0x02, 0x03, 0x32, 0xFF, 0x44, 0x44, 0xC0, 0x00, 0x40
+};
+
+static const unsigned char SEQ_TEST_KEY_ON_EB[] = {
+ 0xeb,
+ 0x01, 0x00
+};
+
+static const unsigned char SEQ_TEST_KEY_ON_F2[] = {
+ 0xf2,
+ 0x02,
+};
+
+static const unsigned char SEQ_MIC_ENABLE[] = {
+ 0xf9,
+ 0x2b
+};
+
+static const unsigned char SEQ_TEST_KEY_ON_E7[] = {
+ 0xE7,
+ 0xED, 0xC7, 0x23, 0x57, 0xA5
+};
+
+static const unsigned char SEQ_TEST_KEY_ON_F6[] = {
+ 0xf6,
+ 0x08
+};
+
+static const unsigned char SEQ_TEST_KEY_ON_FD[] = {
+ 0xfd,
+ 0x16, 0x80
+};
+
+static const unsigned char SEQ_TEST_KEY_ON_ED[] = {
+ 0xed,
+ 0x01, 0x00
+};
+
+static const unsigned char SEQ_READ_ID[] = {
+ 0x04,
+ 0x5A, 0x5A,
+};
+
+static const unsigned char SEQ_TEST_KEY_ON_F0[] = {
+ 0xF0,
+ 0x5A, 0x5A,
+};
+
+static const unsigned char SEQ_TEST_KEY_ON_F1[] = {
+ 0xF1,
+ 0x5A, 0x5A,
+};
+
+static const unsigned char SEQ_TEST_KEY_ON_FC[] = {
+ 0xFC,
+ 0x5A, 0x5A,
+};
+
+static const unsigned char SEQ_TEST_KEY_OFF_FC[] = {
+ 0xFC,
+ 0xA5, 0xA5,
+};
+
+static const unsigned char SEQ_GAMMA_CONTROL_SET_300CD[] = {
+ 0xCA,
+ 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80,
+ 0x00, 0x00, 0x00,
+};
+
+static const unsigned char SEQ_AOR_CONTROL[] = {
+ 0xB2,
+ 0x00, 0x06, 0x00, 0x06, 0x06, 0x06, 0x48, 0x18, 0x3F, 0xFF,
+ 0xFF,
+};
+
+static const unsigned char SEQ_ELVSS_CONDITION_SET[] = {
+ 0xB6,
+ 0x88, 0x0A,
+};
+
+static const unsigned char SEQ_GAMMA_UPDATE[] = {
+ 0xF7,
+ 0x03, 0x00
+};
+
+static const unsigned char SEQ_SLEEP_OUT[] = {
+ 0x11,
+};
+
+static const unsigned char SEQ_ACL_CONTROL[] = {
+ 0xB5,
+ 0x03, 0x98, 0x26, 0x36, 0x45,
+};
+
+static const unsigned char SEQ_ETC_PENTILE_SETTING[] = {
+ 0xC0,
+ 0x00, 0x02, 0x03, 0x32, 0xD8, 0x44, 0x44, 0xC0, 0x00, 0x48,
+ 0x20, 0xD8,
+};
+
+static const unsigned char SEQ_GLOBAL_PARAM_SOURCE_AMP[] = {
+ 0xB0,
+ 0x24,
+};
+
+static const unsigned char SEQ_ETC_SOURCE_AMP[] = {
+ 0xD7,
+ 0xA5,
+};
+
+static const unsigned char SEQ_GLOBAL_PARAM_BIAS_CURRENT[] = {
+ 0xB0,
+ 0x1F,
+};
+
+static const unsigned char SEQ_ETC_BIAS_CURRENT[] = {
+ 0xD7,
+ 0x0A,
+};
+
+static const unsigned char SEQ_TE_ON[] = {
+ 0x35,
+};
+
+static const unsigned char SEQ_DISPLAY_ON[] = {
+ 0x29,
+};
+
+static const unsigned char SEQ_DISPLAY_OFF[] = {
+ 0x28,
+ 0x00, 0x00
+};
+
+static const unsigned char SEQ_SLEEP_IN[] = {
+ 0x10,
+ 0x00, 0x00
+};
+
+static const unsigned char SEQ_TOUCHKEY_OFF[] = {
+ 0xFF,
+ 0x00,
+};
+
+static const unsigned char SEQ_TOUCHKEY_ON[] = {
+ 0xFF,
+ 0x01,
+};
+
+static const unsigned char SEQ_ACL_OFF[] = {
+ 0x55, 0x00,
+ 0x00
+};
+
+static const unsigned char SEQ_ACL_40[] = {
+ 0x55, 0x02,
+ 0x00
+};
+
+static const unsigned char SEQ_ACL_40_RE_LOW[] = {
+ 0x55, 0x02,
+ 0x00
+};
+
+static const unsigned char SEQ_DISPCTL[] = {
+ 0xF2,
+ 0x02, 0x03, 0xC, 0xA0, 0x01, 0x48
+};
+
+#endif /* __S6E3FA0_PARAM_H__ */