[PATCH 10/10] [v10] drm/panel: Add Boe Himax8279d MIPI-DSI LCD panel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



V1: https://patchwork.freedesktop.org/patch/287425/
V2: https://patchwork.freedesktop.org/patch/289843/
V3: https://patchwork.freedesktop.org/patch/290393/
V4: https://patchwork.freedesktop.org/patch/290396/
V5: https://patchwork.freedesktop.org/patch/291131/   (only modify
commit message Added changelog, no files modified)
V6: https://patchwork.freedesktop.org/patch/291650/
V7: https://patchwork.freedesktop.org/patch/294141/
V8: https://patchwork.freedesktop.org/patch/301925/
V9: https://patchwork.freedesktop.org/patch/320514/
From 63bcc4f1e72713eca14c4b08e62bc3c07e67904a Mon Sep 17 00:00:00 2001
From: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Aug 2019 15:52:35 +0800
Subject: [PATCH 02/10] [v2,2/2] drm/panel: Add Boe Himax8279d MIPI-DSI LCD
 panel

Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

V2:
- Use SPDX identifier (Sam)
- Use necessary header files replace drmP.h (Sam)
- Delete unnecessary header files #include <linux/err.h> (Sam)
- Specifies a GPIOs array to control the reset timing,
    instead of reading "dsi-reset-sequence" data from DTS (Sam)
- Delete backlight_disable() function when already disabled (Sam)
- Use devm_of_find_backlight() replace of_find_backlight_by_node()
    (Sam)
- Move the necessary data in the DTS to the current file,
    like porch, display_mode and Init code etc. (Sam)
- Add compatible device "boe,himax8279d10p" (Sam)

V1:
- Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
    panel.

Signed-off-by: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx>
Cc: Nick Sanders <nsanders@xxxxxxxxxx>
Cc: YH Lin <yueherngl@xxxxxxxxxxxx>
Cc: Rock wang <rock_wang@xxxxxxxxxxxx>
---
 drivers/gpu/drm/panel/Makefile               |    2 +-
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 1201 ++++++++++++------
 2 files changed, 842 insertions(+), 361 deletions(-)

diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 1aef9d72c7a6..29c57e915ee6 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -1,5 +1,6 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_DRM_PANEL_ARM_VERSATILE) += panel-arm-versatile.o
+obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
 obj-$(CONFIG_DRM_PANEL_LVDS) += panel-lvds.o
 obj-$(CONFIG_DRM_PANEL_SIMPLE) += panel-simple.o
 obj-$(CONFIG_DRM_PANEL_FEIYANG_FY07024DI26A30D) += panel-feiyang-fy07024di26a30d.o
@@ -30,6 +31,5 @@ obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
 obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701) += panel-sitronix-st7701.o
 obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
-obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
 obj-$(CONFIG_DRM_PANEL_TPO_TPG110) += panel-tpo-tpg110.o
 obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o
diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 2788bdda69ec..836a9cbc5891 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -1,319 +1,76 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (c) 2019, Huaqin Electronics Co., Ltd
+ * Copyright (c) 2019, Huaqin Telecom Technology Co., Ltd
+ *
+ * Author: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
  *
- * 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.
  */
 
 #include <linux/backlight.h>
-#include <linux/gpio/consumer.h>
+#include <linux/delay.h>
+#include <linux/fb.h>
+#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
 #include <linux/of_device.h>
+
+#include <linux/gpio/consumer.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drmP.h>
-#include <drm/drm_crtc.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_mipi_dsi.h>
 #include <drm/drm_panel.h>
+#include <drm/drm_device.h>
+#include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
-#include <linux/err.h>
 
-struct dsi_cmd_desc {
-	char wait;
-	char cmd;
-	char len;
-	char *payload;
+struct panel_cmd {
+	size_t len;
+	const char *data;
 };
 
-struct dsi_panel_cmds {
-	char *buf;
-	int blen;
-	struct dsi_cmd_desc *cmds;
-	int cmd_cnt;
+#define _INIT_CMD(...) { \
+	.len = sizeof((char[]){__VA_ARGS__}), \
+	.data = (char[]){__VA_ARGS__} }
+
+struct panel_desc {
+	const struct drm_display_mode *display_mode;
+	unsigned int bpc;
+	unsigned int width;
+	unsigned int height;
+
+	unsigned int delay_t1;
+	unsigned int reset_delay_t2;
+	unsigned int reset_delay_t3;
+	unsigned int reset_delay_t4;
+
+	unsigned long flags;
+	enum mipi_dsi_pixel_format format;
+	unsigned int lanes;
+	const struct panel_cmd *on_cmds;
+	const struct panel_cmd *off_cmds;
 };
 
 struct panel_info {
 	struct drm_panel base;
 	struct mipi_dsi_device *link;
+	const struct panel_desc *desc;
 
 	struct backlight_device *backlight;
 	struct gpio_desc *reset_gpio;
-	struct gpio_desc *pp33000_gpio;
-	struct gpio_desc *pp18000_gpio;
-
-	u32 rst_seq[10];
-	u32 rst_seq_len;
-
-	struct dsi_panel_cmds *on_cmds;
-	struct dsi_panel_cmds *off_cmds;
-	struct drm_display_mode	*panel_display_mode;
-
-	unsigned int panel_width_mm;
-	unsigned int panel_height_mm;
-	unsigned int per_color_channel;
+	struct gpio_desc *pp33_gpio;
+	struct gpio_desc *pp18_gpio;
 
 	bool prepared;
 	bool enabled;
 };
 
-static int dsi_parse_reset_seq(struct device_node *np, u32 rst_seq[10],
-		u32 *rst_len, const char *name)
-{
-	int num = 0, i;
-	int rc;
-	struct property *data;
-	u32 tmp[10];
-	*rst_len = 0;
-	data = of_find_property(np, name, &num);
-
-	num /= sizeof(u32);
-	if (!data || !num || num > 10 || num % 2) {
-		pr_err("%s:%d, error reading %s, length found = %d\n",
-				__func__, __LINE__, name, num);
-		return -EINVAL;
-	}
-
-	rc = of_property_read_u32_array(np, name, tmp, num);
-	if (rc) {
-		pr_err("%s:%d, error reading %s, rc = %d\n",
-					__func__, __LINE__, name, rc);
-		return -EINVAL;
-	}
-
-	for (i = 0; i < num; ++i) {
-		rst_seq[i] = tmp[i];
-		*rst_len = num;
-	}
-	return 0;
-}
-
-ssize_t mipi_dsi_dcs_write_delay(struct mipi_dsi_device *dsi, u8 cmd,
-		const void *data, size_t len, size_t time)
+void set_gpios(struct panel_info *pinfo, int enable)
 {
-	ssize_t ret;
-
-	if (len == 0)
-		ret = mipi_dsi_dcs_write(dsi, cmd, NULL, 0);
-	else
-		ret = mipi_dsi_dcs_write(dsi, cmd, data, len);
-
-	msleep(time);
-
-	return ret;
-}
-
-static int write_cmds(struct mipi_dsi_device *dsi_device,
-					struct dsi_panel_cmds *init_cmds)
-{
-	struct dsi_cmd_desc *one_cmd = init_cmds->cmds;
-	int i = 0;
-	int ret;
-
-	for (i = 0; i < init_cmds->cmd_cnt; i++) {
-		if (one_cmd == NULL)
-			return -EINVAL;
-
-		ret = mipi_dsi_dcs_write_delay(dsi_device,
-				one_cmd->cmd, one_cmd->payload,
-				one_cmd->len, one_cmd->wait);
-		one_cmd++;
-	}
-
-	return ret;
-}
-
-static int parse_dcs_cmds(struct device_node *np,
-				struct dsi_panel_cmds *pcmds, char *cmd_key)
-{
-	const char *data;
-	int blen = 0, len, cnt = 0;
-	char *buf, *bp;
-	struct dsi_cmd_desc *temp_cmd;
-
-	data = of_get_property(np, cmd_key, &blen);
-	if (!data) {
-		pr_err("%s: failed, key=%s\n", __func__, cmd_key);
-		return -ENOMEM;
-	}
-
-	buf = kzalloc(sizeof(char) * blen, GFP_KERNEL);
-	if (!buf)
-		return -ENOMEM;
-
-	memcpy(buf, data, blen);
-
-	/* scan dcs commands */
-	bp = buf;
-	len = blen;
-
-	/* get how much cmd cnt  */
-	while (len > 0) {
-		cnt++;
-		len = len - *(bp);
-		bp = bp + *(bp);
-	}
-
-	pcmds->cmd_cnt = cnt;
-
-	pcmds->cmds = kcalloc(cnt, sizeof(struct dsi_cmd_desc), GFP_KERNEL);
-	if (!pcmds->cmds)
-		return -ENOMEM;
-	temp_cmd = pcmds->cmds;
-
-	bp = buf;
-	len = blen;
-
-	while (cnt != 0) {
-		temp_cmd->wait = *(bp+1);
-		temp_cmd->cmd = *(bp+2);
-		temp_cmd->len = *(bp) - 3;
-		temp_cmd->payload = bp + 3;
-
-		cnt--;
-		temp_cmd++;
-		bp = bp + *(bp);
-	}
-
-	pcmds->buf = buf;
-	pcmds->blen = blen;
-
-	return 0;
-}
-
-static int panel_parse_dt(struct panel_info *pinfo)
-{
-	struct device_node *panels_node;
-	struct device_node *parameter_node;
-	static const char *lcd_name;
-	static const char *panel_parameter;
-	struct drm_display_mode *display_mode;
-	struct mipi_dsi_device	*dsi_device = pinfo->link;
-	int ret = 0;
-	u32	tmp;
-
-	panels_node = of_find_node_by_name(NULL, "panels");
-	if (!panels_node) {
-		pr_err("Get panels node Fail!\n");
-		return -EINVAL;
-	}
-
-	panel_parameter = of_get_property(panels_node, "panel-parameter", NULL);
-	if (!panel_parameter) {
-		pr_err("Get panel parameter Fail!\n");
-		return -EINVAL;
-	}
-
-	parameter_node = of_find_node_by_name(panels_node, panel_parameter);
-	if (!parameter_node)
-		return -ENODEV;
-
-	/* get lcd name */
-	lcd_name = of_get_property(parameter_node, "dsi-panel-name", NULL);
-	if (!lcd_name) {
-		pr_err("Get lcd_name Fail!\n");
-		return -EINVAL;
-	}
-	pr_info("%s: Lcd Name = %s\n", __func__, lcd_name);
-
-	/* get lcd init code */
-	pinfo->on_cmds = kzalloc(sizeof(struct dsi_panel_cmds), GFP_KERNEL);
-	if (!(pinfo->on_cmds))
-		return -ENOMEM;
-
-	ret = parse_dcs_cmds(parameter_node, pinfo->on_cmds, "dsi-on-command");
-	if (ret < 0) {
-		pr_err("Get Dsi on command Fail\n");
-		return -EINVAL;
-	}
-
-	/* get lcd off code */
-	pinfo->off_cmds = kzalloc(sizeof(struct dsi_panel_cmds), GFP_KERNEL);
-	if (!(pinfo->off_cmds))
-		return -ENOMEM;
-
-	ret = parse_dcs_cmds(parameter_node, pinfo->off_cmds,
-			"dsi-off-command");
-	if (ret < 0) {
-		pr_err("Get Dsi off command Fail\n");
-		return -EINVAL;
-	}
-
-	/* get Porch  */
-	display_mode = kzalloc(sizeof(struct drm_display_mode), GFP_KERNEL);
-	if (!display_mode)
-		return -ENOMEM;
-	pinfo->panel_display_mode = display_mode;
-
-	ret = of_property_read_u32(parameter_node, "dsi-pixel-clk", &tmp);
-	display_mode->clock = (!ret ? tmp : 0);
-
-	ret = of_property_read_u32(parameter_node,
-			"dsi-panel-hzorizontal", &tmp);
-	display_mode->hdisplay = (!ret ? tmp : 0);
-
-	ret = of_property_read_u32(parameter_node, "dsi-h-front-porch", &tmp);
-	tmp = (!ret ? tmp : 0);
-	display_mode->hsync_start = display_mode->hdisplay + tmp;
-
-	ret = of_property_read_u32(parameter_node, "dsi-h-back-porch", &tmp);
-	tmp = (!ret ? tmp : 0);
-	display_mode->hsync_end = display_mode->hsync_start + tmp;
-
-	ret = of_property_read_u32(parameter_node, "dsi-h-pulse-width", &tmp);
-	tmp = (!ret ? tmp : 0);
-	display_mode->htotal = display_mode->hsync_end + tmp;
-
-	ret = of_property_read_u32(parameter_node, "dsi-panel-vertical", &tmp);
-	display_mode->vdisplay = (!ret ? tmp : 0);
-
-	ret = of_property_read_u32(parameter_node, "dsi-v-front-porch", &tmp);
-	tmp = (!ret ? tmp : 0);
-	display_mode->vsync_start = display_mode->vdisplay + tmp;
-
-	ret = of_property_read_u32(parameter_node, "dsi-v-back-porch", &tmp);
-	tmp = (!ret ? tmp : 0);
-	display_mode->vsync_end = display_mode->vsync_start + tmp;
-
-	ret = of_property_read_u32(parameter_node, "dsi-v-pulse-width", &tmp);
-	tmp = (!ret ? tmp : 0);
-	display_mode->vtotal = display_mode->vsync_end + tmp;
-
-	ret = of_property_read_u32(parameter_node, "dsi-panel-refresh", &tmp);
-	display_mode->vrefresh = (!ret ? tmp : 0);
-
-	/* get lans */
-	ret = of_property_read_u32(parameter_node, "dsi-panel-lanes", &tmp);
-	dsi_device->lanes  = (!ret ? tmp : 0);
-
-	ret = of_property_read_u32(parameter_node, "dsi-panel-format", &tmp);
-	dsi_device->format = (!ret ? tmp : 0);
-
-	ret = of_property_read_u32(parameter_node,
-			"dsi-panel-mode-flags", &tmp);
-	dsi_device->mode_flags = (!ret ? tmp : 0);
-
-	/* get WxH */
-	ret = of_property_read_u32(parameter_node, "dsi-panel-width-mm", &tmp);
-	pinfo->panel_width_mm  = (!ret ? tmp : 0);
-
-	ret = of_property_read_u32(parameter_node, "dsi-panel-height-mm", &tmp);
-	pinfo->panel_height_mm  = (!ret ? tmp : 0);
-
-	ret = of_property_read_u32(parameter_node, "per-color-channel", &tmp);
-	pinfo->per_color_channel = (!ret ? tmp : 0);
-
-	/* reset time */
-	ret = dsi_parse_reset_seq(parameter_node, pinfo->rst_seq,
-				&(pinfo->rst_seq_len), "dsi-reset-sequence");
-	if (ret < 0)
-		return ret;
-
-	return 0;
+	gpiod_set_value(pinfo->reset_gpio, enable);
+	gpiod_set_value(pinfo->pp33_gpio, enable);
+	gpiod_set_value(pinfo->pp18_gpio, enable);
 }
 
 static inline struct panel_info *to_panel_info(struct drm_panel *panel)
@@ -325,9 +82,6 @@ static int panel_disable(struct drm_panel *panel)
 {
 	struct panel_info *pinfo = to_panel_info(panel);
 
-	if (!pinfo->enabled)
-		return 0;
-
 	backlight_disable(pinfo->backlight);
 
 	pinfo->enabled = false;
@@ -343,48 +97,99 @@ static int panel_unprepare(struct drm_panel *panel)
 	if (!pinfo->prepared)
 		return 0;
 
-	err = write_cmds(pinfo->link, pinfo->off_cmds);
-	if (err < 0) {
-		dev_err(panel->dev,
-				"failed to send DCS Off Code: %d\n", err);
-		return err;
+	/* send off code */
+	if (pinfo->desc->off_cmds) {
+		const struct panel_cmd *cmds = pinfo->desc->off_cmds;
+		unsigned int i;
+
+		for (i = 0; cmds[i].len != 0; i++) {
+			const struct panel_cmd *cmd = &cmds[i];
+
+			if (cmd->len == 2)
+				err = mipi_dsi_dcs_write(pinfo->link,
+					    cmd->data[1], NULL, 0);
+			else
+				err = mipi_dsi_dcs_write(pinfo->link,
+					    cmd->data[1], cmd->data + 2,
+					    cmd->len - 2);
+
+			if (err < 0) {
+				dev_err(panel->dev,
+					"failed to send DCS Off Code: %d\n",
+					err);
+				goto poweroff;
+			}
+			usleep_range((cmd->data[0]) * 1000,
+				    (1 + cmd->data[0]) * 1000);
+		}
 	}
 
 	usleep_range(1000, 1000);
-	gpiod_set_value_cansleep(pinfo->reset_gpio, 0);
-	gpiod_set_value_cansleep(pinfo->pp33000_gpio, 0);
-	gpiod_set_value_cansleep(pinfo->pp18000_gpio, 0);
+	set_gpios(pinfo, 0);
 
 	pinfo->prepared = false;
 
 	return 0;
+
+poweroff:
+	set_gpios(pinfo, 0);
+	return err;
 }
 
 static int panel_prepare(struct drm_panel *panel)
 {
 	struct panel_info *pinfo = to_panel_info(panel);
-	int err, i;
+	const struct panel_desc *desc = pinfo->desc;
+	int err;
 
 	if (pinfo->prepared)
 		return 0;
 
-	gpiod_set_value_cansleep(pinfo->pp18000_gpio, 1);
-	gpiod_set_value_cansleep(pinfo->pp33000_gpio, 1);
+	gpiod_set_value(pinfo->pp18_gpio, 1);
+	/* T1 (> 5ms) */
+	usleep_range(desc->delay_t1, 1000 + desc->delay_t1);
+	gpiod_set_value(pinfo->pp33_gpio, 1);
 
 	/* reset sequence */
-	for (i = 0; i < pinfo->rst_seq_len; ++i) {
-		gpiod_set_value_cansleep(pinfo->reset_gpio, pinfo->rst_seq[i]);
-		if (pinfo->rst_seq[++i])
-			usleep_range(pinfo->rst_seq[i] * 1000,
-						pinfo->rst_seq[i] * 1000);
+	// T2 (> 14ms)
+	usleep_range(desc->reset_delay_t2, 1000 + desc->reset_delay_t2);
+
+	// T3 (>= 0ms)
+	if (desc->reset_delay_t3) {
+		gpiod_set_value(pinfo->reset_gpio, 1);
+		usleep_range(desc->reset_delay_t3, 1000 + desc->reset_delay_t3);
+		gpiod_set_value(pinfo->reset_gpio, 0);
 	}
 
+	// T4 (> 20us)
+	usleep_range(desc->reset_delay_t4, 1000 + desc->reset_delay_t4);
+	gpiod_set_value(pinfo->reset_gpio, 1);
+
 	/* send init code */
-	err = write_cmds(pinfo->link, pinfo->on_cmds);
-	if (err < 0) {
-		dev_err(panel->dev,
-				"failed to send DCS Init Code: %d\n", err);
-		goto poweroff;
+	if (pinfo->desc->on_cmds) {
+		const struct panel_cmd *cmds = pinfo->desc->on_cmds;
+		unsigned int i;
+
+		for (i = 0; cmds[i].len != 0; i++) {
+			const struct panel_cmd *cmd = &cmds[i];
+
+			if (cmd->len == 2)
+				err = mipi_dsi_dcs_write(pinfo->link,
+					    cmd->data[1], NULL, 0);
+			else
+				err = mipi_dsi_dcs_write(pinfo->link,
+					    cmd->data[1], cmd->data + 2,
+					    cmd->len - 2);
+
+			if (err < 0) {
+				dev_err(panel->dev,
+					"failed to send DCS Init Code: %d\n",
+					err);
+				goto poweroff;
+			}
+			usleep_range(cmd->data[0] * 1000,
+				    (1 + cmd->data[0]) * 1000);
+		}
 	}
 
 	pinfo->prepared = true;
@@ -392,9 +197,7 @@ static int panel_prepare(struct drm_panel *panel)
 	return 0;
 
 poweroff:
-	gpiod_set_value_cansleep(pinfo->reset_gpio, 0);
-	gpiod_set_value_cansleep(pinfo->pp33000_gpio, 0);
-	gpiod_set_value_cansleep(pinfo->pp18000_gpio, 0);
+	set_gpios(pinfo, 0);
 	return err;
 }
 
@@ -409,7 +212,7 @@ static int panel_enable(struct drm_panel *panel)
 	ret = backlight_enable(pinfo->backlight);
 	if (ret) {
 		DRM_DEV_ERROR(panel->drm->dev,
-			      "Failed to enable backlight %d\n", ret);
+				"Failed to enable backlight %d\n", ret);
 		return ret;
 	}
 
@@ -421,16 +224,13 @@ static int panel_enable(struct drm_panel *panel)
 static int panel_get_modes(struct drm_panel *panel)
 {
 	struct panel_info *pinfo = to_panel_info(panel);
+	const struct drm_display_mode *m = pinfo->desc->display_mode;
 	struct drm_display_mode *mode;
 
-	if (!pinfo->panel_display_mode) {
-		pr_err("Get panel_display_mode fail!\n");
-		return -1;
-	}
-
-	mode = drm_mode_duplicate(panel->drm, pinfo->panel_display_mode);
+	mode = drm_mode_duplicate(panel->drm, m);
 	if (!mode) {
-		pr_err("failed to add mode\n");
+		DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+				m->hdisplay, m->vdisplay, m->vrefresh);
 		return -ENOMEM;
 	}
 
@@ -438,9 +238,9 @@ static int panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_probed_add(panel->connector, mode);
 
-	panel->connector->display_info.width_mm = pinfo->panel_width_mm;
-	panel->connector->display_info.height_mm = pinfo->panel_height_mm;
-	panel->connector->display_info.bpc = pinfo->per_color_channel;
+	panel->connector->display_info.width_mm = pinfo->desc->width;
+	panel->connector->display_info.height_mm = pinfo->desc->height;
+	panel->connector->display_info.bpc = pinfo->desc->bpc;
 
 	return 1;
 }
@@ -453,8 +253,700 @@ static const struct drm_panel_funcs panel_funcs = {
 	.get_modes = panel_get_modes,
 };
 
+/* 8 inch */
+static const struct drm_display_mode boe_himax8279d8p_display_mode = {
+	.clock = 159420,
+	.hdisplay = 1200,
+	.hsync_start = 1200 + 80,
+	.hsync_end = 1200 + 80 + 60,
+	.htotal = 1200 + 80 + 60 + 24,
+	.vdisplay = 1920,
+	.vsync_start = 1920 + 10,
+	.vsync_end = 1920 + 10 + 14,
+	.vtotal = 1920 + 10 + 14 + 4,
+	.vrefresh = 60,
+};
+
+static const struct panel_cmd boe_himax8279d8p_on_cmds[] = {
+	_INIT_CMD(0x22, 0x10),
+	_INIT_CMD(0x00, 0xB0, 0x05),
+	_INIT_CMD(0x00, 0xB1, 0xE5),
+	_INIT_CMD(0x00, 0xB3, 0x52),
+	_INIT_CMD(0x00, 0xB0, 0x00),
+	_INIT_CMD(0x00, 0xB3, 0x88),
+	_INIT_CMD(0x00, 0xB0, 0x04),
+	_INIT_CMD(0x00, 0xB8, 0x00),
+	_INIT_CMD(0x00, 0xB0, 0x00),
+	_INIT_CMD(0x00, 0xB2, 0x50),
+	_INIT_CMD(0x00, 0xB6, 0x03),
+	_INIT_CMD(0x00, 0xBA, 0x8B),
+	_INIT_CMD(0x00, 0xBF, 0x15),
+	_INIT_CMD(0x00, 0xC0, 0x0F),
+	_INIT_CMD(0x00, 0xC2, 0x0C),
+	_INIT_CMD(0x00, 0xC3, 0x02),
+	_INIT_CMD(0x00, 0xC4, 0x0C),
+	_INIT_CMD(0x00, 0xC5, 0x02),
+	_INIT_CMD(0x00, 0xB0, 0x01),
+	_INIT_CMD(0x00, 0xE0, 0x26),
+	_INIT_CMD(0x00, 0xE1, 0x26),
+	_INIT_CMD(0x00, 0xDC, 0x00),
+	_INIT_CMD(0x00, 0xDD, 0x00),
+	_INIT_CMD(0x00, 0xCC, 0x26),
+	_INIT_CMD(0x00, 0xCD, 0x26),
+	_INIT_CMD(0x00, 0xC8, 0x00),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xD2, 0x04),
+	_INIT_CMD(0x00, 0xD3, 0x04),
+	_INIT_CMD(0x00, 0xE6, 0x03),
+	_INIT_CMD(0x00, 0xE7, 0x03),
+	_INIT_CMD(0x00, 0xC4, 0x08),
+	_INIT_CMD(0x00, 0xC5, 0x08),
+	_INIT_CMD(0x00, 0xD8, 0x07),
+	_INIT_CMD(0x00, 0xD9, 0x07),
+	_INIT_CMD(0x00, 0xC2, 0x06),
+	_INIT_CMD(0x00, 0xC3, 0x06),
+	_INIT_CMD(0x00, 0xD6, 0x05),
+	_INIT_CMD(0x00, 0xD7, 0x05),
+	_INIT_CMD(0x00, 0xC0, 0x0C),
+	_INIT_CMD(0x00, 0xC1, 0x0C),
+	_INIT_CMD(0x00, 0xD4, 0x0B),
+	_INIT_CMD(0x00, 0xD5, 0x0B),
+	_INIT_CMD(0x00, 0xCA, 0x0A),
+	_INIT_CMD(0x00, 0xCB, 0x0A),
+	_INIT_CMD(0x00, 0xDE, 0x09),
+	_INIT_CMD(0x00, 0xDF, 0x09),
+	_INIT_CMD(0x00, 0xC6, 0x26),
+	_INIT_CMD(0x00, 0xC7, 0x26),
+	_INIT_CMD(0x00, 0xCE, 0x00),
+	_INIT_CMD(0x00, 0xCF, 0x00),
+	_INIT_CMD(0x00, 0xDA, 0x26),
+	_INIT_CMD(0x00, 0xDB, 0x26),
+	_INIT_CMD(0x00, 0xE2, 0x00),
+	_INIT_CMD(0x00, 0xE3, 0x00),
+	_INIT_CMD(0x00, 0xB0, 0x02),
+	_INIT_CMD(0x00, 0xC0, 0x00),
+	_INIT_CMD(0x00, 0xC1, 0x07),
+	_INIT_CMD(0x00, 0xC2, 0x0D),
+	_INIT_CMD(0x00, 0xC3, 0x18),
+	_INIT_CMD(0x00, 0xC4, 0x27),
+	_INIT_CMD(0x00, 0xC5, 0x28),
+	_INIT_CMD(0x00, 0xC6, 0x30),
+	_INIT_CMD(0x00, 0xC7, 0x2E),
+	_INIT_CMD(0x00, 0xC8, 0x2F),
+	_INIT_CMD(0x00, 0xC9, 0x1A),
+	_INIT_CMD(0x00, 0xCA, 0x20),
+	_INIT_CMD(0x00, 0xCB, 0x29),
+	_INIT_CMD(0x00, 0xCC, 0x26),
+	_INIT_CMD(0x00, 0xCD, 0x32),
+	_INIT_CMD(0x00, 0xCE, 0x33),
+	_INIT_CMD(0x00, 0xCF, 0x31),
+	_INIT_CMD(0x00, 0xD0, 0x06),
+	_INIT_CMD(0x00, 0xD2, 0x00),
+	_INIT_CMD(0x00, 0xD3, 0x07),
+	_INIT_CMD(0x00, 0xD4, 0x12),
+	_INIT_CMD(0x00, 0xD5, 0x26),
+	_INIT_CMD(0x00, 0xD6, 0x3D),
+	_INIT_CMD(0x00, 0xD7, 0x3F),
+	_INIT_CMD(0x00, 0xD8, 0x3F),
+	_INIT_CMD(0x00, 0xD9, 0x3F),
+	_INIT_CMD(0x00, 0xDA, 0x3F),
+	_INIT_CMD(0x00, 0xDB, 0x3F),
+	_INIT_CMD(0x00, 0xDC, 0x3F),
+	_INIT_CMD(0x00, 0xDD, 0x3F),
+	_INIT_CMD(0x00, 0xDE, 0x3F),
+	_INIT_CMD(0x00, 0xDF, 0x3A),
+	_INIT_CMD(0x00, 0xE0, 0x37),
+	_INIT_CMD(0x00, 0xE1, 0x35),
+	_INIT_CMD(0x00, 0xE2, 0x07),
+	_INIT_CMD(0x00, 0xB0, 0x03),
+	_INIT_CMD(0x00, 0xC8, 0x0B),
+	_INIT_CMD(0x00, 0xC9, 0x07),
+	_INIT_CMD(0x00, 0xC3, 0x00),
+	_INIT_CMD(0x00, 0xE7, 0x00),
+	_INIT_CMD(0x00, 0xC5, 0x2A),
+	_INIT_CMD(0x00, 0xDE, 0x2A),
+	_INIT_CMD(0x00, 0xCA, 0x43),
+	_INIT_CMD(0x00, 0xC9, 0x07),
+	_INIT_CMD(0x00, 0xE4, 0xC0),
+	_INIT_CMD(0x00, 0xE5, 0x0D),
+	_INIT_CMD(0x00, 0xCB, 0x00),
+	_INIT_CMD(0x00, 0xB0, 0x06),
+	_INIT_CMD(0x00, 0xB8, 0xA5),
+	_INIT_CMD(0x00, 0xC0, 0xA5),
+	_INIT_CMD(0x00, 0xC7, 0x0F),
+	_INIT_CMD(0x00, 0xD5, 0x32),
+	_INIT_CMD(0x00, 0xB8, 0x00),
+	_INIT_CMD(0x00, 0xC0, 0x00),
+	_INIT_CMD(0x00, 0xBC, 0x00),
+	_INIT_CMD(0x00, 0xB0, 0x07),
+	_INIT_CMD(0x00, 0xB1, 0x00),
+	_INIT_CMD(0x00, 0xB2, 0x09),
+	_INIT_CMD(0x00, 0xB3, 0x19),
+	_INIT_CMD(0x00, 0xB4, 0x2F),
+	_INIT_CMD(0x00, 0xB5, 0x44),
+	_INIT_CMD(0x00, 0xB6, 0x52),
+	_INIT_CMD(0x00, 0xB7, 0x6A),
+	_INIT_CMD(0x00, 0xB8, 0x8A),
+	_INIT_CMD(0x00, 0xB9, 0xCA),
+	_INIT_CMD(0x00, 0xBA, 0x0C),
+	_INIT_CMD(0x05, 0xBB, 0x87),
+	_INIT_CMD(0x00, 0xBC, 0x06),
+	_INIT_CMD(0x00, 0xBD, 0x0A),
+	_INIT_CMD(0x00, 0xBE, 0x9B),
+	_INIT_CMD(0x00, 0xBF, 0x0C),
+	_INIT_CMD(0x00, 0xC0, 0x3D),
+	_INIT_CMD(0x00, 0xC1, 0x71),
+	_INIT_CMD(0x00, 0xC2, 0x90),
+	_INIT_CMD(0x00, 0xC3, 0xA0),
+	_INIT_CMD(0x00, 0xC4, 0xA8),
+	_INIT_CMD(0x00, 0xC5, 0xB1),
+	_INIT_CMD(0x00, 0xC6, 0xBB),
+	_INIT_CMD(0x00, 0xC7, 0xC0),
+	_INIT_CMD(0x00, 0xC8, 0xC4),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x08),
+	_INIT_CMD(0x00, 0xB1, 0x04),
+	_INIT_CMD(0x00, 0xB2, 0x08),
+	_INIT_CMD(0x00, 0xB3, 0x19),
+	_INIT_CMD(0x00, 0xB4, 0x31),
+	_INIT_CMD(0x00, 0xB5, 0x46),
+	_INIT_CMD(0x00, 0xB6, 0x55),
+	_INIT_CMD(0x00, 0xB7, 0x6E),
+	_INIT_CMD(0x00, 0xB8, 0x92),
+	_INIT_CMD(0x00, 0xB9, 0xD4),
+	_INIT_CMD(0x00, 0xBA, 0x1B),
+	_INIT_CMD(0x05, 0xBB, 0x9B),
+	_INIT_CMD(0x00, 0xBC, 0x28),
+	_INIT_CMD(0x00, 0xBD, 0x2D),
+	_INIT_CMD(0x00, 0xBE, 0xC3),
+	_INIT_CMD(0x00, 0xBF, 0x2F),
+	_INIT_CMD(0x00, 0xC0, 0x62),
+	_INIT_CMD(0x00, 0xC1, 0x99),
+	_INIT_CMD(0x00, 0xC2, 0xAB),
+	_INIT_CMD(0x00, 0xC3, 0xBF),
+	_INIT_CMD(0x00, 0xC4, 0xCF),
+	_INIT_CMD(0x00, 0xC5, 0xDF),
+	_INIT_CMD(0x00, 0xC6, 0xF0),
+	_INIT_CMD(0x00, 0xC7, 0xF9),
+	_INIT_CMD(0x00, 0xC8, 0xFC),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x09),
+	_INIT_CMD(0x00, 0xB1, 0x04),
+	_INIT_CMD(0x00, 0xB2, 0x05),
+	_INIT_CMD(0x00, 0xB3, 0x17),
+	_INIT_CMD(0x00, 0xB4, 0x2E),
+	_INIT_CMD(0x00, 0xB5, 0x42),
+	_INIT_CMD(0x00, 0xB6, 0x51),
+	_INIT_CMD(0x00, 0xB7, 0x69),
+	_INIT_CMD(0x00, 0xB8, 0x88),
+	_INIT_CMD(0x00, 0xB9, 0xC9),
+	_INIT_CMD(0x00, 0xBA, 0x0C),
+	_INIT_CMD(0x05, 0xBB, 0x86),
+	_INIT_CMD(0x00, 0xBC, 0x03),
+	_INIT_CMD(0x00, 0xBD, 0x08),
+	_INIT_CMD(0x00, 0xBE, 0x95),
+	_INIT_CMD(0x00, 0xBF, 0x05),
+	_INIT_CMD(0x00, 0xC0, 0x35),
+	_INIT_CMD(0x00, 0xC1, 0x62),
+	_INIT_CMD(0x00, 0xC2, 0x81),
+	_INIT_CMD(0x00, 0xC3, 0x96),
+	_INIT_CMD(0x00, 0xC4, 0x9E),
+	_INIT_CMD(0x00, 0xC5, 0xA5),
+	_INIT_CMD(0x00, 0xC6, 0xAD),
+	_INIT_CMD(0x00, 0xC7, 0xB1),
+	_INIT_CMD(0x00, 0xC8, 0xB4),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x0A),
+	_INIT_CMD(0x00, 0xB1, 0x00),
+	_INIT_CMD(0x00, 0xB2, 0x09),
+	_INIT_CMD(0x00, 0xB3, 0x19),
+	_INIT_CMD(0x00, 0xB4, 0x2F),
+	_INIT_CMD(0x00, 0xB5, 0x44),
+	_INIT_CMD(0x00, 0xB6, 0x52),
+	_INIT_CMD(0x00, 0xB7, 0x6A),
+	_INIT_CMD(0x00, 0xB8, 0x8A),
+	_INIT_CMD(0x00, 0xB9, 0xCA),
+	_INIT_CMD(0x00, 0xBA, 0x0C),
+	_INIT_CMD(0x05, 0xBB, 0x87),
+	_INIT_CMD(0x00, 0xBC, 0x06),
+	_INIT_CMD(0x00, 0xBD, 0x0A),
+	_INIT_CMD(0x00, 0xBE, 0x9B),
+	_INIT_CMD(0x00, 0xBF, 0x0C),
+	_INIT_CMD(0x00, 0xC0, 0x3D),
+	_INIT_CMD(0x00, 0xC1, 0x71),
+	_INIT_CMD(0x00, 0xC2, 0x90),
+	_INIT_CMD(0x00, 0xC3, 0xA0),
+	_INIT_CMD(0x00, 0xC4, 0xA8),
+	_INIT_CMD(0x00, 0xC5, 0xB1),
+	_INIT_CMD(0x00, 0xC6, 0xBB),
+	_INIT_CMD(0x00, 0xC7, 0xC0),
+	_INIT_CMD(0x00, 0xC8, 0xC4),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x0B),
+	_INIT_CMD(0x00, 0xB1, 0x04),
+	_INIT_CMD(0x00, 0xB2, 0x08),
+	_INIT_CMD(0x00, 0xB3, 0x19),
+	_INIT_CMD(0x00, 0xB4, 0x31),
+	_INIT_CMD(0x00, 0xB5, 0x46),
+	_INIT_CMD(0x00, 0xB6, 0x55),
+	_INIT_CMD(0x00, 0xB7, 0x6E),
+	_INIT_CMD(0x00, 0xB8, 0x92),
+	_INIT_CMD(0x00, 0xB9, 0xD4),
+	_INIT_CMD(0x00, 0xBA, 0x1B),
+	_INIT_CMD(0x05, 0xBB, 0x9B),
+	_INIT_CMD(0x00, 0xBC, 0x28),
+	_INIT_CMD(0x00, 0xBD, 0x2D),
+	_INIT_CMD(0x00, 0xBE, 0xC3),
+	_INIT_CMD(0x00, 0xBF, 0x2F),
+	_INIT_CMD(0x00, 0xC0, 0x62),
+	_INIT_CMD(0x00, 0xC1, 0x99),
+	_INIT_CMD(0x00, 0xC2, 0xAB),
+	_INIT_CMD(0x00, 0xC3, 0xBF),
+	_INIT_CMD(0x00, 0xC4, 0xCF),
+	_INIT_CMD(0x00, 0xC5, 0xDF),
+	_INIT_CMD(0x00, 0xC6, 0xF0),
+	_INIT_CMD(0x00, 0xC7, 0xF9),
+	_INIT_CMD(0x00, 0xC8, 0xFC),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x0C),
+	_INIT_CMD(0x00, 0xB1, 0x04),
+	_INIT_CMD(0x00, 0xB2, 0x05),
+	_INIT_CMD(0x00, 0xB3, 0x17),
+	_INIT_CMD(0x00, 0xB4, 0x2E),
+	_INIT_CMD(0x00, 0xB5, 0x42),
+	_INIT_CMD(0x00, 0xB6, 0x51),
+	_INIT_CMD(0x00, 0xB7, 0x69),
+	_INIT_CMD(0x00, 0xB8, 0x88),
+	_INIT_CMD(0x00, 0xB9, 0xC9),
+	_INIT_CMD(0x00, 0xBA, 0x0C),
+	_INIT_CMD(0x05, 0xBB, 0x86),
+	_INIT_CMD(0x00, 0xBC, 0x03),
+	_INIT_CMD(0x00, 0xBD, 0x08),
+	_INIT_CMD(0x00, 0xBE, 0x95),
+	_INIT_CMD(0x00, 0xBF, 0x05),
+	_INIT_CMD(0x00, 0xC0, 0x35),
+	_INIT_CMD(0x00, 0xC1, 0x62),
+	_INIT_CMD(0x00, 0xC2, 0x81),
+	_INIT_CMD(0x00, 0xC3, 0x96),
+	_INIT_CMD(0x00, 0xC4, 0x9E),
+	_INIT_CMD(0x00, 0xC5, 0xA5),
+	_INIT_CMD(0x00, 0xC6, 0xAD),
+	_INIT_CMD(0x00, 0xC7, 0xB1),
+	_INIT_CMD(0x00, 0xC8, 0xB4),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x64, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x00),
+	_INIT_CMD(0x00, 0xB3, 0x08),
+	_INIT_CMD(0x00, 0xB0, 0x04),
+	_INIT_CMD(0x0A, 0xB8, 0x68),
+	_INIT_CMD(0x78, 0x11),
+	_INIT_CMD(0x14, 0x29),
+
+	{},
+};
+
+static const struct panel_cmd boe_himax8279d8p_off_cmds[] = {
+	_INIT_CMD(0x00, 0x28),
+	_INIT_CMD(0x00, 0x10),
+
+	{},
+};
+
+static const struct panel_desc boe_himax8279d8p_panel_desc = {
+	.display_mode = &boe_himax8279d8p_display_mode,
+	.bpc = 8,
+	.width = 107,
+	.height = 172,
+	.delay_t1 = 5000,
+	.reset_delay_t2 = 14000,
+	.reset_delay_t3 = 1000,
+	.reset_delay_t4 = 1000,
+	.flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+		    MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM,
+	.format = MIPI_DSI_FMT_RGB888,
+	.lanes = 4,
+	.on_cmds = boe_himax8279d8p_on_cmds,
+	.off_cmds = boe_himax8279d8p_off_cmds,
+};
+
+/* 10 inch */
+static const struct drm_display_mode boe_himax8279d10p_display_mode = {
+	.clock = 159420,
+	.hdisplay = 1200,
+	.hsync_start = 1200 + 80,
+	.hsync_end = 1200 + 80 + 60,
+	.htotal = 1200 + 80 + 60 + 24,
+	.vdisplay = 1920,
+	.vsync_start = 1920 + 10,
+	.vsync_end = 1920 + 10 + 14,
+	.vtotal = 1920 + 10 + 14 + 4,
+	.vrefresh = 60,
+};
+
+static const struct panel_cmd boe_himax8279d10p_on_cmds[] = {
+	_INIT_CMD(0x00, 0xB0, 0x05),
+	_INIT_CMD(0x00, 0xB1, 0xE5),
+	_INIT_CMD(0x00, 0xB3, 0x52),
+	_INIT_CMD(0x00, 0xB0, 0x00),
+	_INIT_CMD(0x00, 0xB3, 0x88),
+	_INIT_CMD(0x00, 0xB0, 0x04),
+	_INIT_CMD(0x00, 0xB8, 0x00),
+	_INIT_CMD(0x00, 0xB0, 0x00),
+	_INIT_CMD(0x00, 0xB2, 0x50),
+	_INIT_CMD(0x00, 0xB6, 0x03),
+	_INIT_CMD(0x00, 0xBA, 0x8B),
+	_INIT_CMD(0x00, 0xBF, 0x1A),
+	_INIT_CMD(0x00, 0xC0, 0x0F),
+	_INIT_CMD(0x00, 0xC2, 0x0C),
+	_INIT_CMD(0x00, 0xC3, 0x02),
+	_INIT_CMD(0x00, 0xC4, 0x0C),
+	_INIT_CMD(0x00, 0xC5, 0x02),
+	_INIT_CMD(0x00, 0xB0, 0x01),
+	_INIT_CMD(0x00, 0xE0, 0x26),
+	_INIT_CMD(0x00, 0xE1, 0x26),
+	_INIT_CMD(0x00, 0xDC, 0x00),
+	_INIT_CMD(0x00, 0xDD, 0x00),
+	_INIT_CMD(0x00, 0xCC, 0x26),
+	_INIT_CMD(0x00, 0xCD, 0x26),
+	_INIT_CMD(0x00, 0xC8, 0x00),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xD2, 0x04),
+	_INIT_CMD(0x00, 0xD3, 0x04),
+	_INIT_CMD(0x00, 0xE6, 0x03),
+	_INIT_CMD(0x00, 0xE7, 0x03),
+	_INIT_CMD(0x00, 0xC4, 0x08),
+	_INIT_CMD(0x00, 0xC5, 0x08),
+	_INIT_CMD(0x00, 0xD8, 0x07),
+	_INIT_CMD(0x00, 0xD9, 0x07),
+	_INIT_CMD(0x00, 0xC2, 0x06),
+	_INIT_CMD(0x00, 0xC3, 0x06),
+	_INIT_CMD(0x00, 0xD6, 0x05),
+	_INIT_CMD(0x00, 0xD7, 0x05),
+	_INIT_CMD(0x00, 0xC0, 0x0C),
+	_INIT_CMD(0x00, 0xC1, 0x0C),
+	_INIT_CMD(0x00, 0xD4, 0x0B),
+	_INIT_CMD(0x00, 0xD5, 0x0B),
+	_INIT_CMD(0x00, 0xCA, 0x0A),
+	_INIT_CMD(0x00, 0xCB, 0x0A),
+	_INIT_CMD(0x00, 0xDE, 0x09),
+	_INIT_CMD(0x00, 0xDF, 0x09),
+	_INIT_CMD(0x00, 0xC6, 0x26),
+	_INIT_CMD(0x00, 0xC7, 0x26),
+	_INIT_CMD(0x00, 0xCE, 0x00),
+	_INIT_CMD(0x00, 0xCF, 0x00),
+	_INIT_CMD(0x00, 0xDA, 0x26),
+	_INIT_CMD(0x00, 0xDB, 0x26),
+	_INIT_CMD(0x00, 0xE2, 0x00),
+	_INIT_CMD(0x00, 0xE3, 0x00),
+	_INIT_CMD(0x00, 0xB0, 0x02),
+	_INIT_CMD(0x00, 0xC0, 0x00),
+	_INIT_CMD(0x00, 0xC1, 0x07),
+	_INIT_CMD(0x00, 0xC2, 0x0D),
+	_INIT_CMD(0x00, 0xC3, 0x18),
+	_INIT_CMD(0x00, 0xC4, 0x27),
+	_INIT_CMD(0x00, 0xC5, 0x28),
+	_INIT_CMD(0x00, 0xC6, 0x30),
+	_INIT_CMD(0x00, 0xC7, 0x2E),
+	_INIT_CMD(0x00, 0xC8, 0x2F),
+	_INIT_CMD(0x00, 0xC9, 0x1A),
+	_INIT_CMD(0x00, 0xCA, 0x20),
+	_INIT_CMD(0x00, 0xCB, 0x29),
+	_INIT_CMD(0x00, 0xCC, 0x26),
+	_INIT_CMD(0x00, 0xCD, 0x32),
+	_INIT_CMD(0x00, 0xCE, 0x33),
+	_INIT_CMD(0x00, 0xCF, 0x31),
+	_INIT_CMD(0x00, 0xD0, 0x06),
+	_INIT_CMD(0x00, 0xD2, 0x00),
+	_INIT_CMD(0x00, 0xD3, 0x07),
+	_INIT_CMD(0x00, 0xD4, 0x12),
+	_INIT_CMD(0x00, 0xD5, 0x26),
+	_INIT_CMD(0x00, 0xD6, 0x3D),
+	_INIT_CMD(0x00, 0xD7, 0x3F),
+	_INIT_CMD(0x00, 0xD8, 0x3F),
+	_INIT_CMD(0x00, 0xD9, 0x3F),
+	_INIT_CMD(0x00, 0xDA, 0x3F),
+	_INIT_CMD(0x00, 0xDB, 0x3F),
+	_INIT_CMD(0x00, 0xDC, 0x3F),
+	_INIT_CMD(0x00, 0xDD, 0x3F),
+	_INIT_CMD(0x00, 0xDE, 0x3F),
+	_INIT_CMD(0x00, 0xDF, 0x3A),
+	_INIT_CMD(0x00, 0xE0, 0x37),
+	_INIT_CMD(0x00, 0xE1, 0x35),
+	_INIT_CMD(0x00, 0xE2, 0x07),
+	_INIT_CMD(0x00, 0xB0, 0x03),
+	_INIT_CMD(0x00, 0xC8, 0x0B),
+	_INIT_CMD(0x00, 0xC9, 0x07),
+	_INIT_CMD(0x00, 0xC3, 0x00),
+	_INIT_CMD(0x00, 0xE7, 0x00),
+	_INIT_CMD(0x00, 0xC5, 0x2A),
+	_INIT_CMD(0x00, 0xDE, 0x2A),
+	_INIT_CMD(0x00, 0xCA, 0x43),
+	_INIT_CMD(0x00, 0xC9, 0x07),
+	_INIT_CMD(0x00, 0xE4, 0xC0),
+	_INIT_CMD(0x00, 0xE5, 0x0D),
+	_INIT_CMD(0x00, 0xCB, 0x00),
+	_INIT_CMD(0x00, 0xB0, 0x06),
+	_INIT_CMD(0x00, 0xB8, 0xA5),
+	_INIT_CMD(0x00, 0xC0, 0xA5),
+	_INIT_CMD(0x00, 0xC7, 0x0F),
+	_INIT_CMD(0x00, 0xD5, 0x32),
+	_INIT_CMD(0x00, 0xB8, 0x00),
+	_INIT_CMD(0x00, 0xC0, 0x00),
+	_INIT_CMD(0x00, 0xBC, 0x00),
+	_INIT_CMD(0x00, 0xB0, 0x07),
+	_INIT_CMD(0x00, 0xB1, 0x00),
+	_INIT_CMD(0x00, 0xB2, 0x09),
+	_INIT_CMD(0x00, 0xB3, 0x19),
+	_INIT_CMD(0x00, 0xB4, 0x2F),
+	_INIT_CMD(0x00, 0xB5, 0x44),
+	_INIT_CMD(0x00, 0xB6, 0x52),
+	_INIT_CMD(0x00, 0xB7, 0x6A),
+	_INIT_CMD(0x00, 0xB8, 0x8A),
+	_INIT_CMD(0x00, 0xB9, 0xCA),
+	_INIT_CMD(0x00, 0xBA, 0x0C),
+	_INIT_CMD(0x00, 0xBB, 0x87),
+	_INIT_CMD(0x00, 0xBC, 0x06),
+	_INIT_CMD(0x00, 0xBD, 0x0A),
+	_INIT_CMD(0x00, 0xBE, 0x9B),
+	_INIT_CMD(0x00, 0xBF, 0x0C),
+	_INIT_CMD(0x00, 0xC0, 0x3D),
+	_INIT_CMD(0x00, 0xC1, 0x71),
+	_INIT_CMD(0x00, 0xC2, 0x90),
+	_INIT_CMD(0x00, 0xC3, 0xA0),
+	_INIT_CMD(0x00, 0xC4, 0xA8),
+	_INIT_CMD(0x00, 0xC5, 0xB1),
+	_INIT_CMD(0x00, 0xC6, 0xBB),
+	_INIT_CMD(0x00, 0xC7, 0xC0),
+	_INIT_CMD(0x00, 0xC8, 0xC4),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x08),
+	_INIT_CMD(0x00, 0xB1, 0x04),
+	_INIT_CMD(0x00, 0xB2, 0x08),
+	_INIT_CMD(0x00, 0xB3, 0x19),
+	_INIT_CMD(0x00, 0xB4, 0x31),
+	_INIT_CMD(0x00, 0xB5, 0x46),
+	_INIT_CMD(0x00, 0xB6, 0x55),
+	_INIT_CMD(0x00, 0xB7, 0x6E),
+	_INIT_CMD(0x00, 0xB8, 0x92),
+	_INIT_CMD(0x00, 0xB9, 0xD4),
+	_INIT_CMD(0x00, 0xBA, 0x1B),
+	_INIT_CMD(0x00, 0xBB, 0x9B),
+	_INIT_CMD(0x00, 0xBC, 0x28),
+	_INIT_CMD(0x00, 0xBD, 0x2D),
+	_INIT_CMD(0x00, 0xBE, 0xC3),
+	_INIT_CMD(0x00, 0xBF, 0x2F),
+	_INIT_CMD(0x00, 0xC0, 0x62),
+	_INIT_CMD(0x00, 0xC1, 0x99),
+	_INIT_CMD(0x00, 0xC2, 0xAB),
+	_INIT_CMD(0x00, 0xC3, 0xBF),
+	_INIT_CMD(0x00, 0xC4, 0xCF),
+	_INIT_CMD(0x00, 0xC5, 0xDF),
+	_INIT_CMD(0x00, 0xC6, 0xF0),
+	_INIT_CMD(0x00, 0xC7, 0xF9),
+	_INIT_CMD(0x00, 0xC8, 0xFC),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x09),
+	_INIT_CMD(0x00, 0xB1, 0x04),
+	_INIT_CMD(0x00, 0xB2, 0x05),
+	_INIT_CMD(0x00, 0xB3, 0x17),
+	_INIT_CMD(0x00, 0xB4, 0x2E),
+	_INIT_CMD(0x00, 0xB5, 0x42),
+	_INIT_CMD(0x00, 0xB6, 0x51),
+	_INIT_CMD(0x00, 0xB7, 0x69),
+	_INIT_CMD(0x00, 0xB8, 0x88),
+	_INIT_CMD(0x00, 0xB9, 0xC9),
+	_INIT_CMD(0x00, 0xBA, 0x0C),
+	_INIT_CMD(0x00, 0xBB, 0x86),
+	_INIT_CMD(0x00, 0xBC, 0x03),
+	_INIT_CMD(0x00, 0xBD, 0x08),
+	_INIT_CMD(0x00, 0xBE, 0x95),
+	_INIT_CMD(0x00, 0xBF, 0x05),
+	_INIT_CMD(0x00, 0xC0, 0x35),
+	_INIT_CMD(0x00, 0xC1, 0x62),
+	_INIT_CMD(0x00, 0xC2, 0x81),
+	_INIT_CMD(0x00, 0xC3, 0x96),
+	_INIT_CMD(0x00, 0xC4, 0x9E),
+	_INIT_CMD(0x00, 0xC5, 0xA5),
+	_INIT_CMD(0x00, 0xC6, 0xAD),
+	_INIT_CMD(0x00, 0xC7, 0xB1),
+	_INIT_CMD(0x00, 0xC8, 0xB4),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x0A),
+	_INIT_CMD(0x00, 0xB1, 0x00),
+	_INIT_CMD(0x00, 0xB2, 0x09),
+	_INIT_CMD(0x00, 0xB3, 0x19),
+	_INIT_CMD(0x00, 0xB4, 0x2F),
+	_INIT_CMD(0x00, 0xB5, 0x44),
+	_INIT_CMD(0x00, 0xB6, 0x52),
+	_INIT_CMD(0x00, 0xB7, 0x6A),
+	_INIT_CMD(0x00, 0xB8, 0x8A),
+	_INIT_CMD(0x00, 0xB9, 0xCA),
+	_INIT_CMD(0x00, 0xBA, 0x0C),
+	_INIT_CMD(0x00, 0xBB, 0x87),
+	_INIT_CMD(0x00, 0xBC, 0x06),
+	_INIT_CMD(0x00, 0xBD, 0x0A),
+	_INIT_CMD(0x00, 0xBE, 0x9B),
+	_INIT_CMD(0x00, 0xBF, 0x0C),
+	_INIT_CMD(0x00, 0xC0, 0x3D),
+	_INIT_CMD(0x00, 0xC1, 0x71),
+	_INIT_CMD(0x00, 0xC2, 0x90),
+	_INIT_CMD(0x00, 0xC3, 0xA0),
+	_INIT_CMD(0x00, 0xC4, 0xA8),
+	_INIT_CMD(0x00, 0xC5, 0xB1),
+	_INIT_CMD(0x00, 0xC6, 0xBB),
+	_INIT_CMD(0x00, 0xC7, 0xC0),
+	_INIT_CMD(0x00, 0xC8, 0xC4),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x0B),
+	_INIT_CMD(0x00, 0xB1, 0x04),
+	_INIT_CMD(0x00, 0xB2, 0x08),
+	_INIT_CMD(0x00, 0xB3, 0x19),
+	_INIT_CMD(0x00, 0xB4, 0x31),
+	_INIT_CMD(0x00, 0xB5, 0x46),
+	_INIT_CMD(0x00, 0xB6, 0x55),
+	_INIT_CMD(0x00, 0xB7, 0x6E),
+	_INIT_CMD(0x00, 0xB8, 0x92),
+	_INIT_CMD(0x00, 0xB9, 0xD4),
+	_INIT_CMD(0x00, 0xBA, 0x1B),
+	_INIT_CMD(0x00, 0xBB, 0x9B),
+	_INIT_CMD(0x00, 0xBC, 0x28),
+	_INIT_CMD(0x00, 0xBD, 0x2D),
+	_INIT_CMD(0x00, 0xBE, 0xC3),
+	_INIT_CMD(0x00, 0xBF, 0x2F),
+	_INIT_CMD(0x00, 0xC0, 0x62),
+	_INIT_CMD(0x00, 0xC1, 0x99),
+	_INIT_CMD(0x00, 0xC2, 0xAB),
+	_INIT_CMD(0x00, 0xC3, 0xBF),
+	_INIT_CMD(0x00, 0xC4, 0xCF),
+	_INIT_CMD(0x00, 0xC5, 0xDF),
+	_INIT_CMD(0x00, 0xC6, 0xF0),
+	_INIT_CMD(0x00, 0xC7, 0xF9),
+	_INIT_CMD(0x00, 0xC8, 0xFC),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x0C),
+	_INIT_CMD(0x00, 0xB1, 0x04),
+	_INIT_CMD(0x00, 0xB2, 0x05),
+	_INIT_CMD(0x00, 0xB3, 0x17),
+	_INIT_CMD(0x00, 0xB4, 0x2E),
+	_INIT_CMD(0x00, 0xB5, 0x42),
+	_INIT_CMD(0x00, 0xB6, 0x51),
+	_INIT_CMD(0x00, 0xB7, 0x69),
+	_INIT_CMD(0x00, 0xB8, 0x88),
+	_INIT_CMD(0x00, 0xB9, 0xC9),
+	_INIT_CMD(0x00, 0xBA, 0x0C),
+	_INIT_CMD(0x00, 0xBB, 0x86),
+	_INIT_CMD(0x00, 0xBC, 0x03),
+	_INIT_CMD(0x00, 0xBD, 0x08),
+	_INIT_CMD(0x00, 0xBE, 0x95),
+	_INIT_CMD(0x00, 0xBF, 0x05),
+	_INIT_CMD(0x00, 0xC0, 0x35),
+	_INIT_CMD(0x00, 0xC1, 0x62),
+	_INIT_CMD(0x00, 0xC2, 0x81),
+	_INIT_CMD(0x00, 0xC3, 0x96),
+	_INIT_CMD(0x00, 0xC4, 0x9E),
+	_INIT_CMD(0x00, 0xC5, 0xA5),
+	_INIT_CMD(0x00, 0xC6, 0xAD),
+	_INIT_CMD(0x00, 0xC7, 0xB1),
+	_INIT_CMD(0x00, 0xC8, 0xB4),
+	_INIT_CMD(0x00, 0xC9, 0x00),
+	_INIT_CMD(0x00, 0xCA, 0x00),
+	_INIT_CMD(0x00, 0xCB, 0x16),
+	_INIT_CMD(0x00, 0xCC, 0xAF),
+	_INIT_CMD(0x00, 0xCD, 0xFF),
+	_INIT_CMD(0x00, 0xCE, 0xFF),
+	_INIT_CMD(0x00, 0xB0, 0x00),
+	_INIT_CMD(0x00, 0xB3, 0x08),
+	_INIT_CMD(0x00, 0xB0, 0x04),
+	_INIT_CMD(0x64, 0xB8, 0x68),
+
+	{},
+};
+
+static const struct panel_cmd boe_himax8279d10p_off_cmds[] = {
+	_INIT_CMD(0x00, 0x28),
+	_INIT_CMD(0x00, 0x10),
+
+	{},
+};
+
+static const struct panel_desc boe_himax8279d10p_panel_desc = {
+	.display_mode = &boe_himax8279d10p_display_mode,
+	.bpc = 8,
+	.width = 135,
+	.height = 216,
+	.delay_t1 = 5000,
+	.reset_delay_t2 = 14000,
+	.reset_delay_t3 = 1000,
+	.reset_delay_t4 = 1000,
+	.flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+		    MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM,
+	.format = MIPI_DSI_FMT_RGB888,
+	.lanes = 4,
+	.on_cmds = boe_himax8279d10p_on_cmds,
+	.off_cmds = boe_himax8279d10p_off_cmds,
+};
+
 static const struct of_device_id panel_of_match[] = {
-	{ .compatible = "boe,himax8279d", },
+	{ .compatible = "boe,himax8279d8p",
+	  .data = &boe_himax8279d8p_panel_desc
+	},
+	{ .compatible = "boe,himax8279d10p",
+	  .data = &boe_himax8279d10p_panel_desc
+	},
 	{ }
 };
 MODULE_DEVICE_TABLE(of, panel_of_match);
@@ -462,43 +954,33 @@ MODULE_DEVICE_TABLE(of, panel_of_match);
 static int panel_add(struct panel_info *pinfo)
 {
 	struct device *dev = &pinfo->link->dev;
-	struct device_node *np;
 	int err;
 
-	pinfo->pp33000_gpio = devm_gpiod_get_optional(dev,
-							"pp33000",
-							GPIOD_OUT_HIGH);
-	if (IS_ERR(pinfo->pp33000_gpio)) {
-		err = PTR_ERR(pinfo->pp33000_gpio);
-		dev_err(dev, "failed to get pp33000 gpio: %d\n", err);
-		pinfo->pp33000_gpio = NULL;
+	pinfo->pp18_gpio = devm_gpiod_get_optional(dev, "pp18", GPIOD_OUT_LOW);
+	if (IS_ERR(pinfo->pp18_gpio)) {
+		err = PTR_ERR(pinfo->pp18_gpio);
+		dev_err(dev, "failed to get pp18 gpio: %d\n", err);
+		pinfo->pp18_gpio = NULL;
 	}
 
-	pinfo->pp18000_gpio = devm_gpiod_get_optional(dev,
-							"pp18000",
-							GPIOD_OUT_HIGH);
-	if (IS_ERR(pinfo->pp18000_gpio)) {
-		err = PTR_ERR(pinfo->pp18000_gpio);
-		dev_err(dev, "failed to get pp18000 gpio: %d\n", err);
-		pinfo->pp18000_gpio = NULL;
+	pinfo->pp33_gpio = devm_gpiod_get_optional(dev, "pp33", GPIOD_OUT_LOW);
+	if (IS_ERR(pinfo->pp33_gpio)) {
+		err = PTR_ERR(pinfo->pp33_gpio);
+		dev_err(dev, "failed to get pp33 gpio: %d\n", err);
+		pinfo->pp33_gpio = NULL;
 	}
 
 	pinfo->reset_gpio = devm_gpiod_get_optional(dev, "enable",
-							GPIOD_OUT_HIGH);
+						    GPIOD_OUT_LOW);
 	if (IS_ERR(pinfo->reset_gpio)) {
 		err = PTR_ERR(pinfo->reset_gpio);
 		dev_err(dev, "failed to get enable gpio: %d\n", err);
 		pinfo->reset_gpio = NULL;
 	}
 
-	np = of_parse_phandle(dev->of_node, "backlight", 0);
-	if (np) {
-		pinfo->backlight = of_find_backlight_by_node(np);
-		of_node_put(np);
-
-		if (!pinfo->backlight)
-			return -EPROBE_DEFER;
-	}
+	pinfo->backlight = devm_of_find_backlight(dev);
+	if (IS_ERR(pinfo->backlight))
+		return PTR_ERR(pinfo->backlight);
 
 	drm_panel_init(&pinfo->base);
 	pinfo->base.funcs = &panel_funcs;
@@ -506,35 +988,34 @@ static int panel_add(struct panel_info *pinfo)
 
 	err = drm_panel_add(&pinfo->base);
 	if (err < 0)
-		goto put_backlight;
+		return err;
 
 	return 0;
-
-put_backlight:
-	put_device(&pinfo->backlight->dev);
-
-	return err;
 }
 
 static void panel_del(struct panel_info *pinfo)
 {
 	if (pinfo->base.dev)
 		drm_panel_remove(&pinfo->base);
-
-	put_device(&pinfo->backlight->dev);
 }
 
 static int panel_probe(struct mipi_dsi_device *dsi)
 {
 	struct panel_info *pinfo;
 	int err;
+	const struct panel_desc *desc;
 
 	pinfo = devm_kzalloc(&dsi->dev, sizeof(*pinfo), GFP_KERNEL);
 	if (!pinfo)
 		return -ENOMEM;
 
+	desc = of_device_get_match_data(&dsi->dev);
+	dsi->mode_flags = desc->flags;
+	dsi->format = desc->format;
+	dsi->lanes = desc->lanes;
+	pinfo->desc = desc;
+
 	pinfo->link = dsi;
-	panel_parse_dt(pinfo);
 	mipi_dsi_set_drvdata(dsi, pinfo);
 
 	err = panel_add(pinfo);
@@ -552,7 +1033,7 @@ static int panel_remove(struct mipi_dsi_device *dsi)
 	err = panel_unprepare(&pinfo->base);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
-			      err);
+						err);
 
 	err = panel_disable(&pinfo->base);
 	if (err < 0)
@@ -561,7 +1042,7 @@ static int panel_remove(struct mipi_dsi_device *dsi)
 	err = mipi_dsi_detach(dsi);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to detach from DSI host: %d\n",
-			      err);
+					  err);
 
 	drm_panel_detach(&pinfo->base);
 	panel_del(pinfo);
@@ -573,13 +1054,13 @@ static void panel_shutdown(struct mipi_dsi_device *dsi)
 {
 	struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi);
 
-	panel_unprepare(&pinfo->base);
 	panel_disable(&pinfo->base);
+	panel_unprepare(&pinfo->base);
 }
 
 static struct mipi_dsi_driver panel_driver = {
 	.driver = {
-		.name = "panel-innolux-ota7290b",
+		.name = "panel-boe-himax8279d",
 		.of_match_table = panel_of_match,
 	},
 	.probe = panel_probe,
-- 
2.17.1

From 23afac4125d1ca70809dc92c5ba6d76a880e92e8 Mon Sep 17 00:00:00 2001
From: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Aug 2019 15:57:08 +0800
Subject: [PATCH 03/10] [v3,2/2] drm/panel: Add Boe Himax8279d MIPI-DSI LCD
 panel

Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

V3:
- Remove unnecessary delays in sending initialization commands (Jitao Shi)

V2:
- Use SPDX identifier (Sam)
- Use necessary header files replace drmP.h (Sam)
- Delete unnecessary header files #include <linux/err.h> (Sam)
- Specifies a GPIOs array to control the reset timing,
    instead of reading "dsi-reset-sequence" data from DTS (Sam)
- Delete backlight_disable() function when already disabled (Sam)
- Use devm_of_find_backlight() replace of_find_backlight_by_node()
    (Sam)
- Move the necessary data in the DTS to the current file,
    like porch, display_mode and Init code etc. (Sam)
- Add compatible device "boe,himax8279d10p" (Sam)

V1:
- Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
    panel.

Signed-off-by: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx>
Cc: Nick Sanders <nsanders@xxxxxxxxxx>
Cc: YH Lin <yueherngl@xxxxxxxxxxxx>
Cc: Rock wang <rock_wang@xxxxxxxxxxxx>
---
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 836a9cbc5891..60f5f8bf2e14 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -119,8 +119,9 @@ static int panel_unprepare(struct drm_panel *panel)
 					err);
 				goto poweroff;
 			}
-			usleep_range((cmd->data[0]) * 1000,
-				    (1 + cmd->data[0]) * 1000);
+			if (cmd->data[0])
+				usleep_range((cmd->data[0]) * 1000,
+					    (1 + cmd->data[0]) * 1000);
 		}
 	}
 
@@ -187,8 +188,10 @@ static int panel_prepare(struct drm_panel *panel)
 					err);
 				goto poweroff;
 			}
-			usleep_range(cmd->data[0] * 1000,
-				    (1 + cmd->data[0]) * 1000);
+
+			if (cmd->data[0])
+				usleep_range(cmd->data[0] * 1000,
+					    (1 + cmd->data[0]) * 1000);
 		}
 	}
 
-- 
2.17.1

From dc75fc3664e04d3752083ae9c18edd62224dd30f Mon Sep 17 00:00:00 2001
From: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Aug 2019 14:04:00 +0800
Subject: [PATCH 01/10] [v1,2/2] drm/panel:Add Boe Himax8279d MIPI-DSI LCD
 panel

Add panel driver for it.

Signed-off-by: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
---
 MAINTAINERS                                  |   6 +
 drivers/gpu/drm/panel/Kconfig                |  11 +
 drivers/gpu/drm/panel/Makefile               |   1 +
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 593 +++++++++++++++++++
 4 files changed, 611 insertions(+)
 create mode 100644 drivers/gpu/drm/panel/panel-boe-himax8279d.c

diff --git a/MAINTAINERS b/MAINTAINERS
index 6fe3462a1f7a..787575705ed4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5108,6 +5108,12 @@ S:	Maintained
 F:	drivers/gpu/drm/tiny/ili9225.c
 F:	Documentation/devicetree/bindings/display/ilitek,ili9225.txt
 
+DRM DRIVER FOR BOE HIMAX8279D PANELS
+M:	Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
+S:	Maintained
+F:	drivers/gpu/drm/panel/panel-boe-himax8279d.c
+F:	Documentation/devicetree/bindings/display/panel/boe,himax8279d.txt
+
 DRM DRIVER FOR HX8357D PANELS
 M:	Eric Anholt <eric@xxxxxxxxxx>
 T:	git git://anongit.freedesktop.org/drm/drm-misc
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index eaecd40cc32e..e8b060b1b59b 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -293,6 +293,17 @@ config DRM_PANEL_SITRONIX_ST7789V
 	  Say Y here if you want to enable support for the Sitronix
 	  ST7789V controller for 240x320 LCD panels
 
+config DRM_PANEL_BOE_HIMAX8279D
+	tristate "Boe Himax8279d panel"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  Say Y here if you want to enable support for Same type
+	  TFT-LCD modules. The panel has a 1200x1920 resolution and uses
+	  24 bit RGB per pixel. It provides a MIPI DSI interface to
+	  the host and has a built-in LED backlight.
+
 config DRM_PANEL_TPO_TPG110
 	tristate "TPO TPG 800x400 panel"
 	depends on OF && SPI && GPIOLIB
diff --git a/drivers/gpu/drm/panel/Makefile b/drivers/gpu/drm/panel/Makefile
index 62dae45f8f74..1aef9d72c7a6 100644
--- a/drivers/gpu/drm/panel/Makefile
+++ b/drivers/gpu/drm/panel/Makefile
@@ -30,5 +30,6 @@ obj-$(CONFIG_DRM_PANEL_SHARP_LQ101R1SX01) += panel-sharp-lq101r1sx01.o
 obj-$(CONFIG_DRM_PANEL_SHARP_LS043T1LE01) += panel-sharp-ls043t1le01.o
 obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7701) += panel-sitronix-st7701.o
 obj-$(CONFIG_DRM_PANEL_SITRONIX_ST7789V) += panel-sitronix-st7789v.o
+obj-$(CONFIG_DRM_PANEL_BOE_HIMAX8279D) += panel-boe-himax8279d.o
 obj-$(CONFIG_DRM_PANEL_TPO_TPG110) += panel-tpo-tpg110.o
 obj-$(CONFIG_DRM_PANEL_TRULY_NT35597_WQXGA) += panel-truly-nt35597.o
diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
new file mode 100644
index 000000000000..2788bdda69ec
--- /dev/null
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -0,0 +1,593 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (c) 2019, Huaqin Electronics Co., Ltd
+ *
+ * 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.
+ */
+
+#include <linux/backlight.h>
+#include <linux/gpio/consumer.h>
+#include <linux/module.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/regulator/consumer.h>
+
+#include <drm/drmP.h>
+#include <drm/drm_crtc.h>
+#include <drm/drm_mipi_dsi.h>
+#include <drm/drm_panel.h>
+
+#include <video/mipi_display.h>
+#include <linux/err.h>
+
+struct dsi_cmd_desc {
+	char wait;
+	char cmd;
+	char len;
+	char *payload;
+};
+
+struct dsi_panel_cmds {
+	char *buf;
+	int blen;
+	struct dsi_cmd_desc *cmds;
+	int cmd_cnt;
+};
+
+struct panel_info {
+	struct drm_panel base;
+	struct mipi_dsi_device *link;
+
+	struct backlight_device *backlight;
+	struct gpio_desc *reset_gpio;
+	struct gpio_desc *pp33000_gpio;
+	struct gpio_desc *pp18000_gpio;
+
+	u32 rst_seq[10];
+	u32 rst_seq_len;
+
+	struct dsi_panel_cmds *on_cmds;
+	struct dsi_panel_cmds *off_cmds;
+	struct drm_display_mode	*panel_display_mode;
+
+	unsigned int panel_width_mm;
+	unsigned int panel_height_mm;
+	unsigned int per_color_channel;
+
+	bool prepared;
+	bool enabled;
+};
+
+static int dsi_parse_reset_seq(struct device_node *np, u32 rst_seq[10],
+		u32 *rst_len, const char *name)
+{
+	int num = 0, i;
+	int rc;
+	struct property *data;
+	u32 tmp[10];
+	*rst_len = 0;
+	data = of_find_property(np, name, &num);
+
+	num /= sizeof(u32);
+	if (!data || !num || num > 10 || num % 2) {
+		pr_err("%s:%d, error reading %s, length found = %d\n",
+				__func__, __LINE__, name, num);
+		return -EINVAL;
+	}
+
+	rc = of_property_read_u32_array(np, name, tmp, num);
+	if (rc) {
+		pr_err("%s:%d, error reading %s, rc = %d\n",
+					__func__, __LINE__, name, rc);
+		return -EINVAL;
+	}
+
+	for (i = 0; i < num; ++i) {
+		rst_seq[i] = tmp[i];
+		*rst_len = num;
+	}
+	return 0;
+}
+
+ssize_t mipi_dsi_dcs_write_delay(struct mipi_dsi_device *dsi, u8 cmd,
+		const void *data, size_t len, size_t time)
+{
+	ssize_t ret;
+
+	if (len == 0)
+		ret = mipi_dsi_dcs_write(dsi, cmd, NULL, 0);
+	else
+		ret = mipi_dsi_dcs_write(dsi, cmd, data, len);
+
+	msleep(time);
+
+	return ret;
+}
+
+static int write_cmds(struct mipi_dsi_device *dsi_device,
+					struct dsi_panel_cmds *init_cmds)
+{
+	struct dsi_cmd_desc *one_cmd = init_cmds->cmds;
+	int i = 0;
+	int ret;
+
+	for (i = 0; i < init_cmds->cmd_cnt; i++) {
+		if (one_cmd == NULL)
+			return -EINVAL;
+
+		ret = mipi_dsi_dcs_write_delay(dsi_device,
+				one_cmd->cmd, one_cmd->payload,
+				one_cmd->len, one_cmd->wait);
+		one_cmd++;
+	}
+
+	return ret;
+}
+
+static int parse_dcs_cmds(struct device_node *np,
+				struct dsi_panel_cmds *pcmds, char *cmd_key)
+{
+	const char *data;
+	int blen = 0, len, cnt = 0;
+	char *buf, *bp;
+	struct dsi_cmd_desc *temp_cmd;
+
+	data = of_get_property(np, cmd_key, &blen);
+	if (!data) {
+		pr_err("%s: failed, key=%s\n", __func__, cmd_key);
+		return -ENOMEM;
+	}
+
+	buf = kzalloc(sizeof(char) * blen, GFP_KERNEL);
+	if (!buf)
+		return -ENOMEM;
+
+	memcpy(buf, data, blen);
+
+	/* scan dcs commands */
+	bp = buf;
+	len = blen;
+
+	/* get how much cmd cnt  */
+	while (len > 0) {
+		cnt++;
+		len = len - *(bp);
+		bp = bp + *(bp);
+	}
+
+	pcmds->cmd_cnt = cnt;
+
+	pcmds->cmds = kcalloc(cnt, sizeof(struct dsi_cmd_desc), GFP_KERNEL);
+	if (!pcmds->cmds)
+		return -ENOMEM;
+	temp_cmd = pcmds->cmds;
+
+	bp = buf;
+	len = blen;
+
+	while (cnt != 0) {
+		temp_cmd->wait = *(bp+1);
+		temp_cmd->cmd = *(bp+2);
+		temp_cmd->len = *(bp) - 3;
+		temp_cmd->payload = bp + 3;
+
+		cnt--;
+		temp_cmd++;
+		bp = bp + *(bp);
+	}
+
+	pcmds->buf = buf;
+	pcmds->blen = blen;
+
+	return 0;
+}
+
+static int panel_parse_dt(struct panel_info *pinfo)
+{
+	struct device_node *panels_node;
+	struct device_node *parameter_node;
+	static const char *lcd_name;
+	static const char *panel_parameter;
+	struct drm_display_mode *display_mode;
+	struct mipi_dsi_device	*dsi_device = pinfo->link;
+	int ret = 0;
+	u32	tmp;
+
+	panels_node = of_find_node_by_name(NULL, "panels");
+	if (!panels_node) {
+		pr_err("Get panels node Fail!\n");
+		return -EINVAL;
+	}
+
+	panel_parameter = of_get_property(panels_node, "panel-parameter", NULL);
+	if (!panel_parameter) {
+		pr_err("Get panel parameter Fail!\n");
+		return -EINVAL;
+	}
+
+	parameter_node = of_find_node_by_name(panels_node, panel_parameter);
+	if (!parameter_node)
+		return -ENODEV;
+
+	/* get lcd name */
+	lcd_name = of_get_property(parameter_node, "dsi-panel-name", NULL);
+	if (!lcd_name) {
+		pr_err("Get lcd_name Fail!\n");
+		return -EINVAL;
+	}
+	pr_info("%s: Lcd Name = %s\n", __func__, lcd_name);
+
+	/* get lcd init code */
+	pinfo->on_cmds = kzalloc(sizeof(struct dsi_panel_cmds), GFP_KERNEL);
+	if (!(pinfo->on_cmds))
+		return -ENOMEM;
+
+	ret = parse_dcs_cmds(parameter_node, pinfo->on_cmds, "dsi-on-command");
+	if (ret < 0) {
+		pr_err("Get Dsi on command Fail\n");
+		return -EINVAL;
+	}
+
+	/* get lcd off code */
+	pinfo->off_cmds = kzalloc(sizeof(struct dsi_panel_cmds), GFP_KERNEL);
+	if (!(pinfo->off_cmds))
+		return -ENOMEM;
+
+	ret = parse_dcs_cmds(parameter_node, pinfo->off_cmds,
+			"dsi-off-command");
+	if (ret < 0) {
+		pr_err("Get Dsi off command Fail\n");
+		return -EINVAL;
+	}
+
+	/* get Porch  */
+	display_mode = kzalloc(sizeof(struct drm_display_mode), GFP_KERNEL);
+	if (!display_mode)
+		return -ENOMEM;
+	pinfo->panel_display_mode = display_mode;
+
+	ret = of_property_read_u32(parameter_node, "dsi-pixel-clk", &tmp);
+	display_mode->clock = (!ret ? tmp : 0);
+
+	ret = of_property_read_u32(parameter_node,
+			"dsi-panel-hzorizontal", &tmp);
+	display_mode->hdisplay = (!ret ? tmp : 0);
+
+	ret = of_property_read_u32(parameter_node, "dsi-h-front-porch", &tmp);
+	tmp = (!ret ? tmp : 0);
+	display_mode->hsync_start = display_mode->hdisplay + tmp;
+
+	ret = of_property_read_u32(parameter_node, "dsi-h-back-porch", &tmp);
+	tmp = (!ret ? tmp : 0);
+	display_mode->hsync_end = display_mode->hsync_start + tmp;
+
+	ret = of_property_read_u32(parameter_node, "dsi-h-pulse-width", &tmp);
+	tmp = (!ret ? tmp : 0);
+	display_mode->htotal = display_mode->hsync_end + tmp;
+
+	ret = of_property_read_u32(parameter_node, "dsi-panel-vertical", &tmp);
+	display_mode->vdisplay = (!ret ? tmp : 0);
+
+	ret = of_property_read_u32(parameter_node, "dsi-v-front-porch", &tmp);
+	tmp = (!ret ? tmp : 0);
+	display_mode->vsync_start = display_mode->vdisplay + tmp;
+
+	ret = of_property_read_u32(parameter_node, "dsi-v-back-porch", &tmp);
+	tmp = (!ret ? tmp : 0);
+	display_mode->vsync_end = display_mode->vsync_start + tmp;
+
+	ret = of_property_read_u32(parameter_node, "dsi-v-pulse-width", &tmp);
+	tmp = (!ret ? tmp : 0);
+	display_mode->vtotal = display_mode->vsync_end + tmp;
+
+	ret = of_property_read_u32(parameter_node, "dsi-panel-refresh", &tmp);
+	display_mode->vrefresh = (!ret ? tmp : 0);
+
+	/* get lans */
+	ret = of_property_read_u32(parameter_node, "dsi-panel-lanes", &tmp);
+	dsi_device->lanes  = (!ret ? tmp : 0);
+
+	ret = of_property_read_u32(parameter_node, "dsi-panel-format", &tmp);
+	dsi_device->format = (!ret ? tmp : 0);
+
+	ret = of_property_read_u32(parameter_node,
+			"dsi-panel-mode-flags", &tmp);
+	dsi_device->mode_flags = (!ret ? tmp : 0);
+
+	/* get WxH */
+	ret = of_property_read_u32(parameter_node, "dsi-panel-width-mm", &tmp);
+	pinfo->panel_width_mm  = (!ret ? tmp : 0);
+
+	ret = of_property_read_u32(parameter_node, "dsi-panel-height-mm", &tmp);
+	pinfo->panel_height_mm  = (!ret ? tmp : 0);
+
+	ret = of_property_read_u32(parameter_node, "per-color-channel", &tmp);
+	pinfo->per_color_channel = (!ret ? tmp : 0);
+
+	/* reset time */
+	ret = dsi_parse_reset_seq(parameter_node, pinfo->rst_seq,
+				&(pinfo->rst_seq_len), "dsi-reset-sequence");
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
+static inline struct panel_info *to_panel_info(struct drm_panel *panel)
+{
+	return container_of(panel, struct panel_info, base);
+}
+
+static int panel_disable(struct drm_panel *panel)
+{
+	struct panel_info *pinfo = to_panel_info(panel);
+
+	if (!pinfo->enabled)
+		return 0;
+
+	backlight_disable(pinfo->backlight);
+
+	pinfo->enabled = false;
+
+	return 0;
+}
+
+static int panel_unprepare(struct drm_panel *panel)
+{
+	struct panel_info *pinfo = to_panel_info(panel);
+	int err;
+
+	if (!pinfo->prepared)
+		return 0;
+
+	err = write_cmds(pinfo->link, pinfo->off_cmds);
+	if (err < 0) {
+		dev_err(panel->dev,
+				"failed to send DCS Off Code: %d\n", err);
+		return err;
+	}
+
+	usleep_range(1000, 1000);
+	gpiod_set_value_cansleep(pinfo->reset_gpio, 0);
+	gpiod_set_value_cansleep(pinfo->pp33000_gpio, 0);
+	gpiod_set_value_cansleep(pinfo->pp18000_gpio, 0);
+
+	pinfo->prepared = false;
+
+	return 0;
+}
+
+static int panel_prepare(struct drm_panel *panel)
+{
+	struct panel_info *pinfo = to_panel_info(panel);
+	int err, i;
+
+	if (pinfo->prepared)
+		return 0;
+
+	gpiod_set_value_cansleep(pinfo->pp18000_gpio, 1);
+	gpiod_set_value_cansleep(pinfo->pp33000_gpio, 1);
+
+	/* reset sequence */
+	for (i = 0; i < pinfo->rst_seq_len; ++i) {
+		gpiod_set_value_cansleep(pinfo->reset_gpio, pinfo->rst_seq[i]);
+		if (pinfo->rst_seq[++i])
+			usleep_range(pinfo->rst_seq[i] * 1000,
+						pinfo->rst_seq[i] * 1000);
+	}
+
+	/* send init code */
+	err = write_cmds(pinfo->link, pinfo->on_cmds);
+	if (err < 0) {
+		dev_err(panel->dev,
+				"failed to send DCS Init Code: %d\n", err);
+		goto poweroff;
+	}
+
+	pinfo->prepared = true;
+
+	return 0;
+
+poweroff:
+	gpiod_set_value_cansleep(pinfo->reset_gpio, 0);
+	gpiod_set_value_cansleep(pinfo->pp33000_gpio, 0);
+	gpiod_set_value_cansleep(pinfo->pp18000_gpio, 0);
+	return err;
+}
+
+static int panel_enable(struct drm_panel *panel)
+{
+	struct panel_info *pinfo = to_panel_info(panel);
+	int ret;
+
+	if (pinfo->enabled)
+		return 0;
+
+	ret = backlight_enable(pinfo->backlight);
+	if (ret) {
+		DRM_DEV_ERROR(panel->drm->dev,
+			      "Failed to enable backlight %d\n", ret);
+		return ret;
+	}
+
+	pinfo->enabled = true;
+
+	return 0;
+}
+
+static int panel_get_modes(struct drm_panel *panel)
+{
+	struct panel_info *pinfo = to_panel_info(panel);
+	struct drm_display_mode *mode;
+
+	if (!pinfo->panel_display_mode) {
+		pr_err("Get panel_display_mode fail!\n");
+		return -1;
+	}
+
+	mode = drm_mode_duplicate(panel->drm, pinfo->panel_display_mode);
+	if (!mode) {
+		pr_err("failed to add mode\n");
+		return -ENOMEM;
+	}
+
+	drm_mode_set_name(mode);
+
+	drm_mode_probed_add(panel->connector, mode);
+
+	panel->connector->display_info.width_mm = pinfo->panel_width_mm;
+	panel->connector->display_info.height_mm = pinfo->panel_height_mm;
+	panel->connector->display_info.bpc = pinfo->per_color_channel;
+
+	return 1;
+}
+
+static const struct drm_panel_funcs panel_funcs = {
+	.disable = panel_disable,
+	.unprepare = panel_unprepare,
+	.prepare = panel_prepare,
+	.enable = panel_enable,
+	.get_modes = panel_get_modes,
+};
+
+static const struct of_device_id panel_of_match[] = {
+	{ .compatible = "boe,himax8279d", },
+	{ }
+};
+MODULE_DEVICE_TABLE(of, panel_of_match);
+
+static int panel_add(struct panel_info *pinfo)
+{
+	struct device *dev = &pinfo->link->dev;
+	struct device_node *np;
+	int err;
+
+	pinfo->pp33000_gpio = devm_gpiod_get_optional(dev,
+							"pp33000",
+							GPIOD_OUT_HIGH);
+	if (IS_ERR(pinfo->pp33000_gpio)) {
+		err = PTR_ERR(pinfo->pp33000_gpio);
+		dev_err(dev, "failed to get pp33000 gpio: %d\n", err);
+		pinfo->pp33000_gpio = NULL;
+	}
+
+	pinfo->pp18000_gpio = devm_gpiod_get_optional(dev,
+							"pp18000",
+							GPIOD_OUT_HIGH);
+	if (IS_ERR(pinfo->pp18000_gpio)) {
+		err = PTR_ERR(pinfo->pp18000_gpio);
+		dev_err(dev, "failed to get pp18000 gpio: %d\n", err);
+		pinfo->pp18000_gpio = NULL;
+	}
+
+	pinfo->reset_gpio = devm_gpiod_get_optional(dev, "enable",
+							GPIOD_OUT_HIGH);
+	if (IS_ERR(pinfo->reset_gpio)) {
+		err = PTR_ERR(pinfo->reset_gpio);
+		dev_err(dev, "failed to get enable gpio: %d\n", err);
+		pinfo->reset_gpio = NULL;
+	}
+
+	np = of_parse_phandle(dev->of_node, "backlight", 0);
+	if (np) {
+		pinfo->backlight = of_find_backlight_by_node(np);
+		of_node_put(np);
+
+		if (!pinfo->backlight)
+			return -EPROBE_DEFER;
+	}
+
+	drm_panel_init(&pinfo->base);
+	pinfo->base.funcs = &panel_funcs;
+	pinfo->base.dev = &pinfo->link->dev;
+
+	err = drm_panel_add(&pinfo->base);
+	if (err < 0)
+		goto put_backlight;
+
+	return 0;
+
+put_backlight:
+	put_device(&pinfo->backlight->dev);
+
+	return err;
+}
+
+static void panel_del(struct panel_info *pinfo)
+{
+	if (pinfo->base.dev)
+		drm_panel_remove(&pinfo->base);
+
+	put_device(&pinfo->backlight->dev);
+}
+
+static int panel_probe(struct mipi_dsi_device *dsi)
+{
+	struct panel_info *pinfo;
+	int err;
+
+	pinfo = devm_kzalloc(&dsi->dev, sizeof(*pinfo), GFP_KERNEL);
+	if (!pinfo)
+		return -ENOMEM;
+
+	pinfo->link = dsi;
+	panel_parse_dt(pinfo);
+	mipi_dsi_set_drvdata(dsi, pinfo);
+
+	err = panel_add(pinfo);
+	if (err < 0)
+		return err;
+
+	return mipi_dsi_attach(dsi);
+}
+
+static int panel_remove(struct mipi_dsi_device *dsi)
+{
+	struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi);
+	int err;
+
+	err = panel_unprepare(&pinfo->base);
+	if (err < 0)
+		DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
+			      err);
+
+	err = panel_disable(&pinfo->base);
+	if (err < 0)
+		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", err);
+
+	err = mipi_dsi_detach(dsi);
+	if (err < 0)
+		DRM_DEV_ERROR(&dsi->dev, "failed to detach from DSI host: %d\n",
+			      err);
+
+	drm_panel_detach(&pinfo->base);
+	panel_del(pinfo);
+
+	return 0;
+}
+
+static void panel_shutdown(struct mipi_dsi_device *dsi)
+{
+	struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi);
+
+	panel_unprepare(&pinfo->base);
+	panel_disable(&pinfo->base);
+}
+
+static struct mipi_dsi_driver panel_driver = {
+	.driver = {
+		.name = "panel-innolux-ota7290b",
+		.of_match_table = panel_of_match,
+	},
+	.probe = panel_probe,
+	.remove = panel_remove,
+	.shutdown = panel_shutdown,
+};
+module_mipi_dsi_driver(panel_driver);
+
+MODULE_AUTHOR("Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>");
+MODULE_DESCRIPTION("Boe Himax8279d driver");
+MODULE_LICENSE("GPL v2");
-- 
2.17.1

From 83df88e9a3791abb0ed500a2678d29016dec73ef Mon Sep 17 00:00:00 2001
From: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Aug 2019 16:01:07 +0800
Subject: [PATCH 04/10] [v4,2/2] drm/panel: Add Boe Himax8279d MIPI-DSI LCD
 panel

Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

V4:
- Frefix all function maes with boe_ (Sam)
- Fsed "enable_gpio" replace "reset_gpio", Make it look clearer (Sam)
- Sort include lines alphabetically (Sam)
- Fixed entries in the makefile must be sorted alphabetically (Sam)
- Add send_mipi_cmds function to avoid duplicating the code (Sam)
- Add the necessary delay(reset_delay_t5) between reset and sending
    the initialization command (Rock wang)

V3:
- Remove unnecessary delays in sending initialization commands (Jitao Shi)

V2:
- Use SPDX identifier (Sam)
- Use necessary header files replace drmP.h (Sam)
- Delete unnecessary header files #include <linux/err.h> (Sam)
- Specifies a GPIOs array to control the reset timing,
    instead of reading "dsi-reset-sequence" data from DTS (Sam)
- Delete backlight_disable() function when already disabled (Sam)
- Use devm_of_find_backlight() replace of_find_backlight_by_node() (Sam)
- Move the necessary data in the DTS to the current file,
    like porch, display_mode and Init code etc. (Sam)
- Add compatible device "boe,himax8279d10p" (Sam)

V1:
- Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
    panel.

Signed-off-by: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx>
Cc: Derek Basehore <dbasehore@xxxxxxxxxxxx>
Cc: Rock wang <rock_wang@xxxxxxxxxxxx>
---
 MAINTAINERS                                  |  12 +-
 drivers/gpu/drm/panel/Kconfig                |  22 +-
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 201 +++++++++----------
 3 files changed, 114 insertions(+), 121 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index 787575705ed4..942068a63ef4 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -5083,6 +5083,12 @@ T:	git git://anongit.freedesktop.org/drm/drm-misc
 S:	Maintained
 F:	drivers/gpu/drm/bochs/
 
+DRM DRIVER FOR BOE HIMAX8279D PANELS
+M:	Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
+S:	Maintained
+F:	drivers/gpu/drm/panel/panel-boe-himax8279d.c
+F:	Documentation/devicetree/bindings/display/panel/boe,himax8279d.txt
+
 DRM DRIVER FOR FARADAY TVE200 TV ENCODER
 M:	Linus Walleij <linus.walleij@xxxxxxxxxx>
 T:	git git://anongit.freedesktop.org/drm/drm-misc
@@ -5108,12 +5114,6 @@ S:	Maintained
 F:	drivers/gpu/drm/tiny/ili9225.c
 F:	Documentation/devicetree/bindings/display/ilitek,ili9225.txt
 
-DRM DRIVER FOR BOE HIMAX8279D PANELS
-M:	Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
-S:	Maintained
-F:	drivers/gpu/drm/panel/panel-boe-himax8279d.c
-F:	Documentation/devicetree/bindings/display/panel/boe,himax8279d.txt
-
 DRM DRIVER FOR HX8357D PANELS
 M:	Eric Anholt <eric@xxxxxxxxxx>
 T:	git git://anongit.freedesktop.org/drm/drm-misc
diff --git a/drivers/gpu/drm/panel/Kconfig b/drivers/gpu/drm/panel/Kconfig
index e8b060b1b59b..257094a16a7d 100644
--- a/drivers/gpu/drm/panel/Kconfig
+++ b/drivers/gpu/drm/panel/Kconfig
@@ -18,6 +18,17 @@ config DRM_PANEL_ARM_VERSATILE
 	  reference designs. The panel is detected using special registers
 	  in the Versatile family syscon registers.
 
+config DRM_PANEL_BOE_HIMAX8279D
+	tristate "Boe Himax8279d panel"
+	depends on OF
+	depends on DRM_MIPI_DSI
+	depends on BACKLIGHT_CLASS_DEVICE
+	help
+	  Say Y here if you want to enable support for Boe Himax8279d
+	  TFT-LCD modules. The panel has a 1200x1920 resolution and uses
+	  24 bit RGB per pixel. It provides a MIPI DSI interface to
+	  the host and has a built-in LED backlight.
+
 config DRM_PANEL_LVDS
 	tristate "Generic LVDS panel driver"
 	depends on OF
@@ -293,17 +304,6 @@ config DRM_PANEL_SITRONIX_ST7789V
 	  Say Y here if you want to enable support for the Sitronix
 	  ST7789V controller for 240x320 LCD panels
 
-config DRM_PANEL_BOE_HIMAX8279D
-	tristate "Boe Himax8279d panel"
-	depends on OF
-	depends on DRM_MIPI_DSI
-	depends on BACKLIGHT_CLASS_DEVICE
-	help
-	  Say Y here if you want to enable support for Same type
-	  TFT-LCD modules. The panel has a 1200x1920 resolution and uses
-	  24 bit RGB per pixel. It provides a MIPI DSI interface to
-	  the host and has a built-in LED backlight.
-
 config DRM_PANEL_TPO_TPG110
 	tristate "TPO TPG 800x400 panel"
 	depends on OF && SPI && GPIOLIB
diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 60f5f8bf2e14..aa7d91279819 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -17,10 +17,10 @@
 #include <linux/gpio/consumer.h>
 #include <linux/regulator/consumer.h>
 
-#include <drm/drm_modes.h>
+#include <drm/drm_device.h>
 #include <drm/drm_mipi_dsi.h>
+#include <drm/drm_modes.h>
 #include <drm/drm_panel.h>
-#include <drm/drm_device.h>
 #include <drm/drm_print.h>
 
 #include <video/mipi_display.h>
@@ -37,15 +37,16 @@ struct panel_cmd {
 struct panel_desc {
 	const struct drm_display_mode *display_mode;
 	unsigned int bpc;
-	unsigned int width;
-	unsigned int height;
+	unsigned int width_mm;
+	unsigned int height_mm;
 
 	unsigned int delay_t1;
 	unsigned int reset_delay_t2;
 	unsigned int reset_delay_t3;
 	unsigned int reset_delay_t4;
+	unsigned int reset_delay_t5;
 
-	unsigned long flags;
+	unsigned long mode_flags;
 	enum mipi_dsi_pixel_format format;
 	unsigned int lanes;
 	const struct panel_cmd *on_cmds;
@@ -58,7 +59,7 @@ struct panel_info {
 	const struct panel_desc *desc;
 
 	struct backlight_device *backlight;
-	struct gpio_desc *reset_gpio;
+	struct gpio_desc *enable_gpio;
 	struct gpio_desc *pp33_gpio;
 	struct gpio_desc *pp18_gpio;
 
@@ -66,19 +67,49 @@ struct panel_info {
 	bool enabled;
 };
 
+static inline struct panel_info *to_panel_info(struct drm_panel *panel)
+{
+	return container_of(panel, struct panel_info, base);
+}
+
 void set_gpios(struct panel_info *pinfo, int enable)
 {
-	gpiod_set_value(pinfo->reset_gpio, enable);
+	gpiod_set_value(pinfo->enable_gpio, enable);
 	gpiod_set_value(pinfo->pp33_gpio, enable);
 	gpiod_set_value(pinfo->pp18_gpio, enable);
 }
 
-static inline struct panel_info *to_panel_info(struct drm_panel *panel)
+static int send_mipi_cmds(struct drm_panel *panel, const struct panel_cmd *cmds)
 {
-	return container_of(panel, struct panel_info, base);
+	struct panel_info *pinfo = to_panel_info(panel);
+	unsigned int i = 0;
+	int err;
+
+	if (!cmds)
+		return -EFAULT;
+
+	for (i = 0; cmds[i].len != 0; i++) {
+		const struct panel_cmd *cmd = &cmds[i];
+
+		if (cmd->len == 2)
+			err = mipi_dsi_dcs_write(pinfo->link,
+						    cmd->data[1], NULL, 0);
+		else
+			err = mipi_dsi_dcs_write(pinfo->link,
+						    cmd->data[1], cmd->data + 2,
+						    cmd->len - 2);
+
+		if (err < 0)
+			return err;
+
+		usleep_range((cmd->data[0]) * 1000,
+			    (1 + cmd->data[0]) * 1000);
+	}
+
+	return 0;
 }
 
-static int panel_disable(struct drm_panel *panel)
+static int boe_panel_disable(struct drm_panel *panel)
 {
 	struct panel_info *pinfo = to_panel_info(panel);
 
@@ -89,7 +120,7 @@ static int panel_disable(struct drm_panel *panel)
 	return 0;
 }
 
-static int panel_unprepare(struct drm_panel *panel)
+static int boe_panel_unprepare(struct drm_panel *panel)
 {
 	struct panel_info *pinfo = to_panel_info(panel);
 	int err;
@@ -98,34 +129,14 @@ static int panel_unprepare(struct drm_panel *panel)
 		return 0;
 
 	/* send off code */
-	if (pinfo->desc->off_cmds) {
-		const struct panel_cmd *cmds = pinfo->desc->off_cmds;
-		unsigned int i;
-
-		for (i = 0; cmds[i].len != 0; i++) {
-			const struct panel_cmd *cmd = &cmds[i];
-
-			if (cmd->len == 2)
-				err = mipi_dsi_dcs_write(pinfo->link,
-					    cmd->data[1], NULL, 0);
-			else
-				err = mipi_dsi_dcs_write(pinfo->link,
-					    cmd->data[1], cmd->data + 2,
-					    cmd->len - 2);
-
-			if (err < 0) {
-				dev_err(panel->dev,
-					"failed to send DCS Off Code: %d\n",
-					err);
-				goto poweroff;
-			}
-			if (cmd->data[0])
-				usleep_range((cmd->data[0]) * 1000,
-					    (1 + cmd->data[0]) * 1000);
-		}
+	err = send_mipi_cmds(panel, pinfo->desc->off_cmds);
+	if (err < 0) {
+		dev_err(panel->dev,
+			"failed to send DCS Off Code: %d\n",
+			err);
+		goto poweroff;
 	}
 
-	usleep_range(1000, 1000);
 	set_gpios(pinfo, 0);
 
 	pinfo->prepared = false;
@@ -137,7 +148,7 @@ static int panel_unprepare(struct drm_panel *panel)
 	return err;
 }
 
-static int panel_prepare(struct drm_panel *panel)
+static int boe_panel_prepare(struct drm_panel *panel)
 {
 	struct panel_info *pinfo = to_panel_info(panel);
 	const struct panel_desc *desc = pinfo->desc;
@@ -152,47 +163,27 @@ static int panel_prepare(struct drm_panel *panel)
 	gpiod_set_value(pinfo->pp33_gpio, 1);
 
 	/* reset sequence */
-	// T2 (> 14ms)
 	usleep_range(desc->reset_delay_t2, 1000 + desc->reset_delay_t2);
 
-	// T3 (>= 0ms)
 	if (desc->reset_delay_t3) {
-		gpiod_set_value(pinfo->reset_gpio, 1);
+		gpiod_set_value(pinfo->enable_gpio, 1);
 		usleep_range(desc->reset_delay_t3, 1000 + desc->reset_delay_t3);
-		gpiod_set_value(pinfo->reset_gpio, 0);
+		gpiod_set_value(pinfo->enable_gpio, 0);
 	}
 
-	// T4 (> 20us)
 	usleep_range(desc->reset_delay_t4, 1000 + desc->reset_delay_t4);
-	gpiod_set_value(pinfo->reset_gpio, 1);
+	gpiod_set_value(pinfo->enable_gpio, 1);
+
+	if (desc->reset_delay_t5)
+		usleep_range(desc->reset_delay_t5, 1000 + desc->reset_delay_t5);
 
 	/* send init code */
-	if (pinfo->desc->on_cmds) {
-		const struct panel_cmd *cmds = pinfo->desc->on_cmds;
-		unsigned int i;
-
-		for (i = 0; cmds[i].len != 0; i++) {
-			const struct panel_cmd *cmd = &cmds[i];
-
-			if (cmd->len == 2)
-				err = mipi_dsi_dcs_write(pinfo->link,
-					    cmd->data[1], NULL, 0);
-			else
-				err = mipi_dsi_dcs_write(pinfo->link,
-					    cmd->data[1], cmd->data + 2,
-					    cmd->len - 2);
-
-			if (err < 0) {
-				dev_err(panel->dev,
-					"failed to send DCS Init Code: %d\n",
-					err);
-				goto poweroff;
-			}
-
-			if (cmd->data[0])
-				usleep_range(cmd->data[0] * 1000,
-					    (1 + cmd->data[0]) * 1000);
-		}
+	err = send_mipi_cmds(panel, pinfo->desc->on_cmds);
+	if (err < 0) {
+		dev_err(panel->dev,
+			"failed to send DCS Init Code: %d\n",
+			err);
+		goto poweroff;
 	}
 
 	pinfo->prepared = true;
@@ -204,7 +195,7 @@ static int panel_prepare(struct drm_panel *panel)
 	return err;
 }
 
-static int panel_enable(struct drm_panel *panel)
+static int boe_panel_enable(struct drm_panel *panel)
 {
 	struct panel_info *pinfo = to_panel_info(panel);
 	int ret;
@@ -224,7 +215,7 @@ static int panel_enable(struct drm_panel *panel)
 	return 0;
 }
 
-static int panel_get_modes(struct drm_panel *panel)
+static int boe_panel_get_modes(struct drm_panel *panel)
 {
 	struct panel_info *pinfo = to_panel_info(panel);
 	const struct drm_display_mode *m = pinfo->desc->display_mode;
@@ -232,7 +223,7 @@ static int panel_get_modes(struct drm_panel *panel)
 
 	mode = drm_mode_duplicate(panel->drm, m);
 	if (!mode) {
-		DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%ux@%u\n",
+		DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%u@%u\n",
 				m->hdisplay, m->vdisplay, m->vrefresh);
 		return -ENOMEM;
 	}
@@ -241,19 +232,19 @@ static int panel_get_modes(struct drm_panel *panel)
 
 	drm_mode_probed_add(panel->connector, mode);
 
-	panel->connector->display_info.width_mm = pinfo->desc->width;
-	panel->connector->display_info.height_mm = pinfo->desc->height;
+	panel->connector->display_info.width_mm = pinfo->desc->width_mm;
+	panel->connector->display_info.height_mm = pinfo->desc->height_mm;
 	panel->connector->display_info.bpc = pinfo->desc->bpc;
 
 	return 1;
 }
 
 static const struct drm_panel_funcs panel_funcs = {
-	.disable = panel_disable,
-	.unprepare = panel_unprepare,
-	.prepare = panel_prepare,
-	.enable = panel_enable,
-	.get_modes = panel_get_modes,
+	.disable = boe_panel_disable,
+	.unprepare = boe_panel_unprepare,
+	.prepare = boe_panel_prepare,
+	.enable = boe_panel_enable,
+	.get_modes = boe_panel_get_modes,
 };
 
 /* 8 inch */
@@ -579,7 +570,7 @@ static const struct panel_cmd boe_himax8279d8p_on_cmds[] = {
 
 static const struct panel_cmd boe_himax8279d8p_off_cmds[] = {
 	_INIT_CMD(0x00, 0x28),
-	_INIT_CMD(0x00, 0x10),
+	_INIT_CMD(0x01, 0x10),
 
 	{},
 };
@@ -587,14 +578,15 @@ static const struct panel_cmd boe_himax8279d8p_off_cmds[] = {
 static const struct panel_desc boe_himax8279d8p_panel_desc = {
 	.display_mode = &boe_himax8279d8p_display_mode,
 	.bpc = 8,
-	.width = 107,
-	.height = 172,
+	.width_mm = 107,
+	.height_mm = 172,
 	.delay_t1 = 5000,
 	.reset_delay_t2 = 14000,
 	.reset_delay_t3 = 1000,
 	.reset_delay_t4 = 1000,
-	.flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
-		    MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM,
+	.reset_delay_t5 = 5000,
+	.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+			MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM,
 	.format = MIPI_DSI_FMT_RGB888,
 	.lanes = 4,
 	.on_cmds = boe_himax8279d8p_on_cmds,
@@ -921,7 +913,7 @@ static const struct panel_cmd boe_himax8279d10p_on_cmds[] = {
 
 static const struct panel_cmd boe_himax8279d10p_off_cmds[] = {
 	_INIT_CMD(0x00, 0x28),
-	_INIT_CMD(0x00, 0x10),
+	_INIT_CMD(0x01, 0x10),
 
 	{},
 };
@@ -929,14 +921,15 @@ static const struct panel_cmd boe_himax8279d10p_off_cmds[] = {
 static const struct panel_desc boe_himax8279d10p_panel_desc = {
 	.display_mode = &boe_himax8279d10p_display_mode,
 	.bpc = 8,
-	.width = 135,
-	.height = 216,
+	.width_mm = 135,
+	.height_mm = 216,
 	.delay_t1 = 5000,
 	.reset_delay_t2 = 14000,
 	.reset_delay_t3 = 1000,
 	.reset_delay_t4 = 1000,
-	.flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
-		    MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM,
+	.reset_delay_t5 = 5000,
+	.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
+			MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM,
 	.format = MIPI_DSI_FMT_RGB888,
 	.lanes = 4,
 	.on_cmds = boe_himax8279d10p_on_cmds,
@@ -946,11 +939,11 @@ static const struct panel_desc boe_himax8279d10p_panel_desc = {
 static const struct of_device_id panel_of_match[] = {
 	{ .compatible = "boe,himax8279d8p",
 	  .data = &boe_himax8279d8p_panel_desc
-	},
-	{ .compatible = "boe,himax8279d10p",
+	}, { .compatible = "boe,himax8279d10p",
 	  .data = &boe_himax8279d10p_panel_desc
-	},
-	{ }
+	}, {
+		/* sentinel */
+	}
 };
 MODULE_DEVICE_TABLE(of, panel_of_match);
 
@@ -973,12 +966,12 @@ static int panel_add(struct panel_info *pinfo)
 		pinfo->pp33_gpio = NULL;
 	}
 
-	pinfo->reset_gpio = devm_gpiod_get_optional(dev, "enable",
+	pinfo->enable_gpio = devm_gpiod_get_optional(dev, "enable",
 						    GPIOD_OUT_LOW);
-	if (IS_ERR(pinfo->reset_gpio)) {
-		err = PTR_ERR(pinfo->reset_gpio);
+	if (IS_ERR(pinfo->enable_gpio)) {
+		err = PTR_ERR(pinfo->enable_gpio);
 		dev_err(dev, "failed to get enable gpio: %d\n", err);
-		pinfo->reset_gpio = NULL;
+		pinfo->enable_gpio = NULL;
 	}
 
 	pinfo->backlight = devm_of_find_backlight(dev);
@@ -1005,15 +998,15 @@ static void panel_del(struct panel_info *pinfo)
 static int panel_probe(struct mipi_dsi_device *dsi)
 {
 	struct panel_info *pinfo;
-	int err;
 	const struct panel_desc *desc;
+	int err;
 
 	pinfo = devm_kzalloc(&dsi->dev, sizeof(*pinfo), GFP_KERNEL);
 	if (!pinfo)
 		return -ENOMEM;
 
 	desc = of_device_get_match_data(&dsi->dev);
-	dsi->mode_flags = desc->flags;
+	dsi->mode_flags = desc->mode_flags;
 	dsi->format = desc->format;
 	dsi->lanes = desc->lanes;
 	pinfo->desc = desc;
@@ -1033,12 +1026,12 @@ static int panel_remove(struct mipi_dsi_device *dsi)
 	struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi);
 	int err;
 
-	err = panel_unprepare(&pinfo->base);
+	err = boe_panel_unprepare(&pinfo->base);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
 						err);
 
-	err = panel_disable(&pinfo->base);
+	err = boe_panel_disable(&pinfo->base);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", err);
 
@@ -1057,8 +1050,8 @@ static void panel_shutdown(struct mipi_dsi_device *dsi)
 {
 	struct panel_info *pinfo = mipi_dsi_get_drvdata(dsi);
 
-	panel_disable(&pinfo->base);
-	panel_unprepare(&pinfo->base);
+	boe_panel_disable(&pinfo->base);
+	boe_panel_unprepare(&pinfo->base);
 }
 
 static struct mipi_dsi_driver panel_driver = {
-- 
2.17.1

From 124d8eeee02854a3b9d6fba9d6a5ceed6d6f820f Mon Sep 17 00:00:00 2001
From: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Aug 2019 16:06:22 +0800
Subject: [PATCH 05/10] [v5,2/2] drm/panel: Add Boe Himax8279d MIPI-DSI LCD
 panel

Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

v5:
- Added changelog

v4:
- Frefix all function maes with boe_ (Sam)
- Fsed "enable_gpio" replace "reset_gpio", Make it look clearer (Sam)
- Sort include lines alphabetically (Sam)
- Fixed entries in the makefile must be sorted alphabetically (Sam)
- Add send_mipi_cmds function to avoid duplicating the code (Sam)
- Add the necessary delay(reset_delay_t5) between reset and sending
    the initialization command (Rock wang)

v3:
- Remove unnecessary delays in sending initialization commands (Jitao Shi)

V2:
- Use SPDX identifier (Sam)
- Use necessary header files replace drmP.h (Sam)
- Delete unnecessary header files #include <linux/err.h> (Sam)
- Specifies a GPIOs array to control the reset timing,
    instead of reading "dsi-reset-sequence" data from DTS (Sam)
- Delete backlight_disable() function when already disabled (Sam)
- Use devm_of_find_backlight() replace of_find_backlight_by_node() (Sam)
- Move the necessary data in the DTS to the current file,
    like porch, display_mode and Init code etc. (Sam)
- Add compatible device "boe,himax8279d10p" (Sam)

V1:
- Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
    panel.

Signed-off-by: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx>
Cc: Derek Basehore <dbasehore@xxxxxxxxxxxx>
Cc: Rock wang <rock_wang@xxxxxxxxxxxx>
-- 
2.17.1

From 02bb39b6fc07783700150d2b9ae567410754cd47 Mon Sep 17 00:00:00 2001
From: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Aug 2019 16:11:33 +0800
Subject: [PATCH 06/10] [v6,2/2] drm/panel: Add Boe Himax8279d MIPI-DSI LCD
 panel

Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

V6:
- Add the information of the reviewer (Sam)
- Delete unnecessary header files #include <linux/fb.h> (Sam)
- The config DRM_PANEL_BOE_HIMAX8279D appears twice. Drop one of
    them (Sam)
- ADD static, set_gpios function is not used outside this module
    (Sam)

V5:
- Added changelog

V4:
- Frefix all function maes with boe_ (Sam)
- Fsed "enable_gpio" replace "reset_gpio", Make it look clearer (Sam)
- Sort include lines alphabetically (Sam)
- Fixed entries in the makefile must be sorted alphabetically (Sam)
- Add send_mipi_cmds function to avoid duplicating the code (Sam)
- Add the necessary delay(reset_delay_t5) between reset and sending
    the initialization command (Rock wang)

V3:
- Remove unnecessary delays in sending initialization commands (Jitao Shi)

V2:
- Use SPDX identifier (Sam)
- Use necessary header files replace drmP.h (Sam)
- Delete unnecessary header files #include <linux/err.h> (Sam)
- Specifies a GPIOs array to control the reset timing,
    instead of reading "dsi-reset-sequence" data from DTS (Sam)
- Delete backlight_disable() function when already disabled (Sam)
- Use devm_of_find_backlight() replace of_find_backlight_by_node() (Sam)
- Move the necessary data in the DTS to the current file,
    like porch, display_mode and Init code etc. (Sam)
- Add compatible device "boe,himax8279d10p" (Sam)

V1:
- Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
    panel.

Signed-off-by: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx>
Cc: Derek Basehore <dbasehore@xxxxxxxxxxxx>
Cc: Rock wang <rock_wang@xxxxxxxxxxxx>
---
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index aa7d91279819..c050a48487a2 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -8,7 +8,6 @@
 
 #include <linux/backlight.h>
 #include <linux/delay.h>
-#include <linux/fb.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/of.h>
@@ -72,7 +71,7 @@ static inline struct panel_info *to_panel_info(struct drm_panel *panel)
 	return container_of(panel, struct panel_info, base);
 }
 
-void set_gpios(struct panel_info *pinfo, int enable)
+static void set_gpios(struct panel_info *pinfo, int enable)
 {
 	gpiod_set_value(pinfo->enable_gpio, enable);
 	gpiod_set_value(pinfo->pp33_gpio, enable);
-- 
2.17.1

From 68e57c46f95a4ffba816f29626ad9702b545afeb Mon Sep 17 00:00:00 2001
From: Jerry Han <jerry.han.hq@xxxxxxxxx>
Date: Thu, 1 Aug 2019 16:20:29 +0800
Subject: [PATCH 08/10] [v8,2/2] drm/panel: Add Boe Himax8279d MIPI-DSI LCD
 panel

Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

V8:
- Modify communication address

V7:
- Add the information of the reviewer
- Remove unnecessary delays, The udelay_range code gracefully returns
    without hitting the scheduler on a delay of 0. (Derek)
- Merge the same data structures, like display_mode and off_cmds (Derek)
- Optimize the processing of results returned by
    devm_gpiod_get_optional (Derek)

V6:
- Add the information of the reviewer (Sam)
- Delete unnecessary header files #include <linux/fb.h> (Sam)
- The config DRM_PANEL_BOE_HIMAX8279D appears twice. Drop one of them (Sam)
- ADD static, set_gpios function is not used outside this module (Sam)

V5:
- Added changelog

V4:
- Frefix all function maes with boe_ (Sam)
- Fsed "enable_gpio" replace "reset_gpio", Make it look clearer (Sam)
- Sort include lines alphabetically (Sam)
- Fixed entries in the makefile must be sorted alphabetically (Sam)
- Add send_mipi_cmds function to avoid duplicating the code (Sam)
- Add the necessary delay(reset_delay_t5) between reset and sending
    the initialization command (Rock wang)

V3:
- Remove unnecessary delays in sending initialization commands (Jitao Shi)

V2:
- Use SPDX identifier (Sam)
- Use necessary header files replace drmP.h (Sam)
- Delete unnecessary header files #include <linux/err.h> (Sam)
- Specifies a GPIOs array to control the reset timing,
    instead of reading "dsi-reset-sequence" data from DTS (Sam)
- Delete backlight_disable() function when already disabled (Sam)
- Use devm_of_find_backlight() replace of_find_backlight_by_node() (Sam)
- Move the necessary data in the DTS to the current file,
    like porch, display_mode and Init code etc. (Sam)
- Add compatible device "boe,himax8279d10p" (Sam)

V1:
- Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

Signed-off-by: Jerry Han <jerry.han.hq@xxxxxxxxx>
Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Reviewed-by: Derek Basehore <dbasehore@xxxxxxxxxxxx>
Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx>
Cc: Rock wang <rock_wang@xxxxxxxxxxxx>
---
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index ff5a89e38fd7..9c8ece4fa30a 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -2,7 +2,7 @@
 /*
  * Copyright (c) 2019, Huaqin Telecom Technology Co., Ltd
  *
- * Author: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
+ * Author: Jerry Han <jerry.han.hq@xxxxxxxxx>
  *
  */
 
@@ -1045,6 +1045,6 @@ static struct mipi_dsi_driver panel_driver = {
 };
 module_mipi_dsi_driver(panel_driver);
 
-MODULE_AUTHOR("Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>");
+MODULE_AUTHOR("Jerry Han <jerry.han.hq@xxxxxxxxx>");
 MODULE_DESCRIPTION("Boe Himax8279d driver");
 MODULE_LICENSE("GPL v2");
-- 
2.17.1

From a165956e0b0fb5a34815b4cc13747d92f90a33a0 Mon Sep 17 00:00:00 2001
From: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Thu, 1 Aug 2019 16:16:08 +0800
Subject: [PATCH 07/10] [v7,2/2] drm/panel: Add Boe Himax8279d MIPI-DSI LCD
 panel

Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

V7:
- Add the information of the reviewer
- Remove unnecessary delays, The udelay_range code gracefully returns
    without hitting the scheduler on a delay of 0. (Derek)
- Merge the same data structures, like display_mode and off_cmds (Derek)
- Optimize the processing of results returned by
    devm_gpiod_get_optional (Derek)

V6:
- Add the information of the reviewer (Sam)
- Delete unnecessary header files #include <linux/fb.h> (Sam)
- The config DRM_PANEL_BOE_HIMAX8279D appears twice. Drop one of them (Sam)
- ADD static, set_gpios function is not used outside this module (Sam)

V5:
- Added changelog

V4:
- Frefix all function maes with boe_ (Sam)
- Fsed "enable_gpio" replace "reset_gpio", Make it look clearer (Sam)
- Sort include lines alphabetically (Sam)
- Fixed entries in the makefile must be sorted alphabetically (Sam)
- Add send_mipi_cmds function to avoid duplicating the code (Sam)
- Add the necessary delay(reset_delay_t5) between reset and sending
    the initialization command (Rock wang)

V3:
- Remove unnecessary delays in sending initialization commands (Jitao Shi)

V2:
- Use SPDX identifier (Sam)
- Use necessary header files replace drmP.h (Sam)
- Delete unnecessary header files #include <linux/err.h> (Sam)
- Specifies a GPIOs array to control the reset timing,
    instead of reading "dsi-reset-sequence" data from DTS (Sam)
- Delete backlight_disable() function when already disabled (Sam)
- Use devm_of_find_backlight() replace of_find_backlight_by_node() (Sam)
- Move the necessary data in the DTS to the current file,
    like porch, display_mode and Init code etc. (Sam)
- Add compatible device "boe,himax8279d10p" (Sam)

V1:
- Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
    panel.

Signed-off-by: Jerry Han <hanxu5@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Reviewed-by: Derek Basehore <dbasehore@xxxxxxxxxxxx>
Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx>
Cc: Rock wang <rock_wang@xxxxxxxxxxxx>
---
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 109 ++++++++-----------
 1 file changed, 45 insertions(+), 64 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index c050a48487a2..ff5a89e38fd7 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -130,9 +130,8 @@ static int boe_panel_unprepare(struct drm_panel *panel)
 	/* send off code */
 	err = send_mipi_cmds(panel, pinfo->desc->off_cmds);
 	if (err < 0) {
-		dev_err(panel->dev,
-			"failed to send DCS Off Code: %d\n",
-			err);
+		DRM_DEV_ERROR(panel->dev,
+				"failed to send DCS Off Code: %d\n", err);
 		goto poweroff;
 	}
 
@@ -164,24 +163,20 @@ static int boe_panel_prepare(struct drm_panel *panel)
 	/* reset sequence */
 	usleep_range(desc->reset_delay_t2, 1000 + desc->reset_delay_t2);
 
-	if (desc->reset_delay_t3) {
-		gpiod_set_value(pinfo->enable_gpio, 1);
-		usleep_range(desc->reset_delay_t3, 1000 + desc->reset_delay_t3);
-		gpiod_set_value(pinfo->enable_gpio, 0);
-	}
+	gpiod_set_value(pinfo->enable_gpio, 1);
+	usleep_range(desc->reset_delay_t3, 1000 + desc->reset_delay_t3);
+	gpiod_set_value(pinfo->enable_gpio, 0);
 
 	usleep_range(desc->reset_delay_t4, 1000 + desc->reset_delay_t4);
 	gpiod_set_value(pinfo->enable_gpio, 1);
 
-	if (desc->reset_delay_t5)
-		usleep_range(desc->reset_delay_t5, 1000 + desc->reset_delay_t5);
+	usleep_range(desc->reset_delay_t5, 1000 + desc->reset_delay_t5);
 
 	/* send init code */
 	err = send_mipi_cmds(panel, pinfo->desc->on_cmds);
 	if (err < 0) {
-		dev_err(panel->dev,
-			"failed to send DCS Init Code: %d\n",
-			err);
+		DRM_DEV_ERROR(panel->dev,
+				"failed to send DCS Init Code: %d\n", err);
 		goto poweroff;
 	}
 
@@ -246,8 +241,7 @@ static const struct drm_panel_funcs panel_funcs = {
 	.get_modes = boe_panel_get_modes,
 };
 
-/* 8 inch */
-static const struct drm_display_mode boe_himax8279d8p_display_mode = {
+static const struct drm_display_mode default_display_mode = {
 	.clock = 159420,
 	.hdisplay = 1200,
 	.hsync_start = 1200 + 80,
@@ -260,6 +254,14 @@ static const struct drm_display_mode boe_himax8279d8p_display_mode = {
 	.vrefresh = 60,
 };
 
+static const struct panel_cmd default_off_cmds[] = {
+	_INIT_CMD(0x00, 0x28),
+	_INIT_CMD(0x01, 0x10),
+
+	{},
+};
+
+/* 8 inch */
 static const struct panel_cmd boe_himax8279d8p_on_cmds[] = {
 	_INIT_CMD(0x22, 0x10),
 	_INIT_CMD(0x00, 0xB0, 0x05),
@@ -567,15 +569,8 @@ static const struct panel_cmd boe_himax8279d8p_on_cmds[] = {
 	{},
 };
 
-static const struct panel_cmd boe_himax8279d8p_off_cmds[] = {
-	_INIT_CMD(0x00, 0x28),
-	_INIT_CMD(0x01, 0x10),
-
-	{},
-};
-
 static const struct panel_desc boe_himax8279d8p_panel_desc = {
-	.display_mode = &boe_himax8279d8p_display_mode,
+	.display_mode = &default_display_mode,
 	.bpc = 8,
 	.width_mm = 107,
 	.height_mm = 172,
@@ -589,23 +584,10 @@ static const struct panel_desc boe_himax8279d8p_panel_desc = {
 	.format = MIPI_DSI_FMT_RGB888,
 	.lanes = 4,
 	.on_cmds = boe_himax8279d8p_on_cmds,
-	.off_cmds = boe_himax8279d8p_off_cmds,
+	.off_cmds = default_off_cmds,
 };
 
 /* 10 inch */
-static const struct drm_display_mode boe_himax8279d10p_display_mode = {
-	.clock = 159420,
-	.hdisplay = 1200,
-	.hsync_start = 1200 + 80,
-	.hsync_end = 1200 + 80 + 60,
-	.htotal = 1200 + 80 + 60 + 24,
-	.vdisplay = 1920,
-	.vsync_start = 1920 + 10,
-	.vsync_end = 1920 + 10 + 14,
-	.vtotal = 1920 + 10 + 14 + 4,
-	.vrefresh = 60,
-};
-
 static const struct panel_cmd boe_himax8279d10p_on_cmds[] = {
 	_INIT_CMD(0x00, 0xB0, 0x05),
 	_INIT_CMD(0x00, 0xB1, 0xE5),
@@ -910,15 +892,8 @@ static const struct panel_cmd boe_himax8279d10p_on_cmds[] = {
 	{},
 };
 
-static const struct panel_cmd boe_himax8279d10p_off_cmds[] = {
-	_INIT_CMD(0x00, 0x28),
-	_INIT_CMD(0x01, 0x10),
-
-	{},
-};
-
 static const struct panel_desc boe_himax8279d10p_panel_desc = {
-	.display_mode = &boe_himax8279d10p_display_mode,
+	.display_mode = &default_display_mode,
 	.bpc = 8,
 	.width_mm = 135,
 	.height_mm = 216,
@@ -932,7 +907,7 @@ static const struct panel_desc boe_himax8279d10p_panel_desc = {
 	.format = MIPI_DSI_FMT_RGB888,
 	.lanes = 4,
 	.on_cmds = boe_himax8279d10p_on_cmds,
-	.off_cmds = boe_himax8279d10p_off_cmds,
+	.off_cmds = default_off_cmds,
 };
 
 static const struct of_device_id panel_of_match[] = {
@@ -949,28 +924,34 @@ MODULE_DEVICE_TABLE(of, panel_of_match);
 static int panel_add(struct panel_info *pinfo)
 {
 	struct device *dev = &pinfo->link->dev;
-	int err;
+	int ret;
 
-	pinfo->pp18_gpio = devm_gpiod_get_optional(dev, "pp18", GPIOD_OUT_LOW);
+	pinfo->pp18_gpio = devm_gpiod_get_optional(dev, "pp18", GPIOD_OUT_HIGH);
 	if (IS_ERR(pinfo->pp18_gpio)) {
-		err = PTR_ERR(pinfo->pp18_gpio);
-		dev_err(dev, "failed to get pp18 gpio: %d\n", err);
-		pinfo->pp18_gpio = NULL;
+		ret = PTR_ERR(pinfo->pp18_gpio);
+		if (ret != -EPROBE_DEFER)
+			DRM_DEV_ERROR(dev, "failed to get pp18 gpio: %d\n",
+					ret);
+		return ret;
 	}
 
-	pinfo->pp33_gpio = devm_gpiod_get_optional(dev, "pp33", GPIOD_OUT_LOW);
+	pinfo->pp33_gpio = devm_gpiod_get_optional(dev, "pp33", GPIOD_OUT_HIGH);
 	if (IS_ERR(pinfo->pp33_gpio)) {
-		err = PTR_ERR(pinfo->pp33_gpio);
-		dev_err(dev, "failed to get pp33 gpio: %d\n", err);
-		pinfo->pp33_gpio = NULL;
+		ret = PTR_ERR(pinfo->pp33_gpio);
+		if (ret != -EPROBE_DEFER)
+			DRM_DEV_ERROR(dev, "failed to get pp33 gpio: %d\n",
+					ret);
+		return ret;
 	}
 
 	pinfo->enable_gpio = devm_gpiod_get_optional(dev, "enable",
-						    GPIOD_OUT_LOW);
+							GPIOD_OUT_HIGH);
 	if (IS_ERR(pinfo->enable_gpio)) {
-		err = PTR_ERR(pinfo->enable_gpio);
-		dev_err(dev, "failed to get enable gpio: %d\n", err);
-		pinfo->enable_gpio = NULL;
+		ret = PTR_ERR(pinfo->enable_gpio);
+		if (ret != -EPROBE_DEFER)
+			DRM_DEV_ERROR(dev, "failed to get enable gpio: %d\n",
+					ret);
+		return ret;
 	}
 
 	pinfo->backlight = devm_of_find_backlight(dev);
@@ -981,9 +962,9 @@ static int panel_add(struct panel_info *pinfo)
 	pinfo->base.funcs = &panel_funcs;
 	pinfo->base.dev = &pinfo->link->dev;
 
-	err = drm_panel_add(&pinfo->base);
-	if (err < 0)
-		return err;
+	ret = drm_panel_add(&pinfo->base);
+	if (ret < 0)
+		return ret;
 
 	return 0;
 }
@@ -1028,7 +1009,7 @@ static int panel_remove(struct mipi_dsi_device *dsi)
 	err = boe_panel_unprepare(&pinfo->base);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
-						err);
+				err);
 
 	err = boe_panel_disable(&pinfo->base);
 	if (err < 0)
@@ -1037,7 +1018,7 @@ static int panel_remove(struct mipi_dsi_device *dsi)
 	err = mipi_dsi_detach(dsi);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to detach from DSI host: %d\n",
-					  err);
+				err);
 
 	drm_panel_detach(&pinfo->base);
 	panel_del(pinfo);
-- 
2.17.1

From b4e05d2bc71d1c874fbb098a90f4d46f662db58b Mon Sep 17 00:00:00 2001
From: Jerry Han <jerry.han.hq@xxxxxxxxx>
Date: Thu, 1 Aug 2019 16:27:06 +0800
Subject: [PATCH 09/10] [v9] drm/panel: Add Boe Himax8279d MIPI-DSI LCD panel

Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

V9:
- modify PARENTHESIS_ALIGNMENT format (Sam)
- use gpios are required API replace optional gpio API (Emil)

V8:
- Modify communication address

V7:
- Add the information of the reviewer
- Remove unnecessary delays, The udelay_range code gracefully returns
    without hitting the scheduler on a delay of 0. (Derek)
- Merge the same data structures, like display_mode and off_cmds (Derek)
- Optimize the processing of results returned by
    devm_gpiod_get_optional (Derek)

V6:
- Add the information of the reviewer (Sam)
- Delete unnecessary header files #include <linux/fb.h> (Sam)
- The config DRM_PANEL_BOE_HIMAX8279D appears twice. Drop one of them (Sam)
- ADD static, set_gpios function is not used outside this module (Sam)

V5:
- Added changelog

V4:
- Frefix all function maes with boe_ (Sam)
- Fsed "enable_gpio" replace "reset_gpio", Make it look clearer (Sam)
- Sort include lines alphabetically (Sam)
- Fixed entries in the makefile must be sorted alphabetically (Sam)
- Add send_mipi_cmds function to avoid duplicating the code (Sam)
- Add the necessary delay(reset_delay_t5) between reset and sending
    the initialization command (Rock wang)

V3:
- Remove unnecessary delays in sending initialization commands (Jitao Shi)

V2:
- Use SPDX identifier (Sam)
- Use necessary header files replace drmP.h (Sam)
- Delete unnecessary header files #include <linux/err.h> (Sam)
- Specifies a GPIOs array to control the reset timing,
    instead of reading "dsi-reset-sequence" data from DTS (Sam)
- Delete backlight_disable() function when already disabled (Sam)
- Use devm_of_find_backlight() replace of_find_backlight_by_node() (Sam)
- Move the necessary data in the DTS to the current file,
    like porch, display_mode and Init code etc. (Sam)
- Add compatible device "boe,himax8279d10p" (Sam)

V1:
- Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

Signed-off-by: Jerry Han <jerry.han.hq@xxxxxxxxx>
Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Reviewed-by: Derek Basehore <dbasehore@xxxxxxxxxxxx>
Reviewed-by: Emil Velikov <emil.l.velikov@xxxxxxxxx>
Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx>
---
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 45 ++++++++++----------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 9c8ece4fa30a..7790f76d3ce7 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -91,18 +91,17 @@ static int send_mipi_cmds(struct drm_panel *panel, const struct panel_cmd *cmds)
 		const struct panel_cmd *cmd = &cmds[i];
 
 		if (cmd->len == 2)
-			err = mipi_dsi_dcs_write(pinfo->link,
-						    cmd->data[1], NULL, 0);
+			err = mipi_dsi_dcs_write(pinfo->link, cmd->data[1],
+						 NULL, 0);
 		else
-			err = mipi_dsi_dcs_write(pinfo->link,
-						    cmd->data[1], cmd->data + 2,
-						    cmd->len - 2);
+			err = mipi_dsi_dcs_write(pinfo->link, cmd->data[1],
+						 cmd->data + 2,
+						 cmd->len - 2);
 
 		if (err < 0)
 			return err;
 
-		usleep_range((cmd->data[0]) * 1000,
-			    (1 + cmd->data[0]) * 1000);
+		usleep_range((cmd->data[0]) * 1000, (1 + cmd->data[0]) * 1000);
 	}
 
 	return 0;
@@ -130,8 +129,8 @@ static int boe_panel_unprepare(struct drm_panel *panel)
 	/* send off code */
 	err = send_mipi_cmds(panel, pinfo->desc->off_cmds);
 	if (err < 0) {
-		DRM_DEV_ERROR(panel->dev,
-				"failed to send DCS Off Code: %d\n", err);
+		DRM_DEV_ERROR(panel->dev, "failed to send DCS Off Code: %d\n",
+			      err);
 		goto poweroff;
 	}
 
@@ -175,8 +174,8 @@ static int boe_panel_prepare(struct drm_panel *panel)
 	/* send init code */
 	err = send_mipi_cmds(panel, pinfo->desc->on_cmds);
 	if (err < 0) {
-		DRM_DEV_ERROR(panel->dev,
-				"failed to send DCS Init Code: %d\n", err);
+		DRM_DEV_ERROR(panel->dev, "failed to send DCS Init Code: %d\n",
+			      err);
 		goto poweroff;
 	}
 
@@ -200,7 +199,7 @@ static int boe_panel_enable(struct drm_panel *panel)
 	ret = backlight_enable(pinfo->backlight);
 	if (ret) {
 		DRM_DEV_ERROR(panel->drm->dev,
-				"Failed to enable backlight %d\n", ret);
+			      "Failed to enable backlight %d\n", ret);
 		return ret;
 	}
 
@@ -218,7 +217,7 @@ static int boe_panel_get_modes(struct drm_panel *panel)
 	mode = drm_mode_duplicate(panel->drm, m);
 	if (!mode) {
 		DRM_DEV_ERROR(panel->drm->dev, "failed to add mode %ux%u@%u\n",
-				m->hdisplay, m->vdisplay, m->vrefresh);
+			      m->hdisplay, m->vdisplay, m->vrefresh);
 		return -ENOMEM;
 	}
 
@@ -926,31 +925,30 @@ static int panel_add(struct panel_info *pinfo)
 	struct device *dev = &pinfo->link->dev;
 	int ret;
 
-	pinfo->pp18_gpio = devm_gpiod_get_optional(dev, "pp18", GPIOD_OUT_HIGH);
+	pinfo->pp18_gpio = devm_gpiod_get(dev, "pp18", GPIOD_OUT_HIGH);
 	if (IS_ERR(pinfo->pp18_gpio)) {
 		ret = PTR_ERR(pinfo->pp18_gpio);
 		if (ret != -EPROBE_DEFER)
 			DRM_DEV_ERROR(dev, "failed to get pp18 gpio: %d\n",
-					ret);
+				      ret);
 		return ret;
 	}
 
-	pinfo->pp33_gpio = devm_gpiod_get_optional(dev, "pp33", GPIOD_OUT_HIGH);
+	pinfo->pp33_gpio = devm_gpiod_get(dev, "pp33", GPIOD_OUT_HIGH);
 	if (IS_ERR(pinfo->pp33_gpio)) {
 		ret = PTR_ERR(pinfo->pp33_gpio);
 		if (ret != -EPROBE_DEFER)
 			DRM_DEV_ERROR(dev, "failed to get pp33 gpio: %d\n",
-					ret);
+				      ret);
 		return ret;
 	}
 
-	pinfo->enable_gpio = devm_gpiod_get_optional(dev, "enable",
-							GPIOD_OUT_HIGH);
+	pinfo->enable_gpio = devm_gpiod_get(dev, "enable", GPIOD_OUT_HIGH);
 	if (IS_ERR(pinfo->enable_gpio)) {
 		ret = PTR_ERR(pinfo->enable_gpio);
 		if (ret != -EPROBE_DEFER)
 			DRM_DEV_ERROR(dev, "failed to get enable gpio: %d\n",
-					ret);
+				      ret);
 		return ret;
 	}
 
@@ -1009,16 +1007,17 @@ static int panel_remove(struct mipi_dsi_device *dsi)
 	err = boe_panel_unprepare(&pinfo->base);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to unprepare panel: %d\n",
-				err);
+			      err);
 
 	err = boe_panel_disable(&pinfo->base);
 	if (err < 0)
-		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n", err);
+		DRM_DEV_ERROR(&dsi->dev, "failed to disable panel: %d\n",
+			      err);
 
 	err = mipi_dsi_detach(dsi);
 	if (err < 0)
 		DRM_DEV_ERROR(&dsi->dev, "failed to detach from DSI host: %d\n",
-				err);
+			      err);
 
 	drm_panel_detach(&pinfo->base);
 	panel_del(pinfo);
-- 
2.17.1

From 0afbef97f63b61872a99d907f3b822d0f495b7b1 Mon Sep 17 00:00:00 2001
From: Jerry Han <jerry.han.hq@xxxxxxxxx>
Date: Fri, 2 Aug 2019 18:14:55 +0800
Subject: [PATCH 10/10] [v10] drm/panel: Add Boe Himax8279d MIPI-DSI LCD panel

Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
panel.

V10:
- Adjust init code, make the format more concise
- kill off default_off_cmds (Emil)
- use mipi_dsi_dcs_set_display_{on,off} in their enable/disable
    callbacks. (Emil)
- Adjusting the delay function (Emil)

V9:
- modify PARENTHESIS_ALIGNMENT format (Sam)
- use gpios are required API replace optional gpio API (Emil)

V8:
- Modify communication address

V7:
- Add the information of the reviewer
- Remove unnecessary delays, The udelay_range code gracefully returns
    without hitting the scheduler on a delay of 0. (Derek)
- Merge the same data structures, like display_mode and off_cmds (Derek)
- Optimize the processing of results returned by
    devm_gpiod_get_optional (Derek)

V6:
- Add the information of the reviewer (Sam)
- Delete unnecessary header files #include <linux/fb.h> (Sam)
- The config DRM_PANEL_BOE_HIMAX8279D appears twice. Drop one of them (Sam)
- ADD static, set_gpios function is not used outside this module (Sam)

V5:
- Added changelog

V4:
- Frefix all function maes with boe_ (Sam)
- Fsed "enable_gpio" replace "reset_gpio", Make it look clearer (Sam)
- Sort include lines alphabetically (Sam)
- Fixed entries in the makefile must be sorted alphabetically (Sam)
- Add send_mipi_cmds function to avoid duplicating the code (Sam)
- Add the necessary delay(reset_delay_t5) between reset and sending
    the initialization command (Rock wang)

V3:
- Remove unnecessary delays in sending initialization commands (Jitao Shi)

V2:
- Use SPDX identifier (Sam)
- Use necessary header files replace drmP.h (Sam)
- Delete unnecessary header files #include <linux/err.h> (Sam)
- Specifies a GPIOs array to control the reset timing,
    instead of reading "dsi-reset-sequence" data from DTS (Sam)
- Delete backlight_disable() function when already disabled (Sam)
- Use devm_of_find_backlight() replace of_find_backlight_by_node() (Sam)
- Move the necessary data in the DTS to the current file,
    like porch, display_mode and Init code etc. (Sam)
- Add compatible device "boe,himax8279d10p" (Sam)

V1:
- Support Boe Himax8279d 8.0" 1200x1920 TFT LCD panel, it is a MIPI DSI
    panel.

Signed-off-by: Jerry Han <jerry.han.hq@xxxxxxxxx>
Reviewed-by: Sam Ravnborg <sam@xxxxxxxxxxxx>
Reviewed-by: Derek Basehore <dbasehore@xxxxxxxxxxxx>
Reviewed-by: Emil Velikov <emil.l.velikov@xxxxxxxxx>
Cc: Jitao Shi <jitao.shi@xxxxxxxxxxxx>
Cc: Rock wang <rock_wang@xxxxxxxxxxxx>
---
 drivers/gpu/drm/panel/panel-boe-himax8279d.c | 1235 +++++++++---------
 1 file changed, 588 insertions(+), 647 deletions(-)

diff --git a/drivers/gpu/drm/panel/panel-boe-himax8279d.c b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
index 7790f76d3ce7..6265bf975365 100644
--- a/drivers/gpu/drm/panel/panel-boe-himax8279d.c
+++ b/drivers/gpu/drm/panel/panel-boe-himax8279d.c
@@ -39,17 +39,10 @@ struct panel_desc {
 	unsigned int width_mm;
 	unsigned int height_mm;
 
-	unsigned int delay_t1;
-	unsigned int reset_delay_t2;
-	unsigned int reset_delay_t3;
-	unsigned int reset_delay_t4;
-	unsigned int reset_delay_t5;
-
 	unsigned long mode_flags;
 	enum mipi_dsi_pixel_format format;
 	unsigned int lanes;
 	const struct panel_cmd *on_cmds;
-	const struct panel_cmd *off_cmds;
 };
 
 struct panel_info {
@@ -90,18 +83,11 @@ static int send_mipi_cmds(struct drm_panel *panel, const struct panel_cmd *cmds)
 	for (i = 0; cmds[i].len != 0; i++) {
 		const struct panel_cmd *cmd = &cmds[i];
 
-		if (cmd->len == 2)
-			err = mipi_dsi_dcs_write(pinfo->link, cmd->data[1],
-						 NULL, 0);
-		else
-			err = mipi_dsi_dcs_write(pinfo->link, cmd->data[1],
-						 cmd->data + 2,
-						 cmd->len - 2);
+		err = mipi_dsi_dcs_write(pinfo->link, cmd->data[0],
+					 cmd->data + 1, 1);
 
 		if (err < 0)
 			return err;
-
-		usleep_range((cmd->data[0]) * 1000, (1 + cmd->data[0]) * 1000);
 	}
 
 	return 0;
@@ -126,14 +112,23 @@ static int boe_panel_unprepare(struct drm_panel *panel)
 	if (!pinfo->prepared)
 		return 0;
 
-	/* send off code */
-	err = send_mipi_cmds(panel, pinfo->desc->off_cmds);
+	err = mipi_dsi_dcs_set_display_off(pinfo->link);
+	if (err < 0) {
+		DRM_DEV_ERROR(panel->dev, "failed to set display off: %d\n",
+			      err);
+		goto poweroff;
+	}
+
+	err = mipi_dsi_dcs_enter_sleep_mode(pinfo->link);
 	if (err < 0) {
-		DRM_DEV_ERROR(panel->dev, "failed to send DCS Off Code: %d\n",
+		DRM_DEV_ERROR(panel->dev, "failed to enter sleep mode: %d\n",
 			      err);
 		goto poweroff;
 	}
 
+	/* sleep_mode_delay: 1ms - 2ms */
+	usleep_range(1000, 2000);
+
 	set_gpios(pinfo, 0);
 
 	pinfo->prepared = false;
@@ -148,28 +143,31 @@ static int boe_panel_unprepare(struct drm_panel *panel)
 static int boe_panel_prepare(struct drm_panel *panel)
 {
 	struct panel_info *pinfo = to_panel_info(panel);
-	const struct panel_desc *desc = pinfo->desc;
 	int err;
 
 	if (pinfo->prepared)
 		return 0;
 
 	gpiod_set_value(pinfo->pp18_gpio, 1);
-	/* T1 (> 5ms) */
-	usleep_range(desc->delay_t1, 1000 + desc->delay_t1);
+	/* T1: 5ms - 6ms */
+	usleep_range(5000, 6000);
 	gpiod_set_value(pinfo->pp33_gpio, 1);
 
 	/* reset sequence */
-	usleep_range(desc->reset_delay_t2, 1000 + desc->reset_delay_t2);
-
+	/* T2: 14ms - 15ms */
+	usleep_range(14000, 15000);
 	gpiod_set_value(pinfo->enable_gpio, 1);
-	usleep_range(desc->reset_delay_t3, 1000 + desc->reset_delay_t3);
+
+	/* T3: 1ms - 2ms */
+	usleep_range(1000, 2000);
 	gpiod_set_value(pinfo->enable_gpio, 0);
 
-	usleep_range(desc->reset_delay_t4, 1000 + desc->reset_delay_t4);
+	/* T4: 1ms - 2ms */
+	usleep_range(1000, 2000);
 	gpiod_set_value(pinfo->enable_gpio, 1);
 
-	usleep_range(desc->reset_delay_t5, 1000 + desc->reset_delay_t5);
+	/* T5: 5ms - 6ms */
+	usleep_range(5000, 6000);
 
 	/* send init code */
 	err = send_mipi_cmds(panel, pinfo->desc->on_cmds);
@@ -179,6 +177,26 @@ static int boe_panel_prepare(struct drm_panel *panel)
 		goto poweroff;
 	}
 
+	err = mipi_dsi_dcs_exit_sleep_mode(pinfo->link);
+	if (err < 0) {
+		DRM_DEV_ERROR(panel->dev, "failed to exit sleep mode: %d\n",
+			      err);
+		goto poweroff;
+	}
+
+	/* T6: 120ms - 121ms */
+	usleep_range(120000, 121000);
+
+	err = mipi_dsi_dcs_set_display_on(pinfo->link);
+	if (err < 0) {
+		DRM_DEV_ERROR(panel->dev, "failed to set display on: %d\n",
+			      err);
+		goto poweroff;
+	}
+
+	/* T7: 20ms - 21ms */
+	usleep_range(20000, 21000);
+
 	pinfo->prepared = true;
 
 	return 0;
@@ -253,317 +271,268 @@ static const struct drm_display_mode default_display_mode = {
 	.vrefresh = 60,
 };
 
-static const struct panel_cmd default_off_cmds[] = {
-	_INIT_CMD(0x00, 0x28),
-	_INIT_CMD(0x01, 0x10),
-
-	{},
-};
-
 /* 8 inch */
 static const struct panel_cmd boe_himax8279d8p_on_cmds[] = {
-	_INIT_CMD(0x22, 0x10),
-	_INIT_CMD(0x00, 0xB0, 0x05),
-	_INIT_CMD(0x00, 0xB1, 0xE5),
-	_INIT_CMD(0x00, 0xB3, 0x52),
-	_INIT_CMD(0x00, 0xB0, 0x00),
-	_INIT_CMD(0x00, 0xB3, 0x88),
-	_INIT_CMD(0x00, 0xB0, 0x04),
-	_INIT_CMD(0x00, 0xB8, 0x00),
-	_INIT_CMD(0x00, 0xB0, 0x00),
-	_INIT_CMD(0x00, 0xB2, 0x50),
-	_INIT_CMD(0x00, 0xB6, 0x03),
-	_INIT_CMD(0x00, 0xBA, 0x8B),
-	_INIT_CMD(0x00, 0xBF, 0x15),
-	_INIT_CMD(0x00, 0xC0, 0x0F),
-	_INIT_CMD(0x00, 0xC2, 0x0C),
-	_INIT_CMD(0x00, 0xC3, 0x02),
-	_INIT_CMD(0x00, 0xC4, 0x0C),
-	_INIT_CMD(0x00, 0xC5, 0x02),
-	_INIT_CMD(0x00, 0xB0, 0x01),
-	_INIT_CMD(0x00, 0xE0, 0x26),
-	_INIT_CMD(0x00, 0xE1, 0x26),
-	_INIT_CMD(0x00, 0xDC, 0x00),
-	_INIT_CMD(0x00, 0xDD, 0x00),
-	_INIT_CMD(0x00, 0xCC, 0x26),
-	_INIT_CMD(0x00, 0xCD, 0x26),
-	_INIT_CMD(0x00, 0xC8, 0x00),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xD2, 0x04),
-	_INIT_CMD(0x00, 0xD3, 0x04),
-	_INIT_CMD(0x00, 0xE6, 0x03),
-	_INIT_CMD(0x00, 0xE7, 0x03),
-	_INIT_CMD(0x00, 0xC4, 0x08),
-	_INIT_CMD(0x00, 0xC5, 0x08),
-	_INIT_CMD(0x00, 0xD8, 0x07),
-	_INIT_CMD(0x00, 0xD9, 0x07),
-	_INIT_CMD(0x00, 0xC2, 0x06),
-	_INIT_CMD(0x00, 0xC3, 0x06),
-	_INIT_CMD(0x00, 0xD6, 0x05),
-	_INIT_CMD(0x00, 0xD7, 0x05),
-	_INIT_CMD(0x00, 0xC0, 0x0C),
-	_INIT_CMD(0x00, 0xC1, 0x0C),
-	_INIT_CMD(0x00, 0xD4, 0x0B),
-	_INIT_CMD(0x00, 0xD5, 0x0B),
-	_INIT_CMD(0x00, 0xCA, 0x0A),
-	_INIT_CMD(0x00, 0xCB, 0x0A),
-	_INIT_CMD(0x00, 0xDE, 0x09),
-	_INIT_CMD(0x00, 0xDF, 0x09),
-	_INIT_CMD(0x00, 0xC6, 0x26),
-	_INIT_CMD(0x00, 0xC7, 0x26),
-	_INIT_CMD(0x00, 0xCE, 0x00),
-	_INIT_CMD(0x00, 0xCF, 0x00),
-	_INIT_CMD(0x00, 0xDA, 0x26),
-	_INIT_CMD(0x00, 0xDB, 0x26),
-	_INIT_CMD(0x00, 0xE2, 0x00),
-	_INIT_CMD(0x00, 0xE3, 0x00),
-	_INIT_CMD(0x00, 0xB0, 0x02),
-	_INIT_CMD(0x00, 0xC0, 0x00),
-	_INIT_CMD(0x00, 0xC1, 0x07),
-	_INIT_CMD(0x00, 0xC2, 0x0D),
-	_INIT_CMD(0x00, 0xC3, 0x18),
-	_INIT_CMD(0x00, 0xC4, 0x27),
-	_INIT_CMD(0x00, 0xC5, 0x28),
-	_INIT_CMD(0x00, 0xC6, 0x30),
-	_INIT_CMD(0x00, 0xC7, 0x2E),
-	_INIT_CMD(0x00, 0xC8, 0x2F),
-	_INIT_CMD(0x00, 0xC9, 0x1A),
-	_INIT_CMD(0x00, 0xCA, 0x20),
-	_INIT_CMD(0x00, 0xCB, 0x29),
-	_INIT_CMD(0x00, 0xCC, 0x26),
-	_INIT_CMD(0x00, 0xCD, 0x32),
-	_INIT_CMD(0x00, 0xCE, 0x33),
-	_INIT_CMD(0x00, 0xCF, 0x31),
-	_INIT_CMD(0x00, 0xD0, 0x06),
-	_INIT_CMD(0x00, 0xD2, 0x00),
-	_INIT_CMD(0x00, 0xD3, 0x07),
-	_INIT_CMD(0x00, 0xD4, 0x12),
-	_INIT_CMD(0x00, 0xD5, 0x26),
-	_INIT_CMD(0x00, 0xD6, 0x3D),
-	_INIT_CMD(0x00, 0xD7, 0x3F),
-	_INIT_CMD(0x00, 0xD8, 0x3F),
-	_INIT_CMD(0x00, 0xD9, 0x3F),
-	_INIT_CMD(0x00, 0xDA, 0x3F),
-	_INIT_CMD(0x00, 0xDB, 0x3F),
-	_INIT_CMD(0x00, 0xDC, 0x3F),
-	_INIT_CMD(0x00, 0xDD, 0x3F),
-	_INIT_CMD(0x00, 0xDE, 0x3F),
-	_INIT_CMD(0x00, 0xDF, 0x3A),
-	_INIT_CMD(0x00, 0xE0, 0x37),
-	_INIT_CMD(0x00, 0xE1, 0x35),
-	_INIT_CMD(0x00, 0xE2, 0x07),
-	_INIT_CMD(0x00, 0xB0, 0x03),
-	_INIT_CMD(0x00, 0xC8, 0x0B),
-	_INIT_CMD(0x00, 0xC9, 0x07),
-	_INIT_CMD(0x00, 0xC3, 0x00),
-	_INIT_CMD(0x00, 0xE7, 0x00),
-	_INIT_CMD(0x00, 0xC5, 0x2A),
-	_INIT_CMD(0x00, 0xDE, 0x2A),
-	_INIT_CMD(0x00, 0xCA, 0x43),
-	_INIT_CMD(0x00, 0xC9, 0x07),
-	_INIT_CMD(0x00, 0xE4, 0xC0),
-	_INIT_CMD(0x00, 0xE5, 0x0D),
-	_INIT_CMD(0x00, 0xCB, 0x00),
-	_INIT_CMD(0x00, 0xB0, 0x06),
-	_INIT_CMD(0x00, 0xB8, 0xA5),
-	_INIT_CMD(0x00, 0xC0, 0xA5),
-	_INIT_CMD(0x00, 0xC7, 0x0F),
-	_INIT_CMD(0x00, 0xD5, 0x32),
-	_INIT_CMD(0x00, 0xB8, 0x00),
-	_INIT_CMD(0x00, 0xC0, 0x00),
-	_INIT_CMD(0x00, 0xBC, 0x00),
-	_INIT_CMD(0x00, 0xB0, 0x07),
-	_INIT_CMD(0x00, 0xB1, 0x00),
-	_INIT_CMD(0x00, 0xB2, 0x09),
-	_INIT_CMD(0x00, 0xB3, 0x19),
-	_INIT_CMD(0x00, 0xB4, 0x2F),
-	_INIT_CMD(0x00, 0xB5, 0x44),
-	_INIT_CMD(0x00, 0xB6, 0x52),
-	_INIT_CMD(0x00, 0xB7, 0x6A),
-	_INIT_CMD(0x00, 0xB8, 0x8A),
-	_INIT_CMD(0x00, 0xB9, 0xCA),
-	_INIT_CMD(0x00, 0xBA, 0x0C),
-	_INIT_CMD(0x05, 0xBB, 0x87),
-	_INIT_CMD(0x00, 0xBC, 0x06),
-	_INIT_CMD(0x00, 0xBD, 0x0A),
-	_INIT_CMD(0x00, 0xBE, 0x9B),
-	_INIT_CMD(0x00, 0xBF, 0x0C),
-	_INIT_CMD(0x00, 0xC0, 0x3D),
-	_INIT_CMD(0x00, 0xC1, 0x71),
-	_INIT_CMD(0x00, 0xC2, 0x90),
-	_INIT_CMD(0x00, 0xC3, 0xA0),
-	_INIT_CMD(0x00, 0xC4, 0xA8),
-	_INIT_CMD(0x00, 0xC5, 0xB1),
-	_INIT_CMD(0x00, 0xC6, 0xBB),
-	_INIT_CMD(0x00, 0xC7, 0xC0),
-	_INIT_CMD(0x00, 0xC8, 0xC4),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x08),
-	_INIT_CMD(0x00, 0xB1, 0x04),
-	_INIT_CMD(0x00, 0xB2, 0x08),
-	_INIT_CMD(0x00, 0xB3, 0x19),
-	_INIT_CMD(0x00, 0xB4, 0x31),
-	_INIT_CMD(0x00, 0xB5, 0x46),
-	_INIT_CMD(0x00, 0xB6, 0x55),
-	_INIT_CMD(0x00, 0xB7, 0x6E),
-	_INIT_CMD(0x00, 0xB8, 0x92),
-	_INIT_CMD(0x00, 0xB9, 0xD4),
-	_INIT_CMD(0x00, 0xBA, 0x1B),
-	_INIT_CMD(0x05, 0xBB, 0x9B),
-	_INIT_CMD(0x00, 0xBC, 0x28),
-	_INIT_CMD(0x00, 0xBD, 0x2D),
-	_INIT_CMD(0x00, 0xBE, 0xC3),
-	_INIT_CMD(0x00, 0xBF, 0x2F),
-	_INIT_CMD(0x00, 0xC0, 0x62),
-	_INIT_CMD(0x00, 0xC1, 0x99),
-	_INIT_CMD(0x00, 0xC2, 0xAB),
-	_INIT_CMD(0x00, 0xC3, 0xBF),
-	_INIT_CMD(0x00, 0xC4, 0xCF),
-	_INIT_CMD(0x00, 0xC5, 0xDF),
-	_INIT_CMD(0x00, 0xC6, 0xF0),
-	_INIT_CMD(0x00, 0xC7, 0xF9),
-	_INIT_CMD(0x00, 0xC8, 0xFC),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x09),
-	_INIT_CMD(0x00, 0xB1, 0x04),
-	_INIT_CMD(0x00, 0xB2, 0x05),
-	_INIT_CMD(0x00, 0xB3, 0x17),
-	_INIT_CMD(0x00, 0xB4, 0x2E),
-	_INIT_CMD(0x00, 0xB5, 0x42),
-	_INIT_CMD(0x00, 0xB6, 0x51),
-	_INIT_CMD(0x00, 0xB7, 0x69),
-	_INIT_CMD(0x00, 0xB8, 0x88),
-	_INIT_CMD(0x00, 0xB9, 0xC9),
-	_INIT_CMD(0x00, 0xBA, 0x0C),
-	_INIT_CMD(0x05, 0xBB, 0x86),
-	_INIT_CMD(0x00, 0xBC, 0x03),
-	_INIT_CMD(0x00, 0xBD, 0x08),
-	_INIT_CMD(0x00, 0xBE, 0x95),
-	_INIT_CMD(0x00, 0xBF, 0x05),
-	_INIT_CMD(0x00, 0xC0, 0x35),
-	_INIT_CMD(0x00, 0xC1, 0x62),
-	_INIT_CMD(0x00, 0xC2, 0x81),
-	_INIT_CMD(0x00, 0xC3, 0x96),
-	_INIT_CMD(0x00, 0xC4, 0x9E),
-	_INIT_CMD(0x00, 0xC5, 0xA5),
-	_INIT_CMD(0x00, 0xC6, 0xAD),
-	_INIT_CMD(0x00, 0xC7, 0xB1),
-	_INIT_CMD(0x00, 0xC8, 0xB4),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x0A),
-	_INIT_CMD(0x00, 0xB1, 0x00),
-	_INIT_CMD(0x00, 0xB2, 0x09),
-	_INIT_CMD(0x00, 0xB3, 0x19),
-	_INIT_CMD(0x00, 0xB4, 0x2F),
-	_INIT_CMD(0x00, 0xB5, 0x44),
-	_INIT_CMD(0x00, 0xB6, 0x52),
-	_INIT_CMD(0x00, 0xB7, 0x6A),
-	_INIT_CMD(0x00, 0xB8, 0x8A),
-	_INIT_CMD(0x00, 0xB9, 0xCA),
-	_INIT_CMD(0x00, 0xBA, 0x0C),
-	_INIT_CMD(0x05, 0xBB, 0x87),
-	_INIT_CMD(0x00, 0xBC, 0x06),
-	_INIT_CMD(0x00, 0xBD, 0x0A),
-	_INIT_CMD(0x00, 0xBE, 0x9B),
-	_INIT_CMD(0x00, 0xBF, 0x0C),
-	_INIT_CMD(0x00, 0xC0, 0x3D),
-	_INIT_CMD(0x00, 0xC1, 0x71),
-	_INIT_CMD(0x00, 0xC2, 0x90),
-	_INIT_CMD(0x00, 0xC3, 0xA0),
-	_INIT_CMD(0x00, 0xC4, 0xA8),
-	_INIT_CMD(0x00, 0xC5, 0xB1),
-	_INIT_CMD(0x00, 0xC6, 0xBB),
-	_INIT_CMD(0x00, 0xC7, 0xC0),
-	_INIT_CMD(0x00, 0xC8, 0xC4),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x0B),
-	_INIT_CMD(0x00, 0xB1, 0x04),
-	_INIT_CMD(0x00, 0xB2, 0x08),
-	_INIT_CMD(0x00, 0xB3, 0x19),
-	_INIT_CMD(0x00, 0xB4, 0x31),
-	_INIT_CMD(0x00, 0xB5, 0x46),
-	_INIT_CMD(0x00, 0xB6, 0x55),
-	_INIT_CMD(0x00, 0xB7, 0x6E),
-	_INIT_CMD(0x00, 0xB8, 0x92),
-	_INIT_CMD(0x00, 0xB9, 0xD4),
-	_INIT_CMD(0x00, 0xBA, 0x1B),
-	_INIT_CMD(0x05, 0xBB, 0x9B),
-	_INIT_CMD(0x00, 0xBC, 0x28),
-	_INIT_CMD(0x00, 0xBD, 0x2D),
-	_INIT_CMD(0x00, 0xBE, 0xC3),
-	_INIT_CMD(0x00, 0xBF, 0x2F),
-	_INIT_CMD(0x00, 0xC0, 0x62),
-	_INIT_CMD(0x00, 0xC1, 0x99),
-	_INIT_CMD(0x00, 0xC2, 0xAB),
-	_INIT_CMD(0x00, 0xC3, 0xBF),
-	_INIT_CMD(0x00, 0xC4, 0xCF),
-	_INIT_CMD(0x00, 0xC5, 0xDF),
-	_INIT_CMD(0x00, 0xC6, 0xF0),
-	_INIT_CMD(0x00, 0xC7, 0xF9),
-	_INIT_CMD(0x00, 0xC8, 0xFC),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x0C),
-	_INIT_CMD(0x00, 0xB1, 0x04),
-	_INIT_CMD(0x00, 0xB2, 0x05),
-	_INIT_CMD(0x00, 0xB3, 0x17),
-	_INIT_CMD(0x00, 0xB4, 0x2E),
-	_INIT_CMD(0x00, 0xB5, 0x42),
-	_INIT_CMD(0x00, 0xB6, 0x51),
-	_INIT_CMD(0x00, 0xB7, 0x69),
-	_INIT_CMD(0x00, 0xB8, 0x88),
-	_INIT_CMD(0x00, 0xB9, 0xC9),
-	_INIT_CMD(0x00, 0xBA, 0x0C),
-	_INIT_CMD(0x05, 0xBB, 0x86),
-	_INIT_CMD(0x00, 0xBC, 0x03),
-	_INIT_CMD(0x00, 0xBD, 0x08),
-	_INIT_CMD(0x00, 0xBE, 0x95),
-	_INIT_CMD(0x00, 0xBF, 0x05),
-	_INIT_CMD(0x00, 0xC0, 0x35),
-	_INIT_CMD(0x00, 0xC1, 0x62),
-	_INIT_CMD(0x00, 0xC2, 0x81),
-	_INIT_CMD(0x00, 0xC3, 0x96),
-	_INIT_CMD(0x00, 0xC4, 0x9E),
-	_INIT_CMD(0x00, 0xC5, 0xA5),
-	_INIT_CMD(0x00, 0xC6, 0xAD),
-	_INIT_CMD(0x00, 0xC7, 0xB1),
-	_INIT_CMD(0x00, 0xC8, 0xB4),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x64, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x00),
-	_INIT_CMD(0x00, 0xB3, 0x08),
-	_INIT_CMD(0x00, 0xB0, 0x04),
-	_INIT_CMD(0x0A, 0xB8, 0x68),
-	_INIT_CMD(0x78, 0x11),
-	_INIT_CMD(0x14, 0x29),
+	_INIT_CMD(0xB0, 0x05),
+	_INIT_CMD(0xB1, 0xE5),
+	_INIT_CMD(0xB3, 0x52),
+	_INIT_CMD(0xC0, 0x00),
+	_INIT_CMD(0xC2, 0x57),
+	_INIT_CMD(0xD9, 0x85),
+	_INIT_CMD(0xB0, 0x01),
+	_INIT_CMD(0xC8, 0x00),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCC, 0x26),
+	_INIT_CMD(0xCD, 0x26),
+	_INIT_CMD(0xDC, 0x00),
+	_INIT_CMD(0xDD, 0x00),
+	_INIT_CMD(0xE0, 0x26),
+	_INIT_CMD(0xE1, 0x26),
+	_INIT_CMD(0xB0, 0x03),
+	_INIT_CMD(0xC3, 0x2A),
+	_INIT_CMD(0xE7, 0x2A),
+	_INIT_CMD(0xC5, 0x2A),
+	_INIT_CMD(0xDE, 0x2A),
+	_INIT_CMD(0xBC, 0x02),
+	_INIT_CMD(0xCB, 0x02),
+	_INIT_CMD(0xB0, 0x00),
+	_INIT_CMD(0xB6, 0x03),
+	_INIT_CMD(0xBA, 0x8B),
+	_INIT_CMD(0xBF, 0x15),
+	_INIT_CMD(0xC0, 0x18),
+	_INIT_CMD(0xC2, 0x14),
+	_INIT_CMD(0xC3, 0x02),
+	_INIT_CMD(0xC4, 0x14),
+	_INIT_CMD(0xC5, 0x02),
+	_INIT_CMD(0xCC, 0x0A),
+	_INIT_CMD(0xB0, 0x06),
+	_INIT_CMD(0xC0, 0xA5),
+	_INIT_CMD(0xD5, 0x20),
+	_INIT_CMD(0xC0, 0x00),
+	_INIT_CMD(0xB0, 0x02),
+	_INIT_CMD(0xC0, 0x00),
+	_INIT_CMD(0xC1, 0x02),
+	_INIT_CMD(0xC2, 0x06),
+	_INIT_CMD(0xC3, 0x16),
+	_INIT_CMD(0xC4, 0x0E),
+	_INIT_CMD(0xC5, 0x18),
+	_INIT_CMD(0xC6, 0x26),
+	_INIT_CMD(0xC7, 0x32),
+	_INIT_CMD(0xC8, 0x3F),
+	_INIT_CMD(0xC9, 0x3F),
+	_INIT_CMD(0xCA, 0x3F),
+	_INIT_CMD(0xCB, 0x3F),
+	_INIT_CMD(0xCC, 0x3D),
+	_INIT_CMD(0xCD, 0x2F),
+	_INIT_CMD(0xCE, 0x2F),
+	_INIT_CMD(0xCF, 0x2F),
+	_INIT_CMD(0xD0, 0x07),
+	_INIT_CMD(0xD2, 0x00),
+	_INIT_CMD(0xD3, 0x02),
+	_INIT_CMD(0xD4, 0x06),
+	_INIT_CMD(0xD5, 0x12),
+	_INIT_CMD(0xD6, 0x0A),
+	_INIT_CMD(0xD7, 0x14),
+	_INIT_CMD(0xD8, 0x22),
+	_INIT_CMD(0xD9, 0x2E),
+	_INIT_CMD(0xDA, 0x3D),
+	_INIT_CMD(0xDB, 0x3F),
+	_INIT_CMD(0xDC, 0x3F),
+	_INIT_CMD(0xDD, 0x3F),
+	_INIT_CMD(0xDE, 0x3D),
+	_INIT_CMD(0xDF, 0x2F),
+	_INIT_CMD(0xE0, 0x2F),
+	_INIT_CMD(0xE1, 0x2F),
+	_INIT_CMD(0xE2, 0x07),
+	_INIT_CMD(0xB0, 0x07),
+	_INIT_CMD(0xB1, 0x18),
+	_INIT_CMD(0xB2, 0x19),
+	_INIT_CMD(0xB3, 0x2E),
+	_INIT_CMD(0xB4, 0x52),
+	_INIT_CMD(0xB5, 0x72),
+	_INIT_CMD(0xB6, 0x8C),
+	_INIT_CMD(0xB7, 0xBD),
+	_INIT_CMD(0xB8, 0xEB),
+	_INIT_CMD(0xB9, 0x47),
+	_INIT_CMD(0xBA, 0x96),
+	_INIT_CMD(0xBB, 0x1E),
+	_INIT_CMD(0xBC, 0x90),
+	_INIT_CMD(0xBD, 0x93),
+	_INIT_CMD(0xBE, 0xFA),
+	_INIT_CMD(0xBF, 0x56),
+	_INIT_CMD(0xC0, 0x8C),
+	_INIT_CMD(0xC1, 0xB7),
+	_INIT_CMD(0xC2, 0xCC),
+	_INIT_CMD(0xC3, 0xDF),
+	_INIT_CMD(0xC4, 0xE8),
+	_INIT_CMD(0xC5, 0xF0),
+	_INIT_CMD(0xC6, 0xF8),
+	_INIT_CMD(0xC7, 0xFA),
+	_INIT_CMD(0xC8, 0xFC),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x5A),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x08),
+	_INIT_CMD(0xB1, 0x04),
+	_INIT_CMD(0xB2, 0x15),
+	_INIT_CMD(0xB3, 0x2D),
+	_INIT_CMD(0xB4, 0x51),
+	_INIT_CMD(0xB5, 0x72),
+	_INIT_CMD(0xB6, 0x8D),
+	_INIT_CMD(0xB7, 0xBE),
+	_INIT_CMD(0xB8, 0xED),
+	_INIT_CMD(0xB9, 0x4A),
+	_INIT_CMD(0xBA, 0x9A),
+	_INIT_CMD(0xBB, 0x23),
+	_INIT_CMD(0xBC, 0x95),
+	_INIT_CMD(0xBD, 0x98),
+	_INIT_CMD(0xBE, 0xFF),
+	_INIT_CMD(0xBF, 0x59),
+	_INIT_CMD(0xC0, 0x8E),
+	_INIT_CMD(0xC1, 0xB9),
+	_INIT_CMD(0xC2, 0xCD),
+	_INIT_CMD(0xC3, 0xDF),
+	_INIT_CMD(0xC4, 0xE8),
+	_INIT_CMD(0xC5, 0xF0),
+	_INIT_CMD(0xC6, 0xF8),
+	_INIT_CMD(0xC7, 0xFA),
+	_INIT_CMD(0xC8, 0xFC),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x5A),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x09),
+	_INIT_CMD(0xB1, 0x04),
+	_INIT_CMD(0xB2, 0x2C),
+	_INIT_CMD(0xB3, 0x36),
+	_INIT_CMD(0xB4, 0x53),
+	_INIT_CMD(0xB5, 0x73),
+	_INIT_CMD(0xB6, 0x8E),
+	_INIT_CMD(0xB7, 0xC0),
+	_INIT_CMD(0xB8, 0xEF),
+	_INIT_CMD(0xB9, 0x4C),
+	_INIT_CMD(0xBA, 0x9D),
+	_INIT_CMD(0xBB, 0x25),
+	_INIT_CMD(0xBC, 0x96),
+	_INIT_CMD(0xBD, 0x9A),
+	_INIT_CMD(0xBE, 0x01),
+	_INIT_CMD(0xBF, 0x59),
+	_INIT_CMD(0xC0, 0x8E),
+	_INIT_CMD(0xC1, 0xB9),
+	_INIT_CMD(0xC2, 0xCD),
+	_INIT_CMD(0xC3, 0xDF),
+	_INIT_CMD(0xC4, 0xE8),
+	_INIT_CMD(0xC5, 0xF0),
+	_INIT_CMD(0xC6, 0xF8),
+	_INIT_CMD(0xC7, 0xFA),
+	_INIT_CMD(0xC8, 0xFC),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x5A),
+	_INIT_CMD(0xCC, 0xBF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x0A),
+	_INIT_CMD(0xB1, 0x18),
+	_INIT_CMD(0xB2, 0x19),
+	_INIT_CMD(0xB3, 0x2E),
+	_INIT_CMD(0xB4, 0x52),
+	_INIT_CMD(0xB5, 0x72),
+	_INIT_CMD(0xB6, 0x8C),
+	_INIT_CMD(0xB7, 0xBD),
+	_INIT_CMD(0xB8, 0xEB),
+	_INIT_CMD(0xB9, 0x47),
+	_INIT_CMD(0xBA, 0x96),
+	_INIT_CMD(0xBB, 0x1E),
+	_INIT_CMD(0xBC, 0x90),
+	_INIT_CMD(0xBD, 0x93),
+	_INIT_CMD(0xBE, 0xFA),
+	_INIT_CMD(0xBF, 0x56),
+	_INIT_CMD(0xC0, 0x8C),
+	_INIT_CMD(0xC1, 0xB7),
+	_INIT_CMD(0xC2, 0xCC),
+	_INIT_CMD(0xC3, 0xDF),
+	_INIT_CMD(0xC4, 0xE8),
+	_INIT_CMD(0xC5, 0xF0),
+	_INIT_CMD(0xC6, 0xF8),
+	_INIT_CMD(0xC7, 0xFA),
+	_INIT_CMD(0xC8, 0xFC),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x5A),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x0B),
+	_INIT_CMD(0xB1, 0x04),
+	_INIT_CMD(0xB2, 0x15),
+	_INIT_CMD(0xB3, 0x2D),
+	_INIT_CMD(0xB4, 0x51),
+	_INIT_CMD(0xB5, 0x72),
+	_INIT_CMD(0xB6, 0x8D),
+	_INIT_CMD(0xB7, 0xBE),
+	_INIT_CMD(0xB8, 0xED),
+	_INIT_CMD(0xB9, 0x4A),
+	_INIT_CMD(0xBA, 0x9A),
+	_INIT_CMD(0xBB, 0x23),
+	_INIT_CMD(0xBC, 0x95),
+	_INIT_CMD(0xBD, 0x98),
+	_INIT_CMD(0xBE, 0xFF),
+	_INIT_CMD(0xBF, 0x59),
+	_INIT_CMD(0xC0, 0x8E),
+	_INIT_CMD(0xC1, 0xB9),
+	_INIT_CMD(0xC2, 0xCD),
+	_INIT_CMD(0xC3, 0xDF),
+	_INIT_CMD(0xC4, 0xE8),
+	_INIT_CMD(0xC5, 0xF0),
+	_INIT_CMD(0xC6, 0xF8),
+	_INIT_CMD(0xC7, 0xFA),
+	_INIT_CMD(0xC8, 0xFC),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x5A),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x0C),
+	_INIT_CMD(0xB1, 0x04),
+	_INIT_CMD(0xB2, 0x2C),
+	_INIT_CMD(0xB3, 0x36),
+	_INIT_CMD(0xB4, 0x53),
+	_INIT_CMD(0xB5, 0x73),
+	_INIT_CMD(0xB6, 0x8E),
+	_INIT_CMD(0xB7, 0xC0),
+	_INIT_CMD(0xB8, 0xEF),
+	_INIT_CMD(0xB9, 0x4C),
+	_INIT_CMD(0xBA, 0x9D),
+	_INIT_CMD(0xBB, 0x25),
+	_INIT_CMD(0xBC, 0x96),
+	_INIT_CMD(0xBD, 0x9A),
+	_INIT_CMD(0xBE, 0x01),
+	_INIT_CMD(0xBF, 0x59),
+	_INIT_CMD(0xC0, 0x8E),
+	_INIT_CMD(0xC1, 0xB9),
+	_INIT_CMD(0xC2, 0xCD),
+	_INIT_CMD(0xC3, 0xDF),
+	_INIT_CMD(0xC4, 0xE8),
+	_INIT_CMD(0xC5, 0xF0),
+	_INIT_CMD(0xC6, 0xF8),
+	_INIT_CMD(0xC7, 0xFA),
+	_INIT_CMD(0xC8, 0xFC),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x5A),
+	_INIT_CMD(0xCC, 0xBF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x04),
+	_INIT_CMD(0xB5, 0x02),
+	_INIT_CMD(0xB6, 0x01),
 
 	{},
 };
@@ -573,320 +542,298 @@ static const struct panel_desc boe_himax8279d8p_panel_desc = {
 	.bpc = 8,
 	.width_mm = 107,
 	.height_mm = 172,
-	.delay_t1 = 5000,
-	.reset_delay_t2 = 14000,
-	.reset_delay_t3 = 1000,
-	.reset_delay_t4 = 1000,
-	.reset_delay_t5 = 5000,
 	.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
 			MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM,
 	.format = MIPI_DSI_FMT_RGB888,
 	.lanes = 4,
 	.on_cmds = boe_himax8279d8p_on_cmds,
-	.off_cmds = default_off_cmds,
 };
 
 /* 10 inch */
 static const struct panel_cmd boe_himax8279d10p_on_cmds[] = {
-	_INIT_CMD(0x00, 0xB0, 0x05),
-	_INIT_CMD(0x00, 0xB1, 0xE5),
-	_INIT_CMD(0x00, 0xB3, 0x52),
-	_INIT_CMD(0x00, 0xB0, 0x00),
-	_INIT_CMD(0x00, 0xB3, 0x88),
-	_INIT_CMD(0x00, 0xB0, 0x04),
-	_INIT_CMD(0x00, 0xB8, 0x00),
-	_INIT_CMD(0x00, 0xB0, 0x00),
-	_INIT_CMD(0x00, 0xB2, 0x50),
-	_INIT_CMD(0x00, 0xB6, 0x03),
-	_INIT_CMD(0x00, 0xBA, 0x8B),
-	_INIT_CMD(0x00, 0xBF, 0x1A),
-	_INIT_CMD(0x00, 0xC0, 0x0F),
-	_INIT_CMD(0x00, 0xC2, 0x0C),
-	_INIT_CMD(0x00, 0xC3, 0x02),
-	_INIT_CMD(0x00, 0xC4, 0x0C),
-	_INIT_CMD(0x00, 0xC5, 0x02),
-	_INIT_CMD(0x00, 0xB0, 0x01),
-	_INIT_CMD(0x00, 0xE0, 0x26),
-	_INIT_CMD(0x00, 0xE1, 0x26),
-	_INIT_CMD(0x00, 0xDC, 0x00),
-	_INIT_CMD(0x00, 0xDD, 0x00),
-	_INIT_CMD(0x00, 0xCC, 0x26),
-	_INIT_CMD(0x00, 0xCD, 0x26),
-	_INIT_CMD(0x00, 0xC8, 0x00),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xD2, 0x04),
-	_INIT_CMD(0x00, 0xD3, 0x04),
-	_INIT_CMD(0x00, 0xE6, 0x03),
-	_INIT_CMD(0x00, 0xE7, 0x03),
-	_INIT_CMD(0x00, 0xC4, 0x08),
-	_INIT_CMD(0x00, 0xC5, 0x08),
-	_INIT_CMD(0x00, 0xD8, 0x07),
-	_INIT_CMD(0x00, 0xD9, 0x07),
-	_INIT_CMD(0x00, 0xC2, 0x06),
-	_INIT_CMD(0x00, 0xC3, 0x06),
-	_INIT_CMD(0x00, 0xD6, 0x05),
-	_INIT_CMD(0x00, 0xD7, 0x05),
-	_INIT_CMD(0x00, 0xC0, 0x0C),
-	_INIT_CMD(0x00, 0xC1, 0x0C),
-	_INIT_CMD(0x00, 0xD4, 0x0B),
-	_INIT_CMD(0x00, 0xD5, 0x0B),
-	_INIT_CMD(0x00, 0xCA, 0x0A),
-	_INIT_CMD(0x00, 0xCB, 0x0A),
-	_INIT_CMD(0x00, 0xDE, 0x09),
-	_INIT_CMD(0x00, 0xDF, 0x09),
-	_INIT_CMD(0x00, 0xC6, 0x26),
-	_INIT_CMD(0x00, 0xC7, 0x26),
-	_INIT_CMD(0x00, 0xCE, 0x00),
-	_INIT_CMD(0x00, 0xCF, 0x00),
-	_INIT_CMD(0x00, 0xDA, 0x26),
-	_INIT_CMD(0x00, 0xDB, 0x26),
-	_INIT_CMD(0x00, 0xE2, 0x00),
-	_INIT_CMD(0x00, 0xE3, 0x00),
-	_INIT_CMD(0x00, 0xB0, 0x02),
-	_INIT_CMD(0x00, 0xC0, 0x00),
-	_INIT_CMD(0x00, 0xC1, 0x07),
-	_INIT_CMD(0x00, 0xC2, 0x0D),
-	_INIT_CMD(0x00, 0xC3, 0x18),
-	_INIT_CMD(0x00, 0xC4, 0x27),
-	_INIT_CMD(0x00, 0xC5, 0x28),
-	_INIT_CMD(0x00, 0xC6, 0x30),
-	_INIT_CMD(0x00, 0xC7, 0x2E),
-	_INIT_CMD(0x00, 0xC8, 0x2F),
-	_INIT_CMD(0x00, 0xC9, 0x1A),
-	_INIT_CMD(0x00, 0xCA, 0x20),
-	_INIT_CMD(0x00, 0xCB, 0x29),
-	_INIT_CMD(0x00, 0xCC, 0x26),
-	_INIT_CMD(0x00, 0xCD, 0x32),
-	_INIT_CMD(0x00, 0xCE, 0x33),
-	_INIT_CMD(0x00, 0xCF, 0x31),
-	_INIT_CMD(0x00, 0xD0, 0x06),
-	_INIT_CMD(0x00, 0xD2, 0x00),
-	_INIT_CMD(0x00, 0xD3, 0x07),
-	_INIT_CMD(0x00, 0xD4, 0x12),
-	_INIT_CMD(0x00, 0xD5, 0x26),
-	_INIT_CMD(0x00, 0xD6, 0x3D),
-	_INIT_CMD(0x00, 0xD7, 0x3F),
-	_INIT_CMD(0x00, 0xD8, 0x3F),
-	_INIT_CMD(0x00, 0xD9, 0x3F),
-	_INIT_CMD(0x00, 0xDA, 0x3F),
-	_INIT_CMD(0x00, 0xDB, 0x3F),
-	_INIT_CMD(0x00, 0xDC, 0x3F),
-	_INIT_CMD(0x00, 0xDD, 0x3F),
-	_INIT_CMD(0x00, 0xDE, 0x3F),
-	_INIT_CMD(0x00, 0xDF, 0x3A),
-	_INIT_CMD(0x00, 0xE0, 0x37),
-	_INIT_CMD(0x00, 0xE1, 0x35),
-	_INIT_CMD(0x00, 0xE2, 0x07),
-	_INIT_CMD(0x00, 0xB0, 0x03),
-	_INIT_CMD(0x00, 0xC8, 0x0B),
-	_INIT_CMD(0x00, 0xC9, 0x07),
-	_INIT_CMD(0x00, 0xC3, 0x00),
-	_INIT_CMD(0x00, 0xE7, 0x00),
-	_INIT_CMD(0x00, 0xC5, 0x2A),
-	_INIT_CMD(0x00, 0xDE, 0x2A),
-	_INIT_CMD(0x00, 0xCA, 0x43),
-	_INIT_CMD(0x00, 0xC9, 0x07),
-	_INIT_CMD(0x00, 0xE4, 0xC0),
-	_INIT_CMD(0x00, 0xE5, 0x0D),
-	_INIT_CMD(0x00, 0xCB, 0x00),
-	_INIT_CMD(0x00, 0xB0, 0x06),
-	_INIT_CMD(0x00, 0xB8, 0xA5),
-	_INIT_CMD(0x00, 0xC0, 0xA5),
-	_INIT_CMD(0x00, 0xC7, 0x0F),
-	_INIT_CMD(0x00, 0xD5, 0x32),
-	_INIT_CMD(0x00, 0xB8, 0x00),
-	_INIT_CMD(0x00, 0xC0, 0x00),
-	_INIT_CMD(0x00, 0xBC, 0x00),
-	_INIT_CMD(0x00, 0xB0, 0x07),
-	_INIT_CMD(0x00, 0xB1, 0x00),
-	_INIT_CMD(0x00, 0xB2, 0x09),
-	_INIT_CMD(0x00, 0xB3, 0x19),
-	_INIT_CMD(0x00, 0xB4, 0x2F),
-	_INIT_CMD(0x00, 0xB5, 0x44),
-	_INIT_CMD(0x00, 0xB6, 0x52),
-	_INIT_CMD(0x00, 0xB7, 0x6A),
-	_INIT_CMD(0x00, 0xB8, 0x8A),
-	_INIT_CMD(0x00, 0xB9, 0xCA),
-	_INIT_CMD(0x00, 0xBA, 0x0C),
-	_INIT_CMD(0x00, 0xBB, 0x87),
-	_INIT_CMD(0x00, 0xBC, 0x06),
-	_INIT_CMD(0x00, 0xBD, 0x0A),
-	_INIT_CMD(0x00, 0xBE, 0x9B),
-	_INIT_CMD(0x00, 0xBF, 0x0C),
-	_INIT_CMD(0x00, 0xC0, 0x3D),
-	_INIT_CMD(0x00, 0xC1, 0x71),
-	_INIT_CMD(0x00, 0xC2, 0x90),
-	_INIT_CMD(0x00, 0xC3, 0xA0),
-	_INIT_CMD(0x00, 0xC4, 0xA8),
-	_INIT_CMD(0x00, 0xC5, 0xB1),
-	_INIT_CMD(0x00, 0xC6, 0xBB),
-	_INIT_CMD(0x00, 0xC7, 0xC0),
-	_INIT_CMD(0x00, 0xC8, 0xC4),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x08),
-	_INIT_CMD(0x00, 0xB1, 0x04),
-	_INIT_CMD(0x00, 0xB2, 0x08),
-	_INIT_CMD(0x00, 0xB3, 0x19),
-	_INIT_CMD(0x00, 0xB4, 0x31),
-	_INIT_CMD(0x00, 0xB5, 0x46),
-	_INIT_CMD(0x00, 0xB6, 0x55),
-	_INIT_CMD(0x00, 0xB7, 0x6E),
-	_INIT_CMD(0x00, 0xB8, 0x92),
-	_INIT_CMD(0x00, 0xB9, 0xD4),
-	_INIT_CMD(0x00, 0xBA, 0x1B),
-	_INIT_CMD(0x00, 0xBB, 0x9B),
-	_INIT_CMD(0x00, 0xBC, 0x28),
-	_INIT_CMD(0x00, 0xBD, 0x2D),
-	_INIT_CMD(0x00, 0xBE, 0xC3),
-	_INIT_CMD(0x00, 0xBF, 0x2F),
-	_INIT_CMD(0x00, 0xC0, 0x62),
-	_INIT_CMD(0x00, 0xC1, 0x99),
-	_INIT_CMD(0x00, 0xC2, 0xAB),
-	_INIT_CMD(0x00, 0xC3, 0xBF),
-	_INIT_CMD(0x00, 0xC4, 0xCF),
-	_INIT_CMD(0x00, 0xC5, 0xDF),
-	_INIT_CMD(0x00, 0xC6, 0xF0),
-	_INIT_CMD(0x00, 0xC7, 0xF9),
-	_INIT_CMD(0x00, 0xC8, 0xFC),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x09),
-	_INIT_CMD(0x00, 0xB1, 0x04),
-	_INIT_CMD(0x00, 0xB2, 0x05),
-	_INIT_CMD(0x00, 0xB3, 0x17),
-	_INIT_CMD(0x00, 0xB4, 0x2E),
-	_INIT_CMD(0x00, 0xB5, 0x42),
-	_INIT_CMD(0x00, 0xB6, 0x51),
-	_INIT_CMD(0x00, 0xB7, 0x69),
-	_INIT_CMD(0x00, 0xB8, 0x88),
-	_INIT_CMD(0x00, 0xB9, 0xC9),
-	_INIT_CMD(0x00, 0xBA, 0x0C),
-	_INIT_CMD(0x00, 0xBB, 0x86),
-	_INIT_CMD(0x00, 0xBC, 0x03),
-	_INIT_CMD(0x00, 0xBD, 0x08),
-	_INIT_CMD(0x00, 0xBE, 0x95),
-	_INIT_CMD(0x00, 0xBF, 0x05),
-	_INIT_CMD(0x00, 0xC0, 0x35),
-	_INIT_CMD(0x00, 0xC1, 0x62),
-	_INIT_CMD(0x00, 0xC2, 0x81),
-	_INIT_CMD(0x00, 0xC3, 0x96),
-	_INIT_CMD(0x00, 0xC4, 0x9E),
-	_INIT_CMD(0x00, 0xC5, 0xA5),
-	_INIT_CMD(0x00, 0xC6, 0xAD),
-	_INIT_CMD(0x00, 0xC7, 0xB1),
-	_INIT_CMD(0x00, 0xC8, 0xB4),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x0A),
-	_INIT_CMD(0x00, 0xB1, 0x00),
-	_INIT_CMD(0x00, 0xB2, 0x09),
-	_INIT_CMD(0x00, 0xB3, 0x19),
-	_INIT_CMD(0x00, 0xB4, 0x2F),
-	_INIT_CMD(0x00, 0xB5, 0x44),
-	_INIT_CMD(0x00, 0xB6, 0x52),
-	_INIT_CMD(0x00, 0xB7, 0x6A),
-	_INIT_CMD(0x00, 0xB8, 0x8A),
-	_INIT_CMD(0x00, 0xB9, 0xCA),
-	_INIT_CMD(0x00, 0xBA, 0x0C),
-	_INIT_CMD(0x00, 0xBB, 0x87),
-	_INIT_CMD(0x00, 0xBC, 0x06),
-	_INIT_CMD(0x00, 0xBD, 0x0A),
-	_INIT_CMD(0x00, 0xBE, 0x9B),
-	_INIT_CMD(0x00, 0xBF, 0x0C),
-	_INIT_CMD(0x00, 0xC0, 0x3D),
-	_INIT_CMD(0x00, 0xC1, 0x71),
-	_INIT_CMD(0x00, 0xC2, 0x90),
-	_INIT_CMD(0x00, 0xC3, 0xA0),
-	_INIT_CMD(0x00, 0xC4, 0xA8),
-	_INIT_CMD(0x00, 0xC5, 0xB1),
-	_INIT_CMD(0x00, 0xC6, 0xBB),
-	_INIT_CMD(0x00, 0xC7, 0xC0),
-	_INIT_CMD(0x00, 0xC8, 0xC4),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x0B),
-	_INIT_CMD(0x00, 0xB1, 0x04),
-	_INIT_CMD(0x00, 0xB2, 0x08),
-	_INIT_CMD(0x00, 0xB3, 0x19),
-	_INIT_CMD(0x00, 0xB4, 0x31),
-	_INIT_CMD(0x00, 0xB5, 0x46),
-	_INIT_CMD(0x00, 0xB6, 0x55),
-	_INIT_CMD(0x00, 0xB7, 0x6E),
-	_INIT_CMD(0x00, 0xB8, 0x92),
-	_INIT_CMD(0x00, 0xB9, 0xD4),
-	_INIT_CMD(0x00, 0xBA, 0x1B),
-	_INIT_CMD(0x00, 0xBB, 0x9B),
-	_INIT_CMD(0x00, 0xBC, 0x28),
-	_INIT_CMD(0x00, 0xBD, 0x2D),
-	_INIT_CMD(0x00, 0xBE, 0xC3),
-	_INIT_CMD(0x00, 0xBF, 0x2F),
-	_INIT_CMD(0x00, 0xC0, 0x62),
-	_INIT_CMD(0x00, 0xC1, 0x99),
-	_INIT_CMD(0x00, 0xC2, 0xAB),
-	_INIT_CMD(0x00, 0xC3, 0xBF),
-	_INIT_CMD(0x00, 0xC4, 0xCF),
-	_INIT_CMD(0x00, 0xC5, 0xDF),
-	_INIT_CMD(0x00, 0xC6, 0xF0),
-	_INIT_CMD(0x00, 0xC7, 0xF9),
-	_INIT_CMD(0x00, 0xC8, 0xFC),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x0C),
-	_INIT_CMD(0x00, 0xB1, 0x04),
-	_INIT_CMD(0x00, 0xB2, 0x05),
-	_INIT_CMD(0x00, 0xB3, 0x17),
-	_INIT_CMD(0x00, 0xB4, 0x2E),
-	_INIT_CMD(0x00, 0xB5, 0x42),
-	_INIT_CMD(0x00, 0xB6, 0x51),
-	_INIT_CMD(0x00, 0xB7, 0x69),
-	_INIT_CMD(0x00, 0xB8, 0x88),
-	_INIT_CMD(0x00, 0xB9, 0xC9),
-	_INIT_CMD(0x00, 0xBA, 0x0C),
-	_INIT_CMD(0x00, 0xBB, 0x86),
-	_INIT_CMD(0x00, 0xBC, 0x03),
-	_INIT_CMD(0x00, 0xBD, 0x08),
-	_INIT_CMD(0x00, 0xBE, 0x95),
-	_INIT_CMD(0x00, 0xBF, 0x05),
-	_INIT_CMD(0x00, 0xC0, 0x35),
-	_INIT_CMD(0x00, 0xC1, 0x62),
-	_INIT_CMD(0x00, 0xC2, 0x81),
-	_INIT_CMD(0x00, 0xC3, 0x96),
-	_INIT_CMD(0x00, 0xC4, 0x9E),
-	_INIT_CMD(0x00, 0xC5, 0xA5),
-	_INIT_CMD(0x00, 0xC6, 0xAD),
-	_INIT_CMD(0x00, 0xC7, 0xB1),
-	_INIT_CMD(0x00, 0xC8, 0xB4),
-	_INIT_CMD(0x00, 0xC9, 0x00),
-	_INIT_CMD(0x00, 0xCA, 0x00),
-	_INIT_CMD(0x00, 0xCB, 0x16),
-	_INIT_CMD(0x00, 0xCC, 0xAF),
-	_INIT_CMD(0x00, 0xCD, 0xFF),
-	_INIT_CMD(0x00, 0xCE, 0xFF),
-	_INIT_CMD(0x00, 0xB0, 0x00),
-	_INIT_CMD(0x00, 0xB3, 0x08),
-	_INIT_CMD(0x00, 0xB0, 0x04),
-	_INIT_CMD(0x64, 0xB8, 0x68),
+	_INIT_CMD(0xB0, 0x05),
+	_INIT_CMD(0xB1, 0xE5),
+	_INIT_CMD(0xB3, 0x52),
+	_INIT_CMD(0xB0, 0x00),
+	_INIT_CMD(0xB6, 0x03),
+	_INIT_CMD(0xBA, 0x8B),
+	_INIT_CMD(0xBF, 0x1A),
+	_INIT_CMD(0xC0, 0x0F),
+	_INIT_CMD(0xC2, 0x0C),
+	_INIT_CMD(0xC3, 0x02),
+	_INIT_CMD(0xC4, 0x0C),
+	_INIT_CMD(0xC5, 0x02),
+	_INIT_CMD(0xB0, 0x01),
+	_INIT_CMD(0xE0, 0x26),
+	_INIT_CMD(0xE1, 0x26),
+	_INIT_CMD(0xDC, 0x00),
+	_INIT_CMD(0xDD, 0x00),
+	_INIT_CMD(0xCC, 0x26),
+	_INIT_CMD(0xCD, 0x26),
+	_INIT_CMD(0xC8, 0x00),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xD2, 0x03),
+	_INIT_CMD(0xD3, 0x03),
+	_INIT_CMD(0xE6, 0x04),
+	_INIT_CMD(0xE7, 0x04),
+	_INIT_CMD(0xC4, 0x09),
+	_INIT_CMD(0xC5, 0x09),
+	_INIT_CMD(0xD8, 0x0A),
+	_INIT_CMD(0xD9, 0x0A),
+	_INIT_CMD(0xC2, 0x0B),
+	_INIT_CMD(0xC3, 0x0B),
+	_INIT_CMD(0xD6, 0x0C),
+	_INIT_CMD(0xD7, 0x0C),
+	_INIT_CMD(0xC0, 0x05),
+	_INIT_CMD(0xC1, 0x05),
+	_INIT_CMD(0xD4, 0x06),
+	_INIT_CMD(0xD5, 0x06),
+	_INIT_CMD(0xCA, 0x07),
+	_INIT_CMD(0xCB, 0x07),
+	_INIT_CMD(0xDE, 0x08),
+	_INIT_CMD(0xDF, 0x08),
+	_INIT_CMD(0xB0, 0x02),
+	_INIT_CMD(0xC0, 0x00),
+	_INIT_CMD(0xC1, 0x0D),
+	_INIT_CMD(0xC2, 0x17),
+	_INIT_CMD(0xC3, 0x26),
+	_INIT_CMD(0xC4, 0x31),
+	_INIT_CMD(0xC5, 0x1C),
+	_INIT_CMD(0xC6, 0x2C),
+	_INIT_CMD(0xC7, 0x33),
+	_INIT_CMD(0xC8, 0x31),
+	_INIT_CMD(0xC9, 0x37),
+	_INIT_CMD(0xCA, 0x37),
+	_INIT_CMD(0xCB, 0x37),
+	_INIT_CMD(0xCC, 0x39),
+	_INIT_CMD(0xCD, 0x2E),
+	_INIT_CMD(0xCE, 0x2F),
+	_INIT_CMD(0xCF, 0x2F),
+	_INIT_CMD(0xD0, 0x07),
+	_INIT_CMD(0xD2, 0x00),
+	_INIT_CMD(0xD3, 0x0D),
+	_INIT_CMD(0xD4, 0x17),
+	_INIT_CMD(0xD5, 0x26),
+	_INIT_CMD(0xD6, 0x31),
+	_INIT_CMD(0xD7, 0x3F),
+	_INIT_CMD(0xD8, 0x3F),
+	_INIT_CMD(0xD9, 0x3F),
+	_INIT_CMD(0xDA, 0x3F),
+	_INIT_CMD(0xDB, 0x37),
+	_INIT_CMD(0xDC, 0x37),
+	_INIT_CMD(0xDD, 0x37),
+	_INIT_CMD(0xDE, 0x39),
+	_INIT_CMD(0xDF, 0x2E),
+	_INIT_CMD(0xE0, 0x2F),
+	_INIT_CMD(0xE1, 0x2F),
+	_INIT_CMD(0xE2, 0x07),
+	_INIT_CMD(0xB0, 0x03),
+	_INIT_CMD(0xC8, 0x0B),
+	_INIT_CMD(0xC9, 0x07),
+	_INIT_CMD(0xC3, 0x00),
+	_INIT_CMD(0xE7, 0x00),
+	_INIT_CMD(0xC5, 0x2A),
+	_INIT_CMD(0xDE, 0x2A),
+	_INIT_CMD(0xCA, 0x43),
+	_INIT_CMD(0xC9, 0x07),
+	_INIT_CMD(0xE4, 0xC0),
+	_INIT_CMD(0xE5, 0x0D),
+	_INIT_CMD(0xCB, 0x01),
+	_INIT_CMD(0xBC, 0x01),
+	_INIT_CMD(0xB0, 0x06),
+	_INIT_CMD(0xB8, 0xA5),
+	_INIT_CMD(0xC0, 0xA5),
+	_INIT_CMD(0xC7, 0x0F),
+	_INIT_CMD(0xD5, 0x32),
+	_INIT_CMD(0xB8, 0x00),
+	_INIT_CMD(0xC0, 0x00),
+	_INIT_CMD(0xBC, 0x00),
+	_INIT_CMD(0xB0, 0x07),
+	_INIT_CMD(0xB1, 0x00),
+	_INIT_CMD(0xB2, 0x05),
+	_INIT_CMD(0xB3, 0x10),
+	_INIT_CMD(0xB4, 0x22),
+	_INIT_CMD(0xB5, 0x36),
+	_INIT_CMD(0xB6, 0x4A),
+	_INIT_CMD(0xB7, 0x6C),
+	_INIT_CMD(0xB8, 0x9A),
+	_INIT_CMD(0xB9, 0xD7),
+	_INIT_CMD(0xBA, 0x17),
+	_INIT_CMD(0xBB, 0x92),
+	_INIT_CMD(0xBC, 0x15),
+	_INIT_CMD(0xBD, 0x18),
+	_INIT_CMD(0xBE, 0x8C),
+	_INIT_CMD(0xBF, 0x00),
+	_INIT_CMD(0xC0, 0x3A),
+	_INIT_CMD(0xC1, 0x72),
+	_INIT_CMD(0xC2, 0x8C),
+	_INIT_CMD(0xC3, 0xA5),
+	_INIT_CMD(0xC4, 0xB1),
+	_INIT_CMD(0xC5, 0xBE),
+	_INIT_CMD(0xC6, 0xCA),
+	_INIT_CMD(0xC7, 0xD1),
+	_INIT_CMD(0xC8, 0xD4),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x16),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x08),
+	_INIT_CMD(0xB1, 0x04),
+	_INIT_CMD(0xB2, 0x05),
+	_INIT_CMD(0xB3, 0x11),
+	_INIT_CMD(0xB4, 0x24),
+	_INIT_CMD(0xB5, 0x39),
+	_INIT_CMD(0xB6, 0x4E),
+	_INIT_CMD(0xB7, 0x72),
+	_INIT_CMD(0xB8, 0xA3),
+	_INIT_CMD(0xB9, 0xE1),
+	_INIT_CMD(0xBA, 0x25),
+	_INIT_CMD(0xBB, 0xA8),
+	_INIT_CMD(0xBC, 0x2E),
+	_INIT_CMD(0xBD, 0x32),
+	_INIT_CMD(0xBE, 0xAD),
+	_INIT_CMD(0xBF, 0x28),
+	_INIT_CMD(0xC0, 0x63),
+	_INIT_CMD(0xC1, 0x9B),
+	_INIT_CMD(0xC2, 0xB5),
+	_INIT_CMD(0xC3, 0xCF),
+	_INIT_CMD(0xC4, 0xDB),
+	_INIT_CMD(0xC5, 0xE8),
+	_INIT_CMD(0xC6, 0xF5),
+	_INIT_CMD(0xC7, 0xFA),
+	_INIT_CMD(0xC8, 0xFC),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x16),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x09),
+	_INIT_CMD(0xB1, 0x04),
+	_INIT_CMD(0xB2, 0x04),
+	_INIT_CMD(0xB3, 0x0F),
+	_INIT_CMD(0xB4, 0x22),
+	_INIT_CMD(0xB5, 0x37),
+	_INIT_CMD(0xB6, 0x4D),
+	_INIT_CMD(0xB7, 0x71),
+	_INIT_CMD(0xB8, 0xA2),
+	_INIT_CMD(0xB9, 0xE1),
+	_INIT_CMD(0xBA, 0x26),
+	_INIT_CMD(0xBB, 0xA9),
+	_INIT_CMD(0xBC, 0x2F),
+	_INIT_CMD(0xBD, 0x33),
+	_INIT_CMD(0xBE, 0xAC),
+	_INIT_CMD(0xBF, 0x24),
+	_INIT_CMD(0xC0, 0x5D),
+	_INIT_CMD(0xC1, 0x94),
+	_INIT_CMD(0xC2, 0xAC),
+	_INIT_CMD(0xC3, 0xC5),
+	_INIT_CMD(0xC4, 0xD1),
+	_INIT_CMD(0xC5, 0xDC),
+	_INIT_CMD(0xC6, 0xE8),
+	_INIT_CMD(0xC7, 0xED),
+	_INIT_CMD(0xC8, 0xF0),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x16),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x0A),
+	_INIT_CMD(0xB1, 0x00),
+	_INIT_CMD(0xB2, 0x05),
+	_INIT_CMD(0xB3, 0x10),
+	_INIT_CMD(0xB4, 0x22),
+	_INIT_CMD(0xB5, 0x36),
+	_INIT_CMD(0xB6, 0x4A),
+	_INIT_CMD(0xB7, 0x6C),
+	_INIT_CMD(0xB8, 0x9A),
+	_INIT_CMD(0xB9, 0xD7),
+	_INIT_CMD(0xBA, 0x17),
+	_INIT_CMD(0xBB, 0x92),
+	_INIT_CMD(0xBC, 0x15),
+	_INIT_CMD(0xBD, 0x18),
+	_INIT_CMD(0xBE, 0x8C),
+	_INIT_CMD(0xBF, 0x00),
+	_INIT_CMD(0xC0, 0x3A),
+	_INIT_CMD(0xC1, 0x72),
+	_INIT_CMD(0xC2, 0x8C),
+	_INIT_CMD(0xC3, 0xA5),
+	_INIT_CMD(0xC4, 0xB1),
+	_INIT_CMD(0xC5, 0xBE),
+	_INIT_CMD(0xC6, 0xCA),
+	_INIT_CMD(0xC7, 0xD1),
+	_INIT_CMD(0xC8, 0xD4),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x16),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x0B),
+	_INIT_CMD(0xB1, 0x04),
+	_INIT_CMD(0xB2, 0x05),
+	_INIT_CMD(0xB3, 0x11),
+	_INIT_CMD(0xB4, 0x24),
+	_INIT_CMD(0xB5, 0x39),
+	_INIT_CMD(0xB6, 0x4E),
+	_INIT_CMD(0xB7, 0x72),
+	_INIT_CMD(0xB8, 0xA3),
+	_INIT_CMD(0xB9, 0xE1),
+	_INIT_CMD(0xBA, 0x25),
+	_INIT_CMD(0xBB, 0xA8),
+	_INIT_CMD(0xBC, 0x2E),
+	_INIT_CMD(0xBD, 0x32),
+	_INIT_CMD(0xBE, 0xAD),
+	_INIT_CMD(0xBF, 0x28),
+	_INIT_CMD(0xC0, 0x63),
+	_INIT_CMD(0xC1, 0x9B),
+	_INIT_CMD(0xC2, 0xB5),
+	_INIT_CMD(0xC3, 0xCF),
+	_INIT_CMD(0xC4, 0xDB),
+	_INIT_CMD(0xC5, 0xE8),
+	_INIT_CMD(0xC6, 0xF5),
+	_INIT_CMD(0xC7, 0xFA),
+	_INIT_CMD(0xC8, 0xFC),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x16),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
+	_INIT_CMD(0xB0, 0x0C),
+	_INIT_CMD(0xB1, 0x04),
+	_INIT_CMD(0xB2, 0x04),
+	_INIT_CMD(0xB3, 0x0F),
+	_INIT_CMD(0xB4, 0x22),
+	_INIT_CMD(0xB5, 0x37),
+	_INIT_CMD(0xB6, 0x4D),
+	_INIT_CMD(0xB7, 0x71),
+	_INIT_CMD(0xB8, 0xA2),
+	_INIT_CMD(0xB9, 0xE1),
+	_INIT_CMD(0xBA, 0x26),
+	_INIT_CMD(0xBB, 0xA9),
+	_INIT_CMD(0xBC, 0x2F),
+	_INIT_CMD(0xBD, 0x33),
+	_INIT_CMD(0xBE, 0xAC),
+	_INIT_CMD(0xBF, 0x24),
+	_INIT_CMD(0xC0, 0x5D),
+	_INIT_CMD(0xC1, 0x94),
+	_INIT_CMD(0xC2, 0xAC),
+	_INIT_CMD(0xC3, 0xC5),
+	_INIT_CMD(0xC4, 0xD1),
+	_INIT_CMD(0xC5, 0xDC),
+	_INIT_CMD(0xC6, 0xE8),
+	_INIT_CMD(0xC7, 0xED),
+	_INIT_CMD(0xC8, 0xF0),
+	_INIT_CMD(0xC9, 0x00),
+	_INIT_CMD(0xCA, 0x00),
+	_INIT_CMD(0xCB, 0x16),
+	_INIT_CMD(0xCC, 0xAF),
+	_INIT_CMD(0xCD, 0xFF),
+	_INIT_CMD(0xCE, 0xFF),
 
 	{},
 };
@@ -896,17 +843,11 @@ static const struct panel_desc boe_himax8279d10p_panel_desc = {
 	.bpc = 8,
 	.width_mm = 135,
 	.height_mm = 216,
-	.delay_t1 = 5000,
-	.reset_delay_t2 = 14000,
-	.reset_delay_t3 = 1000,
-	.reset_delay_t4 = 1000,
-	.reset_delay_t5 = 5000,
 	.mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
 			MIPI_DSI_CLOCK_NON_CONTINUOUS | MIPI_DSI_MODE_LPM,
 	.format = MIPI_DSI_FMT_RGB888,
 	.lanes = 4,
 	.on_cmds = boe_himax8279d10p_on_cmds,
-	.off_cmds = default_off_cmds,
 };
 
 static const struct of_device_id panel_of_match[] = {
-- 
2.17.1

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel

[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux