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/atombios_dp.c7
-rw-r--r--drivers/gpu/drm/radeon/cik.c12
-rw-r--r--drivers/gpu/drm/radeon/cik_sdma.c7
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c8
-rw-r--r--drivers/gpu/drm/radeon/kv_dpm.c28
-rw-r--r--drivers/gpu/drm/radeon/ni_dma.c6
-rw-r--r--drivers/gpu/drm/radeon/r100.c28
-rw-r--r--drivers/gpu/drm/radeon/r600.c12
-rw-r--r--drivers/gpu/drm/radeon/r600_dma.c9
-rw-r--r--drivers/gpu/drm/radeon/r600d.h7
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.h3
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c33
-rw-r--r--drivers/gpu/drm/radeon/radeon_atpx_handler.c16
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c15
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.c7
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c44
-rw-r--r--drivers/gpu/drm/radeon/radeon_semaphore.c2
-rw-r--r--drivers/gpu/drm/radeon/rs400.c4
-rw-r--r--drivers/gpu/drm/radeon/si.c8
21 files changed, 145 insertions, 114 deletions
diff --git a/drivers/gpu/drm/radeon/atombios_dp.c b/drivers/gpu/drm/radeon/atombios_dp.c
index b1e11f8434e2..ac14b67621d3 100644
--- a/drivers/gpu/drm/radeon/atombios_dp.c
+++ b/drivers/gpu/drm/radeon/atombios_dp.c
@@ -405,16 +405,13 @@ bool radeon_dp_getdpcd(struct radeon_connector *radeon_connector)
405 u8 msg[DP_DPCD_SIZE]; 405 u8 msg[DP_DPCD_SIZE];
406 int ret; 406 int ret;
407 407
408 char dpcd_hex_dump[DP_DPCD_SIZE * 3];
409
410 ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg, 408 ret = drm_dp_dpcd_read(&radeon_connector->ddc_bus->aux, DP_DPCD_REV, msg,
411 DP_DPCD_SIZE); 409 DP_DPCD_SIZE);
412 if (ret > 0) { 410 if (ret > 0) {
413 memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE); 411 memcpy(dig_connector->dpcd, msg, DP_DPCD_SIZE);
414 412
415 hex_dump_to_buffer(dig_connector->dpcd, sizeof(dig_connector->dpcd), 413 DRM_DEBUG_KMS("DPCD: %*ph\n", (int)sizeof(dig_connector->dpcd),
416 32, 1, dpcd_hex_dump, sizeof(dpcd_hex_dump), false); 414 dig_connector->dpcd);
417 DRM_DEBUG_KMS("DPCD: %s\n", dpcd_hex_dump);
418 415
419 radeon_dp_probe_oui(radeon_connector); 416 radeon_dp_probe_oui(radeon_connector);
420 417
diff --git a/drivers/gpu/drm/radeon/cik.c b/drivers/gpu/drm/radeon/cik.c
index fa9565957f9d..3d546c606b43 100644
--- a/drivers/gpu/drm/radeon/cik.c
+++ b/drivers/gpu/drm/radeon/cik.c
@@ -4803,7 +4803,7 @@ struct bonaire_mqd
4803 */ 4803 */
4804static int cik_cp_compute_resume(struct radeon_device *rdev) 4804static int cik_cp_compute_resume(struct radeon_device *rdev)
4805{ 4805{
4806 int r, i, idx; 4806 int r, i, j, idx;
4807 u32 tmp; 4807 u32 tmp;
4808 bool use_doorbell = true; 4808 bool use_doorbell = true;
4809 u64 hqd_gpu_addr; 4809 u64 hqd_gpu_addr;
@@ -4922,7 +4922,7 @@ static int cik_cp_compute_resume(struct radeon_device *rdev)
4922 mqd->queue_state.cp_hqd_pq_wptr= 0; 4922 mqd->queue_state.cp_hqd_pq_wptr= 0;
4923 if (RREG32(CP_HQD_ACTIVE) & 1) { 4923 if (RREG32(CP_HQD_ACTIVE) & 1) {
4924 WREG32(CP_HQD_DEQUEUE_REQUEST, 1); 4924 WREG32(CP_HQD_DEQUEUE_REQUEST, 1);
4925 for (i = 0; i < rdev->usec_timeout; i++) { 4925 for (j = 0; j < rdev->usec_timeout; j++) {
4926 if (!(RREG32(CP_HQD_ACTIVE) & 1)) 4926 if (!(RREG32(CP_HQD_ACTIVE) & 1))
4927 break; 4927 break;
4928 udelay(1); 4928 udelay(1);
@@ -7751,17 +7751,17 @@ static inline u32 cik_get_ih_wptr(struct radeon_device *rdev)
7751 wptr = RREG32(IH_RB_WPTR); 7751 wptr = RREG32(IH_RB_WPTR);
7752 7752
7753 if (wptr & RB_OVERFLOW) { 7753 if (wptr & RB_OVERFLOW) {
7754 wptr &= ~RB_OVERFLOW;
7754 /* When a ring buffer overflow happen start parsing interrupt 7755 /* When a ring buffer overflow happen start parsing interrupt
7755 * from the last not overwritten vector (wptr + 16). Hopefully 7756 * from the last not overwritten vector (wptr + 16). Hopefully
7756 * this should allow us to catchup. 7757 * this should allow us to catchup.
7757 */ 7758 */
7758 dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", 7759 dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n",
7759 wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); 7760 wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask);
7760 rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; 7761 rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask;
7761 tmp = RREG32(IH_RB_CNTL); 7762 tmp = RREG32(IH_RB_CNTL);
7762 tmp |= IH_WPTR_OVERFLOW_CLEAR; 7763 tmp |= IH_WPTR_OVERFLOW_CLEAR;
7763 WREG32(IH_RB_CNTL, tmp); 7764 WREG32(IH_RB_CNTL, tmp);
7764 wptr &= ~RB_OVERFLOW;
7765 } 7765 }
7766 return (wptr & rdev->ih.ptr_mask); 7766 return (wptr & rdev->ih.ptr_mask);
7767} 7767}
@@ -8251,6 +8251,7 @@ restart_ih:
8251 /* wptr/rptr are in bytes! */ 8251 /* wptr/rptr are in bytes! */
8252 rptr += 16; 8252 rptr += 16;
8253 rptr &= rdev->ih.ptr_mask; 8253 rptr &= rdev->ih.ptr_mask;
8254 WREG32(IH_RB_RPTR, rptr);
8254 } 8255 }
8255 if (queue_hotplug) 8256 if (queue_hotplug)
8256 schedule_work(&rdev->hotplug_work); 8257 schedule_work(&rdev->hotplug_work);
@@ -8259,7 +8260,6 @@ restart_ih:
8259 if (queue_thermal) 8260 if (queue_thermal)
8260 schedule_work(&rdev->pm.dpm.thermal.work); 8261 schedule_work(&rdev->pm.dpm.thermal.work);
8261 rdev->ih.rptr = rptr; 8262 rdev->ih.rptr = rptr;
8262 WREG32(IH_RB_RPTR, rdev->ih.rptr);
8263 atomic_set(&rdev->ih.lock, 0); 8263 atomic_set(&rdev->ih.lock, 0);
8264 8264
8265 /* make sure wptr hasn't changed while processing */ 8265 /* make sure wptr hasn't changed while processing */
diff --git a/drivers/gpu/drm/radeon/cik_sdma.c b/drivers/gpu/drm/radeon/cik_sdma.c
index 192278bc993c..c4ffa54b1e3d 100644
--- a/drivers/gpu/drm/radeon/cik_sdma.c
+++ b/drivers/gpu/drm/radeon/cik_sdma.c
@@ -489,13 +489,6 @@ int cik_sdma_resume(struct radeon_device *rdev)
489{ 489{
490 int r; 490 int r;
491 491
492 /* Reset dma */
493 WREG32(SRBM_SOFT_RESET, SOFT_RESET_SDMA | SOFT_RESET_SDMA1);
494 RREG32(SRBM_SOFT_RESET);
495 udelay(50);
496 WREG32(SRBM_SOFT_RESET, 0);
497 RREG32(SRBM_SOFT_RESET);
498
499 r = cik_sdma_load_microcode(rdev); 492 r = cik_sdma_load_microcode(rdev);
500 if (r) 493 if (r)
501 return r; 494 return r;
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index dbca60c7d097..e50807c29f69 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -4749,17 +4749,17 @@ static u32 evergreen_get_ih_wptr(struct radeon_device *rdev)
4749 wptr = RREG32(IH_RB_WPTR); 4749 wptr = RREG32(IH_RB_WPTR);
4750 4750
4751 if (wptr & RB_OVERFLOW) { 4751 if (wptr & RB_OVERFLOW) {
4752 wptr &= ~RB_OVERFLOW;
4752 /* When a ring buffer overflow happen start parsing interrupt 4753 /* When a ring buffer overflow happen start parsing interrupt
4753 * from the last not overwritten vector (wptr + 16). Hopefully 4754 * from the last not overwritten vector (wptr + 16). Hopefully
4754 * this should allow us to catchup. 4755 * this should allow us to catchup.
4755 */ 4756 */
4756 dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", 4757 dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n",
4757 wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); 4758 wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask);
4758 rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; 4759 rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask;
4759 tmp = RREG32(IH_RB_CNTL); 4760 tmp = RREG32(IH_RB_CNTL);
4760 tmp |= IH_WPTR_OVERFLOW_CLEAR; 4761 tmp |= IH_WPTR_OVERFLOW_CLEAR;
4761 WREG32(IH_RB_CNTL, tmp); 4762 WREG32(IH_RB_CNTL, tmp);
4762 wptr &= ~RB_OVERFLOW;
4763 } 4763 }
4764 return (wptr & rdev->ih.ptr_mask); 4764 return (wptr & rdev->ih.ptr_mask);
4765} 4765}
@@ -5137,6 +5137,7 @@ restart_ih:
5137 /* wptr/rptr are in bytes! */ 5137 /* wptr/rptr are in bytes! */
5138 rptr += 16; 5138 rptr += 16;
5139 rptr &= rdev->ih.ptr_mask; 5139 rptr &= rdev->ih.ptr_mask;
5140 WREG32(IH_RB_RPTR, rptr);
5140 } 5141 }
5141 if (queue_hotplug) 5142 if (queue_hotplug)
5142 schedule_work(&rdev->hotplug_work); 5143 schedule_work(&rdev->hotplug_work);
@@ -5145,7 +5146,6 @@ restart_ih:
5145 if (queue_thermal && rdev->pm.dpm_enabled) 5146 if (queue_thermal && rdev->pm.dpm_enabled)
5146 schedule_work(&rdev->pm.dpm.thermal.work); 5147 schedule_work(&rdev->pm.dpm.thermal.work);
5147 rdev->ih.rptr = rptr; 5148 rdev->ih.rptr = rptr;
5148 WREG32(IH_RB_RPTR, rdev->ih.rptr);
5149 atomic_set(&rdev->ih.lock, 0); 5149 atomic_set(&rdev->ih.lock, 0);
5150 5150
5151 /* make sure wptr hasn't changed while processing */ 5151 /* make sure wptr hasn't changed while processing */
diff --git a/drivers/gpu/drm/radeon/kv_dpm.c b/drivers/gpu/drm/radeon/kv_dpm.c
index 8b58e11b64fa..67cb472d188c 100644
--- a/drivers/gpu/drm/radeon/kv_dpm.c
+++ b/drivers/gpu/drm/radeon/kv_dpm.c
@@ -33,6 +33,8 @@
33#define KV_MINIMUM_ENGINE_CLOCK 800 33#define KV_MINIMUM_ENGINE_CLOCK 800
34#define SMC_RAM_END 0x40000 34#define SMC_RAM_END 0x40000
35 35
36static int kv_enable_nb_dpm(struct radeon_device *rdev,
37 bool enable);
36static void kv_init_graphics_levels(struct radeon_device *rdev); 38static void kv_init_graphics_levels(struct radeon_device *rdev);
37static int kv_calculate_ds_divider(struct radeon_device *rdev); 39static int kv_calculate_ds_divider(struct radeon_device *rdev);
38static int kv_calculate_nbps_level_settings(struct radeon_device *rdev); 40static int kv_calculate_nbps_level_settings(struct radeon_device *rdev);
@@ -1295,6 +1297,9 @@ void kv_dpm_disable(struct radeon_device *rdev)
1295{ 1297{
1296 kv_smc_bapm_enable(rdev, false); 1298 kv_smc_bapm_enable(rdev, false);
1297 1299
1300 if (rdev->family == CHIP_MULLINS)
1301 kv_enable_nb_dpm(rdev, false);
1302
1298 /* powerup blocks */ 1303 /* powerup blocks */
1299 kv_dpm_powergate_acp(rdev, false); 1304 kv_dpm_powergate_acp(rdev, false);
1300 kv_dpm_powergate_samu(rdev, false); 1305 kv_dpm_powergate_samu(rdev, false);
@@ -1769,15 +1774,24 @@ static int kv_update_dfs_bypass_settings(struct radeon_device *rdev,
1769 return ret; 1774 return ret;
1770} 1775}
1771 1776
1772static int kv_enable_nb_dpm(struct radeon_device *rdev) 1777static int kv_enable_nb_dpm(struct radeon_device *rdev,
1778 bool enable)
1773{ 1779{
1774 struct kv_power_info *pi = kv_get_pi(rdev); 1780 struct kv_power_info *pi = kv_get_pi(rdev);
1775 int ret = 0; 1781 int ret = 0;
1776 1782
1777 if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) { 1783 if (enable) {
1778 ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable); 1784 if (pi->enable_nb_dpm && !pi->nb_dpm_enabled) {
1779 if (ret == 0) 1785 ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Enable);
1780 pi->nb_dpm_enabled = true; 1786 if (ret == 0)
1787 pi->nb_dpm_enabled = true;
1788 }
1789 } else {
1790 if (pi->enable_nb_dpm && pi->nb_dpm_enabled) {
1791 ret = kv_notify_message_to_smu(rdev, PPSMC_MSG_NBDPM_Disable);
1792 if (ret == 0)
1793 pi->nb_dpm_enabled = false;
1794 }
1781 } 1795 }
1782 1796
1783 return ret; 1797 return ret;
@@ -1864,7 +1878,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev)
1864 } 1878 }
1865 kv_update_sclk_t(rdev); 1879 kv_update_sclk_t(rdev);
1866 if (rdev->family == CHIP_MULLINS) 1880 if (rdev->family == CHIP_MULLINS)
1867 kv_enable_nb_dpm(rdev); 1881 kv_enable_nb_dpm(rdev, true);
1868 } 1882 }
1869 } else { 1883 } else {
1870 if (pi->enable_dpm) { 1884 if (pi->enable_dpm) {
@@ -1889,7 +1903,7 @@ int kv_dpm_set_power_state(struct radeon_device *rdev)
1889 } 1903 }
1890 kv_update_acp_boot_level(rdev); 1904 kv_update_acp_boot_level(rdev);
1891 kv_update_sclk_t(rdev); 1905 kv_update_sclk_t(rdev);
1892 kv_enable_nb_dpm(rdev); 1906 kv_enable_nb_dpm(rdev, true);
1893 } 1907 }
1894 } 1908 }
1895 1909
diff --git a/drivers/gpu/drm/radeon/ni_dma.c b/drivers/gpu/drm/radeon/ni_dma.c
index 8a3e6221cece..f26f0a9fb522 100644
--- a/drivers/gpu/drm/radeon/ni_dma.c
+++ b/drivers/gpu/drm/radeon/ni_dma.c
@@ -191,12 +191,6 @@ int cayman_dma_resume(struct radeon_device *rdev)
191 u32 reg_offset, wb_offset; 191 u32 reg_offset, wb_offset;
192 int i, r; 192 int i, r;
193 193
194 /* Reset dma */
195 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA | SOFT_RESET_DMA1);
196 RREG32(SRBM_SOFT_RESET);
197 udelay(50);
198 WREG32(SRBM_SOFT_RESET, 0);
199
200 for (i = 0; i < 2; i++) { 194 for (i = 0; i < 2; i++) {
201 if (i == 0) { 195 if (i == 0) {
202 ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX]; 196 ring = &rdev->ring[R600_RING_TYPE_DMA_INDEX];
diff --git a/drivers/gpu/drm/radeon/r100.c b/drivers/gpu/drm/radeon/r100.c
index 4c5ec44ff328..b0098e792e62 100644
--- a/drivers/gpu/drm/radeon/r100.c
+++ b/drivers/gpu/drm/radeon/r100.c
@@ -821,6 +821,20 @@ u32 r100_get_vblank_counter(struct radeon_device *rdev, int crtc)
821 return RREG32(RADEON_CRTC2_CRNT_FRAME); 821 return RREG32(RADEON_CRTC2_CRNT_FRAME);
822} 822}
823 823
824/**
825 * r100_ring_hdp_flush - flush Host Data Path via the ring buffer
826 * rdev: radeon device structure
827 * ring: ring buffer struct for emitting packets
828 */
829static void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring)
830{
831 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
832 radeon_ring_write(ring, rdev->config.r100.hdp_cntl |
833 RADEON_HDP_READ_BUFFER_INVALIDATE);
834 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
835 radeon_ring_write(ring, rdev->config.r100.hdp_cntl);
836}
837
824/* Who ever call radeon_fence_emit should call ring_lock and ask 838/* Who ever call radeon_fence_emit should call ring_lock and ask
825 * for enough space (today caller are ib schedule and buffer move) */ 839 * for enough space (today caller are ib schedule and buffer move) */
826void r100_fence_ring_emit(struct radeon_device *rdev, 840void r100_fence_ring_emit(struct radeon_device *rdev,
@@ -1056,20 +1070,6 @@ void r100_gfx_set_wptr(struct radeon_device *rdev,
1056 (void)RREG32(RADEON_CP_RB_WPTR); 1070 (void)RREG32(RADEON_CP_RB_WPTR);
1057} 1071}
1058 1072
1059/**
1060 * r100_ring_hdp_flush - flush Host Data Path via the ring buffer
1061 * rdev: radeon device structure
1062 * ring: ring buffer struct for emitting packets
1063 */
1064void r100_ring_hdp_flush(struct radeon_device *rdev, struct radeon_ring *ring)
1065{
1066 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
1067 radeon_ring_write(ring, rdev->config.r100.hdp_cntl |
1068 RADEON_HDP_READ_BUFFER_INVALIDATE);
1069 radeon_ring_write(ring, PACKET0(RADEON_HOST_PATH_CNTL, 0));
1070 radeon_ring_write(ring, rdev->config.r100.hdp_cntl);
1071}
1072
1073static void r100_cp_load_microcode(struct radeon_device *rdev) 1073static void r100_cp_load_microcode(struct radeon_device *rdev)
1074{ 1074{
1075 const __be32 *fw_data; 1075 const __be32 *fw_data;
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index e616eb5f6e7a..ea5c9af722ef 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -2769,8 +2769,8 @@ bool r600_semaphore_ring_emit(struct radeon_device *rdev,
2769 radeon_ring_write(ring, lower_32_bits(addr)); 2769 radeon_ring_write(ring, lower_32_bits(addr));
2770 radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel); 2770 radeon_ring_write(ring, (upper_32_bits(addr) & 0xff) | sel);
2771 2771
2772 /* PFP_SYNC_ME packet only exists on 7xx+ */ 2772 /* PFP_SYNC_ME packet only exists on 7xx+, only enable it on eg+ */
2773 if (emit_wait && (rdev->family >= CHIP_RV770)) { 2773 if (emit_wait && (rdev->family >= CHIP_CEDAR)) {
2774 /* Prevent the PFP from running ahead of the semaphore wait */ 2774 /* Prevent the PFP from running ahead of the semaphore wait */
2775 radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0)); 2775 radeon_ring_write(ring, PACKET3(PACKET3_PFP_SYNC_ME, 0));
2776 radeon_ring_write(ring, 0x0); 2776 radeon_ring_write(ring, 0x0);
@@ -3792,17 +3792,17 @@ static u32 r600_get_ih_wptr(struct radeon_device *rdev)
3792 wptr = RREG32(IH_RB_WPTR); 3792 wptr = RREG32(IH_RB_WPTR);
3793 3793
3794 if (wptr & RB_OVERFLOW) { 3794 if (wptr & RB_OVERFLOW) {
3795 wptr &= ~RB_OVERFLOW;
3795 /* When a ring buffer overflow happen start parsing interrupt 3796 /* When a ring buffer overflow happen start parsing interrupt
3796 * from the last not overwritten vector (wptr + 16). Hopefully 3797 * from the last not overwritten vector (wptr + 16). Hopefully
3797 * this should allow us to catchup. 3798 * this should allow us to catchup.
3798 */ 3799 */
3799 dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", 3800 dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n",
3800 wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); 3801 wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask);
3801 rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; 3802 rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask;
3802 tmp = RREG32(IH_RB_CNTL); 3803 tmp = RREG32(IH_RB_CNTL);
3803 tmp |= IH_WPTR_OVERFLOW_CLEAR; 3804 tmp |= IH_WPTR_OVERFLOW_CLEAR;
3804 WREG32(IH_RB_CNTL, tmp); 3805 WREG32(IH_RB_CNTL, tmp);
3805 wptr &= ~RB_OVERFLOW;
3806 } 3806 }
3807 return (wptr & rdev->ih.ptr_mask); 3807 return (wptr & rdev->ih.ptr_mask);
3808} 3808}
@@ -4048,6 +4048,7 @@ restart_ih:
4048 /* wptr/rptr are in bytes! */ 4048 /* wptr/rptr are in bytes! */
4049 rptr += 16; 4049 rptr += 16;
4050 rptr &= rdev->ih.ptr_mask; 4050 rptr &= rdev->ih.ptr_mask;
4051 WREG32(IH_RB_RPTR, rptr);
4051 } 4052 }
4052 if (queue_hotplug) 4053 if (queue_hotplug)
4053 schedule_work(&rdev->hotplug_work); 4054 schedule_work(&rdev->hotplug_work);
@@ -4056,7 +4057,6 @@ restart_ih:
4056 if (queue_thermal && rdev->pm.dpm_enabled) 4057 if (queue_thermal && rdev->pm.dpm_enabled)
4057 schedule_work(&rdev->pm.dpm.thermal.work); 4058 schedule_work(&rdev->pm.dpm.thermal.work);
4058 rdev->ih.rptr = rptr; 4059 rdev->ih.rptr = rptr;
4059 WREG32(IH_RB_RPTR, rdev->ih.rptr);
4060 atomic_set(&rdev->ih.lock, 0); 4060 atomic_set(&rdev->ih.lock, 0);
4061 4061
4062 /* make sure wptr hasn't changed while processing */ 4062 /* make sure wptr hasn't changed while processing */
diff --git a/drivers/gpu/drm/radeon/r600_dma.c b/drivers/gpu/drm/radeon/r600_dma.c
index 51fd98553eaf..a908daa006d2 100644
--- a/drivers/gpu/drm/radeon/r600_dma.c
+++ b/drivers/gpu/drm/radeon/r600_dma.c
@@ -124,15 +124,6 @@ int r600_dma_resume(struct radeon_device *rdev)
124 u32 rb_bufsz; 124 u32 rb_bufsz;
125 int r; 125 int r;
126 126
127 /* Reset dma */
128 if (rdev->family >= CHIP_RV770)
129 WREG32(SRBM_SOFT_RESET, RV770_SOFT_RESET_DMA);
130 else
131 WREG32(SRBM_SOFT_RESET, SOFT_RESET_DMA);
132 RREG32(SRBM_SOFT_RESET);
133 udelay(50);
134 WREG32(SRBM_SOFT_RESET, 0);
135
136 WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0); 127 WREG32(DMA_SEM_INCOMPLETE_TIMER_CNTL, 0);
137 WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0); 128 WREG32(DMA_SEM_WAIT_FAIL_TIMER_CNTL, 0);
138 129
diff --git a/drivers/gpu/drm/radeon/r600d.h b/drivers/gpu/drm/radeon/r600d.h
index 0c4a7d8d93e0..31e1052ad3e3 100644
--- a/drivers/gpu/drm/radeon/r600d.h
+++ b/drivers/gpu/drm/radeon/r600d.h
@@ -44,13 +44,6 @@
44#define R6XX_MAX_PIPES 8 44#define R6XX_MAX_PIPES 8
45#define R6XX_MAX_PIPES_MASK 0xff 45#define R6XX_MAX_PIPES_MASK 0xff
46 46
47/* PTE flags */
48#define PTE_VALID (1 << 0)
49#define PTE_SYSTEM (1 << 1)
50#define PTE_SNOOPED (1 << 2)
51#define PTE_READABLE (1 << 5)
52#define PTE_WRITEABLE (1 << 6)
53
54/* tiling bits */ 47/* tiling bits */
55#define ARRAY_LINEAR_GENERAL 0x00000000 48#define ARRAY_LINEAR_GENERAL 0x00000000
56#define ARRAY_LINEAR_ALIGNED 0x00000001 49#define ARRAY_LINEAR_ALIGNED 0x00000001
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 5f05b4c84338..3247bfd14410 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -106,6 +106,7 @@ extern int radeon_vm_block_size;
106extern int radeon_deep_color; 106extern int radeon_deep_color;
107extern int radeon_use_pflipirq; 107extern int radeon_use_pflipirq;
108extern int radeon_bapm; 108extern int radeon_bapm;
109extern int radeon_backlight;
109 110
110/* 111/*
111 * Copy from radeon_drv.h so we don't have to include both and have conflicting 112 * Copy from radeon_drv.h so we don't have to include both and have conflicting
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index eeeeabe09758..2dd5847f9b98 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -185,7 +185,6 @@ static struct radeon_asic_ring r100_gfx_ring = {
185 .get_rptr = &r100_gfx_get_rptr, 185 .get_rptr = &r100_gfx_get_rptr,
186 .get_wptr = &r100_gfx_get_wptr, 186 .get_wptr = &r100_gfx_get_wptr,
187 .set_wptr = &r100_gfx_set_wptr, 187 .set_wptr = &r100_gfx_set_wptr,
188 .hdp_flush = &r100_ring_hdp_flush,
189}; 188};
190 189
191static struct radeon_asic r100_asic = { 190static struct radeon_asic r100_asic = {
@@ -332,7 +331,6 @@ static struct radeon_asic_ring r300_gfx_ring = {
332 .get_rptr = &r100_gfx_get_rptr, 331 .get_rptr = &r100_gfx_get_rptr,
333 .get_wptr = &r100_gfx_get_wptr, 332 .get_wptr = &r100_gfx_get_wptr,
334 .set_wptr = &r100_gfx_set_wptr, 333 .set_wptr = &r100_gfx_set_wptr,
335 .hdp_flush = &r100_ring_hdp_flush,
336}; 334};
337 335
338static struct radeon_asic r300_asic = { 336static struct radeon_asic r300_asic = {
diff --git a/drivers/gpu/drm/radeon/radeon_asic.h b/drivers/gpu/drm/radeon/radeon_asic.h
index 275a5dc01780..7756bc1e1cd3 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.h
+++ b/drivers/gpu/drm/radeon/radeon_asic.h
@@ -148,8 +148,7 @@ u32 r100_gfx_get_wptr(struct radeon_device *rdev,
148 struct radeon_ring *ring); 148 struct radeon_ring *ring);
149void r100_gfx_set_wptr(struct radeon_device *rdev, 149void r100_gfx_set_wptr(struct radeon_device *rdev,
150 struct radeon_ring *ring); 150 struct radeon_ring *ring);
151void r100_ring_hdp_flush(struct radeon_device *rdev, 151
152 struct radeon_ring *ring);
153/* 152/*
154 * r200,rv250,rs300,rv280 153 * r200,rv250,rs300,rv280
155 */ 154 */
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 92b2d8dd4735..e74c7e387dde 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -447,6 +447,13 @@ static bool radeon_atom_apply_quirks(struct drm_device *dev,
447 } 447 }
448 } 448 }
449 449
450 /* Fujitsu D3003-S2 board lists DVI-I as DVI-I and VGA */
451 if ((dev->pdev->device == 0x9805) &&
452 (dev->pdev->subsystem_vendor == 0x1734) &&
453 (dev->pdev->subsystem_device == 0x11bd)) {
454 if (*connector_type == DRM_MODE_CONNECTOR_VGA)
455 return false;
456 }
450 457
451 return true; 458 return true;
452} 459}
@@ -2281,19 +2288,31 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r
2281 (controller->ucFanParameters & 2288 (controller->ucFanParameters &
2282 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); 2289 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
2283 rdev->pm.int_thermal_type = THERMAL_TYPE_KV; 2290 rdev->pm.int_thermal_type = THERMAL_TYPE_KV;
2284 } else if ((controller->ucType == 2291 } else if (controller->ucType ==
2285 ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) || 2292 ATOM_PP_THERMALCONTROLLER_EXTERNAL_GPIO) {
2286 (controller->ucType == 2293 DRM_INFO("External GPIO thermal controller %s fan control\n",
2287 ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) || 2294 (controller->ucFanParameters &
2288 (controller->ucType == 2295 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
2289 ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL)) { 2296 rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL_GPIO;
2290 DRM_INFO("Special thermal controller config\n"); 2297 } else if (controller->ucType ==
2298 ATOM_PP_THERMALCONTROLLER_ADT7473_WITH_INTERNAL) {
2299 DRM_INFO("ADT7473 with internal thermal controller %s fan control\n",
2300 (controller->ucFanParameters &
2301 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
2302 rdev->pm.int_thermal_type = THERMAL_TYPE_ADT7473_WITH_INTERNAL;
2303 } else if (controller->ucType ==
2304 ATOM_PP_THERMALCONTROLLER_EMC2103_WITH_INTERNAL) {
2305 DRM_INFO("EMC2103 with internal thermal controller %s fan control\n",
2306 (controller->ucFanParameters &
2307 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
2308 rdev->pm.int_thermal_type = THERMAL_TYPE_EMC2103_WITH_INTERNAL;
2291 } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) { 2309 } else if (controller->ucType < ARRAY_SIZE(pp_lib_thermal_controller_names)) {
2292 DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n", 2310 DRM_INFO("Possible %s thermal controller at 0x%02x %s fan control\n",
2293 pp_lib_thermal_controller_names[controller->ucType], 2311 pp_lib_thermal_controller_names[controller->ucType],
2294 controller->ucI2cAddress >> 1, 2312 controller->ucI2cAddress >> 1,
2295 (controller->ucFanParameters & 2313 (controller->ucFanParameters &
2296 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with"); 2314 ATOM_PP_FANPARAMETERS_NOFAN) ? "without" : "with");
2315 rdev->pm.int_thermal_type = THERMAL_TYPE_EXTERNAL;
2297 i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine); 2316 i2c_bus = radeon_lookup_i2c_gpio(rdev, controller->ucI2cLine);
2298 rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus); 2317 rdev->pm.i2c_bus = radeon_i2c_lookup(rdev, &i2c_bus);
2299 if (rdev->pm.i2c_bus) { 2318 if (rdev->pm.i2c_bus) {
diff --git a/drivers/gpu/drm/radeon/radeon_atpx_handler.c b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
index a9fb0d016d38..8bc7d0bbd3c8 100644
--- a/drivers/gpu/drm/radeon/radeon_atpx_handler.c
+++ b/drivers/gpu/drm/radeon/radeon_atpx_handler.c
@@ -33,7 +33,6 @@ static struct radeon_atpx_priv {
33 bool atpx_detected; 33 bool atpx_detected;
34 /* handle for device - and atpx */ 34 /* handle for device - and atpx */
35 acpi_handle dhandle; 35 acpi_handle dhandle;
36 acpi_handle other_handle;
37 struct radeon_atpx atpx; 36 struct radeon_atpx atpx;
38} radeon_atpx_priv; 37} radeon_atpx_priv;
39 38
@@ -453,10 +452,9 @@ static bool radeon_atpx_pci_probe_handle(struct pci_dev *pdev)
453 return false; 452 return false;
454 453
455 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle); 454 status = acpi_get_handle(dhandle, "ATPX", &atpx_handle);
456 if (ACPI_FAILURE(status)) { 455 if (ACPI_FAILURE(status))
457 radeon_atpx_priv.other_handle = dhandle;
458 return false; 456 return false;
459 } 457
460 radeon_atpx_priv.dhandle = dhandle; 458 radeon_atpx_priv.dhandle = dhandle;
461 radeon_atpx_priv.atpx.handle = atpx_handle; 459 radeon_atpx_priv.atpx.handle = atpx_handle;
462 return true; 460 return true;
@@ -540,16 +538,6 @@ static bool radeon_atpx_detect(void)
540 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n", 538 printk(KERN_INFO "VGA switcheroo: detected switching method %s handle\n",
541 acpi_method_name); 539 acpi_method_name);
542 radeon_atpx_priv.atpx_detected = true; 540 radeon_atpx_priv.atpx_detected = true;
543 /*
544 * On some systems hotplug events are generated for the device
545 * being switched off when ATPX is executed. They cause ACPI
546 * hotplug to trigger and attempt to remove the device from
547 * the system, which causes it to break down. Prevent that from
548 * happening by setting the no_hotplug flag for the involved
549 * ACPI device objects.
550 */
551 acpi_bus_no_hotplug(radeon_atpx_priv.dhandle);
552 acpi_bus_no_hotplug(radeon_atpx_priv.other_handle);
553 return true; 541 return true;
554 } 542 }
555 return false; 543 return false;
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 6a219bcee66d..12c8329644c4 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -123,6 +123,10 @@ static struct radeon_px_quirk radeon_px_quirk_list[] = {
123 * https://bugzilla.kernel.org/show_bug.cgi?id=51381 123 * https://bugzilla.kernel.org/show_bug.cgi?id=51381
124 */ 124 */
125 { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX }, 125 { PCI_VENDOR_ID_ATI, 0x6741, 0x1043, 0x108c, RADEON_PX_QUIRK_DISABLE_PX },
126 /* Asus K53TK laptop with AMD A6-3420M APU and Radeon 7670m GPU
127 * https://bugzilla.kernel.org/show_bug.cgi?id=51381
128 */
129 { PCI_VENDOR_ID_ATI, 0x6840, 0x1043, 0x2122, RADEON_PX_QUIRK_DISABLE_PX },
126 /* macbook pro 8.2 */ 130 /* macbook pro 8.2 */
127 { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP }, 131 { PCI_VENDOR_ID_ATI, 0x6741, PCI_VENDOR_ID_APPLE, 0x00e2, RADEON_PX_QUIRK_LONG_WAKEUP },
128 { 0, 0, 0, 0, 0 }, 132 { 0, 0, 0, 0, 0 },
@@ -1393,7 +1397,7 @@ int radeon_device_init(struct radeon_device *rdev,
1393 1397
1394 r = radeon_init(rdev); 1398 r = radeon_init(rdev);
1395 if (r) 1399 if (r)
1396 return r; 1400 goto failed;
1397 1401
1398 r = radeon_ib_ring_tests(rdev); 1402 r = radeon_ib_ring_tests(rdev);
1399 if (r) 1403 if (r)
@@ -1413,7 +1417,7 @@ int radeon_device_init(struct radeon_device *rdev,
1413 radeon_agp_disable(rdev); 1417 radeon_agp_disable(rdev);
1414 r = radeon_init(rdev); 1418 r = radeon_init(rdev);
1415 if (r) 1419 if (r)
1416 return r; 1420 goto failed;
1417 } 1421 }
1418 1422
1419 if ((radeon_testing & 1)) { 1423 if ((radeon_testing & 1)) {
@@ -1435,6 +1439,11 @@ int radeon_device_init(struct radeon_device *rdev,
1435 DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n"); 1439 DRM_INFO("radeon: acceleration disabled, skipping benchmarks\n");
1436 } 1440 }
1437 return 0; 1441 return 0;
1442
1443failed:
1444 if (runtime)
1445 vga_switcheroo_fini_domain_pm_ops(rdev->dev);
1446 return r;
1438} 1447}
1439 1448
1440static void radeon_debugfs_remove_files(struct radeon_device *rdev); 1449static void radeon_debugfs_remove_files(struct radeon_device *rdev);
@@ -1455,6 +1464,8 @@ void radeon_device_fini(struct radeon_device *rdev)
1455 radeon_bo_evict_vram(rdev); 1464 radeon_bo_evict_vram(rdev);
1456 radeon_fini(rdev); 1465 radeon_fini(rdev);
1457 vga_switcheroo_unregister_client(rdev->pdev); 1466 vga_switcheroo_unregister_client(rdev->pdev);
1467 if (rdev->flags & RADEON_IS_PX)
1468 vga_switcheroo_fini_domain_pm_ops(rdev->dev);
1458 vga_client_register(rdev->pdev, NULL, NULL, NULL); 1469 vga_client_register(rdev->pdev, NULL, NULL, NULL);
1459 if (rdev->rio_mem) 1470 if (rdev->rio_mem)
1460 pci_iounmap(rdev->pdev, rdev->rio_mem); 1471 pci_iounmap(rdev->pdev, rdev->rio_mem);
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 8df888908833..f9d17b29b343 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -83,7 +83,7 @@
83 * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG 83 * CIK: 1D and linear tiling modes contain valid PIPE_CONFIG
84 * 2.39.0 - Add INFO query for number of active CUs 84 * 2.39.0 - Add INFO query for number of active CUs
85 * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting 85 * 2.40.0 - Add RADEON_GEM_GTT_WC/UC, flush HDP cache before submitting
86 * CS to GPU 86 * CS to GPU on >= r600
87 */ 87 */
88#define KMS_DRIVER_MAJOR 2 88#define KMS_DRIVER_MAJOR 2
89#define KMS_DRIVER_MINOR 40 89#define KMS_DRIVER_MINOR 40
@@ -181,6 +181,7 @@ int radeon_vm_block_size = -1;
181int radeon_deep_color = 0; 181int radeon_deep_color = 0;
182int radeon_use_pflipirq = 2; 182int radeon_use_pflipirq = 2;
183int radeon_bapm = -1; 183int radeon_bapm = -1;
184int radeon_backlight = -1;
184 185
185MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers"); 186MODULE_PARM_DESC(no_wb, "Disable AGP writeback for scratch registers");
186module_param_named(no_wb, radeon_no_wb, int, 0444); 187module_param_named(no_wb, radeon_no_wb, int, 0444);
@@ -263,6 +264,9 @@ module_param_named(use_pflipirq, radeon_use_pflipirq, int, 0444);
263MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)"); 264MODULE_PARM_DESC(bapm, "BAPM support (1 = enable, 0 = disable, -1 = auto)");
264module_param_named(bapm, radeon_bapm, int, 0444); 265module_param_named(bapm, radeon_bapm, int, 0444);
265 266
267MODULE_PARM_DESC(backlight, "backlight support (1 = enable, 0 = disable, -1 = auto)");
268module_param_named(backlight, radeon_backlight, int, 0444);
269
266static struct pci_device_id pciidlist[] = { 270static struct pci_device_id pciidlist[] = {
267 radeon_PCI_IDS 271 radeon_PCI_IDS
268}; 272};
@@ -440,6 +444,7 @@ static int radeon_pmops_runtime_suspend(struct device *dev)
440 ret = radeon_suspend_kms(drm_dev, false, false); 444 ret = radeon_suspend_kms(drm_dev, false, false);
441 pci_save_state(pdev); 445 pci_save_state(pdev);
442 pci_disable_device(pdev); 446 pci_disable_device(pdev);
447 pci_ignore_hotplug(pdev);
443 pci_set_power_state(pdev, PCI_D3cold); 448 pci_set_power_state(pdev, PCI_D3cold);
444 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF; 449 drm_dev->switch_power_state = DRM_SWITCH_POWER_DYNAMIC_OFF;
445 450
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 3c2094c25b53..15edf23b465c 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -158,10 +158,43 @@ radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device, uint8
158 return ret; 158 return ret;
159} 159}
160 160
161static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder,
162 struct drm_connector *connector)
163{
164 struct drm_device *dev = radeon_encoder->base.dev;
165 struct radeon_device *rdev = dev->dev_private;
166 bool use_bl = false;
167
168 if (!(radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)))
169 return;
170
171 if (radeon_backlight == 0) {
172 return;
173 } else if (radeon_backlight == 1) {
174 use_bl = true;
175 } else if (radeon_backlight == -1) {
176 /* Quirks */
177 /* Amilo Xi 2550 only works with acpi bl */
178 if ((rdev->pdev->device == 0x9583) &&
179 (rdev->pdev->subsystem_vendor == 0x1734) &&
180 (rdev->pdev->subsystem_device == 0x1107))
181 use_bl = false;
182 else
183 use_bl = true;
184 }
185
186 if (use_bl) {
187 if (rdev->is_atom_bios)
188 radeon_atom_backlight_init(radeon_encoder, connector);
189 else
190 radeon_legacy_backlight_init(radeon_encoder, connector);
191 rdev->mode_info.bl_encoder = radeon_encoder;
192 }
193}
194
161void 195void
162radeon_link_encoder_connector(struct drm_device *dev) 196radeon_link_encoder_connector(struct drm_device *dev)
163{ 197{
164 struct radeon_device *rdev = dev->dev_private;
165 struct drm_connector *connector; 198 struct drm_connector *connector;
166 struct radeon_connector *radeon_connector; 199 struct radeon_connector *radeon_connector;
167 struct drm_encoder *encoder; 200 struct drm_encoder *encoder;
@@ -174,13 +207,8 @@ radeon_link_encoder_connector(struct drm_device *dev)
174 radeon_encoder = to_radeon_encoder(encoder); 207 radeon_encoder = to_radeon_encoder(encoder);
175 if (radeon_encoder->devices & radeon_connector->devices) { 208 if (radeon_encoder->devices & radeon_connector->devices) {
176 drm_mode_connector_attach_encoder(connector, encoder); 209 drm_mode_connector_attach_encoder(connector, encoder);
177 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 210 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
178 if (rdev->is_atom_bios) 211 radeon_encoder_add_backlight(radeon_encoder, connector);
179 radeon_atom_backlight_init(radeon_encoder, connector);
180 else
181 radeon_legacy_backlight_init(radeon_encoder, connector);
182 rdev->mode_info.bl_encoder = radeon_encoder;
183 }
184 } 212 }
185 } 213 }
186 } 214 }
diff --git a/drivers/gpu/drm/radeon/radeon_semaphore.c b/drivers/gpu/drm/radeon/radeon_semaphore.c
index 56d9fd66d8ae..abd6753a570a 100644
--- a/drivers/gpu/drm/radeon/radeon_semaphore.c
+++ b/drivers/gpu/drm/radeon/radeon_semaphore.c
@@ -34,7 +34,7 @@
34int radeon_semaphore_create(struct radeon_device *rdev, 34int radeon_semaphore_create(struct radeon_device *rdev,
35 struct radeon_semaphore **semaphore) 35 struct radeon_semaphore **semaphore)
36{ 36{
37 uint32_t *cpu_addr; 37 uint64_t *cpu_addr;
38 int i, r; 38 int i, r;
39 39
40 *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL); 40 *semaphore = kmalloc(sizeof(struct radeon_semaphore), GFP_KERNEL);
diff --git a/drivers/gpu/drm/radeon/rs400.c b/drivers/gpu/drm/radeon/rs400.c
index 6c1fc339d228..c5799f16aa4b 100644
--- a/drivers/gpu/drm/radeon/rs400.c
+++ b/drivers/gpu/drm/radeon/rs400.c
@@ -221,9 +221,9 @@ void rs400_gart_set_page(struct radeon_device *rdev, unsigned i,
221 entry = (lower_32_bits(addr) & PAGE_MASK) | 221 entry = (lower_32_bits(addr) & PAGE_MASK) |
222 ((upper_32_bits(addr) & 0xff) << 4); 222 ((upper_32_bits(addr) & 0xff) << 4);
223 if (flags & RADEON_GART_PAGE_READ) 223 if (flags & RADEON_GART_PAGE_READ)
224 addr |= RS400_PTE_READABLE; 224 entry |= RS400_PTE_READABLE;
225 if (flags & RADEON_GART_PAGE_WRITE) 225 if (flags & RADEON_GART_PAGE_WRITE)
226 addr |= RS400_PTE_WRITEABLE; 226 entry |= RS400_PTE_WRITEABLE;
227 if (!(flags & RADEON_GART_PAGE_SNOOP)) 227 if (!(flags & RADEON_GART_PAGE_SNOOP))
228 entry |= RS400_PTE_UNSNOOPED; 228 entry |= RS400_PTE_UNSNOOPED;
229 entry = cpu_to_le32(entry); 229 entry = cpu_to_le32(entry);
diff --git a/drivers/gpu/drm/radeon/si.c b/drivers/gpu/drm/radeon/si.c
index 6bce40847753..3a0b973e8a96 100644
--- a/drivers/gpu/drm/radeon/si.c
+++ b/drivers/gpu/drm/radeon/si.c
@@ -6316,17 +6316,17 @@ static inline u32 si_get_ih_wptr(struct radeon_device *rdev)
6316 wptr = RREG32(IH_RB_WPTR); 6316 wptr = RREG32(IH_RB_WPTR);
6317 6317
6318 if (wptr & RB_OVERFLOW) { 6318 if (wptr & RB_OVERFLOW) {
6319 wptr &= ~RB_OVERFLOW;
6319 /* When a ring buffer overflow happen start parsing interrupt 6320 /* When a ring buffer overflow happen start parsing interrupt
6320 * from the last not overwritten vector (wptr + 16). Hopefully 6321 * from the last not overwritten vector (wptr + 16). Hopefully
6321 * this should allow us to catchup. 6322 * this should allow us to catchup.
6322 */ 6323 */
6323 dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, %d, %d)\n", 6324 dev_warn(rdev->dev, "IH ring buffer overflow (0x%08X, 0x%08X, 0x%08X)\n",
6324 wptr, rdev->ih.rptr, (wptr + 16) + rdev->ih.ptr_mask); 6325 wptr, rdev->ih.rptr, (wptr + 16) & rdev->ih.ptr_mask);
6325 rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask; 6326 rdev->ih.rptr = (wptr + 16) & rdev->ih.ptr_mask;
6326 tmp = RREG32(IH_RB_CNTL); 6327 tmp = RREG32(IH_RB_CNTL);
6327 tmp |= IH_WPTR_OVERFLOW_CLEAR; 6328 tmp |= IH_WPTR_OVERFLOW_CLEAR;
6328 WREG32(IH_RB_CNTL, tmp); 6329 WREG32(IH_RB_CNTL, tmp);
6329 wptr &= ~RB_OVERFLOW;
6330 } 6330 }
6331 return (wptr & rdev->ih.ptr_mask); 6331 return (wptr & rdev->ih.ptr_mask);
6332} 6332}
@@ -6664,13 +6664,13 @@ restart_ih:
6664 /* wptr/rptr are in bytes! */ 6664 /* wptr/rptr are in bytes! */
6665 rptr += 16; 6665 rptr += 16;
6666 rptr &= rdev->ih.ptr_mask; 6666 rptr &= rdev->ih.ptr_mask;
6667 WREG32(IH_RB_RPTR, rptr);
6667 } 6668 }
6668 if (queue_hotplug) 6669 if (queue_hotplug)
6669 schedule_work(&rdev->hotplug_work); 6670 schedule_work(&rdev->hotplug_work);
6670 if (queue_thermal && rdev->pm.dpm_enabled) 6671 if (queue_thermal && rdev->pm.dpm_enabled)
6671 schedule_work(&rdev->pm.dpm.thermal.work); 6672 schedule_work(&rdev->pm.dpm.thermal.work);
6672 rdev->ih.rptr = rptr; 6673 rdev->ih.rptr = rptr;
6673 WREG32(IH_RB_RPTR, rdev->ih.rptr);
6674 atomic_set(&rdev->ih.lock, 0); 6674 atomic_set(&rdev->ih.lock, 0);
6675 6675
6676 /* make sure wptr hasn't changed while processing */ 6676 /* make sure wptr hasn't changed while processing */