diff options
author | Dave Airlie <airlied@redhat.com> | 2008-11-10 15:37:16 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-11-10 15:37:16 +1000 |
commit | 195cc0d817f99e25a1e961deeabbb15a40b789ed (patch) | |
tree | d25283ee44cf7ee2f193d44f87b12be25539c152 | |
parent | 327631c8b50a90c8f694ffd9ebd0e5c618e99dff (diff) |
drm/radeon: add dpms connector functions
-rw-r--r-- | linux-core/drm_crtc.c | 2 | ||||
-rw-r--r-- | linux-core/drm_crtc_helper.c | 27 | ||||
-rw-r--r-- | linux-core/drm_crtc_helper.h | 2 | ||||
-rw-r--r-- | linux-core/radeon_connectors.c | 19 |
4 files changed, 49 insertions, 1 deletions
diff --git a/linux-core/drm_crtc.c b/linux-core/drm_crtc.c index 2f80ec07..bc385dce 100644 --- a/linux-core/drm_crtc.c +++ b/linux-core/drm_crtc.c @@ -1423,7 +1423,7 @@ int drm_mode_setcrtc(struct drm_device *dev, set.mode = mode; set.connectors = connector_set; set.num_connectors = crtc_req->count_connectors; - set.fb =fb; + set.fb = fb; ret = crtc->funcs->set_config(&set); out: diff --git a/linux-core/drm_crtc_helper.c b/linux-core/drm_crtc_helper.c index 58163e51..ebb44794 100644 --- a/linux-core/drm_crtc_helper.c +++ b/linux-core/drm_crtc_helper.c @@ -804,3 +804,30 @@ int drm_helper_resume_force_mode(struct drm_device *dev) return 0; } EXPORT_SYMBOL(drm_helper_resume_force_mode); + +void drm_helper_set_connector_dpms(struct drm_connector *connector, + int dpms_mode) +{ + int i = 0; + struct drm_encoder *encoder; + struct drm_encoder_helper_funcs *encoder_funcs; + struct drm_mode_object *obj; + + for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) { + if (connector->encoder_ids[i] == 0) + break; + + obj = drm_mode_object_find(connector->dev, + connector->encoder_ids[i], + DRM_MODE_OBJECT_ENCODER); + if (!obj) + continue; + + encoder = obj_to_encoder(obj); + encoder_funcs = encoder->helper_private; + if (encoder_funcs->dpms) + encoder_funcs->dpms(encoder, dpms_mode); + + } +} +EXPORT_SYMBOL(drm_helper_set_connector_dpms); diff --git a/linux-core/drm_crtc_helper.h b/linux-core/drm_crtc_helper.h index c0719157..a0dd6675 100644 --- a/linux-core/drm_crtc_helper.h +++ b/linux-core/drm_crtc_helper.h @@ -93,4 +93,6 @@ static inline void drm_connector_helper_add(struct drm_connector *connector, con } extern int drm_helper_resume_force_mode(struct drm_device *dev); +extern void drm_helper_set_connector_dpms(struct drm_connector *connector, + int dpms_mode); #endif diff --git a/linux-core/radeon_connectors.c b/linux-core/radeon_connectors.c index 18873f0f..be1dbae1 100644 --- a/linux-core/radeon_connectors.c +++ b/linux-core/radeon_connectors.c @@ -77,6 +77,22 @@ static struct drm_display_mode *radeon_fp_native_mode(struct drm_encoder *encode return mode; } +int radeon_connector_set_property(struct drm_connector *connector, struct drm_property *property, + uint64_t val) +{ + struct drm_device *dev = connector->dev; + + if (property == dev->mode_config.dpms_property) { + if (val > 3) + return -EINVAL; + + drm_helper_set_connector_dpms(connector, val); + + } + return 0; +} + + static int radeon_lvds_get_modes(struct drm_connector *connector) { struct radeon_connector *radeon_connector = to_radeon_connector(connector); @@ -146,6 +162,7 @@ struct drm_connector_funcs radeon_lvds_connector_funcs = { .detect = radeon_lvds_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = radeon_connector_destroy, + .set_property = radeon_connector_set_property, }; static int radeon_vga_get_modes(struct drm_connector *connector) @@ -197,6 +214,7 @@ struct drm_connector_funcs radeon_vga_connector_funcs = { .detect = radeon_vga_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = radeon_connector_destroy, + .set_property = radeon_connector_set_property, }; @@ -289,6 +307,7 @@ struct drm_connector_helper_funcs radeon_dvi_connector_helper_funcs = { struct drm_connector_funcs radeon_dvi_connector_funcs = { .detect = radeon_dvi_detect, .fill_modes = drm_helper_probe_single_connector_modes, + .set_property = radeon_connector_set_property, .destroy = radeon_connector_destroy, }; |