diff options
Diffstat (limited to 'drivers/gpu/drm/exynos/exynos_drm_fimd.c')
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimd.c | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 682806ef4d33..925fc69af1a0 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -253,9 +253,8 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, | |||
253 | writel(val, ctx->regs + SHADOWCON); | 253 | writel(val, ctx->regs + SHADOWCON); |
254 | } | 254 | } |
255 | 255 | ||
256 | static void fimd_clear_channel(struct exynos_drm_crtc *crtc) | 256 | static void fimd_clear_channel(struct fimd_context *ctx) |
257 | { | 257 | { |
258 | struct fimd_context *ctx = crtc->ctx; | ||
259 | int win, ch_enabled = 0; | 258 | int win, ch_enabled = 0; |
260 | 259 | ||
261 | DRM_DEBUG_KMS("%s\n", __FILE__); | 260 | DRM_DEBUG_KMS("%s\n", __FILE__); |
@@ -280,7 +279,7 @@ static void fimd_clear_channel(struct exynos_drm_crtc *crtc) | |||
280 | unsigned int state = ctx->suspended; | 279 | unsigned int state = ctx->suspended; |
281 | 280 | ||
282 | ctx->suspended = 0; | 281 | ctx->suspended = 0; |
283 | fimd_wait_for_vblank(crtc); | 282 | fimd_wait_for_vblank(ctx->crtc); |
284 | ctx->suspended = state; | 283 | ctx->suspended = state; |
285 | } | 284 | } |
286 | } | 285 | } |
@@ -302,7 +301,7 @@ static int fimd_ctx_initialize(struct fimd_context *ctx, | |||
302 | * If any channel is already active, iommu will throw | 301 | * If any channel is already active, iommu will throw |
303 | * a PAGE FAULT when enabled. So clear any channel if enabled. | 302 | * a PAGE FAULT when enabled. So clear any channel if enabled. |
304 | */ | 303 | */ |
305 | fimd_clear_channel(ctx->crtc); | 304 | fimd_clear_channel(ctx); |
306 | ret = drm_iommu_attach_device(ctx->drm_dev, ctx->dev); | 305 | ret = drm_iommu_attach_device(ctx->drm_dev, ctx->dev); |
307 | if (ret) { | 306 | if (ret) { |
308 | DRM_ERROR("drm_iommu_attach failed.\n"); | 307 | DRM_ERROR("drm_iommu_attach failed.\n"); |
@@ -823,9 +822,8 @@ static void fimd_win_disable(struct exynos_drm_crtc *crtc, int zpos) | |||
823 | win_data->enabled = false; | 822 | win_data->enabled = false; |
824 | } | 823 | } |
825 | 824 | ||
826 | static void fimd_window_suspend(struct exynos_drm_crtc *crtc) | 825 | static void fimd_window_suspend(struct fimd_context *ctx) |
827 | { | 826 | { |
828 | struct fimd_context *ctx = crtc->ctx; | ||
829 | struct fimd_win_data *win_data; | 827 | struct fimd_win_data *win_data; |
830 | int i; | 828 | int i; |
831 | 829 | ||
@@ -833,13 +831,12 @@ static void fimd_window_suspend(struct exynos_drm_crtc *crtc) | |||
833 | win_data = &ctx->win_data[i]; | 831 | win_data = &ctx->win_data[i]; |
834 | win_data->resume = win_data->enabled; | 832 | win_data->resume = win_data->enabled; |
835 | if (win_data->enabled) | 833 | if (win_data->enabled) |
836 | fimd_win_disable(crtc, i); | 834 | fimd_win_disable(ctx->crtc, i); |
837 | } | 835 | } |
838 | } | 836 | } |
839 | 837 | ||
840 | static void fimd_window_resume(struct exynos_drm_crtc *crtc) | 838 | static void fimd_window_resume(struct fimd_context *ctx) |
841 | { | 839 | { |
842 | struct fimd_context *ctx = crtc->ctx; | ||
843 | struct fimd_win_data *win_data; | 840 | struct fimd_win_data *win_data; |
844 | int i; | 841 | int i; |
845 | 842 | ||
@@ -850,26 +847,24 @@ static void fimd_window_resume(struct exynos_drm_crtc *crtc) | |||
850 | } | 847 | } |
851 | } | 848 | } |
852 | 849 | ||
853 | static void fimd_apply(struct exynos_drm_crtc *crtc) | 850 | static void fimd_apply(struct fimd_context *ctx) |
854 | { | 851 | { |
855 | struct fimd_context *ctx = crtc->ctx; | ||
856 | struct fimd_win_data *win_data; | 852 | struct fimd_win_data *win_data; |
857 | int i; | 853 | int i; |
858 | 854 | ||
859 | for (i = 0; i < WINDOWS_NR; i++) { | 855 | for (i = 0; i < WINDOWS_NR; i++) { |
860 | win_data = &ctx->win_data[i]; | 856 | win_data = &ctx->win_data[i]; |
861 | if (win_data->enabled) | 857 | if (win_data->enabled) |
862 | fimd_win_commit(crtc, i); | 858 | fimd_win_commit(ctx->crtc, i); |
863 | else | 859 | else |
864 | fimd_win_disable(crtc, i); | 860 | fimd_win_disable(ctx->crtc, i); |
865 | } | 861 | } |
866 | 862 | ||
867 | fimd_commit(crtc); | 863 | fimd_commit(ctx->crtc); |
868 | } | 864 | } |
869 | 865 | ||
870 | static int fimd_poweron(struct exynos_drm_crtc *crtc) | 866 | static int fimd_poweron(struct fimd_context *ctx) |
871 | { | 867 | { |
872 | struct fimd_context *ctx = crtc->ctx; | ||
873 | int ret; | 868 | int ret; |
874 | 869 | ||
875 | if (!ctx->suspended) | 870 | if (!ctx->suspended) |
@@ -893,16 +888,16 @@ static int fimd_poweron(struct exynos_drm_crtc *crtc) | |||
893 | 888 | ||
894 | /* if vblank was enabled status, enable it again. */ | 889 | /* if vblank was enabled status, enable it again. */ |
895 | if (test_and_clear_bit(0, &ctx->irq_flags)) { | 890 | if (test_and_clear_bit(0, &ctx->irq_flags)) { |
896 | ret = fimd_enable_vblank(crtc); | 891 | ret = fimd_enable_vblank(ctx->crtc); |
897 | if (ret) { | 892 | if (ret) { |
898 | DRM_ERROR("Failed to re-enable vblank [%d]\n", ret); | 893 | DRM_ERROR("Failed to re-enable vblank [%d]\n", ret); |
899 | goto enable_vblank_err; | 894 | goto enable_vblank_err; |
900 | } | 895 | } |
901 | } | 896 | } |
902 | 897 | ||
903 | fimd_window_resume(crtc); | 898 | fimd_window_resume(ctx); |
904 | 899 | ||
905 | fimd_apply(crtc); | 900 | fimd_apply(ctx); |
906 | 901 | ||
907 | return 0; | 902 | return 0; |
908 | 903 | ||
@@ -915,10 +910,8 @@ bus_clk_err: | |||
915 | return ret; | 910 | return ret; |
916 | } | 911 | } |
917 | 912 | ||
918 | static int fimd_poweroff(struct exynos_drm_crtc *crtc) | 913 | static int fimd_poweroff(struct fimd_context *ctx) |
919 | { | 914 | { |
920 | struct fimd_context *ctx = crtc->ctx; | ||
921 | |||
922 | if (ctx->suspended) | 915 | if (ctx->suspended) |
923 | return 0; | 916 | return 0; |
924 | 917 | ||
@@ -927,7 +920,7 @@ static int fimd_poweroff(struct exynos_drm_crtc *crtc) | |||
927 | * suspend that connector. Otherwise we might try to scan from | 920 | * suspend that connector. Otherwise we might try to scan from |
928 | * a destroyed buffer later. | 921 | * a destroyed buffer later. |
929 | */ | 922 | */ |
930 | fimd_window_suspend(crtc); | 923 | fimd_window_suspend(ctx); |
931 | 924 | ||
932 | clk_disable_unprepare(ctx->lcd_clk); | 925 | clk_disable_unprepare(ctx->lcd_clk); |
933 | clk_disable_unprepare(ctx->bus_clk); | 926 | clk_disable_unprepare(ctx->bus_clk); |
@@ -944,12 +937,12 @@ static void fimd_dpms(struct exynos_drm_crtc *crtc, int mode) | |||
944 | 937 | ||
945 | switch (mode) { | 938 | switch (mode) { |
946 | case DRM_MODE_DPMS_ON: | 939 | case DRM_MODE_DPMS_ON: |
947 | fimd_poweron(crtc); | 940 | fimd_poweron(crtc->ctx); |
948 | break; | 941 | break; |
949 | case DRM_MODE_DPMS_STANDBY: | 942 | case DRM_MODE_DPMS_STANDBY: |
950 | case DRM_MODE_DPMS_SUSPEND: | 943 | case DRM_MODE_DPMS_SUSPEND: |
951 | case DRM_MODE_DPMS_OFF: | 944 | case DRM_MODE_DPMS_OFF: |
952 | fimd_poweroff(crtc); | 945 | fimd_poweroff(crtc->ctx); |
953 | break; | 946 | break; |
954 | default: | 947 | default: |
955 | DRM_DEBUG_KMS("unspecified mode %d\n", mode); | 948 | DRM_DEBUG_KMS("unspecified mode %d\n", mode); |
@@ -1065,18 +1058,19 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) | |||
1065 | struct drm_device *drm_dev = data; | 1058 | struct drm_device *drm_dev = data; |
1066 | int ret; | 1059 | int ret; |
1067 | 1060 | ||
1068 | ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe, | ||
1069 | EXYNOS_DISPLAY_TYPE_LCD, | ||
1070 | &fimd_crtc_ops, ctx); | ||
1071 | if (IS_ERR(ctx->crtc)) | ||
1072 | return PTR_ERR(ctx->crtc); | ||
1073 | |||
1074 | ret = fimd_ctx_initialize(ctx, drm_dev); | 1061 | ret = fimd_ctx_initialize(ctx, drm_dev); |
1075 | if (ret) { | 1062 | if (ret) { |
1076 | DRM_ERROR("fimd_ctx_initialize failed.\n"); | 1063 | DRM_ERROR("fimd_ctx_initialize failed.\n"); |
1077 | return ret; | 1064 | return ret; |
1078 | } | 1065 | } |
1079 | 1066 | ||
1067 | ctx->crtc = exynos_drm_crtc_create(drm_dev, ctx->pipe, | ||
1068 | EXYNOS_DISPLAY_TYPE_LCD, | ||
1069 | &fimd_crtc_ops, ctx); | ||
1070 | if (IS_ERR(ctx->crtc)) { | ||
1071 | fimd_ctx_remove(ctx); | ||
1072 | return PTR_ERR(ctx->crtc); | ||
1073 | } | ||
1080 | 1074 | ||
1081 | if (ctx->display) | 1075 | if (ctx->display) |
1082 | exynos_drm_create_enc_conn(drm_dev, ctx->display); | 1076 | exynos_drm_create_enc_conn(drm_dev, ctx->display); |