diff options
Diffstat (limited to 'drivers/gpu/drm/imx')
| -rw-r--r-- | drivers/gpu/drm/imx/imx-drm-core.c | 47 | ||||
| -rw-r--r-- | drivers/gpu/drm/imx/imx-drm.h | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/imx/imx-ldb.c | 9 | ||||
| -rw-r--r-- | drivers/gpu/drm/imx/ipuv3-crtc.c | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/imx/ipuv3-plane.c | 9 |
5 files changed, 13 insertions, 54 deletions
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c index 1d053bbefc02..5ea0c82f9957 100644 --- a/drivers/gpu/drm/imx/imx-drm-core.c +++ b/drivers/gpu/drm/imx/imx-drm-core.c | |||
| @@ -35,12 +35,6 @@ | |||
| 35 | 35 | ||
| 36 | #define MAX_CRTC 4 | 36 | #define MAX_CRTC 4 |
| 37 | 37 | ||
| 38 | struct imx_drm_device { | ||
| 39 | struct drm_device *drm; | ||
| 40 | unsigned int pipes; | ||
| 41 | struct drm_atomic_state *state; | ||
| 42 | }; | ||
| 43 | |||
| 44 | #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) | 38 | #if IS_ENABLED(CONFIG_DRM_FBDEV_EMULATION) |
| 45 | static int legacyfb_depth = 16; | 39 | static int legacyfb_depth = 16; |
| 46 | module_param(legacyfb_depth, int, 0444); | 40 | module_param(legacyfb_depth, int, 0444); |
| @@ -219,22 +213,12 @@ static int compare_of(struct device *dev, void *data) | |||
| 219 | static int imx_drm_bind(struct device *dev) | 213 | static int imx_drm_bind(struct device *dev) |
| 220 | { | 214 | { |
| 221 | struct drm_device *drm; | 215 | struct drm_device *drm; |
| 222 | struct imx_drm_device *imxdrm; | ||
| 223 | int ret; | 216 | int ret; |
| 224 | 217 | ||
| 225 | drm = drm_dev_alloc(&imx_drm_driver, dev); | 218 | drm = drm_dev_alloc(&imx_drm_driver, dev); |
| 226 | if (IS_ERR(drm)) | 219 | if (IS_ERR(drm)) |
| 227 | return PTR_ERR(drm); | 220 | return PTR_ERR(drm); |
| 228 | 221 | ||
| 229 | imxdrm = devm_kzalloc(dev, sizeof(*imxdrm), GFP_KERNEL); | ||
| 230 | if (!imxdrm) { | ||
| 231 | ret = -ENOMEM; | ||
| 232 | goto err_unref; | ||
| 233 | } | ||
| 234 | |||
| 235 | imxdrm->drm = drm; | ||
| 236 | drm->dev_private = imxdrm; | ||
| 237 | |||
| 238 | /* | 222 | /* |
| 239 | * enable drm irq mode. | 223 | * enable drm irq mode. |
| 240 | * - with irq_enabled = true, we can use the vblank feature. | 224 | * - with irq_enabled = true, we can use the vblank feature. |
| @@ -306,8 +290,7 @@ err_unbind: | |||
| 306 | component_unbind_all(drm->dev, drm); | 290 | component_unbind_all(drm->dev, drm); |
| 307 | err_kms: | 291 | err_kms: |
| 308 | drm_mode_config_cleanup(drm); | 292 | drm_mode_config_cleanup(drm); |
| 309 | err_unref: | 293 | drm_dev_put(drm); |
| 310 | drm_dev_unref(drm); | ||
| 311 | 294 | ||
| 312 | return ret; | 295 | return ret; |
| 313 | } | 296 | } |
| @@ -327,7 +310,7 @@ static void imx_drm_unbind(struct device *dev) | |||
| 327 | component_unbind_all(drm->dev, drm); | 310 | component_unbind_all(drm->dev, drm); |
| 328 | dev_set_drvdata(dev, NULL); | 311 | dev_set_drvdata(dev, NULL); |
| 329 | 312 | ||
| 330 | drm_dev_unref(drm); | 313 | drm_dev_put(drm); |
| 331 | } | 314 | } |
| 332 | 315 | ||
| 333 | static const struct component_master_ops imx_drm_ops = { | 316 | static const struct component_master_ops imx_drm_ops = { |
| @@ -355,37 +338,15 @@ static int imx_drm_platform_remove(struct platform_device *pdev) | |||
| 355 | static int imx_drm_suspend(struct device *dev) | 338 | static int imx_drm_suspend(struct device *dev) |
| 356 | { | 339 | { |
| 357 | struct drm_device *drm_dev = dev_get_drvdata(dev); | 340 | struct drm_device *drm_dev = dev_get_drvdata(dev); |
| 358 | struct imx_drm_device *imxdrm; | ||
| 359 | |||
| 360 | /* The drm_dev is NULL before .load hook is called */ | ||
| 361 | if (drm_dev == NULL) | ||
| 362 | return 0; | ||
| 363 | |||
| 364 | drm_kms_helper_poll_disable(drm_dev); | ||
| 365 | 341 | ||
| 366 | imxdrm = drm_dev->dev_private; | 342 | return drm_mode_config_helper_suspend(drm_dev); |
| 367 | imxdrm->state = drm_atomic_helper_suspend(drm_dev); | ||
| 368 | if (IS_ERR(imxdrm->state)) { | ||
| 369 | drm_kms_helper_poll_enable(drm_dev); | ||
| 370 | return PTR_ERR(imxdrm->state); | ||
| 371 | } | ||
| 372 | |||
| 373 | return 0; | ||
| 374 | } | 343 | } |
| 375 | 344 | ||
| 376 | static int imx_drm_resume(struct device *dev) | 345 | static int imx_drm_resume(struct device *dev) |
| 377 | { | 346 | { |
| 378 | struct drm_device *drm_dev = dev_get_drvdata(dev); | 347 | struct drm_device *drm_dev = dev_get_drvdata(dev); |
| 379 | struct imx_drm_device *imx_drm; | ||
| 380 | 348 | ||
| 381 | if (drm_dev == NULL) | 349 | return drm_mode_config_helper_resume(drm_dev); |
| 382 | return 0; | ||
| 383 | |||
| 384 | imx_drm = drm_dev->dev_private; | ||
| 385 | drm_atomic_helper_resume(drm_dev, imx_drm->state); | ||
| 386 | drm_kms_helper_poll_enable(drm_dev); | ||
| 387 | |||
| 388 | return 0; | ||
| 389 | } | 350 | } |
| 390 | #endif | 351 | #endif |
| 391 | 352 | ||
diff --git a/drivers/gpu/drm/imx/imx-drm.h b/drivers/gpu/drm/imx/imx-drm.h index 15c2bec47a04..ab9c6f706eb3 100644 --- a/drivers/gpu/drm/imx/imx-drm.h +++ b/drivers/gpu/drm/imx/imx-drm.h | |||
| @@ -10,7 +10,6 @@ struct drm_display_mode; | |||
| 10 | struct drm_encoder; | 10 | struct drm_encoder; |
| 11 | struct drm_framebuffer; | 11 | struct drm_framebuffer; |
| 12 | struct drm_plane; | 12 | struct drm_plane; |
| 13 | struct imx_drm_crtc; | ||
| 14 | struct platform_device; | 13 | struct platform_device; |
| 15 | 14 | ||
| 16 | struct imx_crtc_state { | 15 | struct imx_crtc_state { |
diff --git a/drivers/gpu/drm/imx/imx-ldb.c b/drivers/gpu/drm/imx/imx-ldb.c index 7312beb6f1fc..3bd0f8a18e74 100644 --- a/drivers/gpu/drm/imx/imx-ldb.c +++ b/drivers/gpu/drm/imx/imx-ldb.c | |||
| @@ -611,6 +611,9 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) | |||
| 611 | return PTR_ERR(imx_ldb->regmap); | 611 | return PTR_ERR(imx_ldb->regmap); |
| 612 | } | 612 | } |
| 613 | 613 | ||
| 614 | /* disable LDB by resetting the control register to POR default */ | ||
| 615 | regmap_write(imx_ldb->regmap, IOMUXC_GPR2, 0); | ||
| 616 | |||
| 614 | imx_ldb->dev = dev; | 617 | imx_ldb->dev = dev; |
| 615 | 618 | ||
| 616 | if (of_id) | 619 | if (of_id) |
| @@ -651,14 +654,14 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data) | |||
| 651 | if (ret || i < 0 || i > 1) | 654 | if (ret || i < 0 || i > 1) |
| 652 | return -EINVAL; | 655 | return -EINVAL; |
| 653 | 656 | ||
| 657 | if (!of_device_is_available(child)) | ||
| 658 | continue; | ||
| 659 | |||
| 654 | if (dual && i > 0) { | 660 | if (dual && i > 0) { |
| 655 | dev_warn(dev, "dual-channel mode, ignoring second output\n"); | 661 | dev_warn(dev, "dual-channel mode, ignoring second output\n"); |
| 656 | continue; | 662 | continue; |
| 657 | } | 663 | } |
| 658 | 664 | ||
| 659 | if (!of_device_is_available(child)) | ||
| 660 | continue; | ||
| 661 | |||
| 662 | channel = &imx_ldb->channel[i]; | 665 | channel = &imx_ldb->channel[i]; |
| 663 | channel->ldb = imx_ldb; | 666 | channel->ldb = imx_ldb; |
| 664 | channel->chno = i; | 667 | channel->chno = i; |
diff --git a/drivers/gpu/drm/imx/ipuv3-crtc.c b/drivers/gpu/drm/imx/ipuv3-crtc.c index 21d002859ae0..7d4b710b837a 100644 --- a/drivers/gpu/drm/imx/ipuv3-crtc.c +++ b/drivers/gpu/drm/imx/ipuv3-crtc.c | |||
| @@ -35,7 +35,6 @@ | |||
| 35 | struct ipu_crtc { | 35 | struct ipu_crtc { |
| 36 | struct device *dev; | 36 | struct device *dev; |
| 37 | struct drm_crtc base; | 37 | struct drm_crtc base; |
| 38 | struct imx_drm_crtc *imx_crtc; | ||
| 39 | 38 | ||
| 40 | /* plane[0] is the full plane, plane[1] is the partial plane */ | 39 | /* plane[0] is the full plane, plane[1] is the partial plane */ |
| 41 | struct ipu_plane *plane[2]; | 40 | struct ipu_plane *plane[2]; |
diff --git a/drivers/gpu/drm/imx/ipuv3-plane.c b/drivers/gpu/drm/imx/ipuv3-plane.c index 203f247d4854..40605fdf0e33 100644 --- a/drivers/gpu/drm/imx/ipuv3-plane.c +++ b/drivers/gpu/drm/imx/ipuv3-plane.c | |||
| @@ -281,16 +281,13 @@ static void ipu_plane_state_reset(struct drm_plane *plane) | |||
| 281 | ipu_state = to_ipu_plane_state(plane->state); | 281 | ipu_state = to_ipu_plane_state(plane->state); |
| 282 | __drm_atomic_helper_plane_destroy_state(plane->state); | 282 | __drm_atomic_helper_plane_destroy_state(plane->state); |
| 283 | kfree(ipu_state); | 283 | kfree(ipu_state); |
| 284 | plane->state = NULL; | ||
| 284 | } | 285 | } |
| 285 | 286 | ||
| 286 | ipu_state = kzalloc(sizeof(*ipu_state), GFP_KERNEL); | 287 | ipu_state = kzalloc(sizeof(*ipu_state), GFP_KERNEL); |
| 287 | 288 | ||
| 288 | if (ipu_state) { | 289 | if (ipu_state) |
| 289 | ipu_state->base.plane = plane; | 290 | __drm_atomic_helper_plane_reset(plane, &ipu_state->base); |
| 290 | ipu_state->base.rotation = DRM_MODE_ROTATE_0; | ||
| 291 | } | ||
| 292 | |||
| 293 | plane->state = &ipu_state->base; | ||
| 294 | } | 291 | } |
| 295 | 292 | ||
| 296 | static struct drm_plane_state * | 293 | static struct drm_plane_state * |
