2009-06-05 19:42:42 +07:00
|
|
|
/*
|
|
|
|
* Copyright 2007-8 Advanced Micro Devices, Inc.
|
|
|
|
* Copyright 2008 Red Hat Inc.
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
|
|
|
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
|
|
|
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Authors: Dave Airlie
|
|
|
|
* Alex Deucher
|
|
|
|
*/
|
2019-06-08 15:02:40 +07:00
|
|
|
|
2019-12-03 17:04:02 +07:00
|
|
|
#include <linux/pci.h>
|
|
|
|
|
2012-10-03 00:01:07 +07:00
|
|
|
#include <drm/drm_crtc_helper.h>
|
2019-06-08 15:02:40 +07:00
|
|
|
#include <drm/drm_device.h>
|
2012-10-03 00:01:07 +07:00
|
|
|
#include <drm/radeon_drm.h>
|
2019-06-08 15:02:40 +07:00
|
|
|
|
2009-06-05 19:42:42 +07:00
|
|
|
#include "radeon.h"
|
|
|
|
#include "atom.h"
|
|
|
|
|
2012-07-26 22:32:03 +07:00
|
|
|
extern void
|
|
|
|
radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
|
|
|
|
struct drm_connector *drm_connector);
|
|
|
|
extern void
|
|
|
|
radeon_atom_backlight_init(struct radeon_encoder *radeon_encoder,
|
|
|
|
struct drm_connector *drm_connector);
|
|
|
|
|
|
|
|
|
2009-10-13 11:10:37 +07:00
|
|
|
static uint32_t radeon_encoder_clones(struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = encoder->dev;
|
|
|
|
struct radeon_device *rdev = dev->dev_private;
|
|
|
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
|
|
|
struct drm_encoder *clone_encoder;
|
|
|
|
uint32_t index_mask = 0;
|
|
|
|
int count;
|
|
|
|
|
|
|
|
/* DIG routing gets problematic */
|
|
|
|
if (rdev->family >= CHIP_R600)
|
|
|
|
return index_mask;
|
|
|
|
/* LVDS/TV are too wacky */
|
|
|
|
if (radeon_encoder->devices & ATOM_DEVICE_LCD_SUPPORT)
|
|
|
|
return index_mask;
|
|
|
|
/* DVO requires 2x ppll clocks depending on tmds chip */
|
|
|
|
if (radeon_encoder->devices & ATOM_DEVICE_DFP2_SUPPORT)
|
|
|
|
return index_mask;
|
2010-01-13 05:54:34 +07:00
|
|
|
|
2009-10-13 11:10:37 +07:00
|
|
|
count = -1;
|
|
|
|
list_for_each_entry(clone_encoder, &dev->mode_config.encoder_list, head) {
|
|
|
|
struct radeon_encoder *radeon_clone = to_radeon_encoder(clone_encoder);
|
|
|
|
count++;
|
|
|
|
|
|
|
|
if (clone_encoder == encoder)
|
|
|
|
continue;
|
|
|
|
if (radeon_clone->devices & (ATOM_DEVICE_LCD_SUPPORT))
|
|
|
|
continue;
|
|
|
|
if (radeon_clone->devices & ATOM_DEVICE_DFP2_SUPPORT)
|
|
|
|
continue;
|
|
|
|
else
|
|
|
|
index_mask |= (1 << count);
|
|
|
|
}
|
|
|
|
return index_mask;
|
|
|
|
}
|
|
|
|
|
|
|
|
void radeon_setup_encoder_clones(struct drm_device *dev)
|
|
|
|
{
|
|
|
|
struct drm_encoder *encoder;
|
|
|
|
|
|
|
|
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
|
|
|
encoder->possible_clones = radeon_encoder_clones(encoder);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-05 19:42:42 +07:00
|
|
|
uint32_t
|
2010-08-13 05:58:47 +07:00
|
|
|
radeon_get_encoder_enum(struct drm_device *dev, uint32_t supported_device, uint8_t dac)
|
2009-06-05 19:42:42 +07:00
|
|
|
{
|
|
|
|
struct radeon_device *rdev = dev->dev_private;
|
|
|
|
uint32_t ret = 0;
|
|
|
|
|
|
|
|
switch (supported_device) {
|
|
|
|
case ATOM_DEVICE_CRT1_SUPPORT:
|
|
|
|
case ATOM_DEVICE_TV1_SUPPORT:
|
|
|
|
case ATOM_DEVICE_TV2_SUPPORT:
|
|
|
|
case ATOM_DEVICE_CRT2_SUPPORT:
|
|
|
|
case ATOM_DEVICE_CV_SUPPORT:
|
|
|
|
switch (dac) {
|
|
|
|
case 1: /* dac a */
|
|
|
|
if ((rdev->family == CHIP_RS300) ||
|
|
|
|
(rdev->family == CHIP_RS400) ||
|
|
|
|
(rdev->family == CHIP_RS480))
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_DAC2_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else if (ASIC_IS_AVIVO(rdev))
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_KLDSCP_DAC1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_DAC1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
break;
|
|
|
|
case 2: /* dac b */
|
|
|
|
if (ASIC_IS_AVIVO(rdev))
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_KLDSCP_DAC2_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else {
|
|
|
|
/*if (rdev->family == CHIP_R200)
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_DVO1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else*/
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_DAC2_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 3: /* external dac */
|
|
|
|
if (ASIC_IS_AVIVO(rdev))
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_DVO1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ATOM_DEVICE_LCD1_SUPPORT:
|
|
|
|
if (ASIC_IS_AVIVO(rdev))
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_LVTM1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_LVDS_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
break;
|
|
|
|
case ATOM_DEVICE_DFP1_SUPPORT:
|
|
|
|
if ((rdev->family == CHIP_RS300) ||
|
|
|
|
(rdev->family == CHIP_RS400) ||
|
|
|
|
(rdev->family == CHIP_RS480))
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_DVO1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else if (ASIC_IS_AVIVO(rdev))
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_KLDSCP_TMDS1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_TMDS1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
break;
|
|
|
|
case ATOM_DEVICE_LCD2_SUPPORT:
|
|
|
|
case ATOM_DEVICE_DFP2_SUPPORT:
|
|
|
|
if ((rdev->family == CHIP_RS600) ||
|
|
|
|
(rdev->family == CHIP_RS690) ||
|
|
|
|
(rdev->family == CHIP_RS740))
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_DDI_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else if (ASIC_IS_AVIVO(rdev))
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_KLDSCP_DVO1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
else
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_DVO1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
break;
|
|
|
|
case ATOM_DEVICE_DFP3_SUPPORT:
|
2010-08-13 05:58:47 +07:00
|
|
|
ret = ENCODER_INTERNAL_LVTM1_ENUM_ID1;
|
2009-06-05 19:42:42 +07:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2014-09-17 07:57:26 +07:00
|
|
|
static void radeon_encoder_add_backlight(struct radeon_encoder *radeon_encoder,
|
|
|
|
struct drm_connector *connector)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = radeon_encoder->base.dev;
|
|
|
|
struct radeon_device *rdev = dev->dev_private;
|
|
|
|
bool use_bl = false;
|
|
|
|
|
|
|
|
if (!(radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT)))
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (radeon_backlight == 0) {
|
|
|
|
return;
|
|
|
|
} else if (radeon_backlight == 1) {
|
|
|
|
use_bl = true;
|
|
|
|
} else if (radeon_backlight == -1) {
|
2014-09-17 22:31:02 +07:00
|
|
|
/* Quirks */
|
|
|
|
/* Amilo Xi 2550 only works with acpi bl */
|
|
|
|
if ((rdev->pdev->device == 0x9583) &&
|
|
|
|
(rdev->pdev->subsystem_vendor == 0x1734) &&
|
|
|
|
(rdev->pdev->subsystem_device == 0x1107))
|
|
|
|
use_bl = false;
|
2015-02-18 08:01:19 +07:00
|
|
|
/* Older PPC macs use on-GPU backlight controller */
|
|
|
|
#ifndef CONFIG_PPC_PMAC
|
2014-11-20 01:12:54 +07:00
|
|
|
/* disable native backlight control on older asics */
|
|
|
|
else if (rdev->family < CHIP_R600)
|
|
|
|
use_bl = false;
|
2015-02-18 08:01:19 +07:00
|
|
|
#endif
|
2014-09-17 22:31:02 +07:00
|
|
|
else
|
|
|
|
use_bl = true;
|
2014-09-17 07:57:26 +07:00
|
|
|
}
|
|
|
|
|
|
|
|
if (use_bl) {
|
|
|
|
if (rdev->is_atom_bios)
|
|
|
|
radeon_atom_backlight_init(radeon_encoder, connector);
|
|
|
|
else
|
|
|
|
radeon_legacy_backlight_init(radeon_encoder, connector);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-06-05 19:42:42 +07:00
|
|
|
void
|
|
|
|
radeon_link_encoder_connector(struct drm_device *dev)
|
|
|
|
{
|
|
|
|
struct drm_connector *connector;
|
|
|
|
struct radeon_connector *radeon_connector;
|
|
|
|
struct drm_encoder *encoder;
|
|
|
|
struct radeon_encoder *radeon_encoder;
|
|
|
|
|
|
|
|
/* walk the list and link encoders to connectors */
|
|
|
|
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
|
|
|
|
radeon_connector = to_radeon_connector(connector);
|
|
|
|
list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
|
|
|
|
radeon_encoder = to_radeon_encoder(encoder);
|
2012-07-26 22:32:03 +07:00
|
|
|
if (radeon_encoder->devices & radeon_connector->devices) {
|
2018-07-09 15:40:07 +07:00
|
|
|
drm_connector_attach_encoder(connector, encoder);
|
2014-09-17 07:57:26 +07:00
|
|
|
if (radeon_encoder->devices & (ATOM_DEVICE_LCD_SUPPORT))
|
|
|
|
radeon_encoder_add_backlight(radeon_encoder, connector);
|
2012-07-26 22:32:03 +07:00
|
|
|
}
|
2009-06-05 19:42:42 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-08-13 13:32:14 +07:00
|
|
|
void radeon_encoder_set_active_device(struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = encoder->dev;
|
|
|
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
|
|
|
struct drm_connector *connector;
|
|
|
|
|
|
|
|
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
|
|
|
|
if (connector->encoder == encoder) {
|
|
|
|
struct radeon_connector *radeon_connector = to_radeon_connector(connector);
|
|
|
|
radeon_encoder->active_device = radeon_encoder->devices & radeon_connector->devices;
|
2010-08-02 07:42:55 +07:00
|
|
|
DRM_DEBUG_KMS("setting active device to %08x from %08x %08x for encoder %d\n",
|
2009-09-08 08:17:38 +07:00
|
|
|
radeon_encoder->active_device, radeon_encoder->devices,
|
|
|
|
radeon_connector->devices, encoder->encoder_type);
|
2009-08-13 13:32:14 +07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-04 06:59:20 +07:00
|
|
|
struct drm_connector *
|
2009-06-05 19:42:42 +07:00
|
|
|
radeon_get_connector_for_encoder(struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = encoder->dev;
|
|
|
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
|
|
|
struct drm_connector *connector;
|
|
|
|
struct radeon_connector *radeon_connector;
|
|
|
|
|
|
|
|
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
|
|
|
|
radeon_connector = to_radeon_connector(connector);
|
2015-02-24 06:24:04 +07:00
|
|
|
if (radeon_encoder->is_mst_encoder) {
|
|
|
|
struct radeon_encoder_mst *mst_enc;
|
|
|
|
|
|
|
|
if (!radeon_connector->is_mst_connector)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
mst_enc = radeon_encoder->enc_priv;
|
|
|
|
if (mst_enc->connector == radeon_connector->mst_port)
|
|
|
|
return connector;
|
|
|
|
} else if (radeon_encoder->active_device & radeon_connector->devices)
|
2009-06-05 19:42:42 +07:00
|
|
|
return connector;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2012-01-21 03:03:30 +07:00
|
|
|
struct drm_connector *
|
|
|
|
radeon_get_connector_for_encoder_init(struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
struct drm_device *dev = encoder->dev;
|
|
|
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
|
|
|
struct drm_connector *connector;
|
|
|
|
struct radeon_connector *radeon_connector;
|
|
|
|
|
|
|
|
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
|
|
|
|
radeon_connector = to_radeon_connector(connector);
|
|
|
|
if (radeon_encoder->devices & radeon_connector->devices)
|
|
|
|
return connector;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-10-31 04:20:22 +07:00
|
|
|
struct drm_encoder *radeon_get_external_encoder(struct drm_encoder *encoder)
|
2010-11-17 00:09:42 +07:00
|
|
|
{
|
|
|
|
struct drm_device *dev = encoder->dev;
|
|
|
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
|
|
|
struct drm_encoder *other_encoder;
|
|
|
|
struct radeon_encoder *other_radeon_encoder;
|
|
|
|
|
|
|
|
if (radeon_encoder->is_ext_encoder)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
list_for_each_entry(other_encoder, &dev->mode_config.encoder_list, head) {
|
|
|
|
if (other_encoder == encoder)
|
|
|
|
continue;
|
|
|
|
other_radeon_encoder = to_radeon_encoder(other_encoder);
|
|
|
|
if (other_radeon_encoder->is_ext_encoder &&
|
|
|
|
(radeon_encoder->devices & other_radeon_encoder->devices))
|
|
|
|
return other_encoder;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-10-31 19:58:47 +07:00
|
|
|
u16 radeon_encoder_get_dp_bridge_encoder_id(struct drm_encoder *encoder)
|
2011-05-20 15:34:21 +07:00
|
|
|
{
|
2011-10-31 04:20:22 +07:00
|
|
|
struct drm_encoder *other_encoder = radeon_get_external_encoder(encoder);
|
2011-05-20 15:34:21 +07:00
|
|
|
|
|
|
|
if (other_encoder) {
|
|
|
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(other_encoder);
|
|
|
|
|
|
|
|
switch (radeon_encoder->encoder_id) {
|
|
|
|
case ENCODER_OBJECT_ID_TRAVIS:
|
|
|
|
case ENCODER_OBJECT_ID_NUTMEG:
|
2011-12-03 06:15:27 +07:00
|
|
|
return radeon_encoder->encoder_id;
|
2011-05-20 15:34:21 +07:00
|
|
|
default:
|
2011-12-03 06:15:27 +07:00
|
|
|
return ENCODER_OBJECT_ID_NONE;
|
2011-05-20 15:34:21 +07:00
|
|
|
}
|
|
|
|
}
|
2011-12-03 06:15:27 +07:00
|
|
|
return ENCODER_OBJECT_ID_NONE;
|
2011-05-20 15:34:21 +07:00
|
|
|
}
|
|
|
|
|
2010-04-30 23:00:44 +07:00
|
|
|
void radeon_panel_mode_fixup(struct drm_encoder *encoder,
|
|
|
|
struct drm_display_mode *adjusted_mode)
|
|
|
|
{
|
|
|
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
|
|
|
struct drm_device *dev = encoder->dev;
|
|
|
|
struct radeon_device *rdev = dev->dev_private;
|
|
|
|
struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
|
|
|
|
unsigned hblank = native_mode->htotal - native_mode->hdisplay;
|
|
|
|
unsigned vblank = native_mode->vtotal - native_mode->vdisplay;
|
|
|
|
unsigned hover = native_mode->hsync_start - native_mode->hdisplay;
|
|
|
|
unsigned vover = native_mode->vsync_start - native_mode->vdisplay;
|
|
|
|
unsigned hsync_width = native_mode->hsync_end - native_mode->hsync_start;
|
|
|
|
unsigned vsync_width = native_mode->vsync_end - native_mode->vsync_start;
|
|
|
|
|
|
|
|
adjusted_mode->clock = native_mode->clock;
|
|
|
|
adjusted_mode->flags = native_mode->flags;
|
|
|
|
|
|
|
|
if (ASIC_IS_AVIVO(rdev)) {
|
|
|
|
adjusted_mode->hdisplay = native_mode->hdisplay;
|
|
|
|
adjusted_mode->vdisplay = native_mode->vdisplay;
|
|
|
|
}
|
|
|
|
|
|
|
|
adjusted_mode->htotal = native_mode->hdisplay + hblank;
|
|
|
|
adjusted_mode->hsync_start = native_mode->hdisplay + hover;
|
|
|
|
adjusted_mode->hsync_end = adjusted_mode->hsync_start + hsync_width;
|
|
|
|
|
|
|
|
adjusted_mode->vtotal = native_mode->vdisplay + vblank;
|
|
|
|
adjusted_mode->vsync_start = native_mode->vdisplay + vover;
|
|
|
|
adjusted_mode->vsync_end = adjusted_mode->vsync_start + vsync_width;
|
|
|
|
|
|
|
|
drm_mode_set_crtcinfo(adjusted_mode, CRTC_INTERLACE_HALVE_V);
|
|
|
|
|
|
|
|
if (ASIC_IS_AVIVO(rdev)) {
|
|
|
|
adjusted_mode->crtc_hdisplay = native_mode->hdisplay;
|
|
|
|
adjusted_mode->crtc_vdisplay = native_mode->vdisplay;
|
|
|
|
}
|
|
|
|
|
|
|
|
adjusted_mode->crtc_htotal = adjusted_mode->crtc_hdisplay + hblank;
|
|
|
|
adjusted_mode->crtc_hsync_start = adjusted_mode->crtc_hdisplay + hover;
|
|
|
|
adjusted_mode->crtc_hsync_end = adjusted_mode->crtc_hsync_start + hsync_width;
|
|
|
|
|
|
|
|
adjusted_mode->crtc_vtotal = adjusted_mode->crtc_vdisplay + vblank;
|
|
|
|
adjusted_mode->crtc_vsync_start = adjusted_mode->crtc_vdisplay + vover;
|
|
|
|
adjusted_mode->crtc_vsync_end = adjusted_mode->crtc_vsync_start + vsync_width;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2012-01-21 03:03:30 +07:00
|
|
|
bool radeon_dig_monitor_is_duallink(struct drm_encoder *encoder,
|
|
|
|
u32 pixel_clock)
|
|
|
|
{
|
2012-03-21 04:18:42 +07:00
|
|
|
struct drm_device *dev = encoder->dev;
|
|
|
|
struct radeon_device *rdev = dev->dev_private;
|
2012-01-21 03:03:30 +07:00
|
|
|
struct drm_connector *connector;
|
|
|
|
struct radeon_connector *radeon_connector;
|
|
|
|
struct radeon_connector_atom_dig *dig_connector;
|
|
|
|
|
|
|
|
connector = radeon_get_connector_for_encoder(encoder);
|
|
|
|
/* if we don't have an active device yet, just use one of
|
|
|
|
* the connectors tied to the encoder.
|
|
|
|
*/
|
|
|
|
if (!connector)
|
|
|
|
connector = radeon_get_connector_for_encoder_init(encoder);
|
|
|
|
radeon_connector = to_radeon_connector(connector);
|
|
|
|
|
|
|
|
switch (connector->connector_type) {
|
|
|
|
case DRM_MODE_CONNECTOR_DVII:
|
|
|
|
case DRM_MODE_CONNECTOR_HDMIB:
|
|
|
|
if (radeon_connector->use_digital) {
|
|
|
|
/* HDMI 1.3 supports up to 340 Mhz over single link */
|
2014-07-15 22:00:47 +07:00
|
|
|
if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
|
2012-01-21 03:03:30 +07:00
|
|
|
if (pixel_clock > 340000)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
if (pixel_clock > 165000)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
return false;
|
|
|
|
case DRM_MODE_CONNECTOR_DVID:
|
|
|
|
case DRM_MODE_CONNECTOR_HDMIA:
|
|
|
|
case DRM_MODE_CONNECTOR_DisplayPort:
|
2015-02-24 06:24:04 +07:00
|
|
|
if (radeon_connector->is_mst_connector)
|
|
|
|
return false;
|
|
|
|
|
2012-01-21 03:03:30 +07:00
|
|
|
dig_connector = radeon_connector->con_priv;
|
|
|
|
if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
|
|
|
|
(dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP))
|
|
|
|
return false;
|
|
|
|
else {
|
|
|
|
/* HDMI 1.3 supports up to 340 Mhz over single link */
|
2014-07-15 22:00:47 +07:00
|
|
|
if (ASIC_IS_DCE6(rdev) && drm_detect_hdmi_monitor(radeon_connector_edid(connector))) {
|
2012-01-21 03:03:30 +07:00
|
|
|
if (pixel_clock > 340000)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
if (pixel_clock > 165000)
|
|
|
|
return true;
|
|
|
|
else
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-09-19 03:27:46 +07:00
|
|
|
bool radeon_encoder_is_digital(struct drm_encoder *encoder)
|
|
|
|
{
|
|
|
|
struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
|
|
|
|
switch (radeon_encoder->encoder_id) {
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_LVDS:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_TMDS1:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_TMDS1:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_LVTM1:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_DVO1:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_DVO1:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_DDI:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2:
|
|
|
|
case ENCODER_OBJECT_ID_INTERNAL_UNIPHY3:
|
|
|
|
return true;
|
|
|
|
default:
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|