(CR):[Kane]:[factory]add default lcd driver
authorwangjiao <wangjiao1@huaqin.com>
Tue, 16 Oct 2018 07:49:34 +0000 (15:49 +0800)
committerxiest1 <xiest1@lenovo.com>
Tue, 5 Nov 2019 09:29:48 +0000 (17:29 +0800)
Change-Id: I75f1849fcbab90a53bb952febc27ab1e1560233a
Signed-off-by: wangjiao <wangjiao1@huaqin.com>
arch/arm64/boot/dts/exynos/exynos9610-display-lcd.dtsi [changed mode: 0644->0755]
drivers/video/fbdev/exynos/dpu20/dsim.h [changed mode: 0644->0755]
drivers/video/fbdev/exynos/dpu20/dsim_drv.c
drivers/video/fbdev/exynos/dpu20/panels/Makefile [changed mode: 0644->0755]
drivers/video/fbdev/exynos/dpu20/panels/default_lcd_ctrl.c [new file with mode: 0755]
drivers/video/fbdev/exynos/dpu20/panels/default_mipi_lcd.c [new file with mode: 0755]
drivers/video/fbdev/exynos/dpu20/panels/default_param.h [new file with mode: 0755]
drivers/video/fbdev/exynos/dpu20/panels/lcd_ctrl.h [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index f8795b5..ff6a252
                                hdr_max_avg_luma = <1200000>;   /* 120 */
                                hdr_min_luma = <5>;                             /* 0.0005 */
                        };
+
+                       default: default {
+                               device_type = "default-lcd-vdo";
+                               mode = <0>; /* 0: video mode, 1: DP command mode, 2: MIPI command mode */
+                               resolution = <1080 2270>;
+                               size = <80 120>;
+                               timing,refresh = <60>;
+                               timing,h-porch = <20 40 40>;
+                               timing,v-porch = <2 10 10>;
+                               timing,dsi-hs-clk = <1300>;
+                               /* TODO : pms value to be set */
+                               timing,pmsk = <1 100 1 0>;
+                               timing,dsi-escape-clk = <20>;
+                               mic_en = <0>;           /* 0: Disable, 1: Enable */
+                               mic_ratio = <0>;        /* 0: 1/2 mic, 1: 1/3 mic */
+                               mic_ver = <0>;          /* 0: mic v1.1, 1: v1.2, 2: v2.0 */
+                               type_of_ddi = <2>;      /* 0: Samsung Mobile, 1: MAGNA, 2: Normal(Etc) */
+                               dsc_en = <0>;           /* 0: Disable, 1: Enable */
+                               dsc_cnt = <0>;          /* used DSC count */
+                               dsc_slice_num = <0>;    /* count of dsc slice */
+                               data_lane = <4>;        /* number of using data lane */
+                               cmd_underrun_lp_ref = <4942>;   /* for underrun detect at command mode*/
+                               vt_compensation = <14>; /* for underrun detect at video mode*/
+                               mres_en = <0>;
+                               mres_number = <3>;
+                               mres_width = <1440 1080 720>;
+                               mres_height = <2960 2220 1480>;
+                               mres_dsc_width = <720 540 360>;
+                               mres_dsc_height = <40 30 74>;
+                               mres_dsc_en = <1 1 0>;
+                               hdr_num = <1>;          /* max: 4 */
+                               hdr_type = <2 0 0 0>;   /* 1: DOLBY_VISION, 2: HDR10, 3: HLG */
+                               hdr_max_luma = <5400000>;               /* 540 */
+                               hdr_max_avg_luma = <1200000>;   /* 120 */
+                               hdr_min_luma = <5>;                             /* 0.0005 */
+                       };
                };
        };
 };
old mode 100644 (file)
new mode 100755 (executable)
index 396872e..3d7bb26
@@ -81,6 +81,7 @@ extern struct dsim_lcd_driver s6e3aa2_mipi_lcd_driver;
 extern struct dsim_lcd_driver s6e3fa0_mipi_lcd_driver;
 extern struct dsim_lcd_driver s6e3fa7_mipi_lcd_driver;
 extern struct dsim_lcd_driver nt36672a_mipi_lcd_driver;
+extern struct dsim_lcd_driver default_mipi_lcd_driver;
 
 /* define video timer interrupt */
 enum {
index 3e24f4e54d9f3cac74fcef19d4e38d9cbaab8e2b..92a6c42b5397310d516e8a2fbd62615e82fdced3 100755 (executable)
@@ -1561,8 +1561,9 @@ static void dsim_parse_lcd_info(struct dsim_device *dsim)
                break;
 
        default:
-               dsim_info("can't read ddi_device_type\n");
-               BUG();
+               dsim_info("read ddi_device_type default lcd\n");
+               ddi_device_type = "default-lcd-vdo";
+               dsim_info("ddi type : %s\n", ddi_device_type);
                break;
        }
 
@@ -1790,8 +1791,9 @@ static void dsim_register_panel(struct dsim_device *dsim)
                dsim_info("panel ops : nt36672a_mipi_lcd_driver\n");
                break;
        default:
-               dsim_info("panel ops is not bind\n");
-               BUG();
+               dsim_info("panel ops is default lcd\n");
+               dsim->panel_ops = &default_mipi_lcd_driver;
+               dsim_info("panel ops : default_mipi_lcd_driver\n");
                break;
        }
 }
old mode 100644 (file)
new mode 100755 (executable)
index 56f166b..bd1967c
@@ -1,5 +1,6 @@
 obj-$(CONFIG_EXYNOS_DECON_LCD_MULTI)   += s6e3fa0_mipi_lcd.o s6e3fa0_lcd_ctrl.o \
-                                       nt36672a_mipi_lcd.o nt36672a_lcd_ctrl.o
+                                       nt36672a_mipi_lcd.o nt36672a_lcd_ctrl.o \
+                                       default_mipi_lcd.o default_lcd_ctrl.o
 obj-$(CONFIG_EXYNOS_DECON_LCD_S6E3HA2K)        += s6e3ha2k_mipi_lcd.o s6e3ha2k_lcd_ctrl.o
 obj-$(CONFIG_EXYNOS_DECON_LCD_S6E3HF4) += s6e3hf4_mipi_lcd.o s6e3hf4_lcd_ctrl.o
 obj-$(CONFIG_EXYNOS_DECON_LCD_S6E3HA6) += s6e3ha6_mipi_lcd.o s6e3ha6_lcd_ctrl.o
diff --git a/drivers/video/fbdev/exynos/dpu20/panels/default_lcd_ctrl.c b/drivers/video/fbdev/exynos/dpu20/panels/default_lcd_ctrl.c
new file mode 100755 (executable)
index 0000000..db8d789
--- /dev/null
@@ -0,0 +1,130 @@
+/* drivers/video/fbdev/exynos/dpu20/panels/default_lcd_ctrl.c
+ *
+ * Samsung SoC MIPI LCD CONTROL functions
+ *
+ * Copyright (c) 2018 Samsung Electronics
+ *
+ * Hwangjae Lee, <hj-yo.lee@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 "default_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
+
+#define DEFAULT_VIDEO_VBP      6
+#define DEFAULT_VIDEO_VFP      36
+#define DEFAULT_VIDEO_VSA      2
+#define DEFAULT_VIDEO_HBP      44
+#define DEFAULT_VIDEO_HFP      44
+#define DEFAULT_VIDEO_HSA      12
+
+#define DEFAULT_HORIZONTAL     1080
+#define DEFAULT_VERTICAL       2270
+
+#ifdef FW_TEST /* This information is moved to DT */
+#define CONFIG_FB_I80_COMMAND_MODE
+
+struct decon_lcd default_lcd_info = {
+       .mode = DECON_VIDEO_MODE,
+       .vfp = DEFAULT_VIDEO_VFP,
+       .vbp = DEFAULT_VIDEO_VBP,
+       .hfp = DEFAULT_VIDEO_HFP,
+       .hbp = DEFAULT_VIDEO_HBP,
+       .vsa = DEFAULT_VIDEO_VSA,
+       .hsa = DEFAULT_VIDEO_HSA,
+       .xres = DEFAULT_HORIZONTAL,
+       .yres = DEFAULT_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
+
+/*
+ * DEFAULT 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 default_lcd_init(int id, struct decon_lcd *lcd)
+{
+       mdelay(12);
+
+       if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE_PARAM,
+                               SEQ_CMD_0[0],
+                               SEQ_CMD_0[1]) < 0)
+               dsim_err("fail to send SEQ_CMD_0 command.\n");
+       mdelay(12);
+
+       if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE_PARAM,
+                               SEQ_CMD_1[0],
+                               SEQ_CMD_1[1]) < 0)
+               dsim_err("fail to send SEQ_CMD_1 command.\n");
+       mdelay(12);
+
+       if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE_PARAM,
+                               SEQ_CMD_2[0],
+                               SEQ_CMD_2[1]) < 0)
+               dsim_err("fail to send SEQ_CMD_2 command.\n");
+       mdelay(12);
+
+       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(120);
+}
+
+void default_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 default_lcd_disable(int id)
+{
+       if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE, SEQ_DISPLAY_OFF[0], 0) < 0)
+               dsim_err("fail to send SEQ_DISPLAY_OFF command.\n");
+
+       if (dsim_wr_data(id, MIPI_DSI_DCS_SHORT_WRITE, SEQ_SLEEP_IN[0], 0) < 0)
+               dsim_err("fail to send SEQ_SLEEP_IN command.\n");
+       mdelay(100);
+}
+
+/*
+ * Set gamma values
+ *
+ * Parameter
+ *     - backlightlevel : It is from 0 to 26.
+ */
+int default_lcd_gamma_ctrl(int id, u32 backlightlevel)
+{
+       return 0;
+}
+
+int default_lcd_gamma_update(int id)
+{
+       return 0;
+}
diff --git a/drivers/video/fbdev/exynos/dpu20/panels/default_mipi_lcd.c b/drivers/video/fbdev/exynos/dpu20/panels/default_mipi_lcd.c
new file mode 100755 (executable)
index 0000000..78cffe2
--- /dev/null
@@ -0,0 +1,207 @@
+/* drivers/video/fbdev/exynos/decon_8890/panels/default_mipi_lcd.c
+ *
+ * Samsung SoC MIPI LCD driver.
+ *
+ * Copyright (c) 2018 Samsung Electronics
+ *
+ * Hwangjae Lee, <hj-yo.lee@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 <video/mipi_display.h>
+#include <linux/platform_device.h>
+#include <linux/backlight.h>
+
+#include "../dsim.h"
+#include "lcd_ctrl.h"
+#include "decon_lcd.h"
+#include "default_param.h"
+
+#define MAX_BRIGHTNESS 255
+#define MIN_BRIGHTNESS 0
+#define DEFAULT_BRIGHTNESS 0
+
+static struct dsim_device *dsim_base;
+static struct backlight_device *bd;
+
+
+static int default_get_brightness(struct backlight_device *bd)
+{
+       return bd->props.brightness;
+}
+
+static int default_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 default_update_brightness(int brightness)
+{
+       int backlightlevel;
+
+       backlightlevel = default_get_backlight_level(brightness);
+
+       pr_info("brightness [%d]\n", brightness);
+       if (dsim_wr_data(0, MIPI_DSI_DCS_SHORT_WRITE_PARAM,
+                               SEQ_CMD_0[0],
+                               brightness) < 0)
+               dsim_err("fail to send SEQ_CMD_0 command.\n");
+
+       mdelay(12);
+       return 0;
+}
+
+static int default_set_brightness(struct backlight_device *bd)
+{
+       int brightness = bd->props.brightness;
+
+       if (brightness < MIN_BRIGHTNESS || brightness > MAX_BRIGHTNESS) {
+               pr_err("Brightness should be in the range of 0 ~ 255\n");
+               return -EINVAL;
+       }
+       default_update_brightness(brightness);
+
+       return 0;
+}
+
+static const struct backlight_ops default_backlight_ops = {
+       .get_brightness = default_get_brightness,
+       .update_status = default_set_brightness,
+};
+
+static int default_probe(struct dsim_device *dsim)
+{
+       int ret = 1;
+
+       dsim_base = dsim;
+
+       bd = backlight_device_register("backlight_0", NULL,
+                       NULL, &default_backlight_ops, NULL);
+       if (IS_ERR(bd))
+               pr_err("failed to register backlight device!\n");
+
+       bd->props.max_brightness = MAX_BRIGHTNESS;
+       bd->props.brightness = DEFAULT_BRIGHTNESS;
+
+       return ret;
+}
+
+static int default_displayon(struct dsim_device *dsim)
+{
+       dsim_info("%s \n", __func__);
+       return 1;
+}
+
+static int default_suspend(struct dsim_device *dsim)
+{
+       return 0;
+}
+
+static int default_resume(struct dsim_device *dsim)
+{
+       return 0;
+}
+
+struct dsim_lcd_driver default_mipi_lcd_driver = {
+       .probe          = default_probe,
+       .displayon      = default_displayon,
+       .suspend        = default_suspend,
+       .resume         = default_resume,
+};
diff --git a/drivers/video/fbdev/exynos/dpu20/panels/default_param.h b/drivers/video/fbdev/exynos/dpu20/panels/default_param.h
new file mode 100755 (executable)
index 0000000..b426223
--- /dev/null
@@ -0,0 +1,52 @@
+/* linux/drivers/video/decon_display/default_param.h
+ *
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ *
+ * Hwangjae Lee <hj-yo.lee@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 __DEFAULT_PARAM_H__
+#define __DEFAULT_PARAM_H__
+
+/*
+R51 00 00  //SEQ_CMD_0
+R53 24     //SEQ_CMD_1
+R55 00     //SEQ_CMD_2
+R11 00     //SEQ_SLEEP_OUT
+R29 00     //SEQ_DISPLAY_ON
+*/
+
+/* MIPI commands list */
+static const unsigned char SEQ_SLEEP_OUT[] = {
+       0x11,
+};
+
+static const unsigned char SEQ_DISPLAY_ON[] = {
+       0x29,
+};
+
+static const unsigned char SEQ_DISPLAY_OFF[] = {
+       0x28,
+};
+
+static const unsigned char SEQ_SLEEP_IN[] = {
+       0x10,
+};
+
+static const unsigned char SEQ_CMD_0[] = {
+       0x51, 0xFF
+};
+
+static const unsigned char SEQ_CMD_1[] = {
+       0x53, 0x24
+};
+
+static const unsigned char SEQ_CMD_2[] = {
+       0x55, 0x00
+};
+
+#endif /* __DEFAULT_PARAM_H__ */
old mode 100644 (file)
new mode 100755 (executable)
index 92ddd9b..aff1429
@@ -36,4 +36,15 @@ int nt36672a_lcd_dump(int id);
 void nt36672a_lcd_mres(int id, int mres_idx, int dsc_en);
 void nt36672a_lcd_lane_ctl(int id, unsigned int lane_num);
 
+void default_lcd_init(int id, struct decon_lcd *lcd);
+void default_lcd_enable(int id);
+void default_lcd_disable(int id);
+void default_lcd_sleepin(int id);
+void default_lcd_sleepout(int id);
+int default_lcd_gamma_ctrl(int id, unsigned int backlightlevel);
+int default_lcd_gamma_update(int id);
+int default_lcd_dump(int id);
+void default_lcd_mres(int id, int mres_idx, int dsc_en);
+void default_lcd_lane_ctl(int id, unsigned int lane_num);
+
 #endif /* __LCD_CTRL_H__ */