Re: [PATCH v2 05/12] drm/imx: ldb: drop custom EDID support

2024-05-29 Thread Philipp Zabel
On So, 2024-03-31 at 23:29 +0300, Dmitry Baryshkov wrote:
> Bindings for the imx-ldb never allowed specifying the EDID in DT. None
> of the existing DT files use it. Drop it now in favour of using debugfs
> overrides or the drm.edid_firmware support.
> 
> Signed-off-by: Dmitry Baryshkov 

Reviewed-by: Philipp Zabel 

regards
Philipp



[PATCH v2 05/12] drm/imx: ldb: drop custom EDID support

2024-03-31 Thread Dmitry Baryshkov
Bindings for the imx-ldb never allowed specifying the EDID in DT. None
of the existing DT files use it. Drop it now in favour of using debugfs
overrides or the drm.edid_firmware support.

Signed-off-by: Dmitry Baryshkov 
---
 drivers/gpu/drm/imx/ipuv3/imx-ldb.c | 27 ++-
 1 file changed, 10 insertions(+), 17 deletions(-)

diff --git a/drivers/gpu/drm/imx/ipuv3/imx-ldb.c 
b/drivers/gpu/drm/imx/ipuv3/imx-ldb.c
index 71d70194fcbd..1924d8921c62 100644
--- a/drivers/gpu/drm/imx/ipuv3/imx-ldb.c
+++ b/drivers/gpu/drm/imx/ipuv3/imx-ldb.c
@@ -72,7 +72,6 @@ struct imx_ldb_channel {
struct device_node *child;
struct i2c_adapter *ddc;
int chno;
-   void *edid;
struct drm_display_mode mode;
int mode_valid;
u32 bus_format;
@@ -142,13 +141,16 @@ static int imx_ldb_connector_get_modes(struct 
drm_connector *connector)
if (num_modes > 0)
return num_modes;
 
-   if (!imx_ldb_ch->edid && imx_ldb_ch->ddc)
-   imx_ldb_ch->edid = drm_get_edid(connector, imx_ldb_ch->ddc);
+   if (imx_ldb_ch->ddc) {
+   const struct drm_edid *edid = drm_edid_read_ddc(connector,
+   
imx_ldb_ch->ddc);
 
-   if (imx_ldb_ch->edid) {
-   drm_connector_update_edid_property(connector,
-   imx_ldb_ch->edid);
-   num_modes = drm_add_edid_modes(connector, imx_ldb_ch->edid);
+   if (edid) {
+   drm_edid_connector_update(connector, edid);
+   drm_edid_free(edid);
+
+   return drm_edid_connector_add_modes(connector);
+   }
}
 
if (imx_ldb_ch->mode_valid) {
@@ -553,7 +555,6 @@ static int imx_ldb_panel_ddc(struct device *dev,
struct imx_ldb_channel *channel, struct device_node *child)
 {
struct device_node *ddc_node;
-   const u8 *edidp;
int ret;
 
ddc_node = of_parse_phandle(child, "ddc-i2c-bus", 0);
@@ -567,17 +568,10 @@ static int imx_ldb_panel_ddc(struct device *dev,
}
 
if (!channel->ddc) {
-   int edid_len;
-
/* if no DDC available, fallback to hardcoded EDID */
dev_dbg(dev, "no ddc available\n");
 
-   edidp = of_get_property(child, "edid", &edid_len);
-   if (edidp) {
-   channel->edid = kmemdup(edidp, edid_len, GFP_KERNEL);
-   if (!channel->edid)
-   return -ENOMEM;
-   } else if (!channel->panel) {
+   if (!channel->panel) {
/* fallback to display-timings node */
ret = of_get_drm_display_mode(child,
  &channel->mode,
@@ -744,7 +738,6 @@ static void imx_ldb_remove(struct platform_device *pdev)
for (i = 0; i < 2; i++) {
struct imx_ldb_channel *channel = &imx_ldb->channel[i];
 
-   kfree(channel->edid);
i2c_put_adapter(channel->ddc);
}
 

-- 
2.39.2