Cooperate with DSI RX devices to modify dsi funcs and delay mipi high to cooperate with panel sequence
Subsystems (3)
v4 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 v3:
1. Rebase kernel-5.18-rc1.
2. Added dsi_enable protection.
3. Encapsulates the dsi_lane_ready function.
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 | 81 ++++++++++++++++++++---------- 1 file changed, 55 insertions(+), 26 deletions(-)
Signature · 1 line
2.18.0
PATCH v4 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
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
--- 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 v4, 1/4] drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11
Il 11/04/22 04:31, [email protected] ha scritto:
Quoted 14 lines
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 modeThe 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
Quoted 4 lines
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]>
Re: [PATCH v4,1/4] drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11
In reply to [email protected]Quoted 36 lines · On Mon, 2022-04-11 at 10:31 +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 modeThe 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 modeFixes 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 | 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);
drivers/gpu/drm/mediatek/mtk_dsi.c static int mtk_dsi_poweron(struct mtk_dsi *dsi) · line 662
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +3
-0mtk_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 v4, 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 Mon, 2022-04-11 at 10:31 +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 5 lines
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
You just describe WHAT this patch do, but WHY this patch do? Does this patch reorder sequence to follow any spec?
Quoted 20 lines
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 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-1@@ -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);
drivers/gpu/drm/mediatek/mtk_dsi.c static int mtk_dsi_poweron(struct mtk_dsi *dsi) · line 659
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +3
-2-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);
The original sequence is done by patch [1] not the patch in the Fixes tag. So modify the Fixes tag.
Regards,
CK
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0mtk_dsi_clk_ulp_mode_leave (dsi);mtk_dsi_lane0_ulp_mode_leave (dsi);mtk_dsi_clk_hs_mode (dsi,0 );
Re: [PATCH v4, 1/4] drm/mediatek: Adjust the timing of mipi signal from LP00 to LP11
Quoted 50 lines · CK Hu
Hi, Xinlei:
Quoted 8 lines · On Mon, 2022-04-11 at 10:31 +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 5 lines
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 modeYou just describe WHAT this patch do, but WHY this patch do? Does this
patch reorder sequence to follow any spec?Quoted 29 lines
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 | 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 9 lines
drivers/gpu/drm/mediatek/mtk_dsi.c static int mtk_dsi_poweron(struct mtk_dsi *dsi) · line 659
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +3
-0+mtk_dsi_rxtx_control (dsi); +usleep_range (30 ,100 ); +mtk_dsi_reset_dphy (dsi);The original sequence is done by patch [1] not the patch in the Fixes tag. So modify the Fixes tag.
[1]
Quoted 9 lines
Regards,
CKQuoted 3 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0mtk_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!
This modification does not violate the spec. The main purpose is to move 2, 3, 4 of the new sequece to the lane_ready function. I will modify this Fixes tag in the next version.
Best Regards!
xinlei
PATCH v4 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 | 51 +++++++++++++++++++----------- 1 file changed, 32 insertions(+), 19 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +32 -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; }
@@ -762,13 +753,35 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) {struct mtk_dsi *dsi =bridge_to_dsi (bridge); +if (dsi->refcount ==0 ) +return ; +mtk_output_dsi_enable (dsi); } +static void mtk_dsi_bridge_pre_enable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); +int ret; + + ret =mtk_dsi_poweron (dsi); +if (ret <0 ) +DRM_ERROR ("failed to power on dsi\n" ); +} + +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 v4, 2/4] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs
Il 11/04/22 04:31, [email protected] ha scritto:
Quoted 10 lines
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]>
Re: [PATCH v4,2/4] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs
In reply to [email protected]Quoted 11 lines · On Mon, 2022-04-11 at 10:31 +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]>
Re: [PATCH v4, 2/4] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs
In reply to [email protected]Hi, Xinlei:
Quoted 106 lines · On Mon, 2022-04-11 at 10:31 +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 | 51 +++++++++++++++++++--------- -- 1 file changed, 32 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 +4
-14-* 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.
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 +20
-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; }@@ -762,13 +753,35 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) {struct mtk_dsi *dsi =bridge_to_dsi (bridge); +if (dsi->refcount ==0 ) +return ; +mtk_output_dsi_enable (dsi); } +static void mtk_dsi_bridge_pre_enable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); +int ret; + + ret =mtk_dsi_poweron (dsi); +if (ret <0 ) +DRM_ERROR ("failed to power on dsi\n" ); +} + +static void mtk_dsi_bridge_post_disable (struct drm_bridge *bridge) +{
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct · line 784
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +6
-0+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,
The flow looks good to me, but according to [1], pre_enable is deprecated. Use atomic_pre_enable instead.
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) · line 784
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+ .post_disable = mtk_dsi_bridge_post_disable,
Ditto.
Regards,
CK
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0.mode_set = mtk_dsi_bridge_mode_set, };
Re: [PATCH v4, 2/4] drm/mediatek: Separate poweron/poweroff from enable/disable and define new funcs
Quoted 125 lines · CK Hu
Hi, Xinlei:
Quoted 108 lines · On Mon, 2022-04-11 at 10:31 +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 | 51 +++++++++++++++++++------- -- -- 1 file changed, 32 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 +4
-14-* 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.
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 +20
-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; }@@ -762,13 +753,35 @@ static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) {struct mtk_dsi *dsi =bridge_to_dsi (bridge); +if (dsi->refcount ==0 ) +return ; +mtk_output_dsi_enable (dsi); } +static void mtk_dsi_bridge_pre_enable (struct drm_bridge *bridge) +{ +struct mtk_dsi *dsi =bridge_to_dsi (bridge); +int ret; + + ret =mtk_dsi_poweron (dsi); +if (ret <0 ) +DRM_ERROR ("failed to power on dsi\n" ); +} + +static void mtk_dsi_bridge_post_disable (struct drm_bridge *bridge) +{drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct · line 784
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +6
-0+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,The flow looks good to me, but according to [1],
pre_enableis deprecated. Useatomic_pre_enableinstead.
Quoted 2 lines
[1]
Quoted 14 lines
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_bridge_enable(struct drm_bridge *bridge) · line 784
Quoted 3 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+ .post_disable = mtk_dsi_bridge_post_disable,Ditto.
Regards,
CKQuoted 3 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0.mode_set = mtk_dsi_bridge_mode_set, };
Hi CK:
Thanks for your suggestion.
I will revise it in the next version.
Best Regards!
xinlei
PATCH v4 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. The normal panel timing is :
(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.
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 | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)
drivers/gpu/drm/mediatek/mtk_dsi.c +21 -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,23 @@ 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_dsi_lane_ready (struct mtk_dsi *dsi) +{ +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 ); + }else +DRM_DEBUG ("The dsi_lane is ready\n" ); }static void mtk_output_dsi_enable (struct mtk_dsi *dsi)
@@ -696,6 +707,7 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi)if (dsi->enabled)return ; +mtk_dsi_lane_ready (dsi);mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );
@@ -1001,6 +1013,8 @@ 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 ; +mtk_dsi_lane_ready (dsi); + ret =mtk_dsi_host_send_cmd (dsi, msg, irq_flag);if (ret) goto restore_dsi_mode;
Signature · 1 line
2.18.0
AngeloGioacchino Del Regno
maintainerRe: [PATCH v4, 3/4] drm/mediatek: keep dsi as LP00 before dcs cmds transfer
Il 11/04/22 04:31, [email protected] ha scritto:
Quoted 55 lines
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. The normal panel timing is :
(1) pp1800 DC pull up
(2) avdd & avee AC pull high
(3)lcm_resetpull high -> pull low -> pull high
(4) Pull MIPI signal high (LP11) -> initial code -> send video data(HS mode)
The power-off sequence is reversed.
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")Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +6
-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,23 @@ 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_dsi_lane_ready (struct mtk_dsi *dsi)
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_poweroff(struct mtk_dsi *dsi) · line 700
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +10
-0+{ +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 );
This is a very long sleep, which wasn't present before this change. Please document the reasons why we need this 20ms sleep with a comment in the code.
Regards,
Angelo
Re: [PATCH v4, 3/4] drm/mediatek: keep dsi as LP00 before dcs cmds transfer
Quoted 81 lines · AngeloGioacchino Del Regno
Il 11/04/22 04:31, [email protected] ha scritto:
Quoted 64 lines
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.
The normal panel timing is :
(1) pp1800 DC pull up
(2) avdd & avee AC pull high
(3)lcm_resetpull high -> pull low -> pull high
(4) Pull MIPI signal high (LP11) -> initial code -> send video data(HS mode)
The power-off sequence is reversed.
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_bridgeAPI")Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++-- ----- 1 file changed, 21 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:clk_disable_unprepare(dsi->engine_clk);drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0@@ -689,6 +683,23 @@ 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_dsi_lane_ready (struct mtk_dsi *dsi)drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_poweroff(struct mtk_dsi · line 701
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +10
-0+{ +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 );This is a very long sleep, which wasn't present before this change. Please document the reasons why we need this 20ms sleep with a comment
in the code.
Quoted 4 lines
Regards,
Angelo
Hello Xinlei,
As Angelo mentioned.
I think you should add this in commit message and driver comments. (Your reply in v3.)
"The 20ms delay in mtk_dsi_lane_ready() is because dsi needs to give dsi_rx(panel) a reaction time after pulling up the mipi signal."
BRs,
Rex
Re: [PATCH v4, 3/4] drm/mediatek: keep dsi as LP00 before dcs cmds transfer
Quoted 91 lines · Rex-BC Chen
Quoted 83 lines · AngeloGioacchino Del Regno
Il 11/04/22 04:31, [email protected] ha scritto:
Quoted 66 lines
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.
The normal panel timing is :
(1) pp1800 DC pull up
(2) avdd & avee AC pull high
(3)lcm_resetpull high -> pull low -> pull high
(4) Pull MIPI signal high (LP11) -> initial code -> send video data(HS mode)
The power-off sequence is reversed.
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_bridgeAPI")Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++-- ----- 1 file changed, 21 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:clk_disable_unprepare(dsi->engine_clk);drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0@@ -689,6 +683,23 @@ 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_dsi_lane_ready (struct mtk_dsi *dsi)drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_poweroff(struct mtk_dsi · line 701
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +10
-0+{ +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 );This is a very long sleep, which wasn't present before this change. Please document the reasons why we need this 20ms sleep with a comment
in the code.Quoted 4 lines
Regards,
AngeloHello Xinlei,
Quoted 9 lines
As Angelo mentioned.
I think you should add this in commit message and driver comments. (Your reply in v3.)
"The 20ms delay inmtk_dsi_lane_ready()is because dsi needs to givedsi_rx(panel)a reaction time after pulling up the mipi signal."BRs,
Rex
Hey Rex:
Thanks for your review and reminder.
I will add this explanation in the next edition of code & comments.
Best Regards!
xinlei
Re: [PATCH v4, 3/4] drm/mediatek: keep dsi as LP00 before dcs cmds transfer
In reply to AngeloGioacchino Del RegnoQuoted 81 lines · AngeloGioacchino Del Regno
Il 11/04/22 04:31, [email protected] ha scritto:
Quoted 64 lines
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.
The normal panel timing is :
(1) pp1800 DC pull up
(2) avdd & avee AC pull high
(3)lcm_resetpull high -> pull low -> pull high
(4) Pull MIPI signal high (LP11) -> initial code -> send video data(HS mode)
The power-off sequence is reversed.
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_bridgeAPI")Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++-- ----- 1 file changed, 21 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:clk_disable_unprepare(dsi->engine_clk);drivers/gpu/drm/mediatek/mtk_dsi.c +5
-0@@ -689,6 +683,23 @@ 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_dsi_lane_ready (struct mtk_dsi *dsi)drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_poweroff(struct mtk_dsi · line 701
Quoted 10 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +10
-0+{ +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 );This is a very long sleep, which wasn't present before this change. Please document the reasons why we need this 20ms sleep with a comment
in the code.
Quoted 4 lines
Regards,
Angelo
Hi Angelo:
Thanks for your review.
As mentioned in the previous reply, it is because the time required to respond to dsi_rx is about one frame.
I will add this explanation in the next edition of code & comments.
Best Regards!
xinlei
Re: [PATCH v4, 3/4] drm/mediatek: keep dsi as LP00 before dcs cmds transfer
In reply to [email protected]Hi, Xinlei:
Quoted 87 lines · On Mon, 2022-04-11 at 10:31 +0800, [email protected] wrote:
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.
The normal panel timing is :
(1) pp1800 DC pull up
(2) avdd & avee AC pull high
(3)lcm_resetpull high -> pull low -> pull high
(4) Pull MIPI signal high (LP11) -> initial code -> send video data(HS mode)
The power-off sequence is reversed.
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_bridgeAPI")
Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-)drivers/gpu/drm/mediatek/mtk_dsi.c +18
-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,23 @@ 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_dsi_lane_ready (struct mtk_dsi *dsi) +{ +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 ); + }else +DRM_DEBUG ("The dsi_lane is ready\n" ); }static void
mtk_output_dsi_enable(struct mtk_dsi *dsi)drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0@@ -696,6 +707,7 @@ static void mtk_output_dsi_enable(struct mtk_dsi *dsi)if (dsi->enabled)return ; +mtk_dsi_lane_ready (dsi);mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );
drivers/gpu/drm/mediatek/mtk_dsi.c static ssize_t mtk_dsi_host_transfer(struct · line 1017
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0@@ -1001,6 +1013,8 @@ 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; +mtk_dsi_lane_ready (dsi);
In [1], YT has move mtk_dsi_lane_ready() before panel prepare for dsi-
drivers/gpu/drm/mediatek/mtk_dsi.c static ssize_t mtk_dsi_host_transfer(struct · line 1018
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0panel case. Now you move mtk_dsi_lane_ready() after panel prepare,
this may break dsi->panel case. Please provide a solution for both case.
Regards,
CK
Quoted 4 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+ ret =mtk_dsi_host_send_cmd (dsi, msg, irq_flag);drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0if (ret) goto restore_dsi_mode;
Re: [PATCH v4, 3/4] drm/mediatek: keep dsi as LP00 before dcs cmds transfer
Quoted 103 lines · CK Hu
Hi, Xinlei:
Quoted 92 lines · On Mon, 2022-04-11 at 10:31 +0800, [email protected] wrote:
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.
The normal panel timing is :
(1) pp1800 DC pull up
(2) avdd & avee AC pull high
(3)lcm_resetpull high -> pull low -> pull high
(4) Pull MIPI signal high (LP11) -> initial code -> send video data(HS mode)
The power-off sequence is reversed.
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")Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++----- -- 1 file changed, 21 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 +17
-0clk_disable_unprepare (dsi->engine_clk);@@ -689,6 +683,23 @@ 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_dsi_lane_ready (struct mtk_dsi *dsi) +{ +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 ); + }else +DRM_DEBUG ("The dsi_lane is ready\n" ); }static void
mtk_output_dsi_enable(struct mtk_dsi *dsi)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0@@ -696,6 +707,7 @@ static void mtk_output_dsi_enable(struct
mtk_dsi
*dsi)drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0if (dsi->enabled)return ; +mtk_dsi_lane_ready (dsi);mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );drivers/gpu/drm/mediatek/mtk_dsi.c static ssize_t mtk_dsi_host_transfer(struct · line 1017
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0@@ -1001,6 +1013,8 @@ 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; +mtk_dsi_lane_ready (dsi);In [1], YT has move
mtk_dsi_lane_ready()before panel prepare for dsi-
Quoted 7 lines
drivers/gpu/drm/mediatek/mtk_dsi.c static ssize_t mtk_dsi_host_transfer(struct · line 1018
Quoted 1 line
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0panel case. Now you move mtk_dsi_lane_ready() after panel prepare,this may break
dsi->panelcase. Please provide a solution for both case.[1]
Quoted 10 lines
Regards,
CKQuoted 4 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+ ret =mtk_dsi_host_send_cmd (dsi, msg, irq_flag);drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0if (ret) goto restore_dsi_mode;
Hi CK:
Because the order of dsi->panel in [1] is as follows (tv101 panel as an example):
1. dsi_poweron (lane_ready)
2. panel_prepare
3. panel_prepare_power
4. panel_init_cmd
5. dsi_host_transfer (actually send panel initial code)
This modified order:
1. dsi_poweron
2. panel_prepare
3. panel_prepare_power
4. panel_init_cmd
5. dsi_host_transfer (lane_ready)
It can be seen that the lane_ready is delayed closer to before sending the initial code, which is necessary for some panels with stricter timing requirements.
And if this screen does not need to send initial code, it will also do lane_ready in output_dsi_enable, so that dsi can complete LP00->LP11-
Quoted 1 line
HS mode.
[1]
Best Regards!
xinlei
Re: [PATCH v4, 3/4] drm/mediatek: keep dsi as LP00 before dcs cmds transfer
Hi, Xinlei:
Quoted 77 lines · xinlei.lee
Quoted 76 lines · CK Hu
Hi, Xinlei:
Quoted 73 lines · On Mon, 2022-04-11 at 10:31 +0800, [email protected] wrote:
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.
The normal panel timing is :
(1) pp1800 DC pull up
(2) avdd & avee AC pull high
(3)lcm_resetpull high -> pull low -> pull high
(4) Pull MIPI signal high (LP11) -> initial code -> send video data(HS mode)
The power-off sequence is reversed.
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")Signed-off-by Jitao Shi <[email protected]>Signed-off-by Xinlei Lee <[email protected]>--- drivers/gpu/drm/mediatek/mtk_dsi.c | 28 +++++++++++++++++++++--- -- -- 1 file changed, 21 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 +9
-0clk_disable_unprepare (dsi->engine_clk);@@ -689,6 +683,23 @@ 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_dsi_lane_ready (struct mtk_dsi *dsi) +{ +if (!dsi->lanes_ready) { + dsi->lanes_ready = true; +mtk_dsi_rxtx_control (dsi);
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_dsi.c static void mtk_dsi_poweroff(struct mtk_dsi *dsi) · line 702
Quoted 8 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +8
-0+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 ); + }else +DRM_DEBUG ("The dsi_lane is ready\n" );
Once mtk_dsi_host_transfer() call this function first, then mtk_output_dsi_enable() would call again. This function would be called twice in normal sequence, so I think this debug information is not necessary.
Quoted 22 lines
Quoted 22 lines
Quoted 14 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0}static void
mtk_output_dsi_enable(struct mtk_dsi *dsi)drivers/gpu/drm/mediatek/mtk_dsi.c +0
-0@@ -696,6 +707,7 @@ static void mtk_output_dsi_enable(struct
mtk_dsi
*dsi)drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0if (dsi->enabled)return ; +mtk_dsi_lane_ready (dsi);mtk_dsi_set_mode (dsi);mtk_dsi_clk_hs_mode (dsi,1 );drivers/gpu/drm/mediatek/mtk_dsi.c static ssize_t mtk_dsi_host_transfer(struct · line 1017
Quoted 5 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0@@ -1001,6 +1013,8 @@ 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; +mtk_dsi_lane_ready (dsi);In [1], YT has move
mtk_dsi_lane_ready()before panel prepare for dsi-
Quoted 10 lines
Quoted 8 lines
Quoted 2 lines
panel case. Now you move
mtk_dsi_lane_ready()after panel prepare,this may break
dsi->panelcase. Please provide a solution for both case.[1]
Quoted 29 lines
Quoted 10 lines
Regards,
CKQuoted 4 lines
drivers/gpu/drm/mediatek/mtk_dsi.c +1
-0+ ret =mtk_dsi_host_send_cmd (dsi, msg, irq_flag);if (ret) goto restore_dsi_mode;Hi CK:
Because the order of
dsi->panelin [1] is as follows (tv101 panel as an
example):
1.dsi_poweron(lane_ready)
2.panel_prepare
3.panel_prepare_power
4.panel_init_cmd
5.dsi_host_transfer(actually send panel initial code)This modified order:
1.dsi_poweron
2.panel_prepare
3.panel_prepare_power
4.panel_init_cmd
5.dsi_host_transfer(lane_ready)
Quoted 8 lines
It can be seen that the
lane_readyis delayed closer to before sending
the initial code, which is necessary for some panels with stricter timing requirements.
And if this screen does not need to send initial code, it will also dolane_readyinoutput_dsi_enable, so that dsi can complete LP00->LP11-Quoted 1 line
HS mode.
Understand. You call mtk_dsi_lane_ready() in both mtk_output_dsi_enable() and mtk_dsi_host_transfer(). The panel prepare may call mtk_dsi_host_transfer() and mtk_dsi_lane_ready() would be called.
Regards,
CK
Quoted 4 lines
[1]
Quoted 4 lines
Best Regards!
xinlei
PATCH v4 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.
If 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.
--- 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 to pull down mipi */ +writel (0 , dsi->regs +DSI_TXRX_CTRL );mtk_dsi_disable (dsi);
Signature · 1 line
2.18.0
Re: [PATCH v4,4/4] drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function
Quoted 26 lines · On Mon, 2022-04-11 at 10:31 +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.If 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.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 683
Quoted 8 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 to pull down mipi */ +writel (0 , dsi->regs +DSI_TXRX_CTRL );mtk_dsi_disable (dsi);
Re: [PATCH v4, 4/4] drm/mediatek: Add pull-down MIPI operation in mtk_dsi_poweroff function
In reply to [email protected]Hi, Xinlei:
Quoted 7 lines · On Mon, 2022-04-11 at 10:31 +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.
Quoted 6 lines
If 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.
After add Fixes tag for [1], then
Quoted 21 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 +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 to pull down mipi */ +writel (0 , dsi->regs +DSI_TXRX_CTRL );mtk_dsi_disable (dsi);