* [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup
@ 2024-12-03 0:38 Abhinav Kumar
2024-12-03 13:45 ` Dmitry Baryshkov
0 siblings, 1 reply; 13+ messages in thread
From: Abhinav Kumar @ 2024-12-03 0:38 UTC (permalink / raw)
To: Rob Clark, Dmitry Baryshkov, Sean Paul, Marijn Suijten,
David Airlie, Simona Vetter
Cc: linux-arm-msm, dri-devel, freedreno, Stephen Boyd, Doug Anderson,
Johan Hovold, Bjorn Andersson, Abhinav Kumar
HPD state machine in msm dp display driver manages the state transitions
between various HPD events and the expected state of driver to make sure
both match up.
Although originally done with the intent of managing userspace interactions
and interactions with compliance equipment, over period of time,
changes to this piece of code has become quite difficult to manage.
Although, unwinding this logic will take some time and will be spread over
various changes, to start things, this series tries to get rid of the
ST_DISPLAY_OFF state as firstly, its really not an hpd state but a state
of the display overall. Coupled with this, there are quite a few checks
in the current code, the origins of which need to be re-visited OR are unclear
which seem unlikely or redundant. With DP controller on newer chipsets supporting
multiple streams, this has become increasingly difficult to work with.
This series removes the redundant state checks and simplifies the logic as an
attempt to get rid of this ST_DISPLAY_OFF state.
Note: This series has been tested with sa8775p and sc7180 devices with multiple
monitors and also multiple dongles with no noticeable regressions.
Both of these devices use native DP PHY though. Hence, if this series can
be verified on some devices with USBC-DP combo PHY with the help of the other
developers, that will be great.
To: Rob Clark <robdclark@gmail.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
To: Sean Paul <sean@poorly.run>
To: Marijn Suijten <marijn.suijten@somainline.org>
To: David Airlie <airlied@gmail.com>
To: Simona Vetter <simona@ffwll.ch>
Cc: linux-arm-msm@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: freedreno@lists.freedesktop.org
Cc: Stephen Boyd <swboyd@chromium.org>
Cc: Doug Anderson <dianders@chromium.org>
Cc: Johan Hovold <johan@kernel.org>
Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
---
Abhinav Kumar (4):
drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers
drm/msm/dp: remove redundant ST_DISPLAY_OFF checks in msm_dp_bridge_atomic_enable()
drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle()
drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state
drivers/gpu/drm/msm/dp/dp_display.c | 23 ++---------------------
1 file changed, 2 insertions(+), 21 deletions(-)
---
base-commit: 798bb342e0416d846cf67f4725a3428f39bfb96b
change-id: 20241202-hpd_display_off-6051aa510f23
Best regards,
--
Abhinav Kumar <quic_abhinavk@quicinc.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup
2024-12-03 0:38 Abhinav Kumar
@ 2024-12-03 13:45 ` Dmitry Baryshkov
2024-12-03 20:55 ` Abhinav Kumar
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2024-12-03 13:45 UTC (permalink / raw)
To: Abhinav Kumar
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
linux-arm-msm, dri-devel, freedreno, Stephen Boyd, Doug Anderson,
Johan Hovold, Bjorn Andersson
On Mon, Dec 02, 2024 at 04:38:59PM -0800, Abhinav Kumar wrote:
> HPD state machine in msm dp display driver manages the state transitions
> between various HPD events and the expected state of driver to make sure
> both match up.
>
> Although originally done with the intent of managing userspace interactions
> and interactions with compliance equipment, over period of time,
> changes to this piece of code has become quite difficult to manage.
>
> Although, unwinding this logic will take some time and will be spread over
> various changes, to start things, this series tries to get rid of the
> ST_DISPLAY_OFF state as firstly, its really not an hpd state but a state
> of the display overall. Coupled with this, there are quite a few checks
> in the current code, the origins of which need to be re-visited OR are unclear
> which seem unlikely or redundant. With DP controller on newer chipsets supporting
> multiple streams, this has become increasingly difficult to work with.
>
> This series removes the redundant state checks and simplifies the logic as an
> attempt to get rid of this ST_DISPLAY_OFF state.
>
> Note: This series has been tested with sa8775p and sc7180 devices with multiple
> monitors and also multiple dongles with no noticeable regressions.
> Both of these devices use native DP PHY though. Hence, if this series can
> be verified on some devices with USBC-DP combo PHY with the help of the other
> developers, that will be great.
Don't you also have an RB5 (for pmic-typec) and SM83(?)50-HDK for
pmic-glink?
What kind of userspace were you testing with? Have you tested pure fbcon
/ drm_client?
>
> To: Rob Clark <robdclark@gmail.com>
> To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> To: Sean Paul <sean@poorly.run>
> To: Marijn Suijten <marijn.suijten@somainline.org>
> To: David Airlie <airlied@gmail.com>
> To: Simona Vetter <simona@ffwll.ch>
> Cc: linux-arm-msm@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org
> Cc: freedreno@lists.freedesktop.org
> Cc: Stephen Boyd <swboyd@chromium.org>
> Cc: Doug Anderson <dianders@chromium.org>
> Cc: Johan Hovold <johan@kernel.org>
> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
>
> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> ---
> Abhinav Kumar (4):
> drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers
> drm/msm/dp: remove redundant ST_DISPLAY_OFF checks in msm_dp_bridge_atomic_enable()
> drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle()
> drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state
>
> drivers/gpu/drm/msm/dp/dp_display.c | 23 ++---------------------
> 1 file changed, 2 insertions(+), 21 deletions(-)
> ---
> base-commit: 798bb342e0416d846cf67f4725a3428f39bfb96b
> change-id: 20241202-hpd_display_off-6051aa510f23
>
> Best regards,
> --
> Abhinav Kumar <quic_abhinavk@quicinc.com>
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup
2024-12-03 13:45 ` Dmitry Baryshkov
@ 2024-12-03 20:55 ` Abhinav Kumar
0 siblings, 0 replies; 13+ messages in thread
From: Abhinav Kumar @ 2024-12-03 20:55 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
linux-arm-msm, dri-devel, freedreno, Stephen Boyd, Doug Anderson,
Johan Hovold, Bjorn Andersson
On 12/3/2024 5:45 AM, Dmitry Baryshkov wrote:
> On Mon, Dec 02, 2024 at 04:38:59PM -0800, Abhinav Kumar wrote:
>> HPD state machine in msm dp display driver manages the state transitions
>> between various HPD events and the expected state of driver to make sure
>> both match up.
>>
>> Although originally done with the intent of managing userspace interactions
>> and interactions with compliance equipment, over period of time,
>> changes to this piece of code has become quite difficult to manage.
>>
>> Although, unwinding this logic will take some time and will be spread over
>> various changes, to start things, this series tries to get rid of the
>> ST_DISPLAY_OFF state as firstly, its really not an hpd state but a state
>> of the display overall. Coupled with this, there are quite a few checks
>> in the current code, the origins of which need to be re-visited OR are unclear
>> which seem unlikely or redundant. With DP controller on newer chipsets supporting
>> multiple streams, this has become increasingly difficult to work with.
>>
>> This series removes the redundant state checks and simplifies the logic as an
>> attempt to get rid of this ST_DISPLAY_OFF state.
>>
>> Note: This series has been tested with sa8775p and sc7180 devices with multiple
>> monitors and also multiple dongles with no noticeable regressions.
>> Both of these devices use native DP PHY though. Hence, if this series can
>> be verified on some devices with USBC-DP combo PHY with the help of the other
>> developers, that will be great.
>
Thanks for the review.
> Don't you also have an RB5 (for pmic-typec) and SM83(?)50-HDK for
> pmic-glink?
>
We have a sm8350HDK (RB5 is busy for CI use), but as usual have not
being having a great run with setting it up. Hence if you or anyone from
your side has it already setup, it will be helpful. We will keep trying
to make our sm8350hdk work meanwhile.
> What kind of userspace were you testing with? Have you tested pure fbcon
> / drm_client?
>
Yes, the sc7180 was with CrOS userspace.
the sa8775p was with linux-next and pure fbcon. I only made sure
hotplugs worked and display showed correctly. If something else needs
validation, let me know.
>>
>> To: Rob Clark <robdclark@gmail.com>
>> To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
>> To: Sean Paul <sean@poorly.run>
>> To: Marijn Suijten <marijn.suijten@somainline.org>
>> To: David Airlie <airlied@gmail.com>
>> To: Simona Vetter <simona@ffwll.ch>
>> Cc: linux-arm-msm@vger.kernel.org
>> Cc: dri-devel@lists.freedesktop.org
>> Cc: freedreno@lists.freedesktop.org
>> Cc: Stephen Boyd <swboyd@chromium.org>
>> Cc: Doug Anderson <dianders@chromium.org>
>> Cc: Johan Hovold <johan@kernel.org>
>> Cc: Bjorn Andersson <quic_bjorande@quicinc.com>
>>
>> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>> ---
>> Abhinav Kumar (4):
>> drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers
>> drm/msm/dp: remove redundant ST_DISPLAY_OFF checks in msm_dp_bridge_atomic_enable()
>> drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle()
>> drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state
>>
>> drivers/gpu/drm/msm/dp/dp_display.c | 23 ++---------------------
>> 1 file changed, 2 insertions(+), 21 deletions(-)
>> ---
>> base-commit: 798bb342e0416d846cf67f4725a3428f39bfb96b
>> change-id: 20241202-hpd_display_off-6051aa510f23
>>
>> Best regards,
>> --
>> Abhinav Kumar <quic_abhinavk@quicinc.com>
>>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup
@ 2025-05-29 23:13 Jessica Zhang
2025-05-29 23:13 ` [PATCH 1/4] drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers Jessica Zhang
` (4 more replies)
0 siblings, 5 replies; 13+ messages in thread
From: Jessica Zhang @ 2025-05-29 23:13 UTC (permalink / raw)
To: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov
Cc: linux-arm-msm, dri-devel, freedreno, Stephen Boyd, Doug Anderson,
Johan Hovold, Bjorn Andersson, Abhinav Kumar, linux-kernel,
Yongxing Mou, Jessica Zhang, Dmitry Baryshkov
HPD state machine in msm dp display driver manages the state transitions
between various HPD events and the expected state of driver to make sure
both match up.
Although originally done with the intent of managing userspace interactions
and interactions with compliance equipment, over period of time,
changes to this piece of code has become quite difficult to manage.
Although, unwinding this logic will take some time and will be spread over
various changes, to start things, this series tries to get rid of the
ST_DISPLAY_OFF state as firstly, its really not an hpd state but a state
of the display overall. Coupled with this, there are quite a few checks
in the current code, the origins of which need to be re-visited OR are unclear
which seem unlikely or redundant. With DP controller on newer chipsets supporting
multiple streams, this has become increasingly difficult to work with.
This series removes the redundant state checks and simplifies the logic as an
attempt to get rid of this ST_DISPLAY_OFF state.
Note: This series has been tested with sa8775p and sc7180 devices with multiple
monitors and also multiple dongles with no noticeable regressions.
Both of these devices use native DP PHY though. Hence, if this series can
be verified on some devices with USBC-DP combo PHY with the help of the other
developers, that will be great.
---
Changes in v2:
- Rebased on top of next-20250523
- Change atomic_enable() to return early if ST_DISCONENCT_PENDING
instead of completely dropping the
if (state != ST_DISPLAY_OFF && state != ST_MAINLINK_READY) check (Dmitry)
---
Abhinav Kumar (4):
drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers
drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING
drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle()
drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state
drivers/gpu/drm/msm/dp/dp_display.c | 19 +++----------------
1 file changed, 3 insertions(+), 16 deletions(-)
---
base-commit: daf70030586cf0279a57b58a94c32cfe901df23d
change-id: 20241202-hpd_display_off-6051aa510f23
Best regards,
--
Jessica Zhang <jessica.zhang@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 1/4] drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers
2025-05-29 23:13 [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Jessica Zhang
@ 2025-05-29 23:13 ` Jessica Zhang
2025-05-29 23:13 ` [PATCH 2/4] drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING Jessica Zhang
` (3 subsequent siblings)
4 siblings, 0 replies; 13+ messages in thread
From: Jessica Zhang @ 2025-05-29 23:13 UTC (permalink / raw)
To: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov
Cc: linux-arm-msm, dri-devel, freedreno, Stephen Boyd, Doug Anderson,
Johan Hovold, Bjorn Andersson, Abhinav Kumar, linux-kernel,
Yongxing Mou, Jessica Zhang, Dmitry Baryshkov
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
In commit 8ede2ecc3e5ee ("drm/msm/dp: Add DP compliance tests on Snapdragon
Chipsets"), checks were introduced to avoid handling any plug or irq hpd
events in ST_DISPLAY_OFF state.
Even if we do get hpd events, after the bridge was disabled,
it should get handled. Moreover, its unclear under what circumstances
these events will fire because ST_DISPLAY_OFF means that the link was
still connected but only the bridge was disabled. If the link was
untouched, then interrupts shouldn't fire.
Even in the case of the DP compliance equipment, it should be raising these
interrupts during the start of the test which is usually accompanied with
either a HPD pulse or a IRQ HPD but after the bridge is disabled it should
be fine to handle these anyway. In the absence of a better reason to keep
these checks, drop these and if any other issues do arise, it should be
handled in a different way.
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/dp/dp_display.c | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 386c4669c831..1d7cda62d5fb 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -579,11 +579,6 @@ static int msm_dp_hpd_plug_handle(struct msm_dp_display_private *dp, u32 data)
drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n",
dp->msm_dp_display.connector_type, state);
- if (state == ST_DISPLAY_OFF) {
- mutex_unlock(&dp->event_mutex);
- return 0;
- }
-
if (state == ST_MAINLINK_READY || state == ST_CONNECTED) {
mutex_unlock(&dp->event_mutex);
return 0;
@@ -706,11 +701,6 @@ static int msm_dp_irq_hpd_handle(struct msm_dp_display_private *dp, u32 data)
drm_dbg_dp(dp->drm_dev, "Before, type=%d hpd_state=%d\n",
dp->msm_dp_display.connector_type, state);
- if (state == ST_DISPLAY_OFF) {
- mutex_unlock(&dp->event_mutex);
- return 0;
- }
-
if (state == ST_MAINLINK_READY || state == ST_DISCONNECT_PENDING) {
/* wait until ST_CONNECTED */
msm_dp_add_event(dp, EV_IRQ_HPD_INT, 0, 1); /* delay = 1 */
--
2.49.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 2/4] drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING
2025-05-29 23:13 [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Jessica Zhang
2025-05-29 23:13 ` [PATCH 1/4] drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers Jessica Zhang
@ 2025-05-29 23:13 ` Jessica Zhang
2025-05-30 16:04 ` Dmitry Baryshkov
2025-05-29 23:13 ` [PATCH 3/4] drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle() Jessica Zhang
` (2 subsequent siblings)
4 siblings, 1 reply; 13+ messages in thread
From: Jessica Zhang @ 2025-05-29 23:13 UTC (permalink / raw)
To: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov
Cc: linux-arm-msm, dri-devel, freedreno, Stephen Boyd, Doug Anderson,
Johan Hovold, Bjorn Andersson, Abhinav Kumar, linux-kernel,
Yongxing Mou, Jessica Zhang
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
The checks in msm_dp_bridge_atomic_enable() for making sure that we are in
ST_DISPLAY_OFF OR ST_MAINLINK_READY seem redundant.
DRM fwk shall not issue any commits if state is not ST_MAINLINK_READY as
msm_dp's atomic_check callback returns a failure if state is not
ST_MAINLINK_READY.
For the ST_DISPLAY_OFF check, its mainly to guard against a scenario that
there is an atomic_enable() without a prior atomic_disable() which once
again should not really happen.
Since it's still possible for the state machine to transition to
ST_DISCONNECT_PENDING between atomic_check() and atomic_commit(), change
this check to return early if hpd_state is ST_DISCONNECT_PENDING.
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Signed-off-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 1d7cda62d5fb..f2820f06f5dc 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -1512,7 +1512,7 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge *drm_bridge,
}
hpd_state = msm_dp_display->hpd_state;
- if (hpd_state != ST_DISPLAY_OFF && hpd_state != ST_MAINLINK_READY) {
+ if (hpd_state == ST_DISCONNECT_PENDING) {
mutex_unlock(&msm_dp_display->event_mutex);
return;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 3/4] drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle()
2025-05-29 23:13 [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Jessica Zhang
2025-05-29 23:13 ` [PATCH 1/4] drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers Jessica Zhang
2025-05-29 23:13 ` [PATCH 2/4] drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING Jessica Zhang
@ 2025-05-29 23:13 ` Jessica Zhang
2025-05-29 23:13 ` [PATCH 4/4] drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state Jessica Zhang
2025-05-30 16:05 ` [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Dmitry Baryshkov
4 siblings, 0 replies; 13+ messages in thread
From: Jessica Zhang @ 2025-05-29 23:13 UTC (permalink / raw)
To: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov
Cc: linux-arm-msm, dri-devel, freedreno, Stephen Boyd, Doug Anderson,
Johan Hovold, Bjorn Andersson, Abhinav Kumar, linux-kernel,
Yongxing Mou, Jessica Zhang, Dmitry Baryshkov
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
msm_dp_hpd_unplug_handle() checks if the display was already disabled and
if so does not transition to ST_DISCONNECT_PENDING state and goes directly
to ST_DISCONNECTED. The same result can be achieved with the !power_on
check.
Replace ST_DISPLAY_OFF with !power_on to achieve the same outcome.
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index f2820f06f5dc..785c813d2b31 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -672,7 +672,7 @@ static int msm_dp_hpd_unplug_handle(struct msm_dp_display_private *dp, u32 data)
*/
msm_dp_display_notify_disconnect(&dp->msm_dp_display.pdev->dev);
- if (state == ST_DISPLAY_OFF) {
+ if (!dp->msm_dp_display.power_on) {
dp->hpd_state = ST_DISCONNECTED;
} else {
dp->hpd_state = ST_DISCONNECT_PENDING;
--
2.49.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 4/4] drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state
2025-05-29 23:13 [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Jessica Zhang
` (2 preceding siblings ...)
2025-05-29 23:13 ` [PATCH 3/4] drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle() Jessica Zhang
@ 2025-05-29 23:13 ` Jessica Zhang
2025-05-30 16:05 ` [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Dmitry Baryshkov
4 siblings, 0 replies; 13+ messages in thread
From: Jessica Zhang @ 2025-05-29 23:13 UTC (permalink / raw)
To: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov
Cc: linux-arm-msm, dri-devel, freedreno, Stephen Boyd, Doug Anderson,
Johan Hovold, Bjorn Andersson, Abhinav Kumar, linux-kernel,
Yongxing Mou, Jessica Zhang, Dmitry Baryshkov
From: Abhinav Kumar <quic_abhinavk@quicinc.com>
ST_DISPLAY_OFF check in msm_dp_bridge_atomic_enable() is used to check
that if the display was disabled while still hotplugged, phy needs
to be re-initialized. This can be replaced with a different check as
it just means the hpd_state was still ST_CONNECTED but without display
being powered on. Replace the ST_DISPLAY_OFF check with a combination
of connected and power_on checks.
Since all consumers of ST_DISPLAY_OFF have now been removed,
drop ST_DISPLAY_OFF from the list of hpd_states as technically
this was never a 'hpd' state anyway.
Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Signed-off-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
---
drivers/gpu/drm/msm/dp/dp_display.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
index 785c813d2b31..6f05a939ce9e 100644
--- a/drivers/gpu/drm/msm/dp/dp_display.c
+++ b/drivers/gpu/drm/msm/dp/dp_display.c
@@ -50,7 +50,6 @@ enum {
ST_MAINLINK_READY,
ST_CONNECTED,
ST_DISCONNECT_PENDING,
- ST_DISPLAY_OFF,
};
enum {
@@ -1526,7 +1525,7 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge *drm_bridge,
hpd_state = msm_dp_display->hpd_state;
- if (hpd_state == ST_DISPLAY_OFF) {
+ if (hpd_state == ST_CONNECTED && !dp->power_on) {
msm_dp_display_host_phy_init(msm_dp_display);
force_link_train = true;
}
@@ -1584,8 +1583,6 @@ void msm_dp_bridge_atomic_post_disable(struct drm_bridge *drm_bridge,
if (hpd_state == ST_DISCONNECT_PENDING) {
/* completed disconnection */
msm_dp_display->hpd_state = ST_DISCONNECTED;
- } else {
- msm_dp_display->hpd_state = ST_DISPLAY_OFF;
}
drm_dbg_dp(dp->drm_dev, "type=%d Done\n", dp->connector_type);
--
2.49.0
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING
2025-05-29 23:13 ` [PATCH 2/4] drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING Jessica Zhang
@ 2025-05-30 16:04 ` Dmitry Baryshkov
2025-06-02 17:54 ` Jessica Zhang
0 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2025-05-30 16:04 UTC (permalink / raw)
To: Jessica Zhang
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov, linux-arm-msm, dri-devel,
freedreno, Stephen Boyd, Doug Anderson, Johan Hovold,
Bjorn Andersson, Abhinav Kumar, linux-kernel, Yongxing Mou
On Fri, 30 May 2025 at 02:15, Jessica Zhang
<jessica.zhang@oss.qualcomm.com> wrote:
>
> From: Abhinav Kumar <quic_abhinavk@quicinc.com>
>
> The checks in msm_dp_bridge_atomic_enable() for making sure that we are in
> ST_DISPLAY_OFF OR ST_MAINLINK_READY seem redundant.
>
> DRM fwk shall not issue any commits if state is not ST_MAINLINK_READY as
> msm_dp's atomic_check callback returns a failure if state is not
> ST_MAINLINK_READY.
What if the state changes between atomic_check() and atomic_enable()?
There are no locks, cable unplugging is async, so it's perfectly
possible.
>
> For the ST_DISPLAY_OFF check, its mainly to guard against a scenario that
> there is an atomic_enable() without a prior atomic_disable() which once
> again should not really happen.
>
> Since it's still possible for the state machine to transition to
> ST_DISCONNECT_PENDING between atomic_check() and atomic_commit(), change
> this check to return early if hpd_state is ST_DISCONNECT_PENDING.
Can we really, please, drop the state machine? I had other plans for
the next week, but maybe I should just do it, so that by the end of
6.17 cycle we can have a merged, stable and working solution? This
topic has been lingering for months without any actual change.
>
> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
> Signed-off-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
> ---
> drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
> index 1d7cda62d5fb..f2820f06f5dc 100644
> --- a/drivers/gpu/drm/msm/dp/dp_display.c
> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
> @@ -1512,7 +1512,7 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge *drm_bridge,
> }
>
> hpd_state = msm_dp_display->hpd_state;
> - if (hpd_state != ST_DISPLAY_OFF && hpd_state != ST_MAINLINK_READY) {
> + if (hpd_state == ST_DISCONNECT_PENDING) {
> mutex_unlock(&msm_dp_display->event_mutex);
> return;
> }
>
> --
> 2.49.0
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup
2025-05-29 23:13 [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Jessica Zhang
` (3 preceding siblings ...)
2025-05-29 23:13 ` [PATCH 4/4] drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state Jessica Zhang
@ 2025-05-30 16:05 ` Dmitry Baryshkov
2025-05-30 17:50 ` Jessica Zhang
4 siblings, 1 reply; 13+ messages in thread
From: Dmitry Baryshkov @ 2025-05-30 16:05 UTC (permalink / raw)
To: Jessica Zhang
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov, linux-arm-msm, dri-devel,
freedreno, Stephen Boyd, Doug Anderson, Johan Hovold,
Bjorn Andersson, Abhinav Kumar, linux-kernel, Yongxing Mou
On Fri, 30 May 2025 at 02:15, Jessica Zhang
<jessica.zhang@oss.qualcomm.com> wrote:
>
> HPD state machine in msm dp display driver manages the state transitions
> between various HPD events and the expected state of driver to make sure
> both match up.
>
> Although originally done with the intent of managing userspace interactions
> and interactions with compliance equipment, over period of time,
> changes to this piece of code has become quite difficult to manage.
>
> Although, unwinding this logic will take some time and will be spread over
> various changes, to start things, this series tries to get rid of the
> ST_DISPLAY_OFF state as firstly, its really not an hpd state but a state
> of the display overall. Coupled with this, there are quite a few checks
> in the current code, the origins of which need to be re-visited OR are unclear
> which seem unlikely or redundant. With DP controller on newer chipsets supporting
> multiple streams, this has become increasingly difficult to work with.
>
> This series removes the redundant state checks and simplifies the logic as an
> attempt to get rid of this ST_DISPLAY_OFF state.
>
> Note: This series has been tested with sa8775p and sc7180 devices with multiple
> monitors and also multiple dongles with no noticeable regressions.
> Both of these devices use native DP PHY though. Hence, if this series can
> be verified on some devices with USBC-DP combo PHY with the help of the other
> developers, that will be great.
>
> ---
> Changes in v2:
The series is not marked as v2 though.
> - Rebased on top of next-20250523
> - Change atomic_enable() to return early if ST_DISCONENCT_PENDING
> instead of completely dropping the
> if (state != ST_DISPLAY_OFF && state != ST_MAINLINK_READY) check (Dmitry)
>
> ---
> Abhinav Kumar (4):
> drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers
> drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING
> drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle()
> drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state
>
> drivers/gpu/drm/msm/dp/dp_display.c | 19 +++----------------
> 1 file changed, 3 insertions(+), 16 deletions(-)
> ---
> base-commit: daf70030586cf0279a57b58a94c32cfe901df23d
> change-id: 20241202-hpd_display_off-6051aa510f23
>
> Best regards,
> --
> Jessica Zhang <jessica.zhang@oss.qualcomm.com>
>
--
With best wishes
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup
2025-05-30 16:05 ` [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Dmitry Baryshkov
@ 2025-05-30 17:50 ` Jessica Zhang
0 siblings, 0 replies; 13+ messages in thread
From: Jessica Zhang @ 2025-05-30 17:50 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov, linux-arm-msm, dri-devel,
freedreno, Stephen Boyd, Doug Anderson, Johan Hovold,
Bjorn Andersson, Abhinav Kumar, linux-kernel, Yongxing Mou
On 5/30/2025 9:05 AM, Dmitry Baryshkov wrote:
> On Fri, 30 May 2025 at 02:15, Jessica Zhang
> <jessica.zhang@oss.qualcomm.com> wrote:
>>
>> HPD state machine in msm dp display driver manages the state transitions
>> between various HPD events and the expected state of driver to make sure
>> both match up.
>>
>> Although originally done with the intent of managing userspace interactions
>> and interactions with compliance equipment, over period of time,
>> changes to this piece of code has become quite difficult to manage.
>>
>> Although, unwinding this logic will take some time and will be spread over
>> various changes, to start things, this series tries to get rid of the
>> ST_DISPLAY_OFF state as firstly, its really not an hpd state but a state
>> of the display overall. Coupled with this, there are quite a few checks
>> in the current code, the origins of which need to be re-visited OR are unclear
>> which seem unlikely or redundant. With DP controller on newer chipsets supporting
>> multiple streams, this has become increasingly difficult to work with.
>>
>> This series removes the redundant state checks and simplifies the logic as an
>> attempt to get rid of this ST_DISPLAY_OFF state.
>>
>> Note: This series has been tested with sa8775p and sc7180 devices with multiple
>> monitors and also multiple dongles with no noticeable regressions.
>> Both of these devices use native DP PHY though. Hence, if this series can
>> be verified on some devices with USBC-DP combo PHY with the help of the other
>> developers, that will be great.
>>
>> ---
>> Changes in v2:
>
> The series is not marked as v2 though.
Hi Dmitry,
Sorry for the confusion -- had pulled the v1 [1] using `b4 prep -F` but
forgot to force the revision number to v2.
[1] https://patchwork.freedesktop.org/series/142010/#rev1
Thanks,
Jessica Zhang
>
>> - Rebased on top of next-20250523
>> - Change atomic_enable() to return early if ST_DISCONENCT_PENDING
>> instead of completely dropping the
>> if (state != ST_DISPLAY_OFF && state != ST_MAINLINK_READY) check (Dmitry)
>>
>> ---
>> Abhinav Kumar (4):
>> drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers
>> drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING
>> drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle()
>> drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state
>>
>> drivers/gpu/drm/msm/dp/dp_display.c | 19 +++----------------
>> 1 file changed, 3 insertions(+), 16 deletions(-)
>> ---
>> base-commit: daf70030586cf0279a57b58a94c32cfe901df23d
>> change-id: 20241202-hpd_display_off-6051aa510f23
>>
>> Best regards,
>> --
>> Jessica Zhang <jessica.zhang@oss.qualcomm.com>
>>
>
>
> --
> With best wishes
>
> Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING
2025-05-30 16:04 ` Dmitry Baryshkov
@ 2025-06-02 17:54 ` Jessica Zhang
2025-06-02 19:47 ` OSS
0 siblings, 1 reply; 13+ messages in thread
From: Jessica Zhang @ 2025-06-02 17:54 UTC (permalink / raw)
To: Dmitry Baryshkov
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov, linux-arm-msm, dri-devel,
freedreno, Stephen Boyd, Doug Anderson, Johan Hovold,
Bjorn Andersson, Abhinav Kumar, linux-kernel, Yongxing Mou
On 5/30/2025 9:04 AM, Dmitry Baryshkov wrote:
> On Fri, 30 May 2025 at 02:15, Jessica Zhang
> <jessica.zhang@oss.qualcomm.com> wrote:
>>
>> From: Abhinav Kumar <quic_abhinavk@quicinc.com>
>>
>> The checks in msm_dp_bridge_atomic_enable() for making sure that we are in
>> ST_DISPLAY_OFF OR ST_MAINLINK_READY seem redundant.
>>
>> DRM fwk shall not issue any commits if state is not ST_MAINLINK_READY as
>> msm_dp's atomic_check callback returns a failure if state is not
>> ST_MAINLINK_READY.
>
> What if the state changes between atomic_check() and atomic_enable()?
> There are no locks, cable unplugging is async, so it's perfectly
> possible.
>
>>
>> For the ST_DISPLAY_OFF check, its mainly to guard against a scenario that
>> there is an atomic_enable() without a prior atomic_disable() which once
>> again should not really happen.
>>
>> Since it's still possible for the state machine to transition to
>> ST_DISCONNECT_PENDING between atomic_check() and atomic_commit(), change
>> this check to return early if hpd_state is ST_DISCONNECT_PENDING.
>
> Can we really, please, drop the state machine? I had other plans for
> the next week, but maybe I should just do it, so that by the end of
> 6.17 cycle we can have a merged, stable and working solution? This
> topic has been lingering for months without any actual change.
FWIW, I'm currently working on the state machine rework by the middle of
next week.
I'm anticipating that the rework itself will take some time to get
merged, so didn't want MST to get delayed more by this series.
Thanks,
Jessica Zhang
>
>>
>> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>> Signed-off-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
>> ---
>> drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
>> index 1d7cda62d5fb..f2820f06f5dc 100644
>> --- a/drivers/gpu/drm/msm/dp/dp_display.c
>> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
>> @@ -1512,7 +1512,7 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge *drm_bridge,
>> }
>>
>> hpd_state = msm_dp_display->hpd_state;
>> - if (hpd_state != ST_DISPLAY_OFF && hpd_state != ST_MAINLINK_READY) {
>> + if (hpd_state == ST_DISCONNECT_PENDING) {
>
>
>
>> mutex_unlock(&msm_dp_display->event_mutex);
>> return;
>> }
>>
>> --
>> 2.49.0
>>
>
>
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH 2/4] drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING
2025-06-02 17:54 ` Jessica Zhang
@ 2025-06-02 19:47 ` OSS
0 siblings, 0 replies; 13+ messages in thread
From: OSS @ 2025-06-02 19:47 UTC (permalink / raw)
To: Jessica Zhang
Cc: Rob Clark, Sean Paul, Marijn Suijten, David Airlie, Simona Vetter,
Abhinav Kumar, Dmitry Baryshkov, linux-arm-msm, dri-devel,
freedreno, Stephen Boyd, Doug Anderson, Johan Hovold,
Bjorn Andersson, Abhinav Kumar, linux-kernel, Yongxing Mou
On 2 June 2025 18:54:12 BST, Jessica Zhang <jessica.zhang@oss.qualcomm.com> wrote:
>
>
>On 5/30/2025 9:04 AM, Dmitry Baryshkov wrote:
>> On Fri, 30 May 2025 at 02:15, Jessica Zhang
>> <jessica.zhang@oss.qualcomm.com> wrote:
>>>
>>> From: Abhinav Kumar <quic_abhinavk@quicinc.com>
>>>
>>> The checks in msm_dp_bridge_atomic_enable() for making sure that we are in
>>> ST_DISPLAY_OFF OR ST_MAINLINK_READY seem redundant.
>>>
>>> DRM fwk shall not issue any commits if state is not ST_MAINLINK_READY as
>>> msm_dp's atomic_check callback returns a failure if state is not
>>> ST_MAINLINK_READY.
>>
>> What if the state changes between atomic_check() and atomic_enable()?
>> There are no locks, cable unplugging is async, so it's perfectly
>> possible.
>>
>>>
>>> For the ST_DISPLAY_OFF check, its mainly to guard against a scenario that
>>> there is an atomic_enable() without a prior atomic_disable() which once
>>> again should not really happen.
>>>
>>> Since it's still possible for the state machine to transition to
>>> ST_DISCONNECT_PENDING between atomic_check() and atomic_commit(), change
>>> this check to return early if hpd_state is ST_DISCONNECT_PENDING.
>>
>> Can we really, please, drop the state machine? I had other plans for
>> the next week, but maybe I should just do it, so that by the end of
>> 6.17 cycle we can have a merged, stable and working solution? This
>> topic has been lingering for months without any actual change.
>
>FWIW, I'm currently working on the state machine rework by the middle of next week.
>
>I'm anticipating that the rework itself will take some time to get merged, so didn't want MST to get delayed more by this series.
Yes, that's fine. I really want HPD to be merged before MST. And if I wasn't explicit, the state machine must be gone. Link training should happen from atomic_enable, detect should be reporting whether there is an actual display plugged, etc. Current code must be dropped.
>
>Thanks,
>
>Jessica Zhang
>
>>
>>>
>>> Signed-off-by: Abhinav Kumar <quic_abhinavk@quicinc.com>
>>> Signed-off-by: Jessica Zhang <jessica.zhang@oss.qualcomm.com>
>>> ---
>>> drivers/gpu/drm/msm/dp/dp_display.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c
>>> index 1d7cda62d5fb..f2820f06f5dc 100644
>>> --- a/drivers/gpu/drm/msm/dp/dp_display.c
>>> +++ b/drivers/gpu/drm/msm/dp/dp_display.c
>>> @@ -1512,7 +1512,7 @@ void msm_dp_bridge_atomic_enable(struct drm_bridge *drm_bridge,
>>> }
>>>
>>> hpd_state = msm_dp_display->hpd_state;
>>> - if (hpd_state != ST_DISPLAY_OFF && hpd_state != ST_MAINLINK_READY) {
>>> + if (hpd_state == ST_DISCONNECT_PENDING) {
>>
>>
>>
>>> mutex_unlock(&msm_dp_display->event_mutex);
>>> return;
>>> }
>>>
>>> --
>>> 2.49.0
>>>
>>
>>
>
With best wishes,
Dmitry
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2025-06-02 19:47 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-29 23:13 [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Jessica Zhang
2025-05-29 23:13 ` [PATCH 1/4] drm/msm/dp: remove redundant checks related to ST_DISPLAY_OFF in plug/irq_ipd handlers Jessica Zhang
2025-05-29 23:13 ` [PATCH 2/4] drm/msm/dp: Return early from atomic_enable() if ST_DISCONNECT_PENDING Jessica Zhang
2025-05-30 16:04 ` Dmitry Baryshkov
2025-06-02 17:54 ` Jessica Zhang
2025-06-02 19:47 ` OSS
2025-05-29 23:13 ` [PATCH 3/4] drm/msm/dp: replace ST_DISPLAY_OFF with power_on in msm_dp_hpd_unplug_handle() Jessica Zhang
2025-05-29 23:13 ` [PATCH 4/4] drm/msm/dp: remove ST_DISPLAY_OFF as a hpd_state Jessica Zhang
2025-05-30 16:05 ` [PATCH 0/4] drm/msm/dp: ST_DISPLAY_OFF hpd cleanup Dmitry Baryshkov
2025-05-30 17:50 ` Jessica Zhang
-- strict thread matches above, loose matches on Subject: below --
2024-12-03 0:38 Abhinav Kumar
2024-12-03 13:45 ` Dmitry Baryshkov
2024-12-03 20:55 ` Abhinav Kumar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox