aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/exynos/exynos_mixer.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_mixer.c')
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c40
1 files changed, 19 insertions, 21 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 4d5f41e19527..e15438c01129 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -37,7 +37,8 @@
37#include "exynos_drm_drv.h" 37#include "exynos_drm_drv.h"
38#include "exynos_drm_hdmi.h" 38#include "exynos_drm_hdmi.h"
39 39
40#define HDMI_OVERLAY_NUMBER 3 40#define MIXER_WIN_NR 3
41#define MIXER_DEFAULT_WIN 0
41 42
42#define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev)) 43#define get_mixer_context(dev) platform_get_drvdata(to_platform_device(dev))
43 44
@@ -75,16 +76,12 @@ struct mixer_resources {
75}; 76};
76 77
77struct mixer_context { 78struct mixer_context {
78 struct fb_videomode *default_timing;
79 unsigned int default_win;
80 unsigned int default_bpp;
81 unsigned int irq; 79 unsigned int irq;
82 int pipe; 80 int pipe;
83 bool interlace; 81 bool interlace;
84 bool vp_enabled;
85 82
86 struct mixer_resources mixer_res; 83 struct mixer_resources mixer_res;
87 struct hdmi_win_data win_data[HDMI_OVERLAY_NUMBER]; 84 struct hdmi_win_data win_data[MIXER_WIN_NR];
88}; 85};
89 86
90static const u8 filter_y_horiz_tap8[] = { 87static const u8 filter_y_horiz_tap8[] = {
@@ -643,9 +640,9 @@ static void mixer_win_mode_set(void *ctx,
643 640
644 win = overlay->zpos; 641 win = overlay->zpos;
645 if (win == DEFAULT_ZPOS) 642 if (win == DEFAULT_ZPOS)
646 win = mixer_ctx->default_win; 643 win = MIXER_DEFAULT_WIN;
647 644
648 if (win < 0 || win > HDMI_OVERLAY_NUMBER) { 645 if (win < 0 || win > MIXER_WIN_NR) {
649 DRM_ERROR("overlay plane[%d] is wrong\n", win); 646 DRM_ERROR("overlay plane[%d] is wrong\n", win);
650 return; 647 return;
651 } 648 }
@@ -683,9 +680,9 @@ static void mixer_win_commit(void *ctx, int zpos)
683 DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); 680 DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win);
684 681
685 if (win == DEFAULT_ZPOS) 682 if (win == DEFAULT_ZPOS)
686 win = mixer_ctx->default_win; 683 win = MIXER_DEFAULT_WIN;
687 684
688 if (win < 0 || win > HDMI_OVERLAY_NUMBER) { 685 if (win < 0 || win > MIXER_WIN_NR) {
689 DRM_ERROR("overlay plane[%d] is wrong\n", win); 686 DRM_ERROR("overlay plane[%d] is wrong\n", win);
690 return; 687 return;
691 } 688 }
@@ -706,9 +703,9 @@ static void mixer_win_disable(void *ctx, int zpos)
706 DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win); 703 DRM_DEBUG_KMS("[%d] %s, win: %d\n", __LINE__, __func__, win);
707 704
708 if (win == DEFAULT_ZPOS) 705 if (win == DEFAULT_ZPOS)
709 win = mixer_ctx->default_win; 706 win = MIXER_DEFAULT_WIN;
710 707
711 if (win < 0 || win > HDMI_OVERLAY_NUMBER) { 708 if (win < 0 || win > MIXER_WIN_NR) {
712 DRM_ERROR("overlay plane[%d] is wrong\n", win); 709 DRM_ERROR("overlay plane[%d] is wrong\n", win);
713 return; 710 return;
714 } 711 }
@@ -722,9 +719,12 @@ static void mixer_win_disable(void *ctx, int zpos)
722 spin_unlock_irqrestore(&res->reg_slock, flags); 719 spin_unlock_irqrestore(&res->reg_slock, flags);
723} 720}
724 721
725static struct exynos_hdmi_overlay_ops overlay_ops = { 722static struct exynos_mixer_ops mixer_ops = {
723 /* manager */
726 .enable_vblank = mixer_enable_vblank, 724 .enable_vblank = mixer_enable_vblank,
727 .disable_vblank = mixer_disable_vblank, 725 .disable_vblank = mixer_disable_vblank,
726
727 /* overlay */
728 .win_mode_set = mixer_win_mode_set, 728 .win_mode_set = mixer_win_mode_set,
729 .win_commit = mixer_win_commit, 729 .win_commit = mixer_win_commit,
730 .win_disable = mixer_win_disable, 730 .win_disable = mixer_win_disable,
@@ -771,8 +771,7 @@ static void mixer_finish_pageflip(struct drm_device *drm_dev, int crtc)
771static irqreturn_t mixer_irq_handler(int irq, void *arg) 771static irqreturn_t mixer_irq_handler(int irq, void *arg)
772{ 772{
773 struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg; 773 struct exynos_drm_hdmi_context *drm_hdmi_ctx = arg;
774 struct mixer_context *ctx = 774 struct mixer_context *ctx = drm_hdmi_ctx->ctx;
775 (struct mixer_context *)drm_hdmi_ctx->ctx;
776 struct mixer_resources *res = &ctx->mixer_res; 775 struct mixer_resources *res = &ctx->mixer_res;
777 u32 val, val_base; 776 u32 val, val_base;
778 777
@@ -902,7 +901,7 @@ static int mixer_runtime_resume(struct device *dev)
902 901
903 DRM_DEBUG_KMS("resume - start\n"); 902 DRM_DEBUG_KMS("resume - start\n");
904 903
905 mixer_resource_poweron((struct mixer_context *)ctx->ctx); 904 mixer_resource_poweron(ctx->ctx);
906 905
907 return 0; 906 return 0;
908} 907}
@@ -913,7 +912,7 @@ static int mixer_runtime_suspend(struct device *dev)
913 912
914 DRM_DEBUG_KMS("suspend - start\n"); 913 DRM_DEBUG_KMS("suspend - start\n");
915 914
916 mixer_resource_poweroff((struct mixer_context *)ctx->ctx); 915 mixer_resource_poweroff(ctx->ctx);
917 916
918 return 0; 917 return 0;
919} 918}
@@ -926,8 +925,7 @@ static const struct dev_pm_ops mixer_pm_ops = {
926static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx, 925static int __devinit mixer_resources_init(struct exynos_drm_hdmi_context *ctx,
927 struct platform_device *pdev) 926 struct platform_device *pdev)
928{ 927{
929 struct mixer_context *mixer_ctx = 928 struct mixer_context *mixer_ctx = ctx->ctx;
930 (struct mixer_context *)ctx->ctx;
931 struct device *dev = &pdev->dev; 929 struct device *dev = &pdev->dev;
932 struct mixer_resources *mixer_res = &mixer_ctx->mixer_res; 930 struct mixer_resources *mixer_res = &mixer_ctx->mixer_res;
933 struct resource *res; 931 struct resource *res;
@@ -1076,7 +1074,7 @@ static int __devinit mixer_probe(struct platform_device *pdev)
1076 goto fail; 1074 goto fail;
1077 1075
1078 /* register specific callback point to common hdmi. */ 1076 /* register specific callback point to common hdmi. */
1079 exynos_drm_overlay_ops_register(&overlay_ops); 1077 exynos_mixer_ops_register(&mixer_ops);
1080 1078
1081 mixer_resource_poweron(ctx); 1079 mixer_resource_poweron(ctx);
1082 1080
@@ -1093,7 +1091,7 @@ static int mixer_remove(struct platform_device *pdev)
1093 struct device *dev = &pdev->dev; 1091 struct device *dev = &pdev->dev;
1094 struct exynos_drm_hdmi_context *drm_hdmi_ctx = 1092 struct exynos_drm_hdmi_context *drm_hdmi_ctx =
1095 platform_get_drvdata(pdev); 1093 platform_get_drvdata(pdev);
1096 struct mixer_context *ctx = (struct mixer_context *)drm_hdmi_ctx->ctx; 1094 struct mixer_context *ctx = drm_hdmi_ctx->ctx;
1097 1095
1098 dev_info(dev, "remove successful\n"); 1096 dev_info(dev, "remove successful\n");
1099 1097