[PATCH] drm/radeon/kms: fix shared ddc harder

2010-07-25 Thread Pasi Kärkkäinen
On Thu, Jul 22, 2010 at 03:28:32PM +0300, Pasi K?rkk?inen wrote:
> On Tue, Jul 20, 2010 at 11:27:54AM -0400, Alex Deucher wrote:
> > This fixes a regression caused by b2ea4aa67bfd084834edd070e0a4a47857d6db59
> > due to the way shared ddc with multiple digital connectors was handled.
> > 
> 
> I guess I should verify this patch still works for me..
> 

I applied this patch, and everything still seems to work ok :)

-- Pasi

> 
> > You generally have two cases where DDC lines are shared:
> > - HDMI + VGA
> > - HDMI + DVI-D
> > 
> > HDMI + VGA is easy to deal with because you can check the EDID for the
> > to see if the attached monitor is digital.  A shared DDC line with two
> > digital connectors is more complex.  You can't use the hdmi bits in the
> > EDID since they may not be there with DVI<->HDMI adapters.  In this case
> > all we can do is check the HPD pins to see which is connected as we have
> > no way of knowing using the EDID.
> > 
> > Reported-by: trapdoor6 at gmail.com
> > Signed-off-by: Alex Deucher 
> > Cc: stable at kernel.org
> > ---
> >  drivers/gpu/drm/radeon/radeon_connectors.c |   23 +--
> >  1 files changed, 9 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
> > b/drivers/gpu/drm/radeon/radeon_connectors.c
> > index f58f8bd..adccbc2 100644
> > --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> > +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> > @@ -771,14 +771,14 @@ static enum drm_connector_status 
> > radeon_dvi_detect(struct drm_connector *connect
> > } else
> > ret = connector_status_connected;
> >  
> > -   /* multiple connectors on the same encoder with the 
> > same ddc line
> > -* This tends to be HDMI and DVI on the same encoder 
> > with the
> > -* same ddc line.  If the edid says HDMI, consider the 
> > HDMI port
> > -* connected and the DVI port disconnected.  If the 
> > edid doesn't
> > -* say HDMI, vice versa.
> > +   /* This gets complicated.  We have boards with VGA + 
> > HDMI with a
> > +* shared DDC line and we have boards with DVI-D + HDMI 
> > with a shared
> > +* DDC line.  The latter is more complex because with 
> > DVI<->HDMI adapters
> > +* you don't really know what's connected to which port 
> > as both are digital.
> >  */
> > if (radeon_connector->shared_ddc && (ret == 
> > connector_status_connected)) {
> > struct drm_device *dev = connector->dev;
> > +   struct radeon_device *rdev = dev->dev_private;
> > struct drm_connector *list_connector;
> > struct radeon_connector *list_radeon_connector;
> > list_for_each_entry(list_connector, 
> > &dev->mode_config.connector_list, head) {
> > @@ -788,15 +788,10 @@ static enum drm_connector_status 
> > radeon_dvi_detect(struct drm_connector *connect
> > if (list_radeon_connector->shared_ddc &&
> > 
> > (list_radeon_connector->ddc_bus->rec.i2c_id ==
> >  
> > radeon_connector->ddc_bus->rec.i2c_id)) {
> > -   if 
> > (drm_detect_hdmi_monitor(radeon_connector->edid)) {
> > -   if 
> > (connector->connector_type == DRM_MODE_CONNECTOR_DVID) {
> > -   
> > kfree(radeon_connector->edid);
> > -   
> > radeon_connector->edid = NULL;
> > -   ret = 
> > connector_status_disconnected;
> > -   }
> > -   } else {
> > -   if 
> > ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
> > -   
> > (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
> > +   /* cases where both connectors 
> > are digital */
> > +   if 
> > (list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
> > +   /* hpd is our only 
> > option in this case */
> > +   if 
> > (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
> > 
> > kfree(radeon_connector->edid);
> > 
> > radeon_connector->edid = NULL;
> >

[PATCH] drm/radeon/kms: fix shared ddc harder

2010-07-25 Thread Alex Deucher
On Sun, Jul 25, 2010 at 11:05 AM, Pasi K?rkk?inen  wrote:
> On Thu, Jul 22, 2010 at 03:28:32PM +0300, Pasi K?rkk?inen wrote:
>> On Tue, Jul 20, 2010 at 11:27:54AM -0400, Alex Deucher wrote:
>> > This fixes a regression caused by b2ea4aa67bfd084834edd070e0a4a47857d6db59
>> > due to the way shared ddc with multiple digital connectors was handled.
>> >
>>
>> I guess I should verify this patch still works for me..
>>
>
> I applied this patch, and everything still seems to work ok :)

Excellent!

>
> -- Pasi
>
>>
>> > You generally have two cases where DDC lines are shared:
>> > - HDMI + VGA
>> > - HDMI + DVI-D
>> >
>> > HDMI + VGA is easy to deal with because you can check the EDID for the
>> > to see if the attached monitor is digital. ?A shared DDC line with two
>> > digital connectors is more complex. ?You can't use the hdmi bits in the
>> > EDID since they may not be there with DVI<->HDMI adapters. ?In this case
>> > all we can do is check the HPD pins to see which is connected as we have
>> > no way of knowing using the EDID.
>> >
>> > Reported-by: trapdoor6 at gmail.com
>> > Signed-off-by: Alex Deucher 
>> > Cc: stable at kernel.org
>> > ---
>> > ?drivers/gpu/drm/radeon/radeon_connectors.c | ? 23 +--
>> > ?1 files changed, 9 insertions(+), 14 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
>> > b/drivers/gpu/drm/radeon/radeon_connectors.c
>> > index f58f8bd..adccbc2 100644
>> > --- a/drivers/gpu/drm/radeon/radeon_connectors.c
>> > +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
>> > @@ -771,14 +771,14 @@ static enum drm_connector_status 
>> > radeon_dvi_detect(struct drm_connector *connect
>> > ? ? ? ? ? ? ? ? ? ? } else
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ret = connector_status_connected;
>> >
>> > - ? ? ? ? ? ? ? ? ? /* multiple connectors on the same encoder with the 
>> > same ddc line
>> > - ? ? ? ? ? ? ? ? ? ?* This tends to be HDMI and DVI on the same encoder 
>> > with the
>> > - ? ? ? ? ? ? ? ? ? ?* same ddc line. ?If the edid says HDMI, consider the 
>> > HDMI port
>> > - ? ? ? ? ? ? ? ? ? ?* connected and the DVI port disconnected. ?If the 
>> > edid doesn't
>> > - ? ? ? ? ? ? ? ? ? ?* say HDMI, vice versa.
>> > + ? ? ? ? ? ? ? ? ? /* This gets complicated. ?We have boards with VGA + 
>> > HDMI with a
>> > + ? ? ? ? ? ? ? ? ? ?* shared DDC line and we have boards with DVI-D + 
>> > HDMI with a shared
>> > + ? ? ? ? ? ? ? ? ? ?* DDC line. ?The latter is more complex because with 
>> > DVI<->HDMI adapters
>> > + ? ? ? ? ? ? ? ? ? ?* you don't really know what's connected to which 
>> > port as both are digital.
>> > ? ? ? ? ? ? ? ? ? ? ?*/
>> > ? ? ? ? ? ? ? ? ? ? if (radeon_connector->shared_ddc && (ret == 
>> > connector_status_connected)) {
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct drm_device *dev = connector->dev;
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? struct radeon_device *rdev = dev->dev_private;
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct drm_connector *list_connector;
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? struct radeon_connector *list_radeon_connector;
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? list_for_each_entry(list_connector, 
>> > &dev->mode_config.connector_list, head) {
>> > @@ -788,15 +788,10 @@ static enum drm_connector_status 
>> > radeon_dvi_detect(struct drm_connector *connect
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if (list_radeon_connector->shared_ddc 
>> > &&
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 
>> > (list_radeon_connector->ddc_bus->rec.i2c_id ==
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 
>> > ?radeon_connector->ddc_bus->rec.i2c_id)) {
>> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if 
>> > (drm_detect_hdmi_monitor(radeon_connector->edid)) {
>> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if 
>> > (connector->connector_type == DRM_MODE_CONNECTOR_DVID) {
>> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 
>> > kfree(radeon_connector->edid);
>> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 
>> > radeon_connector->edid = NULL;
>> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ret = 
>> > connector_status_disconnected;
>> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }
>> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? } else {
>> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if 
>> > ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
>> > - ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 
>> > (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* cases where both connectors 
>> > are digital */
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if 
>> > (list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? /* hpd is our only 
>> > option in this case */
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? if 
>> > (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
>> > ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? 
>> 

Re: [PATCH] drm/radeon/kms: fix shared ddc harder

2010-07-25 Thread Alex Deucher
On Sun, Jul 25, 2010 at 11:05 AM, Pasi Kärkkäinen  wrote:
> On Thu, Jul 22, 2010 at 03:28:32PM +0300, Pasi Kärkkäinen wrote:
>> On Tue, Jul 20, 2010 at 11:27:54AM -0400, Alex Deucher wrote:
>> > This fixes a regression caused by b2ea4aa67bfd084834edd070e0a4a47857d6db59
>> > due to the way shared ddc with multiple digital connectors was handled.
>> >
>>
>> I guess I should verify this patch still works for me..
>>
>
> I applied this patch, and everything still seems to work ok :)

Excellent!

>
> -- Pasi
>
>>
>> > You generally have two cases where DDC lines are shared:
>> > - HDMI + VGA
>> > - HDMI + DVI-D
>> >
>> > HDMI + VGA is easy to deal with because you can check the EDID for the
>> > to see if the attached monitor is digital.  A shared DDC line with two
>> > digital connectors is more complex.  You can't use the hdmi bits in the
>> > EDID since they may not be there with DVI<->HDMI adapters.  In this case
>> > all we can do is check the HPD pins to see which is connected as we have
>> > no way of knowing using the EDID.
>> >
>> > Reported-by: trapdo...@gmail.com
>> > Signed-off-by: Alex Deucher 
>> > Cc: sta...@kernel.org
>> > ---
>> >  drivers/gpu/drm/radeon/radeon_connectors.c |   23 +--
>> >  1 files changed, 9 insertions(+), 14 deletions(-)
>> >
>> > diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
>> > b/drivers/gpu/drm/radeon/radeon_connectors.c
>> > index f58f8bd..adccbc2 100644
>> > --- a/drivers/gpu/drm/radeon/radeon_connectors.c
>> > +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
>> > @@ -771,14 +771,14 @@ static enum drm_connector_status 
>> > radeon_dvi_detect(struct drm_connector *connect
>> >                     } else
>> >                             ret = connector_status_connected;
>> >
>> > -                   /* multiple connectors on the same encoder with the 
>> > same ddc line
>> > -                    * This tends to be HDMI and DVI on the same encoder 
>> > with the
>> > -                    * same ddc line.  If the edid says HDMI, consider the 
>> > HDMI port
>> > -                    * connected and the DVI port disconnected.  If the 
>> > edid doesn't
>> > -                    * say HDMI, vice versa.
>> > +                   /* This gets complicated.  We have boards with VGA + 
>> > HDMI with a
>> > +                    * shared DDC line and we have boards with DVI-D + 
>> > HDMI with a shared
>> > +                    * DDC line.  The latter is more complex because with 
>> > DVI<->HDMI adapters
>> > +                    * you don't really know what's connected to which 
>> > port as both are digital.
>> >                      */
>> >                     if (radeon_connector->shared_ddc && (ret == 
>> > connector_status_connected)) {
>> >                             struct drm_device *dev = connector->dev;
>> > +                           struct radeon_device *rdev = dev->dev_private;
>> >                             struct drm_connector *list_connector;
>> >                             struct radeon_connector *list_radeon_connector;
>> >                             list_for_each_entry(list_connector, 
>> > &dev->mode_config.connector_list, head) {
>> > @@ -788,15 +788,10 @@ static enum drm_connector_status 
>> > radeon_dvi_detect(struct drm_connector *connect
>> >                                     if (list_radeon_connector->shared_ddc 
>> > &&
>> >                                         
>> > (list_radeon_connector->ddc_bus->rec.i2c_id ==
>> >                                          
>> > radeon_connector->ddc_bus->rec.i2c_id)) {
>> > -                                           if 
>> > (drm_detect_hdmi_monitor(radeon_connector->edid)) {
>> > -                                                   if 
>> > (connector->connector_type == DRM_MODE_CONNECTOR_DVID) {
>> > -                                                           
>> > kfree(radeon_connector->edid);
>> > -                                                           
>> > radeon_connector->edid = NULL;
>> > -                                                           ret = 
>> > connector_status_disconnected;
>> > -                                                   }
>> > -                                           } else {
>> > -                                                   if 
>> > ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
>> > -                                                       
>> > (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
>> > +                                           /* cases where both connectors 
>> > are digital */
>> > +                                           if 
>> > (list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
>> > +                                                   /* hpd is our only 
>> > option in this case */
>> > +                                                   if 
>> > (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
>> >                                                             
>> > kfre

Re: [PATCH] drm/radeon/kms: fix shared ddc harder

2010-07-25 Thread Pasi Kärkkäinen
On Thu, Jul 22, 2010 at 03:28:32PM +0300, Pasi Kärkkäinen wrote:
> On Tue, Jul 20, 2010 at 11:27:54AM -0400, Alex Deucher wrote:
> > This fixes a regression caused by b2ea4aa67bfd084834edd070e0a4a47857d6db59
> > due to the way shared ddc with multiple digital connectors was handled.
> > 
> 
> I guess I should verify this patch still works for me..
> 

I applied this patch, and everything still seems to work ok :)

-- Pasi

> 
> > You generally have two cases where DDC lines are shared:
> > - HDMI + VGA
> > - HDMI + DVI-D
> > 
> > HDMI + VGA is easy to deal with because you can check the EDID for the
> > to see if the attached monitor is digital.  A shared DDC line with two
> > digital connectors is more complex.  You can't use the hdmi bits in the
> > EDID since they may not be there with DVI<->HDMI adapters.  In this case
> > all we can do is check the HPD pins to see which is connected as we have
> > no way of knowing using the EDID.
> > 
> > Reported-by: trapdo...@gmail.com
> > Signed-off-by: Alex Deucher 
> > Cc: sta...@kernel.org
> > ---
> >  drivers/gpu/drm/radeon/radeon_connectors.c |   23 +--
> >  1 files changed, 9 insertions(+), 14 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
> > b/drivers/gpu/drm/radeon/radeon_connectors.c
> > index f58f8bd..adccbc2 100644
> > --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> > +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> > @@ -771,14 +771,14 @@ static enum drm_connector_status 
> > radeon_dvi_detect(struct drm_connector *connect
> > } else
> > ret = connector_status_connected;
> >  
> > -   /* multiple connectors on the same encoder with the 
> > same ddc line
> > -* This tends to be HDMI and DVI on the same encoder 
> > with the
> > -* same ddc line.  If the edid says HDMI, consider the 
> > HDMI port
> > -* connected and the DVI port disconnected.  If the 
> > edid doesn't
> > -* say HDMI, vice versa.
> > +   /* This gets complicated.  We have boards with VGA + 
> > HDMI with a
> > +* shared DDC line and we have boards with DVI-D + HDMI 
> > with a shared
> > +* DDC line.  The latter is more complex because with 
> > DVI<->HDMI adapters
> > +* you don't really know what's connected to which port 
> > as both are digital.
> >  */
> > if (radeon_connector->shared_ddc && (ret == 
> > connector_status_connected)) {
> > struct drm_device *dev = connector->dev;
> > +   struct radeon_device *rdev = dev->dev_private;
> > struct drm_connector *list_connector;
> > struct radeon_connector *list_radeon_connector;
> > list_for_each_entry(list_connector, 
> > &dev->mode_config.connector_list, head) {
> > @@ -788,15 +788,10 @@ static enum drm_connector_status 
> > radeon_dvi_detect(struct drm_connector *connect
> > if (list_radeon_connector->shared_ddc &&
> > 
> > (list_radeon_connector->ddc_bus->rec.i2c_id ==
> >  
> > radeon_connector->ddc_bus->rec.i2c_id)) {
> > -   if 
> > (drm_detect_hdmi_monitor(radeon_connector->edid)) {
> > -   if 
> > (connector->connector_type == DRM_MODE_CONNECTOR_DVID) {
> > -   
> > kfree(radeon_connector->edid);
> > -   
> > radeon_connector->edid = NULL;
> > -   ret = 
> > connector_status_disconnected;
> > -   }
> > -   } else {
> > -   if 
> > ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
> > -   
> > (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
> > +   /* cases where both connectors 
> > are digital */
> > +   if 
> > (list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
> > +   /* hpd is our only 
> > option in this case */
> > +   if 
> > (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
> > 
> > kfree(radeon_connector->edid);
> > 
> > radeon_connector->edid = NULL;
> >  

[PATCH] drm/radeon/kms: fix shared ddc harder

2010-07-22 Thread Pasi Kärkkäinen
On Tue, Jul 20, 2010 at 11:27:54AM -0400, Alex Deucher wrote:
> This fixes a regression caused by b2ea4aa67bfd084834edd070e0a4a47857d6db59
> due to the way shared ddc with multiple digital connectors was handled.
> 

I guess I should verify this patch still works for me..

-- Pasi

> You generally have two cases where DDC lines are shared:
> - HDMI + VGA
> - HDMI + DVI-D
> 
> HDMI + VGA is easy to deal with because you can check the EDID for the
> to see if the attached monitor is digital.  A shared DDC line with two
> digital connectors is more complex.  You can't use the hdmi bits in the
> EDID since they may not be there with DVI<->HDMI adapters.  In this case
> all we can do is check the HPD pins to see which is connected as we have
> no way of knowing using the EDID.
> 
> Reported-by: trapdoor6 at gmail.com
> Signed-off-by: Alex Deucher 
> Cc: stable at kernel.org
> ---
>  drivers/gpu/drm/radeon/radeon_connectors.c |   23 +--
>  1 files changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
> b/drivers/gpu/drm/radeon/radeon_connectors.c
> index f58f8bd..adccbc2 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -771,14 +771,14 @@ static enum drm_connector_status 
> radeon_dvi_detect(struct drm_connector *connect
>   } else
>   ret = connector_status_connected;
>  
> - /* multiple connectors on the same encoder with the 
> same ddc line
> -  * This tends to be HDMI and DVI on the same encoder 
> with the
> -  * same ddc line.  If the edid says HDMI, consider the 
> HDMI port
> -  * connected and the DVI port disconnected.  If the 
> edid doesn't
> -  * say HDMI, vice versa.
> + /* This gets complicated.  We have boards with VGA + 
> HDMI with a
> +  * shared DDC line and we have boards with DVI-D + HDMI 
> with a shared
> +  * DDC line.  The latter is more complex because with 
> DVI<->HDMI adapters
> +  * you don't really know what's connected to which port 
> as both are digital.
>*/
>   if (radeon_connector->shared_ddc && (ret == 
> connector_status_connected)) {
>   struct drm_device *dev = connector->dev;
> + struct radeon_device *rdev = dev->dev_private;
>   struct drm_connector *list_connector;
>   struct radeon_connector *list_radeon_connector;
>   list_for_each_entry(list_connector, 
> &dev->mode_config.connector_list, head) {
> @@ -788,15 +788,10 @@ static enum drm_connector_status 
> radeon_dvi_detect(struct drm_connector *connect
>   if (list_radeon_connector->shared_ddc &&
>   
> (list_radeon_connector->ddc_bus->rec.i2c_id ==
>
> radeon_connector->ddc_bus->rec.i2c_id)) {
> - if 
> (drm_detect_hdmi_monitor(radeon_connector->edid)) {
> - if 
> (connector->connector_type == DRM_MODE_CONNECTOR_DVID) {
> - 
> kfree(radeon_connector->edid);
> - 
> radeon_connector->edid = NULL;
> - ret = 
> connector_status_disconnected;
> - }
> - } else {
> - if 
> ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
> - 
> (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
> + /* cases where both connectors 
> are digital */
> + if 
> (list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
> + /* hpd is our only 
> option in this case */
> + if 
> (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
>   
> kfree(radeon_connector->edid);
>   
> radeon_connector->edid = NULL;
>   ret = 
> connector_status_disconnected;
> -- 
> 1.7.1.1
> 
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

Re: [PATCH] drm/radeon/kms: fix shared ddc harder

2010-07-22 Thread Pasi Kärkkäinen
On Tue, Jul 20, 2010 at 11:27:54AM -0400, Alex Deucher wrote:
> This fixes a regression caused by b2ea4aa67bfd084834edd070e0a4a47857d6db59
> due to the way shared ddc with multiple digital connectors was handled.
> 

I guess I should verify this patch still works for me..

-- Pasi

> You generally have two cases where DDC lines are shared:
> - HDMI + VGA
> - HDMI + DVI-D
> 
> HDMI + VGA is easy to deal with because you can check the EDID for the
> to see if the attached monitor is digital.  A shared DDC line with two
> digital connectors is more complex.  You can't use the hdmi bits in the
> EDID since they may not be there with DVI<->HDMI adapters.  In this case
> all we can do is check the HPD pins to see which is connected as we have
> no way of knowing using the EDID.
> 
> Reported-by: trapdo...@gmail.com
> Signed-off-by: Alex Deucher 
> Cc: sta...@kernel.org
> ---
>  drivers/gpu/drm/radeon/radeon_connectors.c |   23 +--
>  1 files changed, 9 insertions(+), 14 deletions(-)
> 
> diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
> b/drivers/gpu/drm/radeon/radeon_connectors.c
> index f58f8bd..adccbc2 100644
> --- a/drivers/gpu/drm/radeon/radeon_connectors.c
> +++ b/drivers/gpu/drm/radeon/radeon_connectors.c
> @@ -771,14 +771,14 @@ static enum drm_connector_status 
> radeon_dvi_detect(struct drm_connector *connect
>   } else
>   ret = connector_status_connected;
>  
> - /* multiple connectors on the same encoder with the 
> same ddc line
> -  * This tends to be HDMI and DVI on the same encoder 
> with the
> -  * same ddc line.  If the edid says HDMI, consider the 
> HDMI port
> -  * connected and the DVI port disconnected.  If the 
> edid doesn't
> -  * say HDMI, vice versa.
> + /* This gets complicated.  We have boards with VGA + 
> HDMI with a
> +  * shared DDC line and we have boards with DVI-D + HDMI 
> with a shared
> +  * DDC line.  The latter is more complex because with 
> DVI<->HDMI adapters
> +  * you don't really know what's connected to which port 
> as both are digital.
>*/
>   if (radeon_connector->shared_ddc && (ret == 
> connector_status_connected)) {
>   struct drm_device *dev = connector->dev;
> + struct radeon_device *rdev = dev->dev_private;
>   struct drm_connector *list_connector;
>   struct radeon_connector *list_radeon_connector;
>   list_for_each_entry(list_connector, 
> &dev->mode_config.connector_list, head) {
> @@ -788,15 +788,10 @@ static enum drm_connector_status 
> radeon_dvi_detect(struct drm_connector *connect
>   if (list_radeon_connector->shared_ddc &&
>   
> (list_radeon_connector->ddc_bus->rec.i2c_id ==
>
> radeon_connector->ddc_bus->rec.i2c_id)) {
> - if 
> (drm_detect_hdmi_monitor(radeon_connector->edid)) {
> - if 
> (connector->connector_type == DRM_MODE_CONNECTOR_DVID) {
> - 
> kfree(radeon_connector->edid);
> - 
> radeon_connector->edid = NULL;
> - ret = 
> connector_status_disconnected;
> - }
> - } else {
> - if 
> ((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
> - 
> (connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
> + /* cases where both connectors 
> are digital */
> + if 
> (list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
> + /* hpd is our only 
> option in this case */
> + if 
> (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
>   
> kfree(radeon_connector->edid);
>   
> radeon_connector->edid = NULL;
>   ret = 
> connector_status_disconnected;
> -- 
> 1.7.1.1
> 
> ___
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

[PATCH] drm/radeon/kms: fix shared ddc harder

2010-07-20 Thread Alex Deucher
This fixes a regression caused by b2ea4aa67bfd084834edd070e0a4a47857d6db59
due to the way shared ddc with multiple digital connectors was handled.

You generally have two cases where DDC lines are shared:
- HDMI + VGA
- HDMI + DVI-D

HDMI + VGA is easy to deal with because you can check the EDID for the
to see if the attached monitor is digital.  A shared DDC line with two
digital connectors is more complex.  You can't use the hdmi bits in the
EDID since they may not be there with DVI<->HDMI adapters.  In this case
all we can do is check the HPD pins to see which is connected as we have
no way of knowing using the EDID.

Reported-by: trapdoor6 at gmail.com
Signed-off-by: Alex Deucher 
Cc: stable at kernel.org
---
 drivers/gpu/drm/radeon/radeon_connectors.c |   23 +--
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index f58f8bd..adccbc2 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -771,14 +771,14 @@ static enum drm_connector_status radeon_dvi_detect(struct 
drm_connector *connect
} else
ret = connector_status_connected;

-   /* multiple connectors on the same encoder with the 
same ddc line
-* This tends to be HDMI and DVI on the same encoder 
with the
-* same ddc line.  If the edid says HDMI, consider the 
HDMI port
-* connected and the DVI port disconnected.  If the 
edid doesn't
-* say HDMI, vice versa.
+   /* This gets complicated.  We have boards with VGA + 
HDMI with a
+* shared DDC line and we have boards with DVI-D + HDMI 
with a shared
+* DDC line.  The latter is more complex because with 
DVI<->HDMI adapters
+* you don't really know what's connected to which port 
as both are digital.
 */
if (radeon_connector->shared_ddc && (ret == 
connector_status_connected)) {
struct drm_device *dev = connector->dev;
+   struct radeon_device *rdev = dev->dev_private;
struct drm_connector *list_connector;
struct radeon_connector *list_radeon_connector;
list_for_each_entry(list_connector, 
&dev->mode_config.connector_list, head) {
@@ -788,15 +788,10 @@ static enum drm_connector_status radeon_dvi_detect(struct 
drm_connector *connect
if (list_radeon_connector->shared_ddc &&

(list_radeon_connector->ddc_bus->rec.i2c_id ==
 
radeon_connector->ddc_bus->rec.i2c_id)) {
-   if 
(drm_detect_hdmi_monitor(radeon_connector->edid)) {
-   if 
(connector->connector_type == DRM_MODE_CONNECTOR_DVID) {
-   
kfree(radeon_connector->edid);
-   
radeon_connector->edid = NULL;
-   ret = 
connector_status_disconnected;
-   }
-   } else {
-   if 
((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
-   
(connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
+   /* cases where both connectors 
are digital */
+   if 
(list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
+   /* hpd is our only 
option in this case */
+   if 
(!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {

kfree(radeon_connector->edid);

radeon_connector->edid = NULL;
ret = 
connector_status_disconnected;
-- 
1.7.1.1



[PATCH] drm/radeon/kms: fix shared ddc harder

2010-07-20 Thread Alex Deucher
This fixes a regression caused by b2ea4aa67bfd084834edd070e0a4a47857d6db59
due to the way shared ddc with multiple digital connectors was handled.

You generally have two cases where DDC lines are shared:
- HDMI + VGA
- HDMI + DVI-D

HDMI + VGA is easy to deal with because you can check the EDID for the
to see if the attached monitor is digital.  A shared DDC line with two
digital connectors is more complex.  You can't use the hdmi bits in the
EDID since they may not be there with DVI<->HDMI adapters.  In this case
all we can do is check the HPD pins to see which is connected as we have
no way of knowing using the EDID.

Reported-by: trapdo...@gmail.com
Signed-off-by: Alex Deucher 
Cc: sta...@kernel.org
---
 drivers/gpu/drm/radeon/radeon_connectors.c |   23 +--
 1 files changed, 9 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index f58f8bd..adccbc2 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -771,14 +771,14 @@ static enum drm_connector_status radeon_dvi_detect(struct 
drm_connector *connect
} else
ret = connector_status_connected;
 
-   /* multiple connectors on the same encoder with the 
same ddc line
-* This tends to be HDMI and DVI on the same encoder 
with the
-* same ddc line.  If the edid says HDMI, consider the 
HDMI port
-* connected and the DVI port disconnected.  If the 
edid doesn't
-* say HDMI, vice versa.
+   /* This gets complicated.  We have boards with VGA + 
HDMI with a
+* shared DDC line and we have boards with DVI-D + HDMI 
with a shared
+* DDC line.  The latter is more complex because with 
DVI<->HDMI adapters
+* you don't really know what's connected to which port 
as both are digital.
 */
if (radeon_connector->shared_ddc && (ret == 
connector_status_connected)) {
struct drm_device *dev = connector->dev;
+   struct radeon_device *rdev = dev->dev_private;
struct drm_connector *list_connector;
struct radeon_connector *list_radeon_connector;
list_for_each_entry(list_connector, 
&dev->mode_config.connector_list, head) {
@@ -788,15 +788,10 @@ static enum drm_connector_status radeon_dvi_detect(struct 
drm_connector *connect
if (list_radeon_connector->shared_ddc &&

(list_radeon_connector->ddc_bus->rec.i2c_id ==
 
radeon_connector->ddc_bus->rec.i2c_id)) {
-   if 
(drm_detect_hdmi_monitor(radeon_connector->edid)) {
-   if 
(connector->connector_type == DRM_MODE_CONNECTOR_DVID) {
-   
kfree(radeon_connector->edid);
-   
radeon_connector->edid = NULL;
-   ret = 
connector_status_disconnected;
-   }
-   } else {
-   if 
((connector->connector_type == DRM_MODE_CONNECTOR_HDMIA) ||
-   
(connector->connector_type == DRM_MODE_CONNECTOR_HDMIB)) {
+   /* cases where both connectors 
are digital */
+   if 
(list_connector->connector_type != DRM_MODE_CONNECTOR_VGA) {
+   /* hpd is our only 
option in this case */
+   if 
(!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {

kfree(radeon_connector->edid);

radeon_connector->edid = NULL;
ret = 
connector_status_disconnected;
-- 
1.7.1.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel