Lines Matching +full:lvds +full:- +full:encoder

2  * Copyright 2007-11 Advanced Micro Devices, Inc.
74 struct drm_device *dev = amdgpu_encoder->base.dev; in amdgpu_atombios_encoder_get_backlight_level()
77 if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)) in amdgpu_atombios_encoder_get_backlight_level()
87 struct drm_encoder *encoder = &amdgpu_encoder->base; in amdgpu_atombios_encoder_set_backlight_level() local
88 struct drm_device *dev = amdgpu_encoder->base.dev; in amdgpu_atombios_encoder_set_backlight_level()
92 if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)) in amdgpu_atombios_encoder_set_backlight_level()
95 if ((amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) && in amdgpu_atombios_encoder_set_backlight_level()
96 amdgpu_encoder->enc_priv) { in amdgpu_atombios_encoder_set_backlight_level()
97 dig = amdgpu_encoder->enc_priv; in amdgpu_atombios_encoder_set_backlight_level()
98 dig->backlight_level = level; in amdgpu_atombios_encoder_set_backlight_level()
99 amdgpu_atombios_encoder_set_backlight_level_to_reg(adev, dig->backlight_level); in amdgpu_atombios_encoder_set_backlight_level()
101 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_set_backlight_level()
107 if (dig->backlight_level == 0) in amdgpu_atombios_encoder_set_backlight_level()
108 amdgpu_atombios_encoder_setup_dig_transmitter(encoder, in amdgpu_atombios_encoder_set_backlight_level()
111 amdgpu_atombios_encoder_setup_dig_transmitter(encoder, in amdgpu_atombios_encoder_set_backlight_level()
113 amdgpu_atombios_encoder_setup_dig_transmitter(encoder, in amdgpu_atombios_encoder_set_backlight_level()
128 if (bd->props.brightness < 0) in amdgpu_atombios_encoder_backlight_level()
130 else if (bd->props.brightness > AMDGPU_MAX_BL_LEVEL) in amdgpu_atombios_encoder_backlight_level()
133 level = bd->props.brightness; in amdgpu_atombios_encoder_backlight_level()
141 struct amdgpu_encoder *amdgpu_encoder = pdata->encoder; in amdgpu_atombios_encoder_update_backlight_status()
153 struct amdgpu_encoder *amdgpu_encoder = pdata->encoder; in amdgpu_atombios_encoder_get_backlight_brightness()
154 struct drm_device *dev = amdgpu_encoder->base.dev; in amdgpu_atombios_encoder_get_backlight_brightness()
168 struct drm_device *dev = amdgpu_encoder->base.dev; in amdgpu_atombios_encoder_init_backlight()
179 if ((adev->pdev->subsystem_vendor == PCI_VENDOR_ID_APPLE) && in amdgpu_atombios_encoder_init_backlight()
180 (adev->pdev->device == 0x6741)) in amdgpu_atombios_encoder_init_backlight()
183 if (!amdgpu_encoder->enc_priv) in amdgpu_atombios_encoder_init_backlight()
186 if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)) in amdgpu_atombios_encoder_init_backlight()
204 "amdgpu_bl%d", dev->primary->index); in amdgpu_atombios_encoder_init_backlight()
205 bd = backlight_device_register(bl_name, drm_connector->kdev, in amdgpu_atombios_encoder_init_backlight()
212 pdata->encoder = amdgpu_encoder; in amdgpu_atombios_encoder_init_backlight()
214 dig = amdgpu_encoder->enc_priv; in amdgpu_atombios_encoder_init_backlight()
215 dig->bl_dev = bd; in amdgpu_atombios_encoder_init_backlight()
217 bd->props.brightness = amdgpu_atombios_encoder_get_backlight_brightness(bd); in amdgpu_atombios_encoder_init_backlight()
218 bd->props.power = BACKLIGHT_POWER_ON; in amdgpu_atombios_encoder_init_backlight()
237 struct drm_device *dev = amdgpu_encoder->base.dev; in amdgpu_atombios_encoder_fini_backlight()
242 if (!amdgpu_encoder->enc_priv) in amdgpu_atombios_encoder_fini_backlight()
245 if (!(adev->mode_info.firmware_flags & ATOM_BIOS_INFO_BL_CONTROLLED_BY_GPU)) in amdgpu_atombios_encoder_fini_backlight()
248 dig = amdgpu_encoder->enc_priv; in amdgpu_atombios_encoder_fini_backlight()
249 bd = dig->bl_dev; in amdgpu_atombios_encoder_fini_backlight()
250 dig->bl_dev = NULL; in amdgpu_atombios_encoder_fini_backlight()
259 DRM_INFO("amdgpu atom LVDS backlight unloaded\n"); in amdgpu_atombios_encoder_fini_backlight()
263 bool amdgpu_atombios_encoder_is_digital(struct drm_encoder *encoder) in amdgpu_atombios_encoder_is_digital() argument
265 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_is_digital()
266 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_is_digital()
278 bool amdgpu_atombios_encoder_mode_fixup(struct drm_encoder *encoder, in amdgpu_atombios_encoder_mode_fixup() argument
282 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_mode_fixup()
284 /* set the active encoder to connector routing */ in amdgpu_atombios_encoder_mode_fixup()
285 amdgpu_encoder_set_active_device(encoder); in amdgpu_atombios_encoder_mode_fixup()
289 if ((mode->flags & DRM_MODE_FLAG_INTERLACE) in amdgpu_atombios_encoder_mode_fixup()
290 && (mode->crtc_vsync_start < (mode->crtc_vdisplay + 2))) in amdgpu_atombios_encoder_mode_fixup()
291 adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + 2; in amdgpu_atombios_encoder_mode_fixup()
294 if (mode->crtc_vsync_start == mode->crtc_vdisplay) in amdgpu_atombios_encoder_mode_fixup()
295 adjusted_mode->crtc_vsync_start++; in amdgpu_atombios_encoder_mode_fixup()
298 if (amdgpu_encoder->active_device & (ATOM_DEVICE_LCD_SUPPORT)) in amdgpu_atombios_encoder_mode_fixup()
299 amdgpu_panel_mode_fixup(encoder, adjusted_mode); in amdgpu_atombios_encoder_mode_fixup()
300 else if (amdgpu_encoder->rmx_type != RMX_OFF) in amdgpu_atombios_encoder_mode_fixup()
301 amdgpu_panel_mode_fixup(encoder, adjusted_mode); in amdgpu_atombios_encoder_mode_fixup()
303 if ((amdgpu_encoder->active_device & (ATOM_DEVICE_DFP_SUPPORT | ATOM_DEVICE_LCD_SUPPORT)) || in amdgpu_atombios_encoder_mode_fixup()
304 (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE)) { in amdgpu_atombios_encoder_mode_fixup()
305 struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder); in amdgpu_atombios_encoder_mode_fixup()
313 amdgpu_atombios_encoder_setup_dac(struct drm_encoder *encoder, int action) in amdgpu_atombios_encoder_setup_dac() argument
315 struct drm_device *dev = encoder->dev; in amdgpu_atombios_encoder_setup_dac()
317 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_setup_dac()
323 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_setup_dac()
336 args.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dac()
338 amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in amdgpu_atombios_encoder_setup_dac()
342 static u8 amdgpu_atombios_encoder_get_bpc(struct drm_encoder *encoder) in amdgpu_atombios_encoder_get_bpc() argument
346 if (encoder->crtc) { in amdgpu_atombios_encoder_get_bpc()
347 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(encoder->crtc); in amdgpu_atombios_encoder_get_bpc()
348 bpc = amdgpu_crtc->bpc; in amdgpu_atombios_encoder_get_bpc()
376 amdgpu_atombios_encoder_setup_dvo(struct drm_encoder *encoder, int action) in amdgpu_atombios_encoder_setup_dvo() argument
378 struct drm_device *dev = encoder->dev; in amdgpu_atombios_encoder_setup_dvo()
380 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_setup_dvo()
387 if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev)) in amdgpu_atombios_encoder_setup_dvo()
397 if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dvo()
405 args.dvo.sDVOEncoder.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dvo()
409 if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dvo()
415 args.dvo_v3.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dvo()
421 args.dvo_v4.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dvo()
423 args.dvo_v4.ucBitPerColor = amdgpu_atombios_encoder_get_bpc(encoder); in amdgpu_atombios_encoder_setup_dvo()
435 amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in amdgpu_atombios_encoder_setup_dvo()
438 int amdgpu_atombios_encoder_get_encoder_mode(struct drm_encoder *encoder) in amdgpu_atombios_encoder_get_encoder_mode() argument
440 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_get_encoder_mode()
446 if (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE) in amdgpu_atombios_encoder_get_encoder_mode()
450 if ((amdgpu_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_DVO1) || in amdgpu_atombios_encoder_get_encoder_mode()
451 (amdgpu_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1)) in amdgpu_atombios_encoder_get_encoder_mode()
454 connector = amdgpu_get_connector_for_encoder(encoder); in amdgpu_atombios_encoder_get_encoder_mode()
456 * the connectors tied to the encoder. in amdgpu_atombios_encoder_get_encoder_mode()
459 connector = amdgpu_get_connector_for_encoder_init(encoder); in amdgpu_atombios_encoder_get_encoder_mode()
462 switch (connector->connector_type) { in amdgpu_atombios_encoder_get_encoder_mode()
464 case DRM_MODE_CONNECTOR_HDMIB: /* HDMI-B is basically DL-DVI; analog works fine */ in amdgpu_atombios_encoder_get_encoder_mode()
466 if (amdgpu_connector->use_digital && in amdgpu_atombios_encoder_get_encoder_mode()
467 (amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE)) in amdgpu_atombios_encoder_get_encoder_mode()
469 else if (connector->display_info.is_hdmi && in amdgpu_atombios_encoder_get_encoder_mode()
470 (amdgpu_connector->audio == AMDGPU_AUDIO_AUTO)) in amdgpu_atombios_encoder_get_encoder_mode()
472 else if (amdgpu_connector->use_digital) in amdgpu_atombios_encoder_get_encoder_mode()
476 } else if (amdgpu_connector->use_digital) { in amdgpu_atombios_encoder_get_encoder_mode()
486 if (amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE) in amdgpu_atombios_encoder_get_encoder_mode()
488 else if (connector->display_info.is_hdmi && in amdgpu_atombios_encoder_get_encoder_mode()
489 (amdgpu_connector->audio == AMDGPU_AUDIO_AUTO)) in amdgpu_atombios_encoder_get_encoder_mode()
499 dig_connector = amdgpu_connector->con_priv; in amdgpu_atombios_encoder_get_encoder_mode()
500 if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) || in amdgpu_atombios_encoder_get_encoder_mode()
501 (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP)) { in amdgpu_atombios_encoder_get_encoder_mode()
504 if (amdgpu_connector->audio == AMDGPU_AUDIO_ENABLE) in amdgpu_atombios_encoder_get_encoder_mode()
506 else if (connector->display_info.is_hdmi && in amdgpu_atombios_encoder_get_encoder_mode()
507 (amdgpu_connector->audio == AMDGPU_AUDIO_AUTO)) in amdgpu_atombios_encoder_get_encoder_mode()
528 * DIG Encoder/Transmitter Setup
531 * - 3 DIG transmitter blocks UNIPHY0/1/2 (links A and B).
533 * - 6 DIG encoder blocks.
534 * - DIG to PHY mapping is hardcoded
543 * crtc -> dig encoder -> UNIPHY/LVTMA (1 or 2 links)
545 * crtc0 -> dig2 -> LVTMA links A+B -> TMDS/HDMI
546 * crtc1 -> dig1 -> UNIPHY0 link B -> DP
547 * crtc0 -> dig1 -> UNIPHY2 link A -> LVDS
548 * crtc1 -> dig2 -> UNIPHY1 link B+A -> TMDS/HDMI
560 amdgpu_atombios_encoder_setup_dig_encoder(struct drm_encoder *encoder, in amdgpu_atombios_encoder_setup_dig_encoder() argument
563 struct drm_device *dev = encoder->dev; in amdgpu_atombios_encoder_setup_dig_encoder()
565 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_setup_dig_encoder()
566 struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; in amdgpu_atombios_encoder_setup_dig_encoder()
567 struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder); in amdgpu_atombios_encoder_setup_dig_encoder()
578 amdgpu_connector->con_priv; in amdgpu_atombios_encoder_setup_dig_encoder()
580 dp_clock = dig_connector->dp_clock; in amdgpu_atombios_encoder_setup_dig_encoder()
581 dp_lane_count = dig_connector->dp_lane_count; in amdgpu_atombios_encoder_setup_dig_encoder()
582 hpd_id = amdgpu_connector->hpd.hpd; in amdgpu_atombios_encoder_setup_dig_encoder()
585 /* no dig encoder assigned */ in amdgpu_atombios_encoder_setup_dig_encoder()
586 if (dig->dig_encoder == -1) in amdgpu_atombios_encoder_setup_dig_encoder()
591 if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev)) in amdgpu_atombios_encoder_setup_dig_encoder()
599 args.v1.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_encoder()
603 args.v1.ucEncoderMode = amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_setup_dig_encoder()
607 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_encoder()
614 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_setup_dig_encoder()
626 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_encoder()
634 args.v3.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_encoder()
638 args.v3.ucEncoderMode = amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_setup_dig_encoder()
642 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_encoder()
649 args.v3.acConfig.ucDigSel = dig->dig_encoder; in amdgpu_atombios_encoder_setup_dig_encoder()
650 args.v3.ucBitPerColor = amdgpu_atombios_encoder_get_bpc(encoder); in amdgpu_atombios_encoder_setup_dig_encoder()
654 args.v4.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_encoder()
658 args.v4.ucEncoderMode = amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_setup_dig_encoder()
662 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_encoder()
677 args.v4.acConfig.ucDigSel = dig->dig_encoder; in amdgpu_atombios_encoder_setup_dig_encoder()
678 args.v4.ucBitPerColor = amdgpu_atombios_encoder_get_bpc(encoder); in amdgpu_atombios_encoder_setup_dig_encoder()
689 args.v5.asDPPanelModeParam.ucDigId = dig->dig_encoder; in amdgpu_atombios_encoder_setup_dig_encoder()
693 args.v5.asStreamParam.ucDigId = dig->dig_encoder; in amdgpu_atombios_encoder_setup_dig_encoder()
695 amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_setup_dig_encoder()
698 else if (amdgpu_dig_monitor_is_duallink(encoder, in amdgpu_atombios_encoder_setup_dig_encoder()
699 amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_encoder()
704 cpu_to_le32(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_encoder()
706 amdgpu_atombios_encoder_get_bpc(encoder); in amdgpu_atombios_encoder_setup_dig_encoder()
718 args.v5.asCmdParam.ucDigId = dig->dig_encoder; in amdgpu_atombios_encoder_setup_dig_encoder()
735 amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in amdgpu_atombios_encoder_setup_dig_encoder()
749 amdgpu_atombios_encoder_setup_dig_transmitter(struct drm_encoder *encoder, int action, in amdgpu_atombios_encoder_setup_dig_transmitter() argument
752 struct drm_device *dev = encoder->dev; in amdgpu_atombios_encoder_setup_dig_transmitter()
754 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_setup_dig_transmitter()
755 struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; in amdgpu_atombios_encoder_setup_dig_transmitter()
765 int dig_encoder = dig->dig_encoder; in amdgpu_atombios_encoder_setup_dig_transmitter()
769 connector = amdgpu_get_connector_for_encoder_init(encoder); in amdgpu_atombios_encoder_setup_dig_transmitter()
770 /* just needed to avoid bailing in the encoder check. the encoder in amdgpu_atombios_encoder_setup_dig_transmitter()
775 connector = amdgpu_get_connector_for_encoder(encoder); in amdgpu_atombios_encoder_setup_dig_transmitter()
780 amdgpu_connector->con_priv; in amdgpu_atombios_encoder_setup_dig_transmitter()
782 hpd_id = amdgpu_connector->hpd.hpd; in amdgpu_atombios_encoder_setup_dig_transmitter()
783 dp_clock = dig_connector->dp_clock; in amdgpu_atombios_encoder_setup_dig_transmitter()
784 dp_lane_count = dig_connector->dp_lane_count; in amdgpu_atombios_encoder_setup_dig_transmitter()
786 (amdgpu_connector->connector_object_id & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; in amdgpu_atombios_encoder_setup_dig_transmitter()
789 if (encoder->crtc) { in amdgpu_atombios_encoder_setup_dig_transmitter()
790 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(encoder->crtc); in amdgpu_atombios_encoder_setup_dig_transmitter()
791 pll_id = amdgpu_crtc->pll_id; in amdgpu_atombios_encoder_setup_dig_transmitter()
794 /* no dig encoder assigned */ in amdgpu_atombios_encoder_setup_dig_transmitter()
795 if (dig_encoder == -1) in amdgpu_atombios_encoder_setup_dig_transmitter()
798 if (ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(encoder))) in amdgpu_atombios_encoder_setup_dig_transmitter()
803 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_setup_dig_transmitter()
818 if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev)) in amdgpu_atombios_encoder_setup_dig_transmitter()
834 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
835 args.v1.usPixelClock = cpu_to_le16((amdgpu_encoder->pixel_clock / 2) / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
837 args.v1.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
847 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
854 else if (amdgpu_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { in amdgpu_atombios_encoder_setup_dig_transmitter()
855 if (dig->coherent_mode) in amdgpu_atombios_encoder_setup_dig_transmitter()
857 if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
871 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
872 args.v2.usPixelClock = cpu_to_le16((amdgpu_encoder->pixel_clock / 2) / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
874 args.v2.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
878 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
881 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_setup_dig_transmitter()
896 } else if (amdgpu_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { in amdgpu_atombios_encoder_setup_dig_transmitter()
897 if (dig->coherent_mode) in amdgpu_atombios_encoder_setup_dig_transmitter()
899 if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
913 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
914 args.v3.usPixelClock = cpu_to_le16((amdgpu_encoder->pixel_clock / 2) / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
916 args.v3.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
921 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
926 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
936 if (is_dp && adev->clock.dp_extclk) in amdgpu_atombios_encoder_setup_dig_transmitter()
941 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_setup_dig_transmitter()
955 else if (amdgpu_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { in amdgpu_atombios_encoder_setup_dig_transmitter()
956 if (dig->coherent_mode) in amdgpu_atombios_encoder_setup_dig_transmitter()
958 if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
972 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
973 args.v4.usPixelClock = cpu_to_le16((amdgpu_encoder->pixel_clock / 2) / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
975 args.v4.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
980 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
985 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
996 if (adev->clock.dp_extclk) in amdgpu_atombios_encoder_setup_dig_transmitter()
1003 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_setup_dig_transmitter()
1017 else if (amdgpu_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { in amdgpu_atombios_encoder_setup_dig_transmitter()
1018 if (dig->coherent_mode) in amdgpu_atombios_encoder_setup_dig_transmitter()
1020 if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
1029 args.v5.usSymClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
1031 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_setup_dig_transmitter()
1033 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
1039 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
1045 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
1056 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
1061 args.v5.ucDigMode = amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_setup_dig_transmitter()
1063 if (is_dp && adev->clock.dp_extclk) in amdgpu_atombios_encoder_setup_dig_transmitter()
1070 else if (amdgpu_encoder->devices & (ATOM_DEVICE_DFP_SUPPORT)) { in amdgpu_atombios_encoder_setup_dig_transmitter()
1071 if (dig->coherent_mode) in amdgpu_atombios_encoder_setup_dig_transmitter()
1086 args.v6.ulSymClock = cpu_to_le32(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_dig_transmitter()
1088 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_setup_dig_transmitter()
1090 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
1096 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
1102 if (dig->linkb) in amdgpu_atombios_encoder_setup_dig_transmitter()
1113 else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_dig_transmitter()
1121 args.v6.ucDigMode = amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_setup_dig_transmitter()
1139 amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in amdgpu_atombios_encoder_setup_dig_transmitter()
1147 struct drm_device *dev = amdgpu_connector->base.dev; in amdgpu_atombios_encoder_set_edp_panel_power()
1153 if (connector->connector_type != DRM_MODE_CONNECTOR_eDP) in amdgpu_atombios_encoder_set_edp_panel_power()
1160 if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev)) in amdgpu_atombios_encoder_set_edp_panel_power()
1167 amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in amdgpu_atombios_encoder_set_edp_panel_power()
1174 if (amdgpu_display_hpd_sense(adev, amdgpu_connector->hpd.hpd)) in amdgpu_atombios_encoder_set_edp_panel_power()
1190 amdgpu_atombios_encoder_setup_external_encoder(struct drm_encoder *encoder, in amdgpu_atombios_encoder_setup_external_encoder() argument
1194 struct drm_device *dev = encoder->dev; in amdgpu_atombios_encoder_setup_external_encoder()
1196 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_setup_external_encoder()
1205 u32 ext_enum = (ext_amdgpu_encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT; in amdgpu_atombios_encoder_setup_external_encoder()
1208 connector = amdgpu_get_connector_for_encoder_init(encoder); in amdgpu_atombios_encoder_setup_external_encoder()
1210 connector = amdgpu_get_connector_for_encoder(encoder); in amdgpu_atombios_encoder_setup_external_encoder()
1215 amdgpu_connector->con_priv; in amdgpu_atombios_encoder_setup_external_encoder()
1217 dp_clock = dig_connector->dp_clock; in amdgpu_atombios_encoder_setup_external_encoder()
1218 dp_lane_count = dig_connector->dp_lane_count; in amdgpu_atombios_encoder_setup_external_encoder()
1220 (amdgpu_connector->connector_object_id & OBJECT_ID_MASK) >> OBJECT_ID_SHIFT; in amdgpu_atombios_encoder_setup_external_encoder()
1225 if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev)) in amdgpu_atombios_encoder_setup_external_encoder()
1237 args.v1.sDigEncoder.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_external_encoder()
1239 amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_setup_external_encoder()
1245 } else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_external_encoder()
1255 args.v3.sExtEncoder.usPixelClock = cpu_to_le16(amdgpu_encoder->pixel_clock / 10); in amdgpu_atombios_encoder_setup_external_encoder()
1257 amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_setup_external_encoder()
1265 } else if (amdgpu_dig_monitor_is_duallink(encoder, amdgpu_encoder->pixel_clock)) in amdgpu_atombios_encoder_setup_external_encoder()
1280 args.v3.sExtEncoder.ucBitPerColor = amdgpu_atombios_encoder_get_bpc(encoder); in amdgpu_atombios_encoder_setup_external_encoder()
1291 amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in amdgpu_atombios_encoder_setup_external_encoder()
1295 amdgpu_atombios_encoder_setup_dig(struct drm_encoder *encoder, int action) in amdgpu_atombios_encoder_setup_dig() argument
1297 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_setup_dig()
1298 struct drm_encoder *ext_encoder = amdgpu_get_external_encoder(encoder); in amdgpu_atombios_encoder_setup_dig()
1299 struct amdgpu_encoder_atom_dig *dig = amdgpu_encoder->enc_priv; in amdgpu_atombios_encoder_setup_dig()
1300 struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder); in amdgpu_atombios_encoder_setup_dig()
1306 amdgpu_dig_connector = amdgpu_connector->con_priv; in amdgpu_atombios_encoder_setup_dig()
1311 dig->panel_mode = DP_PANEL_MODE_EXTERNAL_DP_MODE; in amdgpu_atombios_encoder_setup_dig()
1313 dig->panel_mode = amdgpu_atombios_dp_get_panel_mode(encoder, connector); in amdgpu_atombios_encoder_setup_dig()
1315 /* setup and enable the encoder */ in amdgpu_atombios_encoder_setup_dig()
1316 amdgpu_atombios_encoder_setup_dig_encoder(encoder, ATOM_ENCODER_CMD_SETUP, 0); in amdgpu_atombios_encoder_setup_dig()
1317 amdgpu_atombios_encoder_setup_dig_encoder(encoder, in amdgpu_atombios_encoder_setup_dig()
1319 dig->panel_mode); in amdgpu_atombios_encoder_setup_dig()
1321 amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, in amdgpu_atombios_encoder_setup_dig()
1323 if (ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(encoder)) && in amdgpu_atombios_encoder_setup_dig()
1325 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { in amdgpu_atombios_encoder_setup_dig()
1328 amdgpu_dig_connector->edp_on = true; in amdgpu_atombios_encoder_setup_dig()
1332 amdgpu_atombios_encoder_setup_dig_transmitter(encoder, in amdgpu_atombios_encoder_setup_dig()
1335 if (ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(encoder)) && in amdgpu_atombios_encoder_setup_dig()
1338 amdgpu_atombios_dp_link_train(encoder, connector); in amdgpu_atombios_encoder_setup_dig()
1339 amdgpu_atombios_encoder_setup_dig_encoder(encoder, ATOM_ENCODER_CMD_DP_VIDEO_ON, 0); in amdgpu_atombios_encoder_setup_dig()
1341 if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) in amdgpu_atombios_encoder_setup_dig()
1342 amdgpu_atombios_encoder_set_backlight_level(amdgpu_encoder, dig->backlight_level); in amdgpu_atombios_encoder_setup_dig()
1344 amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, ATOM_ENABLE); in amdgpu_atombios_encoder_setup_dig()
1346 if (ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(encoder)) && in amdgpu_atombios_encoder_setup_dig()
1348 amdgpu_atombios_encoder_setup_dig_encoder(encoder, in amdgpu_atombios_encoder_setup_dig()
1351 amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, ATOM_DISABLE); in amdgpu_atombios_encoder_setup_dig()
1352 if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) in amdgpu_atombios_encoder_setup_dig()
1353 amdgpu_atombios_encoder_setup_dig_transmitter(encoder, in amdgpu_atombios_encoder_setup_dig()
1356 if (ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(encoder)) && in amdgpu_atombios_encoder_setup_dig()
1360 amdgpu_atombios_encoder_setup_dig_transmitter(encoder, in amdgpu_atombios_encoder_setup_dig()
1362 if (ENCODER_MODE_IS_DP(amdgpu_atombios_encoder_get_encoder_mode(encoder)) && in amdgpu_atombios_encoder_setup_dig()
1364 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { in amdgpu_atombios_encoder_setup_dig()
1367 amdgpu_dig_connector->edp_on = false; in amdgpu_atombios_encoder_setup_dig()
1374 amdgpu_atombios_encoder_dpms(struct drm_encoder *encoder, int mode) in amdgpu_atombios_encoder_dpms() argument
1376 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_dpms()
1378 DRM_DEBUG_KMS("encoder dpms %d to mode %d, devices %08x, active_devices %08x\n", in amdgpu_atombios_encoder_dpms()
1379 amdgpu_encoder->encoder_id, mode, amdgpu_encoder->devices, in amdgpu_atombios_encoder_dpms()
1380 amdgpu_encoder->active_device); in amdgpu_atombios_encoder_dpms()
1381 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_dpms()
1388 amdgpu_atombios_encoder_setup_dig(encoder, ATOM_ENABLE); in amdgpu_atombios_encoder_dpms()
1393 amdgpu_atombios_encoder_setup_dig(encoder, ATOM_DISABLE); in amdgpu_atombios_encoder_dpms()
1400 amdgpu_atombios_encoder_setup_dvo(encoder, ATOM_ENABLE); in amdgpu_atombios_encoder_dpms()
1405 amdgpu_atombios_encoder_setup_dvo(encoder, ATOM_DISABLE); in amdgpu_atombios_encoder_dpms()
1412 amdgpu_atombios_encoder_setup_dac(encoder, ATOM_ENABLE); in amdgpu_atombios_encoder_dpms()
1417 amdgpu_atombios_encoder_setup_dac(encoder, ATOM_DISABLE); in amdgpu_atombios_encoder_dpms()
1433 amdgpu_atombios_encoder_set_crtc_source(struct drm_encoder *encoder) in amdgpu_atombios_encoder_set_crtc_source() argument
1435 struct drm_device *dev = encoder->dev; in amdgpu_atombios_encoder_set_crtc_source()
1437 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_set_crtc_source()
1438 struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(encoder->crtc); in amdgpu_atombios_encoder_set_crtc_source()
1446 if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev)) in amdgpu_atombios_encoder_set_crtc_source()
1454 args.v1.ucCRTC = amdgpu_crtc->crtc_id; in amdgpu_atombios_encoder_set_crtc_source()
1455 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_set_crtc_source()
1462 if (amdgpu_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) in amdgpu_atombios_encoder_set_crtc_source()
1474 if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1476 else if (amdgpu_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1483 if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1485 else if (amdgpu_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1493 args.v2.ucCRTC = amdgpu_crtc->crtc_id; in amdgpu_atombios_encoder_set_crtc_source()
1494 if (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE) { in amdgpu_atombios_encoder_set_crtc_source()
1495 struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder); in amdgpu_atombios_encoder_set_crtc_source()
1497 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) in amdgpu_atombios_encoder_set_crtc_source()
1499 else if (connector->connector_type == DRM_MODE_CONNECTOR_VGA) in amdgpu_atombios_encoder_set_crtc_source()
1502 args.v2.ucEncodeMode = amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_set_crtc_source()
1503 } else if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { in amdgpu_atombios_encoder_set_crtc_source()
1506 args.v2.ucEncodeMode = amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_set_crtc_source()
1508 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_set_crtc_source()
1514 dig = amdgpu_encoder->enc_priv; in amdgpu_atombios_encoder_set_crtc_source()
1515 switch (dig->dig_encoder) { in amdgpu_atombios_encoder_set_crtc_source()
1543 if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1545 else if (amdgpu_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1551 if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1553 else if (amdgpu_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1561 args.v3.ucCRTC = amdgpu_crtc->crtc_id; in amdgpu_atombios_encoder_set_crtc_source()
1562 if (amdgpu_encoder_get_dp_bridge_encoder_id(encoder) != ENCODER_OBJECT_ID_NONE) { in amdgpu_atombios_encoder_set_crtc_source()
1563 struct drm_connector *connector = amdgpu_get_connector_for_encoder(encoder); in amdgpu_atombios_encoder_set_crtc_source()
1565 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) in amdgpu_atombios_encoder_set_crtc_source()
1567 else if (connector->connector_type == DRM_MODE_CONNECTOR_VGA) in amdgpu_atombios_encoder_set_crtc_source()
1570 args.v2.ucEncodeMode = amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_set_crtc_source()
1571 } else if (amdgpu_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)) { in amdgpu_atombios_encoder_set_crtc_source()
1574 args.v2.ucEncodeMode = amdgpu_atombios_encoder_get_encoder_mode(encoder); in amdgpu_atombios_encoder_set_crtc_source()
1576 args.v3.ucDstBpc = amdgpu_atombios_encoder_get_bpc(encoder); in amdgpu_atombios_encoder_set_crtc_source()
1577 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_set_crtc_source()
1583 dig = amdgpu_encoder->enc_priv; in amdgpu_atombios_encoder_set_crtc_source()
1584 switch (dig->dig_encoder) { in amdgpu_atombios_encoder_set_crtc_source()
1612 if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1614 else if (amdgpu_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1620 if (amdgpu_encoder->active_device & (ATOM_DEVICE_TV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1622 else if (amdgpu_encoder->active_device & (ATOM_DEVICE_CV_SUPPORT)) in amdgpu_atombios_encoder_set_crtc_source()
1636 amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in amdgpu_atombios_encoder_set_crtc_source()
1644 struct drm_encoder *encoder; in amdgpu_atombios_encoder_init_dig() local
1646 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) { in amdgpu_atombios_encoder_init_dig()
1647 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_init_dig()
1648 struct drm_encoder *ext_encoder = amdgpu_get_external_encoder(encoder); in amdgpu_atombios_encoder_init_dig()
1650 switch (amdgpu_encoder->encoder_id) { in amdgpu_atombios_encoder_init_dig()
1655 amdgpu_atombios_encoder_setup_dig_transmitter(encoder, ATOM_TRANSMITTER_ACTION_INIT, in amdgpu_atombios_encoder_init_dig()
1661 amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, in amdgpu_atombios_encoder_init_dig()
1667 amdgpu_atombios_encoder_dac_load_detect(struct drm_encoder *encoder, in amdgpu_atombios_encoder_dac_load_detect() argument
1670 struct drm_device *dev = encoder->dev; in amdgpu_atombios_encoder_dac_load_detect()
1672 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_dac_load_detect()
1675 if (amdgpu_encoder->devices & (ATOM_DEVICE_TV_SUPPORT | in amdgpu_atombios_encoder_dac_load_detect()
1684 if (!amdgpu_atom_parse_cmd_header(adev->mode_info.atom_context, index, &frev, &crev)) in amdgpu_atombios_encoder_dac_load_detect()
1689 if ((amdgpu_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_DAC1) || in amdgpu_atombios_encoder_dac_load_detect()
1690 (amdgpu_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DAC1)) in amdgpu_atombios_encoder_dac_load_detect()
1695 if (amdgpu_connector->devices & ATOM_DEVICE_CRT1_SUPPORT) in amdgpu_atombios_encoder_dac_load_detect()
1697 else if (amdgpu_connector->devices & ATOM_DEVICE_CRT2_SUPPORT) in amdgpu_atombios_encoder_dac_load_detect()
1699 else if (amdgpu_connector->devices & ATOM_DEVICE_CV_SUPPORT) { in amdgpu_atombios_encoder_dac_load_detect()
1703 } else if (amdgpu_connector->devices & ATOM_DEVICE_TV1_SUPPORT) { in amdgpu_atombios_encoder_dac_load_detect()
1709 amdgpu_atom_execute_table(adev->mode_info.atom_context, index, (uint32_t *)&args, sizeof(args)); in amdgpu_atombios_encoder_dac_load_detect()
1717 amdgpu_atombios_encoder_dac_detect(struct drm_encoder *encoder, in amdgpu_atombios_encoder_dac_detect() argument
1720 struct drm_device *dev = encoder->dev; in amdgpu_atombios_encoder_dac_detect()
1722 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_dac_detect()
1726 if (!amdgpu_atombios_encoder_dac_load_detect(encoder, connector)) { in amdgpu_atombios_encoder_dac_detect()
1733 DRM_DEBUG_KMS("Bios 0 scratch %x %08x\n", bios_0_scratch, amdgpu_encoder->devices); in amdgpu_atombios_encoder_dac_detect()
1734 if (amdgpu_connector->devices & ATOM_DEVICE_CRT1_SUPPORT) { in amdgpu_atombios_encoder_dac_detect()
1738 if (amdgpu_connector->devices & ATOM_DEVICE_CRT2_SUPPORT) { in amdgpu_atombios_encoder_dac_detect()
1742 if (amdgpu_connector->devices & ATOM_DEVICE_CV_SUPPORT) { in amdgpu_atombios_encoder_dac_detect()
1746 if (amdgpu_connector->devices & ATOM_DEVICE_TV1_SUPPORT) { in amdgpu_atombios_encoder_dac_detect()
1756 amdgpu_atombios_encoder_dig_detect(struct drm_encoder *encoder, in amdgpu_atombios_encoder_dig_detect() argument
1759 struct drm_device *dev = encoder->dev; in amdgpu_atombios_encoder_dig_detect()
1761 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_dig_detect()
1763 struct drm_encoder *ext_encoder = amdgpu_get_external_encoder(encoder); in amdgpu_atombios_encoder_dig_detect()
1769 if ((amdgpu_connector->devices & ATOM_DEVICE_CRT_SUPPORT) == 0) in amdgpu_atombios_encoder_dig_detect()
1773 amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, in amdgpu_atombios_encoder_dig_detect()
1778 DRM_DEBUG_KMS("Bios 0 scratch %x %08x\n", bios_0_scratch, amdgpu_encoder->devices); in amdgpu_atombios_encoder_dig_detect()
1779 if (amdgpu_connector->devices & ATOM_DEVICE_CRT1_SUPPORT) { in amdgpu_atombios_encoder_dig_detect()
1783 if (amdgpu_connector->devices & ATOM_DEVICE_CRT2_SUPPORT) { in amdgpu_atombios_encoder_dig_detect()
1787 if (amdgpu_connector->devices & ATOM_DEVICE_CV_SUPPORT) { in amdgpu_atombios_encoder_dig_detect()
1791 if (amdgpu_connector->devices & ATOM_DEVICE_TV1_SUPPORT) { in amdgpu_atombios_encoder_dig_detect()
1801 amdgpu_atombios_encoder_setup_ext_encoder_ddc(struct drm_encoder *encoder) in amdgpu_atombios_encoder_setup_ext_encoder_ddc() argument
1803 struct drm_encoder *ext_encoder = amdgpu_get_external_encoder(encoder); in amdgpu_atombios_encoder_setup_ext_encoder_ddc()
1807 amdgpu_atombios_encoder_setup_external_encoder(encoder, ext_encoder, in amdgpu_atombios_encoder_setup_ext_encoder_ddc()
1814 struct drm_encoder *encoder, in amdgpu_atombios_encoder_set_bios_scratch_regs() argument
1817 struct drm_device *dev = connector->dev; in amdgpu_atombios_encoder_set_bios_scratch_regs()
1821 struct amdgpu_encoder *amdgpu_encoder = to_amdgpu_encoder(encoder); in amdgpu_atombios_encoder_set_bios_scratch_regs()
1828 if ((amdgpu_encoder->devices & ATOM_DEVICE_LCD1_SUPPORT) && in amdgpu_atombios_encoder_set_bios_scratch_regs()
1829 (amdgpu_connector->devices & ATOM_DEVICE_LCD1_SUPPORT)) { in amdgpu_atombios_encoder_set_bios_scratch_regs()
1842 if ((amdgpu_encoder->devices & ATOM_DEVICE_CRT1_SUPPORT) && in amdgpu_atombios_encoder_set_bios_scratch_regs()
1843 (amdgpu_connector->devices & ATOM_DEVICE_CRT1_SUPPORT)) { in amdgpu_atombios_encoder_set_bios_scratch_regs()
1856 if ((amdgpu_encoder->devices & ATOM_DEVICE_CRT2_SUPPORT) && in amdgpu_atombios_encoder_set_bios_scratch_regs()
1857 (amdgpu_connector->devices & ATOM_DEVICE_CRT2_SUPPORT)) { in amdgpu_atombios_encoder_set_bios_scratch_regs()
1870 if ((amdgpu_encoder->devices & ATOM_DEVICE_DFP1_SUPPORT) && in amdgpu_atombios_encoder_set_bios_scratch_regs()
1871 (amdgpu_connector->devices & ATOM_DEVICE_DFP1_SUPPORT)) { in amdgpu_atombios_encoder_set_bios_scratch_regs()
1884 if ((amdgpu_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT) && in amdgpu_atombios_encoder_set_bios_scratch_regs()
1885 (amdgpu_connector->devices & ATOM_DEVICE_DFP2_SUPPORT)) { in amdgpu_atombios_encoder_set_bios_scratch_regs()
1898 if ((amdgpu_encoder->devices & ATOM_DEVICE_DFP3_SUPPORT) && in amdgpu_atombios_encoder_set_bios_scratch_regs()
1899 (amdgpu_connector->devices & ATOM_DEVICE_DFP3_SUPPORT)) { in amdgpu_atombios_encoder_set_bios_scratch_regs()
1912 if ((amdgpu_encoder->devices & ATOM_DEVICE_DFP4_SUPPORT) && in amdgpu_atombios_encoder_set_bios_scratch_regs()
1913 (amdgpu_connector->devices & ATOM_DEVICE_DFP4_SUPPORT)) { in amdgpu_atombios_encoder_set_bios_scratch_regs()
1926 if ((amdgpu_encoder->devices & ATOM_DEVICE_DFP5_SUPPORT) && in amdgpu_atombios_encoder_set_bios_scratch_regs()
1927 (amdgpu_connector->devices & ATOM_DEVICE_DFP5_SUPPORT)) { in amdgpu_atombios_encoder_set_bios_scratch_regs()
1940 if ((amdgpu_encoder->devices & ATOM_DEVICE_DFP6_SUPPORT) && in amdgpu_atombios_encoder_set_bios_scratch_regs()
1941 (amdgpu_connector->devices & ATOM_DEVICE_DFP6_SUPPORT)) { in amdgpu_atombios_encoder_set_bios_scratch_regs()
1966 amdgpu_atombios_encoder_get_lcd_info(struct amdgpu_encoder *encoder) in amdgpu_atombios_encoder_get_lcd_info() argument
1968 struct drm_device *dev = encoder->base.dev; in amdgpu_atombios_encoder_get_lcd_info()
1970 struct amdgpu_mode_info *mode_info = &adev->mode_info; in amdgpu_atombios_encoder_get_lcd_info()
1975 struct amdgpu_encoder_atom_dig *lvds = NULL; in amdgpu_atombios_encoder_get_lcd_info() local
1976 int encoder_enum = (encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT; in amdgpu_atombios_encoder_get_lcd_info()
1978 if (amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL, in amdgpu_atombios_encoder_get_lcd_info()
1981 (union lvds_info *)(mode_info->atom_context->bios + data_offset); in amdgpu_atombios_encoder_get_lcd_info()
1982 lvds = in amdgpu_atombios_encoder_get_lcd_info()
1985 if (!lvds) in amdgpu_atombios_encoder_get_lcd_info()
1988 lvds->native_mode.clock = in amdgpu_atombios_encoder_get_lcd_info()
1989 le16_to_cpu(lvds_info->info.sLCDTiming.usPixClk) * 10; in amdgpu_atombios_encoder_get_lcd_info()
1990 lvds->native_mode.hdisplay = in amdgpu_atombios_encoder_get_lcd_info()
1991 le16_to_cpu(lvds_info->info.sLCDTiming.usHActive); in amdgpu_atombios_encoder_get_lcd_info()
1992 lvds->native_mode.vdisplay = in amdgpu_atombios_encoder_get_lcd_info()
1993 le16_to_cpu(lvds_info->info.sLCDTiming.usVActive); in amdgpu_atombios_encoder_get_lcd_info()
1994 lvds->native_mode.htotal = lvds->native_mode.hdisplay + in amdgpu_atombios_encoder_get_lcd_info()
1995 le16_to_cpu(lvds_info->info.sLCDTiming.usHBlanking_Time); in amdgpu_atombios_encoder_get_lcd_info()
1996 lvds->native_mode.hsync_start = lvds->native_mode.hdisplay + in amdgpu_atombios_encoder_get_lcd_info()
1997 le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncOffset); in amdgpu_atombios_encoder_get_lcd_info()
1998 lvds->native_mode.hsync_end = lvds->native_mode.hsync_start + in amdgpu_atombios_encoder_get_lcd_info()
1999 le16_to_cpu(lvds_info->info.sLCDTiming.usHSyncWidth); in amdgpu_atombios_encoder_get_lcd_info()
2000 lvds->native_mode.vtotal = lvds->native_mode.vdisplay + in amdgpu_atombios_encoder_get_lcd_info()
2001 le16_to_cpu(lvds_info->info.sLCDTiming.usVBlanking_Time); in amdgpu_atombios_encoder_get_lcd_info()
2002 lvds->native_mode.vsync_start = lvds->native_mode.vdisplay + in amdgpu_atombios_encoder_get_lcd_info()
2003 le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncOffset); in amdgpu_atombios_encoder_get_lcd_info()
2004 lvds->native_mode.vsync_end = lvds->native_mode.vsync_start + in amdgpu_atombios_encoder_get_lcd_info()
2005 le16_to_cpu(lvds_info->info.sLCDTiming.usVSyncWidth); in amdgpu_atombios_encoder_get_lcd_info()
2006 lvds->panel_pwr_delay = in amdgpu_atombios_encoder_get_lcd_info()
2007 le16_to_cpu(lvds_info->info.usOffDelayInMs); in amdgpu_atombios_encoder_get_lcd_info()
2008 lvds->lcd_misc = lvds_info->info.ucLVDS_Misc; in amdgpu_atombios_encoder_get_lcd_info()
2010 misc = le16_to_cpu(lvds_info->info.sLCDTiming.susModeMiscInfo.usAccess); in amdgpu_atombios_encoder_get_lcd_info()
2012 lvds->native_mode.flags |= DRM_MODE_FLAG_NVSYNC; in amdgpu_atombios_encoder_get_lcd_info()
2014 lvds->native_mode.flags |= DRM_MODE_FLAG_NHSYNC; in amdgpu_atombios_encoder_get_lcd_info()
2016 lvds->native_mode.flags |= DRM_MODE_FLAG_CSYNC; in amdgpu_atombios_encoder_get_lcd_info()
2018 lvds->native_mode.flags |= DRM_MODE_FLAG_INTERLACE; in amdgpu_atombios_encoder_get_lcd_info()
2020 lvds->native_mode.flags |= DRM_MODE_FLAG_DBLSCAN; in amdgpu_atombios_encoder_get_lcd_info()
2022 lvds->native_mode.width_mm = le16_to_cpu(lvds_info->info.sLCDTiming.usImageHSize); in amdgpu_atombios_encoder_get_lcd_info()
2023 lvds->native_mode.height_mm = le16_to_cpu(lvds_info->info.sLCDTiming.usImageVSize); in amdgpu_atombios_encoder_get_lcd_info()
2026 drm_mode_set_crtcinfo(&lvds->native_mode, CRTC_INTERLACE_HALVE_V); in amdgpu_atombios_encoder_get_lcd_info()
2028 lvds->lcd_ss_id = lvds_info->info.ucSS_Id; in amdgpu_atombios_encoder_get_lcd_info()
2030 encoder->native_mode = lvds->native_mode; in amdgpu_atombios_encoder_get_lcd_info()
2033 lvds->linkb = true; in amdgpu_atombios_encoder_get_lcd_info()
2035 lvds->linkb = false; in amdgpu_atombios_encoder_get_lcd_info()
2038 if (le16_to_cpu(lvds_info->info.usModePatchTableOffset)) { in amdgpu_atombios_encoder_get_lcd_info()
2046 record = (u8 *)(mode_info->atom_context->bios + in amdgpu_atombios_encoder_get_lcd_info()
2047 le16_to_cpu(lvds_info->info.usModePatchTableOffset)); in amdgpu_atombios_encoder_get_lcd_info()
2050 record = (u8 *)(mode_info->atom_context->bios + in amdgpu_atombios_encoder_get_lcd_info()
2052 le16_to_cpu(lvds_info->info.usModePatchTableOffset)); in amdgpu_atombios_encoder_get_lcd_info()
2066 if (fake_edid_record->ucFakeEDIDLength) { in amdgpu_atombios_encoder_get_lcd_info()
2070 if (fake_edid_record->ucFakeEDIDLength == 128) in amdgpu_atombios_encoder_get_lcd_info()
2071 edid_size = fake_edid_record->ucFakeEDIDLength; in amdgpu_atombios_encoder_get_lcd_info()
2073 edid_size = fake_edid_record->ucFakeEDIDLength * 128; in amdgpu_atombios_encoder_get_lcd_info()
2074 edid = drm_edid_alloc(fake_edid_record->ucFakeEDIDString, edid_size); in amdgpu_atombios_encoder_get_lcd_info()
2076 adev->mode_info.bios_hardcoded_edid = edid; in amdgpu_atombios_encoder_get_lcd_info()
2089 lvds->native_mode.width_mm = panel_res_record->usHSize; in amdgpu_atombios_encoder_get_lcd_info()
2090 lvds->native_mode.height_mm = panel_res_record->usVSize; in amdgpu_atombios_encoder_get_lcd_info()
2103 return lvds; in amdgpu_atombios_encoder_get_lcd_info()
2109 int encoder_enum = (amdgpu_encoder->encoder_enum & ENUM_ID_MASK) >> ENUM_ID_SHIFT; in amdgpu_atombios_encoder_get_dig_info()
2116 dig->coherent_mode = true; in amdgpu_atombios_encoder_get_dig_info()
2117 dig->dig_encoder = -1; in amdgpu_atombios_encoder_get_dig_info()
2120 dig->linkb = true; in amdgpu_atombios_encoder_get_dig_info()
2122 dig->linkb = false; in amdgpu_atombios_encoder_get_dig_info()