[PATCH 8/9] [v10, 8/9] drm/panel: Add Boe Himax8279d MIPI-DSI LCD panel

Jerry Han jerry.han.hq at gmail.com
Thu Sep 19 06:18:25 UTC 2019


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

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

V7:
- Modify communication address

V6:
- 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)

V5:
- 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)

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 at gmail.com>
Reviewed-by: Sam Ravnborg <sam at ravnborg.org>
Reviewed-by: Derek Basehore <dbasehore at chromium.org>
Reviewed-by: Emil Velikov <emil.l.velikov at gmail.com>
Cc: Jitao Shi <jitao.shi at mediatek.com>
---
 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



More information about the dri-devel mailing list