On Tue, 05 Apr 2022, Ville Syrjala <ville.syrj...@linux.intel.com> wrote:
> From: Ville Syrjälä <ville.syrj...@linux.intel.com>
>
> Dump the panel PNPID and name from the VBT.
>
> Signed-off-by: Ville Syrjälä <ville.syrj...@linux.intel.com>
> ---
>  drivers/gpu/drm/i915/display/intel_bios.c | 24 +++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c 
> b/drivers/gpu/drm/i915/display/intel_bios.c
> index d561551d6324..953526a7dc5d 100644
> --- a/drivers/gpu/drm/i915/display/intel_bios.c
> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
> @@ -25,6 +25,7 @@
>   *
>   */
>  
> +#include <drm/drm_edid.h>
>  #include <drm/dp/drm_dp_helper.h>
>  
>  #include "display/intel_display.h"
> @@ -597,6 +598,19 @@ get_lfp_data_tail(const struct bdb_lvds_lfp_data *data,
>               return NULL;
>  }
>  
> +static void dump_pnp_id(struct drm_i915_private *i915,
> +                     const struct lvds_pnp_id *pnp_id,
> +                     const char *name)
> +{
> +     u16 mfg_name = be16_to_cpu((__force __be16)pnp_id->mfg_name);

Might just add the __be16 in the struct member?

Reviewed-by: Jani Nikula <jani.nik...@intel.com>

> +     char vend[4];
> +
> +     drm_dbg_kms(&i915->drm, "%s PNPID mfg: %s (0x%x), prod: %u, serial: %u, 
> week: %d, year: %d\n",
> +                 name, drm_edid_decode_mfg_id(mfg_name, vend),
> +                 pnp_id->mfg_name, pnp_id->product_code, pnp_id->serial,
> +                 pnp_id->mfg_week, pnp_id->mfg_year + 1990);
> +}
> +
>  static int pnp_id_panel_type(struct drm_i915_private *i915,
>                            const struct edid *edid)
>  {
> @@ -615,6 +629,8 @@ static int pnp_id_panel_type(struct drm_i915_private 
> *i915,
>       edid_id_nodate.mfg_week = 0;
>       edid_id_nodate.mfg_year = 0;
>  
> +     dump_pnp_id(i915, edid_id, "EDID");
> +
>       ptrs = find_section(i915, BDB_LVDS_LFP_DATA_PTRS);
>       if (!ptrs)
>               return -1;
> @@ -802,6 +818,7 @@ parse_lfp_data(struct drm_i915_private *i915)
>       const struct bdb_lvds_lfp_data *data;
>       const struct bdb_lvds_lfp_data_tail *tail;
>       const struct bdb_lvds_lfp_data_ptrs *ptrs;
> +     const struct lvds_pnp_id *pnp_id;
>       int panel_type = i915->vbt.panel_type;
>  
>       ptrs = find_section(i915, BDB_LVDS_LFP_DATA_PTRS);
> @@ -815,10 +832,17 @@ parse_lfp_data(struct drm_i915_private *i915)
>       if (!i915->vbt.lfp_lvds_vbt_mode)
>               parse_lfp_panel_dtd(i915, data, ptrs);
>  
> +     pnp_id = get_lvds_pnp_id(data, ptrs, panel_type);
> +     dump_pnp_id(i915, pnp_id, "Panel");
> +
>       tail = get_lfp_data_tail(data, ptrs);
>       if (!tail)
>               return;
>  
> +     drm_dbg_kms(&i915->drm, "Panel name: %.*s\n",
> +                 (int)sizeof(tail->panel_name[0].name),
> +                 tail->panel_name[panel_type].name);
> +
>       if (i915->vbt.version >= 188) {
>               i915->vbt.seamless_drrs_min_refresh_rate =
>                       tail->seamless_drrs_min_refresh_rate[panel_type];

-- 
Jani Nikula, Intel Open Source Graphics Center

Reply via email to