All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@linux.intel.com>
To: Rodrigo Vivi <rodrigo.vivi@intel.com>, intel-gfx@lists.freedesktop.org
Cc: Kai Heng Feng <kai.heng.feng@canonical.com>
Subject: Re: [PATCH] drm/i915/cnp: Ignore VBT request for know invalid DDC pin.
Date: Wed, 24 Jan 2018 11:25:06 +0200	[thread overview]
Message-ID: <877es7k3rh.fsf@intel.com> (raw)
In-Reply-To: <20180123231934.isv4n4o2yftsekhc@intel.com>

On Tue, 23 Jan 2018, Rodrigo Vivi <rodrigo.vivi@intel.com> wrote:
> On Tue, Jan 23, 2018 at 05:40:50PM +0000, Rodrigo Vivi wrote:
>> Let's ignore VBT request if the pin is clearly wrong.
>> 
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104139
>> Cc: Kai Heng Feng <kai.heng.feng@canonical.com>
>> Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
>
> Reviewed-by: Radhakrishna Sripada <radhakrishna.sripada@intel.com>
> (f2f)
> thanks
>
> merged to dinq.

A bit too fast IMO. The bug report doesn't include the vbt dump which
you should *always* look at before making workarounds for vbt.

Also, see below.

>> ---
>>  drivers/gpu/drm/i915/intel_bios.c | 11 ++++++++---
>>  1 file changed, 8 insertions(+), 3 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
>> index b0668202dc7e..95f0b310d656 100644
>> --- a/drivers/gpu/drm/i915/intel_bios.c
>> +++ b/drivers/gpu/drm/i915/intel_bios.c
>> @@ -1115,9 +1115,14 @@ static const u8 cnp_ddc_pin_map[] = {
>>  
>>  static u8 map_ddc_pin(struct drm_i915_private *dev_priv, u8 vbt_pin)
>>  {
>> -	if (HAS_PCH_CNP(dev_priv) &&
>> -	    vbt_pin > 0 && vbt_pin < ARRAY_SIZE(cnp_ddc_pin_map))
>> -		return cnp_ddc_pin_map[vbt_pin];
>> +	if (HAS_PCH_CNP(dev_priv)) {
>> +		if (vbt_pin > 0 && vbt_pin < ARRAY_SIZE(cnp_ddc_pin_map))
>> +			return cnp_ddc_pin_map[vbt_pin];
>> +		if (vbt_pin > GMBUS_PIN_4_CNP) {
>> +			DRM_DEBUG_KMS("Ignoring alternate pin: VBT claims DDC pin %d, which is not valid for this platform\n", vbt_pin);
>> +			return 0;
>> +		}

The original code was wrong in the sense that it would only do the
mapping if the provided vbt_pin was within bounds for CNP, and would
return the unmapped vbt_pin otherwise. Instead, I think you should
directly return 0 for out of bounds vbt_pin.

This change here is effectively the same, but more confusing. As if
there's a case where the vbt_pin can be both out of bounds, within CNP
pin limits, and should be returned unmapped. That can't happen, so
please make the code reflect that.

BR,
Jani.


>> +	}
>>  
>>  	return vbt_pin;
>>  }
>> -- 
>> 2.13.6
>> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx

-- 
Jani Nikula, Intel Open Source Technology Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-01-24  9:19 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-23 17:40 [PATCH] drm/i915/cnp: Ignore VBT request for know invalid DDC pin Rodrigo Vivi
2018-01-23 18:15 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-01-23 23:19 ` [PATCH] " Rodrigo Vivi
2018-01-24  9:25   ` Jani Nikula [this message]
2018-01-24  9:24     ` Kai Heng Feng
2018-01-24 10:03       ` Jani Nikula
2018-01-24 10:04         ` Kai Heng Feng
2018-01-24 13:30         ` Ville Syrjälä
2018-01-24 18:34     ` Rodrigo Vivi
2018-01-24  3:16 ` ✓ Fi.CI.IGT: success for " Patchwork

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877es7k3rh.fsf@intel.com \
    --to=jani.nikula@linux.intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=kai.heng.feng@canonical.com \
    --cc=rodrigo.vivi@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.