drm/panel: Add Boe Himax8279d MIPI-DSI LCD panel
PATCH v10 6/9 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
- 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.
--- drivers/gpu/drm/panel/panel-boe-himax8279d.c | 109 ++++++++----------- 1 file changed, 45 insertions(+), 64 deletions(-)
drivers/gpu/drm/panel/panel-boe-himax8279d.c +45 -64
@@ -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);
Signature · 6 lines
2.17.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel