Skip to contentSkip to conversation

drm/radeon: set hpd polarity at init time so hotplug detect works

PATCH In review [email protected] 2 participants 5 messages Oct 28, 2011 – Nov 2, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon: set hpd polarity at init time so hotplug detect works

From: Jerome Glisse <[email protected]>

Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up at module init so first hotplug works reliably no matter what is the initial set of connector.

---
 drivers/gpu/drm/radeon/radeon_connectors.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +1 -0
index dec6cbe..bfdd48b 100644
@@ -1789,6 +1789,7 @@ radeon_add_atom_connector(struct drm_device *dev,
 			connector->polled = DRM_CONNECTOR_POLL_CONNECT;
 	} else
 		connector->polled = DRM_CONNECTOR_POLL_HPD;
+	radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 
 	connector->display_info.subpixel_order = subpixel_order;
 	drm_sysfs_connector_add(connector);
Signature · 1 line
1.7.6.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · On Fri, Oct 28, 2011 at 5:52 PM, <[email protected]> wrote:

From: Jerome Glisse <[email protected]>

Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up at module init so first hotplug works reliably no matter what is the initial set of connector.

Quoted 24 lines

---
 drivers/gpu/drm/radeon/radeon_connectors.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +1 -1
index dec6cbe..bfdd48b 100644
@@ -1789,6 +1789,7 @@ radeon_add_atom_connector(struct drm_device *dev,
                        connector->polled = DRM_CONNECTOR_POLL_CONNECT;
        } else
                connector->polled = DRM_CONNECTOR_POLL_HPD;
+       radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 
        connector->display_info.subpixel_order = subpixel_order;
        drm_sysfs_connector_add(connector);
--

1.7.6.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw
In reply to [email protected]
Quoted 5 lines · On Fri, Oct 28, 2011 at 5:52 PM, <[email protected]> wrote:

From: Jerome Glisse <[email protected]>

Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up at module init so first hotplug works reliably no matter what is the initial set of connector.

Thinking about this more, we should probably do this on resume as well. Calling it in hpd_init should cover all the bases.

Alex

Quoted 22 lines

---
 drivers/gpu/drm/radeon/radeon_connectors.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +1 -1
index dec6cbe..bfdd48b 100644
@@ -1789,6 +1789,7 @@ radeon_add_atom_connector(struct drm_device *dev,
                        connector->polled = DRM_CONNECTOR_POLL_CONNECT;
        } else
                connector->polled = DRM_CONNECTOR_POLL_HPD;
+       radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 
        connector->display_info.subpixel_order = subpixel_order;
        drm_sysfs_connector_add(connector);
--

1.7.6.4

Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

From 90a532b643cbe882497eaadb78f7d1997af6e22b Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Tue, 1 Nov 2011 17:23:15 -0400
Subject: [PATCH] drm/radeon/kms: set HPD polarity in hpd_init()

Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up in hpd_init() so first hotplug works reliably no matter what is the initial set of connector. hpd_init() also covers resume so HPD will work correctly after resume as well.

---
 drivers/gpu/drm/radeon/evergreen.c |    1 +
 drivers/gpu/drm/radeon/r100.c      |    1 +
 drivers/gpu/drm/radeon/r600.c      |   19 +++++++++----------
 drivers/gpu/drm/radeon/rs600.c     |    1 +
 4 files changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +1 -0
index db9027d..7ce9c87 100644
@@ -353,6 +353,7 @@ void evergreen_hpd_init(struct radeon_device *rdev)
 		default:
 			break;
 		}
+		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 	}
 	if (rdev->irq.installed)
 		evergreen_irq_set(rdev);
drivers/gpu/drm/radeon/r100.c +1 -0
index 8f8b8fa..4191eaf 100644
@@ -536,6 +536,7 @@ void r100_hpd_init(struct radeon_device *rdev)
 		default:
 			break;
 		}
+		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 	}
 	if (rdev->irq.installed)
 		r100_irq_set(rdev);
drivers/gpu/drm/radeon/r600.c +9 -10
index 3aa46d7..4d85398 100644
@@ -762,13 +762,14 @@ void r600_hpd_init(struct radeon_device *rdev)
 	struct drm_device *dev = rdev->ddev;
 	struct drm_connector *connector;
 
-	if (ASIC_IS_DCE3(rdev)) {
-		u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa);
-		if (ASIC_IS_DCE32(rdev))
-			tmp |= DC_HPDx_EN;
+	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+		struct radeon_connector *radeon_connector = to_radeon_connector(connector);
+
+		if (ASIC_IS_DCE3(rdev)) {
+			u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa);
+			if (ASIC_IS_DCE32(rdev))
+				tmp |= DC_HPDx_EN;
 
-		list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-			struct radeon_connector *radeon_connector = to_radeon_connector(connector);
 			switch (radeon_connector->hpd.hpd) {
 			case RADEON_HPD_1:
 				WREG32(DC_HPD1_CONTROL, tmp);
@@ -798,10 +799,7 @@ void r600_hpd_init(struct radeon_device *rdev)
 			default:
 				break;
 			}
-		}
-	} else {
-		list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-			struct radeon_connector *radeon_connector = to_radeon_connector(connector);
+		} else {
 			switch (radeon_connector->hpd.hpd) {
 			case RADEON_HPD_1:
 				WREG32(DC_HOT_PLUG_DETECT1_CONTROL, DC_HOT_PLUG_DETECTx_EN);
@@ -819,6 +817,7 @@ void r600_hpd_init(struct radeon_device *rdev)
 				break;
 			}
 		}
+		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 	}
 	if (rdev->irq.installed)
 		r600_irq_set(rdev);
drivers/gpu/drm/radeon/rs600.c +1 -0
index 9320dd6..02e0390 100644
@@ -287,6 +287,7 @@ void rs600_hpd_init(struct radeon_device *rdev)
 		default:
 			break;
 		}
+		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 	}
 	if (rdev->irq.installed)
 		rs600_irq_set(rdev);
Signature · 1 line
1.7.3.4

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

author Reviewed-by
#3 lore raw
Quoted 12 lines · Alex Deucher
Quoted 5 lines · On Fri, Oct 28, 2011 at 5:52 PM, <[email protected]> wrote:

From: Jerome Glisse <[email protected]>

Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up at module init so first hotplug works reliably no matter what is the initial set of connector.

Thinking about this more, we should probably do this on resume as well. Calling it in hpd_init should cover all the bases.

Alex

Good catch :)

Quoted 131 lines
Quoted 22 lines

---
 drivers/gpu/drm/radeon/radeon_connectors.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +1 -1
index dec6cbe..bfdd48b 100644
@@ -1789,6 +1789,7 @@ radeon_add_atom_connector(struct drm_device *dev,
                        connector->polled = DRM_CONNECTOR_POLL_CONNECT;
        } else
                connector->polled = DRM_CONNECTOR_POLL_HPD;
+       radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 
        connector->display_info.subpixel_order = subpixel_order;
        drm_sysfs_connector_add(connector);
--

1.7.6.4

Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

From 90a532b643cbe882497eaadb78f7d1997af6e22b Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Tue, 1 Nov 2011 17:23:15 -0400
Subject: [PATCH] drm/radeon/kms: set HPD polarity in hpd_init()

Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up in hpd_init() so first hotplug works reliably no matter what is the initial set of connector. hpd_init() also covers resume so HPD will work correctly after resume as well.

---
 drivers/gpu/drm/radeon/evergreen.c |    1 +
 drivers/gpu/drm/radeon/r100.c      |    1 +
 drivers/gpu/drm/radeon/r600.c      |   19 +++++++++----------
 drivers/gpu/drm/radeon/rs600.c     |    1 +
 4 files changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +1 -0
index db9027d..7ce9c87 100644
@@ -353,6 +353,7 @@ void evergreen_hpd_init(struct radeon_device *rdev)
 		default:
 			break;
 		}
+		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 	}
 	if (rdev->irq.installed)
 		evergreen_irq_set(rdev);
drivers/gpu/drm/radeon/r100.c +1 -0
index 8f8b8fa..4191eaf 100644
@@ -536,6 +536,7 @@ void r100_hpd_init(struct radeon_device *rdev)
 		default:
 			break;
 		}
+		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 	}
 	if (rdev->irq.installed)
 		r100_irq_set(rdev);
drivers/gpu/drm/radeon/r600.c +9 -10
index 3aa46d7..4d85398 100644
@@ -762,13 +762,14 @@ void r600_hpd_init(struct radeon_device *rdev)
 	struct drm_device *dev = rdev->ddev;
 	struct drm_connector *connector;
 
-	if (ASIC_IS_DCE3(rdev)) {
-		u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa);
-		if (ASIC_IS_DCE32(rdev))
-			tmp |= DC_HPDx_EN;
+	list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+		struct radeon_connector *radeon_connector = to_radeon_connector(connector);
+
+		if (ASIC_IS_DCE3(rdev)) {
+			u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa);
+			if (ASIC_IS_DCE32(rdev))
+				tmp |= DC_HPDx_EN;
 
-		list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-			struct radeon_connector *radeon_connector = to_radeon_connector(connector);
 			switch (radeon_connector->hpd.hpd) {
 			case RADEON_HPD_1:
 				WREG32(DC_HPD1_CONTROL, tmp);
@@ -798,10 +799,7 @@ void r600_hpd_init(struct radeon_device *rdev)
 			default:
 				break;
 			}
-		}
-	} else {
-		list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-			struct radeon_connector *radeon_connector = to_radeon_connector(connector);
+		} else {
 			switch (radeon_connector->hpd.hpd) {
 			case RADEON_HPD_1:
 				WREG32(DC_HOT_PLUG_DETECT1_CONTROL, DC_HOT_PLUG_DETECTx_EN);
@@ -819,6 +817,7 @@ void r600_hpd_init(struct radeon_device *rdev)
 				break;
 			}
 		}
+		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 	}
 	if (rdev->irq.installed)
 		r600_irq_set(rdev);
drivers/gpu/drm/radeon/rs600.c +1 -0
index 9320dd6..02e0390 100644
@@ -287,6 +287,7 @@ void rs600_hpd_init(struct radeon_device *rdev)
 		default:
 			break;
 		}
+		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 	}
 	if (rdev->irq.installed)
 		rs600_irq_set(rdev);
Signature · 1 line
1.7.3.4
#4 lore raw
Quoted 8 lines · Jerome Glisse
Quoted 7 lines · Alex Deucher
Quoted 5 lines · On Fri, Oct 28, 2011 at 5:52 PM,  <[email protected]> wrote:

From: Jerome Glisse <[email protected]>

Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up at module init so first hotplug works reliably no matter what is the initial set of connector.

Quoted 8 lines
Quoted 5 lines

Thinking about this more, we should probably do this on resume as well.  Calling it in hpd_init should cover all the bases.

Alex

Good catch :)

Dave,

Do you want to revert Jerome's original patch or should I remove it as part of this patch and resend?

Alex

Quoted 135 lines
Quoted 131 lines
Quoted 22 lines

---
 drivers/gpu/drm/radeon/radeon_connectors.c |    1 +

 1 files changed, 1 insertions(+), 0 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +1 -1
index dec6cbe..bfdd48b 100644
@@ -1789,6 +1789,7 @@ radeon_add_atom_connector(struct drm_device *dev,
                        connector->polled = DRM_CONNECTOR_POLL_CONNECT;
        } else
                connector->polled = DRM_CONNECTOR_POLL_HPD;
+       radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
 
        connector->display_info.subpixel_order = subpixel_order;
        drm_sysfs_connector_add(connector);
--

1.7.6.4

Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel

From 90a532b643cbe882497eaadb78f7d1997af6e22b Mon Sep 17 00:00:00 2001
From: Alex Deucher <[email protected]>
Date: Tue, 1 Nov 2011 17:23:15 -0400
Subject: [PATCH] drm/radeon/kms: set HPD polarity in hpd_init()

Polarity needs to be set accordingly to connector status (connected or disconnected). Set it up in hpd_init() so first hotplug works reliably no matter what is the initial set of connector. hpd_init() also covers resume so HPD will work correctly after resume as well.

---
 drivers/gpu/drm/radeon/evergreen.c |    1 + drivers/gpu/drm/radeon/r100.c      |    1 + drivers/gpu/drm/radeon/r600.c      |   19 +++++++++---------- drivers/gpu/drm/radeon/rs600.c     |    1 +

 4 files changed, 12 insertions(+), 10 deletions(-)
drivers/gpu/drm/radeon/evergreen.c +0 -0
index db9027d..7ce9c87 100644
@@ -353,6 +353,7 @@ void evergreen_hpd_init(struct radeon_device *rdev)

              default:
                      break;
              }
+             radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); }
      if (rdev->irq.installed)
              evergreen_irq_set(rdev);

drivers/gpu/drm/radeon/r100.c +0 -0
index 8f8b8fa..4191eaf 100644
@@ -536,6 +536,7 @@ void r100_hpd_init(struct radeon_device *rdev)

              default:
                      break;
              }
+             radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); }
      if (rdev->irq.installed)
              r100_irq_set(rdev);

drivers/gpu/drm/radeon/r600.c +7 -6
index 3aa46d7..4d85398 100644
@@ -762,13 +762,14 @@ void r600_hpd_init(struct radeon_device *rdev)
       struct drm_device *dev = rdev->ddev;
       struct drm_connector *connector;
 
-     if (ASIC_IS_DCE3(rdev)) {
-             u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa);
-             if (ASIC_IS_DCE32(rdev))
-                     tmp |= DC_HPDx_EN;
+     list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
+             struct radeon_connector *radeon_connector = to_radeon_connector(connector);
+
+             if (ASIC_IS_DCE3(rdev)) {
+                     u32 tmp = DC_HPDx_CONNECTION_TIMER(0x9c4) | DC_HPDx_RX_INT_TIMER(0xfa);
+                     if (ASIC_IS_DCE32(rdev))
+                             tmp |= DC_HPDx_EN;
 
-             list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-                     struct radeon_connector *radeon_connector = to_radeon_connector(connector);
                       switch (radeon_connector->hpd.hpd) {

                      case RADEON_HPD_1:
                              WREG32(DC_HPD1_CONTROL, tmp);

drivers/gpu/drm/radeon/r600.c +0 -0
@@ -798,10 +799,7 @@ void r600_hpd_init(struct radeon_device *rdev)

                      default:
                              break;
                      }
-             }
-     } else {
-             list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
-                     struct radeon_connector *radeon_connector = to_radeon_connector(connector);
+             } else {
                      switch (radeon_connector->hpd.hpd) {
                      case RADEON_HPD_1:
                              WREG32(DC_HOT_PLUG_DETECT1_CONTROL, DC_HOT_PLUG_DETECTx_EN);

drivers/gpu/drm/radeon/r600.c +1 -0
@@ -819,6 +817,7 @@ void r600_hpd_init(struct radeon_device *rdev)
                               break;
                       }
               }
+             radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
       }
       if (rdev->irq.installed)
               r600_irq_set(rdev);
drivers/gpu/drm/radeon/rs600.c +0 -0
index 9320dd6..02e0390 100644
@@ -287,6 +287,7 @@ void rs600_hpd_init(struct radeon_device *rdev)

              default:
                      break;
              }
+             radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd); }
      if (rdev->irq.installed)
              rs600_irq_set(rdev);
--
1.7.3.4