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/radeon_atombios.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c50
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_cp.c1
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c5
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c9
-rw-r--r--drivers/gpu/drm/radeon/radeon_irq.c10
-rw-r--r--drivers/gpu/drm/radeon/rs600.c2
9 files changed, 63 insertions, 24 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 321044bef71c..41dd8ebff219 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -114,6 +114,7 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_dev
114 i2c.i2c_id = gpio->sucI2cId.ucAccess; 114 i2c.i2c_id = gpio->sucI2cId.ucAccess;
115 115
116 i2c.valid = true; 116 i2c.valid = true;
117 break;
117 } 118 }
118 } 119 }
119 120
@@ -1026,6 +1027,7 @@ static struct radeon_atom_ss *radeon_atombios_get_ss_info(struct
1026 ss->delay = ss_info->asSS_Info[i].ucSS_Delay; 1027 ss->delay = ss_info->asSS_Info[i].ucSS_Delay;
1027 ss->range = ss_info->asSS_Info[i].ucSS_Range; 1028 ss->range = ss_info->asSS_Info[i].ucSS_Range;
1028 ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div; 1029 ss->refdiv = ss_info->asSS_Info[i].ucRecommendedRef_Div;
1030 break;
1029 } 1031 }
1030 } 1032 }
1031 } 1033 }
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index fd94dbca33ac..58f342659cc7 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -595,6 +595,34 @@ bool radeon_combios_get_clock_info(struct drm_device *dev)
595 return false; 595 return false;
596} 596}
597 597
598static const uint32_t default_primarydac_adj[CHIP_LAST] = {
599 0x00000808, /* r100 */
600 0x00000808, /* rv100 */
601 0x00000808, /* rs100 */
602 0x00000808, /* rv200 */
603 0x00000808, /* rs200 */
604 0x00000808, /* r200 */
605 0x00000808, /* rv250 */
606 0x00000000, /* rs300 */
607 0x00000808, /* rv280 */
608 0x00000808, /* r300 */
609 0x00000808, /* r350 */
610 0x00000808, /* rv350 */
611 0x00000808, /* rv380 */
612 0x00000808, /* r420 */
613 0x00000808, /* r423 */
614 0x00000808, /* rv410 */
615 0x00000000, /* rs400 */
616 0x00000000, /* rs480 */
617};
618
619static void radeon_legacy_get_primary_dac_info_from_table(struct radeon_device *rdev,
620 struct radeon_encoder_primary_dac *p_dac)
621{
622 p_dac->ps2_pdac_adj = default_primarydac_adj[rdev->family];
623 return;
624}
625
598struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct 626struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
599 radeon_encoder 627 radeon_encoder
600 *encoder) 628 *encoder)
@@ -604,20 +632,20 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
604 uint16_t dac_info; 632 uint16_t dac_info;
605 uint8_t rev, bg, dac; 633 uint8_t rev, bg, dac;
606 struct radeon_encoder_primary_dac *p_dac = NULL; 634 struct radeon_encoder_primary_dac *p_dac = NULL;
635 int found = 0;
607 636
608 if (rdev->bios == NULL) 637 p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac),
638 GFP_KERNEL);
639
640 if (!p_dac)
609 return NULL; 641 return NULL;
610 642
643 if (rdev->bios == NULL)
644 goto out;
645
611 /* check CRT table */ 646 /* check CRT table */
612 dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); 647 dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE);
613 if (dac_info) { 648 if (dac_info) {
614 p_dac =
615 kzalloc(sizeof(struct radeon_encoder_primary_dac),
616 GFP_KERNEL);
617
618 if (!p_dac)
619 return NULL;
620
621 rev = RBIOS8(dac_info) & 0x3; 649 rev = RBIOS8(dac_info) & 0x3;
622 if (rev < 2) { 650 if (rev < 2) {
623 bg = RBIOS8(dac_info + 0x2) & 0xf; 651 bg = RBIOS8(dac_info + 0x2) & 0xf;
@@ -628,9 +656,13 @@ struct radeon_encoder_primary_dac *radeon_combios_get_primary_dac_info(struct
628 dac = RBIOS8(dac_info + 0x3) & 0xf; 656 dac = RBIOS8(dac_info + 0x3) & 0xf;
629 p_dac->ps2_pdac_adj = (bg << 8) | (dac); 657 p_dac->ps2_pdac_adj = (bg << 8) | (dac);
630 } 658 }
631 659 found = 1;
632 } 660 }
633 661
662out:
663 if (!found) /* fallback to defaults */
664 radeon_legacy_get_primary_dac_info_from_table(rdev, p_dac);
665
634 return p_dac; 666 return p_dac;
635} 667}
636 668
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 20161567dbff..b82ae61d4d17 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -615,7 +615,7 @@ static enum drm_connector_status radeon_vga_detect(struct drm_connector *connect
615 ret = connector_status_connected; 615 ret = connector_status_connected;
616 } 616 }
617 } else { 617 } else {
618 if (radeon_connector->dac_load_detect) { 618 if (radeon_connector->dac_load_detect && encoder) {
619 encoder_funcs = encoder->helper_private; 619 encoder_funcs = encoder->helper_private;
620 ret = encoder_funcs->detect(encoder, connector); 620 ret = encoder_funcs->detect(encoder, connector);
621 } 621 }
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index 0b2f9c2ad2c1..06123ba31d31 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -2145,6 +2145,7 @@ int radeon_master_create(struct drm_device *dev, struct drm_master *master)
2145 &master_priv->sarea); 2145 &master_priv->sarea);
2146 if (ret) { 2146 if (ret) {
2147 DRM_ERROR("SAREA setup failed\n"); 2147 DRM_ERROR("SAREA setup failed\n");
2148 kfree(master_priv);
2148 return ret; 2149 return ret;
2149 } 2150 }
2150 master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea); 2151 master_priv->sarea_priv = master_priv->sarea->handle + sizeof(struct drm_sarea);
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index 7c6848096bcd..0c51f8e46613 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -733,16 +733,18 @@ void radeon_device_fini(struct radeon_device *rdev)
733 */ 733 */
734int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) 734int radeon_suspend_kms(struct drm_device *dev, pm_message_t state)
735{ 735{
736 struct radeon_device *rdev = dev->dev_private; 736 struct radeon_device *rdev;
737 struct drm_crtc *crtc; 737 struct drm_crtc *crtc;
738 int r; 738 int r;
739 739
740 if (dev == NULL || rdev == NULL) { 740 if (dev == NULL || dev->dev_private == NULL) {
741 return -ENODEV; 741 return -ENODEV;
742 } 742 }
743 if (state.event == PM_EVENT_PRETHAW) { 743 if (state.event == PM_EVENT_PRETHAW) {
744 return 0; 744 return 0;
745 } 745 }
746 rdev = dev->dev_private;
747
746 /* unpin the front buffers */ 748 /* unpin the front buffers */
747 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { 749 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
748 struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb); 750 struct radeon_framebuffer *rfb = to_radeon_framebuffer(crtc->fb);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 91d72b70abc9..1fb2f029d7e8 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -329,8 +329,11 @@ static bool radeon_setup_enc_conn(struct drm_device *dev)
329 ret = radeon_get_atom_connector_info_from_object_table(dev); 329 ret = radeon_get_atom_connector_info_from_object_table(dev);
330 else 330 else
331 ret = radeon_get_atom_connector_info_from_supported_devices_table(dev); 331 ret = radeon_get_atom_connector_info_from_supported_devices_table(dev);
332 } else 332 } else {
333 ret = radeon_get_legacy_connector_info_from_bios(dev); 333 ret = radeon_get_legacy_connector_info_from_bios(dev);
334 if (ret == false)
335 ret = radeon_get_legacy_connector_info_from_table(dev);
336 }
334 } else { 337 } else {
335 if (!ASIC_IS_AVIVO(rdev)) 338 if (!ASIC_IS_AVIVO(rdev))
336 ret = radeon_get_legacy_connector_info_from_table(dev); 339 ret = radeon_get_legacy_connector_info_from_table(dev);
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index 4cdd8b4f7549..8495d4e32e18 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -140,16 +140,15 @@ int radeon_fence_create(struct radeon_device *rdev, struct radeon_fence **fence)
140 140
141bool radeon_fence_signaled(struct radeon_fence *fence) 141bool radeon_fence_signaled(struct radeon_fence *fence)
142{ 142{
143 struct radeon_device *rdev = fence->rdev;
144 unsigned long irq_flags; 143 unsigned long irq_flags;
145 bool signaled = false; 144 bool signaled = false;
146 145
147 if (rdev->gpu_lockup) { 146 if (!fence)
148 return true; 147 return true;
149 } 148
150 if (fence == NULL) { 149 if (fence->rdev->gpu_lockup)
151 return true; 150 return true;
152 } 151
153 write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags); 152 write_lock_irqsave(&fence->rdev->fence_drv.lock, irq_flags);
154 signaled = fence->signaled; 153 signaled = fence->signaled;
155 /* if we are shuting down report all fence as signaled */ 154 /* if we are shuting down report all fence as signaled */
diff --git a/drivers/gpu/drm/radeon/radeon_irq.c b/drivers/gpu/drm/radeon/radeon_irq.c
index b79ecc4a7cc4..2f349a300195 100644
--- a/drivers/gpu/drm/radeon/radeon_irq.c
+++ b/drivers/gpu/drm/radeon/radeon_irq.c
@@ -289,16 +289,16 @@ int radeon_irq_emit(struct drm_device *dev, void *data, struct drm_file *file_pr
289 drm_radeon_irq_emit_t *emit = data; 289 drm_radeon_irq_emit_t *emit = data;
290 int result; 290 int result;
291 291
292 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
293 return -EINVAL;
294
295 LOCK_TEST_WITH_RETURN(dev, file_priv);
296
297 if (!dev_priv) { 292 if (!dev_priv) {
298 DRM_ERROR("called with no initialization\n"); 293 DRM_ERROR("called with no initialization\n");
299 return -EINVAL; 294 return -EINVAL;
300 } 295 }
301 296
297 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
298 return -EINVAL;
299
300 LOCK_TEST_WITH_RETURN(dev, file_priv);
301
302 result = radeon_emit_irq(dev); 302 result = radeon_emit_irq(dev);
303 303
304 if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) { 304 if (DRM_COPY_TO_USER(emit->irq_seq, &result, sizeof(int))) {
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 4f8ea4260572..4245218e954f 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -396,7 +396,7 @@ int rs600_irq_process(struct radeon_device *rdev)
396 } 396 }
397 while (status || r500_disp_int) { 397 while (status || r500_disp_int) {
398 /* SW interrupt */ 398 /* SW interrupt */
399 if (G_000040_SW_INT_EN(status)) 399 if (G_000044_SW_INT(status))
400 radeon_fence_process(rdev); 400 radeon_fence_process(rdev);
401 /* Vertical blank interrupts */ 401 /* Vertical blank interrupts */
402 if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int)) 402 if (G_007EDC_LB_D1_VBLANK_INTERRUPT(r500_disp_int))