aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r--drivers/gpu/drm/radeon/atom.c1
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c3
-rw-r--r--drivers/gpu/drm/radeon/atombios_dp.c4
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c25
-rw-r--r--drivers/gpu/drm/radeon/r100.c6
-rw-r--r--drivers/gpu/drm/radeon/r100_track.h1
-rw-r--r--drivers/gpu/drm/radeon/r200.c2
-rw-r--r--drivers/gpu/drm/radeon/r600.c32
-rw-r--r--drivers/gpu/drm/radeon/r600_blit_kms.c8
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c4
-rw-r--r--drivers/gpu/drm/radeon/r600_reg.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c53
-rw-r--r--drivers/gpu/drm/radeon/radeon_bios.c13
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c15
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c34
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c36
-rw-r--r--drivers/gpu/drm/radeon/radeon_i2c.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.c4
-rw-r--r--drivers/gpu/drm/radeon/radeon_reg.h1
-rw-r--r--drivers/gpu/drm/radeon/rv770.c9
22 files changed, 194 insertions, 72 deletions
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 8e421f644a54..05efb5b9f13e 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -112,6 +112,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
112 base += 3; 112 base += 3;
113 break; 113 break;
114 case ATOM_IIO_WRITE: 114 case ATOM_IIO_WRITE:
115 (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1));
115 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); 116 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp);
116 base += 3; 117 base += 3;
117 break; 118 break;
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index cd0290f946cf..e226f47b497c 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -253,7 +253,8 @@ void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
253 case DRM_MODE_DPMS_SUSPEND: 253 case DRM_MODE_DPMS_SUSPEND:
254 case DRM_MODE_DPMS_OFF: 254 case DRM_MODE_DPMS_OFF:
255 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id); 255 drm_vblank_pre_modeset(dev, radeon_crtc->crtc_id);
256 atombios_blank_crtc(crtc, ATOM_ENABLE); 256 if (radeon_crtc->enabled)
257 atombios_blank_crtc(crtc, ATOM_ENABLE);
257 if (ASIC_IS_DCE3(rdev)) 258 if (ASIC_IS_DCE3(rdev))
258 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE); 259 atombios_enable_crtc_memreq(crtc, ATOM_DISABLE);
259 atombios_enable_crtc(crtc, ATOM_DISABLE); 260 atombios_enable_crtc(crtc, ATOM_DISABLE);
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index 4e7778d44b8d..695de9a38506 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -187,9 +187,9 @@ static int dp_link_clock_for_mode_clock(u8 dpcd[DP_DPCD_SIZE], int mode_clock)
187int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock) 187int dp_mode_valid(u8 dpcd[DP_DPCD_SIZE], int mode_clock)
188{ 188{
189 int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock); 189 int lanes = dp_lanes_for_mode_clock(dpcd, mode_clock);
190 int bw = dp_lanes_for_mode_clock(dpcd, mode_clock); 190 int dp_clock = dp_link_clock_for_mode_clock(dpcd, mode_clock);
191 191
192 if ((lanes == 0) || (bw == 0)) 192 if ((lanes == 0) || (dp_clock == 0))
193 return MODE_CLOCK_HIGH; 193 return MODE_CLOCK_HIGH;
194 194
195 return MODE_OK; 195 return MODE_OK;
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 2f93d46ae69a..9e3dd2fd2766 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -1423,7 +1423,6 @@ bool evergreen_gpu_is_lockup(struct radeon_device *rdev)
1423static int evergreen_gpu_soft_reset(struct radeon_device *rdev) 1423static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1424{ 1424{
1425 struct evergreen_mc_save save; 1425 struct evergreen_mc_save save;
1426 u32 srbm_reset = 0;
1427 u32 grbm_reset = 0; 1426 u32 grbm_reset = 0;
1428 1427
1429 dev_info(rdev->dev, "GPU softreset \n"); 1428 dev_info(rdev->dev, "GPU softreset \n");
@@ -1462,16 +1461,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1462 udelay(50); 1461 udelay(50);
1463 WREG32(GRBM_SOFT_RESET, 0); 1462 WREG32(GRBM_SOFT_RESET, 0);
1464 (void)RREG32(GRBM_SOFT_RESET); 1463 (void)RREG32(GRBM_SOFT_RESET);
1465
1466 /* reset all the system blocks */
1467 srbm_reset = SRBM_SOFT_RESET_ALL_MASK;
1468
1469 dev_info(rdev->dev, " SRBM_SOFT_RESET=0x%08X\n", srbm_reset);
1470 WREG32(SRBM_SOFT_RESET, srbm_reset);
1471 (void)RREG32(SRBM_SOFT_RESET);
1472 udelay(50);
1473 WREG32(SRBM_SOFT_RESET, 0);
1474 (void)RREG32(SRBM_SOFT_RESET);
1475 /* Wait a little for things to settle down */ 1464 /* Wait a little for things to settle down */
1476 udelay(50); 1465 udelay(50);
1477 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n", 1466 dev_info(rdev->dev, " GRBM_STATUS=0x%08X\n",
@@ -1482,10 +1471,6 @@ static int evergreen_gpu_soft_reset(struct radeon_device *rdev)
1482 RREG32(GRBM_STATUS_SE1)); 1471 RREG32(GRBM_STATUS_SE1));
1483 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n", 1472 dev_info(rdev->dev, " SRBM_STATUS=0x%08X\n",
1484 RREG32(SRBM_STATUS)); 1473 RREG32(SRBM_STATUS));
1485 /* After reset we need to reinit the asic as GPU often endup in an
1486 * incoherent state.
1487 */
1488 atom_asic_init(rdev->mode_info.atom_context);
1489 evergreen_mc_resume(rdev, &save); 1474 evergreen_mc_resume(rdev, &save);
1490 return 0; 1475 return 0;
1491} 1476}
@@ -2097,6 +2082,11 @@ int evergreen_resume(struct radeon_device *rdev)
2097{ 2082{
2098 int r; 2083 int r;
2099 2084
2085 /* reset the asic, the gfx blocks are often in a bad state
2086 * after the driver is unloaded or after a resume
2087 */
2088 if (radeon_asic_reset(rdev))
2089 dev_warn(rdev->dev, "GPU reset failed !\n");
2100 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw, 2090 /* Do not reset GPU before posting, on rv770 hw unlike on r500 hw,
2101 * posting will perform necessary task to bring back GPU into good 2091 * posting will perform necessary task to bring back GPU into good
2102 * shape. 2092 * shape.
@@ -2193,6 +2183,11 @@ int evergreen_init(struct radeon_device *rdev)
2193 r = radeon_atombios_init(rdev); 2183 r = radeon_atombios_init(rdev);
2194 if (r) 2184 if (r)
2195 return r; 2185 return r;
2186 /* reset the asic, the gfx blocks are often in a bad state
2187 * after the driver is unloaded or after a resume
2188 */
2189 if (radeon_asic_reset(rdev))
2190 dev_warn(rdev->dev, "GPU reset failed !\n");
2196 /* Post card if necessary */ 2191 /* Post card if necessary */
2197 if (!evergreen_card_posted(rdev)) { 2192 if (!evergreen_card_posted(rdev)) {
2198 if (!rdev->bios) { 2193 if (!rdev->bios) {
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index e59422320bb6..0ba4163ee0a4 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -2318,6 +2318,9 @@ void r100_vram_init_sizes(struct radeon_device *rdev)
2318 /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM - 2318 /* Fix for RN50, M6, M7 with 8/16/32(??) MBs of VRAM -
2319 * Novell bug 204882 + along with lots of ubuntu ones 2319 * Novell bug 204882 + along with lots of ubuntu ones
2320 */ 2320 */
2321 if (rdev->mc.aper_size > config_aper_size)
2322 config_aper_size = rdev->mc.aper_size;
2323
2321 if (config_aper_size > rdev->mc.real_vram_size) 2324 if (config_aper_size > rdev->mc.real_vram_size)
2322 rdev->mc.mc_vram_size = config_aper_size; 2325 rdev->mc.mc_vram_size = config_aper_size;
2323 else 2326 else
@@ -3225,6 +3228,8 @@ static int r100_cs_track_texture_check(struct radeon_device *rdev,
3225 for (u = 0; u < track->num_texture; u++) { 3228 for (u = 0; u < track->num_texture; u++) {
3226 if (!track->textures[u].enabled) 3229 if (!track->textures[u].enabled)
3227 continue; 3230 continue;
3231 if (track->textures[u].lookup_disable)
3232 continue;
3228 robj = track->textures[u].robj; 3233 robj = track->textures[u].robj;
3229 if (robj == NULL) { 3234 if (robj == NULL) {
3230 DRM_ERROR("No texture bound to unit %u\n", u); 3235 DRM_ERROR("No texture bound to unit %u\n", u);
@@ -3459,6 +3464,7 @@ void r100_cs_track_clear(struct radeon_device *rdev, struct r100_cs_track *track
3459 track->textures[i].robj = NULL; 3464 track->textures[i].robj = NULL;
3460 /* CS IB emission code makes sure texture unit are disabled */ 3465 /* CS IB emission code makes sure texture unit are disabled */
3461 track->textures[i].enabled = false; 3466 track->textures[i].enabled = false;
3467 track->textures[i].lookup_disable = false;
3462 track->textures[i].roundup_w = true; 3468 track->textures[i].roundup_w = true;
3463 track->textures[i].roundup_h = true; 3469 track->textures[i].roundup_h = true;
3464 if (track->separate_cube) 3470 if (track->separate_cube)
diff --git a/drivers/gpu/drm/radeon/r100_track.h b/drivers/gpu/drm/radeon/r100_track.h
index f47cdca1c004..af65600e6564 100644
--- a/drivers/gpu/drm/radeon/r100_track.h
+++ b/drivers/gpu/drm/radeon/r100_track.h
@@ -46,6 +46,7 @@ struct r100_cs_track_texture {
46 unsigned height_11; 46 unsigned height_11;
47 bool use_pitch; 47 bool use_pitch;
48 bool enabled; 48 bool enabled;
49 bool lookup_disable;
49 bool roundup_w; 50 bool roundup_w;
50 bool roundup_h; 51 bool roundup_h;
51 unsigned compress_format; 52 unsigned compress_format;
diff --git a/drivers/gpu/drm/radeon/r200.c b/drivers/gpu/drm/radeon/r200.c
index 0266d72e0a4c..d2408c395619 100644
--- a/drivers/gpu/drm/radeon/r200.c
+++ b/drivers/gpu/drm/radeon/r200.c
@@ -447,6 +447,8 @@ int r200_packet0_check(struct radeon_cs_parser *p,
447 track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK); 447 track->textures[i].width = 1 << ((idx_value >> RADEON_TXFORMAT_WIDTH_SHIFT) & RADEON_TXFORMAT_WIDTH_MASK);
448 track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK); 448 track->textures[i].height = 1 << ((idx_value >> RADEON_TXFORMAT_HEIGHT_SHIFT) & RADEON_TXFORMAT_HEIGHT_MASK);
449 } 449 }
450 if (idx_value & R200_TXFORMAT_LOOKUP_DISABLE)
451 track->textures[i].lookup_disable = true;
450 switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) { 452 switch ((idx_value & RADEON_TXFORMAT_FORMAT_MASK)) {
451 case R200_TXFORMAT_I8: 453 case R200_TXFORMAT_I8:
452 case R200_TXFORMAT_RGB332: 454 case R200_TXFORMAT_RGB332:
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 7b65e4efe8af..74b9fb7a71df 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -97,14 +97,8 @@ u32 rv6xx_get_temp(struct radeon_device *rdev)
97{ 97{
98 u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >> 98 u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >>
99 ASIC_T_SHIFT; 99 ASIC_T_SHIFT;
100 u32 actual_temp = 0;
101 100
102 if ((temp >> 7) & 1) 101 return temp * 1000;
103 actual_temp = 0;
104 else
105 actual_temp = (temp >> 1) & 0xff;
106
107 return actual_temp * 1000;
108} 102}
109 103
110void r600_pm_get_dynpm_state(struct radeon_device *rdev) 104void r600_pm_get_dynpm_state(struct radeon_device *rdev)
@@ -884,12 +878,15 @@ void r600_pcie_gart_tlb_flush(struct radeon_device *rdev)
884 u32 tmp; 878 u32 tmp;
885 879
886 /* flush hdp cache so updates hit vram */ 880 /* flush hdp cache so updates hit vram */
887 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740)) { 881 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
882 !(rdev->flags & RADEON_IS_AGP)) {
888 void __iomem *ptr = (void *)rdev->gart.table.vram.ptr; 883 void __iomem *ptr = (void *)rdev->gart.table.vram.ptr;
889 u32 tmp; 884 u32 tmp;
890 885
891 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read 886 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read
892 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL 887 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL
888 * This seems to cause problems on some AGP cards. Just use the old
889 * method for them.
893 */ 890 */
894 WREG32(HDP_DEBUG1, 0); 891 WREG32(HDP_DEBUG1, 0);
895 tmp = readl((void __iomem *)ptr); 892 tmp = readl((void __iomem *)ptr);
@@ -1201,8 +1198,10 @@ void r600_vram_gtt_location(struct radeon_device *rdev, struct radeon_mc *mc)
1201 mc->vram_end, mc->real_vram_size >> 20); 1198 mc->vram_end, mc->real_vram_size >> 20);
1202 } else { 1199 } else {
1203 u64 base = 0; 1200 u64 base = 0;
1204 if (rdev->flags & RADEON_IS_IGP) 1201 if (rdev->flags & RADEON_IS_IGP) {
1205 base = (RREG32(MC_VM_FB_LOCATION) & 0xFFFF) << 24; 1202 base = RREG32(MC_VM_FB_LOCATION) & 0xFFFF;
1203 base <<= 24;
1204 }
1206 radeon_vram_location(rdev, &rdev->mc, base); 1205 radeon_vram_location(rdev, &rdev->mc, base);
1207 rdev->mc.gtt_base_align = 0; 1206 rdev->mc.gtt_base_align = 0;
1208 radeon_gtt_location(rdev, mc); 1207 radeon_gtt_location(rdev, mc);
@@ -1608,8 +1607,11 @@ void r600_gpu_init(struct radeon_device *rdev)
1608 rdev->config.r600.tiling_npipes = rdev->config.r600.max_tile_pipes; 1607 rdev->config.r600.tiling_npipes = rdev->config.r600.max_tile_pipes;
1609 rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); 1608 rdev->config.r600.tiling_nbanks = 4 << ((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
1610 tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); 1609 tiling_config |= BANK_TILING((ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
1611 tiling_config |= GROUP_SIZE(0); 1610 tiling_config |= GROUP_SIZE((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT);
1612 rdev->config.r600.tiling_group_size = 256; 1611 if ((ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT)
1612 rdev->config.r600.tiling_group_size = 512;
1613 else
1614 rdev->config.r600.tiling_group_size = 256;
1613 tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT; 1615 tmp = (ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT;
1614 if (tmp > 3) { 1616 if (tmp > 3) {
1615 tiling_config |= ROW_TILING(3); 1617 tiling_config |= ROW_TILING(3);
@@ -3528,10 +3530,12 @@ int r600_debugfs_mc_info_init(struct radeon_device *rdev)
3528void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo) 3530void r600_ioctl_wait_idle(struct radeon_device *rdev, struct radeon_bo *bo)
3529{ 3531{
3530 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read 3532 /* r7xx hw bug. write to HDP_DEBUG1 followed by fb read
3531 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL 3533 * rather than write to HDP_REG_COHERENCY_FLUSH_CNTL.
3534 * This seems to cause problems on some AGP cards. Just use the old
3535 * method for them.
3532 */ 3536 */
3533 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) && 3537 if ((rdev->family >= CHIP_RV770) && (rdev->family <= CHIP_RV740) &&
3534 rdev->vram_scratch.ptr) { 3538 rdev->vram_scratch.ptr && !(rdev->flags & RADEON_IS_AGP)) {
3535 void __iomem *ptr = (void *)rdev->vram_scratch.ptr; 3539 void __iomem *ptr = (void *)rdev->vram_scratch.ptr;
3536 u32 tmp; 3540 u32 tmp;
3537 3541
diff --git a/drivers/gpu/drm/radeon/r600_blit_kms.c b/drivers/gpu/drm/radeon/r600_blit_kms.c
index 3473c00781ff..e5d4928fd2dc 100644
--- a/drivers/gpu/drm/radeon/r600_blit_kms.c
+++ b/drivers/gpu/drm/radeon/r600_blit_kms.c
@@ -650,8 +650,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev,
650 int src_x = src_gpu_addr & 255; 650 int src_x = src_gpu_addr & 255;
651 int dst_x = dst_gpu_addr & 255; 651 int dst_x = dst_gpu_addr & 255;
652 int h = 1; 652 int h = 1;
653 src_gpu_addr = src_gpu_addr & ~255; 653 src_gpu_addr = src_gpu_addr & ~255ULL;
654 dst_gpu_addr = dst_gpu_addr & ~255; 654 dst_gpu_addr = dst_gpu_addr & ~255ULL;
655 655
656 if (!src_x && !dst_x) { 656 if (!src_x && !dst_x) {
657 h = (cur_size / max_bytes); 657 h = (cur_size / max_bytes);
@@ -744,8 +744,8 @@ void r600_kms_blit_copy(struct radeon_device *rdev,
744 int src_x = (src_gpu_addr & 255); 744 int src_x = (src_gpu_addr & 255);
745 int dst_x = (dst_gpu_addr & 255); 745 int dst_x = (dst_gpu_addr & 255);
746 int h = 1; 746 int h = 1;
747 src_gpu_addr = src_gpu_addr & ~255; 747 src_gpu_addr = src_gpu_addr & ~255ULL;
748 dst_gpu_addr = dst_gpu_addr & ~255; 748 dst_gpu_addr = dst_gpu_addr & ~255ULL;
749 749
750 if (!src_x && !dst_x) { 750 if (!src_x && !dst_x) {
751 h = (cur_size / max_bytes); 751 h = (cur_size / max_bytes);
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 250a3a918193..478fddf08f9a 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -228,7 +228,7 @@ static inline int r600_cs_track_validate_cb(struct radeon_cs_parser *p, int i)
228 __func__, __LINE__, pitch); 228 __func__, __LINE__, pitch);
229 return -EINVAL; 229 return -EINVAL;
230 } 230 }
231 if (!IS_ALIGNED((height / 8), track->nbanks)) { 231 if (!IS_ALIGNED((height / 8), track->npipes)) {
232 dev_warn(p->dev, "%s:%d cb height (%d) invalid\n", 232 dev_warn(p->dev, "%s:%d cb height (%d) invalid\n",
233 __func__, __LINE__, height); 233 __func__, __LINE__, height);
234 return -EINVAL; 234 return -EINVAL;
@@ -367,7 +367,7 @@ static int r600_cs_track_check(struct radeon_cs_parser *p)
367 __func__, __LINE__, pitch); 367 __func__, __LINE__, pitch);
368 return -EINVAL; 368 return -EINVAL;
369 } 369 }
370 if ((height / 8) & (track->nbanks - 1)) { 370 if (!IS_ALIGNED((height / 8), track->npipes)) {
371 dev_warn(p->dev, "%s:%d db height (%d) invalid\n", 371 dev_warn(p->dev, "%s:%d db height (%d) invalid\n",
372 __func__, __LINE__, height); 372 __func__, __LINE__, height);
373 return -EINVAL; 373 return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/r600_reg.h b/drivers/gpu/drm/radeon/r600_reg.h
index d84612ae47e0..33cda016b083 100644
--- a/drivers/gpu/drm/radeon/r600_reg.h
+++ b/drivers/gpu/drm/radeon/r600_reg.h
@@ -86,6 +86,7 @@
86#define R600_HDP_NONSURFACE_BASE 0x2c04 86#define R600_HDP_NONSURFACE_BASE 0x2c04
87 87
88#define R600_BUS_CNTL 0x5420 88#define R600_BUS_CNTL 0x5420
89# define R600_BIOS_ROM_DIS (1 << 1)
89#define R600_CONFIG_CNTL 0x5424 90#define R600_CONFIG_CNTL 0x5424
90#define R600_CONFIG_MEMSIZE 0x5428 91#define R600_CONFIG_MEMSIZE 0x5428
91#define R600_CONFIG_F0_BASE 0x542C 92#define R600_CONFIG_F0_BASE 0x542C
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 8e43ddae70cc..85a0d9f1f82b 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -98,6 +98,14 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev
98 } 98 }
99 } 99 }
100 100
101 /* some DCE3 boards have bad data for this entry */
102 if (ASIC_IS_DCE3(rdev)) {
103 if ((i == 4) &&
104 (gpio->usClkMaskRegisterIndex == 0x1fda) &&
105 (gpio->sucI2cId.ucAccess == 0x94))
106 gpio->sucI2cId.ucAccess = 0x14;
107 }
108
101 if (gpio->sucI2cId.ucAccess == id) { 109 if (gpio->sucI2cId.ucAccess == id) {
102 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; 110 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4;
103 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; 111 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4;
@@ -174,6 +182,14 @@ void radeon_atombios_i2c_init(struct radeon_device *rdev)
174 } 182 }
175 } 183 }
176 184
185 /* some DCE3 boards have bad data for this entry */
186 if (ASIC_IS_DCE3(rdev)) {
187 if ((i == 4) &&
188 (gpio->usClkMaskRegisterIndex == 0x1fda) &&
189 (gpio->sucI2cId.ucAccess == 0x94))
190 gpio->sucI2cId.ucAccess = 0x14;
191 }
192
177 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4; 193 i2c.mask_clk_reg = le16_to_cpu(gpio->usClkMaskRegisterIndex) * 4;
178 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4; 194 i2c.mask_data_reg = le16_to_cpu(gpio->usDataMaskRegisterIndex) * 4;
179 i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4; 195 i2c.en_clk_reg = le16_to_cpu(gpio->usClkEnRegisterIndex) * 4;
@@ -297,7 +313,6 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
297 uint16_t *line_mux, 313 uint16_t *line_mux,
298 struct radeon_hpd *hpd) 314 struct radeon_hpd *hpd)
299{ 315{
300 struct radeon_device *rdev = dev->dev_private;
301 316
302 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ 317 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */
303 if ((dev->pdev->device == 0x791e) && 318 if ((dev->pdev->device == 0x791e) &&
@@ -372,6 +387,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
372 *line_mux = 0x90; 387 *line_mux = 0x90;
373 } 388 }
374 389
390 /* mac rv630, rv730, others */
391 if ((supported_device == ATOM_DEVICE_TV1_SUPPORT) &&
392 (*connector_type == DRM_MODE_CONNECTOR_DVII)) {
393 *connector_type = DRM_MODE_CONNECTOR_9PinDIN;
394 *line_mux = CONNECTOR_7PIN_DIN_ENUM_ID1;
395 }
396
375 /* ASUS HD 3600 XT board lists the DVI port as HDMI */ 397 /* ASUS HD 3600 XT board lists the DVI port as HDMI */
376 if ((dev->pdev->device == 0x9598) && 398 if ((dev->pdev->device == 0x9598) &&
377 (dev->pdev->subsystem_vendor == 0x1043) && 399 (dev->pdev->subsystem_vendor == 0x1043) &&
@@ -409,21 +431,23 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
409 } 431 }
410 } 432 }
411 433
412 /* Acer laptop reports DVI-D as DVI-I and hpd pins reversed */ 434 /* Acer laptop (Acer TravelMate 5730G) has an HDMI port
435 * on the laptop and a DVI port on the docking station and
436 * both share the same encoder, hpd pin, and ddc line.
437 * So while the bios table is technically correct,
438 * we drop the DVI port here since xrandr has no concept of
439 * encoders and will try and drive both connectors
440 * with different crtcs which isn't possible on the hardware
441 * side and leaves no crtcs for LVDS or VGA.
442 */
413 if ((dev->pdev->device == 0x95c4) && 443 if ((dev->pdev->device == 0x95c4) &&
414 (dev->pdev->subsystem_vendor == 0x1025) && 444 (dev->pdev->subsystem_vendor == 0x1025) &&
415 (dev->pdev->subsystem_device == 0x013c)) { 445 (dev->pdev->subsystem_device == 0x013c)) {
416 struct radeon_gpio_rec gpio;
417
418 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) && 446 if ((*connector_type == DRM_MODE_CONNECTOR_DVII) &&
419 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) { 447 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
420 gpio = radeon_lookup_gpio(rdev, 6); 448 /* actually it's a DVI-D port not DVI-I */
421 *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
422 *connector_type = DRM_MODE_CONNECTOR_DVID; 449 *connector_type = DRM_MODE_CONNECTOR_DVID;
423 } else if ((*connector_type == DRM_MODE_CONNECTOR_HDMIA) && 450 return false;
424 (supported_device == ATOM_DEVICE_DFP1_SUPPORT)) {
425 gpio = radeon_lookup_gpio(rdev, 7);
426 *hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
427 } 451 }
428 } 452 }
429 453
@@ -2279,7 +2303,7 @@ void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev)
2279 bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE; 2303 bios_2_scratch &= ~ATOM_S2_VRI_BRIGHT_ENABLE;
2280 2304
2281 /* tell the bios not to handle mode switching */ 2305 /* tell the bios not to handle mode switching */
2282 bios_6_scratch |= (ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH | ATOM_S6_ACC_MODE); 2306 bios_6_scratch |= ATOM_S6_ACC_BLOCK_DISPLAY_SWITCH;
2283 2307
2284 if (rdev->family >= CHIP_R600) { 2308 if (rdev->family >= CHIP_R600) {
2285 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch); 2309 WREG32(R600_BIOS_2_SCRATCH, bios_2_scratch);
@@ -2330,10 +2354,13 @@ void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock)
2330 else 2354 else
2331 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH); 2355 bios_6_scratch = RREG32(RADEON_BIOS_6_SCRATCH);
2332 2356
2333 if (lock) 2357 if (lock) {
2334 bios_6_scratch |= ATOM_S6_CRITICAL_STATE; 2358 bios_6_scratch |= ATOM_S6_CRITICAL_STATE;
2335 else 2359 bios_6_scratch &= ~ATOM_S6_ACC_MODE;
2360 } else {
2336 bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE; 2361 bios_6_scratch &= ~ATOM_S6_CRITICAL_STATE;
2362 bios_6_scratch |= ATOM_S6_ACC_MODE;
2363 }
2337 2364
2338 if (rdev->family >= CHIP_R600) 2365 if (rdev->family >= CHIP_R600)
2339 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch); 2366 WREG32(R600_BIOS_6_SCRATCH, bios_6_scratch);
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c
index 654787ec43f4..8f2c7b50dcf5 100644
--- a/drivers/gpu/drm/radeon/radeon_bios.c
+++ b/drivers/gpu/drm/radeon/radeon_bios.c
@@ -130,6 +130,7 @@ static bool radeon_atrm_get_bios(struct radeon_device *rdev)
130 } 130 }
131 return true; 131 return true;
132} 132}
133
133static bool r700_read_disabled_bios(struct radeon_device *rdev) 134static bool r700_read_disabled_bios(struct radeon_device *rdev)
134{ 135{
135 uint32_t viph_control; 136 uint32_t viph_control;
@@ -143,7 +144,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev)
143 bool r; 144 bool r;
144 145
145 viph_control = RREG32(RADEON_VIPH_CONTROL); 146 viph_control = RREG32(RADEON_VIPH_CONTROL);
146 bus_cntl = RREG32(RADEON_BUS_CNTL); 147 bus_cntl = RREG32(R600_BUS_CNTL);
147 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); 148 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
148 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); 149 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
149 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); 150 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
@@ -152,7 +153,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev)
152 /* disable VIP */ 153 /* disable VIP */
153 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); 154 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
154 /* enable the rom */ 155 /* enable the rom */
155 WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); 156 WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
156 /* Disable VGA mode */ 157 /* Disable VGA mode */
157 WREG32(AVIVO_D1VGA_CONTROL, 158 WREG32(AVIVO_D1VGA_CONTROL,
158 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | 159 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
@@ -191,7 +192,7 @@ static bool r700_read_disabled_bios(struct radeon_device *rdev)
191 cg_spll_status = RREG32(R600_CG_SPLL_STATUS); 192 cg_spll_status = RREG32(R600_CG_SPLL_STATUS);
192 } 193 }
193 WREG32(RADEON_VIPH_CONTROL, viph_control); 194 WREG32(RADEON_VIPH_CONTROL, viph_control);
194 WREG32(RADEON_BUS_CNTL, bus_cntl); 195 WREG32(R600_BUS_CNTL, bus_cntl);
195 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); 196 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
196 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); 197 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
197 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); 198 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
@@ -216,7 +217,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev)
216 bool r; 217 bool r;
217 218
218 viph_control = RREG32(RADEON_VIPH_CONTROL); 219 viph_control = RREG32(RADEON_VIPH_CONTROL);
219 bus_cntl = RREG32(RADEON_BUS_CNTL); 220 bus_cntl = RREG32(R600_BUS_CNTL);
220 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL); 221 d1vga_control = RREG32(AVIVO_D1VGA_CONTROL);
221 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL); 222 d2vga_control = RREG32(AVIVO_D2VGA_CONTROL);
222 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL); 223 vga_render_control = RREG32(AVIVO_VGA_RENDER_CONTROL);
@@ -231,7 +232,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev)
231 /* disable VIP */ 232 /* disable VIP */
232 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN)); 233 WREG32(RADEON_VIPH_CONTROL, (viph_control & ~RADEON_VIPH_EN));
233 /* enable the rom */ 234 /* enable the rom */
234 WREG32(RADEON_BUS_CNTL, (bus_cntl & ~RADEON_BUS_BIOS_DIS_ROM)); 235 WREG32(R600_BUS_CNTL, (bus_cntl & ~R600_BIOS_ROM_DIS));
235 /* Disable VGA mode */ 236 /* Disable VGA mode */
236 WREG32(AVIVO_D1VGA_CONTROL, 237 WREG32(AVIVO_D1VGA_CONTROL,
237 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE | 238 (d1vga_control & ~(AVIVO_DVGA_CONTROL_MODE_ENABLE |
@@ -262,7 +263,7 @@ static bool r600_read_disabled_bios(struct radeon_device *rdev)
262 263
263 /* restore regs */ 264 /* restore regs */
264 WREG32(RADEON_VIPH_CONTROL, viph_control); 265 WREG32(RADEON_VIPH_CONTROL, viph_control);
265 WREG32(RADEON_BUS_CNTL, bus_cntl); 266 WREG32(R600_BUS_CNTL, bus_cntl);
266 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control); 267 WREG32(AVIVO_D1VGA_CONTROL, d1vga_control);
267 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control); 268 WREG32(AVIVO_D2VGA_CONTROL, d2vga_control);
268 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control); 269 WREG32(AVIVO_VGA_RENDER_CONTROL, vga_render_control);
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index 7b7ea269549c..137b8075f6e7 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -571,6 +571,7 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
571 } 571 }
572 572
573 if (clk_mask && data_mask) { 573 if (clk_mask && data_mask) {
574 /* system specific masks */
574 i2c.mask_clk_mask = clk_mask; 575 i2c.mask_clk_mask = clk_mask;
575 i2c.mask_data_mask = data_mask; 576 i2c.mask_data_mask = data_mask;
576 i2c.a_clk_mask = clk_mask; 577 i2c.a_clk_mask = clk_mask;
@@ -579,7 +580,19 @@ static struct radeon_i2c_bus_rec combios_setup_i2c_bus(struct radeon_device *rde
579 i2c.en_data_mask = data_mask; 580 i2c.en_data_mask = data_mask;
580 i2c.y_clk_mask = clk_mask; 581 i2c.y_clk_mask = clk_mask;
581 i2c.y_data_mask = data_mask; 582 i2c.y_data_mask = data_mask;
583 } else if ((ddc_line == RADEON_GPIOPAD_MASK) ||
584 (ddc_line == RADEON_MDGPIO_MASK)) {
585 /* default gpiopad masks */
586 i2c.mask_clk_mask = (0x20 << 8);
587 i2c.mask_data_mask = 0x80;
588 i2c.a_clk_mask = (0x20 << 8);
589 i2c.a_data_mask = 0x80;
590 i2c.en_clk_mask = (0x20 << 8);
591 i2c.en_data_mask = 0x80;
592 i2c.y_clk_mask = (0x20 << 8);
593 i2c.y_data_mask = 0x80;
582 } else { 594 } else {
595 /* default masks for ddc pads */
583 i2c.mask_clk_mask = RADEON_GPIO_EN_1; 596 i2c.mask_clk_mask = RADEON_GPIO_EN_1;
584 i2c.mask_data_mask = RADEON_GPIO_EN_0; 597 i2c.mask_data_mask = RADEON_GPIO_EN_0;
585 i2c.a_clk_mask = RADEON_GPIO_A_1; 598 i2c.a_clk_mask = RADEON_GPIO_A_1;
@@ -716,7 +729,7 @@ void radeon_combios_i2c_init(struct radeon_device *rdev)
716 clk = RBIOS8(offset + 3 + (i * 5) + 3); 729 clk = RBIOS8(offset + 3 + (i * 5) + 3);
717 data = RBIOS8(offset + 3 + (i * 5) + 4); 730 data = RBIOS8(offset + 3 + (i * 5) + 4);
718 i2c = combios_setup_i2c_bus(rdev, DDC_MONID, 731 i2c = combios_setup_i2c_bus(rdev, DDC_MONID,
719 clk, data); 732 (1 << clk), (1 << data));
720 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK"); 733 rdev->i2c_bus[4] = radeon_i2c_create(dev, &i2c, "GPIOPAD_MASK");
721 break; 734 break;
722 } 735 }
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index ecc1a8fafbfd..5e222c9739c7 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -1119,6 +1119,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1119 /* no HPD on analog connectors */ 1119 /* no HPD on analog connectors */
1120 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1120 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1121 connector->polled = DRM_CONNECTOR_POLL_CONNECT; 1121 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1122 connector->interlace_allowed = true;
1123 connector->doublescan_allowed = true;
1122 break; 1124 break;
1123 case DRM_MODE_CONNECTOR_DVIA: 1125 case DRM_MODE_CONNECTOR_DVIA:
1124 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); 1126 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
@@ -1134,6 +1136,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1134 1); 1136 1);
1135 /* no HPD on analog connectors */ 1137 /* no HPD on analog connectors */
1136 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1138 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1139 connector->interlace_allowed = true;
1140 connector->doublescan_allowed = true;
1137 break; 1141 break;
1138 case DRM_MODE_CONNECTOR_DVII: 1142 case DRM_MODE_CONNECTOR_DVII:
1139 case DRM_MODE_CONNECTOR_DVID: 1143 case DRM_MODE_CONNECTOR_DVID:
@@ -1163,6 +1167,11 @@ radeon_add_atom_connector(struct drm_device *dev,
1163 rdev->mode_info.load_detect_property, 1167 rdev->mode_info.load_detect_property,
1164 1); 1168 1);
1165 } 1169 }
1170 connector->interlace_allowed = true;
1171 if (connector_type == DRM_MODE_CONNECTOR_DVII)
1172 connector->doublescan_allowed = true;
1173 else
1174 connector->doublescan_allowed = false;
1166 break; 1175 break;
1167 case DRM_MODE_CONNECTOR_HDMIA: 1176 case DRM_MODE_CONNECTOR_HDMIA:
1168 case DRM_MODE_CONNECTOR_HDMIB: 1177 case DRM_MODE_CONNECTOR_HDMIB:
@@ -1186,6 +1195,11 @@ radeon_add_atom_connector(struct drm_device *dev,
1186 rdev->mode_info.underscan_property, 1195 rdev->mode_info.underscan_property,
1187 UNDERSCAN_AUTO); 1196 UNDERSCAN_AUTO);
1188 subpixel_order = SubPixelHorizontalRGB; 1197 subpixel_order = SubPixelHorizontalRGB;
1198 connector->interlace_allowed = true;
1199 if (connector_type == DRM_MODE_CONNECTOR_HDMIB)
1200 connector->doublescan_allowed = true;
1201 else
1202 connector->doublescan_allowed = false;
1189 break; 1203 break;
1190 case DRM_MODE_CONNECTOR_DisplayPort: 1204 case DRM_MODE_CONNECTOR_DisplayPort:
1191 case DRM_MODE_CONNECTOR_eDP: 1205 case DRM_MODE_CONNECTOR_eDP:
@@ -1216,6 +1230,9 @@ radeon_add_atom_connector(struct drm_device *dev,
1216 drm_connector_attach_property(&radeon_connector->base, 1230 drm_connector_attach_property(&radeon_connector->base,
1217 rdev->mode_info.underscan_property, 1231 rdev->mode_info.underscan_property,
1218 UNDERSCAN_AUTO); 1232 UNDERSCAN_AUTO);
1233 connector->interlace_allowed = true;
1234 /* in theory with a DP to VGA converter... */
1235 connector->doublescan_allowed = false;
1219 break; 1236 break;
1220 case DRM_MODE_CONNECTOR_SVIDEO: 1237 case DRM_MODE_CONNECTOR_SVIDEO:
1221 case DRM_MODE_CONNECTOR_Composite: 1238 case DRM_MODE_CONNECTOR_Composite:
@@ -1231,6 +1248,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1231 radeon_atombios_get_tv_info(rdev)); 1248 radeon_atombios_get_tv_info(rdev));
1232 /* no HPD on analog connectors */ 1249 /* no HPD on analog connectors */
1233 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1250 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1251 connector->interlace_allowed = false;
1252 connector->doublescan_allowed = false;
1234 break; 1253 break;
1235 case DRM_MODE_CONNECTOR_LVDS: 1254 case DRM_MODE_CONNECTOR_LVDS:
1236 radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL); 1255 radeon_dig_connector = kzalloc(sizeof(struct radeon_connector_atom_dig), GFP_KERNEL);
@@ -1249,6 +1268,8 @@ radeon_add_atom_connector(struct drm_device *dev,
1249 dev->mode_config.scaling_mode_property, 1268 dev->mode_config.scaling_mode_property,
1250 DRM_MODE_SCALE_FULLSCREEN); 1269 DRM_MODE_SCALE_FULLSCREEN);
1251 subpixel_order = SubPixelHorizontalRGB; 1270 subpixel_order = SubPixelHorizontalRGB;
1271 connector->interlace_allowed = false;
1272 connector->doublescan_allowed = false;
1252 break; 1273 break;
1253 } 1274 }
1254 1275
@@ -1326,6 +1347,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1326 /* no HPD on analog connectors */ 1347 /* no HPD on analog connectors */
1327 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1348 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1328 connector->polled = DRM_CONNECTOR_POLL_CONNECT; 1349 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1350 connector->interlace_allowed = true;
1351 connector->doublescan_allowed = true;
1329 break; 1352 break;
1330 case DRM_MODE_CONNECTOR_DVIA: 1353 case DRM_MODE_CONNECTOR_DVIA:
1331 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); 1354 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
@@ -1341,6 +1364,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1341 1); 1364 1);
1342 /* no HPD on analog connectors */ 1365 /* no HPD on analog connectors */
1343 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1366 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1367 connector->interlace_allowed = true;
1368 connector->doublescan_allowed = true;
1344 break; 1369 break;
1345 case DRM_MODE_CONNECTOR_DVII: 1370 case DRM_MODE_CONNECTOR_DVII:
1346 case DRM_MODE_CONNECTOR_DVID: 1371 case DRM_MODE_CONNECTOR_DVID:
@@ -1358,6 +1383,11 @@ radeon_add_legacy_connector(struct drm_device *dev,
1358 1); 1383 1);
1359 } 1384 }
1360 subpixel_order = SubPixelHorizontalRGB; 1385 subpixel_order = SubPixelHorizontalRGB;
1386 connector->interlace_allowed = true;
1387 if (connector_type == DRM_MODE_CONNECTOR_DVII)
1388 connector->doublescan_allowed = true;
1389 else
1390 connector->doublescan_allowed = false;
1361 break; 1391 break;
1362 case DRM_MODE_CONNECTOR_SVIDEO: 1392 case DRM_MODE_CONNECTOR_SVIDEO:
1363 case DRM_MODE_CONNECTOR_Composite: 1393 case DRM_MODE_CONNECTOR_Composite:
@@ -1380,6 +1410,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1380 radeon_combios_get_tv_info(rdev)); 1410 radeon_combios_get_tv_info(rdev));
1381 /* no HPD on analog connectors */ 1411 /* no HPD on analog connectors */
1382 radeon_connector->hpd.hpd = RADEON_HPD_NONE; 1412 radeon_connector->hpd.hpd = RADEON_HPD_NONE;
1413 connector->interlace_allowed = false;
1414 connector->doublescan_allowed = false;
1383 break; 1415 break;
1384 case DRM_MODE_CONNECTOR_LVDS: 1416 case DRM_MODE_CONNECTOR_LVDS:
1385 drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type); 1417 drm_connector_init(dev, &radeon_connector->base, &radeon_lvds_connector_funcs, connector_type);
@@ -1393,6 +1425,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1393 dev->mode_config.scaling_mode_property, 1425 dev->mode_config.scaling_mode_property,
1394 DRM_MODE_SCALE_FULLSCREEN); 1426 DRM_MODE_SCALE_FULLSCREEN);
1395 subpixel_order = SubPixelHorizontalRGB; 1427 subpixel_order = SubPixelHorizontalRGB;
1428 connector->interlace_allowed = false;
1429 connector->doublescan_allowed = false;
1396 break; 1430 break;
1397 } 1431 }
1398 1432
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 256d204a6d24..ed5e153384ac 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -829,11 +829,6 @@ int radeon_resume_kms(struct drm_device *dev)
829 radeon_pm_resume(rdev); 829 radeon_pm_resume(rdev);
830 radeon_restore_bios_scratch_regs(rdev); 830 radeon_restore_bios_scratch_regs(rdev);
831 831
832 /* turn on display hw */
833 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
834 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
835 }
836
837 radeon_fbdev_set_suspend(rdev, 0); 832 radeon_fbdev_set_suspend(rdev, 0);
838 release_console_sem(); 833 release_console_sem();
839 834
@@ -841,6 +836,10 @@ int radeon_resume_kms(struct drm_device *dev)
841 radeon_hpd_init(rdev); 836 radeon_hpd_init(rdev);
842 /* blat the mode back in */ 837 /* blat the mode back in */
843 drm_helper_resume_force_mode(dev); 838 drm_helper_resume_force_mode(dev);
839 /* turn on display hw */
840 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
841 drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
842 }
844 return 0; 843 return 0;
845} 844}
846 845
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index b92d2f2fcbed..4da243ac79d7 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -629,6 +629,10 @@ static void radeon_compute_pll_legacy(struct radeon_pll *pll,
629 *frac_fb_div_p = best_frac_feedback_div; 629 *frac_fb_div_p = best_frac_feedback_div;
630 *ref_div_p = best_ref_div; 630 *ref_div_p = best_ref_div;
631 *post_div_p = best_post_div; 631 *post_div_p = best_post_div;
632 DRM_DEBUG_KMS("%d %d, pll dividers - fb: %d.%d ref: %d, post %d\n",
633 freq, best_freq / 1000, best_feedback_div, best_frac_feedback_div,
634 best_ref_div, best_post_div);
635
632} 636}
633 637
634static bool 638static bool
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 2c293e8304d6..b82015e148e6 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -595,6 +595,7 @@ atombios_digital_setup(struct drm_encoder *encoder, int action)
595int 595int
596atombios_get_encoder_mode(struct drm_encoder *encoder) 596atombios_get_encoder_mode(struct drm_encoder *encoder)
597{ 597{
598 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
598 struct drm_device *dev = encoder->dev; 599 struct drm_device *dev = encoder->dev;
599 struct radeon_device *rdev = dev->dev_private; 600 struct radeon_device *rdev = dev->dev_private;
600 struct drm_connector *connector; 601 struct drm_connector *connector;
@@ -602,9 +603,20 @@ atombios_get_encoder_mode(struct drm_encoder *encoder)
602 struct radeon_connector_atom_dig *dig_connector; 603 struct radeon_connector_atom_dig *dig_connector;
603 604
604 connector = radeon_get_connector_for_encoder(encoder); 605 connector = radeon_get_connector_for_encoder(encoder);
605 if (!connector) 606 if (!connector) {
606 return 0; 607 switch (radeon_encoder->encoder_id) {
607 608 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
609 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
610 case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
611 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
612 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
613 return ATOM_ENCODER_MODE_DVI;
614 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
615 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
616 default:
617 return ATOM_ENCODER_MODE_CRT;
618 }
619 }
608 radeon_connector = to_radeon_connector(connector); 620 radeon_connector = to_radeon_connector(connector);
609 621
610 switch (connector->connector_type) { 622 switch (connector->connector_type) {
@@ -1547,6 +1559,23 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
1547 struct radeon_device *rdev = dev->dev_private; 1559 struct radeon_device *rdev = dev->dev_private;
1548 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 1560 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1549 struct radeon_encoder_atom_dig *dig; 1561 struct radeon_encoder_atom_dig *dig;
1562
1563 /* check for pre-DCE3 cards with shared encoders;
1564 * can't really use the links individually, so don't disable
1565 * the encoder if it's in use by another connector
1566 */
1567 if (!ASIC_IS_DCE3(rdev)) {
1568 struct drm_encoder *other_encoder;
1569 struct radeon_encoder *other_radeon_encoder;
1570
1571 list_for_each_entry(other_encoder, &dev->mode_config.encoder_list, head) {
1572 other_radeon_encoder = to_radeon_encoder(other_encoder);
1573 if ((radeon_encoder->encoder_id == other_radeon_encoder->encoder_id) &&
1574 drm_helper_encoder_in_use(other_encoder))
1575 goto disable_done;
1576 }
1577 }
1578
1550 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); 1579 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
1551 1580
1552 switch (radeon_encoder->encoder_id) { 1581 switch (radeon_encoder->encoder_id) {
@@ -1586,6 +1615,7 @@ static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
1586 break; 1615 break;
1587 } 1616 }
1588 1617
1618disable_done:
1589 if (radeon_encoder_is_digital(encoder)) { 1619 if (radeon_encoder_is_digital(encoder)) {
1590 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI) 1620 if (atombios_get_encoder_mode(encoder) == ATOM_ENCODER_MODE_HDMI)
1591 r600_hdmi_disable(encoder); 1621 r600_hdmi_disable(encoder);
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
index 6a13ee38a5b9..acae80ee91a2 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -946,6 +946,7 @@ struct radeon_i2c_chan *radeon_i2c_create_dp(struct drm_device *dev,
946 i2c->rec = *rec; 946 i2c->rec = *rec;
947 i2c->adapter.owner = THIS_MODULE; 947 i2c->adapter.owner = THIS_MODULE;
948 i2c->dev = dev; 948 i2c->dev = dev;
949 sprintf(i2c->adapter.name, "Radeon aux bus %s", name);
949 i2c_set_adapdata(&i2c->adapter, i2c); 950 i2c_set_adapdata(&i2c->adapter, i2c);
950 i2c->adapter.algo_data = &i2c->algo.dp; 951 i2c->adapter.algo_data = &i2c->algo.dp;
951 i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch; 952 i2c->algo.dp.aux_ch = radeon_dp_i2c_aux_ch;
diff --git a/drivers/gpu/drm/radeon/radeon_object.c b/drivers/gpu/drm/radeon/radeon_object.c
index b3b5306bb578..25d345ecee8e 100644
--- a/drivers/gpu/drm/radeon/radeon_object.c
+++ b/drivers/gpu/drm/radeon/radeon_object.c
@@ -102,6 +102,8 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
102 type = ttm_bo_type_device; 102 type = ttm_bo_type_device;
103 } 103 }
104 *bo_ptr = NULL; 104 *bo_ptr = NULL;
105
106retry:
105 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL); 107 bo = kzalloc(sizeof(struct radeon_bo), GFP_KERNEL);
106 if (bo == NULL) 108 if (bo == NULL)
107 return -ENOMEM; 109 return -ENOMEM;
@@ -109,8 +111,6 @@ int radeon_bo_create(struct radeon_device *rdev, struct drm_gem_object *gobj,
109 bo->gobj = gobj; 111 bo->gobj = gobj;
110 bo->surface_reg = -1; 112 bo->surface_reg = -1;
111 INIT_LIST_HEAD(&bo->list); 113 INIT_LIST_HEAD(&bo->list);
112
113retry:
114 radeon_ttm_placement_from_domain(bo, domain); 114 radeon_ttm_placement_from_domain(bo, domain);
115 /* Kernel allocation are uninterruptible */ 115 /* Kernel allocation are uninterruptible */
116 mutex_lock(&rdev->vram_mutex); 116 mutex_lock(&rdev->vram_mutex);
diff --git a/drivers/gpu/drm/radeon/radeon_reg.h b/drivers/gpu/drm/radeon/radeon_reg.h
index c332f46340d5..64928814de53 100644
--- a/drivers/gpu/drm/radeon/radeon_reg.h
+++ b/drivers/gpu/drm/radeon/radeon_reg.h
@@ -2836,6 +2836,7 @@
2836# define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24) 2836# define R200_TXFORMAT_ST_ROUTE_STQ5 (5 << 24)
2837# define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24) 2837# define R200_TXFORMAT_ST_ROUTE_MASK (7 << 24)
2838# define R200_TXFORMAT_ST_ROUTE_SHIFT 24 2838# define R200_TXFORMAT_ST_ROUTE_SHIFT 24
2839# define R200_TXFORMAT_LOOKUP_DISABLE (1 << 27)
2839# define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) 2840# define R200_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28)
2840# define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) 2841# define R200_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29)
2841# define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) 2842# define R200_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30)
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index 9490da700749..b88353d6ed2e 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -643,10 +643,11 @@ static void rv770_gpu_init(struct radeon_device *rdev)
643 else 643 else
644 gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT); 644 gb_tiling_config |= BANK_TILING((mc_arb_ramcfg & NOOFBANK_MASK) >> NOOFBANK_SHIFT);
645 rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3); 645 rdev->config.rv770.tiling_nbanks = 4 << ((gb_tiling_config >> 4) & 0x3);
646 646 gb_tiling_config |= GROUP_SIZE((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT);
647 gb_tiling_config |= GROUP_SIZE(0); 647 if ((mc_arb_ramcfg & BURSTLENGTH_MASK) >> BURSTLENGTH_SHIFT)
648 rdev->config.rv770.tiling_group_size = 256; 648 rdev->config.rv770.tiling_group_size = 512;
649 649 else
650 rdev->config.rv770.tiling_group_size = 256;
650 if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) { 651 if (((mc_arb_ramcfg & NOOFROWS_MASK) >> NOOFROWS_SHIFT) > 3) {
651 gb_tiling_config |= ROW_TILING(3); 652 gb_tiling_config |= ROW_TILING(3);
652 gb_tiling_config |= SAMPLE_SPLIT(3); 653 gb_tiling_config |= SAMPLE_SPLIT(3);