Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andrzej Hajda and committed by
Inki Dae
196e059a a121d179

+16 -25
+3 -6
drivers/gpu/drm/exynos/exynos_dp.c
··· 48 48 { 49 49 struct exynos_dp_device *dp = to_dp(plat_data); 50 50 struct drm_encoder *encoder = &dp->encoder; 51 - struct exynos_drm_crtc *crtc; 52 51 53 - if (!encoder) 54 - return -1; 52 + if (!encoder->crtc) 53 + return -EPERM; 55 54 56 - crtc = to_exynos_crtc(encoder->crtc); 57 - if (crtc && crtc->ops && crtc->ops->clock_enable) 58 - crtc->ops->clock_enable(crtc, enable); 55 + exynos_drm_pipe_clk_enable(to_exynos_crtc(encoder->crtc), enable); 59 56 60 57 return 0; 61 58 }
-5
drivers/gpu/drm/exynos/exynos_drm_drv.h
··· 129 129 * @disable_plane: disable hardware specific overlay. 130 130 * @te_handler: trigger to transfer video image at the tearing effect 131 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 133 struct exynos_drm_crtc; 138 134 struct exynos_drm_crtc_ops { ··· 147 151 struct exynos_drm_plane *plane); 148 152 void (*atomic_flush)(struct exynos_drm_crtc *crtc); 149 153 void (*te_handler)(struct exynos_drm_crtc *crtc); 150 - void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable); 151 154 }; 152 155 153 156 struct exynos_drm_clk {
+13 -14
drivers/gpu/drm/exynos/exynos_drm_fimd.c
··· 102 102 unsigned int has_vidoutcon:1; 103 103 unsigned int has_vtsel:1; 104 104 unsigned int has_mic_bypass:1; 105 + unsigned int has_dp_clk:1; 105 106 }; 106 107 107 108 static struct fimd_driver_data s3c64xx_fimd_driver_data = { ··· 146 145 .has_shadowcon = 1, 147 146 .has_vidoutcon = 1, 148 147 .has_vtsel = 1, 148 + .has_dp_clk = 1, 149 149 }; 150 150 151 151 static struct fimd_driver_data exynos5420_fimd_driver_data = { ··· 159 157 .has_vidoutcon = 1, 160 158 .has_vtsel = 1, 161 159 .has_mic_bypass = 1, 160 + .has_dp_clk = 1, 162 161 }; 163 162 164 163 struct fimd_context { ··· 187 184 188 185 struct fimd_driver_data *driver_data; 189 186 struct drm_encoder *encoder; 187 + struct exynos_drm_clk dp_clk; 190 188 }; 191 189 192 190 static const struct of_device_id fimd_driver_dt_match[] = { ··· 882 878 drm_crtc_handle_vblank(&ctx->crtc->base); 883 879 } 884 880 885 - static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) 881 + static void fimd_dp_clock_enable(struct exynos_drm_clk *clk, bool enable) 886 882 { 887 - struct fimd_context *ctx = crtc->ctx; 888 - u32 val; 883 + struct fimd_context *ctx = container_of(clk, struct fimd_context, 884 + dp_clk); 885 + u32 val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; 889 886 890 - /* 891 - * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE 892 - * clock. On these SoCs the bootloader may enable it but any 893 - * power domain off/on will reset it to disable state. 894 - */ 895 - if (ctx->driver_data != &exynos5_fimd_driver_data && 896 - ctx->driver_data != &exynos5420_fimd_driver_data) 897 - return; 898 - 899 - val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; 900 887 writel(val, ctx->regs + DP_MIE_CLKCON); 901 888 } 902 889 ··· 903 908 .disable_plane = fimd_disable_plane, 904 909 .atomic_flush = fimd_atomic_flush, 905 910 .te_handler = fimd_te_handler, 906 - .clock_enable = fimd_dp_clock_enable, 907 911 }; 908 912 909 913 static irqreturn_t fimd_irq_handler(int irq, void *dev_id) ··· 980 986 &fimd_crtc_ops, ctx); 981 987 if (IS_ERR(ctx->crtc)) 982 988 return PTR_ERR(ctx->crtc); 989 + 990 + if (ctx->driver_data->has_dp_clk) { 991 + ctx->dp_clk.enable = fimd_dp_clock_enable; 992 + ctx->crtc->pipe_clk = &ctx->dp_clk; 993 + } 983 994 984 995 if (ctx->encoder) 985 996 exynos_dpi_bind(drm_dev, ctx->encoder);