summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux-core/radeon_combios.c32
-rw-r--r--linux-core/radeon_legacy_encoders.c11
-rw-r--r--linux-core/radeon_mode.h4
3 files changed, 43 insertions, 4 deletions
diff --git a/linux-core/radeon_combios.c b/linux-core/radeon_combios.c
index 56116463..02f7335f 100644
--- a/linux-core/radeon_combios.c
+++ b/linux-core/radeon_combios.c
@@ -460,6 +460,36 @@ bool radeon_combios_get_clock_info(struct drm_device *dev)
return false;
}
+bool radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder)
+{
+ struct drm_device *dev = encoder->base.dev;
+ struct drm_radeon_private *dev_priv = dev->dev_private;
+ uint16_t dac_info;
+ uint8_t rev, bg, dac;
+
+ /* check CRT table */
+ dac_info = combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE);
+ if (dac_info) {
+ rev = radeon_bios8(dev_priv, dac_info) & 0x3;
+ if (rev < 2) {
+ bg = radeon_bios8(dev_priv, dac_info + 0x2) & 0xf;
+ dac = (radeon_bios8(dev_priv, dac_info + 0x2) >> 4) & 0xf;
+ encoder->ps2_pdac_adj = (bg << 8) | (dac);
+
+ return true;
+ } else {
+ bg = radeon_bios8(dev_priv, dac_info + 0x2) & 0xf;
+ dac = radeon_bios8(dev_priv, dac_info + 0x3) & 0xf;
+ encoder->ps2_pdac_adj = (bg << 8) | (dac);
+
+ return true;
+ }
+
+ }
+
+ return false;
+}
+
bool radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder)
{
struct drm_device *dev = encoder->base.dev;
@@ -908,7 +938,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
dev_priv->chip_family == CHIP_RS480) {
uint16_t lcd_info = combios_get_table_offset(dev, COMBIOS_LCD_INFO_TABLE);
if (lcd_info) {
- uint16_t lcd_ddc_info = lcd_ddc_info = combios_get_table_offset(dev, COMBIOS_LCD_DDC_INFO_TABLE);
+ uint16_t lcd_ddc_info = combios_get_table_offset(dev, COMBIOS_LCD_DDC_INFO_TABLE);
mode_info->bios_connector[4].valid = true;
mode_info->bios_connector[4].connector_type = CONNECTOR_LVDS;
diff --git a/linux-core/radeon_legacy_encoders.c b/linux-core/radeon_legacy_encoders.c
index 172f93de..48cdd18c 100644
--- a/linux-core/radeon_legacy_encoders.c
+++ b/linux-core/radeon_legacy_encoders.c
@@ -420,6 +420,7 @@ static void radeon_legacy_primary_dac_mode_set(struct drm_encoder *encoder,
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_encoder *radeon_encoder = to_radeon_encoder(encoder);
uint32_t disp_output_cntl, dac_cntl, dac2_cntl, dac_macro_cntl;
DRM_DEBUG("\n");
@@ -458,7 +459,11 @@ static void radeon_legacy_primary_dac_mode_set(struct drm_encoder *encoder,
RADEON_DAC_RANGE_CNTL |
RADEON_DAC_BLANKING);
- dac_macro_cntl = RADEON_READ(RADEON_DAC_MACRO_CNTL);
+ if (radeon_encoder->ps2_pdac_adj)
+ dac_macro_cntl = radeon_encoder->ps2_pdac_adj;
+ else
+ dac_macro_cntl = RADEON_READ(RADEON_DAC_MACRO_CNTL);
+ dac_macro_cntl |= RADEON_DAC_PDWN_R | RADEON_DAC_PDWN_G | RADEON_DAC_PDWN_B;
RADEON_WRITE(RADEON_DAC_MACRO_CNTL, dac_macro_cntl);
}
@@ -504,8 +509,8 @@ struct drm_encoder *radeon_encoder_legacy_primary_dac_add(struct drm_device *dev
drm_encoder_helper_add(encoder, &radeon_legacy_primary_dac_helper_funcs);
- /* TODO get the primary dac vals from bios tables */
- //radeon_combios_get_lvds_info(radeon_encoder);
+ /* get the primary dac bg/adj vals from bios tables */
+ radeon_combios_get_primary_dac_info(radeon_encoder);
return encoder;
}
diff --git a/linux-core/radeon_mode.h b/linux-core/radeon_mode.h
index 3271375d..ee801604 100644
--- a/linux-core/radeon_mode.h
+++ b/linux-core/radeon_mode.h
@@ -368,6 +368,9 @@ struct radeon_encoder {
bool use_bios_dividers;
uint32_t lvds_gen_cntl;
+ /* legacy primary dac */
+ uint32_t ps2_pdac_adj;
+
/* legacy tv dac */
uint32_t ps2_tvdac_adj;
uint32_t ntsc_tvdac_adj;
@@ -439,6 +442,7 @@ extern bool radeon_combios_get_lvds_info(struct radeon_encoder *encoder);
extern bool radeon_combios_get_tmds_info(struct radeon_encoder *encoder);
extern bool radeon_combios_get_tv_info(struct radeon_encoder *encoder);
extern bool radeon_combios_get_tv_dac_info(struct radeon_encoder *encoder);
+extern bool radeon_combios_get_primary_dac_info(struct radeon_encoder *encoder);
extern void radeon_crtc_fb_gamma_set(struct drm_crtc *crtc, u16 red, u16 green,
u16 blue, int regno);
struct drm_framebuffer *radeon_user_framebuffer_create(struct drm_device *dev,