diff options
author | Dave Airlie <airlied@redhat.com> | 2014-05-15 21:47:13 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2014-05-15 21:47:13 -0400 |
commit | 425a9a3ad1e64a00b4dbc827ae58df2aaf10ef43 (patch) | |
tree | 24486fa04e292f875b7944f7086527819e72862b | |
parent | ad222799bec32a2db99c12b4dfa5dc19a1f6eaac (diff) | |
parent | a74591d781a8e445e8d5aec8a8bb9ec43a31138b (diff) |
Merge tag 'topic/core-stuff-2014-05-05' of git://anongit.freedesktop.org/drm-intel into drm-next
Update pull request with drm core patches. Mostly some polish for the
primary plane stuff and a pile of patches all over from Thierry. Has
survived a few days in drm-intel-nightly without causing ill.
I've frobbed my scripts a bit to also tag my topic branches so that you
have something stable to pull - I've accidentally pushed a bunch more
patches onto this branch before you've taken the old pull request.
* tag 'topic/core-stuff-2014-05-05' of git://anongit.freedesktop.org/drm-intel:
drm: Make drm_crtc_helper_disable() return void
drm: Fix indentation of closing brace
drm/dp: Fix typo in comment
drm: Fixup flip-work kerneldoc
drm/fb: Fix typos
drm/edid: Cleanup kerneldoc
drm/edid: Drop revision argument for drm_mode_std()
drm: Try to acquire modeset lock on panic or sysrq
drm: remove unused argument from drm_open_helper
drm: Handle ->disable_plane failures correctly
drm: Simplify fb refcounting rules around ->update_plane
drm/crtc-helper: gc usless connector loop in disable_unused_functions
drm/plane_helper: don't disable plane in destroy function
drm/plane-helper: Fix primary plane scaling check
drm: make mode_valid callback optional
drm/edid: Fill PAR in AVI infoframe based on CEA mode list
28 files changed, 153 insertions, 183 deletions
diff --git a/Documentation/DocBook/drm.tmpl b/Documentation/DocBook/drm.tmpl index 83dd0b043c28..165749dec5af 100644 --- a/Documentation/DocBook/drm.tmpl +++ b/Documentation/DocBook/drm.tmpl | |||
@@ -1895,8 +1895,8 @@ void intel_crt_init(struct drm_device *dev) | |||
1895 | <para> | 1895 | <para> |
1896 | The function filters out modes larger than | 1896 | The function filters out modes larger than |
1897 | <parameter>max_width</parameter> and <parameter>max_height</parameter> | 1897 | <parameter>max_width</parameter> and <parameter>max_height</parameter> |
1898 | if specified. It then calls the connector | 1898 | if specified. It then calls the optional connector |
1899 | <methodname>mode_valid</methodname> helper operation for each mode in | 1899 | <methodname>mode_valid</methodname> helper operation for each mode in |
1900 | the probed list to check whether the mode is valid for the connector. | 1900 | the probed list to check whether the mode is valid for the connector. |
1901 | </para> | 1901 | </para> |
1902 | </listitem> | 1902 | </listitem> |
@@ -2257,7 +2257,7 @@ void intel_crt_init(struct drm_device *dev) | |||
2257 | <para> | 2257 | <para> |
2258 | Verify whether a mode is valid for the connector. Return MODE_OK for | 2258 | Verify whether a mode is valid for the connector. Return MODE_OK for |
2259 | supported modes and one of the enum drm_mode_status values (MODE_*) | 2259 | supported modes and one of the enum drm_mode_status values (MODE_*) |
2260 | for unsupported modes. This operation is mandatory. | 2260 | for unsupported modes. This operation is optional. |
2261 | </para> | 2261 | </para> |
2262 | <para> | 2262 | <para> |
2263 | As the mode rejection reason is currently not used beside for | 2263 | As the mode rejection reason is currently not used beside for |
diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index a4afdc8bb578..e599d64a2620 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c | |||
@@ -743,12 +743,6 @@ static int ast_get_modes(struct drm_connector *connector) | |||
743 | return 0; | 743 | return 0; |
744 | } | 744 | } |
745 | 745 | ||
746 | static int ast_mode_valid(struct drm_connector *connector, | ||
747 | struct drm_display_mode *mode) | ||
748 | { | ||
749 | return MODE_OK; | ||
750 | } | ||
751 | |||
752 | static void ast_connector_destroy(struct drm_connector *connector) | 746 | static void ast_connector_destroy(struct drm_connector *connector) |
753 | { | 747 | { |
754 | struct ast_connector *ast_connector = to_ast_connector(connector); | 748 | struct ast_connector *ast_connector = to_ast_connector(connector); |
@@ -765,7 +759,6 @@ ast_connector_detect(struct drm_connector *connector, bool force) | |||
765 | } | 759 | } |
766 | 760 | ||
767 | static const struct drm_connector_helper_funcs ast_connector_helper_funcs = { | 761 | static const struct drm_connector_helper_funcs ast_connector_helper_funcs = { |
768 | .mode_valid = ast_mode_valid, | ||
769 | .get_modes = ast_get_modes, | 762 | .get_modes = ast_get_modes, |
770 | .best_encoder = ast_best_single_encoder, | 763 | .best_encoder = ast_best_single_encoder, |
771 | }; | 764 | }; |
diff --git a/drivers/gpu/drm/bridge/ptn3460.c b/drivers/gpu/drm/bridge/ptn3460.c index b171901a3553..98fd17ae4916 100644 --- a/drivers/gpu/drm/bridge/ptn3460.c +++ b/drivers/gpu/drm/bridge/ptn3460.c | |||
@@ -225,12 +225,6 @@ out: | |||
225 | return num_modes; | 225 | return num_modes; |
226 | } | 226 | } |
227 | 227 | ||
228 | static int ptn3460_mode_valid(struct drm_connector *connector, | ||
229 | struct drm_display_mode *mode) | ||
230 | { | ||
231 | return MODE_OK; | ||
232 | } | ||
233 | |||
234 | struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector) | 228 | struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector) |
235 | { | 229 | { |
236 | struct ptn3460_bridge *ptn_bridge; | 230 | struct ptn3460_bridge *ptn_bridge; |
@@ -242,7 +236,6 @@ struct drm_encoder *ptn3460_best_encoder(struct drm_connector *connector) | |||
242 | 236 | ||
243 | struct drm_connector_helper_funcs ptn3460_connector_helper_funcs = { | 237 | struct drm_connector_helper_funcs ptn3460_connector_helper_funcs = { |
244 | .get_modes = ptn3460_get_modes, | 238 | .get_modes = ptn3460_get_modes, |
245 | .mode_valid = ptn3460_mode_valid, | ||
246 | .best_encoder = ptn3460_best_encoder, | 239 | .best_encoder = ptn3460_best_encoder, |
247 | }; | 240 | }; |
248 | 241 | ||
diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index f59433b7610c..49332c5fe35b 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c | |||
@@ -505,13 +505,6 @@ static int cirrus_vga_get_modes(struct drm_connector *connector) | |||
505 | return count; | 505 | return count; |
506 | } | 506 | } |
507 | 507 | ||
508 | static int cirrus_vga_mode_valid(struct drm_connector *connector, | ||
509 | struct drm_display_mode *mode) | ||
510 | { | ||
511 | /* Any mode we've added is valid */ | ||
512 | return MODE_OK; | ||
513 | } | ||
514 | |||
515 | static struct drm_encoder *cirrus_connector_best_encoder(struct drm_connector | 508 | static struct drm_encoder *cirrus_connector_best_encoder(struct drm_connector |
516 | *connector) | 509 | *connector) |
517 | { | 510 | { |
@@ -546,7 +539,6 @@ static void cirrus_connector_destroy(struct drm_connector *connector) | |||
546 | 539 | ||
547 | struct drm_connector_helper_funcs cirrus_vga_connector_helper_funcs = { | 540 | struct drm_connector_helper_funcs cirrus_vga_connector_helper_funcs = { |
548 | .get_modes = cirrus_vga_get_modes, | 541 | .get_modes = cirrus_vga_get_modes, |
549 | .mode_valid = cirrus_vga_mode_valid, | ||
550 | .best_encoder = cirrus_connector_best_encoder, | 542 | .best_encoder = cirrus_connector_best_encoder, |
551 | }; | 543 | }; |
552 | 544 | ||
diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c index ef7f0199a0f1..68175b54504b 100644 --- a/drivers/gpu/drm/drm_bufs.c +++ b/drivers/gpu/drm/drm_bufs.c | |||
@@ -363,7 +363,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, | |||
363 | list->master = dev->primary->master; | 363 | list->master = dev->primary->master; |
364 | *maplist = list; | 364 | *maplist = list; |
365 | return 0; | 365 | return 0; |
366 | } | 366 | } |
367 | 367 | ||
368 | int drm_addmap(struct drm_device * dev, resource_size_t offset, | 368 | int drm_addmap(struct drm_device * dev, resource_size_t offset, |
369 | unsigned int size, enum drm_map_type type, | 369 | unsigned int size, enum drm_map_type type, |
diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index a3fe32439a5b..34f0bf18d80d 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c | |||
@@ -1145,16 +1145,19 @@ EXPORT_SYMBOL(drm_plane_cleanup); | |||
1145 | */ | 1145 | */ |
1146 | void drm_plane_force_disable(struct drm_plane *plane) | 1146 | void drm_plane_force_disable(struct drm_plane *plane) |
1147 | { | 1147 | { |
1148 | struct drm_framebuffer *old_fb = plane->fb; | ||
1148 | int ret; | 1149 | int ret; |
1149 | 1150 | ||
1150 | if (!plane->fb) | 1151 | if (!old_fb) |
1151 | return; | 1152 | return; |
1152 | 1153 | ||
1153 | ret = plane->funcs->disable_plane(plane); | 1154 | ret = plane->funcs->disable_plane(plane); |
1154 | if (ret) | 1155 | if (ret) { |
1155 | DRM_ERROR("failed to disable plane with busy fb\n"); | 1156 | DRM_ERROR("failed to disable plane with busy fb\n"); |
1157 | return; | ||
1158 | } | ||
1156 | /* disconnect the plane from the fb and crtc: */ | 1159 | /* disconnect the plane from the fb and crtc: */ |
1157 | __drm_framebuffer_unreference(plane->fb); | 1160 | __drm_framebuffer_unreference(old_fb); |
1158 | plane->fb = NULL; | 1161 | plane->fb = NULL; |
1159 | plane->crtc = NULL; | 1162 | plane->crtc = NULL; |
1160 | } | 1163 | } |
@@ -2122,9 +2125,13 @@ int drm_mode_setplane(struct drm_device *dev, void *data, | |||
2122 | if (!plane_req->fb_id) { | 2125 | if (!plane_req->fb_id) { |
2123 | drm_modeset_lock_all(dev); | 2126 | drm_modeset_lock_all(dev); |
2124 | old_fb = plane->fb; | 2127 | old_fb = plane->fb; |
2125 | plane->funcs->disable_plane(plane); | 2128 | ret = plane->funcs->disable_plane(plane); |
2126 | plane->crtc = NULL; | 2129 | if (!ret) { |
2127 | plane->fb = NULL; | 2130 | plane->crtc = NULL; |
2131 | plane->fb = NULL; | ||
2132 | } else { | ||
2133 | old_fb = NULL; | ||
2134 | } | ||
2128 | drm_modeset_unlock_all(dev); | 2135 | drm_modeset_unlock_all(dev); |
2129 | goto out; | 2136 | goto out; |
2130 | } | 2137 | } |
@@ -2193,16 +2200,18 @@ int drm_mode_setplane(struct drm_device *dev, void *data, | |||
2193 | } | 2200 | } |
2194 | 2201 | ||
2195 | drm_modeset_lock_all(dev); | 2202 | drm_modeset_lock_all(dev); |
2203 | old_fb = plane->fb; | ||
2196 | ret = plane->funcs->update_plane(plane, crtc, fb, | 2204 | ret = plane->funcs->update_plane(plane, crtc, fb, |
2197 | plane_req->crtc_x, plane_req->crtc_y, | 2205 | plane_req->crtc_x, plane_req->crtc_y, |
2198 | plane_req->crtc_w, plane_req->crtc_h, | 2206 | plane_req->crtc_w, plane_req->crtc_h, |
2199 | plane_req->src_x, plane_req->src_y, | 2207 | plane_req->src_x, plane_req->src_y, |
2200 | plane_req->src_w, plane_req->src_h); | 2208 | plane_req->src_w, plane_req->src_h); |
2201 | if (!ret) { | 2209 | if (!ret) { |
2202 | old_fb = plane->fb; | ||
2203 | plane->crtc = crtc; | 2210 | plane->crtc = crtc; |
2204 | plane->fb = fb; | 2211 | plane->fb = fb; |
2205 | fb = NULL; | 2212 | fb = NULL; |
2213 | } else { | ||
2214 | old_fb = NULL; | ||
2206 | } | 2215 | } |
2207 | drm_modeset_unlock_all(dev); | 2216 | drm_modeset_unlock_all(dev); |
2208 | 2217 | ||
@@ -2245,9 +2254,7 @@ int drm_mode_set_config_internal(struct drm_mode_set *set) | |||
2245 | ret = crtc->funcs->set_config(set); | 2254 | ret = crtc->funcs->set_config(set); |
2246 | if (ret == 0) { | 2255 | if (ret == 0) { |
2247 | crtc->primary->crtc = crtc; | 2256 | crtc->primary->crtc = crtc; |
2248 | 2257 | crtc->primary->fb = fb; | |
2249 | /* crtc->fb must be updated by ->set_config, enforces this. */ | ||
2250 | WARN_ON(fb != crtc->primary->fb); | ||
2251 | } | 2258 | } |
2252 | 2259 | ||
2253 | list_for_each_entry(tmp, &crtc->dev->mode_config.crtc_list, head) { | 2260 | list_for_each_entry(tmp, &crtc->dev->mode_config.crtc_list, head) { |
diff --git a/drivers/gpu/drm/drm_crtc_helper.c b/drivers/gpu/drm/drm_crtc_helper.c index df281b54db01..a8b78e7bde50 100644 --- a/drivers/gpu/drm/drm_crtc_helper.c +++ b/drivers/gpu/drm/drm_crtc_helper.c | |||
@@ -140,16 +140,10 @@ drm_encoder_disable(struct drm_encoder *encoder) | |||
140 | static void __drm_helper_disable_unused_functions(struct drm_device *dev) | 140 | static void __drm_helper_disable_unused_functions(struct drm_device *dev) |
141 | { | 141 | { |
142 | struct drm_encoder *encoder; | 142 | struct drm_encoder *encoder; |
143 | struct drm_connector *connector; | ||
144 | struct drm_crtc *crtc; | 143 | struct drm_crtc *crtc; |
145 | 144 | ||
146 | drm_warn_on_modeset_not_all_locked(dev); | 145 | drm_warn_on_modeset_not_all_locked(dev); |
147 | 146 | ||
148 | list_for_each_entry(connector, &dev->mode_config.connector_list, head) { | ||
149 | if (!connector->encoder) | ||
150 | continue; | ||
151 | } | ||
152 | |||
153 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { | 147 | list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { |
154 | if (!drm_helper_encoder_in_use(encoder)) { | 148 | if (!drm_helper_encoder_in_use(encoder)) { |
155 | drm_encoder_disable(encoder); | 149 | drm_encoder_disable(encoder); |
@@ -387,8 +381,7 @@ done: | |||
387 | } | 381 | } |
388 | EXPORT_SYMBOL(drm_crtc_helper_set_mode); | 382 | EXPORT_SYMBOL(drm_crtc_helper_set_mode); |
389 | 383 | ||
390 | 384 | static void | |
391 | static int | ||
392 | drm_crtc_helper_disable(struct drm_crtc *crtc) | 385 | drm_crtc_helper_disable(struct drm_crtc *crtc) |
393 | { | 386 | { |
394 | struct drm_device *dev = crtc->dev; | 387 | struct drm_device *dev = crtc->dev; |
@@ -417,7 +410,6 @@ drm_crtc_helper_disable(struct drm_crtc *crtc) | |||
417 | } | 410 | } |
418 | 411 | ||
419 | __drm_helper_disable_unused_functions(dev); | 412 | __drm_helper_disable_unused_functions(dev); |
420 | return 0; | ||
421 | } | 413 | } |
422 | 414 | ||
423 | /** | 415 | /** |
@@ -468,7 +460,8 @@ int drm_crtc_helper_set_config(struct drm_mode_set *set) | |||
468 | (int)set->num_connectors, set->x, set->y); | 460 | (int)set->num_connectors, set->x, set->y); |
469 | } else { | 461 | } else { |
470 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); | 462 | DRM_DEBUG_KMS("[CRTC:%d] [NOFB]\n", set->crtc->base.id); |
471 | return drm_crtc_helper_disable(set->crtc); | 463 | drm_crtc_helper_disable(set->crtc); |
464 | return 0; | ||
472 | } | 465 | } |
473 | 466 | ||
474 | dev = set->crtc->dev; | 467 | dev = set->crtc->dev; |
diff --git a/drivers/gpu/drm/drm_dp_helper.c b/drivers/gpu/drm/drm_dp_helper.c index 4b6e6f3ba0a1..a13f1f51f68e 100644 --- a/drivers/gpu/drm/drm_dp_helper.c +++ b/drivers/gpu/drm/drm_dp_helper.c | |||
@@ -206,7 +206,7 @@ i2c_dp_aux_prepare_bus(struct i2c_adapter *adapter) | |||
206 | * i2c_dp_aux_add_bus() - register an i2c adapter using the aux ch helper | 206 | * i2c_dp_aux_add_bus() - register an i2c adapter using the aux ch helper |
207 | * @adapter: i2c adapter to register | 207 | * @adapter: i2c adapter to register |
208 | * | 208 | * |
209 | * This registers an i2c adapater that uses dp aux channel as it's underlaying | 209 | * This registers an i2c adapter that uses dp aux channel as it's underlaying |
210 | * transport. The driver needs to fill out the &i2c_algo_dp_aux_data structure | 210 | * transport. The driver needs to fill out the &i2c_algo_dp_aux_data structure |
211 | * and store it in the algo_data member of the @adapter argument. This will be | 211 | * and store it in the algo_data member of the @adapter argument. This will be |
212 | * used by the i2c over dp aux algorithm to drive the hardware. | 212 | * used by the i2c over dp aux algorithm to drive the hardware. |
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index d4e3f9d9370f..7a4fd2ed1280 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c | |||
@@ -984,9 +984,13 @@ static const u8 edid_header[] = { | |||
984 | 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 | 984 | 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 |
985 | }; | 985 | }; |
986 | 986 | ||
987 | /* | 987 | /** |
988 | * Sanity check the header of the base EDID block. Return 8 if the header | 988 | * drm_edid_header_is_valid - sanity check the header of the base EDID block |
989 | * is perfect, down to 0 if it's totally wrong. | 989 | * @raw_edid: pointer to raw base EDID block |
990 | * | ||
991 | * Sanity check the header of the base EDID block. | ||
992 | * | ||
993 | * Return: 8 if the header is perfect, down to 0 if it's totally wrong. | ||
990 | */ | 994 | */ |
991 | int drm_edid_header_is_valid(const u8 *raw_edid) | 995 | int drm_edid_header_is_valid(const u8 *raw_edid) |
992 | { | 996 | { |
@@ -1005,9 +1009,16 @@ module_param_named(edid_fixup, edid_fixup, int, 0400); | |||
1005 | MODULE_PARM_DESC(edid_fixup, | 1009 | MODULE_PARM_DESC(edid_fixup, |
1006 | "Minimum number of valid EDID header bytes (0-8, default 6)"); | 1010 | "Minimum number of valid EDID header bytes (0-8, default 6)"); |
1007 | 1011 | ||
1008 | /* | 1012 | /** |
1009 | * Sanity check the EDID block (base or extension). Return 0 if the block | 1013 | * drm_edid_block_valid - Sanity check the EDID block (base or extension) |
1010 | * doesn't check out, or 1 if it's valid. | 1014 | * @raw_edid: pointer to raw EDID block |
1015 | * @block: type of block to validate (0 for base, extension otherwise) | ||
1016 | * @print_bad_edid: if true, dump bad EDID blocks to the console | ||
1017 | * | ||
1018 | * Validate a base or extension EDID block and optionally dump bad blocks to | ||
1019 | * the console. | ||
1020 | * | ||
1021 | * Return: True if the block is valid, false otherwise. | ||
1011 | */ | 1022 | */ |
1012 | bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) | 1023 | bool drm_edid_block_valid(u8 *raw_edid, int block, bool print_bad_edid) |
1013 | { | 1024 | { |
@@ -1077,6 +1088,8 @@ EXPORT_SYMBOL(drm_edid_block_valid); | |||
1077 | * @edid: EDID data | 1088 | * @edid: EDID data |
1078 | * | 1089 | * |
1079 | * Sanity-check an entire EDID record (including extensions) | 1090 | * Sanity-check an entire EDID record (including extensions) |
1091 | * | ||
1092 | * Return: True if the EDID data is valid, false otherwise. | ||
1080 | */ | 1093 | */ |
1081 | bool drm_edid_is_valid(struct edid *edid) | 1094 | bool drm_edid_is_valid(struct edid *edid) |
1082 | { | 1095 | { |
@@ -1096,18 +1109,15 @@ EXPORT_SYMBOL(drm_edid_is_valid); | |||
1096 | 1109 | ||
1097 | #define DDC_SEGMENT_ADDR 0x30 | 1110 | #define DDC_SEGMENT_ADDR 0x30 |
1098 | /** | 1111 | /** |
1099 | * Get EDID information via I2C. | 1112 | * drm_do_probe_ddc_edid() - get EDID information via I2C |
1100 | * | 1113 | * @adapter: I2C device adaptor |
1101 | * @adapter : i2c device adaptor | ||
1102 | * @buf: EDID data buffer to be filled | 1114 | * @buf: EDID data buffer to be filled |
1103 | * @block: 128 byte EDID block to start fetching from | 1115 | * @block: 128 byte EDID block to start fetching from |
1104 | * @len: EDID data buffer length to fetch | 1116 | * @len: EDID data buffer length to fetch |
1105 | * | 1117 | * |
1106 | * Returns: | 1118 | * Try to fetch EDID information by calling I2C driver functions. |
1107 | * | ||
1108 | * 0 on success or -1 on failure. | ||
1109 | * | 1119 | * |
1110 | * Try to fetch EDID information by calling i2c driver function. | 1120 | * Return: 0 on success or -1 on failure. |
1111 | */ | 1121 | */ |
1112 | static int | 1122 | static int |
1113 | drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, | 1123 | drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, |
@@ -1118,7 +1128,8 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, | |||
1118 | unsigned char xfers = segment ? 3 : 2; | 1128 | unsigned char xfers = segment ? 3 : 2; |
1119 | int ret, retries = 5; | 1129 | int ret, retries = 5; |
1120 | 1130 | ||
1121 | /* The core i2c driver will automatically retry the transfer if the | 1131 | /* |
1132 | * The core I2C driver will automatically retry the transfer if the | ||
1122 | * adapter reports EAGAIN. However, we find that bit-banging transfers | 1133 | * adapter reports EAGAIN. However, we find that bit-banging transfers |
1123 | * are susceptible to errors under a heavily loaded machine and | 1134 | * are susceptible to errors under a heavily loaded machine and |
1124 | * generate spurious NAKs and timeouts. Retrying the transfer | 1135 | * generate spurious NAKs and timeouts. Retrying the transfer |
@@ -1144,10 +1155,10 @@ drm_do_probe_ddc_edid(struct i2c_adapter *adapter, unsigned char *buf, | |||
1144 | } | 1155 | } |
1145 | }; | 1156 | }; |
1146 | 1157 | ||
1147 | /* | 1158 | /* |
1148 | * Avoid sending the segment addr to not upset non-compliant ddc | 1159 | * Avoid sending the segment addr to not upset non-compliant |
1149 | * monitors. | 1160 | * DDC monitors. |
1150 | */ | 1161 | */ |
1151 | ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers); | 1162 | ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers); |
1152 | 1163 | ||
1153 | if (ret == -ENXIO) { | 1164 | if (ret == -ENXIO) { |
@@ -1246,12 +1257,10 @@ out: | |||
1246 | } | 1257 | } |
1247 | 1258 | ||
1248 | /** | 1259 | /** |
1249 | * Probe DDC presence. | 1260 | * drm_probe_ddc() - probe DDC presence |
1250 | * @adapter: i2c adapter to probe | 1261 | * @adapter: I2C adapter to probe |
1251 | * | 1262 | * |
1252 | * Returns: | 1263 | * Return: True on success, false on failure. |
1253 | * | ||
1254 | * 1 on success | ||
1255 | */ | 1264 | */ |
1256 | bool | 1265 | bool |
1257 | drm_probe_ddc(struct i2c_adapter *adapter) | 1266 | drm_probe_ddc(struct i2c_adapter *adapter) |
@@ -1265,12 +1274,12 @@ EXPORT_SYMBOL(drm_probe_ddc); | |||
1265 | /** | 1274 | /** |
1266 | * drm_get_edid - get EDID data, if available | 1275 | * drm_get_edid - get EDID data, if available |
1267 | * @connector: connector we're probing | 1276 | * @connector: connector we're probing |
1268 | * @adapter: i2c adapter to use for DDC | 1277 | * @adapter: I2C adapter to use for DDC |
1269 | * | 1278 | * |
1270 | * Poke the given i2c channel to grab EDID data if possible. If found, | 1279 | * Poke the given I2C channel to grab EDID data if possible. If found, |
1271 | * attach it to the connector. | 1280 | * attach it to the connector. |
1272 | * | 1281 | * |
1273 | * Return edid data or NULL if we couldn't find any. | 1282 | * Return: Pointer to valid EDID or NULL if we couldn't find any. |
1274 | */ | 1283 | */ |
1275 | struct edid *drm_get_edid(struct drm_connector *connector, | 1284 | struct edid *drm_get_edid(struct drm_connector *connector, |
1276 | struct i2c_adapter *adapter) | 1285 | struct i2c_adapter *adapter) |
@@ -1288,7 +1297,7 @@ EXPORT_SYMBOL(drm_get_edid); | |||
1288 | * drm_edid_duplicate - duplicate an EDID and the extensions | 1297 | * drm_edid_duplicate - duplicate an EDID and the extensions |
1289 | * @edid: EDID to duplicate | 1298 | * @edid: EDID to duplicate |
1290 | * | 1299 | * |
1291 | * Return duplicate edid or NULL on allocation failure. | 1300 | * Return: Pointer to duplicated EDID or NULL on allocation failure. |
1292 | */ | 1301 | */ |
1293 | struct edid *drm_edid_duplicate(const struct edid *edid) | 1302 | struct edid *drm_edid_duplicate(const struct edid *edid) |
1294 | { | 1303 | { |
@@ -1411,7 +1420,8 @@ mode_is_rb(const struct drm_display_mode *mode) | |||
1411 | * @rb: Mode reduced-blanking-ness | 1420 | * @rb: Mode reduced-blanking-ness |
1412 | * | 1421 | * |
1413 | * Walk the DMT mode list looking for a match for the given parameters. | 1422 | * Walk the DMT mode list looking for a match for the given parameters. |
1414 | * Return a newly allocated copy of the mode, or NULL if not found. | 1423 | * |
1424 | * Return: A newly allocated copy of the mode, or NULL if not found. | ||
1415 | */ | 1425 | */ |
1416 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, | 1426 | struct drm_display_mode *drm_mode_find_dmt(struct drm_device *dev, |
1417 | int hsize, int vsize, int fresh, | 1427 | int hsize, int vsize, int fresh, |
@@ -1595,14 +1605,13 @@ bad_std_timing(u8 a, u8 b) | |||
1595 | * @connector: connector of for the EDID block | 1605 | * @connector: connector of for the EDID block |
1596 | * @edid: EDID block to scan | 1606 | * @edid: EDID block to scan |
1597 | * @t: standard timing params | 1607 | * @t: standard timing params |
1598 | * @revision: standard timing level | ||
1599 | * | 1608 | * |
1600 | * Take the standard timing params (in this case width, aspect, and refresh) | 1609 | * Take the standard timing params (in this case width, aspect, and refresh) |
1601 | * and convert them into a real mode using CVT/GTF/DMT. | 1610 | * and convert them into a real mode using CVT/GTF/DMT. |
1602 | */ | 1611 | */ |
1603 | static struct drm_display_mode * | 1612 | static struct drm_display_mode * |
1604 | drm_mode_std(struct drm_connector *connector, struct edid *edid, | 1613 | drm_mode_std(struct drm_connector *connector, struct edid *edid, |
1605 | struct std_timing *t, int revision) | 1614 | struct std_timing *t) |
1606 | { | 1615 | { |
1607 | struct drm_device *dev = connector->dev; | 1616 | struct drm_device *dev = connector->dev; |
1608 | struct drm_display_mode *m, *mode = NULL; | 1617 | struct drm_display_mode *m, *mode = NULL; |
@@ -1623,7 +1632,7 @@ drm_mode_std(struct drm_connector *connector, struct edid *edid, | |||
1623 | vrefresh_rate = vfreq + 60; | 1632 | vrefresh_rate = vfreq + 60; |
1624 | /* the vdisplay is calculated based on the aspect ratio */ | 1633 | /* the vdisplay is calculated based on the aspect ratio */ |
1625 | if (aspect_ratio == 0) { | 1634 | if (aspect_ratio == 0) { |
1626 | if (revision < 3) | 1635 | if (edid->revision < 3) |
1627 | vsize = hsize; | 1636 | vsize = hsize; |
1628 | else | 1637 | else |
1629 | vsize = (hsize * 10) / 16; | 1638 | vsize = (hsize * 10) / 16; |
@@ -2140,7 +2149,7 @@ do_established_modes(struct detailed_timing *timing, void *c) | |||
2140 | 2149 | ||
2141 | /** | 2150 | /** |
2142 | * add_established_modes - get est. modes from EDID and add them | 2151 | * add_established_modes - get est. modes from EDID and add them |
2143 | * @connector: connector of for the EDID block | 2152 | * @connector: connector to add mode(s) to |
2144 | * @edid: EDID block to scan | 2153 | * @edid: EDID block to scan |
2145 | * | 2154 | * |
2146 | * Each EDID block contains a bitmap of the supported "established modes" list | 2155 | * Each EDID block contains a bitmap of the supported "established modes" list |
@@ -2191,8 +2200,7 @@ do_standard_modes(struct detailed_timing *timing, void *c) | |||
2191 | struct drm_display_mode *newmode; | 2200 | struct drm_display_mode *newmode; |
2192 | 2201 | ||
2193 | std = &data->data.timings[i]; | 2202 | std = &data->data.timings[i]; |
2194 | newmode = drm_mode_std(connector, edid, std, | 2203 | newmode = drm_mode_std(connector, edid, std); |
2195 | edid->revision); | ||
2196 | if (newmode) { | 2204 | if (newmode) { |
2197 | drm_mode_probed_add(connector, newmode); | 2205 | drm_mode_probed_add(connector, newmode); |
2198 | closure->modes++; | 2206 | closure->modes++; |
@@ -2203,7 +2211,7 @@ do_standard_modes(struct detailed_timing *timing, void *c) | |||
2203 | 2211 | ||
2204 | /** | 2212 | /** |
2205 | * add_standard_modes - get std. modes from EDID and add them | 2213 | * add_standard_modes - get std. modes from EDID and add them |
2206 | * @connector: connector of for the EDID block | 2214 | * @connector: connector to add mode(s) to |
2207 | * @edid: EDID block to scan | 2215 | * @edid: EDID block to scan |
2208 | * | 2216 | * |
2209 | * Standard modes can be calculated using the appropriate standard (DMT, | 2217 | * Standard modes can be calculated using the appropriate standard (DMT, |
@@ -2221,8 +2229,7 @@ add_standard_modes(struct drm_connector *connector, struct edid *edid) | |||
2221 | struct drm_display_mode *newmode; | 2229 | struct drm_display_mode *newmode; |
2222 | 2230 | ||
2223 | newmode = drm_mode_std(connector, edid, | 2231 | newmode = drm_mode_std(connector, edid, |
2224 | &edid->standard_timings[i], | 2232 | &edid->standard_timings[i]); |
2225 | edid->revision); | ||
2226 | if (newmode) { | 2233 | if (newmode) { |
2227 | drm_mode_probed_add(connector, newmode); | 2234 | drm_mode_probed_add(connector, newmode); |
2228 | modes++; | 2235 | modes++; |
@@ -2425,7 +2432,7 @@ cea_mode_alternate_clock(const struct drm_display_mode *cea_mode) | |||
2425 | * drm_match_cea_mode - look for a CEA mode matching given mode | 2432 | * drm_match_cea_mode - look for a CEA mode matching given mode |
2426 | * @to_match: display mode | 2433 | * @to_match: display mode |
2427 | * | 2434 | * |
2428 | * Returns the CEA Video ID (VIC) of the mode or 0 if it isn't a CEA-861 | 2435 | * Return: The CEA Video ID (VIC) of the mode or 0 if it isn't a CEA-861 |
2429 | * mode. | 2436 | * mode. |
2430 | */ | 2437 | */ |
2431 | u8 drm_match_cea_mode(const struct drm_display_mode *to_match) | 2438 | u8 drm_match_cea_mode(const struct drm_display_mode *to_match) |
@@ -2452,6 +2459,22 @@ u8 drm_match_cea_mode(const struct drm_display_mode *to_match) | |||
2452 | } | 2459 | } |
2453 | EXPORT_SYMBOL(drm_match_cea_mode); | 2460 | EXPORT_SYMBOL(drm_match_cea_mode); |
2454 | 2461 | ||
2462 | /** | ||
2463 | * drm_get_cea_aspect_ratio - get the picture aspect ratio corresponding to | ||
2464 | * the input VIC from the CEA mode list | ||
2465 | * @video_code: ID given to each of the CEA modes | ||
2466 | * | ||
2467 | * Returns picture aspect ratio | ||
2468 | */ | ||
2469 | enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code) | ||
2470 | { | ||
2471 | /* return picture aspect ratio for video_code - 1 to access the | ||
2472 | * right array element | ||
2473 | */ | ||
2474 | return edid_cea_modes[video_code-1].picture_aspect_ratio; | ||
2475 | } | ||
2476 | EXPORT_SYMBOL(drm_get_cea_aspect_ratio); | ||
2477 | |||
2455 | /* | 2478 | /* |
2456 | * Calculate the alternate clock for HDMI modes (those from the HDMI vendor | 2479 | * Calculate the alternate clock for HDMI modes (those from the HDMI vendor |
2457 | * specific block). | 2480 | * specific block). |
@@ -3023,11 +3046,9 @@ monitor_name(struct detailed_timing *t, void *data) | |||
3023 | * @connector: connector corresponding to the HDMI/DP sink | 3046 | * @connector: connector corresponding to the HDMI/DP sink |
3024 | * @edid: EDID to parse | 3047 | * @edid: EDID to parse |
3025 | * | 3048 | * |
3026 | * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. | 3049 | * Fill the ELD (EDID-Like Data) buffer for passing to the audio driver. The |
3027 | * Some ELD fields are left to the graphics driver caller: | 3050 | * Conn_Type, HDCP and Port_ID ELD fields are left for the graphics driver to |
3028 | * - Conn_Type | 3051 | * fill in. |
3029 | * - HDCP | ||
3030 | * - Port_ID | ||
3031 | */ | 3052 | */ |
3032 | void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) | 3053 | void drm_edid_to_eld(struct drm_connector *connector, struct edid *edid) |
3033 | { | 3054 | { |
@@ -3111,9 +3132,10 @@ EXPORT_SYMBOL(drm_edid_to_eld); | |||
3111 | * @sads: pointer that will be set to the extracted SADs | 3132 | * @sads: pointer that will be set to the extracted SADs |
3112 | * | 3133 | * |
3113 | * Looks for CEA EDID block and extracts SADs (Short Audio Descriptors) from it. | 3134 | * Looks for CEA EDID block and extracts SADs (Short Audio Descriptors) from it. |
3114 | * Note: returned pointer needs to be kfreed | ||
3115 | * | 3135 | * |
3116 | * Return number of found SADs or negative number on error. | 3136 | * Note: The returned pointer needs to be freed using kfree(). |
3137 | * | ||
3138 | * Return: The number of found SADs or negative number on error. | ||
3117 | */ | 3139 | */ |
3118 | int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) | 3140 | int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads) |
3119 | { | 3141 | { |
@@ -3170,9 +3192,11 @@ EXPORT_SYMBOL(drm_edid_to_sad); | |||
3170 | * @sadb: pointer to the speaker block | 3192 | * @sadb: pointer to the speaker block |
3171 | * | 3193 | * |
3172 | * Looks for CEA EDID block and extracts the Speaker Allocation Data Block from it. | 3194 | * Looks for CEA EDID block and extracts the Speaker Allocation Data Block from it. |
3173 | * Note: returned pointer needs to be kfreed | ||
3174 | * | 3195 | * |
3175 | * Return number of found Speaker Allocation Blocks or negative number on error. | 3196 | * Note: The returned pointer needs to be freed using kfree(). |
3197 | * | ||
3198 | * Return: The number of found Speaker Allocation Blocks or negative number on | ||
3199 | * error. | ||
3176 | */ | 3200 | */ |
3177 | int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) | 3201 | int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) |
3178 | { | 3202 | { |
@@ -3219,9 +3243,12 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) | |||
3219 | EXPORT_SYMBOL(drm_edid_to_speaker_allocation); | 3243 | EXPORT_SYMBOL(drm_edid_to_speaker_allocation); |
3220 | 3244 | ||
3221 | /** | 3245 | /** |
3222 | * drm_av_sync_delay - HDMI/DP sink audio-video sync delay in millisecond | 3246 | * drm_av_sync_delay - compute the HDMI/DP sink audio-video sync delay |
3223 | * @connector: connector associated with the HDMI/DP sink | 3247 | * @connector: connector associated with the HDMI/DP sink |
3224 | * @mode: the display mode | 3248 | * @mode: the display mode |
3249 | * | ||
3250 | * Return: The HDMI/DP sink's audio-video sync delay in milliseconds or 0 if | ||
3251 | * the sink doesn't support audio or video. | ||
3225 | */ | 3252 | */ |
3226 | int drm_av_sync_delay(struct drm_connector *connector, | 3253 | int drm_av_sync_delay(struct drm_connector *connector, |
3227 | struct drm_display_mode *mode) | 3254 | struct drm_display_mode *mode) |
@@ -3263,6 +3290,9 @@ EXPORT_SYMBOL(drm_av_sync_delay); | |||
3263 | * | 3290 | * |
3264 | * It's possible for one encoder to be associated with multiple HDMI/DP sinks. | 3291 | * It's possible for one encoder to be associated with multiple HDMI/DP sinks. |
3265 | * The policy is now hard coded to simply use the first HDMI/DP sink's ELD. | 3292 | * The policy is now hard coded to simply use the first HDMI/DP sink's ELD. |
3293 | * | ||
3294 | * Return: The connector associated with the first HDMI/DP sink that has ELD | ||
3295 | * attached to it. | ||
3266 | */ | 3296 | */ |
3267 | struct drm_connector *drm_select_eld(struct drm_encoder *encoder, | 3297 | struct drm_connector *drm_select_eld(struct drm_encoder *encoder, |
3268 | struct drm_display_mode *mode) | 3298 | struct drm_display_mode *mode) |
@@ -3279,11 +3309,12 @@ struct drm_connector *drm_select_eld(struct drm_encoder *encoder, | |||
3279 | EXPORT_SYMBOL(drm_select_eld); | 3309 | EXPORT_SYMBOL(drm_select_eld); |
3280 | 3310 | ||
3281 | /** | 3311 | /** |
3282 | * drm_detect_hdmi_monitor - detect whether monitor is hdmi. | 3312 | * drm_detect_hdmi_monitor - detect whether monitor is HDMI |
3283 | * @edid: monitor EDID information | 3313 | * @edid: monitor EDID information |
3284 | * | 3314 | * |
3285 | * Parse the CEA extension according to CEA-861-B. | 3315 | * Parse the CEA extension according to CEA-861-B. |
3286 | * Return true if HDMI, false if not or unknown. | 3316 | * |
3317 | * Return: True if the monitor is HDMI, false if not or unknown. | ||
3287 | */ | 3318 | */ |
3288 | bool drm_detect_hdmi_monitor(struct edid *edid) | 3319 | bool drm_detect_hdmi_monitor(struct edid *edid) |
3289 | { | 3320 | { |
@@ -3321,6 +3352,7 @@ EXPORT_SYMBOL(drm_detect_hdmi_monitor); | |||
3321 | * audio format, assume at least 'basic audio' support, even if 'basic | 3352 | * audio format, assume at least 'basic audio' support, even if 'basic |
3322 | * audio' is not defined in EDID. | 3353 | * audio' is not defined in EDID. |
3323 | * | 3354 | * |
3355 | * Return: True if the monitor supports audio, false otherwise. | ||
3324 | */ | 3356 | */ |
3325 | bool drm_detect_monitor_audio(struct edid *edid) | 3357 | bool drm_detect_monitor_audio(struct edid *edid) |
3326 | { | 3358 | { |
@@ -3364,6 +3396,8 @@ EXPORT_SYMBOL(drm_detect_monitor_audio); | |||
3364 | * Check whether the monitor reports the RGB quantization range selection | 3396 | * Check whether the monitor reports the RGB quantization range selection |
3365 | * as supported. The AVI infoframe can then be used to inform the monitor | 3397 | * as supported. The AVI infoframe can then be used to inform the monitor |
3366 | * which quantization range (full or limited) is used. | 3398 | * which quantization range (full or limited) is used. |
3399 | * | ||
3400 | * Return: True if the RGB quantization range is selectable, false otherwise. | ||
3367 | */ | 3401 | */ |
3368 | bool drm_rgb_quant_range_selectable(struct edid *edid) | 3402 | bool drm_rgb_quant_range_selectable(struct edid *edid) |
3369 | { | 3403 | { |
@@ -3468,11 +3502,11 @@ static void drm_add_display_info(struct edid *edid, | |||
3468 | /** | 3502 | /** |
3469 | * drm_add_edid_modes - add modes from EDID data, if available | 3503 | * drm_add_edid_modes - add modes from EDID data, if available |
3470 | * @connector: connector we're probing | 3504 | * @connector: connector we're probing |
3471 | * @edid: edid data | 3505 | * @edid: EDID data |
3472 | * | 3506 | * |
3473 | * Add the specified modes to the connector's mode list. | 3507 | * Add the specified modes to the connector's mode list. |
3474 | * | 3508 | * |
3475 | * Return number of modes added or 0 if we couldn't find any. | 3509 | * Return: The number of modes added or 0 if we couldn't find any. |
3476 | */ | 3510 | */ |
3477 | int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) | 3511 | int drm_add_edid_modes(struct drm_connector *connector, struct edid *edid) |
3478 | { | 3512 | { |
@@ -3534,7 +3568,7 @@ EXPORT_SYMBOL(drm_add_edid_modes); | |||
3534 | * Add the specified modes to the connector's mode list. Only when the | 3568 | * Add the specified modes to the connector's mode list. Only when the |
3535 | * hdisplay/vdisplay is not beyond the given limit, it will be added. | 3569 | * hdisplay/vdisplay is not beyond the given limit, it will be added. |
3536 | * | 3570 | * |
3537 | * Return number of modes added or 0 if we couldn't find any. | 3571 | * Return: The number of modes added or 0 if we couldn't find any. |
3538 | */ | 3572 | */ |
3539 | int drm_add_modes_noedid(struct drm_connector *connector, | 3573 | int drm_add_modes_noedid(struct drm_connector *connector, |
3540 | int hdisplay, int vdisplay) | 3574 | int hdisplay, int vdisplay) |
@@ -3573,13 +3607,22 @@ int drm_add_modes_noedid(struct drm_connector *connector, | |||
3573 | } | 3607 | } |
3574 | EXPORT_SYMBOL(drm_add_modes_noedid); | 3608 | EXPORT_SYMBOL(drm_add_modes_noedid); |
3575 | 3609 | ||
3610 | /** | ||
3611 | * drm_set_preferred_mode - Sets the preferred mode of a connector | ||
3612 | * @connector: connector whose mode list should be processed | ||
3613 | * @hpref: horizontal resolution of preferred mode | ||
3614 | * @vpref: vertical resolution of preferred mode | ||
3615 | * | ||
3616 | * Marks a mode as preferred if it matches the resolution specified by @hpref | ||
3617 | * and @vpref. | ||
3618 | */ | ||
3576 | void drm_set_preferred_mode(struct drm_connector *connector, | 3619 | void drm_set_preferred_mode(struct drm_connector *connector, |
3577 | int hpref, int vpref) | 3620 | int hpref, int vpref) |
3578 | { | 3621 | { |
3579 | struct drm_display_mode *mode; | 3622 | struct drm_display_mode *mode; |
3580 | 3623 | ||
3581 | list_for_each_entry(mode, &connector->probed_modes, head) { | 3624 | list_for_each_entry(mode, &connector->probed_modes, head) { |
3582 | if (mode->hdisplay == hpref && | 3625 | if (mode->hdisplay == hpref && |
3583 | mode->vdisplay == vpref) | 3626 | mode->vdisplay == vpref) |
3584 | mode->type |= DRM_MODE_TYPE_PREFERRED; | 3627 | mode->type |= DRM_MODE_TYPE_PREFERRED; |
3585 | } | 3628 | } |
@@ -3592,7 +3635,7 @@ EXPORT_SYMBOL(drm_set_preferred_mode); | |||
3592 | * @frame: HDMI AVI infoframe | 3635 | * @frame: HDMI AVI infoframe |
3593 | * @mode: DRM display mode | 3636 | * @mode: DRM display mode |
3594 | * | 3637 | * |
3595 | * Returns 0 on success or a negative error code on failure. | 3638 | * Return: 0 on success or a negative error code on failure. |
3596 | */ | 3639 | */ |
3597 | int | 3640 | int |
3598 | drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, | 3641 | drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, |
@@ -3613,6 +3656,12 @@ drm_hdmi_avi_infoframe_from_display_mode(struct hdmi_avi_infoframe *frame, | |||
3613 | frame->video_code = drm_match_cea_mode(mode); | 3656 | frame->video_code = drm_match_cea_mode(mode); |
3614 | 3657 | ||
3615 | frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE; | 3658 | frame->picture_aspect = HDMI_PICTURE_ASPECT_NONE; |
3659 | |||
3660 | /* Populate picture aspect ratio from CEA mode list */ | ||
3661 | if (frame->video_code > 0) | ||
3662 | frame->picture_aspect = drm_get_cea_aspect_ratio( | ||
3663 | frame->video_code); | ||
3664 | |||
3616 | frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE; | 3665 | frame->active_aspect = HDMI_ACTIVE_ASPECT_PICTURE; |
3617 | frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN; | 3666 | frame->scan_mode = HDMI_SCAN_MODE_UNDERSCAN; |
3618 | 3667 | ||
@@ -3657,7 +3706,7 @@ s3d_structure_from_display_mode(const struct drm_display_mode *mode) | |||
3657 | * 4k or stereoscopic 3D mode. So when giving any other mode as input this | 3706 | * 4k or stereoscopic 3D mode. So when giving any other mode as input this |
3658 | * function will return -EINVAL, error that can be safely ignored. | 3707 | * function will return -EINVAL, error that can be safely ignored. |
3659 | * | 3708 | * |
3660 | * Returns 0 on success or a negative error code on failure. | 3709 | * Return: 0 on success or a negative error code on failure. |
3661 | */ | 3710 | */ |
3662 | int | 3711 | int |
3663 | drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, | 3712 | drm_hdmi_vendor_infoframe_from_display_mode(struct hdmi_vendor_infoframe *frame, |
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c index 04d3fd3658f3..e95ed5805f07 100644 --- a/drivers/gpu/drm/drm_fb_helper.c +++ b/drivers/gpu/drm/drm_fb_helper.c | |||
@@ -45,13 +45,13 @@ static LIST_HEAD(kernel_fb_helper_list); | |||
45 | * DOC: fbdev helpers | 45 | * DOC: fbdev helpers |
46 | * | 46 | * |
47 | * The fb helper functions are useful to provide an fbdev on top of a drm kernel | 47 | * The fb helper functions are useful to provide an fbdev on top of a drm kernel |
48 | * mode setting driver. They can be used mostly independantely from the crtc | 48 | * mode setting driver. They can be used mostly independently from the crtc |
49 | * helper functions used by many drivers to implement the kernel mode setting | 49 | * helper functions used by many drivers to implement the kernel mode setting |
50 | * interfaces. | 50 | * interfaces. |
51 | * | 51 | * |
52 | * Initialization is done as a three-step process with drm_fb_helper_init(), | 52 | * Initialization is done as a three-step process with drm_fb_helper_init(), |
53 | * drm_fb_helper_single_add_all_connectors() and drm_fb_helper_initial_config(). | 53 | * drm_fb_helper_single_add_all_connectors() and drm_fb_helper_initial_config(). |
54 | * Drivers with fancier requirements than the default beheviour can override the | 54 | * Drivers with fancier requirements than the default behaviour can override the |
55 | * second step with their own code. Teardown is done with drm_fb_helper_fini(). | 55 | * second step with their own code. Teardown is done with drm_fb_helper_fini(). |
56 | * | 56 | * |
57 | * At runtime drivers should restore the fbdev console by calling | 57 | * At runtime drivers should restore the fbdev console by calling |
@@ -59,7 +59,7 @@ static LIST_HEAD(kernel_fb_helper_list); | |||
59 | * should also notify the fb helper code from updates to the output | 59 | * should also notify the fb helper code from updates to the output |
60 | * configuration by calling drm_fb_helper_hotplug_event(). For easier | 60 | * configuration by calling drm_fb_helper_hotplug_event(). For easier |
61 | * integration with the output polling code in drm_crtc_helper.c the modeset | 61 | * integration with the output polling code in drm_crtc_helper.c the modeset |
62 | * code proves a ->output_poll_changed callback. | 62 | * code provides a ->output_poll_changed callback. |
63 | * | 63 | * |
64 | * All other functions exported by the fb helper library can be used to | 64 | * All other functions exported by the fb helper library can be used to |
65 | * implement the fbdev driver interface by the driver. | 65 | * implement the fbdev driver interface by the driver. |
@@ -326,12 +326,21 @@ static bool drm_fb_helper_force_kernel_mode(void) | |||
326 | return false; | 326 | return false; |
327 | 327 | ||
328 | list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) { | 328 | list_for_each_entry(helper, &kernel_fb_helper_list, kernel_fb_list) { |
329 | if (helper->dev->switch_power_state == DRM_SWITCH_POWER_OFF) | 329 | struct drm_device *dev = helper->dev; |
330 | |||
331 | if (dev->switch_power_state == DRM_SWITCH_POWER_OFF) | ||
332 | continue; | ||
333 | |||
334 | if (!mutex_trylock(&dev->mode_config.mutex)) { | ||
335 | error = true; | ||
330 | continue; | 336 | continue; |
337 | } | ||
331 | 338 | ||
332 | ret = drm_fb_helper_restore_fbdev_mode(helper); | 339 | ret = drm_fb_helper_restore_fbdev_mode(helper); |
333 | if (ret) | 340 | if (ret) |
334 | error = true; | 341 | error = true; |
342 | |||
343 | mutex_unlock(&dev->mode_config.mutex); | ||
335 | } | 344 | } |
336 | return error; | 345 | return error; |
337 | } | 346 | } |
diff --git a/drivers/gpu/drm/drm_fops.c b/drivers/gpu/drm/drm_fops.c index e1eba0b7cd45..021fe5d11df5 100644 --- a/drivers/gpu/drm/drm_fops.c +++ b/drivers/gpu/drm/drm_fops.c | |||
@@ -43,8 +43,7 @@ | |||
43 | DEFINE_MUTEX(drm_global_mutex); | 43 | DEFINE_MUTEX(drm_global_mutex); |
44 | EXPORT_SYMBOL(drm_global_mutex); | 44 | EXPORT_SYMBOL(drm_global_mutex); |
45 | 45 | ||
46 | static int drm_open_helper(struct inode *inode, struct file *filp, | 46 | static int drm_open_helper(struct file *filp, struct drm_minor *minor); |
47 | struct drm_minor *minor); | ||
48 | 47 | ||
49 | static int drm_setup(struct drm_device * dev) | 48 | static int drm_setup(struct drm_device * dev) |
50 | { | 49 | { |
@@ -95,7 +94,7 @@ int drm_open(struct inode *inode, struct file *filp) | |||
95 | /* share address_space across all char-devs of a single device */ | 94 | /* share address_space across all char-devs of a single device */ |
96 | filp->f_mapping = dev->anon_inode->i_mapping; | 95 | filp->f_mapping = dev->anon_inode->i_mapping; |
97 | 96 | ||
98 | retcode = drm_open_helper(inode, filp, minor); | 97 | retcode = drm_open_helper(filp, minor); |
99 | if (retcode) | 98 | if (retcode) |
100 | goto err_undo; | 99 | goto err_undo; |
101 | if (need_setup) { | 100 | if (need_setup) { |
@@ -171,7 +170,6 @@ static int drm_cpu_valid(void) | |||
171 | /** | 170 | /** |
172 | * Called whenever a process opens /dev/drm. | 171 | * Called whenever a process opens /dev/drm. |
173 | * | 172 | * |
174 | * \param inode device inode. | ||
175 | * \param filp file pointer. | 173 | * \param filp file pointer. |
176 | * \param minor acquired minor-object. | 174 | * \param minor acquired minor-object. |
177 | * \return zero on success or a negative number on failure. | 175 | * \return zero on success or a negative number on failure. |
@@ -179,8 +177,7 @@ static int drm_cpu_valid(void) | |||
179 | * Creates and initializes a drm_file structure for the file private data in \p | 177 | * Creates and initializes a drm_file structure for the file private data in \p |
180 | * filp and add it into the double linked list in \p dev. | 178 | * filp and add it into the double linked list in \p dev. |
181 | */ | 179 | */ |
182 | static int drm_open_helper(struct inode *inode, struct file *filp, | 180 | static int drm_open_helper(struct file *filp, struct drm_minor *minor) |
183 | struct drm_minor *minor) | ||
184 | { | 181 | { |
185 | struct drm_device *dev = minor->dev; | 182 | struct drm_device *dev = minor->dev; |
186 | struct drm_file *priv; | 183 | struct drm_file *priv; |
diff --git a/drivers/gpu/drm/drm_plane_helper.c b/drivers/gpu/drm/drm_plane_helper.c index d2b1c03b3d71..d966afa7ecae 100644 --- a/drivers/gpu/drm/drm_plane_helper.c +++ b/drivers/gpu/drm/drm_plane_helper.c | |||
@@ -124,7 +124,6 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
124 | .y2 = crtc->mode.vdisplay, | 124 | .y2 = crtc->mode.vdisplay, |
125 | }; | 125 | }; |
126 | struct drm_connector **connector_list; | 126 | struct drm_connector **connector_list; |
127 | struct drm_framebuffer *tmpfb; | ||
128 | int num_connectors, ret; | 127 | int num_connectors, ret; |
129 | 128 | ||
130 | if (!crtc->enabled) { | 129 | if (!crtc->enabled) { |
@@ -145,6 +144,8 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
145 | } | 144 | } |
146 | 145 | ||
147 | /* Disallow scaling */ | 146 | /* Disallow scaling */ |
147 | src_w >>= 16; | ||
148 | src_h >>= 16; | ||
148 | if (crtc_w != src_w || crtc_h != src_h) { | 149 | if (crtc_w != src_w || crtc_h != src_h) { |
149 | DRM_DEBUG_KMS("Can't scale primary plane\n"); | 150 | DRM_DEBUG_KMS("Can't scale primary plane\n"); |
150 | return -EINVAL; | 151 | return -EINVAL; |
@@ -176,21 +177,14 @@ int drm_primary_helper_update(struct drm_plane *plane, struct drm_crtc *crtc, | |||
176 | set.num_connectors = num_connectors; | 177 | set.num_connectors = num_connectors; |
177 | 178 | ||
178 | /* | 179 | /* |
179 | * set_config() adjusts crtc->primary->fb; however the DRM setplane | 180 | * We call set_config() directly here rather than using |
180 | * code that called us expects to handle the framebuffer update and | ||
181 | * reference counting; save and restore the current fb before | ||
182 | * calling it. | ||
183 | * | ||
184 | * N.B., we call set_config() directly here rather than using | ||
185 | * drm_mode_set_config_internal. We're reprogramming the same | 181 | * drm_mode_set_config_internal. We're reprogramming the same |
186 | * connectors that were already in use, so we shouldn't need the extra | 182 | * connectors that were already in use, so we shouldn't need the extra |
187 | * cross-CRTC fb refcounting to accomodate stealing connectors. | 183 | * cross-CRTC fb refcounting to accomodate stealing connectors. |
188 | * drm_mode_setplane() already handles the basic refcounting for the | 184 | * drm_mode_setplane() already handles the basic refcounting for the |
189 | * framebuffers involved in this operation. | 185 | * framebuffers involved in this operation. |
190 | */ | 186 | */ |
191 | tmpfb = plane->fb; | ||
192 | ret = crtc->funcs->set_config(&set); | 187 | ret = crtc->funcs->set_config(&set); |
193 | plane->fb = tmpfb; | ||
194 | 188 | ||
195 | kfree(connector_list); | 189 | kfree(connector_list); |
196 | return ret; | 190 | return ret; |
@@ -232,7 +226,6 @@ EXPORT_SYMBOL(drm_primary_helper_disable); | |||
232 | */ | 226 | */ |
233 | void drm_primary_helper_destroy(struct drm_plane *plane) | 227 | void drm_primary_helper_destroy(struct drm_plane *plane) |
234 | { | 228 | { |
235 | plane->funcs->disable_plane(plane); | ||
236 | drm_plane_cleanup(plane); | 229 | drm_plane_cleanup(plane); |
237 | kfree(plane); | 230 | kfree(plane); |
238 | } | 231 | } |
diff --git a/drivers/gpu/drm/drm_probe_helper.c b/drivers/gpu/drm/drm_probe_helper.c index 8afdd0998a8c..79f07f2c13d3 100644 --- a/drivers/gpu/drm/drm_probe_helper.c +++ b/drivers/gpu/drm/drm_probe_helper.c | |||
@@ -151,7 +151,7 @@ static int drm_helper_probe_single_connector_modes_merge_bits(struct drm_connect | |||
151 | drm_mode_validate_flag(connector, mode_flags); | 151 | drm_mode_validate_flag(connector, mode_flags); |
152 | 152 | ||
153 | list_for_each_entry(mode, &connector->modes, head) { | 153 | list_for_each_entry(mode, &connector->modes, head) { |
154 | if (mode->status == MODE_OK) | 154 | if (mode->status == MODE_OK && connector_funcs->mode_valid) |
155 | mode->status = connector_funcs->mode_valid(connector, | 155 | mode->status = connector_funcs->mode_valid(connector, |
156 | mode); | 156 | mode); |
157 | } | 157 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index aed533bbfd31..bb74472b4e4b 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c | |||
@@ -949,12 +949,6 @@ static int exynos_dp_get_modes(struct drm_connector *connector) | |||
949 | return 1; | 949 | return 1; |
950 | } | 950 | } |
951 | 951 | ||
952 | static int exynos_dp_mode_valid(struct drm_connector *connector, | ||
953 | struct drm_display_mode *mode) | ||
954 | { | ||
955 | return MODE_OK; | ||
956 | } | ||
957 | |||
958 | static struct drm_encoder *exynos_dp_best_encoder( | 952 | static struct drm_encoder *exynos_dp_best_encoder( |
959 | struct drm_connector *connector) | 953 | struct drm_connector *connector) |
960 | { | 954 | { |
@@ -965,7 +959,6 @@ static struct drm_encoder *exynos_dp_best_encoder( | |||
965 | 959 | ||
966 | static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = { | 960 | static struct drm_connector_helper_funcs exynos_dp_connector_helper_funcs = { |
967 | .get_modes = exynos_dp_get_modes, | 961 | .get_modes = exynos_dp_get_modes, |
968 | .mode_valid = exynos_dp_mode_valid, | ||
969 | .best_encoder = exynos_dp_best_encoder, | 962 | .best_encoder = exynos_dp_best_encoder, |
970 | }; | 963 | }; |
971 | 964 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_dpi.c b/drivers/gpu/drm/exynos/exynos_drm_dpi.c index 2b09c7c0bfcc..82e52c71bccc 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dpi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dpi.c | |||
@@ -94,12 +94,6 @@ static int exynos_dpi_get_modes(struct drm_connector *connector) | |||
94 | return 0; | 94 | return 0; |
95 | } | 95 | } |
96 | 96 | ||
97 | static int exynos_dpi_mode_valid(struct drm_connector *connector, | ||
98 | struct drm_display_mode *mode) | ||
99 | { | ||
100 | return MODE_OK; | ||
101 | } | ||
102 | |||
103 | static struct drm_encoder * | 97 | static struct drm_encoder * |
104 | exynos_dpi_best_encoder(struct drm_connector *connector) | 98 | exynos_dpi_best_encoder(struct drm_connector *connector) |
105 | { | 99 | { |
@@ -110,7 +104,6 @@ exynos_dpi_best_encoder(struct drm_connector *connector) | |||
110 | 104 | ||
111 | static struct drm_connector_helper_funcs exynos_dpi_connector_helper_funcs = { | 105 | static struct drm_connector_helper_funcs exynos_dpi_connector_helper_funcs = { |
112 | .get_modes = exynos_dpi_get_modes, | 106 | .get_modes = exynos_dpi_get_modes, |
113 | .mode_valid = exynos_dpi_mode_valid, | ||
114 | .best_encoder = exynos_dpi_best_encoder, | 107 | .best_encoder = exynos_dpi_best_encoder, |
115 | }; | 108 | }; |
116 | 109 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 852f2dadaebd..3fa987df906a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -533,12 +533,6 @@ static int vidi_get_modes(struct drm_connector *connector) | |||
533 | return drm_add_edid_modes(connector, edid); | 533 | return drm_add_edid_modes(connector, edid); |
534 | } | 534 | } |
535 | 535 | ||
536 | static int vidi_mode_valid(struct drm_connector *connector, | ||
537 | struct drm_display_mode *mode) | ||
538 | { | ||
539 | return MODE_OK; | ||
540 | } | ||
541 | |||
542 | static struct drm_encoder *vidi_best_encoder(struct drm_connector *connector) | 536 | static struct drm_encoder *vidi_best_encoder(struct drm_connector *connector) |
543 | { | 537 | { |
544 | struct vidi_context *ctx = ctx_from_connector(connector); | 538 | struct vidi_context *ctx = ctx_from_connector(connector); |
@@ -548,7 +542,6 @@ static struct drm_encoder *vidi_best_encoder(struct drm_connector *connector) | |||
548 | 542 | ||
549 | static struct drm_connector_helper_funcs vidi_connector_helper_funcs = { | 543 | static struct drm_connector_helper_funcs vidi_connector_helper_funcs = { |
550 | .get_modes = vidi_get_modes, | 544 | .get_modes = vidi_get_modes, |
551 | .mode_valid = vidi_mode_valid, | ||
552 | .best_encoder = vidi_best_encoder, | 545 | .best_encoder = vidi_best_encoder, |
553 | }; | 546 | }; |
554 | 547 | ||
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c index 4f3ba93cd91d..289048d1c7b2 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_lvdscon.c | |||
@@ -57,15 +57,8 @@ static int rcar_du_lvds_connector_get_modes(struct drm_connector *connector) | |||
57 | return 1; | 57 | return 1; |
58 | } | 58 | } |
59 | 59 | ||
60 | static int rcar_du_lvds_connector_mode_valid(struct drm_connector *connector, | ||
61 | struct drm_display_mode *mode) | ||
62 | { | ||
63 | return MODE_OK; | ||
64 | } | ||
65 | |||
66 | static const struct drm_connector_helper_funcs connector_helper_funcs = { | 60 | static const struct drm_connector_helper_funcs connector_helper_funcs = { |
67 | .get_modes = rcar_du_lvds_connector_get_modes, | 61 | .get_modes = rcar_du_lvds_connector_get_modes, |
68 | .mode_valid = rcar_du_lvds_connector_mode_valid, | ||
69 | .best_encoder = rcar_du_connector_best_encoder, | 62 | .best_encoder = rcar_du_connector_best_encoder, |
70 | }; | 63 | }; |
71 | 64 | ||
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c index 41d563adfeaa..ccfe64c7188f 100644 --- a/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c +++ b/drivers/gpu/drm/rcar-du/rcar_du_vgacon.c | |||
@@ -25,15 +25,8 @@ static int rcar_du_vga_connector_get_modes(struct drm_connector *connector) | |||
25 | return 0; | 25 | return 0; |
26 | } | 26 | } |
27 | 27 | ||
28 | static int rcar_du_vga_connector_mode_valid(struct drm_connector *connector, | ||
29 | struct drm_display_mode *mode) | ||
30 | { | ||
31 | return MODE_OK; | ||
32 | } | ||
33 | |||
34 | static const struct drm_connector_helper_funcs connector_helper_funcs = { | 28 | static const struct drm_connector_helper_funcs connector_helper_funcs = { |
35 | .get_modes = rcar_du_vga_connector_get_modes, | 29 | .get_modes = rcar_du_vga_connector_get_modes, |
36 | .mode_valid = rcar_du_vga_connector_mode_valid, | ||
37 | .best_encoder = rcar_du_connector_best_encoder, | 30 | .best_encoder = rcar_du_connector_best_encoder, |
38 | }; | 31 | }; |
39 | 32 | ||
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c index e9e5e6d368cc..faf176b2daf9 100644 --- a/drivers/gpu/drm/shmobile/shmob_drm_crtc.c +++ b/drivers/gpu/drm/shmobile/shmob_drm_crtc.c | |||
@@ -674,12 +674,6 @@ static int shmob_drm_connector_get_modes(struct drm_connector *connector) | |||
674 | return 1; | 674 | return 1; |
675 | } | 675 | } |
676 | 676 | ||
677 | static int shmob_drm_connector_mode_valid(struct drm_connector *connector, | ||
678 | struct drm_display_mode *mode) | ||
679 | { | ||
680 | return MODE_OK; | ||
681 | } | ||
682 | |||
683 | static struct drm_encoder * | 677 | static struct drm_encoder * |
684 | shmob_drm_connector_best_encoder(struct drm_connector *connector) | 678 | shmob_drm_connector_best_encoder(struct drm_connector *connector) |
685 | { | 679 | { |
@@ -690,7 +684,6 @@ shmob_drm_connector_best_encoder(struct drm_connector *connector) | |||
690 | 684 | ||
691 | static const struct drm_connector_helper_funcs connector_helper_funcs = { | 685 | static const struct drm_connector_helper_funcs connector_helper_funcs = { |
692 | .get_modes = shmob_drm_connector_get_modes, | 686 | .get_modes = shmob_drm_connector_get_modes, |
693 | .mode_valid = shmob_drm_connector_mode_valid, | ||
694 | .best_encoder = shmob_drm_connector_best_encoder, | 687 | .best_encoder = shmob_drm_connector_best_encoder, |
695 | }; | 688 | }; |
696 | 689 | ||
diff --git a/drivers/staging/imx-drm/imx-drm-core.c b/drivers/staging/imx-drm/imx-drm-core.c index 4144a75e5f71..53ff005245c5 100644 --- a/drivers/staging/imx-drm/imx-drm-core.c +++ b/drivers/staging/imx-drm/imx-drm-core.c | |||
@@ -200,13 +200,6 @@ static const struct file_operations imx_drm_driver_fops = { | |||
200 | .llseek = noop_llseek, | 200 | .llseek = noop_llseek, |
201 | }; | 201 | }; |
202 | 202 | ||
203 | int imx_drm_connector_mode_valid(struct drm_connector *connector, | ||
204 | struct drm_display_mode *mode) | ||
205 | { | ||
206 | return MODE_OK; | ||
207 | } | ||
208 | EXPORT_SYMBOL(imx_drm_connector_mode_valid); | ||
209 | |||
210 | void imx_drm_connector_destroy(struct drm_connector *connector) | 203 | void imx_drm_connector_destroy(struct drm_connector *connector) |
211 | { | 204 | { |
212 | drm_sysfs_connector_remove(connector); | 205 | drm_sysfs_connector_remove(connector); |
diff --git a/drivers/staging/imx-drm/imx-drm.h b/drivers/staging/imx-drm/imx-drm.h index a322bac55414..7453ae00c412 100644 --- a/drivers/staging/imx-drm/imx-drm.h +++ b/drivers/staging/imx-drm/imx-drm.h | |||
@@ -50,8 +50,6 @@ int imx_drm_encoder_get_mux_id(struct device_node *node, | |||
50 | int imx_drm_encoder_parse_of(struct drm_device *drm, | 50 | int imx_drm_encoder_parse_of(struct drm_device *drm, |
51 | struct drm_encoder *encoder, struct device_node *np); | 51 | struct drm_encoder *encoder, struct device_node *np); |
52 | 52 | ||
53 | int imx_drm_connector_mode_valid(struct drm_connector *connector, | ||
54 | struct drm_display_mode *mode); | ||
55 | void imx_drm_connector_destroy(struct drm_connector *connector); | 53 | void imx_drm_connector_destroy(struct drm_connector *connector); |
56 | void imx_drm_encoder_destroy(struct drm_encoder *encoder); | 54 | void imx_drm_encoder_destroy(struct drm_encoder *encoder); |
57 | 55 | ||
diff --git a/drivers/staging/imx-drm/imx-hdmi.c b/drivers/staging/imx-drm/imx-hdmi.c index d47dedd2cdb4..9fbe6d6a989d 100644 --- a/drivers/staging/imx-drm/imx-hdmi.c +++ b/drivers/staging/imx-drm/imx-hdmi.c | |||
@@ -1492,7 +1492,6 @@ static struct drm_connector_funcs imx_hdmi_connector_funcs = { | |||
1492 | 1492 | ||
1493 | static struct drm_connector_helper_funcs imx_hdmi_connector_helper_funcs = { | 1493 | static struct drm_connector_helper_funcs imx_hdmi_connector_helper_funcs = { |
1494 | .get_modes = imx_hdmi_connector_get_modes, | 1494 | .get_modes = imx_hdmi_connector_get_modes, |
1495 | .mode_valid = imx_drm_connector_mode_valid, | ||
1496 | .best_encoder = imx_hdmi_connector_best_encoder, | 1495 | .best_encoder = imx_hdmi_connector_best_encoder, |
1497 | }; | 1496 | }; |
1498 | 1497 | ||
diff --git a/drivers/staging/imx-drm/imx-ldb.c b/drivers/staging/imx-drm/imx-ldb.c index fe4c1ef4e7a5..7e3f019d7e72 100644 --- a/drivers/staging/imx-drm/imx-ldb.c +++ b/drivers/staging/imx-drm/imx-ldb.c | |||
@@ -317,7 +317,6 @@ static struct drm_connector_funcs imx_ldb_connector_funcs = { | |||
317 | static struct drm_connector_helper_funcs imx_ldb_connector_helper_funcs = { | 317 | static struct drm_connector_helper_funcs imx_ldb_connector_helper_funcs = { |
318 | .get_modes = imx_ldb_connector_get_modes, | 318 | .get_modes = imx_ldb_connector_get_modes, |
319 | .best_encoder = imx_ldb_connector_best_encoder, | 319 | .best_encoder = imx_ldb_connector_best_encoder, |
320 | .mode_valid = imx_drm_connector_mode_valid, | ||
321 | }; | 320 | }; |
322 | 321 | ||
323 | static struct drm_encoder_funcs imx_ldb_encoder_funcs = { | 322 | static struct drm_encoder_funcs imx_ldb_encoder_funcs = { |
diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c index 575533f4fd64..5a5a5287a86a 100644 --- a/drivers/staging/imx-drm/imx-tve.c +++ b/drivers/staging/imx-drm/imx-tve.c | |||
@@ -251,10 +251,6 @@ static int imx_tve_connector_mode_valid(struct drm_connector *connector, | |||
251 | unsigned long rate; | 251 | unsigned long rate; |
252 | int ret; | 252 | int ret; |
253 | 253 | ||
254 | ret = imx_drm_connector_mode_valid(connector, mode); | ||
255 | if (ret != MODE_OK) | ||
256 | return ret; | ||
257 | |||
258 | /* pixel clock with 2x oversampling */ | 254 | /* pixel clock with 2x oversampling */ |
259 | rate = clk_round_rate(tve->clk, 2000UL * mode->clock) / 2000; | 255 | rate = clk_round_rate(tve->clk, 2000UL * mode->clock) / 2000; |
260 | if (rate == mode->clock) | 256 | if (rate == mode->clock) |
diff --git a/drivers/staging/imx-drm/parallel-display.c b/drivers/staging/imx-drm/parallel-display.c index c60b6c645f42..52598e489a4b 100644 --- a/drivers/staging/imx-drm/parallel-display.c +++ b/drivers/staging/imx-drm/parallel-display.c | |||
@@ -148,7 +148,6 @@ static struct drm_connector_funcs imx_pd_connector_funcs = { | |||
148 | static struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = { | 148 | static struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = { |
149 | .get_modes = imx_pd_connector_get_modes, | 149 | .get_modes = imx_pd_connector_get_modes, |
150 | .best_encoder = imx_pd_connector_best_encoder, | 150 | .best_encoder = imx_pd_connector_best_encoder, |
151 | .mode_valid = imx_drm_connector_mode_valid, | ||
152 | }; | 151 | }; |
153 | 152 | ||
154 | static struct drm_encoder_funcs imx_pd_encoder_funcs = { | 153 | static struct drm_encoder_funcs imx_pd_encoder_funcs = { |
diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index c6b9e8ab0a26..698d54e27f39 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h | |||
@@ -1021,6 +1021,7 @@ extern int drm_mode_gamma_get_ioctl(struct drm_device *dev, | |||
1021 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, | 1021 | extern int drm_mode_gamma_set_ioctl(struct drm_device *dev, |
1022 | void *data, struct drm_file *file_priv); | 1022 | void *data, struct drm_file *file_priv); |
1023 | extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match); | 1023 | extern u8 drm_match_cea_mode(const struct drm_display_mode *to_match); |
1024 | extern enum hdmi_picture_aspect drm_get_cea_aspect_ratio(const u8 video_code); | ||
1024 | extern bool drm_detect_hdmi_monitor(struct edid *edid); | 1025 | extern bool drm_detect_hdmi_monitor(struct edid *edid); |
1025 | extern bool drm_detect_monitor_audio(struct edid *edid); | 1026 | extern bool drm_detect_monitor_audio(struct edid *edid); |
1026 | extern bool drm_rgb_quant_range_selectable(struct edid *edid); | 1027 | extern bool drm_rgb_quant_range_selectable(struct edid *edid); |
diff --git a/include/drm/drm_crtc_helper.h b/include/drm/drm_crtc_helper.h index f51c8393e9a8..a3d75fefd010 100644 --- a/include/drm/drm_crtc_helper.h +++ b/include/drm/drm_crtc_helper.h | |||
@@ -114,7 +114,7 @@ struct drm_encoder_helper_funcs { | |||
114 | /** | 114 | /** |
115 | * drm_connector_helper_funcs - helper operations for connectors | 115 | * drm_connector_helper_funcs - helper operations for connectors |
116 | * @get_modes: get mode list for this connector | 116 | * @get_modes: get mode list for this connector |
117 | * @mode_valid: is this mode valid on the given connector? | 117 | * @mode_valid (optional): is this mode valid on the given connector? |
118 | * | 118 | * |
119 | * The helper operations are called by the mid-layer CRTC helper. | 119 | * The helper operations are called by the mid-layer CRTC helper. |
120 | */ | 120 | */ |
diff --git a/include/drm/drm_flip_work.h b/include/drm/drm_flip_work.h index 35c776ae7d3b..9eed34dcd6af 100644 --- a/include/drm/drm_flip_work.h +++ b/include/drm/drm_flip_work.h | |||
@@ -57,6 +57,7 @@ typedef void (*drm_flip_func_t)(struct drm_flip_work *work, void *val); | |||
57 | * @count: number of committed items | 57 | * @count: number of committed items |
58 | * @func: callback fxn called for each committed item | 58 | * @func: callback fxn called for each committed item |
59 | * @worker: worker which calls @func | 59 | * @worker: worker which calls @func |
60 | * @fifo: queue of committed items | ||
60 | */ | 61 | */ |
61 | struct drm_flip_work { | 62 | struct drm_flip_work { |
62 | const char *name; | 63 | const char *name; |