On Fri, Jun 14, 2024 at 10:55:07PM GMT, Zhaoxiong Lv wrote: > Currently, the init_code of the jd9365da driver is placed > in the enable() function and sent, but this seems to take > a long time. It takes 17ms to send each instruction (an init > code consists of about 200 instructions), so it takes > about 3.5s to send the init_code. So we moved the sending > of the inti_code to the prepare() function, and each > instruction seemed to take only 25μs. Additional details about the DSI host would be appreciated. I guess that the difference in time used to send the command is due to the DSI host interleaving commands between video frames, but it would be nice to have that spelled in the commit message. > > Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> > --- > .../gpu/drm/panel/panel-jadard-jd9365da-h3.c | 781 +++++++++--------- > 1 file changed, 393 insertions(+), 388 deletions(-) > > diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c > index 4879835fe101..b39f01d7002e 100644 > --- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c > +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c > @@ -19,17 +19,13 @@ > #include <linux/of.h> > #include <linux/regulator/consumer.h> > > -#define JD9365DA_INIT_CMD_LEN 2 > - > -struct jadard_init_cmd { > - u8 data[JD9365DA_INIT_CMD_LEN]; > -}; > +struct jadard; > > struct jadard_panel_desc { > const struct drm_display_mode mode; > unsigned int lanes; > enum mipi_dsi_pixel_format format; > - const struct jadard_init_cmd *init_cmds; > + int (*init)(struct jadard *jadard); > u32 num_init_cmds; > }; > > @@ -52,21 +48,9 @@ static int jadard_enable(struct drm_panel *panel) > { > struct device *dev = panel->dev; > struct jadard *jadard = panel_to_jadard(panel); > - const struct jadard_panel_desc *desc = jadard->desc; > struct mipi_dsi_device *dsi = jadard->dsi; > - unsigned int i; > int err; > > - msleep(10); > - > - for (i = 0; i < desc->num_init_cmds; i++) { > - const struct jadard_init_cmd *cmd = &desc->init_cmds[i]; > - > - err = mipi_dsi_dcs_write_buffer(dsi, cmd->data, JD9365DA_INIT_CMD_LEN); > - if (err < 0) > - return err; > - } > - > msleep(120); > > err = mipi_dsi_dcs_exit_sleep_mode(dsi); > @@ -117,9 +101,21 @@ static int jadard_prepare(struct drm_panel *panel) > msleep(10); > > gpiod_set_value(jadard->reset, 1); > - msleep(120); > + msleep(130); > + > + ret = jadard->desc->init(jadard); > + if (ret < 0) > + goto poweroff; Plese don't mix refactoring with functional changes. Please split this into two patches, one for using _multi and another one for moving init to prepare() > > return 0; > + > +poweroff: > + gpiod_set_value(jadard->reset, 0); > + /* T6: 2ms */ > + usleep_range(1000, 2000); > + regulator_disable(jadard->vccio); > + > + return ret; > } > -- With best wishes Dmitry