drm/i915/bios: Generate LFP data table pointers if the VBT lacks them
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Wed, 4 May 2022 15:04:33 +0000 (18:04 +0300)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 5 May 2022 15:25:17 +0000 (18:25 +0300)
commita87d0a84760726445dcc0f0177623f0d683f3559
treeb2d0b49aff9c1ab5278f3995db23f50c484da207
parent13367132a7ad2e29d58d55f7755fb1844db5f362
drm/i915/bios: Generate LFP data table pointers if the VBT lacks them

Modern VBTs no longer contain the LFP data table pointers
block (41). We are expecting to have one in order to be able
to parse the LFP data block (42), so let's make one up.

Since the fp_timing table has variable size we must somehow
determine its size. Rather than just hardcode it we look for
the terminator bytes (0xffff) to figure out where each table
entry starts. dvo_timing, panel_pnp_id, and panel_name are
expected to have fixed size.

This has been observed on various machines, eg. TGL with BDB
version 240, CML with BDB version 231, etc. The most recent
VBT I've observed that still had block 41 had BDB version
228. So presumably the cutoff (if an exact cutoff even exists)
is somewhere around BDB version 229-231.

v2: kfree the thing we allocated, not the thing+3 bytes
v3: Do the debugprint only if we found the LFP data block
v4: Fix t0 null check (Jani)

Reviewed-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220504150440.13748-3-ville.syrjala@linux.intel.com
drivers/gpu/drm/i915/display/intel_bios.c