diff options
author | Yang Zhao <yang@yangman.ca> | 2009-09-14 22:21:01 -0400 |
---|---|---|
committer | Dave Airlie <airlied@linux.ie> | 2009-09-15 20:21:35 -0400 |
commit | f657c2a7310ad56e2b67f35f4c5c6106a7146b9c (patch) | |
tree | ae1d2b409de5a472842de2decf5965658aac0c82 /drivers/gpu/drm | |
parent | ecb114a128d150422d22eda238cb812f6b20bf39 (diff) |
drm/radeon: Save and restore bios scratch regs during S/R
[airlied:- adapted slightly in naming]
Signed-off-by: Yang Zhao <yang@yangman.ca>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_atombios.c | 28 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_device.c | 3 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 2 |
4 files changed, 35 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index ff9e4171559a..5bfc05612ac2 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -75,6 +75,7 @@ extern int radeon_tv; | |||
75 | #define RADEON_IB_POOL_SIZE 16 | 75 | #define RADEON_IB_POOL_SIZE 16 |
76 | #define RADEON_DEBUGFS_MAX_NUM_FILES 32 | 76 | #define RADEON_DEBUGFS_MAX_NUM_FILES 32 |
77 | #define RADEONFB_CONN_LIMIT 4 | 77 | #define RADEONFB_CONN_LIMIT 4 |
78 | #define RADEON_BIOS_NUM_SCRATCH 8 | ||
78 | 79 | ||
79 | enum radeon_family { | 80 | enum radeon_family { |
80 | CHIP_R100, | 81 | CHIP_R100, |
@@ -783,6 +784,7 @@ struct radeon_device { | |||
783 | struct radeon_asic *asic; | 784 | struct radeon_asic *asic; |
784 | struct radeon_gem gem; | 785 | struct radeon_gem gem; |
785 | struct radeon_pm pm; | 786 | struct radeon_pm pm; |
787 | uint32_t bios_scratch[RADEON_BIOS_NUM_SCRATCH]; | ||
786 | struct mutex cs_mutex; | 788 | struct mutex cs_mutex; |
787 | struct radeon_wb wb; | 789 | struct radeon_wb wb; |
788 | struct radeon_dummy_page dummy_page; | 790 | struct radeon_dummy_page dummy_page; |
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index aa756dec8959..cb5efcaf2bab 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -1045,6 +1045,34 @@ void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev) | |||
1045 | 1045 | ||
1046 | } | 1046 | } |
1047 | 1047 | ||
1048 | void radeon_save_bios_scratch_regs(struct radeon_device *rdev) | ||
1049 | { | ||
1050 | uint32_t scratch_reg; | ||
1051 | int i; | ||
1052 | |||
1053 | if (rdev->family >= CHIP_R600) | ||
1054 | scratch_reg = R600_BIOS_0_SCRATCH; | ||
1055 | else | ||
1056 | scratch_reg = RADEON_BIOS_0_SCRATCH; | ||
1057 | |||
1058 | for (i = 0; i < RADEON_BIOS_NUM_SCRATCH; i++) | ||
1059 | rdev->bios_scratch[i] = RREG32(scratch_reg + (i * 4)); | ||
1060 | } | ||
1061 | |||
1062 | void radeon_restore_bios_scratch_regs(struct radeon_device *rdev) | ||
1063 | { | ||
1064 | uint32_t scratch_reg; | ||
1065 | int i; | ||
1066 | |||
1067 | if (rdev->family >= CHIP_R600) | ||
1068 | scratch_reg = R600_BIOS_0_SCRATCH; | ||
1069 | else | ||
1070 | scratch_reg = RADEON_BIOS_0_SCRATCH; | ||
1071 | |||
1072 | for (i = 0; i < RADEON_BIOS_NUM_SCRATCH; i++) | ||
1073 | WREG32(scratch_reg + (i * 4), rdev->bios_scratch[i]); | ||
1074 | } | ||
1075 | |||
1048 | void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock) | 1076 | void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock) |
1049 | { | 1077 | { |
1050 | struct drm_device *dev = encoder->dev; | 1078 | struct drm_device *dev = encoder->dev; |
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index cc8e005c1b30..db5ae73d6289 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c | |||
@@ -755,6 +755,8 @@ int radeon_suspend_kms(struct drm_device *dev, pm_message_t state) | |||
755 | /* wait for gpu to finish processing current batch */ | 755 | /* wait for gpu to finish processing current batch */ |
756 | radeon_fence_wait_last(rdev); | 756 | radeon_fence_wait_last(rdev); |
757 | 757 | ||
758 | radeon_save_bios_scratch_regs(rdev); | ||
759 | |||
758 | if (!rdev->new_init_path) { | 760 | if (!rdev->new_init_path) { |
759 | radeon_cp_disable(rdev); | 761 | radeon_cp_disable(rdev); |
760 | radeon_gart_disable(rdev); | 762 | radeon_gart_disable(rdev); |
@@ -828,6 +830,7 @@ int radeon_resume_kms(struct drm_device *dev) | |||
828 | radeon_resume(rdev); | 830 | radeon_resume(rdev); |
829 | } | 831 | } |
830 | out: | 832 | out: |
833 | radeon_restore_bios_scratch_regs(rdev); | ||
831 | fb_set_suspend(rdev->fbdev_info, 0); | 834 | fb_set_suspend(rdev->fbdev_info, 0); |
832 | release_console_sem(); | 835 | release_console_sem(); |
833 | 836 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 523d6cbd4f08..dde13817dee0 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -383,6 +383,8 @@ extern void radeon_combios_output_lock(struct drm_encoder *encoder, bool lock); | |||
383 | extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev); | 383 | extern void radeon_combios_initialize_bios_scratch_regs(struct drm_device *dev); |
384 | extern void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock); | 384 | extern void radeon_atom_output_lock(struct drm_encoder *encoder, bool lock); |
385 | extern void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev); | 385 | extern void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev); |
386 | extern void radeon_save_bios_scratch_regs(struct radeon_device *rdev); | ||
387 | extern void radeon_restore_bios_scratch_regs(struct radeon_device *rdev); | ||
386 | extern void | 388 | extern void |
387 | radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc); | 389 | radeon_atombios_encoder_crtc_scratch_regs(struct drm_encoder *encoder, int crtc); |
388 | extern void | 390 | extern void |