diff options
| author | Noralf Trønnes <noralf@tronnes.org> | 2017-11-15 09:19:51 -0500 |
|---|---|---|
| committer | Noralf Trønnes <noralf@tronnes.org> | 2017-12-08 08:47:41 -0500 |
| commit | 53889c92fde989e71f5bd01b227d58cd92010128 (patch) | |
| tree | c2ce6b5e3f2fe8a8818a151bb4a5b501c29caf2f /drivers/gpu/drm/sti | |
| parent | d18df744de1a2823086486588e497aad68370de6 (diff) | |
drm/sti: Use drm_fb_cma_fbdev_init/fini()
Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.
Cc: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-13-noralf@tronnes.org
Diffstat (limited to 'drivers/gpu/drm/sti')
| -rw-r--r-- | drivers/gpu/drm/sti/sti_drv.c | 27 | ||||
| -rw-r--r-- | drivers/gpu/drm/sti/sti_drv.h | 1 |
2 files changed, 5 insertions, 23 deletions
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c index 88d1dc6408af..55b6967d27e1 100644 --- a/drivers/gpu/drm/sti/sti_drv.c +++ b/drivers/gpu/drm/sti/sti_drv.c | |||
| @@ -17,6 +17,7 @@ | |||
| 17 | #include <drm/drm_crtc_helper.h> | 17 | #include <drm/drm_crtc_helper.h> |
| 18 | #include <drm/drm_gem_cma_helper.h> | 18 | #include <drm/drm_gem_cma_helper.h> |
| 19 | #include <drm/drm_gem_framebuffer_helper.h> | 19 | #include <drm/drm_gem_framebuffer_helper.h> |
| 20 | #include <drm/drm_fb_helper.h> | ||
| 20 | #include <drm/drm_fb_cma_helper.h> | 21 | #include <drm/drm_fb_cma_helper.h> |
| 21 | #include <drm/drm_of.h> | 22 | #include <drm/drm_of.h> |
| 22 | 23 | ||
| @@ -138,16 +139,9 @@ static int sti_atomic_check(struct drm_device *dev, | |||
| 138 | return ret; | 139 | return ret; |
| 139 | } | 140 | } |
| 140 | 141 | ||
| 141 | static void sti_output_poll_changed(struct drm_device *ddev) | ||
| 142 | { | ||
| 143 | struct sti_private *private = ddev->dev_private; | ||
| 144 | |||
| 145 | drm_fbdev_cma_hotplug_event(private->fbdev); | ||
| 146 | } | ||
| 147 | |||
| 148 | static const struct drm_mode_config_funcs sti_mode_config_funcs = { | 142 | static const struct drm_mode_config_funcs sti_mode_config_funcs = { |
| 149 | .fb_create = drm_gem_fb_create, | 143 | .fb_create = drm_gem_fb_create, |
| 150 | .output_poll_changed = sti_output_poll_changed, | 144 | .output_poll_changed = drm_fb_helper_output_poll_changed, |
| 151 | .atomic_check = sti_atomic_check, | 145 | .atomic_check = sti_atomic_check, |
| 152 | .atomic_commit = drm_atomic_helper_commit, | 146 | .atomic_commit = drm_atomic_helper_commit, |
| 153 | }; | 147 | }; |
| @@ -230,11 +224,7 @@ static void sti_cleanup(struct drm_device *ddev) | |||
| 230 | { | 224 | { |
| 231 | struct sti_private *private = ddev->dev_private; | 225 | struct sti_private *private = ddev->dev_private; |
| 232 | 226 | ||
| 233 | if (private->fbdev) { | 227 | drm_fb_cma_fbdev_fini(ddev); |
| 234 | drm_fbdev_cma_fini(private->fbdev); | ||
| 235 | private->fbdev = NULL; | ||
| 236 | } | ||
| 237 | |||
| 238 | drm_kms_helper_poll_fini(ddev); | 228 | drm_kms_helper_poll_fini(ddev); |
| 239 | component_unbind_all(ddev->dev, ddev); | 229 | component_unbind_all(ddev->dev, ddev); |
| 240 | kfree(private); | 230 | kfree(private); |
| @@ -244,8 +234,6 @@ static void sti_cleanup(struct drm_device *ddev) | |||
| 244 | static int sti_bind(struct device *dev) | 234 | static int sti_bind(struct device *dev) |
| 245 | { | 235 | { |
| 246 | struct drm_device *ddev; | 236 | struct drm_device *ddev; |
| 247 | struct sti_private *private; | ||
| 248 | struct drm_fbdev_cma *fbdev; | ||
| 249 | int ret; | 237 | int ret; |
| 250 | 238 | ||
| 251 | ddev = drm_dev_alloc(&sti_driver, dev); | 239 | ddev = drm_dev_alloc(&sti_driver, dev); |
| @@ -266,15 +254,10 @@ static int sti_bind(struct device *dev) | |||
| 266 | 254 | ||
| 267 | drm_mode_config_reset(ddev); | 255 | drm_mode_config_reset(ddev); |
| 268 | 256 | ||
| 269 | private = ddev->dev_private; | ||
| 270 | if (ddev->mode_config.num_connector) { | 257 | if (ddev->mode_config.num_connector) { |
| 271 | fbdev = drm_fbdev_cma_init(ddev, 32, | 258 | ret = drm_fb_cma_fbdev_init(ddev, 32, 0); |
| 272 | ddev->mode_config.num_connector); | 259 | if (ret) |
| 273 | if (IS_ERR(fbdev)) { | ||
| 274 | DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n"); | 260 | DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n"); |
| 275 | fbdev = NULL; | ||
| 276 | } | ||
| 277 | private->fbdev = fbdev; | ||
| 278 | } | 261 | } |
| 279 | 262 | ||
| 280 | return 0; | 263 | return 0; |
diff --git a/drivers/gpu/drm/sti/sti_drv.h b/drivers/gpu/drm/sti/sti_drv.h index abc49b43566e..4b41142a22e4 100644 --- a/drivers/gpu/drm/sti/sti_drv.h +++ b/drivers/gpu/drm/sti/sti_drv.h | |||
| @@ -24,7 +24,6 @@ struct sti_private { | |||
| 24 | struct sti_compositor *compo; | 24 | struct sti_compositor *compo; |
| 25 | struct drm_property *plane_zorder_property; | 25 | struct drm_property *plane_zorder_property; |
| 26 | struct drm_device *drm_dev; | 26 | struct drm_device *drm_dev; |
| 27 | struct drm_fbdev_cma *fbdev; | ||
| 28 | }; | 27 | }; |
| 29 | 28 | ||
| 30 | extern struct platform_driver sti_tvout_driver; | 29 | extern struct platform_driver sti_tvout_driver; |
