Cooperate with DSI RX devices to modify dsi funcs and delay mipi high to cooperate with panel sequence
Subsystems (3)
v3 cover Cooperate with DSI RX devices to modify dsi funcs and delay mipi high to cooperate with panel sequence
From: Xinlei Lee <[email protected]>
In upstream-v5.8, dsi_enable will operate panel_enable, but this modification has been moved in v5.9. In order to ensure the timing of dsi_power_on/off and the timing of pulling up/down the MIPI signal, the modification of v5.9 is synchronized in this series of patches.
Changes since v2:
1. Rebase linux-next
Changes since v1:
1. Dsi sequence marked with patch adjustment
2. Fixes: mtk_dsi: Use the drm_panel_bridge
Jitao Shi (3):
drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11 drm/mediatek: Separate poweron/poweroff from enable/disable and define
new funcs
drm/mediatek: keep dsi as LP00 before dcs cmds transfer
Xinlei Lee (1):
drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff
function
drivers/gpu/drm/mediatek/mtk_dsi.c | 74 ++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 24 deletions(-)
Signature · 1 line
2.18.0
PATCH v3 1/4 drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11
From: Jitao Shi <[email protected]>
Old sequence:
1. Pull the MIPI signal high
2. Delay & Dsi_reset
3. Set the dsi timing register
4. dsi clk & lanes leave ulp mode and enter hs mode
New sequence:
1. Set the dsi timing register
2. Pull the MIPI signal high
3. Delay & Dsi_reset
4. dsi clk & lanes leave ulp mode and enter hs mode
In the new sequence 2 & 3 & 4 will be moved to dsi_enbale in later patch.
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +3 -3
@@ -649,14 +649,14 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_phy_timconfig (dsi); -mtk_dsi_rxtx_control (dsi); -usleep_range (30 ,100 ); -mtk_dsi_reset_dphy (dsi);mtk_dsi_ps_control_vact (dsi);mtk_dsi_set_vm_cmd (dsi);mtk_dsi_config_vdo_timing (dsi);mtk_dsi_set_interrupt_enable (dsi); +mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi);mtk_dsi_clk_ulp_mode_leave (dsi);mtk_dsi_lane0_ulp_mode_leave (dsi);mtk_dsi_clk_hs_mode (dsi,0 );
Signature · 1 line
2.18.0
Re: [PATCH v3,1/4] drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11
Hello Xinlei,
Thanks for your patch, and there are something I want to know:
Quoted 8 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
Old sequence:
1. Pull the MIPI signal high
2. Delay &Dsi_reset
3. Set the dsi timing register
4. dsi clk & lanes leave ulp mode and enter hs mode
Quoted 6 lines
New sequence:
1. Set the dsi timing register
2. Pull the MIPI signal high
3. Delay &Dsi_reset
4. dsi clk & lanes leave ulp mode and enter hs mode
Could you explain why you want to change original power on sequence? From this commit message, I don't know why you want to do this. If the reason is in cover letter, I think you should move them here.
Quoted 2 lines
In the new sequence 2 & 3 & 4 will be moved to
dsi_enbalein later patch.
I think this is no need to describe here.
BRs,
Rex
Quoted 30 lines
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +3
-3@@ -649,14 +649,14 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_phy_timconfig (dsi); -mtk_dsi_rxtx_control (dsi); -usleep_range (30 ,100 ); -mtk_dsi_reset_dphy (dsi);mtk_dsi_ps_control_vact (dsi);mtk_dsi_set_vm_cmd (dsi);mtk_dsi_config_vdo_timing (dsi);mtk_dsi_set_interrupt_enable (dsi); +mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi);mtk_dsi_clk_ulp_mode_leave (dsi);mtk_dsi_lane0_ulp_mode_leave (dsi);mtk_dsi_clk_hs_mode (dsi,0 );
Re: [PATCH v3,1/4] drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11
Quoted 56 lines · Rex-BC Chen
Hello Xinlei,
Thanks for your patch, and there are something I want to know:
Quoted 8 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
Old sequence:
1. Pull the MIPI signal high
2. Delay &Dsi_reset
3. Set the dsi timing register
4. dsi clk & lanes leave ulp mode and enter hs modeQuoted 6 lines
New sequence:
1. Set the dsi timing register
2. Pull the MIPI signal high
3. Delay &Dsi_reset
4. dsi clk & lanes leave ulp mode and enter hs modeCould you explain why you want to change original power on sequence? From this commit message, I don't know why you want to do this. If the reason is in cover letter, I think you should move them here.
Quoted 2 lines
In the new sequence 2 & 3 & 4 will be moved to
dsi_enbalein later patch.I think this is no need to describe here.
BRs,
RexQuoted 25 lines
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-3@@ -649,14 +649,14 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_phy_timconfig (dsi); -mtk_dsi_rxtx_control (dsi); -usleep_range (30 ,100 ); -mtk_dsi_reset_dphy (dsi);mtk_dsi_ps_control_vact (dsi);mtk_dsi_set_vm_cmd (dsi);mtk_dsi_config_vdo_timing (dsi);mtk_dsi_set_interrupt_enable (dsi);
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +3
-0+mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi);mtk_dsi_clk_ulp_mode_leave (dsi);mtk_dsi_lane0_ulp_mode_leave (dsi);
mtk_dsi_clk_hs_mode(dsi, 0);
Hi Rex:
Thanks for your review!
Explain to you that this change does not actually affect the function of dsi. We have verified this.
After this modification, it is convenient to move them into the if (!dsi->lanes_ready) condition, which is just an adjustment action. If you still have questions about my later explanation, please give another suggestion.
Thanks!
xinlei
Re: [PATCH v3, 1/4] drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11
In reply to [email protected]Hi, Xinlei:
Quoted 8 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
Old sequence:
1. Pull the MIPI signal high
2. Delay &Dsi_reset
3. Set the dsi timing register
4. dsi clk & lanes leave ulp mode and enter hs mode
Quoted 8 lines
New sequence:
1. Set the dsi timing register
2. Pull the MIPI signal high
3. Delay &Dsi_reset
4. dsi clk & lanes leave ulp mode and enter hs modeIn the new sequence 2 & 3 & 4 will be moved to
dsi_enbalein later patch.
I think there would be one patch in 5.9 make the wrong sequence, so add 'Fixes' tag to indicate which patch make the wrong sequence. Use the term correct/wrong instead old/new sequence.
I still do not understand what is the sequence after apply this patch?
Does the sequence is this after apply this patch?
1. Set the dsi timing register
2. Pull the MIPI signal high
3. Delay & Dsi_reset
4. dsi clk & lanes leave ulp mode and enter hs mode
Regards,
CK
Quoted 30 lines
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +3
-3@@ -649,14 +649,14 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_phy_timconfig (dsi); -mtk_dsi_rxtx_control (dsi); -usleep_range (30 ,100 ); -mtk_dsi_reset_dphy (dsi);mtk_dsi_ps_control_vact (dsi);mtk_dsi_set_vm_cmd (dsi);mtk_dsi_config_vdo_timing (dsi);mtk_dsi_set_interrupt_enable (dsi); +mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi);mtk_dsi_clk_ulp_mode_leave (dsi);mtk_dsi_lane0_ulp_mode_leave (dsi);mtk_dsi_clk_hs_mode (dsi,0 );
Re: [PATCH v3, 1/4] drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11
Quoted 62 lines · CK Hu
Hi, Xinlei:
Quoted 8 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
Old sequence:
1. Pull the MIPI signal high
2. Delay &Dsi_reset
3. Set the dsi timing register
4. dsi clk & lanes leave ulp mode and enter hs modeQuoted 8 lines
New sequence:
1. Set the dsi timing register
2. Pull the MIPI signal high
3. Delay &Dsi_reset
4. dsi clk & lanes leave ulp mode and enter hs modeIn the new sequence 2 & 3 & 4 will be moved to
dsi_enbalein later patch.I think there would be one patch in 5.9 make the wrong sequence, so add
'Fixes' tag to indicate which patch make the wrong sequence. Use the term correct/wrong instead old/new sequence.I still do not understand what is the sequence after apply this patch?
Does the sequence is this after apply this patch?
1. Set the dsi timing register
2. Pull the MIPI signal high
3. Delay &Dsi_reset
4. dsi clk & lanes leave ulp mode and enter hs modeRegards,
CKQuoted 25 lines
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-3@@ -649,14 +649,14 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_phy_timconfig (dsi); -mtk_dsi_rxtx_control (dsi); -usleep_range (30 ,100 ); -mtk_dsi_reset_dphy (dsi);mtk_dsi_ps_control_vact (dsi);mtk_dsi_set_vm_cmd (dsi);mtk_dsi_config_vdo_timing (dsi);mtk_dsi_set_interrupt_enable (dsi);
Quoted 8 lines
Quoted 6 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +3
-0+mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi);mtk_dsi_clk_ulp_mode_leave (dsi);mtk_dsi_lane0_ulp_mode_leave (dsi);
mtk_dsi_clk_hs_mode(dsi, 0);
Hi CK:
Thanks for your review!
You are right, the sequence after patching is:
1. Set the dsi timing register
2. Pull the MIPI signal high
3. Delay & Dsi_reset
4. dsi clk & lanes leave ulp mode and enter hs mode
This modification will not affect the dsi function, just to put the operation of pulling up the mipi signal in poweron together to facilitate the separation from the poweron function later.
I will add the "Fixes" tag here as well.
BR!
xinlei
PATCH v3 2/4 drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs
In reply to [email protected]From: Jitao Shi <[email protected]>
In order to match the changes of "Use the drm_panel_bridge API", the poweron/poweroff of dsi is extracted from enable/disable and defined as new funcs (pre_enable/post_disable).
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 45 +++++++++++++++++------------- 1 file changed, 26 insertions(+), 19 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +26 -19
@@ -679,16 +679,6 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)if (--dsi->refcount !=0 )return ; -/* -* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since -* mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), -* which needs irq for vblank, and mtk_dsi_stop() will disable irq. -* mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), -* after dsi is fully set. -*/ -mtk_dsi_stop (dsi); - -mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 );mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi);
@@ -703,17 +693,9 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)static void mtk_output_dsi_enable (struct mtk_dsi *dsi) { -int ret; -if (dsi->enabled)return ; - ret =mtk_dsi_poweron (dsi); -if (ret <0 ) { -DRM_ERROR ("failed to power on dsi\n" ); -return ; - } -mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );
@@ -727,7 +709,16 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)if (!dsi->enabled)return ; -mtk_dsi_poweroff (dsi); +/* +* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since +* mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), +* which needs irq for vblank, and mtk_dsi_stop() will disable irq. +* mtk_dsi_start() needs to be called in mtk_output_dsi_enable(), +* after dsi is fully set. +*/ +mtk_dsi_stop (dsi); + +mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 ); dsi->enabled = false; }
@@ -765,10 +756,26 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *bridge)mtk_output_dsi_enable (dsi); } +static void mtk_dsi_bridge_pre_enable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweron (dsi); +} + +static void mtk_dsi_bridge_post_disable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweroff (dsi); +} +static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = { .attach = mtk_dsi_bridge_attach, .disable = mtk_dsi_bridge_disable, .enable = mtk_dsi_bridge_enable, + .pre_enable = mtk_dsi_bridge_pre_enable, + .post_disable = mtk_dsi_bridge_post_disable, .mode_set = mtk_dsi_bridge_mode_set, };
Signature · 1 line
2.18.0
Re: [PATCH v3,2/4] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs
Hello Xinlei,
Quoted 62 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
In order to match the changes of "Use the
drm_panel_bridgeAPI", the poweron/poweroff of dsi is extracted from enable/disable and defined as new funcs (pre_enable/post_disable).Fixes 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the drm_panel_bridgeAPI")
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 45 +++++++++++++++++----------- -- 1 file changed, 26 insertions(+), 19 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-4@@ -679,16 +679,6 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)if (--dsi->refcount !=0 )return ; -/* -* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since -* mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), -* which needs irq for vblank, and mtk_dsi_stop() will disable irq.
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-1-* mtk_dsi_start() needs to be called in
mtk_output_dsi_enable(),drivers/gpu/drm/mediatek/mtk_dsi.c +0
-13-* after dsi is fully set. -*/ -mtk_dsi_stop (dsi); - -mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 );mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi);@@ -703,17 +693,9 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)static void mtk_output_dsi_enable (struct mtk_dsi *dsi) { -int ret; -if (dsi->enabled)return ; - ret =mtk_dsi_poweron (dsi); -if (ret <0 ) { -DRM_ERROR ("failed to power on dsi\n" ); -return ; - } -mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_output_dsi_disable(struct · line 714
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-1@@ -727,7 +709,16 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)if (!dsi->enabled)return ; -mtk_dsi_poweroff (dsi); +/* +* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
Why they are asymmetric?
Quoted 15 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-0+ * mtk_dsi_stop() should be called aftermtk_drm_crtc_atomic_disable (), + * which needs irq for vblank, and mtk_dsi_stop() will disableirq.
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+* mtk_dsi_start() needs to be called in
mtk_output_dsi_enable(),drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0+* after dsi is fully set. +*/ +mtk_dsi_stop (dsi); + +mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 ); dsi->enabled = false; }
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct · line 764
Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0@@ -765,10 +756,26 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *bridge)mtk_output_dsi_enable (dsi ); } +static void mtk_dsi_bridge_pre_enable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweron (dsi);
Should you handle the error of mtk_dsi_poweron?
If you failed to mtk_dsi_bridge_pre_enable and domtk_dsi_bridge_enable,
what will happend?
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) · line 770
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +7
-0+} + +static void mtk_dsi_bridge_post_disable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweroff (dsi);
If you failed to mtk_dsi_bridge_disable and you do mtk_dsi_bridge_post_disable,
what will happend?
Do you need to handle this?
BRs,
Rex
Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +4
-0+} +static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = { .attach = mtk_dsi_bridge_attach, .disable = mtk_dsi_bridge_disable, .enable = mtk_dsi_bridge_enable, + .pre_enable = mtk_dsi_bridge_pre_enable, + .post_disable = mtk_dsi_bridge_post_disable, .mode_set = mtk_dsi_bridge_mode_set, };
Re: [PATCH v3,2/4] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs
Quoted 123 lines · Rex-BC Chen
Hello Xinlei,
Quoted 64 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
In order to match the changes of "Use the
drm_panel_bridgeAPI", the poweron/poweroff of dsi is extracted from enable/disable and defined as new funcs (pre_enable/post_disable).Fixes 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the
drm_panel_bridge
API")Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 45 +++++++++++++++++--------- -- -- 1 file changed, 26 insertions(+), 19 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-4@@ -679,16 +679,6 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)if (--dsi->refcount !=0 )return ; -/* -* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since -* mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), -* which needs irq for vblank, and mtk_dsi_stop() will disable irq.
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-1-* mtk_dsi_start() needs to be called in
mtk_output_dsi_enable(),drivers/gpu/drm/mediatek/mtk_dsi.c +0
-13-* after dsi is fully set. -*/ -mtk_dsi_stop (dsi); - -mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 );mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi);@@ -703,17 +693,9 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)static void mtk_output_dsi_enable (struct mtk_dsi *dsi) { -int ret; -if (dsi->enabled)return ; - ret =mtk_dsi_poweron (dsi); -if (ret <0 ) { -DRM_ERROR ("failed to power on dsi\n" ); -return ; - } -mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_output_dsi_disable(struct · line 714
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-1@@ -727,7 +709,16 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)if (!dsi->enabled)return ; -mtk_dsi_poweroff (dsi); +/* +* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since Why they are asymmetric?
Quoted 15 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-0+ * mtk_dsi_stop() should be called aftermtk_drm_crtc_atomic_disable (), + * which needs irq for vblank, and mtk_dsi_stop() will disableirq.
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+* mtk_dsi_start() needs to be called in
mtk_output_dsi_enable(),drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0+* after dsi is fully set. +*/ +mtk_dsi_stop (dsi); + +mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 ); dsi->enabled = false; }drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct · line 764
Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0@@ -765,10 +756,26 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *bridge)mtk_output_dsi_enable (dsi ); } +static void mtk_dsi_bridge_pre_enable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweron (dsi);Should you handle the error of
mtk_dsi_poweron?
If you failed tomtk_dsi_bridge_pre_enableand domtk_dsi_bridge_enable,
what will happend?drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) · line 770
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +7
-0+} + +static void mtk_dsi_bridge_post_disable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweroff (dsi);If you failed to
mtk_dsi_bridge_disableand you domtk_dsi_bridge_post_disable,
what will happend?
Do you need to handle this?BRs,
Rex
Quoted 13 lines
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) · line 780
Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +4
-0+} +static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = { .attach = mtk_dsi_bridge_attach, .disable = mtk_dsi_bridge_disable, .enable = mtk_dsi_bridge_enable, + .pre_enable = mtk_dsi_bridge_pre_enable, + .post_disable = mtk_dsi_bridge_post_disable, .mode_set = mtk_dsi_bridge_mode_set, };
Hi Rex:
Thanks for your review!
1.Why they are asymmetric?
=>My understanding mtk_dsi_stop() and mtk_dsi_start() is to make dsi switch from LP11 and HS mode.DSI has two working modes:
If it is cmd mode, the data sent is sent by LP11, and dsi_start is just a signal. In this mode, dsi_stop is not required after sending cmd. If it is video mode, because the data needs to be sent in HS mode, dsi_start is required to make dsi enter HS mode from LP11. After suspend, drm will call dsi_disable, and call dsi_stop to make dsi return from HS mode to LP11 state.
Therefore mtk_dsi_stop() and mtk_dsi_start() are asymmetric. For example, in the dsi_host_transfer function, only dsi_stop has no dsi_start operation.
2.
Because the return type of pre_enable & post_disable in common code is void type. If there is an error, it will be processed in poweron/poweroff, and the error message will be printed.
Do you mean that pre_enable & post_disable needs to accept the poweron/poweroff error return value and then print the error log?
3.
If pre_enable fails, there is only a problem with the dsi module, and it does not affect the execution of other modules and enable funcs under drm.
Same goes for post_disable & disable.
Best Regrds!
xinlei
Re: [PATCH v3,2/4] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs
Quoted 166 lines · xinlei.lee
Quoted 125 lines · Rex-BC Chen
Hello Xinlei,
Quoted 65 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
In order to match the changes of "Use the
drm_panel_bridgeAPI", the poweron/poweroff of dsi is extracted from enable/disable and defined as new funcs (pre_enable/post_disable).Fixes 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the
drm_panel_bridge
API")Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 45 +++++++++++++++++------- -- -- -- 1 file changed, 26 insertions(+), 19 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-4@@ -679,16 +679,6 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)if (--dsi->refcount !=0 )return ; -/* -* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since -* mtk_dsi_stop() should be called after mtk_drm_crtc_atomic_disable(), -* which needs irq for vblank, and mtk_dsi_stop() will disable irq.
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-1-* mtk_dsi_start() needs to be called in
mtk_output_dsi_enable(),drivers/gpu/drm/mediatek/mtk_dsi.c +0
-13-* after dsi is fully set. -*/ -mtk_dsi_stop (dsi); - -mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 );mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi);@@ -703,17 +693,9 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)static void mtk_output_dsi_enable (struct mtk_dsi *dsi) { -int ret; -if (dsi->enabled)return ; - ret =mtk_dsi_poweron (dsi); -if (ret <0 ) { -DRM_ERROR ("failed to power on dsi\n" ); -return ; - } -mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_output_dsi_disable(struct · line 714
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-1@@ -727,7 +709,16 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)if (!dsi->enabled)return ; -mtk_dsi_poweroff (dsi); +/* +* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since Why they are asymmetric?
Quoted 15 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-0+ * mtk_dsi_stop() should be called aftermtk_drm_crtc_atomic_disable (), + * which needs irq for vblank, and mtk_dsi_stop() will disableirq.
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+* mtk_dsi_start() needs to be called in
mtk_output_dsi_enable(),drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0+* after dsi is fully set. +*/ +mtk_dsi_stop (dsi); + +mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 ); dsi->enabled = false; }drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct · line 764
Quoted 9 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0@@ -765,10 +756,26 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *bridge)mtk_output_dsi_enable (dsi ); } +static void mtk_dsi_bridge_pre_enable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweron (dsi);Should you handle the error of
mtk_dsi_poweron?
If you failed tomtk_dsi_bridge_pre_enableand domtk_dsi_bridge_enable,
what will happend?drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) · line 770
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +7
-0+} + +static void mtk_dsi_bridge_post_disable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweroff (dsi);If you failed to
mtk_dsi_bridge_disableand you domtk_dsi_bridge_post_disable,
what will happend?
Do you need to handle this?BRs,
RexQuoted 13 lines
Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +4
-0+} +static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = { .attach = mtk_dsi_bridge_attach, .disable = mtk_dsi_bridge_disable, .enable = mtk_dsi_bridge_enable, + .pre_enable = mtk_dsi_bridge_pre_enable, + .post_disable = mtk_dsi_bridge_post_disable, .mode_set = mtk_dsi_bridge_mode_set,};
Hi Rex:
Thanks for your review!
1.Why they are asymmetric?
=>My understandingmtk_dsi_stop()andmtk_dsi_start()is to make dsi switch from LP11 and HS mode.DSI has two working modes:
If it is cmd mode, the data sent is sent by LP11, anddsi_startis just
a signal. In this mode,dsi_stopis not required after sending cmd. If it is video mode, because the data needs to be sent in HS mode,dsi_startis required to make dsi enter HS mode from LP11. After suspend, drm will calldsi_disable, and calldsi_stopto make dsi return from HS mode to LP11 state.
Thereforemtk_dsi_stop()andmtk_dsi_start()are asymmetric. For example, in thedsi_host_transferfunction, onlydsi_stophas nodsi_startoperation.2.
Because the return type ofpre_enable&post_disablein common code is
void type. If there is an error, it will be processed in poweron/poweroff, and the error message will be printed. Do you mean thatpre_enable&post_disableneeds to accept the poweron/poweroff error return value and then print the error log?
Quoted 9 lines
3.
Ifpre_enablefails, there is only a problem with the dsi module, and it does not affect the execution of other modules and enable funcs under drm.
Same goes forpost_disable& disable.Best Regrds!
xinlei
Hello Xinlei,
about failure for mtk_dsi_poweron(), it is all becuase of error setting for clock.
If we do not set clock correctly and not enable DSI, after set DSI start, will it cause any issue? (maybe bus hang or something.)
Because in original drivers, if mtk_dsi_poweron failed, the DSI will not start.
IMO, it also needs some error message for mtk_dsi_bridge_pre_enable() and mtk_dsi_bridge_post_disable().
BRs,
Rex
Re: [PATCH v3,2/4] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs
Quoted 198 lines · Rex-BC Chen
Quoted 185 lines · xinlei.lee
Quoted 135 lines · Rex-BC Chen
Hello Xinlei,
Quoted 79 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
In order to match the changes of "Use the
drm_panel_bridgeAPI",
the poweron/poweroff of dsi is extracted from enable/disable and
defined as new funcs (pre_enable/post_disable).Fixes 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the
drm_panel_bridge
API")Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 45 +++++++++++++++++-------
--
--
--1 file changed, 26 insertions(+), 19 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0@@ -679,16 +679,6 @@ static void mtk_dsi_poweroff(struct
mtk_dsi
*dsi)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-2if (--dsi->refcount !=0 )return ; -/* -* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, since
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-1-* mtk_dsi_stop() should be called after
mtk_drm_crtc_atomic_disable(),drivers/gpu/drm/mediatek/mtk_dsi.c +0
-1-* which needs irq for vblank, and mtk_dsi_stop() will disable
irq.drivers/gpu/drm/mediatek/mtk_dsi.c +0
-1-* mtk_dsi_start() needs to be called in
mtk_output_dsi_enable(),drivers/gpu/drm/mediatek/mtk_dsi.c +0
-5-* after dsi is fully set. -*/ -mtk_dsi_stop (dsi); - -mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 );mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi);@@ -703,17 +693,9 @@ static void mtk_dsi_poweroff(struct
mtk_dsi
*dsi)static void
mtk_output_dsi_enable(struct mtk_dsi *dsi){drivers/gpu/drm/mediatek/mtk_dsi.c +2
-9-int ret; -if (dsi->enabled)return ; - ret =mtk_dsi_poweron (dsi); -if (ret <0 ) { -DRM_ERROR ("failed to power on dsi\n" ); -return ; - } -mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );@@ -727,7 +709,16 @@ static void mtk_output_dsi_disable(struct mtk_dsi *dsi)if (!dsi->enabled)return ; -mtk_dsi_poweroff (dsi); +/* +* mtk_dsi_stop() and mtk_dsi_start() is asymmetric, Quoted 1 line
since
Why they are asymmetric?
Quoted 16 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+* mtk_dsi_stop() should be called after
mtk_drm_crtc_atomic_disable(),drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+* which needs irq for vblank, and mtk_dsi_stop() will disable
irq.drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+* mtk_dsi_start() needs to be called in
mtk_output_dsi_enable(),drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0+* after dsi is fully set. +*/ +mtk_dsi_stop (dsi); + +mtk_dsi_switch_to_cmd_mode (dsi,VM_DONE_INT_FLAG ,500 ); dsi->enabled = false; }drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct · line 765
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0@@ -765,10 +756,26 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *bridge)mtk_output_dsi_enable (dsi ); } +static void mtk_dsi_bridge_pre_enable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweron (dsi);Should you handle the error of
mtk_dsi_poweron?
If you failed tomtk_dsi_bridge_pre_enableand domtk_dsi_bridge_enable,
what will happend?drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) · line 770
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +7
-0+} + +static void mtk_dsi_bridge_post_disable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); + +mtk_dsi_poweroff (dsi);If you failed to
mtk_dsi_bridge_disableand you domtk_dsi_bridge_post_disable,
what will happend?
Do you need to handle this?BRs,
RexQuoted 13 lines
Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +4
-0+} +static const struct drm_bridge_funcs mtk_dsi_bridge_funcs = { .attach = mtk_dsi_bridge_attach, .disable = mtk_dsi_bridge_disable, .enable = mtk_dsi_bridge_enable, + .pre_enable = mtk_dsi_bridge_pre_enable, + .post_disable = mtk_dsi_bridge_post_disable,.mode_set =
mtk_dsi_bridge_mode_set,
};Hi Rex:
Thanks for your review!
1.Why they are asymmetric?
=>My understandingmtk_dsi_stop()andmtk_dsi_start()is to make dsi
switch from LP11 and HS mode.DSI has two working modes:
If it is cmd mode, the data sent is sent by LP11, anddsi_startis just
a signal. In this mode,dsi_stopis not required after sending cmd. If it is video mode, because the data needs to be sent in HS mode,dsi_startis required to make dsi enter HS mode from LP11. After suspend, drm will calldsi_disable, and calldsi_stopto make dsi return from HS mode to LP11 state.
Thereforemtk_dsi_stop()andmtk_dsi_start()are asymmetric. For example, in thedsi_host_transferfunction, onlydsi_stophas nodsi_startoperation.2.
Because the return type ofpre_enable&post_disablein common code is
void type. If there is an error, it will be processed in poweron/poweroff, and the error message will be printed. Do you mean thatpre_enable&post_disableneeds to accept the poweron/poweroff error return value and then print the error log?3.
Ifpre_enablefails, there is only a problem with the dsi module, and
it does not affect the execution of other modules and enable funcs under drm.
Same goes forpost_disable& disable.Quoted 3 lines
Best Regrds!
xinleiHello Xinlei,
about failure for
mtk_dsi_poweron(), it is all becuase of error setting
for clock.
If we do not set clock correctly and not enable DSI, after set DSI start, will it cause any issue? (maybe bus hang or something.)
Quoted 9 lines
Because in original drivers, if
mtk_dsi_poweronfailed, the DSI will not start.IMO, it also needs some error message for
mtk_dsi_bridge_pre_enable()andmtk_dsi_bridge_post_disable().BRs,
Rex
Hi Rex:
Thanks for your review.
In the original dsi_poweron, if (++dsi->refcount != 1) is used to determine whether poweron has been repeatedly run.
The poweron failure to execute DSI Start you mentioned may indeed lead to Bus hang in extreme cases, so I will add a poweron-like judgment mechanism before the next version of enable.
And will add some error message for mtk_dsi_bridge_pre_enable() and mtk_dsi_bridge_post_disable().
Best Regards!
xinlei
PATCH v3 3/4 drm/mediatek: keep dsi as LP00 before dcs cmds transfer
In reply to [email protected]From: Jitao Shi <[email protected]>
To comply with the panel sequence, hold the mipi signal to LP00 before the dcs cmds transmission, and pull the mipi signal high from LP00 to LP11 until the start of the dcs cmds transmission. If dsi is not in cmd mode, then dsi will pull the mipi signal high in the mtk_output_dsi_enable function.
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 31 +++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +24 -7
@@ -203,6 +203,7 @@ struct mtk_dsi {struct mtk_phy_timing phy_timing;int refcount;bool enabled; +bool lanes_ready;u32 irq_data;wait_queue_head_t irq_wait_queue;const struct mtk_dsi_driver_data *driver_data;
@@ -654,13 +655,6 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)mtk_dsi_config_vdo_timing (dsi);mtk_dsi_set_interrupt_enable (dsi); -mtk_dsi_rxtx_control (dsi); -usleep_range (30 ,100 ); -mtk_dsi_reset_dphy (dsi); -mtk_dsi_clk_ulp_mode_leave (dsi); -mtk_dsi_lane0_ulp_mode_leave (dsi); -mtk_dsi_clk_hs_mode (dsi,0 ); -return 0 ; err_disable_engine_clk:clk_disable_unprepare (dsi->engine_clk);
@@ -689,6 +683,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)clk_disable_unprepare (dsi->digital_clk);phy_power_off (dsi->phy); + + dsi->lanes_ready = false; }static void mtk_output_dsi_enable (struct mtk_dsi *dsi)
@@ -696,6 +692,16 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi)if (dsi->enabled)return ; +if (!dsi->lanes_ready) { + dsi->lanes_ready = true; +mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi); +mtk_dsi_clk_ulp_mode_leave (dsi); +mtk_dsi_lane0_ulp_mode_leave (dsi); +mtk_dsi_clk_hs_mode (dsi,0 ); + } +mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );
@@ -995,6 +1001,17 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host,if (MTK_DSI_HOST_IS_READ (msg->type)) irq_flag |=LPRX_RD_RDY_INT_FLAG ; +if (!dsi->lanes_ready) { + dsi->lanes_ready = true; +mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi); +mtk_dsi_clk_ulp_mode_leave (dsi); +mtk_dsi_lane0_ulp_mode_leave (dsi); +mtk_dsi_clk_hs_mode (dsi,0 ); +msleep (20 ); + } + ret =mtk_dsi_host_send_cmd (dsi, msg, irq_flag);if (ret) goto restore_dsi_mode;
Signature · 1 line
2.18.0
Re: [PATCH v3,3/4] drm/mediatek: keep dsi as LP00 before dcs cmds transfer
Hello Xinlei,
Quoted 3 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
To comply with the panel sequence, hold the mipi signal to LP00
Could you provide a example panel power sequence to let me understand that?
Maybe you can put them in commit message.
Quoted 3 lines
before the dcs cmds transmission,
and pull the mipi signal high from LP00 to LP11 until the start of the dcs cmds transmission.
Maybe you can try to write as:
To comply with...
- Hold the mipi signal...
- Pul the miip signal high....
Quoted 6 lines
If dsi is not in cmd mode, then dsi will pull the mipi signal high in the
mtk_output_dsi_enablefunction.Fixes 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the drm_panel_bridgeAPI")
Can you remove this blank line?
Quoted 64 lines
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 31 +++++++++++++++++++++++----- -- 1 file changed, 24 insertions(+), 7 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +13
-7@@ -203,6 +203,7 @@ struct mtk_dsi {struct mtk_phy_timing phy_timing;int refcount;bool enabled; +bool lanes_ready;u32 irq_data;wait_queue_head_t irq_wait_queue;const struct mtk_dsi_driver_data *driver_data;@@ -654,13 +655,6 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)mtk_dsi_config_vdo_timing (dsi);mtk_dsi_set_interrupt_enable (dsi); -mtk_dsi_rxtx_control (dsi); -usleep_range (30 ,100 ); -mtk_dsi_reset_dphy (dsi); -mtk_dsi_clk_ulp_mode_leave (dsi); -mtk_dsi_lane0_ulp_mode_leave (dsi); -mtk_dsi_clk_hs_mode (dsi,0 ); -return 0 ; err_disable_engine_clk:clk_disable_unprepare (dsi->engine_clk);@@ -689,6 +683,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)clk_disable_unprepare (dsi->digital_clk);phy_power_off (dsi->phy); + + dsi->lanes_ready = false; }static void mtk_output_dsi_enable (struct mtk_dsi *dsi)@@ -696,6 +692,16 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi)if (dsi->enabled)return ; +if (!dsi->lanes_ready) { + dsi->lanes_ready = true; +mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi); +mtk_dsi_clk_ulp_mode_leave (dsi); +mtk_dsi_lane0_ulp_mode_leave (dsi); +mtk_dsi_clk_hs_mode (dsi,0 ); + } +mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );@@ -995,6 +1001,17 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host, if (MTK_DSI_HOST_IS_READ(msg->type))
drivers/gpu/drm/mediatek/mtk_dsi.c static ssize_t mtk_dsi_host_transfer(struct · line 1012
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +8
-0irq_flag |=LPRX_RD_RDY_INT_FLAG ; +if (!dsi->lanes_ready) { + dsi->lanes_ready = true; +mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi); +mtk_dsi_clk_ulp_mode_leave (dsi); +mtk_dsi_lane0_ulp_mode_leave (dsi); +mtk_dsi_clk_hs_mode (dsi,0 );
The drivers are the same with previous modification. I think you can use a funtion for them?
drivers/gpu/drm/mediatek/mtk_dsi.c static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host, · line 1012
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+msleep (20 );
Why delay 20ms but not in mtk_output_dsi_enable?
BRs,
Rex
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-0+ } + ret =mtk_dsi_host_send_cmd (dsi, msg, irq_flag);if (ret)goto
restore_dsi_mode;
Re: [PATCH v3,3/4] drm/mediatek: keep dsi as LP00 before dcs cmds transfer
Quoted 117 lines · Rex-BC Chen
Hello Xinlei,
Quoted 3 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Jitao Shi <[email protected]>
To comply with the panel sequence, hold the mipi signal to LP00
Could you provide a example panel power sequence to let me understand that?
Maybe you can put them in commit message.Quoted 3 lines
before the dcs cmds transmission,
and pull the mipi signal high from LP00 to LP11 until the start of the dcs cmds transmission.Maybe you can try to write as:
To comply with...
- Hold the mipi signal...
- Pul the miip signal high....Quoted 8 lines
If dsi is not in cmd mode, then dsi will pull the mipi signal high in
themtk_output_dsi_enablefunction.Fixes 2dd8075d2185 ("drm/mediatek: mtk_dsi: Use the
drm_panel_bridge
API")Can you remove this blank line?
Quoted 68 lines
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 31 +++++++++++++++++++++++--- -- -- 1 file changed, 24 insertions(+), 7 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +1
-7@@ -203,6 +203,7 @@ struct mtk_dsi {struct mtk_phy_timing phy_timing;int refcount;bool enabled; +bool lanes_ready;u32 irq_data;wait_queue_head_t irq_wait_queue;const struct mtk_dsi_driver_data *driver_data;@@ -654,13 +655,6 @@ static int mtk_dsi_poweron(struct mtk_dsi *dsi)mtk_dsi_config_vdo_timing (dsi);mtk_dsi_set_interrupt_enable (dsi); -mtk_dsi_rxtx_control (dsi); -usleep_range (30 ,100 ); -mtk_dsi_reset_dphy (dsi); -mtk_dsi_clk_ulp_mode_leave (dsi); -mtk_dsi_lane0_ulp_mode_leave (dsi); -mtk_dsi_clk_hs_mode (dsi,0 ); -return 0 ; err_disable_engine_clk:drivers/gpu/drm/mediatek/mtk_dsi.c +2
-0clk_disable_unprepare (dsi->engine_clk);@@ -689,6 +683,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)clk_disable_unprepare (dsi->digital_clk);phy_power_off (dsi->phy); + + dsi->lanes_ready = false; }static void
mtk_output_dsi_enable(struct mtk_dsi *dsi)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0@@ -696,6 +692,16 @@ static void mtk_output_dsi_enable(struct
mtk_dsi
*dsi)drivers/gpu/drm/mediatek/mtk_dsi.c +10
-0if (dsi->enabled)return ; +if (!dsi->lanes_ready) { + dsi->lanes_ready = true; +mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi); +mtk_dsi_clk_ulp_mode_leave (dsi); +mtk_dsi_lane0_ulp_mode_leave (dsi); +mtk_dsi_clk_hs_mode (dsi,0 ); + } +mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );@@ -995,6 +1001,17 @@ static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host, if (MTK_DSI_HOST_IS_READ(msg->type))drivers/gpu/drm/mediatek/mtk_dsi.c static ssize_t mtk_dsi_host_transfer(struct · line 1012
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +8
-0irq_flag |=LPRX_RD_RDY_INT_FLAG ; +if (!dsi->lanes_ready) { + dsi->lanes_ready = true; +mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi); +mtk_dsi_clk_ulp_mode_leave (dsi); +mtk_dsi_lane0_ulp_mode_leave (dsi); +mtk_dsi_clk_hs_mode (dsi,0 );The drivers are the same with previous modification. I think you can use a funtion for them?
drivers/gpu/drm/mediatek/mtk_dsi.c static ssize_t mtk_dsi_host_transfer(struct mipi_dsi_host *host, · line 1012
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+msleep (20 );Why delay 20ms but not in
mtk_output_dsi_enable?
Quoted 9 lines
BRs,
RexQuoted 5 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-0+ } + ret =mtk_dsi_host_send_cmd (dsi, msg, irq_flag);if (ret)goto
restore_dsi_mode;
Hi rex:
Thanks for your review.
1.The normal panel timing is as follows (I will add to the commit message in the next version):
(1) pp1800 DC pull up
(2) avdd & avee AC pull high
(3) lcm_reset pull high -> pull low -> pull high
(4) Pull MIPI signal high (LP11) -> initial code -> send video data(HS mode)
The power-off sequence is reversed.
2.
The 20ms delay in dsi_host_transfer is because dsi needs to give dsi_rx(panel) a reaction time after pulling up the mipi signal. If you suggest encapsulating it as a function I will add a delay to mtk_output_dsi_enable in the next version as well.
Best Regards!
xinlei
PATCH v3 4/4 drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function
In reply to [email protected]From: Xinlei Lee <[email protected]>
In the dsi_enable function, mtk_dsi_rxtx_control is to
pull up the MIPI signal operation. Before dsi_disable,
MIPI should also be pulled down by writing a register instead of disabling dsi.
--- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/gpu/drm/mediatek/mtk_dsi.c +2 -0
@@ -676,6 +676,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi); +/* set the lane number as 0 */ +writel (0 , dsi->regs +DSI_TXRX_CTRL );mtk_dsi_disable (dsi);
Signature · 1 line
2.18.0
Re: [PATCH v3,4/4] drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function
Hello Xinlei,
Quoted 7 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Xinlei Lee <[email protected]>
In the
dsi_enablefunction,mtk_dsi_rxtx_controlis to pull up the MIPI signal operation. Beforedsi_disable, MIPI should also be pulled down by writing a register instead of disabling dsi.
What will happen if you do not pulled down the mipi before disable dsi? What's differnet for this two setting?
Quoted 12 lines
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_poweroff(struct mtk_dsi *dsi) · line 680
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-0@@ -676,6 +676,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi); +/* set the lane number as 0 */ +writel (0 , dsi->regs +DSI_TXRX_CTRL );
So set lane num to 0 means pull down mipi?
BRs,
Rex
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0mtk_dsi_disable (dsi);
Re: [PATCH v3,4/4] drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function
Quoted 36 lines · Rex-BC Chen
Hello Xinlei,
Quoted 7 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Xinlei Lee <[email protected]>
In the
dsi_enablefunction,mtk_dsi_rxtx_controlis to pull up the MIPI signal operation. Beforedsi_disable, MIPI should also be pulled down by writing a register instead of disabling dsi.What will happen if you do not pulled down the mipi before disable dsi?
What's differnet for this two setting?Quoted 12 lines
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++ 1 file changed, 2 insertions(+)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_poweroff(struct mtk_dsi · line 681
Quoted 6 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +2
-0@@ -676,6 +676,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi); +/* set the lane number as 0 */ +writel (0 , dsi->regs +DSI_TXRX_CTRL );So set lane num to 0 means pull down mipi?
Quoted 8 lines
BRs,
RexQuoted 3 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0mtk_dsi_disable (dsi);
Hi rex:
1.
If you disable dsi without pulling the mipi signal low, the value of the register will still maintain the setting of the mipi signal being pulled high.
After resume, even if the mipi signal is not pulled high, it will still be in the high state.
2.So set lane num to 0 means pull down mipi
=> yes
Do you have any suggestions on the next version?
Best Regards!
xinlei
Re: [PATCH v3,4/4] drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function
Quoted 22 lines · xinlei.lee
Quoted 21 lines · Rex-BC Chen
Hello Xinlei,
Quoted 7 lines · On Thu, 2022-03-17 at 15:53 +0800, [email protected] wrote:
From: Xinlei Lee <[email protected]>
In the
dsi_enablefunction,mtk_dsi_rxtx_controlis to pull up the MIPI signal operation. Beforedsi_disable, MIPI should also be pulled down by writing a register instead of disabling dsi.What will happen if you do not pulled down the mipi before disable dsi?
What's differnet for this two setting?Quoted 6 lines
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 2 ++ 1 file changed, 2 insertions(+)
Quoted 11 lines
Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_poweroff(struct mtk_dsi · line 680
Quoted 11 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0@@ -676,6 +676,8 @@ static void mtk_dsi_poweroff(struct mtk_dsi *dsi)mtk_dsi_reset_engine (dsi);mtk_dsi_lane0_ulp_mode_enter (dsi);mtk_dsi_clk_ulp_mode_enter (dsi); +/* set the lane number as 0 */
Hello Xinlei,
I think you can write this comment more detailed, like "/* set the lane number as 0 to pull down mipi */"
Quoted 15 lines
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_poweroff(struct mtk_dsi *dsi) · line 680
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+writel (0 , dsi->regs +DSI_TXRX_CTRL );So set lane num to 0 means pull down mipi?
Quoted 8 lines
BRs,
RexQuoted 3 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0mtk_dsi_disable (dsi);Hi rex:
Quoted 8 lines
1.
If you disable dsi without pulling the mipi signal low, the value of the register will still maintain the setting of the mipi signal being pulled high.
After resume, even if the mipi signal is not pulled high, it will still
be in the high state.
I think you can describe this in commit message
BRs,
Rex
Quoted 8 lines
2.So set lane num to 0 means pull down mipi
=> yesDo you have any suggestions on the next version?
Best Regards!
xinlei