aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorRahul Sharma <rahul.sharma@samsung.com>2012-10-04 11:18:53 -0400
committerInki Dae <inki.dae@samsung.com>2012-10-05 06:15:10 -0400
commitaaf8b49e928d58501759e94cc744e97ad9812e68 (patch)
treef6eaccd2a365f1889d0523851c1fcacf1f6892ae /drivers/gpu/drm
parent1b8e5747a9b65928a5a126d128847b29128cae34 (diff)
drm: exynos: hdmi: add support for exynos5 mixer
This patch adds support for exynos5 mixer with device tree enabled. Signed-off-by: Rahul Sharma <rahul.sharma@samsung.com> Signed-off-by: Fahad Kunnathadi <fahad.k@samsung.com> Signed-off-by: Kyungmin.park <kyungmin.park@samsung.com> Signed-off-by: Inki Dae <inki.dae@samsung.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c49
-rw-r--r--drivers/gpu/drm/exynos/regs-mixer.h3
2 files changed, 49 insertions, 3 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c
index 167734529229..39d2b95087ae 100644
--- a/drivers/gpu/drm/exynos/exynos_mixer.c
+++ b/drivers/gpu/drm/exynos/exynos_mixer.c
@@ -481,6 +481,18 @@ static void vp_video_buffer(struct mixer_context *ctx, int win)
481 vp_regs_dump(ctx); 481 vp_regs_dump(ctx);
482} 482}
483 483
484static void mixer_layer_update(struct mixer_context *ctx)
485{
486 struct mixer_resources *res = &ctx->mixer_res;
487 u32 val;
488
489 val = mixer_reg_read(res, MXR_CFG);
490
491 /* allow one update per vsync only */
492 if (!(val & MXR_CFG_LAYER_UPDATE_COUNT_MASK))
493 mixer_reg_writemask(res, MXR_CFG, ~0, MXR_CFG_LAYER_UPDATE);
494}
495
484static void mixer_graph_buffer(struct mixer_context *ctx, int win) 496static void mixer_graph_buffer(struct mixer_context *ctx, int win)
485{ 497{
486 struct mixer_resources *res = &ctx->mixer_res; 498 struct mixer_resources *res = &ctx->mixer_res;
@@ -561,6 +573,11 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win)
561 mixer_cfg_scan(ctx, win_data->mode_height); 573 mixer_cfg_scan(ctx, win_data->mode_height);
562 mixer_cfg_rgb_fmt(ctx, win_data->mode_height); 574 mixer_cfg_rgb_fmt(ctx, win_data->mode_height);
563 mixer_cfg_layer(ctx, win, true); 575 mixer_cfg_layer(ctx, win, true);
576
577 /* layer update mandatory for mixer 16.0.33.0 */
578 if (ctx->mxr_ver == MXR_VER_16_0_33_0)
579 mixer_layer_update(ctx);
580
564 mixer_run(ctx); 581 mixer_run(ctx);
565 582
566 mixer_vsync_set_update(ctx, true); 583 mixer_vsync_set_update(ctx, true);
@@ -1065,6 +1082,11 @@ fail:
1065 return ret; 1082 return ret;
1066} 1083}
1067 1084
1085static struct mixer_drv_data exynos5_mxr_drv_data = {
1086 .version = MXR_VER_16_0_33_0,
1087 .is_vp_enabled = 0,
1088};
1089
1068static struct mixer_drv_data exynos4_mxr_drv_data = { 1090static struct mixer_drv_data exynos4_mxr_drv_data = {
1069 .version = MXR_VER_0_0_0_16, 1091 .version = MXR_VER_0_0_0_16,
1070 .is_vp_enabled = 1, 1092 .is_vp_enabled = 1,
@@ -1075,6 +1097,18 @@ static struct platform_device_id mixer_driver_types[] = {
1075 .name = "s5p-mixer", 1097 .name = "s5p-mixer",
1076 .driver_data = (unsigned long)&exynos4_mxr_drv_data, 1098 .driver_data = (unsigned long)&exynos4_mxr_drv_data,
1077 }, { 1099 }, {
1100 .name = "exynos5-mixer",
1101 .driver_data = (unsigned long)&exynos5_mxr_drv_data,
1102 }, {
1103 /* end node */
1104 }
1105};
1106
1107static struct of_device_id mixer_match_types[] = {
1108 {
1109 .compatible = "samsung,exynos5-mixer",
1110 .data = &exynos5_mxr_drv_data,
1111 }, {
1078 /* end node */ 1112 /* end node */
1079 } 1113 }
1080}; 1114};
@@ -1104,8 +1138,16 @@ static int __devinit mixer_probe(struct platform_device *pdev)
1104 1138
1105 mutex_init(&ctx->mixer_mutex); 1139 mutex_init(&ctx->mixer_mutex);
1106 1140
1107 drv = (struct mixer_drv_data *)platform_get_device_id( 1141 if (dev->of_node) {
1108 pdev)->driver_data; 1142 const struct of_device_id *match;
1143 match = of_match_node(of_match_ptr(mixer_match_types),
1144 pdev->dev.of_node);
1145 drv = match->data;
1146 } else {
1147 drv = (struct mixer_drv_data *)
1148 platform_get_device_id(pdev)->driver_data;
1149 }
1150
1109 ctx->dev = &pdev->dev; 1151 ctx->dev = &pdev->dev;
1110 drm_hdmi_ctx->ctx = (void *)ctx; 1152 drm_hdmi_ctx->ctx = (void *)ctx;
1111 ctx->vp_enabled = drv->is_vp_enabled; 1153 ctx->vp_enabled = drv->is_vp_enabled;
@@ -1167,9 +1209,10 @@ static SIMPLE_DEV_PM_OPS(mixer_pm_ops, mixer_suspend, NULL);
1167 1209
1168struct platform_driver mixer_driver = { 1210struct platform_driver mixer_driver = {
1169 .driver = { 1211 .driver = {
1170 .name = "s5p-mixer", 1212 .name = "exynos-mixer",
1171 .owner = THIS_MODULE, 1213 .owner = THIS_MODULE,
1172 .pm = &mixer_pm_ops, 1214 .pm = &mixer_pm_ops,
1215 .of_match_table = mixer_match_types,
1173 }, 1216 },
1174 .probe = mixer_probe, 1217 .probe = mixer_probe,
1175 .remove = __devexit_p(mixer_remove), 1218 .remove = __devexit_p(mixer_remove),
diff --git a/drivers/gpu/drm/exynos/regs-mixer.h b/drivers/gpu/drm/exynos/regs-mixer.h
index fd2f4d14cf6d..5d8dbc0301e6 100644
--- a/drivers/gpu/drm/exynos/regs-mixer.h
+++ b/drivers/gpu/drm/exynos/regs-mixer.h
@@ -69,6 +69,7 @@
69 (((val) << (low_bit)) & MXR_MASK(high_bit, low_bit)) 69 (((val) << (low_bit)) & MXR_MASK(high_bit, low_bit))
70 70
71/* bits for MXR_STATUS */ 71/* bits for MXR_STATUS */
72#define MXR_STATUS_SOFT_RESET (1 << 8)
72#define MXR_STATUS_16_BURST (1 << 7) 73#define MXR_STATUS_16_BURST (1 << 7)
73#define MXR_STATUS_BURST_MASK (1 << 7) 74#define MXR_STATUS_BURST_MASK (1 << 7)
74#define MXR_STATUS_BIG_ENDIAN (1 << 3) 75#define MXR_STATUS_BIG_ENDIAN (1 << 3)
@@ -77,6 +78,8 @@
77#define MXR_STATUS_REG_RUN (1 << 0) 78#define MXR_STATUS_REG_RUN (1 << 0)
78 79
79/* bits for MXR_CFG */ 80/* bits for MXR_CFG */
81#define MXR_CFG_LAYER_UPDATE (1 << 31)
82#define MXR_CFG_LAYER_UPDATE_COUNT_MASK (3 << 29)
80#define MXR_CFG_RGB601_0_255 (0 << 9) 83#define MXR_CFG_RGB601_0_255 (0 << 9)
81#define MXR_CFG_RGB601_16_235 (1 << 9) 84#define MXR_CFG_RGB601_16_235 (1 << 9)
82#define MXR_CFG_RGB709_0_255 (2 << 9) 85#define MXR_CFG_RGB709_0_255 (2 << 9)