| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* exynos_drm_fimd.c |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Copyright (C) 2011 Samsung Electronics Co.Ltd |
|---|
| 4 | 5 | * Authors: |
|---|
| 5 | 6 | * Joonyoung Shim <jy0922.shim@samsung.com> |
|---|
| 6 | 7 | * Inki Dae <inki.dae@samsung.com> |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 9 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 10 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 11 | | - * option) any later version. |
|---|
| 12 | | - * |
|---|
| 13 | 8 | */ |
|---|
| 14 | | -#include <drm/drmP.h> |
|---|
| 15 | 9 | |
|---|
| 16 | | -#include <linux/kernel.h> |
|---|
| 17 | | -#include <linux/platform_device.h> |
|---|
| 18 | 10 | #include <linux/clk.h> |
|---|
| 11 | +#include <linux/component.h> |
|---|
| 12 | +#include <linux/kernel.h> |
|---|
| 13 | +#include <linux/mfd/syscon.h> |
|---|
| 19 | 14 | #include <linux/of.h> |
|---|
| 20 | 15 | #include <linux/of_device.h> |
|---|
| 16 | +#include <linux/platform_device.h> |
|---|
| 21 | 17 | #include <linux/pm_runtime.h> |
|---|
| 22 | | -#include <linux/component.h> |
|---|
| 23 | | -#include <linux/mfd/syscon.h> |
|---|
| 24 | 18 | #include <linux/regmap.h> |
|---|
| 25 | 19 | |
|---|
| 26 | 20 | #include <video/of_display_timing.h> |
|---|
| 27 | 21 | #include <video/of_videomode.h> |
|---|
| 28 | 22 | #include <video/samsung_fimd.h> |
|---|
| 23 | + |
|---|
| 24 | +#include <drm/drm_fourcc.h> |
|---|
| 25 | +#include <drm/drm_vblank.h> |
|---|
| 29 | 26 | #include <drm/exynos_drm.h> |
|---|
| 30 | 27 | |
|---|
| 28 | +#include "exynos_drm_crtc.h" |
|---|
| 31 | 29 | #include "exynos_drm_drv.h" |
|---|
| 32 | 30 | #include "exynos_drm_fb.h" |
|---|
| 33 | | -#include "exynos_drm_crtc.h" |
|---|
| 34 | 31 | #include "exynos_drm_plane.h" |
|---|
| 35 | | -#include "exynos_drm_iommu.h" |
|---|
| 36 | 32 | |
|---|
| 37 | 33 | /* |
|---|
| 38 | 34 | * FIMD stands for Fully Interactive Mobile Display and |
|---|
| .. | .. |
|---|
| 171 | 167 | struct fimd_context { |
|---|
| 172 | 168 | struct device *dev; |
|---|
| 173 | 169 | struct drm_device *drm_dev; |
|---|
| 170 | + void *dma_priv; |
|---|
| 174 | 171 | struct exynos_drm_crtc *crtc; |
|---|
| 175 | 172 | struct exynos_drm_plane planes[WINDOWS_NR]; |
|---|
| 176 | 173 | struct exynos_drm_plane_config configs[WINDOWS_NR]; |
|---|
| .. | .. |
|---|
| 228 | 225 | DRM_FORMAT_XRGB8888, |
|---|
| 229 | 226 | DRM_FORMAT_ARGB8888, |
|---|
| 230 | 227 | }; |
|---|
| 228 | + |
|---|
| 229 | +static const unsigned int capabilities[WINDOWS_NR] = { |
|---|
| 230 | + 0, |
|---|
| 231 | + EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, |
|---|
| 232 | + EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, |
|---|
| 233 | + EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, |
|---|
| 234 | + EXYNOS_DRM_PLANE_CAP_WIN_BLEND | EXYNOS_DRM_PLANE_CAP_PIX_BLEND, |
|---|
| 235 | +}; |
|---|
| 236 | + |
|---|
| 237 | +static inline void fimd_set_bits(struct fimd_context *ctx, u32 reg, u32 mask, |
|---|
| 238 | + u32 val) |
|---|
| 239 | +{ |
|---|
| 240 | + val = (val & mask) | (readl(ctx->regs + reg) & ~mask); |
|---|
| 241 | + writel(val, ctx->regs + reg); |
|---|
| 242 | +} |
|---|
| 231 | 243 | |
|---|
| 232 | 244 | static int fimd_enable_vblank(struct exynos_drm_crtc *crtc) |
|---|
| 233 | 245 | { |
|---|
| .. | .. |
|---|
| 301 | 313 | if (!wait_event_timeout(ctx->wait_vsync_queue, |
|---|
| 302 | 314 | !atomic_read(&ctx->wait_vsync_event), |
|---|
| 303 | 315 | HZ/20)) |
|---|
| 304 | | - DRM_DEBUG_KMS("vblank wait timed out.\n"); |
|---|
| 316 | + DRM_DEV_DEBUG_KMS(ctx->dev, "vblank wait timed out.\n"); |
|---|
| 305 | 317 | } |
|---|
| 306 | 318 | |
|---|
| 307 | 319 | static void fimd_enable_video_output(struct fimd_context *ctx, unsigned int win, |
|---|
| .. | .. |
|---|
| 335 | 347 | { |
|---|
| 336 | 348 | struct fimd_context *ctx = crtc->ctx; |
|---|
| 337 | 349 | unsigned int win, ch_enabled = 0; |
|---|
| 338 | | - |
|---|
| 339 | | - DRM_DEBUG_KMS("%s\n", __FILE__); |
|---|
| 340 | 350 | |
|---|
| 341 | 351 | /* Hardware is in unknown state, so ensure it gets enabled properly */ |
|---|
| 342 | 352 | pm_runtime_get_sync(ctx->dev); |
|---|
| .. | .. |
|---|
| 386 | 396 | u32 clkdiv; |
|---|
| 387 | 397 | |
|---|
| 388 | 398 | if (mode->clock == 0) { |
|---|
| 389 | | - DRM_INFO("Mode has zero clock value.\n"); |
|---|
| 399 | + DRM_DEV_ERROR(ctx->dev, "Mode has zero clock value.\n"); |
|---|
| 390 | 400 | return -EINVAL; |
|---|
| 391 | 401 | } |
|---|
| 392 | 402 | |
|---|
| .. | .. |
|---|
| 402 | 412 | |
|---|
| 403 | 413 | lcd_rate = clk_get_rate(ctx->lcd_clk); |
|---|
| 404 | 414 | if (2 * lcd_rate < ideal_clk) { |
|---|
| 405 | | - DRM_INFO("sclk_fimd clock too low(%lu) for requested pixel clock(%lu)\n", |
|---|
| 406 | | - lcd_rate, ideal_clk); |
|---|
| 415 | + DRM_DEV_ERROR(ctx->dev, |
|---|
| 416 | + "sclk_fimd clock too low(%lu) for requested pixel clock(%lu)\n", |
|---|
| 417 | + lcd_rate, ideal_clk); |
|---|
| 407 | 418 | return -EINVAL; |
|---|
| 408 | 419 | } |
|---|
| 409 | 420 | |
|---|
| 410 | 421 | /* Find the clock divider value that gets us closest to ideal_clk */ |
|---|
| 411 | 422 | clkdiv = DIV_ROUND_CLOSEST(lcd_rate, ideal_clk); |
|---|
| 412 | 423 | if (clkdiv >= 0x200) { |
|---|
| 413 | | - DRM_INFO("requested pixel clock(%lu) too low\n", ideal_clk); |
|---|
| 424 | + DRM_DEV_ERROR(ctx->dev, "requested pixel clock(%lu) too low\n", |
|---|
| 425 | + ideal_clk); |
|---|
| 414 | 426 | return -EINVAL; |
|---|
| 415 | 427 | } |
|---|
| 416 | 428 | |
|---|
| .. | .. |
|---|
| 467 | 479 | driver_data->lcdblk_offset, |
|---|
| 468 | 480 | 0x3 << driver_data->lcdblk_vt_shift, |
|---|
| 469 | 481 | 0x1 << driver_data->lcdblk_vt_shift)) { |
|---|
| 470 | | - DRM_ERROR("Failed to update sysreg for I80 i/f.\n"); |
|---|
| 482 | + DRM_DEV_ERROR(ctx->dev, |
|---|
| 483 | + "Failed to update sysreg for I80 i/f.\n"); |
|---|
| 471 | 484 | return; |
|---|
| 472 | 485 | } |
|---|
| 473 | 486 | } else { |
|---|
| .. | .. |
|---|
| 511 | 524 | driver_data->lcdblk_offset, |
|---|
| 512 | 525 | 0x1 << driver_data->lcdblk_bypass_shift, |
|---|
| 513 | 526 | 0x1 << driver_data->lcdblk_bypass_shift)) { |
|---|
| 514 | | - DRM_ERROR("Failed to update sysreg for bypass setting.\n"); |
|---|
| 527 | + DRM_DEV_ERROR(ctx->dev, |
|---|
| 528 | + "Failed to update sysreg for bypass setting.\n"); |
|---|
| 515 | 529 | return; |
|---|
| 516 | 530 | } |
|---|
| 517 | 531 | |
|---|
| .. | .. |
|---|
| 523 | 537 | driver_data->lcdblk_offset, |
|---|
| 524 | 538 | 0x1 << driver_data->lcdblk_mic_bypass_shift, |
|---|
| 525 | 539 | 0x1 << driver_data->lcdblk_mic_bypass_shift)) { |
|---|
| 526 | | - DRM_ERROR("Failed to update sysreg for bypass mic.\n"); |
|---|
| 540 | + DRM_DEV_ERROR(ctx->dev, |
|---|
| 541 | + "Failed to update sysreg for bypass mic.\n"); |
|---|
| 527 | 542 | return; |
|---|
| 528 | 543 | } |
|---|
| 529 | 544 | |
|---|
| .. | .. |
|---|
| 552 | 567 | writel(val, ctx->regs + VIDCON0); |
|---|
| 553 | 568 | } |
|---|
| 554 | 569 | |
|---|
| 570 | +static void fimd_win_set_bldeq(struct fimd_context *ctx, unsigned int win, |
|---|
| 571 | + unsigned int alpha, unsigned int pixel_alpha) |
|---|
| 572 | +{ |
|---|
| 573 | + u32 mask = BLENDEQ_A_FUNC_F(0xf) | BLENDEQ_B_FUNC_F(0xf); |
|---|
| 574 | + u32 val = 0; |
|---|
| 575 | + |
|---|
| 576 | + switch (pixel_alpha) { |
|---|
| 577 | + case DRM_MODE_BLEND_PIXEL_NONE: |
|---|
| 578 | + case DRM_MODE_BLEND_COVERAGE: |
|---|
| 579 | + val |= BLENDEQ_A_FUNC_F(BLENDEQ_ALPHA_A); |
|---|
| 580 | + val |= BLENDEQ_B_FUNC_F(BLENDEQ_ONE_MINUS_ALPHA_A); |
|---|
| 581 | + break; |
|---|
| 582 | + case DRM_MODE_BLEND_PREMULTI: |
|---|
| 583 | + default: |
|---|
| 584 | + if (alpha != DRM_BLEND_ALPHA_OPAQUE) { |
|---|
| 585 | + val |= BLENDEQ_A_FUNC_F(BLENDEQ_ALPHA0); |
|---|
| 586 | + val |= BLENDEQ_B_FUNC_F(BLENDEQ_ONE_MINUS_ALPHA_A); |
|---|
| 587 | + } else { |
|---|
| 588 | + val |= BLENDEQ_A_FUNC_F(BLENDEQ_ONE); |
|---|
| 589 | + val |= BLENDEQ_B_FUNC_F(BLENDEQ_ONE_MINUS_ALPHA_A); |
|---|
| 590 | + } |
|---|
| 591 | + break; |
|---|
| 592 | + } |
|---|
| 593 | + fimd_set_bits(ctx, BLENDEQx(win), mask, val); |
|---|
| 594 | +} |
|---|
| 595 | + |
|---|
| 596 | +static void fimd_win_set_bldmod(struct fimd_context *ctx, unsigned int win, |
|---|
| 597 | + unsigned int alpha, unsigned int pixel_alpha) |
|---|
| 598 | +{ |
|---|
| 599 | + u32 win_alpha_l = (alpha >> 8) & 0xf; |
|---|
| 600 | + u32 win_alpha_h = alpha >> 12; |
|---|
| 601 | + u32 val = 0; |
|---|
| 602 | + |
|---|
| 603 | + switch (pixel_alpha) { |
|---|
| 604 | + case DRM_MODE_BLEND_PIXEL_NONE: |
|---|
| 605 | + break; |
|---|
| 606 | + case DRM_MODE_BLEND_COVERAGE: |
|---|
| 607 | + case DRM_MODE_BLEND_PREMULTI: |
|---|
| 608 | + default: |
|---|
| 609 | + val |= WINCON1_ALPHA_SEL; |
|---|
| 610 | + val |= WINCON1_BLD_PIX; |
|---|
| 611 | + val |= WINCON1_ALPHA_MUL; |
|---|
| 612 | + break; |
|---|
| 613 | + } |
|---|
| 614 | + fimd_set_bits(ctx, WINCON(win), WINCONx_BLEND_MODE_MASK, val); |
|---|
| 615 | + |
|---|
| 616 | + /* OSD alpha */ |
|---|
| 617 | + val = VIDISD14C_ALPHA0_R(win_alpha_h) | |
|---|
| 618 | + VIDISD14C_ALPHA0_G(win_alpha_h) | |
|---|
| 619 | + VIDISD14C_ALPHA0_B(win_alpha_h) | |
|---|
| 620 | + VIDISD14C_ALPHA1_R(0x0) | |
|---|
| 621 | + VIDISD14C_ALPHA1_G(0x0) | |
|---|
| 622 | + VIDISD14C_ALPHA1_B(0x0); |
|---|
| 623 | + writel(val, ctx->regs + VIDOSD_C(win)); |
|---|
| 624 | + |
|---|
| 625 | + val = VIDW_ALPHA_R(win_alpha_l) | VIDW_ALPHA_G(win_alpha_l) | |
|---|
| 626 | + VIDW_ALPHA_B(win_alpha_l); |
|---|
| 627 | + writel(val, ctx->regs + VIDWnALPHA0(win)); |
|---|
| 628 | + |
|---|
| 629 | + val = VIDW_ALPHA_R(0x0) | VIDW_ALPHA_G(0x0) | |
|---|
| 630 | + VIDW_ALPHA_B(0x0); |
|---|
| 631 | + writel(val, ctx->regs + VIDWnALPHA1(win)); |
|---|
| 632 | + |
|---|
| 633 | + fimd_set_bits(ctx, BLENDCON, BLENDCON_NEW_MASK, |
|---|
| 634 | + BLENDCON_NEW_8BIT_ALPHA_VALUE); |
|---|
| 635 | +} |
|---|
| 555 | 636 | |
|---|
| 556 | 637 | static void fimd_win_set_pixfmt(struct fimd_context *ctx, unsigned int win, |
|---|
| 557 | | - uint32_t pixel_format, int width) |
|---|
| 638 | + struct drm_framebuffer *fb, int width) |
|---|
| 558 | 639 | { |
|---|
| 559 | | - unsigned long val; |
|---|
| 640 | + struct exynos_drm_plane plane = ctx->planes[win]; |
|---|
| 641 | + struct exynos_drm_plane_state *state = |
|---|
| 642 | + to_exynos_plane_state(plane.base.state); |
|---|
| 643 | + uint32_t pixel_format = fb->format->format; |
|---|
| 644 | + unsigned int alpha = state->base.alpha; |
|---|
| 645 | + u32 val = WINCONx_ENWIN; |
|---|
| 646 | + unsigned int pixel_alpha; |
|---|
| 560 | 647 | |
|---|
| 561 | | - val = WINCONx_ENWIN; |
|---|
| 648 | + if (fb->format->has_alpha) |
|---|
| 649 | + pixel_alpha = state->base.pixel_blend_mode; |
|---|
| 650 | + else |
|---|
| 651 | + pixel_alpha = DRM_MODE_BLEND_PIXEL_NONE; |
|---|
| 562 | 652 | |
|---|
| 563 | 653 | /* |
|---|
| 564 | 654 | * In case of s3c64xx, window 0 doesn't support alpha channel. |
|---|
| .. | .. |
|---|
| 592 | 682 | break; |
|---|
| 593 | 683 | case DRM_FORMAT_ARGB8888: |
|---|
| 594 | 684 | default: |
|---|
| 595 | | - val |= WINCON1_BPPMODE_25BPP_A1888 |
|---|
| 596 | | - | WINCON1_BLD_PIX | WINCON1_ALPHA_SEL; |
|---|
| 685 | + val |= WINCON1_BPPMODE_25BPP_A1888; |
|---|
| 597 | 686 | val |= WINCONx_WSWP; |
|---|
| 598 | 687 | val |= WINCONx_BURSTLEN_16WORD; |
|---|
| 599 | 688 | break; |
|---|
| .. | .. |
|---|
| 611 | 700 | val &= ~WINCONx_BURSTLEN_MASK; |
|---|
| 612 | 701 | val |= WINCONx_BURSTLEN_4WORD; |
|---|
| 613 | 702 | } |
|---|
| 614 | | - |
|---|
| 615 | | - writel(val, ctx->regs + WINCON(win)); |
|---|
| 703 | + fimd_set_bits(ctx, WINCON(win), ~WINCONx_BLEND_MODE_MASK, val); |
|---|
| 616 | 704 | |
|---|
| 617 | 705 | /* hardware window 0 doesn't support alpha channel. */ |
|---|
| 618 | 706 | if (win != 0) { |
|---|
| 619 | | - /* OSD alpha */ |
|---|
| 620 | | - val = VIDISD14C_ALPHA0_R(0xf) | |
|---|
| 621 | | - VIDISD14C_ALPHA0_G(0xf) | |
|---|
| 622 | | - VIDISD14C_ALPHA0_B(0xf) | |
|---|
| 623 | | - VIDISD14C_ALPHA1_R(0xf) | |
|---|
| 624 | | - VIDISD14C_ALPHA1_G(0xf) | |
|---|
| 625 | | - VIDISD14C_ALPHA1_B(0xf); |
|---|
| 626 | | - |
|---|
| 627 | | - writel(val, ctx->regs + VIDOSD_C(win)); |
|---|
| 628 | | - |
|---|
| 629 | | - val = VIDW_ALPHA_R(0xf) | VIDW_ALPHA_G(0xf) | |
|---|
| 630 | | - VIDW_ALPHA_G(0xf); |
|---|
| 631 | | - writel(val, ctx->regs + VIDWnALPHA0(win)); |
|---|
| 632 | | - writel(val, ctx->regs + VIDWnALPHA1(win)); |
|---|
| 707 | + fimd_win_set_bldmod(ctx, win, alpha, pixel_alpha); |
|---|
| 708 | + fimd_win_set_bldeq(ctx, win, alpha, pixel_alpha); |
|---|
| 633 | 709 | } |
|---|
| 634 | 710 | } |
|---|
| 635 | 711 | |
|---|
| .. | .. |
|---|
| 739 | 815 | val = (unsigned long)(dma_addr + size); |
|---|
| 740 | 816 | writel(val, ctx->regs + VIDWx_BUF_END(win, 0)); |
|---|
| 741 | 817 | |
|---|
| 742 | | - DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", |
|---|
| 743 | | - (unsigned long)dma_addr, val, size); |
|---|
| 744 | | - DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", |
|---|
| 745 | | - state->crtc.w, state->crtc.h); |
|---|
| 818 | + DRM_DEV_DEBUG_KMS(ctx->dev, |
|---|
| 819 | + "start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", |
|---|
| 820 | + (unsigned long)dma_addr, val, size); |
|---|
| 821 | + DRM_DEV_DEBUG_KMS(ctx->dev, "ovl_width = %d, ovl_height = %d\n", |
|---|
| 822 | + state->crtc.w, state->crtc.h); |
|---|
| 746 | 823 | |
|---|
| 747 | 824 | /* buffer size */ |
|---|
| 748 | 825 | buf_offsize = pitch - (state->crtc.w * cpp); |
|---|
| .. | .. |
|---|
| 772 | 849 | |
|---|
| 773 | 850 | writel(val, ctx->regs + VIDOSD_B(win)); |
|---|
| 774 | 851 | |
|---|
| 775 | | - DRM_DEBUG_KMS("osd pos: tx = %d, ty = %d, bx = %d, by = %d\n", |
|---|
| 776 | | - state->crtc.x, state->crtc.y, last_x, last_y); |
|---|
| 852 | + DRM_DEV_DEBUG_KMS(ctx->dev, |
|---|
| 853 | + "osd pos: tx = %d, ty = %d, bx = %d, by = %d\n", |
|---|
| 854 | + state->crtc.x, state->crtc.y, last_x, last_y); |
|---|
| 777 | 855 | |
|---|
| 778 | 856 | /* OSD size */ |
|---|
| 779 | 857 | if (win != 3 && win != 4) { |
|---|
| .. | .. |
|---|
| 783 | 861 | val = state->crtc.w * state->crtc.h; |
|---|
| 784 | 862 | writel(val, ctx->regs + offset); |
|---|
| 785 | 863 | |
|---|
| 786 | | - DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); |
|---|
| 864 | + DRM_DEV_DEBUG_KMS(ctx->dev, "osd size = 0x%x\n", |
|---|
| 865 | + (unsigned int)val); |
|---|
| 787 | 866 | } |
|---|
| 788 | 867 | |
|---|
| 789 | | - fimd_win_set_pixfmt(ctx, win, fb->format->format, state->src.w); |
|---|
| 868 | + fimd_win_set_pixfmt(ctx, win, fb, state->src.w); |
|---|
| 790 | 869 | |
|---|
| 791 | 870 | /* hardware window 0 doesn't support color key. */ |
|---|
| 792 | 871 | if (win != 0) |
|---|
| .. | .. |
|---|
| 816 | 895 | fimd_enable_shadow_channel_path(ctx, win, false); |
|---|
| 817 | 896 | } |
|---|
| 818 | 897 | |
|---|
| 819 | | -static void fimd_enable(struct exynos_drm_crtc *crtc) |
|---|
| 898 | +static void fimd_atomic_enable(struct exynos_drm_crtc *crtc) |
|---|
| 820 | 899 | { |
|---|
| 821 | 900 | struct fimd_context *ctx = crtc->ctx; |
|---|
| 822 | 901 | |
|---|
| .. | .. |
|---|
| 834 | 913 | fimd_commit(ctx->crtc); |
|---|
| 835 | 914 | } |
|---|
| 836 | 915 | |
|---|
| 837 | | -static void fimd_disable(struct exynos_drm_crtc *crtc) |
|---|
| 916 | +static void fimd_atomic_disable(struct exynos_drm_crtc *crtc) |
|---|
| 838 | 917 | { |
|---|
| 839 | 918 | struct fimd_context *ctx = crtc->ctx; |
|---|
| 840 | 919 | int i; |
|---|
| .. | .. |
|---|
| 928 | 1007 | } |
|---|
| 929 | 1008 | |
|---|
| 930 | 1009 | static const struct exynos_drm_crtc_ops fimd_crtc_ops = { |
|---|
| 931 | | - .enable = fimd_enable, |
|---|
| 932 | | - .disable = fimd_disable, |
|---|
| 1010 | + .atomic_enable = fimd_atomic_enable, |
|---|
| 1011 | + .atomic_disable = fimd_atomic_disable, |
|---|
| 933 | 1012 | .enable_vblank = fimd_enable_vblank, |
|---|
| 934 | 1013 | .disable_vblank = fimd_disable_vblank, |
|---|
| 935 | 1014 | .atomic_begin = fimd_atomic_begin, |
|---|
| .. | .. |
|---|
| 988 | 1067 | ctx->configs[i].num_pixel_formats = ARRAY_SIZE(fimd_formats); |
|---|
| 989 | 1068 | ctx->configs[i].zpos = i; |
|---|
| 990 | 1069 | ctx->configs[i].type = fimd_win_types[i]; |
|---|
| 1070 | + ctx->configs[i].capabilities = capabilities[i]; |
|---|
| 991 | 1071 | ret = exynos_plane_init(drm_dev, &ctx->planes[i], i, |
|---|
| 992 | 1072 | &ctx->configs[i]); |
|---|
| 993 | 1073 | if (ret) |
|---|
| .. | .. |
|---|
| 1011 | 1091 | if (is_drm_iommu_supported(drm_dev)) |
|---|
| 1012 | 1092 | fimd_clear_channels(ctx->crtc); |
|---|
| 1013 | 1093 | |
|---|
| 1014 | | - return drm_iommu_attach_device(drm_dev, dev); |
|---|
| 1094 | + return exynos_drm_register_dma(drm_dev, dev, &ctx->dma_priv); |
|---|
| 1015 | 1095 | } |
|---|
| 1016 | 1096 | |
|---|
| 1017 | 1097 | static void fimd_unbind(struct device *dev, struct device *master, |
|---|
| .. | .. |
|---|
| 1019 | 1099 | { |
|---|
| 1020 | 1100 | struct fimd_context *ctx = dev_get_drvdata(dev); |
|---|
| 1021 | 1101 | |
|---|
| 1022 | | - fimd_disable(ctx->crtc); |
|---|
| 1102 | + fimd_atomic_disable(ctx->crtc); |
|---|
| 1023 | 1103 | |
|---|
| 1024 | | - drm_iommu_detach_device(ctx->drm_dev, ctx->dev); |
|---|
| 1104 | + exynos_drm_unregister_dma(ctx->drm_dev, ctx->dev, &ctx->dma_priv); |
|---|
| 1025 | 1105 | |
|---|
| 1026 | 1106 | if (ctx->encoder) |
|---|
| 1027 | 1107 | exynos_dpi_remove(ctx->encoder); |
|---|
| .. | .. |
|---|
| 1176 | 1256 | |
|---|
| 1177 | 1257 | ret = clk_prepare_enable(ctx->bus_clk); |
|---|
| 1178 | 1258 | if (ret < 0) { |
|---|
| 1179 | | - DRM_ERROR("Failed to prepare_enable the bus clk [%d]\n", ret); |
|---|
| 1259 | + DRM_DEV_ERROR(dev, |
|---|
| 1260 | + "Failed to prepare_enable the bus clk [%d]\n", |
|---|
| 1261 | + ret); |
|---|
| 1180 | 1262 | return ret; |
|---|
| 1181 | 1263 | } |
|---|
| 1182 | 1264 | |
|---|
| 1183 | 1265 | ret = clk_prepare_enable(ctx->lcd_clk); |
|---|
| 1184 | 1266 | if (ret < 0) { |
|---|
| 1185 | | - DRM_ERROR("Failed to prepare_enable the lcd clk [%d]\n", ret); |
|---|
| 1267 | + DRM_DEV_ERROR(dev, |
|---|
| 1268 | + "Failed to prepare_enable the lcd clk [%d]\n", |
|---|
| 1269 | + ret); |
|---|
| 1186 | 1270 | return ret; |
|---|
| 1187 | 1271 | } |
|---|
| 1188 | 1272 | |
|---|