Commit 331ca3a3 authored by Dave Airlie's avatar Dave Airlie

Merge tag 'exynos-drm-next-for-v5.2' of...

Merge tag 'exynos-drm-next-for-v5.2' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next

Log cleanups
- Correct the use of log macro in error case.
- Drop unnecessary messages.
- Replace DRM_ERROR/DEBUG with DRM_DEV_ERROR/DEBUG.
- Print out debug messages with correct device name in vidi and ipp drivers.

One trivial cleanup
- Just fix checkpatch error, "foo* bar" to "foo *bar" in g2d driver.
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Inki Dae <inki.dae@samsung.com>
Link: https://patchwork.freedesktop.org/patch/msgid/1556073313-9923-1-git-send-email-inki.dae@samsung.com
parents 70b5f09e 8b955034
...@@ -188,7 +188,7 @@ static void decon_setup_trigger(struct decon_context *ctx) ...@@ -188,7 +188,7 @@ static void decon_setup_trigger(struct decon_context *ctx)
if (regmap_update_bits(ctx->sysreg, DSD_CFG_MUX, if (regmap_update_bits(ctx->sysreg, DSD_CFG_MUX,
DSD_CFG_MUX_TE_UNMASK_GLOBAL, ~0)) DSD_CFG_MUX_TE_UNMASK_GLOBAL, ~0))
DRM_ERROR("Cannot update sysreg.\n"); DRM_DEV_ERROR(ctx->dev, "Cannot update sysreg.\n");
} }
static void decon_commit(struct exynos_drm_crtc *crtc) static void decon_commit(struct exynos_drm_crtc *crtc)
...@@ -356,7 +356,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win, ...@@ -356,7 +356,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
break; break;
} }
DRM_DEBUG_KMS("cpp = %u\n", fb->format->cpp[0]); DRM_DEV_DEBUG_KMS(ctx->dev, "cpp = %u\n", fb->format->cpp[0]);
/* /*
* In case of exynos, setting dma-burst to 16Word causes permanent * In case of exynos, setting dma-burst to 16Word causes permanent
...@@ -561,8 +561,6 @@ static void decon_clear_channels(struct exynos_drm_crtc *crtc) ...@@ -561,8 +561,6 @@ static void decon_clear_channels(struct exynos_drm_crtc *crtc)
struct decon_context *ctx = crtc->ctx; struct decon_context *ctx = crtc->ctx;
int win, i, ret; int win, i, ret;
DRM_DEBUG_KMS("%s\n", __FILE__);
for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) { for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) {
ret = clk_prepare_enable(ctx->clks[i]); ret = clk_prepare_enable(ctx->clks[i]);
if (ret < 0) if (ret < 0)
......
...@@ -99,7 +99,7 @@ static void decon_wait_for_vblank(struct exynos_drm_crtc *crtc) ...@@ -99,7 +99,7 @@ static void decon_wait_for_vblank(struct exynos_drm_crtc *crtc)
if (!wait_event_timeout(ctx->wait_vsync_queue, if (!wait_event_timeout(ctx->wait_vsync_queue,
!atomic_read(&ctx->wait_vsync_event), !atomic_read(&ctx->wait_vsync_event),
HZ/20)) HZ/20))
DRM_DEBUG_KMS("vblank wait timed out.\n"); DRM_DEV_DEBUG_KMS(ctx->dev, "vblank wait timed out.\n");
} }
static void decon_clear_channels(struct exynos_drm_crtc *crtc) static void decon_clear_channels(struct exynos_drm_crtc *crtc)
...@@ -107,8 +107,6 @@ static void decon_clear_channels(struct exynos_drm_crtc *crtc) ...@@ -107,8 +107,6 @@ static void decon_clear_channels(struct exynos_drm_crtc *crtc)
struct decon_context *ctx = crtc->ctx; struct decon_context *ctx = crtc->ctx;
unsigned int win, ch_enabled = 0; unsigned int win, ch_enabled = 0;
DRM_DEBUG_KMS("%s\n", __FILE__);
/* Check if any channel is enabled. */ /* Check if any channel is enabled. */
for (win = 0; win < WINDOWS_NR; win++) { for (win = 0; win < WINDOWS_NR; win++) {
u32 val = readl(ctx->regs + WINCON(win)); u32 val = readl(ctx->regs + WINCON(win));
...@@ -315,7 +313,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win, ...@@ -315,7 +313,7 @@ static void decon_win_set_pixfmt(struct decon_context *ctx, unsigned int win,
break; break;
} }
DRM_DEBUG_KMS("cpp = %d\n", fb->format->cpp[0]); DRM_DEV_DEBUG_KMS(ctx->dev, "cpp = %d\n", fb->format->cpp[0]);
/* /*
* In case of exynos, setting dma-burst to 16Word causes permanent * In case of exynos, setting dma-burst to 16Word causes permanent
...@@ -422,9 +420,9 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, ...@@ -422,9 +420,9 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
writel(state->src.x, ctx->regs + VIDW_OFFSET_X(win)); writel(state->src.x, ctx->regs + VIDW_OFFSET_X(win));
writel(state->src.y, ctx->regs + VIDW_OFFSET_Y(win)); writel(state->src.y, ctx->regs + VIDW_OFFSET_Y(win));
DRM_DEBUG_KMS("start addr = 0x%lx\n", DRM_DEV_DEBUG_KMS(ctx->dev, "start addr = 0x%lx\n",
(unsigned long)val); (unsigned long)val);
DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", DRM_DEV_DEBUG_KMS(ctx->dev, "ovl_width = %d, ovl_height = %d\n",
state->crtc.w, state->crtc.h); state->crtc.w, state->crtc.h);
val = VIDOSDxA_TOPLEFT_X(state->crtc.x) | val = VIDOSDxA_TOPLEFT_X(state->crtc.x) |
...@@ -442,7 +440,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, ...@@ -442,7 +440,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc,
writel(val, ctx->regs + VIDOSD_B(win)); writel(val, ctx->regs + VIDOSD_B(win));
DRM_DEBUG_KMS("osd pos: tx = %d, ty = %d, bx = %d, by = %d\n", DRM_DEV_DEBUG_KMS(ctx->dev, "osd pos: tx = %d, ty = %d, bx = %d, by = %d\n",
state->crtc.x, state->crtc.y, last_x, last_y); state->crtc.x, state->crtc.y, last_x, last_y);
/* OSD alpha */ /* OSD alpha */
...@@ -622,7 +620,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data) ...@@ -622,7 +620,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data)
ret = decon_ctx_initialize(ctx, drm_dev); ret = decon_ctx_initialize(ctx, drm_dev);
if (ret) { if (ret) {
DRM_ERROR("decon_ctx_initialize failed.\n"); DRM_DEV_ERROR(dev, "decon_ctx_initialize failed.\n");
return ret; return ret;
} }
...@@ -802,25 +800,29 @@ static int exynos7_decon_resume(struct device *dev) ...@@ -802,25 +800,29 @@ static int exynos7_decon_resume(struct device *dev)
ret = clk_prepare_enable(ctx->pclk); ret = clk_prepare_enable(ctx->pclk);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the pclk [%d]\n", ret); DRM_DEV_ERROR(dev, "Failed to prepare_enable the pclk [%d]\n",
ret);
return ret; return ret;
} }
ret = clk_prepare_enable(ctx->aclk); ret = clk_prepare_enable(ctx->aclk);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the aclk [%d]\n", ret); DRM_DEV_ERROR(dev, "Failed to prepare_enable the aclk [%d]\n",
ret);
return ret; return ret;
} }
ret = clk_prepare_enable(ctx->eclk); ret = clk_prepare_enable(ctx->eclk);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the eclk [%d]\n", ret); DRM_DEV_ERROR(dev, "Failed to prepare_enable the eclk [%d]\n",
ret);
return ret; return ret;
} }
ret = clk_prepare_enable(ctx->vclk); ret = clk_prepare_enable(ctx->vclk);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the vclk [%d]\n", ret); DRM_DEV_ERROR(dev, "Failed to prepare_enable the vclk [%d]\n",
ret);
return ret; return ret;
} }
......
...@@ -83,7 +83,8 @@ static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data, ...@@ -83,7 +83,8 @@ static int exynos_dp_get_modes(struct analogix_dp_plat_data *plat_data,
mode = drm_mode_create(connector->dev); mode = drm_mode_create(connector->dev);
if (!mode) { if (!mode) {
DRM_ERROR("failed to create a new display mode.\n"); DRM_DEV_ERROR(dp->dev,
"failed to create a new display mode.\n");
return num_modes; return num_modes;
} }
...@@ -111,7 +112,8 @@ static int exynos_dp_bridge_attach(struct analogix_dp_plat_data *plat_data, ...@@ -111,7 +112,8 @@ static int exynos_dp_bridge_attach(struct analogix_dp_plat_data *plat_data,
if (dp->ptn_bridge) { if (dp->ptn_bridge) {
ret = drm_bridge_attach(&dp->encoder, dp->ptn_bridge, bridge); ret = drm_bridge_attach(&dp->encoder, dp->ptn_bridge, bridge);
if (ret) { if (ret) {
DRM_ERROR("Failed to attach bridge to drm\n"); DRM_DEV_ERROR(dp->dev,
"Failed to attach bridge to drm\n");
bridge->next = NULL; bridge->next = NULL;
return ret; return ret;
} }
...@@ -147,7 +149,8 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp) ...@@ -147,7 +149,8 @@ static int exynos_dp_dt_parse_panel(struct exynos_dp_device *dp)
ret = of_get_videomode(dp->dev->of_node, &dp->vm, OF_USE_NATIVE_MODE); ret = of_get_videomode(dp->dev->of_node, &dp->vm, OF_USE_NATIVE_MODE);
if (ret) { if (ret) {
DRM_ERROR("failed: of_get_videomode() : %d\n", ret); DRM_DEV_ERROR(dp->dev,
"failed: of_get_videomode() : %d\n", ret);
return ret; return ret;
} }
return 0; return 0;
......
...@@ -62,7 +62,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev, ...@@ -62,7 +62,7 @@ static int drm_iommu_attach_device(struct drm_device *drm_dev,
int ret; int ret;
if (get_dma_ops(priv->dma_dev) != get_dma_ops(subdrv_dev)) { if (get_dma_ops(priv->dma_dev) != get_dma_ops(subdrv_dev)) {
DRM_ERROR("Device %s lacks support for IOMMU\n", DRM_DEV_ERROR(subdrv_dev, "Device %s lacks support for IOMMU\n",
dev_name(subdrv_dev)); dev_name(subdrv_dev));
return -EINVAL; return -EINVAL;
} }
......
...@@ -77,7 +77,8 @@ static int exynos_dpi_get_modes(struct drm_connector *connector) ...@@ -77,7 +77,8 @@ static int exynos_dpi_get_modes(struct drm_connector *connector)
mode = drm_mode_create(connector->dev); mode = drm_mode_create(connector->dev);
if (!mode) { if (!mode) {
DRM_ERROR("failed to create a new display mode\n"); DRM_DEV_ERROR(ctx->dev,
"failed to create a new display mode\n");
return 0; return 0;
} }
drm_display_mode_from_videomode(ctx->vm, mode); drm_display_mode_from_videomode(ctx->vm, mode);
...@@ -108,7 +109,8 @@ static int exynos_dpi_create_connector(struct drm_encoder *encoder) ...@@ -108,7 +109,8 @@ static int exynos_dpi_create_connector(struct drm_encoder *encoder)
&exynos_dpi_connector_funcs, &exynos_dpi_connector_funcs,
DRM_MODE_CONNECTOR_VGA); DRM_MODE_CONNECTOR_VGA);
if (ret) { if (ret) {
DRM_ERROR("failed to initialize connector with drm\n"); DRM_DEV_ERROR(ctx->dev,
"failed to initialize connector with drm\n");
return ret; return ret;
} }
...@@ -213,7 +215,8 @@ int exynos_dpi_bind(struct drm_device *dev, struct drm_encoder *encoder) ...@@ -213,7 +215,8 @@ int exynos_dpi_bind(struct drm_device *dev, struct drm_encoder *encoder)
ret = exynos_dpi_create_connector(encoder); ret = exynos_dpi_create_connector(encoder);
if (ret) { if (ret) {
DRM_ERROR("failed to create connector ret = %d\n", ret); DRM_DEV_ERROR(encoder_to_dpi(encoder)->dev,
"failed to create connector ret = %d\n", ret);
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
return ret; return ret;
} }
......
...@@ -1483,7 +1483,8 @@ static int exynos_dsi_create_connector(struct drm_encoder *encoder) ...@@ -1483,7 +1483,8 @@ static int exynos_dsi_create_connector(struct drm_encoder *encoder)
ret = drm_connector_init(drm, connector, &exynos_dsi_connector_funcs, ret = drm_connector_init(drm, connector, &exynos_dsi_connector_funcs,
DRM_MODE_CONNECTOR_DSI); DRM_MODE_CONNECTOR_DSI);
if (ret) { if (ret) {
DRM_ERROR("Failed to initialize connector with drm\n"); DRM_DEV_ERROR(dsi->dev,
"Failed to initialize connector with drm\n");
return ret; return ret;
} }
...@@ -1527,7 +1528,9 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, ...@@ -1527,7 +1528,9 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host,
int ret = exynos_dsi_create_connector(encoder); int ret = exynos_dsi_create_connector(encoder);
if (ret) { if (ret) {
DRM_ERROR("failed to create connector ret = %d\n", ret); DRM_DEV_ERROR(dsi->dev,
"failed to create connector ret = %d\n",
ret);
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
return ret; return ret;
} }
......
...@@ -45,7 +45,8 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev, ...@@ -45,7 +45,8 @@ static int check_fb_gem_memory_type(struct drm_device *drm_dev,
* supported without IOMMU. * supported without IOMMU.
*/ */
if (IS_NONCONTIG_BUFFER(flags)) { if (IS_NONCONTIG_BUFFER(flags)) {
DRM_ERROR("Non-contiguous GEM memory is not supported.\n"); DRM_DEV_ERROR(drm_dev->dev,
"Non-contiguous GEM memory is not supported.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -83,7 +84,8 @@ exynos_drm_framebuffer_init(struct drm_device *dev, ...@@ -83,7 +84,8 @@ exynos_drm_framebuffer_init(struct drm_device *dev,
ret = drm_framebuffer_init(dev, fb, &exynos_drm_fb_funcs); ret = drm_framebuffer_init(dev, fb, &exynos_drm_fb_funcs);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to initialize framebuffer\n"); DRM_DEV_ERROR(dev->dev,
"failed to initialize framebuffer\n");
goto err; goto err;
} }
...@@ -113,7 +115,8 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, ...@@ -113,7 +115,8 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv,
exynos_gem[i] = exynos_drm_gem_get(file_priv, exynos_gem[i] = exynos_drm_gem_get(file_priv,
mode_cmd->handles[i]); mode_cmd->handles[i]);
if (!exynos_gem[i]) { if (!exynos_gem[i]) {
DRM_ERROR("failed to lookup gem object\n"); DRM_DEV_ERROR(dev->dev,
"failed to lookup gem object\n");
ret = -ENOENT; ret = -ENOENT;
goto err; goto err;
} }
......
...@@ -55,7 +55,7 @@ static int exynos_drm_fb_mmap(struct fb_info *info, ...@@ -55,7 +55,7 @@ static int exynos_drm_fb_mmap(struct fb_info *info,
exynos_gem->dma_addr, exynos_gem->size, exynos_gem->dma_addr, exynos_gem->size,
exynos_gem->dma_attrs); exynos_gem->dma_attrs);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to mmap.\n"); DRM_DEV_ERROR(to_dma_dev(helper->dev), "failed to mmap.\n");
return ret; return ret;
} }
...@@ -83,7 +83,8 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, ...@@ -83,7 +83,8 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
fbi = drm_fb_helper_alloc_fbi(helper); fbi = drm_fb_helper_alloc_fbi(helper);
if (IS_ERR(fbi)) { if (IS_ERR(fbi)) {
DRM_ERROR("failed to allocate fb info.\n"); DRM_DEV_ERROR(to_dma_dev(helper->dev),
"failed to allocate fb info.\n");
return PTR_ERR(fbi); return PTR_ERR(fbi);
} }
...@@ -96,7 +97,8 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, ...@@ -96,7 +97,8 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
exynos_gem->kvaddr = (void __iomem *) vmap(exynos_gem->pages, nr_pages, exynos_gem->kvaddr = (void __iomem *) vmap(exynos_gem->pages, nr_pages,
VM_MAP, pgprot_writecombine(PAGE_KERNEL)); VM_MAP, pgprot_writecombine(PAGE_KERNEL));
if (!exynos_gem->kvaddr) { if (!exynos_gem->kvaddr) {
DRM_ERROR("failed to map pages to kernel space.\n"); DRM_DEV_ERROR(to_dma_dev(helper->dev),
"failed to map pages to kernel space.\n");
return -EIO; return -EIO;
} }
...@@ -120,9 +122,10 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, ...@@ -120,9 +122,10 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
unsigned long size; unsigned long size;
int ret; int ret;
DRM_DEBUG_KMS("surface width(%d), height(%d) and bpp(%d\n", DRM_DEV_DEBUG_KMS(dev->dev,
sizes->surface_width, sizes->surface_height, "surface width(%d), height(%d) and bpp(%d\n",
sizes->surface_bpp); sizes->surface_width, sizes->surface_height,
sizes->surface_bpp);
mode_cmd.width = sizes->surface_width; mode_cmd.width = sizes->surface_width;
mode_cmd.height = sizes->surface_height; mode_cmd.height = sizes->surface_height;
...@@ -152,7 +155,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, ...@@ -152,7 +155,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
helper->fb = helper->fb =
exynos_drm_framebuffer_init(dev, &mode_cmd, &exynos_gem, 1); exynos_drm_framebuffer_init(dev, &mode_cmd, &exynos_gem, 1);
if (IS_ERR(helper->fb)) { if (IS_ERR(helper->fb)) {
DRM_ERROR("failed to create drm framebuffer.\n"); DRM_DEV_ERROR(dev->dev, "failed to create drm framebuffer.\n");
ret = PTR_ERR(helper->fb); ret = PTR_ERR(helper->fb);
goto err_destroy_gem; goto err_destroy_gem;
} }
...@@ -201,20 +204,23 @@ int exynos_drm_fbdev_init(struct drm_device *dev) ...@@ -201,20 +204,23 @@ int exynos_drm_fbdev_init(struct drm_device *dev)
ret = drm_fb_helper_init(dev, helper, MAX_CONNECTOR); ret = drm_fb_helper_init(dev, helper, MAX_CONNECTOR);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to initialize drm fb helper.\n"); DRM_DEV_ERROR(dev->dev,
"failed to initialize drm fb helper.\n");
goto err_init; goto err_init;
} }
ret = drm_fb_helper_single_add_all_connectors(helper); ret = drm_fb_helper_single_add_all_connectors(helper);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to register drm_fb_helper_connector.\n"); DRM_DEV_ERROR(dev->dev,
"failed to register drm_fb_helper_connector.\n");
goto err_setup; goto err_setup;
} }
ret = drm_fb_helper_initial_config(helper, PREFERRED_BPP); ret = drm_fb_helper_initial_config(helper, PREFERRED_BPP);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to set up hw configuration.\n"); DRM_DEV_ERROR(dev->dev,
"failed to set up hw configuration.\n");
goto err_setup; goto err_setup;
} }
......
This diff is collapsed.
...@@ -315,7 +315,7 @@ static void fimd_wait_for_vblank(struct exynos_drm_crtc *crtc) ...@@ -315,7 +315,7 @@ static void fimd_wait_for_vblank(struct exynos_drm_crtc *crtc)
if (!wait_event_timeout(ctx->wait_vsync_queue, if (!wait_event_timeout(ctx->wait_vsync_queue,
!atomic_read(&ctx->wait_vsync_event), !atomic_read(&ctx->wait_vsync_event),
HZ/20)) HZ/20))
DRM_DEBUG_KMS("vblank wait timed out.\n"); DRM_DEV_DEBUG_KMS(ctx->dev, "vblank wait timed out.\n");
} }
static void fimd_enable_video_output(struct fimd_context *ctx, unsigned int win, static void fimd_enable_video_output(struct fimd_context *ctx, unsigned int win,
...@@ -350,8 +350,6 @@ static void fimd_clear_channels(struct exynos_drm_crtc *crtc) ...@@ -350,8 +350,6 @@ static void fimd_clear_channels(struct exynos_drm_crtc *crtc)
struct fimd_context *ctx = crtc->ctx; struct fimd_context *ctx = crtc->ctx;
unsigned int win, ch_enabled = 0; unsigned int win, ch_enabled = 0;
DRM_DEBUG_KMS("%s\n", __FILE__);
/* Hardware is in unknown state, so ensure it gets enabled properly */ /* Hardware is in unknown state, so ensure it gets enabled properly */
pm_runtime_get_sync(ctx->dev); pm_runtime_get_sync(ctx->dev);
...@@ -400,7 +398,7 @@ static int fimd_atomic_check(struct exynos_drm_crtc *crtc, ...@@ -400,7 +398,7 @@ static int fimd_atomic_check(struct exynos_drm_crtc *crtc,
u32 clkdiv; u32 clkdiv;
if (mode->clock == 0) { if (mode->clock == 0) {
DRM_INFO("Mode has zero clock value.\n"); DRM_DEV_ERROR(ctx->dev, "Mode has zero clock value.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -416,15 +414,17 @@ static int fimd_atomic_check(struct exynos_drm_crtc *crtc, ...@@ -416,15 +414,17 @@ static int fimd_atomic_check(struct exynos_drm_crtc *crtc,
lcd_rate = clk_get_rate(ctx->lcd_clk); lcd_rate = clk_get_rate(ctx->lcd_clk);
if (2 * lcd_rate < ideal_clk) { if (2 * lcd_rate < ideal_clk) {
DRM_INFO("sclk_fimd clock too low(%lu) for requested pixel clock(%lu)\n", DRM_DEV_ERROR(ctx->dev,
lcd_rate, ideal_clk); "sclk_fimd clock too low(%lu) for requested pixel clock(%lu)\n",
lcd_rate, ideal_clk);
return -EINVAL; return -EINVAL;
} }
/* Find the clock divider value that gets us closest to ideal_clk */ /* Find the clock divider value that gets us closest to ideal_clk */
clkdiv = DIV_ROUND_CLOSEST(lcd_rate, ideal_clk); clkdiv = DIV_ROUND_CLOSEST(lcd_rate, ideal_clk);
if (clkdiv >= 0x200) { if (clkdiv >= 0x200) {
DRM_INFO("requested pixel clock(%lu) too low\n", ideal_clk); DRM_DEV_ERROR(ctx->dev, "requested pixel clock(%lu) too low\n",
ideal_clk);
return -EINVAL; return -EINVAL;
} }
...@@ -481,7 +481,8 @@ static void fimd_commit(struct exynos_drm_crtc *crtc) ...@@ -481,7 +481,8 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
driver_data->lcdblk_offset, driver_data->lcdblk_offset,
0x3 << driver_data->lcdblk_vt_shift, 0x3 << driver_data->lcdblk_vt_shift,
0x1 << driver_data->lcdblk_vt_shift)) { 0x1 << driver_data->lcdblk_vt_shift)) {
DRM_ERROR("Failed to update sysreg for I80 i/f.\n"); DRM_DEV_ERROR(ctx->dev,
"Failed to update sysreg for I80 i/f.\n");
return; return;
} }
} else { } else {
...@@ -525,7 +526,8 @@ static void fimd_commit(struct exynos_drm_crtc *crtc) ...@@ -525,7 +526,8 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
driver_data->lcdblk_offset, driver_data->lcdblk_offset,
0x1 << driver_data->lcdblk_bypass_shift, 0x1 << driver_data->lcdblk_bypass_shift,
0x1 << driver_data->lcdblk_bypass_shift)) { 0x1 << driver_data->lcdblk_bypass_shift)) {
DRM_ERROR("Failed to update sysreg for bypass setting.\n"); DRM_DEV_ERROR(ctx->dev,
"Failed to update sysreg for bypass setting.\n");
return; return;
} }
...@@ -537,7 +539,8 @@ static void fimd_commit(struct exynos_drm_crtc *crtc) ...@@ -537,7 +539,8 @@ static void fimd_commit(struct exynos_drm_crtc *crtc)
driver_data->lcdblk_offset, driver_data->lcdblk_offset,
0x1 << driver_data->lcdblk_mic_bypass_shift, 0x1 << driver_data->lcdblk_mic_bypass_shift,
0x1 << driver_data->lcdblk_mic_bypass_shift)) { 0x1 << driver_data->lcdblk_mic_bypass_shift)) {
DRM_ERROR("Failed to update sysreg for bypass mic.\n"); DRM_DEV_ERROR(ctx->dev,
"Failed to update sysreg for bypass mic.\n");
return; return;
} }
...@@ -814,10 +817,11 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, ...@@ -814,10 +817,11 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
val = (unsigned long)(dma_addr + size); val = (unsigned long)(dma_addr + size);
writel(val, ctx->regs + VIDWx_BUF_END(win, 0)); writel(val, ctx->regs + VIDWx_BUF_END(win, 0));
DRM_DEBUG_KMS("start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n", DRM_DEV_DEBUG_KMS(ctx->dev,
(unsigned long)dma_addr, val, size); "start addr = 0x%lx, end addr = 0x%lx, size = 0x%lx\n",
DRM_DEBUG_KMS("ovl_width = %d, ovl_height = %d\n", (unsigned long)dma_addr, val, size);
state->crtc.w, state->crtc.h); DRM_DEV_DEBUG_KMS(ctx->dev, "ovl_width = %d, ovl_height = %d\n",
state->crtc.w, state->crtc.h);
/* buffer size */ /* buffer size */
buf_offsize = pitch - (state->crtc.w * cpp); buf_offsize = pitch - (state->crtc.w * cpp);
...@@ -847,8 +851,9 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, ...@@ -847,8 +851,9 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
writel(val, ctx->regs + VIDOSD_B(win)); writel(val, ctx->regs + VIDOSD_B(win));
DRM_DEBUG_KMS("osd pos: tx = %d, ty = %d, bx = %d, by = %d\n", DRM_DEV_DEBUG_KMS(ctx->dev,
state->crtc.x, state->crtc.y, last_x, last_y); "osd pos: tx = %d, ty = %d, bx = %d, by = %d\n",
state->crtc.x, state->crtc.y, last_x, last_y);
/* OSD size */ /* OSD size */
if (win != 3 && win != 4) { if (win != 3 && win != 4) {
...@@ -858,7 +863,8 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc, ...@@ -858,7 +863,8 @@ static void fimd_update_plane(struct exynos_drm_crtc *crtc,
val = state->crtc.w * state->crtc.h; val = state->crtc.w * state->crtc.h;
writel(val, ctx->regs + offset); writel(val, ctx->regs + offset);
DRM_DEBUG_KMS("osd size = 0x%x\n", (unsigned int)val); DRM_DEV_DEBUG_KMS(ctx->dev, "osd size = 0x%x\n",
(unsigned int)val);
} }
fimd_win_set_pixfmt(ctx, win, fb, state->src.w); fimd_win_set_pixfmt(ctx, win, fb, state->src.w);
...@@ -1252,13 +1258,17 @@ static int exynos_fimd_resume(struct device *dev) ...@@ -1252,13 +1258,17 @@ static int exynos_fimd_resume(struct device *dev)
ret = clk_prepare_enable(ctx->bus_clk); ret = clk_prepare_enable(ctx->bus_clk);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the bus clk [%d]\n", ret); DRM_DEV_ERROR(dev,
"Failed to prepare_enable the bus clk [%d]\n",
ret);
return ret; return ret;
} }
ret = clk_prepare_enable(ctx->lcd_clk); ret = clk_prepare_enable(ctx->lcd_clk);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the lcd clk [%d]\n", ret); DRM_DEV_ERROR(dev,
"Failed to prepare_enable the lcd clk [%d]\n",
ret);
return ret; return ret;
} }
......
...@@ -429,7 +429,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d, ...@@ -429,7 +429,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d,
int ret; int ret;
if (!size) { if (!size) {
DRM_ERROR("invalid userptr size.\n"); DRM_DEV_ERROR(g2d->dev, "invalid userptr size.\n");
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
...@@ -482,7 +482,8 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d, ...@@ -482,7 +482,8 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d,
ret = get_vaddr_frames(start, npages, FOLL_FORCE | FOLL_WRITE, ret = get_vaddr_frames(start, npages, FOLL_FORCE | FOLL_WRITE,
g2d_userptr->vec); g2d_userptr->vec);
if (ret != npages) { if (ret != npages) {
DRM_ERROR("failed to get user pages from userptr.\n"); DRM_DEV_ERROR(g2d->dev,
"failed to get user pages from userptr.\n");
if (ret < 0) if (ret < 0)
goto err_destroy_framevec; goto err_destroy_framevec;
ret = -EFAULT; ret = -EFAULT;
...@@ -503,7 +504,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d, ...@@ -503,7 +504,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d,
frame_vector_pages(g2d_userptr->vec), frame_vector_pages(g2d_userptr->vec),
npages, offset, size, GFP_KERNEL); npages, offset, size, GFP_KERNEL);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to get sgt from pages.\n"); DRM_DEV_ERROR(g2d->dev, "failed to get sgt from pages.\n");
goto err_free_sgt; goto err_free_sgt;
} }
...@@ -511,7 +512,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d, ...@@ -511,7 +512,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct g2d_data *g2d,
if (!dma_map_sg(to_dma_dev(g2d->drm_dev), sgt->sgl, sgt->nents, if (!dma_map_sg(to_dma_dev(g2d->drm_dev), sgt->sgl, sgt->nents,
DMA_BIDIRECTIONAL)) { DMA_BIDIRECTIONAL)) {
DRM_ERROR("failed to map sgt with dma region.\n"); DRM_DEV_ERROR(g2d->dev, "failed to map sgt with dma region.\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err_sg_free_table; goto err_sg_free_table;
} }
...@@ -560,7 +561,7 @@ static void g2d_userptr_free_all(struct g2d_data *g2d, struct drm_file *filp) ...@@ -560,7 +561,7 @@ static void g2d_userptr_free_all(struct g2d_data *g2d, struct drm_file *filp)
g2d->current_pool = 0; g2d->current_pool = 0;
} }
static enum g2d_reg_type g2d_get_reg_type(int reg_offset) static enum g2d_reg_type g2d_get_reg_type(struct g2d_data *g2d, int reg_offset)
{ {
enum g2d_reg_type reg_type; enum g2d_reg_type reg_type;
...@@ -593,7 +594,8 @@ static enum g2d_reg_type g2d_get_reg_type(int reg_offset) ...@@ -593,7 +594,8 @@ static enum g2d_reg_type g2d_get_reg_type(int reg_offset)
break; break;
default: default:
reg_type = REG_TYPE_NONE; reg_type = REG_TYPE_NONE;
DRM_ERROR("Unknown register offset![%d]\n", reg_offset); DRM_DEV_ERROR(g2d->dev, "Unknown register offset![%d]\n",
reg_offset);
break; break;
} }
...@@ -627,9 +629,10 @@ static unsigned long g2d_get_buf_bpp(unsigned int format) ...@@ -627,9 +629,10 @@ static unsigned long g2d_get_buf_bpp(unsigned int format)
return bpp; return bpp;
} }
static bool g2d_check_buf_desc_is_valid(struct g2d_buf_desc *buf_desc, static bool g2d_check_buf_desc_is_valid(struct g2d_data *g2d,
enum g2d_reg_type reg_type, struct g2d_buf_desc *buf_desc,
unsigned long size) enum g2d_reg_type reg_type,
unsigned long size)
{ {
int width, height; int width, height;
unsigned long bpp, last_pos; unsigned long bpp, last_pos;
...@@ -644,14 +647,15 @@ static bool g2d_check_buf_desc_is_valid(struct g2d_buf_desc *buf_desc, ...@@ -644,14 +647,15 @@ static bool g2d_check_buf_desc_is_valid(struct g2d_buf_desc *buf_desc,
/* This check also makes sure that right_x > left_x. */ /* This check also makes sure that right_x > left_x. */
width = (int)buf_desc->right_x - (int)buf_desc->left_x; width = (int)buf_desc->right_x - (int)buf_desc->left_x;
if (width < G2D_LEN_MIN || width > G2D_LEN_MAX) { if (width < G2D_LEN_MIN || width > G2D_LEN_MAX) {
DRM_ERROR("width[%d] is out of range!\n", width); DRM_DEV_ERROR(g2d->dev, "width[%d] is out of range!\n", width);
return false; return false;
} }
/* This check also makes sure that bottom_y > top_y. */ /* This check also makes sure that bottom_y > top_y. */
height = (int)buf_desc->bottom_y - (int)buf_desc->top_y; height = (int)buf_desc->bottom_y - (int)buf_desc->top_y;
if (height < G2D_LEN_MIN || height > G2D_LEN_MAX) { if (height < G2D_LEN_MIN || height > G2D_LEN_MAX) {
DRM_ERROR("height[%d] is out of range!\n", height); DRM_DEV_ERROR(g2d->dev,
"height[%d] is out of range!\n", height);
return false; return false;
} }
...@@ -670,8 +674,8 @@ static bool g2d_check_buf_desc_is_valid(struct g2d_buf_desc *buf_desc, ...@@ -670,8 +674,8 @@ static bool g2d_check_buf_desc_is_valid(struct g2d_buf_desc *buf_desc,
*/ */
if (last_pos >= size) { if (last_pos >= size) {
DRM_ERROR("last engine access position [%lu] " DRM_DEV_ERROR(g2d->dev, "last engine access position [%lu] "
"is out of range [%lu]!\n", last_pos, size); "is out of range [%lu]!\n", last_pos, size);
return false; return false;
} }
...@@ -701,7 +705,7 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, ...@@ -701,7 +705,7 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d,
offset = cmdlist->data[reg_pos]; offset = cmdlist->data[reg_pos];
handle = cmdlist->data[reg_pos + 1]; handle = cmdlist->data[reg_pos + 1];
reg_type = g2d_get_reg_type(offset); reg_type = g2d_get_reg_type(g2d, offset);
if (reg_type == REG_TYPE_NONE) { if (reg_type == REG_TYPE_NONE) {
ret = -EFAULT; ret = -EFAULT;
goto err; goto err;
...@@ -718,7 +722,7 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, ...@@ -718,7 +722,7 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d,
goto err; goto err;
} }
if (!g2d_check_buf_desc_is_valid(buf_desc, if (!g2d_check_buf_desc_is_valid(g2d, buf_desc,
reg_type, exynos_gem->size)) { reg_type, exynos_gem->size)) {
exynos_drm_gem_put(exynos_gem); exynos_drm_gem_put(exynos_gem);
ret = -EFAULT; ret = -EFAULT;
...@@ -736,8 +740,9 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d, ...@@ -736,8 +740,9 @@ static int g2d_map_cmdlist_gem(struct g2d_data *g2d,
goto err; goto err;
} }
if (!g2d_check_buf_desc_is_valid(buf_desc, reg_type, if (!g2d_check_buf_desc_is_valid(g2d, buf_desc,
g2d_userptr.size)) { reg_type,
g2d_userptr.size)) {
ret = -EFAULT; ret = -EFAULT;
goto err; goto err;
} }
...@@ -845,7 +850,7 @@ static void g2d_free_runqueue_node(struct g2d_data *g2d, ...@@ -845,7 +850,7 @@ static void g2d_free_runqueue_node(struct g2d_data *g2d,
* *
* Has to be called under runqueue lock. * Has to be called under runqueue lock.
*/ */
static void g2d_remove_runqueue_nodes(struct g2d_data *g2d, struct drm_file* file) static void g2d_remove_runqueue_nodes(struct g2d_data *g2d, struct drm_file *file)
{ {
struct g2d_runqueue_node *node, *n; struct g2d_runqueue_node *node, *n;
...@@ -1044,7 +1049,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d, ...@@ -1044,7 +1049,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d,
if (!for_addr) if (!for_addr)
goto err; goto err;
reg_type = g2d_get_reg_type(reg_offset); reg_type = g2d_get_reg_type(g2d, reg_offset);
/* check userptr buffer type. */ /* check userptr buffer type. */
if ((cmdlist->data[index] & ~0x7fffffff) >> 31) { if ((cmdlist->data[index] & ~0x7fffffff) >> 31) {
...@@ -1058,7 +1063,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d, ...@@ -1058,7 +1063,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d,
if (for_addr) if (for_addr)
goto err; goto err;
reg_type = g2d_get_reg_type(reg_offset); reg_type = g2d_get_reg_type(g2d, reg_offset);
buf_desc = &buf_info->descs[reg_type]; buf_desc = &buf_info->descs[reg_type];
buf_desc->stride = cmdlist->data[index + 1]; buf_desc->stride = cmdlist->data[index + 1];
...@@ -1068,7 +1073,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d, ...@@ -1068,7 +1073,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d,
if (for_addr) if (for_addr)
goto err; goto err;
reg_type = g2d_get_reg_type(reg_offset); reg_type = g2d_get_reg_type(g2d, reg_offset);
buf_desc = &buf_info->descs[reg_type]; buf_desc = &buf_info->descs[reg_type];
value = cmdlist->data[index + 1]; value = cmdlist->data[index + 1];
...@@ -1080,7 +1085,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d, ...@@ -1080,7 +1085,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d,
if (for_addr) if (for_addr)
goto err; goto err;
reg_type = g2d_get_reg_type(reg_offset); reg_type = g2d_get_reg_type(g2d, reg_offset);
buf_desc = &buf_info->descs[reg_type]; buf_desc = &buf_info->descs[reg_type];
value = cmdlist->data[index + 1]; value = cmdlist->data[index + 1];
...@@ -1093,7 +1098,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d, ...@@ -1093,7 +1098,7 @@ static int g2d_check_reg_offset(struct g2d_data *g2d,
if (for_addr) if (for_addr)
goto err; goto err;
reg_type = g2d_get_reg_type(reg_offset); reg_type = g2d_get_reg_type(g2d, reg_offset);
buf_desc = &buf_info->descs[reg_type]; buf_desc = &buf_info->descs[reg_type];
value = cmdlist->data[index + 1]; value = cmdlist->data[index + 1];
......
...@@ -29,7 +29,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem) ...@@ -29,7 +29,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)
int ret = -ENOMEM; int ret = -ENOMEM;
if (exynos_gem->dma_addr) { if (exynos_gem->dma_addr) {
DRM_DEBUG_KMS("already allocated.\n"); DRM_DEV_DEBUG_KMS(to_dma_dev(dev), "already allocated.\n");
return 0; return 0;
} }
...@@ -61,7 +61,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem) ...@@ -61,7 +61,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)
exynos_gem->pages = kvmalloc_array(nr_pages, sizeof(struct page *), exynos_gem->pages = kvmalloc_array(nr_pages, sizeof(struct page *),
GFP_KERNEL | __GFP_ZERO); GFP_KERNEL | __GFP_ZERO);
if (!exynos_gem->pages) { if (!exynos_gem->pages) {
DRM_ERROR("failed to allocate pages.\n"); DRM_DEV_ERROR(to_dma_dev(dev), "failed to allocate pages.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -69,7 +69,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem) ...@@ -69,7 +69,7 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)
&exynos_gem->dma_addr, GFP_KERNEL, &exynos_gem->dma_addr, GFP_KERNEL,
exynos_gem->dma_attrs); exynos_gem->dma_attrs);
if (!exynos_gem->cookie) { if (!exynos_gem->cookie) {
DRM_ERROR("failed to allocate buffer.\n"); DRM_DEV_ERROR(to_dma_dev(dev), "failed to allocate buffer.\n");
goto err_free; goto err_free;
} }
...@@ -77,20 +77,20 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem) ...@@ -77,20 +77,20 @@ static int exynos_drm_alloc_buf(struct exynos_drm_gem *exynos_gem)
exynos_gem->dma_addr, exynos_gem->size, exynos_gem->dma_addr, exynos_gem->size,
exynos_gem->dma_attrs); exynos_gem->dma_attrs);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to get sgtable.\n"); DRM_DEV_ERROR(to_dma_dev(dev), "failed to get sgtable.\n");
goto err_dma_free; goto err_dma_free;
} }
if (drm_prime_sg_to_page_addr_arrays(&sgt, exynos_gem->pages, NULL, if (drm_prime_sg_to_page_addr_arrays(&sgt, exynos_gem->pages, NULL,
nr_pages)) { nr_pages)) {
DRM_ERROR("invalid sgtable.\n"); DRM_DEV_ERROR(to_dma_dev(dev), "invalid sgtable.\n");
ret = -EINVAL; ret = -EINVAL;
goto err_sgt_free; goto err_sgt_free;
} }
sg_free_table(&sgt); sg_free_table(&sgt);
DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n", DRM_DEV_DEBUG_KMS(to_dma_dev(dev), "dma_addr(0x%lx), size(0x%lx)\n",
(unsigned long)exynos_gem->dma_addr, exynos_gem->size); (unsigned long)exynos_gem->dma_addr, exynos_gem->size);
return 0; return 0;
...@@ -111,11 +111,11 @@ static void exynos_drm_free_buf(struct exynos_drm_gem *exynos_gem) ...@@ -111,11 +111,11 @@ static void exynos_drm_free_buf(struct exynos_drm_gem *exynos_gem)
struct drm_device *dev = exynos_gem->base.dev; struct drm_device *dev = exynos_gem->base.dev;
if (!exynos_gem->dma_addr) { if (!exynos_gem->dma_addr) {
DRM_DEBUG_KMS("dma_addr is invalid.\n"); DRM_DEV_DEBUG_KMS(dev->dev, "dma_addr is invalid.\n");
return; return;
} }
DRM_DEBUG_KMS("dma_addr(0x%lx), size(0x%lx)\n", DRM_DEV_DEBUG_KMS(dev->dev, "dma_addr(0x%lx), size(0x%lx)\n",
(unsigned long)exynos_gem->dma_addr, exynos_gem->size); (unsigned long)exynos_gem->dma_addr, exynos_gem->size);
dma_free_attrs(to_dma_dev(dev), exynos_gem->size, exynos_gem->cookie, dma_free_attrs(to_dma_dev(dev), exynos_gem->size, exynos_gem->cookie,
...@@ -139,7 +139,7 @@ static int exynos_drm_gem_handle_create(struct drm_gem_object *obj, ...@@ -139,7 +139,7 @@ static int exynos_drm_gem_handle_create(struct drm_gem_object *obj,
if (ret) if (ret)
return ret; return ret;
DRM_DEBUG_KMS("gem handle = 0x%x\n", *handle); DRM_DEV_DEBUG_KMS(to_dma_dev(obj->dev), "gem handle = 0x%x\n", *handle);
/* drop reference from allocate - handle holds it now. */ /* drop reference from allocate - handle holds it now. */
drm_gem_object_put_unlocked(obj); drm_gem_object_put_unlocked(obj);
...@@ -151,7 +151,8 @@ void exynos_drm_gem_destroy(struct exynos_drm_gem *exynos_gem) ...@@ -151,7 +151,8 @@ void exynos_drm_gem_destroy(struct exynos_drm_gem *exynos_gem)
{ {
struct drm_gem_object *obj = &exynos_gem->base; struct drm_gem_object *obj = &exynos_gem->base;
DRM_DEBUG_KMS("handle count = %d\n", obj->handle_count); DRM_DEV_DEBUG_KMS(to_dma_dev(obj->dev), "handle count = %d\n",
obj->handle_count);
/* /*
* do not release memory region from exporter. * do not release memory region from exporter.
...@@ -186,7 +187,7 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev, ...@@ -186,7 +187,7 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev,
ret = drm_gem_object_init(dev, obj, size); ret = drm_gem_object_init(dev, obj, size);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to initialize gem object\n"); DRM_DEV_ERROR(dev->dev, "failed to initialize gem object\n");
kfree(exynos_gem); kfree(exynos_gem);
return ERR_PTR(ret); return ERR_PTR(ret);
} }
...@@ -198,7 +199,7 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev, ...@@ -198,7 +199,7 @@ static struct exynos_drm_gem *exynos_drm_gem_init(struct drm_device *dev,
return ERR_PTR(ret); return ERR_PTR(ret);
} }
DRM_DEBUG_KMS("created file object = %pK\n", obj->filp); DRM_DEV_DEBUG_KMS(dev->dev, "created file object = %pK\n", obj->filp);
return exynos_gem; return exynos_gem;
} }
...@@ -211,12 +212,13 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev, ...@@ -211,12 +212,13 @@ struct exynos_drm_gem *exynos_drm_gem_create(struct drm_device *dev,
int ret; int ret;
if (flags & ~(EXYNOS_BO_MASK)) { if (flags & ~(EXYNOS_BO_MASK)) {
DRM_ERROR("invalid GEM buffer flags: %u\n", flags); DRM_DEV_ERROR(dev->dev,
"invalid GEM buffer flags: %u\n", flags);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
if (!size) { if (!size) {
DRM_ERROR("invalid GEM buffer size: %lu\n", size); DRM_DEV_ERROR(dev->dev, "invalid GEM buffer size: %lu\n", size);
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
...@@ -325,7 +327,7 @@ int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data, ...@@ -325,7 +327,7 @@ int exynos_drm_gem_get_ioctl(struct drm_device *dev, void *data,
obj = drm_gem_object_lookup(file_priv, args->handle); obj = drm_gem_object_lookup(file_priv, args->handle);
if (!obj) { if (!obj) {
DRM_ERROR("failed to lookup gem object.\n"); DRM_DEV_ERROR(dev->dev, "failed to lookup gem object.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -408,7 +410,8 @@ static int exynos_drm_gem_mmap_obj(struct drm_gem_object *obj, ...@@ -408,7 +410,8 @@ static int exynos_drm_gem_mmap_obj(struct drm_gem_object *obj,
struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj); struct exynos_drm_gem *exynos_gem = to_exynos_gem(obj);
int ret; int ret;
DRM_DEBUG_KMS("flags = 0x%x\n", exynos_gem->flags); DRM_DEV_DEBUG_KMS(to_dma_dev(obj->dev), "flags = 0x%x\n",
exynos_gem->flags);
/* non-cachable as default. */ /* non-cachable as default. */
if (exynos_gem->flags & EXYNOS_BO_CACHABLE) if (exynos_gem->flags & EXYNOS_BO_CACHABLE)
......
...@@ -395,7 +395,7 @@ static int gsc_sw_reset(struct gsc_context *ctx) ...@@ -395,7 +395,7 @@ static int gsc_sw_reset(struct gsc_context *ctx)
} }
if (cfg) { if (cfg) {
DRM_ERROR("failed to reset gsc h/w.\n"); DRM_DEV_ERROR(ctx->dev, "failed to reset gsc h/w.\n");
return -EBUSY; return -EBUSY;
} }
...@@ -422,8 +422,8 @@ static void gsc_handle_irq(struct gsc_context *ctx, bool enable, ...@@ -422,8 +422,8 @@ static void gsc_handle_irq(struct gsc_context *ctx, bool enable,
{ {
u32 cfg; u32 cfg;
DRM_DEBUG_KMS("enable[%d]overflow[%d]level[%d]\n", DRM_DEV_DEBUG_KMS(ctx->dev, "enable[%d]overflow[%d]level[%d]\n",
enable, overflow, done); enable, overflow, done);
cfg = gsc_read(GSC_IRQ); cfg = gsc_read(GSC_IRQ);
cfg |= (GSC_IRQ_OR_MASK | GSC_IRQ_FRMDONE_MASK); cfg |= (GSC_IRQ_OR_MASK | GSC_IRQ_FRMDONE_MASK);
...@@ -451,7 +451,7 @@ static void gsc_src_set_fmt(struct gsc_context *ctx, u32 fmt, bool tiled) ...@@ -451,7 +451,7 @@ static void gsc_src_set_fmt(struct gsc_context *ctx, u32 fmt, bool tiled)
{ {
u32 cfg; u32 cfg;
DRM_DEBUG_KMS("fmt[0x%x]\n", fmt); DRM_DEV_DEBUG_KMS(ctx->dev, "fmt[0x%x]\n", fmt);
cfg = gsc_read(GSC_IN_CON); cfg = gsc_read(GSC_IN_CON);
cfg &= ~(GSC_IN_RGB_TYPE_MASK | GSC_IN_YUV422_1P_ORDER_MASK | cfg &= ~(GSC_IN_RGB_TYPE_MASK | GSC_IN_YUV422_1P_ORDER_MASK |
...@@ -638,7 +638,7 @@ static void gsc_dst_set_fmt(struct gsc_context *ctx, u32 fmt, bool tiled) ...@@ -638,7 +638,7 @@ static void gsc_dst_set_fmt(struct gsc_context *ctx, u32 fmt, bool tiled)
{ {
u32 cfg; u32 cfg;
DRM_DEBUG_KMS("fmt[0x%x]\n", fmt); DRM_DEV_DEBUG_KMS(ctx->dev, "fmt[0x%x]\n", fmt);
cfg = gsc_read(GSC_OUT_CON); cfg = gsc_read(GSC_OUT_CON);
cfg &= ~(GSC_OUT_RGB_TYPE_MASK | GSC_OUT_YUV422_1P_ORDER_MASK | cfg &= ~(GSC_OUT_RGB_TYPE_MASK | GSC_OUT_YUV422_1P_ORDER_MASK |
...@@ -706,12 +706,13 @@ static void gsc_dst_set_fmt(struct gsc_context *ctx, u32 fmt, bool tiled) ...@@ -706,12 +706,13 @@ static void gsc_dst_set_fmt(struct gsc_context *ctx, u32 fmt, bool tiled)
gsc_write(cfg, GSC_OUT_CON); gsc_write(cfg, GSC_OUT_CON);
} }
static int gsc_get_ratio_shift(u32 src, u32 dst, u32 *ratio) static int gsc_get_ratio_shift(struct gsc_context *ctx, u32 src, u32 dst,
u32 *ratio)
{ {
DRM_DEBUG_KMS("src[%d]dst[%d]\n", src, dst); DRM_DEV_DEBUG_KMS(ctx->dev, "src[%d]dst[%d]\n", src, dst);
if (src >= dst * 8) { if (src >= dst * 8) {
DRM_ERROR("failed to make ratio and shift.\n"); DRM_DEV_ERROR(ctx->dev, "failed to make ratio and shift.\n");
return -EINVAL; return -EINVAL;
} else if (src >= dst * 4) } else if (src >= dst * 4)
*ratio = 4; *ratio = 4;
...@@ -759,31 +760,31 @@ static int gsc_set_prescaler(struct gsc_context *ctx, struct gsc_scaler *sc, ...@@ -759,31 +760,31 @@ static int gsc_set_prescaler(struct gsc_context *ctx, struct gsc_scaler *sc,
dst_h = dst->h; dst_h = dst->h;
} }
ret = gsc_get_ratio_shift(src_w, dst_w, &sc->pre_hratio); ret = gsc_get_ratio_shift(ctx, src_w, dst_w, &sc->pre_hratio);
if (ret) { if (ret) {
dev_err(ctx->dev, "failed to get ratio horizontal.\n"); DRM_DEV_ERROR(ctx->dev, "failed to get ratio horizontal.\n");
return ret; return ret;
} }
ret = gsc_get_ratio_shift(src_h, dst_h, &sc->pre_vratio); ret = gsc_get_ratio_shift(ctx, src_h, dst_h, &sc->pre_vratio);
if (ret) { if (ret) {
dev_err(ctx->dev, "failed to get ratio vertical.\n"); DRM_DEV_ERROR(ctx->dev, "failed to get ratio vertical.\n");
return ret; return ret;
} }
DRM_DEBUG_KMS("pre_hratio[%d]pre_vratio[%d]\n", DRM_DEV_DEBUG_KMS(ctx->dev, "pre_hratio[%d]pre_vratio[%d]\n",
sc->pre_hratio, sc->pre_vratio); sc->pre_hratio, sc->pre_vratio);
sc->main_hratio = (src_w << 16) / dst_w; sc->main_hratio = (src_w << 16) / dst_w;
sc->main_vratio = (src_h << 16) / dst_h; sc->main_vratio = (src_h << 16) / dst_h;
DRM_DEBUG_KMS("main_hratio[%ld]main_vratio[%ld]\n", DRM_DEV_DEBUG_KMS(ctx->dev, "main_hratio[%ld]main_vratio[%ld]\n",
sc->main_hratio, sc->main_vratio); sc->main_hratio, sc->main_vratio);
gsc_get_prescaler_shfactor(sc->pre_hratio, sc->pre_vratio, gsc_get_prescaler_shfactor(sc->pre_hratio, sc->pre_vratio,
&sc->pre_shfactor); &sc->pre_shfactor);
DRM_DEBUG_KMS("pre_shfactor[%d]\n", sc->pre_shfactor); DRM_DEV_DEBUG_KMS(ctx->dev, "pre_shfactor[%d]\n", sc->pre_shfactor);
cfg = (GSC_PRESC_SHFACTOR(sc->pre_shfactor) | cfg = (GSC_PRESC_SHFACTOR(sc->pre_shfactor) |
GSC_PRESC_H_RATIO(sc->pre_hratio) | GSC_PRESC_H_RATIO(sc->pre_hratio) |
...@@ -849,8 +850,8 @@ static void gsc_set_scaler(struct gsc_context *ctx, struct gsc_scaler *sc) ...@@ -849,8 +850,8 @@ static void gsc_set_scaler(struct gsc_context *ctx, struct gsc_scaler *sc)
{ {
u32 cfg; u32 cfg;
DRM_DEBUG_KMS("main_hratio[%ld]main_vratio[%ld]\n", DRM_DEV_DEBUG_KMS(ctx->dev, "main_hratio[%ld]main_vratio[%ld]\n",
sc->main_hratio, sc->main_vratio); sc->main_hratio, sc->main_vratio);
gsc_set_h_coef(ctx, sc->main_hratio); gsc_set_h_coef(ctx, sc->main_hratio);
cfg = GSC_MAIN_H_RATIO_VALUE(sc->main_hratio); cfg = GSC_MAIN_H_RATIO_VALUE(sc->main_hratio);
...@@ -916,7 +917,7 @@ static int gsc_dst_get_buf_seq(struct gsc_context *ctx) ...@@ -916,7 +917,7 @@ static int gsc_dst_get_buf_seq(struct gsc_context *ctx)
if (cfg & (mask << i)) if (cfg & (mask << i))
buf_num--; buf_num--;
DRM_DEBUG_KMS("buf_num[%d]\n", buf_num); DRM_DEV_DEBUG_KMS(ctx->dev, "buf_num[%d]\n", buf_num);
return buf_num; return buf_num;
} }
...@@ -963,7 +964,7 @@ static int gsc_get_src_buf_index(struct gsc_context *ctx) ...@@ -963,7 +964,7 @@ static int gsc_get_src_buf_index(struct gsc_context *ctx)
u32 cfg, curr_index, i; u32 cfg, curr_index, i;
u32 buf_id = GSC_MAX_SRC; u32 buf_id = GSC_MAX_SRC;
DRM_DEBUG_KMS("gsc id[%d]\n", ctx->id); DRM_DEV_DEBUG_KMS(ctx->dev, "gsc id[%d]\n", ctx->id);
cfg = gsc_read(GSC_IN_BASE_ADDR_Y_MASK); cfg = gsc_read(GSC_IN_BASE_ADDR_Y_MASK);
curr_index = GSC_IN_CURR_GET_INDEX(cfg); curr_index = GSC_IN_CURR_GET_INDEX(cfg);
...@@ -975,11 +976,11 @@ static int gsc_get_src_buf_index(struct gsc_context *ctx) ...@@ -975,11 +976,11 @@ static int gsc_get_src_buf_index(struct gsc_context *ctx)
} }
} }
DRM_DEBUG_KMS("cfg[0x%x]curr_index[%d]buf_id[%d]\n", cfg, DRM_DEV_DEBUG_KMS(ctx->dev, "cfg[0x%x]curr_index[%d]buf_id[%d]\n", cfg,
curr_index, buf_id); curr_index, buf_id);
if (buf_id == GSC_MAX_SRC) { if (buf_id == GSC_MAX_SRC) {
DRM_ERROR("failed to get in buffer index.\n"); DRM_DEV_ERROR(ctx->dev, "failed to get in buffer index.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -993,7 +994,7 @@ static int gsc_get_dst_buf_index(struct gsc_context *ctx) ...@@ -993,7 +994,7 @@ static int gsc_get_dst_buf_index(struct gsc_context *ctx)
u32 cfg, curr_index, i; u32 cfg, curr_index, i;
u32 buf_id = GSC_MAX_DST; u32 buf_id = GSC_MAX_DST;
DRM_DEBUG_KMS("gsc id[%d]\n", ctx->id); DRM_DEV_DEBUG_KMS(ctx->dev, "gsc id[%d]\n", ctx->id);
cfg = gsc_read(GSC_OUT_BASE_ADDR_Y_MASK); cfg = gsc_read(GSC_OUT_BASE_ADDR_Y_MASK);
curr_index = GSC_OUT_CURR_GET_INDEX(cfg); curr_index = GSC_OUT_CURR_GET_INDEX(cfg);
...@@ -1006,14 +1007,14 @@ static int gsc_get_dst_buf_index(struct gsc_context *ctx) ...@@ -1006,14 +1007,14 @@ static int gsc_get_dst_buf_index(struct gsc_context *ctx)
} }
if (buf_id == GSC_MAX_DST) { if (buf_id == GSC_MAX_DST) {
DRM_ERROR("failed to get out buffer index.\n"); DRM_DEV_ERROR(ctx->dev, "failed to get out buffer index.\n");
return -EINVAL; return -EINVAL;
} }
gsc_dst_set_buf_seq(ctx, buf_id, false); gsc_dst_set_buf_seq(ctx, buf_id, false);
DRM_DEBUG_KMS("cfg[0x%x]curr_index[%d]buf_id[%d]\n", cfg, DRM_DEV_DEBUG_KMS(ctx->dev, "cfg[0x%x]curr_index[%d]buf_id[%d]\n", cfg,
curr_index, buf_id); curr_index, buf_id);
return buf_id; return buf_id;
} }
...@@ -1024,7 +1025,7 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id) ...@@ -1024,7 +1025,7 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id)
u32 status; u32 status;
int err = 0; int err = 0;
DRM_DEBUG_KMS("gsc id[%d]\n", ctx->id); DRM_DEV_DEBUG_KMS(ctx->dev, "gsc id[%d]\n", ctx->id);
status = gsc_read(GSC_IRQ); status = gsc_read(GSC_IRQ);
if (status & GSC_IRQ_STATUS_OR_IRQ) { if (status & GSC_IRQ_STATUS_OR_IRQ) {
...@@ -1042,8 +1043,8 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id) ...@@ -1042,8 +1043,8 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id)
src_buf_id = gsc_get_src_buf_index(ctx); src_buf_id = gsc_get_src_buf_index(ctx);
dst_buf_id = gsc_get_dst_buf_index(ctx); dst_buf_id = gsc_get_dst_buf_index(ctx);
DRM_DEBUG_KMS("buf_id_src[%d]buf_id_dst[%d]\n", src_buf_id, DRM_DEV_DEBUG_KMS(ctx->dev, "buf_id_src[%d]buf_id_dst[%d]\n",
dst_buf_id); src_buf_id, dst_buf_id);
if (src_buf_id < 0 || dst_buf_id < 0) if (src_buf_id < 0 || dst_buf_id < 0)
err = -EINVAL; err = -EINVAL;
...@@ -1168,10 +1169,11 @@ static int gsc_bind(struct device *dev, struct device *master, void *data) ...@@ -1168,10 +1169,11 @@ static int gsc_bind(struct device *dev, struct device *master, void *data)
struct drm_device *drm_dev = data; struct drm_device *drm_dev = data;
struct exynos_drm_ipp *ipp = &ctx->ipp; struct exynos_drm_ipp *ipp = &ctx->ipp;
ctx->drm_dev = drm_dev;
ctx->drm_dev = drm_dev; ctx->drm_dev = drm_dev;
exynos_drm_register_dma(drm_dev, dev); exynos_drm_register_dma(drm_dev, dev);
exynos_drm_ipp_register(drm_dev, ipp, &ipp_funcs, exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE | DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE |
DRM_EXYNOS_IPP_CAP_SCALE | DRM_EXYNOS_IPP_CAP_CONVERT, DRM_EXYNOS_IPP_CAP_SCALE | DRM_EXYNOS_IPP_CAP_CONVERT,
ctx->formats, ctx->num_formats, "gsc"); ctx->formats, ctx->num_formats, "gsc");
...@@ -1188,7 +1190,7 @@ static void gsc_unbind(struct device *dev, struct device *master, ...@@ -1188,7 +1190,7 @@ static void gsc_unbind(struct device *dev, struct device *master,
struct drm_device *drm_dev = data; struct drm_device *drm_dev = data;
struct exynos_drm_ipp *ipp = &ctx->ipp; struct exynos_drm_ipp *ipp = &ctx->ipp;
exynos_drm_ipp_unregister(drm_dev, ipp); exynos_drm_ipp_unregister(dev, ipp);
exynos_drm_unregister_dma(drm_dev, dev); exynos_drm_unregister_dma(drm_dev, dev);
} }
...@@ -1324,7 +1326,7 @@ static int __maybe_unused gsc_runtime_suspend(struct device *dev) ...@@ -1324,7 +1326,7 @@ static int __maybe_unused gsc_runtime_suspend(struct device *dev)
struct gsc_context *ctx = get_gsc_context(dev); struct gsc_context *ctx = get_gsc_context(dev);
int i; int i;
DRM_DEBUG_KMS("id[%d]\n", ctx->id); DRM_DEV_DEBUG_KMS(dev, "id[%d]\n", ctx->id);
for (i = ctx->num_clocks - 1; i >= 0; i--) for (i = ctx->num_clocks - 1; i >= 0; i--)
clk_disable_unprepare(ctx->clocks[i]); clk_disable_unprepare(ctx->clocks[i]);
...@@ -1337,7 +1339,7 @@ static int __maybe_unused gsc_runtime_resume(struct device *dev) ...@@ -1337,7 +1339,7 @@ static int __maybe_unused gsc_runtime_resume(struct device *dev)
struct gsc_context *ctx = get_gsc_context(dev); struct gsc_context *ctx = get_gsc_context(dev);
int i, ret; int i, ret;
DRM_DEBUG_KMS("id[%d]\n", ctx->id); DRM_DEV_DEBUG_KMS(dev, "id[%d]\n", ctx->id);
for (i = 0; i < ctx->num_clocks; i++) { for (i = 0; i < ctx->num_clocks; i++) {
ret = clk_prepare_enable(ctx->clocks[i]); ret = clk_prepare_enable(ctx->clocks[i]);
......
...@@ -43,7 +43,7 @@ static LIST_HEAD(ipp_list); ...@@ -43,7 +43,7 @@ static LIST_HEAD(ipp_list);
* Returns: * Returns:
* Zero on success, error code on failure. * Zero on success, error code on failure.
*/ */
int exynos_drm_ipp_register(struct drm_device *dev, struct exynos_drm_ipp *ipp, int exynos_drm_ipp_register(struct device *dev, struct exynos_drm_ipp *ipp,
const struct exynos_drm_ipp_funcs *funcs, unsigned int caps, const struct exynos_drm_ipp_funcs *funcs, unsigned int caps,
const struct exynos_drm_ipp_formats *formats, const struct exynos_drm_ipp_formats *formats,
unsigned int num_formats, const char *name) unsigned int num_formats, const char *name)
...@@ -67,7 +67,7 @@ int exynos_drm_ipp_register(struct drm_device *dev, struct exynos_drm_ipp *ipp, ...@@ -67,7 +67,7 @@ int exynos_drm_ipp_register(struct drm_device *dev, struct exynos_drm_ipp *ipp,
list_add_tail(&ipp->head, &ipp_list); list_add_tail(&ipp->head, &ipp_list);
ipp->id = num_ipp++; ipp->id = num_ipp++;
DRM_DEBUG_DRIVER("Registered ipp %d\n", ipp->id); DRM_DEV_DEBUG_DRIVER(dev, "Registered ipp %d\n", ipp->id);
return 0; return 0;
} }
...@@ -77,7 +77,7 @@ int exynos_drm_ipp_register(struct drm_device *dev, struct exynos_drm_ipp *ipp, ...@@ -77,7 +77,7 @@ int exynos_drm_ipp_register(struct drm_device *dev, struct exynos_drm_ipp *ipp,
* @dev: DRM device * @dev: DRM device
* @ipp: ipp module * @ipp: ipp module
*/ */
void exynos_drm_ipp_unregister(struct drm_device *dev, void exynos_drm_ipp_unregister(struct device *dev,
struct exynos_drm_ipp *ipp) struct exynos_drm_ipp *ipp)
{ {
WARN_ON(ipp->task); WARN_ON(ipp->task);
...@@ -268,7 +268,7 @@ static inline struct exynos_drm_ipp_task * ...@@ -268,7 +268,7 @@ static inline struct exynos_drm_ipp_task *
task->src.rect.h = task->dst.rect.h = UINT_MAX; task->src.rect.h = task->dst.rect.h = UINT_MAX;
task->transform.rotation = DRM_MODE_ROTATE_0; task->transform.rotation = DRM_MODE_ROTATE_0;
DRM_DEBUG_DRIVER("Allocated task %pK\n", task); DRM_DEV_DEBUG_DRIVER(task->dev, "Allocated task %pK\n", task);
return task; return task;
} }
...@@ -335,7 +335,9 @@ static int exynos_drm_ipp_task_set(struct exynos_drm_ipp_task *task, ...@@ -335,7 +335,9 @@ static int exynos_drm_ipp_task_set(struct exynos_drm_ipp_task *task,
size -= map[i].size; size -= map[i].size;
} }
DRM_DEBUG_DRIVER("Got task %pK configuration from userspace\n", task); DRM_DEV_DEBUG_DRIVER(task->dev,
"Got task %pK configuration from userspace\n",
task);
return 0; return 0;
} }
...@@ -389,12 +391,12 @@ static void exynos_drm_ipp_task_release_buf(struct exynos_drm_ipp_buffer *buf) ...@@ -389,12 +391,12 @@ static void exynos_drm_ipp_task_release_buf(struct exynos_drm_ipp_buffer *buf)
static void exynos_drm_ipp_task_free(struct exynos_drm_ipp *ipp, static void exynos_drm_ipp_task_free(struct exynos_drm_ipp *ipp,
struct exynos_drm_ipp_task *task) struct exynos_drm_ipp_task *task)
{ {
DRM_DEBUG_DRIVER("Freeing task %pK\n", task); DRM_DEV_DEBUG_DRIVER(task->dev, "Freeing task %pK\n", task);
exynos_drm_ipp_task_release_buf(&task->src); exynos_drm_ipp_task_release_buf(&task->src);
exynos_drm_ipp_task_release_buf(&task->dst); exynos_drm_ipp_task_release_buf(&task->dst);
if (task->event) if (task->event)
drm_event_cancel_free(ipp->dev, &task->event->base); drm_event_cancel_free(ipp->drm_dev, &task->event->base);
kfree(task); kfree(task);
} }
...@@ -553,8 +555,9 @@ static int exynos_drm_ipp_check_format(struct exynos_drm_ipp_task *task, ...@@ -553,8 +555,9 @@ static int exynos_drm_ipp_check_format(struct exynos_drm_ipp_task *task,
buf == src ? DRM_EXYNOS_IPP_FORMAT_SOURCE : buf == src ? DRM_EXYNOS_IPP_FORMAT_SOURCE :
DRM_EXYNOS_IPP_FORMAT_DESTINATION); DRM_EXYNOS_IPP_FORMAT_DESTINATION);
if (!fmt) { if (!fmt) {
DRM_DEBUG_DRIVER("Task %pK: %s format not supported\n", task, DRM_DEV_DEBUG_DRIVER(task->dev,
buf == src ? "src" : "dst"); "Task %pK: %s format not supported\n",
task, buf == src ? "src" : "dst");
return -EINVAL; return -EINVAL;
} }
...@@ -603,7 +606,7 @@ static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task) ...@@ -603,7 +606,7 @@ static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task)
bool rotate = (rotation != DRM_MODE_ROTATE_0); bool rotate = (rotation != DRM_MODE_ROTATE_0);
bool scale = false; bool scale = false;
DRM_DEBUG_DRIVER("Checking task %pK\n", task); DRM_DEV_DEBUG_DRIVER(task->dev, "Checking task %pK\n", task);
if (src->rect.w == UINT_MAX) if (src->rect.w == UINT_MAX)
src->rect.w = src->buf.width; src->rect.w = src->buf.width;
...@@ -618,8 +621,9 @@ static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task) ...@@ -618,8 +621,9 @@ static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task)
src->rect.y + src->rect.h > (src->buf.height) || src->rect.y + src->rect.h > (src->buf.height) ||
dst->rect.x + dst->rect.w > (dst->buf.width) || dst->rect.x + dst->rect.w > (dst->buf.width) ||
dst->rect.y + dst->rect.h > (dst->buf.height)) { dst->rect.y + dst->rect.h > (dst->buf.height)) {
DRM_DEBUG_DRIVER("Task %pK: defined area is outside provided buffers\n", DRM_DEV_DEBUG_DRIVER(task->dev,
task); "Task %pK: defined area is outside provided buffers\n",
task);
return -EINVAL; return -EINVAL;
} }
...@@ -635,7 +639,8 @@ static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task) ...@@ -635,7 +639,8 @@ static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task)
(!(ipp->capabilities & DRM_EXYNOS_IPP_CAP_SCALE) && scale) || (!(ipp->capabilities & DRM_EXYNOS_IPP_CAP_SCALE) && scale) ||
(!(ipp->capabilities & DRM_EXYNOS_IPP_CAP_CONVERT) && (!(ipp->capabilities & DRM_EXYNOS_IPP_CAP_CONVERT) &&
src->buf.fourcc != dst->buf.fourcc)) { src->buf.fourcc != dst->buf.fourcc)) {
DRM_DEBUG_DRIVER("Task %pK: hw capabilities exceeded\n", task); DRM_DEV_DEBUG_DRIVER(task->dev, "Task %pK: hw capabilities exceeded\n",
task);
return -EINVAL; return -EINVAL;
} }
...@@ -647,7 +652,8 @@ static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task) ...@@ -647,7 +652,8 @@ static int exynos_drm_ipp_task_check(struct exynos_drm_ipp_task *task)
if (ret) if (ret)
return ret; return ret;
DRM_DEBUG_DRIVER("Task %pK: all checks done.\n", task); DRM_DEV_DEBUG_DRIVER(ipp->dev, "Task %pK: all checks done.\n",
task);
return ret; return ret;
} }
...@@ -658,20 +664,26 @@ static int exynos_drm_ipp_task_setup_buffers(struct exynos_drm_ipp_task *task, ...@@ -658,20 +664,26 @@ static int exynos_drm_ipp_task_setup_buffers(struct exynos_drm_ipp_task *task,
struct exynos_drm_ipp_buffer *src = &task->src, *dst = &task->dst; struct exynos_drm_ipp_buffer *src = &task->src, *dst = &task->dst;
int ret = 0; int ret = 0;
DRM_DEBUG_DRIVER("Setting buffer for task %pK\n", task); DRM_DEV_DEBUG_DRIVER(task->dev, "Setting buffer for task %pK\n",
task);
ret = exynos_drm_ipp_task_setup_buffer(src, filp); ret = exynos_drm_ipp_task_setup_buffer(src, filp);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("Task %pK: src buffer setup failed\n", task); DRM_DEV_DEBUG_DRIVER(task->dev,
"Task %pK: src buffer setup failed\n",
task);
return ret; return ret;
} }
ret = exynos_drm_ipp_task_setup_buffer(dst, filp); ret = exynos_drm_ipp_task_setup_buffer(dst, filp);
if (ret) { if (ret) {
DRM_DEBUG_DRIVER("Task %pK: dst buffer setup failed\n", task); DRM_DEV_DEBUG_DRIVER(task->dev,
"Task %pK: dst buffer setup failed\n",
task);
return ret; return ret;
} }
DRM_DEBUG_DRIVER("Task %pK: buffers prepared.\n", task); DRM_DEV_DEBUG_DRIVER(task->dev, "Task %pK: buffers prepared.\n",
task);
return ret; return ret;
} }
...@@ -691,7 +703,7 @@ static int exynos_drm_ipp_event_create(struct exynos_drm_ipp_task *task, ...@@ -691,7 +703,7 @@ static int exynos_drm_ipp_event_create(struct exynos_drm_ipp_task *task,
e->event.base.length = sizeof(e->event); e->event.base.length = sizeof(e->event);
e->event.user_data = user_data; e->event.user_data = user_data;
ret = drm_event_reserve_init(task->dev, file_priv, &e->base, ret = drm_event_reserve_init(task->ipp->drm_dev, file_priv, &e->base,
&e->event.base); &e->event.base);
if (ret) if (ret)
goto free; goto free;
...@@ -712,7 +724,7 @@ static void exynos_drm_ipp_event_send(struct exynos_drm_ipp_task *task) ...@@ -712,7 +724,7 @@ static void exynos_drm_ipp_event_send(struct exynos_drm_ipp_task *task)
task->event->event.tv_usec = now.tv_nsec / NSEC_PER_USEC; task->event->event.tv_usec = now.tv_nsec / NSEC_PER_USEC;
task->event->event.sequence = atomic_inc_return(&task->ipp->sequence); task->event->event.sequence = atomic_inc_return(&task->ipp->sequence);
drm_send_event(task->dev, &task->event->base); drm_send_event(task->ipp->drm_dev, &task->event->base);
} }
static int exynos_drm_ipp_task_cleanup(struct exynos_drm_ipp_task *task) static int exynos_drm_ipp_task_cleanup(struct exynos_drm_ipp_task *task)
...@@ -749,7 +761,8 @@ void exynos_drm_ipp_task_done(struct exynos_drm_ipp_task *task, int ret) ...@@ -749,7 +761,8 @@ void exynos_drm_ipp_task_done(struct exynos_drm_ipp_task *task, int ret)
struct exynos_drm_ipp *ipp = task->ipp; struct exynos_drm_ipp *ipp = task->ipp;
unsigned long flags; unsigned long flags;
DRM_DEBUG_DRIVER("ipp: %d, task %pK done: %d\n", ipp->id, task, ret); DRM_DEV_DEBUG_DRIVER(task->dev, "ipp: %d, task %pK done: %d\n",
ipp->id, task, ret);
spin_lock_irqsave(&ipp->lock, flags); spin_lock_irqsave(&ipp->lock, flags);
if (ipp->task == task) if (ipp->task == task)
...@@ -773,7 +786,8 @@ static void exynos_drm_ipp_next_task(struct exynos_drm_ipp *ipp) ...@@ -773,7 +786,8 @@ static void exynos_drm_ipp_next_task(struct exynos_drm_ipp *ipp)
unsigned long flags; unsigned long flags;
int ret; int ret;
DRM_DEBUG_DRIVER("ipp: %d, try to run new task\n", ipp->id); DRM_DEV_DEBUG_DRIVER(ipp->dev, "ipp: %d, try to run new task\n",
ipp->id);
spin_lock_irqsave(&ipp->lock, flags); spin_lock_irqsave(&ipp->lock, flags);
...@@ -789,7 +803,9 @@ static void exynos_drm_ipp_next_task(struct exynos_drm_ipp *ipp) ...@@ -789,7 +803,9 @@ static void exynos_drm_ipp_next_task(struct exynos_drm_ipp *ipp)
spin_unlock_irqrestore(&ipp->lock, flags); spin_unlock_irqrestore(&ipp->lock, flags);
DRM_DEBUG_DRIVER("ipp: %d, selected task %pK to run\n", ipp->id, task); DRM_DEV_DEBUG_DRIVER(ipp->dev,
"ipp: %d, selected task %pK to run\n", ipp->id,
task);
ret = ipp->funcs->commit(ipp, task); ret = ipp->funcs->commit(ipp, task);
if (ret) if (ret)
...@@ -897,15 +913,16 @@ int exynos_drm_ipp_commit_ioctl(struct drm_device *dev, void *data, ...@@ -897,15 +913,16 @@ int exynos_drm_ipp_commit_ioctl(struct drm_device *dev, void *data,
* then freed after exynos_drm_ipp_task_done() * then freed after exynos_drm_ipp_task_done()
*/ */
if (arg->flags & DRM_EXYNOS_IPP_FLAG_NONBLOCK) { if (arg->flags & DRM_EXYNOS_IPP_FLAG_NONBLOCK) {
DRM_DEBUG_DRIVER("ipp: %d, nonblocking processing task %pK\n", DRM_DEV_DEBUG_DRIVER(ipp->dev,
ipp->id, task); "ipp: %d, nonblocking processing task %pK\n",
ipp->id, task);
task->flags |= DRM_EXYNOS_IPP_TASK_ASYNC; task->flags |= DRM_EXYNOS_IPP_TASK_ASYNC;
exynos_drm_ipp_schedule_task(task->ipp, task); exynos_drm_ipp_schedule_task(task->ipp, task);
ret = 0; ret = 0;
} else { } else {
DRM_DEBUG_DRIVER("ipp: %d, processing task %pK\n", ipp->id, DRM_DEV_DEBUG_DRIVER(ipp->dev, "ipp: %d, processing task %pK\n",
task); ipp->id, task);
exynos_drm_ipp_schedule_task(ipp, task); exynos_drm_ipp_schedule_task(ipp, task);
ret = wait_event_interruptible(ipp->done_wq, ret = wait_event_interruptible(ipp->done_wq,
task->flags & DRM_EXYNOS_IPP_TASK_DONE); task->flags & DRM_EXYNOS_IPP_TASK_DONE);
......
...@@ -54,7 +54,8 @@ struct exynos_drm_ipp_funcs { ...@@ -54,7 +54,8 @@ struct exynos_drm_ipp_funcs {
* struct exynos_drm_ipp - central picture processor module structure * struct exynos_drm_ipp - central picture processor module structure
*/ */
struct exynos_drm_ipp { struct exynos_drm_ipp {
struct drm_device *dev; struct drm_device *drm_dev;
struct device *dev;
struct list_head head; struct list_head head;
unsigned int id; unsigned int id;
...@@ -85,7 +86,7 @@ struct exynos_drm_ipp_buffer { ...@@ -85,7 +86,7 @@ struct exynos_drm_ipp_buffer {
* has to be performed by the picture processor hardware module * has to be performed by the picture processor hardware module
*/ */
struct exynos_drm_ipp_task { struct exynos_drm_ipp_task {
struct drm_device *dev; struct device *dev;
struct exynos_drm_ipp *ipp; struct exynos_drm_ipp *ipp;
struct list_head head; struct list_head head;
...@@ -129,11 +130,11 @@ struct exynos_drm_ipp_formats { ...@@ -129,11 +130,11 @@ struct exynos_drm_ipp_formats {
#define IPP_SCALE_LIMIT(val...) \ #define IPP_SCALE_LIMIT(val...) \
.type = (DRM_EXYNOS_IPP_LIMIT_TYPE_SCALE), val .type = (DRM_EXYNOS_IPP_LIMIT_TYPE_SCALE), val
int exynos_drm_ipp_register(struct drm_device *dev, struct exynos_drm_ipp *ipp, int exynos_drm_ipp_register(struct device *dev, struct exynos_drm_ipp *ipp,
const struct exynos_drm_ipp_funcs *funcs, unsigned int caps, const struct exynos_drm_ipp_funcs *funcs, unsigned int caps,
const struct exynos_drm_ipp_formats *formats, const struct exynos_drm_ipp_formats *formats,
unsigned int num_formats, const char *name); unsigned int num_formats, const char *name);
void exynos_drm_ipp_unregister(struct drm_device *dev, void exynos_drm_ipp_unregister(struct device *dev,
struct exynos_drm_ipp *ipp); struct exynos_drm_ipp *ipp);
void exynos_drm_ipp_task_done(struct exynos_drm_ipp_task *task, int ret); void exynos_drm_ipp_task_done(struct exynos_drm_ipp_task *task, int ret);
......
...@@ -113,7 +113,8 @@ static void mic_set_path(struct exynos_mic *mic, bool enable) ...@@ -113,7 +113,8 @@ static void mic_set_path(struct exynos_mic *mic, bool enable)
ret = regmap_read(mic->sysreg, DSD_CFG_MUX, &val); ret = regmap_read(mic->sysreg, DSD_CFG_MUX, &val);
if (ret) { if (ret) {
DRM_ERROR("mic: Failed to read system register\n"); DRM_DEV_ERROR(mic->dev,
"mic: Failed to read system register\n");
return; return;
} }
...@@ -129,7 +130,8 @@ static void mic_set_path(struct exynos_mic *mic, bool enable) ...@@ -129,7 +130,8 @@ static void mic_set_path(struct exynos_mic *mic, bool enable)
ret = regmap_write(mic->sysreg, DSD_CFG_MUX, val); ret = regmap_write(mic->sysreg, DSD_CFG_MUX, val);
if (ret) if (ret)
DRM_ERROR("mic: Failed to read system register\n"); DRM_DEV_ERROR(mic->dev,
"mic: Failed to read system register\n");
} }
static int mic_sw_reset(struct exynos_mic *mic) static int mic_sw_reset(struct exynos_mic *mic)
...@@ -190,7 +192,7 @@ static void mic_set_output_timing(struct exynos_mic *mic) ...@@ -190,7 +192,7 @@ static void mic_set_output_timing(struct exynos_mic *mic)
struct videomode vm = mic->vm; struct videomode vm = mic->vm;
u32 reg, bs_size_2d; u32 reg, bs_size_2d;
DRM_DEBUG("w: %u, h: %u\n", vm.hactive, vm.vactive); DRM_DEV_DEBUG(mic->dev, "w: %u, h: %u\n", vm.hactive, vm.vactive);
bs_size_2d = ((vm.hactive >> 2) << 1) + (vm.vactive % 4); bs_size_2d = ((vm.hactive >> 2) << 1) + (vm.vactive % 4);
reg = MIC_BS_SIZE_2D(bs_size_2d); reg = MIC_BS_SIZE_2D(bs_size_2d);
writel(reg, mic->reg + MIC_2D_OUTPUT_TIMING_2); writel(reg, mic->reg + MIC_2D_OUTPUT_TIMING_2);
...@@ -274,7 +276,7 @@ static void mic_pre_enable(struct drm_bridge *bridge) ...@@ -274,7 +276,7 @@ static void mic_pre_enable(struct drm_bridge *bridge)
ret = mic_sw_reset(mic); ret = mic_sw_reset(mic);
if (ret) { if (ret) {
DRM_ERROR("Failed to reset\n"); DRM_DEV_ERROR(mic->dev, "Failed to reset\n");
goto turn_off; goto turn_off;
} }
...@@ -354,8 +356,8 @@ static int exynos_mic_resume(struct device *dev) ...@@ -354,8 +356,8 @@ static int exynos_mic_resume(struct device *dev)
for (i = 0; i < NUM_CLKS; i++) { for (i = 0; i < NUM_CLKS; i++) {
ret = clk_prepare_enable(mic->clks[i]); ret = clk_prepare_enable(mic->clks[i]);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to enable clock (%s)\n", DRM_DEV_ERROR(dev, "Failed to enable clock (%s)\n",
clk_names[i]); clk_names[i]);
while (--i > -1) while (--i > -1)
clk_disable_unprepare(mic->clks[i]); clk_disable_unprepare(mic->clks[i]);
return ret; return ret;
...@@ -380,7 +382,8 @@ static int exynos_mic_probe(struct platform_device *pdev) ...@@ -380,7 +382,8 @@ static int exynos_mic_probe(struct platform_device *pdev)
mic = devm_kzalloc(dev, sizeof(*mic), GFP_KERNEL); mic = devm_kzalloc(dev, sizeof(*mic), GFP_KERNEL);
if (!mic) { if (!mic) {
DRM_ERROR("mic: Failed to allocate memory for MIC object\n"); DRM_DEV_ERROR(dev,
"mic: Failed to allocate memory for MIC object\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
} }
...@@ -389,12 +392,12 @@ static int exynos_mic_probe(struct platform_device *pdev) ...@@ -389,12 +392,12 @@ static int exynos_mic_probe(struct platform_device *pdev)
ret = of_address_to_resource(dev->of_node, 0, &res); ret = of_address_to_resource(dev->of_node, 0, &res);
if (ret) { if (ret) {
DRM_ERROR("mic: Failed to get mem region for MIC\n"); DRM_DEV_ERROR(dev, "mic: Failed to get mem region for MIC\n");
goto err; goto err;
} }
mic->reg = devm_ioremap(dev, res.start, resource_size(&res)); mic->reg = devm_ioremap(dev, res.start, resource_size(&res));
if (!mic->reg) { if (!mic->reg) {
DRM_ERROR("mic: Failed to remap for MIC\n"); DRM_DEV_ERROR(dev, "mic: Failed to remap for MIC\n");
ret = -ENOMEM; ret = -ENOMEM;
goto err; goto err;
} }
...@@ -402,7 +405,7 @@ static int exynos_mic_probe(struct platform_device *pdev) ...@@ -402,7 +405,7 @@ static int exynos_mic_probe(struct platform_device *pdev)
mic->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, mic->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node,
"samsung,disp-syscon"); "samsung,disp-syscon");
if (IS_ERR(mic->sysreg)) { if (IS_ERR(mic->sysreg)) {
DRM_ERROR("mic: Failed to get system register.\n"); DRM_DEV_ERROR(dev, "mic: Failed to get system register.\n");
ret = PTR_ERR(mic->sysreg); ret = PTR_ERR(mic->sysreg);
goto err; goto err;
} }
...@@ -410,8 +413,8 @@ static int exynos_mic_probe(struct platform_device *pdev) ...@@ -410,8 +413,8 @@ static int exynos_mic_probe(struct platform_device *pdev)
for (i = 0; i < NUM_CLKS; i++) { for (i = 0; i < NUM_CLKS; i++) {
mic->clks[i] = devm_clk_get(dev, clk_names[i]); mic->clks[i] = devm_clk_get(dev, clk_names[i]);
if (IS_ERR(mic->clks[i])) { if (IS_ERR(mic->clks[i])) {
DRM_ERROR("mic: Failed to get clock (%s)\n", DRM_DEV_ERROR(dev, "mic: Failed to get clock (%s)\n",
clk_names[i]); clk_names[i]);
ret = PTR_ERR(mic->clks[i]); ret = PTR_ERR(mic->clks[i]);
goto err; goto err;
} }
...@@ -430,7 +433,7 @@ static int exynos_mic_probe(struct platform_device *pdev) ...@@ -430,7 +433,7 @@ static int exynos_mic_probe(struct platform_device *pdev)
if (ret) if (ret)
goto err_pm; goto err_pm;
DRM_DEBUG_KMS("MIC has been probed\n"); DRM_DEV_DEBUG_KMS(dev, "MIC has been probed\n");
return 0; return 0;
......
...@@ -119,9 +119,10 @@ static void exynos_plane_mode_set(struct exynos_drm_plane_state *exynos_state) ...@@ -119,9 +119,10 @@ static void exynos_plane_mode_set(struct exynos_drm_plane_state *exynos_state)
exynos_state->crtc.w = actual_w; exynos_state->crtc.w = actual_w;
exynos_state->crtc.h = actual_h; exynos_state->crtc.h = actual_h;
DRM_DEBUG_KMS("plane : offset_x/y(%d,%d), width/height(%d,%d)", DRM_DEV_DEBUG_KMS(crtc->dev->dev,
exynos_state->crtc.x, exynos_state->crtc.y, "plane : offset_x/y(%d,%d), width/height(%d,%d)",
exynos_state->crtc.w, exynos_state->crtc.h); exynos_state->crtc.x, exynos_state->crtc.y,
exynos_state->crtc.w, exynos_state->crtc.h);
} }
static void exynos_drm_plane_reset(struct drm_plane *plane) static void exynos_drm_plane_reset(struct drm_plane *plane)
...@@ -181,6 +182,7 @@ exynos_drm_plane_check_format(const struct exynos_drm_plane_config *config, ...@@ -181,6 +182,7 @@ exynos_drm_plane_check_format(const struct exynos_drm_plane_config *config,
struct exynos_drm_plane_state *state) struct exynos_drm_plane_state *state)
{ {
struct drm_framebuffer *fb = state->base.fb; struct drm_framebuffer *fb = state->base.fb;
struct drm_device *dev = fb->dev;
switch (fb->modifier) { switch (fb->modifier) {
case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE: case DRM_FORMAT_MOD_SAMSUNG_64_32_TILE:
...@@ -192,7 +194,7 @@ exynos_drm_plane_check_format(const struct exynos_drm_plane_config *config, ...@@ -192,7 +194,7 @@ exynos_drm_plane_check_format(const struct exynos_drm_plane_config *config,
break; break;
default: default:
DRM_ERROR("unsupported pixel format modifier"); DRM_DEV_ERROR(dev->dev, "unsupported pixel format modifier");
return -ENOTSUPP; return -ENOTSUPP;
} }
...@@ -203,6 +205,7 @@ static int ...@@ -203,6 +205,7 @@ static int
exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config, exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config,
struct exynos_drm_plane_state *state) struct exynos_drm_plane_state *state)
{ {
struct drm_crtc *crtc = state->base.crtc;
bool width_ok = false, height_ok = false; bool width_ok = false, height_ok = false;
if (config->capabilities & EXYNOS_DRM_PLANE_CAP_SCALE) if (config->capabilities & EXYNOS_DRM_PLANE_CAP_SCALE)
...@@ -225,7 +228,7 @@ exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config, ...@@ -225,7 +228,7 @@ exynos_drm_plane_check_size(const struct exynos_drm_plane_config *config,
if (width_ok && height_ok) if (width_ok && height_ok)
return 0; return 0;
DRM_DEBUG_KMS("scaling mode is not supported"); DRM_DEV_DEBUG_KMS(crtc->dev->dev, "scaling mode is not supported");
return -ENOTSUPP; return -ENOTSUPP;
} }
...@@ -310,7 +313,7 @@ int exynos_plane_init(struct drm_device *dev, ...@@ -310,7 +313,7 @@ int exynos_plane_init(struct drm_device *dev,
config->num_pixel_formats, config->num_pixel_formats,
NULL, config->type, NULL); NULL, config->type, NULL);
if (err) { if (err) {
DRM_ERROR("failed to initialize plane\n"); DRM_DEV_ERROR(dev->dev, "failed to initialize plane\n");
return err; return err;
} }
......
...@@ -243,9 +243,10 @@ static int rotator_bind(struct device *dev, struct device *master, void *data) ...@@ -243,9 +243,10 @@ static int rotator_bind(struct device *dev, struct device *master, void *data)
struct exynos_drm_ipp *ipp = &rot->ipp; struct exynos_drm_ipp *ipp = &rot->ipp;
rot->drm_dev = drm_dev; rot->drm_dev = drm_dev;
ipp->drm_dev = drm_dev;
exynos_drm_register_dma(drm_dev, dev); exynos_drm_register_dma(drm_dev, dev);
exynos_drm_ipp_register(drm_dev, ipp, &ipp_funcs, exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE, DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE,
rot->formats, rot->num_formats, "rotator"); rot->formats, rot->num_formats, "rotator");
...@@ -258,10 +259,9 @@ static void rotator_unbind(struct device *dev, struct device *master, ...@@ -258,10 +259,9 @@ static void rotator_unbind(struct device *dev, struct device *master,
void *data) void *data)
{ {
struct rot_context *rot = dev_get_drvdata(dev); struct rot_context *rot = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
struct exynos_drm_ipp *ipp = &rot->ipp; struct exynos_drm_ipp *ipp = &rot->ipp;
exynos_drm_ipp_unregister(drm_dev, ipp); exynos_drm_ipp_unregister(dev, ipp);
exynos_drm_unregister_dma(rot->drm_dev, rot->dev); exynos_drm_unregister_dma(rot->drm_dev, rot->dev);
} }
......
...@@ -451,9 +451,10 @@ static int scaler_bind(struct device *dev, struct device *master, void *data) ...@@ -451,9 +451,10 @@ static int scaler_bind(struct device *dev, struct device *master, void *data)
struct exynos_drm_ipp *ipp = &scaler->ipp; struct exynos_drm_ipp *ipp = &scaler->ipp;
scaler->drm_dev = drm_dev; scaler->drm_dev = drm_dev;
ipp->drm_dev = drm_dev;
exynos_drm_register_dma(drm_dev, dev); exynos_drm_register_dma(drm_dev, dev);
exynos_drm_ipp_register(drm_dev, ipp, &ipp_funcs, exynos_drm_ipp_register(dev, ipp, &ipp_funcs,
DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE | DRM_EXYNOS_IPP_CAP_CROP | DRM_EXYNOS_IPP_CAP_ROTATE |
DRM_EXYNOS_IPP_CAP_SCALE | DRM_EXYNOS_IPP_CAP_CONVERT, DRM_EXYNOS_IPP_CAP_SCALE | DRM_EXYNOS_IPP_CAP_CONVERT,
scaler->scaler_data->formats, scaler->scaler_data->formats,
...@@ -468,10 +469,9 @@ static void scaler_unbind(struct device *dev, struct device *master, ...@@ -468,10 +469,9 @@ static void scaler_unbind(struct device *dev, struct device *master,
void *data) void *data)
{ {
struct scaler_context *scaler = dev_get_drvdata(dev); struct scaler_context *scaler = dev_get_drvdata(dev);
struct drm_device *drm_dev = data;
struct exynos_drm_ipp *ipp = &scaler->ipp; struct exynos_drm_ipp *ipp = &scaler->ipp;
exynos_drm_ipp_unregister(drm_dev, ipp); exynos_drm_ipp_unregister(dev, ipp);
exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev); exynos_drm_unregister_dma(scaler->drm_dev, scaler->dev);
} }
......
...@@ -40,8 +40,8 @@ ...@@ -40,8 +40,8 @@
struct vidi_context { struct vidi_context {
struct drm_encoder encoder; struct drm_encoder encoder;
struct platform_device *pdev;
struct drm_device *drm_dev; struct drm_device *drm_dev;
struct device *dev;
struct exynos_drm_crtc *crtc; struct exynos_drm_crtc *crtc;
struct drm_connector connector; struct drm_connector connector;
struct exynos_drm_plane planes[WINDOWS_NR]; struct exynos_drm_plane planes[WINDOWS_NR];
...@@ -123,7 +123,7 @@ static void vidi_update_plane(struct exynos_drm_crtc *crtc, ...@@ -123,7 +123,7 @@ static void vidi_update_plane(struct exynos_drm_crtc *crtc,
return; return;
addr = exynos_drm_fb_dma_addr(state->fb, 0); addr = exynos_drm_fb_dma_addr(state->fb, 0);
DRM_DEBUG_KMS("dma_addr = %pad\n", &addr); DRM_DEV_DEBUG_KMS(ctx->dev, "dma_addr = %pad\n", &addr);
} }
static void vidi_enable(struct exynos_drm_crtc *crtc) static void vidi_enable(struct exynos_drm_crtc *crtc)
...@@ -205,11 +205,11 @@ static ssize_t vidi_store_connection(struct device *dev, ...@@ -205,11 +205,11 @@ static ssize_t vidi_store_connection(struct device *dev,
/* if raw_edid isn't same as fake data then it can't be tested. */ /* if raw_edid isn't same as fake data then it can't be tested. */
if (ctx->raw_edid != (struct edid *)fake_edid_info) { if (ctx->raw_edid != (struct edid *)fake_edid_info) {
DRM_DEBUG_KMS("edid data is not fake data.\n"); DRM_DEV_DEBUG_KMS(dev, "edid data is not fake data.\n");
return -EINVAL; return -EINVAL;
} }
DRM_DEBUG_KMS("requested connection.\n"); DRM_DEV_DEBUG_KMS(dev, "requested connection.\n");
drm_helper_hpd_irq_event(ctx->drm_dev); drm_helper_hpd_irq_event(ctx->drm_dev);
...@@ -226,17 +226,20 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, ...@@ -226,17 +226,20 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
struct drm_exynos_vidi_connection *vidi = data; struct drm_exynos_vidi_connection *vidi = data;
if (!vidi) { if (!vidi) {
DRM_DEBUG_KMS("user data for vidi is null.\n"); DRM_DEV_DEBUG_KMS(ctx->dev,
"user data for vidi is null.\n");
return -EINVAL; return -EINVAL;
} }
if (vidi->connection > 1) { if (vidi->connection > 1) {
DRM_DEBUG_KMS("connection should be 0 or 1.\n"); DRM_DEV_DEBUG_KMS(ctx->dev,
"connection should be 0 or 1.\n");
return -EINVAL; return -EINVAL;
} }
if (ctx->connected == vidi->connection) { if (ctx->connected == vidi->connection) {
DRM_DEBUG_KMS("same connection request.\n"); DRM_DEV_DEBUG_KMS(ctx->dev,
"same connection request.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -245,12 +248,14 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data, ...@@ -245,12 +248,14 @@ int vidi_connection_ioctl(struct drm_device *drm_dev, void *data,
raw_edid = (struct edid *)(unsigned long)vidi->edid; raw_edid = (struct edid *)(unsigned long)vidi->edid;
if (!drm_edid_is_valid(raw_edid)) { if (!drm_edid_is_valid(raw_edid)) {
DRM_DEBUG_KMS("edid data is invalid.\n"); DRM_DEV_DEBUG_KMS(ctx->dev,
"edid data is invalid.\n");
return -EINVAL; return -EINVAL;
} }
ctx->raw_edid = drm_edid_duplicate(raw_edid); ctx->raw_edid = drm_edid_duplicate(raw_edid);
if (!ctx->raw_edid) { if (!ctx->raw_edid) {
DRM_DEBUG_KMS("failed to allocate raw_edid.\n"); DRM_DEV_DEBUG_KMS(ctx->dev,
"failed to allocate raw_edid.\n");
return -ENOMEM; return -ENOMEM;
} }
} else { } else {
...@@ -308,14 +313,14 @@ static int vidi_get_modes(struct drm_connector *connector) ...@@ -308,14 +313,14 @@ static int vidi_get_modes(struct drm_connector *connector)
* to ctx->raw_edid through specific ioctl. * to ctx->raw_edid through specific ioctl.
*/ */
if (!ctx->raw_edid) { if (!ctx->raw_edid) {
DRM_DEBUG_KMS("raw_edid is null.\n"); DRM_DEV_DEBUG_KMS(ctx->dev, "raw_edid is null.\n");
return -EFAULT; return -EFAULT;
} }
edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH; edid_len = (1 + ctx->raw_edid->extensions) * EDID_LENGTH;
edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL); edid = kmemdup(ctx->raw_edid, edid_len, GFP_KERNEL);
if (!edid) { if (!edid) {
DRM_DEBUG_KMS("failed to allocate edid\n"); DRM_DEV_DEBUG_KMS(ctx->dev, "failed to allocate edid\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -339,7 +344,8 @@ static int vidi_create_connector(struct drm_encoder *encoder) ...@@ -339,7 +344,8 @@ static int vidi_create_connector(struct drm_encoder *encoder)
ret = drm_connector_init(ctx->drm_dev, connector, ret = drm_connector_init(ctx->drm_dev, connector,
&vidi_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL); &vidi_connector_funcs, DRM_MODE_CONNECTOR_VIRTUAL);
if (ret) { if (ret) {
DRM_ERROR("Failed to initialize connector with drm\n"); DRM_DEV_ERROR(ctx->dev,
"Failed to initialize connector with drm\n");
return ret; return ret;
} }
...@@ -402,7 +408,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data) ...@@ -402,7 +408,7 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
ctx->crtc = exynos_drm_crtc_create(drm_dev, &exynos_plane->base, ctx->crtc = exynos_drm_crtc_create(drm_dev, &exynos_plane->base,
EXYNOS_DISPLAY_TYPE_VIDI, &vidi_crtc_ops, ctx); EXYNOS_DISPLAY_TYPE_VIDI, &vidi_crtc_ops, ctx);
if (IS_ERR(ctx->crtc)) { if (IS_ERR(ctx->crtc)) {
DRM_ERROR("failed to create crtc.\n"); DRM_DEV_ERROR(dev, "failed to create crtc.\n");
return PTR_ERR(ctx->crtc); return PTR_ERR(ctx->crtc);
} }
...@@ -417,7 +423,8 @@ static int vidi_bind(struct device *dev, struct device *master, void *data) ...@@ -417,7 +423,8 @@ static int vidi_bind(struct device *dev, struct device *master, void *data)
ret = vidi_create_connector(encoder); ret = vidi_create_connector(encoder);
if (ret) { if (ret) {
DRM_ERROR("failed to create connector ret = %d\n", ret); DRM_DEV_ERROR(dev, "failed to create connector ret = %d\n",
ret);
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
return ret; return ret;
} }
...@@ -441,13 +448,14 @@ static const struct component_ops vidi_component_ops = { ...@@ -441,13 +448,14 @@ static const struct component_ops vidi_component_ops = {
static int vidi_probe(struct platform_device *pdev) static int vidi_probe(struct platform_device *pdev)
{ {
struct vidi_context *ctx; struct vidi_context *ctx;
struct device *dev = &pdev->dev;
int ret; int ret;
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
ctx->pdev = pdev; ctx->dev = dev;
timer_setup(&ctx->timer, vidi_fake_vblank_timer, 0); timer_setup(&ctx->timer, vidi_fake_vblank_timer, 0);
...@@ -455,20 +463,21 @@ static int vidi_probe(struct platform_device *pdev) ...@@ -455,20 +463,21 @@ static int vidi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, ctx); platform_set_drvdata(pdev, ctx);
ret = device_create_file(&pdev->dev, &dev_attr_connection); ret = device_create_file(dev, &dev_attr_connection);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to create connection sysfs.\n"); DRM_DEV_ERROR(dev,
"failed to create connection sysfs.\n");
return ret; return ret;
} }
ret = component_add(&pdev->dev, &vidi_component_ops); ret = component_add(dev, &vidi_component_ops);
if (ret) if (ret)
goto err_remove_file; goto err_remove_file;
return ret; return ret;
err_remove_file: err_remove_file:
device_remove_file(&pdev->dev, &dev_attr_connection); device_remove_file(dev, &dev_attr_connection);
return ret; return ret;
} }
......
...@@ -885,9 +885,9 @@ static int hdmi_get_modes(struct drm_connector *connector) ...@@ -885,9 +885,9 @@ static int hdmi_get_modes(struct drm_connector *connector)
return -ENODEV; return -ENODEV;
hdata->dvi_mode = !drm_detect_hdmi_monitor(edid); hdata->dvi_mode = !drm_detect_hdmi_monitor(edid);
DRM_DEBUG_KMS("%s : width[%d] x height[%d]\n", DRM_DEV_DEBUG_KMS(hdata->dev, "%s : width[%d] x height[%d]\n",
(hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"), (hdata->dvi_mode ? "dvi monitor" : "hdmi monitor"),
edid->width_cm, edid->height_cm); edid->width_cm, edid->height_cm);
drm_connector_update_edid_property(connector, edid); drm_connector_update_edid_property(connector, edid);
cec_notifier_set_phys_addr_from_edid(hdata->notifier, edid); cec_notifier_set_phys_addr_from_edid(hdata->notifier, edid);
...@@ -908,7 +908,8 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock) ...@@ -908,7 +908,8 @@ static int hdmi_find_phy_conf(struct hdmi_context *hdata, u32 pixel_clock)
if (confs->data[i].pixel_clock == pixel_clock) if (confs->data[i].pixel_clock == pixel_clock)
return i; return i;
DRM_DEBUG_KMS("Could not find phy config for %d\n", pixel_clock); DRM_DEV_DEBUG_KMS(hdata->dev, "Could not find phy config for %d\n",
pixel_clock);
return -EINVAL; return -EINVAL;
} }
...@@ -918,10 +919,11 @@ static int hdmi_mode_valid(struct drm_connector *connector, ...@@ -918,10 +919,11 @@ static int hdmi_mode_valid(struct drm_connector *connector,
struct hdmi_context *hdata = connector_to_hdmi(connector); struct hdmi_context *hdata = connector_to_hdmi(connector);
int ret; int ret;
DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n", DRM_DEV_DEBUG_KMS(hdata->dev,
mode->hdisplay, mode->vdisplay, mode->vrefresh, "xres=%d, yres=%d, refresh=%d, intl=%d clock=%d\n",
(mode->flags & DRM_MODE_FLAG_INTERLACE) ? true : mode->hdisplay, mode->vdisplay, mode->vrefresh,
false, mode->clock * 1000); (mode->flags & DRM_MODE_FLAG_INTERLACE) ? true :
false, mode->clock * 1000);
ret = hdmi_find_phy_conf(hdata, mode->clock * 1000); ret = hdmi_find_phy_conf(hdata, mode->clock * 1000);
if (ret < 0) if (ret < 0)
...@@ -947,7 +949,8 @@ static int hdmi_create_connector(struct drm_encoder *encoder) ...@@ -947,7 +949,8 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
ret = drm_connector_init(hdata->drm_dev, connector, ret = drm_connector_init(hdata->drm_dev, connector,
&hdmi_connector_funcs, DRM_MODE_CONNECTOR_HDMIA); &hdmi_connector_funcs, DRM_MODE_CONNECTOR_HDMIA);
if (ret) { if (ret) {
DRM_ERROR("Failed to initialize connector with drm\n"); DRM_DEV_ERROR(hdata->dev,
"Failed to initialize connector with drm\n");
return ret; return ret;
} }
...@@ -957,7 +960,7 @@ static int hdmi_create_connector(struct drm_encoder *encoder) ...@@ -957,7 +960,7 @@ static int hdmi_create_connector(struct drm_encoder *encoder)
if (hdata->bridge) { if (hdata->bridge) {
ret = drm_bridge_attach(encoder, hdata->bridge, NULL); ret = drm_bridge_attach(encoder, hdata->bridge, NULL);
if (ret) if (ret)
DRM_ERROR("Failed to attach bridge\n"); DRM_DEV_ERROR(hdata->dev, "Failed to attach bridge\n");
} }
return ret; return ret;
...@@ -1002,8 +1005,10 @@ static bool hdmi_mode_fixup(struct drm_encoder *encoder, ...@@ -1002,8 +1005,10 @@ static bool hdmi_mode_fixup(struct drm_encoder *encoder,
DRM_INFO("desired mode doesn't exist so\n"); DRM_INFO("desired mode doesn't exist so\n");
DRM_INFO("use the most suitable mode among modes.\n"); DRM_INFO("use the most suitable mode among modes.\n");
DRM_DEBUG_KMS("Adjusted Mode: [%d]x[%d] [%d]Hz\n", DRM_DEV_DEBUG_KMS(dev->dev,
m->hdisplay, m->vdisplay, m->vrefresh); "Adjusted Mode: [%d]x[%d] [%d]Hz\n",
m->hdisplay, m->vdisplay,
m->vrefresh);
drm_mode_copy(adjusted_mode, m); drm_mode_copy(adjusted_mode, m);
break; break;
...@@ -1169,13 +1174,15 @@ static void hdmiphy_wait_for_pll(struct hdmi_context *hdata) ...@@ -1169,13 +1174,15 @@ static void hdmiphy_wait_for_pll(struct hdmi_context *hdata)
u32 val = hdmi_reg_read(hdata, HDMI_PHY_STATUS); u32 val = hdmi_reg_read(hdata, HDMI_PHY_STATUS);
if (val & HDMI_PHY_STATUS_READY) { if (val & HDMI_PHY_STATUS_READY) {
DRM_DEBUG_KMS("PLL stabilized after %d tries\n", tries); DRM_DEV_DEBUG_KMS(hdata->dev,
"PLL stabilized after %d tries\n",
tries);
return; return;
} }
usleep_range(10, 20); usleep_range(10, 20);
} }
DRM_ERROR("PLL could not reach steady state\n"); DRM_DEV_ERROR(hdata->dev, "PLL could not reach steady state\n");
} }
static void hdmi_v13_mode_apply(struct hdmi_context *hdata) static void hdmi_v13_mode_apply(struct hdmi_context *hdata)
...@@ -1411,7 +1418,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata) ...@@ -1411,7 +1418,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata)
ret = hdmi_find_phy_conf(hdata, m->clock * 1000); ret = hdmi_find_phy_conf(hdata, m->clock * 1000);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("failed to find hdmiphy conf\n"); DRM_DEV_ERROR(hdata->dev, "failed to find hdmiphy conf\n");
return; return;
} }
phy_conf = hdata->drv_data->phy_confs.data[ret].conf; phy_conf = hdata->drv_data->phy_confs.data[ret].conf;
...@@ -1423,7 +1430,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata) ...@@ -1423,7 +1430,7 @@ static void hdmiphy_conf_apply(struct hdmi_context *hdata)
hdmiphy_enable_mode_set(hdata, true); hdmiphy_enable_mode_set(hdata, true);
ret = hdmiphy_reg_write_buf(hdata, 0, phy_conf, 32); ret = hdmiphy_reg_write_buf(hdata, 0, phy_conf, 32);
if (ret) { if (ret) {
DRM_ERROR("failed to configure hdmiphy\n"); DRM_DEV_ERROR(hdata->dev, "failed to configure hdmiphy\n");
return; return;
} }
hdmiphy_enable_mode_set(hdata, false); hdmiphy_enable_mode_set(hdata, false);
...@@ -1460,7 +1467,8 @@ static void hdmiphy_enable(struct hdmi_context *hdata) ...@@ -1460,7 +1467,8 @@ static void hdmiphy_enable(struct hdmi_context *hdata)
pm_runtime_get_sync(hdata->dev); pm_runtime_get_sync(hdata->dev);
if (regulator_bulk_enable(ARRAY_SIZE(supply), hdata->regul_bulk)) if (regulator_bulk_enable(ARRAY_SIZE(supply), hdata->regul_bulk))
DRM_DEBUG_KMS("failed to enable regulator bulk\n"); DRM_DEV_DEBUG_KMS(hdata->dev,
"failed to enable regulator bulk\n");
regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL, regmap_update_bits(hdata->pmureg, PMU_HDMI_PHY_CONTROL,
PMU_HDMI_PHY_ENABLE_BIT, 1); PMU_HDMI_PHY_ENABLE_BIT, 1);
...@@ -1734,7 +1742,7 @@ static int hdmi_bridge_init(struct hdmi_context *hdata) ...@@ -1734,7 +1742,7 @@ static int hdmi_bridge_init(struct hdmi_context *hdata)
np = of_graph_get_remote_port_parent(ep); np = of_graph_get_remote_port_parent(ep);
of_node_put(ep); of_node_put(ep);
if (!np) { if (!np) {
DRM_ERROR("failed to get remote port parent"); DRM_DEV_ERROR(dev, "failed to get remote port parent");
return -EINVAL; return -EINVAL;
} }
...@@ -1752,17 +1760,17 @@ static int hdmi_resources_init(struct hdmi_context *hdata) ...@@ -1752,17 +1760,17 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
struct device *dev = hdata->dev; struct device *dev = hdata->dev;
int i, ret; int i, ret;
DRM_DEBUG_KMS("HDMI resource init\n"); DRM_DEV_DEBUG_KMS(dev, "HDMI resource init\n");
hdata->hpd_gpio = devm_gpiod_get(dev, "hpd", GPIOD_IN); hdata->hpd_gpio = devm_gpiod_get(dev, "hpd", GPIOD_IN);
if (IS_ERR(hdata->hpd_gpio)) { if (IS_ERR(hdata->hpd_gpio)) {
DRM_ERROR("cannot get hpd gpio property\n"); DRM_DEV_ERROR(dev, "cannot get hpd gpio property\n");
return PTR_ERR(hdata->hpd_gpio); return PTR_ERR(hdata->hpd_gpio);
} }
hdata->irq = gpiod_to_irq(hdata->hpd_gpio); hdata->irq = gpiod_to_irq(hdata->hpd_gpio);
if (hdata->irq < 0) { if (hdata->irq < 0) {
DRM_ERROR("failed to get GPIO irq\n"); DRM_DEV_ERROR(dev, "failed to get GPIO irq\n");
return hdata->irq; return hdata->irq;
} }
...@@ -1780,7 +1788,7 @@ static int hdmi_resources_init(struct hdmi_context *hdata) ...@@ -1780,7 +1788,7 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), hdata->regul_bulk); ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(supply), hdata->regul_bulk);
if (ret) { if (ret) {
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
DRM_ERROR("failed to get regulators\n"); DRM_DEV_ERROR(dev, "failed to get regulators\n");
return ret; return ret;
} }
...@@ -1792,7 +1800,8 @@ static int hdmi_resources_init(struct hdmi_context *hdata) ...@@ -1792,7 +1800,8 @@ static int hdmi_resources_init(struct hdmi_context *hdata)
ret = regulator_enable(hdata->reg_hdmi_en); ret = regulator_enable(hdata->reg_hdmi_en);
if (ret) { if (ret) {
DRM_ERROR("failed to enable hdmi-en regulator\n"); DRM_DEV_ERROR(dev,
"failed to enable hdmi-en regulator\n");
return ret; return ret;
} }
} }
...@@ -1845,7 +1854,8 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data) ...@@ -1845,7 +1854,8 @@ static int hdmi_bind(struct device *dev, struct device *master, void *data)
ret = hdmi_create_connector(encoder); ret = hdmi_create_connector(encoder);
if (ret) { if (ret) {
DRM_ERROR("failed to create connector ret = %d\n", ret); DRM_DEV_ERROR(dev, "failed to create connector ret = %d\n",
ret);
drm_encoder_cleanup(encoder); drm_encoder_cleanup(encoder);
return ret; return ret;
} }
...@@ -1875,7 +1885,8 @@ static int hdmi_get_ddc_adapter(struct hdmi_context *hdata) ...@@ -1875,7 +1885,8 @@ static int hdmi_get_ddc_adapter(struct hdmi_context *hdata)
np = of_parse_phandle(hdata->dev->of_node, "ddc", 0); np = of_parse_phandle(hdata->dev->of_node, "ddc", 0);
if (!np) { if (!np) {
DRM_ERROR("Failed to find ddc node in device tree\n"); DRM_DEV_ERROR(hdata->dev,
"Failed to find ddc node in device tree\n");
return -ENODEV; return -ENODEV;
} }
...@@ -1902,7 +1913,8 @@ static int hdmi_get_phy_io(struct hdmi_context *hdata) ...@@ -1902,7 +1913,8 @@ static int hdmi_get_phy_io(struct hdmi_context *hdata)
if (!np) { if (!np) {
np = of_parse_phandle(hdata->dev->of_node, "phy", 0); np = of_parse_phandle(hdata->dev->of_node, "phy", 0);
if (!np) { if (!np) {
DRM_ERROR("Failed to find hdmiphy node in device tree\n"); DRM_DEV_ERROR(hdata->dev,
"Failed to find hdmiphy node in device tree\n");
return -ENODEV; return -ENODEV;
} }
} }
...@@ -1910,7 +1922,8 @@ static int hdmi_get_phy_io(struct hdmi_context *hdata) ...@@ -1910,7 +1922,8 @@ static int hdmi_get_phy_io(struct hdmi_context *hdata)
if (hdata->drv_data->is_apb_phy) { if (hdata->drv_data->is_apb_phy) {
hdata->regs_hdmiphy = of_iomap(np, 0); hdata->regs_hdmiphy = of_iomap(np, 0);
if (!hdata->regs_hdmiphy) { if (!hdata->regs_hdmiphy) {
DRM_ERROR("failed to ioremap hdmi phy\n"); DRM_DEV_ERROR(hdata->dev,
"failed to ioremap hdmi phy\n");
ret = -ENOMEM; ret = -ENOMEM;
goto out; goto out;
} }
...@@ -1951,7 +1964,7 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1951,7 +1964,7 @@ static int hdmi_probe(struct platform_device *pdev)
ret = hdmi_resources_init(hdata); ret = hdmi_resources_init(hdata);
if (ret) { if (ret) {
if (ret != -EPROBE_DEFER) if (ret != -EPROBE_DEFER)
DRM_ERROR("hdmi_resources_init failed\n"); DRM_DEV_ERROR(dev, "hdmi_resources_init failed\n");
return ret; return ret;
} }
...@@ -1977,14 +1990,14 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1977,14 +1990,14 @@ static int hdmi_probe(struct platform_device *pdev)
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"hdmi", hdata); "hdmi", hdata);
if (ret) { if (ret) {
DRM_ERROR("failed to register hdmi interrupt\n"); DRM_DEV_ERROR(dev, "failed to register hdmi interrupt\n");
goto err_hdmiphy; goto err_hdmiphy;
} }
hdata->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node, hdata->pmureg = syscon_regmap_lookup_by_phandle(dev->of_node,
"samsung,syscon-phandle"); "samsung,syscon-phandle");
if (IS_ERR(hdata->pmureg)) { if (IS_ERR(hdata->pmureg)) {
DRM_ERROR("syscon regmap lookup failed.\n"); DRM_DEV_ERROR(dev, "syscon regmap lookup failed.\n");
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
goto err_hdmiphy; goto err_hdmiphy;
} }
...@@ -1993,7 +2006,7 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1993,7 +2006,7 @@ static int hdmi_probe(struct platform_device *pdev)
hdata->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node, hdata->sysreg = syscon_regmap_lookup_by_phandle(dev->of_node,
"samsung,sysreg-phandle"); "samsung,sysreg-phandle");
if (IS_ERR(hdata->sysreg)) { if (IS_ERR(hdata->sysreg)) {
DRM_ERROR("sysreg regmap lookup failed.\n"); DRM_DEV_ERROR(dev, "sysreg regmap lookup failed.\n");
ret = -EPROBE_DEFER; ret = -EPROBE_DEFER;
goto err_hdmiphy; goto err_hdmiphy;
} }
......
...@@ -228,8 +228,8 @@ static void mixer_regs_dump(struct mixer_context *ctx) ...@@ -228,8 +228,8 @@ static void mixer_regs_dump(struct mixer_context *ctx)
{ {
#define DUMPREG(reg_id) \ #define DUMPREG(reg_id) \
do { \ do { \
DRM_DEBUG_KMS(#reg_id " = %08x\n", \ DRM_DEV_DEBUG_KMS(ctx->dev, #reg_id " = %08x\n", \
(u32)readl(ctx->mixer_regs + reg_id)); \ (u32)readl(ctx->mixer_regs + reg_id)); \
} while (0) } while (0)
DUMPREG(MXR_STATUS); DUMPREG(MXR_STATUS);
...@@ -260,8 +260,8 @@ static void vp_regs_dump(struct mixer_context *ctx) ...@@ -260,8 +260,8 @@ static void vp_regs_dump(struct mixer_context *ctx)
{ {
#define DUMPREG(reg_id) \ #define DUMPREG(reg_id) \
do { \ do { \
DRM_DEBUG_KMS(#reg_id " = %08x\n", \ DRM_DEV_DEBUG_KMS(ctx->dev, #reg_id " = %08x\n", \
(u32) readl(ctx->vp_regs + reg_id)); \ (u32) readl(ctx->vp_regs + reg_id)); \
} while (0) } while (0)
DUMPREG(VP_ENABLE); DUMPREG(VP_ENABLE);
...@@ -885,7 +885,8 @@ static int mixer_initialize(struct mixer_context *mixer_ctx, ...@@ -885,7 +885,8 @@ static int mixer_initialize(struct mixer_context *mixer_ctx,
/* acquire resources: regs, irqs, clocks */ /* acquire resources: regs, irqs, clocks */
ret = mixer_resources_init(mixer_ctx); ret = mixer_resources_init(mixer_ctx);
if (ret) { if (ret) {
DRM_ERROR("mixer_resources_init failed ret=%d\n", ret); DRM_DEV_ERROR(mixer_ctx->dev,
"mixer_resources_init failed ret=%d\n", ret);
return ret; return ret;
} }
...@@ -893,7 +894,8 @@ static int mixer_initialize(struct mixer_context *mixer_ctx, ...@@ -893,7 +894,8 @@ static int mixer_initialize(struct mixer_context *mixer_ctx,
/* acquire vp resources: regs, irqs, clocks */ /* acquire vp resources: regs, irqs, clocks */
ret = vp_resources_init(mixer_ctx); ret = vp_resources_init(mixer_ctx);
if (ret) { if (ret) {
DRM_ERROR("vp_resources_init failed ret=%d\n", ret); DRM_DEV_ERROR(mixer_ctx->dev,
"vp_resources_init failed ret=%d\n", ret);
return ret; return ret;
} }
} }
...@@ -952,7 +954,7 @@ static void mixer_update_plane(struct exynos_drm_crtc *crtc, ...@@ -952,7 +954,7 @@ static void mixer_update_plane(struct exynos_drm_crtc *crtc,
{ {
struct mixer_context *mixer_ctx = crtc->ctx; struct mixer_context *mixer_ctx = crtc->ctx;
DRM_DEBUG_KMS("win: %d\n", plane->index); DRM_DEV_DEBUG_KMS(mixer_ctx->dev, "win: %d\n", plane->index);
if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags))
return; return;
...@@ -969,7 +971,7 @@ static void mixer_disable_plane(struct exynos_drm_crtc *crtc, ...@@ -969,7 +971,7 @@ static void mixer_disable_plane(struct exynos_drm_crtc *crtc,
struct mixer_context *mixer_ctx = crtc->ctx; struct mixer_context *mixer_ctx = crtc->ctx;
unsigned long flags; unsigned long flags;
DRM_DEBUG_KMS("win: %d\n", plane->index); DRM_DEV_DEBUG_KMS(mixer_ctx->dev, "win: %d\n", plane->index);
if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags)) if (!test_bit(MXR_BIT_POWERED, &mixer_ctx->flags))
return; return;
...@@ -1046,8 +1048,9 @@ static int mixer_mode_valid(struct exynos_drm_crtc *crtc, ...@@ -1046,8 +1048,9 @@ static int mixer_mode_valid(struct exynos_drm_crtc *crtc,
struct mixer_context *ctx = crtc->ctx; struct mixer_context *ctx = crtc->ctx;
u32 w = mode->hdisplay, h = mode->vdisplay; u32 w = mode->hdisplay, h = mode->vdisplay;
DRM_DEBUG_KMS("xres=%d, yres=%d, refresh=%d, intl=%d\n", w, h, DRM_DEV_DEBUG_KMS(ctx->dev, "xres=%d, yres=%d, refresh=%d, intl=%d\n",
mode->vrefresh, !!(mode->flags & DRM_MODE_FLAG_INTERLACE)); w, h, mode->vrefresh,
!!(mode->flags & DRM_MODE_FLAG_INTERLACE));
if (ctx->mxr_ver == MXR_VER_128_0_0_184) if (ctx->mxr_ver == MXR_VER_128_0_0_184)
return MODE_OK; return MODE_OK;
...@@ -1227,7 +1230,7 @@ static int mixer_probe(struct platform_device *pdev) ...@@ -1227,7 +1230,7 @@ static int mixer_probe(struct platform_device *pdev)
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx) { if (!ctx) {
DRM_ERROR("failed to alloc mixer context.\n"); DRM_DEV_ERROR(dev, "failed to alloc mixer context.\n");
return -ENOMEM; return -ENOMEM;
} }
...@@ -1282,27 +1285,33 @@ static int __maybe_unused exynos_mixer_resume(struct device *dev) ...@@ -1282,27 +1285,33 @@ static int __maybe_unused exynos_mixer_resume(struct device *dev)
ret = clk_prepare_enable(ctx->mixer); ret = clk_prepare_enable(ctx->mixer);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the mixer clk [%d]\n", ret); DRM_DEV_ERROR(ctx->dev,
"Failed to prepare_enable the mixer clk [%d]\n",
ret);
return ret; return ret;
} }
ret = clk_prepare_enable(ctx->hdmi); ret = clk_prepare_enable(ctx->hdmi);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the hdmi clk [%d]\n", ret); DRM_DEV_ERROR(dev,
"Failed to prepare_enable the hdmi clk [%d]\n",
ret);
return ret; return ret;
} }
if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags)) { if (test_bit(MXR_BIT_VP_ENABLED, &ctx->flags)) {
ret = clk_prepare_enable(ctx->vp); ret = clk_prepare_enable(ctx->vp);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the vp clk [%d]\n", DRM_DEV_ERROR(dev,
ret); "Failed to prepare_enable the vp clk [%d]\n",
ret);
return ret; return ret;
} }
if (test_bit(MXR_BIT_HAS_SCLK, &ctx->flags)) { if (test_bit(MXR_BIT_HAS_SCLK, &ctx->flags)) {
ret = clk_prepare_enable(ctx->sclk_mixer); ret = clk_prepare_enable(ctx->sclk_mixer);
if (ret < 0) { if (ret < 0) {
DRM_ERROR("Failed to prepare_enable the " \ DRM_DEV_ERROR(dev,
"Failed to prepare_enable the " \
"sclk_mixer clk [%d]\n", "sclk_mixer clk [%d]\n",
ret); ret);
return ret; return ret;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment