* [PATCH v4 0/4] Add kd101ne3-40ti configuration in driver jd9365da
@ 2024-06-20 8:05 Zhaoxiong Lv
2024-06-20 8:05 ` [PATCH v4 1/4] drm/panel: jd9365da: Modify the method of sending commands Zhaoxiong Lv
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Zhaoxiong Lv @ 2024-06-20 8:05 UTC (permalink / raw)
To: dmitry.torokhov, robh, krzysztof.kozlowski+dt, conor+dt, jikos,
benjamin.tissoires, dianders, hsinyi
Cc: dri-devel, devicetree, linux-kernel, Zhaoxiong Lv
This kingdisplay panel uses the jd9365da controller, so add it to
panel-jadard-jd9365da-h3.c driver, but because the init_code and timing
are different, some variables are added in struct jadard_panel_des to
control it.
In addition, since sending init_code in the enable() function takes a long
time, it is moved to the prepare() function.
Changes between V4 and V3:
- PATCH 1/4: Only move mipi_dsi_dcs_write_buffer from enable() function to
- prepare() function, and no longer use mipi_dsi_dcs_write_seq_multi.
- PATCH 2/4: Move positions to keep the list sorted.
- PATCH 3/4: Use mipi_dsi_msleep.
- Adjust the ".clock" assignment format.
- Adjust "compatible" positions to keep the list sorted.
- PATCH 4/4: No changes.
- Link to v3: https://lore.kernel.org/all/20240614145510.22965-1-lvzhaoxiong@huaqin.corp-partner.google.com/
Changes between V3 and V2:
- PATCH 1/4: Modify the init_code sending method
- PATCH 2/4: Add binding for kingdisplay-kd101ne3 in jadard,jd9365da-h3.yaml
- PATCH 3/4: Add compatibility for kingdisplay-kd101ne3 in panel-jadard-jd9365da-h3.c driver,
- and add some variables to control timing.
- PATCH 4/4: Add the function of adjusting orientation.
- Link to v2: https://lore.kernel.org/all/20240601084528.22502-1-lvzhaoxiong@huaqin.corp-partner.google.com/
Changes between V2 and V1:
- PATCH 1/4: Delete some unnecessary information.
- PATCH 2/4: Use the new mipi_dsi_dcs_write_seq_multi() function, deleted some unnecessary functions.
- PATCH 3/4: Add compatible for Starry-er88577.
- PATCH 4/4: Add starry panel configuration in panel-kingdisplay-kd101ne3 driver.
- Link to v1: https://lore.kernel.org/all/20240418081548.12160-1-lvzhaoxiong@huaqin.corp-partner.google.com/
Zhaoxiong Lv (4):
drm/panel: jd9365da: Modify the method of sending commands
dt-bindings: display: panel: Add compatible for kingdisplay-kd101ne3
drm/panel: jd9365da: Support for kd101ne3-40ti MIPI-DSI panel.
drm/panel: jd9365da: Add the function of adjusting orientation
.../display/panel/jadard,jd9365da-h3.yaml | 1 +
.../gpu/drm/panel/panel-jadard-jd9365da-h3.c | 317 +++++++++++++++++-
2 files changed, 304 insertions(+), 14 deletions(-)
--
2.17.1
^ permalink raw reply [flat|nested] 9+ messages in thread* [PATCH v4 1/4] drm/panel: jd9365da: Modify the method of sending commands 2024-06-20 8:05 [PATCH v4 0/4] Add kd101ne3-40ti configuration in driver jd9365da Zhaoxiong Lv @ 2024-06-20 8:05 ` Zhaoxiong Lv 2024-06-21 19:33 ` Doug Anderson 2024-06-20 8:05 ` [PATCH v4 2/4] dt-bindings: display: panel: Add compatible for kingdisplay-kd101ne3 Zhaoxiong Lv ` (2 subsequent siblings) 3 siblings, 1 reply; 9+ messages in thread From: Zhaoxiong Lv @ 2024-06-20 8:05 UTC (permalink / raw) To: dmitry.torokhov, robh, krzysztof.kozlowski+dt, conor+dt, jikos, benjamin.tissoires, dianders, hsinyi Cc: dri-devel, devicetree, linux-kernel, Zhaoxiong Lv 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. We checked the DSI host and found that the difference in command sending time is caused by the different modes of the DSI host in prepare() and enable() functions. Our DSI Host only supports sending cmd in LP mode, The prepare() function can directly send init_code (LP->cmd) in LP mode, but the enable() function is in HS mode and needs to switch to LP mode before sending init code (HS->LP->cmd->HS). Therefore, it takes longer to send the command. Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com> --- Changes between V4 and V3: - 1. Only move mipi_dsi_dcs_write_buffer from enable() function to prepare() function, - and no longer use mipi_dsi_dcs_write_seq_multi. V3:https://lore.kernel.org/all/20240614145510.22965-2-lvzhaoxiong@huaqin.corp-partner.google.com/ --- .../gpu/drm/panel/panel-jadard-jd9365da-h3.c | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 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..a9c483a7b3fa 100644 --- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c @@ -52,21 +52,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); @@ -100,6 +88,8 @@ static int jadard_disable(struct drm_panel *panel) static int jadard_prepare(struct drm_panel *panel) { struct jadard *jadard = panel_to_jadard(panel); + const struct jadard_panel_desc *desc = jadard->desc; + unsigned int i; int ret; ret = regulator_enable(jadard->vccio); @@ -117,7 +107,15 @@ static int jadard_prepare(struct drm_panel *panel) msleep(10); gpiod_set_value(jadard->reset, 1); - msleep(120); + msleep(130); + + for (i = 0; i < desc->num_init_cmds; i++) { + const struct jadard_init_cmd *cmd = &desc->init_cmds[i]; + + ret = mipi_dsi_dcs_write_buffer(dsi, cmd->data, JD9365DA_INIT_CMD_LEN); + if (ret < 0) + return ret; + } return 0; } -- 2.17.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 1/4] drm/panel: jd9365da: Modify the method of sending commands 2024-06-20 8:05 ` [PATCH v4 1/4] drm/panel: jd9365da: Modify the method of sending commands Zhaoxiong Lv @ 2024-06-21 19:33 ` Doug Anderson 0 siblings, 0 replies; 9+ messages in thread From: Doug Anderson @ 2024-06-21 19:33 UTC (permalink / raw) To: Zhaoxiong Lv Cc: dmitry.torokhov, robh, krzysztof.kozlowski+dt, conor+dt, jikos, benjamin.tissoires, hsinyi, dri-devel, devicetree, linux-kernel, Jagan Teki, Neil Armstrong, Jessica Zhang, Dmitry Baryshkov Hi, On Thu, Jun 20, 2024 at 1:05 AM Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com> 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. > > We checked the DSI host and found that the difference in > command sending time is caused by the different modes of > the DSI host in prepare() and enable() functions. > Our DSI Host only supports sending cmd in LP mode, The > prepare() function can directly send init_code (LP->cmd) > in LP mode, but the enable() function is in HS mode and > needs to switch to LP mode before sending init code > (HS->LP->cmd->HS). Therefore, it takes longer to send > the command. > > Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com> > --- > > Changes between V4 and V3: > - 1. Only move mipi_dsi_dcs_write_buffer from enable() function to prepare() function, > - and no longer use mipi_dsi_dcs_write_seq_multi. > > V3:https://lore.kernel.org/all/20240614145510.22965-2-lvzhaoxiong@huaqin.corp-partner.google.com/ > > --- > .../gpu/drm/panel/panel-jadard-jd9365da-h3.c | 24 +++++++++---------- > 1 file changed, 11 insertions(+), 13 deletions(-) This seems reasonable to me, but I'd prefer someone with more MIPI experience than me to actually give it a good review to make sure that the argument about things being in prepare() vs enable() makes sense to them. Actually, that makes me look at your CC list, which seems to be missing some important people. You should have run `./scripts/get_maintainer.pl` and used that to help you make your CC list, but you're missing some important people including the maintainer of this driver and the panel maintainer. I've added a few of those people to this patch. If you send future versions please include folks that get_maintainer points out. > @@ -117,7 +107,15 @@ static int jadard_prepare(struct drm_panel *panel) > msleep(10); > > gpiod_set_value(jadard->reset, 1); > - msleep(120); > + msleep(130); > + > + for (i = 0; i < desc->num_init_cmds; i++) { > + const struct jadard_init_cmd *cmd = &desc->init_cmds[i]; > + > + ret = mipi_dsi_dcs_write_buffer(dsi, cmd->data, JD9365DA_INIT_CMD_LEN); In general people don't like the table-based approach for DSI init. For this patch it's probably OK, but before the later patch where you add a new panel you'll probably need to transition to a separate init per panel and then use mipi_dsi_dcs_write_seq_multi() in there. I'll comment more on the later patch. In other words, one possible v5 should be a 5-patch series: Patch #1: this patch Patch #2: DT binding Patch #3: switch jd9365da to use mipi_dsi_dcs_write_seq_multi() but no functional changes. Patch #4: add your new panel. Patch #5: orientation. -Doug ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 2/4] dt-bindings: display: panel: Add compatible for kingdisplay-kd101ne3 2024-06-20 8:05 [PATCH v4 0/4] Add kd101ne3-40ti configuration in driver jd9365da Zhaoxiong Lv 2024-06-20 8:05 ` [PATCH v4 1/4] drm/panel: jd9365da: Modify the method of sending commands Zhaoxiong Lv @ 2024-06-20 8:05 ` Zhaoxiong Lv 2024-06-20 16:14 ` Conor Dooley 2024-06-20 8:05 ` [PATCH v4 3/4] drm/panel: jd9365da: Support for kd101ne3-40ti MIPI-DSI panel Zhaoxiong Lv 2024-06-20 8:05 ` [PATCH v4 4/4] drm/panel: jd9365da: Add the function of adjusting orientation Zhaoxiong Lv 3 siblings, 1 reply; 9+ messages in thread From: Zhaoxiong Lv @ 2024-06-20 8:05 UTC (permalink / raw) To: dmitry.torokhov, robh, krzysztof.kozlowski+dt, conor+dt, jikos, benjamin.tissoires, dianders, hsinyi Cc: dri-devel, devicetree, linux-kernel, Zhaoxiong Lv The kingdisplay-kd101ne3 is a 10.1" WXGA TFT-LCD panel with jadard-jd9365da controller. Hence, we add a new compatible with panel specific config. Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com> --- Changes between V4 and V3: - 1. Move positions to keep the list sorted. V2:https://lore.kernel.org/all/20240614145510.22965-3-lvzhaoxiong@huaqin.corp-partner.google.com/ Changes between V3 and V2: - 1. Abandon the V2 patch and add kingdisplay kd101ne3-40ti binding to - jadard,jd9365da-h3.yaml again. V2:https://lore.kernel.org/all/20240601084528.22502-2-lvzhaoxiong@huaqin.corp-partner.google.com/ Changes between V2 and V1: - Drop some properties that have already been defined in panel-common. - The header file 'dt-bindings/gpio/gpio.h' is not used, delete it V1: https://lore.kernel.org/all/20240418081548.12160-2-lvzhaoxiong@huaqin.corp-partner.google.com/ --- .../devicetree/bindings/display/panel/jadard,jd9365da-h3.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/display/panel/jadard,jd9365da-h3.yaml b/Documentation/devicetree/bindings/display/panel/jadard,jd9365da-h3.yaml index 41eb7fbf7715..2b977292dc48 100644 --- a/Documentation/devicetree/bindings/display/panel/jadard,jd9365da-h3.yaml +++ b/Documentation/devicetree/bindings/display/panel/jadard,jd9365da-h3.yaml @@ -17,6 +17,7 @@ properties: items: - enum: - chongzhou,cz101b4001 + - kingdisplay,kd101ne3-40ti - radxa,display-10hd-ad001 - radxa,display-8hd-ad002 - const: jadard,jd9365da-h3 -- 2.17.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 2/4] dt-bindings: display: panel: Add compatible for kingdisplay-kd101ne3 2024-06-20 8:05 ` [PATCH v4 2/4] dt-bindings: display: panel: Add compatible for kingdisplay-kd101ne3 Zhaoxiong Lv @ 2024-06-20 16:14 ` Conor Dooley 0 siblings, 0 replies; 9+ messages in thread From: Conor Dooley @ 2024-06-20 16:14 UTC (permalink / raw) To: Zhaoxiong Lv Cc: dmitry.torokhov, robh, krzysztof.kozlowski+dt, conor+dt, jikos, benjamin.tissoires, dianders, hsinyi, dri-devel, devicetree, linux-kernel [-- Attachment #1: Type: text/plain, Size: 354 bytes --] On Thu, Jun 20, 2024 at 04:05:07PM +0800, Zhaoxiong Lv wrote: > The kingdisplay-kd101ne3 is a 10.1" WXGA TFT-LCD panel with > jadard-jd9365da controller. Hence, we add a new compatible > with panel specific config. > > Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 3/4] drm/panel: jd9365da: Support for kd101ne3-40ti MIPI-DSI panel. 2024-06-20 8:05 [PATCH v4 0/4] Add kd101ne3-40ti configuration in driver jd9365da Zhaoxiong Lv 2024-06-20 8:05 ` [PATCH v4 1/4] drm/panel: jd9365da: Modify the method of sending commands Zhaoxiong Lv 2024-06-20 8:05 ` [PATCH v4 2/4] dt-bindings: display: panel: Add compatible for kingdisplay-kd101ne3 Zhaoxiong Lv @ 2024-06-20 8:05 ` Zhaoxiong Lv 2024-06-21 19:33 ` Doug Anderson 2024-06-20 8:05 ` [PATCH v4 4/4] drm/panel: jd9365da: Add the function of adjusting orientation Zhaoxiong Lv 3 siblings, 1 reply; 9+ messages in thread From: Zhaoxiong Lv @ 2024-06-20 8:05 UTC (permalink / raw) To: dmitry.torokhov, robh, krzysztof.kozlowski+dt, conor+dt, jikos, benjamin.tissoires, dianders, hsinyi Cc: dri-devel, devicetree, linux-kernel, Zhaoxiong Lv The K&d kd101ne3-40ti is a 10.1" WXGA TFT-LCD panel, use jd9365da controller,which fits in nicely with the existing panel-jadard-jd9365da-h3 driver.Hence,we add a new compatible with panel specific config. Although they have the same control IC, the two panels are different, and the timing will be slightly different, so we added some variables in struct jadard_panel_desc to control the timing Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com> --- Changes between V4 and V3: - 1. Use mipi_dsi_msleep. - 2. Adjust the ".clock" assignment format. - 3. Adjust "compatible" positions to keep the list sorted. V3:https://lore.kernel.org/all/20240614145510.22965-4-lvzhaoxiong@huaqin.corp-partner.google.com/ Changes between V3 and V2: - 1. Give up creating a new driver and re-add K&d kd101ne3-40ti - configuration to the panel-jadard-jd9365da-h3.c driver. V2:https://lore.kernel.org/all/20240601084528.22502-3-lvzhaoxiong@huaqin.corp-partner.google.com/ Changes between V2 and V1: - 1. Use the new mipi_dsi_dcs_write_seq_multi() function. - 2. Modify Move mipi_dsi_dcs_set_display_off() and mipi_dsi_dcs_enter_sleep_mode() to disable(), - and drop kingdisplay_panel_enter_sleep_mode(). - 3. If prepare fails, disable GPIO before regulators. - 4. This function drm_connector_set_panel_orientation() is no longer used. Delete it. - 5. Drop ".shutdown = kingdisplay_panel_shutdown". --- .../gpu/drm/panel/panel-jadard-jd9365da-h3.c | 281 +++++++++++++++++- 1 file changed, 279 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c index a9c483a7b3fa..632bffa035ee 100644 --- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c @@ -31,6 +31,15 @@ struct jadard_panel_desc { enum mipi_dsi_pixel_format format; const struct jadard_init_cmd *init_cmds; u32 num_init_cmds; + bool lp11_before_reset; + bool reset_before_power_off_vcioo; + unsigned int vcioo_to_lp11_delay; + unsigned int lp11_to_reset_delay; + unsigned int exit_sleep_to_display_on_delay; + unsigned int display_on_delay; + unsigned int backlight_off_to_display_off_delay; + unsigned int display_off_to_enter_sleep_delay; + unsigned int enter_sleep_to_reset_down_delay; }; struct jadard { @@ -53,6 +62,7 @@ static int jadard_enable(struct drm_panel *panel) struct device *dev = panel->dev; struct jadard *jadard = panel_to_jadard(panel); struct mipi_dsi_device *dsi = jadard->dsi; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = jadard->dsi }; int err; msleep(120); @@ -61,10 +71,16 @@ static int jadard_enable(struct drm_panel *panel) if (err < 0) DRM_DEV_ERROR(dev, "failed to exit sleep mode ret = %d\n", err); + if (jadard->desc->exit_sleep_to_display_on_delay) + mipi_dsi_msleep(dsi_ctx, jadard->desc->exit_sleep_to_display_on_delay); + err = mipi_dsi_dcs_set_display_on(dsi); if (err < 0) DRM_DEV_ERROR(dev, "failed to set display on ret = %d\n", err); + if (jadard->desc->display_on_delay) + mipi_dsi_msleep(dsi_ctx, jadard->desc->display_on_delay); + return 0; } @@ -72,16 +88,26 @@ static int jadard_disable(struct drm_panel *panel) { struct device *dev = panel->dev; struct jadard *jadard = panel_to_jadard(panel); + struct mipi_dsi_multi_context dsi_ctx = { .dsi = jadard->dsi }; int ret; + if (jadard->desc->backlight_off_to_display_off_delay) + mipi_dsi_msleep(dsi_ctx, jadard->desc->backlight_off_to_display_off_delay); + ret = mipi_dsi_dcs_set_display_off(jadard->dsi); if (ret < 0) DRM_DEV_ERROR(dev, "failed to set display off: %d\n", ret); + if (jadard->desc->display_off_to_enter_sleep_delay) + mipi_dsi_msleep(dsi_ctx, jadard->desc->display_off_to_enter_sleep_delay); + ret = mipi_dsi_dcs_enter_sleep_mode(jadard->dsi); if (ret < 0) DRM_DEV_ERROR(dev, "failed to enter sleep mode: %d\n", ret); + if (jadard->desc->enter_sleep_to_reset_down_delay) + mipi_dsi_msleep(dsi_ctx, jadard->desc->enter_sleep_to_reset_down_delay); + return 0; } @@ -89,6 +115,7 @@ static int jadard_prepare(struct drm_panel *panel) { struct jadard *jadard = panel_to_jadard(panel); const struct jadard_panel_desc *desc = jadard->desc; + struct mipi_dsi_multi_context dsi_ctx = { .dsi = jadard->dsi }; unsigned int i; int ret; @@ -100,6 +127,20 @@ static int jadard_prepare(struct drm_panel *panel) if (ret) return ret; + if (jadard->desc->vcioo_to_lp11_delay) + mipi_dsi_msleep(dsi_ctx, jadard->desc->vcioo_to_lp11_delay); + + if (jadard->desc->lp11_before_reset) { + ret = mipi_dsi_dcs_nop(jadard->dsi); + if (ret) + return ret; + + usleep_range(1000, 2000); + } + + if (jadard->desc->lp11_to_reset_delay) + mipi_dsi_msleep(dsi_ctx, jadard->desc->lp11_to_reset_delay); + gpiod_set_value(jadard->reset, 1); msleep(5); @@ -111,8 +152,7 @@ static int jadard_prepare(struct drm_panel *panel) for (i = 0; i < desc->num_init_cmds; i++) { const struct jadard_init_cmd *cmd = &desc->init_cmds[i]; - - ret = mipi_dsi_dcs_write_buffer(dsi, cmd->data, JD9365DA_INIT_CMD_LEN); + ret = mipi_dsi_dcs_write_buffer(jadard->dsi, cmd->data, JD9365DA_INIT_CMD_LEN); if (ret < 0) return ret; } @@ -127,6 +167,12 @@ static int jadard_unprepare(struct drm_panel *panel) gpiod_set_value(jadard->reset, 1); msleep(120); + if (jadard->desc->reset_before_power_off_vcioo) { + gpiod_set_value(jadard->reset, 0); + + usleep_range(1000, 2000); + } + regulator_disable(jadard->vdd); regulator_disable(jadard->vccio); @@ -582,6 +628,233 @@ static const struct jadard_panel_desc cz101b4001_desc = { .num_init_cmds = ARRAY_SIZE(cz101b4001_init_cmds), }; +static const struct jadard_init_cmd kingdisplay_kd101ne3_init_cmds[] = { + { .data = { 0xe0, 0x00 } }, + { .data = { 0xe1, 0x93 } }, + { .data = { 0xe2, 0x65 } }, + { .data = { 0xe3, 0xf8 } }, + { .data = { 0x80, 0x03 } }, + { .data = { 0xe0, 0x01 } }, + { .data = { 0x0c, 0x74 } }, + { .data = { 0x17, 0x00 } }, + { .data = { 0x18, 0xc7 } }, + { .data = { 0x19, 0x01 } }, + { .data = { 0x1a, 0x00 } }, + { .data = { 0x1b, 0xc7 } }, + { .data = { 0x1c, 0x01 } }, + { .data = { 0x24, 0xfe } }, + { .data = { 0x37, 0x19 } }, + { .data = { 0x35, 0x28 } }, + { .data = { 0x38, 0x05 } }, + { .data = { 0x39, 0x08 } }, + { .data = { 0x3a, 0x12 } }, + { .data = { 0x3c, 0x7e } }, + { .data = { 0x3d, 0xff } }, + { .data = { 0x3e, 0xff } }, + { .data = { 0x3f, 0x7f } }, + { .data = { 0x40, 0x06 } }, + { .data = { 0x41, 0xa0 } }, + { .data = { 0x43, 0x1e } }, + { .data = { 0x44, 0x0b } }, + { .data = { 0x55, 0x02 } }, + { .data = { 0x57, 0x6a } }, + { .data = { 0x59, 0x0a } }, + { .data = { 0x5a, 0x2e } }, + { .data = { 0x5b, 0x1a } }, + { .data = { 0x5c, 0x15 } }, + { .data = { 0x5d, 0x7f } }, + { .data = { 0x5e, 0x61 } }, + { .data = { 0x5f, 0x50 } }, + { .data = { 0x60, 0x43 } }, + { .data = { 0x61, 0x3f } }, + { .data = { 0x62, 0x32 } }, + { .data = { 0x63, 0x35 } }, + { .data = { 0x64, 0x1f } }, + { .data = { 0x65, 0x38 } }, + { .data = { 0x66, 0x36 } }, + { .data = { 0x67, 0x36 } }, + { .data = { 0x68, 0x54 } }, + { .data = { 0x69, 0x42 } }, + { .data = { 0x6a, 0x48 } }, + { .data = { 0x6b, 0x39 } }, + { .data = { 0x6c, 0x34 } }, + { .data = { 0x6d, 0x26 } }, + { .data = { 0x6e, 0x14 } }, + { .data = { 0x6f, 0x02 } }, + { .data = { 0x70, 0x7f } }, + { .data = { 0x71, 0x61 } }, + { .data = { 0x72, 0x50 } }, + { .data = { 0x73, 0x43 } }, + { .data = { 0x74, 0x3f } }, + { .data = { 0x75, 0x32 } }, + { .data = { 0x76, 0x35 } }, + { .data = { 0x77, 0x1f } }, + { .data = { 0x78, 0x38 } }, + { .data = { 0x79, 0x36 } }, + { .data = { 0x7a, 0x36 } }, + { .data = { 0x7b, 0x54 } }, + { .data = { 0x7c, 0x42 } }, + { .data = { 0x7d, 0x48 } }, + { .data = { 0x7e, 0x39 } }, + { .data = { 0x7f, 0x34 } }, + { .data = { 0x80, 0x26 } }, + { .data = { 0x81, 0x14 } }, + { .data = { 0x82, 0x02 } }, + { .data = { 0xe0, 0x02 } }, + { .data = { 0x00, 0x52 } }, + { .data = { 0x01, 0x5f } }, + { .data = { 0x02, 0x5f } }, + { .data = { 0x03, 0x50 } }, + { .data = { 0x04, 0x77 } }, + { .data = { 0x05, 0x57 } }, + { .data = { 0x06, 0x5f } }, + { .data = { 0x07, 0x4e } }, + { .data = { 0x08, 0x4c } }, + { .data = { 0x09, 0x5f } }, + { .data = { 0x0a, 0x4a } }, + { .data = { 0x0b, 0x48 } }, + { .data = { 0x0c, 0x5f } }, + { .data = { 0x0d, 0x46 } }, + { .data = { 0x0e, 0x44 } }, + { .data = { 0x0f, 0x40 } }, + { .data = { 0x10, 0x5f } }, + { .data = { 0x11, 0x5f } }, + { .data = { 0x12, 0x5f } }, + { .data = { 0x13, 0x5f } }, + { .data = { 0x14, 0x5f } }, + { .data = { 0x15, 0x5f } }, + { .data = { 0x16, 0x53 } }, + { .data = { 0x17, 0x5f } }, + { .data = { 0x18, 0x5f } }, + { .data = { 0x19, 0x51 } }, + { .data = { 0x1a, 0x77 } }, + { .data = { 0x1b, 0x57 } }, + { .data = { 0x1c, 0x5f } }, + { .data = { 0x1d, 0x4f } }, + { .data = { 0x1e, 0x4d } }, + { .data = { 0x1f, 0x5f } }, + { .data = { 0x20, 0x4b } }, + { .data = { 0x21, 0x49 } }, + { .data = { 0x22, 0x5f } }, + { .data = { 0x23, 0x47 } }, + { .data = { 0x24, 0x45 } }, + { .data = { 0x25, 0x41 } }, + { .data = { 0x26, 0x5f } }, + { .data = { 0x27, 0x5f } }, + { .data = { 0x28, 0x5f } }, + { .data = { 0x29, 0x5f } }, + { .data = { 0x2a, 0x5f } }, + { .data = { 0x2b, 0x5f } }, + { .data = { 0x2c, 0x13 } }, + { .data = { 0x2d, 0x1f } }, + { .data = { 0x2e, 0x1f } }, + { .data = { 0x2f, 0x01 } }, + { .data = { 0x30, 0x17 } }, + { .data = { 0x31, 0x17 } }, + { .data = { 0x32, 0x1f } }, + { .data = { 0x33, 0x0d } }, + { .data = { 0x34, 0x0f } }, + { .data = { 0x35, 0x1f } }, + { .data = { 0x36, 0x05 } }, + { .data = { 0x37, 0x07 } }, + { .data = { 0x38, 0x1f } }, + { .data = { 0x39, 0x09 } }, + { .data = { 0x3a, 0x0b } }, + { .data = { 0x3b, 0x11 } }, + { .data = { 0x3c, 0x1f } }, + { .data = { 0x3d, 0x1f } }, + { .data = { 0x3e, 0x1f } }, + { .data = { 0x3f, 0x1f } }, + { .data = { 0x40, 0x1f } }, + { .data = { 0x41, 0x1f } }, + { .data = { 0x42, 0x12 } }, + { .data = { 0x43, 0x1f } }, + { .data = { 0x44, 0x1f } }, + { .data = { 0x45, 0x00 } }, + { .data = { 0x46, 0x17 } }, + { .data = { 0x47, 0x17 } }, + { .data = { 0x48, 0x1f } }, + { .data = { 0x49, 0x0c } }, + { .data = { 0x4a, 0x0e } }, + { .data = { 0x4b, 0x1f } }, + { .data = { 0x4c, 0x04 } }, + { .data = { 0x4d, 0x06 } }, + { .data = { 0x4e, 0x1f } }, + { .data = { 0x4f, 0x08 } }, + { .data = { 0x50, 0x0a } }, + { .data = { 0x51, 0x10 } }, + { .data = { 0x52, 0x1f } }, + { .data = { 0x53, 0x1f } }, + { .data = { 0x54, 0x1f } }, + { .data = { 0x55, 0x1f } }, + { .data = { 0x56, 0x1f } }, + { .data = { 0x57, 0x1f } }, + { .data = { 0x58, 0x40 } }, + { .data = { 0x5b, 0x10 } }, + { .data = { 0x5c, 0x06 } }, + { .data = { 0x5d, 0x40 } }, + { .data = { 0x5e, 0x00 } }, + { .data = { 0x5f, 0x00 } }, + { .data = { 0x60, 0x40 } }, + { .data = { 0x61, 0x03 } }, + { .data = { 0x62, 0x04 } }, + { .data = { 0x63, 0x6c } }, + { .data = { 0x64, 0x6c } }, + { .data = { 0x65, 0x75 } }, + { .data = { 0x66, 0x08 } }, + { .data = { 0x67, 0xb4 } }, + { .data = { 0x68, 0x08 } }, + { .data = { 0x69, 0x6c } }, + { .data = { 0x6a, 0x6c } }, + { .data = { 0x6b, 0x0c } }, + { .data = { 0x6d, 0x00 } }, + { .data = { 0x6e, 0x00 } }, + { .data = { 0x6f, 0x88 } }, + { .data = { 0x75, 0xbb } }, + { .data = { 0x76, 0x00 } }, + { .data = { 0x77, 0x05 } }, + { .data = { 0x78, 0x2a } }, + { .data = { 0xe0, 0x04 } }, + { .data = { 0x00, 0x0e } }, + { .data = { 0x02, 0xb3 } }, + { .data = { 0x09, 0x61 } }, + { .data = { 0x0e, 0x48 } }, + { .data = { 0xe0, 0x00 } }, +}; + +static const struct jadard_panel_desc kingdisplay_kd101ne3_40ti_desc = { + .mode = { + .clock = (800 + 24 + 24 + 24) * (1280 + 30 + 4 + 8) * 60 / 1000, + + .hdisplay = 800, + .hsync_start = 800 + 24, + .hsync_end = 800 + 24 + 24, + .htotal = 800 + 24 + 24 + 24, + + .vdisplay = 1280, + .vsync_start = 1280 + 30, + .vsync_end = 1280 + 30 + 4, + .vtotal = 1280 + 30 + 4 + 8, + + .width_mm = 135, + .height_mm = 216, + .type = DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED, + }, + .lanes = 4, + .format = MIPI_DSI_FMT_RGB888, + .init_cmds = kingdisplay_kd101ne3_init_cmds, + .num_init_cmds = ARRAY_SIZE(kingdisplay_kd101ne3_init_cmds), + .lp11_before_reset = true, + .reset_before_power_off_vcioo = true, + .vcioo_to_lp11_delay = 5, + .lp11_to_reset_delay = 10, + .exit_sleep_to_display_on_delay = 120, + .display_on_delay = 20, + .backlight_off_to_display_off_delay = 100, + .display_off_to_enter_sleep_delay = 50, + .enter_sleep_to_reset_down_delay = 100, +}; + static int jadard_dsi_probe(struct mipi_dsi_device *dsi) { struct device *dev = &dsi->dev; @@ -650,6 +923,10 @@ static const struct of_device_id jadard_of_match[] = { .compatible = "chongzhou,cz101b4001", .data = &cz101b4001_desc }, + { + .compatible = "kingdisplay,kd101ne3-40ti", + .data = &kingdisplay_kd101ne3_40ti_desc + }, { .compatible = "radxa,display-10hd-ad001", .data = &cz101b4001_desc -- 2.17.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 3/4] drm/panel: jd9365da: Support for kd101ne3-40ti MIPI-DSI panel. 2024-06-20 8:05 ` [PATCH v4 3/4] drm/panel: jd9365da: Support for kd101ne3-40ti MIPI-DSI panel Zhaoxiong Lv @ 2024-06-21 19:33 ` Doug Anderson 0 siblings, 0 replies; 9+ messages in thread From: Doug Anderson @ 2024-06-21 19:33 UTC (permalink / raw) To: Zhaoxiong Lv Cc: dmitry.torokhov, robh, krzysztof.kozlowski+dt, conor+dt, jikos, benjamin.tissoires, hsinyi, dri-devel, devicetree, linux-kernel Hi, On Thu, Jun 20, 2024 at 1:05 AM Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com> wrote: > > @@ -31,6 +31,15 @@ struct jadard_panel_desc { > enum mipi_dsi_pixel_format format; > const struct jadard_init_cmd *init_cmds; > u32 num_init_cmds; > + bool lp11_before_reset; > + bool reset_before_power_off_vcioo; > + unsigned int vcioo_to_lp11_delay; > + unsigned int lp11_to_reset_delay; > + unsigned int exit_sleep_to_display_on_delay; > + unsigned int display_on_delay; > + unsigned int backlight_off_to_display_off_delay; > + unsigned int display_off_to_enter_sleep_delay; > + unsigned int enter_sleep_to_reset_down_delay; If the above delays are in milliseconds please add a "_ms" suffix to the variables. It's also surprising to me that you need all these extra delays / boolean options if this is really the same underlying chipset. Any idea why they didn't need it? > @@ -53,6 +62,7 @@ static int jadard_enable(struct drm_panel *panel) > struct device *dev = panel->dev; > struct jadard *jadard = panel_to_jadard(panel); > struct mipi_dsi_device *dsi = jadard->dsi; > + struct mipi_dsi_multi_context dsi_ctx = { .dsi = jadard->dsi }; > int err; > > msleep(120); > @@ -61,10 +71,16 @@ static int jadard_enable(struct drm_panel *panel) > if (err < 0) > DRM_DEV_ERROR(dev, "failed to exit sleep mode ret = %d\n", err); > > + if (jadard->desc->exit_sleep_to_display_on_delay) > + mipi_dsi_msleep(dsi_ctx, jadard->desc->exit_sleep_to_display_on_delay); mipi_dsi_msleep() is really only useful if you're using it between a whole bunch of other "_multi" functions. If you just have a simple "msleep()" then just call "msleep()". ...but really you should be transitioning the function to just use more "_multi" functions since they exist for the other functions called here. In other words, this function should look something like: mipi_dsi_dcs_exit_sleep_mode_multi(&dsi_ctx); if (...) mipi_dsi_msleep(...) mipi_dsi_dcs_set_display_on_multi if (...) mipi_dsi_msleep(...) return dsi_ctx.accum_err; I would also note that you seem to be missing commit 66055636a146 ("drm/mipi-dsi: fix handling of ctx in mipi_dsi_msleep"), which changes the first argument of mipi_dsi_msleep() to be a pointer. > @@ -72,16 +88,26 @@ static int jadard_disable(struct drm_panel *panel) > { > struct device *dev = panel->dev; > struct jadard *jadard = panel_to_jadard(panel); > + struct mipi_dsi_multi_context dsi_ctx = { .dsi = jadard->dsi }; > int ret; > > + if (jadard->desc->backlight_off_to_display_off_delay) > + mipi_dsi_msleep(dsi_ctx, jadard->desc->backlight_off_to_display_off_delay); > + > ret = mipi_dsi_dcs_set_display_off(jadard->dsi); Similar comments here to the enable function. Use more _multi which then makes mipi_dsi_msleep() make sense. > @@ -100,6 +127,20 @@ static int jadard_prepare(struct drm_panel *panel) > if (ret) > return ret; > > + if (jadard->desc->vcioo_to_lp11_delay) > + mipi_dsi_msleep(dsi_ctx, jadard->desc->vcioo_to_lp11_delay); > + > + if (jadard->desc->lp11_before_reset) { > + ret = mipi_dsi_dcs_nop(jadard->dsi); > + if (ret) > + return ret; > + > + usleep_range(1000, 2000); Why do you need this extra sleep. For any panel that needs it can't the "lp11_to_reset_delay" just be increased by 1ms? > @@ -582,6 +628,233 @@ static const struct jadard_panel_desc cz101b4001_desc = { > .num_init_cmds = ARRAY_SIZE(cz101b4001_init_cmds), > }; > > +static const struct jadard_init_cmd kingdisplay_kd101ne3_init_cmds[] = { > + { .data = { 0xe0, 0x00 } }, > + { .data = { 0xe1, 0x93 } }, > + { .data = { 0xe2, 0x65 } }, > + { .data = { 0xe3, 0xf8 } }, As mentioned in my reply to patch #1, please don't add new panels that use the table-based approach. Before adding your new panel to this driver have a patch that transitions it to a per-panel init() function that uses mipi_dsi_dcs_write_seq_multi(). ^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v4 4/4] drm/panel: jd9365da: Add the function of adjusting orientation 2024-06-20 8:05 [PATCH v4 0/4] Add kd101ne3-40ti configuration in driver jd9365da Zhaoxiong Lv ` (2 preceding siblings ...) 2024-06-20 8:05 ` [PATCH v4 3/4] drm/panel: jd9365da: Support for kd101ne3-40ti MIPI-DSI panel Zhaoxiong Lv @ 2024-06-20 8:05 ` Zhaoxiong Lv 2024-06-21 19:33 ` Doug Anderson 3 siblings, 1 reply; 9+ messages in thread From: Zhaoxiong Lv @ 2024-06-20 8:05 UTC (permalink / raw) To: dmitry.torokhov, robh, krzysztof.kozlowski+dt, conor+dt, jikos, benjamin.tissoires, dianders, hsinyi Cc: dri-devel, devicetree, linux-kernel, Zhaoxiong Lv This driver does not have the function to adjust the orientation, so this function is added. Signed-off-by: Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com> --- Changes between V4 and V3: - No changes. --- drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c index 632bffa035ee..2545e22a5c85 100644 --- a/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c +++ b/drivers/gpu/drm/panel/panel-jadard-jd9365da-h3.c @@ -46,7 +46,7 @@ struct jadard { struct drm_panel panel; struct mipi_dsi_device *dsi; const struct jadard_panel_desc *desc; - + enum drm_panel_orientation orientation; struct regulator *vdd; struct regulator *vccio; struct gpio_desc *reset; @@ -203,12 +203,20 @@ static int jadard_get_modes(struct drm_panel *panel, return 1; } +static enum drm_panel_orientation jadard_panel_get_orientation(struct drm_panel *panel) +{ + struct jadard *jadard = panel_to_jadard(panel); + + return jadard->orientation; +} + static const struct drm_panel_funcs jadard_funcs = { .disable = jadard_disable, .unprepare = jadard_unprepare, .prepare = jadard_prepare, .enable = jadard_enable, .get_modes = jadard_get_modes, + .get_orientation = jadard_panel_get_orientation, }; static const struct jadard_init_cmd radxa_display_8hd_ad002_init_cmds[] = { @@ -893,6 +901,12 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi) drm_panel_init(&jadard->panel, dev, &jadard_funcs, DRM_MODE_CONNECTOR_DSI); + ret = of_drm_get_panel_orientation(dev->of_node, &jadard->orientation); + if (ret < 0) { + dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret); + return ret; + } + ret = drm_panel_of_backlight(&jadard->panel); if (ret) return ret; -- 2.17.1 ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v4 4/4] drm/panel: jd9365da: Add the function of adjusting orientation 2024-06-20 8:05 ` [PATCH v4 4/4] drm/panel: jd9365da: Add the function of adjusting orientation Zhaoxiong Lv @ 2024-06-21 19:33 ` Doug Anderson 0 siblings, 0 replies; 9+ messages in thread From: Doug Anderson @ 2024-06-21 19:33 UTC (permalink / raw) To: Zhaoxiong Lv Cc: dmitry.torokhov, robh, krzysztof.kozlowski+dt, conor+dt, jikos, benjamin.tissoires, hsinyi, dri-devel, devicetree, linux-kernel Hi, On Thu, Jun 20, 2024 at 1:05 AM Zhaoxiong Lv <lvzhaoxiong@huaqin.corp-partner.google.com> wrote: > > @@ -893,6 +901,12 @@ static int jadard_dsi_probe(struct mipi_dsi_device *dsi) > drm_panel_init(&jadard->panel, dev, &jadard_funcs, > DRM_MODE_CONNECTOR_DSI); > > + ret = of_drm_get_panel_orientation(dev->of_node, &jadard->orientation); > + if (ret < 0) { > + dev_err(dev, "%pOF: failed to get orientation %d\n", dev->of_node, ret); > + return ret; > + } nit: use dev_err_probe(). Also no need to include a %pOF, AKA: if (ret < 0) return dev_err_probe(dev, ret, "Failed to get orientation\n"); ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2024-06-21 19:34 UTC | newest] Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2024-06-20 8:05 [PATCH v4 0/4] Add kd101ne3-40ti configuration in driver jd9365da Zhaoxiong Lv 2024-06-20 8:05 ` [PATCH v4 1/4] drm/panel: jd9365da: Modify the method of sending commands Zhaoxiong Lv 2024-06-21 19:33 ` Doug Anderson 2024-06-20 8:05 ` [PATCH v4 2/4] dt-bindings: display: panel: Add compatible for kingdisplay-kd101ne3 Zhaoxiong Lv 2024-06-20 16:14 ` Conor Dooley 2024-06-20 8:05 ` [PATCH v4 3/4] drm/panel: jd9365da: Support for kd101ne3-40ti MIPI-DSI panel Zhaoxiong Lv 2024-06-21 19:33 ` Doug Anderson 2024-06-20 8:05 ` [PATCH v4 4/4] drm/panel: jd9365da: Add the function of adjusting orientation Zhaoxiong Lv 2024-06-21 19:33 ` Doug Anderson
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®