[Openchrome-devel] drm-openchrome: drivers/gpu/drm

James Simmons jsimmons at kemper.freedesktop.org
Tue Mar 26 07:08:27 PDT 2013


 drivers/gpu/drm/via/via_analog.c  |   40 +--------------------------------
 drivers/gpu/drm/via/via_display.c |   45 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/via/via_display.h |    5 ++++
 3 files changed, 52 insertions(+), 38 deletions(-)

New commits:
commit cc4296b4bb93119c3d0ec402b0cbfcd73b048d28
Author: James Simmons <jsimmons at infradead.org>
Date:   Tue Mar 26 10:08:18 2013 -0400

    Several pieces of code in the upcoming DVI handling is also shared with VGA handling so factor it out to be shared.

diff --git a/drivers/gpu/drm/via/via_analog.c b/drivers/gpu/drm/via/via_analog.c
index 221502d..e7e18ce 100644
--- a/drivers/gpu/drm/via/via_analog.c
+++ b/drivers/gpu/drm/via/via_analog.c
@@ -97,52 +97,16 @@ via_analog_detect(struct drm_connector *connector, bool force)
 	return ret;
 }
 
-static int
-via_analog_set_property(struct drm_connector *connector,
-		  struct drm_property *property,
-		  uint64_t value)
-{
-	struct drm_device *dev = connector->dev;
-
-	if (property == dev->mode_config.dpms_property && connector->encoder)
-		via_dac_dpms(connector->encoder, (uint32_t)(value & 0xf));
-	return 0;
-}
-
 static const struct drm_connector_funcs via_analog_connector_funcs = {
 	.dpms = drm_helper_connector_dpms,
 	.detect = via_analog_detect,
 	.fill_modes = drm_helper_probe_single_connector_modes,
-	.set_property = via_analog_set_property,
+	.set_property = via_connector_set_property,
 	.destroy = via_connector_destroy,
 };
 
-/* This function test if the drm_display_modes generated by a display
- * monitor that is connected is supported by the graphics card.
- */
-static int
-via_analog_mode_valid(struct drm_connector *connector,
-			struct drm_display_mode *mode)
-{
-	if ((mode->flags & DRM_MODE_FLAG_INTERLACE) &&
-	    !connector->interlace_allowed)
-		return MODE_NO_INTERLACE;
-
-	if ((mode->flags & DRM_MODE_FLAG_DBLSCAN) &&
-	    !connector->doublescan_allowed)
-		return MODE_NO_DBLESCAN;
-
-	/* Check Clock Range */
-	if (mode->clock > 400000)
-		return MODE_CLOCK_HIGH;
-	if (mode->clock < 25000)
-		return MODE_CLOCK_LOW;
-
-	return MODE_OK;
-}
-
 static const struct drm_connector_helper_funcs via_analog_connector_helper_funcs = {
-	.mode_valid = via_analog_mode_valid,
+	.mode_valid = via_connector_mode_valid,
 	.get_modes = via_get_edid_modes,
 	.best_encoder = via_best_encoder,
 };
diff --git a/drivers/gpu/drm/via/via_display.c b/drivers/gpu/drm/via/via_display.c
index 9f9cda8..99046d9 100644
--- a/drivers/gpu/drm/via/via_display.c
+++ b/drivers/gpu/drm/via/via_display.c
@@ -28,6 +28,9 @@
 
 #include "via_drv.h"
 
+/*
+ * Shared encoder routines.
+ */
 void
 via_encoder_commit(struct drm_encoder *encoder)
 {
@@ -278,6 +281,9 @@ via_best_encoder(struct drm_connector *connector)
 	return encoder;
 }
 
+/*
+ * Shared connector routines.
+ */
 int
 via_get_edid_modes(struct drm_connector *connector)
 {
@@ -287,6 +293,45 @@ via_get_edid_modes(struct drm_connector *connector)
 	return drm_add_edid_modes(connector, edid);
 }
 
+int
+via_connector_mode_valid(struct drm_connector *connector,
+			struct drm_display_mode *mode)
+{
+	if ((mode->flags & DRM_MODE_FLAG_INTERLACE) &&
+	    !connector->interlace_allowed)
+		return MODE_NO_INTERLACE;
+
+	if ((mode->flags & DRM_MODE_FLAG_DBLSCAN) &&
+	    !connector->doublescan_allowed)
+		return MODE_NO_DBLESCAN;
+
+	/* Check Clock Range */
+	if (mode->clock > 400000)
+		return MODE_CLOCK_HIGH;
+
+	if (mode->clock < 25000)
+		return MODE_CLOCK_LOW;
+
+	return MODE_OK;
+}
+
+int
+via_connector_set_property(struct drm_connector *connector,
+				struct drm_property *property, uint64_t value)
+{
+	struct drm_encoder *encoder = connector->encoder;
+	struct drm_encoder_helper_funcs *encoder_funcs;
+	struct drm_device *dev = connector->dev;
+
+	if (encoder) {
+		encoder_funcs = encoder->helper_private;
+
+		if (property == dev->mode_config.dpms_property)
+			encoder_funcs->dpms(encoder, (uint32_t)(value & 0xf));
+	}
+	return 0;
+}
+
 void
 via_connector_destroy(struct drm_connector *connector)
 {
diff --git a/drivers/gpu/drm/via/via_display.h b/drivers/gpu/drm/via/via_display.h
index 148f69a..02408a5 100644
--- a/drivers/gpu/drm/via/via_display.h
+++ b/drivers/gpu/drm/via/via_display.h
@@ -153,6 +153,11 @@ extern void via_encoder_disable(struct drm_encoder *encoder);
 extern void via_encoder_commit(struct drm_encoder *encoder);
 
 /* connectors */
+extern int via_connector_set_property(struct drm_connector *connector,
+					struct drm_property *property,
+					uint64_t value);
+extern int via_connector_mode_valid(struct drm_connector *connector,
+					struct drm_display_mode *mode);
 extern void via_connector_destroy(struct drm_connector *connector);
 extern int via_get_edid_modes(struct drm_connector *connector);
 


More information about the Openchrome-devel mailing list