aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-06-16 04:46:47 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-06-16 04:46:47 -0400
commitdb96d5853e7d55f1d469d51a93ab38ce3bd72daa (patch)
tree61a2bf90be9e17932e3dedb618ed62fb8fcee56c
parent51ce5f332940ea114426db57772fe0ed18cc2790 (diff)
parent7119dbdf7c52042acb1b02f116fa3257e97659ea (diff)
Merge tag 'drm-fixes-for-v4.12-rc6' of git://people.freedesktop.org/~airlied/linux
Pull drm fixes from Dave Airlie: "This is the main fixes pull for 4.12-rc6, all pretty normal for this stage, nothing really stands out. The mxsfb one is probably the largest and it's for a black screen boot problem. AMD, i915, mgag200, msxfb, tegra fixes" * tag 'drm-fixes-for-v4.12-rc6' of git://people.freedesktop.org/~airlied/linux: drm: mxsfb_crtc: Reset the eLCDIF controller drm/mgag200: Fix to always set HiPri for G200e4 V2 drm/tegra: Correct idr_alloc() minimum id drm/tegra: Fix lockup on a use of staging API gpu: host1x: Fix error handling drm/radeon: Fix overflow of watermark calcs at > 4k resolutions. drm/amdgpu: Fix overflow of watermark calcs at > 4k resolutions. drm/radeon: fix "force the UVD DPB into VRAM as well" drm/i915: Fix GVT-g PVINFO version compatibility check drm/i915: Fix SKL+ watermarks for 90/270 rotation drm/i915: Fix scaling check for 90/270 degree plane rotation drm: dw-hdmi: Fix compilation breakage by selecting REGMAP_MMIO
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v10_0.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v11_0.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v6_0.c7
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v8_0.c7
-rw-r--r--drivers/gpu/drm/bridge/synopsys/Kconfig1
-rw-r--r--drivers/gpu/drm/i915/i915_pvinfo.h8
-rw-r--r--drivers/gpu/drm/i915/i915_vgpu.c10
-rw-r--r--drivers/gpu/drm/i915/intel_display.c14
-rw-r--r--drivers/gpu/drm/i915/intel_pm.c36
-rw-r--r--drivers/gpu/drm/mgag200/mgag200_mode.c9
-rw-r--r--drivers/gpu/drm/mxsfb/mxsfb_crtc.c42
-rw-r--r--drivers/gpu/drm/radeon/cik.c7
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_uvd.c2
-rw-r--r--drivers/gpu/drm/radeon/si.c7
-rw-r--r--drivers/gpu/drm/tegra/drm.c22
-rw-r--r--drivers/gpu/host1x/dev.c2
17 files changed, 131 insertions, 64 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 0cdeb6a2e4a0..5dffa27afa45 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -1207,8 +1207,11 @@ static void dce_v10_0_program_watermarks(struct amdgpu_device *adev,
1207 u32 tmp, wm_mask, lb_vblank_lead_lines = 0; 1207 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
1208 1208
1209 if (amdgpu_crtc->base.enabled && num_heads && mode) { 1209 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1210 active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; 1210 active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
1211 line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); 1211 (u32)mode->clock);
1212 line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
1213 (u32)mode->clock);
1214 line_time = min(line_time, (u32)65535);
1212 1215
1213 /* watermark for high clocks */ 1216 /* watermark for high clocks */
1214 if (adev->pm.dpm_enabled) { 1217 if (adev->pm.dpm_enabled) {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index 773654a19749..47bbc87f96d2 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -1176,8 +1176,11 @@ static void dce_v11_0_program_watermarks(struct amdgpu_device *adev,
1176 u32 tmp, wm_mask, lb_vblank_lead_lines = 0; 1176 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
1177 1177
1178 if (amdgpu_crtc->base.enabled && num_heads && mode) { 1178 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1179 active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; 1179 active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
1180 line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); 1180 (u32)mode->clock);
1181 line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
1182 (u32)mode->clock);
1183 line_time = min(line_time, (u32)65535);
1181 1184
1182 /* watermark for high clocks */ 1185 /* watermark for high clocks */
1183 if (adev->pm.dpm_enabled) { 1186 if (adev->pm.dpm_enabled) {
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
index 1f3552967ba3..d8c9a959493e 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c
@@ -983,8 +983,11 @@ static void dce_v6_0_program_watermarks(struct amdgpu_device *adev,
983 fixed20_12 a, b, c; 983 fixed20_12 a, b, c;
984 984
985 if (amdgpu_crtc->base.enabled && num_heads && mode) { 985 if (amdgpu_crtc->base.enabled && num_heads && mode) {
986 active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; 986 active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
987 line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); 987 (u32)mode->clock);
988 line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
989 (u32)mode->clock);
990 line_time = min(line_time, (u32)65535);
988 priority_a_cnt = 0; 991 priority_a_cnt = 0;
989 priority_b_cnt = 0; 992 priority_b_cnt = 0;
990 993
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 3c558c170e5e..db30c6ba563a 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -1091,8 +1091,11 @@ static void dce_v8_0_program_watermarks(struct amdgpu_device *adev,
1091 u32 tmp, wm_mask, lb_vblank_lead_lines = 0; 1091 u32 tmp, wm_mask, lb_vblank_lead_lines = 0;
1092 1092
1093 if (amdgpu_crtc->base.enabled && num_heads && mode) { 1093 if (amdgpu_crtc->base.enabled && num_heads && mode) {
1094 active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; 1094 active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
1095 line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); 1095 (u32)mode->clock);
1096 line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
1097 (u32)mode->clock);
1098 line_time = min(line_time, (u32)65535);
1096 1099
1097 /* watermark for high clocks */ 1100 /* watermark for high clocks */
1098 if (adev->pm.dpm_enabled) { 1101 if (adev->pm.dpm_enabled) {
diff --git a/drivers/gpu/drm/bridge/synopsys/Kconfig b/drivers/gpu/drm/bridge/synopsys/Kconfig
index 40d2827a6d19..53e78d092d18 100644
--- a/drivers/gpu/drm/bridge/synopsys/Kconfig
+++ b/drivers/gpu/drm/bridge/synopsys/Kconfig
@@ -1,6 +1,7 @@
1config DRM_DW_HDMI 1config DRM_DW_HDMI
2 tristate 2 tristate
3 select DRM_KMS_HELPER 3 select DRM_KMS_HELPER
4 select REGMAP_MMIO
4 5
5config DRM_DW_HDMI_AHB_AUDIO 6config DRM_DW_HDMI_AHB_AUDIO
6 tristate "Synopsys Designware AHB Audio interface" 7 tristate "Synopsys Designware AHB Audio interface"
diff --git a/drivers/gpu/drm/i915/i915_pvinfo.h b/drivers/gpu/drm/i915/i915_pvinfo.h
index c0cb2974caac..2cfe96d3e5d1 100644
--- a/drivers/gpu/drm/i915/i915_pvinfo.h
+++ b/drivers/gpu/drm/i915/i915_pvinfo.h
@@ -36,10 +36,6 @@
36#define VGT_VERSION_MAJOR 1 36#define VGT_VERSION_MAJOR 1
37#define VGT_VERSION_MINOR 0 37#define VGT_VERSION_MINOR 0
38 38
39#define INTEL_VGT_IF_VERSION_ENCODE(major, minor) ((major) << 16 | (minor))
40#define INTEL_VGT_IF_VERSION \
41 INTEL_VGT_IF_VERSION_ENCODE(VGT_VERSION_MAJOR, VGT_VERSION_MINOR)
42
43/* 39/*
44 * notifications from guest to vgpu device model 40 * notifications from guest to vgpu device model
45 */ 41 */
@@ -55,8 +51,8 @@ enum vgt_g2v_type {
55 51
56struct vgt_if { 52struct vgt_if {
57 u64 magic; /* VGT_MAGIC */ 53 u64 magic; /* VGT_MAGIC */
58 uint16_t version_major; 54 u16 version_major;
59 uint16_t version_minor; 55 u16 version_minor;
60 u32 vgt_id; /* ID of vGT instance */ 56 u32 vgt_id; /* ID of vGT instance */
61 u32 rsv1[12]; /* pad to offset 0x40 */ 57 u32 rsv1[12]; /* pad to offset 0x40 */
62 /* 58 /*
diff --git a/drivers/gpu/drm/i915/i915_vgpu.c b/drivers/gpu/drm/i915/i915_vgpu.c
index 4ab8a973b61f..2e739018fb4c 100644
--- a/drivers/gpu/drm/i915/i915_vgpu.c
+++ b/drivers/gpu/drm/i915/i915_vgpu.c
@@ -60,8 +60,8 @@
60 */ 60 */
61void i915_check_vgpu(struct drm_i915_private *dev_priv) 61void i915_check_vgpu(struct drm_i915_private *dev_priv)
62{ 62{
63 uint64_t magic; 63 u64 magic;
64 uint32_t version; 64 u16 version_major;
65 65
66 BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE); 66 BUILD_BUG_ON(sizeof(struct vgt_if) != VGT_PVINFO_SIZE);
67 67
@@ -69,10 +69,8 @@ void i915_check_vgpu(struct drm_i915_private *dev_priv)
69 if (magic != VGT_MAGIC) 69 if (magic != VGT_MAGIC)
70 return; 70 return;
71 71
72 version = INTEL_VGT_IF_VERSION_ENCODE( 72 version_major = __raw_i915_read16(dev_priv, vgtif_reg(version_major));
73 __raw_i915_read16(dev_priv, vgtif_reg(version_major)), 73 if (version_major < VGT_VERSION_MAJOR) {
74 __raw_i915_read16(dev_priv, vgtif_reg(version_minor)));
75 if (version != INTEL_VGT_IF_VERSION) {
76 DRM_INFO("VGT interface version mismatch!\n"); 74 DRM_INFO("VGT interface version mismatch!\n");
77 return; 75 return;
78 } 76 }
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 569717a12723..96b0b01677e2 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -4598,7 +4598,7 @@ static void cpt_verify_modeset(struct drm_device *dev, int pipe)
4598 4598
4599static int 4599static int
4600skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach, 4600skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
4601 unsigned scaler_user, int *scaler_id, unsigned int rotation, 4601 unsigned int scaler_user, int *scaler_id,
4602 int src_w, int src_h, int dst_w, int dst_h) 4602 int src_w, int src_h, int dst_w, int dst_h)
4603{ 4603{
4604 struct intel_crtc_scaler_state *scaler_state = 4604 struct intel_crtc_scaler_state *scaler_state =
@@ -4607,9 +4607,12 @@ skl_update_scaler(struct intel_crtc_state *crtc_state, bool force_detach,
4607 to_intel_crtc(crtc_state->base.crtc); 4607 to_intel_crtc(crtc_state->base.crtc);
4608 int need_scaling; 4608 int need_scaling;
4609 4609
4610 need_scaling = drm_rotation_90_or_270(rotation) ? 4610 /*
4611 (src_h != dst_w || src_w != dst_h): 4611 * Src coordinates are already rotated by 270 degrees for
4612 (src_w != dst_w || src_h != dst_h); 4612 * the 90/270 degree plane rotation cases (to match the
4613 * GTT mapping), hence no need to account for rotation here.
4614 */
4615 need_scaling = src_w != dst_w || src_h != dst_h;
4613 4616
4614 /* 4617 /*
4615 * if plane is being disabled or scaler is no more required or force detach 4618 * if plane is being disabled or scaler is no more required or force detach
@@ -4671,7 +4674,7 @@ int skl_update_scaler_crtc(struct intel_crtc_state *state)
4671 const struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode; 4674 const struct drm_display_mode *adjusted_mode = &state->base.adjusted_mode;
4672 4675
4673 return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX, 4676 return skl_update_scaler(state, !state->base.active, SKL_CRTC_INDEX,
4674 &state->scaler_state.scaler_id, DRM_ROTATE_0, 4677 &state->scaler_state.scaler_id,
4675 state->pipe_src_w, state->pipe_src_h, 4678 state->pipe_src_w, state->pipe_src_h,
4676 adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay); 4679 adjusted_mode->crtc_hdisplay, adjusted_mode->crtc_vdisplay);
4677} 4680}
@@ -4700,7 +4703,6 @@ static int skl_update_scaler_plane(struct intel_crtc_state *crtc_state,
4700 ret = skl_update_scaler(crtc_state, force_detach, 4703 ret = skl_update_scaler(crtc_state, force_detach,
4701 drm_plane_index(&intel_plane->base), 4704 drm_plane_index(&intel_plane->base),
4702 &plane_state->scaler_id, 4705 &plane_state->scaler_id,
4703 plane_state->base.rotation,
4704 drm_rect_width(&plane_state->base.src) >> 16, 4706 drm_rect_width(&plane_state->base.src) >> 16,
4705 drm_rect_height(&plane_state->base.src) >> 16, 4707 drm_rect_height(&plane_state->base.src) >> 16,
4706 drm_rect_width(&plane_state->base.dst), 4708 drm_rect_width(&plane_state->base.dst),
diff --git a/drivers/gpu/drm/i915/intel_pm.c b/drivers/gpu/drm/i915/intel_pm.c
index 2ca481b5aa69..078fd1bfa5ea 100644
--- a/drivers/gpu/drm/i915/intel_pm.c
+++ b/drivers/gpu/drm/i915/intel_pm.c
@@ -3373,20 +3373,26 @@ skl_plane_downscale_amount(const struct intel_crtc_state *cstate,
3373 3373
3374 /* n.b., src is 16.16 fixed point, dst is whole integer */ 3374 /* n.b., src is 16.16 fixed point, dst is whole integer */
3375 if (plane->id == PLANE_CURSOR) { 3375 if (plane->id == PLANE_CURSOR) {
3376 /*
3377 * Cursors only support 0/180 degree rotation,
3378 * hence no need to account for rotation here.
3379 */
3376 src_w = pstate->base.src_w; 3380 src_w = pstate->base.src_w;
3377 src_h = pstate->base.src_h; 3381 src_h = pstate->base.src_h;
3378 dst_w = pstate->base.crtc_w; 3382 dst_w = pstate->base.crtc_w;
3379 dst_h = pstate->base.crtc_h; 3383 dst_h = pstate->base.crtc_h;
3380 } else { 3384 } else {
3385 /*
3386 * Src coordinates are already rotated by 270 degrees for
3387 * the 90/270 degree plane rotation cases (to match the
3388 * GTT mapping), hence no need to account for rotation here.
3389 */
3381 src_w = drm_rect_width(&pstate->base.src); 3390 src_w = drm_rect_width(&pstate->base.src);
3382 src_h = drm_rect_height(&pstate->base.src); 3391 src_h = drm_rect_height(&pstate->base.src);
3383 dst_w = drm_rect_width(&pstate->base.dst); 3392 dst_w = drm_rect_width(&pstate->base.dst);
3384 dst_h = drm_rect_height(&pstate->base.dst); 3393 dst_h = drm_rect_height(&pstate->base.dst);
3385 } 3394 }
3386 3395
3387 if (drm_rotation_90_or_270(pstate->base.rotation))
3388 swap(dst_w, dst_h);
3389
3390 downscale_h = max(src_h / dst_h, (uint32_t)DRM_PLANE_HELPER_NO_SCALING); 3396 downscale_h = max(src_h / dst_h, (uint32_t)DRM_PLANE_HELPER_NO_SCALING);
3391 downscale_w = max(src_w / dst_w, (uint32_t)DRM_PLANE_HELPER_NO_SCALING); 3397 downscale_w = max(src_w / dst_w, (uint32_t)DRM_PLANE_HELPER_NO_SCALING);
3392 3398
@@ -3417,12 +3423,14 @@ skl_plane_relative_data_rate(const struct intel_crtc_state *cstate,
3417 if (y && format != DRM_FORMAT_NV12) 3423 if (y && format != DRM_FORMAT_NV12)
3418 return 0; 3424 return 0;
3419 3425
3426 /*
3427 * Src coordinates are already rotated by 270 degrees for
3428 * the 90/270 degree plane rotation cases (to match the
3429 * GTT mapping), hence no need to account for rotation here.
3430 */
3420 width = drm_rect_width(&intel_pstate->base.src) >> 16; 3431 width = drm_rect_width(&intel_pstate->base.src) >> 16;
3421 height = drm_rect_height(&intel_pstate->base.src) >> 16; 3432 height = drm_rect_height(&intel_pstate->base.src) >> 16;
3422 3433
3423 if (drm_rotation_90_or_270(pstate->rotation))
3424 swap(width, height);
3425
3426 /* for planar format */ 3434 /* for planar format */
3427 if (format == DRM_FORMAT_NV12) { 3435 if (format == DRM_FORMAT_NV12) {
3428 if (y) /* y-plane data rate */ 3436 if (y) /* y-plane data rate */
@@ -3505,12 +3513,14 @@ skl_ddb_min_alloc(const struct drm_plane_state *pstate,
3505 fb->modifier != I915_FORMAT_MOD_Yf_TILED) 3513 fb->modifier != I915_FORMAT_MOD_Yf_TILED)
3506 return 8; 3514 return 8;
3507 3515
3516 /*
3517 * Src coordinates are already rotated by 270 degrees for
3518 * the 90/270 degree plane rotation cases (to match the
3519 * GTT mapping), hence no need to account for rotation here.
3520 */
3508 src_w = drm_rect_width(&intel_pstate->base.src) >> 16; 3521 src_w = drm_rect_width(&intel_pstate->base.src) >> 16;
3509 src_h = drm_rect_height(&intel_pstate->base.src) >> 16; 3522 src_h = drm_rect_height(&intel_pstate->base.src) >> 16;
3510 3523
3511 if (drm_rotation_90_or_270(pstate->rotation))
3512 swap(src_w, src_h);
3513
3514 /* Halve UV plane width and height for NV12 */ 3524 /* Halve UV plane width and height for NV12 */
3515 if (fb->format->format == DRM_FORMAT_NV12 && !y) { 3525 if (fb->format->format == DRM_FORMAT_NV12 && !y) {
3516 src_w /= 2; 3526 src_w /= 2;
@@ -3794,13 +3804,15 @@ static int skl_compute_plane_wm(const struct drm_i915_private *dev_priv,
3794 width = intel_pstate->base.crtc_w; 3804 width = intel_pstate->base.crtc_w;
3795 height = intel_pstate->base.crtc_h; 3805 height = intel_pstate->base.crtc_h;
3796 } else { 3806 } else {
3807 /*
3808 * Src coordinates are already rotated by 270 degrees for
3809 * the 90/270 degree plane rotation cases (to match the
3810 * GTT mapping), hence no need to account for rotation here.
3811 */
3797 width = drm_rect_width(&intel_pstate->base.src) >> 16; 3812 width = drm_rect_width(&intel_pstate->base.src) >> 16;
3798 height = drm_rect_height(&intel_pstate->base.src) >> 16; 3813 height = drm_rect_height(&intel_pstate->base.src) >> 16;
3799 } 3814 }
3800 3815
3801 if (drm_rotation_90_or_270(pstate->rotation))
3802 swap(width, height);
3803
3804 cpp = fb->format->cpp[0]; 3816 cpp = fb->format->cpp[0];
3805 plane_pixel_rate = skl_adjusted_plane_pixel_rate(cstate, intel_pstate); 3817 plane_pixel_rate = skl_adjusted_plane_pixel_rate(cstate, intel_pstate);
3806 3818
diff --git a/drivers/gpu/drm/mgag200/mgag200_mode.c b/drivers/gpu/drm/mgag200/mgag200_mode.c
index adb411a078e8..f4b53588e071 100644
--- a/drivers/gpu/drm/mgag200/mgag200_mode.c
+++ b/drivers/gpu/drm/mgag200/mgag200_mode.c
@@ -1173,7 +1173,10 @@ static int mga_crtc_mode_set(struct drm_crtc *crtc,
1173 1173
1174 1174
1175 if (IS_G200_SE(mdev)) { 1175 if (IS_G200_SE(mdev)) {
1176 if (mdev->unique_rev_id >= 0x02) { 1176 if (mdev->unique_rev_id >= 0x04) {
1177 WREG8(MGAREG_CRTCEXT_INDEX, 0x06);
1178 WREG8(MGAREG_CRTCEXT_DATA, 0);
1179 } else if (mdev->unique_rev_id >= 0x02) {
1177 u8 hi_pri_lvl; 1180 u8 hi_pri_lvl;
1178 u32 bpp; 1181 u32 bpp;
1179 u32 mb; 1182 u32 mb;
@@ -1639,6 +1642,10 @@ static int mga_vga_mode_valid(struct drm_connector *connector,
1639 if (mga_vga_calculate_mode_bandwidth(mode, bpp) 1642 if (mga_vga_calculate_mode_bandwidth(mode, bpp)
1640 > (30100 * 1024)) 1643 > (30100 * 1024))
1641 return MODE_BANDWIDTH; 1644 return MODE_BANDWIDTH;
1645 } else {
1646 if (mga_vga_calculate_mode_bandwidth(mode, bpp)
1647 > (55000 * 1024))
1648 return MODE_BANDWIDTH;
1642 } 1649 }
1643 } else if (mdev->type == G200_WB) { 1650 } else if (mdev->type == G200_WB) {
1644 if (mode->hdisplay > 1280) 1651 if (mode->hdisplay > 1280)
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
index 1144e0c9e894..0abe77675b76 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_crtc.c
@@ -35,6 +35,13 @@
35#include "mxsfb_drv.h" 35#include "mxsfb_drv.h"
36#include "mxsfb_regs.h" 36#include "mxsfb_regs.h"
37 37
38#define MXS_SET_ADDR 0x4
39#define MXS_CLR_ADDR 0x8
40#define MODULE_CLKGATE BIT(30)
41#define MODULE_SFTRST BIT(31)
42/* 1 second delay should be plenty of time for block reset */
43#define RESET_TIMEOUT 1000000
44
38static u32 set_hsync_pulse_width(struct mxsfb_drm_private *mxsfb, u32 val) 45static u32 set_hsync_pulse_width(struct mxsfb_drm_private *mxsfb, u32 val)
39{ 46{
40 return (val & mxsfb->devdata->hs_wdth_mask) << 47 return (val & mxsfb->devdata->hs_wdth_mask) <<
@@ -159,6 +166,36 @@ static void mxsfb_disable_controller(struct mxsfb_drm_private *mxsfb)
159 clk_disable_unprepare(mxsfb->clk_disp_axi); 166 clk_disable_unprepare(mxsfb->clk_disp_axi);
160} 167}
161 168
169/*
170 * Clear the bit and poll it cleared. This is usually called with
171 * a reset address and mask being either SFTRST(bit 31) or CLKGATE
172 * (bit 30).
173 */
174static int clear_poll_bit(void __iomem *addr, u32 mask)
175{
176 u32 reg;
177
178 writel(mask, addr + MXS_CLR_ADDR);
179 return readl_poll_timeout(addr, reg, !(reg & mask), 0, RESET_TIMEOUT);
180}
181
182static int mxsfb_reset_block(void __iomem *reset_addr)
183{
184 int ret;
185
186 ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
187 if (ret)
188 return ret;
189
190 writel(MODULE_CLKGATE, reset_addr + MXS_CLR_ADDR);
191
192 ret = clear_poll_bit(reset_addr, MODULE_SFTRST);
193 if (ret)
194 return ret;
195
196 return clear_poll_bit(reset_addr, MODULE_CLKGATE);
197}
198
162static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb) 199static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
163{ 200{
164 struct drm_display_mode *m = &mxsfb->pipe.crtc.state->adjusted_mode; 201 struct drm_display_mode *m = &mxsfb->pipe.crtc.state->adjusted_mode;
@@ -173,6 +210,11 @@ static void mxsfb_crtc_mode_set_nofb(struct mxsfb_drm_private *mxsfb)
173 */ 210 */
174 mxsfb_enable_axi_clk(mxsfb); 211 mxsfb_enable_axi_clk(mxsfb);
175 212
213 /* Mandatory eLCDIF reset as per the Reference Manual */
214 err = mxsfb_reset_block(mxsfb->base);
215 if (err)
216 return;
217
176 /* Clear the FIFOs */ 218 /* Clear the FIFOs */
177 writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET); 219 writel(CTRL1_FIFO_CLEAR, mxsfb->base + LCDC_CTRL1 + REG_SET);
178 220
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index 008c145b7f29..ca44233ceacc 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -9267,8 +9267,11 @@ static void dce8_program_watermarks(struct radeon_device *rdev,
9267 u32 tmp, wm_mask; 9267 u32 tmp, wm_mask;
9268 9268
9269 if (radeon_crtc->base.enabled && num_heads && mode) { 9269 if (radeon_crtc->base.enabled && num_heads && mode) {
9270 active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; 9270 active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
9271 line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); 9271 (u32)mode->clock);
9272 line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
9273 (u32)mode->clock);
9274 line_time = min(line_time, (u32)65535);
9272 9275
9273 /* watermark for high clocks */ 9276 /* watermark for high clocks */
9274 if ((rdev->pm.pm_method == PM_METHOD_DPM) && 9277 if ((rdev->pm.pm_method == PM_METHOD_DPM) &&
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 0bf103536404..534637203e70 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -2266,8 +2266,11 @@ static void evergreen_program_watermarks(struct radeon_device *rdev,
2266 fixed20_12 a, b, c; 2266 fixed20_12 a, b, c;
2267 2267
2268 if (radeon_crtc->base.enabled && num_heads && mode) { 2268 if (radeon_crtc->base.enabled && num_heads && mode) {
2269 active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; 2269 active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
2270 line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); 2270 (u32)mode->clock);
2271 line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
2272 (u32)mode->clock);
2273 line_time = min(line_time, (u32)65535);
2271 priority_a_cnt = 0; 2274 priority_a_cnt = 0;
2272 priority_b_cnt = 0; 2275 priority_b_cnt = 0;
2273 dram_channels = evergreen_get_number_of_dram_channels(rdev); 2276 dram_channels = evergreen_get_number_of_dram_channels(rdev);
diff --git a/drivers/gpu/drm/radeon/radeon_uvd.c b/drivers/gpu/drm/radeon/radeon_uvd.c
index 7431eb4a11b7..d34d1cf33895 100644
--- a/drivers/gpu/drm/radeon/radeon_uvd.c
+++ b/drivers/gpu/drm/radeon/radeon_uvd.c
@@ -621,7 +621,7 @@ static int radeon_uvd_cs_reloc(struct radeon_cs_parser *p,
621 } 621 }
622 622
623 /* TODO: is this still necessary on NI+ ? */ 623 /* TODO: is this still necessary on NI+ ? */
624 if ((cmd == 0 || cmd == 1 || cmd == 0x3) && 624 if ((cmd == 0 || cmd == 0x3) &&
625 (start >> 28) != (p->rdev->uvd.gpu_addr >> 28)) { 625 (start >> 28) != (p->rdev->uvd.gpu_addr >> 28)) {
626 DRM_ERROR("msg/fb buffer %LX-%LX out of 256MB segment!\n", 626 DRM_ERROR("msg/fb buffer %LX-%LX out of 256MB segment!\n",
627 start, end); 627 start, end);
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 76d1888528e6..5303f25d5280 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -2284,8 +2284,11 @@ static void dce6_program_watermarks(struct radeon_device *rdev,
2284 fixed20_12 a, b, c; 2284 fixed20_12 a, b, c;
2285 2285
2286 if (radeon_crtc->base.enabled && num_heads && mode) { 2286 if (radeon_crtc->base.enabled && num_heads && mode) {
2287 active_time = 1000000UL * (u32)mode->crtc_hdisplay / (u32)mode->clock; 2287 active_time = (u32) div_u64((u64)mode->crtc_hdisplay * 1000000,
2288 line_time = min((u32) (1000000UL * (u32)mode->crtc_htotal / (u32)mode->clock), (u32)65535); 2288 (u32)mode->clock);
2289 line_time = (u32) div_u64((u64)mode->crtc_htotal * 1000000,
2290 (u32)mode->clock);
2291 line_time = min(line_time, (u32)65535);
2289 priority_a_cnt = 0; 2292 priority_a_cnt = 0;
2290 priority_b_cnt = 0; 2293 priority_b_cnt = 0;
2291 2294
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 9a1e34e48f64..81f86a67c10d 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -451,18 +451,6 @@ fail:
451 451
452 452
453#ifdef CONFIG_DRM_TEGRA_STAGING 453#ifdef CONFIG_DRM_TEGRA_STAGING
454static struct tegra_drm_context *
455tegra_drm_file_get_context(struct tegra_drm_file *file, u32 id)
456{
457 struct tegra_drm_context *context;
458
459 mutex_lock(&file->lock);
460 context = idr_find(&file->contexts, id);
461 mutex_unlock(&file->lock);
462
463 return context;
464}
465
466static int tegra_gem_create(struct drm_device *drm, void *data, 454static int tegra_gem_create(struct drm_device *drm, void *data,
467 struct drm_file *file) 455 struct drm_file *file)
468{ 456{
@@ -551,7 +539,7 @@ static int tegra_client_open(struct tegra_drm_file *fpriv,
551 if (err < 0) 539 if (err < 0)
552 return err; 540 return err;
553 541
554 err = idr_alloc(&fpriv->contexts, context, 0, 0, GFP_KERNEL); 542 err = idr_alloc(&fpriv->contexts, context, 1, 0, GFP_KERNEL);
555 if (err < 0) { 543 if (err < 0) {
556 client->ops->close_channel(context); 544 client->ops->close_channel(context);
557 return err; 545 return err;
@@ -606,7 +594,7 @@ static int tegra_close_channel(struct drm_device *drm, void *data,
606 594
607 mutex_lock(&fpriv->lock); 595 mutex_lock(&fpriv->lock);
608 596
609 context = tegra_drm_file_get_context(fpriv, args->context); 597 context = idr_find(&fpriv->contexts, args->context);
610 if (!context) { 598 if (!context) {
611 err = -EINVAL; 599 err = -EINVAL;
612 goto unlock; 600 goto unlock;
@@ -631,7 +619,7 @@ static int tegra_get_syncpt(struct drm_device *drm, void *data,
631 619
632 mutex_lock(&fpriv->lock); 620 mutex_lock(&fpriv->lock);
633 621
634 context = tegra_drm_file_get_context(fpriv, args->context); 622 context = idr_find(&fpriv->contexts, args->context);
635 if (!context) { 623 if (!context) {
636 err = -ENODEV; 624 err = -ENODEV;
637 goto unlock; 625 goto unlock;
@@ -660,7 +648,7 @@ static int tegra_submit(struct drm_device *drm, void *data,
660 648
661 mutex_lock(&fpriv->lock); 649 mutex_lock(&fpriv->lock);
662 650
663 context = tegra_drm_file_get_context(fpriv, args->context); 651 context = idr_find(&fpriv->contexts, args->context);
664 if (!context) { 652 if (!context) {
665 err = -ENODEV; 653 err = -ENODEV;
666 goto unlock; 654 goto unlock;
@@ -685,7 +673,7 @@ static int tegra_get_syncpt_base(struct drm_device *drm, void *data,
685 673
686 mutex_lock(&fpriv->lock); 674 mutex_lock(&fpriv->lock);
687 675
688 context = tegra_drm_file_get_context(fpriv, args->context); 676 context = idr_find(&fpriv->contexts, args->context);
689 if (!context) { 677 if (!context) {
690 err = -ENODEV; 678 err = -ENODEV;
691 goto unlock; 679 goto unlock;
diff --git a/drivers/gpu/host1x/dev.c b/drivers/gpu/host1x/dev.c
index f05ebb14fa63..ac65f52850a6 100644
--- a/drivers/gpu/host1x/dev.c
+++ b/drivers/gpu/host1x/dev.c
@@ -172,7 +172,7 @@ static int host1x_probe(struct platform_device *pdev)
172 172
173 host->rst = devm_reset_control_get(&pdev->dev, "host1x"); 173 host->rst = devm_reset_control_get(&pdev->dev, "host1x");
174 if (IS_ERR(host->rst)) { 174 if (IS_ERR(host->rst)) {
175 err = PTR_ERR(host->clk); 175 err = PTR_ERR(host->rst);
176 dev_err(&pdev->dev, "failed to get reset: %d\n", err); 176 dev_err(&pdev->dev, "failed to get reset: %d\n", err);
177 return err; 177 return err;
178 } 178 }