diff options
author | Inki Dae <inki.dae@samsung.com> | 2016-04-18 04:59:01 -0400 |
---|---|---|
committer | Inki Dae <daeinki@gmail.com> | 2016-04-29 22:34:13 -0400 |
commit | 9ac26de835b9c1865837bce1f4fb837b2a19532e (patch) | |
tree | 6ec33694808a47b7fb95eb40ccc979a7ec01d9e5 | |
parent | a6f75aa161c5a50bb025580e4d1509729deef36d (diff) |
drm/exynos: decon: clean up interface type
This patch cleans up interface type relevant codes.
Trigger mode is determinded only by i80 mode, which isn't
related to Display types - HDMI or Display controller.
So this patch makes the trigger mode to be set only in case of
i80 mode - For DECON-TV, HW Trigger mode is flaged mandatorily
because HDMI Timing Generator generates VSYNC signal
which works as a hardware trigger.
Changelog v2.
- If interface type is HDMI then set out_type to I80.
- fix compile warning.
Signed-off-by: Inki Dae <inki.dae@samsung.com>
-rw-r--r-- | drivers/gpu/drm/exynos/exynos5433_drm_decon.c | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c index 2dfdcadd6cbb..9051c9ac685a 100644 --- a/drivers/gpu/drm/exynos/exynos5433_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos5433_drm_decon.c | |||
@@ -28,6 +28,10 @@ | |||
28 | #define WINDOWS_NR 3 | 28 | #define WINDOWS_NR 3 |
29 | #define MIN_FB_WIDTH_FOR_16WORD_BURST 128 | 29 | #define MIN_FB_WIDTH_FOR_16WORD_BURST 128 |
30 | 30 | ||
31 | #define IFTYPE_I80 (1 << 0) | ||
32 | #define I80_HW_TRG (1 << 1) | ||
33 | #define IFTYPE_HDMI (1 << 2) | ||
34 | |||
31 | static const char * const decon_clks_name[] = { | 35 | static const char * const decon_clks_name[] = { |
32 | "pclk", | 36 | "pclk", |
33 | "aclk_decon", | 37 | "aclk_decon", |
@@ -38,12 +42,6 @@ static const char * const decon_clks_name[] = { | |||
38 | "sclk_decon_eclk", | 42 | "sclk_decon_eclk", |
39 | }; | 43 | }; |
40 | 44 | ||
41 | enum decon_iftype { | ||
42 | IFTYPE_RGB, | ||
43 | IFTYPE_I80, | ||
44 | IFTYPE_HDMI | ||
45 | }; | ||
46 | |||
47 | enum decon_flag_bits { | 45 | enum decon_flag_bits { |
48 | BIT_CLKS_ENABLED, | 46 | BIT_CLKS_ENABLED, |
49 | BIT_IRQS_ENABLED, | 47 | BIT_IRQS_ENABLED, |
@@ -61,7 +59,7 @@ struct decon_context { | |||
61 | struct clk *clks[ARRAY_SIZE(decon_clks_name)]; | 59 | struct clk *clks[ARRAY_SIZE(decon_clks_name)]; |
62 | int pipe; | 60 | int pipe; |
63 | unsigned long flags; | 61 | unsigned long flags; |
64 | enum decon_iftype out_type; | 62 | unsigned long out_type; |
65 | int first_win; | 63 | int first_win; |
66 | }; | 64 | }; |
67 | 65 | ||
@@ -95,7 +93,7 @@ static int decon_enable_vblank(struct exynos_drm_crtc *crtc) | |||
95 | 93 | ||
96 | if (!test_and_set_bit(BIT_IRQS_ENABLED, &ctx->flags)) { | 94 | if (!test_and_set_bit(BIT_IRQS_ENABLED, &ctx->flags)) { |
97 | val = VIDINTCON0_INTEN; | 95 | val = VIDINTCON0_INTEN; |
98 | if (ctx->out_type == IFTYPE_I80) | 96 | if (ctx->out_type & IFTYPE_I80) |
99 | val |= VIDINTCON0_FRAMEDONE; | 97 | val |= VIDINTCON0_FRAMEDONE; |
100 | else | 98 | else |
101 | val |= VIDINTCON0_INTFRMEN; | 99 | val |= VIDINTCON0_INTFRMEN; |
@@ -119,7 +117,7 @@ static void decon_disable_vblank(struct exynos_drm_crtc *crtc) | |||
119 | 117 | ||
120 | static void decon_setup_trigger(struct decon_context *ctx) | 118 | static void decon_setup_trigger(struct decon_context *ctx) |
121 | { | 119 | { |
122 | u32 val = (ctx->out_type != IFTYPE_HDMI) | 120 | u32 val = !(ctx->out_type & I80_HW_TRG) |
123 | ? TRIGCON_TRIGEN_PER_F | TRIGCON_TRIGEN_F | | 121 | ? TRIGCON_TRIGEN_PER_F | TRIGCON_TRIGEN_F | |
124 | TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN | 122 | TRIGCON_TE_AUTO_MASK | TRIGCON_SWTRIGEN |
125 | : TRIGCON_TRIGEN_PER_F | TRIGCON_TRIGEN_F | | 123 | : TRIGCON_TRIGEN_PER_F | TRIGCON_TRIGEN_F | |
@@ -136,7 +134,7 @@ static void decon_commit(struct exynos_drm_crtc *crtc) | |||
136 | if (test_bit(BIT_SUSPENDED, &ctx->flags)) | 134 | if (test_bit(BIT_SUSPENDED, &ctx->flags)) |
137 | return; | 135 | return; |
138 | 136 | ||
139 | if (ctx->out_type == IFTYPE_HDMI) { | 137 | if (ctx->out_type & IFTYPE_HDMI) { |
140 | m->crtc_hsync_start = m->crtc_hdisplay + 10; | 138 | m->crtc_hsync_start = m->crtc_hdisplay + 10; |
141 | m->crtc_hsync_end = m->crtc_htotal - 92; | 139 | m->crtc_hsync_end = m->crtc_htotal - 92; |
142 | m->crtc_vsync_start = m->crtc_vdisplay + 1; | 140 | m->crtc_vsync_start = m->crtc_vdisplay + 1; |
@@ -151,17 +149,20 @@ static void decon_commit(struct exynos_drm_crtc *crtc) | |||
151 | 149 | ||
152 | /* lcd on and use command if */ | 150 | /* lcd on and use command if */ |
153 | val = VIDOUT_LCD_ON; | 151 | val = VIDOUT_LCD_ON; |
154 | if (ctx->out_type == IFTYPE_I80) | 152 | if (ctx->out_type & IFTYPE_I80) { |
155 | val |= VIDOUT_COMMAND_IF; | 153 | val |= VIDOUT_COMMAND_IF; |
156 | else | 154 | decon_setup_trigger(ctx); |
155 | } else { | ||
157 | val |= VIDOUT_RGB_IF; | 156 | val |= VIDOUT_RGB_IF; |
157 | } | ||
158 | |||
158 | writel(val, ctx->addr + DECON_VIDOUTCON0); | 159 | writel(val, ctx->addr + DECON_VIDOUTCON0); |
159 | 160 | ||
160 | val = VIDTCON2_LINEVAL(m->vdisplay - 1) | | 161 | val = VIDTCON2_LINEVAL(m->vdisplay - 1) | |
161 | VIDTCON2_HOZVAL(m->hdisplay - 1); | 162 | VIDTCON2_HOZVAL(m->hdisplay - 1); |
162 | writel(val, ctx->addr + DECON_VIDTCON2); | 163 | writel(val, ctx->addr + DECON_VIDTCON2); |
163 | 164 | ||
164 | if (ctx->out_type != IFTYPE_I80) { | 165 | if (!(ctx->out_type & IFTYPE_I80)) { |
165 | val = VIDTCON00_VBPD_F( | 166 | val = VIDTCON00_VBPD_F( |
166 | m->crtc_vtotal - m->crtc_vsync_end - 1) | | 167 | m->crtc_vtotal - m->crtc_vsync_end - 1) | |
167 | VIDTCON00_VFPD_F( | 168 | VIDTCON00_VFPD_F( |
@@ -183,8 +184,6 @@ static void decon_commit(struct exynos_drm_crtc *crtc) | |||
183 | writel(val, ctx->addr + DECON_VIDTCON11); | 184 | writel(val, ctx->addr + DECON_VIDTCON11); |
184 | } | 185 | } |
185 | 186 | ||
186 | decon_setup_trigger(ctx); | ||
187 | |||
188 | /* enable output and display signal */ | 187 | /* enable output and display signal */ |
189 | decon_set_bits(ctx, DECON_VIDCON0, VIDCON0_ENVID | VIDCON0_ENVID_F, ~0); | 188 | decon_set_bits(ctx, DECON_VIDCON0, VIDCON0_ENVID | VIDCON0_ENVID_F, ~0); |
190 | 189 | ||
@@ -302,7 +301,7 @@ static void decon_update_plane(struct exynos_drm_crtc *crtc, | |||
302 | val = dma_addr + pitch * state->src.h; | 301 | val = dma_addr + pitch * state->src.h; |
303 | writel(val, ctx->addr + DECON_VIDW0xADD1B0(win)); | 302 | writel(val, ctx->addr + DECON_VIDW0xADD1B0(win)); |
304 | 303 | ||
305 | if (ctx->out_type != IFTYPE_HDMI) | 304 | if (!(ctx->out_type & IFTYPE_HDMI)) |
306 | val = BIT_VAL(pitch - state->crtc.w * bpp, 27, 14) | 305 | val = BIT_VAL(pitch - state->crtc.w * bpp, 27, 14) |
307 | | BIT_VAL(state->crtc.w * bpp, 13, 0); | 306 | | BIT_VAL(state->crtc.w * bpp, 13, 0); |
308 | else | 307 | else |
@@ -342,7 +341,7 @@ static void decon_atomic_flush(struct exynos_drm_crtc *crtc) | |||
342 | /* standalone update */ | 341 | /* standalone update */ |
343 | decon_set_bits(ctx, DECON_UPDATE, STANDALONE_UPDATE_F, ~0); | 342 | decon_set_bits(ctx, DECON_UPDATE, STANDALONE_UPDATE_F, ~0); |
344 | 343 | ||
345 | if (ctx->out_type == IFTYPE_I80) | 344 | if (ctx->out_type & IFTYPE_I80) |
346 | set_bit(BIT_WIN_UPDATED, &ctx->flags); | 345 | set_bit(BIT_WIN_UPDATED, &ctx->flags); |
347 | } | 346 | } |
348 | 347 | ||
@@ -368,7 +367,7 @@ static void decon_swreset(struct decon_context *ctx) | |||
368 | 367 | ||
369 | WARN(tries == 0, "failed to software reset DECON\n"); | 368 | WARN(tries == 0, "failed to software reset DECON\n"); |
370 | 369 | ||
371 | if (ctx->out_type != IFTYPE_HDMI) | 370 | if (!(ctx->out_type & IFTYPE_HDMI)) |
372 | return; | 371 | return; |
373 | 372 | ||
374 | writel(VIDCON0_CLKVALUP | VIDCON0_VLCKFREE, ctx->addr + DECON_VIDCON0); | 373 | writel(VIDCON0_CLKVALUP | VIDCON0_VLCKFREE, ctx->addr + DECON_VIDCON0); |
@@ -377,7 +376,9 @@ static void decon_swreset(struct decon_context *ctx) | |||
377 | writel(VIDCON1_VCLK_RUN_VDEN_DISABLE, ctx->addr + DECON_VIDCON1); | 376 | writel(VIDCON1_VCLK_RUN_VDEN_DISABLE, ctx->addr + DECON_VIDCON1); |
378 | writel(CRCCTRL_CRCEN | CRCCTRL_CRCSTART_F | CRCCTRL_CRCCLKEN, | 377 | writel(CRCCTRL_CRCEN | CRCCTRL_CRCSTART_F | CRCCTRL_CRCCLKEN, |
379 | ctx->addr + DECON_CRCCTRL); | 378 | ctx->addr + DECON_CRCCTRL); |
380 | decon_setup_trigger(ctx); | 379 | |
380 | if (ctx->out_type & IFTYPE_I80) | ||
381 | decon_setup_trigger(ctx); | ||
381 | } | 382 | } |
382 | 383 | ||
383 | static void decon_enable(struct exynos_drm_crtc *crtc) | 384 | static void decon_enable(struct exynos_drm_crtc *crtc) |
@@ -511,7 +512,7 @@ static int decon_bind(struct device *dev, struct device *master, void *data) | |||
511 | } | 512 | } |
512 | 513 | ||
513 | exynos_plane = &ctx->planes[ctx->first_win]; | 514 | exynos_plane = &ctx->planes[ctx->first_win]; |
514 | out_type = (ctx->out_type == IFTYPE_HDMI) ? EXYNOS_DISPLAY_TYPE_HDMI | 515 | out_type = (ctx->out_type & IFTYPE_HDMI) ? EXYNOS_DISPLAY_TYPE_HDMI |
515 | : EXYNOS_DISPLAY_TYPE_LCD; | 516 | : EXYNOS_DISPLAY_TYPE_LCD; |
516 | ctx->crtc = exynos_drm_crtc_create(drm_dev, &exynos_plane->base, | 517 | ctx->crtc = exynos_drm_crtc_create(drm_dev, &exynos_plane->base, |
517 | ctx->pipe, out_type, | 518 | ctx->pipe, out_type, |
@@ -619,11 +620,11 @@ static const struct dev_pm_ops exynos5433_decon_pm_ops = { | |||
619 | static const struct of_device_id exynos5433_decon_driver_dt_match[] = { | 620 | static const struct of_device_id exynos5433_decon_driver_dt_match[] = { |
620 | { | 621 | { |
621 | .compatible = "samsung,exynos5433-decon", | 622 | .compatible = "samsung,exynos5433-decon", |
622 | .data = (void *)IFTYPE_RGB | 623 | .data = (void *)I80_HW_TRG |
623 | }, | 624 | }, |
624 | { | 625 | { |
625 | .compatible = "samsung,exynos5433-decon-tv", | 626 | .compatible = "samsung,exynos5433-decon-tv", |
626 | .data = (void *)IFTYPE_HDMI | 627 | .data = (void *)(I80_HW_TRG | IFTYPE_HDMI) |
627 | }, | 628 | }, |
628 | {}, | 629 | {}, |
629 | }; | 630 | }; |
@@ -643,12 +644,14 @@ static int exynos5433_decon_probe(struct platform_device *pdev) | |||
643 | 644 | ||
644 | __set_bit(BIT_SUSPENDED, &ctx->flags); | 645 | __set_bit(BIT_SUSPENDED, &ctx->flags); |
645 | ctx->dev = dev; | 646 | ctx->dev = dev; |
646 | ctx->out_type = (enum decon_iftype)of_device_get_match_data(dev); | 647 | ctx->out_type = (unsigned long)of_device_get_match_data(dev); |
647 | 648 | ||
648 | if (ctx->out_type == IFTYPE_HDMI) | 649 | if (ctx->out_type & IFTYPE_HDMI) { |
649 | ctx->first_win = 1; | 650 | ctx->first_win = 1; |
650 | else if (of_get_child_by_name(dev->of_node, "i80-if-timings")) | ||
651 | ctx->out_type = IFTYPE_I80; | 651 | ctx->out_type = IFTYPE_I80; |
652 | } else if (of_get_child_by_name(dev->of_node, "i80-if-timings")) { | ||
653 | ctx->out_type = IFTYPE_I80; | ||
654 | } | ||
652 | 655 | ||
653 | for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) { | 656 | for (i = 0; i < ARRAY_SIZE(decon_clks_name); i++) { |
654 | struct clk *clk; | 657 | struct clk *clk; |
@@ -673,7 +676,7 @@ static int exynos5433_decon_probe(struct platform_device *pdev) | |||
673 | } | 676 | } |
674 | 677 | ||
675 | res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, | 678 | res = platform_get_resource_byname(pdev, IORESOURCE_IRQ, |
676 | (ctx->out_type == IFTYPE_I80) ? "lcd_sys" : "vsync"); | 679 | (ctx->out_type & IFTYPE_I80) ? "lcd_sys" : "vsync"); |
677 | if (!res) { | 680 | if (!res) { |
678 | dev_err(dev, "cannot find IRQ resource\n"); | 681 | dev_err(dev, "cannot find IRQ resource\n"); |
679 | return -ENXIO; | 682 | return -ENXIO; |