Skip to contentSkip to conversation

RFC: ADV748x HDMI/Analog video receiver

PATCH Superseded Kieran Bingham 7 participants 16 messages Apr 27, 2017 – May 1, 2017

Subsystems (5)

v1 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

cover RFC: ADV748x HDMI/Analog video receiver

From: Kieran Bingham <[email protected]>

This is an RFC for the Analog Devices ADV748x driver, and follows on from a previous posting by Niklas Söderlund [0] of an earlier incarnation of this driver.

This is an early posting of the driver following the release early, release often method after quite a bit of refactoring in an attempt to bring it closer to mainline.

Aside from a few bug fixes, and considerable refactoring this driver:
- is refactored to multiple object files
- defines multiple sub devices for the output paths.
- has independant controls for both HDMI and Analog video paths
- extends V4L2 async matching to support 'ports' on V4L2_ASYNC_MATCH_OF

The ADV7481 and ADV7482 support two video pipelines which can run independently of each other, with each pipeline terminating in a CSI-2 output: TXA (4-Lane) and TXB (1-Lane)

The ADV7480 (Not yet included here), ADV7481, and ADV7482 are all derivatives, with the following features

Analog HDMI MHL 4-Lane 1-Lane
In In CSI CSI

 ADV7480               X    X     X
 ADV7481      X        X    X     X       X
 ADV7482      X        X          X       X

This RFC statically routes the HDMI in through the TXA and the CVBS through the TXB for early development, though I anticipate splitting the TXA/HDMI and TXB/AFE (Analog Front End) into distinct sub devices, allowing configurable routing. This split is dependant upon on-going 'incremental binding' work being done and thus is not yet included in this RFC.

Further potential development areas include:
- ADV7480 Support (No AFE)
- MHL support (Not present on ADV7482)
- EDID support
- CEC Support
- Configurable I2C addressing
- Interrupt handling for format changes and hotplug detect.

However, this driver and series is functional without the above, though if there are mandatory areas which block mainline integration please let me know and I will prioritise that in development.

Particular topics for discussion and review requested here include:

- Device tree bindings specification and port listings review

- Async Subdev port matching on V4L2_ASYNC_MATCH_OF

There are two implementations possible for the subdevice matching:
A) Matching on a root dev-node, with a port specification
B) Creating a new V4L2_ASYNC_MATCH_OF_ENDPOINT

This series posts an initial version utilising Method A.

Here we extend the subdevice and allow the drivers to assign defined 'port' numbers to subdevices so that they can be distinguised against a common root of_node.

This method involves the least change overall, and doesn't require the ADV7482 to parse it's device tree in advance.

Method B) is an option I have also considered, but requires as stated that the driver must parse it's device tree, and instead of passing a root of_node, would pass the endpoint for matching.

The difficulty here will be in communicating to the consumer / async-notifier that instead of the V4L2_ASYNC_MATCH_OF, a V4L2_ASYNC_MATCH_OF_ENDPOINT should be used. Thoughts on this would be appreciated.

This series presents the following patches:

[PATCH 1/5] v4l2-subdev: Provide a port mapping for asynchronous [PATCH 2/5] rcar-vin: Match sources against ports if specified. [PATCH 3/5] media: i2c: adv748x: add adv748x driver
[PATCH 4/5] arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482 [PATCH 5/5] arm64: dts: r8a7796: salvator-x: enable VIN, CSI and ADV7482

Patch 1 provides V4L2 support for the 'Method A' mentioned above. Patch 2 is dependant upon Niklas' rcar-vin series [1], and adds support to the
binding multiple subdevices from a single DT node.
Patch 3 is the new driver
Patch 4 and 5 add support to the Salvator-X platforms where this code has been
tested

I appreciate that there are still some 'rough edges' in the driver, which is still under development, but all comments are welcome.

[0] http://www.mail-archive.com/[email protected]/msg05196.html
[1] https://git.ragnatech.se/linux rcar-vin-elinux-v7

Kieran Bingham (5):
v4l2-subdev: Provide a port mapping for asynchronous subdevs
rcar-vin: Match sources against ports if specified.
media: i2c: adv748x: add adv748x driver
arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482
arm64: dts: r8a7796: salvator-x: enable VIN, CSI and ADV7482

 .../devicetree/bindings/media/i2c/adv748x.txt      |  63 ++
 MAINTAINERS                                        |   6 +
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 129 ++++
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 129 ++++
 drivers/media/i2c/Kconfig                          |  10 +
 drivers/media/i2c/Makefile                         |   1 +
 drivers/media/i2c/adv748x/Makefile                 |   6 +
 drivers/media/i2c/adv748x/adv748x-afe.c            | 614 ++++++++++++++++++
 drivers/media/i2c/adv748x/adv748x-core.c           | 573 +++++++++++++++++
 drivers/media/i2c/adv748x/adv748x-hdmi.c           | 690 +++++++++++++++++++++
 drivers/media/i2c/adv748x/adv748x.h                | 157 +++++
 drivers/media/platform/rcar-vin/rcar-core.c        |  15 +-
 drivers/media/v4l2-core/v4l2-async.c               |   7 +
 drivers/media/v4l2-core/v4l2-subdev.c              |   1 +
 include/media/v4l2-async.h                         |   1 +
 include/media/v4l2-subdev.h                        |   2 +
 16 files changed, 2397 insertions(+), 7 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv748x.txt
 create mode 100644 drivers/media/i2c/adv748x/Makefile
 create mode 100644 drivers/media/i2c/adv748x/adv748x-afe.c
 create mode 100644 drivers/media/i2c/adv748x/adv748x-core.c
 create mode 100644 drivers/media/i2c/adv748x/adv748x-hdmi.c
 create mode 100644 drivers/media/i2c/adv748x/adv748x.h
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/5 v4l2-subdev: Provide a port mapping for asynchronous subdevs

From: Kieran Bingham <[email protected]>

Devices such as the the ADV748x support multiple parallel stream routes through a single chip. This leads towards needing to provide multiple distinct entities and subdevs from a single device-tree node.

To distinguish these separate outputs, the device-tree binding must specify each endpoint link with a unique (to the device) non-zero port number.

This number allows async subdev registrations to identify the correct subdevice to bind and link.

---
 drivers/media/v4l2-core/v4l2-async.c  | 7 +++++++
 drivers/media/v4l2-core/v4l2-subdev.c | 1 +
 include/media/v4l2-async.h            | 1 +
 include/media/v4l2-subdev.h           | 2 ++
 4 files changed, 11 insertions(+)
drivers/media/v4l2-core/v4l2-async.c +7 -0
index 1815e54e8a38..875e6ce646ec 100644
@@ -42,6 +42,13 @@ static bool match_devname(struct v4l2_subdev *sd,
 
 static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
+	/*
+	 * If set, we must match the device tree port, with the subdev port.
+	 * This is a fast match, so do this first
+	 */
+	if (sd->port && sd->port != asd->match.of.port)
+		return -1;
+
 	return !of_node_cmp(of_node_full_name(sd->of_node),
 			    of_node_full_name(asd->match.of.node));
 }
drivers/media/v4l2-core/v4l2-subdev.c +1 -0
index da78497ae5ed..67f816f90ac3 100644
@@ -607,6 +607,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
 	sd->flags = 0;
 	sd->name[0] = '\0';
 	sd->grp_id = 0;
+	sd->port = 0;
 	sd->dev_priv = NULL;
 	sd->host_priv = NULL;
 #if defined(CONFIG_MEDIA_CONTROLLER)
include/media/v4l2-async.h +1 -0
index 5b501309b6a7..2988960613ec 100644
@@ -56,6 +56,7 @@ struct v4l2_async_subdev {
 	union {
 		struct {
 			const struct device_node *node;
+			u32 port;
 		} of;
 		struct {
 			const char *name;
include/media/v4l2-subdev.h +2 -0
index 0ab1c5df6fac..1c1731b491e5 100644
@@ -782,6 +782,7 @@ struct v4l2_subdev_platform_data {
  * @ctrl_handler: The control handler of this subdev. May be NULL.
  * @name: Name of the sub-device. Please notice that the name must be unique.
  * @grp_id: can be used to group similar subdevs. Value is driver-specific
+ * @port: driver-specific value to bind multiple subdevs with a single DT node.
  * @dev_priv: pointer to private data
  * @host_priv: pointer to private data used by the device where the subdev
  *	is attached.
@@ -814,6 +815,7 @@ struct v4l2_subdev {
 	struct v4l2_ctrl_handler *ctrl_handler;
 	char name[V4L2_SUBDEV_NAME_SIZE];
 	u32 grp_id;
+	u32 port;
 	void *dev_priv;
 	void *host_priv;
 	struct video_device *devnode;
Signature · 1 line
2.7.4
#2 lore raw

Re: [PATCH 1/5] v4l2-subdev: Provide a port mapping for asynchronous subdevs

Hi Kieran,

Could I ask you to rebase your patches on top of my V4L2 fwnode patches here?

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi>

It depends on the fwnode graph patches, merged here:

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi-merge>

I expect the fwnode graph patches in v4.12 so we'll have them in media-tree master soon.

(I'm pushing these branches right now, it may take a while until it's really there.)

Quoted 26 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

Devices such as the the ADV748x support multiple parallel stream routes through a single chip. This leads towards needing to provide multiple distinct entities and subdevs from a single device-tree node.

To distinguish these separate outputs, the device-tree binding must specify each endpoint link with a unique (to the device) non-zero port number.

This number allows async subdev registrations to identify the correct subdevice to bind and link.

---
 drivers/media/v4l2-core/v4l2-async.c  | 7 +++++++
 drivers/media/v4l2-core/v4l2-subdev.c | 1 +
 include/media/v4l2-async.h            | 1 +
 include/media/v4l2-subdev.h           | 2 ++
 4 files changed, 11 insertions(+)
drivers/media/v4l2-core/v4l2-async.c +0 -0
index 1815e54e8a38..875e6ce646ec 100644

drivers/media/v4l2-core/v4l2-async.c static bool match_devname(struct v4l2_subdev *sd, · line 49

Quoted 8 lines
drivers/media/v4l2-core/v4l2-async.c +5 -0
@@ -42,6 +42,13 @@ static bool match_devname(struct v4l2_subdev *sd,
 
 static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
+	/*
+	 * If set, we must match the device tree port, with the subdev port.
+	 * This is a fast match, so do this first
+	 */
+	if (sd->port && sd->port != asd->match.of.port)

Zero is an entirely valid value for a port. I think it'd be good not to depend on non-zero port values for port matching.

drivers/media/v4l2-core/v4l2-async.c static bool match_devname(struct v4l2_subdev *sd, · line 50

Quoted 1 line
drivers/media/v4l2-core/v4l2-async.c +1 -0
+		return -1;

Any particular reason to return -1 from a function with bool return type?

Quoted 21 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+
 	return !of_node_cmp(of_node_full_name(sd->of_node),
 			    of_node_full_name(asd->match.of.node));
 }
drivers/media/v4l2-core/v4l2-subdev.c +1 -0
index da78497ae5ed..67f816f90ac3 100644
@@ -607,6 +607,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
 	sd->flags = 0;
 	sd->name[0] = '\0';
 	sd->grp_id = 0;
+	sd->port = 0;
 	sd->dev_priv = NULL;
 	sd->host_priv = NULL;
 #if defined(CONFIG_MEDIA_CONTROLLER)
include/media/v4l2-async.h +0 -0
index 5b501309b6a7..2988960613ec 100644

include/media/v4l2-async.h struct v4l2_async_subdev { · line 59

Quoted 4 lines
include/media/v4l2-async.h +1 -0
@@ -56,6 +56,7 @@ struct v4l2_async_subdev {
 	union {
 		struct {
 			const struct device_node *node;
+			u32 port;

What if instead of storing the device's OF node, you'd store the port node and used that for matching?

Would that also solve the problem or do I miss something?

Quoted 23 lines
include/media/v4l2-async.h +0 -0
 		} of;
 		struct {
 			const char *name;
include/media/v4l2-subdev.h +2 -0
index 0ab1c5df6fac..1c1731b491e5 100644
@@ -782,6 +782,7 @@ struct v4l2_subdev_platform_data {
  * @ctrl_handler: The control handler of this subdev. May be NULL.
  * @name: Name of the sub-device. Please notice that the name must be unique.
  * @grp_id: can be used to group similar subdevs. Value is driver-specific
+ * @port: driver-specific value to bind multiple subdevs with a single DT node.
  * @dev_priv: pointer to private data
  * @host_priv: pointer to private data used by the device where the subdev
  *	is attached.
@@ -814,6 +815,7 @@ struct v4l2_subdev {
 	struct v4l2_ctrl_handler *ctrl_handler;
 	char name[V4L2_SUBDEV_NAME_SIZE];
 	u32 grp_id;
+	u32 port;
 	void *dev_priv;
 	void *host_priv;
 	struct video_device *devnode;
Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
maintainer
#3 lore raw

Re: [PATCH 1/5] v4l2-subdev: Provide a port mapping for asynchronous subdevs

Hi Sakari,

Thanks for taking a look

Quoted 9 lines · Sakari Ailus

Hi Kieran,

Could I ask you to rebase your patches on top of my V4L2 fwnode patches here?

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi>

It depends on the fwnode graph patches, merged here:

Quoted 7 lines

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi-merge>

I expect the fwnode graph patches in v4.12 so we'll have them in media-tree master soon.

(I'm pushing these branches right now, it may take a while until it's really there.)

Sure, I'll merge those into my base.

Quoted 28 lines · Kieran Bingham
Quoted 27 lines

From: Kieran Bingham <[email protected]>

Devices such as the the ADV748x support multiple parallel stream routes through a single chip. This leads towards needing to provide multiple distinct entities and subdevs from a single device-tree node.

To distinguish these separate outputs, the device-tree binding must specify each endpoint link with a unique (to the device) non-zero port number.

This number allows async subdev registrations to identify the correct subdevice to bind and link.

---
 drivers/media/v4l2-core/v4l2-async.c  | 7 +++++++
 drivers/media/v4l2-core/v4l2-subdev.c | 1 +
 include/media/v4l2-async.h            | 1 +
 include/media/v4l2-subdev.h           | 2 ++
 4 files changed, 11 insertions(+)
drivers/media/v4l2-core/v4l2-async.c +0 -0
index 1815e54e8a38..875e6ce646ec 100644
@@ -42,6 +42,13 @@ static bool match_devname(struct v4l2_subdev *sd,
 
Quoted 10 lines

drivers/media/v4l2-core/v4l2-async.c static bool match_devname(struct v4l2_subdev *sd, · line 49

Quoted 7 lines
drivers/media/v4l2-core/v4l2-async.c +5 -0
 static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
+	/*
+	 * If set, we must match the device tree port, with the subdev port.
+	 * This is a fast match, so do this first
+	 */
+	if (sd->port && sd->port != asd->match.of.port)

Zero is an entirely valid value for a port. I think it'd be good not to depend on non-zero port values for port matching.

Well then that pretty much dashes my chances on not parsing the DT in the ADV driver.

Quoted 3 lines

drivers/media/v4l2-core/v4l2-async.c static bool match_devname(struct v4l2_subdev *sd, · line 50

Quoted 1 line
drivers/media/v4l2-core/v4l2-async.c +1 -0
+		return -1;

Any particular reason to return -1 from a function with bool return type?

Ahem, I clearly can't read ;-)
I think my mindset was thinking strcmp or something...

Quoted 29 lines
Quoted 21 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+
 	return !of_node_cmp(of_node_full_name(sd->of_node),
 			    of_node_full_name(asd->match.of.node));
 }
drivers/media/v4l2-core/v4l2-subdev.c +1 -0
index da78497ae5ed..67f816f90ac3 100644
@@ -607,6 +607,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
 	sd->flags = 0;
 	sd->name[0] = '\0';
 	sd->grp_id = 0;
+	sd->port = 0;
 	sd->dev_priv = NULL;
 	sd->host_priv = NULL;
 #if defined(CONFIG_MEDIA_CONTROLLER)
include/media/v4l2-async.h +0 -0
index 5b501309b6a7..2988960613ec 100644

include/media/v4l2-async.h struct v4l2_async_subdev { · line 59

Quoted 4 lines
include/media/v4l2-async.h +1 -0
@@ -56,6 +56,7 @@ struct v4l2_async_subdev {
 	union {
 		struct {
 			const struct device_node *node;
+			u32 port;

What if instead of storing the device's OF node, you'd store the port node and used that for matching?

Quoted 1 line

Would that also solve the problem or do I miss something?

Actually - I was 'trying' to prevent having to parse the DT in the adv748x driver if I didn't need to.

Once I have to parse the DT, then yes, I think storing the endpoint node is probably the best thing to compare against.

And actually - you might have just solved my open question in the cover letter ...

I had got stuck in my mindset that if I were to use the endpoint 'leaf' node as a comparator - that it would be 'instead' of the root node.

But actually - it could just be root-node + leaf-node to compare, which then allows us the fallback of comparing just the root nodes if the leaf isn't set.

I'll respin with this either tomorrow or early next week.

Quoted 16 lines
Quoted 16 lines
include/media/v4l2-async.h +0 -0
 		} of;
 		struct {
 			const char *name;
include/media/v4l2-subdev.h +1 -0
index 0ab1c5df6fac..1c1731b491e5 100644
@@ -782,6 +782,7 @@ struct v4l2_subdev_platform_data {
  * @ctrl_handler: The control handler of this subdev. May be NULL.
  * @name: Name of the sub-device. Please notice that the name must be unique.
  * @grp_id: can be used to group similar subdevs. Value is driver-specific
+ * @port: driver-specific value to bind multiple subdevs with a single DT node.
  * @dev_priv: pointer to private data
  * @host_priv: pointer to private data used by the device where the subdev
  *	is attached.
Quoted 9 lines

include/media/v4l2-subdev.h struct v4l2_subdev { · line 821

Quoted 8 lines
include/media/v4l2-subdev.h +1 -0
@@ -814,6 +815,7 @@ struct v4l2_subdev {
 	struct v4l2_ctrl_handler *ctrl_handler;
 	char name[V4L2_SUBDEV_NAME_SIZE];
 	u32 grp_id;
+	u32 port;
 	void *dev_priv;
 	void *host_priv;
 	struct video_device *devnode;

Regards

Kieran

#4 lore raw

Re: [PATCH 1/5] v4l2-subdev: Provide a port mapping for asynchronous subdevs

Hi Kieran,

Quoted 3 lines · Kieran Bingham

Hi Sakari,

Thanks for taking a look

Sure! :-)

Quoted 60 lines · Sakari Ailus
Quoted 9 lines

Hi Kieran,

Could I ask you to rebase your patches on top of my V4L2 fwnode patches here?

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi>

It depends on the fwnode graph patches, merged here:

Quoted 7 lines

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi-merge>

I expect the fwnode graph patches in v4.12 so we'll have them in media-tree master soon.

(I'm pushing these branches right now, it may take a while until it's really there.)

Sure, I'll merge those into my base.

Quoted 28 lines · Kieran Bingham
Quoted 27 lines

From: Kieran Bingham <[email protected]>

Devices such as the the ADV748x support multiple parallel stream routes through a single chip. This leads towards needing to provide multiple distinct entities and subdevs from a single device-tree node.

To distinguish these separate outputs, the device-tree binding must specify each endpoint link with a unique (to the device) non-zero port number.

This number allows async subdev registrations to identify the correct subdevice to bind and link.

---
 drivers/media/v4l2-core/v4l2-async.c  | 7 +++++++
 drivers/media/v4l2-core/v4l2-subdev.c | 1 +
 include/media/v4l2-async.h            | 1 +
 include/media/v4l2-subdev.h           | 2 ++
 4 files changed, 11 insertions(+)
drivers/media/v4l2-core/v4l2-async.c +0 -0
index 1815e54e8a38..875e6ce646ec 100644
@@ -42,6 +42,13 @@ static bool match_devname(struct v4l2_subdev *sd,
 
Quoted 10 lines

drivers/media/v4l2-core/v4l2-async.c static bool match_devname(struct v4l2_subdev *sd, · line 49

Quoted 7 lines
drivers/media/v4l2-core/v4l2-async.c +5 -0
 static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
+	/*
+	 * If set, we must match the device tree port, with the subdev port.
+	 * This is a fast match, so do this first
+	 */
+	if (sd->port && sd->port != asd->match.of.port)

Zero is an entirely valid value for a port. I think it'd be good not to depend on non-zero port values for port matching.

Quoted 2 lines

Well then that pretty much dashes my chances on not parsing the DT in the ADV driver.

Hmm. I guess there's no really a way to avoid it. But we could make it easier

Quoted 9 lines
Quoted 6 lines

drivers/media/v4l2-core/v4l2-async.c static bool match_devname(struct v4l2_subdev *sd, · line 50

Quoted 4 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+		return -1;

Any particular reason to return -1 from a function with bool return type?

Ahem, I clearly can't read ;-)
I think my mindset was thinking strcmp or something...

But -1 is perfectly valid. If you wanted to make it look really interesting, you could return -!false and still have exactly the same functionality. ;-)

Quoted 41 lines
Quoted 31 lines
Quoted 23 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+
 	return !of_node_cmp(of_node_full_name(sd->of_node),
 			    of_node_full_name(asd->match.of.node));
 }
drivers/media/v4l2-core/v4l2-subdev.c +1 -0
index da78497ae5ed..67f816f90ac3 100644
@@ -607,6 +607,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
 	sd->flags = 0;
 	sd->name[0] = '\0';
 	sd->grp_id = 0;
+	sd->port = 0;
 	sd->dev_priv = NULL;
 	sd->host_priv = NULL;
 #if defined(CONFIG_MEDIA_CONTROLLER)
include/media/v4l2-async.h +0 -0
index 5b501309b6a7..2988960613ec 100644

include/media/v4l2-async.h struct v4l2_async_subdev { · line 59

Quoted 4 lines
include/media/v4l2-async.h +1 -0
@@ -56,6 +56,7 @@ struct v4l2_async_subdev {
 	union {
 		struct {
 			const struct device_node *node;
+			u32 port;

What if instead of storing the device's OF node, you'd store the port node and used that for matching?

Quoted 1 line

Would that also solve the problem or do I miss something?

Actually - I was 'trying' to prevent having to parse the DT in the adv748x driver if I didn't need to.

Once I have to parse the DT, then yes, I think storing the endpoint node is probably the best thing to compare against.

And actually - you might have just solved my open question in the cover letter ...

Quoted 7 lines

I had got stuck in my mindset that if I were to use the endpoint 'leaf' node as a comparator - that it would be 'instead' of the root node.

But actually - it could just be root-node + leaf-node to compare, which then allows us the fallback of comparing just the root nodes if the leaf isn't set.

I'll respin with this either tomorrow or early next week.

Endpoints are indeed another option.

Is there something that would prevent switching from device node matching to port / endpoint matching altogether? I don't think the driver changes should be difficult to make.

Supporting different options there will be painful as it will likely require help from the driver to implement both --- separately.

Quoted 26 lines
Quoted 26 lines
Quoted 25 lines
include/media/v4l2-async.h +0 -0
 		} of;
 		struct {
 			const char *name;
include/media/v4l2-subdev.h +2 -0
index 0ab1c5df6fac..1c1731b491e5 100644
@@ -782,6 +782,7 @@ struct v4l2_subdev_platform_data {
  * @ctrl_handler: The control handler of this subdev. May be NULL.
  * @name: Name of the sub-device. Please notice that the name must be unique.
  * @grp_id: can be used to group similar subdevs. Value is driver-specific
+ * @port: driver-specific value to bind multiple subdevs with a single DT node.
  * @dev_priv: pointer to private data
  * @host_priv: pointer to private data used by the device where the subdev
  *	is attached.
@@ -814,6 +815,7 @@ struct v4l2_subdev {
 	struct v4l2_ctrl_handler *ctrl_handler;
 	char name[V4L2_SUBDEV_NAME_SIZE];
 	u32 grp_id;
+	u32 port;
 	void *dev_priv;
 	void *host_priv;
 	struct video_device *devnode;
Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: [email protected]	XMPP: [email protected]
maintainer
#5 lore raw

Re: [PATCH 1/5] v4l2-subdev: Provide a port mapping for asynchronous subdevs

Quoted 82 lines · Sakari Ailus

Hi Kieran,

Quoted 3 lines · Kieran Bingham

Hi Sakari,

Thanks for taking a look

Sure! :-)

Quoted 60 lines · Sakari Ailus
Quoted 9 lines

Hi Kieran,

Could I ask you to rebase your patches on top of my V4L2 fwnode patches here?

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi>

It depends on the fwnode graph patches, merged here:

Quoted 7 lines

<URL:https://git.linuxtv.org/sailus/media_tree.git/log/?h=v4l2-acpi-merge>

I expect the fwnode graph patches in v4.12 so we'll have them in media-tree master soon.

(I'm pushing these branches right now, it may take a while until it's really there.)

Sure, I'll merge those into my base.

Quoted 28 lines · Kieran Bingham
Quoted 27 lines

From: Kieran Bingham <[email protected]>

Devices such as the the ADV748x support multiple parallel stream routes through a single chip. This leads towards needing to provide multiple distinct entities and subdevs from a single device-tree node.

To distinguish these separate outputs, the device-tree binding must specify each endpoint link with a unique (to the device) non-zero port number.

This number allows async subdev registrations to identify the correct subdevice to bind and link.

---
 drivers/media/v4l2-core/v4l2-async.c  | 7 +++++++
 drivers/media/v4l2-core/v4l2-subdev.c | 1 +
 include/media/v4l2-async.h            | 1 +
 include/media/v4l2-subdev.h           | 2 ++
 4 files changed, 11 insertions(+)
drivers/media/v4l2-core/v4l2-async.c +0 -0
index 1815e54e8a38..875e6ce646ec 100644
@@ -42,6 +42,13 @@ static bool match_devname(struct v4l2_subdev *sd,
 
Quoted 10 lines

drivers/media/v4l2-core/v4l2-async.c static bool match_devname(struct v4l2_subdev *sd, · line 49

Quoted 7 lines
drivers/media/v4l2-core/v4l2-async.c +5 -0
 static bool match_of(struct v4l2_subdev *sd, struct v4l2_async_subdev *asd)
 {
+	/*
+	 * If set, we must match the device tree port, with the subdev port.
+	 * This is a fast match, so do this first
+	 */
+	if (sd->port && sd->port != asd->match.of.port)

Zero is an entirely valid value for a port. I think it'd be good not to depend on non-zero port values for port matching.

Quoted 2 lines

Well then that pretty much dashes my chances on not parsing the DT in the ADV driver.

Hmm. I guess there's no really a way to avoid it. But we could make it easier

Quoted 7 lines
Quoted 6 lines

drivers/media/v4l2-core/v4l2-async.c static bool match_devname(struct v4l2_subdev *sd, · line 50

Quoted 4 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+		return -1;

Any particular reason to return -1 from a function with bool return type?

Quoted 5 lines
Quoted 2 lines

Ahem, I clearly can't read ;-)
I think my mindset was thinking strcmp or something...

But -1 is perfectly valid. If you wanted to make it look really interesting, you could return -!false and still have exactly the same functionality. ;-)

I'll consider -!false a recommendation for my next patch :D

Quoted 47 lines
Quoted 39 lines
Quoted 29 lines
Quoted 21 lines
drivers/media/v4l2-core/v4l2-async.c +1 -0
+
 	return !of_node_cmp(of_node_full_name(sd->of_node),
 			    of_node_full_name(asd->match.of.node));
 }
drivers/media/v4l2-core/v4l2-subdev.c +1 -0
index da78497ae5ed..67f816f90ac3 100644
@@ -607,6 +607,7 @@ void v4l2_subdev_init(struct v4l2_subdev *sd, const struct v4l2_subdev_ops *ops)
 	sd->flags = 0;
 	sd->name[0] = '\0';
 	sd->grp_id = 0;
+	sd->port = 0;
 	sd->dev_priv = NULL;
 	sd->host_priv = NULL;
 #if defined(CONFIG_MEDIA_CONTROLLER)
include/media/v4l2-async.h +0 -0
index 5b501309b6a7..2988960613ec 100644

include/media/v4l2-async.h struct v4l2_async_subdev { · line 59

Quoted 4 lines
include/media/v4l2-async.h +1 -0
@@ -56,6 +56,7 @@ struct v4l2_async_subdev {
 	union {
 		struct {
 			const struct device_node *node;
+			u32 port;

What if instead of storing the device's OF node, you'd store the port node and used that for matching?

Quoted 1 line

Would that also solve the problem or do I miss something?

Actually - I was 'trying' to prevent having to parse the DT in the adv748x driver if I didn't need to.

Once I have to parse the DT, then yes, I think storing the endpoint node is probably the best thing to compare against.

And actually - you might have just solved my open question in the cover letter ...

Quoted 7 lines

I had got stuck in my mindset that if I were to use the endpoint 'leaf' node as a comparator - that it would be 'instead' of the root node.

But actually - it could just be root-node + leaf-node to compare, which then allows us the fallback of comparing just the root nodes if the leaf isn't set.

I'll respin with this either tomorrow or early next week.

Quoted 8 lines

Endpoints are indeed another option.

Is there something that would prevent switching from device node matching to port / endpoint matching altogether? I don't think the driver changes should be difficult to make.

Supporting different options there will be painful as it will likely require help from the driver to implement both --- separately.

Ok - so a bit of pain either way...

IMO - 'endpoint' matching is 'more correct' as then we are tying the subdev with precisely the object that it is linking to.

It looks like there are 11 users of v4l2_async_notifier_register(), so yes, hopefully it might not actually be so much effort to go through and adapt each to match to the endpoint of_node instead!

I'll have a go at this and see how far I get down the rabbit hole.

Quoted 25 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
include/media/v4l2-async.h +0 -0
 		} of;
 		struct {
 			const char *name;
include/media/v4l2-subdev.h +2 -0
index 0ab1c5df6fac..1c1731b491e5 100644
@@ -782,6 +782,7 @@ struct v4l2_subdev_platform_data {
  * @ctrl_handler: The control handler of this subdev. May be NULL.
  * @name: Name of the sub-device. Please notice that the name must be unique.
  * @grp_id: can be used to group similar subdevs. Value is driver-specific
+ * @port: driver-specific value to bind multiple subdevs with a single DT node.
  * @dev_priv: pointer to private data
  * @host_priv: pointer to private data used by the device where the subdev
  *	is attached.
@@ -814,6 +815,7 @@ struct v4l2_subdev {
 	struct v4l2_ctrl_handler *ctrl_handler;
 	char name[V4L2_SUBDEV_NAME_SIZE];
 	u32 grp_id;
+	u32 port;
 	void *dev_priv;
 	void *host_priv;
 	struct video_device *devnode;
#6 lore raw

PATCH 2/5 rcar-vin: Match sources against ports if specified.

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

If an endpoint source specifies a port number, then it may have multiple entities provided by one DT node. In this event, match against both the DT node and it's relevant port.

---
 drivers/media/platform/rcar-vin/rcar-core.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)
drivers/media/platform/rcar-vin/rcar-core.c +8 -7
index a530dc388b95..afe382c9a55d 100644
@@ -782,7 +782,8 @@ static int rvin_group_notify_bound(struct v4l2_async_notifier *notifier,
 			return 0;
 		}
 
-		if (vin->group->source[i].asd.match.of.node == new) {
+		if (vin->group->source[i].asd.match.of.node == new &&
+		    subdev->port == vin->group->source[i].asd.match.of.port) {
 			vin_dbg(vin, "Bound source %s\n", subdev->name);
 			vin->group->source[i].subdev = subdev;
 			mutex_unlock(&vin->group->lock);
@@ -820,7 +821,7 @@ static struct device_node *rvin_group_get_bridge(struct rvin_dev *vin,
 static struct device_node *
 rvin_group_get_source(struct rvin_dev *vin,
 		      struct device_node *bridge,
-		      unsigned int *remote_pad)
+		      unsigned int *remote_port)
 {
 	struct device_node *source, *ep, *rp;
 	struct v4l2_mbus_config mbus_cfg;
@@ -844,7 +845,7 @@ rvin_group_get_source(struct rvin_dev *vin,
 	rp = of_graph_get_remote_port(ep);
 	of_graph_parse_endpoint(rp, &endpoint);
 	of_node_put(rp);
-	*remote_pad = endpoint.id;
+	*remote_port = endpoint.id;
 
 	source = of_graph_get_remote_port_parent(ep);
 	of_node_put(ep);
@@ -861,7 +862,7 @@ rvin_group_get_source(struct rvin_dev *vin,
 static int rvin_group_graph_parse(struct rvin_dev *vin, unsigned long *bitmap)
 {
 	struct device_node *ep, *bridge, *source;
-	unsigned int i, remote_pad = 0;
+	unsigned int i, remote_port = 0;
 	u32 val;
 	int ret;
 
@@ -910,7 +911,7 @@ static int rvin_group_graph_parse(struct rvin_dev *vin, unsigned long *bitmap)
 		if (bridge == NULL)
 			continue;
 
-		source = rvin_group_get_source(vin, bridge, &remote_pad);
+		source = rvin_group_get_source(vin, bridge, &remote_port);
 		of_node_put(bridge);
 		if (IS_ERR(source))
 			return PTR_ERR(source);
@@ -922,14 +923,14 @@ static int rvin_group_graph_parse(struct rvin_dev *vin, unsigned long *bitmap)
 		vin->group->bridge[i].asd.match.of.node = bridge;
 		vin->group->bridge[i].asd.match_type = V4L2_ASYNC_MATCH_OF;
 		vin->group->source[i].asd.match.of.node = source;
+		vin->group->source[i].asd.match.of.port = remote_port;
 		vin->group->source[i].asd.match_type = V4L2_ASYNC_MATCH_OF;
-		vin->group->source[i].source_pad = remote_pad;
 
 		*bitmap |= BIT(i);
 
 		vin_dbg(vin, "Handle bridge %s and source %s pad %d\n",
 			of_node_full_name(bridge), of_node_full_name(source),
-			remote_pad);
+			remote_port);
 	}
 
 	/* All our sources are CSI-2 */
Signature · 1 line
2.7.4
#7 lore raw

PATCH 3/5 media: i2c: adv748x: add adv748x driver

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Provide basic support for the ADV7481 and ADV7482.

The driver is modelled with 2 subdevices to allow simultaneous streaming from the AFE (Analog front end) and HDMI inputs.

Presently the HDMI is hardcoded to link to the TXA CSI bus, whilst the AFE is linked to the TXB CSI bus.

The driver is based on a prototype by Koji Matsuoka in the Renesas BSP, and an earlier rework by Niklas Söderlund.

---
 .../devicetree/bindings/media/i2c/adv748x.txt      |  63 ++
 MAINTAINERS                                        |   6 +
 drivers/media/i2c/Kconfig                          |  10 +
 drivers/media/i2c/Makefile                         |   1 +
 drivers/media/i2c/adv748x/Makefile                 |   6 +
 drivers/media/i2c/adv748x/adv748x-afe.c            | 614 ++++++++++++++++++
 drivers/media/i2c/adv748x/adv748x-core.c           | 573 +++++++++++++++++
 drivers/media/i2c/adv748x/adv748x-hdmi.c           | 690 +++++++++++++++++++++
 drivers/media/i2c/adv748x/adv748x.h                | 157 +++++
 9 files changed, 2120 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv748x.txt
 create mode 100644 drivers/media/i2c/adv748x/Makefile
 create mode 100644 drivers/media/i2c/adv748x/adv748x-afe.c
 create mode 100644 drivers/media/i2c/adv748x/adv748x-core.c
 create mode 100644 drivers/media/i2c/adv748x/adv748x-hdmi.c
 create mode 100644 drivers/media/i2c/adv748x/adv748x.h
Documentation/devicetree/bindings/media/i2c/adv748x.txt new file +63 -0
new file mode 100644
index 000000000000..487d8865c939
@@ -0,0 +1,63 @@
+* Analog Devices ADV748X video decoder with HDMI receiver
+
+The ADV7481, and ADV7482 are multi format video decoders with an integrated
+HDMI receiver. It can output CSI-2 on two independent outputs TXA and TXB from
+three input sources HDMI, analog and TTL.
+
+Required Properties:
+
+  - compatible: Must contain one of the following
+    - "adi,adv7481" for the ADV7481
+    - "adi,adv7482" for the ADV7482
+
+  - reg: I2C slave address
+
+The device node must contain one 'port' child node per device input and output
+port, in accordance with the video interface bindings defined in
+Documentation/devicetree/bindings/media/video-interfaces.txt. The port nodes
+are numbered as follows.
+
+  Name                  Type            Port
+------------------------------------------------------------
+  AIN1                  sink            1
+  AIN2                  sink            2
+  AIN3                  sink            3
+  AIN4                  sink            4
+  AIN5                  sink            5
+  AIN6                  sink            6
+  AIN7                  sink            7
+  AIN8                  sink            8
+  HDMI                  sink            9
+  TTL                   sink            10
+  TXA                   source          11
+  TXB                   source          12
+
+The digital output port node must contain at least one source endpoint.
+
+Example:
+
+    video_receiver@70 {
+            compatible = "adi,adv7482";
+            reg = <0x70>;
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            port@11 {
+                    reg = <11>;
+                    adv7482_txa: endpoint@1 {
+                            clock-lanes = <0>;
+                            data-lanes = <1 2 3 4>;
+                            remote-endpoint = <&csi40_in>;
+                    };
+            };
+
+            port@12 {
+                    reg = <12>;
+                    adv7482_txb: endpoint@1 {
+                            clock-lanes = <0>;
+                            data-lanes = <1>;
+                            remote-endpoint = <&csi20_in>;
+                    };
+            };
+    };
MAINTAINERS +6 -0
index c265a5fe4848..30c0168df508 100644
@@ -774,6 +774,12 @@ L:	[email protected]
 S:	Maintained
 F:	drivers/media/i2c/adv7511*
 
+ANALOG DEVICES INC ADV748X DRIVER
+M:	Kieran Bingham <[email protected]>
+L:	[email protected]
+S:	Maintained
+F:	drivers/media/i2c/adv748x/*
+
 ANALOG DEVICES INC ADV7604 DRIVER
 M:	Hans Verkuil <[email protected]>
 L:	[email protected]
drivers/media/i2c/Kconfig +10 -0
index cee1dae6e014..6b0ea68a0ec8 100644
@@ -204,6 +204,16 @@ config VIDEO_ADV7183
 	  To compile this driver as a module, choose M here: the
 	  module will be called adv7183.
 
+config VIDEO_ADV748X
+	tristate "Analog Devices ADV748x decoder"
+	depends on VIDEO_V4L2 && I2C
+	---help---
+	  V4l2 subdevice driver for the Analog Devices
+	  ADV7481 and ADV7482 HDMI/Analog video decoder.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called adv748x.
+
 config VIDEO_ADV7604
 	tristate "Analog Devices ADV7604 decoder"
 	depends on VIDEO_V4L2 && I2C && VIDEO_V4L2_SUBDEV_API
drivers/media/i2c/Makefile +1 -0
index 5bc7bbeb5499..f331ec0b93c9 100644
@@ -1,6 +1,7 @@
 msp3400-objs	:=	msp3400-driver.o msp3400-kthreads.o
 obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o
 
+obj-$(CONFIG_VIDEO_ADV748X) += adv748x/
 obj-$(CONFIG_VIDEO_SMIAPP)	+= smiapp/
 obj-$(CONFIG_VIDEO_ET8EK8)	+= et8ek8/
 obj-$(CONFIG_VIDEO_CX25840) += cx25840/
drivers/media/i2c/adv748x/Makefile new file +6 -0
new file mode 100644
index 000000000000..fa7524ca02eb
@@ -0,0 +1,6 @@
+adv748x-objs	:= \
+		adv748x-core.o \
+		adv748x-afe.o \
+		adv748x-hdmi.o
+
+obj-$(CONFIG_VIDEO_ADV748X)	+= adv748x.o
drivers/media/i2c/adv748x/adv748x-afe.c new file +614 -0

614 lines not on this page · raw message

drivers/media/i2c/adv748x/adv748x-core.c new file +573 -0

573 lines not on this page · raw message

drivers/media/i2c/adv748x/adv748x-hdmi.c new file +690 -0

690 lines not on this page · raw message

drivers/media/i2c/adv748x/adv748x.h new file +157 -0

157 lines not on this page · raw message

Signature · 1 line
2.7.4
#8 lore raw

PATCH 4/5 arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Provide bindings between the VIN, CSI and the ADV7482 on the r8a7795.

---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 129 +++++++++++++++++++++
 1 file changed, 129 insertions(+)
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +129 -0
index 27b9bae60dc0..a20623faa9d2 100644
@@ -196,6 +196,22 @@
 			};
 		};
 	};
+
+	hdmi {
+		port {
+			hdmi_in: endpoint {
+				remote-endpoint = <&adv7482_hdmi>;
+			};
+		};
+	};
+
+	cvbs {
+		port {
+			cvbs_in: endpoint {
+				remote-endpoint = <&adv7482_ain8>;
+			};
+		};
+	};
 };
 
 &du {
@@ -387,6 +403,50 @@
 	};
 };
 
+&i2c4 {
+	status = "okay";
+
+	clock-frequency = <100000>;
+
+	video_receiver@70 {
+		compatible = "adi,adv7482";
+		reg = <0x70>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@8 {
+			adv7482_ain8: endpoint@1 {
+				remote-endpoint = <&cvbs_in>;
+			};
+		};
+
+		port@9 {
+			adv7482_hdmi: endpoint@1 {
+				remote-endpoint = <&hdmi_in>;
+			};
+		};
+
+		port@11 {
+			reg = <11>;
+			adv7482_txa: endpoint@1 {
+				clock-lanes = <0>;
+				data-lanes = <1 2 3 4>;
+				remote-endpoint = <&csi40_in>;
+			};
+		};
+
+		port@12 {
+			reg = <12>;
+			adv7482_txb: endpoint@1 {
+				clock-lanes = <0>;
+				data-lanes = <1>;
+				remote-endpoint = <&csi20_in>;
+			};
+		};
+	};
+};
+
 &rcar_sound {
 	pinctrl-0 = <&sound_pins &sound_clk_pins>;
 	pinctrl-names = "default";
@@ -577,3 +637,72 @@
 &pciec1 {
 	status = "okay";
 };
+
+&vin0 {
+	status = "okay";
+};
+
+&vin1 {
+	status = "okay";
+};
+
+&vin2 {
+	status = "okay";
+};
+
+&vin3 {
+	status = "okay";
+};
+
+&vin4 {
+	status = "okay";
+};
+
+&vin5 {
+	status = "okay";
+};
+
+&vin6 {
+	status = "okay";
+};
+
+&vin7 {
+	status = "okay";
+};
+
+&csi20 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			csi20_in: endpoint@0 {
+				clock-lanes = <0>;
+				data-lanes = <1>;
+				remote-endpoint = <&adv7482_txb>;
+			};
+		};
+	};
+};
+
+&csi40 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+
+			csi40_in: endpoint@0 {
+				clock-lanes = <0>;
+				data-lanes = <1 2 3 4>;
+				remote-endpoint = <&adv7482_txa>;
+			};
+		};
+	};
+};
Signature · 1 line
2.7.4
#9 lore raw

Re: [PATCH 4/5] arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482

Hello!

Quoted 13 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

Provide bindings between the VIN, CSI and the ADV7482 on the r8a7795.

---
 arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts | 129 +++++++++++++++++++++
 1 file changed, 129 insertions(+)
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +0 -0
index 27b9bae60dc0..a20623faa9d2 100644

[...]

arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts line 411

Quoted 10 lines
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +6 -0
@@ -387,6 +403,50 @@
 	};
 };
 
+&i2c4 {
+	status = "okay";
+
+	clock-frequency = <100000>;
+
+	video_receiver@70 {

Hyphens are preferred in the node names.

[...]

MBR, Sergei

#10 lore raw

Re: [PATCH 4/5] arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482

Quoted 10 lines · Sergei Shtylyov
Quoted 2 lines · Kieran Bingham
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +0 -0

[...]

Quoted 5 lines
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +0 -0
@@ -387,6 +403,50 @@
        };
 };
 
Quoted 9 lines

arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts line 411

Quoted 6 lines
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +6 -0
+&i2c4 {
+       status = "okay";
+
+       clock-frequency = <100000>;
+
+       video_receiver@70 {

Hyphens are preferred in the node names.

Definitely: make W=1 dtbs

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#11 lore raw

Re: [PATCH 4/5] arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482

Quoted 22 lines · Geert Uytterhoeven
Quoted 10 lines · Sergei Shtylyov
Quoted 2 lines · Kieran Bingham
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +0 -0

[...]

Quoted 5 lines
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +0 -0
@@ -387,6 +403,50 @@
        };
 };
 
Quoted 9 lines

arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts line 411

Quoted 6 lines
arch/arm64/boot/dts/renesas/r8a7795-salvator-x.dts +6 -0
+&i2c4 {
+       status = "okay";
+
+       clock-frequency = <100000>;
+
+       video_receiver@70 {

Hyphens are preferred in the node names.

Quoted 1 line

Definitely: make W=1 dtbs

Thanks guys, - I didn't know about that one. I'll update my build script so it's always in place :)

--
Regards

Kieran

Quoted 11 lines

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#12 lore raw

PATCH 5/5 arm64: dts: r8a7796: salvator-x: enable VIN, CSI and ADV7482

In reply to Kieran Bingham

From: Kieran Bingham <[email protected]>

Provide bindings between the VIN, CSI and the ADV7482 on the r8a7796.

---
 arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts | 129 +++++++++++++++++++++
 1 file changed, 129 insertions(+)
arch/arm64/boot/dts/renesas/r8a7796-salvator-x.dts +129 -0
index 2637e4042705..d6f25e1ab455 100644
@@ -102,6 +102,22 @@
 		states = <3300000 1
 			  1800000 0>;
 	};
+
+	hdmi {
+		port {
+			hdmi_in: endpoint {
+				remote-endpoint = <&adv7482_hdmi>;
+			};
+		};
+	};
+
+	cvbs {
+		port {
+			cvbs_in: endpoint {
+				remote-endpoint = <&adv7482_ain8>;
+			};
+		};
+	};
 };
 
 &pfc {
@@ -261,3 +277,116 @@
 	timeout-sec = <60>;
 	status = "okay";
 };
+
+&i2c4 {
+	status = "okay";
+
+	clock-frequency = <100000>;
+
+	video_receiver@70 {
+		compatible = "adi,adv7482";
+		reg = <0x70>;
+
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@8 {
+			adv7482_ain8: endpoint@1 {
+				remote-endpoint = <&cvbs_in>;
+			};
+		};
+
+		port@9 {
+			adv7482_hdmi: endpoint@1 {
+				remote-endpoint = <&hdmi_in>;
+			};
+		};
+
+		port@11 {
+			reg = <11>;
+			adv7482_txa: endpoint@1 {
+				clock-lanes = <0>;
+				data-lanes = <1 2 3 4>;
+				remote-endpoint = <&csi40_in>;
+			};
+		};
+
+		port@12 {
+			reg = <12>;
+			adv7482_txb: endpoint@1 {
+				clock-lanes = <0>;
+				data-lanes = <1>;
+				remote-endpoint = <&csi20_in>;
+			};
+		};
+	};
+};
+
+&vin0 {
+	status = "okay";
+};
+
+&vin1 {
+	status = "okay";
+};
+
+&vin2 {
+	status = "okay";
+};
+
+&vin3 {
+	status = "okay";
+};
+
+&vin4 {
+	status = "okay";
+};
+
+&vin5 {
+	status = "okay";
+};
+
+&vin6 {
+	status = "okay";
+};
+
+&vin7 {
+	status = "okay";
+};
+
+&csi20 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+			csi20_in: endpoint@0 {
+				clock-lanes = <0>;
+				data-lanes = <1>;
+				remote-endpoint = <&adv7482_txb>;
+			};
+		};
+	};
+};
+
+&csi40 {
+	status = "okay";
+
+	ports {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		port@0 {
+			reg = <0>;
+
+			csi40_in: endpoint@0 {
+				clock-lanes = <0>;
+				data-lanes = <1 2 3 4>;
+				remote-endpoint = <&adv7482_txa>;
+			};
+		};
+	};
+};
Signature · 1 line
2.7.4
#13 lore raw
In reply to Kieran Bingham
Quoted 5 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

This is an RFC for the Analog Devices ADV748x driver, and follows on from a previous posting by Niklas Söderlund [0] of an earlier incarnation of this driver.

...

Quoted 7 lines

This series presents the following patches:

[PATCH 1/5] v4l2-subdev: Provide a port mapping for asynchronous [PATCH 2/5] rcar-vin: Match sources against ports if specified. [PATCH 3/5] media: i2c: adv748x: add adv748x driver
[PATCH 4/5] arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482 [PATCH 5/5] arm64: dts: r8a7796: salvator-x: enable VIN, CSI and ADV7482

I am marking the above dts patches as "RFC" and do not plan to apply them unless you ping me or repost them. Assuming they don't cause any regressions I would be happy to consider applying them as soon as their dependencies are accepted.

#14 lore raw

Hi Simon,

Quoted 11 lines · Simon Horman
Quoted 5 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

This is an RFC for the Analog Devices ADV748x driver, and follows on from a previous posting by Niklas Söderlund [0] of an earlier incarnation of this driver.

...

Quoted 2 lines

This series presents the following patches:

Quoted 8 lines
Quoted 5 lines

[PATCH 1/5] v4l2-subdev: Provide a port mapping for asynchronous [PATCH 2/5] rcar-vin: Match sources against ports if specified. [PATCH 3/5] media: i2c: adv748x: add adv748x driver
[PATCH 4/5] arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482 [PATCH 5/5] arm64: dts: r8a7796: salvator-x: enable VIN, CSI and ADV7482

I am marking the above dts patches as "RFC" and do not plan to apply them unless you ping me or repost them.

Yes, sorry - the whole series was supposed to be marked as RFC, but I didn't think about it - and apparently only applied the tag to the cover letter.

Apologies for any confusion.

Quoted 3 lines

Assuming they don't cause any
regressions I would be happy to consider applying them as soon as their dependencies are accepted.

Does that mean you've done a cursory glance over the content ? :-)

In this instance, the port numbers need to revert back to a zero-base, but I would appreciate an eye on how and where I've put the representation of the physical hdmi/cvbs connectors. Having modified plenty of DT, but not actually submitted much - I still feel 'new' at it - so I'm sure I may not have followed the standards quite right yet.

The dts patches are based heavily on the previous posting by Niklas, but I have extended to put the extra hdmi and cvbs links in.

Regards
--
Kieran

#15 lore raw
Quoted 20 lines · Kieran Bingham

Hi Simon,

Quoted 17 lines · Simon Horman
Quoted 5 lines · Kieran Bingham

From: Kieran Bingham <[email protected]>

This is an RFC for the Analog Devices ADV748x driver, and follows on from a previous posting by Niklas Söderlund [0] of an earlier incarnation of this driver.

...

Quoted 7 lines

This series presents the following patches:

[PATCH 1/5] v4l2-subdev: Provide a port mapping for asynchronous [PATCH 2/5] rcar-vin: Match sources against ports if specified. [PATCH 3/5] media: i2c: adv748x: add adv748x driver
[PATCH 4/5] arm64: dts: r8a7795: salvator-x: enable VIN, CSI and ADV7482 [PATCH 5/5] arm64: dts: r8a7796: salvator-x: enable VIN, CSI and ADV7482

Quoted 7 lines
Quoted 2 lines

I am marking the above dts patches as "RFC" and do not plan to apply them unless you ping me or repost them.

Yes, sorry - the whole series was supposed to be marked as RFC, but I didn't think about it - and apparently only applied the tag to the cover letter.

Apologies for any confusion.

It was clear enough, though an tag RFC in every patch would be better. In any case I was referring to how I have handled these patches in patchwork.

Apologies for any confusion.

Quoted 5 lines
Quoted 3 lines

Assuming they don't cause any
regressions I would be happy to consider applying them as soon as their dependencies are accepted.

Does that mean you've done a cursory glance over the content ? :-)

Yes, I did take a quick glance.

Quoted 5 lines

In this instance, the port numbers need to revert back to a zero-base, but I would appreciate an eye on how and where I've put the representation of the physical hdmi/cvbs connectors. Having modified plenty of DT, but not actually submitted much - I still feel 'new' at it
- so I'm sure I may not have followed the standards quite right yet.

Assuming you are talking about where in the DT file the hdmi and cvbs nodes should go, I think this is somewhat arbitrary so long as they are within the top-level node - what you have looks good to me.

Quoted 7 lines

The dts patches are based heavily on the previous posting by Niklas, but I have extended to put the extra hdmi and cvbs links in.

Regards
--
Kieran