mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH v1] video: edid: print debug message on EDID read out error
@ 2023-09-28 12:21 Oleksij Rempel
  2023-10-04  7:40 ` Sascha Hauer
  2023-10-05  6:44 ` Ahmad Fatoum
  0 siblings, 2 replies; 3+ messages in thread
From: Oleksij Rempel @ 2023-09-28 12:21 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

From: Ahmad Fatoum <a.fatoum@pengutronix.de>

EDID readout errors happen often, e.g. because the HDMI port doesn't
have a display connected. However, when a monitor is connected, but some
other error occurs, barebox is silent. Add a debug message with an error
code for this.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/video/edid.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/video/edid.c b/drivers/video/edid.c
index d2757185f6..2baf6646d9 100644
--- a/drivers/video/edid.c
+++ b/drivers/video/edid.c
@@ -852,20 +852,27 @@ edid_do_read_i2c(struct i2c_adapter *adapter, unsigned char *buf,
 		ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
 	} while (ret != xfers && --retries);
 
-	return ret == xfers ? 0 : -1;
+	if (ret == 0)
+		ret = -EPROTO;
+
+	return ret == xfers ? 0 : ret;
 }
 
 void *edid_read_i2c(struct i2c_adapter *adapter)
 {
 	u8 *block;
+	int ret;
 
 	if (!IS_ENABLED(CONFIG_I2C))
 		return NULL;
 
 	block = xmalloc(EDID_LENGTH);
 
-	if (edid_do_read_i2c(adapter, block, 0, EDID_LENGTH))
+	ret = edid_do_read_i2c(adapter, block, 0, EDID_LENGTH);
+	if (ret) {
+		dev_dbg(&adapter->dev, "EDID readout failed: %pe\n", ERR_PTR(ret));
 		goto out;
+	}
 
 	return block;
 out:
-- 
2.39.2




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] video: edid: print debug message on EDID read out error
  2023-09-28 12:21 [PATCH v1] video: edid: print debug message on EDID read out error Oleksij Rempel
@ 2023-10-04  7:40 ` Sascha Hauer
  2023-10-05  6:44 ` Ahmad Fatoum
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2023-10-04  7:40 UTC (permalink / raw)
  To: Oleksij Rempel; +Cc: barebox, Ahmad Fatoum

On Thu, Sep 28, 2023 at 02:21:33PM +0200, Oleksij Rempel wrote:
> From: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
> EDID readout errors happen often, e.g. because the HDMI port doesn't
> have a display connected. However, when a monitor is connected, but some
> other error occurs, barebox is silent. Add a debug message with an error
> code for this.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/video/edid.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/video/edid.c b/drivers/video/edid.c
> index d2757185f6..2baf6646d9 100644
> --- a/drivers/video/edid.c
> +++ b/drivers/video/edid.c
> @@ -852,20 +852,27 @@ edid_do_read_i2c(struct i2c_adapter *adapter, unsigned char *buf,
>  		ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
>  	} while (ret != xfers && --retries);
>  
> -	return ret == xfers ? 0 : -1;
> +	if (ret == 0)
> +		ret = -EPROTO;
> +
> +	return ret == xfers ? 0 : ret;
>  }
>  
>  void *edid_read_i2c(struct i2c_adapter *adapter)
>  {
>  	u8 *block;
> +	int ret;
>  
>  	if (!IS_ENABLED(CONFIG_I2C))
>  		return NULL;
>  
>  	block = xmalloc(EDID_LENGTH);
>  
> -	if (edid_do_read_i2c(adapter, block, 0, EDID_LENGTH))
> +	ret = edid_do_read_i2c(adapter, block, 0, EDID_LENGTH);
> +	if (ret) {
> +		dev_dbg(&adapter->dev, "EDID readout failed: %pe\n", ERR_PTR(ret));
>  		goto out;
> +	}
>  
>  	return block;
>  out:
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v1] video: edid: print debug message on EDID read out error
  2023-09-28 12:21 [PATCH v1] video: edid: print debug message on EDID read out error Oleksij Rempel
  2023-10-04  7:40 ` Sascha Hauer
@ 2023-10-05  6:44 ` Ahmad Fatoum
  1 sibling, 0 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2023-10-05  6:44 UTC (permalink / raw)
  To: Oleksij Rempel, barebox

Hello Oleksij,

On 28.09.23 14:21, Oleksij Rempel wrote:
> From: Ahmad Fatoum <a.fatoum@pengutronix.de>
> 
> EDID readout errors happen often, e.g. because the HDMI port doesn't
> have a display connected. However, when a monitor is connected, but some
> other error occurs, barebox is silent. Add a debug message with an error
> code for this.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

This patch had been posted before and Marco had an objection to it:
https://lore.barebox.org/barebox/20221223090605.zis4mcft72crswfm@pengutronix.de/

> ---
>  drivers/video/edid.c | 11 +++++++++--
>  1 file changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/video/edid.c b/drivers/video/edid.c
> index d2757185f6..2baf6646d9 100644
> --- a/drivers/video/edid.c
> +++ b/drivers/video/edid.c
> @@ -852,20 +852,27 @@ edid_do_read_i2c(struct i2c_adapter *adapter, unsigned char *buf,
>  		ret = i2c_transfer(adapter, &msgs[3 - xfers], xfers);
>  	} while (ret != xfers && --retries);
>  
> -	return ret == xfers ? 0 : -1;
> +	if (ret == 0)
> +		ret = -EPROTO;
> +
> +	return ret == xfers ? 0 : ret;
>  }
>  
>  void *edid_read_i2c(struct i2c_adapter *adapter)
>  {
>  	u8 *block;
> +	int ret;
>  
>  	if (!IS_ENABLED(CONFIG_I2C))
>  		return NULL;
>  
>  	block = xmalloc(EDID_LENGTH);
>  
> -	if (edid_do_read_i2c(adapter, block, 0, EDID_LENGTH))
> +	ret = edid_do_read_i2c(adapter, block, 0, EDID_LENGTH);
> +	if (ret) {
> +		dev_dbg(&adapter->dev, "EDID readout failed: %pe\n", ERR_PTR(ret));
>  		goto out;
> +	}
>  
>  	return block;
>  out:

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-10-05  6:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-09-28 12:21 [PATCH v1] video: edid: print debug message on EDID read out error Oleksij Rempel
2023-10-04  7:40 ` Sascha Hauer
2023-10-05  6:44 ` Ahmad Fatoum

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox