aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/drm_fb_helper.c26
-rw-r--r--include/drm/drm_fb_helper.h2
2 files changed, 23 insertions, 5 deletions
diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 11d7a72c22d9..140b9525b48a 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -1516,17 +1516,33 @@ bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel)
1516} 1516}
1517EXPORT_SYMBOL(drm_fb_helper_initial_config); 1517EXPORT_SYMBOL(drm_fb_helper_initial_config);
1518 1518
1519bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper) 1519/**
1520 * drm_fb_helper_hotplug_event - respond to a hotplug notification by
1521 * probing all the outputs attached to the fb.
1522 * @fb_helper: the drm_fb_helper
1523 *
1524 * LOCKING:
1525 * Called at runtime, must take mode config lock.
1526 *
1527 * Scan the connectors attached to the fb_helper and try to put together a
1528 * setup after *notification of a change in output configuration.
1529 *
1530 * RETURNS:
1531 * 0 on success and a non-zero error code otherwise.
1532 */
1533int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1520{ 1534{
1535 struct drm_device *dev = fb_helper->dev;
1521 int count = 0; 1536 int count = 0;
1522 u32 max_width, max_height, bpp_sel; 1537 u32 max_width, max_height, bpp_sel;
1523 bool bound = false, crtcs_bound = false; 1538 bool bound = false, crtcs_bound = false;
1524 struct drm_crtc *crtc; 1539 struct drm_crtc *crtc;
1525 1540
1526 if (!fb_helper->fb) 1541 if (!fb_helper->fb)
1527 return false; 1542 return 0;
1528 1543
1529 list_for_each_entry(crtc, &fb_helper->dev->mode_config.crtc_list, head) { 1544 mutex_lock(&dev->mode_config.mutex);
1545 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
1530 if (crtc->fb) 1546 if (crtc->fb)
1531 crtcs_bound = true; 1547 crtcs_bound = true;
1532 if (crtc->fb == fb_helper->fb) 1548 if (crtc->fb == fb_helper->fb)
@@ -1535,7 +1551,8 @@ bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1535 1551
1536 if (!bound && crtcs_bound) { 1552 if (!bound && crtcs_bound) {
1537 fb_helper->delayed_hotplug = true; 1553 fb_helper->delayed_hotplug = true;
1538 return false; 1554 mutex_unlock(&dev->mode_config.mutex);
1555 return 0;
1539 } 1556 }
1540 DRM_DEBUG_KMS("\n"); 1557 DRM_DEBUG_KMS("\n");
1541 1558
@@ -1546,6 +1563,7 @@ bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper)
1546 count = drm_fb_helper_probe_connector_modes(fb_helper, max_width, 1563 count = drm_fb_helper_probe_connector_modes(fb_helper, max_width,
1547 max_height); 1564 max_height);
1548 drm_setup_crtcs(fb_helper); 1565 drm_setup_crtcs(fb_helper);
1566 mutex_unlock(&dev->mode_config.mutex);
1549 1567
1550 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel); 1568 return drm_fb_helper_single_fb_probe(fb_helper, bpp_sel);
1551} 1569}
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index ade09d7b4271..c99c3d3e7811 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -127,7 +127,7 @@ void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
127 127
128int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info); 128int drm_fb_helper_setcmap(struct fb_cmap *cmap, struct fb_info *info);
129 129
130bool drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper); 130int drm_fb_helper_hotplug_event(struct drm_fb_helper *fb_helper);
131bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel); 131bool drm_fb_helper_initial_config(struct drm_fb_helper *fb_helper, int bpp_sel);
132int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper); 132int drm_fb_helper_single_add_all_connectors(struct drm_fb_helper *fb_helper);
133int drm_fb_helper_debug_enter(struct fb_info *info); 133int drm_fb_helper_debug_enter(struct fb_info *info);