950-0679-drm-fb-helper-Look-up-preferred-fbdev-node-number-fr.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. From 35f881ca59d6f8bbf49889a792d3539d9bab6ed2 Mon Sep 17 00:00:00 2001
  2. From: Dave Stevenson <[email protected]>
  3. Date: Mon, 9 Oct 2023 16:34:36 +0100
  4. Subject: [PATCH 0679/1085] drm/fb-helper: Look up preferred fbdev node number
  5. from DT
  6. For situations where there are multiple DRM cards in a system,
  7. add a query of DT for "drm_fb" designations for cards to set
  8. their preferred /dev/fbN designation.
  9. Signed-off-by: Dave Stevenson <[email protected]>
  10. ---
  11. drivers/gpu/drm/drm_fb_helper.c | 11 ++++++++++-
  12. 1 file changed, 10 insertions(+), 1 deletion(-)
  13. --- a/drivers/gpu/drm/drm_fb_helper.c
  14. +++ b/drivers/gpu/drm/drm_fb_helper.c
  15. @@ -1851,7 +1851,7 @@ __drm_fb_helper_initial_config_and_unloc
  16. struct drm_device *dev = fb_helper->dev;
  17. struct fb_info *info;
  18. unsigned int width, height;
  19. - int ret;
  20. + int ret, id;
  21. width = dev->mode_config.max_width;
  22. height = dev->mode_config.max_height;
  23. @@ -1879,6 +1879,15 @@ __drm_fb_helper_initial_config_and_unloc
  24. * register the fbdev emulation instance in kernel_fb_helper_list. */
  25. mutex_unlock(&fb_helper->lock);
  26. + id = of_alias_get_highest_id("drm_fb");
  27. + if (id >= 0)
  28. + fb_set_lowest_dynamic_fb(id + 1);
  29. +
  30. + id = of_alias_get_id(dev->dev->of_node, "drm_fb");
  31. + if (id >= 0) {
  32. + info->node = id;
  33. + info->custom_fb_num = true;
  34. + }
  35. ret = register_framebuffer(info);
  36. if (ret < 0)
  37. return ret;