Commit b6552328 authored by Dave Airlie's avatar Dave Airlie

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

Merge branch 'exynos-drm-fixes' of git://git.infradead.org/users/kmpark/linux-samsung into drm-fixes

Inki Dae writes:
- fix build warnings
- minor code cleanup
- remove non-standard format, DRM_FORMAT_NV12M
- add dummy mmap for exynos dmabuf
  . dma_buf export needs this patch

* 'exynos-drm-fixes' of git://git.infradead.org/users/kmpark/linux-samsung:
  drm: Drop the NV12M and YUV420M formats
  drm/exynos: remove DRM_FORMAT_NV12M from plane module
  drm/exynos: fix double call of drm_prime_(init/destroy)_file_private
  drm/exynos: add dummy support for dmabuf-mmap
  drm/exynos: Add missing braces around sizeof in exynos_mixer.c
  drm/exynos: Add missing braces around sizeof in exynos_hdmi.c
  drm/exynos: Make g2d_pm_ops static
  drm/exynos: Add dependency for G2D in Kconfig
  drm/exynos: fixed page align bug.
  drm/exynos: Use ERR_CAST inlined function instead of ERR_PTR(PTR_ERR(.. [1]
  drm/exynos: Use devm_* functions in exynos_drm_g2d.c file
  drm/exynos: Use devm_kzalloc in exynos_drm_hdmi.c file
  drm/exynos: Use devm_kzalloc in exynos_drm_vidi.c file
  drm/exynos: Remove redundant check in exynos_drm_fimd.c file
  drm/exynos: Remove redundant check in exynos_hdmi.c file
parents 5e1782d2 d9dd85dd
...@@ -36,6 +36,6 @@ config DRM_EXYNOS_VIDI ...@@ -36,6 +36,6 @@ config DRM_EXYNOS_VIDI
config DRM_EXYNOS_G2D config DRM_EXYNOS_G2D
bool "Exynos DRM G2D" bool "Exynos DRM G2D"
depends on DRM_EXYNOS depends on DRM_EXYNOS && !VIDEO_SAMSUNG_S5P_G2D
help help
Choose this option if you want to use Exynos G2D for DRM. Choose this option if you want to use Exynos G2D for DRM.
...@@ -163,6 +163,12 @@ static void exynos_gem_dmabuf_kunmap(struct dma_buf *dma_buf, ...@@ -163,6 +163,12 @@ static void exynos_gem_dmabuf_kunmap(struct dma_buf *dma_buf,
/* TODO */ /* TODO */
} }
static int exynos_gem_dmabuf_mmap(struct dma_buf *dma_buf,
struct vm_area_struct *vma)
{
return -ENOTTY;
}
static struct dma_buf_ops exynos_dmabuf_ops = { static struct dma_buf_ops exynos_dmabuf_ops = {
.map_dma_buf = exynos_gem_map_dma_buf, .map_dma_buf = exynos_gem_map_dma_buf,
.unmap_dma_buf = exynos_gem_unmap_dma_buf, .unmap_dma_buf = exynos_gem_unmap_dma_buf,
...@@ -170,6 +176,7 @@ static struct dma_buf_ops exynos_dmabuf_ops = { ...@@ -170,6 +176,7 @@ static struct dma_buf_ops exynos_dmabuf_ops = {
.kmap_atomic = exynos_gem_dmabuf_kmap_atomic, .kmap_atomic = exynos_gem_dmabuf_kmap_atomic,
.kunmap = exynos_gem_dmabuf_kunmap, .kunmap = exynos_gem_dmabuf_kunmap,
.kunmap_atomic = exynos_gem_dmabuf_kunmap_atomic, .kunmap_atomic = exynos_gem_dmabuf_kunmap_atomic,
.mmap = exynos_gem_dmabuf_mmap,
.release = exynos_dmabuf_release, .release = exynos_dmabuf_release,
}; };
......
...@@ -160,7 +160,6 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) ...@@ -160,7 +160,6 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
if (!file_priv) if (!file_priv)
return -ENOMEM; return -ENOMEM;
drm_prime_init_file_private(&file->prime);
file->driver_priv = file_priv; file->driver_priv = file_priv;
return exynos_drm_subdrv_open(dev, file); return exynos_drm_subdrv_open(dev, file);
...@@ -184,7 +183,6 @@ static void exynos_drm_preclose(struct drm_device *dev, ...@@ -184,7 +183,6 @@ static void exynos_drm_preclose(struct drm_device *dev,
e->base.destroy(&e->base); e->base.destroy(&e->base);
} }
} }
drm_prime_destroy_file_private(&file->prime);
spin_unlock_irqrestore(&dev->event_lock, flags); spin_unlock_irqrestore(&dev->event_lock, flags);
exynos_drm_subdrv_close(dev, file); exynos_drm_subdrv_close(dev, file);
......
...@@ -831,11 +831,6 @@ static int __devinit fimd_probe(struct platform_device *pdev) ...@@ -831,11 +831,6 @@ static int __devinit fimd_probe(struct platform_device *pdev)
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(dev, "failed to find registers\n");
ret = -ENOENT;
goto err_clk;
}
ctx->regs = devm_request_and_ioremap(&pdev->dev, res); ctx->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!ctx->regs) { if (!ctx->regs) {
......
...@@ -129,7 +129,6 @@ struct g2d_runqueue_node { ...@@ -129,7 +129,6 @@ struct g2d_runqueue_node {
struct g2d_data { struct g2d_data {
struct device *dev; struct device *dev;
struct clk *gate_clk; struct clk *gate_clk;
struct resource *regs_res;
void __iomem *regs; void __iomem *regs;
int irq; int irq;
struct workqueue_struct *g2d_workq; struct workqueue_struct *g2d_workq;
...@@ -751,7 +750,7 @@ static int __devinit g2d_probe(struct platform_device *pdev) ...@@ -751,7 +750,7 @@ static int __devinit g2d_probe(struct platform_device *pdev)
struct exynos_drm_subdrv *subdrv; struct exynos_drm_subdrv *subdrv;
int ret; int ret;
g2d = kzalloc(sizeof(*g2d), GFP_KERNEL); g2d = devm_kzalloc(&pdev->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;
...@@ -759,10 +758,8 @@ static int __devinit g2d_probe(struct platform_device *pdev) ...@@ -759,10 +758,8 @@ static int __devinit g2d_probe(struct platform_device *pdev)
g2d->runqueue_slab = kmem_cache_create("g2d_runqueue_slab", g2d->runqueue_slab = kmem_cache_create("g2d_runqueue_slab",
sizeof(struct g2d_runqueue_node), 0, 0, NULL); sizeof(struct g2d_runqueue_node), 0, 0, NULL);
if (!g2d->runqueue_slab) { if (!g2d->runqueue_slab)
ret = -ENOMEM; return -ENOMEM;
goto err_free_mem;
}
g2d->dev = dev; g2d->dev = dev;
...@@ -794,38 +791,26 @@ static int __devinit g2d_probe(struct platform_device *pdev) ...@@ -794,38 +791,26 @@ static int __devinit g2d_probe(struct platform_device *pdev)
pm_runtime_enable(dev); pm_runtime_enable(dev);
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
dev_err(dev, "failed to get I/O memory\n");
ret = -ENOENT;
goto err_put_clk;
}
g2d->regs_res = request_mem_region(res->start, resource_size(res), g2d->regs = devm_request_and_ioremap(&pdev->dev, res);
dev_name(dev));
if (!g2d->regs_res) {
dev_err(dev, "failed to request I/O memory\n");
ret = -ENOENT;
goto err_put_clk;
}
g2d->regs = ioremap(res->start, resource_size(res));
if (!g2d->regs) { if (!g2d->regs) {
dev_err(dev, "failed to remap I/O memory\n"); dev_err(dev, "failed to remap I/O memory\n");
ret = -ENXIO; ret = -ENXIO;
goto err_release_res; goto err_put_clk;
} }
g2d->irq = platform_get_irq(pdev, 0); g2d->irq = platform_get_irq(pdev, 0);
if (g2d->irq < 0) { if (g2d->irq < 0) {
dev_err(dev, "failed to get irq\n"); dev_err(dev, "failed to get irq\n");
ret = g2d->irq; ret = g2d->irq;
goto err_unmap_base; goto err_put_clk;
} }
ret = request_irq(g2d->irq, g2d_irq_handler, 0, "drm_g2d", g2d); ret = devm_request_irq(&pdev->dev, g2d->irq, g2d_irq_handler, 0,
"drm_g2d", g2d);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "irq request failed\n"); dev_err(dev, "irq request failed\n");
goto err_unmap_base; goto err_put_clk;
} }
platform_set_drvdata(pdev, g2d); platform_set_drvdata(pdev, g2d);
...@@ -838,7 +823,7 @@ static int __devinit g2d_probe(struct platform_device *pdev) ...@@ -838,7 +823,7 @@ static int __devinit g2d_probe(struct platform_device *pdev)
ret = exynos_drm_subdrv_register(subdrv); ret = exynos_drm_subdrv_register(subdrv);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed to register drm g2d device\n"); dev_err(dev, "failed to register drm g2d device\n");
goto err_free_irq; goto err_put_clk;
} }
dev_info(dev, "The exynos g2d(ver %d.%d) successfully probed\n", dev_info(dev, "The exynos g2d(ver %d.%d) successfully probed\n",
...@@ -846,13 +831,6 @@ static int __devinit g2d_probe(struct platform_device *pdev) ...@@ -846,13 +831,6 @@ static int __devinit g2d_probe(struct platform_device *pdev)
return 0; return 0;
err_free_irq:
free_irq(g2d->irq, g2d);
err_unmap_base:
iounmap(g2d->regs);
err_release_res:
release_resource(g2d->regs_res);
kfree(g2d->regs_res);
err_put_clk: err_put_clk:
pm_runtime_disable(dev); pm_runtime_disable(dev);
clk_put(g2d->gate_clk); clk_put(g2d->gate_clk);
...@@ -862,8 +840,6 @@ static int __devinit g2d_probe(struct platform_device *pdev) ...@@ -862,8 +840,6 @@ static int __devinit g2d_probe(struct platform_device *pdev)
destroy_workqueue(g2d->g2d_workq); destroy_workqueue(g2d->g2d_workq);
err_destroy_slab: err_destroy_slab:
kmem_cache_destroy(g2d->runqueue_slab); kmem_cache_destroy(g2d->runqueue_slab);
err_free_mem:
kfree(g2d);
return ret; return ret;
} }
...@@ -873,24 +849,18 @@ static int __devexit g2d_remove(struct platform_device *pdev) ...@@ -873,24 +849,18 @@ static int __devexit g2d_remove(struct platform_device *pdev)
cancel_work_sync(&g2d->runqueue_work); cancel_work_sync(&g2d->runqueue_work);
exynos_drm_subdrv_unregister(&g2d->subdrv); exynos_drm_subdrv_unregister(&g2d->subdrv);
free_irq(g2d->irq, g2d);
while (g2d->runqueue_node) { while (g2d->runqueue_node) {
g2d_free_runqueue_node(g2d, g2d->runqueue_node); g2d_free_runqueue_node(g2d, g2d->runqueue_node);
g2d->runqueue_node = g2d_get_runqueue_node(g2d); g2d->runqueue_node = g2d_get_runqueue_node(g2d);
} }
iounmap(g2d->regs);
release_resource(g2d->regs_res);
kfree(g2d->regs_res);
pm_runtime_disable(&pdev->dev); pm_runtime_disable(&pdev->dev);
clk_put(g2d->gate_clk); clk_put(g2d->gate_clk);
g2d_fini_cmdlist(g2d); g2d_fini_cmdlist(g2d);
destroy_workqueue(g2d->g2d_workq); destroy_workqueue(g2d->g2d_workq);
kmem_cache_destroy(g2d->runqueue_slab); kmem_cache_destroy(g2d->runqueue_slab);
kfree(g2d);
return 0; return 0;
} }
...@@ -924,7 +894,7 @@ static int g2d_resume(struct device *dev) ...@@ -924,7 +894,7 @@ static int g2d_resume(struct device *dev)
} }
#endif #endif
SIMPLE_DEV_PM_OPS(g2d_pm_ops, g2d_suspend, g2d_resume); static SIMPLE_DEV_PM_OPS(g2d_pm_ops, g2d_suspend, g2d_resume);
struct platform_driver g2d_driver = { struct platform_driver g2d_driver = {
.probe = g2d_probe, .probe = g2d_probe,
......
...@@ -122,7 +122,7 @@ struct page **exynos_gem_get_pages(struct drm_gem_object *obj, ...@@ -122,7 +122,7 @@ struct page **exynos_gem_get_pages(struct drm_gem_object *obj,
__free_page(pages[i]); __free_page(pages[i]);
drm_free_large(pages); drm_free_large(pages);
return ERR_PTR(PTR_ERR(p)); return ERR_CAST(p);
} }
static void exynos_gem_put_pages(struct drm_gem_object *obj, static void exynos_gem_put_pages(struct drm_gem_object *obj,
...@@ -662,7 +662,7 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv, ...@@ -662,7 +662,7 @@ int exynos_drm_gem_dumb_create(struct drm_file *file_priv,
*/ */
args->pitch = args->width * ((args->bpp + 7) / 8); args->pitch = args->width * ((args->bpp + 7) / 8);
args->size = PAGE_ALIGN(args->pitch * args->height); args->size = args->pitch * args->height;
exynos_gem_obj = exynos_drm_gem_create(dev, args->flags, args->size); exynos_gem_obj = exynos_drm_gem_create(dev, args->flags, args->size);
if (IS_ERR(exynos_gem_obj)) if (IS_ERR(exynos_gem_obj))
......
...@@ -345,7 +345,7 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev) ...@@ -345,7 +345,7 @@ static int __devinit exynos_drm_hdmi_probe(struct platform_device *pdev)
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); ctx = devm_kzalloc(&pdev->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;
...@@ -371,7 +371,6 @@ static int __devexit exynos_drm_hdmi_remove(struct platform_device *pdev) ...@@ -371,7 +371,6 @@ static int __devexit exynos_drm_hdmi_remove(struct platform_device *pdev)
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
exynos_drm_subdrv_unregister(&ctx->subdrv); exynos_drm_subdrv_unregister(&ctx->subdrv);
kfree(ctx);
return 0; return 0;
} }
......
...@@ -29,7 +29,6 @@ static const uint32_t formats[] = { ...@@ -29,7 +29,6 @@ static const uint32_t formats[] = {
DRM_FORMAT_XRGB8888, DRM_FORMAT_XRGB8888,
DRM_FORMAT_ARGB8888, DRM_FORMAT_ARGB8888,
DRM_FORMAT_NV12, DRM_FORMAT_NV12,
DRM_FORMAT_NV12M,
DRM_FORMAT_NV12MT, DRM_FORMAT_NV12MT,
}; };
......
...@@ -633,7 +633,7 @@ static int __devinit vidi_probe(struct platform_device *pdev) ...@@ -633,7 +633,7 @@ static int __devinit vidi_probe(struct platform_device *pdev)
DRM_DEBUG_KMS("%s\n", __FILE__); DRM_DEBUG_KMS("%s\n", __FILE__);
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
...@@ -673,8 +673,6 @@ static int __devexit vidi_remove(struct platform_device *pdev) ...@@ -673,8 +673,6 @@ static int __devexit vidi_remove(struct platform_device *pdev)
ctx->raw_edid = NULL; ctx->raw_edid = NULL;
} }
kfree(ctx);
return 0; return 0;
} }
......
...@@ -2172,7 +2172,7 @@ static int __devinit hdmi_resources_init(struct hdmi_context *hdata) ...@@ -2172,7 +2172,7 @@ static int __devinit hdmi_resources_init(struct hdmi_context *hdata)
DRM_DEBUG_KMS("HDMI resource init\n"); DRM_DEBUG_KMS("HDMI resource init\n");
memset(res, 0, sizeof *res); memset(res, 0, sizeof(*res));
/* get clocks, power */ /* get clocks, power */
res->hdmi = clk_get(dev, "hdmi"); res->hdmi = clk_get(dev, "hdmi");
...@@ -2204,7 +2204,7 @@ static int __devinit hdmi_resources_init(struct hdmi_context *hdata) ...@@ -2204,7 +2204,7 @@ static int __devinit hdmi_resources_init(struct hdmi_context *hdata)
clk_set_parent(res->sclk_hdmi, res->sclk_pixel); clk_set_parent(res->sclk_hdmi, res->sclk_pixel);
res->regul_bulk = kzalloc(ARRAY_SIZE(supply) * res->regul_bulk = kzalloc(ARRAY_SIZE(supply) *
sizeof res->regul_bulk[0], GFP_KERNEL); sizeof(res->regul_bulk[0]), GFP_KERNEL);
if (!res->regul_bulk) { if (!res->regul_bulk) {
DRM_ERROR("failed to get memory for regulators\n"); DRM_ERROR("failed to get memory for regulators\n");
goto fail; goto fail;
...@@ -2243,7 +2243,7 @@ static int hdmi_resources_cleanup(struct hdmi_context *hdata) ...@@ -2243,7 +2243,7 @@ static int hdmi_resources_cleanup(struct hdmi_context *hdata)
clk_put(res->sclk_hdmi); clk_put(res->sclk_hdmi);
if (!IS_ERR_OR_NULL(res->hdmi)) if (!IS_ERR_OR_NULL(res->hdmi))
clk_put(res->hdmi); clk_put(res->hdmi);
memset(res, 0, sizeof *res); memset(res, 0, sizeof(*res));
return 0; return 0;
} }
...@@ -2312,11 +2312,6 @@ static int __devinit hdmi_probe(struct platform_device *pdev) ...@@ -2312,11 +2312,6 @@ static int __devinit hdmi_probe(struct platform_device *pdev)
} }
res = platform_get_resource(pdev, IORESOURCE_MEM, 0); res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res) {
DRM_ERROR("failed to find registers\n");
ret = -ENOENT;
goto err_resource;
}
hdata->regs = devm_request_and_ioremap(&pdev->dev, res); hdata->regs = devm_request_and_ioremap(&pdev->dev, res);
if (!hdata->regs) { if (!hdata->regs) {
......
...@@ -236,11 +236,11 @@ static inline void vp_filter_set(struct mixer_resources *res, ...@@ -236,11 +236,11 @@ static inline void vp_filter_set(struct mixer_resources *res,
static void vp_default_filter(struct mixer_resources *res) static void vp_default_filter(struct mixer_resources *res)
{ {
vp_filter_set(res, VP_POLY8_Y0_LL, vp_filter_set(res, VP_POLY8_Y0_LL,
filter_y_horiz_tap8, sizeof filter_y_horiz_tap8); filter_y_horiz_tap8, sizeof(filter_y_horiz_tap8));
vp_filter_set(res, VP_POLY4_Y0_LL, vp_filter_set(res, VP_POLY4_Y0_LL,
filter_y_vert_tap4, sizeof filter_y_vert_tap4); filter_y_vert_tap4, sizeof(filter_y_vert_tap4));
vp_filter_set(res, VP_POLY4_C0_LL, vp_filter_set(res, VP_POLY4_C0_LL,
filter_cr_horiz_tap4, sizeof filter_cr_horiz_tap4); filter_cr_horiz_tap4, sizeof(filter_cr_horiz_tap4));
} }
static void mixer_vsync_set_update(struct mixer_context *ctx, bool enable) static void mixer_vsync_set_update(struct mixer_context *ctx, bool enable)
......
...@@ -107,8 +107,7 @@ ...@@ -107,8 +107,7 @@
#define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */ #define DRM_FORMAT_NV16 fourcc_code('N', 'V', '1', '6') /* 2x1 subsampled Cr:Cb plane */
#define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */ #define DRM_FORMAT_NV61 fourcc_code('N', 'V', '6', '1') /* 2x1 subsampled Cb:Cr plane */
/* 2 non contiguous plane YCbCr */ /* special NV12 tiled format */
#define DRM_FORMAT_NV12M fourcc_code('N', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane */
#define DRM_FORMAT_NV12MT fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */ #define DRM_FORMAT_NV12MT fourcc_code('T', 'M', '1', '2') /* 2x2 subsampled Cr:Cb plane 64x32 macroblocks */
/* /*
...@@ -131,7 +130,4 @@ ...@@ -131,7 +130,4 @@
#define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */ #define DRM_FORMAT_YUV444 fourcc_code('Y', 'U', '2', '4') /* non-subsampled Cb (1) and Cr (2) planes */
#define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */ #define DRM_FORMAT_YVU444 fourcc_code('Y', 'V', '2', '4') /* non-subsampled Cr (1) and Cb (2) planes */
/* 3 non contiguous plane YCbCr */
#define DRM_FORMAT_YUV420M fourcc_code('Y', 'M', '1', '2') /* 2x2 subsampled Cb (1) and Cr (2) planes */
#endif /* DRM_FOURCC_H */ #endif /* DRM_FOURCC_H */
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