136,7 → 136,14 |
lvds_pll_cntl &= ~RADEON_LVDS_PLL_EN; |
|
lvds_ss_gen_cntl = RREG32(RADEON_LVDS_SS_GEN_CNTL); |
if ((!rdev->is_atom_bios)) { |
if (rdev->is_atom_bios) { |
/* LVDS_GEN_CNTL parameters are computed in LVDSEncoderControl |
* need to call that on resume to set up the reg properly. |
*/ |
radeon_encoder->pixel_clock = adjusted_mode->clock; |
atombios_digital_setup(encoder, PANEL_ENCODER_ACTION_ENABLE); |
lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL); |
} else { |
struct radeon_encoder_lvds *lvds = (struct radeon_encoder_lvds *)radeon_encoder->enc_priv; |
if (lvds) { |
DRM_DEBUG("bios LVDS_GEN_CNTL: 0x%x\n", lvds->lvds_gen_cntl); |
147,8 → 154,7 |
(lvds->panel_blon_delay << RADEON_LVDS_PWRSEQ_DELAY2_SHIFT)); |
} else |
lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL); |
} else |
lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL); |
} |
lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS; |
lvds_gen_cntl &= ~(RADEON_LVDS_ON | |
RADEON_LVDS_BLON | |
184,7 → 190,7 |
radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); |
} |
|
static bool radeon_legacy_lvds_mode_fixup(struct drm_encoder *encoder, |
static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder, |
struct drm_display_mode *mode, |
struct drm_display_mode *adjusted_mode) |
{ |
194,8 → 200,15 |
radeon_encoder_set_active_device(encoder); |
drm_mode_set_crtcinfo(adjusted_mode, 0); |
|
if (radeon_encoder->rmx_type != RMX_OFF) |
radeon_rmx_mode_fixup(encoder, mode, adjusted_mode); |
/* get the native mode for LVDS */ |
if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) { |
struct drm_display_mode *native_mode = &radeon_encoder->native_mode; |
int mode_id = adjusted_mode->base.id; |
*adjusted_mode = *native_mode; |
adjusted_mode->hdisplay = mode->hdisplay; |
adjusted_mode->vdisplay = mode->vdisplay; |
adjusted_mode->base.id = mode_id; |
} |
|
return true; |
} |
202,7 → 215,7 |
|
static const struct drm_encoder_helper_funcs radeon_legacy_lvds_helper_funcs = { |
.dpms = radeon_legacy_lvds_dpms, |
.mode_fixup = radeon_legacy_lvds_mode_fixup, |
.mode_fixup = radeon_legacy_mode_fixup, |
.prepare = radeon_legacy_lvds_prepare, |
.mode_set = radeon_legacy_lvds_mode_set, |
.commit = radeon_legacy_lvds_commit, |
214,17 → 227,6 |
.destroy = radeon_enc_destroy, |
}; |
|
static bool radeon_legacy_primary_dac_mode_fixup(struct drm_encoder *encoder, |
struct drm_display_mode *mode, |
struct drm_display_mode *adjusted_mode) |
{ |
/* set the active encoder to connector routing */ |
radeon_encoder_set_active_device(encoder); |
drm_mode_set_crtcinfo(adjusted_mode, 0); |
|
return true; |
} |
|
static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode) |
{ |
struct drm_device *dev = encoder->dev; |
410,7 → 412,7 |
|
static const struct drm_encoder_helper_funcs radeon_legacy_primary_dac_helper_funcs = { |
.dpms = radeon_legacy_primary_dac_dpms, |
.mode_fixup = radeon_legacy_primary_dac_mode_fixup, |
.mode_fixup = radeon_legacy_mode_fixup, |
.prepare = radeon_legacy_primary_dac_prepare, |
.mode_set = radeon_legacy_primary_dac_mode_set, |
.commit = radeon_legacy_primary_dac_commit, |
423,16 → 425,6 |
.destroy = radeon_enc_destroy, |
}; |
|
static bool radeon_legacy_tmds_int_mode_fixup(struct drm_encoder *encoder, |
struct drm_display_mode *mode, |
struct drm_display_mode *adjusted_mode) |
{ |
|
drm_mode_set_crtcinfo(adjusted_mode, 0); |
|
return true; |
} |
|
static void radeon_legacy_tmds_int_dpms(struct drm_encoder *encoder, int mode) |
{ |
struct drm_device *dev = encoder->dev; |
584,7 → 576,7 |
|
static const struct drm_encoder_helper_funcs radeon_legacy_tmds_int_helper_funcs = { |
.dpms = radeon_legacy_tmds_int_dpms, |
.mode_fixup = radeon_legacy_tmds_int_mode_fixup, |
.mode_fixup = radeon_legacy_mode_fixup, |
.prepare = radeon_legacy_tmds_int_prepare, |
.mode_set = radeon_legacy_tmds_int_mode_set, |
.commit = radeon_legacy_tmds_int_commit, |
596,17 → 588,6 |
.destroy = radeon_enc_destroy, |
}; |
|
static bool radeon_legacy_tmds_ext_mode_fixup(struct drm_encoder *encoder, |
struct drm_display_mode *mode, |
struct drm_display_mode *adjusted_mode) |
{ |
/* set the active encoder to connector routing */ |
radeon_encoder_set_active_device(encoder); |
drm_mode_set_crtcinfo(adjusted_mode, 0); |
|
return true; |
} |
|
static void radeon_legacy_tmds_ext_dpms(struct drm_encoder *encoder, int mode) |
{ |
struct drm_device *dev = encoder->dev; |
697,6 → 678,8 |
/*if (mode->clock > 165000) |
fp2_gen_cntl |= R300_FP2_DVO_DUAL_CHANNEL_EN;*/ |
} |
if (!radeon_combios_external_tmds_setup(encoder)) |
radeon_external_tmds_setup(encoder); |
} |
|
if (radeon_crtc->crtc_id == 0) { |
724,9 → 707,22 |
radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); |
} |
|
static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder) |
{ |
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); |
struct radeon_encoder_ext_tmds *tmds = radeon_encoder->enc_priv; |
if (tmds) { |
if (tmds->i2c_bus) |
radeon_i2c_destroy(tmds->i2c_bus); |
} |
kfree(radeon_encoder->enc_priv); |
drm_encoder_cleanup(encoder); |
kfree(radeon_encoder); |
} |
|
static const struct drm_encoder_helper_funcs radeon_legacy_tmds_ext_helper_funcs = { |
.dpms = radeon_legacy_tmds_ext_dpms, |
.mode_fixup = radeon_legacy_tmds_ext_mode_fixup, |
.mode_fixup = radeon_legacy_mode_fixup, |
.prepare = radeon_legacy_tmds_ext_prepare, |
.mode_set = radeon_legacy_tmds_ext_mode_set, |
.commit = radeon_legacy_tmds_ext_commit, |
735,20 → 731,9 |
|
|
static const struct drm_encoder_funcs radeon_legacy_tmds_ext_enc_funcs = { |
.destroy = radeon_enc_destroy, |
.destroy = radeon_ext_tmds_enc_destroy, |
}; |
|
static bool radeon_legacy_tv_dac_mode_fixup(struct drm_encoder *encoder, |
struct drm_display_mode *mode, |
struct drm_display_mode *adjusted_mode) |
{ |
/* set the active encoder to connector routing */ |
radeon_encoder_set_active_device(encoder); |
drm_mode_set_crtcinfo(adjusted_mode, 0); |
|
return true; |
} |
|
static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode) |
{ |
struct drm_device *dev = encoder->dev; |
1265,7 → 1250,7 |
|
static const struct drm_encoder_helper_funcs radeon_legacy_tv_dac_helper_funcs = { |
.dpms = radeon_legacy_tv_dac_dpms, |
.mode_fixup = radeon_legacy_tv_dac_mode_fixup, |
.mode_fixup = radeon_legacy_mode_fixup, |
.prepare = radeon_legacy_tv_dac_prepare, |
.mode_set = radeon_legacy_tv_dac_mode_set, |
.commit = radeon_legacy_tv_dac_commit, |
1302,6 → 1287,29 |
return tmds; |
} |
|
static struct radeon_encoder_ext_tmds *radeon_legacy_get_ext_tmds_info(struct radeon_encoder *encoder) |
{ |
struct drm_device *dev = encoder->base.dev; |
struct radeon_device *rdev = dev->dev_private; |
struct radeon_encoder_ext_tmds *tmds = NULL; |
bool ret; |
|
if (rdev->is_atom_bios) |
return NULL; |
|
tmds = kzalloc(sizeof(struct radeon_encoder_ext_tmds), GFP_KERNEL); |
|
if (!tmds) |
return NULL; |
|
ret = radeon_legacy_get_ext_tmds_info_from_combios(encoder, tmds); |
|
if (ret == false) |
radeon_legacy_get_ext_tmds_info_from_table(encoder, tmds); |
|
return tmds; |
} |
|
void |
radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t supported_device) |
{ |
1329,7 → 1337,6 |
encoder->possible_crtcs = 0x1; |
else |
encoder->possible_crtcs = 0x3; |
encoder->possible_clones = 0; |
|
radeon_encoder->enc_priv = NULL; |
|
1373,7 → 1380,7 |
drm_encoder_init(dev, encoder, &radeon_legacy_tmds_ext_enc_funcs, DRM_MODE_ENCODER_TMDS); |
drm_encoder_helper_add(encoder, &radeon_legacy_tmds_ext_helper_funcs); |
if (!rdev->is_atom_bios) |
radeon_combios_get_ext_tmds_info(radeon_encoder); |
radeon_encoder->enc_priv = radeon_legacy_get_ext_tmds_info(radeon_encoder); |
break; |
} |
} |