[PATCH 1/2] drm/panel: lvds: Simplify mode parsing

Marek Vasut marex at denx.de
Fri Apr 1 16:11:22 UTC 2022


On 4/1/22 17:48, Laurent Pinchart wrote:

Hi,

[...]

>> diff --git a/drivers/gpu/drm/panel/panel-lvds.c b/drivers/gpu/drm/panel/panel-lvds.c
>> index 27a1c9923b09..65c6a6e9e223 100644
>> --- a/drivers/gpu/drm/panel/panel-lvds.c
>> +++ b/drivers/gpu/drm/panel/panel-lvds.c
>> @@ -30,7 +30,8 @@ struct panel_lvds {
>>   	const char *label;
>>   	unsigned int width;
>>   	unsigned int height;
>> -	struct videomode video_mode;
>> +	struct drm_display_mode dmode;
> 
> "dmode" sounds a bit weird, I would have gone for just "mode", or
> "display_mode", but I don't mind much.

That's how the of_get_drm_panel_display_mode() parameter is called in 
drivers/gpu/drm/drm_modes.c , so I'll just keep it for consistency.

[...]

>> -	videomode_from_timing(&timing, &lvds->video_mode);
>> -
>> -	ret = of_property_read_u32(np, "width-mm", &lvds->width);
>> -	if (ret < 0) {
>> -		dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
>> -			np, "width-mm");
>> -		return -ENODEV;
>> -	}
>> -	ret = of_property_read_u32(np, "height-mm", &lvds->height);
>> -	if (ret < 0) {
>> -		dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
>> -			np, "height-mm");
>> -		return -ENODEV;
>> -	}
> 
> of_get_drm_panel_display_mode() doesn't consider missing width-mm or
> height-mm properties as an error. Should we check here that ->width_mm
> and ->height_mm are not 0 ?

I wonder whether we should always require valid width-mm and height-mm 
DT property in of_get_drm_panel_display_mode() instead.

[...]


More information about the dri-devel mailing list