drm: rcar-du: rzg2l_mipi_dsi: add MIPI DSI command support
Subsystems (3)
v3 cover drm: rcar-du: rzg2l_mipi_dsi: add MIPI DSI command support
From: Hugo Villeneuve <[email protected]>
Hello,
this patch series add support for sending MIPI DSI command packets to the Renesas RZ/G2L MIPI DSI driver.
Tested on a custom board with a SolidRun RZ/G2L SOM, with two different LCD panels using the jd9365da and st7703 drivers.
Tested short and long writes.
Tested read of 1 byte, 2 bytes and long reads.
Thank you.
Changes for V3:
- No code change, resending after fixing mail server config resulting in only cover letter being sent
Changes for V2:
- Change commit message prefix to "drm: renesas: rz-du: "
- Reorder variables in rzg2l_mipi_dsi_read_response()
- Remove unused macros
- Add missing bitfield include (kernel test robot)
Hugo Villeneuve (2):
drm: renesas: rz-du: Implement MIPI DSI host transfers
drm: renesas: rz-du: Set DCS maximum return packet size
.../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 186 ++++++++++++++++++ .../drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 54 +++++ 2 files changed, 240 insertions(+)
base-commit: c4f8ac095fc91084108ec21117eb9c1fff64725d
Signature · 1 line
2.39.5
PATCH v3 1/2 drm: renesas: rz-du: Implement MIPI DSI host transfers
From: Hugo Villeneuve <[email protected]>
Add support for sending MIPI DSI command packets from the host to a peripheral. This is required for panels that need configuration before they accept video data.
Based on Renesas Linux kernel v5.10 repos [1].
--- .../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 176 ++++++++++++++++++ .../drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 50 +++++ 2 files changed, 226 insertions(+)
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +176 -0
@@ -4,8 +4,11 @@* * Copyright (C) 2022 Renesas Electronics Corporation */ + +#include <linux/bitfield.h> #include <linux/clk.h> #include <linux/delay.h> +#include <linux/dma-mapping.h> #include <linux/io.h> #include <linux/iopoll.h> #include <linux/module.h>
@@ -23,9 +26,12 @@#include <drm/drm_of.h> #include <drm/drm_panel.h> #include <drm/drm_probe_helper.h> +#include <video/mipi_display.h> #include "rzg2l_mipi_dsi_regs.h" +#define RZG2L_DCS_BUF_SIZE 128/* Maximum DCS buffer size in external memory. */ +struct rzg2l_mipi_dsi {struct device *dev;void __iomem *mmio;
@@ -44,6 +50,10 @@ struct rzg2l_mipi_dsi {unsigned int num_data_lanes;unsigned int lanes;unsigned long mode_flags; + +/* DCS buffer pointers when using external memory. */ +dma_addr_t dcs_buf_phys; +u8 *dcs_buf_virt; }; static inline struct rzg2l_mipi_dsi *
@@ -651,9 +661,168 @@ static int rzg2l_mipi_dsi_host_detach(struct mipi_dsi_host *host,return 0 ; } +static ssize_t rzg2l_mipi_dsi_read_response (struct rzg2l_mipi_dsi *dsi, +const struct mipi_dsi_msg *msg) +{ +u8 *msg_rx = msg->rx_buf; +u8 datatype; +u32 result; +u16 size; + + result =rzg2l_mipi_dsi_link_read (dsi,RXRSS0R ); +if (result &RXRSS0R_RXPKTDFAIL ) { +dev_err (dsi->dev,"packet rx data did not save correctly\n" ); +return -EPROTO ; + } + +if (result &RXRSS0R_RXFAIL ) { +dev_err (dsi->dev,"packet rx failure\n" ); +return -EPROTO ; + } + +if (!(result &RXRSS0R_RXSUC )) +return -EPROTO ; + + datatype =FIELD_GET (RXRSS0R_DT , result); + +switch (datatype) { +case 0 : +dev_dbg (dsi->dev,"ACK\n" ); +return 0 ; +case MIPI_DSI_RX_END_OF_TRANSMISSION : +dev_dbg (dsi->dev,"EoTp\n" ); +return 0 ; +case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT : +dev_dbg (dsi->dev,"Acknowledge and error report: $%02x%02x\n" , + (u8 )FIELD_GET (RXRSS0R_DATA1 , result), + (u8 )FIELD_GET (RXRSS0R_DATA0 , result)); +return 0 ; +case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE : +case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE : + msg_rx[0 ] =FIELD_GET (RXRSS0R_DATA0 , result); +return 1 ; +case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_2BYTE : +case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_2BYTE : + msg_rx[0 ] =FIELD_GET (RXRSS0R_DATA0 , result); + msg_rx[1 ] =FIELD_GET (RXRSS0R_DATA1 , result); +return 2 ; +case MIPI_DSI_RX_GENERIC_LONG_READ_RESPONSE : +case MIPI_DSI_RX_DCS_LONG_READ_RESPONSE : + size =FIELD_GET (RXRSS0R_WC , result); + +if (size > msg->rx_len) { +dev_err (dsi->dev,"rx buffer too small" ); +return -ENOSPC ; + } + +memcpy (msg_rx, dsi->dcs_buf_virt, size); +return size; +default : +dev_err (dsi->dev,"unhandled response type: %02x\n" , datatype); +return -EPROTO ; + } +} + +static ssize_t rzg2l_mipi_dsi_host_transfer (struct mipi_dsi_host *host, +const struct mipi_dsi_msg *msg) +{ +struct rzg2l_mipi_dsi *dsi =host_to_rzg2l_mipi_dsi (host); +struct mipi_dsi_packet packet; +bool need_bta; +u32 value; +int ret; + + ret =mipi_dsi_create_packet (&packet, msg); +if (ret <0 ) +return ret; + +/* Terminate operation after this descriptor is finished */ + value =SQCH0DSC0AR_NXACT_TERM ; + +if (msg->flags &MIPI_DSI_MSG_REQ_ACK ) { + need_bta = true;/* Message with explicitly requested ACK */ + value |=FIELD_PREP (SQCH0DSC0AR_BTA ,SQCH0DSC0AR_BTA_NON_READ ); + }else if (msg->rx_buf && msg->rx_len >0 ) { + need_bta = true;/* Read request */ + value |=FIELD_PREP (SQCH0DSC0AR_BTA ,SQCH0DSC0AR_BTA_READ ); + }else { + need_bta = false; + value |=FIELD_PREP (SQCH0DSC0AR_BTA ,SQCH0DSC0AR_BTA_NONE ); + } + +/* Set transmission speed */ +if (msg->flags &MIPI_DSI_MSG_USE_LPM ) + value |=SQCH0DSC0AR_SPD_LOW ; +else + value |=SQCH0DSC0AR_SPD_HIGH ; + +/* Write TX packet header */ + value |=FIELD_PREP (SQCH0DSC0AR_DT , packet.header[0 ]) | +FIELD_PREP (SQCH0DSC0AR_DATA0 , packet.header[1 ]) | +FIELD_PREP (SQCH0DSC0AR_DATA1 , packet.header[2 ]); + +if (mipi_dsi_packet_format_is_long (msg->type)) { + value |=SQCH0DSC0AR_FMT_LONG ; + +if (packet.payload_length >RZG2L_DCS_BUF_SIZE ) { +dev_err (dsi->dev,"Packet Tx payload size (%d) too large" , + (unsigned int )packet.payload_length); +return -ENOSPC ; + } + +/* Copy TX packet payload data to memory space */ +memcpy (dsi->dcs_buf_virt, packet.payload, packet.payload_length); + }else { + value |=SQCH0DSC0AR_FMT_SHORT ; + } + +rzg2l_mipi_dsi_link_write (dsi,SQCH0DSC0AR , value); + +/* +* Write: specify payload data source location, only used for +* long packet. +* Read: specify payload data storage location of response +* packet. Note: a read packet is always a short packet. +* If the response packet is a short packet or a long packet +* with WC = 0 (no payload), DTSEL is meaningless. +*/ +rzg2l_mipi_dsi_link_write (dsi,SQCH0DSC0BR ,SQCH0DSC0BR_DTSEL_MEM_SPACE ); + +/* +* Set SQCHxSR.AACTFIN bit when descriptor actions are finished. +* Read: set Rx result save slot number to 0 (ACTCODE). +*/ +rzg2l_mipi_dsi_link_write (dsi,SQCH0DSC0CR ,SQCH0DSC0CR_FINACT ); + +/* Set rx/tx payload data address, only relevant for long packet. */ +rzg2l_mipi_dsi_link_write (dsi,SQCH0DSC0DR , (u32 )dsi->dcs_buf_phys); + +/* Start sequence 0 operation */ + value =rzg2l_mipi_dsi_link_read (dsi,SQCH0SET0R ); + value |=SQCH0SET0R_START ; +rzg2l_mipi_dsi_link_write (dsi,SQCH0SET0R , value); + +/* Wait for operation to finish */ + ret =read_poll_timeout (rzg2l_mipi_dsi_link_read, + value, value &SQCH0SR_ADESFIN , +2000 ,20000 , false, dsi,SQCH0SR ); +if (ret ==0 ) { +/* Success: clear status bit */ +rzg2l_mipi_dsi_link_write (dsi,SQCH0SCR ,SQCH0SCR_ADESFIN ); + +if (need_bta) + ret =rzg2l_mipi_dsi_read_response (dsi, msg); +else + ret = packet.payload_length; + } + +return ret; +} +static const struct mipi_dsi_host_ops rzg2l_mipi_dsi_host_ops = { .attach = rzg2l_mipi_dsi_host_attach, .detach = rzg2l_mipi_dsi_host_detach, + .transfer = rzg2l_mipi_dsi_host_transfer, };/* -----------------------------------------------------------------------------
@@ -771,6 +940,11 @@ static int rzg2l_mipi_dsi_probe(struct platform_device *pdev)if (ret <0 ) goto err_pm_disable; + dsi->dcs_buf_virt =dma_alloc_coherent (dsi->host.dev,RZG2L_DCS_BUF_SIZE , + &dsi->dcs_buf_phys,GFP_KERNEL ); +if (!dsi->dcs_buf_virt) +return -ENOMEM ; +return 0 ; err_phy:
@@ -785,6 +959,8 @@ static void rzg2l_mipi_dsi_remove(struct platform_device *pdev) {struct rzg2l_mipi_dsi *dsi =platform_get_drvdata (pdev); +dma_free_coherent (dsi->host.dev,RZG2L_DCS_BUF_SIZE , dsi->dcs_buf_virt, + dsi->dcs_buf_phys);mipi_dsi_host_unregister (&dsi->host);pm_runtime_disable (&pdev->dev); }
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h +50 -0
60 lines not on this page · raw message
Signature · 1 line
2.39.5
PATCH v3 2/2 drm: renesas: rz-du: Set DCS maximum return packet size
In reply to Hugo VilleneuveFrom: Hugo Villeneuve <[email protected]>
The default value of 1 will result in long read commands payload not being saved to memory.
Fix by setting this value to the DMA buffer size.
--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 10 ++++++++++ drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 4 ++++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +10 -0
@@ -549,6 +549,7 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc; +u32 value;int ret; connector =drm_atomic_get_new_connector_for_encoder (state, bridge->encoder);
@@ -561,6 +562,15 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,rzg2l_mipi_dsi_set_display_timing (dsi, mode); +/* +* The default value of 1 will result in long read commands payload +* not being saved to memory. Set to the DMA buffer size. +*/ + value =rzg2l_mipi_dsi_link_read (dsi,DSISETR ); + value &= ~DSISETR_MRPSZ ; + value |=FIELD_PREP (DSISETR_MRPSZ ,RZG2L_DCS_BUF_SIZE ); +rzg2l_mipi_dsi_link_write (dsi,DSISETR , value); + ret =rzg2l_mipi_dsi_start_hs_clock (dsi);if (ret <0 ) goto err_stop;
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h +4 -0
@@ -81,6 +81,10 @@#define RSTSR_SWRSTLP (1 << 1)#define RSTSR_SWRSTHS (1 << 0) +/* DSI Set Register */ +#define DSISETR 0x120 +#define DSISETR_MRPSZ GENMASK(15, 0) +/* Rx Result Save Slot 0 Register */ #define RXRSS0R 0x240#define RXRSS0R_RXPKTDFAIL BIT(28)
Signature · 1 line
2.39.5
RE: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet size
Hi Hugo,
I'm fine with the code, but maybe it should go in a different location.
Since it's a register setup, it should probably go in rzg2l_mipi_dsi_startup() with the others.
Additionally, since it is required to make rzg2l_mipi_dsi_host_transfer() operate properly, my suggestion is to add this to your previous patch instead of making it separate.
Otherwise, it's like you are submitting one patch with a known bug, then immediately fixing it with a second patch.
This also would prevent the merge conflict with my patch that also modifies rzg2l_mipi_dsi_atomic_enable().
Chris
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: Thursday, May 22, 2025 10:39 AM
To: Biju Das <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hugo Villeneuve <[email protected]>; Chris Brandt <[email protected]>
Subject: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet size
From: Hugo Villeneuve <[email protected]>
The default value of 1 will result in long read commands payload not being saved to memory.
Fix by setting this value to the DMA buffer size.
--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 10 ++++++++++ drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 4 ++++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +1 -0
@@ -549,6 +549,7 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc; +u32 value;int ret; connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); @@ -561,6 +562,15 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,
rzg2l_mipi_dsi_set_display_timing(dsi, mode);
+ /*
+ * The default value of 1 will result in long read commands payload
+ * not being saved to memory. Set to the DMA buffer size.
+ */
+ value = rzg2l_mipi_dsi_link_read(dsi, DSISETR);
+ value &= ~DSISETR_MRPSZ;
+ value |= FIELD_PREP(DSISETR_MRPSZ, RZG2L_DCS_BUF_SIZE);
+ rzg2l_mipi_dsi_link_write(dsi, DSISETR, value);
+
ret = rzg2l_mipi_dsi_start_hs_clock(dsi);
if (ret < 0)
goto err_stop;
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h +4 -0
@@ -81,6 +81,10 @@#define RSTSR_SWRSTLP (1 << 1)#define RSTSR_SWRSTHS (1 << 0) +/* DSI Set Register */ +#define DSISETR 0x120 +#define DSISETR_MRPSZ GENMASK(15, 0) +/* Rx Result Save Slot 0 Register */ #define RXRSS0R 0x240#define RXRSS0R_RXPKTDFAIL BIT(28)
--
2.39.5
RE: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet size
Hi Hugo,
Sorry, one more thing....
Review
Quoted 4 lines
(quoted diff) +4
-0+ /* + * The default value of 1 will result in long read commands payload + * not being saved to memory. Set to the DMA buffer size. + */
The comment is a bit wordy.
You just need to say:
/* Set read buffer size */
Or...no comment at all. It's pretty obvious what the code is doing because you are writing RZG2L_DCS_BUF_SIZE to a register.
Chris
-----Original Message-----
From: Chris Brandt
Sent: Wednesday, June 4, 2025 7:54 AM
To: Hugo Villeneuve <[email protected]>; Biju Das <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hugo Villeneuve <[email protected]>
Subject: RE: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet size
Hi Hugo,
I'm fine with the code, but maybe it should go in a different location.
Since it's a register setup, it should probably go in rzg2l_mipi_dsi_startup() with the others.
Additionally, since it is required to make rzg2l_mipi_dsi_host_transfer() operate properly, my suggestion is to add this to your previous patch instead of making it separate. Otherwise, it's like you are submitting one patch with a known bug, then immediately fixing it with a second patch.
This also would prevent the merge conflict with my patch that also modifies rzg2l_mipi_dsi_atomic_enable().
Chris
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: Thursday, May 22, 2025 10:39 AM
To: Biju Das <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hugo Villeneuve <[email protected]>; Chris Brandt <[email protected]>
Subject: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet size
From: Hugo Villeneuve <[email protected]>
The default value of 1 will result in long read commands payload not being saved to memory.
Fix by setting this value to the DMA buffer size.
--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 10 ++++++++++ drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 4 ++++ 2 files changed, 14 insertions(+)
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +1 -0
@@ -549,6 +549,7 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc; +u32 value;int ret; connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); @@ -561,6 +562,15 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,
rzg2l_mipi_dsi_set_display_timing(dsi, mode);
+ /*
+ * The default value of 1 will result in long read commands payload
+ * not being saved to memory. Set to the DMA buffer size.
+ */
+ value = rzg2l_mipi_dsi_link_read(dsi, DSISETR);
+ value &= ~DSISETR_MRPSZ;
+ value |= FIELD_PREP(DSISETR_MRPSZ, RZG2L_DCS_BUF_SIZE);
+ rzg2l_mipi_dsi_link_write(dsi, DSISETR, value);
+
ret = rzg2l_mipi_dsi_start_hs_clock(dsi);
if (ret < 0)
goto err_stop;
drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h +4 -0
@@ -81,6 +81,10 @@#define RSTSR_SWRSTLP (1 << 1)#define RSTSR_SWRSTHS (1 << 0) +/* DSI Set Register */ +#define DSISETR 0x120 +#define DSISETR_MRPSZ GENMASK(15, 0) +/* Rx Result Save Slot 0 Register */ #define RXRSS0R 0x240#define RXRSS0R_RXPKTDFAIL BIT(28)
--
2.39.5
Re: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet size
On Wed, 4 Jun 2025 12:08:49 +0000
Chris Brandt <[email protected]> wrote:
Hi Chris,
Quoted 11 lines
Hi Hugo,
Sorry, one more thing....
Review
Quoted 4 lines
(quoted diff) +4
-0+ /* + * The default value of 1 will result in long read commands payload + * not being saved to memory. Set to the DMA buffer size. + */The comment is a bit wordy.
Quoted 3 lines
You just need to say:
/* Set read buffer size */
Like I said, this is related to something that is not obvious, so that is why I put a lenghty description.
Quoted 2 lines
Or...no comment at all. It's pretty obvious what the code is doing because you are writing
RZG2L_DCS_BUF_SIZEto a register.
Agreed, I will remove the part that says "Set to the DMA buffer size".
Hugo.
Quoted 88 lines
-----Original Message-----
From: Chris Brandt
Sent: Wednesday, June 4, 2025 7:54 AM
To: Hugo Villeneuve <[email protected]>; Biju Das <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; Hugo Villeneuve <[email protected]>
Subject: RE: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet sizeHi Hugo,
I'm fine with the code, but maybe it should go in a different location.
Since it's a register setup, it should probably go in
rzg2l_mipi_dsi_startup()with the others.Additionally, since it is required to make
rzg2l_mipi_dsi_host_transfer()operate properly, my suggestion is to add this to your previous patch instead of making it separate. Otherwise, it's like you are submitting one patch with a known bug, then immediately fixing it with a second patch.This also would prevent the merge conflict with my patch that also modifies
rzg2l_mipi_dsi_atomic_enable().Chris
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: Thursday, May 22, 2025 10:39 AM
To: Biju Das <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hugo Villeneuve <[email protected]>; Chris Brandt <[email protected]>
Subject: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet sizeFrom: Hugo Villeneuve <[email protected]>
The default value of 1 will result in long read commands payload not being saved to memory.
Fix by setting this value to the DMA buffer size.
Cc Biju Das <[email protected]>Cc Chris Brandt <[email protected]>Signed-off-by Hugo Villeneuve <[email protected]>--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 10 ++++++++++ drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 4 ++++ 2 files changed, 14 insertions(+)drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +1
-0@@ -549,6 +549,7 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc; +u32 value;int ret; connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); @@ -561,6 +562,15 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +9
-0rzg2l_mipi_dsi_set_display_timing (dsi, mode); +/* +* The default value of 1 will result in long read commands payload +* not being saved to memory. Set to the DMA buffer size. +*/ + value =rzg2l_mipi_dsi_link_read (dsi,DSISETR ); + value &= ~DSISETR_MRPSZ ; + value |=FIELD_PREP (DSISETR_MRPSZ ,RZG2L_DCS_BUF_SIZE ); +rzg2l_mipi_dsi_link_write (dsi,DSISETR , value); + ret =rzg2l_mipi_dsi_start_hs_clock (dsi);if (ret <0 ) goto err_stop;drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h +4
-1@@ -81,6 +81,10 @@#define RSTSR_SWRSTLP (1 << 1)#define RSTSR_SWRSTHS (1 << 0) +/* DSI Set Register */ +#define DSISETR 0x120 +#define DSISETR_MRPSZ GENMASK(15, 0) +/* Rx Result Save Slot 0 Register */ #define RXRSS0R 0x240#define RXRSS0R_RXPKTDFAIL BIT(28) --2.39.5
Signature · 1 line
Hugo Villeneuve
Re: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet size
In reply to Chris BrandtOn Wed, 4 Jun 2025 11:54:28 +0000
Chris Brandt <[email protected]> wrote:
Hi Chris,
Quoted 5 lines
Hi Hugo,
I'm fine with the code, but maybe it should go in a different location.
Since it's a register setup, it should probably go in
rzg2l_mipi_dsi_startup()with the others.
It makes sense, I will move it there.
Quoted 3 lines
Additionally, since it is required to make
rzg2l_mipi_dsi_host_transfer()operate properly, my suggestion is to add this to your previous patch instead of making it separate.
Otherwise, it's like you are submitting one patch with a known bug, then immediately fixing it with a second patch.
I made it a separate patch to clearly show why this is needed, because it took me a lot of time to figure this out, and I didn't want that knowledge to be lost :)
Also, by default, most panels are configured to send a maximum of 1 byte, so it is not absolutely required by default and not really a bug.
But sure I can merge it, anyway my comment will clearly indicate why it is needed.
Quoted 1 line
This also would prevent the merge conflict with my patch that also modifies
rzg2l_mipi_dsi_atomic_enable().
Ok.
Hugo.
Quoted 70 lines
Chris
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: Thursday, May 22, 2025 10:39 AM
To: Biju Das <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hugo Villeneuve <[email protected]>; Chris Brandt <[email protected]>
Subject: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet sizeFrom: Hugo Villeneuve <[email protected]>
The default value of 1 will result in long read commands payload not being saved to memory.
Fix by setting this value to the DMA buffer size.
Cc Biju Das <[email protected]>Cc Chris Brandt <[email protected]>Signed-off-by Hugo Villeneuve <[email protected]>--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 10 ++++++++++ drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 4 ++++ 2 files changed, 14 insertions(+)drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +1
-0@@ -549,6 +549,7 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc; +u32 value;int ret; connector = drm_atomic_get_new_connector_for_encoder(state, bridge->encoder); @@ -561,6 +562,15 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +9
-0rzg2l_mipi_dsi_set_display_timing (dsi, mode); +/* +* The default value of 1 will result in long read commands payload +* not being saved to memory. Set to the DMA buffer size. +*/ + value =rzg2l_mipi_dsi_link_read (dsi,DSISETR ); + value &= ~DSISETR_MRPSZ ; + value |=FIELD_PREP (DSISETR_MRPSZ ,RZG2L_DCS_BUF_SIZE ); +rzg2l_mipi_dsi_link_write (dsi,DSISETR , value); + ret =rzg2l_mipi_dsi_start_hs_clock (dsi);if (ret <0 ) goto err_stop;drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h +4
-1@@ -81,6 +81,10 @@#define RSTSR_SWRSTLP (1 << 1)#define RSTSR_SWRSTHS (1 << 0) +/* DSI Set Register */ +#define DSISETR 0x120 +#define DSISETR_MRPSZ GENMASK(15, 0) +/* Rx Result Save Slot 0 Register */ #define RXRSS0R 0x240#define RXRSS0R_RXPKTDFAIL BIT(28) --2.39.5
Signature · 1 line
Hugo Villeneuve
RE: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet size
Hi Hugo,
Quoted 1 line
Also, by default, most panels are configured to send a maximum of 1 byte, so it is not absolutely required by default and not really a bug.
Thanks. I found that I needed to call mipi_dsi_set_maximum_return_packet_size() first in my panel driver, then I could receive multiple bytes.
Chris
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: Wednesday, June 4, 2025 9:35 AM
To: Chris Brandt <[email protected]>
Cc: Biju Das <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]; Hugo Villeneuve <[email protected]>
Subject: Re: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet size
On Wed, 4 Jun 2025 11:54:28 +0000
Chris Brandt <[email protected]> wrote:
Hi Chris,
Quoted 5 lines
Hi Hugo,
I'm fine with the code, but maybe it should go in a different location.
Since it's a register setup, it should probably go in
rzg2l_mipi_dsi_startup()with the others.
It makes sense, I will move it there.
Quoted 3 lines
Additionally, since it is required to make
rzg2l_mipi_dsi_host_transfer()operate properly, my suggestion is to add this to your previous patch instead of making it separate. Otherwise, it's like you are submitting one patch with a known bug, then immediately fixing it with a second patch.
I made it a separate patch to clearly show why this is needed, because it took me a lot of time to figure this out, and I didn't want that knowledge to be lost :)
Also, by default, most panels are configured to send a maximum of 1 byte, so it is not absolutely required by default and not really a bug.
But sure I can merge it, anyway my comment will clearly indicate why it is needed.
Quoted 1 line
This also would prevent the merge conflict with my patch that also modifies
rzg2l_mipi_dsi_atomic_enable().
Ok.
Hugo.
Quoted 77 lines
Chris
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: Thursday, May 22, 2025 10:39 AM
To: Biju Das <[email protected]>; [email protected]; [email protected]; [email protected]; [email protected]; [email protected]
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Hugo Villeneuve <[email protected]>; Chris Brandt <[email protected]>
Subject: [PATCH v3 2/2] drm: renesas: rz-du: Set DCS maximum return packet sizeFrom: Hugo Villeneuve <[email protected]>
The default value of 1 will result in long read commands payload not being saved to memory.
Fix by setting this value to the DMA buffer size.
Cc Biju Das <[email protected]>Cc Chris Brandt <[email protected]>Signed-off-by Hugo Villeneuve <[email protected]>--- drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 10 ++++++++++ drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 4 ++++ 2 files changed, 14 insertions(+)drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +1
-0@@ -549,6 +549,7 @@ static void rzg2l_mipi_dsi_atomic_enable(struct drm_bridge *bridge,const struct drm_display_mode *mode;struct drm_connector *connector;struct drm_crtc *crtc; +u32 value;int ret; connector = drm_atomic_get_new_connector_for_encoder(state,
bridge->encoder); @@ -561,6 +562,15 @@ static void rzg2l_mipi_dsi_atomic_enable(structdrm_bridge*bridge,drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c +9
-0rzg2l_mipi_dsi_set_display_timing (dsi, mode); +/* +* The default value of 1 will result in long read commands payload +* not being saved to memory. Set to the DMA buffer size. +*/ + value =rzg2l_mipi_dsi_link_read (dsi,DSISETR ); + value &= ~DSISETR_MRPSZ ; + value |=FIELD_PREP (DSISETR_MRPSZ ,RZG2L_DCS_BUF_SIZE ); +rzg2l_mipi_dsi_link_write (dsi,DSISETR , value); + ret =rzg2l_mipi_dsi_start_hs_clock (dsi);if (ret <0 ) goto err_stop;drivers/gpu/drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h +4
-1@@ -81,6 +81,10 @@#define RSTSR_SWRSTLP (1 << 1)#define RSTSR_SWRSTHS (1 << 0) +/* DSI Set Register */ +#define DSISETR 0x120 +#define DSISETR_MRPSZ GENMASK(15, 0) +/* Rx Result Save Slot 0 Register */ #define RXRSS0R 0x240#define RXRSS0R_RXPKTDFAIL BIT(28) --
Quoted 3 lines
2.39.5
--
Hugo Villeneuve
Biju Das
maintainerHi Hugo,
Thanks for the patch.
Quoted 11 lines
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: 22 May 2025 15:39
Subject: [PATCH v3 0/2] drm: rcar-du:rzg2l_mipi_dsi: add MIPI DSI command supportFrom: Hugo Villeneuve <[email protected]>
Hello,
this patch series add support for sending MIPI DSI command packets to the Renesas RZ/G2L MIPI DSI driver.
Quoted 6 lines
Tested on a custom board with a SolidRun RZ/G2L SOM, with two different LCD panels using the jd9365da and st7703 drivers.
Tested short and long writes.
Tested read of 1 byte, 2 bytes and long reads.
I see tested-by tag for patch[1] and this patch series is conflict with that patch.
Can this patch series work without patch[1]? If yes, no issue.
Otherwise, you need to rebase your patch on top of [1] to avoid merge conflict.
[1] https://lore.kernel.org/all/[email protected]/
Cheers,
Biju
Quoted 27 lines
Thank you.
Changes for V3:
- No code change, resending after fixing mail server config resulting in only cover letter being sentChanges for V2:
- Change commit message prefix to "drm: renesas: rz-du: "
- Reorder variables inrzg2l_mipi_dsi_read_response()
- Remove unused macros
- Add missing bitfield include (kernel test robot)Hugo Villeneuve (2):
drm: renesas: rz-du: Implement MIPI DSI host transfers
drm: renesas: rz-du: Set DCS maximum return packet size.../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 186 ++++++++++++++++++ .../drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 54 +++++ 2 files changed, 240 insertions(+)base-commit:
c4f8ac095fc91084108ec21117eb9c1fff64725d--
2.39.5
Quoted 15 lines · On Thu, 22 May 2025 18:40:29 +0000 Biju Das <[email protected]> wrote:
Hi Hugo,
Thanks for the patch.
Quoted 11 lines
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: 22 May 2025 15:39
Subject: [PATCH v3 0/2] drm: rcar-du:rzg2l_mipi_dsi: add MIPI DSI command supportFrom: Hugo Villeneuve <[email protected]>
Hello,
this patch series add support for sending MIPI DSI command packets to the Renesas RZ/G2L MIPI DSI driver.
Quoted 8 lines
Quoted 6 lines
Tested on a custom board with a SolidRun RZ/G2L SOM, with two different LCD panels using the jd9365da and st7703 drivers.
Tested short and long writes.
Tested read of 1 byte, 2 bytes and long reads.
I see tested-by tag for patch[1] and this patch series is conflict with that patch.
Hi Biju,
there is no conflict per se for the moment, as these are two separate submissions. Chris's patch is not part of this submission.
I tested patch[1] by rebasing my series on top of Chris patch.
Quoted 1 line
Can this patch series work without patch[1]? If yes, no issue.
Yes it can.
Quoted 1 line
Otherwise, you need to rebase your patch on top of [1] to avoid merge conflict.
Eventually, if Chris's patch is accepted before my series, I will rebase and resubmit then. Right now, it seems I cannot do it, because submitting my serie based on an "not yet accepted" patch will result in the kernel test robot complaining (and rightly so). Unless there is a mean to specify that my serie depends on other unapplied patch...
Ideally, it should have been easier if I could have integrated Chris's patch into my serie, but he preferred to send his patch alone since he felt that it could be accepted more rapidly like this.
Hugo.
Quoted 34 lines
[1] https://lore.kernel.org/all/[email protected]/
Cheers,
BijuQuoted 27 lines
Thank you.
Changes for V3:
- No code change, resending after fixing mail server config resulting in only cover letter being sentChanges for V2:
- Change commit message prefix to "drm: renesas: rz-du: "
- Reorder variables inrzg2l_mipi_dsi_read_response()
- Remove unused macros
- Add missing bitfield include (kernel test robot)Hugo Villeneuve (2):
drm: renesas: rz-du: Implement MIPI DSI host transfers
drm: renesas: rz-du: Set DCS maximum return packet size.../gpu/drm/renesas/rz-du/rzg2l_mipi_dsi.c | 186 ++++++++++++++++++ .../drm/renesas/rz-du/rzg2l_mipi_dsi_regs.h | 54 +++++ 2 files changed, 240 insertions(+)base-commit:
c4f8ac095fc91084108ec21117eb9c1fff64725d--
2.39.5
Signature · 1 line
Hugo Villeneuve
Biju Das
maintainerHi Hugo,
Quoted 46 lines
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: 22 May 2025 20:14
Subject: Re: [PATCH v3 0/2] drm: rcar-du:rzg2l_mipi_dsi: add MIPI DSI command supportQuoted 16 lines · On Thu, 22 May 2025 18:40:29 +0000 Biju Das <[email protected]> wrote:
Hi Hugo,
Thanks for the patch.
Quoted 12 lines
-----Original Message-----
From: Hugo Villeneuve <[email protected]>
Sent: 22 May 2025 15:39
Subject: [PATCH v3 0/2] drm: rcar-du:rzg2l_mipi_dsi: add MIPI DSI command supportFrom: Hugo Villeneuve <[email protected]>
Hello,
this patch series add support for sending MIPI DSI command packets to the Renesas RZ/G2L MIPI DSI driver.Quoted 8 lines
Quoted 6 lines
Tested on a custom board with a SolidRun RZ/G2L SOM, with two different LCD panels using the jd9365da and st7703 drivers.
Tested short and long writes.
Tested read of 1 byte, 2 bytes and long reads.
I see tested-by tag for patch[1] and this patch series is conflict with that patch.
Hi Biju,
there is no conflict per se for the moment, as these are two separate submissions. Chris's patch is not part of this submission.I tested patch[1] by rebasing my series on top of Chris patch.
Quoted 1 line
Can this patch series work without patch[1]? If yes, no issue.
Yes it can.
Quoted 1 line
Otherwise, you need to rebase your patch on top of [1] to avoid merge conflict.
Quoted 7 lines
Eventually, if Chris's patch is accepted before my series, I will rebase and resubmit then. Right now, it seems I cannot do it, because submitting my serie based on an "not yet accepted" patch will result in the kernel test robot complaining (and rightly so). Unless there is a mean to specify that my serie depends on other unapplied patch...
Ideally, it should have been easier if I could have integrated Chris's patch into my serie, but he preferred to send his patch alone since he felt that it could be accepted more rapidly like this.
OK, I have added your patch + Chris's patch and tested with ADV7535 connected to display. But the display is unstable. I need to figure out which patch is causing the issue.
Cheers,
Biju