aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2009-06-04 18:23:39 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-04 18:23:39 -0400
commitb63254c71a46d7af2e3f00342b0592dfcd77b342 (patch)
treecdf9a2b48358b1843bf4e67bb80dde490d04c1fc
parent730c586ad5228c339949b2eb4e72b80ae167abc4 (diff)
parentfc43896630a421321a19d7970bac27ac94e9d162 (diff)
Merge branch 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6
* 'drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/airlied/drm-2.6: drm: ignore EDID with really tiny modes. drm: don't associate _DRM_DRIVER maps with a master drm/i915: intel_lvds.c fix section mismatch drm: Hook up DPMS property handling in drm_crtc.c. Add drm_helper_connector_dpms. drm: set permissions on edid file to 0444 drm: add newlines to text sysfs files drm/radeon: fix ring free alignment calculations drm: fix irq naming for kms drivers.
-rw-r--r--drivers/gpu/drm/drm_bufs.c3
-rw-r--r--drivers/gpu/drm/drm_crtc.c7
-rw-r--r--drivers/gpu/drm/drm_crtc_helper.c109
-rw-r--r--drivers/gpu/drm/drm_edid.c5
-rw-r--r--drivers/gpu/drm/drm_irq.c8
-rw-r--r--drivers/gpu/drm/drm_sysfs.c7
-rw-r--r--drivers/gpu/drm/i915/i915_dma.c12
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c6
-rw-r--r--drivers/gpu/drm/i915/intel_dvo.c1
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c1
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c8
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c1
-rw-r--r--drivers/gpu/drm/i915/intel_tv.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_cp.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.h5
-rw-r--r--include/drm/drm_crtc.h3
-rw-r--r--include/drm/drm_crtc_helper.h2
17 files changed, 151 insertions, 32 deletions
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
index 0411d912d82a..80a257554b30 100644
--- a/drivers/gpu/drm/drm_bufs.c
+++ b/drivers/gpu/drm/drm_bufs.c
@@ -371,7 +371,8 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset,
371 list->user_token = list->hash.key << PAGE_SHIFT; 371 list->user_token = list->hash.key << PAGE_SHIFT;
372 mutex_unlock(&dev->struct_mutex); 372 mutex_unlock(&dev->struct_mutex);
373 373
374 list->master = dev->primary->master; 374 if (!(map->flags & _DRM_DRIVER))
375 list->master = dev->primary->master;
375 *maplist = list; 376 *maplist = list;
376 return 0; 377 return 0;
377 } 378 }
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
index 94a768871734..8fab7890a363 100644
--- a/drivers/gpu/drm/drm_crtc.c
+++ b/drivers/gpu/drm/drm_crtc.c
@@ -2294,7 +2294,12 @@ int drm_mode_connector_property_set_ioctl(struct drm_device *dev,
2294 } 2294 }
2295 } 2295 }
2296 2296
2297 if (connector->funcs->set_property) 2297 /* Do DPMS ourselves */
2298 if (property == connector->dev->mode_config.dpms_property) {
2299 if (connector->funcs->dpms)
2300 (*connector->funcs->dpms)(connector, (int) out_resp->value);
2301 ret = 0;
2302 } else if (connector->funcs->set_property)
2298 ret = connector->funcs->set_property(connector, property, out_resp->value); 2303 ret = connector->funcs->set_property(connector, property, out_resp->value);
2299 2304
2300 /* store the property value if succesful */ 2305 /* store the property value if succesful */
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c
index 45890447feec..a6f73f1e99d9 100644
--- a/drivers/gpu/drm/drm_crtc_helper.c
+++ b/drivers/gpu/drm/drm_crtc_helper.c
@@ -199,6 +199,29 @@ static void drm_helper_add_std_modes(struct drm_device *dev,
199} 199}
200 200
201/** 201/**
202 * drm_helper_encoder_in_use - check if a given encoder is in use
203 * @encoder: encoder to check
204 *
205 * LOCKING:
206 * Caller must hold mode config lock.
207 *
208 * Walk @encoders's DRM device's mode_config and see if it's in use.
209 *
210 * RETURNS:
211 * True if @encoder is part of the mode_config, false otherwise.
212 */
213bool drm_helper_encoder_in_use(struct drm_encoder *encoder)
214{
215 struct drm_connector *connector;
216 struct drm_device *dev = encoder->dev;
217 list_for_each_entry(connector, &dev->mode_config.connector_list, head)
218 if (connector->encoder == encoder)
219 return true;
220 return false;
221}
222EXPORT_SYMBOL(drm_helper_encoder_in_use);
223
224/**
202 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config 225 * drm_helper_crtc_in_use - check if a given CRTC is in a mode_config
203 * @crtc: CRTC to check 226 * @crtc: CRTC to check
204 * 227 *
@@ -216,7 +239,7 @@ bool drm_helper_crtc_in_use(struct drm_crtc *crtc)
216 struct drm_device *dev = crtc->dev; 239 struct drm_device *dev = crtc->dev;
217 /* FIXME: Locking around list access? */ 240 /* FIXME: Locking around list access? */
218 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) 241 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head)
219 if (encoder->crtc == crtc) 242 if (encoder->crtc == crtc && drm_helper_encoder_in_use(encoder))
220 return true; 243 return true;
221 return false; 244 return false;
222} 245}
@@ -240,7 +263,7 @@ void drm_helper_disable_unused_functions(struct drm_device *dev)
240 263
241 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { 264 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
242 encoder_funcs = encoder->helper_private; 265 encoder_funcs = encoder->helper_private;
243 if (!encoder->crtc) 266 if (!drm_helper_encoder_in_use(encoder))
244 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF); 267 (*encoder_funcs->dpms)(encoder, DRM_MODE_DPMS_OFF);
245 } 268 }
246 269
@@ -935,6 +958,88 @@ bool drm_helper_initial_config(struct drm_device *dev)
935} 958}
936EXPORT_SYMBOL(drm_helper_initial_config); 959EXPORT_SYMBOL(drm_helper_initial_config);
937 960
961static int drm_helper_choose_encoder_dpms(struct drm_encoder *encoder)
962{
963 int dpms = DRM_MODE_DPMS_OFF;
964 struct drm_connector *connector;
965 struct drm_device *dev = encoder->dev;
966
967 list_for_each_entry(connector, &dev->mode_config.connector_list, head)
968 if (connector->encoder == encoder)
969 if (connector->dpms < dpms)
970 dpms = connector->dpms;
971 return dpms;
972}
973
974static int drm_helper_choose_crtc_dpms(struct drm_crtc *crtc)
975{
976 int dpms = DRM_MODE_DPMS_OFF;
977 struct drm_connector *connector;
978 struct drm_device *dev = crtc->dev;
979
980 list_for_each_entry(connector, &dev->mode_config.connector_list, head)
981 if (connector->encoder && connector->encoder->crtc == crtc)
982 if (connector->dpms < dpms)
983 dpms = connector->dpms;
984 return dpms;
985}
986
987/**
988 * drm_helper_connector_dpms
989 * @connector affected connector
990 * @mode DPMS mode
991 *
992 * Calls the low-level connector DPMS function, then
993 * calls appropriate encoder and crtc DPMS functions as well
994 */
995void drm_helper_connector_dpms(struct drm_connector *connector, int mode)
996{
997 struct drm_encoder *encoder = connector->encoder;
998 struct drm_crtc *crtc = encoder ? encoder->crtc : NULL;
999 int old_dpms;
1000
1001 if (mode == connector->dpms)
1002 return;
1003
1004 old_dpms = connector->dpms;
1005 connector->dpms = mode;
1006
1007 /* from off to on, do crtc then encoder */
1008 if (mode < old_dpms) {
1009 if (crtc) {
1010 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
1011 if (crtc_funcs->dpms)
1012 (*crtc_funcs->dpms) (crtc,
1013 drm_helper_choose_crtc_dpms(crtc));
1014 }
1015 if (encoder) {
1016 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
1017 if (encoder_funcs->dpms)
1018 (*encoder_funcs->dpms) (encoder,
1019 drm_helper_choose_encoder_dpms(encoder));
1020 }
1021 }
1022
1023 /* from on to off, do encoder then crtc */
1024 if (mode > old_dpms) {
1025 if (encoder) {
1026 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
1027 if (encoder_funcs->dpms)
1028 (*encoder_funcs->dpms) (encoder,
1029 drm_helper_choose_encoder_dpms(encoder));
1030 }
1031 if (crtc) {
1032 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
1033 if (crtc_funcs->dpms)
1034 (*crtc_funcs->dpms) (crtc,
1035 drm_helper_choose_crtc_dpms(crtc));
1036 }
1037 }
1038
1039 return;
1040}
1041EXPORT_SYMBOL(drm_helper_connector_dpms);
1042
938/** 1043/**
939 * drm_hotplug_stage_two 1044 * drm_hotplug_stage_two
940 * @dev DRM device 1045 * @dev DRM device
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index ca9c61656714..6f6b26479d82 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -289,6 +289,11 @@ static struct drm_display_mode *drm_mode_detailed(struct drm_device *dev,
289 struct drm_display_mode *mode; 289 struct drm_display_mode *mode;
290 struct detailed_pixel_timing *pt = &timing->data.pixel_data; 290 struct detailed_pixel_timing *pt = &timing->data.pixel_data;
291 291
292 /* ignore tiny modes */
293 if (((pt->hactive_hi << 8) | pt->hactive_lo) < 64 ||
294 ((pt->vactive_hi << 8) | pt->hactive_lo) < 64)
295 return NULL;
296
292 if (pt->stereo) { 297 if (pt->stereo) {
293 printk(KERN_WARNING "stereo mode not supported\n"); 298 printk(KERN_WARNING "stereo mode not supported\n");
294 return NULL; 299 return NULL;
diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
index 93e677a481f5..fc8e5acd9d9a 100644
--- a/drivers/gpu/drm/drm_irq.c
+++ b/drivers/gpu/drm/drm_irq.c
@@ -196,6 +196,7 @@ int drm_irq_install(struct drm_device *dev)
196{ 196{
197 int ret = 0; 197 int ret = 0;
198 unsigned long sh_flags = 0; 198 unsigned long sh_flags = 0;
199 char *irqname;
199 200
200 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ)) 201 if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
201 return -EINVAL; 202 return -EINVAL;
@@ -227,8 +228,13 @@ int drm_irq_install(struct drm_device *dev)
227 if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED)) 228 if (drm_core_check_feature(dev, DRIVER_IRQ_SHARED))
228 sh_flags = IRQF_SHARED; 229 sh_flags = IRQF_SHARED;
229 230
231 if (dev->devname)
232 irqname = dev->devname;
233 else
234 irqname = dev->driver->name;
235
230 ret = request_irq(drm_dev_to_irq(dev), dev->driver->irq_handler, 236 ret = request_irq(drm_dev_to_irq(dev), dev->driver->irq_handler,
231 sh_flags, dev->devname, dev); 237 sh_flags, irqname, dev);
232 238
233 if (ret < 0) { 239 if (ret < 0) {
234 mutex_lock(&dev->struct_mutex); 240 mutex_lock(&dev->struct_mutex);
diff --git a/drivers/gpu/drm/drm_sysfs.c b/drivers/gpu/drm/drm_sysfs.c
index 8f9372921f82..9987ab880835 100644
--- a/drivers/gpu/drm/drm_sysfs.c
+++ b/drivers/gpu/drm/drm_sysfs.c
@@ -147,7 +147,7 @@ static ssize_t status_show(struct device *device,
147 enum drm_connector_status status; 147 enum drm_connector_status status;
148 148
149 status = connector->funcs->detect(connector); 149 status = connector->funcs->detect(connector);
150 return snprintf(buf, PAGE_SIZE, "%s", 150 return snprintf(buf, PAGE_SIZE, "%s\n",
151 drm_get_connector_status_name(status)); 151 drm_get_connector_status_name(status));
152} 152}
153 153
@@ -166,7 +166,7 @@ static ssize_t dpms_show(struct device *device,
166 if (ret) 166 if (ret)
167 return 0; 167 return 0;
168 168
169 return snprintf(buf, PAGE_SIZE, "%s", 169 return snprintf(buf, PAGE_SIZE, "%s\n",
170 drm_get_dpms_name((int)dpms_status)); 170 drm_get_dpms_name((int)dpms_status));
171} 171}
172 172
@@ -176,7 +176,7 @@ static ssize_t enabled_show(struct device *device,
176{ 176{
177 struct drm_connector *connector = to_drm_connector(device); 177 struct drm_connector *connector = to_drm_connector(device);
178 178
179 return snprintf(buf, PAGE_SIZE, connector->encoder ? "enabled" : 179 return snprintf(buf, PAGE_SIZE, "%s\n", connector->encoder ? "enabled" :
180 "disabled"); 180 "disabled");
181} 181}
182 182
@@ -317,6 +317,7 @@ static struct device_attribute connector_attrs_opt1[] = {
317 317
318static struct bin_attribute edid_attr = { 318static struct bin_attribute edid_attr = {
319 .attr.name = "edid", 319 .attr.name = "edid",
320 .attr.mode = 0444,
320 .size = 128, 321 .size = 128,
321 .read = edid_show, 322 .read = edid_show,
322}; 323};
diff --git a/drivers/gpu/drm/i915/i915_dma.c b/drivers/gpu/drm/i915/i915_dma.c
index 53d544552625..0ccb63ee50ee 100644
--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -987,12 +987,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
987 int fb_bar = IS_I9XX(dev) ? 2 : 0; 987 int fb_bar = IS_I9XX(dev) ? 2 : 0;
988 int ret = 0; 988 int ret = 0;
989 989
990 dev->devname = kstrdup(DRIVER_NAME, GFP_KERNEL);
991 if (!dev->devname) {
992 ret = -ENOMEM;
993 goto out;
994 }
995
996 dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) & 990 dev->mode_config.fb_base = drm_get_resource_start(dev, fb_bar) &
997 0xff000000; 991 0xff000000;
998 992
@@ -1006,7 +1000,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
1006 1000
1007 ret = i915_probe_agp(dev, &agp_size, &prealloc_size); 1001 ret = i915_probe_agp(dev, &agp_size, &prealloc_size);
1008 if (ret) 1002 if (ret)
1009 goto kfree_devname; 1003 goto out;
1010 1004
1011 /* Basic memrange allocator for stolen space (aka vram) */ 1005 /* Basic memrange allocator for stolen space (aka vram) */
1012 drm_mm_init(&dev_priv->vram, 0, prealloc_size); 1006 drm_mm_init(&dev_priv->vram, 0, prealloc_size);
@@ -1024,7 +1018,7 @@ static int i915_load_modeset_init(struct drm_device *dev)
1024 1018
1025 ret = i915_gem_init_ringbuffer(dev); 1019 ret = i915_gem_init_ringbuffer(dev);
1026 if (ret) 1020 if (ret)
1027 goto kfree_devname; 1021 goto out;
1028 1022
1029 /* Allow hardware batchbuffers unless told otherwise. 1023 /* Allow hardware batchbuffers unless told otherwise.
1030 */ 1024 */
@@ -1056,8 +1050,6 @@ static int i915_load_modeset_init(struct drm_device *dev)
1056 1050
1057destroy_ringbuffer: 1051destroy_ringbuffer:
1058 i915_gem_cleanup_ringbuffer(dev); 1052 i915_gem_cleanup_ringbuffer(dev);
1059kfree_devname:
1060 kfree(dev->devname);
1061out: 1053out:
1062 return ret; 1054 return ret;
1063} 1055}
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index 640f5158effc..79acc4f4c1f8 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -381,11 +381,6 @@ static int intel_crt_set_property(struct drm_connector *connector,
381 struct drm_property *property, 381 struct drm_property *property,
382 uint64_t value) 382 uint64_t value)
383{ 383{
384 struct drm_device *dev = connector->dev;
385
386 if (property == dev->mode_config.dpms_property && connector->encoder)
387 intel_crt_dpms(connector->encoder, (uint32_t)(value & 0xf));
388
389 return 0; 384 return 0;
390} 385}
391 386
@@ -402,6 +397,7 @@ static const struct drm_encoder_helper_funcs intel_crt_helper_funcs = {
402}; 397};
403 398
404static const struct drm_connector_funcs intel_crt_connector_funcs = { 399static const struct drm_connector_funcs intel_crt_connector_funcs = {
400 .dpms = drm_helper_connector_dpms,
405 .detect = intel_crt_detect, 401 .detect = intel_crt_detect,
406 .fill_modes = drm_helper_probe_single_connector_modes, 402 .fill_modes = drm_helper_probe_single_connector_modes,
407 .destroy = intel_crt_destroy, 403 .destroy = intel_crt_destroy,
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index 8b8d6e65cd3f..1ee3007d6ec0 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -316,6 +316,7 @@ static const struct drm_encoder_helper_funcs intel_dvo_helper_funcs = {
316}; 316};
317 317
318static const struct drm_connector_funcs intel_dvo_connector_funcs = { 318static const struct drm_connector_funcs intel_dvo_connector_funcs = {
319 .dpms = drm_helper_connector_dpms,
319 .save = intel_dvo_save, 320 .save = intel_dvo_save,
320 .restore = intel_dvo_restore, 321 .restore = intel_dvo_restore,
321 .detect = intel_dvo_detect, 322 .detect = intel_dvo_detect,
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index d0983bb93a18..7d6bdd705326 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -219,6 +219,7 @@ static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = {
219}; 219};
220 220
221static const struct drm_connector_funcs intel_hdmi_connector_funcs = { 221static const struct drm_connector_funcs intel_hdmi_connector_funcs = {
222 .dpms = drm_helper_connector_dpms,
222 .save = intel_hdmi_save, 223 .save = intel_hdmi_save,
223 .restore = intel_hdmi_restore, 224 .restore = intel_hdmi_restore,
224 .detect = intel_hdmi_detect, 225 .detect = intel_hdmi_detect,
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 53731f0ffcb5..53cccfa58b95 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -343,11 +343,6 @@ static int intel_lvds_set_property(struct drm_connector *connector,
343 struct drm_property *property, 343 struct drm_property *property,
344 uint64_t value) 344 uint64_t value)
345{ 345{
346 struct drm_device *dev = connector->dev;
347
348 if (property == dev->mode_config.dpms_property && connector->encoder)
349 intel_lvds_dpms(connector->encoder, (uint32_t)(value & 0xf));
350
351 return 0; 346 return 0;
352} 347}
353 348
@@ -366,6 +361,7 @@ static const struct drm_connector_helper_funcs intel_lvds_connector_helper_funcs
366}; 361};
367 362
368static const struct drm_connector_funcs intel_lvds_connector_funcs = { 363static const struct drm_connector_funcs intel_lvds_connector_funcs = {
364 .dpms = drm_helper_connector_dpms,
369 .save = intel_lvds_save, 365 .save = intel_lvds_save,
370 .restore = intel_lvds_restore, 366 .restore = intel_lvds_restore,
371 .detect = intel_lvds_detect, 367 .detect = intel_lvds_detect,
@@ -391,7 +387,7 @@ static int __init intel_no_lvds_dmi_callback(const struct dmi_system_id *id)
391} 387}
392 388
393/* These systems claim to have LVDS, but really don't */ 389/* These systems claim to have LVDS, but really don't */
394static const struct dmi_system_id __initdata intel_no_lvds[] = { 390static const struct dmi_system_id intel_no_lvds[] = {
395 { 391 {
396 .callback = intel_no_lvds_dmi_callback, 392 .callback = intel_no_lvds_dmi_callback,
397 .ident = "Apple Mac Mini (Core series)", 393 .ident = "Apple Mac Mini (Core series)",
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index f3ef6bfd8ffc..3093b4d4a4dd 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -1616,6 +1616,7 @@ static const struct drm_encoder_helper_funcs intel_sdvo_helper_funcs = {
1616}; 1616};
1617 1617
1618static const struct drm_connector_funcs intel_sdvo_connector_funcs = { 1618static const struct drm_connector_funcs intel_sdvo_connector_funcs = {
1619 .dpms = drm_helper_connector_dpms,
1619 .save = intel_sdvo_save, 1620 .save = intel_sdvo_save,
1620 .restore = intel_sdvo_restore, 1621 .restore = intel_sdvo_restore,
1621 .detect = intel_sdvo_detect, 1622 .detect = intel_sdvo_detect,
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index d2c32983242d..98ac0546b7bd 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -1626,6 +1626,7 @@ static const struct drm_encoder_helper_funcs intel_tv_helper_funcs = {
1626}; 1626};
1627 1627
1628static const struct drm_connector_funcs intel_tv_connector_funcs = { 1628static const struct drm_connector_funcs intel_tv_connector_funcs = {
1629 .dpms = drm_helper_connector_dpms,
1629 .save = intel_tv_save, 1630 .save = intel_tv_save,
1630 .restore = intel_tv_restore, 1631 .restore = intel_tv_restore,
1631 .detect = intel_tv_detect, 1632 .detect = intel_tv_detect,
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index 77a7a4d84650..aff90bb96488 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -2185,9 +2185,9 @@ void radeon_commit_ring(drm_radeon_private_t *dev_priv)
2185 2185
2186 /* check if the ring is padded out to 16-dword alignment */ 2186 /* check if the ring is padded out to 16-dword alignment */
2187 2187
2188 tail_aligned = dev_priv->ring.tail & 0xf; 2188 tail_aligned = dev_priv->ring.tail & (RADEON_RING_ALIGN-1);
2189 if (tail_aligned) { 2189 if (tail_aligned) {
2190 int num_p2 = 16 - tail_aligned; 2190 int num_p2 = RADEON_RING_ALIGN - tail_aligned;
2191 2191
2192 ring = dev_priv->ring.start; 2192 ring = dev_priv->ring.start;
2193 /* pad with some CP_PACKET2 */ 2193 /* pad with some CP_PACKET2 */
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h
index 8071d965f142..0c6bfc1de153 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.h
+++ b/drivers/gpu/drm/radeon/radeon_drv.h
@@ -1964,11 +1964,14 @@ do { \
1964 1964
1965#define RING_LOCALS int write, _nr, _align_nr; unsigned int mask; u32 *ring; 1965#define RING_LOCALS int write, _nr, _align_nr; unsigned int mask; u32 *ring;
1966 1966
1967#define RADEON_RING_ALIGN 16
1968
1967#define BEGIN_RING( n ) do { \ 1969#define BEGIN_RING( n ) do { \
1968 if ( RADEON_VERBOSE ) { \ 1970 if ( RADEON_VERBOSE ) { \
1969 DRM_INFO( "BEGIN_RING( %d )\n", (n)); \ 1971 DRM_INFO( "BEGIN_RING( %d )\n", (n)); \
1970 } \ 1972 } \
1971 _align_nr = (n + 0xf) & ~0xf; \ 1973 _align_nr = RADEON_RING_ALIGN - ((dev_priv->ring.tail + n) & (RADEON_RING_ALIGN-1)); \
1974 _align_nr += n; \
1972 if (dev_priv->ring.space <= (_align_nr * sizeof(u32))) { \ 1975 if (dev_priv->ring.space <= (_align_nr * sizeof(u32))) { \
1973 COMMIT_RING(); \ 1976 COMMIT_RING(); \
1974 radeon_wait_ring( dev_priv, _align_nr * sizeof(u32)); \ 1977 radeon_wait_ring( dev_priv, _align_nr * sizeof(u32)); \
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h
index 3c1924c010e8..7300fb866767 100644
--- a/include/drm/drm_crtc.h
+++ b/include/drm/drm_crtc.h
@@ -471,6 +471,9 @@ struct drm_connector {
471 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY]; 471 u32 property_ids[DRM_CONNECTOR_MAX_PROPERTY];
472 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY]; 472 uint64_t property_values[DRM_CONNECTOR_MAX_PROPERTY];
473 473
474 /* requested DPMS state */
475 int dpms;
476
474 void *helper_private; 477 void *helper_private;
475 478
476 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER]; 479 uint32_t encoder_ids[DRM_CONNECTOR_MAX_ENCODER];
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h
index ec073d8288d9..6769ff6c1bc0 100644
--- a/include/drm/drm_crtc_helper.h
+++ b/include/drm/drm_crtc_helper.h
@@ -99,6 +99,8 @@ extern bool drm_crtc_helper_set_mode(struct drm_crtc *crtc,
99 struct drm_framebuffer *old_fb); 99 struct drm_framebuffer *old_fb);
100extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc); 100extern bool drm_helper_crtc_in_use(struct drm_crtc *crtc);
101 101
102extern void drm_helper_connector_dpms(struct drm_connector *connector, int mode);
103
102extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb, 104extern int drm_helper_mode_fill_fb_struct(struct drm_framebuffer *fb,
103 struct drm_mode_fb_cmd *mode_cmd); 105 struct drm_mode_fb_cmd *mode_cmd);
104 106