drm/panel: jdi-lt070me05000: Use MIPI DSI multi functions
Subsystems (3)
PATCH v2 1/1 drm/panel: jdi-lt070me05000: Use MIPI DSI multi functions
Convert to the non-deprecated mipi_dsi_*_multi() helpers per the TODO list. This reduces boilerplate error checking while providing proper error accumulation.
Use mipi_dsi_msleep() and mipi_dsi_usleep_range() macros for delays. Replace mdelay(10) and mdelay(20) with mipi_dsi_usleep_range() calls using tighter slop (10-11ms and 20-21ms respectively) since these functions aren't run often and don't need large timing windows.
In jdi_panel_off(), reset the error context between display_off and enter_sleep_mode to preserve the original behavior of continuing power-down even if display_off fails. This ensures enter_sleep_mode executes before GPIO/regulator control, which is critical for proper power sequencing.
---
Changes in v2:
- Replaced mdelay() with mipi_dsi_usleep_range() for timing (tighter bounds per review)
- Switched to mipi_dsi_generic_write_seq_multi() for cleaner varargs syntax
- Applied lowercase hex notation per kernel style guide
- Added error accumulator reset in jdi_panel_off() to preserve power-down behavior
- Kept final msleep(100) outside multi context for safety
.../gpu/drm/panel/panel-jdi-lt070me05000.c | 105 ++++-------------- 1 file changed, 24 insertions(+), 81 deletions(-)
drivers/gpu/drm/panel/panel-jdi-lt070me05000.c +24 -81
@@ -48,34 +48,16 @@ static inline struct jdi_panel *to_jdi_panel(struct drm_panel *panel)static int jdi_panel_init (struct jdi_panel *jdi) {struct mipi_dsi_device *dsi = jdi->dsi; -struct device *dev = &jdi->dsi->dev; -int ret; +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; dsi->mode_flags |=MIPI_DSI_MODE_LPM ; - ret =mipi_dsi_dcs_soft_reset (dsi); -if (ret <0 ) -return ret; - -usleep_range (10000 ,20000 ); - - ret =mipi_dsi_dcs_set_pixel_format (dsi,MIPI_DCS_PIXEL_FMT_24BIT <<4 ); -if (ret <0 ) { -dev_err (dev,"failed to set pixel format: %d\n" , ret); -return ret; - } - - ret =mipi_dsi_dcs_set_column_address (dsi,0 , jdi->mode->hdisplay -1 ); -if (ret <0 ) { -dev_err (dev,"failed to set column address: %d\n" , ret); -return ret; - } +mipi_dsi_dcs_soft_reset_multi (&dsi_ctx); +mipi_dsi_usleep_range (&dsi_ctx,10000 ,20000 ); - ret =mipi_dsi_dcs_set_page_address (dsi,0 , jdi->mode->vdisplay -1 ); -if (ret <0 ) { -dev_err (dev,"failed to set page address: %d\n" , ret); -return ret; - } +mipi_dsi_dcs_set_pixel_format_multi (&dsi_ctx,MIPI_DCS_PIXEL_FMT_24BIT <<4 ); +mipi_dsi_dcs_set_column_address_multi (&dsi_ctx,0 , jdi->mode->hdisplay -1 ); +mipi_dsi_dcs_set_page_address_multi (&dsi_ctx,0 , jdi->mode->vdisplay -1 );/* * BIT(5) BCTRL = 1 Backlight Control Block On, Brightness registers
@@ -83,88 +65,49 @@ static int jdi_panel_init(struct jdi_panel *jdi)* BIT(3) BL = 1 Backlight Control On * BIT(2) DD = 0 Display Dimming is Off */ - ret =mipi_dsi_dcs_write (dsi,MIPI_DCS_WRITE_CONTROL_DISPLAY , - (u8 []){0x24 },1 ); -if (ret <0 ) { -dev_err (dev,"failed to write control display: %d\n" , ret); -return ret; - } +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_WRITE_CONTROL_DISPLAY ,0x24 );/* CABC off */ - ret =mipi_dsi_dcs_write (dsi,MIPI_DCS_WRITE_POWER_SAVE , - (u8 []){0x00 },1 ); -if (ret <0 ) { -dev_err (dev,"failed to set cabc off: %d\n" , ret); -return ret; - } +mipi_dsi_dcs_write_seq_multi (&dsi_ctx,MIPI_DCS_WRITE_POWER_SAVE ,0x00 ); - ret =mipi_dsi_dcs_exit_sleep_mode (dsi); -if (ret <0 ) { -dev_err (dev,"failed to set exit sleep mode: %d\n" , ret); -return ret; - } - -msleep (120 ); - - ret =mipi_dsi_generic_write (dsi, (u8 []){0xB0 ,0x00 },2 ); -if (ret <0 ) { -dev_err (dev,"failed to set mcap: %d\n" , ret); -return ret; - } +mipi_dsi_dcs_exit_sleep_mode_multi (&dsi_ctx); +mipi_dsi_msleep (&dsi_ctx,120 ); -mdelay (10 ); +mipi_dsi_generic_write_seq_multi (&dsi_ctx,0xb0 ,0x00 ); +mipi_dsi_usleep_range (&dsi_ctx,10000 ,11000 );/* Interface setting, video mode */ - ret =mipi_dsi_generic_write (dsi, (u8 []) - {0xB3 ,0x26 ,0x08 ,0x00 ,0x20 ,0x00 },6 ); -if (ret <0 ) { -dev_err (dev,"failed to set display interface setting: %d\n" - , ret); -return ret; - } +mipi_dsi_generic_write_seq_multi (&dsi_ctx,0xb3 ,0x26 ,0x08 ,0x00 ,0x20 ,0x00 ); +mipi_dsi_usleep_range (&dsi_ctx,20000 ,21000 ); -mdelay (20 ); +mipi_dsi_generic_write_seq_multi (&dsi_ctx,0xb0 ,0x03 ); - ret =mipi_dsi_generic_write (dsi, (u8 []){0xB0 ,0x03 },2 ); -if (ret <0 ) { -dev_err (dev,"failed to set default values for mcap: %d\n" - , ret); -return ret; - } - -return 0 ; +return dsi_ctx.accum_err; }static int jdi_panel_on (struct jdi_panel *jdi) {struct mipi_dsi_device *dsi = jdi->dsi; -struct device *dev = &jdi->dsi->dev; -int ret; +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; dsi->mode_flags |=MIPI_DSI_MODE_LPM ; - ret =mipi_dsi_dcs_set_display_on (dsi); -if (ret <0 ) -dev_err (dev,"failed to set display on: %d\n" , ret); +mipi_dsi_dcs_set_display_on_multi (&dsi_ctx); -return ret; +return dsi_ctx.accum_err; }static void jdi_panel_off (struct jdi_panel *jdi) {struct mipi_dsi_device *dsi = jdi->dsi; -struct device *dev = &jdi->dsi->dev; -int ret; +struct mipi_dsi_multi_context dsi_ctx = { .dsi = dsi }; dsi->mode_flags &= ~MIPI_DSI_MODE_LPM ; - ret =mipi_dsi_dcs_set_display_off (dsi); -if (ret <0 ) -dev_err (dev,"failed to set display off: %d\n" , ret); - - ret =mipi_dsi_dcs_enter_sleep_mode (dsi); -if (ret <0 ) -dev_err (dev,"failed to enter sleep mode: %d\n" , ret); +mipi_dsi_dcs_set_display_off_multi (&dsi_ctx); +/* Reset error to continue power-down even if display off failed */ + dsi_ctx.accum_err =0 ; +mipi_dsi_dcs_enter_sleep_mode_multi (&dsi_ctx);msleep (100 ); }
Signature · 1 line
2.43.0
Hi,
Quoted 25 lines · Chintan Patel
Convert to the non-deprecated mipi_dsi_*_multi() helpers per the TODO list. This reduces boilerplate error checking while providing proper error accumulation.
Use
mipi_dsi_msleep()andmipi_dsi_usleep_range()macros for delays. Replace mdelay(10) and mdelay(20) withmipi_dsi_usleep_range()calls using tighter slop (10-11ms and 20-21ms respectively) since these functions aren't run often and don't need large timing windows.In
jdi_panel_off(), reset the error context betweendisplay_offandenter_sleep_modeto preserve the original behavior of continuing power-down even ifdisplay_offfails. This ensuresenter_sleep_modeexecutes before GPIO/regulator control, which is critical for proper power sequencing.Signed-off-by Chintan Patel <[email protected]>---
Changes in v2:
- Replacedmdelay()withmipi_dsi_usleep_range()for timing (tighter bounds per review)
- Switched tomipi_dsi_generic_write_seq_multi()for cleaner varargs syntax
- Applied lowercase hex notation per kernel style guide
- Added error accumulator reset injdi_panel_off()to preserve power-down behavior
- Kept final msleep(100) outside multi context for safety
Quoted 2 lines
.../gpu/drm/panel/panel-jdi-lt070me05000.c | 105 ++++-------------- 1 file changed, 24 insertions(+), 81 deletions(-)
This looks nice to me now, and I think it's a nice improvement to the driver.
I'll put it in my queue and plan to land it next week unless someone beats me to it or has additional comments.
-Doug
Quoted 13 lines
Quoted 10 lines
---
Changes in v2:
- Replacedmdelay()withmipi_dsi_usleep_range()for timing (tighter bounds per review)
- Switched tomipi_dsi_generic_write_seq_multi()for cleaner varargs syntax
- Applied lowercase hex notation per kernel style guide
- Added error accumulator reset injdi_panel_off()to preserve power-down behavior
- Kept final msleep(100) outside multi context for safetyQuoted 2 lines
.../gpu/drm/panel/panel-jdi-lt070me05000.c | 105 ++++-------------- 1 file changed, 24 insertions(+), 81 deletions(-)
Quoted 6 lines
This looks nice to me now, and I think it's a nice improvement to the driver.
Reviewed-by Douglas Anderson <[email protected]>I'll put it in my queue and plan to land it next week unless someone beats me to it or has additional comments.
Thank you Doug! I appreciate your review feedback.
Quoted 1 line
-Doug
Doug Anderson
AppliedHi,
Quoted 32 lines · Doug Anderson
Hi,
Quoted 25 lines · Chintan Patel
Convert to the non-deprecated mipi_dsi_*_multi() helpers per the TODO list. This reduces boilerplate error checking while providing proper error accumulation.
Use
mipi_dsi_msleep()andmipi_dsi_usleep_range()macros for delays. Replace mdelay(10) and mdelay(20) withmipi_dsi_usleep_range()calls using tighter slop (10-11ms and 20-21ms respectively) since these functions aren't run often and don't need large timing windows.In
jdi_panel_off(), reset the error context betweendisplay_offandenter_sleep_modeto preserve the original behavior of continuing power-down even ifdisplay_offfails. This ensuresenter_sleep_modeexecutes before GPIO/regulator control, which is critical for proper power sequencing.Signed-off-by Chintan Patel <[email protected]>---
Changes in v2:
- Replacedmdelay()withmipi_dsi_usleep_range()for timing (tighter bounds per review)
- Switched tomipi_dsi_generic_write_seq_multi()for cleaner varargs syntax
- Applied lowercase hex notation per kernel style guide
- Added error accumulator reset injdi_panel_off()to preserve power-down behavior
- Kept final msleep(100) outside multi context for safetyQuoted 2 lines
.../gpu/drm/panel/panel-jdi-lt070me05000.c | 105 ++++-------------- 1 file changed, 24 insertions(+), 81 deletions(-)
Quoted 6 lines
This looks nice to me now, and I think it's a nice improvement to the driver.
Reviewed-by Douglas Anderson <[email protected]>I'll put it in my queue and plan to land it next week unless someone beats me to it or has additional comments.
Pushed to drm-misc-next. Thanks!
[1/1] drm/panel: jdi-lt070me05000: Use MIPI DSI multi functions
commit: 857e2d886ad32d9a49fe99fd06bd78f4354043f4