alistair23-linux/drivers/gpu/drm/exynos/exynos_drm_drv.c

595 lines
15 KiB
C
Raw Normal View History

DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
/*
* Copyright (c) 2011 Samsung Electronics Co., Ltd.
* Authors:
* Inki Dae <inki.dae@samsung.com>
* Joonyoung Shim <jy0922.shim@samsung.com>
* Seung-Woo Kim <sw0312.kim@samsung.com>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
*/
#include <linux/pm_runtime.h>
#include <drm/drmP.h>
#include <drm/drm_atomic.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_fb_helper.h>
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
#include <linux/component.h>
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
#include <drm/exynos_drm.h>
#include "exynos_drm_drv.h"
#include "exynos_drm_fbdev.h"
#include "exynos_drm_fb.h"
#include "exynos_drm_gem.h"
#include "exynos_drm_plane.h"
drm/exynos: ipp: Add IPP v2 framework This patch adds Exynos IPP v2 subsystem and userspace API. New userspace API is focused ONLY on memory-to-memory image processing. The two remainging operation modes of obsolete IPP v1 API (framebuffer writeback and local-path output with image processing) can be implemented using standard DRM features: writeback connectors and additional DRM planes with scaling features. V2 IPP userspace API is based on stateless approach, which much better fits to memory-to-memory image processing model. It also provides support for all image formats, which are both already defined in DRM API and supported by the existing IPP hardware modules. The API consists of the following ioctls: - DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES: to enumerate all available image processing modules, - DRM_IOCTL_EXYNOS_IPP_GET_CAPS: to query capabilities and supported image formats of given IPP module, - DRM_IOCTL_EXYNOS_IPP_GET_LIMITS: to query hardware limitiations for selected image format of given IPP module, - DRM_IOCTL_EXYNOS_IPP_COMMIT: to perform operation described by the provided structures (source and destination buffers, operation rectangle, transformation, etc). The proposed userspace API is extensible. In the future more advanced image processing operations can be defined to support for example blending. Userspace API is fully functional also on DRM render nodes, so it is not limited to the root/privileged client. Internal driver API also has been completely rewritten. New IPP core performs all possible input validation, checks and object life-time control. The drivers can focus only on writing configuration to hardware registers. Stateless nature of DRM_IOCTL_EXYNOS_IPP_COMMIT ioctl simplifies the driver API. Minimal driver needs to provide a single callback for starting processing and an array with supported image formats. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com> Merge conflict so merged manually. Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-05-09 17:46:36 -06:00
#include "exynos_drm_ipp.h"
#include "exynos_drm_vidi.h"
drm/exynos: add G2D driver Changelog v3: - use __u64 instead of pointer in ioctl struct. The G2D is a 2D graphic accelerator that supports Bit Block Transfer. This G2D driver is exynos drm specific and supports only G2D(version 4.1) of later Exynos series from Exynos4X12 because supporting DMA. The G2D is performed by two tasks simply. 1. Configures the rendering parameters, such as foreground color and coordinates data by setting the drawing context registers. 2. Start the rendering process by setting thre relevant command registers accordingly. The G2D version 4.1 supports DMA mode as host interface. User can make command list to reduce HOST(ARM) loads. The contents of The command list is setted to relevant registers of G2D by DMA. The command list is composed Header and command sets and Tail. - Header: The number of command set(4Bytes) - Command set: Register offset(4Bytes) + Register data(4Bytes) - Tail: Pointer of base address of the other command list(4Bytes) By Tail field, the G2D can process many command lists without halt at one go. The G2D has following the rendering pipeline. --> Primitive Drawing --> Rotation --> Clipping --> Bilinear Sampling --> Color Key --> ROP --> Mask Operation --> Alpha Blending --> Dithering --> FrameBuffer And supports various operations from the rendering pipeline. - copy - fast solid color fill - window clipping - rotation - flip - 4 operand raster operation(ROP4) - masking operation - alpha blending - color key - dithering - etc User should make the command list to data and registers needed by operation to use. The Exynos G2D driver only manages the command lists received from user. Some registers needs memory base address(physical address) of image. User doesn't know its physical address, so fills the gem handle of that memory than address to command sets, then G2D driver converts it to memory base address. We adds three ioctls and one event for Exynos G2D. - ioctls DRM_EXYNOS_G2D_GET_VER: get the G2D hardware version DRM_EXYNOS_G2D_SET_CMDLIST: set the command list from user to driver DRM_EXYNOS_G2D_EXEC: execute the command lists setted to driver - event DRM_EXYNOS_G2D_EVENT: event to give notification completion of the command list to user Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-05-17 05:06:32 -06:00
#include "exynos_drm_g2d.h"
#include "exynos_drm_iommu.h"
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
#define DRIVER_NAME "exynos"
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
#define DRIVER_DESC "Samsung SoC DRM"
drm/exynos: ipp: Add IPP v2 framework This patch adds Exynos IPP v2 subsystem and userspace API. New userspace API is focused ONLY on memory-to-memory image processing. The two remainging operation modes of obsolete IPP v1 API (framebuffer writeback and local-path output with image processing) can be implemented using standard DRM features: writeback connectors and additional DRM planes with scaling features. V2 IPP userspace API is based on stateless approach, which much better fits to memory-to-memory image processing model. It also provides support for all image formats, which are both already defined in DRM API and supported by the existing IPP hardware modules. The API consists of the following ioctls: - DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES: to enumerate all available image processing modules, - DRM_IOCTL_EXYNOS_IPP_GET_CAPS: to query capabilities and supported image formats of given IPP module, - DRM_IOCTL_EXYNOS_IPP_GET_LIMITS: to query hardware limitiations for selected image format of given IPP module, - DRM_IOCTL_EXYNOS_IPP_COMMIT: to perform operation described by the provided structures (source and destination buffers, operation rectangle, transformation, etc). The proposed userspace API is extensible. In the future more advanced image processing operations can be defined to support for example blending. Userspace API is fully functional also on DRM render nodes, so it is not limited to the root/privileged client. Internal driver API also has been completely rewritten. New IPP core performs all possible input validation, checks and object life-time control. The drivers can focus only on writing configuration to hardware registers. Stateless nature of DRM_IOCTL_EXYNOS_IPP_COMMIT ioctl simplifies the driver API. Minimal driver needs to provide a single callback for starting processing and an array with supported image formats. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com> Merge conflict so merged manually. Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-05-09 17:46:36 -06:00
#define DRIVER_DATE "20180330"
/*
* Interface history:
*
* 1.0 - Original version
* 1.1 - Upgrade IPP driver to version 2.0
*/
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
#define DRIVER_MAJOR 1
drm/exynos: ipp: Add IPP v2 framework This patch adds Exynos IPP v2 subsystem and userspace API. New userspace API is focused ONLY on memory-to-memory image processing. The two remainging operation modes of obsolete IPP v1 API (framebuffer writeback and local-path output with image processing) can be implemented using standard DRM features: writeback connectors and additional DRM planes with scaling features. V2 IPP userspace API is based on stateless approach, which much better fits to memory-to-memory image processing model. It also provides support for all image formats, which are both already defined in DRM API and supported by the existing IPP hardware modules. The API consists of the following ioctls: - DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES: to enumerate all available image processing modules, - DRM_IOCTL_EXYNOS_IPP_GET_CAPS: to query capabilities and supported image formats of given IPP module, - DRM_IOCTL_EXYNOS_IPP_GET_LIMITS: to query hardware limitiations for selected image format of given IPP module, - DRM_IOCTL_EXYNOS_IPP_COMMIT: to perform operation described by the provided structures (source and destination buffers, operation rectangle, transformation, etc). The proposed userspace API is extensible. In the future more advanced image processing operations can be defined to support for example blending. Userspace API is fully functional also on DRM render nodes, so it is not limited to the root/privileged client. Internal driver API also has been completely rewritten. New IPP core performs all possible input validation, checks and object life-time control. The drivers can focus only on writing configuration to hardware registers. Stateless nature of DRM_IOCTL_EXYNOS_IPP_COMMIT ioctl simplifies the driver API. Minimal driver needs to provide a single callback for starting processing and an array with supported image formats. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com> Merge conflict so merged manually. Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-05-09 17:46:36 -06:00
#define DRIVER_MINOR 1
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
static int exynos_drm_open(struct drm_device *dev, struct drm_file *file)
{
drm/exynos: add G2D driver Changelog v3: - use __u64 instead of pointer in ioctl struct. The G2D is a 2D graphic accelerator that supports Bit Block Transfer. This G2D driver is exynos drm specific and supports only G2D(version 4.1) of later Exynos series from Exynos4X12 because supporting DMA. The G2D is performed by two tasks simply. 1. Configures the rendering parameters, such as foreground color and coordinates data by setting the drawing context registers. 2. Start the rendering process by setting thre relevant command registers accordingly. The G2D version 4.1 supports DMA mode as host interface. User can make command list to reduce HOST(ARM) loads. The contents of The command list is setted to relevant registers of G2D by DMA. The command list is composed Header and command sets and Tail. - Header: The number of command set(4Bytes) - Command set: Register offset(4Bytes) + Register data(4Bytes) - Tail: Pointer of base address of the other command list(4Bytes) By Tail field, the G2D can process many command lists without halt at one go. The G2D has following the rendering pipeline. --> Primitive Drawing --> Rotation --> Clipping --> Bilinear Sampling --> Color Key --> ROP --> Mask Operation --> Alpha Blending --> Dithering --> FrameBuffer And supports various operations from the rendering pipeline. - copy - fast solid color fill - window clipping - rotation - flip - 4 operand raster operation(ROP4) - masking operation - alpha blending - color key - dithering - etc User should make the command list to data and registers needed by operation to use. The Exynos G2D driver only manages the command lists received from user. Some registers needs memory base address(physical address) of image. User doesn't know its physical address, so fills the gem handle of that memory than address to command sets, then G2D driver converts it to memory base address. We adds three ioctls and one event for Exynos G2D. - ioctls DRM_EXYNOS_G2D_GET_VER: get the G2D hardware version DRM_EXYNOS_G2D_SET_CMDLIST: set the command list from user to driver DRM_EXYNOS_G2D_EXEC: execute the command lists setted to driver - event DRM_EXYNOS_G2D_EVENT: event to give notification completion of the command list to user Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-05-17 05:06:32 -06:00
struct drm_exynos_file_private *file_priv;
int ret;
drm/exynos: add G2D driver Changelog v3: - use __u64 instead of pointer in ioctl struct. The G2D is a 2D graphic accelerator that supports Bit Block Transfer. This G2D driver is exynos drm specific and supports only G2D(version 4.1) of later Exynos series from Exynos4X12 because supporting DMA. The G2D is performed by two tasks simply. 1. Configures the rendering parameters, such as foreground color and coordinates data by setting the drawing context registers. 2. Start the rendering process by setting thre relevant command registers accordingly. The G2D version 4.1 supports DMA mode as host interface. User can make command list to reduce HOST(ARM) loads. The contents of The command list is setted to relevant registers of G2D by DMA. The command list is composed Header and command sets and Tail. - Header: The number of command set(4Bytes) - Command set: Register offset(4Bytes) + Register data(4Bytes) - Tail: Pointer of base address of the other command list(4Bytes) By Tail field, the G2D can process many command lists without halt at one go. The G2D has following the rendering pipeline. --> Primitive Drawing --> Rotation --> Clipping --> Bilinear Sampling --> Color Key --> ROP --> Mask Operation --> Alpha Blending --> Dithering --> FrameBuffer And supports various operations from the rendering pipeline. - copy - fast solid color fill - window clipping - rotation - flip - 4 operand raster operation(ROP4) - masking operation - alpha blending - color key - dithering - etc User should make the command list to data and registers needed by operation to use. The Exynos G2D driver only manages the command lists received from user. Some registers needs memory base address(physical address) of image. User doesn't know its physical address, so fills the gem handle of that memory than address to command sets, then G2D driver converts it to memory base address. We adds three ioctls and one event for Exynos G2D. - ioctls DRM_EXYNOS_G2D_GET_VER: get the G2D hardware version DRM_EXYNOS_G2D_SET_CMDLIST: set the command list from user to driver DRM_EXYNOS_G2D_EXEC: execute the command lists setted to driver - event DRM_EXYNOS_G2D_EVENT: event to give notification completion of the command list to user Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2012-05-17 05:06:32 -06:00
file_priv = kzalloc(sizeof(*file_priv), GFP_KERNEL);
if (!file_priv)
return -ENOMEM;
file->driver_priv = file_priv;
ret = exynos_drm_subdrv_open(dev, file);
if (ret)
goto err_file_priv_free;
return ret;
err_file_priv_free:
kfree(file_priv);
file->driver_priv = NULL;
return ret;
}
static void exynos_drm_postclose(struct drm_device *dev, struct drm_file *file)
{
exynos_drm_subdrv_close(dev, file);
kfree(file->driver_priv);
file->driver_priv = NULL;
}
static const struct vm_operations_struct exynos_drm_gem_vm_ops = {
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
.fault = exynos_drm_gem_fault,
.open = drm_gem_vm_open,
.close = drm_gem_vm_close,
};
static const struct drm_ioctl_desc exynos_ioctls[] = {
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
DRM_IOCTL_DEF_DRV(EXYNOS_GEM_CREATE, exynos_drm_gem_create_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(EXYNOS_GEM_MAP, exynos_drm_gem_map_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(EXYNOS_GEM_GET, exynos_drm_gem_get_ioctl,
DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(EXYNOS_VIDI_CONNECTION, vidi_connection_ioctl,
DRM_AUTH),
DRM_IOCTL_DEF_DRV(EXYNOS_G2D_GET_VER, exynos_g2d_get_ver_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(EXYNOS_G2D_SET_CMDLIST, exynos_g2d_set_cmdlist_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(EXYNOS_G2D_EXEC, exynos_g2d_exec_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW),
drm/exynos: ipp: Add IPP v2 framework This patch adds Exynos IPP v2 subsystem and userspace API. New userspace API is focused ONLY on memory-to-memory image processing. The two remainging operation modes of obsolete IPP v1 API (framebuffer writeback and local-path output with image processing) can be implemented using standard DRM features: writeback connectors and additional DRM planes with scaling features. V2 IPP userspace API is based on stateless approach, which much better fits to memory-to-memory image processing model. It also provides support for all image formats, which are both already defined in DRM API and supported by the existing IPP hardware modules. The API consists of the following ioctls: - DRM_IOCTL_EXYNOS_IPP_GET_RESOURCES: to enumerate all available image processing modules, - DRM_IOCTL_EXYNOS_IPP_GET_CAPS: to query capabilities and supported image formats of given IPP module, - DRM_IOCTL_EXYNOS_IPP_GET_LIMITS: to query hardware limitiations for selected image format of given IPP module, - DRM_IOCTL_EXYNOS_IPP_COMMIT: to perform operation described by the provided structures (source and destination buffers, operation rectangle, transformation, etc). The proposed userspace API is extensible. In the future more advanced image processing operations can be defined to support for example blending. Userspace API is fully functional also on DRM render nodes, so it is not limited to the root/privileged client. Internal driver API also has been completely rewritten. New IPP core performs all possible input validation, checks and object life-time control. The drivers can focus only on writing configuration to hardware registers. Stateless nature of DRM_IOCTL_EXYNOS_IPP_COMMIT ioctl simplifies the driver API. Minimal driver needs to provide a single callback for starting processing and an array with supported image formats. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Tested-by: Hoegeun Kwon <hoegeun.kwon@samsung.com> Merge conflict so merged manually. Signed-off-by: Inki Dae <inki.dae@samsung.com>
2018-05-09 17:46:36 -06:00
DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_RESOURCES,
exynos_drm_ipp_get_res_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_CAPS, exynos_drm_ipp_get_caps_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(EXYNOS_IPP_GET_LIMITS,
exynos_drm_ipp_get_limits_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW),
DRM_IOCTL_DEF_DRV(EXYNOS_IPP_COMMIT, exynos_drm_ipp_commit_ioctl,
DRM_AUTH | DRM_RENDER_ALLOW),
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
};
drm/exynos: Fix compile errors This compile errors occur by changes of e08e96de986ceb2c6b683df0bd0c4ddd4f91dcfd commit, so exynos drm should apply this changes. CC drivers/gpu/drm/exynos/exynos_drm_drv.o drivers/gpu/drm/exynos/exynos_drm_drv.c:185: warning: braces around scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:185: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:186: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:186: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:186: warning: initialization from incompatible pointer type drivers/gpu/drm/exynos/exynos_drm_drv.c:187: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:187: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:187: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:187: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:188: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:188: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:188: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:188: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:189: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:189: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:189: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:189: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:190: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:190: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:190: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:190: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:191: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:191: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:191: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:191: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:192: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:192: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:192: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:192: warning: (near initialization for 'exynos_drm_driver.fops') make[4]: *** [drivers/gpu/drm/exynos/exynos_drm_drv.o] Error 1 make[3]: *** [drivers/gpu/drm/exynos] Error 2 make[2]: *** [drivers/gpu/drm] Error 2 make[1]: *** [drivers/gpu] Error 2 make: *** [drivers] Error 2 Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2011-12-07 23:00:20 -07:00
static const struct file_operations exynos_drm_driver_fops = {
.owner = THIS_MODULE,
.open = drm_open,
.mmap = exynos_drm_gem_mmap,
.poll = drm_poll,
.read = drm_read,
.unlocked_ioctl = drm_ioctl,
.compat_ioctl = drm_compat_ioctl,
drm/exynos: Fix compile errors This compile errors occur by changes of e08e96de986ceb2c6b683df0bd0c4ddd4f91dcfd commit, so exynos drm should apply this changes. CC drivers/gpu/drm/exynos/exynos_drm_drv.o drivers/gpu/drm/exynos/exynos_drm_drv.c:185: warning: braces around scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:185: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:186: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:186: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:186: warning: initialization from incompatible pointer type drivers/gpu/drm/exynos/exynos_drm_drv.c:187: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:187: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:187: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:187: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:188: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:188: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:188: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:188: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:189: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:189: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:189: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:189: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:190: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:190: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:190: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:190: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:191: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:191: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:191: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:191: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:192: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:192: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:192: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:192: warning: (near initialization for 'exynos_drm_driver.fops') make[4]: *** [drivers/gpu/drm/exynos/exynos_drm_drv.o] Error 1 make[3]: *** [drivers/gpu/drm/exynos] Error 2 make[2]: *** [drivers/gpu/drm] Error 2 make[1]: *** [drivers/gpu] Error 2 make: *** [drivers] Error 2 Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2011-12-07 23:00:20 -07:00
.release = drm_release,
};
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
static struct drm_driver exynos_drm_driver = {
.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_PRIME
| DRIVER_ATOMIC | DRIVER_RENDER,
.open = exynos_drm_open,
.lastclose = drm_fb_helper_lastclose,
.postclose = exynos_drm_postclose,
.gem_free_object_unlocked = exynos_drm_gem_free_object,
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
.gem_vm_ops = &exynos_drm_gem_vm_ops,
.dumb_create = exynos_drm_gem_dumb_create,
.prime_handle_to_fd = drm_gem_prime_handle_to_fd,
.prime_fd_to_handle = drm_gem_prime_fd_to_handle,
.gem_prime_export = drm_gem_prime_export,
.gem_prime_import = exynos_drm_gem_prime_import,
.gem_prime_get_sg_table = exynos_drm_gem_prime_get_sg_table,
.gem_prime_import_sg_table = exynos_drm_gem_prime_import_sg_table,
.gem_prime_vmap = exynos_drm_gem_prime_vmap,
.gem_prime_vunmap = exynos_drm_gem_prime_vunmap,
.gem_prime_mmap = exynos_drm_gem_prime_mmap,
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
.ioctls = exynos_ioctls,
.num_ioctls = ARRAY_SIZE(exynos_ioctls),
drm/exynos: Fix compile errors This compile errors occur by changes of e08e96de986ceb2c6b683df0bd0c4ddd4f91dcfd commit, so exynos drm should apply this changes. CC drivers/gpu/drm/exynos/exynos_drm_drv.o drivers/gpu/drm/exynos/exynos_drm_drv.c:185: warning: braces around scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:185: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:186: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:186: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:186: warning: initialization from incompatible pointer type drivers/gpu/drm/exynos/exynos_drm_drv.c:187: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:187: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:187: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:187: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:188: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:188: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:188: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:188: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:189: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:189: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:189: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:189: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:190: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:190: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:190: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:190: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:191: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:191: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:191: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:191: warning: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:192: error: field name not in record or union initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:192: error: (near initialization for 'exynos_drm_driver.fops') drivers/gpu/drm/exynos/exynos_drm_drv.c:192: warning: excess elements in scalar initializer drivers/gpu/drm/exynos/exynos_drm_drv.c:192: warning: (near initialization for 'exynos_drm_driver.fops') make[4]: *** [drivers/gpu/drm/exynos/exynos_drm_drv.o] Error 1 make[3]: *** [drivers/gpu/drm/exynos] Error 2 make[2]: *** [drivers/gpu/drm] Error 2 make[1]: *** [drivers/gpu] Error 2 make: *** [drivers] Error 2 Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
2011-12-07 23:00:20 -07:00
.fops = &exynos_drm_driver_fops,
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
.name = DRIVER_NAME,
.desc = DRIVER_DESC,
.date = DRIVER_DATE,
.major = DRIVER_MAJOR,
.minor = DRIVER_MINOR,
};
#ifdef CONFIG_PM_SLEEP
static int exynos_drm_suspend(struct device *dev)
{
struct drm_device *drm_dev = dev_get_drvdata(dev);
struct exynos_drm_private *private;
drm/exynos: Fix NULL pointer exception when suspending without components Fix a NULL pointer exception when main exynos drm driver was probed successfully but no components were added (e.g. by incomplete DTS). In such case the exynos_drm_load() is never called and drvdata is NULL. The NULL pointer exception may theoretically also happen as a effect of race between adding components and main driver: if suspend of the driver happens before adding components. Trace: [ 1.190295] [drm] Initialized drm 1.1.0 20060810 [ 1.195209] exynos-drm-ipp exynos-drm-ipp: drm ipp registered successfully. (...) [ 24.001743] PM: Syncing filesystems ... done. [ 24.002177] Freezing user space processes ... (elapsed 0.000 seconds) done. [ 24.007403] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 24.032559] Unable to handle kernel NULL pointer dereference at virtual address 00000134 [ 24.035007] pgd = dedd8000 [ 24.037734] [00000134] *pgd=5ee13831, *pte=00000000, *ppte=00000000 [ 24.043953] Internal error: Oops: 17 [#1] PREEMPT SMP ARM [ 24.049329] Modules linked in: [ 24.052371] CPU: 0 PID: 1 Comm: sh Not tainted 3.16.0-rc3-00035-geba20bbdde04-dirty #51 [ 24.060354] task: df478000 ti: df480000 task.ti: df480000 [ 24.065743] PC is at mutex_lock+0x10/0x50 [ 24.069733] LR is at drm_modeset_lock_all+0x30/0xbc [ 24.074590] pc : [<c048516c>] lr : [<c02a14b4>] psr: a0000013 [ 24.074590] sp : df481db8 ip : 00000000 fp : c05e524c [ 24.086045] r10: 00000002 r9 : c02c1fe4 r8 : deca5e44 [ 24.091253] r7 : 00000000 r6 : 00000000 r5 : 0000014c r4 : 00000134 [ 24.097763] r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : 00000134 [ 24.104275] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 24.111391] Control: 10c53c7d Table: 5edd806a DAC: 00000015 [ 24.117120] Process sh (pid: 1, stack limit = 0xdf480240) [ 24.122502] Stack: (0xdf481db8 to 0xdf482000) [ 24.126843] 1da0: dee01d80 c02a14b4 [ 24.135004] 1dc0: 00000000 00000000 c07aff98 c02aec7c 00000002 00000000 00000000 c07aff98 [ 24.143164] 1de0: deca5e10 c02aecf4 c02aecd4 c02c2010 00000000 c02c9470 00000000 00000000 [ 24.151322] 1e00: 00000000 00000000 deca5e10 deca5e10 00000000 c07aff98 00000002 deca5e44 [ 24.159482] 1e20: c06d8f78 c06fb800 deca5e78 c02ca660 df7baf00 007b0aa0 deca5e10 c06fb7c8 [ 24.167641] 1e40: c07aff98 00000000 00000002 c02cbe18 9757aec5 00000005 9757aec5 00000005 [ 24.175801] 1e60: ded1d380 00000003 00000003 c05c74d8 ded1d380 c07209d4 c05c7514 c07105d8 [ 24.183960] 1e80: 01e2a738 c0068a74 00000000 c05c7514 ded1d380 c071c6e0 00000004 c07105d8 [ 24.192119] 1ea0: 01e2a738 c047f1e0 c0600cc0 df481ec4 00000003 00000000 00000003 c05c74d8 [ 24.200278] 1ec0: ded1d380 c071c6e0 c05c7514 c07105d8 01e2a738 c0069444 c06d905c 00000003 [ 24.208438] 1ee0: 00000003 ded1d380 c06d9064 00000004 c05c3fc0 c0067d4c df535ab0 ded1d380 [ 24.216596] 1f00: df481f80 ded1d380 00000004 ded1d1cc ded1d1c0 c0221724 00000004 c016ca6c [ 24.224756] 1f20: c016ca28 00000000 00000000 c016c1d4 00000000 00000000 b6f37000 df481f80 [ 24.232915] 1f40: decedd80 00000004 df480000 df480000 b6f37000 c0110920 df47839c 60000013 [ 24.241074] 1f60: 00000000 00000000 decedd80 decedd80 00000004 df480000 b6f37000 c0110da8 [ 24.249233] 1f80: 00000000 00000000 00000004 b6edf5d8 00000004 b6f37000 00000004 c000f2a8 [ 24.257393] 1fa0: 00001000 c000f0e0 b6edf5d8 00000004 00000001 b6f37000 00000004 00000000 [ 24.265551] 1fc0: b6edf5d8 00000004 b6f37000 00000004 00000004 00000001 00000000 01e2a738 [ 24.273711] 1fe0: 00000000 beba0a20 b6e1f4f0 b6e7022c 60000010 00000001 ffffffff ffffffff [ 24.281885] [<c048516c>] (mutex_lock) from [<c02a14b4>] (drm_modeset_lock_all+0x30/0xbc) [ 24.289950] [<c02a14b4>] (drm_modeset_lock_all) from [<c02aec7c>] (exynos_drm_suspend+0xc/0x64) [ 24.298627] [<c02aec7c>] (exynos_drm_suspend) from [<c02aecf4>] (exynos_drm_sys_suspend+0x20/0x34) [ 24.307568] [<c02aecf4>] (exynos_drm_sys_suspend) from [<c02c2010>] (platform_pm_suspend+0x2c/0x54) [ 24.316597] [<c02c2010>] (platform_pm_suspend) from [<c02c9470>] (dpm_run_callback+0x48/0x170) [ 24.325188] [<c02c9470>] (dpm_run_callback) from [<c02ca660>] (__device_suspend+0x128/0x39c) [ 24.333606] [<c02ca660>] (__device_suspend) from [<c02cbe18>] (dpm_suspend+0x5c/0x314) [ 24.341506] [<c02cbe18>] (dpm_suspend) from [<c0068a74>] (suspend_devices_and_enter+0x8c/0x598) [ 24.350185] [<c0068a74>] (suspend_devices_and_enter) from [<c0069444>] (pm_suspend+0x4c4/0x5d0) [ 24.358862] [<c0069444>] (pm_suspend) from [<c0067d4c>] (state_store+0x70/0xd4) [ 24.366156] [<c0067d4c>] (state_store) from [<c0221724>] (kobj_attr_store+0x14/0x20) [ 24.373885] [<c0221724>] (kobj_attr_store) from [<c016ca6c>] (sysfs_kf_write+0x44/0x48) [ 24.381867] [<c016ca6c>] (sysfs_kf_write) from [<c016c1d4>] (kernfs_fop_write+0xc0/0x17c) [ 24.390027] [<c016c1d4>] (kernfs_fop_write) from [<c0110920>] (vfs_write+0xa0/0x1c4) [ 24.397750] [<c0110920>] (vfs_write) from [<c0110da8>] (SyS_write+0x40/0x8c) [ 24.404782] [<c0110da8>] (SyS_write) from [<c000f0e0>] (ret_fast_syscall+0x0/0x3c) [ 24.412332] Code: e92d4010 e1a04000 f57ff05b f590f000 (e1903f9f) [ 24.418448] ---[ end trace cfa06690eabe8dd5 ]--- [ 24.423032] Kernel panic - not syncing: Fatal exception [ 24.428220] CPU1: stopping [ 24.430905] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G D 3.16.0-rc3-00035-geba20bbdde04-dirty #51 [ 24.440549] [<c0016440>] (unwind_backtrace) from [<c001294c>] (show_stack+0x10/0x14) [ 24.448269] [<c001294c>] (show_stack) from [<c04811e8>] (dump_stack+0x80/0xcc) [ 24.455472] [<c04811e8>] (dump_stack) from [<c001495c>] (handle_IPI+0x130/0x15c) [ 24.462850] [<c001495c>] (handle_IPI) from [<c000862c>] (gic_handle_irq+0x60/0x68) [ 24.470400] [<c000862c>] (gic_handle_irq) from [<c0013440>] (__irq_svc+0x40/0x70) [ 24.477860] Exception stack(0xdf4bdf88 to 0xdf4bdfd0) [ 24.482898] df80: ffffffed 00000000 00000000 00000000 df4bc000 c06d042c [ 24.491058] dfa0: 00000000 ffffffed c06d03c0 00000000 c070c288 00000000 00000000 df4bdfd0 [ 24.499214] dfc0: c0010324 c0010328 60000013 ffffffff [ 24.504254] [<c0013440>] (__irq_svc) from [<c0010328>] (arch_cpu_idle+0x28/0x30) [ 24.511634] [<c0010328>] (arch_cpu_idle) from [<c005f110>] (cpu_startup_entry+0x2c4/0x3f0) [ 24.519878] [<c005f110>] (cpu_startup_entry) from [<400086c4>] (0x400086c4) [ 24.526821] ---[ end Kernel panic - not syncing: Fatal exception Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2014-06-30 07:25:44 -06:00
if (pm_runtime_suspended(dev) || !drm_dev)
return 0;
private = drm_dev->dev_private;
drm_kms_helper_poll_disable(drm_dev);
exynos_drm_fbdev_suspend(drm_dev);
private->suspend_state = drm_atomic_helper_suspend(drm_dev);
if (IS_ERR(private->suspend_state)) {
exynos_drm_fbdev_resume(drm_dev);
drm_kms_helper_poll_enable(drm_dev);
return PTR_ERR(private->suspend_state);
}
return 0;
}
static int exynos_drm_resume(struct device *dev)
{
struct drm_device *drm_dev = dev_get_drvdata(dev);
struct exynos_drm_private *private;
drm/exynos: Fix NULL pointer exception when suspending without components Fix a NULL pointer exception when main exynos drm driver was probed successfully but no components were added (e.g. by incomplete DTS). In such case the exynos_drm_load() is never called and drvdata is NULL. The NULL pointer exception may theoretically also happen as a effect of race between adding components and main driver: if suspend of the driver happens before adding components. Trace: [ 1.190295] [drm] Initialized drm 1.1.0 20060810 [ 1.195209] exynos-drm-ipp exynos-drm-ipp: drm ipp registered successfully. (...) [ 24.001743] PM: Syncing filesystems ... done. [ 24.002177] Freezing user space processes ... (elapsed 0.000 seconds) done. [ 24.007403] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done. [ 24.032559] Unable to handle kernel NULL pointer dereference at virtual address 00000134 [ 24.035007] pgd = dedd8000 [ 24.037734] [00000134] *pgd=5ee13831, *pte=00000000, *ppte=00000000 [ 24.043953] Internal error: Oops: 17 [#1] PREEMPT SMP ARM [ 24.049329] Modules linked in: [ 24.052371] CPU: 0 PID: 1 Comm: sh Not tainted 3.16.0-rc3-00035-geba20bbdde04-dirty #51 [ 24.060354] task: df478000 ti: df480000 task.ti: df480000 [ 24.065743] PC is at mutex_lock+0x10/0x50 [ 24.069733] LR is at drm_modeset_lock_all+0x30/0xbc [ 24.074590] pc : [<c048516c>] lr : [<c02a14b4>] psr: a0000013 [ 24.074590] sp : df481db8 ip : 00000000 fp : c05e524c [ 24.086045] r10: 00000002 r9 : c02c1fe4 r8 : deca5e44 [ 24.091253] r7 : 00000000 r6 : 00000000 r5 : 0000014c r4 : 00000134 [ 24.097763] r3 : 00000000 r2 : 00000000 r1 : 00000000 r0 : 00000134 [ 24.104275] Flags: NzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user [ 24.111391] Control: 10c53c7d Table: 5edd806a DAC: 00000015 [ 24.117120] Process sh (pid: 1, stack limit = 0xdf480240) [ 24.122502] Stack: (0xdf481db8 to 0xdf482000) [ 24.126843] 1da0: dee01d80 c02a14b4 [ 24.135004] 1dc0: 00000000 00000000 c07aff98 c02aec7c 00000002 00000000 00000000 c07aff98 [ 24.143164] 1de0: deca5e10 c02aecf4 c02aecd4 c02c2010 00000000 c02c9470 00000000 00000000 [ 24.151322] 1e00: 00000000 00000000 deca5e10 deca5e10 00000000 c07aff98 00000002 deca5e44 [ 24.159482] 1e20: c06d8f78 c06fb800 deca5e78 c02ca660 df7baf00 007b0aa0 deca5e10 c06fb7c8 [ 24.167641] 1e40: c07aff98 00000000 00000002 c02cbe18 9757aec5 00000005 9757aec5 00000005 [ 24.175801] 1e60: ded1d380 00000003 00000003 c05c74d8 ded1d380 c07209d4 c05c7514 c07105d8 [ 24.183960] 1e80: 01e2a738 c0068a74 00000000 c05c7514 ded1d380 c071c6e0 00000004 c07105d8 [ 24.192119] 1ea0: 01e2a738 c047f1e0 c0600cc0 df481ec4 00000003 00000000 00000003 c05c74d8 [ 24.200278] 1ec0: ded1d380 c071c6e0 c05c7514 c07105d8 01e2a738 c0069444 c06d905c 00000003 [ 24.208438] 1ee0: 00000003 ded1d380 c06d9064 00000004 c05c3fc0 c0067d4c df535ab0 ded1d380 [ 24.216596] 1f00: df481f80 ded1d380 00000004 ded1d1cc ded1d1c0 c0221724 00000004 c016ca6c [ 24.224756] 1f20: c016ca28 00000000 00000000 c016c1d4 00000000 00000000 b6f37000 df481f80 [ 24.232915] 1f40: decedd80 00000004 df480000 df480000 b6f37000 c0110920 df47839c 60000013 [ 24.241074] 1f60: 00000000 00000000 decedd80 decedd80 00000004 df480000 b6f37000 c0110da8 [ 24.249233] 1f80: 00000000 00000000 00000004 b6edf5d8 00000004 b6f37000 00000004 c000f2a8 [ 24.257393] 1fa0: 00001000 c000f0e0 b6edf5d8 00000004 00000001 b6f37000 00000004 00000000 [ 24.265551] 1fc0: b6edf5d8 00000004 b6f37000 00000004 00000004 00000001 00000000 01e2a738 [ 24.273711] 1fe0: 00000000 beba0a20 b6e1f4f0 b6e7022c 60000010 00000001 ffffffff ffffffff [ 24.281885] [<c048516c>] (mutex_lock) from [<c02a14b4>] (drm_modeset_lock_all+0x30/0xbc) [ 24.289950] [<c02a14b4>] (drm_modeset_lock_all) from [<c02aec7c>] (exynos_drm_suspend+0xc/0x64) [ 24.298627] [<c02aec7c>] (exynos_drm_suspend) from [<c02aecf4>] (exynos_drm_sys_suspend+0x20/0x34) [ 24.307568] [<c02aecf4>] (exynos_drm_sys_suspend) from [<c02c2010>] (platform_pm_suspend+0x2c/0x54) [ 24.316597] [<c02c2010>] (platform_pm_suspend) from [<c02c9470>] (dpm_run_callback+0x48/0x170) [ 24.325188] [<c02c9470>] (dpm_run_callback) from [<c02ca660>] (__device_suspend+0x128/0x39c) [ 24.333606] [<c02ca660>] (__device_suspend) from [<c02cbe18>] (dpm_suspend+0x5c/0x314) [ 24.341506] [<c02cbe18>] (dpm_suspend) from [<c0068a74>] (suspend_devices_and_enter+0x8c/0x598) [ 24.350185] [<c0068a74>] (suspend_devices_and_enter) from [<c0069444>] (pm_suspend+0x4c4/0x5d0) [ 24.358862] [<c0069444>] (pm_suspend) from [<c0067d4c>] (state_store+0x70/0xd4) [ 24.366156] [<c0067d4c>] (state_store) from [<c0221724>] (kobj_attr_store+0x14/0x20) [ 24.373885] [<c0221724>] (kobj_attr_store) from [<c016ca6c>] (sysfs_kf_write+0x44/0x48) [ 24.381867] [<c016ca6c>] (sysfs_kf_write) from [<c016c1d4>] (kernfs_fop_write+0xc0/0x17c) [ 24.390027] [<c016c1d4>] (kernfs_fop_write) from [<c0110920>] (vfs_write+0xa0/0x1c4) [ 24.397750] [<c0110920>] (vfs_write) from [<c0110da8>] (SyS_write+0x40/0x8c) [ 24.404782] [<c0110da8>] (SyS_write) from [<c000f0e0>] (ret_fast_syscall+0x0/0x3c) [ 24.412332] Code: e92d4010 e1a04000 f57ff05b f590f000 (e1903f9f) [ 24.418448] ---[ end trace cfa06690eabe8dd5 ]--- [ 24.423032] Kernel panic - not syncing: Fatal exception [ 24.428220] CPU1: stopping [ 24.430905] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G D 3.16.0-rc3-00035-geba20bbdde04-dirty #51 [ 24.440549] [<c0016440>] (unwind_backtrace) from [<c001294c>] (show_stack+0x10/0x14) [ 24.448269] [<c001294c>] (show_stack) from [<c04811e8>] (dump_stack+0x80/0xcc) [ 24.455472] [<c04811e8>] (dump_stack) from [<c001495c>] (handle_IPI+0x130/0x15c) [ 24.462850] [<c001495c>] (handle_IPI) from [<c000862c>] (gic_handle_irq+0x60/0x68) [ 24.470400] [<c000862c>] (gic_handle_irq) from [<c0013440>] (__irq_svc+0x40/0x70) [ 24.477860] Exception stack(0xdf4bdf88 to 0xdf4bdfd0) [ 24.482898] df80: ffffffed 00000000 00000000 00000000 df4bc000 c06d042c [ 24.491058] dfa0: 00000000 ffffffed c06d03c0 00000000 c070c288 00000000 00000000 df4bdfd0 [ 24.499214] dfc0: c0010324 c0010328 60000013 ffffffff [ 24.504254] [<c0013440>] (__irq_svc) from [<c0010328>] (arch_cpu_idle+0x28/0x30) [ 24.511634] [<c0010328>] (arch_cpu_idle) from [<c005f110>] (cpu_startup_entry+0x2c4/0x3f0) [ 24.519878] [<c005f110>] (cpu_startup_entry) from [<400086c4>] (0x400086c4) [ 24.526821] ---[ end Kernel panic - not syncing: Fatal exception Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2014-06-30 07:25:44 -06:00
if (pm_runtime_suspended(dev) || !drm_dev)
return 0;
private = drm_dev->dev_private;
drm_atomic_helper_resume(drm_dev, private->suspend_state);
exynos_drm_fbdev_resume(drm_dev);
drm_kms_helper_poll_enable(drm_dev);
return 0;
}
#endif
static const struct dev_pm_ops exynos_drm_pm_ops = {
SET_SYSTEM_SLEEP_PM_OPS(exynos_drm_suspend, exynos_drm_resume)
};
/* forward declaration */
static struct platform_driver exynos_drm_platform_driver;
struct exynos_drm_driver_info {
struct platform_driver *driver;
unsigned int flags;
};
#define DRM_COMPONENT_DRIVER BIT(0) /* supports component framework */
#define DRM_VIRTUAL_DEVICE BIT(1) /* create virtual platform device */
#define DRM_DMA_DEVICE BIT(2) /* can be used for dma allocations */
#define DRM_FIMC_DEVICE BIT(3) /* devices shared with V4L2 subsystem */
#define DRV_PTR(drv, cond) (IS_ENABLED(cond) ? &drv : NULL)
/*
* Connector drivers should not be placed before associated crtc drivers,
* because connector requires pipe number of its crtc during initialization.
*/
static struct exynos_drm_driver_info exynos_drm_drivers[] = {
{
DRV_PTR(fimd_driver, CONFIG_DRM_EXYNOS_FIMD),
DRM_COMPONENT_DRIVER | DRM_DMA_DEVICE
}, {
DRV_PTR(exynos5433_decon_driver, CONFIG_DRM_EXYNOS5433_DECON),
DRM_COMPONENT_DRIVER | DRM_DMA_DEVICE
}, {
DRV_PTR(decon_driver, CONFIG_DRM_EXYNOS7_DECON),
DRM_COMPONENT_DRIVER | DRM_DMA_DEVICE
}, {
DRV_PTR(mixer_driver, CONFIG_DRM_EXYNOS_MIXER),
DRM_COMPONENT_DRIVER | DRM_DMA_DEVICE
}, {
DRV_PTR(mic_driver, CONFIG_DRM_EXYNOS_MIC),
DRM_COMPONENT_DRIVER
}, {
DRV_PTR(dp_driver, CONFIG_DRM_EXYNOS_DP),
DRM_COMPONENT_DRIVER
}, {
DRV_PTR(dsi_driver, CONFIG_DRM_EXYNOS_DSI),
DRM_COMPONENT_DRIVER
}, {
DRV_PTR(hdmi_driver, CONFIG_DRM_EXYNOS_HDMI),
DRM_COMPONENT_DRIVER
}, {
DRV_PTR(vidi_driver, CONFIG_DRM_EXYNOS_VIDI),
DRM_COMPONENT_DRIVER | DRM_VIRTUAL_DEVICE
}, {
DRV_PTR(g2d_driver, CONFIG_DRM_EXYNOS_G2D),
}, {
DRV_PTR(fimc_driver, CONFIG_DRM_EXYNOS_FIMC),
DRM_COMPONENT_DRIVER | DRM_FIMC_DEVICE,
}, {
DRV_PTR(rotator_driver, CONFIG_DRM_EXYNOS_ROTATOR),
DRM_COMPONENT_DRIVER
}, {
DRV_PTR(scaler_driver, CONFIG_DRM_EXYNOS_SCALER),
DRM_COMPONENT_DRIVER
}, {
DRV_PTR(gsc_driver, CONFIG_DRM_EXYNOS_GSC),
DRM_COMPONENT_DRIVER
}, {
&exynos_drm_platform_driver,
DRM_VIRTUAL_DEVICE
}
};
static int compare_dev(struct device *dev, void *data)
{
return dev == (struct device *)data;
}
static struct component_match *exynos_drm_match_add(struct device *dev)
{
struct component_match *match = NULL;
int i;
for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
struct device *p = NULL, *d;
if (!info->driver || !(info->flags & DRM_COMPONENT_DRIVER))
continue;
while ((d = bus_find_device(&platform_bus_type, p,
&info->driver->driver,
(void *)platform_bus_type.match))) {
put_device(p);
if (!(info->flags & DRM_FIMC_DEVICE) ||
exynos_drm_check_fimc_device(d) == 0)
component_match_add(dev, &match,
compare_dev, d);
p = d;
}
put_device(p);
}
return match ?: ERR_PTR(-ENODEV);
}
static struct device *exynos_drm_get_dma_device(void)
{
int i;
for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
struct device *dev;
if (!info->driver || !(info->flags & DRM_DMA_DEVICE))
continue;
while ((dev = bus_find_device(&platform_bus_type, NULL,
&info->driver->driver,
(void *)platform_bus_type.match))) {
put_device(dev);
return dev;
}
}
return NULL;
}
static int exynos_drm_bind(struct device *dev)
{
struct exynos_drm_private *private;
struct drm_encoder *encoder;
struct drm_device *drm;
unsigned int clone_mask;
int cnt, ret;
drm = drm_dev_alloc(&exynos_drm_driver, dev);
if (IS_ERR(drm))
return PTR_ERR(drm);
private = kzalloc(sizeof(struct exynos_drm_private), GFP_KERNEL);
if (!private) {
ret = -ENOMEM;
goto err_free_drm;
}
init_waitqueue_head(&private->wait);
spin_lock_init(&private->lock);
dev_set_drvdata(dev, drm);
drm->dev_private = (void *)private;
/* the first real CRTC device is used for all dma mapping operations */
private->dma_dev = exynos_drm_get_dma_device();
if (!private->dma_dev) {
DRM_ERROR("no device found for DMA mapping operations.\n");
ret = -ENODEV;
goto err_free_private;
}
DRM_INFO("Exynos DRM: using %s device for DMA mapping operations\n",
dev_name(private->dma_dev));
/* create common IOMMU mapping for all devices attached to Exynos DRM */
ret = drm_create_iommu_mapping(drm);
if (ret < 0) {
DRM_ERROR("failed to create iommu mapping.\n");
goto err_free_private;
}
drm_mode_config_init(drm);
exynos_drm_mode_config_init(drm);
/* setup possible_clones. */
cnt = 0;
clone_mask = 0;
list_for_each_entry(encoder, &drm->mode_config.encoder_list, head)
clone_mask |= (1 << (cnt++));
list_for_each_entry(encoder, &drm->mode_config.encoder_list, head)
encoder->possible_clones = clone_mask;
/* Try to bind all sub drivers. */
ret = component_bind_all(drm->dev, drm);
if (ret)
goto err_mode_config_cleanup;
ret = drm_vblank_init(drm, drm->mode_config.num_crtc);
if (ret)
goto err_unbind_all;
/* Probe non kms sub drivers and virtual display driver. */
ret = exynos_drm_device_subdrv_probe(drm);
if (ret)
goto err_unbind_all;
drm_mode_config_reset(drm);
/*
* enable drm irq mode.
* - with irq_enabled = true, we can use the vblank feature.
*
* P.S. note that we wouldn't use drm irq handler but
* just specific driver own one instead because
* drm framework supports only one irq handler.
*/
drm->irq_enabled = true;
/* init kms poll for handling hpd */
drm_kms_helper_poll_init(drm);
ret = exynos_drm_fbdev_init(drm);
if (ret)
goto err_cleanup_poll;
/* register the DRM device */
ret = drm_dev_register(drm, 0);
if (ret < 0)
goto err_cleanup_fbdev;
return 0;
err_cleanup_fbdev:
exynos_drm_fbdev_fini(drm);
err_cleanup_poll:
drm_kms_helper_poll_fini(drm);
exynos_drm_device_subdrv_remove(drm);
err_unbind_all:
component_unbind_all(drm->dev, drm);
err_mode_config_cleanup:
drm_mode_config_cleanup(drm);
drm_release_iommu_mapping(drm);
err_free_private:
kfree(private);
err_free_drm:
drm_dev_unref(drm);
return ret;
}
static void exynos_drm_unbind(struct device *dev)
{
struct drm_device *drm = dev_get_drvdata(dev);
drm_dev_unregister(drm);
exynos_drm_device_subdrv_remove(drm);
exynos_drm_fbdev_fini(drm);
drm_kms_helper_poll_fini(drm);
component_unbind_all(drm->dev, drm);
drm_mode_config_cleanup(drm);
drm_release_iommu_mapping(drm);
kfree(drm->dev_private);
drm->dev_private = NULL;
dev_set_drvdata(dev, NULL);
drm_dev_unref(drm);
}
static const struct component_master_ops exynos_drm_ops = {
.bind = exynos_drm_bind,
.unbind = exynos_drm_unbind,
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
};
static int exynos_drm_platform_probe(struct platform_device *pdev)
{
struct component_match *match;
pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
match = exynos_drm_match_add(&pdev->dev);
if (IS_ERR(match))
return PTR_ERR(match);
return component_master_add_with_match(&pdev->dev, &exynos_drm_ops,
match);
}
static int exynos_drm_platform_remove(struct platform_device *pdev)
{
component_master_del(&pdev->dev, &exynos_drm_ops);
return 0;
}
static struct platform_driver exynos_drm_platform_driver = {
.probe = exynos_drm_platform_probe,
.remove = exynos_drm_platform_remove,
.driver = {
.name = "exynos-drm",
.pm = &exynos_drm_pm_ops,
},
};
static void exynos_drm_unregister_devices(void)
{
int i;
for (i = ARRAY_SIZE(exynos_drm_drivers) - 1; i >= 0; --i) {
struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
struct device *dev;
if (!info->driver || !(info->flags & DRM_VIRTUAL_DEVICE))
continue;
while ((dev = bus_find_device(&platform_bus_type, NULL,
&info->driver->driver,
(void *)platform_bus_type.match))) {
put_device(dev);
platform_device_unregister(to_platform_device(dev));
}
}
}
static int exynos_drm_register_devices(void)
{
struct platform_device *pdev;
int i;
for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
if (!info->driver || !(info->flags & DRM_VIRTUAL_DEVICE))
continue;
pdev = platform_device_register_simple(
info->driver->driver.name, -1, NULL, 0);
if (IS_ERR(pdev))
goto fail;
}
return 0;
fail:
exynos_drm_unregister_devices();
return PTR_ERR(pdev);
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
}
static void exynos_drm_unregister_drivers(void)
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
{
int i;
for (i = ARRAY_SIZE(exynos_drm_drivers) - 1; i >= 0; --i) {
struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
if (!info->driver)
continue;
platform_driver_unregister(info->driver);
}
}
static int exynos_drm_register_drivers(void)
{
int i, ret;
for (i = 0; i < ARRAY_SIZE(exynos_drm_drivers); ++i) {
struct exynos_drm_driver_info *info = &exynos_drm_drivers[i];
if (!info->driver)
continue;
ret = platform_driver_register(info->driver);
if (ret)
goto fail;
}
return 0;
fail:
exynos_drm_unregister_drivers();
return ret;
}
static int exynos_drm_init(void)
{
int ret;
ret = exynos_drm_register_devices();
if (ret)
return ret;
drm/exynos: move Exynos platform drivers registration to init Registering the Exynos DRM subdevices platform drivers in the probe function is causing an infinite loop. Fix this by moving it to the exynos_drm_init() function to register the drivers on module init. Registering drivers in the probe functions causes a deadlock in the parent device lock. See Grant Likely explanation on the topic: "I think the problem is that exynos_drm_init() is registering a normal (non-OF) platform device, so the parent will be /sys/devices/platform. It immediately gets bound against exynos_drm_platform_driver which calls the exynos drm_platform_probe() hook. The driver core obtains device_lock() on the device *and on the device parent*. Inside the probe hook, additional platform_drivers get registered. Each time one does, it tries to bind against every platform device in the system, which includes the ones created by OF. When it attempts to bind, it obtains device_lock() on the device *and on the device parent*. Before the change to move of-generated platform devices into /sys/devices/platform, the devices had different parents. Now both devices have /sys/devices/platform as the parent, so yes they are going to deadlock. The real problem is registering drivers from within a probe hook. That is completely wrong for the above deadlock reason. __driver_attach() will deadlock. Those registrations must be pulled out of .probe(). Registering devices in .probe() is okay because __device_attach() doesn't try to obtain device_lock() on the parent." INFO: task swapper/0:1 blocked for more than 120 seconds. Not tainted 3.18.0-rc3-next-20141105 #794 "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. swapper/0 D c052534c 0 1 0 0x00000000 [<c052534c>] (__schedule) from [<c0525b34>] (schedule_preempt_disabled+0x14/0x20) [<c0525b34>] (schedule_preempt_disabled) from [<c0526d44>] (mutex_lock_nested+0x1c4/0x464 [<c0526d44>] (mutex_lock_nested) from [<c02be908>] (__driver_attach+0x48/0x98) [<c02be908>] (__driver_attach) from [<c02bcc00>] (bus_for_each_dev+0x54/0x88) [<c02bcc00>] (bus_for_each_dev) from [<c02bdce0>] (bus_add_driver+0xe4/0x200) [<c02bdce0>] (bus_add_driver) from [<c02bef94>] (driver_register+0x78/0xf4) [<c02bef94>] (driver_register) from [<c029e99c>] (exynos_drm_platform_probe+0x34/0x234) [<c029e99c>] (exynos_drm_platform_probe) from [<c02bfcf0>] (platform_drv_probe+0x48/0xa4) [<c02bfcf0>] (platform_drv_probe) from [<c02be680>] (driver_probe_device+0x13c/0x37c) [<c02be680>] (driver_probe_device) from [<c02be954>] (__driver_attach+0x94/0x98) [<c02be954>] (__driver_attach) from [<c02bcc00>] (bus_for_each_dev+0x54/0x88) [<c02bcc00>] (bus_for_each_dev) from [<c02bdce0>] (bus_add_driver+0xe4/0x200) [<c02bdce0>] (bus_add_driver) from [<c02bef94>] (driver_register+0x78/0xf4) [<c02bef94>] (driver_register) from [<c029e938>] (exynos_drm_init+0x70/0xa0) [<c029e938>] (exynos_drm_init) from [<c00089b0>] (do_one_initcall+0xac/0x1f0) [<c00089b0>] (do_one_initcall) from [<c074bd90>] (kernel_init_freeable+0x10c/0x1d8) [<c074bd90>] (kernel_init_freeable) from [<c051eabc>] (kernel_init+0x8/0xec) [<c051eabc>] (kernel_init) from [<c000f268>] (ret_from_fork+0x14/0x2c) 3 locks held by swapper/0/1: #0: (&dev->mutex){......}, at: [<c02be908>] __driver_attach+0x48/0x98 #1: (&dev->mutex){......}, at: [<c02be918>] __driver_attach+0x58/0x98 #2: (&dev->mutex){......}, at: [<c02be908>] __driver_attach+0x48/0x98 Changelog v2: - call platform_driver_register after all kms and non kms drivers are registered - rebased it to exynos-drm-next Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Inki Dae <inki.dae@samsung.com>
2014-11-24 00:37:26 -07:00
ret = exynos_drm_register_drivers();
if (ret)
goto err_unregister_pdevs;
return 0;
err_unregister_pdevs:
exynos_drm_unregister_devices();
return ret;
}
static void exynos_drm_exit(void)
{
exynos_drm_unregister_drivers();
exynos_drm_unregister_devices();
DRM: add DRM Driver for Samsung SoC EXYNOS4210. This patch is a DRM Driver for Samsung SoC Exynos4210 and now enables only FIMD yet but we will add HDMI support also in the future. this patch is based on git repository below: git://people.freedesktop.org/~airlied/linux.git branch name: drm-next commit-id: 88ef4e3f4f616462b78a7838eb3ffc3818d30f67 you can refer to our working repository below: http://git.infradead.org/users/kmpark/linux-2.6-samsung branch name: samsung-drm We tried to re-use lowlevel codes of the FIMD driver(s3c-fb.c based on Linux framebuffer) but couldn't so because lowlevel codes of s3c-fb.c are included internally and so FIMD module of this driver has its own lowlevel codes. We used GEM framework for buffer management and DMA APIs(dma_alloc_*) for buffer allocation so we can allocate physically continuous memory for DMA through it and also we could use CMA later if CMA is applied to mainline. Refer to this link for CMA(Continuous Memory Allocator): http://lkml.org/lkml/2011/7/20/45 this driver supports only physically continuous memory(non-iommu). Links to previous versions of the patchset: v1: < https://lwn.net/Articles/454380/ > v2: < http://www.spinics.net/lists/kernel/msg1224275.html > v3: < http://www.spinics.net/lists/dri-devel/msg13755.html > v4: < http://permalink.gmane.org/gmane.comp.video.dri.devel/60439 > v5: < http://comments.gmane.org/gmane.comp.video.dri.devel/60802 > Changelog v2: DRM: add DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl command. this feature maps user address space to physical memory region once user application requests DRM_IOCTL_SAMSUNG_GEM_MMAP ioctl. DRM: code clean and add exception codes. Changelog v3: DRM: Support multiple irq. FIMD and HDMI have their own irq handler but DRM Framework can regiter only one irq handler this patch supports mutiple irq for Samsung SoC. DRM: Consider modularization. each DRM, FIMD could be built as a module. DRM: Have indenpendent crtc object. crtc isn't specific to SoC Platform so this patch gets a crtc to be used as common object. created crtc could be attached to any encoder object. DRM: code clean and add exception codes. Changelog v4: DRM: remove is_defult from samsung_fb. is_default isn't used for default framebuffer. DRM: code refactoring to fimd module. this patch is be considered with multiple display objects and would use its own request_irq() to register a irq handler instead of drm framework's one. DRM: remove find_samsung_drm_gem_object() DRM: move kernel private data structures and definitions to driver folder. samsung_drm.h would contain only public information for userspace ioctl interface. DRM: code refactoring to gem modules. buffer module isn't dependent of gem module anymore. DRM: fixed security issue. DRM: remove encoder porinter from specific connector. samsung connector doesn't need to have generic encoder. DRM: code clean and add exception codes. Changelog v5: DRM: updated fimd(display controller) driver. added various pixel formats, color key and pixel blending features. DRM: removed end_buf_off from samsung_drm_overlay structure. this variable isn't used and end buffer address would be calculated by each sub driver. DRM: use generic function for mmap_offset. replaced samsung_drm_gem_create_mmap_offset() and samsung_drm_free_mmap_offset() with generic ones applied to mainline recentrly. DRM: removed unnecessary codes and added exception codes. DRM: added comments and code clean. Changelog v6: DRM: added default config options. DRM: added padding for 64-bit align. DRM: changed prefix 'samsung' to 'exynos' Signed-off-by: Inki Dae <inki.dae@samsung.com> Signed-off-by: Joonyoung Shim <jy0922.shim@samsung.com> Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com> Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> Reviewed-by: Dave Airlie <airlied@redhat.com> Reviewed-by: Rob Clark <robdclark@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2011-10-04 04:19:01 -06:00
}
module_init(exynos_drm_init);
module_exit(exynos_drm_exit);
MODULE_AUTHOR("Inki Dae <inki.dae@samsung.com>");
MODULE_AUTHOR("Joonyoung Shim <jy0922.shim@samsung.com>");
MODULE_AUTHOR("Seung-Woo Kim <sw0312.kim@samsung.com>");
MODULE_DESCRIPTION("Samsung SoC DRM Driver");
MODULE_LICENSE("GPL");