]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drm/i915/bios: Extract struct lvds_lfp_data_ptr_table
authorVille Syrjälä <ville.syrjala@linux.intel.com>
Thu, 17 Mar 2022 17:19:38 +0000 (19:19 +0200)
committerVille Syrjälä <ville.syrjala@linux.intel.com>
Mon, 4 Apr 2022 14:09:52 +0000 (17:09 +0300)
All the LFP data table pointers have uniform layout. Turn
that into a struct.

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

index 3f3e8ccd902656e52299e58315dc44572f187649..556169ce05441f5a354fac43278e550a8f146b16 100644 (file)
@@ -180,11 +180,11 @@ get_lvds_dvo_timing(const struct bdb_lvds_lfp_data *lvds_lfp_data,
         */
 
        int lfp_data_size =
-               lvds_lfp_data_ptrs->ptr[1].dvo_timing_offset -
-               lvds_lfp_data_ptrs->ptr[0].dvo_timing_offset;
+               lvds_lfp_data_ptrs->ptr[1].dvo_timing.offset -
+               lvds_lfp_data_ptrs->ptr[0].dvo_timing.offset;
        int dvo_timing_offset =
-               lvds_lfp_data_ptrs->ptr[0].dvo_timing_offset -
-               lvds_lfp_data_ptrs->ptr[0].fp_timing_offset;
+               lvds_lfp_data_ptrs->ptr[0].dvo_timing.offset -
+               lvds_lfp_data_ptrs->ptr[0].fp_timing.offset;
        char *entry = (char *)lvds_lfp_data->data + lfp_data_size * index;
 
        return (struct lvds_dvo_timing *)(entry + dvo_timing_offset);
@@ -205,7 +205,7 @@ get_lvds_fp_timing(const struct bdb_header *bdb,
 
        if (index >= ARRAY_SIZE(ptrs->ptr))
                return NULL;
-       ofs = ptrs->ptr[index].fp_timing_offset;
+       ofs = ptrs->ptr[index].fp_timing.offset;
        if (ofs < data_ofs ||
            ofs + sizeof(struct lvds_fp_timing) > data_ofs + data_size)
                return NULL;
index e0508990df486c93a3dbfd3d0610e40a6c0675f3..d727fcd6cdab9b70cde0ef7e5069e15c88a6e7b3 100644 (file)
@@ -722,15 +722,16 @@ struct bdb_lvds_options {
 /*
  * Block 41 - LFP Data Table Pointers
  */
+struct lvds_lfp_data_ptr_table {
+       u16 offset; /* offsets are from start of bdb */
+       u8 table_size;
+} __packed;
 
 /* LFP pointer table contains entries to the struct below */
 struct lvds_lfp_data_ptr {
-       u16 fp_timing_offset; /* offsets are from start of bdb */
-       u8 fp_table_size;
-       u16 dvo_timing_offset;
-       u8 dvo_table_size;
-       u16 panel_pnp_id_offset;
-       u8 pnp_table_size;
+       struct lvds_lfp_data_ptr_table fp_timing;
+       struct lvds_lfp_data_ptr_table dvo_timing;
+       struct lvds_lfp_data_ptr_table panel_pnp_id;
 } __packed;
 
 struct bdb_lvds_lfp_data_ptrs {