| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright (C) 2011 Samsung Electronics Co.Ltd |
|---|
| 3 | 4 | * Authors: |
|---|
| .. | .. |
|---|
| 6 | 7 | * Joonyoung Shim <jy0922.shim@samsung.com> |
|---|
| 7 | 8 | * |
|---|
| 8 | 9 | * Based on drivers/media/video/s5p-tv/mixer_reg.c |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify it |
|---|
| 11 | | - * under the terms of the GNU General Public License as published by the |
|---|
| 12 | | - * Free Software Foundation; either version 2 of the License, or (at your |
|---|
| 13 | | - * option) any later version. |
|---|
| 14 | | - * |
|---|
| 15 | 10 | */ |
|---|
| 16 | 11 | |
|---|
| 17 | | -#include <drm/drmP.h> |
|---|
| 18 | | - |
|---|
| 19 | | -#include "regs-mixer.h" |
|---|
| 20 | | -#include "regs-vp.h" |
|---|
| 21 | | - |
|---|
| 22 | | -#include <linux/kernel.h> |
|---|
| 23 | | -#include <linux/ktime.h> |
|---|
| 24 | | -#include <linux/spinlock.h> |
|---|
| 25 | | -#include <linux/wait.h> |
|---|
| 12 | +#include <linux/clk.h> |
|---|
| 13 | +#include <linux/component.h> |
|---|
| 14 | +#include <linux/delay.h> |
|---|
| 26 | 15 | #include <linux/i2c.h> |
|---|
| 27 | | -#include <linux/platform_device.h> |
|---|
| 28 | 16 | #include <linux/interrupt.h> |
|---|
| 29 | 17 | #include <linux/irq.h> |
|---|
| 30 | | -#include <linux/delay.h> |
|---|
| 31 | | -#include <linux/pm_runtime.h> |
|---|
| 32 | | -#include <linux/clk.h> |
|---|
| 33 | | -#include <linux/regulator/consumer.h> |
|---|
| 18 | +#include <linux/kernel.h> |
|---|
| 19 | +#include <linux/ktime.h> |
|---|
| 34 | 20 | #include <linux/of.h> |
|---|
| 35 | 21 | #include <linux/of_device.h> |
|---|
| 36 | | -#include <linux/component.h> |
|---|
| 22 | +#include <linux/platform_device.h> |
|---|
| 23 | +#include <linux/pm_runtime.h> |
|---|
| 24 | +#include <linux/regulator/consumer.h> |
|---|
| 25 | +#include <linux/spinlock.h> |
|---|
| 26 | +#include <linux/wait.h> |
|---|
| 37 | 27 | |
|---|
| 28 | +#include <drm/drm_fourcc.h> |
|---|
| 29 | +#include <drm/drm_vblank.h> |
|---|
| 38 | 30 | #include <drm/exynos_drm.h> |
|---|
| 39 | 31 | |
|---|
| 40 | | -#include "exynos_drm_drv.h" |
|---|
| 41 | 32 | #include "exynos_drm_crtc.h" |
|---|
| 33 | +#include "exynos_drm_drv.h" |
|---|
| 42 | 34 | #include "exynos_drm_fb.h" |
|---|
| 43 | 35 | #include "exynos_drm_plane.h" |
|---|
| 44 | | -#include "exynos_drm_iommu.h" |
|---|
| 36 | +#include "regs-mixer.h" |
|---|
| 37 | +#include "regs-vp.h" |
|---|
| 45 | 38 | |
|---|
| 46 | 39 | #define MIXER_WIN_NR 3 |
|---|
| 47 | 40 | #define VP_DEFAULT_WIN 2 |
|---|
| .. | .. |
|---|
| 101 | 94 | struct platform_device *pdev; |
|---|
| 102 | 95 | struct device *dev; |
|---|
| 103 | 96 | struct drm_device *drm_dev; |
|---|
| 97 | + void *dma_priv; |
|---|
| 104 | 98 | struct exynos_drm_crtc *crtc; |
|---|
| 105 | 99 | struct exynos_drm_plane planes[MIXER_WIN_NR]; |
|---|
| 106 | 100 | unsigned long flags; |
|---|
| .. | .. |
|---|
| 132 | 126 | .pixel_formats = mixer_formats, |
|---|
| 133 | 127 | .num_pixel_formats = ARRAY_SIZE(mixer_formats), |
|---|
| 134 | 128 | .capabilities = EXYNOS_DRM_PLANE_CAP_DOUBLE | |
|---|
| 135 | | - EXYNOS_DRM_PLANE_CAP_ZPOS, |
|---|
| 129 | + EXYNOS_DRM_PLANE_CAP_ZPOS | |
|---|
| 130 | + EXYNOS_DRM_PLANE_CAP_PIX_BLEND | |
|---|
| 131 | + EXYNOS_DRM_PLANE_CAP_WIN_BLEND, |
|---|
| 136 | 132 | }, { |
|---|
| 137 | 133 | .zpos = 1, |
|---|
| 138 | 134 | .type = DRM_PLANE_TYPE_CURSOR, |
|---|
| 139 | 135 | .pixel_formats = mixer_formats, |
|---|
| 140 | 136 | .num_pixel_formats = ARRAY_SIZE(mixer_formats), |
|---|
| 141 | 137 | .capabilities = EXYNOS_DRM_PLANE_CAP_DOUBLE | |
|---|
| 142 | | - EXYNOS_DRM_PLANE_CAP_ZPOS, |
|---|
| 138 | + EXYNOS_DRM_PLANE_CAP_ZPOS | |
|---|
| 139 | + EXYNOS_DRM_PLANE_CAP_PIX_BLEND | |
|---|
| 140 | + EXYNOS_DRM_PLANE_CAP_WIN_BLEND, |
|---|
| 143 | 141 | }, { |
|---|
| 144 | 142 | .zpos = 2, |
|---|
| 145 | 143 | .type = DRM_PLANE_TYPE_OVERLAY, |
|---|
| .. | .. |
|---|
| 147 | 145 | .num_pixel_formats = ARRAY_SIZE(vp_formats), |
|---|
| 148 | 146 | .capabilities = EXYNOS_DRM_PLANE_CAP_SCALE | |
|---|
| 149 | 147 | EXYNOS_DRM_PLANE_CAP_ZPOS | |
|---|
| 150 | | - EXYNOS_DRM_PLANE_CAP_TILE, |
|---|
| 148 | + EXYNOS_DRM_PLANE_CAP_TILE | |
|---|
| 149 | + EXYNOS_DRM_PLANE_CAP_WIN_BLEND, |
|---|
| 151 | 150 | }, |
|---|
| 152 | 151 | }; |
|---|
| 153 | 152 | |
|---|
| .. | .. |
|---|
| 224 | 223 | { |
|---|
| 225 | 224 | #define DUMPREG(reg_id) \ |
|---|
| 226 | 225 | do { \ |
|---|
| 227 | | - DRM_DEBUG_KMS(#reg_id " = %08x\n", \ |
|---|
| 228 | | - (u32)readl(ctx->mixer_regs + reg_id)); \ |
|---|
| 226 | + DRM_DEV_DEBUG_KMS(ctx->dev, #reg_id " = %08x\n", \ |
|---|
| 227 | + (u32)readl(ctx->mixer_regs + reg_id)); \ |
|---|
| 229 | 228 | } while (0) |
|---|
| 230 | 229 | |
|---|
| 231 | 230 | DUMPREG(MXR_STATUS); |
|---|
| .. | .. |
|---|
| 256 | 255 | { |
|---|
| 257 | 256 | #define DUMPREG(reg_id) \ |
|---|
| 258 | 257 | do { \ |
|---|
| 259 | | - DRM_DEBUG_KMS(#reg_id " = %08x\n", \ |
|---|
| 260 | | - (u32) readl(ctx->vp_regs + reg_id)); \ |
|---|
| 258 | + DRM_DEV_DEBUG_KMS(ctx->dev, #reg_id " = %08x\n", \ |
|---|
| 259 | + (u32) readl(ctx->vp_regs + reg_id)); \ |
|---|
| 261 | 260 | } while (0) |
|---|
| 262 | 261 | |
|---|
| 263 | 262 | DUMPREG(VP_ENABLE); |
|---|
| .. | .. |
|---|
| 310 | 309 | } |
|---|
| 311 | 310 | |
|---|
| 312 | 311 | static void mixer_cfg_gfx_blend(struct mixer_context *ctx, unsigned int win, |
|---|
| 313 | | - bool alpha) |
|---|
| 312 | + unsigned int pixel_alpha, unsigned int alpha) |
|---|
| 314 | 313 | { |
|---|
| 314 | + u32 win_alpha = alpha >> 8; |
|---|
| 315 | 315 | u32 val; |
|---|
| 316 | 316 | |
|---|
| 317 | 317 | val = MXR_GRP_CFG_COLOR_KEY_DISABLE; /* no blank key */ |
|---|
| 318 | | - if (alpha) { |
|---|
| 319 | | - /* blending based on pixel alpha */ |
|---|
| 318 | + switch (pixel_alpha) { |
|---|
| 319 | + case DRM_MODE_BLEND_PIXEL_NONE: |
|---|
| 320 | + break; |
|---|
| 321 | + case DRM_MODE_BLEND_COVERAGE: |
|---|
| 322 | + val |= MXR_GRP_CFG_PIXEL_BLEND_EN; |
|---|
| 323 | + break; |
|---|
| 324 | + case DRM_MODE_BLEND_PREMULTI: |
|---|
| 325 | + default: |
|---|
| 320 | 326 | val |= MXR_GRP_CFG_BLEND_PRE_MUL; |
|---|
| 321 | 327 | val |= MXR_GRP_CFG_PIXEL_BLEND_EN; |
|---|
| 328 | + break; |
|---|
| 329 | + } |
|---|
| 330 | + |
|---|
| 331 | + if (alpha != DRM_BLEND_ALPHA_OPAQUE) { |
|---|
| 332 | + val |= MXR_GRP_CFG_WIN_BLEND_EN; |
|---|
| 333 | + val |= win_alpha; |
|---|
| 322 | 334 | } |
|---|
| 323 | 335 | mixer_reg_writemask(ctx, MXR_GRAPHIC_CFG(win), |
|---|
| 324 | 336 | val, MXR_GRP_CFG_MISC_MASK); |
|---|
| 325 | 337 | } |
|---|
| 326 | 338 | |
|---|
| 327 | | -static void mixer_cfg_vp_blend(struct mixer_context *ctx) |
|---|
| 339 | +static void mixer_cfg_vp_blend(struct mixer_context *ctx, unsigned int alpha) |
|---|
| 328 | 340 | { |
|---|
| 329 | | - u32 val; |
|---|
| 341 | + u32 win_alpha = alpha >> 8; |
|---|
| 342 | + u32 val = 0; |
|---|
| 330 | 343 | |
|---|
| 331 | | - /* |
|---|
| 332 | | - * No blending at the moment since the NV12/NV21 pixelformats don't |
|---|
| 333 | | - * have an alpha channel. However the mixer supports a global alpha |
|---|
| 334 | | - * value for a layer. Once this functionality is exposed, we can |
|---|
| 335 | | - * support blending of the video layer through this. |
|---|
| 336 | | - */ |
|---|
| 337 | | - val = 0; |
|---|
| 344 | + if (alpha != DRM_BLEND_ALPHA_OPAQUE) { |
|---|
| 345 | + val |= MXR_VID_CFG_BLEND_EN; |
|---|
| 346 | + val |= win_alpha; |
|---|
| 347 | + } |
|---|
| 338 | 348 | mixer_reg_write(ctx, MXR_VIDEO_CFG, val); |
|---|
| 339 | 349 | } |
|---|
| 340 | 350 | |
|---|
| .. | .. |
|---|
| 413 | 423 | mixer_reg_writemask(ctx, MXR_CFG, val, MXR_CFG_SCAN_MASK); |
|---|
| 414 | 424 | } |
|---|
| 415 | 425 | |
|---|
| 416 | | -static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height) |
|---|
| 426 | +static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, struct drm_display_mode *mode) |
|---|
| 417 | 427 | { |
|---|
| 428 | + enum hdmi_quantization_range range = drm_default_rgb_quant_range(mode); |
|---|
| 418 | 429 | u32 val; |
|---|
| 419 | 430 | |
|---|
| 420 | | - switch (height) { |
|---|
| 421 | | - case 480: |
|---|
| 422 | | - case 576: |
|---|
| 423 | | - val = MXR_CFG_RGB601_0_255; |
|---|
| 424 | | - break; |
|---|
| 425 | | - case 720: |
|---|
| 426 | | - case 1080: |
|---|
| 427 | | - default: |
|---|
| 428 | | - val = MXR_CFG_RGB709_16_235; |
|---|
| 431 | + if (mode->vdisplay < 720) { |
|---|
| 432 | + val = MXR_CFG_RGB601; |
|---|
| 433 | + } else { |
|---|
| 434 | + val = MXR_CFG_RGB709; |
|---|
| 435 | + |
|---|
| 429 | 436 | /* Configure the BT.709 CSC matrix for full range RGB. */ |
|---|
| 430 | 437 | mixer_reg_write(ctx, MXR_CM_COEFF_Y, |
|---|
| 431 | 438 | MXR_CSC_CT( 0.184, 0.614, 0.063) | |
|---|
| .. | .. |
|---|
| 434 | 441 | MXR_CSC_CT(-0.102, -0.338, 0.440)); |
|---|
| 435 | 442 | mixer_reg_write(ctx, MXR_CM_COEFF_CR, |
|---|
| 436 | 443 | MXR_CSC_CT( 0.440, -0.399, -0.040)); |
|---|
| 437 | | - break; |
|---|
| 438 | 444 | } |
|---|
| 445 | + |
|---|
| 446 | + if (range == HDMI_QUANTIZATION_RANGE_FULL) |
|---|
| 447 | + val |= MXR_CFG_QUANT_RANGE_FULL; |
|---|
| 448 | + else |
|---|
| 449 | + val |= MXR_CFG_QUANT_RANGE_LIMITED; |
|---|
| 439 | 450 | |
|---|
| 440 | 451 | mixer_reg_writemask(ctx, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); |
|---|
| 441 | 452 | } |
|---|
| .. | .. |
|---|
| 493 | 504 | struct drm_display_mode *mode = &ctx->crtc->base.state->adjusted_mode; |
|---|
| 494 | 505 | |
|---|
| 495 | 506 | mixer_cfg_scan(ctx, mode->hdisplay, mode->vdisplay); |
|---|
| 496 | | - mixer_cfg_rgb_fmt(ctx, mode->vdisplay); |
|---|
| 507 | + mixer_cfg_rgb_fmt(ctx, mode); |
|---|
| 497 | 508 | mixer_run(ctx); |
|---|
| 498 | 509 | } |
|---|
| 499 | 510 | |
|---|
| .. | .. |
|---|
| 576 | 587 | vp_reg_write(ctx, VP_BOT_C_PTR, chroma_addr[1]); |
|---|
| 577 | 588 | |
|---|
| 578 | 589 | mixer_cfg_layer(ctx, plane->index, priority, true); |
|---|
| 579 | | - mixer_cfg_vp_blend(ctx); |
|---|
| 590 | + mixer_cfg_vp_blend(ctx, state->base.alpha); |
|---|
| 580 | 591 | |
|---|
| 581 | 592 | spin_unlock_irqrestore(&ctx->reg_slock, flags); |
|---|
| 582 | 593 | |
|---|
| .. | .. |
|---|
| 595 | 606 | unsigned int win = plane->index; |
|---|
| 596 | 607 | unsigned int x_ratio = 0, y_ratio = 0; |
|---|
| 597 | 608 | unsigned int dst_x_offset, dst_y_offset; |
|---|
| 609 | + unsigned int pixel_alpha; |
|---|
| 598 | 610 | dma_addr_t dma_addr; |
|---|
| 599 | 611 | unsigned int fmt; |
|---|
| 600 | 612 | u32 val; |
|---|
| 613 | + |
|---|
| 614 | + if (fb->format->has_alpha) |
|---|
| 615 | + pixel_alpha = state->base.pixel_blend_mode; |
|---|
| 616 | + else |
|---|
| 617 | + pixel_alpha = DRM_MODE_BLEND_PIXEL_NONE; |
|---|
| 601 | 618 | |
|---|
| 602 | 619 | switch (fb->format->format) { |
|---|
| 603 | 620 | case DRM_FORMAT_XRGB4444: |
|---|
| .. | .. |
|---|
| 658 | 675 | mixer_reg_write(ctx, MXR_GRAPHIC_BASE(win), dma_addr); |
|---|
| 659 | 676 | |
|---|
| 660 | 677 | mixer_cfg_layer(ctx, win, priority, true); |
|---|
| 661 | | - mixer_cfg_gfx_blend(ctx, win, fb->format->has_alpha); |
|---|
| 678 | + mixer_cfg_gfx_blend(ctx, win, pixel_alpha, state->base.alpha); |
|---|
| 662 | 679 | |
|---|
| 663 | 680 | spin_unlock_irqrestore(&ctx->reg_slock, flags); |
|---|
| 664 | 681 | |
|---|
| .. | .. |
|---|
| 863 | 880 | /* acquire resources: regs, irqs, clocks */ |
|---|
| 864 | 881 | ret = mixer_resources_init(mixer_ctx); |
|---|
| 865 | 882 | if (ret) { |
|---|
| 866 | | - DRM_ERROR("mixer_resources_init failed ret=%d\n", ret); |
|---|
| 883 | + DRM_DEV_ERROR(mixer_ctx->dev, |
|---|
| 884 | + "mixer_resources_init failed ret=%d\n", ret); |
|---|
| 867 | 885 | return ret; |
|---|
| 868 | 886 | } |
|---|
| 869 | 887 | |
|---|
| .. | .. |
|---|
| 871 | 889 | /* acquire vp resources: regs, irqs, clocks */ |
|---|
| 872 | 890 | ret = vp_resources_init(mixer_ctx); |
|---|
| 873 | 891 | if (ret) { |
|---|
| 874 | | - DRM_ERROR("vp_resources_init failed ret=%d\n", ret); |
|---|
| 892 | + DRM_DEV_ERROR(mixer_ctx->dev, |
|---|
| 893 | + "vp_resources_init failed ret=%d\n", ret); |
|---|
| 875 | 894 | return ret; |
|---|
| 876 | 895 | } |
|---|
| 877 | 896 | } |
|---|
| 878 | 897 | |
|---|
| 879 | | - return drm_iommu_attach_device(drm_dev, mixer_ctx->dev); |
|---|
| 898 | + return exynos_drm_register_dma(drm_dev, mixer_ctx->dev, |
|---|
| 899 | + &mixer_ctx->dma_priv); |
|---|
| 880 | 900 | } |
|---|
| 881 | 901 | |
|---|
| 882 | 902 | static void mixer_ctx_remove(struct mixer_context *mixer_ctx) |
|---|
| 883 | 903 | { |
|---|
| 884 | | - drm_iommu_detach_device(mixer_ctx->drm_dev, mixer_ctx->dev); |
|---|
| 904 | + exynos_drm_unregister_dma(mixer_ctx->drm_dev, mixer_ctx->dev, |
|---|
| 905 | + &mixer_ctx->dma_priv); |
|---|
| 885 | 906 | } |
|---|
| 886 | 907 | |
|---|
| 887 | 908 | static int mixer_enable_vblank(struct exynos_drm_crtc *crtc) |
|---|
| .. | .. |
|---|
| 930 | 951 | { |
|---|
| 931 | 952 | struct mixer_context *mixer_ctx = crtc->ctx; |
|---|
| 932 | 953 | |
|---|
| 933 | | - DRM_DEBUG_KMS("win: %d\n", plane->index); |
|---|
| 954 | + DRM_DEV_DEBUG_KMS(mixer_ctx->dev, "win: %d\n", plane->index); |
|---|
| 934 | 955 | |
|---|
| 935 | 956 | if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) |
|---|
| 936 | 957 | return; |
|---|
| .. | .. |
|---|
| 947 | 968 | struct mixer_context *mixer_ctx = crtc->ctx; |
|---|
| 948 | 969 | unsigned long flags; |
|---|
| 949 | 970 | |
|---|
| 950 | | - DRM_DEBUG_KMS("win: %d\n", plane->index); |
|---|
| 971 | + DRM_DEV_DEBUG_KMS(mixer_ctx->dev, "win: %d\n", plane->index); |
|---|
| 951 | 972 | |
|---|
| 952 | 973 | if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) |
|---|
| 953 | 974 | return; |
|---|
| .. | .. |
|---|
| 968 | 989 | exynos_crtc_handle_event(crtc); |
|---|
| 969 | 990 | } |
|---|
| 970 | 991 | |
|---|
| 971 | | -static void mixer_enable(struct exynos_drm_crtc *crtc) |
|---|
| 992 | +static void mixer_atomic_enable(struct exynos_drm_crtc *crtc) |
|---|
| 972 | 993 | { |
|---|
| 973 | 994 | struct mixer_context *ctx = crtc->ctx; |
|---|
| 974 | 995 | |
|---|
| .. | .. |
|---|
| 997 | 1018 | set_bit(MXR_BIT_POWERED, &ctx->flags); |
|---|
| 998 | 1019 | } |
|---|
| 999 | 1020 | |
|---|
| 1000 | | -static void mixer_disable(struct exynos_drm_crtc *crtc) |
|---|
| 1021 | +static void mixer_atomic_disable(struct exynos_drm_crtc *crtc) |
|---|
| 1001 | 1022 | { |
|---|
| 1002 | 1023 | struct mixer_context *ctx = crtc->ctx; |
|---|
| 1003 | 1024 | int i; |
|---|
| .. | .. |
|---|
| 1024 | 1045 | struct mixer_context *ctx = crtc->ctx; |
|---|
| 1025 | 1046 | u32 w = mode->hdisplay, h = mode->vdisplay; |
|---|
| 1026 | 1047 | |
|---|
| 1027 | | - DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d\n", w, h, |
|---|
| 1028 | | - mode->vrefresh, !!(mode->flags & DRM_MODE_FLAG_INTERLACE)); |
|---|
| 1048 | + DRM_DEV_DEBUG_KMS(ctx->dev, "xres=%d, yres=%d, refresh=%d, intl=%d\n", |
|---|
| 1049 | + w, h, drm_mode_vrefresh(mode), |
|---|
| 1050 | + !!(mode->flags & DRM_MODE_FLAG_INTERLACE)); |
|---|
| 1029 | 1051 | |
|---|
| 1030 | 1052 | if (ctx->mxr_ver == MXR_VER_128_0_0_184) |
|---|
| 1031 | 1053 | return MODE_OK; |
|---|
| .. | .. |
|---|
| 1050 | 1072 | struct mixer_context *ctx = crtc->ctx; |
|---|
| 1051 | 1073 | int width = mode->hdisplay, height = mode->vdisplay, i; |
|---|
| 1052 | 1074 | |
|---|
| 1053 | | - struct { |
|---|
| 1075 | + static const struct { |
|---|
| 1054 | 1076 | int hdisplay, vdisplay, htotal, vtotal, scan_val; |
|---|
| 1055 | | - } static const modes[] = { |
|---|
| 1077 | + } modes[] = { |
|---|
| 1056 | 1078 | { 720, 480, 858, 525, MXR_CFG_SCAN_NTSC | MXR_CFG_SCAN_SD }, |
|---|
| 1057 | 1079 | { 720, 576, 864, 625, MXR_CFG_SCAN_PAL | MXR_CFG_SCAN_SD }, |
|---|
| 1058 | 1080 | { 1280, 720, 1650, 750, MXR_CFG_SCAN_HD_720 | MXR_CFG_SCAN_HD }, |
|---|
| .. | .. |
|---|
| 1090 | 1112 | } |
|---|
| 1091 | 1113 | |
|---|
| 1092 | 1114 | static const struct exynos_drm_crtc_ops mixer_crtc_ops = { |
|---|
| 1093 | | - .enable = mixer_enable, |
|---|
| 1094 | | - .disable = mixer_disable, |
|---|
| 1115 | + .atomic_enable = mixer_atomic_enable, |
|---|
| 1116 | + .atomic_disable = mixer_atomic_disable, |
|---|
| 1095 | 1117 | .enable_vblank = mixer_enable_vblank, |
|---|
| 1096 | 1118 | .disable_vblank = mixer_disable_vblank, |
|---|
| 1097 | 1119 | .atomic_begin = mixer_atomic_begin, |
|---|
| .. | .. |
|---|
| 1205 | 1227 | |
|---|
| 1206 | 1228 | ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); |
|---|
| 1207 | 1229 | if (!ctx) { |
|---|
| 1208 | | - DRM_ERROR("failed to alloc mixer context.\n"); |
|---|
| 1230 | + DRM_DEV_ERROR(dev, "failed to alloc mixer context.\n"); |
|---|
| 1209 | 1231 | return -ENOMEM; |
|---|
| 1210 | 1232 | } |
|---|
| 1211 | 1233 | |
|---|
| .. | .. |
|---|
| 1222 | 1244 | |
|---|
| 1223 | 1245 | platform_set_drvdata(pdev, ctx); |
|---|
| 1224 | 1246 | |
|---|
| 1247 | + pm_runtime_enable(dev); |
|---|
| 1248 | + |
|---|
| 1225 | 1249 | ret = component_add(&pdev->dev, &mixer_component_ops); |
|---|
| 1226 | | - if (!ret) |
|---|
| 1227 | | - pm_runtime_enable(dev); |
|---|
| 1250 | + if (ret) |
|---|
| 1251 | + pm_runtime_disable(dev); |
|---|
| 1228 | 1252 | |
|---|
| 1229 | 1253 | return ret; |
|---|
| 1230 | 1254 | } |
|---|
| .. | .. |
|---|
| 1260 | 1284 | |
|---|
| 1261 | 1285 | ret = clk_prepare_enable(ctx->mixer); |
|---|
| 1262 | 1286 | if (ret < 0) { |
|---|
| 1263 | | - DRM_ERROR("Failed to prepare_enable the mixer clk [%d]\n", ret); |
|---|
| 1287 | + DRM_DEV_ERROR(ctx->dev, |
|---|
| 1288 | + "Failed to prepare_enable the mixer clk [%d]\n", |
|---|
| 1289 | + ret); |
|---|
| 1264 | 1290 | return ret; |
|---|
| 1265 | 1291 | } |
|---|
| 1266 | 1292 | ret = clk_prepare_enable(ctx->hdmi); |
|---|
| 1267 | 1293 | if (ret < 0) { |
|---|
| 1268 | | - DRM_ERROR("Failed to prepare_enable the hdmi clk [%d]\n", ret); |
|---|
| 1294 | + DRM_DEV_ERROR(dev, |
|---|
| 1295 | + "Failed to prepare_enable the hdmi clk [%d]\n", |
|---|
| 1296 | + ret); |
|---|
| 1269 | 1297 | return ret; |
|---|
| 1270 | 1298 | } |
|---|
| 1271 | 1299 | if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags)) { |
|---|
| 1272 | 1300 | ret = clk_prepare_enable(ctx->vp); |
|---|
| 1273 | 1301 | if (ret < 0) { |
|---|
| 1274 | | - DRM_ERROR("Failed to prepare_enable the vp clk [%d]\n", |
|---|
| 1275 | | - ret); |
|---|
| 1302 | + DRM_DEV_ERROR(dev, |
|---|
| 1303 | + "Failed to prepare_enable the vp clk [%d]\n", |
|---|
| 1304 | + ret); |
|---|
| 1276 | 1305 | return ret; |
|---|
| 1277 | 1306 | } |
|---|
| 1278 | 1307 | if (test_bit(MXR_BIT_HAS_SCLK, &ctx->flags)) { |
|---|
| 1279 | 1308 | ret = clk_prepare_enable(ctx->sclk_mixer); |
|---|
| 1280 | 1309 | if (ret < 0) { |
|---|
| 1281 | | - DRM_ERROR("Failed to prepare_enable the " \ |
|---|
| 1310 | + DRM_DEV_ERROR(dev, |
|---|
| 1311 | + "Failed to prepare_enable the " \ |
|---|
| 1282 | 1312 | "sclk_mixer clk [%d]\n", |
|---|
| 1283 | | - ret); |
|---|
| 1313 | + ret); |
|---|
| 1284 | 1314 | return ret; |
|---|
| 1285 | 1315 | } |
|---|
| 1286 | 1316 | } |
|---|