Skip to contentSkip to conversation

media: i2c: tvp7002: feature enhancement

PATCH Superseded Prabhakar Lad 3 participants 11 messages Jun 22, 2013 – Jul 15, 2013

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

v2 cover media: i2c: tvp7002: feature enhancement

From: "Lad, Prabhakar" <[email protected]>

The first patch of the series add support for asynchronous probing and the second patch adds OF support to tvp7002 driver.

Lad, Prabhakar (2):
media: i2c: tvp7002: add support for asynchronous probing
media: i2c: tvp7002: add OF support

 .../devicetree/bindings/media/i2c/tvp7002.txt      |   43 ++++++++++++
 drivers/media/i2c/tvp7002.c                        |   73 ++++++++++++++++++--
 2 files changed, 109 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/tvp7002.txt
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 1/2 media: i2c: tvp7002: add support for asynchronous probing

From: "Lad, Prabhakar" <[email protected]>

Both synchronous and asynchronous tvp7002 subdevice probing is supported by this patch.

Cc Hans Verkuil <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Sylwester Nawrocki <[email protected]>
Cc Sakari Ailus <[email protected]>
---
 drivers/media/i2c/tvp7002.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/media/i2c/tvp7002.c +6 -0
index 36ad565..b577548 100644
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-dv-timings.h>
 #include <media/tvp7002.h>
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-ctrls.h>
@@ -1040,6 +1041,10 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
 	}
 	v4l2_ctrl_handler_setup(&device->hdl);
 
+	error = v4l2_async_register_subdev(&device->sd);
+	if (error)
+		goto error;
+
 	return 0;
 
 error:
@@ -1064,6 +1069,7 @@ static int tvp7002_remove(struct i2c_client *c)
 
 	v4l2_dbg(1, debug, sd, "Removing tvp7002 adapter"
 				"on address 0x%x\n", c->addr);
+	v4l2_async_unregister_subdev(&device->sd);
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	media_entity_cleanup(&device->sd.entity);
 #endif
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v2 1/2] media: i2c: tvp7002: add support for asynchronous probing

Quoted 4 lines · On Sat June 22 2013 19:44:14 Prabhakar Lad wrote:

From: "Lad, Prabhakar" <[email protected]>

Both synchronous and asynchronous tvp7002 subdevice probing is supported by this patch.

Can I merge this patch without patch 2/2? Or should I wait with both until the video sync properties have been approved?

Hans

Quoted 46 lines
Cc Hans Verkuil <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Sylwester Nawrocki <[email protected]>
Cc Sakari Ailus <[email protected]>
---
 drivers/media/i2c/tvp7002.c |    6 ++++++
 1 file changed, 6 insertions(+)
drivers/media/i2c/tvp7002.c +6 -0
index 36ad565..b577548 100644
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/v4l2-dv-timings.h>
 #include <media/tvp7002.h>
+#include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-common.h>
 #include <media/v4l2-ctrls.h>
@@ -1040,6 +1041,10 @@ static int tvp7002_probe(struct i2c_client *c, const struct i2c_device_id *id)
 	}
 	v4l2_ctrl_handler_setup(&device->hdl);
 
+	error = v4l2_async_register_subdev(&device->sd);
+	if (error)
+		goto error;
+
 	return 0;
 
 error:
@@ -1064,6 +1069,7 @@ static int tvp7002_remove(struct i2c_client *c)
 
 	v4l2_dbg(1, debug, sd, "Removing tvp7002 adapter"
 				"on address 0x%x\n", c->addr);
+	v4l2_async_unregister_subdev(&device->sd);
 #if defined(CONFIG_MEDIA_CONTROLLER)
 	media_entity_cleanup(&device->sd.entity);
 #endif
#3 lore raw

Re: [PATCH v2 1/2] media: i2c: tvp7002: add support for asynchronous probing

Hi Hans,

Quoted 9 lines · Hans Verkuil
Quoted 4 lines · On Sat June 22 2013 19:44:14 Prabhakar Lad wrote:

From: "Lad, Prabhakar" <[email protected]>

Both synchronous and asynchronous tvp7002 subdevice probing is supported by this patch.

Can I merge this patch without patch 2/2? Or should I wait with both until the video sync properties have been approved?

You can go ahead and merge this one no need to wait for 2/2, I know the video sync will take more time :)

Regards,
--Prabhakar Lad

#4 lore raw

PATCH v2 2/2 media: i2c: tvp7002: add OF support

In reply to Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

add OF support for the tvp7002 driver.

Cc Hans Verkuil <[email protected]>
Cc Laurent Pinchart <[email protected]>
Cc Mauro Carvalho Chehab <[email protected]>
Cc Guennadi Liakhovetski <[email protected]>
Cc Sylwester Nawrocki <[email protected]>
Cc Sakari Ailus <[email protected]>
Cc Grant Likely <[email protected]>
Cc Rob Herring <[email protected]>
Cc Rob Landley <[email protected]>

---
Depends on patch https://patchwork.kernel.org/patch/2765851/

 .../devicetree/bindings/media/i2c/tvp7002.txt      |   43 +++++++++++++
 drivers/media/i2c/tvp7002.c                        |   67 ++++++++++++++++++--
 2 files changed, 103 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/tvp7002.txt
Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +43 -0
new file mode 100644
index 0000000..9daebe1
@@ -0,0 +1,43 @@
+* Texas Instruments TV7002 video decoder
+
+The TVP7002 device supports digitizing of video and graphics signal in RGB and
+YPbPr color space.
+
+Required Properties :
+- compatible : Must be "ti,tvp7002"
+
+- hsync-active: HSYNC Polarity configuration for endpoint.
+
+- vsync-active: VSYNC Polarity configuration for endpoint.
+
+- pclk-sample: Clock polarity of the endpoint.
+
+- video-sync: Video sync property of the endpoint.
+
+- ti,tvp7002-fid-polarity: Active-high Field ID polarity of the endpoint.
+
+
+For further reading of port node refer Documentation/devicetree/bindings/media/
+video-interfaces.txt.
+
+Example:
+
+	i2c0@1c22000 {
+		...
+		...
+		tvp7002@5c {
+			compatible = "ti,tvp7002";
+			reg = <0x5c>;
+
+			port {
+				tvp7002_1: endpoint {
+					hsync-active = <1>;
+					vsync-active = <1>;
+					pclk-sample = <0>;
+					video-sync = <V4L2_MBUS_VIDEO_SYNC_ON_GREEN>;
+					ti,tvp7002-fid-polarity;
+				};
+			};
+		};
+		...
+	};
drivers/media/i2c/tvp7002.c +60 -7

113 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#5 lore raw

Re: [PATCH v2 2/2] media: i2c: tvp7002: add OF support

Hi,

Quoted 39 lines · Prabhakar Lad

From: "Lad, Prabhakar"<[email protected]>

add OF support for the tvp7002 driver.

Cc Hans Verkuil<[email protected]>
Cc Laurent Pinchart<[email protected]>
Cc Mauro Carvalho Chehab<[email protected]>
Cc Guennadi Liakhovetski<[email protected]>
Cc Sylwester Nawrocki<[email protected]>
Cc Sakari Ailus<[email protected]>
Cc Grant Likely<[email protected]>
Cc Rob Herring<[email protected]>
Cc Rob Landley<[email protected]>

---
Depends on patch https://patchwork.kernel.org/patch/2765851/

  .../devicetree/bindings/media/i2c/tvp7002.txt      |   43 +++++++++++++
  drivers/media/i2c/tvp7002.c                        |   67 ++++++++++++++++++--
  2 files changed, 103 insertions(+), 7 deletions(-)

create mode 100644 Documentation/devicetree/bindings/media/i2c/tvp7002.txt

Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +7 -0
new file mode 100644
index 0000000..9daebe1
@@ -0,0 +1,43 @@
+* Texas Instruments TV7002 video decoder
+
+The TVP7002 device supports digitizing of video and graphics signal in RGB and
+YPbPr color space.
+
+Required Properties :
+- compatible : Must be "ti,tvp7002"

Documentation/devicetree/bindings/media/i2c/tvp7002.txt line 17

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +10 -0
+
+- hsync-active: HSYNC Polarity configuration for endpoint.
+
+- vsync-active: VSYNC Polarity configuration for endpoint.
+
+- pclk-sample: Clock polarity of the endpoint.
+
+- video-sync: Video sync property of the endpoint.
+
+- ti,tvp7002-fid-polarity: Active-high Field ID polarity of the endpoint.

I thought it was agreed 'field-even-active' would be used instead of this device specific property. Did you run into any issues with that ?

Quoted 39 lines
Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +25 -0
+
+For further reading of port node refer Documentation/devicetree/bindings/media/
+video-interfaces.txt.
+
+Example:
+
+	i2c0@1c22000 {
+		...
+		...
+		tvp7002@5c {
+			compatible = "ti,tvp7002";
+			reg =<0x5c>;
+
+			port {
+				tvp7002_1: endpoint {
+					hsync-active =<1>;
+					vsync-active =<1>;
+					pclk-sample =<0>;
+					video-sync =<V4L2_MBUS_VIDEO_SYNC_ON_GREEN>;
+					ti,tvp7002-fid-polarity;
+				};
+			};
+		};
+		...
+	};
drivers/media/i2c/tvp7002.c +2 -0
index b577548..4896024 100644
@@ -35,6 +35,8 @@
  #include<media/v4l2-device.h>
  #include<media/v4l2-common.h>
  #include<media/v4l2-ctrls.h>
+#include<media/v4l2-of.h>
+
  #include "tvp7002_reg.h"
 
  MODULE_DESCRIPTION("TI TVP7002 Video and Graphics Digitizer driver");

drivers/media/i2c/tvp7002.c static const struct v4l2_subdev_ops tvp7002_ops = { · line 949

Quoted 5 lines
drivers/media/i2c/tvp7002.c +2 -0
@@ -943,6 +945,48 @@ static const struct v4l2_subdev_ops tvp7002_ops = {
  	.pad =&tvp7002_pad_ops,
  };
 
+static struct tvp7002_config *
+tvp7002_get_pdata(struct i2c_client *client)

nit: unnecessary line break

Quoted 21 lines
drivers/media/i2c/tvp7002.c +21 -0
+{
+	struct v4l2_of_endpoint bus_cfg;
+	struct tvp7002_config *pdata;
+	struct device_node *endpoint;
+	unsigned int flags;
+
+	if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
+		return client->dev.platform_data;
+
+	endpoint = v4l2_of_get_next_endpoint(client->dev.of_node, NULL);
+	if (!endpoint)
+		return NULL;
+
+	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		goto done;
+
+	v4l2_of_parse_endpoint(endpoint,&bus_cfg);
+	flags = bus_cfg.bus.parallel.flags;
+
+	if (flags&  V4L2_MBUS_HSYNC_ACTIVE_HIGH)

drivers/media/i2c/tvp7002.c static const struct v4l2_subdev_ops tvp7002_ops = { · line 980

Quoted 10 lines
drivers/media/i2c/tvp7002.c +10 -0
+		pdata->hs_polarity = 1;
+
+	if (flags&  V4L2_MBUS_VSYNC_ACTIVE_HIGH)
+		pdata->vs_polarity = 1;
+
+	if (flags&  V4L2_MBUS_PCLK_SAMPLE_RISING)
+		pdata->clk_polarity = 1;
+
+	if (flags&  V4L2_MBUS_VIDEO_SYNC_ON_GREEN)
+		pdata->sog_polarity = 1;

This clearly shows that you're using this property for something different you have defined it for. I asked previously if what you really needed for this TVP7002 chip is a DT property indicating sync-on-green _polarity_ or the sync-on-green _usage_. And you clearly need the polarity information.

So I would just define a standard "sync-on-green-active" property and V4L2_MBUS_VIDEO_SOG_ACTIVE_{HIGH,LOW} flags. Presumably you don't need anything else, and the extra sync polarity flags would need eventually to be defined anyway, independently of any video sync selection property, should something like this ever need to be specified by firmware.

drivers/media/i2c/tvp7002.c static const struct v4l2_subdev_ops tvp7002_ops = { · line 983

Quoted 2 lines
drivers/media/i2c/tvp7002.c +2 -0
+	pdata->fid_polarity = of_property_read_bool(endpoint,
+						    "ti,tvp7002-fid-polarity");

This could be just:

	if (flags & V4L2_MBUS_FIELD_EVEN_HIGH)
		pdata->fid_polarity = 1;

if you used standard 'field-even-active' property.

And this is what we find in the TVP7002 datasheet, in the section describing MISC Control 3 (18h) register's FID POL bit (pdata->fid_polarity is written directly to FID POL):

"FID POL: Active-high Field ID output polarity control. Under normal operation, the field ID output is set to logic 1 for an odd field (field 1) and set to logic 0 for an even field (field 0).
0 = Normal operation (default)
1 = FID output polarity inverted
NOTE: This control bit also affects the polarity of the data enable output when selected (see Test output control [2:0] at subaddress 17h)."

And include/media/tvp70002.h:

* fid_polarity:
* 0 -> the field ID output is set to logic 1 for an odd
* field (field 1) and set to logic 0 for an even
* field (field 0).
* 1 -> operation with polarity inverted.

Do you know if the chip automatically selects video sync source (sync-on-green vs. VSYNC/HSYNC) and there is no need to configure this on the analogue input side ? At least the driver seems to always select the default SOGIN_1 input (TVP7002_IN_MUX_SEL_1 register is set only at initialization time).

Or perhaps it just outputs on SOGOUT, VSOUT, HSOUT lines whatever is fed to its analogue inputs, and any further processing unit need to determine what synchronization signal is present and should be used ?

I suspect that we don't need, e.g. another endpoint node to specify the configuration of the TVP7002 analogue input interface, that would contain a property like video-sync.

drivers/media/i2c/tvp7002.c static const struct v4l2_subdev_ops tvp7002_ops = { · line 988

Quoted 4 lines
drivers/media/i2c/tvp7002.c +4 -0
+done:
+	of_node_put(endpoint);
+	return pdata;
+}

Regards,
Sylwester

#6 lore raw

Re: [PATCH v2 2/2] media: i2c: tvp7002: add OF support

Hi Sylwester,

Thanks for the review.

Quoted 23 lines · Sylwester Nawrocki

Hi,

Quoted 19 lines · Prabhakar Lad

From: "Lad, Prabhakar"<[email protected]>

add OF support for the tvp7002 driver.

Cc Hans Verkuil<[email protected]>
Cc Laurent Pinchart<[email protected]>
Cc Mauro Carvalho Chehab<[email protected]>
Cc Guennadi Liakhovetski<[email protected]>
Cc Sylwester Nawrocki<[email protected]>
Cc Sakari Ailus<[email protected]>
Cc Grant Likely<[email protected]>
Cc Rob Herring<[email protected]>
Cc Rob Landley<[email protected]>

Will take care of this as mentioned in earlier patch.

Quoted 31 lines
Quoted 31 lines

---
Depends on patch https://patchwork.kernel.org/patch/2765851/

  .../devicetree/bindings/media/i2c/tvp7002.txt      |   43 +++++++++++++
  drivers/media/i2c/tvp7002.c                        |   67
++++++++++++++++++--
  2 files changed, 103 insertions(+), 7 deletions(-)

create mode 100644
Documentation/devicetree/bindings/media/i2c/tvp7002.txt

Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +3 -0
new file mode 100644
index 0000000..9daebe1
@@ -0,0 +1,43 @@
+* Texas Instruments TV7002 video decoder
+
+The TVP7002 device supports digitizing of video and graphics signal in

RGB and

Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +10 -0
+YPbPr color space.
+
+Required Properties :
+- compatible : Must be "ti,tvp7002"
+
+- hsync-active: HSYNC Polarity configuration for endpoint.
+
+- vsync-active: VSYNC Polarity configuration for endpoint.
+
+- pclk-sample: Clock polarity of the endpoint.
Quoted 10 lines

Documentation/devicetree/bindings/media/i2c/tvp7002.txt line 17

Quoted 4 lines
Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +4 -0
+
+- video-sync: Video sync property of the endpoint.
+
+- ti,tvp7002-fid-polarity: Active-high Field ID polarity of the endpoint.

I thought it was agreed 'field-even-active' would be used instead of this device specific property. Did you run into any issues with that ?

Argh I some how missed it out, sorry this should be 'field-even-active'

Quoted 44 lines
Quoted 44 lines
Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +2 -0
+
+For further reading of port node refer

Documentation/devicetree/bindings/media/

Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +17 -0
+video-interfaces.txt.
+
+Example:
+
+       i2c0@1c22000 {
+               ...
+               ...
+               tvp7002@5c {
+                       compatible = "ti,tvp7002";
+                       reg =<0x5c>;
+
+                       port {
+                               tvp7002_1: endpoint {
+                                       hsync-active =<1>;
+                                       vsync-active =<1>;
+                                       pclk-sample =<0>;
+                                       video-sync

=<V4L2_MBUS_VIDEO_SYNC_ON_GREEN>;

Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +6 -0
+                                       ti,tvp7002-fid-polarity;
+                               };
+                       };
+               };
+               ...
+       };
drivers/media/i2c/tvp7002.c +2 -0
index b577548..4896024 100644
@@ -35,6 +35,8 @@
  #include<media/v4l2-device.h>
  #include<media/v4l2-common.h>
  #include<media/v4l2-ctrls.h>
+#include<media/v4l2-of.h>
+
  #include "tvp7002_reg.h"
 
  MODULE_DESCRIPTION("TI TVP7002 Video and Graphics Digitizer driver");
@@ -943,6 +945,48 @@ static const struct v4l2_subdev_ops tvp7002_ops = {
        .pad =&tvp7002_pad_ops,
  };
 
Quoted 6 lines

drivers/media/i2c/tvp7002.c static const struct v4l2_subdev_ops tvp7002_ops = { · line 949

Quoted 2 lines
drivers/media/i2c/tvp7002.c +2 -0
+static struct tvp7002_config *
+tvp7002_get_pdata(struct i2c_client *client)

nit: unnecessary line break

Ok

Quoted 42 lines
Quoted 25 lines
drivers/media/i2c/tvp7002.c +24 -0
+{
+       struct v4l2_of_endpoint bus_cfg;
+       struct tvp7002_config *pdata;
+       struct device_node *endpoint;
+       unsigned int flags;
+
+       if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
+               return client->dev.platform_data;
+
+       endpoint = v4l2_of_get_next_endpoint(client->dev.of_node, NULL);
+       if (!endpoint)
+               return NULL;
+
+       pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
+       if (!pdata)
+               goto done;
+
+       v4l2_of_parse_endpoint(endpoint,&bus_cfg);
+       flags = bus_cfg.bus.parallel.flags;
+
+       if (flags&  V4L2_MBUS_HSYNC_ACTIVE_HIGH)
 
+               pdata->hs_polarity = 1;
+
+       if (flags&  V4L2_MBUS_VSYNC_ACTIVE_HIGH)

drivers/media/i2c/tvp7002.c static const struct v4l2_subdev_ops tvp7002_ops = { · line 980

Quoted 10 lines
drivers/media/i2c/tvp7002.c +7 -0
 
+               pdata->vs_polarity = 1;
+
+       if (flags&  V4L2_MBUS_PCLK_SAMPLE_RISING)
 
+               pdata->clk_polarity = 1;
+
+       if (flags&  V4L2_MBUS_VIDEO_SYNC_ON_GREEN)
 
+               pdata->sog_polarity = 1;

This clearly shows that you're using this property for something different you have defined it for. I asked previously if what you really needed for this TVP7002 chip is a DT property indicating sync-on-green _polarity_ or the sync-on-green _usage_. And you clearly need the polarity information.

Quoted 7 lines

So I would just define a standard "sync-on-green-active" property and V4L2_MBUS_VIDEO_SOG_ACTIVE_{HIGH,LOW} flags. Presumably you don't need anything else, and the extra sync polarity flags would need eventually to be defined anyway, independently of any video sync selection property, should something like this ever need to be specified by firmware.

OK

Quoted 5 lines
Quoted 3 lines
drivers/media/i2c/tvp7002.c +2 -0
+       pdata->fid_polarity = of_property_read_bool(endpoint,
+

"ti,tvp7002-fid-polarity");

Quoted 7 lines

This could be just:

if (flags & V4L2_MBUS_FIELD_EVEN_HIGH)
pdata->fid_polarity = 1;

if you used standard 'field-even-active' property.

Agreed.

Quoted 23 lines

And this is what we find in the TVP7002 datasheet, in the section describing MISC Control 3 (18h) register's FID POL bit (pdata->fid_polarity is written directly to FID POL):

"FID POL: Active-high Field ID output polarity control. Under normal operation, the field ID output is set to logic 1 for an odd field (field 1) and set to logic 0 for an even field (field 0).
0 = Normal operation (default)
1 = FID output polarity inverted
NOTE: This control bit also affects the polarity of the data enable output when selected (see Test output control [2:0] at subaddress 17h)."

And include/media/tvp70002.h:

* fid_polarity:
* 0 -> the field ID output is set to logic 1 for an
odd
* field (field 1) and set to logic 0 for an even
* field (field 0).
* 1 -> operation with polarity inverted.

Quoted 7 lines

Do you know if the chip automatically selects video sync source (sync-on-green
vs. VSYNC/HSYNC) and there is no need to configure this on the analogue input
side ? At least the driver seems to always select the default SOGIN_1 input (TVP7002_IN_MUX_SEL_1 register is set only at initialization time).

Yes the driver is selecting the default SOGIN_1 input.

Quoted 4 lines

Or perhaps it just outputs on SOGOUT, VSOUT, HSOUT lines whatever is fed to its analogue inputs, and any further processing unit need to determine what synchronization signal is present and should be used ?

Yes that correct, there is a register (Sync Detect Status) which detects the sync for
you.

Quoted 5 lines

I suspect that we don't need, e.g. another endpoint node to specify the configuration of the TVP7002 analogue input interface, that would contain a property like video-sync.

If I understand correctly you mean if there are two tvp7002 devices connected we don’t need to specify video-sync property, but my question how do we specify this property in common then ?

Regards,
--Prabhakar Lad

#7 lore raw

Re: [PATCH v2 2/2] media: i2c: tvp7002: add OF support

On 07/11/2013 07:09 PM, Prabhakar Lad wrote:
[...]

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +2 -0
new file mode 100644
index 0000000..9daebe1
@@ -0,0 +1,43 @@
+* Texas Instruments TV7002 video decoder
+

[...]

Quoted 8 lines
Quoted 7 lines
Quoted 2 lines

+
+- ti,tvp7002-fid-polarity: Active-high Field ID polarity of the endpoint.

I thought it was agreed 'field-even-active' would be used instead of this device specific property. Did you run into any issues with that ?

Argh I some how missed it out, sorry this should be 'field-even-active'

OK.

Quoted 27 lines
Quoted 10 lines

And include/media/tvp70002.h:

* fid_polarity:
* 0 -> the field ID output is set to logic 1 for an
odd
* field (field 1) and set to logic 0 for an even
* field (field 0).
* 1 -> operation with polarity inverted.

Quoted 7 lines

Do you know if the chip automatically selects video sync source (sync-on-green
vs. VSYNC/HSYNC) and there is no need to configure this on the analogue input
side ? At least the driver seems to always select the default SOGIN_1 input (TVP7002_IN_MUX_SEL_1 register is set only at initialization time).

Yes the driver is selecting the default SOGIN_1 input.

Quoted 4 lines

Or perhaps it just outputs on SOGOUT, VSOUT, HSOUT lines whatever is fed to its analogue inputs, and any further processing unit need to determine what synchronization signal is present and should be used ?

Yes that correct, there is a register (Sync Detect Status) which detects the sync for you.

Quoted 8 lines
Quoted 5 lines

I suspect that we don't need, e.g. another endpoint node to specify the configuration of the TVP7002 analogue input interface, that would contain a property like video-sync.

If I understand correctly you mean if there are two tvp7002 devices connected we don’t need to specify video-sync property, but my question how do we specify this property in common then ?

No, I thought about two port sub-nodes of a single device node, one for the TVP7002 video input and one for the output. But it seems there is no need for that, i.e. to specify the input configuration statically in the firmware. The chip detects the signals automatically, i.e. it uses whatever is available, and it allows querying the selection status at run time. What would really need to be configured statically in DT in that case then ? Some initial video sync configuration ? I guess it could be well hard coded in the driver, since the hardware does run time detection anyway.

It there are real use cases I gues we could add video-sync property or similar, besides the existing signal polarity properties.

--
Thanks,
Sylwester

#8 lore raw

Re: [PATCH v2 2/2] media: i2c: tvp7002: add OF support

Quoted 73 lines · Sylwester Nawrocki

On 07/11/2013 07:09 PM, Prabhakar Lad wrote:
[...]

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Documentation/devicetree/bindings/media/i2c/tvp7002.txt new file +2 -0
new file mode 100644
index 0000000..9daebe1
@@ -0,0 +1,43 @@
+* Texas Instruments TV7002 video decoder
+

[...]

Quoted 10 lines
Quoted 9 lines
Quoted 3 lines

+
+- ti,tvp7002-fid-polarity: Active-high Field ID polarity of the endpoint.

I thought it was agreed 'field-even-active' would be used instead of this device specific property. Did you run into any issues with that ?

Argh I some how missed it out, sorry this should be 'field-even-active'

OK.

Quoted 37 lines
Quoted 12 lines

And include/media/tvp70002.h:

* fid_polarity:
* 0 -> the field ID output is set to logic 1 for
an
odd
* field (field 1) and set to logic 0 for an
even
* field (field 0).
* 1 -> operation with polarity inverted.

Quoted 8 lines

Do you know if the chip automatically selects video sync source (sync-on-green
vs. VSYNC/HSYNC) and there is no need to configure this on the analogue input
side ? At least the driver seems to always select the default SOGIN_1 input
(TVP7002_IN_MUX_SEL_1 register is set only at initialization time).

Yes the driver is selecting the default SOGIN_1 input.

Quoted 6 lines

Or perhaps it just outputs on SOGOUT, VSOUT, HSOUT lines whatever is fed to
its analogue inputs, and any further processing unit need to determine what
synchronization signal is present and should be used ?

Yes that correct, there is a register (Sync Detect Status) which detects the sync for you.

Quoted 5 lines

I suspect that we don't need, e.g. another endpoint node to specify the configuration of the TVP7002 analogue input interface, that would contain a property like video-sync.

Quoted 4 lines

If I understand correctly you mean if there are two tvp7002 devices connected
we don’t need to specify video-sync property, but my question how do we specify this property in common then ?

Quoted 13 lines

No, I thought about two port sub-nodes of a single device node, one for the TVP7002 video input and one for the output. But it seems there is no need for that, i.e. to specify the input configuration statically in the firmware.
The chip detects the signals automatically, i.e. it uses whatever is available,
and it allows querying the selection status at run time. What would really need to be configured statically in DT in that case then ? Some initial video
sync configuration ? I guess it could be well hard coded in the driver, since
the hardware does run time detection anyway.

Yes the chip detects the signal automatically, What I want to configure in the DT case is say if SOG signal is detected, I want to invert the polarity of it this is what I am trying to set in DT case whether to invert or not. 0 = Normal operation (default)
1 = SOG output polarity inverted

Something similar to fid_polarity.

Regards,
--Prabhakar Lad

#9 lore raw

Re: [PATCH v2 2/2] media: i2c: tvp7002: add OF support

Hi Prabhakar,

Quoted 3 lines · Prabhakar Lad
Quoted 1 line · Sylwester Nawrocki

On 07/11/2013 07:09 PM, Prabhakar Lad wrote:

[...]

Quoted 56 lines
Quoted 43 lines
Quoted 37 lines
Quoted 12 lines

And include/media/tvp70002.h:

* fid_polarity:
* 0 -> the field ID output is set to logic 1 for
an
odd
* field (field 1) and set to logic 0 for an
even
* field (field 0).
* 1 -> operation with polarity inverted.

Quoted 8 lines

Do you know if the chip automatically selects video sync source (sync-on-green
vs. VSYNC/HSYNC) and there is no need to configure this on the analogue input
side ? At least the driver seems to always select the default SOGIN_1 input
(TVP7002_IN_MUX_SEL_1 register is set only at initialization time).

Yes the driver is selecting the default SOGIN_1 input.

Quoted 6 lines

Or perhaps it just outputs on SOGOUT, VSOUT, HSOUT lines whatever is fed to
its analogue inputs, and any further processing unit need to determine what
synchronization signal is present and should be used ?

Yes that correct, there is a register (Sync Detect Status) which detects the sync for you.

Quoted 5 lines

I suspect that we don't need, e.g. another endpoint node to specify the configuration of the TVP7002 analogue input interface, that would contain a property like video-sync.

Quoted 4 lines

If I understand correctly you mean if there are two tvp7002 devices connected
we don’t need to specify video-sync property, but my question how do we specify this property in common then ?

Quoted 13 lines

No, I thought about two port sub-nodes of a single device node, one for the TVP7002 video input and one for the output. But it seems there is no need for that, i.e. to specify the input configuration statically in the firmware.
The chip detects the signals automatically, i.e. it uses whatever is available,
and it allows querying the selection status at run time. What would really need to be configured statically in DT in that case then ? Some initial video
sync configuration ? I guess it could be well hard coded in the driver, since
the hardware does run time detection anyway.

Quoted 7 lines

Yes the chip detects the signal automatically, What I want to configure in the DT case is say if SOG signal is detected, I want to invert the polarity of it this is what I am trying to set in DT case whether to invert or not. 0 = Normal operation (default)
1 = SOG output polarity inverted

Something similar to fid_polarity.

Then as I suggested earlier, let's just add 'sync-on-green-active' DT property for that. I wouldn't expect the DT properties to be directly replacing your driver platform_data members. Saying in the binding that this is a normal operation and that is an inverted one is not very useful in general, as you would need to dig in the binding's description what "normal" exactly means. sync-on-green-active = <1>; seems much more explicit than, e.g. sync-on-green-inverted. By looking at the sync-on-green-active property each device driver would determine whether it means normal or inverted operation for its device.

--
Thanks,
Sylwester

#10 lore raw

Re: [PATCH v2 2/2] media: i2c: tvp7002: add OF support

Hi Sylwester,

Quoted 2 lines · Sylwester Nawrocki

Hi Prabhakar,

[Snip]

Quoted 13 lines
Quoted 1 line

Something similar to fid_polarity.

Then as I suggested earlier, let's just add 'sync-on-green-active' DT property for that. I wouldn't expect the DT properties to be directly replacing your driver platform_data members. Saying in the binding that this is a normal operation and that is an inverted one is not very useful in general, as you would need to dig in the binding's description what "normal" exactly means. sync-on-green-active = <1>; seems much more explicit than, e.g. sync-on-green-inverted. By looking at the sync-on-green-active property each device driver would determine whether it means normal or inverted operation for its device.

Ok so I'll add 'sync-on-green-active' property and parse it in v4l2_of_parse_parallel_bus()
and add it as part of flags. and define the following flags in mediabus.h

V4L2_MBUS_VIDEO_SOG_ACTIVE_{HIGH,LOW}.

Hope you are OK with it.

--
Regards,
Prabhakar Lad