summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/drm_crtc.c77
-rw-r--r--linux-core/drm_crtc.h3
-rw-r--r--linux-core/intel_crt.c4
-rw-r--r--linux-core/intel_tv.c2
4 files changed, 55 insertions, 31 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index aab936c2..b6e636e0 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -43,10 +43,10 @@ struct drm_prop_enum_list {
* Global properties
*/
static struct drm_prop_enum_list drm_dpms_enum_list[] =
-{ { DPMSModeOn, "On" },
- { DPMSModeStandby, "Standby" },
- { DPMSModeSuspend, "Suspend" },
- { DPMSModeOff, "Off" }
+{ { DPMSModeOn, "On" },
+ { DPMSModeStandby, "Standby" },
+ { DPMSModeSuspend, "Suspend" },
+ { DPMSModeOff, "Off" }
};
char *drm_get_dpms_name(int val)
@@ -61,26 +61,26 @@ char *drm_get_dpms_name(int val)
}
static struct drm_prop_enum_list drm_connector_enum_list[] =
-{ { DRM_MODE_CONNECTOR_Unknown, "Unknown" },
- { DRM_MODE_CONNECTOR_VGA, "VGA" },
- { DRM_MODE_CONNECTOR_DVII, "DVI-I" },
- { DRM_MODE_CONNECTOR_DVID, "DVI-D" },
- { DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
- { DRM_MODE_CONNECTOR_Composite, "Composite" },
- { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO" },
- { DRM_MODE_CONNECTOR_LVDS, "LVDS" },
- { DRM_MODE_CONNECTOR_Component, "Component" },
- { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN" },
- { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort" },
- { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A" },
- { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B" },
+{ { DRM_MODE_CONNECTOR_Unknown, "Unknown" },
+ { DRM_MODE_CONNECTOR_VGA, "VGA" },
+ { DRM_MODE_CONNECTOR_DVII, "DVI-I" },
+ { DRM_MODE_CONNECTOR_DVID, "DVI-D" },
+ { DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
+ { DRM_MODE_CONNECTOR_Composite, "Composite" },
+ { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO" },
+ { DRM_MODE_CONNECTOR_LVDS, "LVDS" },
+ { DRM_MODE_CONNECTOR_Component, "Component" },
+ { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN" },
+ { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort" },
+ { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A" },
+ { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B" },
};
static struct drm_prop_enum_list drm_encoder_enum_list[] =
-{ { DRM_MODE_ENCODER_NONE, "None" },
- { DRM_MODE_ENCODER_DAC, "DAC" },
- { DRM_MODE_ENCODER_TMDS, "TMDS" },
- { DRM_MODE_ENCODER_LVDS, "LVDS" },
- { DRM_MODE_ENCODER_TVDAC, "TV" },
+{ { DRM_MODE_ENCODER_NONE, "None" },
+ { DRM_MODE_ENCODER_DAC, "DAC" },
+ { DRM_MODE_ENCODER_TMDS, "TMDS" },
+ { DRM_MODE_ENCODER_LVDS, "LVDS" },
+ { DRM_MODE_ENCODER_TVDAC, "TV" },
};
char *drm_get_encoder_name(struct drm_encoder *encoder)
@@ -164,7 +164,7 @@ static void drm_mode_object_put(struct drm_device *dev, struct drm_mode_object *
static void *drm_mode_object_find(struct drm_device *dev, uint32_t id, uint32_t type)
{
struct drm_mode_object *obj;
-
+
obj = idr_find(&dev->mode_config.crtc_idr, id);
if (!obj || (obj->type != type) || (obj->id != id))
return NULL;
@@ -369,8 +369,6 @@ void drm_connector_init(struct drm_device *dev,
drm_connector_attach_property(connector, dev->mode_config.edid_property, 0);
- drm_connector_attach_property(connector, dev->mode_config.dpms_property, 0);
-
mutex_unlock(&dev->mode_config.mutex);
}
EXPORT_SYMBOL(drm_connector_init);
@@ -479,8 +477,6 @@ EXPORT_SYMBOL(drm_mode_destroy);
static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
{
- int i;
-
/*
* Standard properties (apply to all connectors)
*/
@@ -488,6 +484,24 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
drm_property_create(dev, DRM_MODE_PROP_BLOB | DRM_MODE_PROP_IMMUTABLE,
"EDID", 0);
+ return 0;
+}
+
+/**
+ * drm_mode_create_dpms_property - create dpms connector property
+ * @dev: DRM device
+ *
+ * Called by a driver wanting to support the dpms property.
+ * Caller is responsible for attaching it to the appropriate connector.
+ */
+bool drm_mode_create_dpms_property(struct drm_device *dev)
+{
+ int i;
+
+ /* already allocated */
+ if (dev->mode_config.dpms_property)
+ return 0;
+
dev->mode_config.dpms_property =
drm_property_create(dev, DRM_MODE_PROP_ENUM,
"DPMS", ARRAY_SIZE(drm_dpms_enum_list));
@@ -496,6 +510,7 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
return 0;
}
+EXPORT_SYMBOL(drm_mode_create_dpms_property);
/**
* drm_create_tv_properties - create TV specific connector properties
@@ -508,11 +523,15 @@ static int drm_mode_create_standard_connector_properties(struct drm_device *dev)
* responsible for allocating a list of format names and passing them to
* this routine.
*/
-bool drm_create_tv_properties(struct drm_device *dev, int num_modes,
+bool drm_mode_create_tv_properties(struct drm_device *dev, int num_modes,
char *modes[])
{
int i;
+ /* already allocated */
+ if (dev->mode_config.tv_mode_property)
+ return 0;
+
dev->mode_config.tv_left_margin_property =
drm_property_create(dev, DRM_MODE_PROP_RANGE |
DRM_MODE_PROP_IMMUTABLE,
@@ -547,7 +566,7 @@ bool drm_create_tv_properties(struct drm_device *dev, int num_modes,
return 0;
}
-EXPORT_SYMBOL(drm_create_tv_properties);
+EXPORT_SYMBOL(drm_mode_create_tv_properties);
/**
* drm_mode_config_init - initialize DRM mode_configuration structure
diff --git a/linux-core/drm_crtc.h b/linux-core/drm_crtc.h
index d6fa4cca..b94e91a1 100644
--- a/linux-core/drm_crtc.h
+++ b/linux-core/drm_crtc.h
@@ -677,7 +677,8 @@ extern struct drm_property *drm_property_create(struct drm_device *dev, int flag
extern void drm_property_destroy(struct drm_device *dev, struct drm_property *property);
extern int drm_property_add_enum(struct drm_property *property, int index,
uint64_t value, const char *name);
-extern bool drm_create_tv_properties(struct drm_device *dev, int num_formats,
+extern bool drm_mode_create_dpms_property(struct drm_device *dev);
+extern bool drm_mode_create_tv_properties(struct drm_device *dev, int num_formats,
char *formats[]);
extern char *drm_get_encoder_name(struct drm_encoder *encoder);
diff --git a/linux-core/intel_crt.c b/linux-core/intel_crt.c
index b9e8ee63..c7509d5e 100644
--- a/linux-core/intel_crt.c
+++ b/linux-core/intel_crt.c
@@ -292,5 +292,9 @@ void intel_crt_init(struct drm_device *dev)
drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs);
drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
+ /* create dpms property */
+ drm_mode_create_dpms_property(dev);
+ drm_connector_attach_property(connector, dev->mode_config.dpms_property, 0);
+
drm_sysfs_connector_add(connector);
}
diff --git a/linux-core/intel_tv.c b/linux-core/intel_tv.c
index 39f33d6c..f564fa91 100644
--- a/linux-core/intel_tv.c
+++ b/linux-core/intel_tv.c
@@ -1713,7 +1713,7 @@ intel_tv_init(struct drm_device *dev)
goto out;
for (i = 0; i < NUM_TV_MODES; i++)
tv_format_names[i] = tv_modes[i].name;
- drm_create_tv_properties(dev, NUM_TV_MODES, tv_format_names);
+ drm_mode_create_tv_properties(dev, NUM_TV_MODES, tv_format_names);
drm_connector_attach_property(connector, dev->mode_config.tv_mode_property,
initial_mode);