diff options
author | Andrzej Hajda <a.hajda@samsung.com> | 2016-04-29 12:39:08 -0400 |
---|---|---|
committer | Inki Dae <daeinki@gmail.com> | 2016-04-29 22:33:48 -0400 |
commit | 196e059a8a6a23dc099d4c3f2fccdda7775ddc16 (patch) | |
tree | da4d0af95bc2fc229f04577d5a717318f79765eb | |
parent | a121d179563e773e682448bf06a1842662e6440f (diff) |
drm/exynos: convert clock_enable crtc callback to pipeline clock
clock_enable callback is used only by FIMD->DP pipeline. Similar but more
universal functionality provides pipeline clock.
Signed-off-by: Andrzej Hajda <a.hajda@samsung.com>
Signed-off-by: Inki Dae <daeinki@gmail.com>
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_dp.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.h | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimd.c | 27 |
3 files changed, 16 insertions, 25 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_dp.c b/drivers/gpu/drm/exynos/exynos_dp.c index 8ae3d51b5b33..468498e3fec1 100644 --- a/drivers/gpu/drm/exynos/exynos_dp.c +++ b/drivers/gpu/drm/exynos/exynos_dp.c | |||
@@ -48,14 +48,11 @@ int exynos_dp_crtc_clock_enable(struct analogix_dp_plat_data *plat_data, | |||
48 | { | 48 | { |
49 | struct exynos_dp_device *dp = to_dp(plat_data); | 49 | struct exynos_dp_device *dp = to_dp(plat_data); |
50 | struct drm_encoder *encoder = &dp->encoder; | 50 | struct drm_encoder *encoder = &dp->encoder; |
51 | struct exynos_drm_crtc *crtc; | ||
52 | 51 | ||
53 | if (!encoder) | 52 | if (!encoder->crtc) |
54 | return -1; | 53 | return -EPERM; |
55 | 54 | ||
56 | crtc = to_exynos_crtc(encoder->crtc); | 55 | exynos_drm_pipe_clk_enable(to_exynos_crtc(encoder->crtc), enable); |
57 | if (crtc && crtc->ops && crtc->ops->clock_enable) | ||
58 | crtc->ops->clock_enable(crtc, enable); | ||
59 | 56 | ||
60 | return 0; | 57 | return 0; |
61 | } | 58 | } |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index 7d84835a8cdf..ff671e3db6ca 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -129,10 +129,6 @@ struct exynos_drm_plane_config { | |||
129 | * @disable_plane: disable hardware specific overlay. | 129 | * @disable_plane: disable hardware specific overlay. |
130 | * @te_handler: trigger to transfer video image at the tearing effect | 130 | * @te_handler: trigger to transfer video image at the tearing effect |
131 | * synchronization signal if there is a page flip request. | 131 | * synchronization signal if there is a page flip request. |
132 | * @clock_enable: optional function enabling/disabling display domain clock, | ||
133 | * called from exynos-dp driver before powering up (with | ||
134 | * 'enable' argument as true) and after powering down (with | ||
135 | * 'enable' as false). | ||
136 | */ | 132 | */ |
137 | struct exynos_drm_crtc; | 133 | struct exynos_drm_crtc; |
138 | struct exynos_drm_crtc_ops { | 134 | struct exynos_drm_crtc_ops { |
@@ -151,7 +147,6 @@ struct exynos_drm_crtc_ops { | |||
151 | struct exynos_drm_plane *plane); | 147 | struct exynos_drm_plane *plane); |
152 | void (*atomic_flush)(struct exynos_drm_crtc *crtc); | 148 | void (*atomic_flush)(struct exynos_drm_crtc *crtc); |
153 | void (*te_handler)(struct exynos_drm_crtc *crtc); | 149 | void (*te_handler)(struct exynos_drm_crtc *crtc); |
154 | void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable); | ||
155 | }; | 150 | }; |
156 | 151 | ||
157 | struct exynos_drm_clk { | 152 | struct exynos_drm_clk { |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 018449f8d557..004bf57aa026 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -102,6 +102,7 @@ struct fimd_driver_data { | |||
102 | unsigned int has_vidoutcon:1; | 102 | unsigned int has_vidoutcon:1; |
103 | unsigned int has_vtsel:1; | 103 | unsigned int has_vtsel:1; |
104 | unsigned int has_mic_bypass:1; | 104 | unsigned int has_mic_bypass:1; |
105 | unsigned int has_dp_clk:1; | ||
105 | }; | 106 | }; |
106 | 107 | ||
107 | static struct fimd_driver_data s3c64xx_fimd_driver_data = { | 108 | static struct fimd_driver_data s3c64xx_fimd_driver_data = { |
@@ -145,6 +146,7 @@ static struct fimd_driver_data exynos5_fimd_driver_data = { | |||
145 | .has_shadowcon = 1, | 146 | .has_shadowcon = 1, |
146 | .has_vidoutcon = 1, | 147 | .has_vidoutcon = 1, |
147 | .has_vtsel = 1, | 148 | .has_vtsel = 1, |
149 | .has_dp_clk = 1, | ||
148 | }; | 150 | }; |
149 | 151 | ||
150 | static struct fimd_driver_data exynos5420_fimd_driver_data = { | 152 | static struct fimd_driver_data exynos5420_fimd_driver_data = { |
@@ -157,6 +159,7 @@ static struct fimd_driver_data exynos5420_fimd_driver_data = { | |||
157 | .has_vidoutcon = 1, | 159 | .has_vidoutcon = 1, |
158 | .has_vtsel = 1, | 160 | .has_vtsel = 1, |
159 | .has_mic_bypass = 1, | 161 | .has_mic_bypass = 1, |
162 | .has_dp_clk = 1, | ||
160 | }; | 163 | }; |
161 | 164 | ||
162 | struct fimd_context { | 165 | struct fimd_context { |
@@ -184,6 +187,7 @@ struct fimd_context { | |||
184 | 187 | ||
185 | struct fimd_driver_data *driver_data; | 188 | struct fimd_driver_data *driver_data; |
186 | struct drm_encoder *encoder; | 189 | struct drm_encoder *encoder; |
190 | struct exynos_drm_clk dp_clk; | ||
187 | }; | 191 | }; |
188 | 192 | ||
189 | static const struct of_device_id fimd_driver_dt_match[] = { | 193 | static const struct of_device_id fimd_driver_dt_match[] = { |
@@ -878,21 +882,12 @@ static void fimd_te_handler(struct exynos_drm_crtc *crtc) | |||
878 | drm_crtc_handle_vblank(&ctx->crtc->base); | 882 | drm_crtc_handle_vblank(&ctx->crtc->base); |
879 | } | 883 | } |
880 | 884 | ||
881 | static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) | 885 | static void fimd_dp_clock_enable(struct exynos_drm_clk *clk, bool enable) |
882 | { | 886 | { |
883 | struct fimd_context *ctx = crtc->ctx; | 887 | struct fimd_context *ctx = container_of(clk, struct fimd_context, |
884 | u32 val; | 888 | dp_clk); |
885 | 889 | u32 val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; | |
886 | /* | ||
887 | * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE | ||
888 | * clock. On these SoCs the bootloader may enable it but any | ||
889 | * power domain off/on will reset it to disable state. | ||
890 | */ | ||
891 | if (ctx->driver_data != &exynos5_fimd_driver_data && | ||
892 | ctx->driver_data != &exynos5420_fimd_driver_data) | ||
893 | return; | ||
894 | 890 | ||
895 | val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; | ||
896 | writel(val, ctx->regs + DP_MIE_CLKCON); | 891 | writel(val, ctx->regs + DP_MIE_CLKCON); |
897 | } | 892 | } |
898 | 893 | ||
@@ -908,7 +903,6 @@ static const struct exynos_drm_crtc_ops fimd_crtc_ops = { | |||
908 | .disable_plane = fimd_disable_plane, | 903 | .disable_plane = fimd_disable_plane, |
909 | .atomic_flush = fimd_atomic_flush, | 904 | .atomic_flush = fimd_atomic_flush, |
910 | .te_handler = fimd_te_handler, | 905 | .te_handler = fimd_te_handler, |
911 | .clock_enable = fimd_dp_clock_enable, | ||
912 | }; | 906 | }; |
913 | 907 | ||
914 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | 908 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) |
@@ -987,6 +981,11 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) | |||
987 | if (IS_ERR(ctx->crtc)) | 981 | if (IS_ERR(ctx->crtc)) |
988 | return PTR_ERR(ctx->crtc); | 982 | return PTR_ERR(ctx->crtc); |
989 | 983 | ||
984 | if (ctx->driver_data->has_dp_clk) { | ||
985 | ctx->dp_clk.enable = fimd_dp_clock_enable; | ||
986 | ctx->crtc->pipe_clk = &ctx->dp_clk; | ||
987 | } | ||
988 | |||
990 | if (ctx->encoder) | 989 | if (ctx->encoder) |
991 | exynos_dpi_bind(drm_dev, ctx->encoder); | 990 | exynos_dpi_bind(drm_dev, ctx->encoder); |
992 | 991 | ||