2020-09-11 03:47:08

by Koba Ko

[permalink] [raw]
Subject: [PATCH v3] drm/dp_mst: Retrieve extended DPCD caps for topology manager

As per DP-1.3, First check DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT.
If DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT is 1, read the DP_DP13_DPCD_REV to
get the faster capability.
If DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT is 0, read DP_DPCD_REV.

Signed-off-by: Koba Ko <[email protected]>
Reviewed-by: Lyude Paul <[email protected]>
---
Changelog:
1. Adjust the commit message.
2. use drm_dbg_kms instead and print the return code.
---
drivers/gpu/drm/drm_dp_mst_topology.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)

diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 7753c718ddf9..63f8809b9aa4 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -3671,8 +3671,6 @@ EXPORT_SYMBOL(drm_dp_read_mst_cap);
int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool mst_state)
{
int ret = 0;
- u8 dpcd_ext = 0;
- unsigned int dpcd_offset = 0;
struct drm_dp_mst_branch *mstb = NULL;

mutex_lock(&mgr->payload_lock);
@@ -3686,17 +3684,11 @@ int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr, bool ms
struct drm_dp_payload reset_pay;

WARN_ON(mgr->mst_primary);
- drm_dp_dpcd_read(mgr->aux,
- DP_TRAINING_AUX_RD_INTERVAL,
- &dpcd_ext, sizeof(dpcd_ext));
-
- dpcd_offset =
- ((dpcd_ext & DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT) ? DP_DP13_DPCD_REV : DP_DPCD_REV);

/* get dpcd info */
- ret = drm_dp_dpcd_read(mgr->aux, dpcd_offset, mgr->dpcd, DP_RECEIVER_CAP_SIZE);
- if (ret != DP_RECEIVER_CAP_SIZE) {
- DRM_DEBUG_KMS("failed to read DPCD\n");
+ ret = drm_dp_read_dpcd_caps(mgr->aux, mgr->dpcd);
+ if (ret < 0) {
+ drm_dbg_kms(mgr->dev, "failed to read DPCD, ret %d\n", ret);
goto out_unlock;
}

--
2.25.1


2020-09-21 18:13:09

by Lyude Paul

[permalink] [raw]
Subject: Re: [PATCH v3] drm/dp_mst: Retrieve extended DPCD caps for topology manager

Hi, sorry I lost track of this until just now. Comments down below:

On Fri, 2020-09-11 at 11:44 +0800, Koba Ko wrote:
> As per DP-1.3, First check DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT.
> If DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT is 1, read the DP_DP13_DPCD_REV to
> get the faster capability.
> If DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT is 0, read DP_DPCD_REV.
>
> Signed-off-by: Koba Ko <[email protected]>
> Reviewed-by: Lyude Paul <[email protected]>
> ---
> Changelog:
> 1. Adjust the commit message.
> 2. use drm_dbg_kms instead and print the return code.
> ---
> drivers/gpu/drm/drm_dp_mst_topology.c | 14 +++-----------
> 1 file changed, 3 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> b/drivers/gpu/drm/drm_dp_mst_topology.c
> index 7753c718ddf9..63f8809b9aa4 100644
> --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> @@ -3671,8 +3671,6 @@ EXPORT_SYMBOL(drm_dp_read_mst_cap);
> int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr,
> bool mst_state)
> {
> int ret = 0;
> - u8 dpcd_ext = 0;
> - unsigned int dpcd_offset = 0;
> struct drm_dp_mst_branch *mstb = NULL;
>
> mutex_lock(&mgr->payload_lock);
> @@ -3686,17 +3684,11 @@ int drm_dp_mst_topology_mgr_set_mst(struct
> drm_dp_mst_topology_mgr *mgr, bool ms
> struct drm_dp_payload reset_pay;
>
> WARN_ON(mgr->mst_primary);
> - drm_dp_dpcd_read(mgr->aux,
> - DP_TRAINING_AUX_RD_INTERVAL,
> - &dpcd_ext, sizeof(dpcd_ext));
> -
> - dpcd_offset =
> - ((dpcd_ext & DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT)
> ? DP_DP13_DPCD_REV : DP_DPCD_REV);


Uh, are you sure you formatted this patch correctly? None of these hunks are present upstream, this looks like it's a diff for the previous version of this patch that you sent out
>
> /* get dpcd info */
> - ret = drm_dp_dpcd_read(mgr->aux, dpcd_offset, mgr->dpcd,
> DP_RECEIVER_CAP_SIZE);
> - if (ret != DP_RECEIVER_CAP_SIZE) {
> - DRM_DEBUG_KMS("failed to read DPCD\n");
> + ret = drm_dp_read_dpcd_caps(mgr->aux, mgr->dpcd);
> + if (ret < 0) {
> + drm_dbg_kms(mgr->dev, "failed to read DPCD, ret %d\n",
> ret);
> goto out_unlock;
> }
>
--
Cheers,
Lyude Paul (she/her)
Software Engineer at Red Hat

2020-09-22 08:30:23

by Koba Ko

[permalink] [raw]
Subject: Re: [PATCH v3] drm/dp_mst: Retrieve extended DPCD caps for topology manager

On Tue, Sep 22, 2020 at 2:11 AM Lyude Paul <[email protected]> wrote:
>
> Hi, sorry I lost track of this until just now. Comments down below:
Sorry, the wrong base. I will modify it based on v2 and will send v4.
>
> On Fri, 2020-09-11 at 11:44 +0800, Koba Ko wrote:
> > As per DP-1.3, First check DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT.
> > If DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT is 1, read the DP_DP13_DPCD_REV to
> > get the faster capability.
> > If DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT is 0, read DP_DPCD_REV.
> >
> > Signed-off-by: Koba Ko <[email protected]>
> > Reviewed-by: Lyude Paul <[email protected]>
> > ---
> > Changelog:
> > 1. Adjust the commit message.
> > 2. use drm_dbg_kms instead and print the return code.
> > ---
> > drivers/gpu/drm/drm_dp_mst_topology.c | 14 +++-----------
> > 1 file changed, 3 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > index 7753c718ddf9..63f8809b9aa4 100644
> > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > @@ -3671,8 +3671,6 @@ EXPORT_SYMBOL(drm_dp_read_mst_cap);
> > int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr,
> > bool mst_state)
> > {
> > int ret = 0;
> > - u8 dpcd_ext = 0;
> > - unsigned int dpcd_offset = 0;
> > struct drm_dp_mst_branch *mstb = NULL;
> >
> > mutex_lock(&mgr->payload_lock);
> > @@ -3686,17 +3684,11 @@ int drm_dp_mst_topology_mgr_set_mst(struct
> > drm_dp_mst_topology_mgr *mgr, bool ms
> > struct drm_dp_payload reset_pay;
> >
> > WARN_ON(mgr->mst_primary);
> > - drm_dp_dpcd_read(mgr->aux,
> > - DP_TRAINING_AUX_RD_INTERVAL,
> > - &dpcd_ext, sizeof(dpcd_ext));
> > -
> > - dpcd_offset =
> > - ((dpcd_ext & DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT)
> > ? DP_DP13_DPCD_REV : DP_DPCD_REV);
>
>
> Uh, are you sure you formatted this patch correctly? None of these hunks are present upstream, this looks like it's a diff for the previous version of this patch that you sent out
> >
> > /* get dpcd info */
> > - ret = drm_dp_dpcd_read(mgr->aux, dpcd_offset, mgr->dpcd,
> > DP_RECEIVER_CAP_SIZE);
> > - if (ret != DP_RECEIVER_CAP_SIZE) {
> > - DRM_DEBUG_KMS("failed to read DPCD\n");
> > + ret = drm_dp_read_dpcd_caps(mgr->aux, mgr->dpcd);
> > + if (ret < 0) {
> > + drm_dbg_kms(mgr->dev, "failed to read DPCD, ret %d\n",
> > ret);
> > goto out_unlock;
> > }
> >
> --
> Cheers,
> Lyude Paul (she/her)
> Software Engineer at Red Hat
>

2020-09-22 08:34:43

by Koba Ko

[permalink] [raw]
Subject: Re: [PATCH v3] drm/dp_mst: Retrieve extended DPCD caps for topology manager

On Tue, Sep 22, 2020 at 2:11 AM Lyude Paul <[email protected]> wrote:
>
> Hi, sorry I lost track of this until just now. Comments down below:
>
Sorry, the wrong base. I will modify it based on v2 and will send v4.
> On Fri, 2020-09-11 at 11:44 +0800, Koba Ko wrote:
> > As per DP-1.3, First check DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT.
> > If DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT is 1, read the DP_DP13_DPCD_REV to
> > get the faster capability.
> > If DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT is 0, read DP_DPCD_REV.
> >
> > Signed-off-by: Koba Ko <[email protected]>
> > Reviewed-by: Lyude Paul <[email protected]>
> > ---
> > Changelog:
> > 1. Adjust the commit message.
> > 2. use drm_dbg_kms instead and print the return code.
> > ---
> > drivers/gpu/drm/drm_dp_mst_topology.c | 14 +++-----------
> > 1 file changed, 3 insertions(+), 11 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c
> > b/drivers/gpu/drm/drm_dp_mst_topology.c
> > index 7753c718ddf9..63f8809b9aa4 100644
> > --- a/drivers/gpu/drm/drm_dp_mst_topology.c
> > +++ b/drivers/gpu/drm/drm_dp_mst_topology.c
> > @@ -3671,8 +3671,6 @@ EXPORT_SYMBOL(drm_dp_read_mst_cap);
> > int drm_dp_mst_topology_mgr_set_mst(struct drm_dp_mst_topology_mgr *mgr,
> > bool mst_state)
> > {
> > int ret = 0;
> > - u8 dpcd_ext = 0;
> > - unsigned int dpcd_offset = 0;
> > struct drm_dp_mst_branch *mstb = NULL;
> >
> > mutex_lock(&mgr->payload_lock);
> > @@ -3686,17 +3684,11 @@ int drm_dp_mst_topology_mgr_set_mst(struct
> > drm_dp_mst_topology_mgr *mgr, bool ms
> > struct drm_dp_payload reset_pay;
> >
> > WARN_ON(mgr->mst_primary);
> > - drm_dp_dpcd_read(mgr->aux,
> > - DP_TRAINING_AUX_RD_INTERVAL,
> > - &dpcd_ext, sizeof(dpcd_ext));
> > -
> > - dpcd_offset =
> > - ((dpcd_ext & DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT)
> > ? DP_DP13_DPCD_REV : DP_DPCD_REV);
>
>
> Uh, are you sure you formatted this patch correctly? None of these hunks are present upstream, this looks like it's a diff for the previous version of this patch that you sent out
> >
> > /* get dpcd info */
> > - ret = drm_dp_dpcd_read(mgr->aux, dpcd_offset, mgr->dpcd,
> > DP_RECEIVER_CAP_SIZE);
> > - if (ret != DP_RECEIVER_CAP_SIZE) {
> > - DRM_DEBUG_KMS("failed to read DPCD\n");
> > + ret = drm_dp_read_dpcd_caps(mgr->aux, mgr->dpcd);
> > + if (ret < 0) {
> > + drm_dbg_kms(mgr->dev, "failed to read DPCD, ret %d\n",
> > ret);
> > goto out_unlock;
> > }
> >
> --
> Cheers,
> Lyude Paul (she/her)
> Software Engineer at Red Hat
>