Subversion Repositories Kolibri OS

Rev

Rev 1123 | Rev 1221 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1123 Rev 1179
Line 683... Line 683...
683
	0x01080000,		/* rv410 */
683
	0x01080000,		/* rv410 */
684
	0x00780000,		/* rs400 */
684
	0x00780000,		/* rs400 */
685
	0x00780000,		/* rs480 */
685
	0x00780000,		/* rs480 */
686
};
686
};
Line 687... Line -...
687
 
-
 
688
static struct radeon_encoder_tv_dac
687
 
-
 
688
static void radeon_legacy_get_tv_dac_info_from_table(struct radeon_device *rdev,
689
    *radeon_legacy_get_tv_dac_info_from_table(struct radeon_device *rdev)
689
						     struct radeon_encoder_tv_dac *tv_dac)
690
{
-
 
691
	struct radeon_encoder_tv_dac *tv_dac = NULL;
-
 
692
 
-
 
693
	tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
-
 
694
 
-
 
695
	if (!tv_dac)
-
 
696
		return NULL;
-
 
697
 
690
{
698
	tv_dac->ps2_tvdac_adj = default_tvdac_adj[rdev->family];
691
	tv_dac->ps2_tvdac_adj = default_tvdac_adj[rdev->family];
699
	if ((rdev->flags & RADEON_IS_MOBILITY) && (rdev->family == CHIP_RV250))
692
	if ((rdev->flags & RADEON_IS_MOBILITY) && (rdev->family == CHIP_RV250))
700
		tv_dac->ps2_tvdac_adj = 0x00880000;
693
		tv_dac->ps2_tvdac_adj = 0x00880000;
701
	tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
694
	tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
702
	tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
-
 
703
 
695
	tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
704
	return tv_dac;
696
	return;
Line 705... Line 697...
705
}
697
}
706
 
698
 
707
struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
699
struct radeon_encoder_tv_dac *radeon_combios_get_tv_dac_info(struct
Line 711... Line 703...
711
	struct drm_device *dev = encoder->base.dev;
703
	struct drm_device *dev = encoder->base.dev;
712
	struct radeon_device *rdev = dev->dev_private;
704
	struct radeon_device *rdev = dev->dev_private;
713
	uint16_t dac_info;
705
	uint16_t dac_info;
714
	uint8_t rev, bg, dac;
706
	uint8_t rev, bg, dac;
715
	struct radeon_encoder_tv_dac *tv_dac = NULL;
707
	struct radeon_encoder_tv_dac *tv_dac = NULL;
-
 
708
	int found = 0;
-
 
709
 
-
 
710
	tv_dac = kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
-
 
711
	if (!tv_dac)
-
 
712
		return NULL;
Line 716... Line 713...
716
 
713
 
717
	if (rdev->bios == NULL)
714
	if (rdev->bios == NULL)
Line 718... Line 715...
718
		return radeon_legacy_get_tv_dac_info_from_table(rdev);
715
		goto out;
719
 
716
 
720
	/* first check TV table */
717
	/* first check TV table */
721
	dac_info = combios_get_table_offset(dev, COMBIOS_TV_INFO_TABLE);
-
 
722
	if (dac_info) {
-
 
723
		tv_dac =
-
 
724
		    kzalloc(sizeof(struct radeon_encoder_tv_dac), GFP_KERNEL);
-
 
725
 
-
 
726
		if (!tv_dac)
-
 
727
			return NULL;
718
	dac_info = combios_get_table_offset(dev, COMBIOS_TV_INFO_TABLE);
728
 
719
	if (dac_info) {
729
		rev = RBIOS8(dac_info + 0x3);
720
		rev = RBIOS8(dac_info + 0x3);
730
		if (rev > 4) {
721
		if (rev > 4) {
731
			bg = RBIOS8(dac_info + 0xc) & 0xf;
722
			bg = RBIOS8(dac_info + 0xc) & 0xf;
Line 737... Line 728...
737
			tv_dac->pal_tvdac_adj = (bg << 16) | (dac << 20);
728
			tv_dac->pal_tvdac_adj = (bg << 16) | (dac << 20);
Line 738... Line 729...
738
 
729
 
739
			bg = RBIOS8(dac_info + 0x10) & 0xf;
730
			bg = RBIOS8(dac_info + 0x10) & 0xf;
740
			dac = RBIOS8(dac_info + 0x11) & 0xf;
731
			dac = RBIOS8(dac_info + 0x11) & 0xf;
-
 
732
			tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
741
			tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
733
			found = 1;
742
		} else if (rev > 1) {
734
		} else if (rev > 1) {
743
			bg = RBIOS8(dac_info + 0xc) & 0xf;
735
			bg = RBIOS8(dac_info + 0xc) & 0xf;
744
			dac = (RBIOS8(dac_info + 0xc) >> 4) & 0xf;
736
			dac = (RBIOS8(dac_info + 0xc) >> 4) & 0xf;
Line 749... Line 741...
749
			tv_dac->pal_tvdac_adj = (bg << 16) | (dac << 20);
741
			tv_dac->pal_tvdac_adj = (bg << 16) | (dac << 20);
Line 750... Line 742...
750
 
742
 
751
			bg = RBIOS8(dac_info + 0xe) & 0xf;
743
			bg = RBIOS8(dac_info + 0xe) & 0xf;
752
			dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf;
744
			dac = (RBIOS8(dac_info + 0xe) >> 4) & 0xf;
-
 
745
			tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
753
			tv_dac->ntsc_tvdac_adj = (bg << 16) | (dac << 20);
746
			found = 1;
Line 754... Line 747...
754
		}
747
		}
755
 
748
 
756
		tv_dac->tv_std = radeon_combios_get_tv_info(encoder);
749
		tv_dac->tv_std = radeon_combios_get_tv_info(encoder);
757
 
750
	}
758
	} else {
751
	if (!found) {
759
		/* then check CRT table */
752
		/* then check CRT table */
760
		dac_info =
753
		dac_info =
761
		    combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE);
-
 
762
		if (dac_info) {
-
 
763
			tv_dac =
-
 
764
			    kzalloc(sizeof(struct radeon_encoder_tv_dac),
-
 
765
				    GFP_KERNEL);
-
 
766
 
-
 
767
			if (!tv_dac)
-
 
768
				return NULL;
754
		    combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE);
769
 
755
		if (dac_info) {
770
			rev = RBIOS8(dac_info) & 0x3;
756
			rev = RBIOS8(dac_info) & 0x3;
771
			if (rev < 2) {
757
			if (rev < 2) {
772
				bg = RBIOS8(dac_info + 0x3) & 0xf;
758
				bg = RBIOS8(dac_info + 0x3) & 0xf;
773
				dac = (RBIOS8(dac_info + 0x3) >> 4) & 0xf;
759
				dac = (RBIOS8(dac_info + 0x3) >> 4) & 0xf;
774
				tv_dac->ps2_tvdac_adj =
760
				tv_dac->ps2_tvdac_adj =
775
				    (bg << 16) | (dac << 20);
761
				    (bg << 16) | (dac << 20);
-
 
762
				tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
776
				tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
763
				tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
777
				tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
764
				found = 1;
778
			} else {
765
			} else {
779
				bg = RBIOS8(dac_info + 0x4) & 0xf;
766
				bg = RBIOS8(dac_info + 0x4) & 0xf;
780
				dac = RBIOS8(dac_info + 0x5) & 0xf;
767
				dac = RBIOS8(dac_info + 0x5) & 0xf;
781
				tv_dac->ps2_tvdac_adj =
768
				tv_dac->ps2_tvdac_adj =
782
				    (bg << 16) | (dac << 20);
769
				    (bg << 16) | (dac << 20);
-
 
770
				tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
783
				tv_dac->pal_tvdac_adj = tv_dac->ps2_tvdac_adj;
771
				tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
784
				tv_dac->ntsc_tvdac_adj = tv_dac->ps2_tvdac_adj;
772
				found = 1;
785
			}
773
			}
786
		} else {
-
 
787
			DRM_INFO("No TV DAC info found in BIOS\n");
774
		} else {
788
			return radeon_legacy_get_tv_dac_info_from_table(rdev);
775
			DRM_INFO("No TV DAC info found in BIOS\n");
-
 
776
		}
-
 
777
	}
-
 
778
out:
Line 789... Line 779...
789
		}
779
	if (!found) /* fallback to defaults */
790
	}
780
		radeon_legacy_get_tv_dac_info_from_table(rdev, tv_dac);
Line 791... Line 781...
791
 
781
 
Line 871... Line 861...
871
	uint32_t panel_setup;
861
	uint32_t panel_setup;
872
	char stmp[30];
862
	char stmp[30];
873
	int tmp, i;
863
	int tmp, i;
874
	struct radeon_encoder_lvds *lvds = NULL;
864
	struct radeon_encoder_lvds *lvds = NULL;
Line 875... Line 865...
875
 
865
 
876
	if (rdev->bios == NULL)
866
	if (rdev->bios == NULL) {
-
 
867
		lvds = radeon_legacy_get_lvds_info_from_regs(rdev);
-
 
868
		goto out;
Line 877... Line 869...
877
		return radeon_legacy_get_lvds_info_from_regs(rdev);
869
	}
Line 878... Line 870...
878
 
870
 
879
	lcd_info = combios_get_table_offset(dev, COMBIOS_LCD_INFO_TABLE);
871
	lcd_info = combios_get_table_offset(dev, COMBIOS_LCD_INFO_TABLE);
Line 973... Line 965...
973
				lvds->native_mode.dotclock =
965
				lvds->native_mode.dotclock =
974
				    RBIOS16(tmp + 9) * 10;
966
				    RBIOS16(tmp + 9) * 10;
975
				lvds->native_mode.flags = 0;
967
				lvds->native_mode.flags = 0;
976
			}
968
			}
977
		}
969
		}
978
		encoder->native_mode = lvds->native_mode;
-
 
979
	} else {
970
	} else {
980
		DRM_INFO("No panel info found in BIOS\n");
971
		DRM_INFO("No panel info found in BIOS\n");
981
		return radeon_legacy_get_lvds_info_from_regs(rdev);
972
		lvds = radeon_legacy_get_lvds_info_from_regs(rdev);
982
	}
973
	}
-
 
974
out:
-
 
975
	if (lvds)
-
 
976
		encoder->native_mode = lvds->native_mode;
983
	return lvds;
977
	return lvds;
984
}
978
}
Line 985... Line 979...
985
 
979
 
986
static const struct radeon_tmds_pll default_tmds_pll[CHIP_LAST][4] = {
980
static const struct radeon_tmds_pll default_tmds_pll[CHIP_LAST][4] = {
Line 1002... Line 996...
1002
	{{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}},	/* CHIP_RV410 */
996
	{{0xffffffff, 0xb01cb}, {0, 0}, {0, 0}, {0, 0}},	/* CHIP_RV410 */
1003
	{{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}},	/* CHIP_RS400 */
997
	{{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}},	/* CHIP_RS400 */
1004
	{{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}},	/* CHIP_RS480 */
998
	{{15000, 0xb0155}, {0xffffffff, 0xb01cb}, {0, 0}, {0, 0}},	/* CHIP_RS480 */
1005
};
999
};
Line 1006... Line -...
1006
 
-
 
1007
static struct radeon_encoder_int_tmds
1000
 
-
 
1001
bool radeon_legacy_get_tmds_info_from_table(struct radeon_encoder *encoder,
1008
    *radeon_legacy_get_tmds_info_from_table(struct radeon_device *rdev)
1002
					    struct radeon_encoder_int_tmds *tmds)
-
 
1003
{
-
 
1004
	struct drm_device *dev = encoder->base.dev;
1009
{
1005
	struct radeon_device *rdev = dev->dev_private;
1010
	int i;
-
 
1011
	struct radeon_encoder_int_tmds *tmds = NULL;
-
 
1012
 
-
 
1013
	tmds = kzalloc(sizeof(struct radeon_encoder_int_tmds), GFP_KERNEL);
-
 
1014
 
-
 
1015
	if (!tmds)
-
 
Line 1016... Line 1006...
1016
		return NULL;
1006
	int i;
1017
 
1007
 
1018
	for (i = 0; i < 4; i++) {
1008
	for (i = 0; i < 4; i++) {
1019
		tmds->tmds_pll[i].value =
1009
		tmds->tmds_pll[i].value =
1020
		    default_tmds_pll[rdev->family][i].value;
1010
		    default_tmds_pll[rdev->family][i].value;
Line 1021... Line 1011...
1021
		tmds->tmds_pll[i].freq = default_tmds_pll[rdev->family][i].freq;
1011
		tmds->tmds_pll[i].freq = default_tmds_pll[rdev->family][i].freq;
1022
	}
1012
	}
Line 1023... Line 1013...
1023
 
1013
 
1024
	return tmds;
1014
	return true;
1025
}
-
 
1026
 
1015
}
1027
struct radeon_encoder_int_tmds *radeon_combios_get_tmds_info(struct
1016
 
1028
							     radeon_encoder
1017
bool radeon_legacy_get_tmds_info_from_combios(struct radeon_encoder *encoder,
1029
							     *encoder)
1018
					      struct radeon_encoder_int_tmds *tmds)
1030
{
1019
{
1031
	struct drm_device *dev = encoder->base.dev;
1020
	struct drm_device *dev = encoder->base.dev;
1032
	struct radeon_device *rdev = dev->dev_private;
-
 
Line 1033... Line 1021...
1033
	uint16_t tmds_info;
1021
	struct radeon_device *rdev = dev->dev_private;
1034
	int i, n;
1022
	uint16_t tmds_info;
Line 1035... Line 1023...
1035
	uint8_t ver;
1023
	int i, n;
Line 1036... Line 1024...
1036
	struct radeon_encoder_int_tmds *tmds = NULL;
1024
	uint8_t ver;
1037
 
-
 
1038
	if (rdev->bios == NULL)
-
 
1039
		return radeon_legacy_get_tmds_info_from_table(rdev);
-
 
1040
 
-
 
1041
	tmds_info = combios_get_table_offset(dev, COMBIOS_DFP_INFO_TABLE);
-
 
Line 1042... Line 1025...
1042
 
1025
 
1043
	if (tmds_info) {
1026
	if (rdev->bios == NULL)
1044
		tmds =
1027
		return false;
1045
		    kzalloc(sizeof(struct radeon_encoder_int_tmds), GFP_KERNEL);
1028
 
Line 1081... Line 1064...
1081
					  tmds->tmds_pll[i].value);
1064
					  tmds->tmds_pll[i].value);
1082
			}
1065
			}
1083
		}
1066
		}
1084
	} else
1067
	} else
1085
		DRM_INFO("No TMDS info found in BIOS\n");
1068
		DRM_INFO("No TMDS info found in BIOS\n");
-
 
1069
	return true;
-
 
1070
}
-
 
1071
 
-
 
1072
struct radeon_encoder_int_tmds *radeon_combios_get_tmds_info(struct radeon_encoder *encoder)
-
 
1073
{
-
 
1074
	struct radeon_encoder_int_tmds *tmds = NULL;
-
 
1075
	bool ret;
-
 
1076
 
-
 
1077
	tmds = kzalloc(sizeof(struct radeon_encoder_int_tmds), GFP_KERNEL);
-
 
1078
 
-
 
1079
	if (!tmds)
-
 
1080
		return NULL;
-
 
1081
 
-
 
1082
	ret = radeon_legacy_get_tmds_info_from_combios(encoder, tmds);
-
 
1083
	if (ret == false)
-
 
1084
		radeon_legacy_get_tmds_info_from_table(encoder, tmds);
-
 
1085
 
1086
	return tmds;
1086
	return tmds;
1087
}
1087
}
Line 1088... Line 1088...
1088
 
1088
 
1089
void radeon_combios_get_ext_tmds_info(struct radeon_encoder *encoder)
1089
void radeon_combios_get_ext_tmds_info(struct radeon_encoder *encoder)