Lines Matching +full:lvds +full:- +full:encoder
2 * Copyright 2007-8 Advanced Micro Devices, Inc.
46 static void radeon_legacy_encoder_disable(struct drm_encoder *encoder) in radeon_legacy_encoder_disable() argument
48 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_encoder_disable()
51 encoder_funcs = encoder->helper_private; in radeon_legacy_encoder_disable()
52 encoder_funcs->dpms(encoder, DRM_MODE_DPMS_OFF); in radeon_legacy_encoder_disable()
53 radeon_encoder->active_device = 0; in radeon_legacy_encoder_disable()
56 static void radeon_legacy_lvds_update(struct drm_encoder *encoder, int mode) in radeon_legacy_lvds_update() argument
58 struct drm_device *dev = encoder->dev; in radeon_legacy_lvds_update()
59 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_lvds_update()
60 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_lvds_update()
70 if (radeon_encoder->enc_priv) { in radeon_legacy_lvds_update()
71 if (rdev->is_atom_bios) { in radeon_legacy_lvds_update()
72 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv; in radeon_legacy_lvds_update() local
73 panel_pwr_delay = lvds->panel_pwr_delay; in radeon_legacy_lvds_update()
74 if (lvds->bl_dev) in radeon_legacy_lvds_update()
75 backlight_level = lvds->backlight_level; in radeon_legacy_lvds_update()
77 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv; in radeon_legacy_lvds_update() local
78 panel_pwr_delay = lvds->panel_pwr_delay; in radeon_legacy_lvds_update()
79 if (lvds->bl_dev) in radeon_legacy_lvds_update()
80 backlight_level = lvds->backlight_level; in radeon_legacy_lvds_update()
84 /* macs (and possibly some x86 oem systems?) wire up LVDS strangely in radeon_legacy_lvds_update()
87 if ((rdev->mode_info.connector_table == CT_IBOOK) || in radeon_legacy_lvds_update()
88 (rdev->mode_info.connector_table == CT_POWERBOOK_EXTERNAL) || in radeon_legacy_lvds_update()
89 (rdev->mode_info.connector_table == CT_POWERBOOK_INTERNAL) || in radeon_legacy_lvds_update()
90 (rdev->mode_info.connector_table == CT_POWERBOOK_VGA)) in radeon_legacy_lvds_update()
138 if (rdev->is_atom_bios) in radeon_legacy_lvds_update()
139 radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_lvds_update()
141 radeon_combios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_lvds_update()
145 static void radeon_legacy_lvds_dpms(struct drm_encoder *encoder, int mode) in radeon_legacy_lvds_dpms() argument
147 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_lvds_dpms()
148 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_lvds_dpms()
151 if (radeon_encoder->enc_priv) { in radeon_legacy_lvds_dpms()
152 if (rdev->is_atom_bios) { in radeon_legacy_lvds_dpms()
153 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv; in radeon_legacy_lvds_dpms() local
154 lvds->dpms_mode = mode; in radeon_legacy_lvds_dpms()
156 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv; in radeon_legacy_lvds_dpms() local
157 lvds->dpms_mode = mode; in radeon_legacy_lvds_dpms()
161 radeon_legacy_lvds_update(encoder, mode); in radeon_legacy_lvds_dpms()
164 static void radeon_legacy_lvds_prepare(struct drm_encoder *encoder) in radeon_legacy_lvds_prepare() argument
166 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_lvds_prepare()
168 if (rdev->is_atom_bios) in radeon_legacy_lvds_prepare()
169 radeon_atom_output_lock(encoder, true); in radeon_legacy_lvds_prepare()
171 radeon_combios_output_lock(encoder, true); in radeon_legacy_lvds_prepare()
172 radeon_legacy_lvds_dpms(encoder, DRM_MODE_DPMS_OFF); in radeon_legacy_lvds_prepare()
175 static void radeon_legacy_lvds_commit(struct drm_encoder *encoder) in radeon_legacy_lvds_commit() argument
177 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_lvds_commit()
179 radeon_legacy_lvds_dpms(encoder, DRM_MODE_DPMS_ON); in radeon_legacy_lvds_commit()
180 if (rdev->is_atom_bios) in radeon_legacy_lvds_commit()
181 radeon_atom_output_lock(encoder, false); in radeon_legacy_lvds_commit()
183 radeon_combios_output_lock(encoder, false); in radeon_legacy_lvds_commit()
186 static void radeon_legacy_lvds_mode_set(struct drm_encoder *encoder, in radeon_legacy_lvds_mode_set() argument
190 struct drm_device *dev = encoder->dev; in radeon_legacy_lvds_mode_set()
191 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_lvds_mode_set()
192 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); in radeon_legacy_lvds_mode_set()
193 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_lvds_mode_set()
202 if (rdev->is_atom_bios) { in radeon_legacy_lvds_mode_set()
206 radeon_encoder->pixel_clock = adjusted_mode->clock; in radeon_legacy_lvds_mode_set()
207 atombios_digital_setup(encoder, PANEL_ENCODER_ACTION_ENABLE); in radeon_legacy_lvds_mode_set()
210 struct radeon_encoder_lvds *lvds = (struct radeon_encoder_lvds *)radeon_encoder->enc_priv; in radeon_legacy_lvds_mode_set() local
211 if (lvds) { in radeon_legacy_lvds_mode_set()
212 DRM_DEBUG_KMS("bios LVDS_GEN_CNTL: 0x%x\n", lvds->lvds_gen_cntl); in radeon_legacy_lvds_mode_set()
213 lvds_gen_cntl = lvds->lvds_gen_cntl; in radeon_legacy_lvds_mode_set()
216 lvds_ss_gen_cntl |= ((lvds->panel_digon_delay << RADEON_LVDS_PWRSEQ_DELAY1_SHIFT) | in radeon_legacy_lvds_mode_set()
217 (lvds->panel_blon_delay << RADEON_LVDS_PWRSEQ_DELAY2_SHIFT)); in radeon_legacy_lvds_mode_set()
230 if (radeon_crtc->crtc_id == 0) { in radeon_legacy_lvds_mode_set()
232 if (radeon_encoder->rmx_type != RMX_OFF) in radeon_legacy_lvds_mode_set()
247 if (rdev->family == CHIP_RV410) in radeon_legacy_lvds_mode_set()
250 if (rdev->is_atom_bios) in radeon_legacy_lvds_mode_set()
251 radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_lvds_mode_set()
253 radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_lvds_mode_set()
256 static bool radeon_legacy_mode_fixup(struct drm_encoder *encoder, in radeon_legacy_mode_fixup() argument
260 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_mode_fixup()
262 /* set the active encoder to connector routing */ in radeon_legacy_mode_fixup()
263 radeon_encoder_set_active_device(encoder); in radeon_legacy_mode_fixup()
266 /* get the native mode for LVDS */ in radeon_legacy_mode_fixup()
267 if (radeon_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) in radeon_legacy_mode_fixup()
268 radeon_panel_mode_fixup(encoder, adjusted_mode); in radeon_legacy_mode_fixup()
285 struct drm_device *dev = radeon_encoder->base.dev; in radeon_legacy_get_backlight_level()
286 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_get_backlight_level()
298 struct drm_device *dev = radeon_encoder->base.dev; in radeon_legacy_set_backlight_level()
299 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_set_backlight_level()
302 if (radeon_encoder->enc_priv) { in radeon_legacy_set_backlight_level()
303 if (rdev->is_atom_bios) { in radeon_legacy_set_backlight_level()
304 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv; in radeon_legacy_set_backlight_level() local
305 if (lvds->backlight_level > 0) in radeon_legacy_set_backlight_level()
306 dpms_mode = lvds->dpms_mode; in radeon_legacy_set_backlight_level()
309 lvds->backlight_level = level; in radeon_legacy_set_backlight_level()
311 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv; in radeon_legacy_set_backlight_level() local
312 if (lvds->backlight_level > 0) in radeon_legacy_set_backlight_level()
313 dpms_mode = lvds->dpms_mode; in radeon_legacy_set_backlight_level()
316 lvds->backlight_level = level; in radeon_legacy_set_backlight_level()
320 radeon_legacy_lvds_update(&radeon_encoder->base, dpms_mode); in radeon_legacy_set_backlight_level()
329 if (bd->props.brightness < 0) in radeon_legacy_lvds_level()
331 else if (bd->props.brightness > RADEON_MAX_BL_LEVEL) in radeon_legacy_lvds_level()
334 level = bd->props.brightness; in radeon_legacy_lvds_level()
336 if (pdata->negative) in radeon_legacy_lvds_level()
337 level = RADEON_MAX_BL_LEVEL - level; in radeon_legacy_lvds_level()
345 struct radeon_encoder *radeon_encoder = pdata->encoder; in radeon_legacy_backlight_update_status()
356 struct radeon_encoder *radeon_encoder = pdata->encoder; in radeon_legacy_backlight_get_brightness()
357 struct drm_device *dev = radeon_encoder->base.dev; in radeon_legacy_backlight_get_brightness()
358 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_backlight_get_brightness()
364 return pdata->negative ? RADEON_MAX_BL_LEVEL - backlight_level : backlight_level; in radeon_legacy_backlight_get_brightness()
375 struct drm_device *dev = radeon_encoder->base.dev; in radeon_legacy_backlight_init()
376 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_backlight_init()
383 if (!radeon_encoder->enc_priv) in radeon_legacy_backlight_init()
393 drm_info(dev, "Skipping radeon legacy LVDS backlight registration\n"); in radeon_legacy_backlight_init()
407 "radeon_bl%d", dev->primary->index); in radeon_legacy_backlight_init()
408 bd = backlight_device_register(bl_name, drm_connector->kdev, in radeon_legacy_backlight_init()
415 pdata->encoder = radeon_encoder; in radeon_legacy_backlight_init()
424 pdata->negative = true; in radeon_legacy_backlight_init()
426 pdata->negative = false; in radeon_legacy_backlight_init()
431 pdata->negative = (rdev->family != CHIP_RV200 && in radeon_legacy_backlight_init()
432 rdev->family != CHIP_RV250 && in radeon_legacy_backlight_init()
433 rdev->family != CHIP_RV280 && in radeon_legacy_backlight_init()
434 rdev->family != CHIP_RV350); in radeon_legacy_backlight_init()
437 pdata->negative = (pdata->negative || in radeon_legacy_backlight_init()
444 if (rdev->is_atom_bios) { in radeon_legacy_backlight_init()
445 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv; in radeon_legacy_backlight_init() local
446 lvds->bl_dev = bd; in radeon_legacy_backlight_init()
448 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv; in radeon_legacy_backlight_init() local
449 lvds->bl_dev = bd; in radeon_legacy_backlight_init()
452 bd->props.brightness = radeon_legacy_backlight_get_brightness(bd); in radeon_legacy_backlight_init()
453 bd->props.power = BACKLIGHT_POWER_ON; in radeon_legacy_backlight_init()
456 DRM_INFO("radeon legacy LVDS backlight initialized\n"); in radeon_legacy_backlight_init()
457 rdev->mode_info.bl_encoder = radeon_encoder; in radeon_legacy_backlight_init()
468 struct drm_device *dev = radeon_encoder->base.dev; in radeon_legacy_backlight_exit()
469 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_backlight_exit()
472 if (!radeon_encoder->enc_priv) in radeon_legacy_backlight_exit()
475 if (rdev->is_atom_bios) { in radeon_legacy_backlight_exit()
476 struct radeon_encoder_atom_dig *lvds = radeon_encoder->enc_priv; in radeon_legacy_backlight_exit() local
477 bd = lvds->bl_dev; in radeon_legacy_backlight_exit()
478 lvds->bl_dev = NULL; in radeon_legacy_backlight_exit()
480 struct radeon_encoder_lvds *lvds = radeon_encoder->enc_priv; in radeon_legacy_backlight_exit() local
481 bd = lvds->bl_dev; in radeon_legacy_backlight_exit()
482 lvds->bl_dev = NULL; in radeon_legacy_backlight_exit()
492 DRM_INFO("radeon legacy LVDS backlight unloaded\n"); in radeon_legacy_backlight_exit()
496 static void radeon_lvds_enc_destroy(struct drm_encoder *encoder) in radeon_lvds_enc_destroy() argument
498 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_lvds_enc_destroy()
500 if (radeon_encoder->enc_priv) { in radeon_lvds_enc_destroy()
502 kfree(radeon_encoder->enc_priv); in radeon_lvds_enc_destroy()
504 drm_encoder_cleanup(encoder); in radeon_lvds_enc_destroy()
512 static void radeon_legacy_primary_dac_dpms(struct drm_encoder *encoder, int mode) in radeon_legacy_primary_dac_dpms() argument
514 struct drm_device *dev = encoder->dev; in radeon_legacy_primary_dac_dpms()
515 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_primary_dac_dpms()
542 if (!(rdev->flags & RADEON_SINGLE_CRTC)) in radeon_legacy_primary_dac_dpms()
547 if (rdev->is_atom_bios) in radeon_legacy_primary_dac_dpms()
548 radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_primary_dac_dpms()
550 radeon_combios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_primary_dac_dpms()
554 static void radeon_legacy_primary_dac_prepare(struct drm_encoder *encoder) in radeon_legacy_primary_dac_prepare() argument
556 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_primary_dac_prepare()
558 if (rdev->is_atom_bios) in radeon_legacy_primary_dac_prepare()
559 radeon_atom_output_lock(encoder, true); in radeon_legacy_primary_dac_prepare()
561 radeon_combios_output_lock(encoder, true); in radeon_legacy_primary_dac_prepare()
562 radeon_legacy_primary_dac_dpms(encoder, DRM_MODE_DPMS_OFF); in radeon_legacy_primary_dac_prepare()
565 static void radeon_legacy_primary_dac_commit(struct drm_encoder *encoder) in radeon_legacy_primary_dac_commit() argument
567 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_primary_dac_commit()
569 radeon_legacy_primary_dac_dpms(encoder, DRM_MODE_DPMS_ON); in radeon_legacy_primary_dac_commit()
571 if (rdev->is_atom_bios) in radeon_legacy_primary_dac_commit()
572 radeon_atom_output_lock(encoder, false); in radeon_legacy_primary_dac_commit()
574 radeon_combios_output_lock(encoder, false); in radeon_legacy_primary_dac_commit()
577 static void radeon_legacy_primary_dac_mode_set(struct drm_encoder *encoder, in radeon_legacy_primary_dac_mode_set() argument
581 struct drm_device *dev = encoder->dev; in radeon_legacy_primary_dac_mode_set()
582 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_primary_dac_mode_set()
583 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); in radeon_legacy_primary_dac_mode_set()
584 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_primary_dac_mode_set()
589 if (radeon_crtc->crtc_id == 0) { in radeon_legacy_primary_dac_mode_set()
590 if (rdev->family == CHIP_R200 || ASIC_IS_R300(rdev)) { in radeon_legacy_primary_dac_mode_set()
599 if (rdev->family == CHIP_R200 || ASIC_IS_R300(rdev)) { in radeon_legacy_primary_dac_mode_set()
612 /* TODO 6-bits */ in radeon_legacy_primary_dac_mode_set()
620 if (radeon_encoder->enc_priv) { in radeon_legacy_primary_dac_mode_set()
621 …struct radeon_encoder_primary_dac *p_dac = (struct radeon_encoder_primary_dac *)radeon_encoder->en… in radeon_legacy_primary_dac_mode_set()
622 dac_macro_cntl = p_dac->ps2_pdac_adj; in radeon_legacy_primary_dac_mode_set()
628 if (rdev->is_atom_bios) in radeon_legacy_primary_dac_mode_set()
629 radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_primary_dac_mode_set()
631 radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_primary_dac_mode_set()
634 static enum drm_connector_status radeon_legacy_primary_dac_detect(struct drm_encoder *encoder, in radeon_legacy_primary_dac_detect() argument
637 struct drm_device *dev = encoder->dev; in radeon_legacy_primary_dac_detect()
638 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_primary_dac_detect()
646 * everyone happy report the encoder as always connected. in radeon_legacy_primary_dac_detect()
724 static void radeon_legacy_tmds_int_dpms(struct drm_encoder *encoder, int mode) in radeon_legacy_tmds_int_dpms() argument
726 struct drm_device *dev = encoder->dev; in radeon_legacy_tmds_int_dpms()
727 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_tmds_int_dpms()
744 if (rdev->is_atom_bios) in radeon_legacy_tmds_int_dpms()
745 radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_tmds_int_dpms()
747 radeon_combios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_tmds_int_dpms()
751 static void radeon_legacy_tmds_int_prepare(struct drm_encoder *encoder) in radeon_legacy_tmds_int_prepare() argument
753 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_tmds_int_prepare()
755 if (rdev->is_atom_bios) in radeon_legacy_tmds_int_prepare()
756 radeon_atom_output_lock(encoder, true); in radeon_legacy_tmds_int_prepare()
758 radeon_combios_output_lock(encoder, true); in radeon_legacy_tmds_int_prepare()
759 radeon_legacy_tmds_int_dpms(encoder, DRM_MODE_DPMS_OFF); in radeon_legacy_tmds_int_prepare()
762 static void radeon_legacy_tmds_int_commit(struct drm_encoder *encoder) in radeon_legacy_tmds_int_commit() argument
764 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_tmds_int_commit()
766 radeon_legacy_tmds_int_dpms(encoder, DRM_MODE_DPMS_ON); in radeon_legacy_tmds_int_commit()
768 if (rdev->is_atom_bios) in radeon_legacy_tmds_int_commit()
769 radeon_atom_output_lock(encoder, true); in radeon_legacy_tmds_int_commit()
771 radeon_combios_output_lock(encoder, true); in radeon_legacy_tmds_int_commit()
774 static void radeon_legacy_tmds_int_mode_set(struct drm_encoder *encoder, in radeon_legacy_tmds_int_mode_set() argument
778 struct drm_device *dev = encoder->dev; in radeon_legacy_tmds_int_mode_set()
779 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_tmds_int_mode_set()
780 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); in radeon_legacy_tmds_int_mode_set()
781 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_tmds_int_mode_set()
789 if (rdev->family == CHIP_RV280) { in radeon_legacy_tmds_int_mode_set()
790 /* bit 22 of TMDS_PLL_CNTL is read-back inverted */ in radeon_legacy_tmds_int_mode_set()
795 if (radeon_encoder->enc_priv) { in radeon_legacy_tmds_int_mode_set()
796 struct radeon_encoder_int_tmds *tmds = (struct radeon_encoder_int_tmds *)radeon_encoder->enc_priv; in radeon_legacy_tmds_int_mode_set()
799 if (tmds->tmds_pll[i].freq == 0) in radeon_legacy_tmds_int_mode_set()
801 if ((uint32_t)(mode->clock / 10) < tmds->tmds_pll[i].freq) { in radeon_legacy_tmds_int_mode_set()
802 tmp = tmds->tmds_pll[i].value ; in radeon_legacy_tmds_int_mode_set()
808 if (ASIC_IS_R300(rdev) || (rdev->family == CHIP_RV280)) { in radeon_legacy_tmds_int_mode_set()
821 if (rdev->family == CHIP_R200 || in radeon_legacy_tmds_int_mode_set()
822 rdev->family == CHIP_R100 || in radeon_legacy_tmds_int_mode_set()
847 if (radeon_crtc->crtc_id == 0) { in radeon_legacy_tmds_int_mode_set()
848 if (ASIC_IS_R300(rdev) || rdev->family == CHIP_R200) { in radeon_legacy_tmds_int_mode_set()
850 if (radeon_encoder->rmx_type != RMX_OFF) in radeon_legacy_tmds_int_mode_set()
857 if (ASIC_IS_R300(rdev) || rdev->family == CHIP_R200) { in radeon_legacy_tmds_int_mode_set()
868 if (rdev->is_atom_bios) in radeon_legacy_tmds_int_mode_set()
869 radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_tmds_int_mode_set()
871 radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_tmds_int_mode_set()
888 static void radeon_legacy_tmds_ext_dpms(struct drm_encoder *encoder, int mode) in radeon_legacy_tmds_ext_dpms() argument
890 struct drm_device *dev = encoder->dev; in radeon_legacy_tmds_ext_dpms()
891 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_tmds_ext_dpms()
910 if (rdev->is_atom_bios) in radeon_legacy_tmds_ext_dpms()
911 radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_tmds_ext_dpms()
913 radeon_combios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_tmds_ext_dpms()
917 static void radeon_legacy_tmds_ext_prepare(struct drm_encoder *encoder) in radeon_legacy_tmds_ext_prepare() argument
919 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_tmds_ext_prepare()
921 if (rdev->is_atom_bios) in radeon_legacy_tmds_ext_prepare()
922 radeon_atom_output_lock(encoder, true); in radeon_legacy_tmds_ext_prepare()
924 radeon_combios_output_lock(encoder, true); in radeon_legacy_tmds_ext_prepare()
925 radeon_legacy_tmds_ext_dpms(encoder, DRM_MODE_DPMS_OFF); in radeon_legacy_tmds_ext_prepare()
928 static void radeon_legacy_tmds_ext_commit(struct drm_encoder *encoder) in radeon_legacy_tmds_ext_commit() argument
930 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_tmds_ext_commit()
931 radeon_legacy_tmds_ext_dpms(encoder, DRM_MODE_DPMS_ON); in radeon_legacy_tmds_ext_commit()
933 if (rdev->is_atom_bios) in radeon_legacy_tmds_ext_commit()
934 radeon_atom_output_lock(encoder, false); in radeon_legacy_tmds_ext_commit()
936 radeon_combios_output_lock(encoder, false); in radeon_legacy_tmds_ext_commit()
939 static void radeon_legacy_tmds_ext_mode_set(struct drm_encoder *encoder, in radeon_legacy_tmds_ext_mode_set() argument
943 struct drm_device *dev = encoder->dev; in radeon_legacy_tmds_ext_mode_set()
944 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_tmds_ext_mode_set()
945 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); in radeon_legacy_tmds_ext_mode_set()
946 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_tmds_ext_mode_set()
951 if (rdev->is_atom_bios) { in radeon_legacy_tmds_ext_mode_set()
952 radeon_encoder->pixel_clock = adjusted_mode->clock; in radeon_legacy_tmds_ext_mode_set()
953 atombios_dvo_setup(encoder, ATOM_ENABLE); in radeon_legacy_tmds_ext_mode_set()
969 if ((rdev->pdev->device == 0x4850) && in radeon_legacy_tmds_ext_mode_set()
970 (rdev->pdev->subsystem_vendor == 0x1028) && in radeon_legacy_tmds_ext_mode_set()
971 (rdev->pdev->subsystem_device == 0x2001)) /* Dell Inspiron 8600 */ in radeon_legacy_tmds_ext_mode_set()
976 /*if (mode->clock > 165000) in radeon_legacy_tmds_ext_mode_set()
979 if (!radeon_combios_external_tmds_setup(encoder)) in radeon_legacy_tmds_ext_mode_set()
980 radeon_external_tmds_setup(encoder); in radeon_legacy_tmds_ext_mode_set()
983 if (radeon_crtc->crtc_id == 0) { in radeon_legacy_tmds_ext_mode_set()
984 if ((rdev->family == CHIP_R200) || ASIC_IS_R300(rdev)) { in radeon_legacy_tmds_ext_mode_set()
986 if (radeon_encoder->rmx_type != RMX_OFF) in radeon_legacy_tmds_ext_mode_set()
993 if ((rdev->family == CHIP_R200) || ASIC_IS_R300(rdev)) { in radeon_legacy_tmds_ext_mode_set()
1002 if (rdev->is_atom_bios) in radeon_legacy_tmds_ext_mode_set()
1003 radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_tmds_ext_mode_set()
1005 radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_tmds_ext_mode_set()
1008 static void radeon_ext_tmds_enc_destroy(struct drm_encoder *encoder) in radeon_ext_tmds_enc_destroy() argument
1010 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_ext_tmds_enc_destroy()
1012 kfree(radeon_encoder->enc_priv); in radeon_ext_tmds_enc_destroy()
1013 drm_encoder_cleanup(encoder); in radeon_ext_tmds_enc_destroy()
1031 static void radeon_legacy_tv_dac_dpms(struct drm_encoder *encoder, int mode) in radeon_legacy_tv_dac_dpms() argument
1033 struct drm_device *dev = encoder->dev; in radeon_legacy_tv_dac_dpms()
1034 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_tv_dac_dpms()
1035 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_tv_dac_dpms()
1041 is_tv = radeon_encoder->active_device & ATOM_DEVICE_TV_SUPPORT ? true : false; in radeon_legacy_tv_dac_dpms()
1043 if (rdev->family == CHIP_R200) in radeon_legacy_tv_dac_dpms()
1055 if (rdev->family == CHIP_R200) { in radeon_legacy_tv_dac_dpms()
1063 if (rdev->family == CHIP_R420 || in radeon_legacy_tv_dac_dpms()
1064 rdev->family == CHIP_R423 || in radeon_legacy_tv_dac_dpms()
1065 rdev->family == CHIP_RV410) in radeon_legacy_tv_dac_dpms()
1080 if (rdev->family == CHIP_R200) in radeon_legacy_tv_dac_dpms()
1088 if (rdev->family == CHIP_R420 || in radeon_legacy_tv_dac_dpms()
1089 rdev->family == CHIP_R423 || in radeon_legacy_tv_dac_dpms()
1090 rdev->family == CHIP_RV410) in radeon_legacy_tv_dac_dpms()
1104 if (rdev->family == CHIP_R200) { in radeon_legacy_tv_dac_dpms()
1110 else if (!(rdev->flags & RADEON_SINGLE_CRTC)) in radeon_legacy_tv_dac_dpms()
1115 if (rdev->is_atom_bios) in radeon_legacy_tv_dac_dpms()
1116 radeon_atombios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_tv_dac_dpms()
1118 radeon_combios_encoder_dpms_scratch_regs(encoder, (mode == DRM_MODE_DPMS_ON) ? true : false); in radeon_legacy_tv_dac_dpms()
1122 static void radeon_legacy_tv_dac_prepare(struct drm_encoder *encoder) in radeon_legacy_tv_dac_prepare() argument
1124 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_tv_dac_prepare()
1126 if (rdev->is_atom_bios) in radeon_legacy_tv_dac_prepare()
1127 radeon_atom_output_lock(encoder, true); in radeon_legacy_tv_dac_prepare()
1129 radeon_combios_output_lock(encoder, true); in radeon_legacy_tv_dac_prepare()
1130 radeon_legacy_tv_dac_dpms(encoder, DRM_MODE_DPMS_OFF); in radeon_legacy_tv_dac_prepare()
1133 static void radeon_legacy_tv_dac_commit(struct drm_encoder *encoder) in radeon_legacy_tv_dac_commit() argument
1135 struct radeon_device *rdev = encoder->dev->dev_private; in radeon_legacy_tv_dac_commit()
1137 radeon_legacy_tv_dac_dpms(encoder, DRM_MODE_DPMS_ON); in radeon_legacy_tv_dac_commit()
1139 if (rdev->is_atom_bios) in radeon_legacy_tv_dac_commit()
1140 radeon_atom_output_lock(encoder, true); in radeon_legacy_tv_dac_commit()
1142 radeon_combios_output_lock(encoder, true); in radeon_legacy_tv_dac_commit()
1145 static void radeon_legacy_tv_dac_mode_set(struct drm_encoder *encoder, in radeon_legacy_tv_dac_mode_set() argument
1149 struct drm_device *dev = encoder->dev; in radeon_legacy_tv_dac_mode_set()
1150 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_tv_dac_mode_set()
1151 struct radeon_crtc *radeon_crtc = to_radeon_crtc(encoder->crtc); in radeon_legacy_tv_dac_mode_set()
1152 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_tv_dac_mode_set()
1153 struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; in radeon_legacy_tv_dac_mode_set()
1160 is_tv = radeon_encoder->active_device & ATOM_DEVICE_TV_SUPPORT ? true : false; in radeon_legacy_tv_dac_mode_set()
1162 if (rdev->family != CHIP_R200) { in radeon_legacy_tv_dac_mode_set()
1164 if (rdev->family == CHIP_R420 || in radeon_legacy_tv_dac_mode_set()
1165 rdev->family == CHIP_R423 || in radeon_legacy_tv_dac_mode_set()
1166 rdev->family == CHIP_RV410) { in radeon_legacy_tv_dac_mode_set()
1186 if (tv_dac->tv_std == TV_STD_NTSC || in radeon_legacy_tv_dac_mode_set()
1187 tv_dac->tv_std == TV_STD_NTSC_J || in radeon_legacy_tv_dac_mode_set()
1188 tv_dac->tv_std == TV_STD_PAL_M || in radeon_legacy_tv_dac_mode_set()
1189 tv_dac->tv_std == TV_STD_PAL_60) in radeon_legacy_tv_dac_mode_set()
1190 tv_dac_cntl |= tv_dac->ntsc_tvdac_adj; in radeon_legacy_tv_dac_mode_set()
1192 tv_dac_cntl |= tv_dac->pal_tvdac_adj; in radeon_legacy_tv_dac_mode_set()
1194 if (tv_dac->tv_std == TV_STD_NTSC || in radeon_legacy_tv_dac_mode_set()
1195 tv_dac->tv_std == TV_STD_NTSC_J) in radeon_legacy_tv_dac_mode_set()
1201 tv_dac->ps2_tvdac_adj); in radeon_legacy_tv_dac_mode_set()
1209 } else if (rdev->family != CHIP_R200) in radeon_legacy_tv_dac_mode_set()
1211 else if (rdev->family == CHIP_R200) in radeon_legacy_tv_dac_mode_set()
1214 if (rdev->family >= CHIP_R200) in radeon_legacy_tv_dac_mode_set()
1228 if (radeon_crtc->crtc_id == 0) { in radeon_legacy_tv_dac_mode_set()
1234 if (rdev->family >= CHIP_R200) { in radeon_legacy_tv_dac_mode_set()
1244 if (rdev->family >= CHIP_R200) { in radeon_legacy_tv_dac_mode_set()
1255 if (radeon_crtc->crtc_id == 0) { in radeon_legacy_tv_dac_mode_set()
1259 } else if (rdev->family == CHIP_R200) { in radeon_legacy_tv_dac_mode_set()
1268 } else if (rdev->family == CHIP_R200) { in radeon_legacy_tv_dac_mode_set()
1281 } else if (rdev->family != CHIP_R200) in radeon_legacy_tv_dac_mode_set()
1283 else if (rdev->family == CHIP_R200) in radeon_legacy_tv_dac_mode_set()
1286 if (rdev->family >= CHIP_R200) in radeon_legacy_tv_dac_mode_set()
1290 radeon_legacy_tv_mode_set(encoder, mode, adjusted_mode); in radeon_legacy_tv_dac_mode_set()
1292 if (rdev->is_atom_bios) in radeon_legacy_tv_dac_mode_set()
1293 radeon_atombios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_tv_dac_mode_set()
1295 radeon_combios_encoder_crtc_scratch_regs(encoder, radeon_crtc->crtc_id); in radeon_legacy_tv_dac_mode_set()
1299 static bool r300_legacy_tv_detect(struct drm_encoder *encoder, in r300_legacy_tv_detect() argument
1302 struct drm_device *dev = encoder->dev; in r300_legacy_tv_detect()
1303 struct radeon_device *rdev = dev->dev_private; in r300_legacy_tv_detect()
1355 DRM_DEBUG_KMS("S-video TV connection detected\n"); in r300_legacy_tv_detect()
1370 static bool radeon_legacy_tv_detect(struct drm_encoder *encoder, in radeon_legacy_tv_detect() argument
1373 struct drm_device *dev = encoder->dev; in radeon_legacy_tv_detect()
1374 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_tv_detect()
1380 return r300_legacy_tv_detect(encoder, connector); in radeon_legacy_tv_detect()
1421 DRM_DEBUG_KMS("S-video TV connection detected\n"); in radeon_legacy_tv_detect()
1434 static bool radeon_legacy_ext_dac_detect(struct drm_encoder *encoder, in radeon_legacy_ext_dac_detect() argument
1437 struct drm_device *dev = encoder->dev; in radeon_legacy_ext_dac_detect()
1438 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_ext_dac_detect()
1524 static enum drm_connector_status radeon_legacy_tv_dac_detect(struct drm_encoder *encoder, in radeon_legacy_tv_dac_detect() argument
1527 struct drm_device *dev = encoder->dev; in radeon_legacy_tv_dac_detect()
1528 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_tv_dac_detect()
1533 struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder); in radeon_legacy_tv_dac_detect()
1534 struct radeon_encoder_tv_dac *tv_dac = radeon_encoder->enc_priv; in radeon_legacy_tv_dac_detect()
1538 /* find out if crtc2 is in use or if this encoder is using it */ in radeon_legacy_tv_dac_detect()
1539 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) { in radeon_legacy_tv_dac_detect()
1541 if ((radeon_crtc->crtc_id == 1) && crtc->enabled) { in radeon_legacy_tv_dac_detect()
1542 if (encoder->crtc != crtc) { in radeon_legacy_tv_dac_detect()
1548 if (connector->connector_type == DRM_MODE_CONNECTOR_SVIDEO || in radeon_legacy_tv_dac_detect()
1549 connector->connector_type == DRM_MODE_CONNECTOR_Composite || in radeon_legacy_tv_dac_detect()
1550 connector->connector_type == DRM_MODE_CONNECTOR_9PinDIN) { in radeon_legacy_tv_dac_detect()
1553 if (radeon_encoder->active_device && !(radeon_encoder->active_device & ATOM_DEVICE_TV_SUPPORT)) in radeon_legacy_tv_dac_detect()
1556 tv_detect = radeon_legacy_tv_detect(encoder, connector); in radeon_legacy_tv_dac_detect()
1562 /* don't probe if the encoder is being used for something else not CRT related */ in radeon_legacy_tv_dac_detect()
1563 if (radeon_encoder->active_device && !(radeon_encoder->active_device & ATOM_DEVICE_CRT_SUPPORT)) { in radeon_legacy_tv_dac_detect()
1564 DRM_INFO("not detecting due to %08x\n", radeon_encoder->active_device); in radeon_legacy_tv_dac_detect()
1569 if (rdev->family == CHIP_R200) { in radeon_legacy_tv_dac_detect()
1570 if (radeon_legacy_ext_dac_detect(encoder, connector)) in radeon_legacy_tv_dac_detect()
1578 if (rdev->flags & RADEON_SINGLE_CRTC) { in radeon_legacy_tv_dac_detect()
1597 if (rdev->flags & RADEON_SINGLE_CRTC) { in radeon_legacy_tv_dac_detect()
1657 if (rdev->flags & RADEON_SINGLE_CRTC) { in radeon_legacy_tv_dac_detect()
1691 static struct radeon_encoder_int_tmds *radeon_legacy_get_tmds_info(struct radeon_encoder *encoder) in radeon_legacy_get_tmds_info() argument
1693 struct drm_device *dev = encoder->base.dev; in radeon_legacy_get_tmds_info()
1694 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_get_tmds_info()
1703 if (rdev->is_atom_bios) in radeon_legacy_get_tmds_info()
1704 ret = radeon_atombios_get_tmds_info(encoder, tmds); in radeon_legacy_get_tmds_info()
1706 ret = radeon_legacy_get_tmds_info_from_combios(encoder, tmds); in radeon_legacy_get_tmds_info()
1709 radeon_legacy_get_tmds_info_from_table(encoder, tmds); in radeon_legacy_get_tmds_info()
1714 …tic struct radeon_encoder_ext_tmds *radeon_legacy_get_ext_tmds_info(struct radeon_encoder *encoder) in radeon_legacy_get_ext_tmds_info() argument
1716 struct drm_device *dev = encoder->base.dev; in radeon_legacy_get_ext_tmds_info()
1717 struct radeon_device *rdev = dev->dev_private; in radeon_legacy_get_ext_tmds_info()
1721 if (rdev->is_atom_bios) in radeon_legacy_get_ext_tmds_info()
1729 ret = radeon_legacy_get_ext_tmds_info_from_combios(encoder, tmds); in radeon_legacy_get_ext_tmds_info()
1732 radeon_legacy_get_ext_tmds_info_from_table(encoder, tmds); in radeon_legacy_get_ext_tmds_info()
1740 struct radeon_device *rdev = dev->dev_private; in radeon_add_legacy_encoder()
1741 struct drm_encoder *encoder; in radeon_add_legacy_encoder() local
1745 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { in radeon_add_legacy_encoder()
1746 radeon_encoder = to_radeon_encoder(encoder); in radeon_add_legacy_encoder()
1747 if (radeon_encoder->encoder_enum == encoder_enum) { in radeon_add_legacy_encoder()
1748 radeon_encoder->devices |= supported_device; in radeon_add_legacy_encoder()
1759 encoder = &radeon_encoder->base; in radeon_add_legacy_encoder()
1760 if (rdev->flags & RADEON_SINGLE_CRTC) in radeon_add_legacy_encoder()
1761 encoder->possible_crtcs = 0x1; in radeon_add_legacy_encoder()
1763 encoder->possible_crtcs = 0x3; in radeon_add_legacy_encoder()
1765 radeon_encoder->enc_priv = NULL; in radeon_add_legacy_encoder()
1767 radeon_encoder->encoder_enum = encoder_enum; in radeon_add_legacy_encoder()
1768 radeon_encoder->encoder_id = (encoder_enum & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; in radeon_add_legacy_encoder()
1769 radeon_encoder->devices = supported_device; in radeon_add_legacy_encoder()
1770 radeon_encoder->rmx_type = RMX_OFF; in radeon_add_legacy_encoder()
1772 switch (radeon_encoder->encoder_id) { in radeon_add_legacy_encoder()
1774 encoder->possible_crtcs = 0x1; in radeon_add_legacy_encoder()
1775 drm_encoder_init(dev, encoder, &radeon_legacy_lvds_enc_funcs, in radeon_add_legacy_encoder()
1777 drm_encoder_helper_add(encoder, &radeon_legacy_lvds_helper_funcs); in radeon_add_legacy_encoder()
1778 if (rdev->is_atom_bios) in radeon_add_legacy_encoder()
1779 radeon_encoder->enc_priv = radeon_atombios_get_lvds_info(radeon_encoder); in radeon_add_legacy_encoder()
1781 radeon_encoder->enc_priv = radeon_combios_get_lvds_info(radeon_encoder); in radeon_add_legacy_encoder()
1782 radeon_encoder->rmx_type = RMX_FULL; in radeon_add_legacy_encoder()
1785 drm_encoder_init(dev, encoder, &radeon_legacy_tmds_int_enc_funcs, in radeon_add_legacy_encoder()
1787 drm_encoder_helper_add(encoder, &radeon_legacy_tmds_int_helper_funcs); in radeon_add_legacy_encoder()
1788 radeon_encoder->enc_priv = radeon_legacy_get_tmds_info(radeon_encoder); in radeon_add_legacy_encoder()
1791 drm_encoder_init(dev, encoder, &radeon_legacy_primary_dac_enc_funcs, in radeon_add_legacy_encoder()
1793 drm_encoder_helper_add(encoder, &radeon_legacy_primary_dac_helper_funcs); in radeon_add_legacy_encoder()
1794 if (rdev->is_atom_bios) in radeon_add_legacy_encoder()
1795 radeon_encoder->enc_priv = radeon_atombios_get_primary_dac_info(radeon_encoder); in radeon_add_legacy_encoder()
1797 radeon_encoder->enc_priv = radeon_combios_get_primary_dac_info(radeon_encoder); in radeon_add_legacy_encoder()
1800 drm_encoder_init(dev, encoder, &radeon_legacy_tv_dac_enc_funcs, in radeon_add_legacy_encoder()
1802 drm_encoder_helper_add(encoder, &radeon_legacy_tv_dac_helper_funcs); in radeon_add_legacy_encoder()
1803 if (rdev->is_atom_bios) in radeon_add_legacy_encoder()
1804 radeon_encoder->enc_priv = radeon_atombios_get_tv_dac_info(radeon_encoder); in radeon_add_legacy_encoder()
1806 radeon_encoder->enc_priv = radeon_combios_get_tv_dac_info(radeon_encoder); in radeon_add_legacy_encoder()
1809 drm_encoder_init(dev, encoder, &radeon_legacy_tmds_ext_enc_funcs, in radeon_add_legacy_encoder()
1811 drm_encoder_helper_add(encoder, &radeon_legacy_tmds_ext_helper_funcs); in radeon_add_legacy_encoder()
1812 if (!rdev->is_atom_bios) in radeon_add_legacy_encoder()
1813 radeon_encoder->enc_priv = radeon_legacy_get_ext_tmds_info(radeon_encoder); in radeon_add_legacy_encoder()