|
10 | 10 | #include <drm/drm_atomic.h> |
11 | 11 | #include <drm/drm_atomic_helper.h> |
12 | 12 | #include <drm/drm_crtc_helper.h> |
| 13 | +#include <drm/drm_fb_helper.h> |
13 | 14 | #include <drm/drm_gem_framebuffer_helper.h> |
14 | 15 | #include <drm/tinydrm/tinydrm.h> |
15 | 16 | #include <linux/device.h> |
|
35 | 36 | * and registers the DRM device using devm_tinydrm_register(). |
36 | 37 | */ |
37 | 38 |
|
38 | | -/** |
39 | | - * tinydrm_lastclose - DRM lastclose helper |
40 | | - * @drm: DRM device |
41 | | - * |
42 | | - * This function ensures that fbdev is restored when drm_lastclose() is called |
43 | | - * on the last drm_release(). Drivers can use this as their |
44 | | - * &drm_driver->lastclose callback. |
45 | | - */ |
46 | | -void tinydrm_lastclose(struct drm_device *drm) |
47 | | -{ |
48 | | - struct tinydrm_device *tdev = drm->dev_private; |
49 | | - |
50 | | - DRM_DEBUG_KMS("\n"); |
51 | | - drm_fbdev_cma_restore_mode(tdev->fbdev_cma); |
52 | | -} |
53 | | -EXPORT_SYMBOL(tinydrm_lastclose); |
54 | | - |
55 | 39 | /** |
56 | 40 | * tinydrm_gem_cma_prime_import_sg_table - Produce a CMA GEM object from |
57 | 41 | * another driver's scatter/gather table of pinned pages |
@@ -214,35 +198,24 @@ EXPORT_SYMBOL(devm_tinydrm_init); |
214 | 198 | static int tinydrm_register(struct tinydrm_device *tdev) |
215 | 199 | { |
216 | 200 | struct drm_device *drm = tdev->drm; |
217 | | - int bpp = drm->mode_config.preferred_depth; |
218 | | - struct drm_fbdev_cma *fbdev; |
219 | 201 | int ret; |
220 | 202 |
|
221 | 203 | ret = drm_dev_register(tdev->drm, 0); |
222 | 204 | if (ret) |
223 | 205 | return ret; |
224 | 206 |
|
225 | | - fbdev = drm_fbdev_cma_init_with_funcs(drm, bpp ? bpp : 32, |
226 | | - drm->mode_config.num_connector, |
227 | | - tdev->fb_funcs); |
228 | | - if (IS_ERR(fbdev)) |
229 | | - DRM_ERROR("Failed to initialize fbdev: %ld\n", PTR_ERR(fbdev)); |
230 | | - else |
231 | | - tdev->fbdev_cma = fbdev; |
| 207 | + ret = drm_fb_cma_fbdev_init_with_funcs(drm, 0, 0, tdev->fb_funcs); |
| 208 | + if (ret) |
| 209 | + DRM_ERROR("Failed to initialize fbdev: %d\n", ret); |
232 | 210 |
|
233 | 211 | return 0; |
234 | 212 | } |
235 | 213 |
|
236 | 214 | static void tinydrm_unregister(struct tinydrm_device *tdev) |
237 | 215 | { |
238 | | - struct drm_fbdev_cma *fbdev_cma = tdev->fbdev_cma; |
239 | | - |
240 | 216 | drm_atomic_helper_shutdown(tdev->drm); |
241 | | - /* don't restore fbdev in lastclose, keep pipeline disabled */ |
242 | | - tdev->fbdev_cma = NULL; |
| 217 | + drm_fb_cma_fbdev_fini(tdev->drm); |
243 | 218 | drm_dev_unregister(tdev->drm); |
244 | | - if (fbdev_cma) |
245 | | - drm_fbdev_cma_fini(fbdev_cma); |
246 | 219 | } |
247 | 220 |
|
248 | 221 | static void devm_tinydrm_register_release(void *data) |
|
0 commit comments