All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/1 v1] adv7604: Add adv7612 support
@ 2014-08-11 12:05 Ian Molton
  2014-08-11 12:05 ` [PATCH 1/2] media: adv7604: Add support for ADV7612 dual HDMI input decoder Ian Molton
       [not found] ` <1407758719-12474-1-git-send-email-ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
  0 siblings, 2 replies; 8+ messages in thread
From: Ian Molton @ 2014-08-11 12:05 UTC (permalink / raw)
  To: linux-media
  Cc: laurent.pinchart, hans.verkuil, robh+dt, devicetree, lars,
	shubhrajyoti, william-towle, ian.molton

This small patch series adds initial support for the adv7612 dual HDMI input
decoder chip and adds a device-tree option allowing the default input to be
selected.

Please review / apply,

-Ian

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

* [PATCH 1/2] media: adv7604: Add support for ADV7612 dual HDMI input decoder.
  2014-08-11 12:05 [PATCH 0/1 v1] adv7604: Add adv7612 support Ian Molton
@ 2014-08-11 12:05 ` Ian Molton
  2014-08-18 22:25   ` Laurent Pinchart
       [not found] ` <1407758719-12474-1-git-send-email-ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
  1 sibling, 1 reply; 8+ messages in thread
From: Ian Molton @ 2014-08-11 12:05 UTC (permalink / raw)
  To: linux-media
  Cc: laurent.pinchart, hans.verkuil, robh+dt, devicetree, lars,
	shubhrajyoti, william-towle, ian.molton

This patch adds necessary support for the ADV7612 dual HDMI decoder / repeater
chip.

This was tested using a heavily modified rcar_vin/soc_camera capture driver.

Tested-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
---
 .../devicetree/bindings/media/i2c/adv7604.txt      | 17 +++----
 drivers/media/i2c/adv7604.c                        | 54 +++++++++++++++++++++-
 2 files changed, 61 insertions(+), 10 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..cc0708c 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -1,15 +1,16 @@
-* Analog Devices ADV7604/11 video decoder with HDMI receiver
+* Analog Devices ADV7604/11/12 video decoder with HDMI receiver
 
-The ADV7604 and ADV7611 are multiformat video decoders with an integrated HDMI
-receiver. The ADV7604 has four multiplexed HDMI inputs and one analog input,
-and the ADV7611 has one HDMI input and no analog input.
+The ADV7604 and ADV7611/12 are multiformat video decoders with an integrated
+HDMI receiver. The ADV7604 has four multiplexed HDMI inputs and one analog
+input, and the ADV7611 has one HDMI input and no analog input. The 7612 is similar to the 7611 but has 2 HDMI inputs.
 
-These device tree bindings support the ADV7611 only at the moment.
+These device tree bindings support the ADV7611/12 only at the moment.
 
 Required Properties:
 
   - compatible: Must contain one of the following
     - "adi,adv7611" for the ADV7611
+    - "adi,adv7612" for the ADV7612
 
   - reg: I2C slave address
 
@@ -22,10 +23,10 @@ port, in accordance with the video interface bindings defined in
 Documentation/devicetree/bindings/media/video-interfaces.txt. The port nodes
 are numbered as follows.
 
-  Port			ADV7611
+  Port			ADV7611    ADV7612
 ------------------------------------------------------------
-  HDMI			0
-  Digital output	1
+  HDMI			0             0, 1
+  Digital output	1                2
 
 The digital output port node must contain at least one endpoint.
 
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 1778d32..9f73a7f 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -80,6 +80,7 @@ MODULE_LICENSE("GPL");
 enum adv7604_type {
 	ADV7604,
 	ADV7611,
+	ADV7612,
 };
 
 struct adv7604_reg_seq {
@@ -2517,6 +2518,11 @@ static void adv7611_setup_irqs(struct v4l2_subdev *sd)
 	io_write(sd, 0x41, 0xd0); /* STDI irq for any change, disable INT2 */
 }
 
+static void adv7612_setup_irqs(struct v4l2_subdev *sd)
+{
+	io_write(sd, 0x41, 0xd0); /* disable INT2 */
+}
+
 static void adv7604_unregister_clients(struct adv7604_state *state)
 {
 	unsigned int i;
@@ -2601,6 +2607,19 @@ static const struct adv7604_reg_seq adv7611_recommended_settings_hdmi[] = {
 	{ ADV7604_REG_SEQ_TERM, 0 },
 };
 
+static const struct adv7604_reg_seq adv7612_recommended_settings_hdmi[] = {
+	{ ADV7604_REG(ADV7604_PAGE_CP, 0x6c), 0x00 },
+	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x9b), 0x03 },
+	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x6f), 0x08 },
+	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x85), 0x1f },
+	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x87), 0x70 },
+	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x57), 0xda },
+	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x58), 0x01 },
+	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x03), 0x98 },
+	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x4c), 0x44 },
+	{ ADV7604_REG_SEQ_TERM, 0 },
+};
+
 static const struct adv7604_chip_info adv7604_chip_info[] = {
 	[ADV7604] = {
 		.type = ADV7604,
@@ -2663,17 +2682,47 @@ static const struct adv7604_chip_info adv7604_chip_info[] = {
 			BIT(ADV7604_PAGE_REP) |  BIT(ADV7604_PAGE_EDID) |
 			BIT(ADV7604_PAGE_HDMI) | BIT(ADV7604_PAGE_CP),
 	},
+	[ADV7612] = {
+		.type = ADV7612,
+		.has_afe = false,
+		.max_port = ADV7604_PAD_HDMI_PORT_B,
+		.num_dv_ports = 2,
+		.edid_enable_reg = 0x74,
+		.edid_status_reg = 0x76,
+		.lcf_reg = 0xa3,
+		.tdms_lock_mask = 0x43,
+		.cable_det_mask = 0x01,
+		.fmt_change_digital_mask = 0x03,
+		.formats = adv7604_formats,
+		.nformats = ARRAY_SIZE(adv7604_formats),
+		.set_termination = adv7611_set_termination,
+		.setup_irqs = adv7612_setup_irqs,
+		.read_hdmi_pixelclock = adv7611_read_hdmi_pixelclock,
+		.read_cable_det = adv7611_read_cable_det,
+		.recommended_settings = {
+		    [1] = adv7612_recommended_settings_hdmi,
+		},
+		.num_recommended_settings = {
+		    [1] = ARRAY_SIZE(adv7612_recommended_settings_hdmi),
+		},
+		.page_mask = BIT(ADV7604_PAGE_IO) | BIT(ADV7604_PAGE_CEC) |
+			BIT(ADV7604_PAGE_INFOFRAME) | BIT(ADV7604_PAGE_AFE) |
+			BIT(ADV7604_PAGE_REP) |  BIT(ADV7604_PAGE_EDID) |
+			BIT(ADV7604_PAGE_HDMI) | BIT(ADV7604_PAGE_CP),
+	},
 };
 
 static struct i2c_device_id adv7604_i2c_id[] = {
 	{ "adv7604", (kernel_ulong_t)&adv7604_chip_info[ADV7604] },
 	{ "adv7611", (kernel_ulong_t)&adv7604_chip_info[ADV7611] },
+	{ "adv7612", (kernel_ulong_t)&adv7604_chip_info[ADV7612] },
 	{ }
 };
 MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
 
 static struct of_device_id adv7604_of_id[] __maybe_unused = {
 	{ .compatible = "adi,adv7611", .data = &adv7604_chip_info[ADV7611] },
+	{ .compatible = "adi,adv7612", .data = &adv7604_chip_info[ADV7612] },
 	{ }
 };
 MODULE_DEVICE_TABLE(of, adv7604_of_id);
@@ -2828,8 +2877,9 @@ static int adv7604_probe(struct i2c_client *client,
 	} else {
 		val = (adv_smbus_read_byte_data_check(client, 0xea, false) << 8)
 		    | (adv_smbus_read_byte_data_check(client, 0xeb, false) << 0);
-		if (val != 0x2051) {
-			v4l2_info(sd, "not an adv7611 on address 0x%x\n",
+		if ((state->info->type == ADV7611 && val != 0x2051) ||
+		    (state->info->type == ADV7612 && val != 0x2041)) {
+			v4l2_info(sd, "not an adv761x on address 0x%x\n",
 					client->addr << 1);
 			return -ENODEV;
 		}
-- 
1.9.1

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

* [PATCH 2/2] media: adv7604: Add ability to read default input port from DT
  2014-08-11 12:05 [PATCH 0/1 v1] adv7604: Add adv7612 support Ian Molton
@ 2014-08-11 12:05     ` Ian Molton
       [not found] ` <1407758719-12474-1-git-send-email-ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
  1 sibling, 0 replies; 8+ messages in thread
From: Ian Molton @ 2014-08-11 12:05 UTC (permalink / raw)
  To: linux-media-u79uwXL29TY76Z2rM5mHXA
  Cc: laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw,
	hans.verkuil-FYB4Gu1CFyUAvxtiuMwx3w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	devicetree-u79uwXL29TY76Z2rM5mHXA, lars-Qo5EllUWu/uELgA04lAiVw,
	shubhrajyoti-l0cyMroinI0, william-towle-4yDnlxn2s6sWdaTGBSpHTA,
	ian.molton-4yDnlxn2s6sWdaTGBSpHTA

This patch adds support to the adv7604 driver for reading the default
selected input from the Device tree. If none is provided, the driver will not
select an input without help from userspace.

Tested-by: William Towle <william.towle-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
Signed-off-by: Ian Molton <ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
---
 Documentation/devicetree/bindings/media/i2c/adv7604.txt | 5 ++++-
 drivers/media/i2c/adv7604.c                             | 9 +++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index cc0708c..6e8ace0 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -41,11 +41,12 @@ Optional Endpoint Properties:
 
   - hsync-active: Horizontal synchronization polarity. Defaults to active low.
   - vsync-active: Vertical synchronization polarity. Defaults to active low.
-  - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge.
+  - pclk-sample:  Pixel clock polarity. Defaults to output on the falling edge.
 
   If none of hsync-active, vsync-active and pclk-sample is specified the
   endpoint will use embedded BT.656 synchronization.
 
+  - default-input: Select which input is selected after reset.
 
 Example:
 
@@ -59,6 +60,8 @@ Example:
 		#address-cells = <1>;
 		#size-cells = <0>;
 
+		default-input = <0>;
+
 		port@0 {
 			reg = <0>;
 		};
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 9f73a7f..75e1942 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2732,7 +2732,7 @@ static int adv7604_parse_dt(struct adv7604_state *state)
 	struct v4l2_of_endpoint bus_cfg;
 	struct device_node *endpoint;
 	struct device_node *np;
-	unsigned int flags;
+	unsigned int flags, v;
 
 	np = state->i2c_clients[ADV7604_PAGE_IO]->dev.of_node;
 
@@ -2742,6 +2742,12 @@ static int adv7604_parse_dt(struct adv7604_state *state)
 		return -EINVAL;
 
 	v4l2_of_parse_endpoint(endpoint, &bus_cfg);
+
+	 if (!of_property_read_u32(endpoint, "default_input", &v))
+		state->pdata.default_input = v;
+	else
+		state->pdata.default_input = -1;
+
 	of_node_put(endpoint);
 
 	flags = bus_cfg.bus.parallel.flags;
@@ -2780,7 +2786,6 @@ static int adv7604_parse_dt(struct adv7604_state *state)
 	/* Hardcode the remaining platform data fields. */
 	state->pdata.disable_pwrdnb = 0;
 	state->pdata.disable_cable_det_rst = 0;
-	state->pdata.default_input = -1;
 	state->pdata.blank_data = 1;
 	state->pdata.alt_data_sat = 1;
 	state->pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0;
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH 2/2] media: adv7604: Add ability to read default input port from DT
@ 2014-08-11 12:05     ` Ian Molton
  0 siblings, 0 replies; 8+ messages in thread
From: Ian Molton @ 2014-08-11 12:05 UTC (permalink / raw)
  To: linux-media
  Cc: laurent.pinchart, hans.verkuil, robh+dt, devicetree, lars,
	shubhrajyoti, william-towle, ian.molton

This patch adds support to the adv7604 driver for reading the default
selected input from the Device tree. If none is provided, the driver will not
select an input without help from userspace.

Tested-by: William Towle <william.towle@codethink.co.uk>
Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
---
 Documentation/devicetree/bindings/media/i2c/adv7604.txt | 5 ++++-
 drivers/media/i2c/adv7604.c                             | 9 +++++++--
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index cc0708c..6e8ace0 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -41,11 +41,12 @@ Optional Endpoint Properties:
 
   - hsync-active: Horizontal synchronization polarity. Defaults to active low.
   - vsync-active: Vertical synchronization polarity. Defaults to active low.
-  - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge.
+  - pclk-sample:  Pixel clock polarity. Defaults to output on the falling edge.
 
   If none of hsync-active, vsync-active and pclk-sample is specified the
   endpoint will use embedded BT.656 synchronization.
 
+  - default-input: Select which input is selected after reset.
 
 Example:
 
@@ -59,6 +60,8 @@ Example:
 		#address-cells = <1>;
 		#size-cells = <0>;
 
+		default-input = <0>;
+
 		port@0 {
 			reg = <0>;
 		};
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 9f73a7f..75e1942 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2732,7 +2732,7 @@ static int adv7604_parse_dt(struct adv7604_state *state)
 	struct v4l2_of_endpoint bus_cfg;
 	struct device_node *endpoint;
 	struct device_node *np;
-	unsigned int flags;
+	unsigned int flags, v;
 
 	np = state->i2c_clients[ADV7604_PAGE_IO]->dev.of_node;
 
@@ -2742,6 +2742,12 @@ static int adv7604_parse_dt(struct adv7604_state *state)
 		return -EINVAL;
 
 	v4l2_of_parse_endpoint(endpoint, &bus_cfg);
+
+	 if (!of_property_read_u32(endpoint, "default_input", &v))
+		state->pdata.default_input = v;
+	else
+		state->pdata.default_input = -1;
+
 	of_node_put(endpoint);
 
 	flags = bus_cfg.bus.parallel.flags;
@@ -2780,7 +2786,6 @@ static int adv7604_parse_dt(struct adv7604_state *state)
 	/* Hardcode the remaining platform data fields. */
 	state->pdata.disable_pwrdnb = 0;
 	state->pdata.disable_cable_det_rst = 0;
-	state->pdata.default_input = -1;
 	state->pdata.blank_data = 1;
 	state->pdata.alt_data_sat = 1;
 	state->pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0;
-- 
1.9.1


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

* Re: [PATCH 2/2] media: adv7604: Add ability to read default input port from DT
  2014-08-11 12:05     ` Ian Molton
  (?)
@ 2014-08-11 12:19     ` Mark Rutland
  2014-08-13 12:14       ` Ian Molton
  -1 siblings, 1 reply; 8+ messages in thread
From: Mark Rutland @ 2014-08-11 12:19 UTC (permalink / raw)
  To: Ian Molton
  Cc: linux-media, laurent.pinchart, hans.verkuil, robh+dt, devicetree,
	lars, shubhrajyoti, william-towle

On Mon, Aug 11, 2014 at 01:05:19PM +0100, Ian Molton wrote:
> This patch adds support to the adv7604 driver for reading the default
> selected input from the Device tree. If none is provided, the driver will not
> select an input without help from userspace.
> 
> Tested-by: William Towle <william.towle@codethink.co.uk>
> Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
> ---
>  Documentation/devicetree/bindings/media/i2c/adv7604.txt | 5 ++++-
>  drivers/media/i2c/adv7604.c                             | 9 +++++++--
>  2 files changed, 11 insertions(+), 3 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> index cc0708c..6e8ace0 100644
> --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> @@ -41,11 +41,12 @@ Optional Endpoint Properties:
>  
>    - hsync-active: Horizontal synchronization polarity. Defaults to active low.
>    - vsync-active: Vertical synchronization polarity. Defaults to active low.
> -  - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge.
> +  - pclk-sample:  Pixel clock polarity. Defaults to output on the falling edge.

Unrelated whitespace change?

>  
>    If none of hsync-active, vsync-active and pclk-sample is specified the
>    endpoint will use embedded BT.656 synchronization.
>  
> +  - default-input: Select which input is selected after reset.

Valid values are?

>  
>  Example:
>  
> @@ -59,6 +60,8 @@ Example:
>  		#address-cells = <1>;
>  		#size-cells = <0>;
>  
> +		default-input = <0>;
> +
>  		port@0 {
>  			reg = <0>;
>  		};
> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
> index 9f73a7f..75e1942 100644
> --- a/drivers/media/i2c/adv7604.c
> +++ b/drivers/media/i2c/adv7604.c
> @@ -2732,7 +2732,7 @@ static int adv7604_parse_dt(struct adv7604_state *state)
>  	struct v4l2_of_endpoint bus_cfg;
>  	struct device_node *endpoint;
>  	struct device_node *np;
> -	unsigned int flags;
> +	unsigned int flags, v;
>  
>  	np = state->i2c_clients[ADV7604_PAGE_IO]->dev.of_node;
>  
> @@ -2742,6 +2742,12 @@ static int adv7604_parse_dt(struct adv7604_state *state)
>  		return -EINVAL;
>  
>  	v4l2_of_parse_endpoint(endpoint, &bus_cfg);
> +
> +	 if (!of_property_read_u32(endpoint, "default_input", &v))

This doesn't match the binding ('_' vs '-').

Thanks,
Mark.

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

* Re: [PATCH 2/2] media: adv7604: Add ability to read default input port from DT
  2014-08-11 12:19     ` Mark Rutland
@ 2014-08-13 12:14       ` Ian Molton
  2014-08-13 16:24         ` Mark Rutland
  0 siblings, 1 reply; 8+ messages in thread
From: Ian Molton @ 2014-08-13 12:14 UTC (permalink / raw)
  To: Mark Rutland
  Cc: linux-media, laurent.pinchart, hans.verkuil, robh+dt, devicetree,
	lars, shubhrajyoti, william.towle

On Mon, 11 Aug 2014 13:19:02 +0100
Mark Rutland <mark.rutland@arm.com> wrote:

> > -  - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge.
> > +  - pclk-sample:  Pixel clock polarity. Defaults to output on the falling edge.
> 
> Unrelated whitespace change?

Is there a sensible way to get miniscule whitespace changes in?

> >    If none of hsync-active, vsync-active and pclk-sample is specified the
> >    endpoint will use embedded BT.656 synchronization.
> >  
> > +  - default-input: Select which input is selected after reset.
> 
> Valid values are?

Chip dependent. 0 for 7611, 0-1 for 7612, I expect there are other chips in the family with differing numbers of inputs.

> > +	 if (!of_property_read_u32(endpoint, "default_input", &v))
> 
> This doesn't match the binding ('_' vs '-').

Good catch!

-- 
Ian Molton <ian.molton@codethink.co.uk>

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

* Re: [PATCH 2/2] media: adv7604: Add ability to read default input port from DT
  2014-08-13 12:14       ` Ian Molton
@ 2014-08-13 16:24         ` Mark Rutland
  0 siblings, 0 replies; 8+ messages in thread
From: Mark Rutland @ 2014-08-13 16:24 UTC (permalink / raw)
  To: Ian Molton
  Cc: linux-media, laurent.pinchart, hans.verkuil, robh+dt, devicetree,
	lars, shubhrajyoti, william.towle

On Wed, Aug 13, 2014 at 01:14:35PM +0100, Ian Molton wrote:
> On Mon, 11 Aug 2014 13:19:02 +0100
> Mark Rutland <mark.rutland@arm.com> wrote:
> 
> > > -  - pclk-sample: Pixel clock polarity. Defaults to output on the falling edge.
> > > +  - pclk-sample:  Pixel clock polarity. Defaults to output on the falling edge.
> > 
> > Unrelated whitespace change?
> 
> Is there a sensible way to get miniscule whitespace changes in?

Just mention it in the commit message.

> > >    If none of hsync-active, vsync-active and pclk-sample is specified the
> > >    endpoint will use embedded BT.656 synchronization.
> > >  
> > > +  - default-input: Select which input is selected after reset.
> > 
> > Valid values are?
> 
> Chip dependent. 0 for 7611, 0-1 for 7612, I expect there are other chips in the family with differing numbers of inputs.

Ok. Can this be mentioned in the documentation?

Cheers,
Mark.

> > > +	 if (!of_property_read_u32(endpoint, "default_input", &v))
> > 
> > This doesn't match the binding ('_' vs '-').
> 
> Good catch!
> 
> -- 
> Ian Molton <ian.molton@codethink.co.uk>
> --
> To unsubscribe from this list: send the line "unsubscribe devicetree" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

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

* Re: [PATCH 1/2] media: adv7604: Add support for ADV7612 dual HDMI input decoder.
  2014-08-11 12:05 ` [PATCH 1/2] media: adv7604: Add support for ADV7612 dual HDMI input decoder Ian Molton
@ 2014-08-18 22:25   ` Laurent Pinchart
  0 siblings, 0 replies; 8+ messages in thread
From: Laurent Pinchart @ 2014-08-18 22:25 UTC (permalink / raw)
  To: Ian Molton
  Cc: linux-media, hans.verkuil, robh+dt, devicetree, lars,
	shubhrajyoti, william-towle

Hi Ian,

Thank you for the patch.

On Monday 11 August 2014 13:05:18 Ian Molton wrote:
> This patch adds necessary support for the ADV7612 dual HDMI decoder /
> repeater chip.
> 
> This was tested using a heavily modified rcar_vin/soc_camera capture driver.
> 
> Tested-by: William Towle <william.towle@codethink.co.uk>
> Signed-off-by: Ian Molton <ian.molton@codethink.co.uk>
> ---
>  .../devicetree/bindings/media/i2c/adv7604.txt      | 17 +++----
>  drivers/media/i2c/adv7604.c                        | 54 ++++++++++++++++++-
>  2 files changed, 61 insertions(+), 10 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index
> c27cede..cc0708c 100644
> --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> @@ -1,15 +1,16 @@
> -* Analog Devices ADV7604/11 video decoder with HDMI receiver
> +* Analog Devices ADV7604/11/12 video decoder with HDMI receiver
> 
> -The ADV7604 and ADV7611 are multiformat video decoders with an integrated
> HDMI
> -receiver. The ADV7604 has four multiplexed HDMI inputs and one analog
> input,
> -and the ADV7611 has one HDMI input and no analog input.
> +The ADV7604 and ADV7611/12 are multiformat video decoders with an
> integrated
> +HDMI receiver. The ADV7604 has four multiplexed HDMI inputs and one analog
> +input, and the ADV7611 has one HDMI input and no analog input. The 7612 is
> similar to the 7611 but has 2 HDMI inputs.

Any reason to make the last line stand out instead of wrapping it at 80 
characters ?

> -These device tree bindings support the ADV7611 only at the moment.
> +These device tree bindings support the ADV7611/12 only at the moment.
> 
>  Required Properties:
> 
>    - compatible: Must contain one of the following
>      - "adi,adv7611" for the ADV7611
> +    - "adi,adv7612" for the ADV7612
> 
>    - reg: I2C slave address
> 
> @@ -22,10 +23,10 @@ port, in accordance with the video interface bindings
> defined in Documentation/devicetree/bindings/media/video-interfaces.txt.
> The port nodes are numbered as follows.
> 
> -  Port			ADV7611
> +  Port			ADV7611    ADV7612
>  ------------------------------------------------------------
> -  HDMI			0
> -  Digital output	1
> +  HDMI			0             0, 1
> +  Digital output	1                2
> 
>  The digital output port node must contain at least one endpoint.
> 
> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
> index 1778d32..9f73a7f 100644
> --- a/drivers/media/i2c/adv7604.c
> +++ b/drivers/media/i2c/adv7604.c
> @@ -80,6 +80,7 @@ MODULE_LICENSE("GPL");
>  enum adv7604_type {
>  	ADV7604,
>  	ADV7611,
> +	ADV7612,
>  };
> 
>  struct adv7604_reg_seq {
> @@ -2517,6 +2518,11 @@ static void adv7611_setup_irqs(struct v4l2_subdev
> *sd) io_write(sd, 0x41, 0xd0); /* STDI irq for any change, disable INT2 */
> }
> 
> +static void adv7612_setup_irqs(struct v4l2_subdev *sd)
> +{
> +	io_write(sd, 0x41, 0xd0); /* disable INT2 */
> +}
> +
>  static void adv7604_unregister_clients(struct adv7604_state *state)
>  {
>  	unsigned int i;
> @@ -2601,6 +2607,19 @@ static const struct adv7604_reg_seq
> adv7611_recommended_settings_hdmi[] = { { ADV7604_REG_SEQ_TERM, 0 },
>  };
> 
> +static const struct adv7604_reg_seq adv7612_recommended_settings_hdmi[] = {

Could you please add a comment here with a reference to the documentation, 
like done for ADV7604 and ADV7611 ?

> +	{ ADV7604_REG(ADV7604_PAGE_CP, 0x6c), 0x00 },
> +	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x9b), 0x03 },
> +	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x6f), 0x08 },
> +	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x85), 0x1f },
> +	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x87), 0x70 },
> +	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x57), 0xda },
> +	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x58), 0x01 },
> +	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x03), 0x98 },
> +	{ ADV7604_REG(ADV7604_PAGE_HDMI, 0x4c), 0x44 },

Aren't you missing the equalizer settings ?

> +	{ ADV7604_REG_SEQ_TERM, 0 },
> +};
> +
>  static const struct adv7604_chip_info adv7604_chip_info[] = {
>  	[ADV7604] = {
>  		.type = ADV7604,
> @@ -2663,17 +2682,47 @@ static const struct adv7604_chip_info
> adv7604_chip_info[] = { BIT(ADV7604_PAGE_REP) |  BIT(ADV7604_PAGE_EDID) |
>  			BIT(ADV7604_PAGE_HDMI) | BIT(ADV7604_PAGE_CP),
>  	},
> +	[ADV7612] = {
> +		.type = ADV7612,
> +		.has_afe = false,
> +		.max_port = ADV7604_PAD_HDMI_PORT_B,
> +		.num_dv_ports = 2,
> +		.edid_enable_reg = 0x74,
> +		.edid_status_reg = 0x76,
> +		.lcf_reg = 0xa3,
> +		.tdms_lock_mask = 0x43,
> +		.cable_det_mask = 0x01,
> +		.fmt_change_digital_mask = 0x03,
> +		.formats = adv7604_formats,
> +		.nformats = ARRAY_SIZE(adv7604_formats),
> +		.set_termination = adv7611_set_termination,
> +		.setup_irqs = adv7612_setup_irqs,
> +		.read_hdmi_pixelclock = adv7611_read_hdmi_pixelclock,
> +		.read_cable_det = adv7611_read_cable_det,
> +		.recommended_settings = {
> +		    [1] = adv7612_recommended_settings_hdmi,
> +		},
> +		.num_recommended_settings = {
> +		    [1] = ARRAY_SIZE(adv7612_recommended_settings_hdmi),
> +		},
> +		.page_mask = BIT(ADV7604_PAGE_IO) | BIT(ADV7604_PAGE_CEC) |
> +			BIT(ADV7604_PAGE_INFOFRAME) | BIT(ADV7604_PAGE_AFE) |
> +			BIT(ADV7604_PAGE_REP) |  BIT(ADV7604_PAGE_EDID) |
> +			BIT(ADV7604_PAGE_HDMI) | BIT(ADV7604_PAGE_CP),
> +	},
>  };
> 
>  static struct i2c_device_id adv7604_i2c_id[] = {
>  	{ "adv7604", (kernel_ulong_t)&adv7604_chip_info[ADV7604] },
>  	{ "adv7611", (kernel_ulong_t)&adv7604_chip_info[ADV7611] },
> +	{ "adv7612", (kernel_ulong_t)&adv7604_chip_info[ADV7612] },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
> 
>  static struct of_device_id adv7604_of_id[] __maybe_unused = {
>  	{ .compatible = "adi,adv7611", .data = &adv7604_chip_info[ADV7611] },
> +	{ .compatible = "adi,adv7612", .data = &adv7604_chip_info[ADV7612] },
>  	{ }
>  };
>  MODULE_DEVICE_TABLE(of, adv7604_of_id);
> @@ -2828,8 +2877,9 @@ static int adv7604_probe(struct i2c_client *client,
>  	} else {
>  		val = (adv_smbus_read_byte_data_check(client, 0xea, false) << 8)
>  		    | (adv_smbus_read_byte_data_check(client, 0xeb, false) << 0);
> 
> -		if (val != 0x2051) {
> -			v4l2_info(sd, "not an adv7611 on address 0x%x\n",
> +		if ((state->info->type == ADV7611 && val != 0x2051) ||
> +		    (state->info->type == ADV7612 && val != 0x2041)) {
> +			v4l2_info(sd, "not an adv761x on address 0x%x\n",

Not a major issue, but that message could be misleading, as it could get 
printed when an ADV7611/12 is detected when an ADV7612/11 was expected.

>  					client->addr << 1);
>  			return -ENODEV;
>  		}

-- 
Regards,

Laurent Pinchart

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

end of thread, other threads:[~2014-08-18 22:25 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-11 12:05 [PATCH 0/1 v1] adv7604: Add adv7612 support Ian Molton
2014-08-11 12:05 ` [PATCH 1/2] media: adv7604: Add support for ADV7612 dual HDMI input decoder Ian Molton
2014-08-18 22:25   ` Laurent Pinchart
     [not found] ` <1407758719-12474-1-git-send-email-ian.molton-4yDnlxn2s6sWdaTGBSpHTA@public.gmane.org>
2014-08-11 12:05   ` [PATCH 2/2] media: adv7604: Add ability to read default input port from DT Ian Molton
2014-08-11 12:05     ` Ian Molton
2014-08-11 12:19     ` Mark Rutland
2014-08-13 12:14       ` Ian Molton
2014-08-13 16:24         ` Mark Rutland

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.