<div dir="ltr">My name does not include the word "show" (Tested-by tag).</div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 11, 2016 at 7:52 PM, <span dir="ltr"><<a href="mailto:ville.syrjala@linux.intel.com" target="_blank">ville.syrjala@linux.intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">From: Ville Syrjälä <<a href="mailto:ville.syrjala@linux.intel.com">ville.syrjala@linux.intel.com</a><wbr>><br>
<br>
The VBT provides the platform a way to mix and match the DDI ports vs.<br>
GMBUS pins. Currently we only trust the VBT for DDI E, which I suppose<br>
has no standard GMBUS pin assignment. However, there are machines out<br>
there that use a non-standard mapping for the other ports as well.<br>
Let's start trusting the VBT on this one for all ports on DDI platforms.<br>
<br>
I've structured the code such that other platforms could easily start<br>
using this as well, by simply filling in the ddi_port_info. IIRC there<br>
may be CHV system that might actually need this.<br>
<br>
v2: Include a commit message, include a debug message during init<br>
<br>
Cc: <a href="mailto:stable@vger.kernel.org">stable@vger.kernel.org</a><br>
Cc: Maarten Maathuis <<a href="mailto:madman2003@gmail.com">madman2003@gmail.com</a>><br>
Tested-by: Maarten Maatt show huis <<a href="mailto:madman2003@gmail.com">madman2003@gmail.com</a>><br>
Bugzilla: <a href="https://bugs.freedesktop.org/show_bug.cgi?id=97877" rel="noreferrer" target="_blank">https://bugs.freedesktop.org/<wbr>show_bug.cgi?id=97877</a><br>
Signed-off-by: Ville Syrjälä <<a href="mailto:ville.syrjala@linux.intel.com">ville.syrjala@linux.intel.com</a><wbr>><br>
---<br>
drivers/gpu/drm/i915/intel_<wbr>hdmi.c | 84 ++++++++++++++++++++++--------<wbr>---------<br>
1 file changed, 48 insertions(+), 36 deletions(-)<br>
<br>
diff --git a/drivers/gpu/drm/i915/intel_<wbr>hdmi.c b/drivers/gpu/drm/i915/intel_<wbr>hdmi.c<br>
index 8d46f5836746..9ca86e901fc8 100644<br>
--- a/drivers/gpu/drm/i915/intel_<wbr>hdmi.c<br>
+++ b/drivers/gpu/drm/i915/intel_<wbr>hdmi.c<br>
@@ -1799,6 +1799,50 @@ intel_hdmi_add_properties(<wbr>struct intel_hdmi *intel_hdmi, struct drm_connector *c<br>
intel_hdmi->aspect_ratio = HDMI_PICTURE_ASPECT_NONE;<br>
}<br>
<br>
+static u8 intel_hdmi_ddc_pin(struct drm_i915_private *dev_priv,<br>
+ enum port port)<br>
+{<br>
+ const struct ddi_vbt_port_info *info =<br>
+ &dev_priv->vbt.ddi_port_info[<wbr>port];<br>
+ u8 ddc_pin;<br>
+<br>
+ if (info->alternate_ddc_pin) {<br>
+ DRM_DEBUG_KMS("Using DDC pin 0x%x for port %c (VBT)\n",<br>
+ info->alternate_ddc_pin, port_name(port));<br>
+ return info->alternate_ddc_pin;<br>
+ }<br>
+<br>
+ switch (port) {<br>
+ case PORT_B:<br>
+ if (IS_BROXTON(dev_priv))<br>
+ ddc_pin = GMBUS_PIN_1_BXT;<br>
+ else<br>
+ ddc_pin = GMBUS_PIN_DPB;<br>
+ break;<br>
+ case PORT_C:<br>
+ if (IS_BROXTON(dev_priv))<br>
+ ddc_pin = GMBUS_PIN_2_BXT;<br>
+ else<br>
+ ddc_pin = GMBUS_PIN_DPC;<br>
+ break;<br>
+ case PORT_D:<br>
+ if (IS_CHERRYVIEW(dev_priv))<br>
+ ddc_pin = GMBUS_PIN_DPD_CHV;<br>
+ else<br>
+ ddc_pin = GMBUS_PIN_DPD;<br>
+ break;<br>
+ default:<br>
+ MISSING_CASE(port);<br>
+ ddc_pin = GMBUS_PIN_DPB;<br>
+ break;<br>
+ }<br>
+<br>
+ DRM_DEBUG_KMS("Using DDC pin 0x%x for port %c (platform default)\n",<br>
+ ddc_pin, port_name(port));<br>
+<br>
+ return ddc_pin;<br>
+}<br>
+<br>
void intel_hdmi_init_connector(<wbr>struct intel_digital_port *intel_dig_port,<br>
struct intel_connector *intel_connector)<br>
{<br>
@@ -1808,7 +1852,6 @@ void intel_hdmi_init_connector(<wbr>struct intel_digital_port *intel_dig_port,<br>
struct drm_device *dev = intel_encoder->base.dev;<br>
struct drm_i915_private *dev_priv = to_i915(dev);<br>
enum port port = intel_dig_port->port;<br>
- uint8_t alternate_ddc_pin;<br>
<br>
DRM_DEBUG_KMS("Adding HDMI connector on port %c\n",<br>
port_name(port));<br>
@@ -1826,12 +1869,10 @@ void intel_hdmi_init_connector(<wbr>struct intel_digital_port *intel_dig_port,<br>
connector->doublescan_allowed = 0;<br>
connector->stereo_allowed = 1;<br>
<br>
+ intel_hdmi->ddc_bus = intel_hdmi_ddc_pin(dev_priv, port);<br>
+<br>
switch (port) {<br>
case PORT_B:<br>
- if (IS_BROXTON(dev_priv))<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_1_BXT;<br>
- else<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_DPB;<br>
/*<br>
* On BXT A0/A1, sw needs to activate DDIA HPD logic and<br>
* interrupts to check the external panel connection.<br>
@@ -1842,46 +1883,17 @@ void intel_hdmi_init_connector(<wbr>struct intel_digital_port *intel_dig_port,<br>
intel_encoder->hpd_pin = HPD_PORT_B;<br>
break;<br>
case PORT_C:<br>
- if (IS_BROXTON(dev_priv))<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_2_BXT;<br>
- else<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_DPC;<br>
intel_encoder->hpd_pin = HPD_PORT_C;<br>
break;<br>
case PORT_D:<br>
- if (WARN_ON(IS_BROXTON(dev_priv))<wbr>)<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_DISABLED;<br>
- else if (IS_CHERRYVIEW(dev_priv))<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_DPD_CHV;<br>
- else<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_DPD;<br>
intel_encoder->hpd_pin = HPD_PORT_D;<br>
break;<br>
case PORT_E:<br>
- /* On SKL PORT E doesn't have seperate GMBUS pin<br>
- * We rely on VBT to set a proper alternate GMBUS pin. */<br>
- alternate_ddc_pin =<br>
- dev_priv->vbt.ddi_port_info[<wbr>PORT_E].alternate_ddc_pin;<br>
- switch (alternate_ddc_pin) {<br>
- case DDC_PIN_B:<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_DPB;<br>
- break;<br>
- case DDC_PIN_C:<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_DPC;<br>
- break;<br>
- case DDC_PIN_D:<br>
- intel_hdmi->ddc_bus = GMBUS_PIN_DPD;<br>
- break;<br>
- default:<br>
- MISSING_CASE(alternate_ddc_<wbr>pin);<br>
- }<br>
intel_encoder->hpd_pin = HPD_PORT_E;<br>
break;<br>
- case PORT_A:<br>
- intel_encoder->hpd_pin = HPD_PORT_A;<br>
- /* Internal port only for eDP. */<br>
default:<br>
- BUG();<br>
+ MISSING_CASE(port);<br>
+ return;<br>
}<br>
<br>
if (IS_VALLEYVIEW(dev) || IS_CHERRYVIEW(dev)) {<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.7.4<br>
<br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Far away from the primal instinct, the song seems to fade away, the river get wider between your thoughts and the things we do and say.</div>
</div>