aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/exynos/exynos7_drm_decon.c4
-rw-r--r--drivers/gpu/drm/exynos/exynos_dp_core.c13
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.c10
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_crtc.h10
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_drv.h20
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fb.c39
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.c53
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_fimd.h15
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_plane.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_drm_vidi.c2
-rw-r--r--drivers/gpu/drm/exynos/exynos_mixer.c72
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c24
-rw-r--r--drivers/gpu/drm/msm/adreno/adreno_gpu.c2
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi.c10
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi_host.c21
-rw-r--r--drivers/gpu/drm/msm/dsi/dsi_manager.c6
-rw-r--r--drivers/gpu/drm/msm/edp/edp_aux.c4
-rw-r--r--drivers/gpu/drm/msm/edp/edp_connector.c2
-rw-r--r--drivers/gpu/drm/msm/edp/edp_ctrl.c3
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c34
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h9
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c12
-rw-r--r--drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c2
-rw-r--r--drivers/gpu/drm/msm/msm_drv.c24
-rw-r--r--drivers/gpu/drm/msm/msm_fb.c7
-rw-r--r--drivers/gpu/drm/msm/msm_gem.c2
-rw-r--r--drivers/gpu/drm/msm/msm_iommu.c4
-rw-r--r--drivers/gpu/drm/msm/msm_ringbuffer.c2
-rw-r--r--drivers/gpu/drm/radeon/atombios_dp.c20
-rw-r--r--drivers/gpu/drm/radeon/radeon_dp_auxch.c2
30 files changed, 190 insertions, 240 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
92static void decon_clear_channel(struct decon_context *ctx) 92static 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
713static struct exynos_drm_crtc_ops decon_crtc_ops = { 713static 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
1067static void exynos_dp_poweron(struct exynos_dp_device *dp) 1066static 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
1088static void exynos_dp_poweroff(struct exynos_dp_device *dp) 1090static 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
240struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, 240struct 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
20struct exynos_drm_crtc *exynos_drm_crtc_create(struct drm_device *drm_dev, 20struct 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);
26int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe); 26int exynos_drm_crtc_enable_vblank(struct drm_device *dev, int pipe);
27void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe); 27void exynos_drm_crtc_disable_vblank(struct drm_device *dev, int pipe);
28void exynos_drm_crtc_finish_pageflip(struct drm_device *dev, int pipe); 28void 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 */
185struct exynos_drm_crtc; 176struct exynos_drm_crtc;
186struct exynos_drm_crtc_ops { 177struct 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
174static 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
211static struct drm_framebuffer * 174static struct drm_framebuffer *
212exynos_user_fb_create(struct drm_device *dev, struct drm_file *file_priv, 175exynos_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
219static void fimd_enable_video_output(struct fimd_context *ctx, int win, 218static 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
232static void fimd_enable_shadow_channel_path(struct fimd_context *ctx, int win, 231static 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
245static void fimd_clear_channel(struct fimd_context *ctx) 245static 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
949static struct exynos_drm_crtc_ops fimd_crtc_ops = { 949static 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
966static 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
961static irqreturn_t fimd_irq_handler(int irq, void *dev_id) 979static 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
1036static void fimd_unbind(struct device *dev, struct device *master, 1049static 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
1195void 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}
1211EXPORT_SYMBOL_GPL(fimd_dp_clock_enable);
1212
1213struct platform_driver fimd_driver = { 1208struct 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
13extern 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
220static struct exynos_drm_crtc_ops vidi_crtc_ops = { 220static 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
47struct mixer_resources { 53struct 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
330static void mixer_cfg_layer(struct mixer_context *ctx, int win, bool enable) 336static 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
366static void mixer_stop(struct mixer_context *ctx) 371static 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
380static void vp_video_buffer(struct mixer_context *ctx, int win) 383static 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
521static void mixer_graph_buffer(struct mixer_context *ctx, int win) 515static 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
622static void vp_win_reset(struct mixer_context *ctx) 625static 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
1129static struct exynos_drm_crtc_ops mixer_crtc_ops = { 1133static 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
1159static struct platform_device_id mixer_driver_types[] = { 1163static 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,
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index fa4ccb346389..555b896d2bda 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -2045,22 +2045,20 @@ static void ilk_compute_wm_parameters(struct drm_crtc *crtc,
2045 p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal; 2045 p->pipe_htotal = intel_crtc->config->base.adjusted_mode.crtc_htotal;
2046 p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc); 2046 p->pixel_rate = ilk_pipe_pixel_rate(dev, crtc);
2047 2047
2048 if (crtc->primary->state->fb) { 2048 if (crtc->primary->state->fb)
2049 p->pri.enabled = true;
2050 p->pri.bytes_per_pixel = 2049 p->pri.bytes_per_pixel =
2051 crtc->primary->state->fb->bits_per_pixel / 8; 2050 crtc->primary->state->fb->bits_per_pixel / 8;
2052 } else { 2051 else
2053 p->pri.enabled = false; 2052 p->pri.bytes_per_pixel = 4;
2054 p->pri.bytes_per_pixel = 0; 2053
2055 } 2054 p->cur.bytes_per_pixel = 4;
2055 /*
2056 * TODO: for now, assume primary and cursor planes are always enabled.
2057 * Setting them to false makes the screen flicker.
2058 */
2059 p->pri.enabled = true;
2060 p->cur.enabled = true;
2056 2061
2057 if (crtc->cursor->state->fb) {
2058 p->cur.enabled = true;
2059 p->cur.bytes_per_pixel = 4;
2060 } else {
2061 p->cur.enabled = false;
2062 p->cur.bytes_per_pixel = 0;
2063 }
2064 p->pri.horiz_pixels = intel_crtc->config->pipe_src_w; 2062 p->pri.horiz_pixels = intel_crtc->config->pipe_src_w;
2065 p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w; 2063 p->cur.horiz_pixels = intel_crtc->base.cursor->state->crtc_w;
2066 2064
diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 94a5bee69fe7..bbdcab0a56c1 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -384,7 +384,7 @@ void adreno_gpu_cleanup(struct adreno_gpu *gpu)
384 if (gpu->memptrs_bo) { 384 if (gpu->memptrs_bo) {
385 if (gpu->memptrs_iova) 385 if (gpu->memptrs_iova)
386 msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id); 386 msm_gem_put_iova(gpu->memptrs_bo, gpu->base.id);
387 drm_gem_object_unreference(gpu->memptrs_bo); 387 drm_gem_object_unreference_unlocked(gpu->memptrs_bo);
388 } 388 }
389 release_firmware(gpu->pm4); 389 release_firmware(gpu->pm4);
390 release_firmware(gpu->pfp); 390 release_firmware(gpu->pfp);
diff --git a/drivers/gpu/drm/msm/dsi/dsi.c b/drivers/gpu/drm/msm/dsi/dsi.c
index 28d1f95a90cc..ad50b80225f5 100644
--- a/drivers/gpu/drm/msm/dsi/dsi.c
+++ b/drivers/gpu/drm/msm/dsi/dsi.c
@@ -177,6 +177,11 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
177 goto fail; 177 goto fail;
178 } 178 }
179 179
180 for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) {
181 encoders[i]->bridge = msm_dsi->bridge;
182 msm_dsi->encoders[i] = encoders[i];
183 }
184
180 msm_dsi->connector = msm_dsi_manager_connector_init(msm_dsi->id); 185 msm_dsi->connector = msm_dsi_manager_connector_init(msm_dsi->id);
181 if (IS_ERR(msm_dsi->connector)) { 186 if (IS_ERR(msm_dsi->connector)) {
182 ret = PTR_ERR(msm_dsi->connector); 187 ret = PTR_ERR(msm_dsi->connector);
@@ -185,11 +190,6 @@ int msm_dsi_modeset_init(struct msm_dsi *msm_dsi, struct drm_device *dev,
185 goto fail; 190 goto fail;
186 } 191 }
187 192
188 for (i = 0; i < MSM_DSI_ENCODER_NUM; i++) {
189 encoders[i]->bridge = msm_dsi->bridge;
190 msm_dsi->encoders[i] = encoders[i];
191 }
192
193 priv->bridges[priv->num_bridges++] = msm_dsi->bridge; 193 priv->bridges[priv->num_bridges++] = msm_dsi->bridge;
194 priv->connectors[priv->num_connectors++] = msm_dsi->connector; 194 priv->connectors[priv->num_connectors++] = msm_dsi->connector;
195 195
diff --git a/drivers/gpu/drm/msm/dsi/dsi_host.c b/drivers/gpu/drm/msm/dsi/dsi_host.c
index 956b22492c9a..649d20d29f92 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_host.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_host.c
@@ -1023,7 +1023,7 @@ static int dsi_short_read1_resp(u8 *buf, const struct mipi_dsi_msg *msg)
1023 *data = buf[1]; /* strip out dcs type */ 1023 *data = buf[1]; /* strip out dcs type */
1024 return 1; 1024 return 1;
1025 } else { 1025 } else {
1026 pr_err("%s: read data does not match with rx_buf len %d\n", 1026 pr_err("%s: read data does not match with rx_buf len %zu\n",
1027 __func__, msg->rx_len); 1027 __func__, msg->rx_len);
1028 return -EINVAL; 1028 return -EINVAL;
1029 } 1029 }
@@ -1040,7 +1040,7 @@ static int dsi_short_read2_resp(u8 *buf, const struct mipi_dsi_msg *msg)
1040 data[1] = buf[2]; 1040 data[1] = buf[2];
1041 return 2; 1041 return 2;
1042 } else { 1042 } else {
1043 pr_err("%s: read data does not match with rx_buf len %d\n", 1043 pr_err("%s: read data does not match with rx_buf len %zu\n",
1044 __func__, msg->rx_len); 1044 __func__, msg->rx_len);
1045 return -EINVAL; 1045 return -EINVAL;
1046 } 1046 }
@@ -1093,7 +1093,6 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
1093{ 1093{
1094 u32 *lp, *temp, data; 1094 u32 *lp, *temp, data;
1095 int i, j = 0, cnt; 1095 int i, j = 0, cnt;
1096 bool ack_error = false;
1097 u32 read_cnt; 1096 u32 read_cnt;
1098 u8 reg[16]; 1097 u8 reg[16];
1099 int repeated_bytes = 0; 1098 int repeated_bytes = 0;
@@ -1105,15 +1104,10 @@ static int dsi_cmd_dma_rx(struct msm_dsi_host *msm_host,
1105 if (cnt > 4) 1104 if (cnt > 4)
1106 cnt = 4; /* 4 x 32 bits registers only */ 1105 cnt = 4; /* 4 x 32 bits registers only */
1107 1106
1108 /* Calculate real read data count */ 1107 if (rx_byte == 4)
1109 read_cnt = dsi_read(msm_host, 0x1d4) >> 16; 1108 read_cnt = 4;
1110 1109 else
1111 ack_error = (rx_byte == 4) ? 1110 read_cnt = pkt_size + 6;
1112 (read_cnt == 8) : /* short pkt + 4-byte error pkt */
1113 (read_cnt == (pkt_size + 6 + 4)); /* long pkt+4-byte error pkt*/
1114
1115 if (ack_error)
1116 read_cnt -= 4; /* Remove 4 byte error pkt */
1117 1111
1118 /* 1112 /*
1119 * In case of multiple reads from the panel, after the first read, there 1113 * In case of multiple reads from the panel, after the first read, there
@@ -1215,7 +1209,7 @@ static void dsi_err_worker(struct work_struct *work)
1215 container_of(work, struct msm_dsi_host, err_work); 1209 container_of(work, struct msm_dsi_host, err_work);
1216 u32 status = msm_host->err_work_state; 1210 u32 status = msm_host->err_work_state;
1217 1211
1218 pr_err("%s: status=%x\n", __func__, status); 1212 pr_err_ratelimited("%s: status=%x\n", __func__, status);
1219 if (status & DSI_ERR_STATE_MDP_FIFO_UNDERFLOW) 1213 if (status & DSI_ERR_STATE_MDP_FIFO_UNDERFLOW)
1220 dsi_sw_reset_restore(msm_host); 1214 dsi_sw_reset_restore(msm_host);
1221 1215
@@ -1797,6 +1791,7 @@ int msm_dsi_host_cmd_rx(struct mipi_dsi_host *host,
1797 case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT: 1791 case MIPI_DSI_RX_ACKNOWLEDGE_AND_ERROR_REPORT:
1798 pr_err("%s: rx ACK_ERR_PACLAGE\n", __func__); 1792 pr_err("%s: rx ACK_ERR_PACLAGE\n", __func__);
1799 ret = 0; 1793 ret = 0;
1794 break;
1800 case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE: 1795 case MIPI_DSI_RX_GENERIC_SHORT_READ_RESPONSE_1BYTE:
1801 case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE: 1796 case MIPI_DSI_RX_DCS_SHORT_READ_RESPONSE_1BYTE:
1802 ret = dsi_short_read1_resp(buf, msg); 1797 ret = dsi_short_read1_resp(buf, msg);
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
index ee3ebcaa33f5..0a40f3c64e8b 100644
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
@@ -462,7 +462,7 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id)
462 struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id); 462 struct msm_dsi *msm_dsi = dsi_mgr_get_dsi(id);
463 struct drm_connector *connector = NULL; 463 struct drm_connector *connector = NULL;
464 struct dsi_connector *dsi_connector; 464 struct dsi_connector *dsi_connector;
465 int ret; 465 int ret, i;
466 466
467 dsi_connector = devm_kzalloc(msm_dsi->dev->dev, 467 dsi_connector = devm_kzalloc(msm_dsi->dev->dev,
468 sizeof(*dsi_connector), GFP_KERNEL); 468 sizeof(*dsi_connector), GFP_KERNEL);
@@ -495,6 +495,10 @@ struct drm_connector *msm_dsi_manager_connector_init(u8 id)
495 if (ret) 495 if (ret)
496 goto fail; 496 goto fail;
497 497
498 for (i = 0; i < MSM_DSI_ENCODER_NUM; i++)
499 drm_mode_connector_attach_encoder(connector,
500 msm_dsi->encoders[i]);
501
498 return connector; 502 return connector;
499 503
500fail: 504fail:
diff --git a/drivers/gpu/drm/msm/edp/edp_aux.c b/drivers/gpu/drm/msm/edp/edp_aux.c
index 5f5a84f6074c..208f9d47f82e 100644
--- a/drivers/gpu/drm/msm/edp/edp_aux.c
+++ b/drivers/gpu/drm/msm/edp/edp_aux.c
@@ -132,7 +132,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
132 /* msg sanity check */ 132 /* msg sanity check */
133 if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) || 133 if ((native && (msg->size > AUX_CMD_NATIVE_MAX)) ||
134 (msg->size > AUX_CMD_I2C_MAX)) { 134 (msg->size > AUX_CMD_I2C_MAX)) {
135 pr_err("%s: invalid msg: size(%d), request(%x)\n", 135 pr_err("%s: invalid msg: size(%zu), request(%x)\n",
136 __func__, msg->size, msg->request); 136 __func__, msg->size, msg->request);
137 return -EINVAL; 137 return -EINVAL;
138 } 138 }
@@ -155,7 +155,7 @@ ssize_t edp_aux_transfer(struct drm_dp_aux *drm_aux, struct drm_dp_aux_msg *msg)
155 */ 155 */
156 edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0); 156 edp_write(aux->base + REG_EDP_AUX_TRANS_CTRL, 0);
157 msm_edp_aux_ctrl(aux, 1); 157 msm_edp_aux_ctrl(aux, 1);
158 pr_err("%s: aux timeout, %d\n", __func__, ret); 158 pr_err("%s: aux timeout, %zd\n", __func__, ret);
159 goto unlock_exit; 159 goto unlock_exit;
160 } 160 }
161 DBG("completion"); 161 DBG("completion");
diff --git a/drivers/gpu/drm/msm/edp/edp_connector.c b/drivers/gpu/drm/msm/edp/edp_connector.c
index d8812e84da54..b4d1b469862a 100644
--- a/drivers/gpu/drm/msm/edp/edp_connector.c
+++ b/drivers/gpu/drm/msm/edp/edp_connector.c
@@ -151,6 +151,8 @@ struct drm_connector *msm_edp_connector_init(struct msm_edp *edp)
151 if (ret) 151 if (ret)
152 goto fail; 152 goto fail;
153 153
154 drm_mode_connector_attach_encoder(connector, edp->encoder);
155
154 return connector; 156 return connector;
155 157
156fail: 158fail:
diff --git a/drivers/gpu/drm/msm/edp/edp_ctrl.c b/drivers/gpu/drm/msm/edp/edp_ctrl.c
index 0ec5abdba5c4..29e52d7c61c0 100644
--- a/drivers/gpu/drm/msm/edp/edp_ctrl.c
+++ b/drivers/gpu/drm/msm/edp/edp_ctrl.c
@@ -1149,12 +1149,13 @@ int msm_edp_ctrl_init(struct msm_edp *edp)
1149 ctrl->aux = msm_edp_aux_init(dev, ctrl->base, &ctrl->drm_aux); 1149 ctrl->aux = msm_edp_aux_init(dev, ctrl->base, &ctrl->drm_aux);
1150 if (!ctrl->aux || !ctrl->drm_aux) { 1150 if (!ctrl->aux || !ctrl->drm_aux) {
1151 pr_err("%s:failed to init aux\n", __func__); 1151 pr_err("%s:failed to init aux\n", __func__);
1152 return ret; 1152 return -ENOMEM;
1153 } 1153 }
1154 1154
1155 ctrl->phy = msm_edp_phy_init(dev, ctrl->base); 1155 ctrl->phy = msm_edp_phy_init(dev, ctrl->base);
1156 if (!ctrl->phy) { 1156 if (!ctrl->phy) {
1157 pr_err("%s:failed to init phy\n", __func__); 1157 pr_err("%s:failed to init phy\n", __func__);
1158 ret = -ENOMEM;
1158 goto err_destory_aux; 1159 goto err_destory_aux;
1159 } 1160 }
1160 1161
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
index e001e6b2296a..8b9a7931b162 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.c
@@ -72,14 +72,13 @@ const struct mdp5_cfg_hw msm8x74_config = {
72 .base = { 0x12d00, 0x12e00, 0x12f00 }, 72 .base = { 0x12d00, 0x12e00, 0x12f00 },
73 }, 73 },
74 .intf = { 74 .intf = {
75 .count = 4,
76 .base = { 0x12500, 0x12700, 0x12900, 0x12b00 }, 75 .base = { 0x12500, 0x12700, 0x12900, 0x12b00 },
77 }, 76 .connect = {
78 .intfs = { 77 [0] = INTF_eDP,
79 [0] = INTF_eDP, 78 [1] = INTF_DSI,
80 [1] = INTF_DSI, 79 [2] = INTF_DSI,
81 [2] = INTF_DSI, 80 [3] = INTF_HDMI,
82 [3] = INTF_HDMI, 81 },
83 }, 82 },
84 .max_clk = 200000000, 83 .max_clk = 200000000,
85}; 84};
@@ -142,14 +141,13 @@ const struct mdp5_cfg_hw apq8084_config = {
142 .base = { 0x12f00, 0x13000, 0x13100, 0x13200 }, 141 .base = { 0x12f00, 0x13000, 0x13100, 0x13200 },
143 }, 142 },
144 .intf = { 143 .intf = {
145 .count = 5,
146 .base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 }, 144 .base = { 0x12500, 0x12700, 0x12900, 0x12b00, 0x12d00 },
147 }, 145 .connect = {
148 .intfs = { 146 [0] = INTF_eDP,
149 [0] = INTF_eDP, 147 [1] = INTF_DSI,
150 [1] = INTF_DSI, 148 [2] = INTF_DSI,
151 [2] = INTF_DSI, 149 [3] = INTF_HDMI,
152 [3] = INTF_HDMI, 150 },
153 }, 151 },
154 .max_clk = 320000000, 152 .max_clk = 320000000,
155}; 153};
@@ -196,10 +194,12 @@ const struct mdp5_cfg_hw msm8x16_config = {
196 194
197 }, 195 },
198 .intf = { 196 .intf = {
199 .count = 1, /* INTF_1 */ 197 .base = { 0x00000, 0x6b800 },
200 .base = { 0x6B800 }, 198 .connect = {
199 [0] = INTF_DISABLED,
200 [1] = INTF_DSI,
201 },
201 }, 202 },
202 /* TODO enable .intfs[] with [1] = INTF_DSI, once DSI is implemented */
203 .max_clk = 320000000, 203 .max_clk = 320000000,
204}; 204};
205 205
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
index 3a551b0892d8..69349abe59f2 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_cfg.h
@@ -59,6 +59,11 @@ struct mdp5_smp_block {
59 59
60#define MDP5_INTF_NUM_MAX 5 60#define MDP5_INTF_NUM_MAX 5
61 61
62struct mdp5_intf_block {
63 uint32_t base[MAX_BASES];
64 u32 connect[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */
65};
66
62struct mdp5_cfg_hw { 67struct mdp5_cfg_hw {
63 char *name; 68 char *name;
64 69
@@ -72,9 +77,7 @@ struct mdp5_cfg_hw {
72 struct mdp5_sub_block dspp; 77 struct mdp5_sub_block dspp;
73 struct mdp5_sub_block ad; 78 struct mdp5_sub_block ad;
74 struct mdp5_sub_block pp; 79 struct mdp5_sub_block pp;
75 struct mdp5_sub_block intf; 80 struct mdp5_intf_block intf;
76
77 u32 intfs[MDP5_INTF_NUM_MAX]; /* array of enum mdp5_intf_type */
78 81
79 uint32_t max_clk; 82 uint32_t max_clk;
80}; 83};
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index dfa8beb9343a..bbacf9d2b738 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -206,8 +206,8 @@ static struct drm_encoder *construct_encoder(struct mdp5_kms *mdp5_kms,
206 206
207static int get_dsi_id_from_intf(const struct mdp5_cfg_hw *hw_cfg, int intf_num) 207static int get_dsi_id_from_intf(const struct mdp5_cfg_hw *hw_cfg, int intf_num)
208{ 208{
209 const int intf_cnt = hw_cfg->intf.count; 209 const enum mdp5_intf_type *intfs = hw_cfg->intf.connect;
210 const u32 *intfs = hw_cfg->intfs; 210 const int intf_cnt = ARRAY_SIZE(hw_cfg->intf.connect);
211 int id = 0, i; 211 int id = 0, i;
212 212
213 for (i = 0; i < intf_cnt; i++) { 213 for (i = 0; i < intf_cnt; i++) {
@@ -228,7 +228,7 @@ static int modeset_init_intf(struct mdp5_kms *mdp5_kms, int intf_num)
228 struct msm_drm_private *priv = dev->dev_private; 228 struct msm_drm_private *priv = dev->dev_private;
229 const struct mdp5_cfg_hw *hw_cfg = 229 const struct mdp5_cfg_hw *hw_cfg =
230 mdp5_cfg_get_hw_config(mdp5_kms->cfg); 230 mdp5_cfg_get_hw_config(mdp5_kms->cfg);
231 enum mdp5_intf_type intf_type = hw_cfg->intfs[intf_num]; 231 enum mdp5_intf_type intf_type = hw_cfg->intf.connect[intf_num];
232 struct drm_encoder *encoder; 232 struct drm_encoder *encoder;
233 int ret = 0; 233 int ret = 0;
234 234
@@ -365,7 +365,7 @@ static int modeset_init(struct mdp5_kms *mdp5_kms)
365 /* Construct encoders and modeset initialize connector devices 365 /* Construct encoders and modeset initialize connector devices
366 * for each external display interface. 366 * for each external display interface.
367 */ 367 */
368 for (i = 0; i < ARRAY_SIZE(hw_cfg->intfs); i++) { 368 for (i = 0; i < ARRAY_SIZE(hw_cfg->intf.connect); i++) {
369 ret = modeset_init_intf(mdp5_kms, i); 369 ret = modeset_init_intf(mdp5_kms, i);
370 if (ret) 370 if (ret)
371 goto fail; 371 goto fail;
@@ -514,8 +514,8 @@ struct msm_kms *mdp5_kms_init(struct drm_device *dev)
514 */ 514 */
515 mdp5_enable(mdp5_kms); 515 mdp5_enable(mdp5_kms);
516 for (i = 0; i < MDP5_INTF_NUM_MAX; i++) { 516 for (i = 0; i < MDP5_INTF_NUM_MAX; i++) {
517 if (!config->hw->intf.base[i] || 517 if (mdp5_cfg_intf_is_virtual(config->hw->intf.connect[i]) ||
518 mdp5_cfg_intf_is_virtual(config->hw->intfs[i])) 518 !config->hw->intf.base[i])
519 continue; 519 continue;
520 mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 0); 520 mdp5_write(mdp5_kms, REG_MDP5_INTF_TIMING_ENGINE_EN(i), 0);
521 } 521 }
diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index 18a3d203b174..57b8f56ae9d0 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -273,7 +273,7 @@ static void set_scanout_locked(struct drm_plane *plane,
273 mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC2_ADDR(pipe), 273 mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC2_ADDR(pipe),
274 msm_framebuffer_iova(fb, mdp5_kms->id, 2)); 274 msm_framebuffer_iova(fb, mdp5_kms->id, 2));
275 mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC3_ADDR(pipe), 275 mdp5_write(mdp5_kms, REG_MDP5_PIPE_SRC3_ADDR(pipe),
276 msm_framebuffer_iova(fb, mdp5_kms->id, 4)); 276 msm_framebuffer_iova(fb, mdp5_kms->id, 3));
277 277
278 plane->fb = fb; 278 plane->fb = fb;
279} 279}
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index 47f4dd407671..c80a6bee2b18 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -21,9 +21,11 @@
21 21
22static void msm_fb_output_poll_changed(struct drm_device *dev) 22static void msm_fb_output_poll_changed(struct drm_device *dev)
23{ 23{
24#ifdef CONFIG_DRM_MSM_FBDEV
24 struct msm_drm_private *priv = dev->dev_private; 25 struct msm_drm_private *priv = dev->dev_private;
25 if (priv->fbdev) 26 if (priv->fbdev)
26 drm_fb_helper_hotplug_event(priv->fbdev); 27 drm_fb_helper_hotplug_event(priv->fbdev);
28#endif
27} 29}
28 30
29static const struct drm_mode_config_funcs mode_config_funcs = { 31static const struct drm_mode_config_funcs mode_config_funcs = {
@@ -94,7 +96,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
94 } 96 }
95 97
96 if (reglog) 98 if (reglog)
97 printk(KERN_DEBUG "IO:region %s %08x %08lx\n", dbgname, (u32)ptr, size); 99 printk(KERN_DEBUG "IO:region %s %p %08lx\n", dbgname, ptr, size);
98 100
99 return ptr; 101 return ptr;
100} 102}
@@ -102,7 +104,7 @@ void __iomem *msm_ioremap(struct platform_device *pdev, const char *name,
102void msm_writel(u32 data, void __iomem *addr) 104void msm_writel(u32 data, void __iomem *addr)
103{ 105{
104 if (reglog) 106 if (reglog)
105 printk(KERN_DEBUG "IO:W %08x %08x\n", (u32)addr, data); 107 printk(KERN_DEBUG "IO:W %p %08x\n", addr, data);
106 writel(data, addr); 108 writel(data, addr);
107} 109}
108 110
@@ -110,7 +112,7 @@ u32 msm_readl(const void __iomem *addr)
110{ 112{
111 u32 val = readl(addr); 113 u32 val = readl(addr);
112 if (reglog) 114 if (reglog)
113 printk(KERN_ERR "IO:R %08x %08x\n", (u32)addr, val); 115 printk(KERN_ERR "IO:R %p %08x\n", addr, val);
114 return val; 116 return val;
115} 117}
116 118
@@ -143,8 +145,8 @@ static int msm_unload(struct drm_device *dev)
143 if (gpu) { 145 if (gpu) {
144 mutex_lock(&dev->struct_mutex); 146 mutex_lock(&dev->struct_mutex);
145 gpu->funcs->pm_suspend(gpu); 147 gpu->funcs->pm_suspend(gpu);
146 gpu->funcs->destroy(gpu);
147 mutex_unlock(&dev->struct_mutex); 148 mutex_unlock(&dev->struct_mutex);
149 gpu->funcs->destroy(gpu);
148 } 150 }
149 151
150 if (priv->vram.paddr) { 152 if (priv->vram.paddr) {
@@ -177,7 +179,7 @@ static int get_mdp_ver(struct platform_device *pdev)
177 const struct of_device_id *match; 179 const struct of_device_id *match;
178 match = of_match_node(match_types, dev->of_node); 180 match = of_match_node(match_types, dev->of_node);
179 if (match) 181 if (match)
180 return (int)match->data; 182 return (int)(unsigned long)match->data;
181#endif 183#endif
182 return 4; 184 return 4;
183} 185}
@@ -216,7 +218,7 @@ static int msm_init_vram(struct drm_device *dev)
216 if (ret) 218 if (ret)
217 return ret; 219 return ret;
218 size = r.end - r.start; 220 size = r.end - r.start;
219 DRM_INFO("using VRAM carveout: %lx@%08x\n", size, r.start); 221 DRM_INFO("using VRAM carveout: %lx@%pa\n", size, &r.start);
220 } else 222 } else
221#endif 223#endif
222 224
@@ -283,10 +285,6 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
283 285
284 drm_mode_config_init(dev); 286 drm_mode_config_init(dev);
285 287
286 ret = msm_init_vram(dev);
287 if (ret)
288 goto fail;
289
290 platform_set_drvdata(pdev, dev); 288 platform_set_drvdata(pdev, dev);
291 289
292 /* Bind all our sub-components: */ 290 /* Bind all our sub-components: */
@@ -294,6 +292,10 @@ static int msm_load(struct drm_device *dev, unsigned long flags)
294 if (ret) 292 if (ret)
295 return ret; 293 return ret;
296 294
295 ret = msm_init_vram(dev);
296 if (ret)
297 goto fail;
298
297 switch (get_mdp_ver(pdev)) { 299 switch (get_mdp_ver(pdev)) {
298 case 4: 300 case 4:
299 kms = mdp4_kms_init(dev); 301 kms = mdp4_kms_init(dev);
@@ -419,9 +421,11 @@ static void msm_preclose(struct drm_device *dev, struct drm_file *file)
419 421
420static void msm_lastclose(struct drm_device *dev) 422static void msm_lastclose(struct drm_device *dev)
421{ 423{
424#ifdef CONFIG_DRM_MSM_FBDEV
422 struct msm_drm_private *priv = dev->dev_private; 425 struct msm_drm_private *priv = dev->dev_private;
423 if (priv->fbdev) 426 if (priv->fbdev)
424 drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev); 427 drm_fb_helper_restore_fbdev_mode_unlocked(priv->fbdev);
428#endif
425} 429}
426 430
427static irqreturn_t msm_irq(int irq, void *arg) 431static irqreturn_t msm_irq(int irq, void *arg)
diff --git a/drivers/gpu/drm/msm/msm_fb.c b/drivers/gpu/drm/msm/msm_fb.c
index 6b573e612f27..121713281417 100644
--- a/drivers/gpu/drm/msm/msm_fb.c
+++ b/drivers/gpu/drm/msm/msm_fb.c
@@ -172,8 +172,8 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
172{ 172{
173 struct msm_drm_private *priv = dev->dev_private; 173 struct msm_drm_private *priv = dev->dev_private;
174 struct msm_kms *kms = priv->kms; 174 struct msm_kms *kms = priv->kms;
175 struct msm_framebuffer *msm_fb; 175 struct msm_framebuffer *msm_fb = NULL;
176 struct drm_framebuffer *fb = NULL; 176 struct drm_framebuffer *fb;
177 const struct msm_format *format; 177 const struct msm_format *format;
178 int ret, i, n; 178 int ret, i, n;
179 unsigned int hsub, vsub; 179 unsigned int hsub, vsub;
@@ -239,8 +239,7 @@ struct drm_framebuffer *msm_framebuffer_init(struct drm_device *dev,
239 return fb; 239 return fb;
240 240
241fail: 241fail:
242 if (fb) 242 kfree(msm_fb);
243 msm_framebuffer_destroy(fb);
244 243
245 return ERR_PTR(ret); 244 return ERR_PTR(ret);
246} 245}
diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c
index 479d8af72bcb..52839769eb6c 100644
--- a/drivers/gpu/drm/msm/msm_gem.c
+++ b/drivers/gpu/drm/msm/msm_gem.c
@@ -483,7 +483,7 @@ void msm_gem_describe(struct drm_gem_object *obj, struct seq_file *m)
483 uint64_t off = drm_vma_node_start(&obj->vma_node); 483 uint64_t off = drm_vma_node_start(&obj->vma_node);
484 484
485 WARN_ON(!mutex_is_locked(&dev->struct_mutex)); 485 WARN_ON(!mutex_is_locked(&dev->struct_mutex));
486 seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %d\n", 486 seq_printf(m, "%08x: %c(r=%u,w=%u) %2d (%2d) %08llx %p %zu\n",
487 msm_obj->flags, is_active(msm_obj) ? 'A' : 'I', 487 msm_obj->flags, is_active(msm_obj) ? 'A' : 'I',
488 msm_obj->read_fence, msm_obj->write_fence, 488 msm_obj->read_fence, msm_obj->write_fence,
489 obj->name, obj->refcount.refcount.counter, 489 obj->name, obj->refcount.refcount.counter,
diff --git a/drivers/gpu/drm/msm/msm_iommu.c b/drivers/gpu/drm/msm/msm_iommu.c
index 7acdaa5688b7..7ac2f1997e4a 100644
--- a/drivers/gpu/drm/msm/msm_iommu.c
+++ b/drivers/gpu/drm/msm/msm_iommu.c
@@ -60,7 +60,7 @@ static int msm_iommu_map(struct msm_mmu *mmu, uint32_t iova,
60 u32 pa = sg_phys(sg) - sg->offset; 60 u32 pa = sg_phys(sg) - sg->offset;
61 size_t bytes = sg->length + sg->offset; 61 size_t bytes = sg->length + sg->offset;
62 62
63 VERB("map[%d]: %08x %08x(%x)", i, iova, pa, bytes); 63 VERB("map[%d]: %08x %08x(%zx)", i, iova, pa, bytes);
64 64
65 ret = iommu_map(domain, da, pa, bytes, prot); 65 ret = iommu_map(domain, da, pa, bytes, prot);
66 if (ret) 66 if (ret)
@@ -99,7 +99,7 @@ static int msm_iommu_unmap(struct msm_mmu *mmu, uint32_t iova,
99 if (unmapped < bytes) 99 if (unmapped < bytes)
100 return unmapped; 100 return unmapped;
101 101
102 VERB("unmap[%d]: %08x(%x)", i, iova, bytes); 102 VERB("unmap[%d]: %08x(%zx)", i, iova, bytes);
103 103
104 BUG_ON(!PAGE_ALIGNED(bytes)); 104 BUG_ON(!PAGE_ALIGNED(bytes));
105 105
diff --git a/drivers/gpu/drm/msm/msm_ringbuffer.c b/drivers/gpu/drm/msm/msm_ringbuffer.c
index 8171537dd7d1..1f14b908b221 100644
--- a/drivers/gpu/drm/msm/msm_ringbuffer.c
+++ b/drivers/gpu/drm/msm/msm_ringbuffer.c
@@ -56,6 +56,6 @@ fail:
56void msm_ringbuffer_destroy(struct msm_ringbuffer *ring) 56void msm_ringbuffer_destroy(struct msm_ringbuffer *ring)
57{ 57{
58 if (ring->bo) 58 if (ring->bo)
59 drm_gem_object_unreference(ring->bo); 59 drm_gem_object_unreference_unlocked(ring->bo);
60 kfree(ring); 60 kfree(ring);
61} 61}
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 3e3290c203c6..b435c859dcbc 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -421,19 +421,21 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector)
421{ 421{
422 struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv; 422 struct radeon_connector_atom_dig *dig_connector = radeon_connector->con_priv;
423 u8 msg[DP_DPCD_SIZE]; 423 u8 msg[DP_DPCD_SIZE];
424 int ret; 424 int ret, i;
425 425
426 ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, 426 for (i = 0; i < 7; i++) {
427 DP_DPCD_SIZE); 427 ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg,
428 if (ret > 0) { 428 DP_DPCD_SIZE);
429 memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); 429 if (ret == DP_DPCD_SIZE) {
430 memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE);
430 431
431 DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd), 432 DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd),
432 dig_connector->dpcd); 433 dig_connector->dpcd);
433 434
434 radeon_dp_probe_oui(radeon_connector); 435 radeon_dp_probe_oui(radeon_connector);
435 436
436 return true; 437 return true;
438 }
437 } 439 }
438 dig_connector->dpcd[0] = 0; 440 dig_connector->dpcd[0] = 0;
439 return false; 441 return false;
diff --git a/drivers/gpu/drm/radeon/radeon_dp_auxch.c b/drivers/gpu/drm/radeon/radeon_dp_auxch.c
index bf1fecc6cceb..fcbd60bb0349 100644
--- a/drivers/gpu/drm/radeon/radeon_dp_auxch.c
+++ b/drivers/gpu/drm/radeon/radeon_dp_auxch.c
@@ -30,8 +30,6 @@
30 AUX_SW_RX_HPD_DISCON | \ 30 AUX_SW_RX_HPD_DISCON | \
31 AUX_SW_RX_PARTIAL_BYTE | \ 31 AUX_SW_RX_PARTIAL_BYTE | \
32 AUX_SW_NON_AUX_MODE | \ 32 AUX_SW_NON_AUX_MODE | \
33 AUX_SW_RX_MIN_COUNT_VIOL | \
34 AUX_SW_RX_INVALID_STOP | \
35 AUX_SW_RX_SYNC_INVALID_L | \ 33 AUX_SW_RX_SYNC_INVALID_L | \
36 AUX_SW_RX_SYNC_INVALID_H | \ 34 AUX_SW_RX_SYNC_INVALID_H | \
37 AUX_SW_RX_INVALID_START | \ 35 AUX_SW_RX_INVALID_START | \