diff options
author | Ben Skeggs <bskeggs@redhat.com> | 2010-02-23 23:01:40 -0500 |
---|---|---|
committer | Ben Skeggs <bskeggs@redhat.com> | 2010-02-25 00:09:36 -0500 |
commit | be079e97b5a6a569ceff73731aa9433b6113cb87 (patch) | |
tree | 4e7560e0ae4253da8ff0b6e7025d451b8c8b95d8 | |
parent | 1157563931dd773df2420b98eef61598205d39ec (diff) |
drm/nouveau: use dcb connector types throughout the driver
Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
-rw-r--r-- | drivers/gpu/drm/nouveau/nouveau_connector.c | 73 |
1 files changed, 41 insertions, 32 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_connector.c b/drivers/gpu/drm/nouveau/nouveau_connector.c index 9d118737f88f..dee52c81b100 100644 --- a/drivers/gpu/drm/nouveau/nouveau_connector.c +++ b/drivers/gpu/drm/nouveau/nouveau_connector.c | |||
@@ -218,7 +218,7 @@ nouveau_connector_set_encoder(struct drm_connector *connector, | |||
218 | connector->interlace_allowed = true; | 218 | connector->interlace_allowed = true; |
219 | } | 219 | } |
220 | 220 | ||
221 | if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) { | 221 | if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) { |
222 | drm_connector_property_set_value(connector, | 222 | drm_connector_property_set_value(connector, |
223 | dev->mode_config.dvi_i_subconnector_property, | 223 | dev->mode_config.dvi_i_subconnector_property, |
224 | nv_encoder->dcb->type == OUTPUT_TMDS ? | 224 | nv_encoder->dcb->type == OUTPUT_TMDS ? |
@@ -236,7 +236,7 @@ nouveau_connector_detect(struct drm_connector *connector) | |||
236 | struct nouveau_i2c_chan *i2c; | 236 | struct nouveau_i2c_chan *i2c; |
237 | int type, flags; | 237 | int type, flags; |
238 | 238 | ||
239 | if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) | 239 | if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS) |
240 | nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS); | 240 | nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS); |
241 | if (nv_encoder && nv_connector->native_mode) { | 241 | if (nv_encoder && nv_connector->native_mode) { |
242 | #ifdef CONFIG_ACPI | 242 | #ifdef CONFIG_ACPI |
@@ -279,7 +279,7 @@ nouveau_connector_detect(struct drm_connector *connector) | |||
279 | * same i2c channel so the value returned from ddc_detect | 279 | * same i2c channel so the value returned from ddc_detect |
280 | * isn't necessarily correct. | 280 | * isn't necessarily correct. |
281 | */ | 281 | */ |
282 | if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) { | 282 | if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) { |
283 | if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL) | 283 | if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL) |
284 | type = OUTPUT_TMDS; | 284 | type = OUTPUT_TMDS; |
285 | else | 285 | else |
@@ -321,11 +321,11 @@ detect_analog: | |||
321 | static void | 321 | static void |
322 | nouveau_connector_force(struct drm_connector *connector) | 322 | nouveau_connector_force(struct drm_connector *connector) |
323 | { | 323 | { |
324 | struct drm_device *dev = connector->dev; | 324 | struct nouveau_connector *nv_connector = nouveau_connector(connector); |
325 | struct nouveau_encoder *nv_encoder; | 325 | struct nouveau_encoder *nv_encoder; |
326 | int type; | 326 | int type; |
327 | 327 | ||
328 | if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) { | 328 | if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) { |
329 | if (connector->force == DRM_FORCE_ON_DIGITAL) | 329 | if (connector->force == DRM_FORCE_ON_DIGITAL) |
330 | type = OUTPUT_TMDS; | 330 | type = OUTPUT_TMDS; |
331 | else | 331 | else |
@@ -335,7 +335,7 @@ nouveau_connector_force(struct drm_connector *connector) | |||
335 | 335 | ||
336 | nv_encoder = find_encoder_by_type(connector, type); | 336 | nv_encoder = find_encoder_by_type(connector, type); |
337 | if (!nv_encoder) { | 337 | if (!nv_encoder) { |
338 | NV_ERROR(dev, "can't find encoder to force %s on!\n", | 338 | NV_ERROR(connector->dev, "can't find encoder to force %s on!\n", |
339 | drm_get_connector_name(connector)); | 339 | drm_get_connector_name(connector)); |
340 | connector->status = connector_status_disconnected; | 340 | connector->status = connector_status_disconnected; |
341 | return; | 341 | return; |
@@ -369,7 +369,7 @@ nouveau_connector_set_property(struct drm_connector *connector, | |||
369 | } | 369 | } |
370 | 370 | ||
371 | /* LVDS always needs gpu scaling */ | 371 | /* LVDS always needs gpu scaling */ |
372 | if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS && | 372 | if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS && |
373 | value == DRM_MODE_SCALE_NONE) | 373 | value == DRM_MODE_SCALE_NONE) |
374 | return -EINVAL; | 374 | return -EINVAL; |
375 | 375 | ||
@@ -535,7 +535,7 @@ nouveau_connector_get_modes(struct drm_connector *connector) | |||
535 | /* If we're not LVDS, destroy the previous native mode, the attached | 535 | /* If we're not LVDS, destroy the previous native mode, the attached |
536 | * monitor could have changed. | 536 | * monitor could have changed. |
537 | */ | 537 | */ |
538 | if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && | 538 | if (nv_connector->dcb->type != DCB_CONNECTOR_LVDS && |
539 | nv_connector->native_mode) { | 539 | nv_connector->native_mode) { |
540 | drm_mode_destroy(dev, nv_connector->native_mode); | 540 | drm_mode_destroy(dev, nv_connector->native_mode); |
541 | nv_connector->native_mode = NULL; | 541 | nv_connector->native_mode = NULL; |
@@ -563,7 +563,7 @@ nouveau_connector_get_modes(struct drm_connector *connector) | |||
563 | ret = get_slave_funcs(nv_encoder)-> | 563 | ret = get_slave_funcs(nv_encoder)-> |
564 | get_modes(to_drm_encoder(nv_encoder), connector); | 564 | get_modes(to_drm_encoder(nv_encoder), connector); |
565 | 565 | ||
566 | if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) | 566 | if (nv_encoder->dcb->type == OUTPUT_LVDS) |
567 | ret += nouveau_connector_scaler_modes_add(connector); | 567 | ret += nouveau_connector_scaler_modes_add(connector); |
568 | 568 | ||
569 | return ret; | 569 | return ret; |
@@ -771,20 +771,26 @@ nouveau_connector_create(struct drm_device *dev, | |||
771 | type = DRM_MODE_CONNECTOR_DVII; | 771 | type = DRM_MODE_CONNECTOR_DVII; |
772 | break; | 772 | break; |
773 | case DCB_CONNECTOR_DVI_D: | 773 | case DCB_CONNECTOR_DVI_D: |
774 | case DCB_CONNECTOR_HDMI_0: | ||
775 | case DCB_CONNECTOR_HDMI_1: | ||
776 | NV_INFO(dev, "Detected a DVI-D connector\n"); | 774 | NV_INFO(dev, "Detected a DVI-D connector\n"); |
777 | type = DRM_MODE_CONNECTOR_DVID; | 775 | type = DRM_MODE_CONNECTOR_DVID; |
778 | break; | 776 | break; |
777 | case DCB_CONNECTOR_HDMI_0: | ||
778 | case DCB_CONNECTOR_HDMI_1: | ||
779 | NV_INFO(dev, "Detected a HDMI connector\n"); | ||
780 | type = DRM_MODE_CONNECTOR_HDMIA; | ||
781 | break; | ||
779 | case DCB_CONNECTOR_LVDS: | 782 | case DCB_CONNECTOR_LVDS: |
780 | NV_INFO(dev, "Detected a LVDS connector\n"); | 783 | NV_INFO(dev, "Detected a LVDS connector\n"); |
781 | type = DRM_MODE_CONNECTOR_LVDS; | 784 | type = DRM_MODE_CONNECTOR_LVDS; |
782 | break; | 785 | break; |
783 | case DCB_CONNECTOR_DP: | 786 | case DCB_CONNECTOR_DP: |
784 | case DCB_CONNECTOR_eDP: | ||
785 | NV_INFO(dev, "Detected a DisplayPort connector\n"); | 787 | NV_INFO(dev, "Detected a DisplayPort connector\n"); |
786 | type = DRM_MODE_CONNECTOR_DisplayPort; | 788 | type = DRM_MODE_CONNECTOR_DisplayPort; |
787 | break; | 789 | break; |
790 | case DCB_CONNECTOR_eDP: | ||
791 | NV_INFO(dev, "Detected an eDP connector\n"); | ||
792 | type = DRM_MODE_CONNECTOR_eDP; | ||
793 | break; | ||
788 | default: | 794 | default: |
789 | NV_ERROR(dev, "unknown connector type: 0x%02x!!\n", dcb->type); | 795 | NV_ERROR(dev, "unknown connector type: 0x%02x!!\n", dcb->type); |
790 | return -EINVAL; | 796 | return -EINVAL; |
@@ -824,41 +830,44 @@ nouveau_connector_create(struct drm_device *dev, | |||
824 | } | 830 | } |
825 | 831 | ||
826 | /* Init DVI-I specific properties */ | 832 | /* Init DVI-I specific properties */ |
827 | if (type == DRM_MODE_CONNECTOR_DVII) { | 833 | if (dcb->type == DCB_CONNECTOR_DVI_I) { |
828 | drm_mode_create_dvi_i_properties(dev); | 834 | drm_mode_create_dvi_i_properties(dev); |
829 | drm_connector_attach_property(connector, dev->mode_config.dvi_i_subconnector_property, 0); | 835 | drm_connector_attach_property(connector, dev->mode_config.dvi_i_subconnector_property, 0); |
830 | drm_connector_attach_property(connector, dev->mode_config.dvi_i_select_subconnector_property, 0); | 836 | drm_connector_attach_property(connector, dev->mode_config.dvi_i_select_subconnector_property, 0); |
831 | } | 837 | } |
832 | 838 | ||
833 | if (type != DRM_MODE_CONNECTOR_LVDS) | 839 | if (dcb->type != DCB_CONNECTOR_LVDS) |
834 | nv_connector->use_dithering = false; | 840 | nv_connector->use_dithering = false; |
835 | 841 | ||
836 | if (type == DRM_MODE_CONNECTOR_DVID || | 842 | switch (dcb->type) { |
837 | type == DRM_MODE_CONNECTOR_DVII || | 843 | case DCB_CONNECTOR_VGA: |
838 | type == DRM_MODE_CONNECTOR_LVDS || | 844 | if (dev_priv->card_type >= NV_50) { |
839 | type == DRM_MODE_CONNECTOR_DisplayPort) { | ||
840 | nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN; | ||
841 | |||
842 | drm_connector_attach_property(connector, dev->mode_config.scaling_mode_property, | ||
843 | nv_connector->scaling_mode); | ||
844 | drm_connector_attach_property(connector, dev->mode_config.dithering_mode_property, | ||
845 | nv_connector->use_dithering ? DRM_MODE_DITHERING_ON | ||
846 | : DRM_MODE_DITHERING_OFF); | ||
847 | |||
848 | } else { | ||
849 | nv_connector->scaling_mode = DRM_MODE_SCALE_NONE; | ||
850 | |||
851 | if (type == DRM_MODE_CONNECTOR_VGA && | ||
852 | dev_priv->card_type >= NV_50) { | ||
853 | drm_connector_attach_property(connector, | 845 | drm_connector_attach_property(connector, |
854 | dev->mode_config.scaling_mode_property, | 846 | dev->mode_config.scaling_mode_property, |
855 | nv_connector->scaling_mode); | 847 | nv_connector->scaling_mode); |
856 | } | 848 | } |
849 | /* fall-through */ | ||
850 | case DCB_CONNECTOR_TV_0: | ||
851 | case DCB_CONNECTOR_TV_1: | ||
852 | case DCB_CONNECTOR_TV_3: | ||
853 | nv_connector->scaling_mode = DRM_MODE_SCALE_NONE; | ||
854 | break; | ||
855 | default: | ||
856 | nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN; | ||
857 | |||
858 | drm_connector_attach_property(connector, | ||
859 | dev->mode_config.scaling_mode_property, | ||
860 | nv_connector->scaling_mode); | ||
861 | drm_connector_attach_property(connector, | ||
862 | dev->mode_config.dithering_mode_property, | ||
863 | nv_connector->use_dithering ? | ||
864 | DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF); | ||
865 | break; | ||
857 | } | 866 | } |
858 | 867 | ||
859 | drm_sysfs_connector_add(connector); | 868 | drm_sysfs_connector_add(connector); |
860 | 869 | ||
861 | if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) { | 870 | if (dcb->type == DCB_CONNECTOR_LVDS) { |
862 | ret = nouveau_connector_create_lvds(dev, connector); | 871 | ret = nouveau_connector_create_lvds(dev, connector); |
863 | if (ret) { | 872 | if (ret) { |
864 | connector->funcs->destroy(connector); | 873 | connector->funcs->destroy(connector); |