[PATCH 4/4] drm/radeon: Extended DDC Probing for ECS A740GM-M DVI-D Connector

2011-07-29 Thread reimth
From: Thomas Reim 

   ECS A740GM-M with ATI RADEON 2100 sends data to i2c bus
   for a DVI connector that is not implemented/existent on the board.

   Fix by applying extented DDC probing for this connector.

   Requires [PATCH] drm/radeon: Extended DDC Probing for Connectors
   with Improperly Wired DDC Lines

   Tested for kernel 2.6.38 on Asus ECS A740GM-M board

   BugLink: http://bugs.launchpad.net/bugs/810926

Cc: 
Signed-off-by: Thomas Reim 
Reviewed-by: Alex Deucher 
Acked-by: Stephen Michaels 
---
 drivers/gpu/drm/radeon/radeon_connectors.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index 2e70be2..82dacc6 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -449,6 +449,15 @@ static bool radeon_connector_needs_extended_probe(struct 
radeon_device *dev,
(supported_device == ATOM_DEVICE_DFP2_SUPPORT))
return true;
}
+   /* ECS A740GM-M with ATI RADEON 2100 sends data to i2c bus
+* for a DVI connector that is not implemented */
+   if ((dev->pdev->device == 0x796e) &&
+   (dev->pdev->subsystem_vendor == 0x1019) &&
+   (dev->pdev->subsystem_device == 0x2615)) {
+   if ((connector_type == DRM_MODE_CONNECTOR_DVID) &&
+   (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
+   return true;
+   }
 
/* Default: no EDID header probe required for DDC probing */
return false;
-- 
1.7.1

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


[PATCH 3/4] drm/radeon: Log Subsystem Vendor and Device Information

2011-07-29 Thread reimth
From: Thomas Reim 

Log PCI subsystem vendor and subsystem device ID in addition to
PCI vendor and device ID during kernel mode initialisation. This helps
to better identify radeon devices of third-party vendors, e. g. for
bug analysis.

Tested for kernel 2.6.35, 2.6.38 and 3.0 on Asus M2A-VM HDMI board

Cc: 
Signed-off-by: Thomas Reim 
Reviewed-by: Alex Deucher 
Acked-by: Stephen Michaels 
---
 drivers/gpu/drm/radeon/radeon_device.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c 
b/drivers/gpu/drm/radeon/radeon_device.c
index 7cfaa7e..440e6ec 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -704,8 +704,9 @@ int radeon_device_init(struct radeon_device *rdev,
rdev->gpu_lockup = false;
rdev->accel_working = false;
 
-   DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X).\n",
-   radeon_family_name[rdev->family], pdev->vendor, pdev->device);
+   DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X 
0x%04X:0x%04X).\n",
+   radeon_family_name[rdev->family], pdev->vendor, pdev->device,
+   pdev->subsystem_vendor, pdev->subsystem_device);
 
/* mutex initialization are all done here so we
 * can recall function without having locking issues */
-- 
1.7.1

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


[PATCH 2/4] drm/radeon: Extended DDC Probing for Connectors with Improperly Wired DDC Lines (here: Asus M2A-VM HDMI)

2011-07-29 Thread reimth
From: Thomas Reim 

Some integrated ATI Radeon chipset implementations with add-on HDMI card
(e. g. Asus M2A-VM HDMI) indicate the availability of a DDC even
when the add-on card is not plugged in or HDMI is disabled in BIOS setup.
In this case, drm_get_edid() and drm_edid_block_valid() periodically
dump data and kernel errors into system log files and onto terminals.
For these connectors DDC probing is extended by a check for a correct
EDID header. Only in case a valid EDID header is also found, the
(HDMI or DVI) connector will be used by the Radeon driver. This prevents
the kernel driver from useless flooding of logs and terminal sessions with
EDID dumps and error messages.
This patch adds a flag 'requires_extended_probe' to the radeon_connector
structure. In function radeon_connector_needs_extended_probe() this flag
can be set on a chipset family/vendor/connector type specific basis.
In addition, function radeon_ddc_probe() has been adapted to perform
extended DDC probing if required by the connector's flag.
Requires function drm_edid_header_is_valid() in DRM module provided by
[PATCH] drm: Separate EDID Header Check from EDID Block Check.

Tested for kernel 2.6.35, 2.6.38 and 3.0 on Asus M2A-VM HDMI board

BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=668196
BugLink: http://bugs.launchpad.net/bugs/7228066

Cc: 
Signed-off-by: Thomas Reim 
Reviewed-by: Alex Deucher 
Acked-by: Stephen Michaels 
---
 drivers/gpu/drm/radeon/radeon_connectors.c |   45 ++--
 drivers/gpu/drm/radeon/radeon_display.c|9 +
 drivers/gpu/drm/radeon/radeon_i2c.c|   32 +++-
 drivers/gpu/drm/radeon/radeon_mode.h   |6 +++-
 4 files changed, 80 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index cbfca3a..2e70be2 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -424,6 +424,36 @@ int radeon_connector_set_property(struct drm_connector 
*connector, struct drm_pr
return 0;
 }
 
+/*
+ * Some integrated ATI Radeon chipset implementations (e. g.
+ * Asus M2A-VM HDMI) may indicate the availability of a DDC,
+ * even when there's no monitor connected. For these connectors
+ * following DDC probe extension will be applied: check also for the
+ * availability of EDID with at least a correct EDID header. Only then,
+ * DDC is assumed to be available. This prevents drm_get_edid() and
+ * drm_edid_block_valid() from periodically dumping data and kernel
+ * errors into the logs and onto the terminal.
+ */
+static bool radeon_connector_needs_extended_probe(struct radeon_device *dev,
+uint32_t supported_device,
+int connector_type)
+{
+   /* Asus M2A-VM HDMI board sends data to i2c bus even,
+* if HDMI add-on card is not plugged in or HDMI is disabled in
+* BIOS. Valid DDC can only be assumed, if also a valid EDID header
+* can be retrieved via i2c bus during DDC probe */
+   if ((dev->pdev->device == 0x791e) &&
+   (dev->pdev->subsystem_vendor == 0x1043) &&
+   (dev->pdev->subsystem_device == 0x826d)) {
+   if ((connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
+   (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
+   return true;
+   }
+
+   /* Default: no EDID header probe required for DDC probing */
+   return false;
+}
+
 static void radeon_fixup_lvds_native_mode(struct drm_encoder *encoder,
  struct drm_connector *connector)
 {
@@ -655,7 +685,8 @@ radeon_vga_detect(struct drm_connector *connector, bool 
force)
ret = connector_status_disconnected;
 
if (radeon_connector->ddc_bus)
-   dret = radeon_ddc_probe(radeon_connector);
+   dret = radeon_ddc_probe(radeon_connector,
+   
radeon_connector->requires_extended_probe);
if (dret) {
if (radeon_connector->edid) {
kfree(radeon_connector->edid);
@@ -827,7 +858,8 @@ radeon_dvi_detect(struct drm_connector *connector, bool 
force)
bool dret = false;
 
if (radeon_connector->ddc_bus)
-   dret = radeon_ddc_probe(radeon_connector);
+   dret = radeon_ddc_probe(radeon_connector,
+   
radeon_connector->requires_extended_probe);
if (dret) {
if (radeon_connector->edid) {
kfree(radeon_connector->edid);
@@ -1245,7 +1277,8 @@ radeon_dp_detect(struct drm_connector *connector, bool 
force)
if (radeon_dp_getdpcd(radeon_connector))
ret = connector_status_connected;
 

[PATCH 0/4] drm/radeon: Extended DDC Probing for Connectors with Improperly Wired DDC Lines

2011-07-29 Thread reimth
From: Thomas Reim 

Dear Dave, 

Alex asked me to send you the updated set of proposed kernel patches for 
extended 
DDC probing in kernel radeon driver. The patch is based on Linux 3.0-rc7.

The patch code itself is exactly the same as in 
https://lkml.org/lkml/2011/7/6/443, 
I just have made slight updates to the patch titles and descriptions, based on 
the 
discussion on the kernel mailing list.

Best regards

Thomas

Am Dienstag, den 26.07.2011, 09:07 -0400 schrieb Alex Deucher:
On Mon, Jul 25, 2011 at 9:45 PM, Thomas Reim  wrote:
> > Dear Alex,
> >
> > haven't got any news on the extended DDC probing patches. Last week I
> > sent another patch that fixes a similar problem on an ECS board with ATI
> > RADEON 2100 chip.
> >
> > As there's no feedback from Dave, do you think it would make sense to
> > add this patch to the others and resend them in a bundle? This time with
> > correct Cc: sta...@kernel.org plus review and ack tags?
> >
> 
> Yes, go ahead and send the patches + acks to Dave.  You don't need to
> keep the huge cc list.  Just sent the patches to dri-devel and Dave.
> 
> Alex
> 
> > Best regards
> >
> > Thomas
> >
> 

Thomas Reim (4):
  drm: Separate EDID Header Check from EDID Block Check
  drm/radeon: Extended DDC Probing for Connectors with Improperly Wired
DDC Lines (here: Asus M2A-VM HDMI)
  drm/radeon: Log Subsystem Vendor and Device Information
  drm/radeon: Extended DDC Probing for ECS A740GM-M DVI-D Connector

 drivers/gpu/drm/drm_edid.c |   24 +---
 drivers/gpu/drm/radeon/radeon_connectors.c |   54 ++--
 drivers/gpu/drm/radeon/radeon_device.c |5 ++-
 drivers/gpu/drm/radeon/radeon_display.c|9 +
 drivers/gpu/drm/radeon/radeon_i2c.c|   32 
 drivers/gpu/drm/radeon/radeon_mode.h   |6 +++-
 include/drm/drm_crtc.h |1 +
 7 files changed, 111 insertions(+), 20 deletions(-)

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


[PATCH 1/4] drm: Separate EDID Header Check from EDID Block Check

2011-07-29 Thread reimth
From: Thomas Reim 

Provides function drm_edid_header_is_valid() for EDID header check
and replaces EDID header check part of function drm_edid_block_valid()
by a call of drm_edid_header_is_valid().
This is a prerequisite to extend DDC probing, e. g. in function
radeon_ddc_probe() for Radeon devices, by a central EDID header check.

Tested for kernel 2.6.35, 2.6.38 and 3.0

Cc: 
Signed-off-by: Thomas Reim 
Reviewed-by: Alex Deucher 
Acked-by: Stephen Michaels 
---
 drivers/gpu/drm/drm_edid.c |   24 ++--
 include/drm/drm_crtc.h |1 +
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 0929219..1bbb85b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -127,6 +127,23 @@ static const u8 edid_header[] = {
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 };
 
+ /*
+ * Sanity check the header of the base EDID block.  Return 8 if the header
+ * is perfect, down to 0 if it's totally wrong.
+ */
+int drm_edid_header_is_valid(const u8 *raw_edid)
+{
+   int i, score = 0;
+
+   for (i = 0; i < sizeof(edid_header); i++)
+   if (raw_edid[i] == edid_header[i])
+   score++;
+
+   return score;
+}
+EXPORT_SYMBOL(drm_edid_header_is_valid);
+
+
 /*
  * Sanity check the EDID block (base or extension).  Return 0 if the block
  * doesn't check out, or 1 if it's valid.
@@ -139,12 +156,7 @@ drm_edid_block_valid(u8 *raw_edid)
struct edid *edid = (struct edid *)raw_edid;
 
if (raw_edid[0] == 0x00) {
-   int score = 0;
-
-   for (i = 0; i < sizeof(edid_header); i++)
-   if (raw_edid[i] == edid_header[i])
-   score++;
-
+   int score = drm_edid_header_is_valid(raw_edid);
if (score == 8) ;
else if (score >= 6) {
DRM_DEBUG("Fixing EDID header, your hardware may be 
failing\n");
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 33d12f8..0ec3687 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -802,6 +802,7 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct 
drm_device *dev,
 extern int drm_add_modes_noedid(struct drm_connector *connector,
int hdisplay, int vdisplay);
 
+extern int drm_edid_header_is_valid(const u8 *raw_edid);
 extern bool drm_edid_is_valid(struct edid *edid);
 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
   int hsize, int vsize, int fresh);
-- 
1.7.1

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


[PATCH] drm/radeon: Fix ECS A740GM-M DVI-D EDID error flooding problem

2011-07-20 Thread reimth
From: Thomas Reim 

   ECS A740GM-M with ATI RADEON 2100 sends data to i2c bus
   for a DVI connector that is not implemented/existent on the board.

   Fix by applying extented DDC probing for this connector.

   Requires [PATCH] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem

   BugLink: http://bugs.launchpad.net/bugs/810926

Signed-off-by: Thomas Reim 
---
 drivers/gpu/drm/radeon/radeon_connectors.c |9 +
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index 2e70be2..82dacc6 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -449,6 +449,15 @@ static bool radeon_connector_needs_extended_probe(struct 
radeon_device *dev,
(supported_device == ATOM_DEVICE_DFP2_SUPPORT))
return true;
}
+   /* ECS A740GM-M with ATI RADEON 2100 sends data to i2c bus
+* for a DVI connector that is not implemented */
+   if ((dev->pdev->device == 0x796e) &&
+   (dev->pdev->subsystem_vendor == 0x1019) &&
+   (dev->pdev->subsystem_device == 0x2615)) {
+   if ((connector_type == DRM_MODE_CONNECTOR_DVID) &&
+   (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
+   return true;
+   }
 
/* Default: no EDID header probe required for DDC probing */
return false;
-- 
1.7.1

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


[PATCH 1/3] drm: Separate EDID Header Check from EDID Block Check

2011-07-06 Thread reimth
From: Thomas Reim 

Provides function drm_edid_header_is_valid() for EDID header check
and replaces EDID header check part of function drm_edid_block_valid()
by a call of drm_edid_header_is_valid().
This is a prerequisite to extend DDC probing, e. g. in function
radeon_ddc_probe() for Radeon devices, by a central EDID header check.

Tested for kernel 2.35, 2.38 and 3.0

Signed-off-by: Thomas Reim 
---
 drivers/gpu/drm/drm_edid.c |   24 ++--
 include/drm/drm_crtc.h |1 +
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 0929219..1bbb85b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -127,6 +127,23 @@ static const u8 edid_header[] = {
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 };
 
+ /*
+ * Sanity check the header of the base EDID block.  Return 8 if the header
+ * is perfect, down to 0 if it's totally wrong.
+ */
+int drm_edid_header_is_valid(const u8 *raw_edid)
+{
+   int i, score = 0;
+
+   for (i = 0; i < sizeof(edid_header); i++)
+   if (raw_edid[i] == edid_header[i])
+   score++;
+
+   return score;
+}
+EXPORT_SYMBOL(drm_edid_header_is_valid);
+
+
 /*
  * Sanity check the EDID block (base or extension).  Return 0 if the block
  * doesn't check out, or 1 if it's valid.
@@ -139,12 +156,7 @@ drm_edid_block_valid(u8 *raw_edid)
struct edid *edid = (struct edid *)raw_edid;
 
if (raw_edid[0] == 0x00) {
-   int score = 0;
-
-   for (i = 0; i < sizeof(edid_header); i++)
-   if (raw_edid[i] == edid_header[i])
-   score++;
-
+   int score = drm_edid_header_is_valid(raw_edid);
if (score == 8) ;
else if (score >= 6) {
DRM_DEBUG("Fixing EDID header, your hardware may be 
failing\n");
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 33d12f8..0ec3687 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -802,6 +802,7 @@ extern struct drm_display_mode *drm_gtf_mode_complex(struct 
drm_device *dev,
 extern int drm_add_modes_noedid(struct drm_connector *connector,
int hdisplay, int vdisplay);
 
+extern int drm_edid_header_is_valid(const u8 *raw_edid);
 extern bool drm_edid_is_valid(struct edid *edid);
 struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev,
   int hsize, int vsize, int fresh);
-- 
1.7.1

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


[PATCH 2/3] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem

2011-07-06 Thread reimth
From: Thomas Reim 

Fixes bug https://bugs.launchpad.net/ubuntu/+source/linux/+bug/722806:
Some integrated ATI Radeon chipset implementations with add-on HDMI card
(e. g. Asus M2A-VM HDMI) indicate the availability of a DDC even
when the add-on card is not plugged in or HDMI is disabled in BIOS setup.
In this case, drm_get_edid() and drm_edid_block_valid() periodically
dump data and kernel errors into system log files and onto terminals.
For these chipsets DDC probing is extended by a check for a correct
EDID header. Only in case a valid EDID header is also found, the
(HDMI) connector will be used by the Radeon driver. This prevents the
kernel driver from useless flooding of logs and terminal sessions with
EDID dumps and error messages.
This patch adds a flag 'requires_extended_probe' to the radeon_connector
structure. In function radeon_connector_needs_extended_probe() this flag
can be set on a chipset family/vendor/connector type specific basis.
In addition, function radeon_ddc_probe() has been adapted to perform
extended DDC probing if required by the connector's flag.
Requires function drm_edid_header_is_valid() in DRM module provided by
[PATCH] drm: Separate EDID Header Check from EDID Block Check.

Tested for kernel 2.35, 2.38 and 3.0 on Asus M2A-VM HDMI board

Signed-off-by: Thomas Reim 
---
 drivers/gpu/drm/radeon/radeon_connectors.c |   45 ++--
 drivers/gpu/drm/radeon/radeon_display.c|9 +
 drivers/gpu/drm/radeon/radeon_i2c.c|   32 +++-
 drivers/gpu/drm/radeon/radeon_mode.h   |6 +++-
 4 files changed, 80 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index cbfca3a..2e70be2 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -424,6 +424,36 @@ int radeon_connector_set_property(struct drm_connector 
*connector, struct drm_pr
return 0;
 }
 
+/*
+ * Some integrated ATI Radeon chipset implementations (e. g.
+ * Asus M2A-VM HDMI) may indicate the availability of a DDC,
+ * even when there's no monitor connected. For these connectors
+ * following DDC probe extension will be applied: check also for the
+ * availability of EDID with at least a correct EDID header. Only then,
+ * DDC is assumed to be available. This prevents drm_get_edid() and
+ * drm_edid_block_valid() from periodically dumping data and kernel
+ * errors into the logs and onto the terminal.
+ */
+static bool radeon_connector_needs_extended_probe(struct radeon_device *dev,
+uint32_t supported_device,
+int connector_type)
+{
+   /* Asus M2A-VM HDMI board sends data to i2c bus even,
+* if HDMI add-on card is not plugged in or HDMI is disabled in
+* BIOS. Valid DDC can only be assumed, if also a valid EDID header
+* can be retrieved via i2c bus during DDC probe */
+   if ((dev->pdev->device == 0x791e) &&
+   (dev->pdev->subsystem_vendor == 0x1043) &&
+   (dev->pdev->subsystem_device == 0x826d)) {
+   if ((connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
+   (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
+   return true;
+   }
+
+   /* Default: no EDID header probe required for DDC probing */
+   return false;
+}
+
 static void radeon_fixup_lvds_native_mode(struct drm_encoder *encoder,
  struct drm_connector *connector)
 {
@@ -655,7 +685,8 @@ radeon_vga_detect(struct drm_connector *connector, bool 
force)
ret = connector_status_disconnected;
 
if (radeon_connector->ddc_bus)
-   dret = radeon_ddc_probe(radeon_connector);
+   dret = radeon_ddc_probe(radeon_connector,
+   
radeon_connector->requires_extended_probe);
if (dret) {
if (radeon_connector->edid) {
kfree(radeon_connector->edid);
@@ -827,7 +858,8 @@ radeon_dvi_detect(struct drm_connector *connector, bool 
force)
bool dret = false;
 
if (radeon_connector->ddc_bus)
-   dret = radeon_ddc_probe(radeon_connector);
+   dret = radeon_ddc_probe(radeon_connector,
+   
radeon_connector->requires_extended_probe);
if (dret) {
if (radeon_connector->edid) {
kfree(radeon_connector->edid);
@@ -1245,7 +1277,8 @@ radeon_dp_detect(struct drm_connector *connector, bool 
force)
if (radeon_dp_getdpcd(radeon_connector))
ret = connector_status_connected;
} else {
-   if (radeon_ddc_probe(radeon_connector))
+  

[PATCH 3/3] drm/radeon: Log Subsystem Vendor and Device Information

2011-07-06 Thread reimth
From: Thomas Reim 

Log PCI subsystem vendor and subsystem device ID in addition to
PCI vendor and device ID during kernel mode initialisation. This helps
to better identify radeon devices of third-party vendors, e. g. for
bug analysis.

Tested for kernel 2.35, 2.38 and 3.0 on Asus M2A-VM HDMI board

Signed-off-by: Thomas Reim 
---
 drivers/gpu/drm/radeon/radeon_device.c |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_device.c 
b/drivers/gpu/drm/radeon/radeon_device.c
index 7cfaa7e..440e6ec 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -704,8 +704,9 @@ int radeon_device_init(struct radeon_device *rdev,
rdev->gpu_lockup = false;
rdev->accel_working = false;
 
-   DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X).\n",
-   radeon_family_name[rdev->family], pdev->vendor, pdev->device);
+   DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X 
0x%04X:0x%04X).\n",
+   radeon_family_name[rdev->family], pdev->vendor, pdev->device,
+   pdev->subsystem_vendor, pdev->subsystem_device);
 
/* mutex initialization are all done here so we
 * can recall function without having locking issues */
-- 
1.7.1

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


[PATCH 0/3] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem

2011-07-06 Thread reimth
From: Thomas Reim 

Dear Alex,

> > From: Thomas Reim 
> >
> >Some integrated ATI Radeon chipset implementations
> >with add-on HDMI card (e. g. Asus M2A-VM HDMI) indicate the availability
> >of a DDC even when the add-on card is not plugged in or HDMI is disabled
> >in BIOS setup. In this case, drm_get_edid() and drm_edid_block_valid()
> >periodically dump data and kernel errors into system log files and onto
> >terminals. For these chipsets DDC probing is extended by a check for a
> >correct EDID header. Only in case a valid EDID header is also found, the
> >(HDMI) connector will be used by the Radeon driver. This prevents the
> >kernel driver from useless flooding of logs and terminal sessions with
> >EDID dumps and error messages.
> >This patch adds a flag 'requires_extended_probe' to the radeon_connector
> >structure. In function radeon_connector_needs_extended_probe() this flag
> >can be set on a chipset family/vendor/connector type specific basis.
> >In addition, function drm_edid_header_is_valid() has been added for EDID
> >header check and function radeon_ddc_probe() has been adapted to perform
> >extended DDC probing if required by the connector's flag.
> >
> >Tested for kernel 2.35, 2.38 and 3.0 on Asus M2A-VM HDMI board
> >
> 
> Once it's ready, just add:
> Cc: sta...@kernel.org
> to the commit message and it will go into the stable kernels as well.
> Might want to mention the bug report in your commit message as well.
> Just a couple comments below.  With those fixed:
> 
> Reviewed-by: Alex Deucher 
> 
> > Signed-off-by: Thomas Reim 
> 
thank you for the review and your feedback. I've incorporated your comments as 
follows:

>  * Sanity check the EDID block (base or extension).  Return 0 if the block
> >  * doesn't check out, or 1 if it's valid.
> > @@ -139,12 +156,7 @@ drm_edid_block_valid(u8 *raw_edid)
> >struct edid *edid = (struct edid *)raw_edid;
> >
> >if (raw_edid[0] == 0x00) {
> > -   int score = 0;
> > -
> > -   for (i = 0; i < sizeof(edid_header); i++)
> > -   if (raw_edid[i] == edid_header[i])
> > -   score++;
> > -
> > +   int score = drm_edid_header_is_valid(raw_edid);
> >if (score == 8) ;
> >else if (score >= 6) {
> >DRM_DEBUG("Fixing EDID header, your hardware may be 
> > failing\n");
> 
> Might want to break this hunk out as a separate patch.

Done. Moved to [PATCH 1/3] drm: Separate EDID Header Check from EDID Block 
Check  

> --- a/drivers/gpu/drm/radeon/radeon_device.c
> > +++ b/drivers/gpu/drm/radeon/radeon_device.c
> > @@ -704,8 +704,13 @@ int radeon_device_init(struct radeon_device *rdev,
> >rdev->gpu_lockup = false;
> >rdev->accel_working = false;
> >
> > -   DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X).\n",
> > +   if (pdev->subsystem_vendor == 0)
> > +   DRM_INFO("initializing kernel modesetting (%s 
> > 0x%04X:0x%04X).\n",
> >radeon_family_name[rdev->family], pdev->vendor, 
> > pdev->device);
> > +   else
> > +   DRM_INFO("initializing kernel modesetting (%s 0x%04X:0x%04X 
> > 0x%04X:0x%04X).\n",
> > +   radeon_family_name[rdev->family], pdev->vendor, 
> > pdev->device,
> > +   pdev->subsystem_vendor, pdev->subsystem_device);
> >
> 
> No need for the if block.  Just always print both the pci and
> subsystem ids.  Also, I'd suggest making that a separate patch as it's
> not related to the actual fix.

Done. Moved to [PATCH 3/3] drm/radeon: Log Subsystem Vendor and Device 
Information.

The following mails will contain the three patches:
[PATCH 1/3] drm: Separate EDID Header Check from EDID Block Check
[PATCH 2/3] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem
[PATCH 3/3] drm/radeon: Log Subsystem Vendor and Device Information

[PATCH 2/3] requires [PATCH 1/3] (new function drm_edid_header_is_valid). 
[PATCH 3/3] 
is an add-on that helps people to identify also the subsystem vendor and device 
PCI ID 
of a Radeon chipset within the kernel log. So all information that is needed to 
include 
Radeon implementations other than Asus M2A-VM HDMI for extended DDC probing 
should now 
be available in dmesg. 

The patches were generated against revision 'Linux 3.0-rc6' in Linux kernel git 
repository.

Best regards

Thomas Reim


Thomas Reim (3):
  drm: Separate EDID Header Check from EDID Block Check
  drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem
  drm/radeon: Log Subsystem Vendor and Device Information

 drivers/gpu/drm/drm_edid.c |   24 +++
 drivers/gpu/drm/radeon/radeon_connectors.c |   45 ++--
 drivers/gpu/drm/radeon/radeon_device.c |5 ++-
 drivers/gpu/drm/radeon/radeon_display.c|9 +
 drivers/gpu/drm/radeon/radeon_i2c.c|   32 +

[PATCH] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem

2011-07-06 Thread reimth
From: Thomas Reim 

Some integrated ATI Radeon chipset implementations
with add-on HDMI card (e. g. Asus M2A-VM HDMI) indicate the availability
of a DDC even when the add-on card is not plugged in or HDMI is disabled
in BIOS setup. In this case, drm_get_edid() and drm_edid_block_valid()
periodically dump data and kernel errors into system log files and onto
terminals. For these chipsets DDC probing is extended by a check for a
correct EDID header. Only in case a valid EDID header is also found, the
(HDMI) connector will be used by the Radeon driver. This prevents the
kernel driver from useless flooding of logs and terminal sessions with
EDID dumps and error messages.
This patch adds a flag 'requires_extended_probe' to the radeon_connector
structure. In function radeon_connector_needs_extended_probe() this flag
can be set on a chipset family/vendor/connector type specific basis.
In addition, function drm_edid_header_is_valid() has been added for EDID
header check and function radeon_ddc_probe() has been adapted to perform
extended DDC probing if required by the connector's flag.

Tested for kernel 2.35, 2.38 and 3.0 on Asus M2A-VM HDMI board

Signed-off-by: Thomas Reim 
---
 drivers/gpu/drm/drm_edid.c |   24 +++
 drivers/gpu/drm/radeon/radeon_connectors.c |   45 ++--
 drivers/gpu/drm/radeon/radeon_device.c |7 -
 drivers/gpu/drm/radeon/radeon_display.c|9 +
 drivers/gpu/drm/radeon/radeon_i2c.c|   32 +++-
 drivers/gpu/drm/radeon/radeon_mode.h   |6 +++-
 include/drm/drm_crtc.h |1 +
 7 files changed, 105 insertions(+), 19 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 0929219..1bbb85b 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -127,6 +127,23 @@ static const u8 edid_header[] = {
0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00
 };
 
+ /*
+ * Sanity check the header of the base EDID block.  Return 8 if the header
+ * is perfect, down to 0 if it's totally wrong.
+ */
+int drm_edid_header_is_valid(const u8 *raw_edid)
+{
+   int i, score = 0;
+
+   for (i = 0; i < sizeof(edid_header); i++)
+   if (raw_edid[i] == edid_header[i])
+   score++;
+
+   return score;
+}
+EXPORT_SYMBOL(drm_edid_header_is_valid);
+
+
 /*
  * Sanity check the EDID block (base or extension).  Return 0 if the block
  * doesn't check out, or 1 if it's valid.
@@ -139,12 +156,7 @@ drm_edid_block_valid(u8 *raw_edid)
struct edid *edid = (struct edid *)raw_edid;
 
if (raw_edid[0] == 0x00) {
-   int score = 0;
-
-   for (i = 0; i < sizeof(edid_header); i++)
-   if (raw_edid[i] == edid_header[i])
-   score++;
-
+   int score = drm_edid_header_is_valid(raw_edid);
if (score == 8) ;
else if (score >= 6) {
DRM_DEBUG("Fixing EDID header, your hardware may be 
failing\n");
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index cbfca3a..2e70be2 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -424,6 +424,36 @@ int radeon_connector_set_property(struct drm_connector 
*connector, struct drm_pr
return 0;
 }
 
+/*
+ * Some integrated ATI Radeon chipset implementations (e. g.
+ * Asus M2A-VM HDMI) may indicate the availability of a DDC,
+ * even when there's no monitor connected. For these connectors
+ * following DDC probe extension will be applied: check also for the
+ * availability of EDID with at least a correct EDID header. Only then,
+ * DDC is assumed to be available. This prevents drm_get_edid() and
+ * drm_edid_block_valid() from periodically dumping data and kernel
+ * errors into the logs and onto the terminal.
+ */
+static bool radeon_connector_needs_extended_probe(struct radeon_device *dev,
+uint32_t supported_device,
+int connector_type)
+{
+   /* Asus M2A-VM HDMI board sends data to i2c bus even,
+* if HDMI add-on card is not plugged in or HDMI is disabled in
+* BIOS. Valid DDC can only be assumed, if also a valid EDID header
+* can be retrieved via i2c bus during DDC probe */
+   if ((dev->pdev->device == 0x791e) &&
+   (dev->pdev->subsystem_vendor == 0x1043) &&
+   (dev->pdev->subsystem_device == 0x826d)) {
+   if ((connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
+   (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
+   return true;
+   }
+
+   /* Default: no EDID header probe required for DDC probing */
+   return false;
+}
+
 static void radeon_fixup_lvds_native_mode(struct drm_encod

[PATCH] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem

2011-06-23 Thread reimth
From: Thomas Reim 

Some integrated ATI Radeon chipset implementations
(e. g. Asus M2A-VM HDMI, RS690) indicate the availability
of a DDC even when there's no monitor connected.
In this case, drm_get_edid() and drm_edid_block_valid()
periodically dump data and kernel errors into system
log files and onto terminals, which lead to an unacceptable
system behaviour. For this purpose function drm_edid_header_is_valid()
has been added to drm and function drm_edid_block_valid()
has been adapted to also use drm_edid_header_is_valid().

Tested since kernel 2.35 on Asus M2A-VM HDMI board

Signed-off-by: Thomas Reim 
---
 drivers/gpu/drm/drm_edid.c |   23 +++---
 drivers/gpu/drm/radeon/radeon_connectors.c |   29 -
 drivers/gpu/drm/radeon/radeon_display.c|   12 +++
 drivers/gpu/drm/radeon/radeon_i2c.c|   45 ++-
 drivers/gpu/drm/radeon/radeon_mode.h   |4 ++
 include/drm/drm_crtc.h |1 +
 6 files changed, 105 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 0929219..1daaf81 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -128,6 +128,23 @@ static const u8 edid_header[] = {
 };
 
 /*
+ * Sanity check the header of the base EDID block.  Return 8 if the header
+ * is perfect, down to 0 if it's totally wrong.
+ */
+int drm_edid_header_is_valid(const u8 *raw_edid)
+{
+   int i, score = 0;
+
+   for (i = 0; i < sizeof(edid_header); i++)
+   if (raw_edid[i] == edid_header[i])
+   score++;
+
+   return score;
+}
+EXPORT_SYMBOL(drm_edid_header_is_valid);
+
+
+/*
  * Sanity check the EDID block (base or extension).  Return 0 if the block
  * doesn't check out, or 1 if it's valid.
  */
@@ -139,11 +156,7 @@ drm_edid_block_valid(u8 *raw_edid)
struct edid *edid = (struct edid *)raw_edid;
 
if (raw_edid[0] == 0x00) {
-   int score = 0;
-
-   for (i = 0; i < sizeof(edid_header); i++)
-   if (raw_edid[i] == edid_header[i])
-   score++;
+   int score = drm_edid_header_is_valid(raw_edid);
 
if (score == 8) ;
else if (score >= 6) {
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index cbfca3a..bcd2380 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -826,8 +826,12 @@ radeon_dvi_detect(struct drm_connector *connector, bool 
force)
enum drm_connector_status ret = connector_status_disconnected;
bool dret = false;
 
-   if (radeon_connector->ddc_bus)
-   dret = radeon_ddc_probe(radeon_connector);
+   if (radeon_connector->ddc_bus) {
+   if (radeon_connector->requires_extended_probe)
+   dret = radeon_ddc_probe_extended(radeon_connector);
+   else
+   dret = radeon_ddc_probe(radeon_connector);
+   }
if (dret) {
if (radeon_connector->edid) {
kfree(radeon_connector->edid);
@@ -1342,6 +1346,7 @@ radeon_add_atom_connector(struct drm_device *dev,
struct radeon_encoder *radeon_encoder;
uint32_t subpixel_order = SubPixelNone;
bool shared_ddc = false;
+   bool requires_extended_probe = false;
bool is_dp_bridge = false;
 
if (connector_type == DRM_MODE_CONNECTOR_Unknown)
@@ -1400,6 +1405,7 @@ radeon_add_atom_connector(struct drm_device *dev,
radeon_connector->shared_ddc = shared_ddc;
radeon_connector->connector_object_id = connector_object_id;
radeon_connector->hpd = *hpd;
+   radeon_connector->requires_extended_probe = requires_extended_probe;
radeon_connector->router = *router;
if (router->ddc_valid || router->cd_valid) {
radeon_connector->router_bus = radeon_i2c_lookup(rdev, 
&router->i2c_info);
@@ -1688,6 +1694,23 @@ radeon_add_atom_connector(struct drm_device *dev,
}
}
 
+   /* RS690 HDMI DDC quirk:
+* Some integrated ATI Radeon chipset implementations (e. g.
+* Asus M2A-VM HDMI) indicate the availability of a DDC even
+* when there's no monitor connected to HDMI. For HDMI
+* connectors we check for the availability of EDID with
+* at least a correct EDID header and EDID version/revision
+* information. Only then, DDC is assumed to be available.
+* This prevents drm_get_edid() and drm_edid_block_valid() of
+* periodically dumping data and kernel errors into the logs
+* and onto the terminal, which would lead to an unacceptable
+* system behaviour */
+   if (connector_type == DRM_MODE_CONNECTOR_HDMIA &&
+   (rdev->family == CHIP_RS690 ||
+rdev->family == CHIP_RS740 ||
+r

[PATCH 1/1] drm/radeon: Fix Asus M2A-VM HDMI EDID error flooding problem

2011-06-21 Thread reimth
From: Thomas Reim 

Some integrated ATI Radeon chipset implementations
(e. g. Asus M2A-VM HDMI) indicate the availability
of a DDC even when there's no monitor connected.
In this case, drm_get_edid() and drm_edid_block_valid()
periodically dump data and kernel errors into system
log files and onto terminals, which lead to an unacceptable
system behaviour.

Tested since kernel 2.35 on Asus M2A-VM HDMI board

Signed-off-by: Thomas Reim 
---
 drivers/gpu/drm/radeon/radeon_connectors.c |   21 +--
 drivers/gpu/drm/radeon/radeon_display.c|   11 ++
 drivers/gpu/drm/radeon/radeon_i2c.c|   55 
 drivers/gpu/drm/radeon/radeon_mode.h   |1 +
 4 files changed, 85 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c 
b/drivers/gpu/drm/radeon/radeon_connectors.c
index cbfca3a..497e32a 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -825,9 +825,24 @@ radeon_dvi_detect(struct drm_connector *connector, bool 
force)
int i;
enum drm_connector_status ret = connector_status_disconnected;
bool dret = false;
-
-   if (radeon_connector->ddc_bus)
-   dret = radeon_ddc_probe(radeon_connector);
+
+   if (radeon_connector->ddc_bus) {
+   /* AMD 690 chipset series HDMI DDC quirk:
+* Some integrated ATI Radeon chipset implementations (e. g.
+* Asus M2A-VM HDMI) indicate the availability of a DDC even
+* when there's no monitor connected to HDMI. For HDMI
+* connectors we check for the availability of EDID with
+* at least a correct EDID header and EDID version/revision
+* information. Only then, DDC is assumed to be available.
+* This prevents drm_get_edid() and drm_edid_block_valid() of
+* periodically dumping data and kernel errors into the logs
+* and onto the terminal, which would lead to an unacceptable
+* system behaviour */
+   if (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA)
+   dret = radeon_ddc_edid_probe(radeon_connector);
+   else
+   dret = radeon_ddc_probe(radeon_connector);
+   }
if (dret) {
if (radeon_connector->edid) {
kfree(radeon_connector->edid);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c 
b/drivers/gpu/drm/radeon/radeon_display.c
index 292f73f..550f143 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -715,6 +715,9 @@ static bool radeon_setup_enc_conn(struct drm_device *dev)
if (ret) {
radeon_setup_encoder_clones(dev);
radeon_print_display_setup(dev);
+   /* Is this really required here?
+  Seems to just force drm to dump EDID errors
+  to kernel logs */
list_for_each_entry(drm_connector, 
&dev->mode_config.connector_list, head)
radeon_ddc_dump(drm_connector);
}
@@ -777,8 +780,16 @@ static int radeon_ddc_dump(struct drm_connector *connector)
if (!radeon_connector->ddc_bus)
return -1;
edid = drm_get_edid(connector, &radeon_connector->ddc_bus->adapter);
+   /* Asus M2A-VM HDMI DDC quirk: Log EDID retrieval status here once,
+* instead of periodically dumping data and kernel errors into the
+* logs, if a monitor is not connected to HDMI */
if (edid) {
+   DRM_INFO("Radeon display connector %s: Found valid EDID",
+   drm_get_connector_name(connector));
kfree(edid);
+   } else {
+   DRM_INFO("Radeon display connector %s: No display connected or 
invalid EDID",
+   drm_get_connector_name(connector));
}
return ret;
 }
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c 
b/drivers/gpu/drm/radeon/radeon_i2c.c
index 781196d..80b871f 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -63,6 +63,61 @@ bool radeon_ddc_probe(struct radeon_connector 
*radeon_connector)
return false;
 }
 
+/*
+ * Probe EDID information via I2C:
+ * Try to fetch EDID information by calling i2c_transfer driver function and
+ * probe for valid EDID header and version information.
+ *
+ * AMD 690 chipset series HDMI DDC quirk:
+ * Some integrated ATI Radeon chipset implementations (e. g. Asus M2A-VM HDMI
+ * indicate the availability of a DDC even when there's no monitor connected.
+ * Invalid EDID leads to flooding of logs and terminals with error messages
+ */
+bool radeon_ddc_edid_probe(struct radeon_connector *radeon_connector)
+{
+   u8 out_buf[] = {0x0, 0x0};
+   u8 block[20];
+   int ret;
+   struct i2c_msg msgs[] = {
+   {