Commit be079e97 authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau: use dcb connector types throughout the driver

Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent 11575639
...@@ -218,7 +218,7 @@ nouveau_connector_set_encoder(struct drm_connector *connector, ...@@ -218,7 +218,7 @@ nouveau_connector_set_encoder(struct drm_connector *connector,
connector->interlace_allowed = true; connector->interlace_allowed = true;
} }
if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) { if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
drm_connector_property_set_value(connector, drm_connector_property_set_value(connector,
dev->mode_config.dvi_i_subconnector_property, dev->mode_config.dvi_i_subconnector_property,
nv_encoder->dcb->type == OUTPUT_TMDS ? nv_encoder->dcb->type == OUTPUT_TMDS ?
...@@ -236,7 +236,7 @@ nouveau_connector_detect(struct drm_connector *connector) ...@@ -236,7 +236,7 @@ nouveau_connector_detect(struct drm_connector *connector)
struct nouveau_i2c_chan *i2c; struct nouveau_i2c_chan *i2c;
int type, flags; int type, flags;
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS)
nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS); nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS);
if (nv_encoder && nv_connector->native_mode) { if (nv_encoder && nv_connector->native_mode) {
#ifdef CONFIG_ACPI #ifdef CONFIG_ACPI
...@@ -279,7 +279,7 @@ nouveau_connector_detect(struct drm_connector *connector) ...@@ -279,7 +279,7 @@ nouveau_connector_detect(struct drm_connector *connector)
* same i2c channel so the value returned from ddc_detect * same i2c channel so the value returned from ddc_detect
* isn't necessarily correct. * isn't necessarily correct.
*/ */
if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) { if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL) if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL)
type = OUTPUT_TMDS; type = OUTPUT_TMDS;
else else
...@@ -321,11 +321,11 @@ nouveau_connector_detect(struct drm_connector *connector) ...@@ -321,11 +321,11 @@ nouveau_connector_detect(struct drm_connector *connector)
static void static void
nouveau_connector_force(struct drm_connector *connector) nouveau_connector_force(struct drm_connector *connector)
{ {
struct drm_device *dev = connector->dev; struct nouveau_connector *nv_connector = nouveau_connector(connector);
struct nouveau_encoder *nv_encoder; struct nouveau_encoder *nv_encoder;
int type; int type;
if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) { if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
if (connector->force == DRM_FORCE_ON_DIGITAL) if (connector->force == DRM_FORCE_ON_DIGITAL)
type = OUTPUT_TMDS; type = OUTPUT_TMDS;
else else
...@@ -335,7 +335,7 @@ nouveau_connector_force(struct drm_connector *connector) ...@@ -335,7 +335,7 @@ nouveau_connector_force(struct drm_connector *connector)
nv_encoder = find_encoder_by_type(connector, type); nv_encoder = find_encoder_by_type(connector, type);
if (!nv_encoder) { if (!nv_encoder) {
NV_ERROR(dev, "can't find encoder to force %s on!\n", NV_ERROR(connector->dev, "can't find encoder to force %s on!\n",
drm_get_connector_name(connector)); drm_get_connector_name(connector));
connector->status = connector_status_disconnected; connector->status = connector_status_disconnected;
return; return;
...@@ -369,7 +369,7 @@ nouveau_connector_set_property(struct drm_connector *connector, ...@@ -369,7 +369,7 @@ nouveau_connector_set_property(struct drm_connector *connector,
} }
/* LVDS always needs gpu scaling */ /* LVDS always needs gpu scaling */
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS && if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS &&
value == DRM_MODE_SCALE_NONE) value == DRM_MODE_SCALE_NONE)
return -EINVAL; return -EINVAL;
...@@ -535,7 +535,7 @@ nouveau_connector_get_modes(struct drm_connector *connector) ...@@ -535,7 +535,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
/* If we're not LVDS, destroy the previous native mode, the attached /* If we're not LVDS, destroy the previous native mode, the attached
* monitor could have changed. * monitor could have changed.
*/ */
if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && if (nv_connector->dcb->type != DCB_CONNECTOR_LVDS &&
nv_connector->native_mode) { nv_connector->native_mode) {
drm_mode_destroy(dev, nv_connector->native_mode); drm_mode_destroy(dev, nv_connector->native_mode);
nv_connector->native_mode = NULL; nv_connector->native_mode = NULL;
...@@ -563,7 +563,7 @@ nouveau_connector_get_modes(struct drm_connector *connector) ...@@ -563,7 +563,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
ret = get_slave_funcs(nv_encoder)-> ret = get_slave_funcs(nv_encoder)->
get_modes(to_drm_encoder(nv_encoder), connector); get_modes(to_drm_encoder(nv_encoder), connector);
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) if (nv_encoder->dcb->type == OUTPUT_LVDS)
ret += nouveau_connector_scaler_modes_add(connector); ret += nouveau_connector_scaler_modes_add(connector);
return ret; return ret;
...@@ -771,20 +771,26 @@ nouveau_connector_create(struct drm_device *dev, ...@@ -771,20 +771,26 @@ nouveau_connector_create(struct drm_device *dev,
type = DRM_MODE_CONNECTOR_DVII; type = DRM_MODE_CONNECTOR_DVII;
break; break;
case DCB_CONNECTOR_DVI_D: case DCB_CONNECTOR_DVI_D:
case DCB_CONNECTOR_HDMI_0:
case DCB_CONNECTOR_HDMI_1:
NV_INFO(dev, "Detected a DVI-D connector\n"); NV_INFO(dev, "Detected a DVI-D connector\n");
type = DRM_MODE_CONNECTOR_DVID; type = DRM_MODE_CONNECTOR_DVID;
break; break;
case DCB_CONNECTOR_HDMI_0:
case DCB_CONNECTOR_HDMI_1:
NV_INFO(dev, "Detected a HDMI connector\n");
type = DRM_MODE_CONNECTOR_HDMIA;
break;
case DCB_CONNECTOR_LVDS: case DCB_CONNECTOR_LVDS:
NV_INFO(dev, "Detected a LVDS connector\n"); NV_INFO(dev, "Detected a LVDS connector\n");
type = DRM_MODE_CONNECTOR_LVDS; type = DRM_MODE_CONNECTOR_LVDS;
break; break;
case DCB_CONNECTOR_DP: case DCB_CONNECTOR_DP:
case DCB_CONNECTOR_eDP:
NV_INFO(dev, "Detected a DisplayPort connector\n"); NV_INFO(dev, "Detected a DisplayPort connector\n");
type = DRM_MODE_CONNECTOR_DisplayPort; type = DRM_MODE_CONNECTOR_DisplayPort;
break; break;
case DCB_CONNECTOR_eDP:
NV_INFO(dev, "Detected an eDP connector\n");
type = DRM_MODE_CONNECTOR_eDP;
break;
default: default:
NV_ERROR(dev, "unknown connector type: 0x%02x!!\n", dcb->type); NV_ERROR(dev, "unknown connector type: 0x%02x!!\n", dcb->type);
return -EINVAL; return -EINVAL;
...@@ -824,41 +830,44 @@ nouveau_connector_create(struct drm_device *dev, ...@@ -824,41 +830,44 @@ nouveau_connector_create(struct drm_device *dev,
} }
/* Init DVI-I specific properties */ /* Init DVI-I specific properties */
if (type == DRM_MODE_CONNECTOR_DVII) { if (dcb->type == DCB_CONNECTOR_DVI_I) {
drm_mode_create_dvi_i_properties(dev); drm_mode_create_dvi_i_properties(dev);
drm_connector_attach_property(connector, dev->mode_config.dvi_i_subconnector_property, 0); drm_connector_attach_property(connector, dev->mode_config.dvi_i_subconnector_property, 0);
drm_connector_attach_property(connector, dev->mode_config.dvi_i_select_subconnector_property, 0); drm_connector_attach_property(connector, dev->mode_config.dvi_i_select_subconnector_property, 0);
} }
if (type != DRM_MODE_CONNECTOR_LVDS) if (dcb->type != DCB_CONNECTOR_LVDS)
nv_connector->use_dithering = false; nv_connector->use_dithering = false;
if (type == DRM_MODE_CONNECTOR_DVID || switch (dcb->type) {
type == DRM_MODE_CONNECTOR_DVII || case DCB_CONNECTOR_VGA:
type == DRM_MODE_CONNECTOR_LVDS || if (dev_priv->card_type >= NV_50) {
type == DRM_MODE_CONNECTOR_DisplayPort) {
nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN;
drm_connector_attach_property(connector, dev->mode_config.scaling_mode_property,
nv_connector->scaling_mode);
drm_connector_attach_property(connector, dev->mode_config.dithering_mode_property,
nv_connector->use_dithering ? DRM_MODE_DITHERING_ON
: DRM_MODE_DITHERING_OFF);
} else {
nv_connector->scaling_mode = DRM_MODE_SCALE_NONE;
if (type == DRM_MODE_CONNECTOR_VGA &&
dev_priv->card_type >= NV_50) {
drm_connector_attach_property(connector, drm_connector_attach_property(connector,
dev->mode_config.scaling_mode_property, dev->mode_config.scaling_mode_property,
nv_connector->scaling_mode); nv_connector->scaling_mode);
} }
/* fall-through */
case DCB_CONNECTOR_TV_0:
case DCB_CONNECTOR_TV_1:
case DCB_CONNECTOR_TV_3:
nv_connector->scaling_mode = DRM_MODE_SCALE_NONE;
break;
default:
nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN;
drm_connector_attach_property(connector,
dev->mode_config.scaling_mode_property,
nv_connector->scaling_mode);
drm_connector_attach_property(connector,
dev->mode_config.dithering_mode_property,
nv_connector->use_dithering ?
DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF);
break;
} }
drm_sysfs_connector_add(connector); drm_sysfs_connector_add(connector);
if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { if (dcb->type == DCB_CONNECTOR_LVDS) {
ret = nouveau_connector_create_lvds(dev, connector); ret = nouveau_connector_create_lvds(dev, connector);
if (ret) { if (ret) {
connector->funcs->destroy(connector); connector->funcs->destroy(connector);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment