diff options
| -rw-r--r-- | drivers/gpu/drm/exynos/Kconfig | 6 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/Makefile | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.c | 15 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.h | 1 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimc.c | 2001 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimc.h | 37 | ||||
| -rw-r--r-- | drivers/gpu/drm/exynos/regs-fimc.h | 669 | ||||
| -rw-r--r-- | include/drm/exynos_drm.h | 26 |
8 files changed, 2756 insertions, 0 deletions
diff --git a/drivers/gpu/drm/exynos/Kconfig b/drivers/gpu/drm/exynos/Kconfig index 80ab242e2739..66c02df360e7 100644 --- a/drivers/gpu/drm/exynos/Kconfig +++ b/drivers/gpu/drm/exynos/Kconfig | |||
| @@ -51,3 +51,9 @@ config DRM_EXYNOS_IPP | |||
| 51 | depends on DRM_EXYNOS | 51 | depends on DRM_EXYNOS |
| 52 | help | 52 | help |
| 53 | Choose this option if you want to use IPP feature for DRM. | 53 | Choose this option if you want to use IPP feature for DRM. |
| 54 | |||
| 55 | config DRM_EXYNOS_FIMC | ||
| 56 | bool "Exynos DRM FIMC" | ||
| 57 | depends on DRM_EXYNOS_IPP | ||
| 58 | help | ||
| 59 | Choose this option if you want to use Exynos FIMC for DRM. | ||
diff --git a/drivers/gpu/drm/exynos/Makefile b/drivers/gpu/drm/exynos/Makefile index 6c536ce4d95b..9710024ed000 100644 --- a/drivers/gpu/drm/exynos/Makefile +++ b/drivers/gpu/drm/exynos/Makefile | |||
| @@ -17,5 +17,6 @@ exynosdrm-$(CONFIG_DRM_EXYNOS_HDMI) += exynos_hdmi.o exynos_mixer.o \ | |||
| 17 | exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o | 17 | exynosdrm-$(CONFIG_DRM_EXYNOS_VIDI) += exynos_drm_vidi.o |
| 18 | exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o | 18 | exynosdrm-$(CONFIG_DRM_EXYNOS_G2D) += exynos_drm_g2d.o |
| 19 | exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o | 19 | exynosdrm-$(CONFIG_DRM_EXYNOS_IPP) += exynos_drm_ipp.o |
| 20 | exynosdrm-$(CONFIG_DRM_EXYNOS_FIMC) += exynos_drm_fimc.o | ||
| 20 | 21 | ||
| 21 | obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.o | 22 | obj-$(CONFIG_DRM_EXYNOS) += exynosdrm.o |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c index 0eb8a972e21c..73f02ac53bad 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c | |||
| @@ -372,6 +372,12 @@ static int __init exynos_drm_init(void) | |||
| 372 | goto out_g2d; | 372 | goto out_g2d; |
| 373 | #endif | 373 | #endif |
| 374 | 374 | ||
| 375 | #ifdef CONFIG_DRM_EXYNOS_FIMC | ||
| 376 | ret = platform_driver_register(&fimc_driver); | ||
| 377 | if (ret < 0) | ||
| 378 | goto out_fimc; | ||
| 379 | #endif | ||
| 380 | |||
| 375 | #ifdef CONFIG_DRM_EXYNOS_IPP | 381 | #ifdef CONFIG_DRM_EXYNOS_IPP |
| 376 | ret = platform_driver_register(&ipp_driver); | 382 | ret = platform_driver_register(&ipp_driver); |
| 377 | if (ret < 0) | 383 | if (ret < 0) |
| @@ -400,6 +406,11 @@ out_drm: | |||
| 400 | out_ipp: | 406 | out_ipp: |
| 401 | #endif | 407 | #endif |
| 402 | 408 | ||
| 409 | #ifdef CONFIG_DRM_EXYNOS_FIMC | ||
| 410 | platform_driver_unregister(&fimc_driver); | ||
| 411 | out_fimc: | ||
| 412 | #endif | ||
| 413 | |||
| 403 | #ifdef CONFIG_DRM_EXYNOS_G2D | 414 | #ifdef CONFIG_DRM_EXYNOS_G2D |
| 404 | platform_driver_unregister(&g2d_driver); | 415 | platform_driver_unregister(&g2d_driver); |
| 405 | out_g2d: | 416 | out_g2d: |
| @@ -440,6 +451,10 @@ static void __exit exynos_drm_exit(void) | |||
| 440 | platform_driver_unregister(&ipp_driver); | 451 | platform_driver_unregister(&ipp_driver); |
| 441 | #endif | 452 | #endif |
| 442 | 453 | ||
| 454 | #ifdef CONFIG_DRM_EXYNOS_FIMC | ||
| 455 | platform_driver_unregister(&fimc_driver); | ||
| 456 | #endif | ||
| 457 | |||
| 443 | #ifdef CONFIG_DRM_EXYNOS_G2D | 458 | #ifdef CONFIG_DRM_EXYNOS_G2D |
| 444 | platform_driver_unregister(&g2d_driver); | 459 | platform_driver_unregister(&g2d_driver); |
| 445 | #endif | 460 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 44ab3c7b6a90..63803508e4df 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
| @@ -349,5 +349,6 @@ extern struct platform_driver mixer_driver; | |||
| 349 | extern struct platform_driver exynos_drm_common_hdmi_driver; | 349 | extern struct platform_driver exynos_drm_common_hdmi_driver; |
| 350 | extern struct platform_driver vidi_driver; | 350 | extern struct platform_driver vidi_driver; |
| 351 | extern struct platform_driver g2d_driver; | 351 | extern struct platform_driver g2d_driver; |
| 352 | extern struct platform_driver fimc_driver; | ||
| 352 | extern struct platform_driver ipp_driver; | 353 | extern struct platform_driver ipp_driver; |
| 353 | #endif | 354 | #endif |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimc.c b/drivers/gpu/drm/exynos/exynos_drm_fimc.c new file mode 100644 index 000000000000..61ea24296b52 --- /dev/null +++ b/drivers/gpu/drm/exynos/exynos_drm_fimc.c | |||
| @@ -0,0 +1,2001 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2012 Samsung Electronics Co.Ltd | ||
| 3 | * Authors: | ||
| 4 | * Eunchul Kim <chulspro.kim@samsung.com> | ||
| 5 | * Jinyoung Jeon <jy0.jeon@samsung.com> | ||
| 6 | * Sangmin Lee <lsmin.lee@samsung.com> | ||
| 7 | * | ||
| 8 | * This program is free software; you can redistribute it and/or modify it | ||
| 9 | * under the terms of the GNU General Public License as published by the | ||
| 10 | * Free Software Foundation; either version 2 of the License, or (at your | ||
| 11 | * option) any later version. | ||
| 12 | * | ||
| 13 | */ | ||
| 14 | #include <linux/kernel.h> | ||
| 15 | #include <linux/module.h> | ||
| 16 | #include <linux/platform_device.h> | ||
| 17 | #include <linux/clk.h> | ||
| 18 | #include <linux/pm_runtime.h> | ||
| 19 | #include <plat/map-base.h> | ||
| 20 | |||
| 21 | #include <drm/drmP.h> | ||
| 22 | #include <drm/exynos_drm.h> | ||
| 23 | #include "regs-fimc.h" | ||
| 24 | #include "exynos_drm_ipp.h" | ||
| 25 | #include "exynos_drm_fimc.h" | ||
| 26 | |||
| 27 | /* | ||
| 28 | * FIMC is stand for Fully Interactive Mobile Camera and | ||
| 29 | * supports image scaler/rotator and input/output DMA operations. | ||
| 30 | * input DMA reads image data from the memory. | ||
| 31 | * output DMA writes image data to memory. | ||
| 32 | * FIMC supports image rotation and image effect functions. | ||
| 33 | * | ||
| 34 | * M2M operation : supports crop/scale/rotation/csc so on. | ||
| 35 | * Memory ----> FIMC H/W ----> Memory. | ||
| 36 | * Writeback operation : supports cloned screen with FIMD. | ||
| 37 | * FIMD ----> FIMC H/W ----> Memory. | ||
| 38 | * Output operation : supports direct display using local path. | ||
| 39 | * Memory ----> FIMC H/W ----> FIMD. | ||
| 40 | */ | ||
| 41 | |||
| 42 | /* | ||
| 43 | * TODO | ||
| 44 | * 1. check suspend/resume api if needed. | ||
| 45 | * 2. need to check use case platform_device_id. | ||
| 46 | * 3. check src/dst size with, height. | ||
| 47 | * 4. added check_prepare api for right register. | ||
| 48 | * 5. need to add supported list in prop_list. | ||
| 49 | * 6. check prescaler/scaler optimization. | ||
| 50 | */ | ||
| 51 | |||
| 52 | #define FIMC_MAX_DEVS 4 | ||
| 53 | #define FIMC_MAX_SRC 2 | ||
| 54 | #define FIMC_MAX_DST 32 | ||
| 55 | #define FIMC_SHFACTOR 10 | ||
| 56 | #define FIMC_BUF_STOP 1 | ||
| 57 | #define FIMC_BUF_START 2 | ||
| 58 | #define FIMC_REG_SZ 32 | ||
| 59 | #define FIMC_WIDTH_ITU_709 1280 | ||
| 60 | #define FIMC_REFRESH_MAX 60 | ||
| 61 | #define FIMC_REFRESH_MIN 12 | ||
| 62 | #define FIMC_CROP_MAX 8192 | ||
| 63 | #define FIMC_CROP_MIN 32 | ||
| 64 | #define FIMC_SCALE_MAX 4224 | ||
| 65 | #define FIMC_SCALE_MIN 32 | ||
| 66 | |||
| 67 | #define get_fimc_context(dev) platform_get_drvdata(to_platform_device(dev)) | ||
| 68 | #define get_ctx_from_ippdrv(ippdrv) container_of(ippdrv,\ | ||
| 69 | struct fimc_context, ippdrv); | ||
| 70 | #define fimc_read(offset) readl(ctx->regs + (offset)) | ||
| 71 | #define fimc_write(cfg, offset) writel(cfg, ctx->regs + (offset)) | ||
| 72 | |||
| 73 | enum fimc_wb { | ||
| 74 | FIMC_WB_NONE, | ||
| 75 | FIMC_WB_A, | ||
| 76 | FIMC_WB_B, | ||
| 77 | }; | ||
| 78 | |||
| 79 | /* | ||
| 80 | * A structure of scaler. | ||
| 81 | * | ||
| 82 | * @range: narrow, wide. | ||
| 83 | * @bypass: unused scaler path. | ||
| 84 | * @up_h: horizontal scale up. | ||
| 85 | * @up_v: vertical scale up. | ||
| 86 | * @hratio: horizontal ratio. | ||
| 87 | * @vratio: vertical ratio. | ||
| 88 | */ | ||
| 89 | struct fimc_scaler { | ||
| 90 | bool range; | ||
| 91 | bool bypass; | ||
| 92 | bool up_h; | ||
| 93 | bool up_v; | ||
| 94 | u32 hratio; | ||
| 95 | u32 vratio; | ||
| 96 | }; | ||
| 97 | |||
| 98 | /* | ||
| 99 | * A structure of scaler capability. | ||
| 100 | * | ||
| 101 | * find user manual table 43-1. | ||
| 102 | * @in_hori: scaler input horizontal size. | ||
| 103 | * @bypass: scaler bypass mode. | ||
| 104 | * @dst_h_wo_rot: target horizontal size without output rotation. | ||
| 105 | * @dst_h_rot: target horizontal size with output rotation. | ||
| 106 | * @rl_w_wo_rot: real width without input rotation. | ||
| 107 | * @rl_h_rot: real height without output rotation. | ||
| 108 | */ | ||
| 109 | struct fimc_capability { | ||
| 110 | /* scaler */ | ||
| 111 | u32 in_hori; | ||
| 112 | u32 bypass; | ||
| 113 | /* output rotator */ | ||
| 114 | u32 dst_h_wo_rot; | ||
| 115 | u32 dst_h_rot; | ||
| 116 | /* input rotator */ | ||
| 117 | u32 rl_w_wo_rot; | ||
| 118 | u32 rl_h_rot; | ||
| 119< | |||
