mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] video: dw-hdmi: fix I2C controller probe breakage
@ 2024-12-17 14:08 Ahmad Fatoum
  2024-12-17 14:44 ` Alexander Shiyan
  2024-12-20  8:48 ` Sascha Hauer
  0 siblings, 2 replies; 3+ messages in thread
From: Ahmad Fatoum @ 2024-12-17 14:08 UTC (permalink / raw)
  To: barebox; +Cc: Alexander Shiyan, Ahmad Fatoum

The dw-hdmi I2C controller binding doesn't support listing I2C slaves
as child nodes in the device tree. This is fine as the EDID I2C address
is well-known, but trying to parse the dw-hdmi device tree node as if it
were a normal I2C controller will fail:

  ERROR: i2c11: of_i2c: invalid reg on /hdmi@fe0a0000/ports

Fix this by only use the device tree node to find the alias if any and
not passing it alone to the I2C core.

Fixes: 474b6cb42ea5 ("video: dw-hdmi: populate missing I2C adapter device node")
Reported-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/video/dw-hdmi.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/video/dw-hdmi.c b/drivers/video/dw-hdmi.c
index cd5de17e9bd7..b86f3c7366c1 100644
--- a/drivers/video/dw-hdmi.c
+++ b/drivers/video/dw-hdmi.c
@@ -433,9 +433,15 @@ static struct i2c_adapter *dw_hdmi_i2c_adapter(struct dw_hdmi *hdmi)
 
 	adap = &i2c->adap;
 	adap->dev.parent = hdmi->dev;
-	adap->dev.of_node = hdmi->dev->of_node;
 	adap->master_xfer = dw_hdmi_i2c_xfer;
-	adap->nr = -1;
+
+	/*
+	 * The binding doesn't support listing slaves as OF child nodes,
+	 * therefore we use the device tree node only to check if
+	 * there is an alias.
+	 */
+	adap->dev.of_node = NULL;
+	adap->nr = of_alias_get_id(hdmi->dev->of_node, "i2c");
 
 	i2c->rinfo.sda_gpio = of_get_named_gpio_flags(hdmi->dev->of_node,
 							  "sda-gpios", 0,
-- 
2.39.5




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

* Re: [PATCH master] video: dw-hdmi: fix I2C controller probe breakage
  2024-12-17 14:08 [PATCH master] video: dw-hdmi: fix I2C controller probe breakage Ahmad Fatoum
@ 2024-12-17 14:44 ` Alexander Shiyan
  2024-12-20  8:48 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Alexander Shiyan @ 2024-12-17 14:44 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

Thanks!

Tested-by: Alexander Shiyan <eagle.alexander923@gmail.com>

вт, 17 дек. 2024 г. в 17:08, Ahmad Fatoum <a.fatoum@pengutronix.de>:
>
> The dw-hdmi I2C controller binding doesn't support listing I2C slaves
> as child nodes in the device tree. This is fine as the EDID I2C address
> is well-known, but trying to parse the dw-hdmi device tree node as if it
> were a normal I2C controller will fail:
>
>   ERROR: i2c11: of_i2c: invalid reg on /hdmi@fe0a0000/ports
>
> Fix this by only use the device tree node to find the alias if any and
> not passing it alone to the I2C core.
>
> Fixes: 474b6cb42ea5 ("video: dw-hdmi: populate missing I2C adapter device node")
> Reported-by: Alexander Shiyan <eagle.alexander923@gmail.com>
> Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
> ---
>  drivers/video/dw-hdmi.c | 10 ++++++++--
>  1 file changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/dw-hdmi.c b/drivers/video/dw-hdmi.c
> index cd5de17e9bd7..b86f3c7366c1 100644
> --- a/drivers/video/dw-hdmi.c
> +++ b/drivers/video/dw-hdmi.c
> @@ -433,9 +433,15 @@ static struct i2c_adapter *dw_hdmi_i2c_adapter(struct dw_hdmi *hdmi)
>
>         adap = &i2c->adap;
>         adap->dev.parent = hdmi->dev;
> -       adap->dev.of_node = hdmi->dev->of_node;
>         adap->master_xfer = dw_hdmi_i2c_xfer;
> -       adap->nr = -1;
> +
> +       /*
> +        * The binding doesn't support listing slaves as OF child nodes,
> +        * therefore we use the device tree node only to check if
> +        * there is an alias.
> +        */
> +       adap->dev.of_node = NULL;
> +       adap->nr = of_alias_get_id(hdmi->dev->of_node, "i2c");
>
>         i2c->rinfo.sda_gpio = of_get_named_gpio_flags(hdmi->dev->of_node,
>                                                           "sda-gpios", 0,
> --
> 2.39.5
>



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

* Re: [PATCH master] video: dw-hdmi: fix I2C controller probe breakage
  2024-12-17 14:08 [PATCH master] video: dw-hdmi: fix I2C controller probe breakage Ahmad Fatoum
  2024-12-17 14:44 ` Alexander Shiyan
@ 2024-12-20  8:48 ` Sascha Hauer
  1 sibling, 0 replies; 3+ messages in thread
From: Sascha Hauer @ 2024-12-20  8:48 UTC (permalink / raw)
  To: barebox, Ahmad Fatoum; +Cc: Alexander Shiyan


On Tue, 17 Dec 2024 15:08:33 +0100, Ahmad Fatoum wrote:
> The dw-hdmi I2C controller binding doesn't support listing I2C slaves
> as child nodes in the device tree. This is fine as the EDID I2C address
> is well-known, but trying to parse the dw-hdmi device tree node as if it
> were a normal I2C controller will fail:
> 
>   ERROR: i2c11: of_i2c: invalid reg on /hdmi@fe0a0000/ports
> 
> [...]

Applied, thanks!

[1/1] video: dw-hdmi: fix I2C controller probe breakage
      https://git.pengutronix.de/cgit/barebox/commit/?id=a1f21c191888 (link may not be stable)

Best regards,
-- 
Sascha Hauer <s.hauer@pengutronix.de>




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

end of thread, other threads:[~2024-12-20  8:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-17 14:08 [PATCH master] video: dw-hdmi: fix I2C controller probe breakage Ahmad Fatoum
2024-12-17 14:44 ` Alexander Shiyan
2024-12-20  8:48 ` Sascha Hauer

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