Commit ca5c8a4c authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux

Pull drm update from Dave Airlie:
 "Exynos and Radeon mostly, with a dma-buf and ttm fix thrown in.

  It's a bit big but its mostly exynos license fix ups and I'd rather
  not hold those up since its legally stuff.

  Radeon has a couple of fixes from dma engine work, TTM is just a
  locking fix, and dma-buf fix has been hanging around and I finally got
  a chance to review it."

* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux: (30 commits)
  drm/ttm: fix fence locking in ttm_buffer_object_transfer
  drm/prime: drop reference on imported dma-buf come from gem
  drm/radeon: add quirk for d3 delay during switcheroo poweron for apple macbooks
  drm/exynos: move finish page flip to a common place
  drm/exynos: fimd: modify condition in fimd resume
  drm/radeon: fix DMA CS parser for r6xx linear copy packet
  drm/radeon: split r6xx and r7xx copy_dma functions
  drm/exynos: Use devm_clk_get in exynos_drm_gsc.c
  drm/exynos: Remove redundant NULL check in exynos_drm_gsc.c
  drm/exynos: Remove explicit freeing using devm_* APIs in exynos_drm_gsc.c
  drm/exynos: Use devm_clk_get in exynos_drm_rotator.c
  drm/exynos: Remove redundant NULL check in exynos_drm_rotator.c
  drm/exynos: Remove unnecessary devm_* freeing APIs in exynos_drm_rotator.c
  drm/exynos: Use devm_clk_get in exynos_drm_fimc.c
  drm/exynos: Remove redundant NULL check
  drm/exynos: Remove explicit freeing using devm_* APIs in exynos_drm_fimc.c
  drm/exynos: Use devm_kzalloc in exynos_drm_ipp.c
  drm/exynos: fix gem buffer allocation type checking
  drm/exynos: remove needless parenthesis.
  drm/exynos: fix incorrect interrupt induced by m2m operation.
  ...
parents ed2c8911 e8e89622
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2011 Samsung Electronics Co., Ltd. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
* Author: Inki Dae <inki.dae@samsung.com> * Author: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
...@@ -29,6 +15,7 @@ ...@@ -29,6 +15,7 @@
#include "exynos_drm_drv.h" #include "exynos_drm_drv.h"
#include "exynos_drm_gem.h" #include "exynos_drm_gem.h"
#include "exynos_drm_buf.h" #include "exynos_drm_buf.h"
#include "exynos_drm_iommu.h"
static int lowlevel_buffer_allocate(struct drm_device *dev, static int lowlevel_buffer_allocate(struct drm_device *dev,
unsigned int flags, struct exynos_drm_gem_buf *buf) unsigned int flags, struct exynos_drm_gem_buf *buf)
...@@ -51,7 +38,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, ...@@ -51,7 +38,7 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
* region will be allocated else physically contiguous * region will be allocated else physically contiguous
* as possible. * as possible.
*/ */
if (flags & EXYNOS_BO_CONTIG) if (!(flags & EXYNOS_BO_NONCONTIG))
dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs); dma_set_attr(DMA_ATTR_FORCE_CONTIGUOUS, &buf->dma_attrs);
/* /*
...@@ -66,14 +53,45 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, ...@@ -66,14 +53,45 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
dma_set_attr(attr, &buf->dma_attrs); dma_set_attr(attr, &buf->dma_attrs);
dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->dma_attrs); dma_set_attr(DMA_ATTR_NO_KERNEL_MAPPING, &buf->dma_attrs);
buf->pages = dma_alloc_attrs(dev->dev, buf->size, nr_pages = buf->size >> PAGE_SHIFT;
&buf->dma_addr, GFP_KERNEL, &buf->dma_attrs);
if (!buf->pages) { if (!is_drm_iommu_supported(dev)) {
DRM_ERROR("failed to allocate buffer.\n"); dma_addr_t start_addr;
return -ENOMEM; unsigned int i = 0;
buf->pages = kzalloc(sizeof(struct page) * nr_pages,
GFP_KERNEL);
if (!buf->pages) {
DRM_ERROR("failed to allocate pages.\n");
return -ENOMEM;
}
buf->kvaddr = dma_alloc_attrs(dev->dev, buf->size,
&buf->dma_addr, GFP_KERNEL,
&buf->dma_attrs);
if (!buf->kvaddr) {
DRM_ERROR("failed to allocate buffer.\n");
kfree(buf->pages);
return -ENOMEM;
}
start_addr = buf->dma_addr;
while (i < nr_pages) {
buf->pages[i] = phys_to_page(start_addr);
start_addr += PAGE_SIZE;
i++;
}
} else {
buf->pages = dma_alloc_attrs(dev->dev, buf->size,
&buf->dma_addr, GFP_KERNEL,
&buf->dma_attrs);
if (!buf->pages) {
DRM_ERROR("failed to allocate buffer.\n");
return -ENOMEM;
}
} }
nr_pages = buf->size >> PAGE_SHIFT;
buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages); buf->sgt = drm_prime_pages_to_sg(buf->pages, nr_pages);
if (!buf->sgt) { if (!buf->sgt) {
DRM_ERROR("failed to get sg table.\n"); DRM_ERROR("failed to get sg table.\n");
...@@ -92,6 +110,9 @@ static int lowlevel_buffer_allocate(struct drm_device *dev, ...@@ -92,6 +110,9 @@ static int lowlevel_buffer_allocate(struct drm_device *dev,
(dma_addr_t)buf->dma_addr, &buf->dma_attrs); (dma_addr_t)buf->dma_addr, &buf->dma_attrs);
buf->dma_addr = (dma_addr_t)NULL; buf->dma_addr = (dma_addr_t)NULL;
if (!is_drm_iommu_supported(dev))
kfree(buf->pages);
return ret; return ret;
} }
...@@ -114,8 +135,14 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev, ...@@ -114,8 +135,14 @@ static void lowlevel_buffer_deallocate(struct drm_device *dev,
kfree(buf->sgt); kfree(buf->sgt);
buf->sgt = NULL; buf->sgt = NULL;
dma_free_attrs(dev->dev, buf->size, buf->pages, if (!is_drm_iommu_supported(dev)) {
dma_free_attrs(dev->dev, buf->size, buf->kvaddr,
(dma_addr_t)buf->dma_addr, &buf->dma_attrs); (dma_addr_t)buf->dma_addr, &buf->dma_attrs);
kfree(buf->pages);
} else
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; buf->dma_addr = (dma_addr_t)NULL;
} }
......
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2011 Samsung Electronics Co., Ltd. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
* Author: Inki Dae <inki.dae@samsung.com> * Author: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_BUF_H_ #ifndef _EXYNOS_DRM_BUF_H_
......
...@@ -5,24 +5,10 @@ ...@@ -5,24 +5,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
......
...@@ -5,24 +5,10 @@ ...@@ -5,24 +5,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_CONNECTOR_H_ #ifndef _EXYNOS_DRM_CONNECTOR_H_
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
...@@ -407,3 +393,33 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc) ...@@ -407,3 +393,33 @@ void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc)
exynos_drm_fn_encoder(private->crtc[crtc], &crtc, exynos_drm_fn_encoder(private->crtc[crtc], &crtc,
exynos_drm_disable_vblank); exynos_drm_disable_vblank);
} }
void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc)
{
struct exynos_drm_private *dev_priv = dev->dev_private;
struct drm_pending_vblank_event *e, *t;
struct timeval now;
unsigned long flags;
DRM_DEBUG_KMS("%s\n", __FILE__);
spin_lock_irqsave(&dev->event_lock, flags);
list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list,
base.link) {
/* if event's pipe isn't same as crtc then ignore it. */
if (crtc != e->pipe)
continue;
do_gettimeofday(&now);
e->event.sequence = 0;
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);
}
spin_unlock_irqrestore(&dev->event_lock, flags);
}
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_CRTC_H_ #ifndef _EXYNOS_DRM_CRTC_H_
...@@ -32,5 +18,6 @@ ...@@ -32,5 +18,6 @@
int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr); int exynos_drm_crtc_create(struct drm_device *dev, unsigned int nr);
int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc); int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int crtc);
void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc); void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int crtc);
void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int crtc);
#endif #endif
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2012 Samsung Electronics Co., Ltd. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
* Author: Inki Dae <inki.dae@samsung.com> * Author: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
...@@ -222,7 +208,7 @@ struct dma_buf *exynos_dmabuf_prime_export(struct drm_device *drm_dev, ...@@ -222,7 +208,7 @@ struct dma_buf *exynos_dmabuf_prime_export(struct drm_device *drm_dev,
struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj); struct exynos_drm_gem_obj *exynos_gem_obj = to_exynos_gem_obj(obj);
return dma_buf_export(exynos_gem_obj, &exynos_dmabuf_ops, return dma_buf_export(exynos_gem_obj, &exynos_dmabuf_ops,
exynos_gem_obj->base.size, 0600); exynos_gem_obj->base.size, flags);
} }
struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
...@@ -246,7 +232,12 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev, ...@@ -246,7 +232,12 @@ struct drm_gem_object *exynos_dmabuf_prime_import(struct drm_device *drm_dev,
/* is it from our device? */ /* is it from our device? */
if (obj->dev == drm_dev) { if (obj->dev == drm_dev) {
/*
* Importing dmabuf exported from out own gem increases
* refcount on gem itself instead of f_count of dmabuf.
*/
drm_gem_object_reference(obj); drm_gem_object_reference(obj);
dma_buf_put(dma_buf);
return obj; return obj;
} }
} }
......
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2012 Samsung Electronics Co., Ltd. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
* Author: Inki Dae <inki.dae@samsung.com> * Author: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_DMABUF_H_ #ifndef _EXYNOS_DRM_DMABUF_H_
......
...@@ -5,24 +5,10 @@ ...@@ -5,24 +5,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_DRV_H_ #ifndef _EXYNOS_DRM_DRV_H_
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
......
...@@ -5,24 +5,10 @@ ...@@ -5,24 +5,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_ENCODER_H_ #ifndef _EXYNOS_DRM_ENCODER_H_
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
......
...@@ -5,24 +5,10 @@ ...@@ -5,24 +5,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_FB_H_ #ifndef _EXYNOS_DRM_FB_H_
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
...@@ -34,6 +20,7 @@ ...@@ -34,6 +20,7 @@
#include "exynos_drm_drv.h" #include "exynos_drm_drv.h"
#include "exynos_drm_fb.h" #include "exynos_drm_fb.h"
#include "exynos_drm_gem.h" #include "exynos_drm_gem.h"
#include "exynos_drm_iommu.h"
#define MAX_CONNECTOR 4 #define MAX_CONNECTOR 4
#define PREFERRED_BPP 32 #define PREFERRED_BPP 32
...@@ -111,9 +98,18 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, ...@@ -111,9 +98,18 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
/* map pages with kernel virtual space. */ /* map pages with kernel virtual space. */
if (!buffer->kvaddr) { if (!buffer->kvaddr) {
unsigned int nr_pages = buffer->size >> PAGE_SHIFT; if (is_drm_iommu_supported(dev)) {
buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP, unsigned int nr_pages = buffer->size >> PAGE_SHIFT;
buffer->kvaddr = vmap(buffer->pages, nr_pages, VM_MAP,
pgprot_writecombine(PAGE_KERNEL)); pgprot_writecombine(PAGE_KERNEL));
} else {
phys_addr_t dma_addr = buffer->dma_addr;
if (dma_addr)
buffer->kvaddr = phys_to_virt(dma_addr);
else
buffer->kvaddr = (void __iomem *)NULL;
}
if (!buffer->kvaddr) { if (!buffer->kvaddr) {
DRM_ERROR("failed to map pages to kernel space.\n"); DRM_ERROR("failed to map pages to kernel space.\n");
return -EIO; return -EIO;
...@@ -128,8 +124,12 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper, ...@@ -128,8 +124,12 @@ static int exynos_drm_fbdev_update(struct drm_fb_helper *helper,
dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr; dev->mode_config.fb_base = (resource_size_t)buffer->dma_addr;
fbi->screen_base = buffer->kvaddr + offset; fbi->screen_base = buffer->kvaddr + offset;
fbi->fix.smem_start = (unsigned long) if (is_drm_iommu_supported(dev))
fbi->fix.smem_start = (unsigned long)
(page_to_phys(sg_page(buffer->sgt->sgl)) + offset); (page_to_phys(sg_page(buffer->sgt->sgl)) + offset);
else
fbi->fix.smem_start = (unsigned long)buffer->dma_addr;
fbi->screen_size = size; fbi->screen_size = size;
fbi->fix.smem_len = size; fbi->fix.smem_len = size;
...@@ -320,7 +320,7 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev, ...@@ -320,7 +320,7 @@ static void exynos_drm_fbdev_destroy(struct drm_device *dev,
struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj; struct exynos_drm_gem_obj *exynos_gem_obj = exynos_fbd->exynos_gem_obj;
struct drm_framebuffer *fb; struct drm_framebuffer *fb;
if (exynos_gem_obj->buffer->kvaddr) if (is_drm_iommu_supported(dev) && exynos_gem_obj->buffer->kvaddr)
vunmap(exynos_gem_obj->buffer->kvaddr); vunmap(exynos_gem_obj->buffer->kvaddr);
/* release drm framebuffer and real buffer */ /* release drm framebuffer and real buffer */
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_FBDEV_H_ #ifndef _EXYNOS_DRM_FBDEV_H_
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "exynos_drm_fimc.h" #include "exynos_drm_fimc.h"
/* /*
* FIMC is stand for Fully Interactive Mobile Camera and * FIMC stands for Fully Interactive Mobile Camera and
* supports image scaler/rotator and input/output DMA operations. * supports image scaler/rotator and input/output DMA operations.
* input DMA reads image data from the memory. * input DMA reads image data from the memory.
* output DMA writes image data to memory. * output DMA writes image data to memory.
...@@ -163,19 +163,29 @@ struct fimc_context { ...@@ -163,19 +163,29 @@ struct fimc_context {
bool suspended; bool suspended;
}; };
static void fimc_sw_reset(struct fimc_context *ctx, bool pattern) static void fimc_sw_reset(struct fimc_context *ctx)
{ {
u32 cfg; u32 cfg;
DRM_DEBUG_KMS("%s:pattern[%d]\n", __func__, pattern); DRM_DEBUG_KMS("%s\n", __func__);
/* stop dma operation */
cfg = fimc_read(EXYNOS_CISTATUS);
if (EXYNOS_CISTATUS_GET_ENVID_STATUS(cfg)) {
cfg = fimc_read(EXYNOS_MSCTRL);
cfg &= ~EXYNOS_MSCTRL_ENVID;
fimc_write(cfg, EXYNOS_MSCTRL);
}
cfg = fimc_read(EXYNOS_CISRCFMT); cfg = fimc_read(EXYNOS_CISRCFMT);
cfg |= EXYNOS_CISRCFMT_ITU601_8BIT; cfg |= EXYNOS_CISRCFMT_ITU601_8BIT;
if (pattern)
cfg |= EXYNOS_CIGCTRL_TESTPATTERN_COLOR_BAR;
fimc_write(cfg, EXYNOS_CISRCFMT); fimc_write(cfg, EXYNOS_CISRCFMT);
/* disable image capture */
cfg = fimc_read(EXYNOS_CIIMGCPT);
cfg &= ~(EXYNOS_CIIMGCPT_IMGCPTEN_SC | EXYNOS_CIIMGCPT_IMGCPTEN);
fimc_write(cfg, EXYNOS_CIIMGCPT);
/* s/w reset */ /* s/w reset */
cfg = fimc_read(EXYNOS_CIGCTRL); cfg = fimc_read(EXYNOS_CIGCTRL);
cfg |= (EXYNOS_CIGCTRL_SWRST); cfg |= (EXYNOS_CIGCTRL_SWRST);
...@@ -695,7 +705,7 @@ static int fimc_src_set_addr(struct device *dev, ...@@ -695,7 +705,7 @@ static int fimc_src_set_addr(struct device *dev,
{ {
struct fimc_context *ctx = get_fimc_context(dev); struct fimc_context *ctx = get_fimc_context(dev);
struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_property *property;
struct drm_exynos_ipp_config *config; struct drm_exynos_ipp_config *config;
...@@ -705,10 +715,6 @@ static int fimc_src_set_addr(struct device *dev, ...@@ -705,10 +715,6 @@ static int fimc_src_set_addr(struct device *dev,
} }
property = &c_node->property; property = &c_node->property;
if (!property) {
DRM_ERROR("failed to get property.\n");
return -EINVAL;
}
DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__,
property->prop_id, buf_id, buf_type); property->prop_id, buf_id, buf_type);
...@@ -1206,7 +1212,7 @@ static int fimc_dst_set_buf_seq(struct fimc_context *ctx, u32 buf_id, ...@@ -1206,7 +1212,7 @@ static int fimc_dst_set_buf_seq(struct fimc_context *ctx, u32 buf_id,
} }
/* sequence id */ /* sequence id */
cfg &= (~mask); cfg &= ~mask;
cfg |= (enable << buf_id); cfg |= (enable << buf_id);
fimc_write(cfg, EXYNOS_CIFCNTSEQ); fimc_write(cfg, EXYNOS_CIFCNTSEQ);
...@@ -1231,7 +1237,7 @@ static int fimc_dst_set_addr(struct device *dev, ...@@ -1231,7 +1237,7 @@ static int fimc_dst_set_addr(struct device *dev,
{ {
struct fimc_context *ctx = get_fimc_context(dev); struct fimc_context *ctx = get_fimc_context(dev);
struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_property *property;
struct drm_exynos_ipp_config *config; struct drm_exynos_ipp_config *config;
...@@ -1241,10 +1247,6 @@ static int fimc_dst_set_addr(struct device *dev, ...@@ -1241,10 +1247,6 @@ static int fimc_dst_set_addr(struct device *dev,
} }
property = &c_node->property; property = &c_node->property;
if (!property) {
DRM_ERROR("failed to get property.\n");
return -EINVAL;
}
DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__,
property->prop_id, buf_id, buf_type); property->prop_id, buf_id, buf_type);
...@@ -1317,7 +1319,7 @@ static irqreturn_t fimc_irq_handler(int irq, void *dev_id) ...@@ -1317,7 +1319,7 @@ static irqreturn_t fimc_irq_handler(int irq, void *dev_id)
{ {
struct fimc_context *ctx = dev_id; struct fimc_context *ctx = dev_id;
struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
struct drm_exynos_ipp_event_work *event_work = struct drm_exynos_ipp_event_work *event_work =
c_node->event_work; c_node->event_work;
int buf_id; int buf_id;
...@@ -1395,6 +1397,7 @@ static inline bool fimc_check_drm_flip(enum drm_exynos_flip flip) ...@@ -1395,6 +1397,7 @@ static inline bool fimc_check_drm_flip(enum drm_exynos_flip flip)
case EXYNOS_DRM_FLIP_NONE: case EXYNOS_DRM_FLIP_NONE:
case EXYNOS_DRM_FLIP_VERTICAL: case EXYNOS_DRM_FLIP_VERTICAL:
case EXYNOS_DRM_FLIP_HORIZONTAL: case EXYNOS_DRM_FLIP_HORIZONTAL:
case EXYNOS_DRM_FLIP_BOTH:
return true; return true;
default: default:
DRM_DEBUG_KMS("%s:invalid flip\n", __func__); DRM_DEBUG_KMS("%s:invalid flip\n", __func__);
...@@ -1543,7 +1546,7 @@ static int fimc_ippdrv_reset(struct device *dev) ...@@ -1543,7 +1546,7 @@ static int fimc_ippdrv_reset(struct device *dev)
DRM_DEBUG_KMS("%s\n", __func__); DRM_DEBUG_KMS("%s\n", __func__);
/* reset h/w block */ /* reset h/w block */
fimc_sw_reset(ctx, false); fimc_sw_reset(ctx);
/* reset scaler capability */ /* reset scaler capability */
memset(&ctx->sc, 0x0, sizeof(ctx->sc)); memset(&ctx->sc, 0x0, sizeof(ctx->sc));
...@@ -1557,7 +1560,7 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) ...@@ -1557,7 +1560,7 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
{ {
struct fimc_context *ctx = get_fimc_context(dev); struct fimc_context *ctx = get_fimc_context(dev);
struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_property *property;
struct drm_exynos_ipp_config *config; struct drm_exynos_ipp_config *config;
struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX]; struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX];
...@@ -1573,10 +1576,6 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) ...@@ -1573,10 +1576,6 @@ static int fimc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
} }
property = &c_node->property; property = &c_node->property;
if (!property) {
DRM_ERROR("failed to get property.\n");
return -EINVAL;
}
fimc_handle_irq(ctx, true, false, true); fimc_handle_irq(ctx, true, false, true);
...@@ -1739,93 +1738,64 @@ static int fimc_probe(struct platform_device *pdev) ...@@ -1739,93 +1738,64 @@ static int fimc_probe(struct platform_device *pdev)
platform_get_device_id(pdev)->driver_data; platform_get_device_id(pdev)->driver_data;
/* clock control */ /* clock control */
ctx->sclk_fimc_clk = clk_get(dev, "sclk_fimc"); ctx->sclk_fimc_clk = devm_clk_get(dev, "sclk_fimc");
if (IS_ERR(ctx->sclk_fimc_clk)) { if (IS_ERR(ctx->sclk_fimc_clk)) {
dev_err(dev, "failed to get src fimc clock.\n"); dev_err(dev, "failed to get src fimc clock.\n");
ret = PTR_ERR(ctx->sclk_fimc_clk); return PTR_ERR(ctx->sclk_fimc_clk);
goto err_ctx;
} }
clk_enable(ctx->sclk_fimc_clk); clk_enable(ctx->sclk_fimc_clk);
ctx->fimc_clk = clk_get(dev, "fimc"); ctx->fimc_clk = devm_clk_get(dev, "fimc");
if (IS_ERR(ctx->fimc_clk)) { if (IS_ERR(ctx->fimc_clk)) {
dev_err(dev, "failed to get fimc clock.\n"); dev_err(dev, "failed to get fimc clock.\n");
ret = PTR_ERR(ctx->fimc_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); return PTR_ERR(ctx->fimc_clk);
goto err_ctx;
} }
ctx->wb_clk = clk_get(dev, "pxl_async0"); ctx->wb_clk = devm_clk_get(dev, "pxl_async0");
if (IS_ERR(ctx->wb_clk)) { if (IS_ERR(ctx->wb_clk)) {
dev_err(dev, "failed to get writeback a clock.\n"); dev_err(dev, "failed to get writeback a clock.\n");
ret = PTR_ERR(ctx->wb_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); return PTR_ERR(ctx->wb_clk);
clk_put(ctx->fimc_clk);
goto err_ctx;
} }
ctx->wb_b_clk = clk_get(dev, "pxl_async1"); ctx->wb_b_clk = devm_clk_get(dev, "pxl_async1");
if (IS_ERR(ctx->wb_b_clk)) { if (IS_ERR(ctx->wb_b_clk)) {
dev_err(dev, "failed to get writeback b clock.\n"); dev_err(dev, "failed to get writeback b clock.\n");
ret = PTR_ERR(ctx->wb_b_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); return PTR_ERR(ctx->wb_b_clk);
clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk);
goto err_ctx;
} }
parent_clk = clk_get(dev, ddata->parent_clk); parent_clk = devm_clk_get(dev, ddata->parent_clk);
if (IS_ERR(parent_clk)) { if (IS_ERR(parent_clk)) {
dev_err(dev, "failed to get parent clock.\n"); dev_err(dev, "failed to get parent clock.\n");
ret = PTR_ERR(parent_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); return PTR_ERR(parent_clk);
clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk);
clk_put(ctx->wb_b_clk);
goto err_ctx;
} }
if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) { if (clk_set_parent(ctx->sclk_fimc_clk, parent_clk)) {
dev_err(dev, "failed to set parent.\n"); dev_err(dev, "failed to set parent.\n");
ret = -EINVAL;
clk_put(parent_clk);
clk_disable(ctx->sclk_fimc_clk); clk_disable(ctx->sclk_fimc_clk);
clk_put(ctx->sclk_fimc_clk); return -EINVAL;
clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk);
clk_put(ctx->wb_b_clk);
goto err_ctx;
} }
clk_put(parent_clk); devm_clk_put(dev, parent_clk);
clk_set_rate(ctx->sclk_fimc_clk, pdata->clk_rate); clk_set_rate(ctx->sclk_fimc_clk, pdata->clk_rate);
/* resource memory */ /* resource memory */
ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!ctx->regs_res) {
dev_err(dev, "failed to find registers.\n");
ret = -ENOENT;
goto err_clk;
}
ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res); ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
if (!ctx->regs) { if (!ctx->regs) {
dev_err(dev, "failed to map registers.\n"); dev_err(dev, "failed to map registers.\n");
ret = -ENXIO; return -ENXIO;
goto err_clk;
} }
/* resource irq */ /* resource irq */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) { if (!res) {
dev_err(dev, "failed to request irq resource.\n"); dev_err(dev, "failed to request irq resource.\n");
ret = -ENOENT; return -ENOENT;
goto err_get_regs;
} }
ctx->irq = res->start; ctx->irq = res->start;
...@@ -1833,7 +1803,7 @@ static int fimc_probe(struct platform_device *pdev) ...@@ -1833,7 +1803,7 @@ static int fimc_probe(struct platform_device *pdev)
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");
goto err_get_regs; return ret;
} }
/* context initailization */ /* context initailization */
...@@ -1879,15 +1849,7 @@ static int fimc_probe(struct platform_device *pdev) ...@@ -1879,15 +1849,7 @@ static int fimc_probe(struct platform_device *pdev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_get_irq: err_get_irq:
free_irq(ctx->irq, ctx); free_irq(ctx->irq, ctx);
err_get_regs:
devm_iounmap(dev, ctx->regs);
err_clk:
clk_put(ctx->sclk_fimc_clk);
clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk);
clk_put(ctx->wb_b_clk);
err_ctx:
devm_kfree(dev, ctx);
return ret; return ret;
} }
...@@ -1905,14 +1867,6 @@ static int fimc_remove(struct platform_device *pdev) ...@@ -1905,14 +1867,6 @@ static int fimc_remove(struct platform_device *pdev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
free_irq(ctx->irq, ctx); free_irq(ctx->irq, ctx);
devm_iounmap(dev, ctx->regs);
clk_put(ctx->sclk_fimc_clk);
clk_put(ctx->fimc_clk);
clk_put(ctx->wb_clk);
clk_put(ctx->wb_b_clk);
devm_kfree(dev, ctx);
return 0; return 0;
} }
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Jinyoung Jeon <jy0.jeon@samsung.com> * Jinyoung Jeon <jy0.jeon@samsung.com>
* Sangmin Lee <lsmin.lee@samsung.com> * Sangmin Lee <lsmin.lee@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_FIMC_H_ #ifndef _EXYNOS_DRM_FIMC_H_
......
...@@ -663,34 +663,6 @@ static struct exynos_drm_manager fimd_manager = { ...@@ -663,34 +663,6 @@ static struct exynos_drm_manager fimd_manager = {
.display_ops = &fimd_display_ops, .display_ops = &fimd_display_ops,
}; };
static void fimd_finish_pageflip(struct drm_device *drm_dev, int crtc)
{
struct exynos_drm_private *dev_priv = drm_dev->dev_private;
struct drm_pending_vblank_event *e, *t;
struct timeval now;
unsigned long flags;
spin_lock_irqsave(&drm_dev->event_lock, flags);
list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list,
base.link) {
/* if event's pipe isn't same as crtc then ignore it. */
if (crtc != e->pipe)
continue;
do_gettimeofday(&now);
e->event.sequence = 0;
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(drm_dev, crtc);
}
spin_unlock_irqrestore(&drm_dev->event_lock, flags);
}
static irqreturn_t fimd_irq_handler(int irq, void *dev_id) static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
{ {
struct fimd_context *ctx = (struct fimd_context *)dev_id; struct fimd_context *ctx = (struct fimd_context *)dev_id;
...@@ -710,7 +682,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id) ...@@ -710,7 +682,7 @@ static irqreturn_t fimd_irq_handler(int irq, void *dev_id)
goto out; goto out;
drm_handle_vblank(drm_dev, manager->pipe); drm_handle_vblank(drm_dev, manager->pipe);
fimd_finish_pageflip(drm_dev, manager->pipe); exynos_drm_crtc_finish_pageflip(drm_dev, manager->pipe);
/* set wait vsync event to zero and wake up queue. */ /* set wait vsync event to zero and wake up queue. */
if (atomic_read(&ctx->wait_vsync_event)) { if (atomic_read(&ctx->wait_vsync_event)) {
...@@ -1046,7 +1018,7 @@ static int fimd_resume(struct device *dev) ...@@ -1046,7 +1018,7 @@ static int fimd_resume(struct device *dev)
* of pm runtime would still be 1 so in this case, fimd driver * of pm runtime would still be 1 so in this case, fimd driver
* should be on directly not drawing on pm runtime interface. * should be on directly not drawing on pm runtime interface.
*/ */
if (pm_runtime_suspended(dev)) { if (!pm_runtime_suspended(dev)) {
int ret; int ret;
ret = fimd_activate(ctx, true); ret = fimd_activate(ctx, true);
......
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2011 Samsung Electronics Co., Ltd. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
* Author: Inki Dae <inki.dae@samsung.com> * Author: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drm/drmP.h> #include <drm/drmP.h>
......
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2011 Samsung Electronics Co., Ltd. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
* Authoer: Inki Dae <inki.dae@samsung.com> * Authoer: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_GEM_H_ #ifndef _EXYNOS_DRM_GEM_H_
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include "exynos_drm_gsc.h" #include "exynos_drm_gsc.h"
/* /*
* GSC is stand for General SCaler and * GSC stands for General SCaler and
* supports image scaler/rotator and input/output DMA operations. * supports image scaler/rotator and input/output DMA operations.
* input DMA reads image data from the memory. * input DMA reads image data from the memory.
* output DMA writes image data to memory. * output DMA writes image data to memory.
...@@ -711,7 +711,7 @@ static int gsc_src_set_addr(struct device *dev, ...@@ -711,7 +711,7 @@ static int gsc_src_set_addr(struct device *dev,
{ {
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;
struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_property *property;
if (!c_node) { if (!c_node) {
...@@ -720,10 +720,6 @@ static int gsc_src_set_addr(struct device *dev, ...@@ -720,10 +720,6 @@ static int gsc_src_set_addr(struct device *dev,
} }
property = &c_node->property; property = &c_node->property;
if (!property) {
DRM_ERROR("failed to get property.\n");
return -EFAULT;
}
DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__,
property->prop_id, buf_id, buf_type); property->prop_id, buf_id, buf_type);
...@@ -1171,7 +1167,7 @@ static int gsc_dst_set_addr(struct device *dev, ...@@ -1171,7 +1167,7 @@ static int gsc_dst_set_addr(struct device *dev,
{ {
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;
struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_property *property;
if (!c_node) { if (!c_node) {
...@@ -1180,10 +1176,6 @@ static int gsc_dst_set_addr(struct device *dev, ...@@ -1180,10 +1176,6 @@ static int gsc_dst_set_addr(struct device *dev,
} }
property = &c_node->property; property = &c_node->property;
if (!property) {
DRM_ERROR("failed to get property.\n");
return -EFAULT;
}
DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__, DRM_DEBUG_KMS("%s:prop_id[%d]buf_id[%d]buf_type[%d]\n", __func__,
property->prop_id, buf_id, buf_type); property->prop_id, buf_id, buf_type);
...@@ -1312,7 +1304,7 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id) ...@@ -1312,7 +1304,7 @@ static irqreturn_t gsc_irq_handler(int irq, void *dev_id)
{ {
struct gsc_context *ctx = dev_id; struct gsc_context *ctx = dev_id;
struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv; struct exynos_drm_ippdrv *ippdrv = &ctx->ippdrv;
struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
struct drm_exynos_ipp_event_work *event_work = struct drm_exynos_ipp_event_work *event_work =
c_node->event_work; c_node->event_work;
u32 status; u32 status;
...@@ -1399,7 +1391,7 @@ static inline bool gsc_check_drm_flip(enum drm_exynos_flip flip) ...@@ -1399,7 +1391,7 @@ static inline bool gsc_check_drm_flip(enum drm_exynos_flip flip)
case EXYNOS_DRM_FLIP_NONE: case EXYNOS_DRM_FLIP_NONE:
case EXYNOS_DRM_FLIP_VERTICAL: case EXYNOS_DRM_FLIP_VERTICAL:
case EXYNOS_DRM_FLIP_HORIZONTAL: case EXYNOS_DRM_FLIP_HORIZONTAL:
case EXYNOS_DRM_FLIP_VERTICAL | EXYNOS_DRM_FLIP_HORIZONTAL: case EXYNOS_DRM_FLIP_BOTH:
return true; return true;
default: default:
DRM_DEBUG_KMS("%s:invalid flip\n", __func__); DRM_DEBUG_KMS("%s:invalid flip\n", __func__);
...@@ -1549,7 +1541,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) ...@@ -1549,7 +1541,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
{ {
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;
struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
struct drm_exynos_ipp_property *property; struct drm_exynos_ipp_property *property;
struct drm_exynos_ipp_config *config; struct drm_exynos_ipp_config *config;
struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX]; struct drm_exynos_pos img_pos[EXYNOS_DRM_OPS_MAX];
...@@ -1565,10 +1557,6 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) ...@@ -1565,10 +1557,6 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
} }
property = &c_node->property; property = &c_node->property;
if (!property) {
DRM_ERROR("failed to get property.\n");
return -EINVAL;
}
gsc_handle_irq(ctx, true, false, true); gsc_handle_irq(ctx, true, false, true);
...@@ -1604,7 +1592,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd) ...@@ -1604,7 +1592,7 @@ static int gsc_ippdrv_start(struct device *dev, enum drm_exynos_ipp_cmd cmd)
exynos_drm_ippnb_send_event(IPP_SET_WRITEBACK, (void *)&set_wb); exynos_drm_ippnb_send_event(IPP_SET_WRITEBACK, (void *)&set_wb);
/* src local path */ /* src local path */
cfg = readl(GSC_IN_CON); cfg = gsc_read(GSC_IN_CON);
cfg &= ~(GSC_IN_PATH_MASK | GSC_IN_LOCAL_SEL_MASK); cfg &= ~(GSC_IN_PATH_MASK | GSC_IN_LOCAL_SEL_MASK);
cfg |= (GSC_IN_PATH_LOCAL | GSC_IN_LOCAL_FIMD_WB); cfg |= (GSC_IN_PATH_LOCAL | GSC_IN_LOCAL_FIMD_WB);
gsc_write(cfg, GSC_IN_CON); gsc_write(cfg, GSC_IN_CON);
...@@ -1696,34 +1684,25 @@ static int gsc_probe(struct platform_device *pdev) ...@@ -1696,34 +1684,25 @@ static int gsc_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
/* clock control */ /* clock control */
ctx->gsc_clk = clk_get(dev, "gscl"); ctx->gsc_clk = devm_clk_get(dev, "gscl");
if (IS_ERR(ctx->gsc_clk)) { if (IS_ERR(ctx->gsc_clk)) {
dev_err(dev, "failed to get gsc clock.\n"); dev_err(dev, "failed to get gsc clock.\n");
ret = PTR_ERR(ctx->gsc_clk); return PTR_ERR(ctx->gsc_clk);
goto err_ctx;
} }
/* resource memory */ /* resource memory */
ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); ctx->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!ctx->regs_res) {
dev_err(dev, "failed to find registers.\n");
ret = -ENOENT;
goto err_clk;
}
ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res); ctx->regs = devm_request_and_ioremap(dev, ctx->regs_res);
if (!ctx->regs) { if (!ctx->regs) {
dev_err(dev, "failed to map registers.\n"); dev_err(dev, "failed to map registers.\n");
ret = -ENXIO; return -ENXIO;
goto err_clk;
} }
/* resource irq */ /* resource irq */
res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
if (!res) { if (!res) {
dev_err(dev, "failed to request irq resource.\n"); dev_err(dev, "failed to request irq resource.\n");
ret = -ENOENT; return -ENOENT;
goto err_get_regs;
} }
ctx->irq = res->start; ctx->irq = res->start;
...@@ -1731,7 +1710,7 @@ static int gsc_probe(struct platform_device *pdev) ...@@ -1731,7 +1710,7 @@ static int gsc_probe(struct platform_device *pdev)
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");
goto err_get_regs; return ret;
} }
/* context initailization */ /* context initailization */
...@@ -1775,12 +1754,6 @@ static int gsc_probe(struct platform_device *pdev) ...@@ -1775,12 +1754,6 @@ static int gsc_probe(struct platform_device *pdev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
err_get_irq: err_get_irq:
free_irq(ctx->irq, ctx); free_irq(ctx->irq, ctx);
err_get_regs:
devm_iounmap(dev, ctx->regs);
err_clk:
clk_put(ctx->gsc_clk);
err_ctx:
devm_kfree(dev, ctx);
return ret; return ret;
} }
...@@ -1798,11 +1771,6 @@ static int gsc_remove(struct platform_device *pdev) ...@@ -1798,11 +1771,6 @@ static int gsc_remove(struct platform_device *pdev)
pm_runtime_disable(dev); pm_runtime_disable(dev);
free_irq(ctx->irq, ctx); free_irq(ctx->irq, ctx);
devm_iounmap(dev, ctx->regs);
clk_put(ctx->gsc_clk);
devm_kfree(dev, ctx);
return 0; return 0;
} }
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Jinyoung Jeon <jy0.jeon@samsung.com> * Jinyoung Jeon <jy0.jeon@samsung.com>
* Sangmin Lee <lsmin.lee@samsung.com> * Sangmin Lee <lsmin.lee@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_GSC_H_ #ifndef _EXYNOS_DRM_GSC_H_
......
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2011 Samsung Electronics Co., Ltd. * Copyright (c) 2011 Samsung Electronics Co., Ltd.
* Authoer: Inki Dae <inki.dae@samsung.com> * Authoer: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_HDMI_H_ #ifndef _EXYNOS_DRM_HDMI_H_
......
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2012 Samsung Electronics Co., Ltd. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
* Author: Inki Dae <inki.dae@samsung.com> * Author: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#include <drmP.h> #include <drmP.h>
......
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2012 Samsung Electronics Co., Ltd. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
* Authoer: Inki Dae <inki.dae@samsung.com> * Authoer: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_IOMMU_H_ #ifndef _EXYNOS_DRM_IOMMU_H_
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
#include "exynos_drm_iommu.h" #include "exynos_drm_iommu.h"
/* /*
* IPP is stand for Image Post Processing and * IPP stands for Image Post Processing and
* supports image scaler/rotator and input/output DMA operations. * supports image scaler/rotator and input/output DMA operations.
* using FIMC, GSC, Rotator, so on. * using FIMC, GSC, Rotator, so on.
* IPP is integration device driver of same attribute h/w * IPP is integration device driver of same attribute h/w
...@@ -1292,7 +1292,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv, ...@@ -1292,7 +1292,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv,
DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, property->prop_id); DRM_DEBUG_KMS("%s:prop_id[%d]\n", __func__, property->prop_id);
/* store command info in ippdrv */ /* store command info in ippdrv */
ippdrv->cmd = c_node; ippdrv->c_node = c_node;
if (!ipp_check_mem_list(c_node)) { if (!ipp_check_mem_list(c_node)) {
DRM_DEBUG_KMS("%s:empty memory.\n", __func__); DRM_DEBUG_KMS("%s:empty memory.\n", __func__);
...@@ -1303,7 +1303,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv, ...@@ -1303,7 +1303,7 @@ static int ipp_start_property(struct exynos_drm_ippdrv *ippdrv,
ret = ipp_set_property(ippdrv, property); ret = ipp_set_property(ippdrv, property);
if (ret) { if (ret) {
DRM_ERROR("failed to set property.\n"); DRM_ERROR("failed to set property.\n");
ippdrv->cmd = NULL; ippdrv->c_node = NULL;
return ret; return ret;
} }
...@@ -1487,11 +1487,6 @@ void ipp_sched_cmd(struct work_struct *work) ...@@ -1487,11 +1487,6 @@ void ipp_sched_cmd(struct work_struct *work)
mutex_lock(&c_node->cmd_lock); mutex_lock(&c_node->cmd_lock);
property = &c_node->property; property = &c_node->property;
if (!property) {
DRM_ERROR("failed to get property:prop_id[%d]\n",
c_node->property.prop_id);
goto err_unlock;
}
switch (cmd_work->ctrl) { switch (cmd_work->ctrl) {
case IPP_CTRL_PLAY: case IPP_CTRL_PLAY:
...@@ -1704,7 +1699,7 @@ void ipp_sched_event(struct work_struct *work) ...@@ -1704,7 +1699,7 @@ void ipp_sched_event(struct work_struct *work)
return; return;
} }
c_node = ippdrv->cmd; c_node = ippdrv->c_node;
if (!c_node) { if (!c_node) {
DRM_ERROR("failed to get command node.\n"); DRM_ERROR("failed to get command node.\n");
return; return;
...@@ -1895,7 +1890,7 @@ static int ipp_probe(struct platform_device *pdev) ...@@ -1895,7 +1890,7 @@ static int ipp_probe(struct platform_device *pdev)
struct exynos_drm_subdrv *subdrv; struct exynos_drm_subdrv *subdrv;
int ret; int ret;
ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
if (!ctx) if (!ctx)
return -ENOMEM; return -ENOMEM;
...@@ -1916,8 +1911,7 @@ static int ipp_probe(struct platform_device *pdev) ...@@ -1916,8 +1911,7 @@ static int ipp_probe(struct platform_device *pdev)
ctx->event_workq = create_singlethread_workqueue("ipp_event"); ctx->event_workq = create_singlethread_workqueue("ipp_event");
if (!ctx->event_workq) { if (!ctx->event_workq) {
dev_err(dev, "failed to create event workqueue\n"); dev_err(dev, "failed to create event workqueue\n");
ret = -EINVAL; return -EINVAL;
goto err_clear;
} }
/* /*
...@@ -1958,8 +1952,6 @@ static int ipp_probe(struct platform_device *pdev) ...@@ -1958,8 +1952,6 @@ static int ipp_probe(struct platform_device *pdev)
destroy_workqueue(ctx->cmd_workq); destroy_workqueue(ctx->cmd_workq);
err_event_workq: err_event_workq:
destroy_workqueue(ctx->event_workq); destroy_workqueue(ctx->event_workq);
err_clear:
kfree(ctx);
return ret; return ret;
} }
...@@ -1985,8 +1977,6 @@ static int ipp_remove(struct platform_device *pdev) ...@@ -1985,8 +1977,6 @@ static int ipp_remove(struct platform_device *pdev)
destroy_workqueue(ctx->cmd_workq); destroy_workqueue(ctx->cmd_workq);
destroy_workqueue(ctx->event_workq); destroy_workqueue(ctx->event_workq);
kfree(ctx);
return 0; return 0;
} }
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Jinyoung Jeon <jy0.jeon@samsung.com> * Jinyoung Jeon <jy0.jeon@samsung.com>
* Sangmin Lee <lsmin.lee@samsung.com> * Sangmin Lee <lsmin.lee@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_IPP_H_ #ifndef _EXYNOS_DRM_IPP_H_
...@@ -160,7 +146,7 @@ struct exynos_drm_ipp_ops { ...@@ -160,7 +146,7 @@ struct exynos_drm_ipp_ops {
* @dedicated: dedicated ipp device. * @dedicated: dedicated ipp device.
* @ops: source, destination operations. * @ops: source, destination operations.
* @event_workq: event work queue. * @event_workq: event work queue.
* @cmd: current command information. * @c_node: current command information.
* @cmd_list: list head for command information. * @cmd_list: list head for command information.
* @prop_list: property informations of current ipp driver. * @prop_list: property informations of current ipp driver.
* @check_property: check property about format, size, buffer. * @check_property: check property about format, size, buffer.
...@@ -178,7 +164,7 @@ struct exynos_drm_ippdrv { ...@@ -178,7 +164,7 @@ struct exynos_drm_ippdrv {
bool dedicated; bool dedicated;
struct exynos_drm_ipp_ops *ops[EXYNOS_DRM_OPS_MAX]; struct exynos_drm_ipp_ops *ops[EXYNOS_DRM_OPS_MAX];
struct workqueue_struct *event_workq; struct workqueue_struct *event_workq;
struct drm_exynos_ipp_cmd_node *cmd; struct drm_exynos_ipp_cmd_node *c_node;
struct list_head cmd_list; struct list_head cmd_list;
struct drm_exynos_ipp_prop_list *prop_list; struct drm_exynos_ipp_prop_list *prop_list;
......
...@@ -139,7 +139,7 @@ static irqreturn_t rotator_irq_handler(int irq, void *arg) ...@@ -139,7 +139,7 @@ static irqreturn_t rotator_irq_handler(int irq, void *arg)
{ {
struct rot_context *rot = arg; struct rot_context *rot = arg;
struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv; struct exynos_drm_ippdrv *ippdrv = &rot->ippdrv;
struct drm_exynos_ipp_cmd_node *c_node = ippdrv->cmd; struct drm_exynos_ipp_cmd_node *c_node = ippdrv->c_node;
struct drm_exynos_ipp_event_work *event_work = c_node->event_work; struct drm_exynos_ipp_event_work *event_work = c_node->event_work;
enum rot_irq_status irq_status; enum rot_irq_status irq_status;
u32 val; u32 val;
...@@ -513,6 +513,7 @@ static inline bool rotator_check_drm_flip(enum drm_exynos_flip flip) ...@@ -513,6 +513,7 @@ static inline bool rotator_check_drm_flip(enum drm_exynos_flip flip)
case EXYNOS_DRM_FLIP_NONE: case EXYNOS_DRM_FLIP_NONE:
case EXYNOS_DRM_FLIP_VERTICAL: case EXYNOS_DRM_FLIP_VERTICAL:
case EXYNOS_DRM_FLIP_HORIZONTAL: case EXYNOS_DRM_FLIP_HORIZONTAL:
case EXYNOS_DRM_FLIP_BOTH:
return true; return true;
default: default:
DRM_DEBUG_KMS("%s:invalid flip\n", __func__); DRM_DEBUG_KMS("%s:invalid flip\n", __func__);
...@@ -655,34 +656,26 @@ static int rotator_probe(struct platform_device *pdev) ...@@ -655,34 +656,26 @@ static int rotator_probe(struct platform_device *pdev)
platform_get_device_id(pdev)->driver_data; platform_get_device_id(pdev)->driver_data;
rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); rot->regs_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!rot->regs_res) {
dev_err(dev, "failed to find registers\n");
ret = -ENOENT;
goto err_get_resource;
}
rot->regs = devm_request_and_ioremap(dev, rot->regs_res); rot->regs = devm_request_and_ioremap(dev, rot->regs_res);
if (!rot->regs) { if (!rot->regs) {
dev_err(dev, "failed to map register\n"); dev_err(dev, "failed to map register\n");
ret = -ENXIO; return -ENXIO;
goto err_get_resource;
} }
rot->irq = platform_get_irq(pdev, 0); rot->irq = platform_get_irq(pdev, 0);
if (rot->irq < 0) { if (rot->irq < 0) {
dev_err(dev, "failed to get irq\n"); dev_err(dev, "failed to get irq\n");
ret = rot->irq; return rot->irq;
goto err_get_irq;
} }
ret = request_threaded_irq(rot->irq, NULL, rotator_irq_handler, ret = request_threaded_irq(rot->irq, NULL, rotator_irq_handler,
IRQF_ONESHOT, "drm_rotator", rot); 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");
goto err_get_irq; return ret;
} }
rot->clock = clk_get(dev, "rotator"); rot->clock = devm_clk_get(dev, "rotator");
if (IS_ERR_OR_NULL(rot->clock)) { if (IS_ERR_OR_NULL(rot->clock)) {
dev_err(dev, "failed to get clock\n"); dev_err(dev, "failed to get clock\n");
ret = PTR_ERR(rot->clock); ret = PTR_ERR(rot->clock);
...@@ -720,13 +713,8 @@ static int rotator_probe(struct platform_device *pdev) ...@@ -720,13 +713,8 @@ static int rotator_probe(struct platform_device *pdev)
err_ippdrv_register: err_ippdrv_register:
devm_kfree(dev, ippdrv->prop_list); devm_kfree(dev, ippdrv->prop_list);
pm_runtime_disable(dev); pm_runtime_disable(dev);
clk_put(rot->clock);
err_clk_get: err_clk_get:
free_irq(rot->irq, rot); free_irq(rot->irq, rot);
err_get_irq:
devm_iounmap(dev, rot->regs);
err_get_resource:
devm_kfree(dev, rot);
return ret; return ret;
} }
...@@ -740,12 +728,8 @@ static int rotator_remove(struct platform_device *pdev) ...@@ -740,12 +728,8 @@ static int rotator_remove(struct platform_device *pdev)
exynos_drm_ippdrv_unregister(ippdrv); exynos_drm_ippdrv_unregister(ippdrv);
pm_runtime_disable(dev); pm_runtime_disable(dev);
clk_put(rot->clock);
free_irq(rot->irq, rot); free_irq(rot->irq, rot);
devm_iounmap(dev, rot->regs);
devm_kfree(dev, rot);
return 0; return 0;
} }
......
...@@ -5,24 +5,10 @@ ...@@ -5,24 +5,10 @@
* YoungJun Cho <yj44.cho@samsung.com> * YoungJun Cho <yj44.cho@samsung.com>
* Eunchul Kim <chulspro.kim@samsung.com> * Eunchul Kim <chulspro.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_ROTATOR_H_ #ifndef _EXYNOS_DRM_ROTATOR_H_
......
...@@ -372,34 +372,6 @@ static struct exynos_drm_manager vidi_manager = { ...@@ -372,34 +372,6 @@ static struct exynos_drm_manager vidi_manager = {
.display_ops = &vidi_display_ops, .display_ops = &vidi_display_ops,
}; };
static void vidi_finish_pageflip(struct drm_device *drm_dev, int crtc)
{
struct exynos_drm_private *dev_priv = drm_dev->dev_private;
struct drm_pending_vblank_event *e, *t;
struct timeval now;
unsigned long flags;
spin_lock_irqsave(&drm_dev->event_lock, flags);
list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list,
base.link) {
/* if event's pipe isn't same as crtc then ignore it. */
if (crtc != e->pipe)
continue;
do_gettimeofday(&now);
e->event.sequence = 0;
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(drm_dev, crtc);
}
spin_unlock_irqrestore(&drm_dev->event_lock, flags);
}
static void vidi_fake_vblank_handler(struct work_struct *work) static void vidi_fake_vblank_handler(struct work_struct *work)
{ {
struct vidi_context *ctx = container_of(work, struct vidi_context, struct vidi_context *ctx = container_of(work, struct vidi_context,
...@@ -424,7 +396,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work) ...@@ -424,7 +396,7 @@ static void vidi_fake_vblank_handler(struct work_struct *work)
mutex_unlock(&ctx->lock); mutex_unlock(&ctx->lock);
vidi_finish_pageflip(subdrv->drm_dev, manager->pipe); exynos_drm_crtc_finish_pageflip(subdrv->drm_dev, manager->pipe);
} }
static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev) static int vidi_subdrv_probe(struct drm_device *drm_dev, struct device *dev)
......
...@@ -3,24 +3,10 @@ ...@@ -3,24 +3,10 @@
* Copyright (c) 2012 Samsung Electronics Co., Ltd. * Copyright (c) 2012 Samsung Electronics Co., Ltd.
* Author: Inki Dae <inki.dae@samsung.com> * Author: Inki Dae <inki.dae@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_VIDI_H_ #ifndef _EXYNOS_DRM_VIDI_H_
......
...@@ -5,24 +5,10 @@ ...@@ -5,24 +5,10 @@
* Inki Dae <inki.dae@samsung.com> * Inki Dae <inki.dae@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_HDMI_H_ #ifndef _EXYNOS_HDMI_H_
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <drm/exynos_drm.h> #include <drm/exynos_drm.h>
#include "exynos_drm_drv.h" #include "exynos_drm_drv.h"
#include "exynos_drm_crtc.h"
#include "exynos_drm_hdmi.h" #include "exynos_drm_hdmi.h"
#include "exynos_drm_iommu.h" #include "exynos_drm_iommu.h"
...@@ -949,35 +950,6 @@ static struct exynos_mixer_ops mixer_ops = { ...@@ -949,35 +950,6 @@ static struct exynos_mixer_ops mixer_ops = {
.win_disable = mixer_win_disable, .win_disable = mixer_win_disable,
}; };
/* for pageflip event */
static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc)
{
struct exynos_drm_private *dev_priv = drm_dev->dev_private;
struct drm_pending_vblank_event *e, *t;
struct timeval now;
unsigned long flags;
spin_lock_irqsave(&drm_dev->event_lock, flags);
list_for_each_entry_safe(e, t, &dev_priv->pageflip_event_list,
base.link) {
/* if event's pipe isn't same as crtc then ignore it. */
if (crtc != e->pipe)
continue;
do_gettimeofday(&now);
e->event.sequence = 0;
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(drm_dev, crtc);
}
spin_unlock_irqrestore(&drm_dev->event_lock, flags);
}
static irqreturn_t mixer_irq_handler(int irq, void *arg) static irqreturn_t mixer_irq_handler(int irq, void *arg)
{ {
struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg;
...@@ -1006,7 +978,8 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg) ...@@ -1006,7 +978,8 @@ static irqreturn_t mixer_irq_handler(int irq, void *arg)
} }
drm_handle_vblank(drm_hdmi_ctx->drm_dev, ctx->pipe); drm_handle_vblank(drm_hdmi_ctx->drm_dev, ctx->pipe);
mixer_finish_pageflip(drm_hdmi_ctx->drm_dev, ctx->pipe); exynos_drm_crtc_finish_pageflip(drm_hdmi_ctx->drm_dev,
ctx->pipe);
/* set wait vsync event to zero and wake up queue. */ /* set wait vsync event to zero and wake up queue. */
if (atomic_read(&ctx->wait_vsync_event)) { if (atomic_read(&ctx->wait_vsync_event)) {
......
...@@ -266,7 +266,12 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev, ...@@ -266,7 +266,12 @@ struct drm_gem_object *i915_gem_prime_import(struct drm_device *dev,
obj = dma_buf->priv; obj = dma_buf->priv;
/* is it from our device? */ /* is it from our device? */
if (obj->base.dev == dev) { if (obj->base.dev == dev) {
/*
* Importing dmabuf exported from out own gem increases
* refcount on gem itself instead of f_count of dmabuf.
*/
drm_gem_object_reference(&obj->base); drm_gem_object_reference(&obj->base);
dma_buf_put(dma_buf);
return &obj->base; return &obj->base;
} }
} }
......
...@@ -193,6 +193,7 @@ struct drm_gem_object *nouveau_gem_prime_import(struct drm_device *dev, ...@@ -193,6 +193,7 @@ struct drm_gem_object *nouveau_gem_prime_import(struct drm_device *dev,
if (nvbo->gem) { if (nvbo->gem) {
if (nvbo->gem->dev == dev) { if (nvbo->gem->dev == dev) {
drm_gem_object_reference(nvbo->gem); drm_gem_object_reference(nvbo->gem);
dma_buf_put(dma_buf);
return nvbo->gem; return nvbo->gem;
} }
} }
......
...@@ -2646,7 +2646,7 @@ int r600_copy_blit(struct radeon_device *rdev, ...@@ -2646,7 +2646,7 @@ int r600_copy_blit(struct radeon_device *rdev,
* @num_gpu_pages: number of GPU pages to xfer * @num_gpu_pages: number of GPU pages to xfer
* @fence: radeon fence object * @fence: radeon fence object
* *
* Copy GPU paging using the DMA engine (r6xx-r7xx). * Copy GPU paging using the DMA engine (r6xx).
* Used by the radeon ttm implementation to move pages if * Used by the radeon ttm implementation to move pages if
* registered as the asic copy callback. * registered as the asic copy callback.
*/ */
...@@ -2669,8 +2669,8 @@ int r600_copy_dma(struct radeon_device *rdev, ...@@ -2669,8 +2669,8 @@ int r600_copy_dma(struct radeon_device *rdev,
} }
size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4; size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4;
num_loops = DIV_ROUND_UP(size_in_dw, 0xffff); num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFE);
r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8); r = radeon_ring_lock(rdev, ring, num_loops * 4 + 8);
if (r) { if (r) {
DRM_ERROR("radeon: moving bo (%d).\n", r); DRM_ERROR("radeon: moving bo (%d).\n", r);
radeon_semaphore_free(rdev, &sem, NULL); radeon_semaphore_free(rdev, &sem, NULL);
...@@ -2693,8 +2693,8 @@ int r600_copy_dma(struct radeon_device *rdev, ...@@ -2693,8 +2693,8 @@ int r600_copy_dma(struct radeon_device *rdev,
radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw)); radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw));
radeon_ring_write(ring, dst_offset & 0xfffffffc); radeon_ring_write(ring, dst_offset & 0xfffffffc);
radeon_ring_write(ring, src_offset & 0xfffffffc); radeon_ring_write(ring, src_offset & 0xfffffffc);
radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xff); radeon_ring_write(ring, (((upper_32_bits(dst_offset) & 0xff) << 16) |
radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff); (upper_32_bits(src_offset) & 0xff)));
src_offset += cur_size_in_dw * 4; src_offset += cur_size_in_dw * 4;
dst_offset += cur_size_in_dw * 4; dst_offset += cur_size_in_dw * 4;
} }
......
...@@ -2677,16 +2677,29 @@ int r600_dma_cs_parse(struct radeon_cs_parser *p) ...@@ -2677,16 +2677,29 @@ int r600_dma_cs_parse(struct radeon_cs_parser *p)
} }
p->idx += 7; p->idx += 7;
} else { } else {
src_offset = ib[idx+2]; if (p->family >= CHIP_RV770) {
src_offset |= ((u64)(ib[idx+4] & 0xff)) << 32; src_offset = ib[idx+2];
dst_offset = ib[idx+1]; src_offset |= ((u64)(ib[idx+4] & 0xff)) << 32;
dst_offset |= ((u64)(ib[idx+3] & 0xff)) << 32; dst_offset = ib[idx+1];
dst_offset |= ((u64)(ib[idx+3] & 0xff)) << 32;
ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc); ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc);
ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc); ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc);
ib[idx+3] += upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff; ib[idx+3] += upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff;
ib[idx+4] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff; ib[idx+4] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff;
p->idx += 5; p->idx += 5;
} else {
src_offset = ib[idx+2];
src_offset |= ((u64)(ib[idx+3] & 0xff)) << 32;
dst_offset = ib[idx+1];
dst_offset |= ((u64)(ib[idx+3] & 0xff0000)) << 16;
ib[idx+1] += (u32)(dst_reloc->lobj.gpu_offset & 0xfffffffc);
ib[idx+2] += (u32)(src_reloc->lobj.gpu_offset & 0xfffffffc);
ib[idx+3] += upper_32_bits(src_reloc->lobj.gpu_offset) & 0xff;
ib[idx+3] += (upper_32_bits(dst_reloc->lobj.gpu_offset) & 0xff) << 16;
p->idx += 4;
}
} }
if ((src_offset + (count * 4)) > radeon_bo_size(src_reloc->robj)) { if ((src_offset + (count * 4)) > radeon_bo_size(src_reloc->robj)) {
dev_warn(p->dev, "DMA copy src buffer too small (%llu %lu)\n", dev_warn(p->dev, "DMA copy src buffer too small (%llu %lu)\n",
......
...@@ -1140,9 +1140,9 @@ static struct radeon_asic rv770_asic = { ...@@ -1140,9 +1140,9 @@ static struct radeon_asic rv770_asic = {
.copy = { .copy = {
.blit = &r600_copy_blit, .blit = &r600_copy_blit,
.blit_ring_index = RADEON_RING_TYPE_GFX_INDEX, .blit_ring_index = RADEON_RING_TYPE_GFX_INDEX,
.dma = &r600_copy_dma, .dma = &rv770_copy_dma,
.dma_ring_index = R600_RING_TYPE_DMA_INDEX, .dma_ring_index = R600_RING_TYPE_DMA_INDEX,
.copy = &r600_copy_dma, .copy = &rv770_copy_dma,
.copy_ring_index = R600_RING_TYPE_DMA_INDEX, .copy_ring_index = R600_RING_TYPE_DMA_INDEX,
}, },
.surface = { .surface = {
......
...@@ -403,6 +403,10 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base); ...@@ -403,6 +403,10 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc, u64 crtc_base);
void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc); void r700_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc);
void r700_cp_stop(struct radeon_device *rdev); void r700_cp_stop(struct radeon_device *rdev);
void r700_cp_fini(struct radeon_device *rdev); void r700_cp_fini(struct radeon_device *rdev);
int rv770_copy_dma(struct radeon_device *rdev,
uint64_t src_offset, uint64_t dst_offset,
unsigned num_gpu_pages,
struct radeon_fence **fence);
/* /*
* evergreen * evergreen
......
...@@ -896,6 +896,25 @@ static void radeon_check_arguments(struct radeon_device *rdev) ...@@ -896,6 +896,25 @@ static void radeon_check_arguments(struct radeon_device *rdev)
} }
} }
/**
* radeon_switcheroo_quirk_long_wakeup - return true if longer d3 delay is
* needed for waking up.
*
* @pdev: pci dev pointer
*/
static bool radeon_switcheroo_quirk_long_wakeup(struct pci_dev *pdev)
{
/* 6600m in a macbook pro */
if (pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE &&
pdev->subsystem_device == 0x00e2) {
printk(KERN_INFO "radeon: quirking longer d3 wakeup delay\n");
return true;
}
return false;
}
/** /**
* radeon_switcheroo_set_state - set switcheroo state * radeon_switcheroo_set_state - set switcheroo state
* *
...@@ -910,10 +929,19 @@ static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero ...@@ -910,10 +929,19 @@ static void radeon_switcheroo_set_state(struct pci_dev *pdev, enum vga_switchero
struct drm_device *dev = pci_get_drvdata(pdev); struct drm_device *dev = pci_get_drvdata(pdev);
pm_message_t pmm = { .event = PM_EVENT_SUSPEND }; pm_message_t pmm = { .event = PM_EVENT_SUSPEND };
if (state == VGA_SWITCHEROO_ON) { if (state == VGA_SWITCHEROO_ON) {
unsigned d3_delay = dev->pdev->d3_delay;
printk(KERN_INFO "radeon: switched on\n"); printk(KERN_INFO "radeon: switched on\n");
/* don't suspend or resume card normally */ /* don't suspend or resume card normally */
dev->switch_power_state = DRM_SWITCH_POWER_CHANGING; dev->switch_power_state = DRM_SWITCH_POWER_CHANGING;
if (d3_delay < 20 && radeon_switcheroo_quirk_long_wakeup(pdev))
dev->pdev->d3_delay = 20;
radeon_resume_kms(dev); radeon_resume_kms(dev);
dev->pdev->d3_delay = d3_delay;
dev->switch_power_state = DRM_SWITCH_POWER_ON; dev->switch_power_state = DRM_SWITCH_POWER_ON;
drm_kms_helper_poll_enable(dev); drm_kms_helper_poll_enable(dev);
} else { } else {
......
...@@ -194,6 +194,7 @@ struct drm_gem_object *radeon_gem_prime_import(struct drm_device *dev, ...@@ -194,6 +194,7 @@ struct drm_gem_object *radeon_gem_prime_import(struct drm_device *dev,
bo = dma_buf->priv; bo = dma_buf->priv;
if (bo->gem_base.dev == dev) { if (bo->gem_base.dev == dev) {
drm_gem_object_reference(&bo->gem_base); drm_gem_object_reference(&bo->gem_base);
dma_buf_put(dma_buf);
return &bo->gem_base; return &bo->gem_base;
} }
} }
......
...@@ -887,6 +887,80 @@ static int rv770_mc_init(struct radeon_device *rdev) ...@@ -887,6 +887,80 @@ static int rv770_mc_init(struct radeon_device *rdev)
return 0; return 0;
} }
/**
* rv770_copy_dma - copy pages using the DMA engine
*
* @rdev: radeon_device pointer
* @src_offset: src GPU address
* @dst_offset: dst GPU address
* @num_gpu_pages: number of GPU pages to xfer
* @fence: radeon fence object
*
* Copy GPU paging using the DMA engine (r7xx).
* Used by the radeon ttm implementation to move pages if
* registered as the asic copy callback.
*/
int rv770_copy_dma(struct radeon_device *rdev,
uint64_t src_offset, uint64_t dst_offset,
unsigned num_gpu_pages,
struct radeon_fence **fence)
{
struct radeon_semaphore *sem = NULL;
int ring_index = rdev->asic->copy.dma_ring_index;
struct radeon_ring *ring = &rdev->ring[ring_index];
u32 size_in_dw, cur_size_in_dw;
int i, num_loops;
int r = 0;
r = radeon_semaphore_create(rdev, &sem);
if (r) {
DRM_ERROR("radeon: moving bo (%d).\n", r);
return r;
}
size_in_dw = (num_gpu_pages << RADEON_GPU_PAGE_SHIFT) / 4;
num_loops = DIV_ROUND_UP(size_in_dw, 0xFFFF);
r = radeon_ring_lock(rdev, ring, num_loops * 5 + 8);
if (r) {
DRM_ERROR("radeon: moving bo (%d).\n", r);
radeon_semaphore_free(rdev, &sem, NULL);
return r;
}
if (radeon_fence_need_sync(*fence, ring->idx)) {
radeon_semaphore_sync_rings(rdev, sem, (*fence)->ring,
ring->idx);
radeon_fence_note_sync(*fence, ring->idx);
} else {
radeon_semaphore_free(rdev, &sem, NULL);
}
for (i = 0; i < num_loops; i++) {
cur_size_in_dw = size_in_dw;
if (cur_size_in_dw > 0xFFFF)
cur_size_in_dw = 0xFFFF;
size_in_dw -= cur_size_in_dw;
radeon_ring_write(ring, DMA_PACKET(DMA_PACKET_COPY, 0, 0, cur_size_in_dw));
radeon_ring_write(ring, dst_offset & 0xfffffffc);
radeon_ring_write(ring, src_offset & 0xfffffffc);
radeon_ring_write(ring, upper_32_bits(dst_offset) & 0xff);
radeon_ring_write(ring, upper_32_bits(src_offset) & 0xff);
src_offset += cur_size_in_dw * 4;
dst_offset += cur_size_in_dw * 4;
}
r = radeon_fence_emit(rdev, fence, ring->idx);
if (r) {
radeon_ring_unlock_undo(rdev, ring);
return r;
}
radeon_ring_unlock_commit(rdev, ring);
radeon_semaphore_free(rdev, &sem, *fence);
return r;
}
static int rv770_startup(struct radeon_device *rdev) static int rv770_startup(struct radeon_device *rdev)
{ {
struct radeon_ring *ring; struct radeon_ring *ring;
......
...@@ -654,11 +654,13 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo, ...@@ -654,11 +654,13 @@ int ttm_bo_move_accel_cleanup(struct ttm_buffer_object *bo,
*/ */
set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags); set_bit(TTM_BO_PRIV_FLAG_MOVING, &bo->priv_flags);
/* ttm_buffer_object_transfer accesses bo->sync_obj */
ret = ttm_buffer_object_transfer(bo, &ghost_obj);
spin_unlock(&bdev->fence_lock); spin_unlock(&bdev->fence_lock);
if (tmp_obj) if (tmp_obj)
driver->sync_obj_unref(&tmp_obj); driver->sync_obj_unref(&tmp_obj);
ret = ttm_buffer_object_transfer(bo, &ghost_obj);
if (ret) if (ret)
return ret; return ret;
......
...@@ -207,7 +207,12 @@ struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev, ...@@ -207,7 +207,12 @@ struct drm_gem_object *omap_gem_prime_import(struct drm_device *dev,
obj = buffer->priv; obj = buffer->priv;
/* is it from our device? */ /* is it from our device? */
if (obj->dev == dev) { if (obj->dev == dev) {
/*
* Importing dmabuf exported from out own gem increases
* refcount on gem itself instead of f_count of dmabuf.
*/
drm_gem_object_reference(obj); drm_gem_object_reference(obj);
dma_buf_put(buffer);
return obj; return obj;
} }
} }
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _EXYNOS_DRM_H_ #ifndef _EXYNOS_DRM_H_
#define _EXYNOS_DRM_H_ #define _EXYNOS_DRM_H_
......
...@@ -6,24 +6,10 @@ ...@@ -6,24 +6,10 @@
* Joonyoung Shim <jy0922.shim@samsung.com> * Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com> * Seung-Woo Kim <sw0312.kim@samsung.com>
* *
* Permission is hereby granted, free of charge, to any person obtaining a * This program is free software; you can redistribute it and/or modify it
* copy of this software and associated documentation files (the "Software"), * under the terms of the GNU General Public License as published by the
* to deal in the Software without restriction, including without limitation * Free Software Foundation; either version 2 of the License, or (at your
* the rights to use, copy, modify, merge, publish, distribute, sublicense, * option) any later version.
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/ */
#ifndef _UAPI_EXYNOS_DRM_H_ #ifndef _UAPI_EXYNOS_DRM_H_
...@@ -185,6 +171,8 @@ enum drm_exynos_flip { ...@@ -185,6 +171,8 @@ enum drm_exynos_flip {
EXYNOS_DRM_FLIP_NONE = (0 << 0), EXYNOS_DRM_FLIP_NONE = (0 << 0),
EXYNOS_DRM_FLIP_VERTICAL = (1 << 0), EXYNOS_DRM_FLIP_VERTICAL = (1 << 0),
EXYNOS_DRM_FLIP_HORIZONTAL = (1 << 1), EXYNOS_DRM_FLIP_HORIZONTAL = (1 << 1),
EXYNOS_DRM_FLIP_BOTH = EXYNOS_DRM_FLIP_VERTICAL |
EXYNOS_DRM_FLIP_HORIZONTAL,
}; };
enum drm_exynos_degree { enum drm_exynos_degree {
......
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