Skip to contentSkip to conversation

drm/modes: Make width-mm/height-mm check in of_get_drm_panel_display_mode() mandatory

PATCH In review Marek Vasut 2 participants 5 messages Apr 11, 2022 – Apr 21, 2022

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 drm/modes: Make width-mm/height-mm check in of_get_drm_panel_display_mode() mandatory

All users of this function require width-mm/height-mm DT property to be present per their DT bindings, make width-mm/height-mm check mandatory. It is generally a good idea to specify panel dimensions, so userspace can configure e.g. scaling accordingly.

Cc Christoph Niedermaier <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Dmitry Osipenko <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Noralf Trønnes <[email protected]>
Cc Rob Herring <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Thomas Zimmermann <[email protected]>

To: [email protected]

---
 drivers/gpu/drm/drm_modes.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_modes.c +4 -4
index 6e7e10f16ec03..f0b000ddaddb5 100644
@@ -735,8 +735,8 @@ EXPORT_SYMBOL_GPL(of_get_drm_display_mode);
  * @dmode: will be set to the return value
  * @bus_flags: information about pixelclk, sync and DE polarity
  *
- * The Device Tree properties width-mm and height-mm will be read and set on
- * the display mode if they are present.
+ * The mandatory Device Tree properties width-mm and height-mm
+ * are read and set on the display mode.
  *
  * Returns:
  * Zero on success, negative error code on failure.
@@ -761,11 +761,11 @@ int of_get_drm_panel_display_mode(struct device_node *np,
 		drm_bus_flags_from_videomode(&vm, bus_flags);
 
 	ret = of_property_read_u32(np, "width-mm", &width_mm);
-	if (ret && ret != -EINVAL)
+	if (ret)
 		return ret;
 
 	ret = of_property_read_u32(np, "height-mm", &height_mm);
-	if (ret && ret != -EINVAL)
+	if (ret)
 		return ret;
 
 	dmode->width_mm = width_mm;
Signature · 1 line
2.35.1
#1 lore raw

PATCH 2/2 drm/panel: lvds: Drop now redundant width-mm and height-mm check

The check for mandatory DT properties width-mm and height-mm is now part of of_get_drm_panel_display_mode(), drop the redundant check from this driver.

Cc Christoph Niedermaier <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Dmitry Osipenko <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Noralf Trønnes <[email protected]>
Cc Rob Herring <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Thomas Zimmermann <[email protected]>

To: [email protected]

---
 drivers/gpu/drm/panel/panel-lvds.c | 12 ------------
 1 file changed, 12 deletions(-)
drivers/gpu/drm/panel/panel-lvds.c +0 -12
index eca067e785796..f11252fb00fea 100644
@@ -128,18 +128,6 @@ static int panel_lvds_parse_dt(struct panel_lvds *lvds)
 		return ret;
 	}
 
-	if (lvds->dmode.width_mm == 0) {
-		dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
-			np, "width-mm");
-		return -ENODEV;
-	}
-
-	if (lvds->dmode.height_mm == 0) {
-		dev_err(lvds->dev, "%pOF: invalid or missing %s DT property\n",
-			np, "height-mm");
-		return -ENODEV;
-	}
-
 	of_property_read_string(np, "label", &lvds->label);
 
 	ret = drm_of_lvds_get_data_mapping(np);
Signature · 1 line
2.35.1
Reviewed-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] drm/panel: lvds: Drop now redundant width-mm and height-mm check

Den 11.04.2022 02.47, skrev Marek Vasut:

Quoted 14 lines

The check for mandatory DT properties width-mm and height-mm is now part of of_get_drm_panel_display_mode(), drop the redundant check from this driver.

Cc Christoph Niedermaier <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Dmitry Osipenko <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Noralf Trønnes <[email protected]>
Cc Rob Herring <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Quoted 2 lines

To: [email protected]
---

Reviewed-by on v1 1/2
#3 lore raw
In reply to Marek Vasut

Den 11.04.2022 02.47, skrev Marek Vasut:

Quoted 15 lines

All users of this function require width-mm/height-mm DT property to be present per their DT bindings, make width-mm/height-mm check mandatory. It is generally a good idea to specify panel dimensions, so userspace can configure e.g. scaling accordingly.

Cc Christoph Niedermaier <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc Dmitry Osipenko <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Noralf Trønnes <[email protected]>
Cc Rob Herring <[email protected]>
Cc Robert Foss <[email protected]>
Cc Sam Ravnborg <[email protected]>
Cc Thomas Zimmermann <[email protected]>
Quoted 2 lines

To: [email protected]
---

#4 lore raw
In reply to Marek Vasut
Quoted 4 lines · Marek Vasut

All users of this function require width-mm/height-mm DT property to be present per their DT bindings, make width-mm/height-mm check mandatory. It is generally a good idea to specify panel dimensions, so userspace can configure e.g. scaling accordingly.

I will apply these two patches soon.