All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Deepak M <m.deepak@intel.com>, intel-gfx@lists.freedesktop.org
Subject: Re: [PATCH 09/15] drm/i915/bios: interpret the i2c element
Date: Thu, 07 Jan 2016 11:31:25 +0200	[thread overview]
Message-ID: <878u4120sy.fsf@intel.com> (raw)
In-Reply-To: <20160105192123.GR4437@intel.com>

On Tue, 05 Jan 2016, Ville Syrjälä <ville.syrjala@linux.intel.com> wrote:
> On Mon, Dec 21, 2015 at 03:11:00PM +0200, Jani Nikula wrote:
>> Add parsing of the i2c element, defined in MIPI sequence block v2. Drop
>> the status operation byte while at it, that does not exist.
>> 
>> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
>> ---
>>  drivers/gpu/drm/i915/intel_bios.c | 5 +++++
>>  drivers/gpu/drm/i915/intel_bios.h | 2 +-
>>  2 files changed, 6 insertions(+), 1 deletion(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
>> index d6eaf32f33e5..45a7a2bc96c6 100644
>> --- a/drivers/gpu/drm/i915/intel_bios.c
>> +++ b/drivers/gpu/drm/i915/intel_bios.c
>> @@ -812,6 +812,11 @@ static int goto_next_sequence(const u8 *data, int index, int total)
>>  		case MIPI_SEQ_ELEM_GPIO:
>>  			len = 2;
>
> Somewhat off topic, but I wonder if this is correct. The "structure"
> diagram shows it as 2 bytes for v1 and v2, but I'm not sure that section
> isn't there just as an example. Later the describing the GPIO block it
> seems to say it's 2 bytes for v1, and three bytes for v2.

I've held on to some old spec versions (bdb version 177 has sequence v1,
bdb version 185 has sequence v2). Both v1 and v2 have 2 bytes payload
for the GPIO element.

The *meaning* of the first of those bytes has changed from v1->v2
though. Can't do much about that here, it's up to the generic vbt dsi
"driver"...

>
>>  			break;
>> +		case MIPI_SEQ_ELEM_I2C:
>> +			if (index + 7 > total)
>> +				return 0;
>> +			len = *(data + index + 6) + 7;
>> +			break;
>
> This one isn't show in the structure diagrams at all, so I guess we get
> to trust the other section. It says this was introduced in v2. Should be
> add a paranoia check for that?

The spec with bdb version 185 has this.

I contemplated adding a check for v2, but then I thought it probably
doesn't really matter all that much. If we get an i2c elem with v1 and
reject it, we'll probably end up with a black screen. If we just assume
it's an i2c element but it isn't, it'll trip over something else later.

> Should we also check that the payload length is below the specified max
> of 240 bytes?

You'll love this. In v2 the max is actually the whole byte i.e. 255. In
v3 they added a length field for these operations for forward
compatibility (can now skip unknown new operations). And that's 8
bits. So the header + payload for the i2c data can't exceed 255, so
there's now an arbitrary 240 byte limit for i2c payload in v3.

BR,
Jani.


>
>>  		default:
>>  			DRM_ERROR("Unknown operation byte\n");
>>  			return 0;
>> diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
>> index 4e87df16e7b3..411b33794536 100644
>> --- a/drivers/gpu/drm/i915/intel_bios.h
>> +++ b/drivers/gpu/drm/i915/intel_bios.h
>> @@ -968,7 +968,7 @@ enum mipi_seq_element {
>>  	MIPI_SEQ_ELEM_SEND_PKT,
>>  	MIPI_SEQ_ELEM_DELAY,
>>  	MIPI_SEQ_ELEM_GPIO,
>> -	MIPI_SEQ_ELEM_STATUS,
>> +	MIPI_SEQ_ELEM_I2C,		/* sequence block v2+ */
>>  	MIPI_SEQ_ELEM_MAX
>>  };
>>  
>> -- 
>> 2.1.4
>> 
>> _______________________________________________
>> Intel-gfx mailing list
>> Intel-gfx@lists.freedesktop.org
>> http://lists.freedesktop.org/mailman/listinfo/intel-gfx

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

  reply	other threads:[~2016-01-07  9:31 UTC|newest]

Thread overview: 62+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-21 13:10 [PATCH 00/15] drm/i915/bios: mipi sequence block v3, etc Jani Nikula
2015-12-21 13:10 ` [PATCH 01/15] drm/i915/bios: add proper documentation for the Video BIOS Table (VBT) Jani Nikula
2015-12-22 12:40   ` Jani Nikula
2015-12-21 13:10 ` [PATCH 02/15] drm/i915/bios: fix header define name for intel_bios.h Jani Nikula
2016-01-05 10:41   ` Daniel Vetter
2015-12-21 13:10 ` [PATCH 03/15] drm/i915/bios: split the MIPI DSI VBT block parsing to two Jani Nikula
2016-01-05 10:43   ` Daniel Vetter
2015-12-21 13:10 ` [PATCH 04/15] drm/i915/bios: have get_blocksize() support MIPI sequence block v3+ Jani Nikula
2016-01-05 10:45   ` Daniel Vetter
2016-01-05 13:01     ` Jani Nikula
2015-12-21 13:10 ` [PATCH 05/15] drm/i915/bios: abstract finding the panel sequence block Jani Nikula
2016-01-05 10:53   ` Daniel Vetter
2016-01-05 12:45     ` Jani Nikula
2016-01-05 13:59       ` Daniel Vetter
2016-01-05 13:50   ` [PATCH v2] " Jani Nikula
2015-12-21 13:10 ` [PATCH 06/15] drm/i915/bios: rewrite sequence block parsing Jani Nikula
2016-01-05 14:12   ` Daniel Vetter
2015-12-21 13:10 ` [PATCH 07/15] drm/i915/dsi: be defensive about out of bounds sequence id Jani Nikula
2016-01-05 14:12   ` Daniel Vetter
2015-12-21 13:10 ` [PATCH 08/15] drm/i915/dsi: be defensive about out of bounds operation byte Jani Nikula
2016-01-05 14:15   ` Daniel Vetter
2016-01-05 14:44     ` Jani Nikula
2015-12-21 13:11 ` [PATCH 09/15] drm/i915/bios: interpret the i2c element Jani Nikula
2016-01-05 19:21   ` Ville Syrjälä
2016-01-07  9:31     ` Jani Nikula [this message]
2016-01-07 14:16       ` Ville Syrjälä
2016-01-11 12:46         ` Jani Nikula
2016-01-11 16:01           ` Ville Syrjälä
2015-12-21 13:11 ` [PATCH 10/15] drm/i915/bios: add sequences for MIPI sequence block v2 Jani Nikula
2016-01-07 14:39   ` Ville Syrjälä
2016-01-07 14:54     ` Jani Nikula
2016-01-07 15:07       ` Ville Syrjälä
2015-12-21 13:11 ` [PATCH 11/15] drm/i915: Adding the parsing logic for the i2c element Jani Nikula
2016-01-07 15:05   ` Ville Syrjälä
2016-01-11 12:49     ` Jani Nikula
2016-01-11 13:31       ` Jani Nikula
2016-01-11 16:08         ` Ville Syrjälä
2016-01-11 13:29   ` [REPLACEMENT PATCH 11/15] drm/i915: skip the i2c element in the generic VBT DSI driver Jani Nikula
2016-01-11 15:56     ` Ville Syrjälä
2015-12-21 13:11 ` [PATCH 12/15] drm/i915/bios: add defines for v3 sequence block Jani Nikula
2016-01-07 15:27   ` Ville Syrjälä
2015-12-21 13:11 ` [PATCH 13/15] drm/i915/bios: add support for MIPI sequence block v3 Jani Nikula
2016-01-05 15:01   ` [PATCH v2] " Jani Nikula
2016-01-08 11:44     ` Ville Syrjälä
2016-01-11 13:15     ` [PATCH v3] " Jani Nikula
2016-01-11 15:51       ` Ville Syrjälä
2015-12-21 13:11 ` [PATCH 14/15] drm/i915/dsi: skip unknown elements for sequence block v3+ Jani Nikula
2016-01-05 14:19   ` Daniel Vetter
2016-01-05 14:54     ` Jani Nikula
2016-01-05 15:06   ` [PATCH v2] " Jani Nikula
2015-12-21 13:11 ` [PATCH 15/15] drm/i915/dsi: reduce tedious repetition Jani Nikula
2016-01-05 14:25   ` Daniel Vetter
2015-12-21 13:27 ` ✗ warning: Fi.CI.BAT Patchwork
2015-12-22  8:40 ` [PATCH 00/15] drm/i915/bios: mipi sequence block v3, etc Jani Nikula
2016-01-05 15:08 ` [PATCH] drm/i915/dsi: add debug printing of the new sequence block names Jani Nikula
2016-01-08 11:46   ` Ville Syrjälä
2016-01-05 16:01 ` ✗ failure: Fi.CI.BAT Patchwork
2016-01-11 13:30 ` [PATCH v5] drm/i915: Adding the parsing logic for the i2c element Jani Nikula
2016-01-11 13:32   ` Jani Nikula
2016-01-11 17:26     ` Jani Nikula
2016-01-11 13:30 ` ✗ failure: Fi.CI.BAT Patchwork
2016-01-11 14:01 ` 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=878u4120sy.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=m.deepak@intel.com \
    --cc=ville.syrjala@linux.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.