diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2009-06-12 13:26:08 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2009-06-14 22:02:27 -0400 |
commit | 6fe7ac3f5b544703581f3829c8c950dc721d976e (patch) | |
tree | f4c98df51d3b73486572bc3f4c65a96c6bdd34f0 /drivers/gpu/drm | |
parent | 771fe6b912fca54f03e8a72eb63058b582775362 (diff) |
radeon legacy chips: tv dac bg/dac adj updates
COMBIOS - fallback to table values if there are no tv dac or lvds bios tables
ATOMBIOS - add support for looking up these values from the bios table
Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_atombios.c | 72 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_combios.c | 7 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_legacy_encoders.c | 8 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_mode.h | 4 |
4 files changed, 88 insertions, 3 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 98904de63874..786632d3e378 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c | |||
@@ -824,6 +824,78 @@ struct radeon_encoder_atom_dig *radeon_atombios_get_lvds_info(struct | |||
824 | return lvds; | 824 | return lvds; |
825 | } | 825 | } |
826 | 826 | ||
827 | struct radeon_encoder_primary_dac * | ||
828 | radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder) | ||
829 | { | ||
830 | struct drm_device *dev = encoder->base.dev; | ||
831 | struct radeon_device *rdev = dev->dev_private; | ||
832 | struct radeon_mode_info *mode_info = &rdev->mode_info; | ||
833 | int index = GetIndexIntoMasterTable(DATA, CompassionateData); | ||
834 | uint16_t data_offset; | ||
835 | struct _COMPASSIONATE_DATA *dac_info; | ||
836 | uint8_t frev, crev; | ||
837 | uint8_t bg, dac; | ||
838 | int i; | ||
839 | struct radeon_encoder_primary_dac *p_dac = NULL; | ||
840 | |||
841 | atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset); | ||
842 | |||
843 | dac_info = (struct _COMPASSIONATE_DATA *)(mode_info->atom_context->bios + data_offset); | ||
844 | |||
845 | if (dac_info) { | ||
846 | p_dac = kzalloc(sizeof(struct radeon_encoder_primary_dac), GFP_KERNEL); | ||
847 | |||
848 | if (!p_dac) | ||
849 | return NULL; | ||
850 | |||
851 | bg = dac_info->ucDAC1_BG_Adjustment; | ||
852 | dac = dac_info->ucDAC1_DAC_Adjustment; | ||
853 | p_dac->ps2_pdac_adj = (bg << 8) | (dac); | ||
854 | |||
855 | } | ||
856 | return p_dac; | ||
857 | } | ||
858 | |||
859 | struct radeon_encoder_tv_dac * | ||
860 | radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder) | ||
861 | { | ||
862 | struct drm_device *dev = encoder->base.dev; | ||
863 | struct radeon_device *rdev = dev->dev_private; | ||
864 | struct radeon_mode_info *mode_info = &rdev->mode_info; | ||
865 | int index = GetIndexIntoMasterTable(DATA, CompassionateData); | ||
866 | uint16_t data_offset; | ||
867 | struct _COMPASSIONATE_DATA *dac_info; | ||
868 | uint8_t frev, crev; | ||
869 | uint8_t bg, dac; | ||
870 | int i; | ||
871 | struct radeon_encoder_tv_dac *tv_dac = NULL; | ||
872 | |||
873 | atom_parse_data_header(mode_info->atom_context, index, NULL, &frev, &crev, &data_offset); | ||
874 | |||
875 | dac_info = (struct _COMPASSIONATE_DATA *)(mode_info->atom_context->bios + data_offset); | ||
876 | |||
877 | if (dac_info) { | ||
878 | tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL); | ||
879 | |||
880 | if (!tv_dac) | ||
881 | return NULL; | ||
882 | |||
883 | bg = dac_info->ucDAC2_CRT2_BG_Adjustment; | ||
884 | dac = dac_info->ucDAC2_CRT2_DAC_Adjustment; | ||
885 | tv_dac->ps2_tvdac_adj = (bg << 16) | (dac << 20); | ||
886 | |||
887 | bg = dac_info->ucDAC2_PAL_BG_Adjustment; | ||
888 | dac = dac_info->ucDAC2_PAL_DAC_Adjustment; | ||
889 | tv_dac->pal_tvdac_adj = (bg << 16) | (dac << 20); | ||
890 | |||
891 | bg = dac_info->ucDAC2_NTSC_BG_Adjustment; | ||
892 | dac = dac_info->ucDAC2_NTSC_DAC_Adjustment; | ||
893 | tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20); | ||
894 | |||
895 | } | ||
896 | return tv_dac; | ||
897 | } | ||
898 | |||
827 | void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable) | 899 | void radeon_atom_set_clock_gating(struct radeon_device *rdev, int enable) |
828 | { | 900 | { |
829 | DYNAMIC_CLOCK_GATING_PS_ALLOCATION args; | 901 | DYNAMIC_CLOCK_GATING_PS_ALLOCATION args; |
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index be52198fa56a..06e8038bc4ac 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -783,6 +783,9 @@ struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct | |||
783 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; | 783 | tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj; |
784 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; | 784 | tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj; |
785 | } | 785 | } |
786 | } else { | ||
787 | DRM_INFO("No TV DAC info found in BIOS\n"); | ||
788 | return radeon_legacy_get_tv_dac_info_from_table(rdev); | ||
786 | } | 789 | } |
787 | } | 790 | } |
788 | 791 | ||
@@ -964,8 +967,10 @@ struct radeon_encoder_lvds *radeon_combios_get_lvds_info(struct radeon_encoder | |||
964 | } | 967 | } |
965 | } | 968 | } |
966 | encoder->native_mode = lvds->native_mode; | 969 | encoder->native_mode = lvds->native_mode; |
967 | } else | 970 | } else { |
968 | DRM_INFO("No panel info found in BIOS\n"); | 971 | DRM_INFO("No panel info found in BIOS\n"); |
972 | return radeon_legacy_get_lvds_info_from_regs(rdev); | ||
973 | } | ||
969 | return lvds; | 974 | return lvds; |
970 | } | 975 | } |
971 | 976 | ||
diff --git a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c index c41ab0966f86..2c2f42de1d4c 100644 --- a/drivers/gpu/drm/radeon/radeon_legacy_encoders.c +++ b/drivers/gpu/drm/radeon/radeon_legacy_encoders.c | |||
@@ -1265,13 +1265,17 @@ radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t | |||
1265 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: | 1265 | case ENCODER_OBJECT_ID_INTERNAL_DAC1: |
1266 | drm_encoder_init(dev, encoder, &radeon_legacy_primary_dac_enc_funcs, DRM_MODE_ENCODER_DAC); | 1266 | drm_encoder_init(dev, encoder, &radeon_legacy_primary_dac_enc_funcs, DRM_MODE_ENCODER_DAC); |
1267 | drm_encoder_helper_add(encoder, &radeon_legacy_primary_dac_helper_funcs); | 1267 | drm_encoder_helper_add(encoder, &radeon_legacy_primary_dac_helper_funcs); |
1268 | if (!rdev->is_atom_bios) | 1268 | if (rdev->is_atom_bios) |
1269 | radeon_encoder->enc_priv = radeon_atombios_get_primary_dac_info(radeon_encoder); | ||
1270 | else | ||
1269 | radeon_encoder->enc_priv = radeon_combios_get_primary_dac_info(radeon_encoder); | 1271 | radeon_encoder->enc_priv = radeon_combios_get_primary_dac_info(radeon_encoder); |
1270 | break; | 1272 | break; |
1271 | case ENCODER_OBJECT_ID_INTERNAL_DAC2: | 1273 | case ENCODER_OBJECT_ID_INTERNAL_DAC2: |
1272 | drm_encoder_init(dev, encoder, &radeon_legacy_tv_dac_enc_funcs, DRM_MODE_ENCODER_TVDAC); | 1274 | drm_encoder_init(dev, encoder, &radeon_legacy_tv_dac_enc_funcs, DRM_MODE_ENCODER_TVDAC); |
1273 | drm_encoder_helper_add(encoder, &radeon_legacy_tv_dac_helper_funcs); | 1275 | drm_encoder_helper_add(encoder, &radeon_legacy_tv_dac_helper_funcs); |
1274 | if (!rdev->is_atom_bios) | 1276 | if (rdev->is_atom_bios) |
1277 | radeon_encoder->enc_priv = radeon_atombios_get_tv_dac_info(radeon_encoder); | ||
1278 | else | ||
1275 | radeon_encoder->enc_priv = radeon_combios_get_tv_dac_info(radeon_encoder); | 1279 | radeon_encoder->enc_priv = radeon_combios_get_tv_dac_info(radeon_encoder); |
1276 | break; | 1280 | break; |
1277 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: | 1281 | case ENCODER_OBJECT_ID_INTERNAL_DVO1: |
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h index 4b37746eae55..9173b687462b 100644 --- a/drivers/gpu/drm/radeon/radeon_mode.h +++ b/drivers/gpu/drm/radeon/radeon_mode.h | |||
@@ -329,6 +329,10 @@ extern struct radeon_encoder_atom_dig * | |||
329 | radeon_atombios_get_lvds_info(struct radeon_encoder *encoder); | 329 | radeon_atombios_get_lvds_info(struct radeon_encoder *encoder); |
330 | extern struct radeon_encoder_int_tmds * | 330 | extern struct radeon_encoder_int_tmds * |
331 | radeon_atombios_get_tmds_info(struct radeon_encoder *encoder); | 331 | radeon_atombios_get_tmds_info(struct radeon_encoder *encoder); |
332 | extern struct radeon_encoder_primary_dac * | ||
333 | radeon_atombios_get_primary_dac_info(struct radeon_encoder *encoder); | ||
334 | extern struct radeon_encoder_tv_dac * | ||
335 | radeon_atombios_get_tv_dac_info(struct radeon_encoder *encoder); | ||
332 | extern struct radeon_encoder_lvds * | 336 | extern struct radeon_encoder_lvds * |
333 | radeon_combios_get_lvds_info(struct radeon_encoder *encoder); | 337 | radeon_combios_get_lvds_info(struct radeon_encoder *encoder); |
334 | extern struct radeon_encoder_int_tmds * | 338 | extern struct radeon_encoder_int_tmds * |