Commit 80ce5f6f authored by Dave Airlie's avatar Dave Airlie

Merge branch 'exynos-drm-fixes' of...

Merge branch 'exynos-drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-next

Inki writes:
  This pull request includes drm_send_vblank_event() helper
   relevant patch I missed and code cleanups. And also it fixes
   a pended page flip issue.

* 'exynos-drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos:
  drm/exynos: replace request_threaded_irq with devm function
  drm/exynos: remove unnecessary devm_kfree
  drm/exynos: fix build warnings from ipp fimc
  drm/exynos: cleanup device pointer usages
  drm/exynos: wait for the completion of pending page flip
  drm/exynos: use drm_send_vblank_event() helper
  drm/exynos: page flip fixes
  drm/exynos: exynos_hdmi: Pass correct pointer to free_irq()
  drm/exynos: exynos_drm_ipp: Fix incorrect usage of IS_ERR_OR_NULL
  drm/exynos: exynos_drm_fbdev: Fix incorrect usage of IS_ERR_OR_NULL

Conflicts:
	drivers/gpu/drm/exynos/exynos_hdmi.c
parents c313d567 dcb9a7c7
...@@ -48,6 +48,8 @@ struct exynos_drm_crtc { ...@@ -48,6 +48,8 @@ struct exynos_drm_crtc {
unsigned int pipe; unsigned int pipe;
unsigned int dpms; unsigned int dpms;
enum exynos_crtc_mode mode; enum exynos_crtc_mode mode;
wait_queue_head_t pending_flip_queue;
atomic_t pending_flip;
}; };
static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
...@@ -61,6 +63,13 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode) ...@@ -61,6 +63,13 @@ static void exynos_drm_crtc_dpms(struct drm_crtc *crtc, int mode)
return; return;
} }
if (mode > DRM_MODE_DPMS_ON) {
/* wait for the completion of page flip. */
wait_event(exynos_crtc->pending_flip_queue,
atomic_read(&exynos_crtc->pending_flip) == 0);
drm_vblank_off(crtc->dev, exynos_crtc->pipe);
}
exynos_drm_fn_encoder(crtc, &mode, exynos_drm_encoder_crtc_dpms); exynos_drm_fn_encoder(crtc, &mode, exynos_drm_encoder_crtc_dpms);
exynos_crtc->dpms = mode; exynos_crtc->dpms = mode;
} }
...@@ -217,7 +226,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, ...@@ -217,7 +226,6 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
ret = drm_vblank_get(dev, exynos_crtc->pipe); ret = drm_vblank_get(dev, exynos_crtc->pipe);
if (ret) { if (ret) {
DRM_DEBUG("failed to acquire vblank counter\n"); DRM_DEBUG("failed to acquire vblank counter\n");
list_del(&event->base.link);
goto out; goto out;
} }
...@@ -225,6 +233,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc, ...@@ -225,6 +233,7 @@ static int exynos_drm_crtc_page_flip(struct drm_crtc *crtc,
spin_lock_irq(&dev->event_lock); spin_lock_irq(&dev->event_lock);
list_add_tail(&event->base.link, list_add_tail(&event->base.link,
&dev_priv->pageflip_event_list); &dev_priv->pageflip_event_list);
atomic_set(&exynos_crtc->pending_flip, 1);
spin_unlock_irq(&dev->event_lock); spin_unlock_irq(&dev->event_lock);
crtc->fb = fb; crtc->fb = fb;
...@@ -344,6 +353,8 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr) ...@@ -344,6 +353,8 @@ int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr)
exynos_crtc->pipe = nr; exynos_crtc->pipe = nr;
exynos_crtc->dpms = DRM_MODE_DPMS_OFF; exynos_crtc->dpms = DRM_MODE_DPMS_OFF;
init_waitqueue_head(&exynos_crtc->pending_flip_queue);
atomic_set(&exynos_crtc->pending_flip, 0);
exynos_crtc->plane = exynos_plane_init(dev, 1 << nr, true); exynos_crtc->plane = exynos_plane_init(dev, 1 << nr, true);
if (!exynos_crtc->plane) { if (!exynos_crtc->plane) {
kfree(exynos_crtc); kfree(exynos_crtc);
...@@ -398,7 +409,8 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc) ...@@ -398,7 +409,8 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc)
{ {
struct exynos_drm_private *dev_priv = dev->dev_private; struct exynos_drm_private *dev_priv = dev->dev_private;
struct drm_pending_vblank_event *e, *t; struct drm_pending_vblank_event *e, *t;
struct timeval now; struct drm_crtc *drm_crtc = dev_priv->crtc[crtc];
struct exynos_drm_crtc *exynos_crtc = to_exynos_crtc(drm_crtc);
unsigned long flags; unsigned long flags;
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
...@@ -411,14 +423,11 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc) ...@@ -411,14 +423,11 @@ void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc)
if (crtc != e->pipe) if (crtc != e->pipe)
continue; continue;
do_gettimeofday(&now); list_del(&e->base.link);
e->event.sequence = 0; drm_send_vblank_event(dev, -1, e);
e->event.tv_sec = now.tv_sec;
e->event.tv_usec = now.tv_usec;
list_move_tail(&e->base.link, &e->base.file_priv->event_list);
wake_up_interruptible(&e->base.file_priv->event_wait);
drm_vblank_put(dev, crtc); drm_vblank_put(dev, crtc);
atomic_set(&exynos_crtc->pending_flip, 0);
wake_up(&exynos_crtc->pending_flip_queue);
} }
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
......
...@@ -182,7 +182,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper, ...@@ -182,7 +182,7 @@ static int exynos_drm_fbdev_create(struct drm_fb_helper *helper,
helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd, helper->fb = exynos_drm_framebuffer_init(dev, &mode_cmd,
&exynos_gem_obj->base); &exynos_gem_obj->base);
if (IS_ERR_OR_NULL(helper->fb)) { if (IS_ERR(helper->fb)) {
DRM_ERROR("failed to create drm framebuffer.\n"); DRM_ERROR("failed to create drm framebuffer.\n");
ret = PTR_ERR(helper->fb); ret = PTR_ERR(helper->fb);
goto err_destroy_gem; goto err_destroy_gem;
......
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* *
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/mfd/syscon.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
#include <linux/mfd/syscon.h>
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/pm_runtime.h> #include <linux/pm_runtime.h>
...@@ -1845,7 +1845,7 @@ static int fimc_probe(struct platform_device *pdev) ...@@ -1845,7 +1845,7 @@ static int fimc_probe(struct platform_device *pdev)
} }
ctx->irq = res->start; ctx->irq = res->start;
ret = request_threaded_irq(ctx->irq, NULL, fimc_irq_handler, ret = devm_request_threaded_irq(dev, ctx->irq, NULL, fimc_irq_handler,
IRQF_ONESHOT, "drm_fimc", ctx); IRQF_ONESHOT, "drm_fimc", ctx);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to request irq.\n"); dev_err(dev, "failed to request irq.\n");
...@@ -1854,7 +1854,7 @@ static int fimc_probe(struct platform_device *pdev) ...@@ -1854,7 +1854,7 @@ static int fimc_probe(struct platform_device *pdev)
ret = fimc_setup_clocks(ctx); ret = fimc_setup_clocks(ctx);
if (ret < 0) if (ret < 0)
goto err_free_irq; return ret;
ippdrv = &ctx->ippdrv; ippdrv = &ctx->ippdrv;
ippdrv->ops[EXYNOS_DRM_OPS_SRC] = &fimc_src_ops; ippdrv->ops[EXYNOS_DRM_OPS_SRC] = &fimc_src_ops;
...@@ -1884,7 +1884,7 @@ static int fimc_probe(struct platform_device *pdev) ...@@ -1884,7 +1884,7 @@ static int fimc_probe(struct platform_device *pdev)
goto err_pm_dis; goto err_pm_dis;
} }
dev_info(&pdev->dev, "drm fimc registered successfully.\n"); dev_info(dev, "drm fimc registered successfully.\n");
return 0; return 0;
...@@ -1892,8 +1892,6 @@ static int fimc_probe(struct platform_device *pdev) ...@@ -1892,8 +1892,6 @@ static int fimc_probe(struct platform_device *pdev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_put_clk: err_put_clk:
fimc_put_clocks(ctx); fimc_put_clocks(ctx);
err_free_irq:
free_irq(ctx->irq, ctx);
return ret; return ret;
} }
...@@ -1911,8 +1909,6 @@ static int fimc_remove(struct platform_device *pdev) ...@@ -1911,8 +1909,6 @@ static int fimc_remove(struct platform_device *pdev)
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
free_irq(ctx->irq, ctx);
return 0; return 0;
} }
......
...@@ -885,7 +885,7 @@ static int fimd_probe(struct platform_device *pdev) ...@@ -885,7 +885,7 @@ static int fimd_probe(struct platform_device *pdev)
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
if (pdev->dev.of_node) { if (dev->of_node) {
pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) { if (!pdata) {
DRM_ERROR("memory allocation for pdata failed\n"); DRM_ERROR("memory allocation for pdata failed\n");
...@@ -899,7 +899,7 @@ static int fimd_probe(struct platform_device *pdev) ...@@ -899,7 +899,7 @@ static int fimd_probe(struct platform_device *pdev)
return ret; return ret;
} }
} else { } else {
pdata = pdev->dev.platform_data; pdata = dev->platform_data;
if (!pdata) { if (!pdata) {
DRM_ERROR("no platform data specified\n"); DRM_ERROR("no platform data specified\n");
return -EINVAL; return -EINVAL;
...@@ -912,7 +912,7 @@ static int fimd_probe(struct platform_device *pdev) ...@@ -912,7 +912,7 @@ static int fimd_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
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;
...@@ -930,7 +930,7 @@ static int fimd_probe(struct platform_device *pdev) ...@@ -930,7 +930,7 @@ static int fimd_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
ctx->regs = devm_ioremap_resource(&pdev->dev, res); ctx->regs = devm_ioremap_resource(dev, res);
if (IS_ERR(ctx->regs)) if (IS_ERR(ctx->regs))
return PTR_ERR(ctx->regs); return PTR_ERR(ctx->regs);
...@@ -942,7 +942,7 @@ static int fimd_probe(struct platform_device *pdev) ...@@ -942,7 +942,7 @@ static int fimd_probe(struct platform_device *pdev)
ctx->irq = res->start; ctx->irq = res->start;
ret = devm_request_irq(&pdev->dev, ctx->irq, fimd_irq_handler, ret = devm_request_irq(dev, ctx->irq, fimd_irq_handler,
0, "drm_fimd", ctx); 0, "drm_fimd", ctx);
if (ret) { if (ret) {
dev_err(dev, "irq request failed.\n"); dev_err(dev, "irq request failed.\n");
......
...@@ -1379,7 +1379,7 @@ static int g2d_probe(struct platform_device *pdev) ...@@ -1379,7 +1379,7 @@ static int g2d_probe(struct platform_device *pdev)
struct exynos_drm_subdrv *subdrv; struct exynos_drm_subdrv *subdrv;
int ret; int ret;
g2d = devm_kzalloc(&pdev->dev, sizeof(*g2d), GFP_KERNEL); g2d = devm_kzalloc(dev, sizeof(*g2d), GFP_KERNEL);
if (!g2d) { if (!g2d) {
dev_err(dev, "failed to allocate driver data\n"); dev_err(dev, "failed to allocate driver data\n");
return -ENOMEM; return -ENOMEM;
...@@ -1417,7 +1417,7 @@ static int g2d_probe(struct platform_device *pdev) ...@@ -1417,7 +1417,7 @@ static int g2d_probe(struct platform_device *pdev)
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
g2d->regs = devm_ioremap_resource(&pdev->dev, res); g2d->regs = devm_ioremap_resource(dev, res);
if (IS_ERR(g2d->regs)) { if (IS_ERR(g2d->regs)) {
ret = PTR_ERR(g2d->regs); ret = PTR_ERR(g2d->regs);
goto err_put_clk; goto err_put_clk;
...@@ -1430,7 +1430,7 @@ static int g2d_probe(struct platform_device *pdev) ...@@ -1430,7 +1430,7 @@ static int g2d_probe(struct platform_device *pdev)
goto err_put_clk; goto err_put_clk;
} }
ret = devm_request_irq(&pdev->dev, g2d->irq, g2d_irq_handler, 0, ret = devm_request_irq(dev, g2d->irq, g2d_irq_handler, 0,
"drm_g2d", g2d); "drm_g2d", g2d);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "irq request failed\n"); dev_err(dev, "irq request failed\n");
......
...@@ -1704,7 +1704,7 @@ static int gsc_probe(struct platform_device *pdev) ...@@ -1704,7 +1704,7 @@ static int gsc_probe(struct platform_device *pdev)
} }
ctx->irq = res->start; ctx->irq = res->start;
ret = request_threaded_irq(ctx->irq, NULL, gsc_irq_handler, ret = devm_request_threaded_irq(dev, ctx->irq, NULL, gsc_irq_handler,
IRQF_ONESHOT, "drm_gsc", ctx); IRQF_ONESHOT, "drm_gsc", ctx);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to request irq.\n"); dev_err(dev, "failed to request irq.\n");
...@@ -1725,7 +1725,7 @@ static int gsc_probe(struct platform_device *pdev) ...@@ -1725,7 +1725,7 @@ static int gsc_probe(struct platform_device *pdev)
ret = gsc_init_prop_list(ippdrv); ret = gsc_init_prop_list(ippdrv);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to init property list.\n"); dev_err(dev, "failed to init property list.\n");
goto err_get_irq; return ret;
} }
DRM_DEBUG_KMS("%s:id[%d]ippdrv[0x%x]\n", __func__, ctx->id, DRM_DEBUG_KMS("%s:id[%d]ippdrv[0x%x]\n", __func__, ctx->id,
...@@ -1743,15 +1743,12 @@ static int gsc_probe(struct platform_device *pdev) ...@@ -1743,15 +1743,12 @@ static int gsc_probe(struct platform_device *pdev)
goto err_ippdrv_register; goto err_ippdrv_register;
} }
dev_info(&pdev->dev, "drm gsc registered successfully.\n"); dev_info(dev, "drm gsc registered successfully.\n");
return 0; return 0;
err_ippdrv_register: err_ippdrv_register:
devm_kfree(dev, ippdrv->prop_list);
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_get_irq:
free_irq(ctx->irq, ctx);
return ret; return ret;
} }
...@@ -1761,15 +1758,12 @@ static int gsc_remove(struct platform_device *pdev) ...@@ -1761,15 +1758,12 @@ static int gsc_remove(struct platform_device *pdev)
struct gsc_context *ctx = get_gsc_context(dev); struct gsc_context *ctx = get_gsc_context(dev);
struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
devm_kfree(dev, ippdrv->prop_list);
exynos_drm_ippdrv_unregister(ippdrv); exynos_drm_ippdrv_unregister(ippdrv);
mutex_destroy(&ctx->lock); mutex_destroy(&ctx->lock);
pm_runtime_set_suspended(dev); pm_runtime_set_suspended(dev);
pm_runtime_disable(dev); pm_runtime_disable(dev);
free_irq(ctx->irq, ctx);
return 0; return 0;
} }
......
...@@ -442,7 +442,7 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev) ...@@ -442,7 +442,7 @@ static int exynos_drm_hdmi_probe(struct platform_device *pdev)
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx) { if (!ctx) {
DRM_LOG_KMS("failed to alloc common hdmi context.\n"); DRM_LOG_KMS("failed to alloc common hdmi context.\n");
return -ENOMEM; return -ENOMEM;
......
...@@ -222,7 +222,7 @@ static struct exynos_drm_ippdrv *ipp_find_driver(struct ipp_context *ctx, ...@@ -222,7 +222,7 @@ static struct exynos_drm_ippdrv *ipp_find_driver(struct ipp_context *ctx,
/* find ipp driver using idr */ /* find ipp driver using idr */
ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock, ippdrv = ipp_find_obj(&ctx->ipp_idr, &ctx->ipp_lock,
ipp_id); ipp_id);
if (IS_ERR_OR_NULL(ippdrv)) { if (IS_ERR(ippdrv)) {
DRM_ERROR("not found ipp%d driver.\n", ipp_id); DRM_ERROR("not found ipp%d driver.\n", ipp_id);
return ippdrv; return ippdrv;
} }
...@@ -388,7 +388,7 @@ static int ipp_find_and_set_property(struct drm_exynos_ipp_property *property) ...@@ -388,7 +388,7 @@ static int ipp_find_and_set_property(struct drm_exynos_ipp_property *property)
DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, prop_id); DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, prop_id);
ippdrv = ipp_find_drv_by_handle(prop_id); ippdrv = ipp_find_drv_by_handle(prop_id);
if (IS_ERR_OR_NULL(ippdrv)) { if (IS_ERR(ippdrv)) {
DRM_ERROR("failed to get ipp driver.\n"); DRM_ERROR("failed to get ipp driver.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -492,7 +492,7 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data, ...@@ -492,7 +492,7 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data,
/* find ipp driver using ipp id */ /* find ipp driver using ipp id */
ippdrv = ipp_find_driver(ctx, property); ippdrv = ipp_find_driver(ctx, property);
if (IS_ERR_OR_NULL(ippdrv)) { if (IS_ERR(ippdrv)) {
DRM_ERROR("failed to get ipp driver.\n"); DRM_ERROR("failed to get ipp driver.\n");
return -EINVAL; return -EINVAL;
} }
...@@ -521,19 +521,19 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data, ...@@ -521,19 +521,19 @@ int exynos_drm_ipp_set_property(struct drm_device *drm_dev, void *data,
c_node->state = IPP_STATE_IDLE; c_node->state = IPP_STATE_IDLE;
c_node->start_work = ipp_create_cmd_work(); c_node->start_work = ipp_create_cmd_work();
if (IS_ERR_OR_NULL(c_node->start_work)) { if (IS_ERR(c_node->start_work)) {
DRM_ERROR("failed to create start work.\n"); DRM_ERROR("failed to create start work.\n");
goto err_clear; goto err_clear;
} }
c_node->stop_work = ipp_create_cmd_work(); c_node->stop_work = ipp_create_cmd_work();
if (IS_ERR_OR_NULL(c_node->stop_work)) { if (IS_ERR(c_node->stop_work)) {
DRM_ERROR("failed to create stop work.\n"); DRM_ERROR("failed to create stop work.\n");
goto err_free_start; goto err_free_start;
} }
c_node->event_work = ipp_create_event_work(); c_node->event_work = ipp_create_event_work();
if (IS_ERR_OR_NULL(c_node->event_work)) { if (IS_ERR(c_node->event_work)) {
DRM_ERROR("failed to create event work.\n"); DRM_ERROR("failed to create event work.\n");
goto err_free_stop; goto err_free_stop;
} }
...@@ -915,7 +915,7 @@ static int ipp_queue_buf_with_run(struct device *dev, ...@@ -915,7 +915,7 @@ static int ipp_queue_buf_with_run(struct device *dev,
DRM_DEBUG_KMS("%s\n", __func__); DRM_DEBUG_KMS("%s\n", __func__);
ippdrv = ipp_find_drv_by_handle(qbuf->prop_id); ippdrv = ipp_find_drv_by_handle(qbuf->prop_id);
if (IS_ERR_OR_NULL(ippdrv)) { if (IS_ERR(ippdrv)) {
DRM_ERROR("failed to get ipp driver.\n"); DRM_ERROR("failed to get ipp driver.\n");
return -EFAULT; return -EFAULT;
} }
...@@ -1909,7 +1909,7 @@ static int ipp_probe(struct platform_device *pdev) ...@@ -1909,7 +1909,7 @@ static int ipp_probe(struct platform_device *pdev)
struct exynos_drm_subdrv *subdrv; struct exynos_drm_subdrv *subdrv;
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;
...@@ -1963,7 +1963,7 @@ static int ipp_probe(struct platform_device *pdev) ...@@ -1963,7 +1963,7 @@ static int ipp_probe(struct platform_device *pdev)
goto err_cmd_workq; goto err_cmd_workq;
} }
dev_info(&pdev->dev, "drm ipp registered successfully.\n"); dev_info(dev, "drm ipp registered successfully.\n");
return 0; return 0;
......
...@@ -666,8 +666,8 @@ static int rotator_probe(struct platform_device *pdev) ...@@ -666,8 +666,8 @@ static int rotator_probe(struct platform_device *pdev)
return rot->irq; return rot->irq;
} }
ret = request_threaded_irq(rot->irq, NULL, rotator_irq_handler, ret = devm_request_threaded_irq(dev, rot->irq, NULL,
IRQF_ONESHOT, "drm_rotator", rot); rotator_irq_handler, IRQF_ONESHOT, "drm_rotator", rot);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to request irq\n"); dev_err(dev, "failed to request irq\n");
return ret; return ret;
...@@ -676,8 +676,7 @@ static int rotator_probe(struct platform_device *pdev) ...@@ -676,8 +676,7 @@ static int rotator_probe(struct platform_device *pdev)
rot->clock = devm_clk_get(dev, "rotator"); rot->clock = devm_clk_get(dev, "rotator");
if (IS_ERR(rot->clock)) { if (IS_ERR(rot->clock)) {
dev_err(dev, "failed to get clock\n"); dev_err(dev, "failed to get clock\n");
ret = PTR_ERR(rot->clock); return PTR_ERR(rot->clock);
goto err_clk_get;
} }
pm_runtime_enable(dev); pm_runtime_enable(dev);
...@@ -709,10 +708,7 @@ static int rotator_probe(struct platform_device *pdev) ...@@ -709,10 +708,7 @@ static int rotator_probe(struct platform_device *pdev)
return 0; return 0;
err_ippdrv_register: err_ippdrv_register:
devm_kfree(dev, ippdrv->prop_list);
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_clk_get:
free_irq(rot->irq, rot);
return ret; return ret;
} }
...@@ -722,13 +718,10 @@ static int rotator_remove(struct platform_device *pdev) ...@@ -722,13 +718,10 @@ static int rotator_remove(struct platform_device *pdev)
struct rot_context *rot = dev_get_drvdata(dev); struct rot_context *rot = dev_get_drvdata(dev);
struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv; struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv;
devm_kfree(dev, ippdrv->prop_list);
exynos_drm_ippdrv_unregister(ippdrv); exynos_drm_ippdrv_unregister(ippdrv);
pm_runtime_disable(dev); pm_runtime_disable(dev);
free_irq(rot->irq, rot);
return 0; return 0;
} }
......
...@@ -594,7 +594,7 @@ static int vidi_probe(struct platform_device *pdev) ...@@ -594,7 +594,7 @@ static int vidi_probe(struct platform_device *pdev)
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
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;
...@@ -612,7 +612,7 @@ static int vidi_probe(struct platform_device *pdev) ...@@ -612,7 +612,7 @@ 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_INFO("failed to create connection sysfs.\n"); DRM_INFO("failed to create connection sysfs.\n");
......
...@@ -1946,14 +1946,14 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1946,14 +1946,14 @@ static int hdmi_probe(struct platform_device *pdev)
DRM_DEBUG_KMS("[%d]\n", __LINE__); DRM_DEBUG_KMS("[%d]\n", __LINE__);
if (pdev->dev.of_node) { if (dev->of_node) {
pdata = drm_hdmi_dt_parse_pdata(dev); pdata = drm_hdmi_dt_parse_pdata(dev);
if (IS_ERR(pdata)) { if (IS_ERR(pdata)) {
DRM_ERROR("failed to parse dt\n"); DRM_ERROR("failed to parse dt\n");
return PTR_ERR(pdata); return PTR_ERR(pdata);
} }
} else { } else {
pdata = pdev->dev.platform_data; pdata = dev->platform_data;
} }
if (!pdata) { if (!pdata) {
...@@ -1961,14 +1961,14 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1961,14 +1961,14 @@ static int hdmi_probe(struct platform_device *pdev)
return -EINVAL; return -EINVAL;
} }
drm_hdmi_ctx = devm_kzalloc(&pdev->dev, sizeof(*drm_hdmi_ctx), drm_hdmi_ctx = devm_kzalloc(dev, sizeof(*drm_hdmi_ctx),
GFP_KERNEL); GFP_KERNEL);
if (!drm_hdmi_ctx) { if (!drm_hdmi_ctx) {
DRM_ERROR("failed to allocate common hdmi context.\n"); DRM_ERROR("failed to allocate common hdmi context.\n");
return -ENOMEM; return -ENOMEM;
} }
hdata = devm_kzalloc(&pdev->dev, sizeof(struct hdmi_context), hdata = devm_kzalloc(dev, sizeof(struct hdmi_context),
GFP_KERNEL); GFP_KERNEL);
if (!hdata) { if (!hdata) {
DRM_ERROR("out of memory\n"); DRM_ERROR("out of memory\n");
...@@ -1985,7 +1985,7 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -1985,7 +1985,7 @@ static int hdmi_probe(struct platform_device *pdev)
if (dev->of_node) { if (dev->of_node) {
const struct of_device_id *match; const struct of_device_id *match;
match = of_match_node(of_match_ptr(hdmi_match_types), match = of_match_node(of_match_ptr(hdmi_match_types),
pdev->dev.of_node); dev->of_node);
if (match == NULL) if (match == NULL)
return -ENODEV; return -ENODEV;
hdata->type = (enum hdmi_type)match->data; hdata->type = (enum hdmi_type)match->data;
...@@ -2005,11 +2005,11 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2005,11 +2005,11 @@ static int hdmi_probe(struct platform_device *pdev)
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
hdata->regs = devm_ioremap_resource(&pdev->dev, res); hdata->regs = devm_ioremap_resource(dev, res);
if (IS_ERR(hdata->regs)) if (IS_ERR(hdata->regs))
return PTR_ERR(hdata->regs); return PTR_ERR(hdata->regs);
ret = devm_gpio_request(&pdev->dev, hdata->hpd_gpio, "HPD"); ret = devm_gpio_request(dev, hdata->hpd_gpio, "HPD");
if (ret) { if (ret) {
DRM_ERROR("failed to request HPD gpio\n"); DRM_ERROR("failed to request HPD gpio\n");
return ret; return ret;
...@@ -2041,7 +2041,7 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2041,7 +2041,7 @@ static int hdmi_probe(struct platform_device *pdev)
hdata->hpd = gpio_get_value(hdata->hpd_gpio); hdata->hpd = gpio_get_value(hdata->hpd_gpio);
ret = request_threaded_irq(hdata->irq, NULL, ret = devm_request_threaded_irq(dev, hdata->irq, NULL,
hdmi_irq_thread, IRQF_TRIGGER_RISING | hdmi_irq_thread, IRQF_TRIGGER_RISING |
IRQF_TRIGGER_FALLING | IRQF_ONESHOT, IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
"hdmi", drm_hdmi_ctx); "hdmi", drm_hdmi_ctx);
...@@ -2070,16 +2070,11 @@ static int hdmi_probe(struct platform_device *pdev) ...@@ -2070,16 +2070,11 @@ static int hdmi_probe(struct platform_device *pdev)
static int hdmi_remove(struct platform_device *pdev) static int hdmi_remove(struct platform_device *pdev)
{ {
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct exynos_drm_hdmi_context *ctx = platform_get_drvdata(pdev);
struct hdmi_context *hdata = ctx->ctx;
DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__); DRM_DEBUG_KMS("[%d] %s\n", __LINE__, __func__);
pm_runtime_disable(dev); pm_runtime_disable(dev);
free_irq(hdata->irq, hdata);
/* hdmiphy i2c driver */ /* hdmiphy i2c driver */
i2c_del_driver(&hdmiphy_driver); i2c_del_driver(&hdmiphy_driver);
/* DDC i2c driver */ /* DDC i2c driver */
......
...@@ -1061,7 +1061,7 @@ static int mixer_resources_init(struct exynos_drm_hdmi_context *ctx, ...@@ -1061,7 +1061,7 @@ static int mixer_resources_init(struct exynos_drm_hdmi_context *ctx,
return -ENXIO; return -ENXIO;
} }
mixer_res->mixer_regs = devm_ioremap(&pdev->dev, res->start, mixer_res->mixer_regs = devm_ioremap(dev, res->start,
resource_size(res)); resource_size(res));
if (mixer_res->mixer_regs == NULL) { if (mixer_res->mixer_regs == NULL) {
dev_err(dev, "register mapping failed.\n"); dev_err(dev, "register mapping failed.\n");
...@@ -1074,7 +1074,7 @@ static int mixer_resources_init(struct exynos_drm_hdmi_context *ctx, ...@@ -1074,7 +1074,7 @@ static int mixer_resources_init(struct exynos_drm_hdmi_context *ctx,
return -ENXIO; return -ENXIO;
} }
ret = devm_request_irq(&pdev->dev, res->start, mixer_irq_handler, ret = devm_request_irq(dev, res->start, mixer_irq_handler,
0, "drm_mixer", ctx); 0, "drm_mixer", ctx);
if (ret) { if (ret) {
dev_err(dev, "request interrupt failed.\n"); dev_err(dev, "request interrupt failed.\n");
...@@ -1118,7 +1118,7 @@ static int vp_resources_init(struct exynos_drm_hdmi_context *ctx, ...@@ -1118,7 +1118,7 @@ static int vp_resources_init(struct exynos_drm_hdmi_context *ctx,
return -ENXIO; return -ENXIO;
} }
mixer_res->vp_regs = devm_ioremap(&pdev->dev, res->start, mixer_res->vp_regs = devm_ioremap(dev, res->start,
resource_size(res)); resource_size(res));
if (mixer_res->vp_regs == NULL) { if (mixer_res->vp_regs == NULL) {
dev_err(dev, "register mapping failed.\n"); dev_err(dev, "register mapping failed.\n");
...@@ -1169,14 +1169,14 @@ static int mixer_probe(struct platform_device *pdev) ...@@ -1169,14 +1169,14 @@ static int mixer_probe(struct platform_device *pdev)
dev_info(dev, "probe start\n"); dev_info(dev, "probe start\n");
drm_hdmi_ctx = devm_kzalloc(&pdev->dev, sizeof(*drm_hdmi_ctx), drm_hdmi_ctx = devm_kzalloc(dev, sizeof(*drm_hdmi_ctx),
GFP_KERNEL); GFP_KERNEL);
if (!drm_hdmi_ctx) { if (!drm_hdmi_ctx) {
DRM_ERROR("failed to allocate common hdmi context.\n"); DRM_ERROR("failed to allocate common hdmi context.\n");
return -ENOMEM; return -ENOMEM;
} }
ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL); ctx = devm_kzalloc(dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx) { if (!ctx) {
DRM_ERROR("failed to alloc mixer context.\n"); DRM_ERROR("failed to alloc mixer context.\n");
return -ENOMEM; return -ENOMEM;
...@@ -1187,14 +1187,14 @@ static int mixer_probe(struct platform_device *pdev) ...@@ -1187,14 +1187,14 @@ static int mixer_probe(struct platform_device *pdev)
if (dev->of_node) { if (dev->of_node) {
const struct of_device_id *match; const struct of_device_id *match;
match = of_match_node(of_match_ptr(mixer_match_types), match = of_match_node(of_match_ptr(mixer_match_types),
pdev->dev.of_node); dev->of_node);
drv = (struct mixer_drv_data *)match->data; drv = (struct mixer_drv_data *)match->data;
} else { } else {
drv = (struct mixer_drv_data *) drv = (struct mixer_drv_data *)
platform_get_device_id(pdev)->driver_data; platform_get_device_id(pdev)->driver_data;
} }
ctx->dev = &pdev->dev; ctx->dev = dev;
ctx->parent_ctx = (void *)drm_hdmi_ctx; ctx->parent_ctx = (void *)drm_hdmi_ctx;
drm_hdmi_ctx->ctx = (void *)ctx; drm_hdmi_ctx->ctx = (void *)ctx;
ctx->vp_enabled = drv->is_vp_enabled; ctx->vp_enabled = drv->is_vp_enabled;
......
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