modesetting-101: Make dpms property optional + misc cleanup.

- intel_crt seems the only one to provide it, so init it there.
main
Maarten Maathuis 2008-06-26 21:28:29 +02:00
parent 4d85d5d251
commit 13943fe582
4 changed files with 55 additions and 31 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);
}

View File

@ -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);