From 8eed2641df55f7a3e69699b50a63f5705533886f Mon Sep 17 00:00:00 2001 From: Sachin Kamat Date: Mon, 1 Jul 2013 15:15:36 +0900 Subject: of/documentation: Update hpd gpio property for exynos_hdmi Signed-off-by: Sachin Kamat Signed-off-by: Rahul Sharma Signed-off-by: Inki Dae --- Documentation/devicetree/bindings/video/exynos_hdmi.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Documentation/devicetree/bindings/video/exynos_hdmi.txt b/Documentation/devicetree/bindings/video/exynos_hdmi.txt index c71d0f0b750..323983be3c3 100644 --- a/Documentation/devicetree/bindings/video/exynos_hdmi.txt +++ b/Documentation/devicetree/bindings/video/exynos_hdmi.txt @@ -11,9 +11,7 @@ Required properties: - hpd-gpio: following information about the hotplug gpio pin. a) phandle of the gpio controller node. b) pin number within the gpio controller. - c) pin function mode. - d) optional flags and pull up/down. - e) drive strength. + c) optional flags and pull up/down. Example: @@ -21,5 +19,5 @@ Example: compatible = "samsung,exynos4212-hdmi"; reg = <0x14530000 0x100000>; interrupts = <0 95 0>; - hpd-gpio = <&gpx3 7 0xf 1 3>; + hpd-gpio = <&gpx3 7 1>; }; -- cgit v1.2.3-70-g09d2 From c58c1599cd5c97977c44047272b56b4db455bbba Mon Sep 17 00:00:00 2001 From: YoungJun Cho Date: Mon, 1 Jul 2013 11:17:12 +0900 Subject: drm/exynos: fix not to remain exynos_gem_obj as a leak The exynos_drm_gem_create() only calls drm_gem_object_release() when exynos_drm_alloc_buf() is failed, and exynos_gem_obj remains as a leak, which is allocated in exynos_drm_gem_init(). So this patch fixes it not to remain as a leak. Signed-off-by: YoungJun Cho Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin Park Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_gem.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_gem.c b/drivers/gpu/drm/exynos/exynos_drm_gem.c index c3f15e7646d..24c22a8c336 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_gem.c +++ b/drivers/gpu/drm/exynos/exynos_drm_gem.c @@ -246,13 +246,14 @@ struct exynos_drm_gem_obj *exynos_drm_gem_create(struct drm_device *dev, exynos_gem_obj->flags = flags; ret = exynos_drm_alloc_buf(dev, buf, flags); - if (ret < 0) { - drm_gem_object_release(&exynos_gem_obj->base); - goto err_fini_buf; - } + if (ret < 0) + goto err_gem_fini; return exynos_gem_obj; +err_gem_fini: + drm_gem_object_release(&exynos_gem_obj->base); + kfree(exynos_gem_obj); err_fini_buf: exynos_drm_fini_buf(dev, buf); return ERR_PTR(ret); -- cgit v1.2.3-70-g09d2 From cbb28bb09d41872909fdbd4ba56eb1ba55146c03 Mon Sep 17 00:00:00 2001 From: YoungJun Cho Date: Mon, 1 Jul 2013 13:03:39 +0900 Subject: drm/exynos: remove dead code in vidi_power_on The type of input parameter enable is bool, so it does not need to check whether true or false. Signed-off-by: YoungJun Cho Signed-off-by: Kyungmin Park Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_vidi.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 784bbce0741..41cc74d83e4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c @@ -413,9 +413,6 @@ static int vidi_power_on(struct vidi_context *ctx, bool enable) struct exynos_drm_subdrv *subdrv = &ctx->subdrv; struct device *dev = subdrv->dev; - if (enable != false && enable != true) - return -EINVAL; - if (enable) { ctx->suspended = false; -- cgit v1.2.3-70-g09d2 From 782953ece3d102ccb31df87ecfeeb96064126afb Mon Sep 17 00:00:00 2001 From: YoungJun Cho Date: Mon, 1 Jul 2013 13:04:12 +0900 Subject: drm/exynos: initialize the buf_num in vp_video_buffer The buf_num in vp_video_buffer() should be 1 or 2, but it is not initialized, and only set to 2 in NV12M or NV12MT cases. So this patch initializes the buf_num with 1 as default. Signed-off-by: YoungJun Cho Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin Park Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_mixer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index b1280b43931..42ffb71c63b 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c @@ -379,7 +379,7 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) unsigned long flags; struct hdmi_win_data *win_data; unsigned int x_ratio, y_ratio; - unsigned int buf_num; + unsigned int buf_num = 1; dma_addr_t luma_addr[2], chroma_addr[2]; bool tiled_mode = false; bool crcb_mode = false; -- cgit v1.2.3-70-g09d2 From ba3706c0f19ab77593b8b3be6649746ac56905d3 Mon Sep 17 00:00:00 2001 From: YoungJun Cho Date: Mon, 1 Jul 2013 17:00:47 +0900 Subject: drm/exynos: add error check routine in exynos_drm_open When the exynos_drm_subdrv_open() returns error, the file_priv should be released and file->driver_priv set to NULL. Signed-off-by: YoungJun Cho Signed-off-by: Kyungmin Park Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_drv.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 276237348d1..ca2729a8512 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c @@ -155,6 +155,7 @@ static int exynos_drm_unload(struct drm_device *dev) static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) { struct drm_exynos_file_private *file_priv; + int ret; file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL); if (!file_priv) @@ -162,7 +163,13 @@ static int exynos_drm_open(struct drm_device *dev, struct drm_file *file) file->driver_priv = file_priv; - return exynos_drm_subdrv_open(dev, file); + ret = exynos_drm_subdrv_open(dev, file); + if (ret) { + kfree(file_priv); + file->driver_priv = NULL; + } + + return ret; } static void exynos_drm_preclose(struct drm_device *dev, -- cgit v1.2.3-70-g09d2 From af51a5e7068826fe5016ab38149243bacc449233 Mon Sep 17 00:00:00 2001 From: YoungJun Cho Date: Wed, 3 Jul 2013 17:09:19 +0900 Subject: drm/exynos: use drm_calloc_large when allocates pointer array If the type of object is pointer array, the drm_calloc_large() is more suitable than kzalloc() for its allocation function. And uses drm_free_large() instead of kfree() also. Signed-off-by: YoungJun Cho Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin Park Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_buf.c | 9 ++++----- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 6 +++--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 22865baa03b..245c9ae187a 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c @@ -57,8 +57,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, dma_addr_t start_addr; unsigned int i = 0; - buf->pages = kzalloc(sizeof(struct page) * nr_pages, - GFP_KERNEL); + buf->pages = drm_calloc_large(nr_pages, sizeof(struct page)); if (!buf->pages) { DRM_ERROR("failed to allocate pages.\n"); return -ENOMEM; @@ -69,7 +68,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, &buf->dma_attrs); if (!buf->kvaddr) { DRM_ERROR("failed to allocate buffer.\n"); - kfree(buf->pages); + drm_free_large(buf->pages); return -ENOMEM; } @@ -109,7 +108,7 @@ err_free_attrs: buf->dma_addr = (dma_addr_t)NULL; if (!is_drm_iommu_supported(dev)) - kfree(buf->pages); + drm_free_large(buf->pages); return ret; } @@ -134,7 +133,7 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, if (!is_drm_iommu_supported(dev)) { dma_free_attrs(dev->dev, buf->size, buf->kvaddr, (dma_addr_t)buf->dma_addr, &buf->dma_attrs); - kfree(buf->pages); + drm_free_large(buf->pages); } else dma_free_attrs(dev->dev, buf->size, buf->pages, (dma_addr_t)buf->dma_addr, &buf->dma_attrs); diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index af75434ee4d..fb19ee53ecb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -390,7 +390,7 @@ out: kfree(g2d_userptr->sgt); g2d_userptr->sgt = NULL; - kfree(g2d_userptr->pages); + drm_free_large(g2d_userptr->pages); g2d_userptr->pages = NULL; kfree(g2d_userptr); g2d_userptr = NULL; @@ -463,7 +463,7 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, npages = (end - start) >> PAGE_SHIFT; g2d_userptr->npages = npages; - pages = kzalloc(npages * sizeof(struct page *), GFP_KERNEL); + pages = drm_calloc_large(npages, sizeof(struct page *)); if (!pages) { DRM_ERROR("failed to allocate pages.\n"); kfree(g2d_userptr); @@ -554,7 +554,7 @@ err_put_vma: exynos_gem_put_vma(g2d_userptr->vma); err_free_pages: - kfree(pages); + drm_free_large(pages); kfree(g2d_userptr); pages = NULL; g2d_userptr = NULL; -- cgit v1.2.3-70-g09d2 From 42ac99a72041a3515bd2b205adb9a239b49c6741 Mon Sep 17 00:00:00 2001 From: YoungJun Cho Date: Wed, 3 Jul 2013 17:09:20 +0900 Subject: drm/exynos: fix pages allocation size in lowlevel_buffer_allocate When IOMMU is not supported, buf->pages has to be allocated to assign the result of phys_to_page() which return type is struct page *. So it is sufficient to allocate buf->pages with the size of multiple struct page pointers. Signed-off-by: YoungJun Cho Signed-off-by: Seung-Woo Kim Signed-off-by: Kyungmin Park Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 245c9ae187a..518b6d8e062 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c @@ -57,7 +57,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, dma_addr_t start_addr; unsigned int i = 0; - buf->pages = drm_calloc_large(nr_pages, sizeof(struct page)); + buf->pages = drm_calloc_large(nr_pages, sizeof(struct page *)); if (!buf->pages) { DRM_ERROR("failed to allocate pages.\n"); return -ENOMEM; -- cgit v1.2.3-70-g09d2 From 4bb615c5fbb4f3ea0f197dfe4fb07a9e4ec2a755 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Wed, 3 Jul 2013 17:09:21 +0900 Subject: drm/exynos: remove duplicated error routine and unnecessary assign There were duplicated error handling routines during allocating pages in lowlevel_buffer_allocate() and g2d_userptr_get_dma_addr(). Also unnecessary NULL assignments for variable used not any more are removed from g2d_userptr_get_dma_addr() and g2d_userptr_put_dma_addr(). Signed-off-by: Seung-Woo Kim Signed-off-by: YoungJun Cho Signed-off-by: Kyungmin Park Signed-off-by: Inki Dae --- drivers/gpu/drm/exynos/exynos_drm_buf.c | 6 +++--- drivers/gpu/drm/exynos/exynos_drm_g2d.c | 12 ++++-------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_buf.c b/drivers/gpu/drm/exynos/exynos_drm_buf.c index 518b6d8e062..b8ac06d92fb 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_buf.c +++ b/drivers/gpu/drm/exynos/exynos_drm_buf.c @@ -68,8 +68,8 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, &buf->dma_attrs); if (!buf->kvaddr) { DRM_ERROR("failed to allocate buffer.\n"); - drm_free_large(buf->pages); - return -ENOMEM; + ret = -ENOMEM; + goto err_free; } start_addr = buf->dma_addr; @@ -106,7 +106,7 @@ err_free_attrs: dma_free_attrs(dev->dev, buf->size, buf->pages, (dma_addr_t)buf->dma_addr, &buf->dma_attrs); buf->dma_addr = (dma_addr_t)NULL; - +err_free: if (!is_drm_iommu_supported(dev)) drm_free_large(buf->pages); diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c index fb19ee53ecb..42a5a546607 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c @@ -388,12 +388,9 @@ out: sg_free_table(g2d_userptr->sgt); kfree(g2d_userptr->sgt); - g2d_userptr->sgt = NULL; drm_free_large(g2d_userptr->pages); - g2d_userptr->pages = NULL; kfree(g2d_userptr); - g2d_userptr = NULL; } static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, @@ -466,8 +463,8 @@ static dma_addr_t *g2d_userptr_get_dma_addr(struct drm_device *drm_dev, pages = drm_calloc_large(npages, sizeof(struct page *)); if (!pages) { DRM_ERROR("failed to allocate pages.\n"); - kfree(g2d_userptr); - return ERR_PTR(-ENOMEM); + ret = -ENOMEM; + goto err_free; } vma = find_vma(current->mm, userptr); @@ -543,7 +540,6 @@ err_sg_free_table: err_free_sgt: kfree(sgt); - sgt = NULL; err_free_userptr: exynos_gem_put_pages_to_userptr(g2d_userptr->pages, @@ -555,9 +551,9 @@ err_put_vma: err_free_pages: drm_free_large(pages); + +err_free: kfree(g2d_userptr); - pages = NULL; - g2d_userptr = NULL; return ERR_PTR(ret); } -- cgit v1.2.3-70-g09d2