Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1328027 > unrolled thread

[PATCH 0/8] [media] tvp5150: add HW input connectors support

Started byJavier Martinez Canillas <javier@osg.samsung.com>
First post2016-02-05 20:20 +0100
Last post2016-02-08 19:30 +0100
Articles 6 — 1 participant

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/8] [media] tvp5150: add HW input connectors support Javier Martinez Canillas <javier@osg.samsung.com> - 2016-02-05 20:20 +0100
    [PATCH 2/8] [media] v4l2-async: call registered_async after subdev registration Javier Martinez Canillas <javier@osg.samsung.com> - 2016-02-05 20:20 +0100
    [PATCH 4/8] [media] tvp5150: store dev id and rom version Javier Martinez Canillas <javier@osg.samsung.com> - 2016-02-05 20:20 +0100
    [PATCH 5/8] [media] tvp5150: add internal signal generator to HW input list Javier Martinez Canillas <javier@osg.samsung.com> - 2016-02-05 20:20 +0100
    [PATCH 7/8] [media] tvp5150: document input connectors DT bindings Javier Martinez Canillas <javier@osg.samsung.com> - 2016-02-05 20:20 +0100
      Re: [PATCH 7/8] [media] tvp5150: document input connectors DT  bindings Javier Martinez Canillas <javier@osg.samsung.com> - 2016-02-08 19:30 +0100

#1328027 — [PATCH 0/8] [media] tvp5150: add HW input connectors support

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-02-05 20:20 +0100
Subject[PATCH 0/8] [media] tvp5150: add HW input connectors support
Message-ID<qYU5b-4l7-9@gated-at.bofh.it>
Hello,

One of my test machines for MC is an IGEPv2 board that has a tvp5151
decoder attached to the OMAP3 ISP bridge.

The board has 2 composite RCA input connectors on it but I've no way
to switch those using the MC framework.

The driver currently uses the s_routing callback to change the input
but the documentation is clear that user level input IDs should never
be used (e.g. Composite, S-Video, etc). See: include/media/v4l2-subdev.h.

Also, these are HW blocks and other interface-centric drivers use
media entities to represent the input connectors (i.e: au0828 and
cx231xx) so this patch series do the same for the tvp5150 driver.

By having media entities for the input connectors, switching the
current input can be easily done with the MEDIA_IOC_SETUP_LINK ioctl:

$ media-ctl -r -l '"Composite0":0->"tvp5150 1-005c":0[1]'

Since the driver is responsible for registering the media entities
and creating the pad links, the associated v4l2 media device is needed.

But the driver registers the sub-dev using v4l2_async_register_subdev()
so a subdev core operation operating has been added so the v4l2 async
core can invoke the driver's initialization routing after the sub-dev
has been registered.

Please let me know if you think there's a better way to solve this.

Best regards,
Javier


Javier Martinez Canillas (8):
  [media] v4l2-subdev: add registered_async subdev core operation
  [media] v4l2-async: call registered_async after subdev registration
  [media] tvp5150: put endpoint node on error
  [media] tvp5150: store dev id and rom version
  [media] tvp5150: add internal signal generator to HW input list
  [media] tvp5150: move input definition header to dt-bindings
  [media] tvp5150: document input connectors DT bindings
  [media] tvp5150: add HW input connectors support

 .../devicetree/bindings/media/i2c/tvp5150.txt      |  43 +++++
 drivers/media/i2c/tvp5150.c                        | 179 +++++++++++++++++++--
 drivers/media/v4l2-core/v4l2-async.c               |   7 +
 include/{media/i2c => dt-bindings/media}/tvp5150.h |   9 +-
 include/media/v4l2-subdev.h                        |   3 +
 5 files changed, 226 insertions(+), 15 deletions(-)
 rename include/{media/i2c => dt-bindings/media}/tvp5150.h (85%)

-- 
2.5.0

[toc] | [next] | [standalone]


#1328028 — [PATCH 2/8] [media] v4l2-async: call registered_async after subdev registration

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-02-05 20:20 +0100
Subject[PATCH 2/8] [media] v4l2-async: call registered_async after subdev registration
Message-ID<qYU5c-4l7-27@gated-at.bofh.it>
In reply to#1328027
V4L2 sub-devices might need to do initialization that depends on being
registered with a V4L2 device. As an example, sub-devices with Media
Controller support may need to register entities and create pad links.

Execute the registered_async callback after the sub-device has been
registered with the V4L2 device so the driver can do any needed init.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/v4l2-core/v4l2-async.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c
index 5bada202b2d3..716bfd47daab 100644
--- a/drivers/media/v4l2-core/v4l2-async.c
+++ b/drivers/media/v4l2-core/v4l2-async.c
@@ -119,6 +119,13 @@ static int v4l2_async_test_notify(struct v4l2_async_notifier *notifier,
 		return ret;
 	}
 
+	ret = v4l2_subdev_call(sd, core, registered_async);
+	if (ret < 0) {
+		if (notifier->unbind)
+			notifier->unbind(notifier, sd, asd);
+		return ret;
+	}
+
 	if (list_empty(&notifier->waiting) && notifier->complete)
 		return notifier->complete(notifier);
 
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1328030 — [PATCH 4/8] [media] tvp5150: store dev id and rom version

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-02-05 20:20 +0100
Subject[PATCH 4/8] [media] tvp5150: store dev id and rom version
Message-ID<qYU5c-4l7-33@gated-at.bofh.it>
In reply to#1328027
Not all tvp5150 variants support the same, for example some have an
internal signal generator that can output a black screen.

So the device id and rom version have to be stored in the driver's
state to know what variant is a given device.

While being there, remove some redundant comments about the device
version since there is already calls to v4l2_info() with that info.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 drivers/media/i2c/tvp5150.c | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)

diff --git a/drivers/media/i2c/tvp5150.c b/drivers/media/i2c/tvp5150.c
index c7eeb59a999b..093ff80f944c 100644
--- a/drivers/media/i2c/tvp5150.c
+++ b/drivers/media/i2c/tvp5150.c
@@ -49,6 +49,9 @@ struct tvp5150 {
 	u32 output;
 	int enable;
 
+	u16 dev_id;
+	u16 rom_ver;
+
 	enum v4l2_mbus_type mbus_type;
 };
 
@@ -1180,8 +1183,6 @@ static int tvp5150_detect_version(struct tvp5150 *core)
 	struct v4l2_subdev *sd = &core->sd;
 	struct i2c_client *c = v4l2_get_subdevdata(sd);
 	unsigned int i;
-	u16 dev_id;
-	u16 rom_ver;
 	u8 regs[4];
 	int res;
 
@@ -1196,23 +1197,25 @@ static int tvp5150_detect_version(struct tvp5150 *core)
 		regs[i] = res;
 	}
 
-	dev_id = (regs[0] << 8) | regs[1];
-	rom_ver = (regs[2] << 8) | regs[3];
+	core->dev_id = (regs[0] << 8) | regs[1];
+	core->rom_ver = (regs[2] << 8) | regs[3];
 
 	v4l2_info(sd, "tvp%04x (%u.%u) chip found @ 0x%02x (%s)\n",
-		  dev_id, regs[2], regs[3], c->addr << 1, c->adapter->name);
+		  core->dev_id, regs[2], regs[3], c->addr << 1,
+		  c->adapter->name);
 
-	if (dev_id == 0x5150 && rom_ver == 0x0321) { /* TVP51510A */
+	if (core->dev_id == 0x5150 && core->rom_ver == 0x0321) {
 		v4l2_info(sd, "tvp5150a detected.\n");
-	} else if (dev_id == 0x5150 && rom_ver == 0x0400) { /* TVP5150AM1 */
+	} else if (core->dev_id == 0x5150 && core->rom_ver == 0x0400) {
 		v4l2_info(sd, "tvp5150am1 detected.\n");
 
 		/* ITU-T BT.656.4 timing */
 		tvp5150_write(sd, TVP5150_REV_SELECT, 0);
-	} else if (dev_id == 0x5151 && rom_ver == 0x0100) { /* TVP5151 */
+	} else if (core->dev_id == 0x5151 && core->rom_ver == 0x0100) {
 		v4l2_info(sd, "tvp5151 detected.\n");
 	} else {
-		v4l2_info(sd, "*** unknown tvp%04x chip detected.\n", dev_id);
+		v4l2_info(sd, "*** unknown tvp%04x chip detected.\n",
+			  core->dev_id);
 	}
 
 	return 0;
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1328033 — [PATCH 5/8] [media] tvp5150: add internal signal generator to HW input list

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-02-05 20:20 +0100
Subject[PATCH 5/8] [media] tvp5150: add internal signal generator to HW input list
Message-ID<qYU5c-4l7-37@gated-at.bofh.it>
In reply to#1328027
Some tvp5150 variants, have an internal generator that can generate a
black screen output. Since this is a HW block, it should be in the HW
inputs list.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 include/media/i2c/tvp5150.h | 1 +
 1 file changed, 1 insertion(+)

diff --git a/include/media/i2c/tvp5150.h b/include/media/i2c/tvp5150.h
index 649908a25605..685a1e718531 100644
--- a/include/media/i2c/tvp5150.h
+++ b/include/media/i2c/tvp5150.h
@@ -25,6 +25,7 @@
 #define TVP5150_COMPOSITE0 0
 #define TVP5150_COMPOSITE1 1
 #define TVP5150_SVIDEO     2
+#define TVP5150_GENERATOR  3
 
 /* TVP5150 HW outputs */
 #define TVP5150_NORMAL       0
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1328035 — [PATCH 7/8] [media] tvp5150: document input connectors DT bindings

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-02-05 20:20 +0100
Subject[PATCH 7/8] [media] tvp5150: document input connectors DT bindings
Message-ID<qYU5d-4l7-43@gated-at.bofh.it>
In reply to#1328027
The tvp5150 decoder has different input connectors so extend the device
tree binding to allow device tree source files to define the connectors
that are available on a given board.

Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
---

 .../devicetree/bindings/media/i2c/tvp5150.txt      | 43 ++++++++++++++++++++++
 1 file changed, 43 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/i2c/tvp5150.txt b/Documentation/devicetree/bindings/media/i2c/tvp5150.txt
index 8c0fc1a26bf0..daa20e43a8e3 100644
--- a/Documentation/devicetree/bindings/media/i2c/tvp5150.txt
+++ b/Documentation/devicetree/bindings/media/i2c/tvp5150.txt
@@ -12,6 +12,32 @@ Optional Properties:
 - pdn-gpios: phandle for the GPIO connected to the PDN pin, if any.
 - reset-gpios: phandle for the GPIO connected to the RESETB pin, if any.
 
+Optional nodes:
+- connectors: The input connectors of tvp5150 have to be defined under
+  a subnode name "connectors" using the following format:
+
+	input-connector-name {
+		input connector properties
+	};
+
+Each input connector must contain the following properties:
+
+	- label: a name for the connector.
+	- input: the input connector.
+
+The possible values for the "input" property are:
+	0: Composite0
+	1: Composite1
+	2: S-Video
+
+and on a tvp5150am1 and tvp5151 there is another:
+	4: Signal generator
+
+The list of valid input connectors are defined in dt-bindings/media/tvp5150.h
+header file and can be included by device tree source files.
+
+Each input connector can be defined only once.
+
 The device node must contain one 'port' child node for its digital output
 video port, in accordance with the video interface bindings defined in
 Documentation/devicetree/bindings/media/video-interfaces.txt.
@@ -36,6 +62,23 @@ Example:
 		pdn-gpios = <&gpio4 30 GPIO_ACTIVE_LOW>;
 		reset-gpios = <&gpio6 7 GPIO_ACTIVE_LOW>;
 
+		connectors {
+			composite0 {
+				label = "Composite0";
+				input = <TVP5150_COMPOSITE0>;
+			};
+
+			composite1 {
+				label = "Composite1";
+				input = <TVP5150_COMPOSITE1>;
+			};
+
+			s-video {
+				label = "S-Video";
+				input = <TVP5150_SVIDEO>;
+			};
+		};
+
 		port {
 			tvp5150_1: endpoint {
 				remote-endpoint = <&ccdc_ep>;
-- 
2.5.0

[toc] | [prev] | [next] | [standalone]


#1329460 — Re: [PATCH 7/8] [media] tvp5150: document input connectors DT bindings

FromJavier Martinez Canillas <javier@osg.samsung.com>
Date2016-02-08 19:30 +0100
SubjectRe: [PATCH 7/8] [media] tvp5150: document input connectors DT bindings
Message-ID<qZYJs-zh-25@gated-at.bofh.it>
In reply to#1328035
Hello,

I noticed that I missed the DT folks in the cc list so I'm adding
them now, sorry for the noise...

On 02/05/2016 04:09 PM, Javier Martinez Canillas wrote:
> The tvp5150 decoder has different input connectors so extend the device
> tree binding to allow device tree source files to define the connectors
> that are available on a given board.
>
> Signed-off-by: Javier Martinez Canillas <javier@osg.samsung.com>
> ---
>
>   .../devicetree/bindings/media/i2c/tvp5150.txt      | 43 ++++++++++++++++++++++
>   1 file changed, 43 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/media/i2c/tvp5150.txt b/Documentation/devicetree/bindings/media/i2c/tvp5150.txt
> index 8c0fc1a26bf0..daa20e43a8e3 100644
> --- a/Documentation/devicetree/bindings/media/i2c/tvp5150.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/tvp5150.txt
> @@ -12,6 +12,32 @@ Optional Properties:
>   - pdn-gpios: phandle for the GPIO connected to the PDN pin, if any.
>   - reset-gpios: phandle for the GPIO connected to the RESETB pin, if any.
>
> +Optional nodes:
> +- connectors: The input connectors of tvp5150 have to be defined under
> +  a subnode name "connectors" using the following format:
> +
> +	input-connector-name {
> +		input connector properties
> +	};
> +
> +Each input connector must contain the following properties:
> +
> +	- label: a name for the connector.
> +	- input: the input connector.
> +
> +The possible values for the "input" property are:
> +	0: Composite0
> +	1: Composite1
> +	2: S-Video
> +
> +and on a tvp5150am1 and tvp5151 there is another:
> +	4: Signal generator
> +
> +The list of valid input connectors are defined in dt-bindings/media/tvp5150.h
> +header file and can be included by device tree source files.
> +
> +Each input connector can be defined only once.
> +
>   The device node must contain one 'port' child node for its digital output
>   video port, in accordance with the video interface bindings defined in
>   Documentation/devicetree/bindings/media/video-interfaces.txt.
> @@ -36,6 +62,23 @@ Example:
>   		pdn-gpios = <&gpio4 30 GPIO_ACTIVE_LOW>;
>   		reset-gpios = <&gpio6 7 GPIO_ACTIVE_LOW>;
>
> +		connectors {
> +			composite0 {
> +				label = "Composite0";
> +				input = <TVP5150_COMPOSITE0>;
> +			};
> +
> +			composite1 {
> +				label = "Composite1";
> +				input = <TVP5150_COMPOSITE1>;
> +			};
> +
> +			s-video {
> +				label = "S-Video";
> +				input = <TVP5150_SVIDEO>;
> +			};
> +		};
> +
>   		port {
>   			tvp5150_1: endpoint {
>   				remote-endpoint = <&ccdc_ep>;
>

Best regards,
-- 
Javier Martinez Canillas
Open Source Group
Samsung Research America

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web