[PATCH 03/14] drm: introduce DRM_CONNECTOR_POLL_FORCE

2012-05-24 Thread Daniel Vetter
Useful for ->detect functions that have different behaviour if force
is set. This way probe_single_connector can avoid to do the expensive
edid dance on connectors where this is not needed.

I've checked through all drivers and set this flag everywhere where
the connector->detect function has different behaviour if force is
set. For nouveau and radeon I've got lost in the code traces, so I've
set this flag unconditionally.

Note that we also need to update the poll_execute function to now
also ignore connectors which have only this new flag set.

v2: Change POLL_HDP checks so that they ignore POLL_FORCE for both the
poll and the hpd handling code.

v3: Sprinkle POLL_FORCE more liberally over drivers. It should be now
everywhere where a non-intel driver can return anything else than
connector_status_connected in its detect callback.

Signed-Off-by: Daniel Vetter 
---
 drivers/gpu/drm/drm_crtc_helper.c |6 --
 drivers/gpu/drm/exynos/exynos_drm_connector.c |2 ++
 drivers/gpu/drm/gma500/cdv_intel_crt.c|2 ++
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c   |2 ++
 drivers/gpu/drm/gma500/mdfld_dsi_output.c |1 +
 drivers/gpu/drm/gma500/oaktrail_hdmi.c|2 ++
 drivers/gpu/drm/gma500/psb_intel_sdvo.c   |2 ++
 drivers/gpu/drm/i915/intel_crt.c  |3 ++-
 drivers/gpu/drm/i915/intel_tv.c   |3 ++-
 drivers/gpu/drm/nouveau/nouveau_connector.c   |1 +
 drivers/gpu/drm/radeon/radeon_connectors.c|5 +
 drivers/gpu/drm/udl/udl_connector.c   |2 ++
 drivers/staging/omapdrm/omap_connector.c  |2 ++
 include/drm/drm_crtc.h|4 
 14 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index b1d643d..8ea1c1e 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -944,7 +944,9 @@ static void output_poll_execute(struct work_struct *work)

/* Ignore HDP capable connectors and connectors where we don't
 * want any hotplug detection at all for polling. */
-   if (!connector->polled || connector->polled == 
DRM_CONNECTOR_POLL_HPD)
+   if (!connector->polled ||
+   connector->polled == DRM_CONNECTOR_POLL_FORCE ||
+   (connector->polled & DRM_CONNECTOR_POLL_HPD))
continue;

else if (connector->polled & (DRM_CONNECTOR_POLL_CONNECT | 
DRM_CONNECTOR_POLL_DISCONNECT))
@@ -1029,7 +1031,7 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
list_for_each_entry(connector, >mode_config.connector_list, head) {

/* Only handle HPD capable connectors. */
-   if (connector->polled != DRM_CONNECTOR_POLL_HPD)
+   if (!(connector->polled & DRM_CONNECTOR_POLL_HPD))
continue;

old_status = connector->status;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c 
b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index bf791fa..e5a8a27 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -327,6 +327,8 @@ struct drm_connector *exynos_drm_connector_create(struct 
drm_device *dev,
drm_connector_init(dev, connector, _connector_funcs, type);
drm_connector_helper_add(connector, _connector_helper_funcs);

+   connector->polled |= DRM_CONNECTOR_POLL_FORCE;
+
err = drm_sysfs_connector_add(connector);
if (err)
goto err_connector;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c 
b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index 1874220..e6b2e49 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -313,6 +313,8 @@ void cdv_intel_crt_init(struct drm_device *dev,
drm_connector_helper_add(connector,
_intel_crt_connector_helper_funcs);

+   connector->polled |= DRM_CONNECTOR_POLL_FORCE;
+
drm_sysfs_connector_add(connector);

return;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c 
b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index 88b59d4..766aec8 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -373,6 +373,8 @@ void cdv_hdmi_init(struct drm_device *dev,
hdmi_priv->hdmi_i2c_adapter =
&(psb_intel_encoder->i2c_bus->adapter);
hdmi_priv->dev = dev;
+   connector->polled |= DRM_CONNECTOR_POLL_FORCE;
+
drm_sysfs_connector_add(connector);
return;

diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c 
b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
index 5675d93..0e97a91 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
@@ -604,6 +604,7 @@ void mdfld_dsi_output_init(struct drm_device *dev,

[PATCH 03/14] drm: introduce DRM_CONNECTOR_POLL_FORCE

2012-05-24 Thread Daniel Vetter
Useful for -detect functions that have different behaviour if force
is set. This way probe_single_connector can avoid to do the expensive
edid dance on connectors where this is not needed.

I've checked through all drivers and set this flag everywhere where
the connector-detect function has different behaviour if force is
set. For nouveau and radeon I've got lost in the code traces, so I've
set this flag unconditionally.

Note that we also need to update the poll_execute function to now
also ignore connectors which have only this new flag set.

v2: Change POLL_HDP checks so that they ignore POLL_FORCE for both the
poll and the hpd handling code.

v3: Sprinkle POLL_FORCE more liberally over drivers. It should be now
everywhere where a non-intel driver can return anything else than
connector_status_connected in its detect callback.

Signed-Off-by: Daniel Vetter daniel.vet...@ffwll.ch
---
 drivers/gpu/drm/drm_crtc_helper.c |6 --
 drivers/gpu/drm/exynos/exynos_drm_connector.c |2 ++
 drivers/gpu/drm/gma500/cdv_intel_crt.c|2 ++
 drivers/gpu/drm/gma500/cdv_intel_hdmi.c   |2 ++
 drivers/gpu/drm/gma500/mdfld_dsi_output.c |1 +
 drivers/gpu/drm/gma500/oaktrail_hdmi.c|2 ++
 drivers/gpu/drm/gma500/psb_intel_sdvo.c   |2 ++
 drivers/gpu/drm/i915/intel_crt.c  |3 ++-
 drivers/gpu/drm/i915/intel_tv.c   |3 ++-
 drivers/gpu/drm/nouveau/nouveau_connector.c   |1 +
 drivers/gpu/drm/radeon/radeon_connectors.c|5 +
 drivers/gpu/drm/udl/udl_connector.c   |2 ++
 drivers/staging/omapdrm/omap_connector.c  |2 ++
 include/drm/drm_crtc.h|4 
 14 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/drm_crtc_helper.c 
b/drivers/gpu/drm/drm_crtc_helper.c
index b1d643d..8ea1c1e 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -944,7 +944,9 @@ static void output_poll_execute(struct work_struct *work)
 
/* Ignore HDP capable connectors and connectors where we don't
 * want any hotplug detection at all for polling. */
-   if (!connector-polled || connector-polled == 
DRM_CONNECTOR_POLL_HPD)
+   if (!connector-polled ||
+   connector-polled == DRM_CONNECTOR_POLL_FORCE ||
+   (connector-polled  DRM_CONNECTOR_POLL_HPD))
continue;
 
else if (connector-polled  (DRM_CONNECTOR_POLL_CONNECT | 
DRM_CONNECTOR_POLL_DISCONNECT))
@@ -1029,7 +1031,7 @@ void drm_helper_hpd_irq_event(struct drm_device *dev)
list_for_each_entry(connector, dev-mode_config.connector_list, head) {
 
/* Only handle HPD capable connectors. */
-   if (connector-polled != DRM_CONNECTOR_POLL_HPD)
+   if (!(connector-polled  DRM_CONNECTOR_POLL_HPD))
continue;
 
old_status = connector-status;
diff --git a/drivers/gpu/drm/exynos/exynos_drm_connector.c 
b/drivers/gpu/drm/exynos/exynos_drm_connector.c
index bf791fa..e5a8a27 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_connector.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_connector.c
@@ -327,6 +327,8 @@ struct drm_connector *exynos_drm_connector_create(struct 
drm_device *dev,
drm_connector_init(dev, connector, exynos_connector_funcs, type);
drm_connector_helper_add(connector, exynos_connector_helper_funcs);
 
+   connector-polled |= DRM_CONNECTOR_POLL_FORCE;
+
err = drm_sysfs_connector_add(connector);
if (err)
goto err_connector;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_crt.c 
b/drivers/gpu/drm/gma500/cdv_intel_crt.c
index 1874220..e6b2e49 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_crt.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_crt.c
@@ -313,6 +313,8 @@ void cdv_intel_crt_init(struct drm_device *dev,
drm_connector_helper_add(connector,
cdv_intel_crt_connector_helper_funcs);
 
+   connector-polled |= DRM_CONNECTOR_POLL_FORCE;
+
drm_sysfs_connector_add(connector);
 
return;
diff --git a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c 
b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
index 88b59d4..766aec8 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_hdmi.c
@@ -373,6 +373,8 @@ void cdv_hdmi_init(struct drm_device *dev,
hdmi_priv-hdmi_i2c_adapter =
(psb_intel_encoder-i2c_bus-adapter);
hdmi_priv-dev = dev;
+   connector-polled |= DRM_CONNECTOR_POLL_FORCE;
+
drm_sysfs_connector_add(connector);
return;
 
diff --git a/drivers/gpu/drm/gma500/mdfld_dsi_output.c 
b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
index 5675d93..0e97a91 100644
--- a/drivers/gpu/drm/gma500/mdfld_dsi_output.c
+++ b/drivers/gpu/drm/gma500/mdfld_dsi_output.c
@@ -604,6 +604,7 @@ void mdfld_dsi_output_init(struct