aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2011-04-26 04:22:15 -0400
committerJiri Kosina <jkosina@suse.cz>2011-04-26 04:22:59 -0400
commit07f9479a40cc778bc1462ada11f95b01360ae4ff (patch)
tree0676cf38df3844004bb3ebfd99dfa67a4a8998f5 /drivers/gpu/drm/radeon
parent9d5e6bdb3013acfb311ab407eeca0b6a6a3dedbf (diff)
parentcd2e49e90f1cae7726c9a2c54488d881d7f1cd1c (diff)
Merge branch 'master' into for-next
Fast-forwarded to current state of Linus' tree as there are patches to be applied for files that didn't exist on the old branch.
Diffstat (limited to 'drivers/gpu/drm/radeon')
-rw-r--r--drivers/gpu/drm/radeon/Kconfig1
-rw-r--r--drivers/gpu/drm/radeon/atom.c12
-rw-r--r--drivers/gpu/drm/radeon/atombios.h34
-rw-r--r--drivers/gpu/drm/radeon/atombios_crtc.c30
-rw-r--r--drivers/gpu/drm/radeon/evergreen.c119
-rw-r--r--drivers/gpu/drm/radeon/evergreen_cs.c2
-rw-r--r--drivers/gpu/drm/radeon/r300.c2
-rw-r--r--drivers/gpu/drm/radeon/r300_reg.h4
-rw-r--r--drivers/gpu/drm/radeon/r600.c8
-rw-r--r--drivers/gpu/drm/radeon/r600_cs.c2
-rw-r--r--drivers/gpu/drm/radeon/r600_hdmi.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon.h16
-rw-r--r--drivers/gpu/drm/radeon/radeon_asic.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c43
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c34
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c72
-rw-r--r--drivers/gpu/drm/radeon/radeon_cp.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_cursor.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_device.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_drv.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_fence.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_gart.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_i2c.c10
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_crtc.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_legacy_encoders.c257
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h7
-rw-r--r--drivers/gpu/drm/radeon/radeon_object.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_pm.c19
-rw-r--r--drivers/gpu/drm/radeon/radeon_ring.c2
-rw-r--r--drivers/gpu/drm/radeon/radeon_state.c2
-rw-r--r--drivers/gpu/drm/radeon/rs600.c13
-rw-r--r--drivers/gpu/drm/radeon/rv770.c6
33 files changed, 530 insertions, 187 deletions
diff --git a/drivers/gpu/drm/radeon/Kconfig b/drivers/gpu/drm/radeon/Kconfig
index 1c02d23f6fc..9746fee59f5 100644
--- a/drivers/gpu/drm/radeon/Kconfig
+++ b/drivers/gpu/drm/radeon/Kconfig
@@ -1,6 +1,7 @@
1config DRM_RADEON_KMS 1config DRM_RADEON_KMS
2 bool "Enable modesetting on radeon by default - NEW DRIVER" 2 bool "Enable modesetting on radeon by default - NEW DRIVER"
3 depends on DRM_RADEON 3 depends on DRM_RADEON
4 select BACKLIGHT_CLASS_DEVICE
4 help 5 help
5 Choose this option if you want kernel modesetting enabled by default. 6 Choose this option if you want kernel modesetting enabled by default.
6 7
diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c
index 258fa5e7a2d..7bd74568909 100644
--- a/drivers/gpu/drm/radeon/atom.c
+++ b/drivers/gpu/drm/radeon/atom.c
@@ -32,6 +32,7 @@
32#include "atom.h" 32#include "atom.h"
33#include "atom-names.h" 33#include "atom-names.h"
34#include "atom-bits.h" 34#include "atom-bits.h"
35#include "radeon.h"
35 36
36#define ATOM_COND_ABOVE 0 37#define ATOM_COND_ABOVE 0
37#define ATOM_COND_ABOVEOREQUAL 1 38#define ATOM_COND_ABOVEOREQUAL 1
@@ -101,7 +102,9 @@ static void debug_print_spaces(int n)
101static uint32_t atom_iio_execute(struct atom_context *ctx, int base, 102static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
102 uint32_t index, uint32_t data) 103 uint32_t index, uint32_t data)
103{ 104{
105 struct radeon_device *rdev = ctx->card->dev->dev_private;
104 uint32_t temp = 0xCDCDCDCD; 106 uint32_t temp = 0xCDCDCDCD;
107
105 while (1) 108 while (1)
106 switch (CU8(base)) { 109 switch (CU8(base)) {
107 case ATOM_IIO_NOP: 110 case ATOM_IIO_NOP:
@@ -112,7 +115,8 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
112 base += 3; 115 base += 3;
113 break; 116 break;
114 case ATOM_IIO_WRITE: 117 case ATOM_IIO_WRITE:
115 (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1)); 118 if (rdev->family == CHIP_RV515)
119 (void)ctx->card->ioreg_read(ctx->card, CU16(base + 1));
116 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp); 120 ctx->card->ioreg_write(ctx->card, CU16(base + 1), temp);
117 base += 3; 121 base += 3;
118 break; 122 break;
@@ -131,7 +135,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
131 case ATOM_IIO_MOVE_INDEX: 135 case ATOM_IIO_MOVE_INDEX:
132 temp &= 136 temp &=
133 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << 137 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
134 CU8(base + 2)); 138 CU8(base + 3));
135 temp |= 139 temp |=
136 ((index >> CU8(base + 2)) & 140 ((index >> CU8(base + 2)) &
137 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 141 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
@@ -141,7 +145,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
141 case ATOM_IIO_MOVE_DATA: 145 case ATOM_IIO_MOVE_DATA:
142 temp &= 146 temp &=
143 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << 147 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
144 CU8(base + 2)); 148 CU8(base + 3));
145 temp |= 149 temp |=
146 ((data >> CU8(base + 2)) & 150 ((data >> CU8(base + 2)) &
147 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base + 151 (0xFFFFFFFF >> (32 - CU8(base + 1)))) << CU8(base +
@@ -151,7 +155,7 @@ static uint32_t atom_iio_execute(struct atom_context *ctx, int base,
151 case ATOM_IIO_MOVE_ATTR: 155 case ATOM_IIO_MOVE_ATTR:
152 temp &= 156 temp &=
153 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) << 157 ~((0xFFFFFFFF >> (32 - CU8(base + 1))) <<
154 CU8(base + 2)); 158 CU8(base + 3));
155 temp |= 159 temp |=
156 ((ctx-> 160 ((ctx->
157 io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 - 161 io_attr >> CU8(base + 2)) & (0xFFFFFFFF >> (32 -
diff --git a/drivers/gpu/drm/radeon/atombios.h b/drivers/gpu/drm/radeon/atombios.h
index 04b269d14a5..7fd88497b93 100644
--- a/drivers/gpu/drm/radeon/atombios.h
+++ b/drivers/gpu/drm/radeon/atombios.h
@@ -738,13 +738,13 @@ typedef struct _ATOM_DIG_ENCODER_CONFIG_V3
738{ 738{
739#if ATOM_BIG_ENDIAN 739#if ATOM_BIG_ENDIAN
740 UCHAR ucReserved1:1; 740 UCHAR ucReserved1:1;
741 UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also refered as DIGA/B/C/D/E/F) 741 UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F)
742 UCHAR ucReserved:3; 742 UCHAR ucReserved:3;
743 UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz 743 UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz
744#else 744#else
745 UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz 745 UCHAR ucDPLinkRate:1; // =0: 1.62Ghz, =1: 2.7Ghz
746 UCHAR ucReserved:3; 746 UCHAR ucReserved:3;
747 UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also refered as DIGA/B/C/D/E/F) 747 UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F)
748 UCHAR ucReserved1:1; 748 UCHAR ucReserved1:1;
749#endif 749#endif
750}ATOM_DIG_ENCODER_CONFIG_V3; 750}ATOM_DIG_ENCODER_CONFIG_V3;
@@ -785,13 +785,13 @@ typedef struct _ATOM_DIG_ENCODER_CONFIG_V4
785{ 785{
786#if ATOM_BIG_ENDIAN 786#if ATOM_BIG_ENDIAN
787 UCHAR ucReserved1:1; 787 UCHAR ucReserved1:1;
788 UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also refered as DIGA/B/C/D/E/F) 788 UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F)
789 UCHAR ucReserved:2; 789 UCHAR ucReserved:2;
790 UCHAR ucDPLinkRate:2; // =0: 1.62Ghz, =1: 2.7Ghz, 2=5.4Ghz <= Changed comparing to previous version 790 UCHAR ucDPLinkRate:2; // =0: 1.62Ghz, =1: 2.7Ghz, 2=5.4Ghz <= Changed comparing to previous version
791#else 791#else
792 UCHAR ucDPLinkRate:2; // =0: 1.62Ghz, =1: 2.7Ghz, 2=5.4Ghz <= Changed comparing to previous version 792 UCHAR ucDPLinkRate:2; // =0: 1.62Ghz, =1: 2.7Ghz, 2=5.4Ghz <= Changed comparing to previous version
793 UCHAR ucReserved:2; 793 UCHAR ucReserved:2;
794 UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also refered as DIGA/B/C/D/E/F) 794 UCHAR ucDigSel:3; // =0/1/2/3/4/5: DIG0/1/2/3/4/5 (In register spec also referred as DIGA/B/C/D/E/F)
795 UCHAR ucReserved1:1; 795 UCHAR ucReserved1:1;
796#endif 796#endif
797}ATOM_DIG_ENCODER_CONFIG_V4; 797}ATOM_DIG_ENCODER_CONFIG_V4;
@@ -2126,7 +2126,7 @@ typedef struct _ATOM_MULTIMEDIA_CONFIG_INFO
2126// Structures used in FirmwareInfoTable 2126// Structures used in FirmwareInfoTable
2127/****************************************************************************/ 2127/****************************************************************************/
2128 2128
2129// usBIOSCapability Defintion: 2129// usBIOSCapability Definition:
2130// Bit 0 = 0: Bios image is not Posted, =1:Bios image is Posted; 2130// Bit 0 = 0: Bios image is not Posted, =1:Bios image is Posted;
2131// Bit 1 = 0: Dual CRTC is not supported, =1: Dual CRTC is supported; 2131// Bit 1 = 0: Dual CRTC is not supported, =1: Dual CRTC is supported;
2132// Bit 2 = 0: Extended Desktop is not supported, =1: Extended Desktop is supported; 2132// Bit 2 = 0: Extended Desktop is not supported, =1: Extended Desktop is supported;
@@ -3341,7 +3341,7 @@ typedef struct _ATOM_SPREAD_SPECTRUM_INFO
3341/****************************************************************************/ 3341/****************************************************************************/
3342// Structure used in AnalogTV_InfoTable (Top level) 3342// Structure used in AnalogTV_InfoTable (Top level)
3343/****************************************************************************/ 3343/****************************************************************************/
3344//ucTVBootUpDefaultStd definiton: 3344//ucTVBootUpDefaultStd definition:
3345 3345
3346//ATOM_TV_NTSC 1 3346//ATOM_TV_NTSC 1
3347//ATOM_TV_NTSCJ 2 3347//ATOM_TV_NTSCJ 2
@@ -3816,7 +3816,7 @@ typedef struct _ATOM_EXTERNAL_DISPLAY_CONNECTION_INFO
3816 UCHAR Reserved [6]; // for potential expansion 3816 UCHAR Reserved [6]; // for potential expansion
3817}ATOM_EXTERNAL_DISPLAY_CONNECTION_INFO; 3817}ATOM_EXTERNAL_DISPLAY_CONNECTION_INFO;
3818 3818
3819//Related definitions, all records are differnt but they have a commond header 3819//Related definitions, all records are different but they have a commond header
3820typedef struct _ATOM_COMMON_RECORD_HEADER 3820typedef struct _ATOM_COMMON_RECORD_HEADER
3821{ 3821{
3822 UCHAR ucRecordType; //An emun to indicate the record type 3822 UCHAR ucRecordType; //An emun to indicate the record type
@@ -4365,14 +4365,14 @@ ucUMAChannelNumber: System memory channel numbers.
4365ulCSR_M3_ARB_CNTL_DEFAULT[10]: Arrays with values for CSR M3 arbiter for default 4365ulCSR_M3_ARB_CNTL_DEFAULT[10]: Arrays with values for CSR M3 arbiter for default
4366ulCSR_M3_ARB_CNTL_UVD[10]: Arrays with values for CSR M3 arbiter for UVD playback. 4366ulCSR_M3_ARB_CNTL_UVD[10]: Arrays with values for CSR M3 arbiter for UVD playback.
4367ulCSR_M3_ARB_CNTL_FS3D[10]: Arrays with values for CSR M3 arbiter for Full Screen 3D applications. 4367ulCSR_M3_ARB_CNTL_FS3D[10]: Arrays with values for CSR M3 arbiter for Full Screen 3D applications.
4368sAvail_SCLK[5]: Arrays to provide availabe list of SLCK and corresponding voltage, order from low to high 4368sAvail_SCLK[5]: Arrays to provide available list of SLCK and corresponding voltage, order from low to high
4369ulGMCRestoreResetTime: GMC power restore and GMC reset time to calculate data reconnection latency. Unit in ns. 4369ulGMCRestoreResetTime: GMC power restore and GMC reset time to calculate data reconnection latency. Unit in ns.
4370ulMinimumNClk: Minimum NCLK speed among all NB-Pstates to calcualte data reconnection latency. Unit in 10kHz. 4370ulMinimumNClk: Minimum NCLK speed among all NB-Pstates to calcualte data reconnection latency. Unit in 10kHz.
4371ulIdleNClk: NCLK speed while memory runs in self-refresh state. Unit in 10kHz. 4371ulIdleNClk: NCLK speed while memory runs in self-refresh state. Unit in 10kHz.
4372ulDDR_DLL_PowerUpTime: DDR PHY DLL power up time. Unit in ns. 4372ulDDR_DLL_PowerUpTime: DDR PHY DLL power up time. Unit in ns.
4373ulDDR_PLL_PowerUpTime: DDR PHY PLL power up time. Unit in ns. 4373ulDDR_PLL_PowerUpTime: DDR PHY PLL power up time. Unit in ns.
4374usPCIEClkSSPercentage: PCIE Clock Spred Spectrum Percentage in unit 0.01%; 100 mean 1%. 4374usPCIEClkSSPercentage: PCIE Clock Spread Spectrum Percentage in unit 0.01%; 100 mean 1%.
4375usPCIEClkSSType: PCIE Clock Spred Spectrum Type. 0 for Down spread(default); 1 for Center spread. 4375usPCIEClkSSType: PCIE Clock Spread Spectrum Type. 0 for Down spread(default); 1 for Center spread.
4376usLvdsSSPercentage: LVDS panel ( not include eDP ) Spread Spectrum Percentage in unit of 0.01%, =0, use VBIOS default setting. 4376usLvdsSSPercentage: LVDS panel ( not include eDP ) Spread Spectrum Percentage in unit of 0.01%, =0, use VBIOS default setting.
4377usLvdsSSpreadRateIn10Hz: LVDS panel ( not include eDP ) Spread Spectrum frequency in unit of 10Hz, =0, use VBIOS default setting. 4377usLvdsSSpreadRateIn10Hz: LVDS panel ( not include eDP ) Spread Spectrum frequency in unit of 10Hz, =0, use VBIOS default setting.
4378usHDMISSPercentage: HDMI Spread Spectrum Percentage in unit 0.01%; 100 mean 1%, =0, use VBIOS default setting. 4378usHDMISSPercentage: HDMI Spread Spectrum Percentage in unit 0.01%; 100 mean 1%, =0, use VBIOS default setting.
@@ -4555,7 +4555,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO_V3
4555#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_LITEAC 3 4555#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_LITEAC 3
4556#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_LIT2AC 4 4556#define ATOM_S0_SYSTEM_POWER_STATE_VALUE_LIT2AC 4
4557 4557
4558//Byte aligned defintion for BIOS usage 4558//Byte aligned definition for BIOS usage
4559#define ATOM_S0_CRT1_MONOb0 0x01 4559#define ATOM_S0_CRT1_MONOb0 0x01
4560#define ATOM_S0_CRT1_COLORb0 0x02 4560#define ATOM_S0_CRT1_COLORb0 0x02
4561#define ATOM_S0_CRT1_MASKb0 (ATOM_S0_CRT1_MONOb0+ATOM_S0_CRT1_COLORb0) 4561#define ATOM_S0_CRT1_MASKb0 (ATOM_S0_CRT1_MONOb0+ATOM_S0_CRT1_COLORb0)
@@ -4621,7 +4621,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO_V3
4621#define ATOM_S2_DISPLAY_ROTATION_ANGLE_MASK 0xC0000000L 4621#define ATOM_S2_DISPLAY_ROTATION_ANGLE_MASK 0xC0000000L
4622 4622
4623 4623
4624//Byte aligned defintion for BIOS usage 4624//Byte aligned definition for BIOS usage
4625#define ATOM_S2_TV1_STANDARD_MASKb0 0x0F 4625#define ATOM_S2_TV1_STANDARD_MASKb0 0x0F
4626#define ATOM_S2_CURRENT_BL_LEVEL_MASKb1 0xFF 4626#define ATOM_S2_CURRENT_BL_LEVEL_MASKb1 0xFF
4627#define ATOM_S2_DEVICE_DPMS_STATEb2 0x01 4627#define ATOM_S2_DEVICE_DPMS_STATEb2 0x01
@@ -4671,7 +4671,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO_V3
4671#define ATOM_S3_ALLOW_FAST_PWR_SWITCH 0x40000000L 4671#define ATOM_S3_ALLOW_FAST_PWR_SWITCH 0x40000000L
4672#define ATOM_S3_RQST_GPU_USE_MIN_PWR 0x80000000L 4672#define ATOM_S3_RQST_GPU_USE_MIN_PWR 0x80000000L
4673 4673
4674//Byte aligned defintion for BIOS usage 4674//Byte aligned definition for BIOS usage
4675#define ATOM_S3_CRT1_ACTIVEb0 0x01 4675#define ATOM_S3_CRT1_ACTIVEb0 0x01
4676#define ATOM_S3_LCD1_ACTIVEb0 0x02 4676#define ATOM_S3_LCD1_ACTIVEb0 0x02
4677#define ATOM_S3_TV1_ACTIVEb0 0x04 4677#define ATOM_S3_TV1_ACTIVEb0 0x04
@@ -4707,7 +4707,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO_V3
4707#define ATOM_S4_LCD1_REFRESH_MASK 0x0000FF00L 4707#define ATOM_S4_LCD1_REFRESH_MASK 0x0000FF00L
4708#define ATOM_S4_LCD1_REFRESH_SHIFT 8 4708#define ATOM_S4_LCD1_REFRESH_SHIFT 8
4709 4709
4710//Byte aligned defintion for BIOS usage 4710//Byte aligned definition for BIOS usage
4711#define ATOM_S4_LCD1_PANEL_ID_MASKb0 0x0FF 4711#define ATOM_S4_LCD1_PANEL_ID_MASKb0 0x0FF
4712#define ATOM_S4_LCD1_REFRESH_MASKb1 ATOM_S4_LCD1_PANEL_ID_MASKb0 4712#define ATOM_S4_LCD1_REFRESH_MASKb1 ATOM_S4_LCD1_PANEL_ID_MASKb0
4713#define ATOM_S4_VRAM_INFO_MASKb2 ATOM_S4_LCD1_PANEL_ID_MASKb0 4713#define ATOM_S4_VRAM_INFO_MASKb2 ATOM_S4_LCD1_PANEL_ID_MASKb0
@@ -4786,7 +4786,7 @@ typedef struct _ATOM_ASIC_INTERNAL_SS_INFO_V3
4786#define ATOM_S6_VRI_BRIGHTNESS_CHANGE 0x40000000L 4786#define ATOM_S6_VRI_BRIGHTNESS_CHANGE 0x40000000L
4787#define ATOM_S6_CONFIG_DISPLAY_CHANGE_MASK 0x80000000L 4787#define ATOM_S6_CONFIG_DISPLAY_CHANGE_MASK 0x80000000L
4788 4788
4789//Byte aligned defintion for BIOS usage 4789//Byte aligned definition for BIOS usage
4790#define ATOM_S6_DEVICE_CHANGEb0 0x01 4790#define ATOM_S6_DEVICE_CHANGEb0 0x01
4791#define ATOM_S6_SCALER_CHANGEb0 0x02 4791#define ATOM_S6_SCALER_CHANGEb0 0x02
4792#define ATOM_S6_LID_CHANGEb0 0x04 4792#define ATOM_S6_LID_CHANGEb0 0x04
@@ -5027,7 +5027,7 @@ typedef struct _ENABLE_GRAPH_SURFACE_PS_ALLOCATION
5027 5027
5028typedef struct _MEMORY_CLEAN_UP_PARAMETERS 5028typedef struct _MEMORY_CLEAN_UP_PARAMETERS
5029{ 5029{
5030 USHORT usMemoryStart; //in 8Kb boundry, offset from memory base address 5030 USHORT usMemoryStart; //in 8Kb boundary, offset from memory base address
5031 USHORT usMemorySize; //8Kb blocks aligned 5031 USHORT usMemorySize; //8Kb blocks aligned
5032}MEMORY_CLEAN_UP_PARAMETERS; 5032}MEMORY_CLEAN_UP_PARAMETERS;
5033#define MEMORY_CLEAN_UP_PS_ALLOCATION MEMORY_CLEAN_UP_PARAMETERS 5033#define MEMORY_CLEAN_UP_PS_ALLOCATION MEMORY_CLEAN_UP_PARAMETERS
@@ -6855,7 +6855,7 @@ typedef struct _ATOM_PPLIB_Clock_Voltage_Limit_Table
6855/**************************************************************************/ 6855/**************************************************************************/
6856 6856
6857 6857
6858// Following definitions are for compatiblity issue in different SW components. 6858// Following definitions are for compatibility issue in different SW components.
6859#define ATOM_MASTER_DATA_TABLE_REVISION 0x01 6859#define ATOM_MASTER_DATA_TABLE_REVISION 0x01
6860#define Object_Info Object_Header 6860#define Object_Info Object_Header
6861#define AdjustARB_SEQ MC_InitParameter 6861#define AdjustARB_SEQ MC_InitParameter
diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 3cd3234ba0a..529a3a70473 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -531,6 +531,9 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
531 pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV; 531 pll->flags |= RADEON_PLL_PREFER_HIGH_FB_DIV;
532 else 532 else
533 pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV; 533 pll->flags |= RADEON_PLL_PREFER_LOW_REF_DIV;
534
535 if (rdev->family < CHIP_RV770)
536 pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;
534 } else { 537 } else {
535 pll->flags |= RADEON_PLL_LEGACY; 538 pll->flags |= RADEON_PLL_LEGACY;
536 539
@@ -559,7 +562,6 @@ static u32 atombios_adjust_pll(struct drm_crtc *crtc,
559 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { 562 if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) {
560 if (ss_enabled) { 563 if (ss_enabled) {
561 if (ss->refdiv) { 564 if (ss->refdiv) {
562 pll->flags |= RADEON_PLL_PREFER_MINM_OVER_MAXP;
563 pll->flags |= RADEON_PLL_USE_REF_DIV; 565 pll->flags |= RADEON_PLL_USE_REF_DIV;
564 pll->reference_div = ss->refdiv; 566 pll->reference_div = ss->refdiv;
565 if (ASIC_IS_AVIVO(rdev)) 567 if (ASIC_IS_AVIVO(rdev))
@@ -957,7 +959,11 @@ static void atombios_crtc_set_pll(struct drm_crtc *crtc, struct drm_display_mode
957 /* adjust pixel clock as needed */ 959 /* adjust pixel clock as needed */
958 adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss); 960 adjusted_clock = atombios_adjust_pll(crtc, mode, pll, ss_enabled, &ss);
959 961
960 if (ASIC_IS_AVIVO(rdev)) 962 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
963 /* TV seems to prefer the legacy algo on some boards */
964 radeon_compute_pll_legacy(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
965 &ref_div, &post_div);
966 else if (ASIC_IS_AVIVO(rdev))
961 radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div, 967 radeon_compute_pll_avivo(pll, adjusted_clock, &pll_clock, &fb_div, &frac_fb_div,
962 &ref_div, &post_div); 968 &ref_div, &post_div);
963 else 969 else
@@ -1005,6 +1011,7 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1005 uint64_t fb_location; 1011 uint64_t fb_location;
1006 uint32_t fb_format, fb_pitch_pixels, tiling_flags; 1012 uint32_t fb_format, fb_pitch_pixels, tiling_flags;
1007 u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE); 1013 u32 fb_swap = EVERGREEN_GRPH_ENDIAN_SWAP(EVERGREEN_GRPH_ENDIAN_NONE);
1014 u32 tmp;
1008 int r; 1015 int r;
1009 1016
1010 /* no fb bound */ 1017 /* no fb bound */
@@ -1133,6 +1140,15 @@ static int dce4_crtc_do_set_base(struct drm_crtc *crtc,
1133 WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset, 1140 WREG32(EVERGREEN_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
1134 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); 1141 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
1135 1142
1143 /* pageflip setup */
1144 /* make sure flip is at vb rather than hb */
1145 tmp = RREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
1146 tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN;
1147 WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
1148
1149 /* set pageflip to happen anywhere in vblank interval */
1150 WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
1151
1136 if (!atomic && fb && fb != crtc->fb) { 1152 if (!atomic && fb && fb != crtc->fb) {
1137 radeon_fb = to_radeon_framebuffer(fb); 1153 radeon_fb = to_radeon_framebuffer(fb);
1138 rbo = gem_to_radeon_bo(radeon_fb->obj); 1154 rbo = gem_to_radeon_bo(radeon_fb->obj);
@@ -1163,6 +1179,7 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
1163 uint64_t fb_location; 1179 uint64_t fb_location;
1164 uint32_t fb_format, fb_pitch_pixels, tiling_flags; 1180 uint32_t fb_format, fb_pitch_pixels, tiling_flags;
1165 u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE; 1181 u32 fb_swap = R600_D1GRPH_SWAP_ENDIAN_NONE;
1182 u32 tmp;
1166 int r; 1183 int r;
1167 1184
1168 /* no fb bound */ 1185 /* no fb bound */
@@ -1290,6 +1307,15 @@ static int avivo_crtc_do_set_base(struct drm_crtc *crtc,
1290 WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset, 1307 WREG32(AVIVO_D1MODE_VIEWPORT_SIZE + radeon_crtc->crtc_offset,
1291 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay); 1308 (crtc->mode.hdisplay << 16) | crtc->mode.vdisplay);
1292 1309
1310 /* pageflip setup */
1311 /* make sure flip is at vb rather than hb */
1312 tmp = RREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
1313 tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN;
1314 WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
1315
1316 /* set pageflip to happen anywhere in vblank interval */
1317 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
1318
1293 if (!atomic && fb && fb != crtc->fb) { 1319 if (!atomic && fb && fb != crtc->fb) {
1294 radeon_fb = to_radeon_framebuffer(fb); 1320 radeon_fb = to_radeon_framebuffer(fb);
1295 rbo = gem_to_radeon_bo(radeon_fb->obj); 1321 rbo = gem_to_radeon_bo(radeon_fb->obj);
diff --git a/drivers/gpu/drm/radeon/evergreen.c b/drivers/gpu/drm/radeon/evergreen.c
index 941080a7794..e9bc135d918 100644
--- a/drivers/gpu/drm/radeon/evergreen.c
+++ b/drivers/gpu/drm/radeon/evergreen.c
@@ -43,17 +43,6 @@ static void evergreen_pcie_gen2_enable(struct radeon_device *rdev);
43 43
44void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc) 44void evergreen_pre_page_flip(struct radeon_device *rdev, int crtc)
45{ 45{
46 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
47 u32 tmp;
48
49 /* make sure flip is at vb rather than hb */
50 tmp = RREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
51 tmp &= ~EVERGREEN_GRPH_SURFACE_UPDATE_H_RETRACE_EN;
52 WREG32(EVERGREEN_GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
53
54 /* set pageflip to happen anywhere in vblank interval */
55 WREG32(EVERGREEN_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
56
57 /* enable the pflip int */ 46 /* enable the pflip int */
58 radeon_irq_kms_pflip_irq_get(rdev, crtc); 47 radeon_irq_kms_pflip_irq_get(rdev, crtc);
59} 48}
@@ -131,11 +120,16 @@ void evergreen_pm_misc(struct radeon_device *rdev)
131 struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx]; 120 struct radeon_power_state *ps = &rdev->pm.power_state[req_ps_idx];
132 struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage; 121 struct radeon_voltage *voltage = &ps->clock_info[req_cm_idx].voltage;
133 122
134 if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { 123 if (voltage->type == VOLTAGE_SW) {
135 if (voltage->voltage != rdev->pm.current_vddc) { 124 if (voltage->voltage && (voltage->voltage != rdev->pm.current_vddc)) {
136 radeon_atom_set_voltage(rdev, voltage->voltage); 125 radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC);
137 rdev->pm.current_vddc = voltage->voltage; 126 rdev->pm.current_vddc = voltage->voltage;
138 DRM_DEBUG("Setting: v: %d\n", voltage->voltage); 127 DRM_DEBUG("Setting: vddc: %d\n", voltage->voltage);
128 }
129 if (voltage->vddci && (voltage->vddci != rdev->pm.current_vddci)) {
130 radeon_atom_set_voltage(rdev, voltage->vddci, SET_VOLTAGE_TYPE_ASIC_VDDCI);
131 rdev->pm.current_vddci = voltage->vddci;
132 DRM_DEBUG("Setting: vddci: %d\n", voltage->vddci);
139 } 133 }
140 } 134 }
141} 135}
@@ -359,7 +353,7 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev,
359 struct drm_display_mode *mode, 353 struct drm_display_mode *mode,
360 struct drm_display_mode *other_mode) 354 struct drm_display_mode *other_mode)
361{ 355{
362 u32 tmp = 0; 356 u32 tmp;
363 /* 357 /*
364 * Line Buffer Setup 358 * Line Buffer Setup
365 * There are 3 line buffers, each one shared by 2 display controllers. 359 * There are 3 line buffers, each one shared by 2 display controllers.
@@ -369,64 +363,63 @@ static u32 evergreen_line_buffer_adjust(struct radeon_device *rdev,
369 * first display controller 363 * first display controller
370 * 0 - first half of lb (3840 * 2) 364 * 0 - first half of lb (3840 * 2)
371 * 1 - first 3/4 of lb (5760 * 2) 365 * 1 - first 3/4 of lb (5760 * 2)
372 * 2 - whole lb (7680 * 2) 366 * 2 - whole lb (7680 * 2), other crtc must be disabled
373 * 3 - first 1/4 of lb (1920 * 2) 367 * 3 - first 1/4 of lb (1920 * 2)
374 * second display controller 368 * second display controller
375 * 4 - second half of lb (3840 * 2) 369 * 4 - second half of lb (3840 * 2)
376 * 5 - second 3/4 of lb (5760 * 2) 370 * 5 - second 3/4 of lb (5760 * 2)
377 * 6 - whole lb (7680 * 2) 371 * 6 - whole lb (7680 * 2), other crtc must be disabled
378 * 7 - last 1/4 of lb (1920 * 2) 372 * 7 - last 1/4 of lb (1920 * 2)
379 */ 373 */
380 if (mode && other_mode) { 374 /* this can get tricky if we have two large displays on a paired group
381 if (mode->hdisplay > other_mode->hdisplay) { 375 * of crtcs. Ideally for multiple large displays we'd assign them to
382 if (mode->hdisplay > 2560) 376 * non-linked crtcs for maximum line buffer allocation.
383 tmp = 1; /* 3/4 */ 377 */
384 else 378 if (radeon_crtc->base.enabled && mode) {
385 tmp = 0; /* 1/2 */ 379 if (other_mode)
386 } else if (other_mode->hdisplay > mode->hdisplay) {
387 if (other_mode->hdisplay > 2560)
388 tmp = 3; /* 1/4 */
389 else
390 tmp = 0; /* 1/2 */
391 } else
392 tmp = 0; /* 1/2 */ 380 tmp = 0; /* 1/2 */
393 } else if (mode) 381 else
394 tmp = 2; /* whole */ 382 tmp = 2; /* whole */
395 else if (other_mode) 383 } else
396 tmp = 3; /* 1/4 */ 384 tmp = 0;
397 385
398 /* second controller of the pair uses second half of the lb */ 386 /* second controller of the pair uses second half of the lb */
399 if (radeon_crtc->crtc_id % 2) 387 if (radeon_crtc->crtc_id % 2)
400 tmp += 4; 388 tmp += 4;
401 WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp); 389 WREG32(DC_LB_MEMORY_SPLIT + radeon_crtc->crtc_offset, tmp);
402 390
403 switch (tmp) { 391 if (radeon_crtc->base.enabled && mode) {
404 case 0: 392 switch (tmp) {
405 case 4: 393 case 0:
406 default: 394 case 4:
407 if (ASIC_IS_DCE5(rdev)) 395 default:
408 return 4096 * 2; 396 if (ASIC_IS_DCE5(rdev))
409 else 397 return 4096 * 2;
410 return 3840 * 2; 398 else
411 case 1: 399 return 3840 * 2;
412 case 5: 400 case 1:
413 if (ASIC_IS_DCE5(rdev)) 401 case 5:
414 return 6144 * 2; 402 if (ASIC_IS_DCE5(rdev))
415 else 403 return 6144 * 2;
416 return 5760 * 2; 404 else
417 case 2: 405 return 5760 * 2;
418 case 6: 406 case 2:
419 if (ASIC_IS_DCE5(rdev)) 407 case 6:
420 return 8192 * 2; 408 if (ASIC_IS_DCE5(rdev))
421 else 409 return 8192 * 2;
422 return 7680 * 2; 410 else
423 case 3: 411 return 7680 * 2;
424 case 7: 412 case 3:
425 if (ASIC_IS_DCE5(rdev)) 413 case 7:
426 return 2048 * 2; 414 if (ASIC_IS_DCE5(rdev))
427 else 415 return 2048 * 2;
428 return 1920 * 2; 416 else
417 return 1920 * 2;
418 }
429 } 419 }
420
421 /* controller not enabled, so no lb used */
422 return 0;
430} 423}
431 424
432static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev) 425static u32 evergreen_get_number_of_dram_channels(struct radeon_device *rdev)
@@ -2587,7 +2580,7 @@ static inline u32 evergreen_get_ih_wptr(struct radeon_device *rdev)
2587 u32 wptr, tmp; 2580 u32 wptr, tmp;
2588 2581
2589 if (rdev->wb.enabled) 2582 if (rdev->wb.enabled)
2590 wptr = rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]; 2583 wptr = le32_to_cpu(rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]);
2591 else 2584 else
2592 wptr = RREG32(IH_RB_WPTR); 2585 wptr = RREG32(IH_RB_WPTR);
2593 2586
@@ -3047,9 +3040,6 @@ int evergreen_init(struct radeon_device *rdev)
3047{ 3040{
3048 int r; 3041 int r;
3049 3042
3050 r = radeon_dummy_page_init(rdev);
3051 if (r)
3052 return r;
3053 /* This don't do much */ 3043 /* This don't do much */
3054 r = radeon_gem_init(rdev); 3044 r = radeon_gem_init(rdev);
3055 if (r) 3045 if (r)
@@ -3161,7 +3151,6 @@ void evergreen_fini(struct radeon_device *rdev)
3161 radeon_atombios_fini(rdev); 3151 radeon_atombios_fini(rdev);
3162 kfree(rdev->bios); 3152 kfree(rdev->bios);
3163 rdev->bios = NULL; 3153 rdev->bios = NULL;
3164 radeon_dummy_page_fini(rdev);
3165} 3154}
3166 3155
3167static void evergreen_pcie_gen2_enable(struct radeon_device *rdev) 3156static void evergreen_pcie_gen2_enable(struct radeon_device *rdev)
diff --git a/drivers/gpu/drm/radeon/evergreen_cs.c b/drivers/gpu/drm/radeon/evergreen_cs.c
index edde90b3755..23d36417158 100644
--- a/drivers/gpu/drm/radeon/evergreen_cs.c
+++ b/drivers/gpu/drm/radeon/evergreen_cs.c
@@ -442,7 +442,7 @@ static inline int evergreen_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u3
442 } 442 }
443 ib = p->ib->ptr; 443 ib = p->ib->ptr;
444 switch (reg) { 444 switch (reg) {
445 /* force following reg to 0 in an attemp to disable out buffer 445 /* force following reg to 0 in an attempt to disable out buffer
446 * which will need us to better understand how it works to perform 446 * which will need us to better understand how it works to perform
447 * security check on it (Jerome) 447 * security check on it (Jerome)
448 */ 448 */
diff --git a/drivers/gpu/drm/radeon/r300.c b/drivers/gpu/drm/radeon/r300.c
index 8713731fa01..55a7f190027 100644
--- a/drivers/gpu/drm/radeon/r300.c
+++ b/drivers/gpu/drm/radeon/r300.c
@@ -437,7 +437,7 @@ int r300_asic_reset(struct radeon_device *rdev)
437 status = RREG32(R_000E40_RBBM_STATUS); 437 status = RREG32(R_000E40_RBBM_STATUS);
438 dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status); 438 dev_info(rdev->dev, "(%s:%d) RBBM_STATUS=0x%08X\n", __func__, __LINE__, status);
439 /* resetting the CP seems to be problematic sometimes it end up 439 /* resetting the CP seems to be problematic sometimes it end up
440 * hard locking the computer, but it's necessary for successfull 440 * hard locking the computer, but it's necessary for successful
441 * reset more test & playing is needed on R3XX/R4XX to find a 441 * reset more test & playing is needed on R3XX/R4XX to find a
442 * reliable (if any solution) 442 * reliable (if any solution)
443 */ 443 */
diff --git a/drivers/gpu/drm/radeon/r300_reg.h b/drivers/gpu/drm/radeon/r300_reg.h
index f0bce399c9f..00c0d2ba22d 100644
--- a/drivers/gpu/drm/radeon/r300_reg.h
+++ b/drivers/gpu/drm/radeon/r300_reg.h
@@ -608,7 +608,7 @@
608 * My guess is that there are two bits for each zbias primitive 608 * My guess is that there are two bits for each zbias primitive
609 * (FILL, LINE, POINT). 609 * (FILL, LINE, POINT).
610 * One to enable depth test and one for depth write. 610 * One to enable depth test and one for depth write.
611 * Yet this doesnt explain why depth writes work ... 611 * Yet this doesn't explain why depth writes work ...
612 */ 612 */
613#define R300_RE_OCCLUSION_CNTL 0x42B4 613#define R300_RE_OCCLUSION_CNTL 0x42B4
614# define R300_OCCLUSION_ON (1<<1) 614# define R300_OCCLUSION_ON (1<<1)
@@ -817,7 +817,7 @@
817# define R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 11) 817# define R300_TX_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 11)
818# define R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR (10 << 11) 818# define R300_TX_MIN_FILTER_LINEAR_MIP_LINEAR (10 << 11)
819 819
820/* NOTE: NEAREST doesnt seem to exist. 820/* NOTE: NEAREST doesn't seem to exist.
821 * Im not seting MAG_FILTER_MASK and (3 << 11) on for all 821 * Im not seting MAG_FILTER_MASK and (3 << 11) on for all
822 * anisotropy modes because that would void selected mag filter 822 * anisotropy modes because that would void selected mag filter
823 */ 823 */
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index be271c42de4..6f27593901c 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -587,7 +587,7 @@ void r600_pm_misc(struct radeon_device *rdev)
587 587
588 if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { 588 if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
589 if (voltage->voltage != rdev->pm.current_vddc) { 589 if (voltage->voltage != rdev->pm.current_vddc) {
590 radeon_atom_set_voltage(rdev, voltage->voltage); 590 radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC);
591 rdev->pm.current_vddc = voltage->voltage; 591 rdev->pm.current_vddc = voltage->voltage;
592 DRM_DEBUG_DRIVER("Setting: v: %d\n", voltage->voltage); 592 DRM_DEBUG_DRIVER("Setting: v: %d\n", voltage->voltage);
593 } 593 }
@@ -2509,9 +2509,6 @@ int r600_init(struct radeon_device *rdev)
2509{ 2509{
2510 int r; 2510 int r;
2511 2511
2512 r = radeon_dummy_page_init(rdev);
2513 if (r)
2514 return r;
2515 if (r600_debugfs_mc_info_init(rdev)) { 2512 if (r600_debugfs_mc_info_init(rdev)) {
2516 DRM_ERROR("Failed to register debugfs file for mc !\n"); 2513 DRM_ERROR("Failed to register debugfs file for mc !\n");
2517 } 2514 }
@@ -2625,7 +2622,6 @@ void r600_fini(struct radeon_device *rdev)
2625 radeon_atombios_fini(rdev); 2622 radeon_atombios_fini(rdev);
2626 kfree(rdev->bios); 2623 kfree(rdev->bios);
2627 rdev->bios = NULL; 2624 rdev->bios = NULL;
2628 radeon_dummy_page_fini(rdev);
2629} 2625}
2630 2626
2631 2627
@@ -3235,7 +3231,7 @@ static inline u32 r600_get_ih_wptr(struct radeon_device *rdev)
3235 u32 wptr, tmp; 3231 u32 wptr, tmp;
3236 3232
3237 if (rdev->wb.enabled) 3233 if (rdev->wb.enabled)
3238 wptr = rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]; 3234 wptr = le32_to_cpu(rdev->wb.wb[R600_WB_IH_WPTR_OFFSET/4]);
3239 else 3235 else
3240 wptr = RREG32(IH_RB_WPTR); 3236 wptr = RREG32(IH_RB_WPTR);
3241 3237
diff --git a/drivers/gpu/drm/radeon/r600_cs.c b/drivers/gpu/drm/radeon/r600_cs.c
index 3324620b2db..fd18be9871a 100644
--- a/drivers/gpu/drm/radeon/r600_cs.c
+++ b/drivers/gpu/drm/radeon/r600_cs.c
@@ -921,7 +921,7 @@ static inline int r600_cs_check_reg(struct radeon_cs_parser *p, u32 reg, u32 idx
921 return 0; 921 return 0;
922 ib = p->ib->ptr; 922 ib = p->ib->ptr;
923 switch (reg) { 923 switch (reg) {
924 /* force following reg to 0 in an attemp to disable out buffer 924 /* force following reg to 0 in an attempt to disable out buffer
925 * which will need us to better understand how it works to perform 925 * which will need us to better understand how it works to perform
926 * security check on it (Jerome) 926 * security check on it (Jerome)
927 */ 927 */
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index 50db6d62eec..f5ac7e788d8 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -334,7 +334,7 @@ void r600_hdmi_setmode(struct drm_encoder *encoder, struct drm_display_mode *mod
334 r600_hdmi_videoinfoframe(encoder, RGB, 0, 0, 0, 0, 334 r600_hdmi_videoinfoframe(encoder, RGB, 0, 0, 0, 0,
335 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); 335 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
336 336
337 /* it's unknown what these bits do excatly, but it's indeed quite usefull for debugging */ 337 /* it's unknown what these bits do excatly, but it's indeed quite useful for debugging */
338 WREG32(offset+R600_HDMI_AUDIO_DEBUG_0, 0x00FFFFFF); 338 WREG32(offset+R600_HDMI_AUDIO_DEBUG_0, 0x00FFFFFF);
339 WREG32(offset+R600_HDMI_AUDIO_DEBUG_1, 0x007FFFFF); 339 WREG32(offset+R600_HDMI_AUDIO_DEBUG_1, 0x007FFFFF);
340 WREG32(offset+R600_HDMI_AUDIO_DEBUG_2, 0x00000001); 340 WREG32(offset+R600_HDMI_AUDIO_DEBUG_2, 0x00000001);
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index cfe3af1a793..ba643b57605 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -177,7 +177,7 @@ void radeon_pm_suspend(struct radeon_device *rdev);
177void radeon_pm_resume(struct radeon_device *rdev); 177void radeon_pm_resume(struct radeon_device *rdev);
178void radeon_combios_get_power_modes(struct radeon_device *rdev); 178void radeon_combios_get_power_modes(struct radeon_device *rdev);
179void radeon_atombios_get_power_modes(struct radeon_device *rdev); 179void radeon_atombios_get_power_modes(struct radeon_device *rdev);
180void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level); 180void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type);
181void rs690_pm_info(struct radeon_device *rdev); 181void rs690_pm_info(struct radeon_device *rdev);
182extern int rv6xx_get_temp(struct radeon_device *rdev); 182extern int rv6xx_get_temp(struct radeon_device *rdev);
183extern int rv770_get_temp(struct radeon_device *rdev); 183extern int rv770_get_temp(struct radeon_device *rdev);
@@ -679,11 +679,11 @@ struct radeon_wb {
679 * @sideport_bandwidth: sideport bandwidth the gpu has (MByte/s) (IGP) 679 * @sideport_bandwidth: sideport bandwidth the gpu has (MByte/s) (IGP)
680 * @ht_bandwidth: ht bandwidth the gpu has (MByte/s) (IGP) 680 * @ht_bandwidth: ht bandwidth the gpu has (MByte/s) (IGP)
681 * @core_bandwidth: core GPU bandwidth the gpu has (MByte/s) (IGP) 681 * @core_bandwidth: core GPU bandwidth the gpu has (MByte/s) (IGP)
682 * @sclk: GPU clock Mhz (core bandwith depends of this clock) 682 * @sclk: GPU clock Mhz (core bandwidth depends of this clock)
683 * @needed_bandwidth: current bandwidth needs 683 * @needed_bandwidth: current bandwidth needs
684 * 684 *
685 * It keeps track of various data needed to take powermanagement decision. 685 * It keeps track of various data needed to take powermanagement decision.
686 * Bandwith need is used to determine minimun clock of the GPU and memory. 686 * Bandwidth need is used to determine minimun clock of the GPU and memory.
687 * Equation between gpu/memory clock and available bandwidth is hw dependent 687 * Equation between gpu/memory clock and available bandwidth is hw dependent
688 * (type of memory, bus size, efficiency, ...) 688 * (type of memory, bus size, efficiency, ...)
689 */ 689 */
@@ -767,7 +767,9 @@ struct radeon_voltage {
767 u8 vddci_id; /* index into vddci voltage table */ 767 u8 vddci_id; /* index into vddci voltage table */
768 bool vddci_enabled; 768 bool vddci_enabled;
769 /* r6xx+ sw */ 769 /* r6xx+ sw */
770 u32 voltage; 770 u16 voltage;
771 /* evergreen+ vddci */
772 u16 vddci;
771}; 773};
772 774
773/* clock mode flags */ 775/* clock mode flags */
@@ -835,10 +837,12 @@ struct radeon_pm {
835 int default_power_state_index; 837 int default_power_state_index;
836 u32 current_sclk; 838 u32 current_sclk;
837 u32 current_mclk; 839 u32 current_mclk;
838 u32 current_vddc; 840 u16 current_vddc;
841 u16 current_vddci;
839 u32 default_sclk; 842 u32 default_sclk;
840 u32 default_mclk; 843 u32 default_mclk;
841 u32 default_vddc; 844 u16 default_vddc;
845 u16 default_vddci;
842 struct radeon_i2c_chan *i2c_bus; 846 struct radeon_i2c_chan *i2c_bus;
843 /* selected pm method */ 847 /* selected pm method */
844 enum radeon_pm_method pm_method; 848 enum radeon_pm_method pm_method;
diff --git a/drivers/gpu/drm/radeon/radeon_asic.c b/drivers/gpu/drm/radeon/radeon_asic.c
index eb888ee5f67..ca576191d05 100644
--- a/drivers/gpu/drm/radeon/radeon_asic.c
+++ b/drivers/gpu/drm/radeon/radeon_asic.c
@@ -94,7 +94,7 @@ static void radeon_register_accessor_init(struct radeon_device *rdev)
94 rdev->mc_rreg = &rs600_mc_rreg; 94 rdev->mc_rreg = &rs600_mc_rreg;
95 rdev->mc_wreg = &rs600_mc_wreg; 95 rdev->mc_wreg = &rs600_mc_wreg;
96 } 96 }
97 if ((rdev->family >= CHIP_R600) && (rdev->family <= CHIP_HEMLOCK)) { 97 if (rdev->family >= CHIP_R600) {
98 rdev->pciep_rreg = &r600_pciep_rreg; 98 rdev->pciep_rreg = &r600_pciep_rreg;
99 rdev->pciep_wreg = &r600_pciep_wreg; 99 rdev->pciep_wreg = &r600_pciep_wreg;
100 } 100 }
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 02d5c415f49..f5d12fb103f 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -675,7 +675,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
675 ATOM_ENCODER_CAP_RECORD *cap_record; 675 ATOM_ENCODER_CAP_RECORD *cap_record;
676 u16 caps = 0; 676 u16 caps = 0;
677 677
678 while (record->ucRecordType > 0 && 678 while (record->ucRecordSize > 0 &&
679 record->ucRecordType > 0 &&
679 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { 680 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
680 switch (record->ucRecordType) { 681 switch (record->ucRecordType) {
681 case ATOM_ENCODER_CAP_RECORD_TYPE: 682 case ATOM_ENCODER_CAP_RECORD_TYPE:
@@ -720,7 +721,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
720 break; 721 break;
721 } 722 }
722 723
723 while (record->ucRecordType > 0 && 724 while (record->ucRecordSize > 0 &&
725 record->ucRecordType > 0 &&
724 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) { 726 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
725 switch (record->ucRecordType) { 727 switch (record->ucRecordType) {
726 case ATOM_I2C_RECORD_TYPE: 728 case ATOM_I2C_RECORD_TYPE:
@@ -782,10 +784,9 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
782 ATOM_HPD_INT_RECORD *hpd_record; 784 ATOM_HPD_INT_RECORD *hpd_record;
783 ATOM_I2C_ID_CONFIG_ACCESS *i2c_config; 785 ATOM_I2C_ID_CONFIG_ACCESS *i2c_config;
784 786
785 while (record->ucRecordType > 0 787 while (record->ucRecordSize > 0 &&
786 && record-> 788 record->ucRecordType > 0 &&
787 ucRecordType <= 789 record->ucRecordType <= ATOM_MAX_OBJECT_RECORD_NUMBER) {
788 ATOM_MAX_OBJECT_RECORD_NUMBER) {
789 switch (record->ucRecordType) { 790 switch (record->ucRecordType) {
790 case ATOM_I2C_RECORD_TYPE: 791 case ATOM_I2C_RECORD_TYPE:
791 i2c_record = 792 i2c_record =
@@ -2175,24 +2176,27 @@ static void radeon_atombios_add_pplib_thermal_controller(struct radeon_device *r
2175 } 2176 }
2176} 2177}
2177 2178
2178static u16 radeon_atombios_get_default_vddc(struct radeon_device *rdev) 2179static void radeon_atombios_get_default_voltages(struct radeon_device *rdev,
2180 u16 *vddc, u16 *vddci)
2179{ 2181{
2180 struct radeon_mode_info *mode_info = &rdev->mode_info; 2182 struct radeon_mode_info *mode_info = &rdev->mode_info;
2181 int index = GetIndexIntoMasterTable(DATA, FirmwareInfo); 2183 int index = GetIndexIntoMasterTable(DATA, FirmwareInfo);
2182 u8 frev, crev; 2184 u8 frev, crev;
2183 u16 data_offset; 2185 u16 data_offset;
2184 union firmware_info *firmware_info; 2186 union firmware_info *firmware_info;
2185 u16 vddc = 0; 2187
2188 *vddc = 0;
2189 *vddci = 0;
2186 2190
2187 if (atom_parse_data_header(mode_info->atom_context, index, NULL, 2191 if (atom_parse_data_header(mode_info->atom_context, index, NULL,
2188 &frev, &crev, &data_offset)) { 2192 &frev, &crev, &data_offset)) {
2189 firmware_info = 2193 firmware_info =
2190 (union firmware_info *)(mode_info->atom_context->bios + 2194 (union firmware_info *)(mode_info->atom_context->bios +
2191 data_offset); 2195 data_offset);
2192 vddc = le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage); 2196 *vddc = le16_to_cpu(firmware_info->info_14.usBootUpVDDCVoltage);
2197 if ((frev == 2) && (crev >= 2))
2198 *vddci = le16_to_cpu(firmware_info->info_22.usBootUpVDDCIVoltage);
2193 } 2199 }
2194
2195 return vddc;
2196} 2200}
2197 2201
2198static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rdev, 2202static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rdev,
@@ -2202,7 +2206,9 @@ static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rde
2202 int j; 2206 int j;
2203 u32 misc = le32_to_cpu(non_clock_info->ulCapsAndSettings); 2207 u32 misc = le32_to_cpu(non_clock_info->ulCapsAndSettings);
2204 u32 misc2 = le16_to_cpu(non_clock_info->usClassification); 2208 u32 misc2 = le16_to_cpu(non_clock_info->usClassification);
2205 u16 vddc = radeon_atombios_get_default_vddc(rdev); 2209 u16 vddc, vddci;
2210
2211 radeon_atombios_get_default_voltages(rdev, &vddc, &vddci);
2206 2212
2207 rdev->pm.power_state[state_index].misc = misc; 2213 rdev->pm.power_state[state_index].misc = misc;
2208 rdev->pm.power_state[state_index].misc2 = misc2; 2214 rdev->pm.power_state[state_index].misc2 = misc2;
@@ -2243,6 +2249,7 @@ static void radeon_atombios_parse_pplib_non_clock_info(struct radeon_device *rde
2243 rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk; 2249 rdev->pm.default_sclk = rdev->pm.power_state[state_index].clock_info[0].sclk;
2244 rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk; 2250 rdev->pm.default_mclk = rdev->pm.power_state[state_index].clock_info[0].mclk;
2245 rdev->pm.default_vddc = rdev->pm.power_state[state_index].clock_info[0].voltage.voltage; 2251 rdev->pm.default_vddc = rdev->pm.power_state[state_index].clock_info[0].voltage.voltage;
2252 rdev->pm.default_vddci = rdev->pm.power_state[state_index].clock_info[0].voltage.vddci;
2246 } else { 2253 } else {
2247 /* patch the table values with the default slck/mclk from firmware info */ 2254 /* patch the table values with the default slck/mclk from firmware info */
2248 for (j = 0; j < mode_index; j++) { 2255 for (j = 0; j < mode_index; j++) {
@@ -2285,6 +2292,8 @@ static bool radeon_atombios_parse_pplib_clock_info(struct radeon_device *rdev,
2285 VOLTAGE_SW; 2292 VOLTAGE_SW;
2286 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage = 2293 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.voltage =
2287 le16_to_cpu(clock_info->evergreen.usVDDC); 2294 le16_to_cpu(clock_info->evergreen.usVDDC);
2295 rdev->pm.power_state[state_index].clock_info[mode_index].voltage.vddci =
2296 le16_to_cpu(clock_info->evergreen.usVDDCI);
2288 } else { 2297 } else {
2289 sclk = le16_to_cpu(clock_info->r600.usEngineClockLow); 2298 sclk = le16_to_cpu(clock_info->r600.usEngineClockLow);
2290 sclk |= clock_info->r600.ucEngineClockHigh << 16; 2299 sclk |= clock_info->r600.ucEngineClockHigh << 16;
@@ -2576,25 +2585,25 @@ union set_voltage {
2576 struct _SET_VOLTAGE_PARAMETERS_V2 v2; 2585 struct _SET_VOLTAGE_PARAMETERS_V2 v2;
2577}; 2586};
2578 2587
2579void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level) 2588void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type)
2580{ 2589{
2581 union set_voltage args; 2590 union set_voltage args;
2582 int index = GetIndexIntoMasterTable(COMMAND, SetVoltage); 2591 int index = GetIndexIntoMasterTable(COMMAND, SetVoltage);
2583 u8 frev, crev, volt_index = level; 2592 u8 frev, crev, volt_index = voltage_level;
2584 2593
2585 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev)) 2594 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))
2586 return; 2595 return;
2587 2596
2588 switch (crev) { 2597 switch (crev) {
2589 case 1: 2598 case 1:
2590 args.v1.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC; 2599 args.v1.ucVoltageType = voltage_type;
2591 args.v1.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_ALL_SOURCE; 2600 args.v1.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_ALL_SOURCE;
2592 args.v1.ucVoltageIndex = volt_index; 2601 args.v1.ucVoltageIndex = volt_index;
2593 break; 2602 break;
2594 case 2: 2603 case 2:
2595 args.v2.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC; 2604 args.v2.ucVoltageType = voltage_type;
2596 args.v2.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE; 2605 args.v2.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE;
2597 args.v2.usVoltageLevel = cpu_to_le16(level); 2606 args.v2.usVoltageLevel = cpu_to_le16(voltage_level);
2598 break; 2607 break;
2599 default: 2608 default:
2600 DRM_ERROR("Unknown table version %d, %d\n", frev, crev); 2609 DRM_ERROR("Unknown table version %d, %d\n", frev, crev);
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index cf7c8d5b4ec..8caf546c8e9 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -448,7 +448,7 @@ static uint16_t combios_get_table_offset(struct drm_device *dev,
448 448
449bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev) 449bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev)
450{ 450{
451 int edid_info; 451 int edid_info, size;
452 struct edid *edid; 452 struct edid *edid;
453 unsigned char *raw; 453 unsigned char *raw;
454 edid_info = combios_get_table_offset(rdev->ddev, COMBIOS_HARDCODED_EDID_TABLE); 454 edid_info = combios_get_table_offset(rdev->ddev, COMBIOS_HARDCODED_EDID_TABLE);
@@ -456,11 +456,12 @@ bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev)
456 return false; 456 return false;
457 457
458 raw = rdev->bios + edid_info; 458 raw = rdev->bios + edid_info;
459 edid = kmalloc(EDID_LENGTH * (raw[0x7e] + 1), GFP_KERNEL); 459 size = EDID_LENGTH * (raw[0x7e] + 1);
460 edid = kmalloc(size, GFP_KERNEL);
460 if (edid == NULL) 461 if (edid == NULL)
461 return false; 462 return false;
462 463
463 memcpy((unsigned char *)edid, raw, EDID_LENGTH * (raw[0x7e] + 1)); 464 memcpy((unsigned char *)edid, raw, size);
464 465
465 if (!drm_edid_is_valid(edid)) { 466 if (!drm_edid_is_valid(edid)) {
466 kfree(edid); 467 kfree(edid);
@@ -468,6 +469,7 @@ bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev)
468 } 469 }
469 470
470 rdev->mode_info.bios_hardcoded_edid = edid; 471 rdev->mode_info.bios_hardcoded_edid = edid;
472 rdev->mode_info.bios_hardcoded_edid_size = size;
471 return true; 473 return true;
472} 474}
473 475
@@ -475,8 +477,17 @@ bool radeon_combios_check_hardcoded_edid(struct radeon_device *rdev)
475struct edid * 477struct edid *
476radeon_bios_get_hardcoded_edid(struct radeon_device *rdev) 478radeon_bios_get_hardcoded_edid(struct radeon_device *rdev)
477{ 479{
478 if (rdev->mode_info.bios_hardcoded_edid) 480 struct edid *edid;
479 return rdev->mode_info.bios_hardcoded_edid; 481
482 if (rdev->mode_info.bios_hardcoded_edid) {
483 edid = kmalloc(rdev->mode_info.bios_hardcoded_edid_size, GFP_KERNEL);
484 if (edid) {
485 memcpy((unsigned char *)edid,
486 (unsigned char *)rdev->mode_info.bios_hardcoded_edid,
487 rdev->mode_info.bios_hardcoded_edid_size);
488 return edid;
489 }
490 }
480 return NULL; 491 return NULL;
481} 492}
482 493
@@ -2068,6 +2079,19 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
2068 DRM_MODE_CONNECTOR_DVII, &ddc_i2c, 2079 DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
2069 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I, 2080 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
2070 &hpd); 2081 &hpd);
2082 /* TV - TV DAC */
2083 ddc_i2c.valid = false;
2084 hpd.hpd = RADEON_HPD_NONE;
2085 radeon_add_legacy_encoder(dev,
2086 radeon_get_encoder_enum(dev,
2087 ATOM_DEVICE_TV1_SUPPORT,
2088 2),
2089 ATOM_DEVICE_TV1_SUPPORT);
2090 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
2091 DRM_MODE_CONNECTOR_SVIDEO,
2092 &ddc_i2c,
2093 CONNECTOR_OBJECT_ID_SVIDEO,
2094 &hpd);
2071 break; 2095 break;
2072 default: 2096 default:
2073 DRM_INFO("Connector table: %d (invalid)\n", 2097 DRM_INFO("Connector table: %d (invalid)\n",
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 3f3c9aac46c..5f45fa12bb8 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -40,6 +40,10 @@ radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
40 struct drm_encoder *encoder, 40 struct drm_encoder *encoder,
41 bool connected); 41 bool connected);
42 42
43extern void
44radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
45 struct drm_connector *drm_connector);
46
43void radeon_connector_hotplug(struct drm_connector *connector) 47void radeon_connector_hotplug(struct drm_connector *connector)
44{ 48{
45 struct drm_device *dev = connector->dev; 49 struct drm_device *dev = connector->dev;
@@ -629,6 +633,8 @@ static int radeon_vga_mode_valid(struct drm_connector *connector,
629static enum drm_connector_status 633static enum drm_connector_status
630radeon_vga_detect(struct drm_connector *connector, bool force) 634radeon_vga_detect(struct drm_connector *connector, bool force)
631{ 635{
636 struct drm_device *dev = connector->dev;
637 struct radeon_device *rdev = dev->dev_private;
632 struct radeon_connector *radeon_connector = to_radeon_connector(connector); 638 struct radeon_connector *radeon_connector = to_radeon_connector(connector);
633 struct drm_encoder *encoder; 639 struct drm_encoder *encoder;
634 struct drm_encoder_helper_funcs *encoder_funcs; 640 struct drm_encoder_helper_funcs *encoder_funcs;
@@ -679,6 +685,17 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
679 685
680 if (ret == connector_status_connected) 686 if (ret == connector_status_connected)
681 ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, true); 687 ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, true);
688
689 /* RN50 and some RV100 asics in servers often have a hardcoded EDID in the
690 * vbios to deal with KVMs. If we have one and are not able to detect a monitor
691 * by other means, assume the CRT is connected and use that EDID.
692 */
693 if ((!rdev->is_atom_bios) &&
694 (ret == connector_status_disconnected) &&
695 rdev->mode_info.bios_hardcoded_edid_size) {
696 ret = connector_status_connected;
697 }
698
682 radeon_connector_update_scratch_regs(connector, ret); 699 radeon_connector_update_scratch_regs(connector, ret);
683 return ret; 700 return ret;
684} 701}
@@ -790,6 +807,8 @@ static int radeon_dvi_get_modes(struct drm_connector *connector)
790static enum drm_connector_status 807static enum drm_connector_status
791radeon_dvi_detect(struct drm_connector *connector, bool force) 808radeon_dvi_detect(struct drm_connector *connector, bool force)
792{ 809{
810 struct drm_device *dev = connector->dev;
811 struct radeon_device *rdev = dev->dev_private;
793 struct radeon_connector *radeon_connector = to_radeon_connector(connector); 812 struct radeon_connector *radeon_connector = to_radeon_connector(connector);
794 struct drm_encoder *encoder = NULL; 813 struct drm_encoder *encoder = NULL;
795 struct drm_encoder_helper_funcs *encoder_funcs; 814 struct drm_encoder_helper_funcs *encoder_funcs;
@@ -829,8 +848,6 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
829 * you don't really know what's connected to which port as both are digital. 848 * you don't really know what's connected to which port as both are digital.
830 */ 849 */
831 if (radeon_connector->shared_ddc && (ret == connector_status_connected)) { 850 if (radeon_connector->shared_ddc && (ret == connector_status_connected)) {
832 struct drm_device *dev = connector->dev;
833 struct radeon_device *rdev = dev->dev_private;
834 struct drm_connector *list_connector; 851 struct drm_connector *list_connector;
835 struct radeon_connector *list_radeon_connector; 852 struct radeon_connector *list_radeon_connector;
836 list_for_each_entry(list_connector, &dev->mode_config.connector_list, head) { 853 list_for_each_entry(list_connector, &dev->mode_config.connector_list, head) {
@@ -895,6 +912,19 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
895 ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, true); 912 ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, true);
896 } 913 }
897 914
915 /* RN50 and some RV100 asics in servers often have a hardcoded EDID in the
916 * vbios to deal with KVMs. If we have one and are not able to detect a monitor
917 * by other means, assume the DFP is connected and use that EDID. In most
918 * cases the DVI port is actually a virtual KVM port connected to the service
919 * processor.
920 */
921 if ((!rdev->is_atom_bios) &&
922 (ret == connector_status_disconnected) &&
923 rdev->mode_info.bios_hardcoded_edid_size) {
924 radeon_connector->use_digital = true;
925 ret = connector_status_connected;
926 }
927
898out: 928out:
899 /* updated in get modes as well since we need to know if it's analog or digital */ 929 /* updated in get modes as well since we need to know if it's analog or digital */
900 radeon_connector_update_scratch_regs(connector, ret); 930 radeon_connector_update_scratch_regs(connector, ret);
@@ -1169,7 +1199,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1169 if (router->ddc_valid || router->cd_valid) { 1199 if (router->ddc_valid || router->cd_valid) {
1170 radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info); 1200 radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info);
1171 if (!radeon_connector->router_bus) 1201 if (!radeon_connector->router_bus)
1172 goto failed; 1202 DRM_ERROR("Failed to assign router i2c bus! Check dmesg for i2c errors.\n");
1173 } 1203 }
1174 switch (connector_type) { 1204 switch (connector_type) {
1175 case DRM_MODE_CONNECTOR_VGA: 1205 case DRM_MODE_CONNECTOR_VGA:
@@ -1178,7 +1208,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1178 if (i2c_bus->valid) { 1208 if (i2c_bus->valid) {
1179 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1209 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1180 if (!radeon_connector->ddc_bus) 1210 if (!radeon_connector->ddc_bus)
1181 goto failed; 1211 DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1182 } 1212 }
1183 radeon_connector->dac_load_detect = true; 1213 radeon_connector->dac_load_detect = true;
1184 drm_connector_attach_property(&radeon_connector->base, 1214 drm_connector_attach_property(&radeon_connector->base,
@@ -1196,7 +1226,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1196 if (i2c_bus->valid) { 1226 if (i2c_bus->valid) {
1197 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1227 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1198 if (!radeon_connector->ddc_bus) 1228 if (!radeon_connector->ddc_bus)
1199 goto failed; 1229 DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1200 } 1230 }
1201 radeon_connector->dac_load_detect = true; 1231 radeon_connector->dac_load_detect = true;
1202 drm_connector_attach_property(&radeon_connector->base, 1232 drm_connector_attach_property(&radeon_connector->base,
@@ -1219,7 +1249,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1219 if (i2c_bus->valid) { 1249 if (i2c_bus->valid) {
1220 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1250 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1221 if (!radeon_connector->ddc_bus) 1251 if (!radeon_connector->ddc_bus)
1222 goto failed; 1252 DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1223 } 1253 }
1224 subpixel_order = SubPixelHorizontalRGB; 1254 subpixel_order = SubPixelHorizontalRGB;
1225 drm_connector_attach_property(&radeon_connector->base, 1255 drm_connector_attach_property(&radeon_connector->base,
@@ -1260,7 +1290,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1260 if (i2c_bus->valid) { 1290 if (i2c_bus->valid) {
1261 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1291 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1262 if (!radeon_connector->ddc_bus) 1292 if (!radeon_connector->ddc_bus)
1263 goto failed; 1293 DRM_ERROR("HDMI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1264 } 1294 }
1265 drm_connector_attach_property(&radeon_connector->base, 1295 drm_connector_attach_property(&radeon_connector->base,
1266 rdev->mode_info.coherent_mode_property, 1296 rdev->mode_info.coherent_mode_property,
@@ -1299,10 +1329,10 @@ radeon_add_atom_connector(struct drm_device *dev,
1299 else 1329 else
1300 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch"); 1330 radeon_dig_connector->dp_i2c_bus = radeon_i2c_create_dp(dev, i2c_bus, "DP-auxch");
1301 if (!radeon_dig_connector->dp_i2c_bus) 1331 if (!radeon_dig_connector->dp_i2c_bus)
1302 goto failed; 1332 DRM_ERROR("DP: Failed to assign dp ddc bus! Check dmesg for i2c errors.\n");
1303 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1333 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1304 if (!radeon_connector->ddc_bus) 1334 if (!radeon_connector->ddc_bus)
1305 goto failed; 1335 DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1306 } 1336 }
1307 subpixel_order = SubPixelHorizontalRGB; 1337 subpixel_order = SubPixelHorizontalRGB;
1308 drm_connector_attach_property(&radeon_connector->base, 1338 drm_connector_attach_property(&radeon_connector->base,
@@ -1351,7 +1381,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1351 if (i2c_bus->valid) { 1381 if (i2c_bus->valid) {
1352 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1382 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1353 if (!radeon_connector->ddc_bus) 1383 if (!radeon_connector->ddc_bus)
1354 goto failed; 1384 DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1355 } 1385 }
1356 drm_connector_attach_property(&radeon_connector->base, 1386 drm_connector_attach_property(&radeon_connector->base,
1357 dev->mode_config.scaling_mode_property, 1387 dev->mode_config.scaling_mode_property,
@@ -1427,7 +1457,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1427 if (i2c_bus->valid) { 1457 if (i2c_bus->valid) {
1428 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1458 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1429 if (!radeon_connector->ddc_bus) 1459 if (!radeon_connector->ddc_bus)
1430 goto failed; 1460 DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1431 } 1461 }
1432 radeon_connector->dac_load_detect = true; 1462 radeon_connector->dac_load_detect = true;
1433 drm_connector_attach_property(&radeon_connector->base, 1463 drm_connector_attach_property(&radeon_connector->base,
@@ -1445,7 +1475,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1445 if (i2c_bus->valid) { 1475 if (i2c_bus->valid) {
1446 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1476 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1447 if (!radeon_connector->ddc_bus) 1477 if (!radeon_connector->ddc_bus)
1448 goto failed; 1478 DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1449 } 1479 }
1450 radeon_connector->dac_load_detect = true; 1480 radeon_connector->dac_load_detect = true;
1451 drm_connector_attach_property(&radeon_connector->base, 1481 drm_connector_attach_property(&radeon_connector->base,
@@ -1463,7 +1493,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1463 if (i2c_bus->valid) { 1493 if (i2c_bus->valid) {
1464 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1494 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1465 if (!radeon_connector->ddc_bus) 1495 if (!radeon_connector->ddc_bus)
1466 goto failed; 1496 DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1467 } 1497 }
1468 if (connector_type == DRM_MODE_CONNECTOR_DVII) { 1498 if (connector_type == DRM_MODE_CONNECTOR_DVII) {
1469 radeon_connector->dac_load_detect = true; 1499 radeon_connector->dac_load_detect = true;
@@ -1508,7 +1538,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1508 if (i2c_bus->valid) { 1538 if (i2c_bus->valid) {
1509 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus); 1539 radeon_connector->ddc_bus = radeon_i2c_lookup(rdev, i2c_bus);
1510 if (!radeon_connector->ddc_bus) 1540 if (!radeon_connector->ddc_bus)
1511 goto failed; 1541 DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1512 } 1542 }
1513 drm_connector_attach_property(&radeon_connector->base, 1543 drm_connector_attach_property(&radeon_connector->base,
1514 dev->mode_config.scaling_mode_property, 1544 dev->mode_config.scaling_mode_property,
@@ -1526,9 +1556,15 @@ radeon_add_legacy_connector(struct drm_device *dev,
1526 connector->polled = DRM_CONNECTOR_POLL_HPD; 1556 connector->polled = DRM_CONNECTOR_POLL_HPD;
1527 connector->display_info.subpixel_order = subpixel_order; 1557 connector->display_info.subpixel_order = subpixel_order;
1528 drm_sysfs_connector_add(connector); 1558 drm_sysfs_connector_add(connector);
1529 return; 1559 if (connector_type == DRM_MODE_CONNECTOR_LVDS) {
1560 struct drm_encoder *drm_encoder;
1530 1561
1531failed: 1562 list_for_each_entry(drm_encoder, &dev->mode_config.encoder_list, head) {
1532 drm_connector_cleanup(connector); 1563 struct radeon_encoder *radeon_encoder;
1533 kfree(connector); 1564
1565 radeon_encoder = to_radeon_encoder(drm_encoder);
1566 if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_LVDS)
1567 radeon_legacy_backlight_init(radeon_encoder, connector);
1568 }
1569 }
1534} 1570}
diff --git a/drivers/gpu/drm/radeon/radeon_cp.c b/drivers/gpu/drm/radeon/radeon_cp.c
index 3d599e33b9c..75867792a4e 100644
--- a/drivers/gpu/drm/radeon/radeon_cp.c
+++ b/drivers/gpu/drm/radeon/radeon_cp.c
@@ -244,7 +244,7 @@ void radeon_write_agp_base(drm_radeon_private_t *dev_priv, u64 agp_base)
244 u32 agp_base_lo = agp_base & 0xffffffff; 244 u32 agp_base_lo = agp_base & 0xffffffff;
245 u32 r6xx_agp_base = (agp_base >> 22) & 0x3ffff; 245 u32 r6xx_agp_base = (agp_base >> 22) & 0x3ffff;
246 246
247 /* R6xx/R7xx must be aligned to a 4MB boundry */ 247 /* R6xx/R7xx must be aligned to a 4MB boundary */
248 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770) 248 if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_RV770)
249 RADEON_WRITE(R700_MC_VM_AGP_BASE, r6xx_agp_base); 249 RADEON_WRITE(R700_MC_VM_AGP_BASE, r6xx_agp_base);
250 else if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600) 250 else if ((dev_priv->flags & RADEON_FAMILY_MASK) >= CHIP_R600)
diff --git a/drivers/gpu/drm/radeon/radeon_cursor.c b/drivers/gpu/drm/radeon/radeon_cursor.c
index 017ac54920f..bdf2fa1189a 100644
--- a/drivers/gpu/drm/radeon/radeon_cursor.c
+++ b/drivers/gpu/drm/radeon/radeon_cursor.c
@@ -226,7 +226,7 @@ int radeon_crtc_cursor_move(struct drm_crtc *crtc,
226 y += crtc->y; 226 y += crtc->y;
227 DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y); 227 DRM_DEBUG("x %d y %d c->x %d c->y %d\n", x, y, crtc->x, crtc->y);
228 228
229 /* avivo cursor image can't end on 128 pixel boundry or 229 /* avivo cursor image can't end on 128 pixel boundary or
230 * go past the end of the frame if both crtcs are enabled 230 * go past the end of the frame if both crtcs are enabled
231 */ 231 */
232 list_for_each_entry(crtc_p, &crtc->dev->mode_config.crtc_list, head) { 232 list_for_each_entry(crtc_p, &crtc->dev->mode_config.crtc_list, head) {
diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c
index f0209be7a34..890217e678d 100644
--- a/drivers/gpu/drm/radeon/radeon_device.c
+++ b/drivers/gpu/drm/radeon/radeon_device.c
@@ -262,7 +262,7 @@ int radeon_wb_init(struct radeon_device *rdev)
262 * Note: GTT start, end, size should be initialized before calling this 262 * Note: GTT start, end, size should be initialized before calling this
263 * function on AGP platform. 263 * function on AGP platform.
264 * 264 *
265 * Note: We don't explictly enforce VRAM start to be aligned on VRAM size, 265 * Note: We don't explicitly enforce VRAM start to be aligned on VRAM size,
266 * this shouldn't be a problem as we are using the PCI aperture as a reference. 266 * this shouldn't be a problem as we are using the PCI aperture as a reference.
267 * Otherwise this would be needed for rv280, all r3xx, and all r4xx, but 267 * Otherwise this would be needed for rv280, all r3xx, and all r4xx, but
268 * not IGP. 268 * not IGP.
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 4be58793dc1..bdbab5c43bd 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -1492,7 +1492,7 @@ bool radeon_crtc_scaling_mode_fixup(struct drm_crtc *crtc,
1492 * 1492 *
1493 * \return Flags, or'ed together as follows: 1493 * \return Flags, or'ed together as follows:
1494 * 1494 *
1495 * DRM_SCANOUTPOS_VALID = Query successfull. 1495 * DRM_SCANOUTPOS_VALID = Query successful.
1496 * DRM_SCANOUTPOS_INVBL = Inside vblank. 1496 * DRM_SCANOUTPOS_INVBL = Inside vblank.
1497 * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of 1497 * DRM_SCANOUTPOS_ACCURATE = Returned position is accurate. A lack of
1498 * this flag means that returned position may be offset by a constant but 1498 * this flag means that returned position may be offset by a constant but
diff --git a/drivers/gpu/drm/radeon/radeon_drv.h b/drivers/gpu/drm/radeon/radeon_drv.h
index 5cba46b9779..a1b59ca96d0 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.h
+++ b/drivers/gpu/drm/radeon/radeon_drv.h
@@ -271,7 +271,7 @@ typedef struct drm_radeon_private {
271 271
272 int have_z_offset; 272 int have_z_offset;
273 273
274 /* starting from here on, data is preserved accross an open */ 274 /* starting from here on, data is preserved across an open */
275 uint32_t flags; /* see radeon_chip_flags */ 275 uint32_t flags; /* see radeon_chip_flags */
276 resource_size_t fb_aper_offset; 276 resource_size_t fb_aper_offset;
277 277
diff --git a/drivers/gpu/drm/radeon/radeon_fence.c b/drivers/gpu/drm/radeon/radeon_fence.c
index ab83472553c..1f822943657 100644
--- a/drivers/gpu/drm/radeon/radeon_fence.c
+++ b/drivers/gpu/drm/radeon/radeon_fence.c
@@ -79,7 +79,7 @@ static bool radeon_fence_poll_locked(struct radeon_device *rdev)
79 scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; 79 scratch_index = R600_WB_EVENT_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base;
80 else 80 else
81 scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base; 81 scratch_index = RADEON_WB_SCRATCH_OFFSET + rdev->fence_drv.scratch_reg - rdev->scratch.reg_base;
82 seq = rdev->wb.wb[scratch_index/4]; 82 seq = le32_to_cpu(rdev->wb.wb[scratch_index/4]);
83 } else 83 } else
84 seq = RREG32(rdev->fence_drv.scratch_reg); 84 seq = RREG32(rdev->fence_drv.scratch_reg);
85 if (seq != rdev->fence_drv.last_seq) { 85 if (seq != rdev->fence_drv.last_seq) {
diff --git a/drivers/gpu/drm/radeon/radeon_gart.c b/drivers/gpu/drm/radeon/radeon_gart.c
index f0534ef2f33..8a955bbdb60 100644
--- a/drivers/gpu/drm/radeon/radeon_gart.c
+++ b/drivers/gpu/drm/radeon/radeon_gart.c
@@ -285,4 +285,6 @@ void radeon_gart_fini(struct radeon_device *rdev)
285 rdev->gart.pages = NULL; 285 rdev->gart.pages = NULL;
286 rdev->gart.pages_addr = NULL; 286 rdev->gart.pages_addr = NULL;
287 rdev->gart.ttm_alloced = NULL; 287 rdev->gart.ttm_alloced = NULL;
288
289 radeon_dummy_page_fini(rdev);
288} 290}
diff --git a/drivers/gpu/drm/radeon/radeon_i2c.c b/drivers/gpu/drm/radeon/radeon_i2c.c
index ded2a45bc95..983cbac75af 100644
--- a/drivers/gpu/drm/radeon/radeon_i2c.c
+++ b/drivers/gpu/drm/radeon/radeon_i2c.c
@@ -1062,7 +1062,7 @@ void radeon_i2c_get_byte(struct radeon_i2c_chan *i2c_bus,
1062 *val = in_buf[0]; 1062 *val = in_buf[0];
1063 DRM_DEBUG("val = 0x%02x\n", *val); 1063 DRM_DEBUG("val = 0x%02x\n", *val);
1064 } else { 1064 } else {
1065 DRM_ERROR("i2c 0x%02x 0x%02x read failed\n", 1065 DRM_DEBUG("i2c 0x%02x 0x%02x read failed\n",
1066 addr, *val); 1066 addr, *val);
1067 } 1067 }
1068} 1068}
@@ -1084,7 +1084,7 @@ void radeon_i2c_put_byte(struct radeon_i2c_chan *i2c_bus,
1084 out_buf[1] = val; 1084 out_buf[1] = val;
1085 1085
1086 if (i2c_transfer(&i2c_bus->adapter, &msg, 1) != 1) 1086 if (i2c_transfer(&i2c_bus->adapter, &msg, 1) != 1)
1087 DRM_ERROR("i2c 0x%02x 0x%02x write failed\n", 1087 DRM_DEBUG("i2c 0x%02x 0x%02x write failed\n",
1088 addr, val); 1088 addr, val);
1089} 1089}
1090 1090
@@ -1096,6 +1096,9 @@ void radeon_router_select_ddc_port(struct radeon_connector *radeon_connector)
1096 if (!radeon_connector->router.ddc_valid) 1096 if (!radeon_connector->router.ddc_valid)
1097 return; 1097 return;
1098 1098
1099 if (!radeon_connector->router_bus)
1100 return;
1101
1099 radeon_i2c_get_byte(radeon_connector->router_bus, 1102 radeon_i2c_get_byte(radeon_connector->router_bus,
1100 radeon_connector->router.i2c_addr, 1103 radeon_connector->router.i2c_addr,
1101 0x3, &val); 1104 0x3, &val);
@@ -1121,6 +1124,9 @@ void radeon_router_select_cd_port(struct radeon_connector *radeon_connector)
1121 if (!radeon_connector->router.cd_valid) 1124 if (!radeon_connector->router.cd_valid)
1122 return; 1125 return;
1123 1126
1127 if (!radeon_connector->router_bus)
1128 return;
1129
1124 radeon_i2c_get_byte(radeon_connector->router_bus, 1130 radeon_i2c_get_byte(radeon_connector->router_bus,
1125 radeon_connector->router.i2c_addr, 1131 radeon_connector->router.i2c_addr,
1126 0x3, &val); 1132 0x3, &val);
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
index 66c9af1b3d9..41a5d48e657 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_crtc.c
@@ -889,7 +889,7 @@ static void radeon_set_pll(struct drm_crtc *crtc, struct drm_display_mode *mode)
889 } 889 }
890 890
891 if (rdev->flags & RADEON_IS_MOBILITY) { 891 if (rdev->flags & RADEON_IS_MOBILITY) {
892 /* A temporal workaround for the occational blanking on certain laptop panels. 892 /* A temporal workaround for the occasional blanking on certain laptop panels.
893 This appears to related to the PLL divider registers (fail to lock?). 893 This appears to related to the PLL divider registers (fail to lock?).
894 It occurs even when all dividers are the same with their old settings. 894 It occurs even when all dividers are the same with their old settings.
895 In this case we really don't need to fiddle with PLL registers. 895 In this case we really don't need to fiddle with PLL registers.
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
index 59f834ba283..2f46e0c8df5 100644
--- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c
@@ -28,6 +28,10 @@
28#include "radeon_drm.h" 28#include "radeon_drm.h"
29#include "radeon.h" 29#include "radeon.h"
30#include "atom.h" 30#include "atom.h"
31#include <linux/backlight.h>
32#ifdef CONFIG_PMAC_BACKLIGHT
33#include <asm/backlight.h>
34#endif
31 35
32static void radeon_legacy_encoder_disable(struct drm_encoder *encoder) 36static void radeon_legacy_encoder_disable(struct drm_encoder *encoder)
33{ 37{
@@ -39,7 +43,7 @@ static void radeon_legacy_encoder_disable(struct drm_encoder *encoder)
39 radeon_encoder->active_device = 0; 43 radeon_encoder->active_device = 0;
40} 44}
41 45
42static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode) 46static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode)
43{ 47{
44 struct drm_device *dev = encoder->dev; 48 struct drm_device *dev = encoder->dev;
45 struct radeon_device *rdev = dev->dev_private; 49 struct radeon_device *rdev = dev->dev_private;
@@ -47,15 +51,23 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
47 uint32_t lvds_gen_cntl, lvds_pll_cntl, pixclks_cntl, disp_pwr_man; 51 uint32_t lvds_gen_cntl, lvds_pll_cntl, pixclks_cntl, disp_pwr_man;
48 int panel_pwr_delay = 2000; 52 int panel_pwr_delay = 2000;
49 bool is_mac = false; 53 bool is_mac = false;
54 uint8_t backlight_level;
50 DRM_DEBUG_KMS("\n"); 55 DRM_DEBUG_KMS("\n");
51 56
57 lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
58 backlight_level = (lvds_gen_cntl >> RADEON_LVDS_BL_MOD_LEVEL_SHIFT) & 0xff;
59
52 if (radeon_encoder->enc_priv) { 60 if (radeon_encoder->enc_priv) {
53 if (rdev->is_atom_bios) { 61 if (rdev->is_atom_bios) {
54 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv; 62 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv;
55 panel_pwr_delay = lvds->panel_pwr_delay; 63 panel_pwr_delay = lvds->panel_pwr_delay;
64 if (lvds->bl_dev)
65 backlight_level = lvds->backlight_level;
56 } else { 66 } else {
57 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv; 67 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv;
58 panel_pwr_delay = lvds->panel_pwr_delay; 68 panel_pwr_delay = lvds->panel_pwr_delay;
69 if (lvds->bl_dev)
70 backlight_level = lvds->backlight_level;
59 } 71 }
60 } 72 }
61 73
@@ -82,11 +94,13 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
82 lvds_pll_cntl &= ~RADEON_LVDS_PLL_RESET; 94 lvds_pll_cntl &= ~RADEON_LVDS_PLL_RESET;
83 WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl); 95 WREG32(RADEON_LVDS_PLL_CNTL, lvds_pll_cntl);
84 96
85 lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL); 97 lvds_gen_cntl &= ~(RADEON_LVDS_DISPLAY_DIS |
86 lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_EN | RADEON_LVDS_DIGON | RADEON_LVDS_BLON); 98 RADEON_LVDS_BL_MOD_LEVEL_MASK);
99 lvds_gen_cntl |= (RADEON_LVDS_ON | RADEON_LVDS_EN |
100 RADEON_LVDS_DIGON | RADEON_LVDS_BLON |
101 (backlight_level << RADEON_LVDS_BL_MOD_LEVEL_SHIFT));
87 if (is_mac) 102 if (is_mac)
88 lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN; 103 lvds_gen_cntl |= RADEON_LVDS_BL_MOD_EN;
89 lvds_gen_cntl &= ~(RADEON_LVDS_DISPLAY_DIS);
90 udelay(panel_pwr_delay * 1000); 104 udelay(panel_pwr_delay * 1000);
91 WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl); 105 WREG32(RADEON_LVDS_GEN_CNTL, lvds_gen_cntl);
92 break; 106 break;
@@ -95,7 +109,6 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
95 case DRM_MODE_DPMS_OFF: 109 case DRM_MODE_DPMS_OFF:
96 pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL); 110 pixclks_cntl = RREG32_PLL(RADEON_PIXCLKS_CNTL);
97 WREG32_PLL_P(RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb); 111 WREG32_PLL_P(RADEON_PIXCLKS_CNTL, 0, ~RADEON_PIXCLK_LVDS_ALWAYS_ONb);
98 lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
99 lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS; 112 lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
100 if (is_mac) { 113 if (is_mac) {
101 lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_EN; 114 lvds_gen_cntl &= ~RADEON_LVDS_BL_MOD_EN;
@@ -119,6 +132,25 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
119 132
120} 133}
121 134
135static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
136{
137 struct radeon_device *rdev = encoder->dev->dev_private;
138 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
139 DRM_DEBUG("\n");
140
141 if (radeon_encoder->enc_priv) {
142 if (rdev->is_atom_bios) {
143 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv;
144 lvds->dpms_mode = mode;
145 } else {
146 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv;
147 lvds->dpms_mode = mode;
148 }
149 }
150
151 radeon_legacy_lvds_update(encoder, mode);
152}
153
122static void radeon_legacy_lvds_prepare(struct drm_encoder *encoder) 154static void radeon_legacy_lvds_prepare(struct drm_encoder *encoder)
123{ 155{
124 struct radeon_device *rdev = encoder->dev->dev_private; 156 struct radeon_device *rdev = encoder->dev->dev_private;
@@ -237,9 +269,222 @@ static const struct drm_encoder_helper_funcs radeon_legacy_lvds_helper_funcs = {
237 .disable = radeon_legacy_encoder_disable, 269 .disable = radeon_legacy_encoder_disable,
238}; 270};
239 271
272#if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) || defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)
273
274#define MAX_RADEON_LEVEL 0xFF
275
276struct radeon_backlight_privdata {
277 struct radeon_encoder *encoder;
278 uint8_t negative;
279};
280
281static uint8_t radeon_legacy_lvds_level(struct backlight_device *bd)
282{
283 struct radeon_backlight_privdata *pdata = bl_get_data(bd);
284 uint8_t level;
285
286 /* Convert brightness to hardware level */
287 if (bd->props.brightness < 0)
288 level = 0;
289 else if (bd->props.brightness > MAX_RADEON_LEVEL)
290 level = MAX_RADEON_LEVEL;
291 else
292 level = bd->props.brightness;
293
294 if (pdata->negative)
295 level = MAX_RADEON_LEVEL - level;
296
297 return level;
298}
299
300static int radeon_legacy_backlight_update_status(struct backlight_device *bd)
301{
302 struct radeon_backlight_privdata *pdata = bl_get_data(bd);
303 struct radeon_encoder *radeon_encoder = pdata->encoder;
304 struct drm_device *dev = radeon_encoder->base.dev;
305 struct radeon_device *rdev = dev->dev_private;
306 int dpms_mode = DRM_MODE_DPMS_ON;
307
308 if (radeon_encoder->enc_priv) {
309 if (rdev->is_atom_bios) {
310 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv;
311 dpms_mode = lvds->dpms_mode;
312 lvds->backlight_level = radeon_legacy_lvds_level(bd);
313 } else {
314 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv;
315 dpms_mode = lvds->dpms_mode;
316 lvds->backlight_level = radeon_legacy_lvds_level(bd);
317 }
318 }
319
320 if (bd->props.brightness > 0)
321 radeon_legacy_lvds_update(&radeon_encoder->base, dpms_mode);
322 else
323 radeon_legacy_lvds_update(&radeon_encoder->base, DRM_MODE_DPMS_OFF);
324
325 return 0;
326}
327
328static int radeon_legacy_backlight_get_brightness(struct backlight_device *bd)
329{
330 struct radeon_backlight_privdata *pdata = bl_get_data(bd);
331 struct radeon_encoder *radeon_encoder = pdata->encoder;
332 struct drm_device *dev = radeon_encoder->base.dev;
333 struct radeon_device *rdev = dev->dev_private;
334 uint8_t backlight_level;
335
336 backlight_level = (RREG32(RADEON_LVDS_GEN_CNTL) >>
337 RADEON_LVDS_BL_MOD_LEVEL_SHIFT) & 0xff;
338
339 return pdata->negative ? MAX_RADEON_LEVEL - backlight_level : backlight_level;
340}
341
342static const struct backlight_ops radeon_backlight_ops = {
343 .get_brightness = radeon_legacy_backlight_get_brightness,
344 .update_status = radeon_legacy_backlight_update_status,
345};
346
347void radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
348 struct drm_connector *drm_connector)
349{
350 struct drm_device *dev = radeon_encoder->base.dev;
351 struct radeon_device *rdev = dev->dev_private;
352 struct backlight_device *bd;
353 struct backlight_properties props;
354 struct radeon_backlight_privdata *pdata;
355 uint8_t backlight_level;
356
357 if (!radeon_encoder->enc_priv)
358 return;
359
360#ifdef CONFIG_PMAC_BACKLIGHT
361 if (!pmac_has_backlight_type("ati") &&
362 !pmac_has_backlight_type("mnca"))
363 return;
364#endif
365
366 pdata = kmalloc(sizeof(struct radeon_backlight_privdata), GFP_KERNEL);
367 if (!pdata) {
368 DRM_ERROR("Memory allocation failed\n");
369 goto error;
370 }
371
372 props.max_brightness = MAX_RADEON_LEVEL;
373 props.type = BACKLIGHT_RAW;
374 bd = backlight_device_register("radeon_bl", &drm_connector->kdev,
375 pdata, &radeon_backlight_ops, &props);
376 if (IS_ERR(bd)) {
377 DRM_ERROR("Backlight registration failed\n");
378 goto error;
379 }
380
381 pdata->encoder = radeon_encoder;
382
383 backlight_level = (RREG32(RADEON_LVDS_GEN_CNTL) >>
384 RADEON_LVDS_BL_MOD_LEVEL_SHIFT) & 0xff;
385
386 /* First, try to detect backlight level sense based on the assumption
387 * that firmware set it up at full brightness
388 */
389 if (backlight_level == 0)
390 pdata->negative = true;
391 else if (backlight_level == 0xff)
392 pdata->negative = false;
393 else {
394 /* XXX hack... maybe some day we can figure out in what direction
395 * backlight should work on a given panel?
396 */
397 pdata->negative = (rdev->family != CHIP_RV200 &&
398 rdev->family != CHIP_RV250 &&
399 rdev->family != CHIP_RV280 &&
400 rdev->family != CHIP_RV350);
401
402#ifdef CONFIG_PMAC_BACKLIGHT
403 pdata->negative = (pdata->negative ||
404 of_machine_is_compatible("PowerBook4,3") ||
405 of_machine_is_compatible("PowerBook6,3") ||
406 of_machine_is_compatible("PowerBook6,5"));
407#endif
408 }
409
410 if (rdev->is_atom_bios) {
411 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv;
412 lvds->bl_dev = bd;
413 } else {
414 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv;
415 lvds->bl_dev = bd;
416 }
417
418 bd->props.brightness = radeon_legacy_backlight_get_brightness(bd);
419 bd->props.power = FB_BLANK_UNBLANK;
420 backlight_update_status(bd);
421
422 DRM_INFO("radeon legacy LVDS backlight initialized\n");
423
424 return;
425
426error:
427 kfree(pdata);
428 return;
429}
430
431static void radeon_legacy_backlight_exit(struct radeon_encoder *radeon_encoder)
432{
433 struct drm_device *dev = radeon_encoder->base.dev;
434 struct radeon_device *rdev = dev->dev_private;
435 struct backlight_device *bd = NULL;
436
437 if (!radeon_encoder->enc_priv)
438 return;
439
440 if (rdev->is_atom_bios) {
441 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv;
442 bd = lvds->bl_dev;
443 lvds->bl_dev = NULL;
444 } else {
445 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv;
446 bd = lvds->bl_dev;
447 lvds->bl_dev = NULL;
448 }
449
450 if (bd) {
451 struct radeon_legacy_backlight_privdata *pdata;
452
453 pdata = bl_get_data(bd);
454 backlight_device_unregister(bd);
455 kfree(pdata);
456
457 DRM_INFO("radeon legacy LVDS backlight unloaded\n");
458 }
459}
460
461#else /* !CONFIG_BACKLIGHT_CLASS_DEVICE */
462
463void radeon_legacy_backlight_init(struct radeon_encoder *encoder)
464{
465}
466
467static void radeon_legacy_backlight_exit(struct radeon_encoder *encoder)
468{
469}
470
471#endif
472
473
474static void radeon_lvds_enc_destroy(struct drm_encoder *encoder)
475{
476 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
477
478 if (radeon_encoder->enc_priv) {
479 radeon_legacy_backlight_exit(radeon_encoder);
480 kfree(radeon_encoder->enc_priv);
481 }
482 drm_encoder_cleanup(encoder);
483 kfree(radeon_encoder);
484}
240 485
241static const struct drm_encoder_funcs radeon_legacy_lvds_enc_funcs = { 486static const struct drm_encoder_funcs radeon_legacy_lvds_enc_funcs = {
242 .destroy = radeon_enc_destroy, 487 .destroy = radeon_lvds_enc_destroy,
243}; 488};
244 489
245static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode) 490static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode)
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index 5067d18d000..9c57538231d 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -239,6 +239,7 @@ struct radeon_mode_info {
239 struct drm_property *underscan_vborder_property; 239 struct drm_property *underscan_vborder_property;
240 /* hardcoded DFP edid from BIOS */ 240 /* hardcoded DFP edid from BIOS */
241 struct edid *bios_hardcoded_edid; 241 struct edid *bios_hardcoded_edid;
242 int bios_hardcoded_edid_size;
242 243
243 /* pointer to fbdev info structure */ 244 /* pointer to fbdev info structure */
244 struct radeon_fbdev *rfbdev; 245 struct radeon_fbdev *rfbdev;
@@ -302,6 +303,9 @@ struct radeon_encoder_lvds {
302 uint32_t lvds_gen_cntl; 303 uint32_t lvds_gen_cntl;
303 /* panel mode */ 304 /* panel mode */
304 struct drm_display_mode native_mode; 305 struct drm_display_mode native_mode;
306 struct backlight_device *bl_dev;
307 int dpms_mode;
308 uint8_t backlight_level;
305}; 309};
306 310
307struct radeon_encoder_tv_dac { 311struct radeon_encoder_tv_dac {
@@ -355,6 +359,9 @@ struct radeon_encoder_atom_dig {
355 uint32_t lcd_ss_id; 359 uint32_t lcd_ss_id;
356 /* panel mode */ 360 /* panel mode */
357 struct drm_display_mode native_mode; 361 struct drm_display_mode native_mode;
362 struct backlight_device *bl_dev;
363 int dpms_mode;
364 uint8_t backlight_level;
358}; 365};
359 366
360struct radeon_encoder_atom_dac { 367struct radeon_encoder_atom_dac {
diff --git a/drivers/gpu/drm/radeon/radeon_object.h b/drivers/gpu/drm/radeon/radeon_object.h
index 7f8e778dba4..ede6c13628f 100644
--- a/drivers/gpu/drm/radeon/radeon_object.h
+++ b/drivers/gpu/drm/radeon/radeon_object.h
@@ -87,7 +87,7 @@ static inline void radeon_bo_unreserve(struct radeon_bo *bo)
87 * Returns current GPU offset of the object. 87 * Returns current GPU offset of the object.
88 * 88 *
89 * Note: object should either be pinned or reserved when calling this 89 * Note: object should either be pinned or reserved when calling this
90 * function, it might be usefull to add check for this for debugging. 90 * function, it might be useful to add check for this for debugging.
91 */ 91 */
92static inline u64 radeon_bo_gpu_offset(struct radeon_bo *bo) 92static inline u64 radeon_bo_gpu_offset(struct radeon_bo *bo)
93{ 93{
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c
index 2aed03bde4b..86eda1ea94d 100644
--- a/drivers/gpu/drm/radeon/radeon_pm.c
+++ b/drivers/gpu/drm/radeon/radeon_pm.c
@@ -23,6 +23,7 @@
23#include "drmP.h" 23#include "drmP.h"
24#include "radeon.h" 24#include "radeon.h"
25#include "avivod.h" 25#include "avivod.h"
26#include "atom.h"
26#ifdef CONFIG_ACPI 27#ifdef CONFIG_ACPI
27#include <linux/acpi.h> 28#include <linux/acpi.h>
28#endif 29#endif
@@ -365,12 +366,14 @@ static ssize_t radeon_set_pm_profile(struct device *dev,
365 else if (strncmp("high", buf, strlen("high")) == 0) 366 else if (strncmp("high", buf, strlen("high")) == 0)
366 rdev->pm.profile = PM_PROFILE_HIGH; 367 rdev->pm.profile = PM_PROFILE_HIGH;
367 else { 368 else {
368 DRM_ERROR("invalid power profile!\n"); 369 count = -EINVAL;
369 goto fail; 370 goto fail;
370 } 371 }
371 radeon_pm_update_profile(rdev); 372 radeon_pm_update_profile(rdev);
372 radeon_pm_set_clocks(rdev); 373 radeon_pm_set_clocks(rdev);
373 } 374 } else
375 count = -EINVAL;
376
374fail: 377fail:
375 mutex_unlock(&rdev->pm.mutex); 378 mutex_unlock(&rdev->pm.mutex);
376 379
@@ -413,7 +416,7 @@ static ssize_t radeon_set_pm_method(struct device *dev,
413 mutex_unlock(&rdev->pm.mutex); 416 mutex_unlock(&rdev->pm.mutex);
414 cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work); 417 cancel_delayed_work_sync(&rdev->pm.dynpm_idle_work);
415 } else { 418 } else {
416 DRM_ERROR("invalid power method!\n"); 419 count = -EINVAL;
417 goto fail; 420 goto fail;
418 } 421 }
419 radeon_pm_compute_clocks(rdev); 422 radeon_pm_compute_clocks(rdev);
@@ -533,7 +536,11 @@ void radeon_pm_resume(struct radeon_device *rdev)
533 /* set up the default clocks if the MC ucode is loaded */ 536 /* set up the default clocks if the MC ucode is loaded */
534 if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { 537 if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) {
535 if (rdev->pm.default_vddc) 538 if (rdev->pm.default_vddc)
536 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc); 539 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
540 SET_VOLTAGE_TYPE_ASIC_VDDC);
541 if (rdev->pm.default_vddci)
542 radeon_atom_set_voltage(rdev, rdev->pm.default_vddci,
543 SET_VOLTAGE_TYPE_ASIC_VDDCI);
537 if (rdev->pm.default_sclk) 544 if (rdev->pm.default_sclk)
538 radeon_set_engine_clock(rdev, rdev->pm.default_sclk); 545 radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
539 if (rdev->pm.default_mclk) 546 if (rdev->pm.default_mclk)
@@ -546,6 +553,7 @@ void radeon_pm_resume(struct radeon_device *rdev)
546 rdev->pm.current_sclk = rdev->pm.default_sclk; 553 rdev->pm.current_sclk = rdev->pm.default_sclk;
547 rdev->pm.current_mclk = rdev->pm.default_mclk; 554 rdev->pm.current_mclk = rdev->pm.default_mclk;
548 rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage; 555 rdev->pm.current_vddc = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.voltage;
556 rdev->pm.current_vddci = rdev->pm.power_state[rdev->pm.default_power_state_index].clock_info[0].voltage.vddci;
549 if (rdev->pm.pm_method == PM_METHOD_DYNPM 557 if (rdev->pm.pm_method == PM_METHOD_DYNPM
550 && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) { 558 && rdev->pm.dynpm_state == DYNPM_STATE_SUSPENDED) {
551 rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE; 559 rdev->pm.dynpm_state = DYNPM_STATE_ACTIVE;
@@ -583,7 +591,8 @@ int radeon_pm_init(struct radeon_device *rdev)
583 /* set up the default clocks if the MC ucode is loaded */ 591 /* set up the default clocks if the MC ucode is loaded */
584 if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) { 592 if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) {
585 if (rdev->pm.default_vddc) 593 if (rdev->pm.default_vddc)
586 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc); 594 radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
595 SET_VOLTAGE_TYPE_ASIC_VDDC);
587 if (rdev->pm.default_sclk) 596 if (rdev->pm.default_sclk)
588 radeon_set_engine_clock(rdev, rdev->pm.default_sclk); 597 radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
589 if (rdev->pm.default_mclk) 598 if (rdev->pm.default_mclk)
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c
index d86254d7f80..08c0233db1b 100644
--- a/drivers/gpu/drm/radeon/radeon_ring.c
+++ b/drivers/gpu/drm/radeon/radeon_ring.c
@@ -248,7 +248,7 @@ void radeon_ib_pool_fini(struct radeon_device *rdev)
248void radeon_ring_free_size(struct radeon_device *rdev) 248void radeon_ring_free_size(struct radeon_device *rdev)
249{ 249{
250 if (rdev->wb.enabled) 250 if (rdev->wb.enabled)
251 rdev->cp.rptr = rdev->wb.wb[RADEON_WB_CP_RPTR_OFFSET/4]; 251 rdev->cp.rptr = le32_to_cpu(rdev->wb.wb[RADEON_WB_CP_RPTR_OFFSET/4]);
252 else { 252 else {
253 if (rdev->family >= CHIP_R600) 253 if (rdev->family >= CHIP_R600)
254 rdev->cp.rptr = RREG32(R600_CP_RB_RPTR); 254 rdev->cp.rptr = RREG32(R600_CP_RB_RPTR);
diff --git a/drivers/gpu/drm/radeon/radeon_state.c b/drivers/gpu/drm/radeon/radeon_state.c
index 4ae5a3d1074..92e7ea73b7c 100644
--- a/drivers/gpu/drm/radeon/radeon_state.c
+++ b/drivers/gpu/drm/radeon/radeon_state.c
@@ -980,7 +980,7 @@ static void radeon_cp_dispatch_clear(struct drm_device * dev,
980 } 980 }
981 981
982 /* hyper z clear */ 982 /* hyper z clear */
983 /* no docs available, based on reverse engeneering by Stephane Marchesin */ 983 /* no docs available, based on reverse engineering by Stephane Marchesin */
984 if ((flags & (RADEON_DEPTH | RADEON_STENCIL)) 984 if ((flags & (RADEON_DEPTH | RADEON_STENCIL))
985 && (flags & RADEON_CLEAR_FASTZ)) { 985 && (flags & RADEON_CLEAR_FASTZ)) {
986 986
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 19763f5df5e..6e3b11e5abb 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -48,17 +48,6 @@ int rs600_mc_wait_for_idle(struct radeon_device *rdev);
48 48
49void rs600_pre_page_flip(struct radeon_device *rdev, int crtc) 49void rs600_pre_page_flip(struct radeon_device *rdev, int crtc)
50{ 50{
51 struct radeon_crtc *radeon_crtc = rdev->mode_info.crtcs[crtc];
52 u32 tmp;
53
54 /* make sure flip is at vb rather than hb */
55 tmp = RREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset);
56 tmp &= ~AVIVO_D1GRPH_SURFACE_UPDATE_H_RETRACE_EN;
57 WREG32(AVIVO_D1GRPH_FLIP_CONTROL + radeon_crtc->crtc_offset, tmp);
58
59 /* set pageflip to happen anywhere in vblank interval */
60 WREG32(AVIVO_D1MODE_MASTER_UPDATE_MODE + radeon_crtc->crtc_offset, 0);
61
62 /* enable the pflip int */ 51 /* enable the pflip int */
63 radeon_irq_kms_pflip_irq_get(rdev, crtc); 52 radeon_irq_kms_pflip_irq_get(rdev, crtc);
64} 53}
@@ -125,7 +114,7 @@ void rs600_pm_misc(struct radeon_device *rdev)
125 udelay(voltage->delay); 114 udelay(voltage->delay);
126 } 115 }
127 } else if (voltage->type == VOLTAGE_VDDC) 116 } else if (voltage->type == VOLTAGE_VDDC)
128 radeon_atom_set_voltage(rdev, voltage->vddc_id); 117 radeon_atom_set_voltage(rdev, voltage->vddc_id, SET_VOLTAGE_TYPE_ASIC_VDDC);
129 118
130 dyn_pwrmgt_sclk_length = RREG32_PLL(DYN_PWRMGT_SCLK_LENGTH); 119 dyn_pwrmgt_sclk_length = RREG32_PLL(DYN_PWRMGT_SCLK_LENGTH);
131 dyn_pwrmgt_sclk_length &= ~REDUCED_POWER_SCLK_HILEN(0xf); 120 dyn_pwrmgt_sclk_length &= ~REDUCED_POWER_SCLK_HILEN(0xf);
diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c
index b974ac7df8d..ef8a5babe9f 100644
--- a/drivers/gpu/drm/radeon/rv770.c
+++ b/drivers/gpu/drm/radeon/rv770.c
@@ -106,7 +106,7 @@ void rv770_pm_misc(struct radeon_device *rdev)
106 106
107 if ((voltage->type == VOLTAGE_SW) && voltage->voltage) { 107 if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
108 if (voltage->voltage != rdev->pm.current_vddc) { 108 if (voltage->voltage != rdev->pm.current_vddc) {
109 radeon_atom_set_voltage(rdev, voltage->voltage); 109 radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC);
110 rdev->pm.current_vddc = voltage->voltage; 110 rdev->pm.current_vddc = voltage->voltage;
111 DRM_DEBUG("Setting: v: %d\n", voltage->voltage); 111 DRM_DEBUG("Setting: v: %d\n", voltage->voltage);
112 } 112 }
@@ -1255,9 +1255,6 @@ int rv770_init(struct radeon_device *rdev)
1255{ 1255{
1256 int r; 1256 int r;
1257 1257
1258 r = radeon_dummy_page_init(rdev);
1259 if (r)
1260 return r;
1261 /* This don't do much */ 1258 /* This don't do much */
1262 r = radeon_gem_init(rdev); 1259 r = radeon_gem_init(rdev);
1263 if (r) 1260 if (r)
@@ -1372,7 +1369,6 @@ void rv770_fini(struct radeon_device *rdev)
1372 radeon_atombios_fini(rdev); 1369 radeon_atombios_fini(rdev);
1373 kfree(rdev->bios); 1370 kfree(rdev->bios);
1374 rdev->bios = NULL; 1371 rdev->bios = NULL;
1375 radeon_dummy_page_fini(rdev);
1376} 1372}
1377 1373
1378static void rv770_pcie_gen2_enable(struct radeon_device *rdev) 1374static void rv770_pcie_gen2_enable(struct radeon_device *rdev)