diff mbox

[v5,06/11] imx-drm: imx-tve: Fix DDC I2C bus property

Message ID 1394011262-16849-7-git-send-email-p.zabel@pengutronix.de (mailing list archive)
State New, archived
Headers show

Commit Message

Philipp Zabel March 5, 2014, 9:20 a.m. UTC
This patch fixes the TV Encoder DDC I2C bus property to use the common
'ddc-i2c-bus' property name instead of 'ddc'.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/staging/imx-drm/imx-tve.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Russell King - ARM Linux March 6, 2014, 1:03 p.m. UTC | #1
On Wed, Mar 05, 2014 at 10:20:57AM +0100, Philipp Zabel wrote:
> This patch fixes the TV Encoder DDC I2C bus property to use the common
> 'ddc-i2c-bus' property name instead of 'ddc'.

Looking at both hdmi and tve, the ddc part is very similar.  The difference
is how the probe is handled:

imx-hdmi:
        ddc_node = of_parse_phandle(np, "ddc", 0);
        if (ddc_node) {
                hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
                if (!hdmi->ddc)
                        dev_dbg(hdmi->dev, "failed to read ddc node\n");

                of_node_put(ddc_node);
        } else {
                dev_dbg(hdmi->dev, "no ddc property found\n");
        }

imx-tve:
        ddc_node = of_parse_phandle(np, "ddc", 0);
        if (ddc_node) {
                tve->ddc = of_find_i2c_adapter_by_node(ddc_node);
                of_node_put(ddc_node);
        }

It appears to differ only by debug prints - is there any reason we
couldn't unify the DDC backend part?  I've tinkered with this idea,
and already have a patch, though it needs a little rework.

Any thoughts?
Philipp Zabel March 6, 2014, 1:32 p.m. UTC | #2
Hi Russell,

Am Donnerstag, den 06.03.2014, 13:03 +0000 schrieb Russell King - ARM
Linux:
> On Wed, Mar 05, 2014 at 10:20:57AM +0100, Philipp Zabel wrote:
> > This patch fixes the TV Encoder DDC I2C bus property to use the common
> > 'ddc-i2c-bus' property name instead of 'ddc'.
> 
> Looking at both hdmi and tve, the ddc part is very similar.  The difference
> is how the probe is handled:
> 
> imx-hdmi:
>         ddc_node = of_parse_phandle(np, "ddc", 0);
>         if (ddc_node) {
>                 hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
>                 if (!hdmi->ddc)
>                         dev_dbg(hdmi->dev, "failed to read ddc node\n");
> 
>                 of_node_put(ddc_node);
>         } else {
>                 dev_dbg(hdmi->dev, "no ddc property found\n");
>         }
> 
> imx-tve:
>         ddc_node = of_parse_phandle(np, "ddc", 0);
>         if (ddc_node) {
>                 tve->ddc = of_find_i2c_adapter_by_node(ddc_node);
>                 of_node_put(ddc_node);
>         }

panel-simple.c
        ddc = of_parse_phandle(dev->of_node, "ddc-i2c-bus", 0);
        if (ddc) {
                panel->ddc = of_find_i2c_adapter_by_node(ddc);
                of_node_put(ddc);

                if (!panel->ddc) {
                        err = -EPROBE_DEFER;
                        goto free_backlight;
                }
        }

>It appears to differ only by debug prints - is there any reason we
> couldn't unify the DDC backend part?  I've tinkered with this idea,
> and already have a patch, though it needs a little rework.
> 
> Any thoughts?

there should be a generic helper for obtaining the DDC I2C adapter from
the device tree. I'd prefer not to stall the imx-drm-dt series on this,
though.

regards
Philipp
diff mbox

Patch

diff --git a/drivers/staging/imx-drm/imx-tve.c b/drivers/staging/imx-drm/imx-tve.c
index 50b25f1..575533f 100644
--- a/drivers/staging/imx-drm/imx-tve.c
+++ b/drivers/staging/imx-drm/imx-tve.c
@@ -582,7 +582,7 @@  static int imx_tve_bind(struct device *dev, struct device *master, void *data)
 	tve->dev = dev;
 	spin_lock_init(&tve->lock);
 
-	ddc_node = of_parse_phandle(np, "ddc", 0);
+	ddc_node = of_parse_phandle(np, "i2c-ddc-bus", 0);
 	if (ddc_node) {
 		tve->ddc = of_find_i2c_adapter_by_node(ddc_node);
 		of_node_put(ddc_node);