[PATCH 1/1] UBUNTU: SAUCE: drm/i915: Disable writing of TMDS_OE on Lenovo ThinkPad X1 series

Aaron Ma aaron.ma at canonical.com
Thu Dec 21 02:13:50 UTC 2017



On 12/21/2017 09:22 AM, Hui Wang wrote:
> On 2017年12月16日 17:00, Aaron Ma wrote:
>> BugLink: https://bugs.launchpad.net/bugs/1738523
>>
>> There is a hw design on Lenovo ThinkPad X1 yoga/carbon:
>> Intel GEN9 display -> AlpineRidge -> PS8407 -> HDMI output
>>
>> When switch mode on this HDMI output, it failed to writing on
>> I2C device 0x40/0x50. Then sometimes the HDMI output is disabled.
>>
>>  From Parade's support, tmds_oe is enabled by default, and keep it
>> enabled to fix this issue.
> 
> Is it possible that after upgrading the BIOS or VBIOS, tmds_oe becomes
> disabled by default, then your patch will keep the tmds_oe disabled
> forever on Lenovo X1?


tmds_oe is on ps8407 and it can be controlled via I2C, BIOS can not keep
it disabled when writing it via I2C, so we need this patch.

Regards,
Aaron


> 
> If it is not, I think it is safe to apply this workaround, then give my
> ACK here.
> 
> Regards,
> Hui.
>>
>> Add a workaround to bypass this TMDS_OE writing on identified
>> laptop models.
>>
>> Signed-off-by: Aaron Ma <aaron.ma at canonical.com>
>> ---
>>   drivers/gpu/drm/i915/i915_drv.h   |  3 +++
>>   drivers/gpu/drm/i915/intel_bios.c | 18 ++++++++++++++++++
>>   drivers/gpu/drm/i915/intel_hdmi.c |  5 +++++
>>   3 files changed, 26 insertions(+)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.h
>> b/drivers/gpu/drm/i915/i915_drv.h
>> index 0d3848b4f000..46bc91ad6719 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.h
>> +++ b/drivers/gpu/drm/i915/i915_drv.h
>> @@ -2576,6 +2576,9 @@ struct drm_i915_private {
>>         bool ipc_enabled;
>>   +    /* Hack to bypass TMDS_OE write on DP->HDMI dongle */
>> +    bool bypass_tmds_oe;
>> +
>>       /* Used to save the pipe-to-encoder mapping for audio */
>>       struct intel_encoder *av_enc_map[I915_MAX_PIPES];
>>   diff --git a/drivers/gpu/drm/i915/intel_bios.c
>> b/drivers/gpu/drm/i915/intel_bios.c
>> index f814359c86c9..0be1d38feaec 100644
>> --- a/drivers/gpu/drm/i915/intel_bios.c
>> +++ b/drivers/gpu/drm/i915/intel_bios.c
>> @@ -29,6 +29,7 @@
>>   #include <drm/drmP.h>
>>   #include <drm/i915_drm.h>
>>   #include "i915_drv.h"
>> +#include <linux/dmi.h>
>>     #define _INTEL_BIOS_PRIVATE
>>   #include "intel_vbt_defs.h"
>> @@ -1481,6 +1482,22 @@ static const struct vbt_header *find_vbt(void
>> __iomem *bios, size_t size)
>>       return NULL;
>>   }
>>   +#define DRM_DMI_PRODUCT_VERSION 0x6
>> +
>> +static void parse_product_info(struct drm_i915_private *dev_priv)
>> +{
>> +    const char *product_ver =
>> dmi_get_system_info(DRM_DMI_PRODUCT_VERSION);
>> +    if (!product_ver)
>> +        return;
>> +
>> +    if (!strncmp(product_ver, "ThinkPad X1", 11)) {
>> +        DRM_DEBUG_KMS("dmi: %s, Bypassing TMDS_OE write\n",
>> product_ver);
>> +        dev_priv->bypass_tmds_oe = true;
>> +    }
>> +
>> +    return;
>> +}
>> +
>>   /**
>>    * intel_bios_init - find VBT and initialize settings from the BIOS
>>    * @dev_priv: i915 device instance
>> @@ -1537,6 +1554,7 @@ void intel_bios_init(struct drm_i915_private
>> *dev_priv)
>>       parse_mipi_config(dev_priv, bdb);
>>       parse_mipi_sequence(dev_priv, bdb);
>>       parse_ddi_ports(dev_priv, bdb);
>> +    parse_product_info(dev_priv);
>>     out:
>>       if (!vbt) {
>> diff --git a/drivers/gpu/drm/i915/intel_hdmi.c
>> b/drivers/gpu/drm/i915/intel_hdmi.c
>> index ec0779a52d53..01837b9f7d76 100644
>> --- a/drivers/gpu/drm/i915/intel_hdmi.c
>> +++ b/drivers/gpu/drm/i915/intel_hdmi.c
>> @@ -851,6 +851,11 @@ void intel_dp_dual_mode_set_tmds_output(struct
>> intel_hdmi *hdmi, bool enable)
>>       if (hdmi->dp_dual_mode.type < DRM_DP_DUAL_MODE_TYPE2_DVI)
>>           return;
>>   +    if (dev_priv->bypass_tmds_oe) {
>> +        DRM_DEBUG_KMS("Bypassing TMDS_OE setting\n");
>> +        return;
>> +    }
>> +
>>       DRM_DEBUG_KMS("%s DP dual mode adaptor TMDS output\n",
>>                 enable ? "Enabling" : "Disabling");
>>   
> 
> 




More information about the kernel-team mailing list