aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_hdmi.c
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2012-07-12 14:19:59 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-07-25 12:23:47 -0400
commit08d644add0e5f799a47dbe7849401606c522e59e (patch)
treefb16c7a3902748552285836d1bae82601f3bcacb /drivers/gpu/drm/i915/intel_hdmi.c
parent66a9278eecbef1c746e7fac8f4bcb0485d7aa4d0 (diff)
drm/i915: add port parameter to intel_hdmi_init
Instead of having a giant if cascade to figure this out according to the passed-in register. We could do quite a bit more cleaning up and all by using the port at more places, but I think this should be part of a bigger rework to introduce a struct intel_digital_port which would keep track of all these things. I guess this will be part of some haswell-DP-induced refactoring. For now this rips out the big cascade, which is what annoyed me so much. v2: Add port variable name back for the func decl (I've tried to trick myself below the 80 char limit). Reviewed-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_hdmi.c')
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c41
1 files changed, 12 insertions, 29 deletions
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index 593b8fe2e00a..e4c37bb572e8 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -889,7 +889,7 @@ intel_hdmi_add_properties(struct intel_hdmi *intel_hdmi, struct drm_connector *c
889 intel_attach_broadcast_rgb_property(connector); 889 intel_attach_broadcast_rgb_property(connector);
890} 890}
891 891
892void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) 892void intel_hdmi_init(struct drm_device *dev, int sdvox_reg, enum port port)
893{ 893{
894 struct drm_i915_private *dev_priv = dev->dev_private; 894 struct drm_i915_private *dev_priv = dev->dev_private;
895 struct drm_connector *connector; 895 struct drm_connector *connector;
@@ -925,40 +925,23 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
925 925
926 intel_encoder->cloneable = false; 926 intel_encoder->cloneable = false;
927 927
928 /* Set up the DDC bus. */ 928 intel_hdmi->ddi_port = port;
929 if (sdvox_reg == SDVOB) { 929 switch (port) {
930 case PORT_B:
930 intel_hdmi->ddc_bus = GMBUS_PORT_DPB; 931 intel_hdmi->ddc_bus = GMBUS_PORT_DPB;
931 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; 932 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
932 } else if (sdvox_reg == SDVOC) { 933 break;
933 intel_hdmi->ddc_bus = GMBUS_PORT_DPC; 934 case PORT_C:
934 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
935 } else if (sdvox_reg == HDMIB) {
936 intel_hdmi->ddc_bus = GMBUS_PORT_DPB;
937 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
938 } else if (sdvox_reg == HDMIC) {
939 intel_hdmi->ddc_bus = GMBUS_PORT_DPC;
940 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
941 } else if (sdvox_reg == HDMID) {
942 intel_hdmi->ddc_bus = GMBUS_PORT_DPD;
943 dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS;
944 } else if (sdvox_reg == DDI_BUF_CTL(PORT_B)) {
945 DRM_DEBUG_DRIVER("LPT: detected output on DDI B\n");
946 intel_hdmi->ddc_bus = GMBUS_PORT_DPB;
947 intel_hdmi->ddi_port = PORT_B;
948 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
949 } else if (sdvox_reg == DDI_BUF_CTL(PORT_C)) {
950 DRM_DEBUG_DRIVER("LPT: detected output on DDI C\n");
951 intel_hdmi->ddc_bus = GMBUS_PORT_DPC; 935 intel_hdmi->ddc_bus = GMBUS_PORT_DPC;
952 intel_hdmi->ddi_port = PORT_C;
953 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; 936 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
954 } else if (sdvox_reg == DDI_BUF_CTL(PORT_D)) { 937 break;
955 DRM_DEBUG_DRIVER("LPT: detected output on DDI D\n"); 938 case PORT_D:
956 intel_hdmi->ddc_bus = GMBUS_PORT_DPD; 939 intel_hdmi->ddc_bus = GMBUS_PORT_DPD;
957 intel_hdmi->ddi_port = PORT_D;
958 dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS; 940 dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS;
959 } else { 941 break;
960 /* If we got an unknown sdvox_reg, things are pretty much broken 942 case PORT_A:
961 * in a way that we should let the kernel know about it */ 943 /* Internal port only for eDP. */
944 default:
962 BUG(); 945 BUG();
963 } 946 }
964 947