diff options
author | Dave Airlie <airlied@redhat.com> | 2015-05-19 19:22:00 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-05-19 19:22:00 -0400 |
commit | f7c125a198325b0b7ec6ba1ce53713765dc9d240 (patch) | |
tree | c137cae3e4bb2fa89c52664923826534e9146f38 | |
parent | 64d237e66d562348f04a9c04a45455c1f3201ced (diff) | |
parent | b0f155ada4c819f06aa32b4c906e7e76350c7ec1 (diff) |
Merge branch 'exynos-drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos into drm-fixes
Summary:
- Use generic function to get buffer count instead of specific one.
In case of Exynos DRM, There was a special case which decides pixel
format of a given buffer according to planer types, which is NV12M and NV12.
However, NV12M doesn't exist in drm fourcc so it removes
exynos_drm_format_num_buffers() specific to Exynos DRM and use a generic function,
drm_format_num_planes() instead.
- Allow mixer driver to support NV21 format for Video processor.
This format was already supported but we just missed DRM_FORMAT_NV21 case
so this patch considers the case so that Mixer driver can handle it correctly.
- Add regression fix and some code cleanups.
* 'exynos-drm-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/daeinki/drm-exynos:
drm/exynos: dp: Lower level of EDID read success message
drm/exynos: cleanup exynos_drm_plane
drm/exynos: 'win' is always unsigned
drm/exynos: mixer: don't dump registers under spinlock
drm/exynos: Consolidate return statements in fimd_bind()
drm/exynos: Constify exynos_drm_crtc_ops
drm/exynos: Fix build breakage on !DRM_EXYNOS_FIMD
drm/exynos: mixer: Constify platform_device_id
drm/exynos: mixer: cleanup pixelformat handling
drm/exynos: mixer: also allow NV21 for the video processor
drm/exynos: mixer: remove buffer count handling in vp_video_buffer()
drm/exynos: plane: honor buffer offset for dma_addr
drm/exynos: fb: use drm_format_num_planes to get buffer count
-rw-r--r-- | drivers/gpu/drm/exynos/exynos7_drm_decon.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_dp_core.c | 13 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_crtc.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_crtc.h | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_drv.h | 20 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fb.c | 39 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimd.c | 53 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_fimd.h | 15 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_plane.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_drm_vidi.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/exynos/exynos_mixer.c | 72 |
11 files changed, 92 insertions, 148 deletions
diff --git a/drivers/gpu/drm/exynos/exynos7_drm_decon.c b/drivers/gpu/drm/exynos/exynos7_drm_decon.c index 1f7e33f59de6..6714e5b193ea 100644 --- a/drivers/gpu/drm/exynos/exynos7_drm_decon.c +++ b/drivers/gpu/drm/exynos/exynos7_drm_decon.c | |||
@@ -91,7 +91,7 @@ static void decon_wait_for_vblank(struct exynos_drm_crtc *crtc) | |||
91 | 91 | ||
92 | static void decon_clear_channel(struct decon_context *ctx) | 92 | static void decon_clear_channel(struct decon_context *ctx) |
93 | { | 93 | { |
94 | int win, ch_enabled = 0; | 94 | unsigned int win, ch_enabled = 0; |
95 | 95 | ||
96 | DRM_DEBUG_KMS("%s\n", __FILE__); | 96 | DRM_DEBUG_KMS("%s\n", __FILE__); |
97 | 97 | ||
@@ -710,7 +710,7 @@ static void decon_dpms(struct exynos_drm_crtc *crtc, int mode) | |||
710 | } | 710 | } |
711 | } | 711 | } |
712 | 712 | ||
713 | static struct exynos_drm_crtc_ops decon_crtc_ops = { | 713 | static const struct exynos_drm_crtc_ops decon_crtc_ops = { |
714 | .dpms = decon_dpms, | 714 | .dpms = decon_dpms, |
715 | .mode_fixup = decon_mode_fixup, | 715 | .mode_fixup = decon_mode_fixup, |
716 | .commit = decon_commit, | 716 | .commit = decon_commit, |
diff --git a/drivers/gpu/drm/exynos/exynos_dp_core.c b/drivers/gpu/drm/exynos/exynos_dp_core.c index 1dbfba58f909..30feb7d06624 100644 --- a/drivers/gpu/drm/exynos/exynos_dp_core.c +++ b/drivers/gpu/drm/exynos/exynos_dp_core.c | |||
@@ -32,7 +32,6 @@ | |||
32 | #include <drm/bridge/ptn3460.h> | 32 | #include <drm/bridge/ptn3460.h> |
33 | 33 | ||
34 | #include "exynos_dp_core.h" | 34 | #include "exynos_dp_core.h" |
35 | #include "exynos_drm_fimd.h" | ||
36 | 35 | ||
37 | #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ | 36 | #define ctx_from_connector(c) container_of(c, struct exynos_dp_device, \ |
38 | connector) | 37 | connector) |
@@ -196,7 +195,7 @@ static int exynos_dp_read_edid(struct exynos_dp_device *dp) | |||
196 | } | 195 | } |
197 | } | 196 | } |
198 | 197 | ||
199 | dev_err(dp->dev, "EDID Read success!\n"); | 198 | dev_dbg(dp->dev, "EDID Read success!\n"); |
200 | return 0; | 199 | return 0; |
201 | } | 200 | } |
202 | 201 | ||
@@ -1066,6 +1065,8 @@ static void exynos_dp_phy_exit(struct exynos_dp_device *dp) | |||
1066 | 1065 | ||
1067 | static void exynos_dp_poweron(struct exynos_dp_device *dp) | 1066 | static void exynos_dp_poweron(struct exynos_dp_device *dp) |
1068 | { | 1067 | { |
1068 | struct exynos_drm_crtc *crtc = dp_to_crtc(dp); | ||
1069 | |||
1069 | if (dp->dpms_mode == DRM_MODE_DPMS_ON) | 1070 | if (dp->dpms_mode == DRM_MODE_DPMS_ON) |
1070 | return; | 1071 | return; |
1071 | 1072 | ||
@@ -1076,7 +1077,8 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) | |||
1076 | } | 1077 | } |
1077 | } | 1078 | } |
1078 | 1079 | ||
1079 | fimd_dp_clock_enable(dp_to_crtc(dp), true); | 1080 | if (crtc->ops->clock_enable) |
1081 | crtc->ops->clock_enable(dp_to_crtc(dp), true); | ||
1080 | 1082 | ||
1081 | clk_prepare_enable(dp->clock); | 1083 | clk_prepare_enable(dp->clock); |
1082 | exynos_dp_phy_init(dp); | 1084 | exynos_dp_phy_init(dp); |
@@ -1087,6 +1089,8 @@ static void exynos_dp_poweron(struct exynos_dp_device *dp) | |||
1087 | 1089 | ||
1088 | static void exynos_dp_poweroff(struct exynos_dp_device *dp) | 1090 | static void exynos_dp_poweroff(struct exynos_dp_device *dp) |
1089 | { | 1091 | { |
1092 | struct exynos_drm_crtc *crtc = dp_to_crtc(dp); | ||
1093 | |||
1090 | if (dp->dpms_mode != DRM_MODE_DPMS_ON) | 1094 | if (dp->dpms_mode != DRM_MODE_DPMS_ON) |
1091 | return; | 1095 | return; |
1092 | 1096 | ||
@@ -1102,7 +1106,8 @@ static void exynos_dp_poweroff(struct exynos_dp_device *dp) | |||
1102 | exynos_dp_phy_exit(dp); | 1106 | exynos_dp_phy_exit(dp); |
1103 | clk_disable_unprepare(dp->clock); | 1107 | clk_disable_unprepare(dp->clock); |
1104 | 1108 | ||
1105 | fimd_dp_clock_enable(dp_to_crtc(dp), false); | 1109 | if (crtc->ops->clock_enable) |
1110 | crtc->ops->clock_enable(dp_to_crtc(dp), false); | ||
1106 | 1111 | ||
1107 | if (dp->panel) { | 1112 | if (dp->panel) { |
1108 | if (drm_panel_unprepare(dp->panel)) | 1113 | if (drm_panel_unprepare(dp->panel)) |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.c b/drivers/gpu/drm/exynos/exynos_drm_crtc.c index eb49195cec5c..9006b947e03c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.c +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.c | |||
@@ -238,11 +238,11 @@ static struct drm_crtc_funcs exynos_crtc_funcs = { | |||
238 | }; | 238 | }; |
239 | 239 | ||
240 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, | 240 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, |
241 | struct drm_plane *plane, | 241 | struct drm_plane *plane, |
242 | int pipe, | 242 | int pipe, |
243 | enum exynos_drm_output_type type, | 243 | enum exynos_drm_output_type type, |
244 | struct exynos_drm_crtc_ops *ops, | 244 | const struct exynos_drm_crtc_ops *ops, |
245 | void *ctx) | 245 | void *ctx) |
246 | { | 246 | { |
247 | struct exynos_drm_crtc *exynos_crtc; | 247 | struct exynos_drm_crtc *exynos_crtc; |
248 | struct exynos_drm_private *private = drm_dev->dev_private; | 248 | struct exynos_drm_private *private = drm_dev->dev_private; |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_crtc.h b/drivers/gpu/drm/exynos/exynos_drm_crtc.h index 0ecd8fc45cff..0f3aa70818e3 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_crtc.h +++ b/drivers/gpu/drm/exynos/exynos_drm_crtc.h | |||
@@ -18,11 +18,11 @@ | |||
18 | #include "exynos_drm_drv.h" | 18 | #include "exynos_drm_drv.h" |
19 | 19 | ||
20 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, | 20 | struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, |
21 | struct drm_plane *plane, | 21 | struct drm_plane *plane, |
22 | int pipe, | 22 | int pipe, |
23 | enum exynos_drm_output_type type, | 23 | enum exynos_drm_output_type type, |
24 | struct exynos_drm_crtc_ops *ops, | 24 | const struct exynos_drm_crtc_ops *ops, |
25 | void *context); | 25 | void *context); |
26 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe); | 26 | int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe); |
27 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe); | 27 | void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe); |
28 | void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe); | 28 | void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.h b/drivers/gpu/drm/exynos/exynos_drm_drv.h index e12ecb5d5d9a..29e3fb78c615 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_drv.h +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.h | |||
@@ -71,13 +71,6 @@ enum exynos_drm_output_type { | |||
71 | * @dma_addr: array of bus(accessed by dma) address to the memory region | 71 | * @dma_addr: array of bus(accessed by dma) address to the memory region |
72 | * allocated for a overlay. | 72 | * allocated for a overlay. |
73 | * @zpos: order of overlay layer(z position). | 73 | * @zpos: order of overlay layer(z position). |
74 | * @index_color: if using color key feature then this value would be used | ||
75 | * as index color. | ||
76 | * @default_win: a window to be enabled. | ||
77 | * @color_key: color key on or off. | ||
78 | * @local_path: in case of lcd type, local path mode on or off. | ||
79 | * @transparency: transparency on or off. | ||
80 | * @activated: activated or not. | ||
81 | * @enabled: enabled or not. | 74 | * @enabled: enabled or not. |
82 | * @resume: to resume or not. | 75 | * @resume: to resume or not. |
83 | * | 76 | * |
@@ -108,13 +101,7 @@ struct exynos_drm_plane { | |||
108 | uint32_t pixel_format; | 101 | uint32_t pixel_format; |
109 | dma_addr_t dma_addr[MAX_FB_BUFFER]; | 102 | dma_addr_t dma_addr[MAX_FB_BUFFER]; |
110 | unsigned int zpos; | 103 | unsigned int zpos; |
111 | unsigned int index_color; | ||
112 | 104 | ||
113 | bool default_win:1; | ||
114 | bool color_key:1; | ||
115 | bool local_path:1; | ||
116 | bool transparency:1; | ||
117 | bool activated:1; | ||
118 | bool enabled:1; | 105 | bool enabled:1; |
119 | bool resume:1; | 106 | bool resume:1; |
120 | }; | 107 | }; |
@@ -181,6 +168,10 @@ struct exynos_drm_display { | |||
181 | * @win_disable: disable hardware specific overlay. | 168 | * @win_disable: disable hardware specific overlay. |
182 | * @te_handler: trigger to transfer video image at the tearing effect | 169 | * @te_handler: trigger to transfer video image at the tearing effect |
183 | * synchronization signal if there is a page flip request. | 170 | * synchronization signal if there is a page flip request. |
171 | * @clock_enable: optional function enabling/disabling display domain clock, | ||
172 | * called from exynos-dp driver before powering up (with | ||
173 | * 'enable' argument as true) and after powering down (with | ||
174 | * 'enable' as false). | ||
184 | */ | 175 | */ |
185 | struct exynos_drm_crtc; | 176 | struct exynos_drm_crtc; |
186 | struct exynos_drm_crtc_ops { | 177 | struct exynos_drm_crtc_ops { |
@@ -195,6 +186,7 @@ struct exynos_drm_crtc_ops { | |||
195 | void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos); | 186 | void (*win_commit)(struct exynos_drm_crtc *crtc, unsigned int zpos); |
196 | void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos); | 187 | void (*win_disable)(struct exynos_drm_crtc *crtc, unsigned int zpos); |
197 | void (*te_handler)(struct exynos_drm_crtc *crtc); | 188 | void (*te_handler)(struct exynos_drm_crtc *crtc); |
189 | void (*clock_enable)(struct exynos_drm_crtc *crtc, bool enable); | ||
198 | }; | 190 | }; |
199 | 191 | ||
200 | /* | 192 | /* |
@@ -221,7 +213,7 @@ struct exynos_drm_crtc { | |||
221 | unsigned int dpms; | 213 | unsigned int dpms; |
222 | wait_queue_head_t pending_flip_queue; | 214 | wait_queue_head_t pending_flip_queue; |
223 | struct drm_pending_vblank_event *event; | 215 | struct drm_pending_vblank_event *event; |
224 | struct exynos_drm_crtc_ops *ops; | 216 | const struct exynos_drm_crtc_ops *ops; |
225 | void *ctx; | 217 | void *ctx; |
226 | }; | 218 | }; |
227 | 219 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fb.c b/drivers/gpu/drm/exynos/exynos_drm_fb.c index 929cb03a8eab..142eb4e3f59e 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fb.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fb.c | |||
@@ -171,43 +171,6 @@ exynos_drm_framebuffer_init(struct drm_device *dev, | |||
171 | return &exynos_fb->fb; | 171 | return &exynos_fb->fb; |
172 | } | 172 | } |
173 | 173 | ||
174 | static u32 exynos_drm_format_num_buffers(struct drm_mode_fb_cmd2 *mode_cmd) | ||
175 | { | ||
176 | unsigned int cnt = 0; | ||
177 | |||
178 | if (mode_cmd->pixel_format != DRM_FORMAT_NV12) | ||
179 | return drm_format_num_planes(mode_cmd->pixel_format); | ||
180 | |||
181 | while (cnt != MAX_FB_BUFFER) { | ||
182 | if (!mode_cmd->handles[cnt]) | ||
183 | break; | ||
184 | cnt++; | ||
185 | } | ||
186 | |||
187 | /* | ||
188 | * check if NV12 or NV12M. | ||
189 | * | ||
190 | * NV12 | ||
191 | * handles[0] = base1, offsets[0] = 0 | ||
192 | * handles[1] = base1, offsets[1] = Y_size | ||
193 | * | ||
194 | * NV12M | ||
195 | * handles[0] = base1, offsets[0] = 0 | ||
196 | * handles[1] = base2, offsets[1] = 0 | ||
197 | */ | ||
198 | if (cnt == 2) { | ||
199 | /* | ||
200 | * in case of NV12 format, offsets[1] is not 0 and | ||
201 | * handles[0] is same as handles[1]. | ||
202 | */ | ||
203 | if (mode_cmd->offsets[1] && | ||
204 | mode_cmd->handles[0] == mode_cmd->handles[1]) | ||
205 | cnt = 1; | ||
206 | } | ||
207 | |||
208 | return cnt; | ||
209 | } | ||
210 | |||
211 | static struct drm_framebuffer * | 174 | static struct drm_framebuffer * |
212 | exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, | 175 | exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, |
213 | struct drm_mode_fb_cmd2 *mode_cmd) | 176 | struct drm_mode_fb_cmd2 *mode_cmd) |
@@ -230,7 +193,7 @@ exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, | |||
230 | 193 | ||
231 | drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); | 194 | drm_helper_mode_fill_fb_struct(&exynos_fb->fb, mode_cmd); |
232 | exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj); | 195 | exynos_fb->exynos_gem_obj[0] = to_exynos_gem_obj(obj); |
233 | exynos_fb->buf_cnt = exynos_drm_format_num_buffers(mode_cmd); | 196 | exynos_fb->buf_cnt = drm_format_num_planes(mode_cmd->pixel_format); |
234 | 197 | ||
235 | DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt); | 198 | DRM_DEBUG_KMS("buf_cnt = %d\n", exynos_fb->buf_cnt); |
236 | 199 | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.c b/drivers/gpu/drm/exynos/exynos_drm_fimd.c index 9819fa6a9e2a..a0edab833148 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.c +++ b/drivers/gpu/drm/exynos/exynos_drm_fimd.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include "exynos_drm_crtc.h" | 33 | #include "exynos_drm_crtc.h" |
34 | #include "exynos_drm_plane.h" | 34 | #include "exynos_drm_plane.h" |
35 | #include "exynos_drm_iommu.h" | 35 | #include "exynos_drm_iommu.h" |
36 | #include "exynos_drm_fimd.h" | ||
37 | 36 | ||
38 | /* | 37 | /* |
39 | * FIMD stands for Fully Interactive Mobile Display and | 38 | * FIMD stands for Fully Interactive Mobile Display and |
@@ -216,7 +215,7 @@ static void fimd_wait_for_vblank(struct exynos_drm_crtc *crtc) | |||
216 | DRM_DEBUG_KMS("vblank wait timed out.\n"); | 215 | DRM_DEBUG_KMS("vblank wait timed out.\n"); |
217 | } | 216 | } |
218 | 217 | ||
219 | static void fimd_enable_video_output(struct fimd_context *ctx, int win, | 218 | static void fimd_enable_video_output(struct fimd_context *ctx, unsigned int win, |
220 | bool enable) | 219 | bool enable) |
221 | { | 220 | { |
222 | u32 val = readl(ctx->regs + WINCON(win)); | 221 | u32 val = readl(ctx->regs + WINCON(win)); |
@@ -229,7 +228,8 @@ static void fimd_enable_video_output(struct fimd_context *ctx, int win, | |||
229 | writel(val, ctx->regs + WINCON(win)); | 228 | writel(val, ctx->regs + WINCON(win)); |
230 | } | 229 | } |
231 | 230 | ||
232 | static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, | 231 | static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, |
232 | unsigned int win, | ||
233 | bool enable) | 233 | bool enable) |
234 | { | 234 | { |
235 | u32 val = readl(ctx->regs + SHADOWCON); | 235 | u32 val = readl(ctx->regs + SHADOWCON); |
@@ -244,7 +244,7 @@ static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, | |||
244 | 244 | ||
245 | static void fimd_clear_channel(struct fimd_context *ctx) | 245 | static void fimd_clear_channel(struct fimd_context *ctx) |
246 | { | 246 | { |
247 | int win, ch_enabled = 0; | 247 | unsigned int win, ch_enabled = 0; |
248 | 248 | ||
249 | DRM_DEBUG_KMS("%s\n", __FILE__); | 249 | DRM_DEBUG_KMS("%s\n", __FILE__); |
250 | 250 | ||
@@ -946,7 +946,24 @@ static void fimd_te_handler(struct exynos_drm_crtc *crtc) | |||
946 | drm_handle_vblank(ctx->drm_dev, ctx->pipe); | 946 | drm_handle_vblank(ctx->drm_dev, ctx->pipe); |
947 | } | 947 | } |
948 | 948 | ||
949 | static struct exynos_drm_crtc_ops fimd_crtc_ops = { | 949 | static void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) |
950 | { | ||
951 | struct fimd_context *ctx = crtc->ctx; | ||
952 | u32 val; | ||
953 | |||
954 | /* | ||
955 | * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE | ||
956 | * clock. On these SoCs the bootloader may enable it but any | ||
957 | * power domain off/on will reset it to disable state. | ||
958 | */ | ||
959 | if (ctx->driver_data != &exynos5_fimd_driver_data) | ||
960 | return; | ||
961 | |||
962 | val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; | ||
963 | writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON); | ||
964 | } | ||
965 | |||
966 | static const struct exynos_drm_crtc_ops fimd_crtc_ops = { | ||
950 | .dpms = fimd_dpms, | 967 | .dpms = fimd_dpms, |
951 | .mode_fixup = fimd_mode_fixup, | 968 | .mode_fixup = fimd_mode_fixup, |
952 | .commit = fimd_commit, | 969 | .commit = fimd_commit, |
@@ -956,6 +973,7 @@ static struct exynos_drm_crtc_ops fimd_crtc_ops = { | |||
956 | .win_commit = fimd_win_commit, | 973 | .win_commit = fimd_win_commit, |
957 | .win_disable = fimd_win_disable, | 974 | .win_disable = fimd_win_disable, |
958 | .te_handler = fimd_te_handler, | 975 | .te_handler = fimd_te_handler, |
976 | .clock_enable = fimd_dp_clock_enable, | ||
959 | }; | 977 | }; |
960 | 978 | ||
961 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) | 979 | static irqreturn_t fimd_irq_handler(int irq, void *dev_id) |
@@ -1025,12 +1043,7 @@ static int fimd_bind(struct device *dev, struct device *master, void *data) | |||
1025 | if (ctx->display) | 1043 | if (ctx->display) |
1026 | exynos_drm_create_enc_conn(drm_dev, ctx->display); | 1044 | exynos_drm_create_enc_conn(drm_dev, ctx->display); |
1027 | 1045 | ||
1028 | ret = fimd_iommu_attach_devices(ctx, drm_dev); | 1046 | return fimd_iommu_attach_devices(ctx, drm_dev); |
1029 | if (ret) | ||
1030 | return ret; | ||
1031 | |||
1032 | return 0; | ||
1033 | |||
1034 | } | 1047 | } |
1035 | 1048 | ||
1036 | static void fimd_unbind(struct device *dev, struct device *master, | 1049 | static void fimd_unbind(struct device *dev, struct device *master, |
@@ -1192,24 +1205,6 @@ static int fimd_remove(struct platform_device *pdev) | |||
1192 | return 0; | 1205 | return 0; |
1193 | } | 1206 | } |
1194 | 1207 | ||
1195 | void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable) | ||
1196 | { | ||
1197 | struct fimd_context *ctx = crtc->ctx; | ||
1198 | u32 val; | ||
1199 | |||
1200 | /* | ||
1201 | * Only Exynos 5250, 5260, 5410 and 542x requires enabling DP/MIE | ||
1202 | * clock. On these SoCs the bootloader may enable it but any | ||
1203 | * power domain off/on will reset it to disable state. | ||
1204 | */ | ||
1205 | if (ctx->driver_data != &exynos5_fimd_driver_data) | ||
1206 | return; | ||
1207 | |||
1208 | val = enable ? DP_MIE_CLK_DP_ENABLE : DP_MIE_CLK_DISABLE; | ||
1209 | writel(DP_MIE_CLK_DP_ENABLE, ctx->regs + DP_MIE_CLKCON); | ||
1210 | } | ||
1211 | EXPORT_SYMBOL_GPL(fimd_dp_clock_enable); | ||
1212 | |||
1213 | struct platform_driver fimd_driver = { | 1208 | struct platform_driver fimd_driver = { |
1214 | .probe = fimd_probe, | 1209 | .probe = fimd_probe, |
1215 | .remove = fimd_remove, | 1210 | .remove = fimd_remove, |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_fimd.h b/drivers/gpu/drm/exynos/exynos_drm_fimd.h deleted file mode 100644 index b4fcaa568456..000000000000 --- a/drivers/gpu/drm/exynos/exynos_drm_fimd.h +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2015 Samsung Electronics Co., Ltd. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms of the GNU General Public License as published by the | ||
6 | * Free Software Foundation; either version 2 of the License, or (at your | ||
7 | * option) any later version. | ||
8 | */ | ||
9 | |||
10 | #ifndef _EXYNOS_DRM_FIMD_H_ | ||
11 | #define _EXYNOS_DRM_FIMD_H_ | ||
12 | |||
13 | extern void fimd_dp_clock_enable(struct exynos_drm_crtc *crtc, bool enable); | ||
14 | |||
15 | #endif /* _EXYNOS_DRM_FIMD_H_ */ | ||
diff --git a/drivers/gpu/drm/exynos/exynos_drm_plane.c b/drivers/gpu/drm/exynos/exynos_drm_plane.c index 13ea3349363b..b1180fbe7546 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_plane.c +++ b/drivers/gpu/drm/exynos/exynos_drm_plane.c | |||
@@ -76,7 +76,7 @@ int exynos_check_plane(struct drm_plane *plane, struct drm_framebuffer *fb) | |||
76 | return -EFAULT; | 76 | return -EFAULT; |
77 | } | 77 | } |
78 | 78 | ||
79 | exynos_plane->dma_addr[i] = buffer->dma_addr; | 79 | exynos_plane->dma_addr[i] = buffer->dma_addr + fb->offsets[i]; |
80 | 80 | ||
81 | DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n", | 81 | DRM_DEBUG_KMS("buffer: %d, dma_addr = 0x%lx\n", |
82 | i, (unsigned long)exynos_plane->dma_addr[i]); | 82 | i, (unsigned long)exynos_plane->dma_addr[i]); |
diff --git a/drivers/gpu/drm/exynos/exynos_drm_vidi.c b/drivers/gpu/drm/exynos/exynos_drm_vidi.c index 27e84ec21694..1b3479a8db5f 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_vidi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_vidi.c | |||
@@ -217,7 +217,7 @@ static int vidi_ctx_initialize(struct vidi_context *ctx, | |||
217 | return 0; | 217 | return 0; |
218 | } | 218 | } |
219 | 219 | ||
220 | static struct exynos_drm_crtc_ops vidi_crtc_ops = { | 220 | static const struct exynos_drm_crtc_ops vidi_crtc_ops = { |
221 | .dpms = vidi_dpms, | 221 | .dpms = vidi_dpms, |
222 | .enable_vblank = vidi_enable_vblank, | 222 | .enable_vblank = vidi_enable_vblank, |
223 | .disable_vblank = vidi_disable_vblank, | 223 | .disable_vblank = vidi_disable_vblank, |
diff --git a/drivers/gpu/drm/exynos/exynos_mixer.c b/drivers/gpu/drm/exynos/exynos_mixer.c index fbec750574e6..8874c1fcb3ab 100644 --- a/drivers/gpu/drm/exynos/exynos_mixer.c +++ b/drivers/gpu/drm/exynos/exynos_mixer.c | |||
@@ -44,6 +44,12 @@ | |||
44 | #define MIXER_WIN_NR 3 | 44 | #define MIXER_WIN_NR 3 |
45 | #define MIXER_DEFAULT_WIN 0 | 45 | #define MIXER_DEFAULT_WIN 0 |
46 | 46 | ||
47 | /* The pixelformats that are natively supported by the mixer. */ | ||
48 | #define MXR_FORMAT_RGB565 4 | ||
49 | #define MXR_FORMAT_ARGB1555 5 | ||
50 | #define MXR_FORMAT_ARGB4444 6 | ||
51 | #define MXR_FORMAT_ARGB8888 7 | ||
52 | |||
47 | struct mixer_resources { | 53 | struct mixer_resources { |
48 | int irq; | 54 | int irq; |
49 | void __iomem *mixer_regs; | 55 | void __iomem *mixer_regs; |
@@ -327,7 +333,8 @@ static void mixer_cfg_rgb_fmt(struct mixer_context *ctx, unsigned int height) | |||
327 | mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); | 333 | mixer_reg_writemask(res, MXR_CFG, val, MXR_CFG_RGB_FMT_MASK); |
328 | } | 334 | } |
329 | 335 | ||
330 | static void mixer_cfg_layer(struct mixer_context *ctx, int win, bool enable) | 336 | static void mixer_cfg_layer(struct mixer_context *ctx, unsigned int win, |
337 | bool enable) | ||
331 | { | 338 | { |
332 | struct mixer_resources *res = &ctx->mixer_res; | 339 | struct mixer_resources *res = &ctx->mixer_res; |
333 | u32 val = enable ? ~0 : 0; | 340 | u32 val = enable ? ~0 : 0; |
@@ -359,8 +366,6 @@ static void mixer_run(struct mixer_context *ctx) | |||
359 | struct mixer_resources *res = &ctx->mixer_res; | 366 | struct mixer_resources *res = &ctx->mixer_res; |
360 | 367 | ||
361 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_REG_RUN); | 368 | mixer_reg_writemask(res, MXR_STATUS, ~0, MXR_STATUS_REG_RUN); |
362 | |||
363 | mixer_regs_dump(ctx); | ||
364 | } | 369 | } |
365 | 370 | ||
366 | static void mixer_stop(struct mixer_context *ctx) | 371 | static void mixer_stop(struct mixer_context *ctx) |
@@ -373,16 +378,13 @@ static void mixer_stop(struct mixer_context *ctx) | |||
373 | while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && | 378 | while (!(mixer_reg_read(res, MXR_STATUS) & MXR_STATUS_REG_IDLE) && |
374 | --timeout) | 379 | --timeout) |
375 | usleep_range(10000, 12000); | 380 | usleep_range(10000, 12000); |
376 | |||
377 | mixer_regs_dump(ctx); | ||
378 | } | 381 | } |
379 | 382 | ||
380 | static void vp_video_buffer(struct mixer_context *ctx, int win) | 383 | static void vp_video_buffer(struct mixer_context *ctx, unsigned int win) |
381 | { | 384 | { |
382 | struct mixer_resources *res = &ctx->mixer_res; | 385 | struct mixer_resources *res = &ctx->mixer_res; |
383 | unsigned long flags; | 386 | unsigned long flags; |
384 | struct exynos_drm_plane *plane; | 387 | struct exynos_drm_plane *plane; |
385 | unsigned int buf_num = 1; | ||
386 | dma_addr_t luma_addr[2], chroma_addr[2]; | 388 | dma_addr_t luma_addr[2], chroma_addr[2]; |
387 | bool tiled_mode = false; | 389 | bool tiled_mode = false; |
388 | bool crcb_mode = false; | 390 | bool crcb_mode = false; |
@@ -393,27 +395,18 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
393 | switch (plane->pixel_format) { | 395 | switch (plane->pixel_format) { |
394 | case DRM_FORMAT_NV12: | 396 | case DRM_FORMAT_NV12: |
395 | crcb_mode = false; | 397 | crcb_mode = false; |
396 | buf_num = 2; | ||
397 | break; | 398 | break; |
398 | /* TODO: single buffer format NV12, NV21 */ | 399 | case DRM_FORMAT_NV21: |
400 | crcb_mode = true; | ||
401 | break; | ||
399 | default: | 402 | default: |
400 | /* ignore pixel format at disable time */ | ||
401 | if (!plane->dma_addr[0]) | ||
402 | break; | ||
403 | |||
404 | DRM_ERROR("pixel format for vp is wrong [%d].\n", | 403 | DRM_ERROR("pixel format for vp is wrong [%d].\n", |
405 | plane->pixel_format); | 404 | plane->pixel_format); |
406 | return; | 405 | return; |
407 | } | 406 | } |
408 | 407 | ||
409 | if (buf_num == 2) { | 408 | luma_addr[0] = plane->dma_addr[0]; |
410 | luma_addr[0] = plane->dma_addr[0]; | 409 | chroma_addr[0] = plane->dma_addr[1]; |
411 | chroma_addr[0] = plane->dma_addr[1]; | ||
412 | } else { | ||
413 | luma_addr[0] = plane->dma_addr[0]; | ||
414 | chroma_addr[0] = plane->dma_addr[0] | ||
415 | + (plane->pitch * plane->fb_height); | ||
416 | } | ||
417 | 410 | ||
418 | if (plane->scan_flag & DRM_MODE_FLAG_INTERLACE) { | 411 | if (plane->scan_flag & DRM_MODE_FLAG_INTERLACE) { |
419 | ctx->interlace = true; | 412 | ctx->interlace = true; |
@@ -484,6 +477,7 @@ static void vp_video_buffer(struct mixer_context *ctx, int win) | |||
484 | mixer_vsync_set_update(ctx, true); | 477 | mixer_vsync_set_update(ctx, true); |
485 | spin_unlock_irqrestore(&res->reg_slock, flags); | 478 | spin_unlock_irqrestore(&res->reg_slock, flags); |
486 | 479 | ||
480 | mixer_regs_dump(ctx); | ||
487 | vp_regs_dump(ctx); | 481 | vp_regs_dump(ctx); |
488 | } | 482 | } |
489 | 483 | ||
@@ -518,7 +512,7 @@ fail: | |||
518 | return -ENOTSUPP; | 512 | return -ENOTSUPP; |
519 | } | 513 | } |
520 | 514 | ||
521 | static void mixer_graph_buffer(struct mixer_context *ctx, int win) | 515 | static void mixer_graph_buffer(struct mixer_context *ctx, unsigned int win) |
522 | { | 516 | { |
523 | struct mixer_resources *res = &ctx->mixer_res; | 517 | struct mixer_resources *res = &ctx->mixer_res; |
524 | unsigned long flags; | 518 | unsigned long flags; |
@@ -531,20 +525,27 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win) | |||
531 | 525 | ||
532 | plane = &ctx->planes[win]; | 526 | plane = &ctx->planes[win]; |
533 | 527 | ||
534 | #define RGB565 4 | 528 | switch (plane->pixel_format) { |
535 | #define ARGB1555 5 | 529 | case DRM_FORMAT_XRGB4444: |
536 | #define ARGB4444 6 | 530 | fmt = MXR_FORMAT_ARGB4444; |
537 | #define ARGB8888 7 | 531 | break; |
538 | 532 | ||
539 | switch (plane->bpp) { | 533 | case DRM_FORMAT_XRGB1555: |
540 | case 16: | 534 | fmt = MXR_FORMAT_ARGB1555; |
541 | fmt = ARGB4444; | ||
542 | break; | 535 | break; |
543 | case 32: | 536 | |
544 | fmt = ARGB8888; | 537 | case DRM_FORMAT_RGB565: |
538 | fmt = MXR_FORMAT_RGB565; | ||
539 | break; | ||
540 | |||
541 | case DRM_FORMAT_XRGB8888: | ||
542 | case DRM_FORMAT_ARGB8888: | ||
543 | fmt = MXR_FORMAT_ARGB8888; | ||
545 | break; | 544 | break; |
545 | |||
546 | default: | 546 | default: |
547 | fmt = ARGB8888; | 547 | DRM_DEBUG_KMS("pixelformat unsupported by mixer\n"); |
548 | return; | ||
548 | } | 549 | } |
549 | 550 | ||
550 | /* check if mixer supports requested scaling setup */ | 551 | /* check if mixer supports requested scaling setup */ |
@@ -617,6 +618,8 @@ static void mixer_graph_buffer(struct mixer_context *ctx, int win) | |||
617 | 618 | ||
618 | mixer_vsync_set_update(ctx, true); | 619 | mixer_vsync_set_update(ctx, true); |
619 | spin_unlock_irqrestore(&res->reg_slock, flags); | 620 | spin_unlock_irqrestore(&res->reg_slock, flags); |
621 | |||
622 | mixer_regs_dump(ctx); | ||
620 | } | 623 | } |
621 | 624 | ||
622 | static void vp_win_reset(struct mixer_context *ctx) | 625 | static void vp_win_reset(struct mixer_context *ctx) |
@@ -1070,6 +1073,7 @@ static void mixer_poweroff(struct mixer_context *ctx) | |||
1070 | mutex_unlock(&ctx->mixer_mutex); | 1073 | mutex_unlock(&ctx->mixer_mutex); |
1071 | 1074 | ||
1072 | mixer_stop(ctx); | 1075 | mixer_stop(ctx); |
1076 | mixer_regs_dump(ctx); | ||
1073 | mixer_window_suspend(ctx); | 1077 | mixer_window_suspend(ctx); |
1074 | 1078 | ||
1075 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); | 1079 | ctx->int_en = mixer_reg_read(res, MXR_INT_EN); |
@@ -1126,7 +1130,7 @@ int mixer_check_mode(struct drm_display_mode *mode) | |||
1126 | return -EINVAL; | 1130 | return -EINVAL; |
1127 | } | 1131 | } |
1128 | 1132 | ||
1129 | static struct exynos_drm_crtc_ops mixer_crtc_ops = { | 1133 | static const struct exynos_drm_crtc_ops mixer_crtc_ops = { |
1130 | .dpms = mixer_dpms, | 1134 | .dpms = mixer_dpms, |
1131 | .enable_vblank = mixer_enable_vblank, | 1135 | .enable_vblank = mixer_enable_vblank, |
1132 | .disable_vblank = mixer_disable_vblank, | 1136 | .disable_vblank = mixer_disable_vblank, |
@@ -1156,7 +1160,7 @@ static struct mixer_drv_data exynos4210_mxr_drv_data = { | |||
1156 | .has_sclk = 1, | 1160 | .has_sclk = 1, |
1157 | }; | 1161 | }; |
1158 | 1162 | ||
1159 | static struct platform_device_id mixer_driver_types[] = { | 1163 | static const struct platform_device_id mixer_driver_types[] = { |
1160 | { | 1164 | { |
1161 | .name = "s5p-mixer", | 1165 | .name = "s5p-mixer", |
1162 | .driver_data = (unsigned long)&exynos4210_mxr_drv_data, | 1166 | .driver_data = (unsigned long)&exynos4210_mxr_drv_data, |