aboutsummaryrefslogtreecommitdiff
path: root/linux-core
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2008-08-28 11:30:20 +1000
committerDave Airlie <airlied@redhat.com>2008-08-28 11:30:20 +1000
commit6a27e019bc16ce901d6be6c85e63c0bad75dd16a (patch)
tree2d400709e294e2dd262028c1dd7ec5c0baf356f5 /linux-core
parent7552b2a6c3b29da308a76dade4959180d0d1c57b (diff)
radeon: fixup checks for crtc in dpms paths
Diffstat (limited to 'linux-core')
-rw-r--r--linux-core/radeon_encoders.c26
-rw-r--r--linux-core/radeon_legacy_encoders.c55
2 files changed, 60 insertions, 21 deletions
diff --git a/linux-core/radeon_encoders.c b/linux-core/radeon_encoders.c
index 787102e7..a889953e 100644
--- a/linux-core/radeon_encoders.c
+++ b/linux-core/radeon_encoders.c
@@ -273,9 +273,15 @@ static void radeon_lvtma_dpms(struct drm_encoder *encoder, int mode)
{
struct drm_device *dev = encoder->dev;
struct drm_radeon_private *dev_priv = dev->dev_private;
- struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
+ struct radeon_crtc *radeon_crtc;
int index = GetIndexIntoMasterTable(COMMAND, LCD1OutputControl);
uint32_t bios_2_scratch, bios_3_scratch;
+ int crtc_id = 0;
+
+ if (encoder->crtc) {
+ struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
+ crtc_id = radeon_crtc->crtc_id;
+ }
if (dev_priv->chip_family >= CHIP_R600) {
bios_2_scratch = RADEON_READ(R600_BIOS_2_SCRATCH);
@@ -286,7 +292,7 @@ static void radeon_lvtma_dpms(struct drm_encoder *encoder, int mode)
}
bios_2_scratch &= ~ATOM_S3_LCD1_CRTC_ACTIVE;
- bios_3_scratch |= (radeon_crtc->crtc_id << 17);
+ bios_3_scratch |= (crtc_id << 17);
switch(mode) {
case DRM_MODE_DPMS_ON:
@@ -393,10 +399,16 @@ static void radeon_atom_dac_dpms(struct drm_encoder *encoder, int mode)
struct drm_device *dev = encoder->dev;
struct drm_radeon_private *dev_priv = dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
- struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
+ struct radeon_crtc *radeon_crtc;
int atom_type = -1;
int index;
uint32_t bios_2_scratch, bios_3_scratch;
+ int crtc_id = 0;
+
+ if (encoder->crtc) {
+ radeon_crtc = to_radeon_crtc(encoder->crtc);
+ crtc_id = radeon_crtc->crtc_id;
+ }
atom_type = atom_dac_find_atom_type(radeon_encoder, NULL);
if (atom_type == -1)
@@ -414,7 +426,7 @@ static void radeon_atom_dac_dpms(struct drm_encoder *encoder, int mode)
case ATOM_DEVICE_CRT1_INDEX:
index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl);
bios_2_scratch &= ~ATOM_S3_CRT1_CRTC_ACTIVE;
- bios_3_scratch |= (radeon_crtc->crtc_id << 16);
+ bios_3_scratch |= (crtc_id << 16);
switch(mode) {
case DRM_MODE_DPMS_ON:
bios_2_scratch &= ~ATOM_S2_CRT1_DPMS_STATE;
@@ -431,7 +443,7 @@ static void radeon_atom_dac_dpms(struct drm_encoder *encoder, int mode)
case ATOM_DEVICE_CRT2_INDEX:
index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl);
bios_2_scratch &= ~ATOM_S3_CRT2_CRTC_ACTIVE;
- bios_3_scratch |= (radeon_crtc->crtc_id << 20);
+ bios_3_scratch |= (crtc_id << 20);
switch(mode) {
case DRM_MODE_DPMS_ON:
bios_2_scratch &= ~ATOM_S2_CRT2_DPMS_STATE;
@@ -448,7 +460,7 @@ static void radeon_atom_dac_dpms(struct drm_encoder *encoder, int mode)
case ATOM_DEVICE_TV1_INDEX:
index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl);
bios_3_scratch &= ~ATOM_S3_TV1_CRTC_ACTIVE;
- bios_3_scratch |= (radeon_crtc->crtc_id << 18);
+ bios_3_scratch |= (crtc_id << 18);
switch(mode) {
case DRM_MODE_DPMS_ON:
bios_2_scratch &= ~ATOM_S2_TV1_DPMS_STATE;
@@ -465,7 +477,7 @@ static void radeon_atom_dac_dpms(struct drm_encoder *encoder, int mode)
case ATOM_DEVICE_CV_INDEX:
index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl);
bios_2_scratch &= ~ATOM_S3_CV_CRTC_ACTIVE;
- bios_3_scratch |= (radeon_crtc->crtc_id << 24);
+ bios_3_scratch |= (crtc_id << 24);
switch(mode) {
case DRM_MODE_DPMS_ON:
bios_2_scratch &= ~ATOM_S2_CV_DPMS_STATE;
diff --git a/linux-core/radeon_legacy_encoders.c b/linux-core/radeon_legacy_encoders.c
index 5b0047e4..3fae0076 100644
--- a/linux-core/radeon_legacy_encoders.c
+++ b/linux-core/radeon_legacy_encoders.c
@@ -197,18 +197,23 @@ static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode)
struct drm_device *dev = encoder->dev;
struct drm_radeon_private *dev_priv = dev->dev_private;
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
- struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
+ struct radeon_crtc *radeon_crtc;
uint32_t lvds_gen_cntl, lvds_pll_cntl, pixclks_cntl, disp_pwr_man;
uint32_t bios_5_scratch, bios_6_scratch;
-
+ int crtc_id = 0;
DRM_DEBUG("\n");
+ if (encoder->crtc) {
+ radeon_crtc = to_radeon_crtc(encoder->crtc);
+ crtc_id = radeon_crtc->crtc_id;
+ }
+
// FIXME atom/legacy cards like r4xx
bios_5_scratch = RADEON_READ(RADEON_BIOS_5_SCRATCH);
bios_6_scratch = RADEON_READ(RADEON_BIOS_6_SCRATCH);
bios_5_scratch &= ~RADEON_LCD1_CRTC_MASK;
- bios_5_scratch |= (radeon_crtc->crtc_id << RADEON_LCD1_CRTC_SHIFT);
+ bios_5_scratch |= (crtc_id << RADEON_LCD1_CRTC_SHIFT);
switch (mode) {
case DRM_MODE_DPMS_ON:
@@ -396,20 +401,26 @@ static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode
{
struct drm_device *dev = encoder->dev;
struct drm_radeon_private *dev_priv = dev->dev_private;
- struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
+ struct radeon_crtc *radeon_crtc;
uint32_t crtc_ext_cntl = RADEON_READ(RADEON_CRTC_EXT_CNTL);
uint32_t dac_cntl = RADEON_READ(RADEON_DAC_CNTL);
uint32_t dac_macro_cntl = RADEON_READ(RADEON_DAC_MACRO_CNTL);
uint32_t bios_5_scratch, bios_6_scratch;
+ int crtc_id = 0;
DRM_DEBUG("\n");
+ if (encoder->crtc) {
+ radeon_crtc = to_radeon_crtc(encoder->crtc);
+ crtc_id = radeon_crtc->crtc_id;
+ }
+
// FIXME atom/legacy cards like r4xx
bios_5_scratch = RADEON_READ(RADEON_BIOS_5_SCRATCH);
bios_6_scratch = RADEON_READ(RADEON_BIOS_6_SCRATCH);
bios_5_scratch &= ~RADEON_CRT1_CRTC_MASK;
- bios_5_scratch |= (radeon_crtc->crtc_id << RADEON_CRT1_CRTC_SHIFT);
+ bios_5_scratch |= (crtc_id << RADEON_CRT1_CRTC_SHIFT);
DRM_DEBUG("\n");
@@ -629,18 +640,23 @@ static void radeon_legacy_tmds_int_dpms(struct drm_encoder *encoder, int mode)
{
struct drm_device *dev = encoder->dev;
struct drm_radeon_private *dev_priv = dev->dev_private;
- struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
+ struct radeon_crtc *radeon_crtc;
uint32_t fp_gen_cntl = RADEON_READ(RADEON_FP_GEN_CNTL);
uint32_t bios_5_scratch, bios_6_scratch;
-
+ int crtc_id = 0;
DRM_DEBUG("\n");
+ if (encoder->crtc) {
+ radeon_crtc = to_radeon_crtc(encoder->crtc);
+ crtc_id = radeon_crtc->crtc_id;
+ }
+
// FIXME atom/legacy cards like r4xx
bios_5_scratch = RADEON_READ(RADEON_BIOS_5_SCRATCH);
bios_6_scratch = RADEON_READ(RADEON_BIOS_6_SCRATCH);
bios_5_scratch &= ~RADEON_DFP1_CRTC_MASK;
- bios_5_scratch |= (radeon_crtc->crtc_id << RADEON_DFP1_CRTC_SHIFT);
+ bios_5_scratch |= (crtc_id << RADEON_DFP1_CRTC_SHIFT);
switch(mode) {
case DRM_MODE_DPMS_ON:
@@ -813,18 +829,23 @@ static void radeon_legacy_tmds_ext_dpms(struct drm_encoder *encoder, int mode)
{
struct drm_device *dev = encoder->dev;
struct drm_radeon_private *dev_priv = dev->dev_private;
- struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
+ struct radeon_crtc *radeon_crtc;
uint32_t fp2_gen_cntl = RADEON_READ(RADEON_FP2_GEN_CNTL);
uint32_t bios_5_scratch, bios_6_scratch;
-
+ int crtc_id = 0;
DRM_DEBUG("\n");
+ if (encoder->crtc) {
+ radeon_crtc = to_radeon_crtc(encoder->crtc);
+ crtc_id = radeon_crtc->crtc_id;
+ }
+
// FIXME atom/legacy cards like r4xx
bios_5_scratch = RADEON_READ(RADEON_BIOS_5_SCRATCH);
bios_6_scratch = RADEON_READ(RADEON_BIOS_6_SCRATCH);
bios_5_scratch &= ~RADEON_DFP2_CRTC_MASK;
- bios_5_scratch |= (radeon_crtc->crtc_id << RADEON_DFP2_CRTC_SHIFT);
+ bios_5_scratch |= (crtc_id << RADEON_DFP2_CRTC_SHIFT);
switch(mode) {
case DRM_MODE_DPMS_ON:
@@ -969,22 +990,28 @@ static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode)
{
struct drm_device *dev = encoder->dev;
struct drm_radeon_private *dev_priv = dev->dev_private;
- struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc);
+ struct radeon_crtc *radeon_crtc;
uint32_t fp2_gen_cntl = 0, crtc2_gen_cntl = 0, tv_dac_cntl = 0;
//uint32_t tv_master_cntl = 0;
uint32_t bios_5_scratch, bios_6_scratch;
+ int crtc_id = 0;
DRM_DEBUG("\n");
+ if (encoder->crtc) {
+ radeon_crtc = to_radeon_crtc(encoder->crtc);
+ crtc_id = radeon_crtc->crtc_id;
+ }
+
// FIXME atom/legacy cards like r4xx
bios_5_scratch = RADEON_READ(RADEON_BIOS_5_SCRATCH);
bios_6_scratch = RADEON_READ(RADEON_BIOS_6_SCRATCH);
bios_5_scratch &= ~RADEON_CRT2_CRTC_MASK;
- bios_5_scratch |= (radeon_crtc->crtc_id << RADEON_CRT2_CRTC_SHIFT);
+ bios_5_scratch |= (crtc_id << RADEON_CRT2_CRTC_SHIFT);
// FIXME TV
//bios_5_scratch &= ~RADEON_TV1_CRTC_MASK;
- //bios_5_scratch |= (radeon_crtc->crtc_id << RADEON_TV1_CRTC_SHIFT);
+ //bios_5_scratch |= (crtc_id << RADEON_TV1_CRTC_SHIFT);
if (dev_priv->chip_family == CHIP_R200)
fp2_gen_cntl = RADEON_READ(RADEON_FP2_GEN_CNTL);