diff mbox

[2/2] drm/dp: Make sink count DP 1.2 aware

Message ID 1348173765-28444-2-git-send-email-ajax@redhat.com (mailing list archive)
State New, archived
Headers show

Commit Message

Adam Jackson Sept. 20, 2012, 8:42 p.m. UTC
Signed-off-by: Adam Jackson <ajax@redhat.com>
---
 drivers/gpu/drm/i915/intel_dp.c |    9 ++++-----
 include/drm/drm_dp_helper.h     |    3 ++-
 2 files changed, 6 insertions(+), 6 deletions(-)

Comments

Paulo Zanoni Sept. 20, 2012, 9:45 p.m. UTC | #1
2012/9/20 Adam Jackson <ajax@redhat.com>:
> Signed-off-by: Adam Jackson <ajax@redhat.com>

Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

> ---
>  drivers/gpu/drm/i915/intel_dp.c |    9 ++++-----
>  include/drm/drm_dp_helper.h     |    3 ++-
>  2 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> index 813b771..00f99e5 100644
> --- a/drivers/gpu/drm/i915/intel_dp.c
> +++ b/drivers/gpu/drm/i915/intel_dp.c
> @@ -2106,13 +2106,12 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
>         /* If we're HPD-aware, SINK_COUNT changes dynamically */
>         hpd = !!(intel_dp->downstream_ports[0] & DP_DS_PORT_HPD);
>         if (hpd) {
> -               uint8_t sink_count;
> +               uint8_t reg;
>                 if (!intel_dp_aux_native_read_retry(intel_dp, DP_SINK_COUNT,
> -                                                   &sink_count, 1))
> +                                                   &reg, 1))
>                         return connector_status_unknown;
> -               sink_count &= DP_SINK_COUNT_MASK;
> -               return sink_count ? connector_status_connected
> -                                 : connector_status_disconnected;
> +               return DP_GET_SINK_COUNT(reg) ? connector_status_connected
> +                                             : connector_status_disconnected;
>         }
>
>         /* If no HPD, poke DDC gently */
> diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> index 38ffcb4..fe06148 100644
> --- a/include/drm/drm_dp_helper.h
> +++ b/include/drm/drm_dp_helper.h
> @@ -221,7 +221,8 @@
>  # define DP_PSR_FRAME_CAPTURE              (1 << 3)
>
>  #define DP_SINK_COUNT                      0x200
> -# define DP_SINK_COUNT_MASK                (31 << 0)
> +/* prior to 1.2 bit 7 was reserved mbz */
> +# define DP_GET_SINK_COUNT(x)              ((((x) & 0x80) >> 1) | ((x) & 0x3f))
>  # define DP_SINK_CP_READY                  (1 << 6)
>
>  #define DP_DEVICE_SERVICE_IRQ_VECTOR       0x201
> --
> 1.7.7.6
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter Sept. 26, 2012, 12:43 p.m. UTC | #2
On Thu, Sep 20, 2012 at 06:45:29PM -0300, Paulo Zanoni wrote:
> 2012/9/20 Adam Jackson <ajax@redhat.com>:
> > Signed-off-by: Adam Jackson <ajax@redhat.com>
> 
> Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com>

Both patches merged to dinq (again with Dave's irc-ack for the common
stuff).

Thanks, Daniel
> 
> > ---
> >  drivers/gpu/drm/i915/intel_dp.c |    9 ++++-----
> >  include/drm/drm_dp_helper.h     |    3 ++-
> >  2 files changed, 6 insertions(+), 6 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
> > index 813b771..00f99e5 100644
> > --- a/drivers/gpu/drm/i915/intel_dp.c
> > +++ b/drivers/gpu/drm/i915/intel_dp.c
> > @@ -2106,13 +2106,12 @@ intel_dp_detect_dpcd(struct intel_dp *intel_dp)
> >         /* If we're HPD-aware, SINK_COUNT changes dynamically */
> >         hpd = !!(intel_dp->downstream_ports[0] & DP_DS_PORT_HPD);
> >         if (hpd) {
> > -               uint8_t sink_count;
> > +               uint8_t reg;
> >                 if (!intel_dp_aux_native_read_retry(intel_dp, DP_SINK_COUNT,
> > -                                                   &sink_count, 1))
> > +                                                   &reg, 1))
> >                         return connector_status_unknown;
> > -               sink_count &= DP_SINK_COUNT_MASK;
> > -               return sink_count ? connector_status_connected
> > -                                 : connector_status_disconnected;
> > +               return DP_GET_SINK_COUNT(reg) ? connector_status_connected
> > +                                             : connector_status_disconnected;
> >         }
> >
> >         /* If no HPD, poke DDC gently */
> > diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
> > index 38ffcb4..fe06148 100644
> > --- a/include/drm/drm_dp_helper.h
> > +++ b/include/drm/drm_dp_helper.h
> > @@ -221,7 +221,8 @@
> >  # define DP_PSR_FRAME_CAPTURE              (1 << 3)
> >
> >  #define DP_SINK_COUNT                      0x200
> > -# define DP_SINK_COUNT_MASK                (31 << 0)
> > +/* prior to 1.2 bit 7 was reserved mbz */
> > +# define DP_GET_SINK_COUNT(x)              ((((x) & 0x80) >> 1) | ((x) & 0x3f))
> >  # define DP_SINK_CP_READY                  (1 << 6)
> >
> >  #define DP_DEVICE_SERVICE_IRQ_VECTOR       0x201
> > --
> > 1.7.7.6
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > http://lists.freedesktop.org/mailman/listinfo/dri-devel
> 
> 
> 
> -- 
> Paulo Zanoni
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 813b771..00f99e5 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2106,13 +2106,12 @@  intel_dp_detect_dpcd(struct intel_dp *intel_dp)
 	/* If we're HPD-aware, SINK_COUNT changes dynamically */
 	hpd = !!(intel_dp->downstream_ports[0] & DP_DS_PORT_HPD);
 	if (hpd) {
-		uint8_t sink_count;
+		uint8_t reg;
 		if (!intel_dp_aux_native_read_retry(intel_dp, DP_SINK_COUNT,
-						    &sink_count, 1))
+						    &reg, 1))
 			return connector_status_unknown;
-		sink_count &= DP_SINK_COUNT_MASK;
-		return sink_count ? connector_status_connected
-				  : connector_status_disconnected;
+		return DP_GET_SINK_COUNT(reg) ? connector_status_connected
+					      : connector_status_disconnected;
 	}
 
 	/* If no HPD, poke DDC gently */
diff --git a/include/drm/drm_dp_helper.h b/include/drm/drm_dp_helper.h
index 38ffcb4..fe06148 100644
--- a/include/drm/drm_dp_helper.h
+++ b/include/drm/drm_dp_helper.h
@@ -221,7 +221,8 @@ 
 # define DP_PSR_FRAME_CAPTURE		    (1 << 3)
 
 #define DP_SINK_COUNT			    0x200
-# define DP_SINK_COUNT_MASK		    (31 << 0)
+/* prior to 1.2 bit 7 was reserved mbz */
+# define DP_GET_SINK_COUNT(x)		    ((((x) & 0x80) >> 1) | ((x) & 0x3f))
 # define DP_SINK_CP_READY		    (1 << 6)
 
 #define DP_DEVICE_SERVICE_IRQ_VECTOR	    0x201