summaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorJesse Barnes <jbarnes@nietzche.virtuousgeek.org>2008-04-10 20:30:12 -0700
committerJesse Barnes <jbarnes@nietzche.virtuousgeek.org>2008-04-10 20:30:12 -0700
commit83c3acb7da1043a63d260d5443f7149b2c664b08 (patch)
tree95d9e0efef3bc72fa90ee4fac60ec74ce406f1db /linux-core
parentbee546ad696e3157b878dfa90e563786b5b5c7ac (diff)
Split TV property creation into its own routine
It needs to take arguments from the caller about supported TV formats, so declare it in drm_crtc.h and export it.
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/drm_crtc.c39
-rw-r--r--linux-core/drm_crtc.h2
2 files changed, 32 insertions, 9 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c
index b33edce7..1e5195db 100644
--- a/linux-core/drm_crtc.c
+++ b/linux-core/drm_crtc.c
@@ -767,9 +767,25 @@ static int drm_mode_create_standard_output_properties(struct drm_device *dev)
dev->mode_config.connector_num_property->values[0] = 0;
dev->mode_config.connector_num_property->values[1] = 20;
- /*
- * TV specific properties
- */
+ return 0;
+}
+
+/**
+ * drm_create_tv_properties - create TV specific output properties
+ * @dev: DRM device
+ * @num_modes: number of different TV formats (modes) supported
+ * @modes: array of pointers to strings containing name of each format
+ *
+ * Called by a driver's TV initialization routine, this function creates
+ * the TV specific output properties for a given device. Caller is
+ * 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,
+ char *modes[])
+{
+ int i;
+
dev->mode_config.tv_left_margin_property =
drm_property_create(dev, DRM_MODE_PROP_RANGE |
DRM_MODE_PROP_IMMUTABLE,
@@ -778,28 +794,33 @@ static int drm_mode_create_standard_output_properties(struct drm_device *dev)
dev->mode_config.tv_left_margin_property->values[1] = 100;
dev->mode_config.tv_right_margin_property =
- drm_property_create(dev, DRM_MODE_PROP_RANGE |
- DRM_MODE_PROP_IMMUTABLE,
+ drm_property_create(dev, DRM_MODE_PROP_RANGE,
"right margin", 2);
dev->mode_config.tv_right_margin_property->values[0] = 0;
dev->mode_config.tv_right_margin_property->values[1] = 100;
dev->mode_config.tv_top_margin_property =
- drm_property_create(dev, DRM_MODE_PROP_RANGE |
- DRM_MODE_PROP_IMMUTABLE,
+ drm_property_create(dev, DRM_MODE_PROP_RANGE,
"top margin", 2);
dev->mode_config.tv_top_margin_property->values[0] = 0;
dev->mode_config.tv_top_margin_property->values[1] = 100;
dev->mode_config.tv_bottom_margin_property =
- drm_property_create(dev, DRM_MODE_PROP_RANGE |
- DRM_MODE_PROP_IMMUTABLE,
+ drm_property_create(dev, DRM_MODE_PROP_RANGE,
"bottom margin", 2);
dev->mode_config.tv_bottom_margin_property->values[0] = 0;
dev->mode_config.tv_bottom_margin_property->values[1] = 100;
+ dev->mode_config.tv_mode_property =
+ drm_property_create(dev, DRM_MODE_PROP_ENUM,
+ "mode", num_modes);
+ for (i = 0; i < num_modes; i++)
+ drm_property_add_enum(dev->mode_config.tv_mode_property, i,
+ i, modes[i]);
+
return 0;
}
+EXPORT_SYMBOL(drm_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 74316aa5..20b1ea06 100644
--- a/linux-core/drm_crtc.h
+++ b/linux-core/drm_crtc.h
@@ -611,6 +611,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,
+ char *formats[]);
/* IOCTLs */
extern int drm_mode_getresources(struct drm_device *dev,