Re: [PATCH v2 3/4] drm/i915/bios: switch to struct drm_edid and struct drm_edid_product_id

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 09 Apr 2024, Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> wrote:
> On Tue, Apr 09, 2024 at 12:46:11PM +0300, Jani Nikula wrote:
>> To avoid accessing and parsing the raw EDID with drm_edid_raw(), switch
>> to the struct drm_edid based function to extract product id, and use the
>> drm printer function to debug log it.
>> 
>> The underlying assumption is that struct drm_edid_product_id and struct
>> lvds_pnp_id describe identical data, albeit with slightly different
>> member definitions.
>> 
>> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
>> Acked-by: Melissa Wen <mwen@xxxxxxxxxx>
>> Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
>> ---
>>  drivers/gpu/drm/i915/display/intel_bios.c | 43 ++++++++++-------------
>>  1 file changed, 18 insertions(+), 25 deletions(-)
>> 
>> diff --git a/drivers/gpu/drm/i915/display/intel_bios.c b/drivers/gpu/drm/i915/display/intel_bios.c
>> index 2abd2d7ceda2..3d89e4b39fed 100644
>> --- a/drivers/gpu/drm/i915/display/intel_bios.c
>> +++ b/drivers/gpu/drm/i915/display/intel_bios.c
>> @@ -600,6 +600,9 @@ get_lvds_pnp_id(const struct bdb_lvds_lfp_data *data,
>>  		const struct bdb_lvds_lfp_data_ptrs *ptrs,
>>  		int index)
>>  {
>> +	/* These two are supposed to have the same layout in memory. */
>> +	BUILD_BUG_ON(sizeof(struct lvds_pnp_id) != sizeof(struct drm_edid_product_id));
>> +
>>  	return (const void *)data + ptrs->ptr[index].panel_pnp_id.offset;
>>  }
>>  
>> @@ -613,19 +616,6 @@ 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);
>> -	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 opregion_get_panel_type(struct drm_i915_private *i915,
>>  				   const struct intel_bios_encoder_data *devdata,
>>  				   const struct drm_edid *drm_edid, bool use_fallback)
>> @@ -664,21 +654,21 @@ static int pnpid_get_panel_type(struct drm_i915_private *i915,
>>  {
>>  	const struct bdb_lvds_lfp_data *data;
>>  	const struct bdb_lvds_lfp_data_ptrs *ptrs;
>> -	const struct lvds_pnp_id *edid_id;
>> -	struct lvds_pnp_id edid_id_nodate;
>> -	const struct edid *edid = drm_edid_raw(drm_edid); /* FIXME */
>> +	struct drm_edid_product_id product_id, product_id_nodate;
>> +	struct drm_printer p;
>>  	int i, best = -1;
>>  
>> -	if (!edid)
>> +	if (!drm_edid)
>>  		return -1;
>>  
>> -	edid_id = (const void *)&edid->mfg_id[0];
>> +	drm_edid_get_product_id(drm_edid, &product_id);
>
> I don't really like s/edid_id/product_id/ rename.
> The variable names were trying to convey the source of
> the data (EDID vs. VBT).
>
> But not a huge deal wither way. Series is
> Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

Thanks, pushed the lot to drm-misc-next.

BR,
Jani.


-- 
Jani Nikula, Intel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux