aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/radeon/radeon_encoders.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2009-08-13 02:32:14 -0400
committerDave Airlie <airlied@redhat.com>2009-09-07 19:24:37 -0400
commit4ce001abafafe77e5dd943d1480fc9f87894e96f (patch)
tree4a22b42c58a80450992fcf5d7625b19fe045855b /drivers/gpu/drm/radeon/radeon_encoders.c
parent551ebd837c75fc75df81811a18b7136c39cab487 (diff)
drm/radeon/kms: add initial radeon tv-out support.
This ports the tv-out code from the DDX to KMS. adds a radeon.tv module option, radeon.tv=0 to disable tv Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm/radeon/radeon_encoders.c')
-rw-r--r--drivers/gpu/drm/radeon/radeon_encoders.c116
1 files changed, 86 insertions, 30 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_encoders.c b/drivers/gpu/drm/radeon/radeon_encoders.c
index 0a92706eac19..5c4ede7c9901 100644
--- a/drivers/gpu/drm/radeon/radeon_encoders.c
+++ b/drivers/gpu/drm/radeon/radeon_encoders.c
@@ -126,6 +126,23 @@ radeon_link_encoder_connector(struct drm_device *dev)
126 } 126 }
127} 127}
128 128
129void radeon_encoder_set_active_device(struct drm_encoder *encoder)
130{
131 struct drm_device *dev = encoder->dev;
132 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
133 struct drm_connector *connector;
134
135 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
136 if (connector->encoder == encoder) {
137 struct radeon_connector *radeon_connector = to_radeon_connector(connector);
138 radeon_encoder->active_device = radeon_encoder->devices & radeon_connector->devices;
139 DRM_INFO("setting active device to %08x from %08x %08x for encoder %d\n",
140 radeon_encoder->active_device, radeon_encoder->devices,
141 radeon_connector->devices, encoder->encoder_type);
142 }
143 }
144}
145
129static struct drm_connector * 146static struct drm_connector *
130radeon_get_connector_for_encoder(struct drm_encoder *encoder) 147radeon_get_connector_for_encoder(struct drm_encoder *encoder)
131{ 148{
@@ -244,9 +261,9 @@ atombios_dac_setup(struct drm_encoder *encoder, int action)
244 261
245 args.ucAction = action; 262 args.ucAction = action;
246 263
247 if (radeon_encoder->devices & (ATOM_DEVICE_CRT_SUPPORT)) 264 if (radeon_encoder->active_device & (ATOM_DEVICE_CRT_SUPPORT))
248 args.ucDacStandard = ATOM_DAC1_PS2; 265 args.ucDacStandard = ATOM_DAC1_PS2;
249 else if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT)) 266 else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT))
250 args.ucDacStandard = ATOM_DAC1_CV; 267 args.ucDacStandard = ATOM_DAC1_CV;
251 else { 268 else {
252 switch (tv_std) { 269 switch (tv_std) {
@@ -288,7 +305,7 @@ atombios_tv_setup(struct drm_encoder *encoder, int action)
288 305
289 args.sTVEncoder.ucAction = action; 306 args.sTVEncoder.ucAction = action;
290 307
291 if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT)) 308 if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT))
292 args.sTVEncoder.ucTvStandard = ATOM_TV_CV; 309 args.sTVEncoder.ucTvStandard = ATOM_TV_CV;
293 else { 310 else {
294 switch (tv_std) { 311 switch (tv_std) {
@@ -825,10 +842,10 @@ atombios_yuv_setup(struct drm_encoder *encoder, bool enable)
825 842
826 /* XXX: fix up scratch reg handling */ 843 /* XXX: fix up scratch reg handling */
827 temp = RREG32(reg); 844 temp = RREG32(reg);
828 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) 845 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
829 WREG32(reg, (ATOM_S3_TV1_ACTIVE | 846 WREG32(reg, (ATOM_S3_TV1_ACTIVE |
830 (radeon_crtc->crtc_id << 18))); 847 (radeon_crtc->crtc_id << 18)));
831 else if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT)) 848 else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT))
832 WREG32(reg, (ATOM_S3_CV_ACTIVE | (radeon_crtc->crtc_id << 24))); 849 WREG32(reg, (ATOM_S3_CV_ACTIVE | (radeon_crtc->crtc_id << 24)));
833 else 850 else
834 WREG32(reg, 0); 851 WREG32(reg, 0);
@@ -851,9 +868,19 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode)
851 DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args; 868 DISPLAY_DEVICE_OUTPUT_CONTROL_PS_ALLOCATION args;
852 int index = 0; 869 int index = 0;
853 bool is_dig = false; 870 bool is_dig = false;
871 int devices;
854 872
855 memset(&args, 0, sizeof(args)); 873 memset(&args, 0, sizeof(args));
856 874
875 /* on DPMS off we have no idea if active device is meaningful */
876 if (mode != DRM_MODE_DPMS_ON && !radeon_encoder->active_device)
877 devices = radeon_encoder->devices;
878 else
879 devices = radeon_encoder->active_device;
880
881 DRM_INFO("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n",
882 radeon_encoder->encoder_id, mode, radeon_encoder->devices,
883 radeon_encoder->active_device);
857 switch (radeon_encoder->encoder_id) { 884 switch (radeon_encoder->encoder_id) {
858 case ENCODER_OBJECT_ID_INTERNAL_TMDS1: 885 case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
859 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1: 886 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
@@ -881,18 +908,18 @@ radeon_atom_encoder_dpms(struct drm_encoder *encoder, int mode)
881 break; 908 break;
882 case ENCODER_OBJECT_ID_INTERNAL_DAC1: 909 case ENCODER_OBJECT_ID_INTERNAL_DAC1:
883 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: 910 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
884 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) 911 if (devices & (ATOM_DEVICE_TV_SUPPORT))
885 index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); 912 index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl);
886 else if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT)) 913 else if (devices & (ATOM_DEVICE_CV_SUPPORT))
887 index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); 914 index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl);
888 else 915 else
889 index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl); 916 index = GetIndexIntoMasterTable(COMMAND, DAC1OutputControl);
890 break; 917 break;
891 case ENCODER_OBJECT_ID_INTERNAL_DAC2: 918 case ENCODER_OBJECT_ID_INTERNAL_DAC2:
892 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: 919 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
893 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) 920 if (devices & (ATOM_DEVICE_TV_SUPPORT))
894 index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl); 921 index = GetIndexIntoMasterTable(COMMAND, TV1OutputControl);
895 else if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT)) 922 else if (devices & (ATOM_DEVICE_CV_SUPPORT))
896 index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl); 923 index = GetIndexIntoMasterTable(COMMAND, CV1OutputControl);
897 else 924 else
898 index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl); 925 index = GetIndexIntoMasterTable(COMMAND, DAC2OutputControl);
@@ -979,18 +1006,18 @@ atombios_set_encoder_crtc_source(struct drm_encoder *encoder)
979 break; 1006 break;
980 case ENCODER_OBJECT_ID_INTERNAL_DAC1: 1007 case ENCODER_OBJECT_ID_INTERNAL_DAC1:
981 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: 1008 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
982 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) 1009 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
983 args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; 1010 args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX;
984 else if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT)) 1011 else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT))
985 args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; 1012 args.v1.ucDevice = ATOM_DEVICE_CV_INDEX;
986 else 1013 else
987 args.v1.ucDevice = ATOM_DEVICE_CRT1_INDEX; 1014 args.v1.ucDevice = ATOM_DEVICE_CRT1_INDEX;
988 break; 1015 break;
989 case ENCODER_OBJECT_ID_INTERNAL_DAC2: 1016 case ENCODER_OBJECT_ID_INTERNAL_DAC2:
990 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: 1017 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
991 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) 1018 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
992 args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX; 1019 args.v1.ucDevice = ATOM_DEVICE_TV1_INDEX;
993 else if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT)) 1020 else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT))
994 args.v1.ucDevice = ATOM_DEVICE_CV_INDEX; 1021 args.v1.ucDevice = ATOM_DEVICE_CV_INDEX;
995 else 1022 else
996 args.v1.ucDevice = ATOM_DEVICE_CRT2_INDEX; 1023 args.v1.ucDevice = ATOM_DEVICE_CRT2_INDEX;
@@ -1019,17 +1046,17 @@ atombios_set_encoder_crtc_source(struct drm_encoder *encoder)
1019 args.v2.ucEncoderID = ASIC_INT_DIG2_ENCODER_ID; 1046 args.v2.ucEncoderID = ASIC_INT_DIG2_ENCODER_ID;
1020 break; 1047 break;
1021 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: 1048 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
1022 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) 1049 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
1023 args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; 1050 args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID;
1024 else if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT)) 1051 else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT))
1025 args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; 1052 args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID;
1026 else 1053 else
1027 args.v2.ucEncoderID = ASIC_INT_DAC1_ENCODER_ID; 1054 args.v2.ucEncoderID = ASIC_INT_DAC1_ENCODER_ID;
1028 break; 1055 break;
1029 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: 1056 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
1030 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT)) 1057 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT))
1031 args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; 1058 args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID;
1032 else if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT)) 1059 else if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT))
1033 args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID; 1060 args.v2.ucEncoderID = ASIC_INT_TV_ENCODER_ID;
1034 else 1061 else
1035 args.v2.ucEncoderID = ASIC_INT_DAC2_ENCODER_ID; 1062 args.v2.ucEncoderID = ASIC_INT_DAC2_ENCODER_ID;
@@ -1097,7 +1124,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
1097 atombios_set_encoder_crtc_source(encoder); 1124 atombios_set_encoder_crtc_source(encoder);
1098 1125
1099 if (ASIC_IS_AVIVO(rdev)) { 1126 if (ASIC_IS_AVIVO(rdev)) {
1100 if (radeon_encoder->devices & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT)) 1127 if (radeon_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT | ATOM_DEVICE_TV_SUPPORT))
1101 atombios_yuv_setup(encoder, true); 1128 atombios_yuv_setup(encoder, true);
1102 else 1129 else
1103 atombios_yuv_setup(encoder, false); 1130 atombios_yuv_setup(encoder, false);
@@ -1135,7 +1162,7 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
1135 case ENCODER_OBJECT_ID_INTERNAL_DAC2: 1162 case ENCODER_OBJECT_ID_INTERNAL_DAC2:
1136 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: 1163 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
1137 atombios_dac_setup(encoder, ATOM_ENABLE); 1164 atombios_dac_setup(encoder, ATOM_ENABLE);
1138 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) 1165 if (radeon_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT))
1139 atombios_tv_setup(encoder, ATOM_ENABLE); 1166 atombios_tv_setup(encoder, ATOM_ENABLE);
1140 break; 1167 break;
1141 } 1168 }
@@ -1143,11 +1170,12 @@ radeon_atom_encoder_mode_set(struct drm_encoder *encoder,
1143} 1170}
1144 1171
1145static bool 1172static bool
1146atombios_dac_load_detect(struct drm_encoder *encoder) 1173atombios_dac_load_detect(struct drm_encoder *encoder, struct drm_connector *connector)
1147{ 1174{
1148 struct drm_device *dev = encoder->dev; 1175 struct drm_device *dev = encoder->dev;
1149 struct radeon_device *rdev = dev->dev_private; 1176 struct radeon_device *rdev = dev->dev_private;
1150 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 1177 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1178 struct radeon_connector *radeon_connector = to_radeon_connector(connector);
1151 1179
1152 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT | 1180 if (radeon_encoder->devices & (ATOM_DEVICE_TV_SUPPORT |
1153 ATOM_DEVICE_CV_SUPPORT | 1181 ATOM_DEVICE_CV_SUPPORT |
@@ -1168,15 +1196,15 @@ atombios_dac_load_detect(struct drm_encoder *encoder)
1168 else 1196 else
1169 args.sDacload.ucDacType = ATOM_DAC_B; 1197 args.sDacload.ucDacType = ATOM_DAC_B;
1170 1198
1171 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) 1199 if (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT)
1172 args.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_CRT1_SUPPORT); 1200 args.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_CRT1_SUPPORT);
1173 else if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) 1201 else if (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT)
1174 args.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_CRT2_SUPPORT); 1202 args.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_CRT2_SUPPORT);
1175 else if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) { 1203 else if (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT) {
1176 args.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_CV_SUPPORT); 1204 args.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_CV_SUPPORT);
1177 if (crev >= 3) 1205 if (crev >= 3)
1178 args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; 1206 args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb;
1179 } else if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) { 1207 } else if (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT) {
1180 args.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_TV1_SUPPORT); 1208 args.sDacload.usDeviceID = cpu_to_le16(ATOM_DEVICE_TV1_SUPPORT);
1181 if (crev >= 3) 1209 if (crev >= 3)
1182 args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb; 1210 args.sDacload.ucMisc = DAC_LOAD_MISC_YPrPb;
@@ -1195,9 +1223,10 @@ radeon_atom_dac_detect(struct drm_encoder *encoder, struct drm_connector *connec
1195 struct drm_device *dev = encoder->dev; 1223 struct drm_device *dev = encoder->dev;
1196 struct radeon_device *rdev = dev->dev_private; 1224 struct radeon_device *rdev = dev->dev_private;
1197 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); 1225 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1226 struct radeon_connector *radeon_connector = to_radeon_connector(connector);
1198 uint32_t bios_0_scratch; 1227 uint32_t bios_0_scratch;
1199 1228
1200 if (!atombios_dac_load_detect(encoder)) { 1229 if (!atombios_dac_load_detect(encoder, connector)) {
1201 DRM_DEBUG("detect returned false \n"); 1230 DRM_DEBUG("detect returned false \n");
1202 return connector_status_unknown; 1231 return connector_status_unknown;
1203 } 1232 }
@@ -1207,17 +1236,20 @@ radeon_atom_dac_detect(struct drm_encoder *encoder, struct drm_connector *connec
1207 else 1236 else
1208 bios_0_scratch = RREG32(RADEON_BIOS_0_SCRATCH); 1237 bios_0_scratch = RREG32(RADEON_BIOS_0_SCRATCH);
1209 1238
1210 DRM_DEBUG("Bios 0 scratch %x\n", bios_0_scratch); 1239 DRM_DEBUG("Bios 0 scratch %x %08x\n", bios_0_scratch, radeon_encoder->devices);
1211 if (radeon_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) { 1240 if (radeon_connector->devices & ATOM_DEVICE_CRT1_SUPPORT) {
1212 if (bios_0_scratch & ATOM_S0_CRT1_MASK) 1241 if (bios_0_scratch & ATOM_S0_CRT1_MASK)
1213 return connector_status_connected; 1242 return connector_status_connected;
1214 } else if (radeon_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) { 1243 }
1244 if (radeon_connector->devices & ATOM_DEVICE_CRT2_SUPPORT) {
1215 if (bios_0_scratch & ATOM_S0_CRT2_MASK) 1245 if (bios_0_scratch & ATOM_S0_CRT2_MASK)
1216 return connector_status_connected; 1246 return connector_status_connected;
1217 } else if (radeon_encoder->devices & ATOM_DEVICE_CV_SUPPORT) { 1247 }
1248 if (radeon_connector->devices & ATOM_DEVICE_CV_SUPPORT) {
1218 if (bios_0_scratch & (ATOM_S0_CV_MASK|ATOM_S0_CV_MASK_A)) 1249 if (bios_0_scratch & (ATOM_S0_CV_MASK|ATOM_S0_CV_MASK_A))
1219 return connector_status_connected; 1250 return connector_status_connected;
1220 } else if (radeon_encoder->devices & ATOM_DEVICE_TV1_SUPPORT) { 1251 }
1252 if (radeon_connector->devices & ATOM_DEVICE_TV1_SUPPORT) {
1221 if (bios_0_scratch & (ATOM_S0_TV1_COMPOSITE | ATOM_S0_TV1_COMPOSITE_A)) 1253 if (bios_0_scratch & (ATOM_S0_TV1_COMPOSITE | ATOM_S0_TV1_COMPOSITE_A))
1222 return connector_status_connected; /* CTV */ 1254 return connector_status_connected; /* CTV */
1223 else if (bios_0_scratch & (ATOM_S0_TV1_SVIDEO | ATOM_S0_TV1_SVIDEO_A)) 1255 else if (bios_0_scratch & (ATOM_S0_TV1_SVIDEO | ATOM_S0_TV1_SVIDEO_A))
@@ -1230,6 +1262,8 @@ static void radeon_atom_encoder_prepare(struct drm_encoder *encoder)
1230{ 1262{
1231 radeon_atom_output_lock(encoder, true); 1263 radeon_atom_output_lock(encoder, true);
1232 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF); 1264 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
1265
1266 radeon_encoder_set_active_device(encoder);
1233} 1267}
1234 1268
1235static void radeon_atom_encoder_commit(struct drm_encoder *encoder) 1269static void radeon_atom_encoder_commit(struct drm_encoder *encoder)
@@ -1238,12 +1272,21 @@ static void radeon_atom_encoder_commit(struct drm_encoder *encoder)
1238 radeon_atom_output_lock(encoder, false); 1272 radeon_atom_output_lock(encoder, false);
1239} 1273}
1240 1274
1275static void radeon_atom_encoder_disable(struct drm_encoder *encoder)
1276{
1277 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
1278 radeon_atom_encoder_dpms(encoder, DRM_MODE_DPMS_OFF);
1279 DRM_INFO("setting active device to 0 for encoder %d\n", encoder->encoder_type);
1280 radeon_encoder->active_device = 0;
1281}
1282
1241static const struct drm_encoder_helper_funcs radeon_atom_dig_helper_funcs = { 1283static const struct drm_encoder_helper_funcs radeon_atom_dig_helper_funcs = {
1242 .dpms = radeon_atom_encoder_dpms, 1284 .dpms = radeon_atom_encoder_dpms,
1243 .mode_fixup = radeon_atom_mode_fixup, 1285 .mode_fixup = radeon_atom_mode_fixup,
1244 .prepare = radeon_atom_encoder_prepare, 1286 .prepare = radeon_atom_encoder_prepare,
1245 .mode_set = radeon_atom_encoder_mode_set, 1287 .mode_set = radeon_atom_encoder_mode_set,
1246 .commit = radeon_atom_encoder_commit, 1288 .commit = radeon_atom_encoder_commit,
1289 .disable = radeon_atom_encoder_disable,
1247 /* no detect for TMDS/LVDS yet */ 1290 /* no detect for TMDS/LVDS yet */
1248}; 1291};
1249 1292
@@ -1268,6 +1311,18 @@ static const struct drm_encoder_funcs radeon_atom_enc_funcs = {
1268 .destroy = radeon_enc_destroy, 1311 .destroy = radeon_enc_destroy,
1269}; 1312};
1270 1313
1314struct radeon_encoder_atom_dac *
1315radeon_atombios_set_dac_info(struct radeon_encoder *radeon_encoder)
1316{
1317 struct radeon_encoder_atom_dac *dac = kzalloc(sizeof(struct radeon_encoder_atom_dac), GFP_KERNEL);
1318
1319 if (!dac)
1320 return NULL;
1321
1322 dac->tv_std = TV_STD_NTSC;
1323 return dac;
1324}
1325
1271struct radeon_encoder_atom_dig * 1326struct radeon_encoder_atom_dig *
1272radeon_atombios_set_dig_info(struct radeon_encoder *radeon_encoder) 1327radeon_atombios_set_dig_info(struct radeon_encoder *radeon_encoder)
1273{ 1328{
@@ -1336,6 +1391,7 @@ radeon_add_atom_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t su
1336 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1: 1391 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1:
1337 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2: 1392 case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC2:
1338 drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_TVDAC); 1393 drm_encoder_init(dev, encoder, &radeon_atom_enc_funcs, DRM_MODE_ENCODER_TVDAC);
1394 radeon_encoder->enc_priv = radeon_atombios_set_dac_info(radeon_encoder);
1339 drm_encoder_helper_add(encoder, &radeon_atom_dac_helper_funcs); 1395 drm_encoder_helper_add(encoder, &radeon_atom_dac_helper_funcs);
1340 break; 1396 break;
1341 case ENCODER_OBJECT_ID_INTERNAL_DVO1: 1397 case ENCODER_OBJECT_ID_INTERNAL_DVO1: