diff options
| author | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2017-10-20 13:26:41 -0400 |
|---|---|---|
| committer | Rodrigo Vivi <rodrigo.vivi@intel.com> | 2017-10-20 19:18:03 -0400 |
| commit | 9c3b2689d01ff03e2b8e8d47538881dbff756d78 (patch) | |
| tree | cc49bf269658bd62c6e97bcd283666589dcb26e7 /drivers/gpu | |
| parent | 2952cd6fb4cc9834baa3774fc4051718f94dc3fe (diff) | |
drm/i915/cnl: Map VBT DDC Pin to BSpec DDC Pin.
Starting on CNL we now need to map VBT DDC Pin to
BSPec DDC Pin values. Not a direct translation anymore.
According to VBT
Block 2 (General Bytes Definition)
DDC Bus
+----------+-----------+--------------------+
| DDI Type | VBT Value | Bspec Mapped Value |
+----------+-----------+--------------------+
| DDI-B | 0x1 | 0x1 |
| DDI-C | 0x2 | 0x2 |
| DDI-D | 0x3 | 0x4 |
| DDI-F | 0x4 | 0x3 |
+----------+-----------+--------------------+
v2: Move defines to a better place.
This is actually CNL_PCH not CNL only.
v3: Accepting Ville's suggestions: enums and array to
to make this future proof.
v4: Protect the array access as Ville suggested.
Also accepting all Jani's suggestions:
- use already defined gmbus pin definitions.
- use map_ddc_pin for disambiguation.
- Add /* sic */ comment on inverted values
so people can easily see it it nos a mistake
we have the map 3 -> 4 and 4 -> 3 :/
Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni@intel.com>
Cc: Anusha Srivatsa <anusha.srivatsa@intel.com>
Cc: Clinton Taylor <clinton.a.taylor@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171020172641.16029-1-rodrigo.vivi@intel.com
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/i915/intel_bios.c | 27 | ||||
| -rw-r--r-- | drivers/gpu/drm/i915/intel_vbt_defs.h | 8 |
2 files changed, 25 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c index a0c42e6c9873..5e122673d32a 100644 --- a/drivers/gpu/drm/i915/intel_bios.c +++ b/drivers/gpu/drm/i915/intel_bios.c | |||
| @@ -1106,6 +1106,22 @@ static void sanitize_aux_ch(struct drm_i915_private *dev_priv, | |||
| 1106 | } | 1106 | } |
| 1107 | } | 1107 | } |
| 1108 | 1108 | ||
| 1109 | static const u8 cnp_ddc_pin_map[] = { | ||
| 1110 | [DDC_BUS_DDI_B] = GMBUS_PIN_1_BXT, | ||
| 1111 | [DDC_BUS_DDI_C] = GMBUS_PIN_2_BXT, | ||
| 1112 | [DDC_BUS_DDI_D] = GMBUS_PIN_4_CNP, /* sic */ | ||
| 1113 | [DDC_BUS_DDI_F] = GMBUS_PIN_3_BXT, /* sic */ | ||
| 1114 | }; | ||
| 1115 | |||
| 1116 | static u8 map_ddc_pin(struct drm_i915_private *dev_priv, u8 vbt_pin) | ||
| 1117 | { | ||
| 1118 | if (HAS_PCH_CNP(dev_priv) && | ||
| 1119 | vbt_pin > 0 && vbt_pin < ARRAY_SIZE(cnp_ddc_pin_map)) | ||
| 1120 | return cnp_ddc_pin_map[vbt_pin]; | ||
| 1121 | |||
| 1122 | return vbt_pin; | ||
| 1123 | } | ||
| 1124 | |||
| 1109 | static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, | 1125 | static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, |
| 1110 | u8 bdb_version) | 1126 | u8 bdb_version) |
| 1111 | { | 1127 | { |
| @@ -1191,16 +1207,7 @@ static void parse_ddi_port(struct drm_i915_private *dev_priv, enum port port, | |||
| 1191 | DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port)); | 1207 | DRM_DEBUG_KMS("Port %c is internal DP\n", port_name(port)); |
| 1192 | 1208 | ||
| 1193 | if (is_dvi) { | 1209 | if (is_dvi) { |
| 1194 | info->alternate_ddc_pin = ddc_pin; | 1210 | info->alternate_ddc_pin = map_ddc_pin(dev_priv, ddc_pin); |
| 1195 | |||
| 1196 | /* | ||
| 1197 | * All VBTs that we got so far for B Stepping has this | ||
| 1198 | * information wrong for Port D. So, let's just ignore for now. | ||
| 1199 | */ | ||
| 1200 | if (IS_CNL_REVID(dev_priv, CNL_REVID_B0, CNL_REVID_B0) && | ||
| 1201 | port == PORT_D) { | ||
| 1202 | info->alternate_ddc_pin = 0; | ||
| 1203 | } | ||
| 1204 | 1211 | ||
| 1205 | sanitize_ddc_pin(dev_priv, port); | 1212 | sanitize_ddc_pin(dev_priv, port); |
| 1206 | } | 1213 | } |
diff --git a/drivers/gpu/drm/i915/intel_vbt_defs.h b/drivers/gpu/drm/i915/intel_vbt_defs.h index 404569c9fdfc..f225c288a121 100644 --- a/drivers/gpu/drm/i915/intel_vbt_defs.h +++ b/drivers/gpu/drm/i915/intel_vbt_defs.h | |||
| @@ -306,6 +306,14 @@ struct bdb_general_features { | |||
| 306 | 306 | ||
| 307 | #define LEGACY_CHILD_DEVICE_CONFIG_SIZE 33 | 307 | #define LEGACY_CHILD_DEVICE_CONFIG_SIZE 33 |
| 308 | 308 | ||
| 309 | /* DDC Bus DDI Type 155+ */ | ||
| 310 | enum vbt_gmbus_ddi { | ||
| 311 | DDC_BUS_DDI_B = 0x1, | ||
| 312 | DDC_BUS_DDI_C, | ||
| 313 | DDC_BUS_DDI_D, | ||
| 314 | DDC_BUS_DDI_F, | ||
| 315 | }; | ||
| 316 | |||
| 309 | /* | 317 | /* |
| 310 | * The child device config, aka the display device data structure, provides a | 318 | * The child device config, aka the display device data structure, provides a |
| 311 | * description of a port and its configuration on the platform. | 319 | * description of a port and its configuration on the platform. |
