Subversion Repositories Kolibri OS

Rev

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

Rev 1268 Rev 1321
Line 134... Line 134...
134
 
134
 
135
	lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL);
135
	lvds_pll_cntl = RREG32(RADEON_LVDS_PLL_CNTL);
Line 136... Line 136...
136
	lvds_pll_cntl &= ~RADEON_LVDS_PLL_EN;
136
	lvds_pll_cntl &= ~RADEON_LVDS_PLL_EN;
137
 
137
 
-
 
138
	lvds_ss_gen_cntl = RREG32(RADEON_LVDS_SS_GEN_CNTL);
-
 
139
	if (rdev->is_atom_bios) {
-
 
140
		/* LVDS_GEN_CNTL parameters are computed in LVDSEncoderControl
-
 
141
		 * need to call that on resume to set up the reg properly.
-
 
142
		 */
-
 
143
		radeon_encoder->pixel_clock = adjusted_mode->clock;
-
 
144
		atombios_digital_setup(encoder, PANEL_ENCODER_ACTION_ENABLE);
138
	lvds_ss_gen_cntl = RREG32(RADEON_LVDS_SS_GEN_CNTL);
145
		lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
139
	if ((!rdev->is_atom_bios)) {
146
	} else {
140
		struct radeon_encoder_lvds *lvds = (struct radeon_encoder_lvds *)radeon_encoder->enc_priv;
147
		struct radeon_encoder_lvds *lvds = (struct radeon_encoder_lvds *)radeon_encoder->enc_priv;
141
		if (lvds) {
148
		if (lvds) {
142
			DRM_DEBUG("bios LVDS_GEN_CNTL: 0x%x\n", lvds->lvds_gen_cntl);
149
			DRM_DEBUG("bios LVDS_GEN_CNTL: 0x%x\n", lvds->lvds_gen_cntl);
143
			lvds_gen_cntl = lvds->lvds_gen_cntl;
150
			lvds_gen_cntl = lvds->lvds_gen_cntl;
144
			lvds_ss_gen_cntl &= ~((0xf << RADEON_LVDS_PWRSEQ_DELAY1_SHIFT) |
151
			lvds_ss_gen_cntl &= ~((0xf << RADEON_LVDS_PWRSEQ_DELAY1_SHIFT) |
145
					      (0xf << RADEON_LVDS_PWRSEQ_DELAY2_SHIFT));
152
					      (0xf << RADEON_LVDS_PWRSEQ_DELAY2_SHIFT));
146
			lvds_ss_gen_cntl |= ((lvds->panel_digon_delay << RADEON_LVDS_PWRSEQ_DELAY1_SHIFT) |
153
			lvds_ss_gen_cntl |= ((lvds->panel_digon_delay << RADEON_LVDS_PWRSEQ_DELAY1_SHIFT) |
147
					     (lvds->panel_blon_delay << RADEON_LVDS_PWRSEQ_DELAY2_SHIFT));
154
					     (lvds->panel_blon_delay << RADEON_LVDS_PWRSEQ_DELAY2_SHIFT));
148
		} else
155
		} else
149
			lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
-
 
150
	} else
156
			lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
151
		lvds_gen_cntl = RREG32(RADEON_LVDS_GEN_CNTL);
157
	}
152
	lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
158
	lvds_gen_cntl |= RADEON_LVDS_DISPLAY_DIS;
153
	lvds_gen_cntl &= ~(RADEON_LVDS_ON |
159
	lvds_gen_cntl &= ~(RADEON_LVDS_ON |
154
			   RADEON_LVDS_BLON |
160
			   RADEON_LVDS_BLON |
Line 182... Line 188...
182
		radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
188
		radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
183
	else
189
	else
184
		radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
190
		radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
185
}
191
}
Line 186... Line 192...
186
 
192
 
187
static bool radeon_legacy_lvds_mode_fixup(struct drm_encoder *encoder,
193
static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder,
188
					  struct drm_display_mode *mode,
194
					  struct drm_display_mode *mode,
189
					  struct drm_display_mode *adjusted_mode)
195
					  struct drm_display_mode *adjusted_mode)
190
{
196
{
Line 191... Line 197...
191
	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
197
	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
192
 
198
 
193
	/* set the active encoder to connector routing */
199
	/* set the active encoder to connector routing */
Line -... Line 200...
-
 
200
	radeon_encoder_set_active_device(encoder);
194
	radeon_encoder_set_active_device(encoder);
201
	drm_mode_set_crtcinfo(adjusted_mode, 0);
-
 
202
 
-
 
203
	/* get the native mode for LVDS */
-
 
204
	if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) {
-
 
205
		struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
195
	drm_mode_set_crtcinfo(adjusted_mode, 0);
206
		int mode_id = adjusted_mode->base.id;
-
 
207
		*adjusted_mode = *native_mode;
-
 
208
		adjusted_mode->hdisplay = mode->hdisplay;
Line 196... Line 209...
196
 
209
		adjusted_mode->vdisplay = mode->vdisplay;
197
	if (radeon_encoder->rmx_type != RMX_OFF)
210
		adjusted_mode->base.id = mode_id;
Line 198... Line 211...
198
		radeon_rmx_mode_fixup(encoder, mode, adjusted_mode);
211
	}
199
 
212
 
200
	return true;
213
	return true;
201
}
214
}
202
 
215
 
203
static const struct drm_encoder_helper_funcs radeon_legacy_lvds_helper_funcs = {
216
static const struct drm_encoder_helper_funcs radeon_legacy_lvds_helper_funcs = {
204
	.dpms = radeon_legacy_lvds_dpms,
217
	.dpms = radeon_legacy_lvds_dpms,
205
	.mode_fixup = radeon_legacy_lvds_mode_fixup,
218
	.mode_fixup = radeon_legacy_mode_fixup,
Line 212... Line 225...
212
 
225
 
213
static const struct drm_encoder_funcs radeon_legacy_lvds_enc_funcs = {
226
static const struct drm_encoder_funcs radeon_legacy_lvds_enc_funcs = {
214
	.destroy = radeon_enc_destroy,
227
	.destroy = radeon_enc_destroy,
Line 215... Line -...
215
};
-
 
216
 
-
 
217
static bool radeon_legacy_primary_dac_mode_fixup(struct drm_encoder *encoder,
-
 
218
						 struct drm_display_mode *mode,
-
 
219
						 struct drm_display_mode *adjusted_mode)
-
 
220
{
-
 
221
	/* set the active encoder to connector routing */
-
 
222
	radeon_encoder_set_active_device(encoder);
-
 
223
	drm_mode_set_crtcinfo(adjusted_mode, 0);
-
 
224
 
-
 
225
	return true;
-
 
226
}
228
};
227
 
229
 
228
static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode)
230
static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode)
229
{
231
{
230
	struct drm_device *dev = encoder->dev;
232
	struct drm_device *dev = encoder->dev;
Line 408... Line 410...
408
	return found;
410
	return found;
409
}
411
}
Line 410... Line 412...
410
 
412
 
411
static const struct drm_encoder_helper_funcs radeon_legacy_primary_dac_helper_funcs = {
413
static const struct drm_encoder_helper_funcs radeon_legacy_primary_dac_helper_funcs = {
412
	.dpms = radeon_legacy_primary_dac_dpms,
414
	.dpms = radeon_legacy_primary_dac_dpms,
413
	.mode_fixup = radeon_legacy_primary_dac_mode_fixup,
415
	.mode_fixup = radeon_legacy_mode_fixup,
414
	.prepare = radeon_legacy_primary_dac_prepare,
416
	.prepare = radeon_legacy_primary_dac_prepare,
415
	.mode_set = radeon_legacy_primary_dac_mode_set,
417
	.mode_set = radeon_legacy_primary_dac_mode_set,
416
	.commit = radeon_legacy_primary_dac_commit,
418
	.commit = radeon_legacy_primary_dac_commit,
417
	.detect = radeon_legacy_primary_dac_detect,
419
	.detect = radeon_legacy_primary_dac_detect,
Line 421... Line 423...
421
 
423
 
422
static const struct drm_encoder_funcs radeon_legacy_primary_dac_enc_funcs = {
424
static const struct drm_encoder_funcs radeon_legacy_primary_dac_enc_funcs = {
423
	.destroy = radeon_enc_destroy,
425
	.destroy = radeon_enc_destroy,
Line 424... Line -...
424
};
-
 
425
 
-
 
426
static bool radeon_legacy_tmds_int_mode_fixup(struct drm_encoder *encoder,
-
 
427
					      struct drm_display_mode *mode,
-
 
428
					      struct drm_display_mode *adjusted_mode)
-
 
429
{
-
 
430
 
-
 
431
	drm_mode_set_crtcinfo(adjusted_mode, 0);
-
 
432
 
-
 
433
	return true;
-
 
434
}
426
};
435
 
427
 
436
static void radeon_legacy_tmds_int_dpms(struct drm_encoder *encoder, int mode)
428
static void radeon_legacy_tmds_int_dpms(struct drm_encoder *encoder, int mode)
437
{
429
{
438
	struct drm_device *dev = encoder->dev;
430
	struct drm_device *dev = encoder->dev;
Line 582... Line 574...
582
		radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
574
		radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
583
}
575
}
Line 584... Line 576...
584
 
576
 
585
static const struct drm_encoder_helper_funcs radeon_legacy_tmds_int_helper_funcs = {
577
static const struct drm_encoder_helper_funcs radeon_legacy_tmds_int_helper_funcs = {
586
	.dpms = radeon_legacy_tmds_int_dpms,
578
	.dpms = radeon_legacy_tmds_int_dpms,
587
	.mode_fixup = radeon_legacy_tmds_int_mode_fixup,
579
	.mode_fixup = radeon_legacy_mode_fixup,
588
	.prepare = radeon_legacy_tmds_int_prepare,
580
	.prepare = radeon_legacy_tmds_int_prepare,
589
	.mode_set = radeon_legacy_tmds_int_mode_set,
581
	.mode_set = radeon_legacy_tmds_int_mode_set,
590
	.commit = radeon_legacy_tmds_int_commit,
582
	.commit = radeon_legacy_tmds_int_commit,
591
	.disable = radeon_legacy_encoder_disable,
583
	.disable = radeon_legacy_encoder_disable,
Line 594... Line 586...
594
 
586
 
595
static const struct drm_encoder_funcs radeon_legacy_tmds_int_enc_funcs = {
587
static const struct drm_encoder_funcs radeon_legacy_tmds_int_enc_funcs = {
596
	.destroy = radeon_enc_destroy,
588
	.destroy = radeon_enc_destroy,
Line 597... Line -...
597
};
-
 
598
 
-
 
599
static bool radeon_legacy_tmds_ext_mode_fixup(struct drm_encoder *encoder,
-
 
600
					      struct drm_display_mode *mode,
-
 
601
					      struct drm_display_mode *adjusted_mode)
-
 
602
{
-
 
603
	/* set the active encoder to connector routing */
-
 
604
	radeon_encoder_set_active_device(encoder);
-
 
605
	drm_mode_set_crtcinfo(adjusted_mode, 0);
-
 
606
 
-
 
607
	return true;
-
 
608
}
589
};
609
 
590
 
610
static void radeon_legacy_tmds_ext_dpms(struct drm_encoder *encoder, int mode)
591
static void radeon_legacy_tmds_ext_dpms(struct drm_encoder *encoder, int mode)
611
{
592
{
612
	struct drm_device *dev = encoder->dev;
593
	struct drm_device *dev = encoder->dev;
Line 695... Line 676...
695
				fp2_gen_cntl |= RADEON_FP2_PAD_FLOP_EN | R300_FP2_DVO_CLOCK_MODE_SINGLE;
676
				fp2_gen_cntl |= RADEON_FP2_PAD_FLOP_EN | R300_FP2_DVO_CLOCK_MODE_SINGLE;
Line 696... Line 677...
696
 
677
 
697
			/*if (mode->clock > 165000)
678
			/*if (mode->clock > 165000)
698
			  fp2_gen_cntl |= R300_FP2_DVO_DUAL_CHANNEL_EN;*/
679
			  fp2_gen_cntl |= R300_FP2_DVO_DUAL_CHANNEL_EN;*/
-
 
680
		}
-
 
681
		if (!radeon_combios_external_tmds_setup(encoder))
699
		}
682
			radeon_external_tmds_setup(encoder);
Line 700... Line 683...
700
	}
683
	}
701
 
684
 
702
	if (radeon_crtc->crtc_id == 0) {
685
	if (radeon_crtc->crtc_id == 0) {
Line 722... Line 705...
722
		radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
705
		radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
723
	else
706
	else
724
		radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
707
		radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id);
725
}
708
}
Line -... Line 709...
-
 
709
 
-
 
710
static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder)
-
 
711
{
-
 
712
	struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
-
 
713
	struct radeon_encoder_ext_tmds *tmds = radeon_encoder->enc_priv;
-
 
714
	if (tmds) {
-
 
715
		if (tmds->i2c_bus)
-
 
716
			radeon_i2c_destroy(tmds->i2c_bus);
-
 
717
	}
-
 
718
	kfree(radeon_encoder->enc_priv);
-
 
719
	drm_encoder_cleanup(encoder);
-
 
720
	kfree(radeon_encoder);
-
 
721
}
726
 
722
 
727
static const struct drm_encoder_helper_funcs radeon_legacy_tmds_ext_helper_funcs = {
723
static const struct drm_encoder_helper_funcs radeon_legacy_tmds_ext_helper_funcs = {
728
	.dpms = radeon_legacy_tmds_ext_dpms,
724
	.dpms = radeon_legacy_tmds_ext_dpms,
729
	.mode_fixup = radeon_legacy_tmds_ext_mode_fixup,
725
	.mode_fixup = radeon_legacy_mode_fixup,
730
	.prepare = radeon_legacy_tmds_ext_prepare,
726
	.prepare = radeon_legacy_tmds_ext_prepare,
731
	.mode_set = radeon_legacy_tmds_ext_mode_set,
727
	.mode_set = radeon_legacy_tmds_ext_mode_set,
732
	.commit = radeon_legacy_tmds_ext_commit,
728
	.commit = radeon_legacy_tmds_ext_commit,
733
	.disable = radeon_legacy_encoder_disable,
729
	.disable = radeon_legacy_encoder_disable,
Line 734... Line 730...
734
};
730
};
735
 
731
 
736
 
732
 
Line 737... Line -...
737
static const struct drm_encoder_funcs radeon_legacy_tmds_ext_enc_funcs = {
-
 
738
	.destroy = radeon_enc_destroy,
-
 
739
};
-
 
740
 
-
 
741
static bool radeon_legacy_tv_dac_mode_fixup(struct drm_encoder *encoder,
-
 
742
					    struct drm_display_mode *mode,
-
 
743
					    struct drm_display_mode *adjusted_mode)
-
 
744
{
-
 
745
	/* set the active encoder to connector routing */
-
 
746
	radeon_encoder_set_active_device(encoder);
-
 
747
	drm_mode_set_crtcinfo(adjusted_mode, 0);
-
 
748
 
733
static const struct drm_encoder_funcs radeon_legacy_tmds_ext_enc_funcs = {
749
	return true;
734
	.destroy = radeon_ext_tmds_enc_destroy,
750
}
735
};
751
 
736
 
752
static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode)
737
static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode)
Line 1263... Line 1248...
1263
 
1248
 
Line 1264... Line 1249...
1264
}
1249
}
1265
 
1250
 
1266
static const struct drm_encoder_helper_funcs radeon_legacy_tv_dac_helper_funcs = {
1251
static const struct drm_encoder_helper_funcs radeon_legacy_tv_dac_helper_funcs = {
1267
	.dpms = radeon_legacy_tv_dac_dpms,
1252
	.dpms = radeon_legacy_tv_dac_dpms,
1268
	.mode_fixup = radeon_legacy_tv_dac_mode_fixup,
1253
	.mode_fixup = radeon_legacy_mode_fixup,
1269
	.prepare = radeon_legacy_tv_dac_prepare,
1254
	.prepare = radeon_legacy_tv_dac_prepare,
1270
	.mode_set = radeon_legacy_tv_dac_mode_set,
1255
	.mode_set = radeon_legacy_tv_dac_mode_set,
1271
	.commit = radeon_legacy_tv_dac_commit,
1256
	.commit = radeon_legacy_tv_dac_commit,
Line 1300... Line 1285...
1300
		radeon_legacy_get_tmds_info_from_table(encoder, tmds);
1285
		radeon_legacy_get_tmds_info_from_table(encoder, tmds);
Line 1301... Line 1286...
1301
 
1286
 
1302
	return tmds;
1287
	return tmds;
Line -... Line 1288...
-
 
1288
}
-
 
1289
 
-
 
1290
static struct radeon_encoder_ext_tmds *radeon_legacy_get_ext_tmds_info(struct radeon_encoder *encoder)
-
 
1291
{
-
 
1292
	struct drm_device *dev = encoder->base.dev;
-
 
1293
	struct radeon_device *rdev = dev->dev_private;
-
 
1294
	struct radeon_encoder_ext_tmds *tmds = NULL;
-
 
1295
	bool ret;
-
 
1296
 
-
 
1297
	if (rdev->is_atom_bios)
-
 
1298
		return NULL;
-
 
1299
 
-
 
1300
	tmds = kzalloc(sizeof(struct radeon_encoder_ext_tmds), GFP_KERNEL);
-
 
1301
 
-
 
1302
	if (!tmds)
-
 
1303
		return NULL;
-
 
1304
 
-
 
1305
	ret = radeon_legacy_get_ext_tmds_info_from_combios(encoder, tmds);
-
 
1306
 
-
 
1307
	if (ret == false)
-
 
1308
		radeon_legacy_get_ext_tmds_info_from_table(encoder, tmds);
-
 
1309
 
-
 
1310
	return tmds;
1303
}
1311
}
1304
 
1312
 
1305
void
1313
void
1306
radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t supported_device)
1314
radeon_add_legacy_encoder(struct drm_device *dev, uint32_t encoder_id, uint32_t supported_device)
1307
{
1315
{
Line 1327... Line 1335...
1327
	encoder = &radeon_encoder->base;
1335
	encoder = &radeon_encoder->base;
1328
	if (rdev->flags & RADEON_SINGLE_CRTC)
1336
	if (rdev->flags & RADEON_SINGLE_CRTC)
1329
		encoder->possible_crtcs = 0x1;
1337
		encoder->possible_crtcs = 0x1;
1330
	else
1338
	else
1331
	encoder->possible_crtcs = 0x3;
1339
	encoder->possible_crtcs = 0x3;
1332
	encoder->possible_clones = 0;
-
 
Line 1333... Line 1340...
1333
 
1340
 
Line 1334... Line 1341...
1334
	radeon_encoder->enc_priv = NULL;
1341
	radeon_encoder->enc_priv = NULL;
1335
 
1342
 
Line 1371... Line 1378...
1371
		break;
1378
		break;
1372
	case ENCODER_OBJECT_ID_INTERNAL_DVO1:
1379
	case ENCODER_OBJECT_ID_INTERNAL_DVO1:
1373
		drm_encoder_init(dev, encoder, &radeon_legacy_tmds_ext_enc_funcs, DRM_MODE_ENCODER_TMDS);
1380
		drm_encoder_init(dev, encoder, &radeon_legacy_tmds_ext_enc_funcs, DRM_MODE_ENCODER_TMDS);
1374
		drm_encoder_helper_add(encoder, &radeon_legacy_tmds_ext_helper_funcs);
1381
		drm_encoder_helper_add(encoder, &radeon_legacy_tmds_ext_helper_funcs);
1375
		if (!rdev->is_atom_bios)
1382
		if (!rdev->is_atom_bios)
1376
			radeon_combios_get_ext_tmds_info(radeon_encoder);
1383
			radeon_encoder->enc_priv = radeon_legacy_get_ext_tmds_info(radeon_encoder);
1377
		break;
1384
		break;
1378
	}
1385
	}
1379
}
1386
}