[PATCH 04/20] media: adv7604: document support for ADV7612 dual HDMI input decoder

2015-05-21 Thread William Towle
From: Ian Molton ian.mol...@codethink.co.uk

This documentation accompanies the patch adding support for the ADV7612
dual HDMI decoder / repeater chip.

Signed-off-by: Ian Molton ian.mol...@codethink.co.uk
Reviewed-by: William Towle william.to...@codethink.co.uk
---
 .../devicetree/bindings/media/i2c/adv7604.txt|   18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..7eafdbc 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -1,15 +1,17 @@
-* 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 +24,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 ADV7611ADV7612
 
-  HDMI 0
-  Digital output   1
+  HDMI 0 0, 1
+  Digital output   12
 
 The digital output port node must contain at least one endpoint.
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/15] media: adv7604: document support for ADV7612 dual HDMI input decoder

2015-06-03 Thread William Towle
From: Ian Molton ian.mol...@codethink.co.uk

This documentation accompanies the patch adding support for the ADV7612
dual HDMI decoder / repeater chip.

Signed-off-by: Ian Molton ian.mol...@codethink.co.uk
Reviewed-by: William Towle william.to...@codethink.co.uk
---
 .../devicetree/bindings/media/i2c/adv7604.txt|   18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..7eafdbc 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -1,15 +1,17 @@
-* 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 +24,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 ADV7611ADV7612
 
-  HDMI 0
-  Digital output   1
+  HDMI 0 0, 1
+  Digital output   12
 
 The digital output port node must contain at least one endpoint.
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/15] media: adv7604: document support for ADV7612 dual HDMI input decoder

2015-06-25 Thread William Towle
From: Ian Molton ian.mol...@codethink.co.uk

This documentation accompanies the patch adding support for the ADV7612
dual HDMI decoder / repeater chip.

Signed-off-by: Ian Molton ian.mol...@codethink.co.uk
Reviewed-by: William Towle william.to...@codethink.co.uk
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt|   18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..7eafdbc 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -1,15 +1,17 @@
-* 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 +24,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 ADV7611ADV7612
 
-  HDMI 0
-  Digital output   1
+  HDMI 0 0, 1
+  Digital output   12
 
 The digital output port node must contain at least one endpoint.
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 05/15] media: adv7604: document support for ADV7612 dual HDMI input decoder

2015-06-12 Thread Hans Verkuil
On 06/03/2015 03:59 PM, William Towle wrote:
 From: Ian Molton ian.mol...@codethink.co.uk
 
 This documentation accompanies the patch adding support for the ADV7612
 dual HDMI decoder / repeater chip.
 
 Signed-off-by: Ian Molton ian.mol...@codethink.co.uk
 Reviewed-by: William Towle william.to...@codethink.co.uk

Acked-by: Hans Verkuil hans.verk...@cisco.com

 ---
  .../devicetree/bindings/media/i2c/adv7604.txt|   18 
 ++
  1 file changed, 10 insertions(+), 8 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 index c27cede..7eafdbc 100644
 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -1,15 +1,17 @@
 -* 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 +24,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   ADV7611ADV7612
  
 -  HDMI   0
 -  Digital output 1
 +  HDMI   0 0, 1
 +  Digital output 12
  
  The digital output port node must contain at least one endpoint.
  
 

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 05/15] media: adv7604: document support for ADV7612 dual HDMI input decoder

2015-05-27 Thread William Towle
From: Ian Molton ian.mol...@codethink.co.uk

This documentation accompanies the patch adding support for the ADV7612
dual HDMI decoder / repeater chip.

Signed-off-by: Ian Molton ian.mol...@codethink.co.uk
Reviewed-by: William Towle william.to...@codethink.co.uk
---
 .../devicetree/bindings/media/i2c/adv7604.txt|   18 ++
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..7eafdbc 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -1,15 +1,17 @@
-* 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 +24,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 ADV7611ADV7612
 
-  HDMI 0
-  Digital output   1
+  HDMI 0 0, 1
+  Digital output   12
 
 The digital output port node must contain at least one endpoint.
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/2] media: adv7604: Add support for ADV7612 dual HDMI input decoder.

2014-08-18 Thread Laurent Pinchart
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.to...@codethink.co.uk
 Signed-off-by: Ian Molton ian.mol...@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   ADV7611ADV7612
  
 -  HDMI   0
 -  Digital output 1
 +  HDMI   0 0, 1
 +  Digital output 12
 
  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

[PATCH 1/2] media: adv7604: Add support for ADV7612 dual HDMI input decoder.

2014-08-11 Thread 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.to...@codethink.co.uk
Signed-off-by: Ian Molton ian.mol...@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 ADV7611ADV7612
 
-  HDMI 0
-  Digital output   1
+  HDMI 0 0, 1
+  Digital output   12
 
 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

Re: [PATCH v4 45/49] adv7604: Add DT support

2014-04-17 Thread Laurent Pinchart
Hi Sylwester,

On Thursday 17 April 2014 16:39:29 Sylwester Nawrocki wrote:
 On 17/04/14 16:13, Laurent Pinchart wrote:
  Parse the device tree node to populate platform data. Only the ADV7611
  is currently support with DT.
  
  Cc: devicet...@vger.kernel.org
  Cc: Sylwester Nawrocki s.nawro...@samsung.com
  Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
  Acked-by: Hans Verkuil hans.verk...@cisco.com
 
 The patch looks good to me.
 
 Acked-by: Sylwester Nawrocki s.nawro...@samsung.com

Thank you.

 Just one comment below...

[snip]

  diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
  index 342d73d..061794e 100644
  --- a/drivers/media/i2c/adv7604.c
  +++ b/drivers/media/i2c/adv7604.c
  @@ -2663,13 +2663,58 @@ static const struct adv7604_chip_info
  adv7604_chip_info[] = { 
  },
   
   };
  
  +static struct i2c_device_id adv7604_i2c_id[] = {
  +   { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
  +   { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
  +   { }
  +};
  +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
  +
  +static struct of_device_id adv7604_of_id[] = {
 
 Not adding __maybe_unused attribute to this one ?

Sure, of course. I'll squash patch 49/49 into this one.

  +   { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
  +   { }
  +};
  +MODULE_DEVICE_TABLE(of, adv7604_of_id);

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] adv7604: Add DT parsing support

2014-10-22 Thread Jean-Michel Hautbois
This patch adds support for DT parsing of ADV7604 as well as ADV7611.
It needs to be improved in order to get ports parsing too.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
 Documentation/devicetree/bindings/media/i2c/adv7604.txt | 1 +
 drivers/media/i2c/adv7604.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..5c8b3e6 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -10,6 +10,7 @@ Required Properties:
 
   - compatible: Must contain one of the following
 - adi,adv7611 for the ADV7611
+- adi,adv7604 for the ADV7604
 
   - reg: I2C slave address
 
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 47795ff..421035f 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2677,6 +2677,7 @@ 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,adv7604, .data = adv7604_chip_info[ADV7604] },
{ }
 };
 MODULE_DEVICE_TABLE(of, adv7604_of_id);
-- 
2.1.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] adv7604: Add DT parsing support

2014-10-22 Thread Laurent Pinchart
Hi Jean-Michel,

Thank you for the patch.

On Wednesday 22 October 2014 17:34:21 Jean-Michel Hautbois wrote:
 This patch adds support for DT parsing of ADV7604 as well as ADV7611.
 It needs to be improved in order to get ports parsing too.

Let's improve it then :-) The DT bindings as proposed by this patch are 
incomplete, that's just asking for trouble.

How would you model the adv7604 ports ?

 Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
 ---
  Documentation/devicetree/bindings/media/i2c/adv7604.txt | 1 +
  drivers/media/i2c/adv7604.c | 1 +
  2 files changed, 2 insertions(+)
 
 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index
 c27cede..5c8b3e6 100644
 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -10,6 +10,7 @@ Required Properties:
 
- compatible: Must contain one of the following
  - adi,adv7611 for the ADV7611
 +- adi,adv7604 for the ADV7604

Please switch the two lines to keep them alphabetically sorted.
 
- reg: I2C slave address
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index 47795ff..421035f 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -2677,6 +2677,7 @@ 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,adv7604, .data = adv7604_chip_info[ADV7604] },

Same comment here.

   { }
  };
  MODULE_DEVICE_TABLE(of, adv7604_of_id);

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 3/8] WmT: document adi,adv7612

2015-01-29 Thread William Towle
---
 Documentation/devicetree/bindings/media/i2c/adv7604.txt |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index bc50da2..1ca6e5a 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -1,4 +1,4 @@
-* 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,
@@ -10,6 +10,7 @@ Required Properties:
 
   - compatible: Must contain one of the following
 - adi,adv7611 for the ADV7611
+- adi,adv7612 for the ADV7612
 
   - reg: I2C slave address
 
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 45/47] adv7604: Add DT support

2014-02-11 Thread Laurent Pinchart
Hi Hans,

On Tuesday 11 February 2014 10:23:03 Hans Verkuil wrote:
 On 02/05/14 17:42, Laurent Pinchart wrote:
  Parse the device tree node to populate platform data.
  
  Cc: devicet...@vger.kernel.org
  Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
  ---
  
   .../devicetree/bindings/media/i2c/adv7604.txt  |  56 
   drivers/media/i2c/adv7604.c| 101 ++--
   2 files changed, 143 insertions(+), 14 deletions(-)
   create mode 100644
   Documentation/devicetree/bindings/media/i2c/adv7604.txt
  
  diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
  b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode
  100644
  index 000..0845c50
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
  @@ -0,0 +1,56 @@
  +* Analog Devices ADV7604/11 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.
  +
  +Required Properties:
  +
  +  - compatible: Must contain one of the following
  +- adi,adv7604 for the ADV7604
  +- adi,adv7611 for the ADV7611
  +
  +  - reg: I2C slave address
  +
  +  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
  +detection pins, one per HDMI input. The active flag indicates the
  GPIO
  +level that enables hot-plug detection.
  +
  +Optional Properties:
  +
  +  - reset-gpios: Reference to the GPIO connected to the device's reset
  pin. +
  +  - adi,default-input: Index of the input to be configured as default.
  Valid +values are 0..5 for the ADV7604 and 0 for the ADV7611.
  +
  +  - adi,disable-power-down: Boolean property. When set forces the device
  to +ignore the power-down pin. The property is valid for the ADV7604
  only as +the ADV7611 has no power-down pin.
  +
  +  - adi,disable-cable-reset: Boolean property. When set disables the HDMI
  +receiver automatic reset when the HDMI cable is unplugged.
  +
  +Example:
  +
  +   hdmi_receiver@4c {
  +   compatible = adi,adv7611;
  +   reg = 0x4c;
  +
  +   reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
  +   hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
  +
  +   adi,default-input = 0;
  +
  +   #address-cells = 1;
  +   #size-cells = 0;
  +
  +   port@0 {
  +   reg = 0;
  +   };
  +   port@1 {
  +   reg = 1;
  +   hdmi_in: endpoint {
  +   remote-endpoint = ccdc_in;
  +   };
  +   };
  +   };
  diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
  index e586c1c..cd8a2dc 100644
  --- a/drivers/media/i2c/adv7604.c
  +++ b/drivers/media/i2c/adv7604.c
  @@ -32,6 +32,7 @@
  
   #include linux/i2c.h
   #include linux/kernel.h
   #include linux/module.h
  
  +#include linux/of_gpio.h
  
   #include linux/slab.h
   #include linux/v4l2-dv-timings.h
   #include linux/videodev2.h
  
  @@ -2641,13 +2642,83 @@ static const struct adv7604_chip_info
  adv7604_chip_info[] = { 
  },
   
   };
  
  +static struct i2c_device_id adv7604_i2c_id[] = {
  +   { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
  +   { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
  +   { }
  +};
  +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
  +
  +static struct of_device_id adv7604_of_id[] = {
  +   { .compatible = adi,adv7604, .data = adv7604_chip_info[ADV7604] },
  +   { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
  +   { }
  +};
  +MODULE_DEVICE_TABLE(of, adv7604_of_id);
  +
  +static int adv7604_parse_dt(struct adv7604_state *state)
 
 Put this under #ifdef CONFIG_OF.

#ifdef CONFIG_OF has been discouraged. I'll add an IS_ENABLED(CONFIG_OF) to 
condition the call of adv7604_parse_dt() and let the compiler optimize the 
function out, but I've been recommended to fix compilation errors instead of 
using conditional compilation.

 It fails to compile if CONFIG_OF is not set (as it is in my case since this
 driver is used with a PCIe card).

What's the compilation failure ?

  +{
  +   struct device_node *np;
  +   unsigned int i;
  +   int ret;
  +
  +   np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node;
  +   state-info = of_match_node(adv7604_of_id, np)-data;
  +
  +   state-pdata.disable_pwrdnb =
  +   of_property_read_bool(np, adi,disable-power-down);
  +   state-pdata.disable_cable_det_rst =
  +   of_property_read_bool(np, adi,disable-cable-reset);
  +
  +   ret = of_property_read_u32(np, adi,default-input,
  +  state-pdata.default_input);
  +   if (ret  0)
  +   state-pdata.default_input = -1;
  +
  +   for (i = 0; i  state-info-num_dv_ports; ++i) {
  +   enum of_gpio_flags flags;
  +
  +   state

Re: [PATCH 45/47] adv7604: Add DT support

2014-02-11 Thread Lars-Peter Clausen

On 02/11/2014 01:14 PM, Hans Verkuil wrote:



On 02/11/14 13:08, Laurent Pinchart wrote:

Hi Hans,

On Tuesday 11 February 2014 10:23:03 Hans Verkuil wrote:

On 02/05/14 17:42, Laurent Pinchart wrote:

Parse the device tree node to populate platform data.

Cc: devicet...@vger.kernel.org
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---

  .../devicetree/bindings/media/i2c/adv7604.txt  |  56 
  drivers/media/i2c/adv7604.c| 101 ++--
  2 files changed, 143 insertions(+), 14 deletions(-)
  create mode 100644
  Documentation/devicetree/bindings/media/i2c/adv7604.txt

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode
100644
index 000..0845c50
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -0,0 +1,56 @@
+* Analog Devices ADV7604/11 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.
+
+Required Properties:
+
+  - compatible: Must contain one of the following
+- adi,adv7604 for the ADV7604
+- adi,adv7611 for the ADV7611
+
+  - reg: I2C slave address
+
+  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
+detection pins, one per HDMI input. The active flag indicates the
GPIO
+level that enables hot-plug detection.
+
+Optional Properties:
+
+  - reset-gpios: Reference to the GPIO connected to the device's reset
pin. +
+  - adi,default-input: Index of the input to be configured as default.
Valid +values are 0..5 for the ADV7604 and 0 for the ADV7611.
+
+  - adi,disable-power-down: Boolean property. When set forces the device
to +ignore the power-down pin. The property is valid for the ADV7604
only as +the ADV7611 has no power-down pin.
+
+  - adi,disable-cable-reset: Boolean property. When set disables the HDMI
+receiver automatic reset when the HDMI cable is unplugged.
+
+Example:
+
+   hdmi_receiver@4c {
+   compatible = adi,adv7611;
+   reg = 0x4c;
+
+   reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
+   hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
+
+   adi,default-input = 0;
+
+   #address-cells = 1;
+   #size-cells = 0;
+
+   port@0 {
+   reg = 0;
+   };
+   port@1 {
+   reg = 1;
+   hdmi_in: endpoint {
+   remote-endpoint = ccdc_in;
+   };
+   };
+   };
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index e586c1c..cd8a2dc 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -32,6 +32,7 @@

  #include linux/i2c.h
  #include linux/kernel.h
  #include linux/module.h

+#include linux/of_gpio.h

  #include linux/slab.h
  #include linux/v4l2-dv-timings.h
  #include linux/videodev2.h

@@ -2641,13 +2642,83 @@ static const struct adv7604_chip_info
adv7604_chip_info[] = {
},

  };

+static struct i2c_device_id adv7604_i2c_id[] = {
+   { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
+   { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
+   { }
+};
+MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
+
+static struct of_device_id adv7604_of_id[] = {
+   { .compatible = adi,adv7604, .data = adv7604_chip_info[ADV7604] },
+   { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
+   { }
+};
+MODULE_DEVICE_TABLE(of, adv7604_of_id);
+
+static int adv7604_parse_dt(struct adv7604_state *state)


Put this under #ifdef CONFIG_OF.


#ifdef CONFIG_OF has been discouraged. I'll add an IS_ENABLED(CONFIG_OF) to
condition the call of adv7604_parse_dt() and let the compiler optimize the
function out, but I've been recommended to fix compilation errors instead of
using conditional compilation.


It fails to compile if CONFIG_OF is not set (as it is in my case since this
driver is used with a PCIe card).


What's the compilation failure ?


drivers/media/i2c/adv7604.c: In function ‘adv7604_parse_dt’:
drivers/media/i2c/adv7604.c:2671:48: warning: dereferencing ‘void *’ pointer 
[enabled by default]
   state-info = of_match_node(adv7604_of_id, np)-data;
 ^
drivers/media/i2c/adv7604.c:2671:48: error: request for member ‘data’ in 
something not a structure or union
make[3]: *** [drivers/media/i2c/adv7604.o] Error 1


That looks like a bug in the stubbed out version of of_match_node(). It 
should be a inline function with a return type, rather than a macro.


- Lars
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http

Re: [PATCH 45/47] adv7604: Add DT support

2014-02-11 Thread Laurent Pinchart
Hi Lars,

On Tuesday 11 February 2014 13:21:56 Lars-Peter Clausen wrote:
 On 02/11/2014 01:14 PM, Hans Verkuil wrote:
  On 02/11/14 13:08, Laurent Pinchart wrote:
  On Tuesday 11 February 2014 10:23:03 Hans Verkuil wrote:
  On 02/05/14 17:42, Laurent Pinchart wrote:
  Parse the device tree node to populate platform data.
  
  Cc: devicet...@vger.kernel.org
  Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
  ---
  
.../devicetree/bindings/media/i2c/adv7604.txt  |  56 
drivers/media/i2c/adv7604.c| 101 ++--
2 files changed, 143 insertions(+), 14 deletions(-)
create mode 100644
Documentation/devicetree/bindings/media/i2c/adv7604.txt
  
  diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
  b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode
  100644
  index 000..0845c50
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
  @@ -0,0 +1,56 @@
  +* Analog Devices ADV7604/11 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.
  +
  +Required Properties:
  +
  +  - compatible: Must contain one of the following
  +- adi,adv7604 for the ADV7604
  +- adi,adv7611 for the ADV7611
  +
  +  - reg: I2C slave address
  +
  +  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
  +detection pins, one per HDMI input. The active flag indicates the
  GPIO
  +level that enables hot-plug detection.
  +
  +Optional Properties:
  +
  +  - reset-gpios: Reference to the GPIO connected to the device's reset
  pin. +
  +  - adi,default-input: Index of the input to be configured as default.
  Valid +values are 0..5 for the ADV7604 and 0 for the ADV7611.
  +
  +  - adi,disable-power-down: Boolean property. When set forces the
  device
  to +ignore the power-down pin. The property is valid for the
  ADV7604
  only as +the ADV7611 has no power-down pin.
  +
  +  - adi,disable-cable-reset: Boolean property. When set disables the
  HDMI
  +receiver automatic reset when the HDMI cable is unplugged.
  +
  +Example:
  +
  +hdmi_receiver@4c {
  +compatible = adi,adv7611;
  +reg = 0x4c;
  +
  +reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
  +hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
  +
  +adi,default-input = 0;
  +
  +#address-cells = 1;
  +#size-cells = 0;
  +
  +port@0 {
  +reg = 0;
  +};
  +port@1 {
  +reg = 1;
  +hdmi_in: endpoint {
  +remote-endpoint = ccdc_in;
  +};
  +};
  +};
  diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
  index e586c1c..cd8a2dc 100644
  --- a/drivers/media/i2c/adv7604.c
  +++ b/drivers/media/i2c/adv7604.c
  @@ -32,6 +32,7 @@
  
#include linux/i2c.h
#include linux/kernel.h
#include linux/module.h
  
  +#include linux/of_gpio.h
  
#include linux/slab.h
#include linux/v4l2-dv-timings.h
#include linux/videodev2.h
  
  @@ -2641,13 +2642,83 @@ static const struct adv7604_chip_info
  adv7604_chip_info[] = {
  
   },

};
  
  +static struct i2c_device_id adv7604_i2c_id[] = {
  +{ adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
  +{ adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
  +{ }
  +};
  +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
  +
  +static struct of_device_id adv7604_of_id[] = {
  +{ .compatible = adi,adv7604, .data = 
  adv7604_chip_info[ADV7604] },
  +{ .compatible = adi,adv7611, .data = 
  adv7604_chip_info[ADV7611] },
  +{ }
  +};
  +MODULE_DEVICE_TABLE(of, adv7604_of_id);
  +
  +static int adv7604_parse_dt(struct adv7604_state *state)
  
  Put this under #ifdef CONFIG_OF.
  
  #ifdef CONFIG_OF has been discouraged. I'll add an IS_ENABLED(CONFIG_OF)
  to condition the call of adv7604_parse_dt() and let the compiler optimize
  the function out, but I've been recommended to fix compilation errors
  instead of using conditional compilation.
  
  It fails to compile if CONFIG_OF is not set (as it is in my case since
  this driver is used with a PCIe card).
  
  What's the compilation failure ?
  
  drivers/media/i2c/adv7604.c: In function ‘adv7604_parse_dt’:
  drivers/media/i2c/adv7604.c:2671:48: warning: dereferencing ‘void *’
  pointer [enabled by default] 
 state-info = of_match_node(adv7604_of_id, np)-data;
  
  drivers/media/i2c/adv7604.c:2671:48: error: request for member ‘data’ in
  something not a structure or union make[3]: ***
  [drivers/media/i2c/adv7604.o] Error 1

Re: [PATCH v2 46/48] adv7604: Add DT support

2014-04-17 Thread Laurent Pinchart
Hi Sylwester,

Thank you for the review.

On Thursday 17 April 2014 12:59:22 Sylwester Nawrocki wrote:
 On 11/03/14 00:15, Laurent Pinchart wrote:
  Parse the device tree node to populate platform data.
  
  Cc: devicet...@vger.kernel.org
  Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
  ---
  
   .../devicetree/bindings/media/i2c/adv7604.txt  | 56 +
   drivers/media/i2c/adv7604.c| 92 +
   2 files changed, 134 insertions(+), 14 deletions(-)
   create mode 100644
   Documentation/devicetree/bindings/media/i2c/adv7604.txt
  
  diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
  b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode
  100644
  index 000..0845c50
  --- /dev/null
  +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
  @@ -0,0 +1,56 @@
  +* Analog Devices ADV7604/11 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.
  +
  +Required Properties:
  +
  +  - compatible: Must contain one of the following
  +- adi,adv7604 for the ADV7604
  +- adi,adv7611 for the ADV7611
  +
  +  - reg: I2C slave address
  +
  +  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
  +detection pins, one per HDMI input. The active flag indicates the
  GPIO
  +level that enables hot-plug detection.
  +
  +Optional Properties:
  +
  +  - reset-gpios: Reference to the GPIO connected to the device's reset
  pin. +
  +  - adi,default-input: Index of the input to be configured as default.
  Valid
  +values are 0..5 for the ADV7604 and 0 for the ADV7611.
 
 I have some doubts about this property. Firstly, it seems it is not needed
 for ADV7611 since it is always 0 for that device ?
 Why can't we hard code in the driver some default input ?

I've thought about hardcoding a default input in the driver as well, but Hans 
wasn't really keen on the idea. Hans, could you please comment on this ?

 And which inputs it refers to ? HDMI inputs A..D + analog ? If we keep this
 property I think exact mapping of numbers to inputs should be included
 in description of this property.
 
  +  - adi,disable-power-down: Boolean property. When set forces the device
  to
  +ignore the power-down pin. The property is valid for the ADV7604 only
  as
  +the ADV7611 has no power-down pin.
 
 Does it refer to the !PWRDWN pin ? If so I would replace power-down with
 PWRDWN, so it is clear what we're talking about when someone looks only
 at the datasheet.

  +  - adi,disable-cable-reset: Boolean property. When set disables the HDMI
  +receiver automatic reset when the HDMI cable is unplugged.
 
 Couldn't this be configured from user space with some default assumed in the
 driver ?

Good question. I'm not sure what the exact use case for this is.

Let's be careful not to introduce unneeded properties, I'll drop those two 
properties for now, we can implement support for the features later when 
needed.

  +Example:
  +
  +   hdmi_receiver@4c {
  +   compatible = adi,adv7611;
  +   reg = 0x4c;
  +
  +   reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
  +   hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
  +
  +   adi,default-input = 0;
  +
  +   #address-cells = 1;
  +   #size-cells = 0;
  +
  +   port@0 {
  +   reg = 0;
  +   };
  +   port@1 {
  +   reg = 1;
  +   hdmi_in: endpoint {
  +   remote-endpoint = ccdc_in;
  +   };
  +   };
  +   };
  diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
  index cce140c..de44213 100644
  --- a/drivers/media/i2c/adv7604.c
  +++ b/drivers/media/i2c/adv7604.c

[snip]

  @@ -2836,21 +2906,15 @@ static int adv7604_remove(struct i2c_client
  *client) 
   /* --- */
  -static struct i2c_device_id adv7604_id[] = {
  -   { adv7604, ADV7604 },
  -   { adv7611, ADV7611 },
  -   { }
  -};
  -MODULE_DEVICE_TABLE(i2c, adv7604_id);
  -
   static struct i2c_driver adv7604_driver = {
  .driver = {
  .owner = THIS_MODULE,
  .name = adv7604,
  +   .of_match_table = of_match_ptr(adv7604_of_id),
 
 of_match_ptr() isn't necessary here.

Thanks, will fix in v3.

  },
  .probe = adv7604_probe,
  .remove = adv7604_remove,
  -   .id_table = adv7604_id,
  +   .id_table = adv7604_i2c_id,
   };
   
   module_i2c_driver(adv7604_driver);

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 46/48] adv7604: Add DT support

2014-04-17 Thread Laurent Pinchart
Hi Sylwester,

On Thursday 17 April 2014 14:36:32 Laurent Pinchart wrote:
 On Thursday 17 April 2014 12:59:22 Sylwester Nawrocki wrote:
  On 11/03/14 00:15, Laurent Pinchart wrote:
   Parse the device tree node to populate platform data.
   
   Cc: devicet...@vger.kernel.org
   Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
   ---
   
.../devicetree/bindings/media/i2c/adv7604.txt  | 56 +
drivers/media/i2c/adv7604.c| 92
+
2 files changed, 134 insertions(+), 14 deletions(-)
create mode 100644
Documentation/devicetree/bindings/media/i2c/adv7604.txt
   
   diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
   b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode
   100644
   index 000..0845c50
   --- /dev/null
   +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
   @@ -0,0 +1,56 @@
   +* Analog Devices ADV7604/11 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.
   +
   +Required Properties:
   +
   +  - compatible: Must contain one of the following
   +- adi,adv7604 for the ADV7604
   +- adi,adv7611 for the ADV7611
   +
   +  - reg: I2C slave address
   +
   +  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
   +detection pins, one per HDMI input. The active flag indicates the
   GPIO
   +level that enables hot-plug detection.
   +
   +Optional Properties:
   +
   +  - reset-gpios: Reference to the GPIO connected to the device's reset
   pin. +
   +  - adi,default-input: Index of the input to be configured as default.
   Valid
   +values are 0..5 for the ADV7604 and 0 for the ADV7611.
  
  I have some doubts about this property. Firstly, it seems it is not needed
  for ADV7611 since it is always 0 for that device ?
  Why can't we hard code in the driver some default input ?
 
 I've thought about hardcoding a default input in the driver as well, but
 Hans wasn't really keen on the idea. Hans, could you please comment on this
 ?
  And which inputs it refers to ? HDMI inputs A..D + analog ? If we keep
  this
  property I think exact mapping of numbers to inputs should be included
  in description of this property.
  
   +  - adi,disable-power-down: Boolean property. When set forces the
   device
   to
   +ignore the power-down pin. The property is valid for the ADV7604
   only
   as
   +the ADV7611 has no power-down pin.
  
  Does it refer to the !PWRDWN pin ? If so I would replace power-down with
  PWRDWN, so it is clear what we're talking about when someone looks only
  at the datasheet.
  
   +  - adi,disable-cable-reset: Boolean property. When set disables the
   HDMI
   +receiver automatic reset when the HDMI cable is unplugged.
  
  Couldn't this be configured from user space with some default assumed in
  the driver ?
 
 Good question. I'm not sure what the exact use case for this is.
 
 Let's be careful not to introduce unneeded properties, I'll drop those two
 properties for now, we can implement support for the features later when
 needed.
 
   +Example:
   +
   + hdmi_receiver@4c {
   + compatible = adi,adv7611;
   + reg = 0x4c;
   +
   + reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
   + hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
   +
   + adi,default-input = 0;
   +
   + #address-cells = 1;
   + #size-cells = 0;
   +
   + port@0 {
   + reg = 0;
   + };
   + port@1 {
   + reg = 1;
   + hdmi_in: endpoint {
   + remote-endpoint = ccdc_in;
   + };
   + };
   + };
   diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
   index cce140c..de44213 100644
   --- a/drivers/media/i2c/adv7604.c
   +++ b/drivers/media/i2c/adv7604.c
 
 [snip]
 
   @@ -2836,21 +2906,15 @@ static int adv7604_remove(struct i2c_client
   *client)
   
/* ---
*/
   
   -static struct i2c_device_id adv7604_id[] = {
   - { adv7604, ADV7604 },
   - { adv7611, ADV7611 },
   - { }
   -};
   -MODULE_DEVICE_TABLE(i2c, adv7604_id);
   -
   
static struct i2c_driver adv7604_driver = {

 .driver = {
 
 .owner = THIS_MODULE,
 .name = adv7604,
   
   + .of_match_table = of_match_ptr(adv7604_of_id),
  
  of_match_ptr() isn't necessary here.
 
 Thanks, will fix in v3.

On second thought, as the driver has non-DT users, keeping of_match_ptr() and 
marking the table as __maybe_unused will optimize the table out if neither 
CONFIG_OF nor CONFIG_MODULE is set. I'd thus prefer keeping of_match_ptr().

 },
 .probe = adv7604_probe

[PATCH 04/15] media: adv7604: chip info and formats for ADV7612

2015-06-03 Thread William Towle
Add support for the ADV7612 chip as implemented on Renesas' Lager
board to adv7604.c, including lists for formats/colourspace/timing
selection and an IRQ handler.

Signed-off-by: William Towle william.to...@codethink.co.uk
---
 drivers/media/i2c/adv7604.c |   91 +--
 1 file changed, 87 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index aaa37b0..16646517 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -80,6 +80,7 @@ MODULE_LICENSE(GPL);
 enum adv76xx_type {
ADV7604,
ADV7611,
+   ADV7612,
 };
 
 struct adv76xx_reg_seq {
@@ -758,6 +759,23 @@ static const struct adv76xx_format_info adv7611_formats[] 
= {
  ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_12BIT },
 };
 
+static const struct adv76xx_format_info adv7612_formats[] = {
+   { MEDIA_BUS_FMT_RGB888_1X24, ADV76XX_OP_CH_SEL_RGB, true, false,
+ ADV76XX_OP_MODE_SEL_SDR_444 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_2X8, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_2X8, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_UYVY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_VYUY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_1X16, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_1X16, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+};
+
 static const struct adv76xx_format_info *
 adv76xx_format_info(struct adv76xx_state *state, u32 code)
 {
@@ -2471,6 +2489,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 adv76xx_unregister_clients(struct adv76xx_state *state)
 {
unsigned int i;
@@ -2558,6 +2581,19 @@ static const struct adv76xx_reg_seq 
adv7611_recommended_settings_hdmi[] = {
{ ADV76XX_REG_SEQ_TERM, 0 },
 };
 
+static const struct adv76xx_reg_seq adv7612_recommended_settings_hdmi[] = {
+   { ADV76XX_REG(ADV76XX_PAGE_CP, 0x6c), 0x00 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x9b), 0x03 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x6f), 0x08 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x85), 0x1f },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x87), 0x70 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x57), 0xda },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x58), 0x01 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x03), 0x98 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x4c), 0x44 },
+   { ADV76XX_REG_SEQ_TERM, 0 },
+};
+
 static const struct adv76xx_chip_info adv76xx_chip_info[] = {
[ADV7604] = {
.type = ADV7604,
@@ -2646,17 +2682,59 @@ static const struct adv76xx_chip_info 
adv76xx_chip_info[] = {
.field1_vsync_mask = 0x3fff,
.field1_vbackporch_mask = 0x3fff,
},
+   [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 = adv7612_formats,
+   .nformats = ARRAY_SIZE(adv7612_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(ADV76XX_PAGE_IO) | BIT(ADV76XX_PAGE_CEC) |
+   BIT(ADV76XX_PAGE_INFOFRAME) | BIT(ADV76XX_PAGE_AFE) |
+   BIT(ADV76XX_PAGE_REP) |  BIT(ADV76XX_PAGE_EDID) |
+   BIT(ADV76XX_PAGE_HDMI) | BIT(ADV76XX_PAGE_CP),
+   .linewidth_mask = 0x1fff,
+   .field0_height_mask = 0x1fff,
+   .field1_height_mask = 0x1fff,
+   .hfrontporch_mask = 0x1fff,
+   .hsync_mask

[PATCH 04/15] media: adv7604: chip info and formats for ADV7612

2015-06-25 Thread William Towle
Add support for the ADV7612 chip as implemented on Renesas' Lager
board to adv7604.c, including lists for formats/colourspace/timing
selection and an IRQ handler.

Signed-off-by: William Towle william.to...@codethink.co.uk
---
 drivers/media/i2c/adv7604.c |  102 +--
 1 file changed, 98 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 808360f..ebeddd5 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -81,6 +81,7 @@ MODULE_LICENSE(GPL);
 enum adv76xx_type {
ADV7604,
ADV7611,
+   ADV7612,
 };
 
 struct adv76xx_reg_seq {
@@ -766,6 +767,23 @@ static const struct adv76xx_format_info adv7611_formats[] 
= {
  ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_12BIT },
 };
 
+static const struct adv76xx_format_info adv7612_formats[] = {
+   { MEDIA_BUS_FMT_RGB888_1X24, ADV76XX_OP_CH_SEL_RGB, true, false,
+ ADV76XX_OP_MODE_SEL_SDR_444 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_2X8, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_2X8, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_UYVY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_VYUY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_1X16, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_1X16, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+};
+
 static const struct adv76xx_format_info *
 adv76xx_format_info(struct adv76xx_state *state, u32 code)
 {
@@ -870,6 +888,16 @@ static unsigned int adv7611_read_cable_det(struct 
v4l2_subdev *sd)
return value  1;
 }
 
+static unsigned int adv7612_read_cable_det(struct v4l2_subdev *sd)
+{
+   /*  Reads CABLE_DET_A_RAW. For input B support, need to
+*  account for bit 7 [MSB] of 0x6a (ie. CABLE_DET_B_RAW)
+*/
+   u8 value = io_read(sd, 0x6f);
+
+   return value  1;
+}
+
 static int adv76xx_s_detect_tx_5v_ctrl(struct v4l2_subdev *sd)
 {
struct adv76xx_state *state = to_state(sd);
@@ -2510,6 +2538,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 adv76xx_unregister_clients(struct adv76xx_state *state)
 {
unsigned int i;
@@ -2597,6 +2630,19 @@ static const struct adv76xx_reg_seq 
adv7611_recommended_settings_hdmi[] = {
{ ADV76XX_REG_SEQ_TERM, 0 },
 };
 
+static const struct adv76xx_reg_seq adv7612_recommended_settings_hdmi[] = {
+   { ADV76XX_REG(ADV76XX_PAGE_CP, 0x6c), 0x00 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x9b), 0x03 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x6f), 0x08 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x85), 0x1f },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x87), 0x70 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x57), 0xda },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x58), 0x01 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x03), 0x98 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x4c), 0x44 },
+   { ADV76XX_REG_SEQ_TERM, 0 },
+};
+
 static const struct adv76xx_chip_info adv76xx_chip_info[] = {
[ADV7604] = {
.type = ADV7604,
@@ -2685,17 +2731,60 @@ static const struct adv76xx_chip_info 
adv76xx_chip_info[] = {
.field1_vsync_mask = 0x3fff,
.field1_vbackporch_mask = 0x3fff,
},
+   [ADV7612] = {
+   .type = ADV7612,
+   .has_afe = false,
+   .max_port = ADV76XX_PAD_HDMI_PORT_A,/* B not supported */
+   .num_dv_ports = 1,  /* normally 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,
+   .cp_csc = 0xf4,
+   .formats = adv7612_formats,
+   .nformats = ARRAY_SIZE(adv7612_formats),
+   .set_termination = adv7611_set_termination,
+   .setup_irqs = adv7612_setup_irqs,
+   .read_hdmi_pixelclock = adv7611_read_hdmi_pixelclock,
+   .read_cable_det = adv7612_read_cable_det,
+   .recommended_settings = {
+   [1] = adv7612_recommended_settings_hdmi

Re: [PATCH 04/15] media: adv7604: chip info and formats for ADV7612

2015-06-12 Thread Hans Verkuil
Hi William,

Two comments, see below.

On 06/03/2015 03:59 PM, William Towle wrote:
 Add support for the ADV7612 chip as implemented on Renesas' Lager
 board to adv7604.c, including lists for formats/colourspace/timing
 selection and an IRQ handler.
 
 Signed-off-by: William Towle william.to...@codethink.co.uk
 ---
  drivers/media/i2c/adv7604.c |   91 
 +--
  1 file changed, 87 insertions(+), 4 deletions(-)
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index aaa37b0..16646517 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -80,6 +80,7 @@ MODULE_LICENSE(GPL);
  enum adv76xx_type {
   ADV7604,
   ADV7611,
 + ADV7612,
  };
  
  struct adv76xx_reg_seq {
 @@ -758,6 +759,23 @@ static const struct adv76xx_format_info 
 adv7611_formats[] = {
 ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_12BIT },
  };
  
 +static const struct adv76xx_format_info adv7612_formats[] = {
 + { MEDIA_BUS_FMT_RGB888_1X24, ADV76XX_OP_CH_SEL_RGB, true, false,
 +   ADV76XX_OP_MODE_SEL_SDR_444 | ADV76XX_OP_FORMAT_SEL_8BIT },
 + { MEDIA_BUS_FMT_YUYV8_2X8, ADV76XX_OP_CH_SEL_RGB, false, false,
 +   ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
 + { MEDIA_BUS_FMT_YVYU8_2X8, ADV76XX_OP_CH_SEL_RGB, false, true,
 +   ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
 + { MEDIA_BUS_FMT_UYVY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, false,
 +   ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
 + { MEDIA_BUS_FMT_VYUY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, true,
 +   ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
 + { MEDIA_BUS_FMT_YUYV8_1X16, ADV76XX_OP_CH_SEL_RGB, false, false,
 +   ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
 + { MEDIA_BUS_FMT_YVYU8_1X16, ADV76XX_OP_CH_SEL_RGB, false, true,
 +   ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
 +};
 +
  static const struct adv76xx_format_info *
  adv76xx_format_info(struct adv76xx_state *state, u32 code)
  {
 @@ -2471,6 +2489,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 adv76xx_unregister_clients(struct adv76xx_state *state)
  {
   unsigned int i;
 @@ -2558,6 +2581,19 @@ static const struct adv76xx_reg_seq 
 adv7611_recommended_settings_hdmi[] = {
   { ADV76XX_REG_SEQ_TERM, 0 },
  };
  
 +static const struct adv76xx_reg_seq adv7612_recommended_settings_hdmi[] = {
 + { ADV76XX_REG(ADV76XX_PAGE_CP, 0x6c), 0x00 },
 + { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x9b), 0x03 },
 + { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x6f), 0x08 },
 + { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x85), 0x1f },
 + { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x87), 0x70 },
 + { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x57), 0xda },
 + { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x58), 0x01 },
 + { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x03), 0x98 },
 + { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x4c), 0x44 },
 + { ADV76XX_REG_SEQ_TERM, 0 },
 +};
 +
  static const struct adv76xx_chip_info adv76xx_chip_info[] = {
   [ADV7604] = {
   .type = ADV7604,
 @@ -2646,17 +2682,59 @@ static const struct adv76xx_chip_info 
 adv76xx_chip_info[] = {
   .field1_vsync_mask = 0x3fff,
   .field1_vbackporch_mask = 0x3fff,
   },
 + [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,

This looks strange: with two inputs I expect two bits set in the mask, not 
three.

 + .cable_det_mask = 0x01,

Same here: I expect to see two bits set, not one.

 + .fmt_change_digital_mask = 0x03,
 + .formats = adv7612_formats,
 + .nformats = ARRAY_SIZE(adv7612_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(ADV76XX_PAGE_IO) | BIT(ADV76XX_PAGE_CEC) |
 + BIT(ADV76XX_PAGE_INFOFRAME) | BIT(ADV76XX_PAGE_AFE) |
 + BIT(ADV76XX_PAGE_REP) |  BIT(ADV76XX_PAGE_EDID) |
 + BIT(ADV76XX_PAGE_HDMI) | BIT(ADV76XX_PAGE_CP

Re: [PATCH] adv7604: Add DT parsing support

2014-10-22 Thread Jean-Michel Hautbois
Hi Laurent,

Thank you for reviewing,

2014-10-23 1:53 GMT+02:00 Laurent Pinchart laurent.pinch...@ideasonboard.com:
 Hi Jean-Michel,

 Thank you for the patch.

 On Wednesday 22 October 2014 17:34:21 Jean-Michel Hautbois wrote:
 This patch adds support for DT parsing of ADV7604 as well as ADV7611.
 It needs to be improved in order to get ports parsing too.

 Let's improve it then :-) The DT bindings as proposed by this patch are
 incomplete, that's just asking for trouble.

 How would you model the adv7604 ports ?

I am opened to suggestions :).
But it has to remain as simple as possible, ideally allowing for
giving names to the ports.
As done today, it works, ports are parsed but are all the same...

 Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
 ---
  Documentation/devicetree/bindings/media/i2c/adv7604.txt | 1 +
  drivers/media/i2c/adv7604.c | 1 +
  2 files changed, 2 insertions(+)

 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index
 c27cede..5c8b3e6 100644
 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -10,6 +10,7 @@ Required Properties:

- compatible: Must contain one of the following
  - adi,adv7611 for the ADV7611
 +- adi,adv7604 for the ADV7604

 Please switch the two lines to keep them alphabetically sorted.

- reg: I2C slave address

 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index 47795ff..421035f 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -2677,6 +2677,7 @@ 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,adv7604, .data = adv7604_chip_info[ADV7604] },

 Same comment here.

Done on my side, but will wait for your suggestions, in order to add
ports parsing ;-).

Thanks,
JM
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 46/48] adv7604: Add DT support

2014-04-17 Thread Sylwester Nawrocki
Hi Laurent.

On 11/03/14 00:15, Laurent Pinchart wrote:
 Parse the device tree node to populate platform data.
 
 Cc: devicet...@vger.kernel.org
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  .../devicetree/bindings/media/i2c/adv7604.txt  | 56 +
  drivers/media/i2c/adv7604.c| 92 
 ++
  2 files changed, 134 insertions(+), 14 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt
 
 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 new file mode 100644
 index 000..0845c50
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -0,0 +1,56 @@
 +* Analog Devices ADV7604/11 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.
 +
 +Required Properties:
 +
 +  - compatible: Must contain one of the following
 +- adi,adv7604 for the ADV7604
 +- adi,adv7611 for the ADV7611
 +
 +  - reg: I2C slave address
 +
 +  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 +detection pins, one per HDMI input. The active flag indicates the GPIO
 +level that enables hot-plug detection.
 +
 +Optional Properties:
 +
 +  - reset-gpios: Reference to the GPIO connected to the device's reset pin.
 +
 +  - adi,default-input: Index of the input to be configured as default. Valid
 +values are 0..5 for the ADV7604 and 0 for the ADV7611.

I have some doubts about this property. Firstly, it seems it is not needed for
ADV7611 since it is always 0 for that device ?
Why can't we hard code in the driver some default input ?
And which inputs it refers to ? HDMI inputs A..D + analog ? If we keep this 
property I think exact mapping of numbers to inputs should be included 
in description of this property.

 +  - adi,disable-power-down: Boolean property. When set forces the device to
 +ignore the power-down pin. The property is valid for the ADV7604 only as
 +the ADV7611 has no power-down pin.

Does it refer to the !PWRDWN pin ? If so I would replace power-down with
PWRDWN, so it is clear what we're talking about when someone looks only
at the datasheet.

 +  - adi,disable-cable-reset: Boolean property. When set disables the HDMI
 +receiver automatic reset when the HDMI cable is unplugged.

Couldn't this be configured from user space with some default assumed
in the driver ?

 +Example:
 +
 + hdmi_receiver@4c {
 + compatible = adi,adv7611;
 + reg = 0x4c;
 +
 + reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
 + hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
 +
 + adi,default-input = 0;
 +
 + #address-cells = 1;
 + #size-cells = 0;
 +
 + port@0 {
 + reg = 0;
 + };
 + port@1 {
 + reg = 1;
 + hdmi_in: endpoint {
 + remote-endpoint = ccdc_in;
 + };
 + };
 + };
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index cce140c..de44213 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -2626,13 +2626,70 @@ static const struct adv7604_chip_info 
 adv7604_chip_info[] = {
   },
  };
  
 +static struct i2c_device_id adv7604_i2c_id[] = {
 + { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
 + { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
 + { }
 +};
 +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
 +
 +static struct of_device_id adv7604_of_id[] = {
 + { .compatible = adi,adv7604, .data = adv7604_chip_info[ADV7604] },
 + { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
 + { }
 +};
 +MODULE_DEVICE_TABLE(of, adv7604_of_id);
 +
 +static int adv7604_parse_dt(struct adv7604_state *state)
 +{
 + struct device_node *np;
 + int ret;
 +
 + np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node;
 +
 + state-pdata.disable_pwrdnb =
 + of_property_read_bool(np, adi,disable-power-down);
 + state-pdata.disable_cable_det_rst =
 + of_property_read_bool(np, adi,disable-cable-reset);
 +
 + ret = of_property_read_u32(np, adi,default-input,
 +state-pdata.default_input);
 + if (ret  0)
 + state-pdata.default_input = -1;
 +
 + /* Disable the interrupt for now as no DT-based board uses it. */
 + state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
 +
 + /* Use the default I2C addresses. */
 + state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
 + state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
 + state-pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME

[PATCH v4 45/49] adv7604: Add DT support

2014-04-17 Thread Laurent Pinchart
Parse the device tree node to populate platform data. Only the ADV7611
is currently support with DT.

Cc: devicet...@vger.kernel.org
Cc: Sylwester Nawrocki s.nawro...@samsung.com
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt  | 57 +++
 drivers/media/i2c/adv7604.c| 80 ++
 2 files changed, 123 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
new file mode 100644
index 000..2efb48f
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -0,0 +1,57 @@
+* Analog Devices ADV7604/11 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.
+
+These device tree bindings support the ADV7611 only at the moment.
+
+Required Properties:
+
+  - compatible: Must contain one of the following
+- adi,adv7611 for the ADV7611
+
+  - reg: I2C slave address
+
+  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
+detection pins, one per HDMI input. The active flag indicates the GPIO
+level that enables hot-plug detection.
+
+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.
+
+  Port ADV7611
+
+  HDMI 0
+  Digital output   1
+
+The digital output port node must contain at least one endpoint.
+
+Optional Properties:
+
+  - reset-gpios: Reference to the GPIO connected to the device's reset pin.
+
+Example:
+
+   hdmi_receiver@4c {
+   compatible = adi,adv7611;
+   reg = 0x4c;
+
+   reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
+   hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
+
+   #address-cells = 1;
+   #size-cells = 0;
+
+   port@0 {
+   reg = 0;
+   };
+   port@1 {
+   reg = 1;
+   hdmi_in: endpoint {
+   remote-endpoint = ccdc_in;
+   };
+   };
+   };
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 342d73d..061794e 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2663,13 +2663,58 @@ static const struct adv7604_chip_info 
adv7604_chip_info[] = {
},
 };
 
+static struct i2c_device_id adv7604_i2c_id[] = {
+   { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
+   { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
+   { }
+};
+MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
+
+static struct of_device_id adv7604_of_id[] = {
+   { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
+   { }
+};
+MODULE_DEVICE_TABLE(of, adv7604_of_id);
+
+static int adv7604_parse_dt(struct adv7604_state *state)
+{
+   /* Disable the interrupt for now as no DT-based board uses it. */
+   state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
+
+   /* Use the default I2C addresses. */
+   state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
+   state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
+   state-pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e;
+   state-pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38;
+   state-pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c;
+   state-pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26;
+   state-pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32;
+   state-pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36;
+   state-pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34;
+   state-pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30;
+   state-pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22;
+   state-pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24;
+
+   /* 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.op_656_range = 1;
+   state-pdata.alt_data_sat = 1;
+   state-pdata.insert_av_codes = 1;
+   state-pdata.op_format_mode_sel = ADV7604_OP_FORMAT_MODE0;
+   state-pdata.bus_order = ADV7604_BUS_ORDER_RGB;
+
+   return 0;
+}
+
 static int adv7604_probe(struct i2c_client *client,
 const struct i2c_device_id *id)
 {
static const struct

Re: [PATCH v4 45/49] adv7604: Add DT support

2014-04-17 Thread Sylwester Nawrocki
Hi Laurent,

On 17/04/14 16:13, Laurent Pinchart wrote:
 Parse the device tree node to populate platform data. Only the ADV7611
 is currently support with DT.
 
 Cc: devicet...@vger.kernel.org
 Cc: Sylwester Nawrocki s.nawro...@samsung.com
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 Acked-by: Hans Verkuil hans.verk...@cisco.com

The patch looks good to me.

Acked-by: Sylwester Nawrocki s.nawro...@samsung.com

Just one comment below...
 ---
  .../devicetree/bindings/media/i2c/adv7604.txt  | 57 +++
  drivers/media/i2c/adv7604.c| 80 
 ++
  2 files changed, 123 insertions(+), 14 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt
 
 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 new file mode 100644
 index 000..2efb48f
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -0,0 +1,57 @@
 +* Analog Devices ADV7604/11 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.
 +
 +These device tree bindings support the ADV7611 only at the moment.
 +
 +Required Properties:
 +
 +  - compatible: Must contain one of the following
 +- adi,adv7611 for the ADV7611
 +
 +  - reg: I2C slave address
 +
 +  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 +detection pins, one per HDMI input. The active flag indicates the GPIO
 +level that enables hot-plug detection.
 +
 +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.
 +
 +  Port   ADV7611
 +
 +  HDMI   0
 +  Digital output 1
 +
 +The digital output port node must contain at least one endpoint.
 +
 +Optional Properties:
 +
 +  - reset-gpios: Reference to the GPIO connected to the device's reset pin.
 +
 +Example:
 +
 + hdmi_receiver@4c {
 + compatible = adi,adv7611;
 + reg = 0x4c;
 +
 + reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
 + hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
 +
 + #address-cells = 1;
 + #size-cells = 0;
 +
 + port@0 {
 + reg = 0;
 + };
 + port@1 {
 + reg = 1;
 + hdmi_in: endpoint {
 + remote-endpoint = ccdc_in;
 + };
 + };
 + };
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index 342d73d..061794e 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -2663,13 +2663,58 @@ static const struct adv7604_chip_info 
 adv7604_chip_info[] = {
   },
  };
  
 +static struct i2c_device_id adv7604_i2c_id[] = {
 + { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
 + { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
 + { }
 +};
 +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
 +
 +static struct of_device_id adv7604_of_id[] = {

Not adding __maybe_unused attribute to this one ?

 + { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
 + { }
 +};
 +MODULE_DEVICE_TABLE(of, adv7604_of_id);
 +
 +static int adv7604_parse_dt(struct adv7604_state *state)
 +{
 + /* Disable the interrupt for now as no DT-based board uses it. */
 + state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
 +
 + /* Use the default I2C addresses. */
 + state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
 + state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
 + state-pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e;
 + state-pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38;
 + state-pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c;
 + state-pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26;
 + state-pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32;
 + state-pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36;
 + state-pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34;
 + state-pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30;
 + state-pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22;
 + state-pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24;
 +
 + /* 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.op_656_range = 1;
 + state-pdata.alt_data_sat = 1;
 + state-pdata.insert_av_codes = 1;
 + state

Re: [PATCH 45/47] adv7604: Add DT support

2014-02-11 Thread Hans Verkuil
On 02/05/14 17:42, Laurent Pinchart wrote:
 Parse the device tree node to populate platform data.
 
 Cc: devicet...@vger.kernel.org
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  .../devicetree/bindings/media/i2c/adv7604.txt  |  56 
  drivers/media/i2c/adv7604.c| 101 
 ++---
  2 files changed, 143 insertions(+), 14 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt
 
 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 new file mode 100644
 index 000..0845c50
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -0,0 +1,56 @@
 +* Analog Devices ADV7604/11 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.
 +
 +Required Properties:
 +
 +  - compatible: Must contain one of the following
 +- adi,adv7604 for the ADV7604
 +- adi,adv7611 for the ADV7611
 +
 +  - reg: I2C slave address
 +
 +  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 +detection pins, one per HDMI input. The active flag indicates the GPIO
 +level that enables hot-plug detection.
 +
 +Optional Properties:
 +
 +  - reset-gpios: Reference to the GPIO connected to the device's reset pin.
 +
 +  - adi,default-input: Index of the input to be configured as default. Valid
 +values are 0..5 for the ADV7604 and 0 for the ADV7611.
 +
 +  - adi,disable-power-down: Boolean property. When set forces the device to
 +ignore the power-down pin. The property is valid for the ADV7604 only as
 +the ADV7611 has no power-down pin.
 +
 +  - adi,disable-cable-reset: Boolean property. When set disables the HDMI
 +receiver automatic reset when the HDMI cable is unplugged.
 +
 +Example:
 +
 + hdmi_receiver@4c {
 + compatible = adi,adv7611;
 + reg = 0x4c;
 +
 + reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
 + hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
 +
 + adi,default-input = 0;
 +
 + #address-cells = 1;
 + #size-cells = 0;
 +
 + port@0 {
 + reg = 0;
 + };
 + port@1 {
 + reg = 1;
 + hdmi_in: endpoint {
 + remote-endpoint = ccdc_in;
 + };
 + };
 + };
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index e586c1c..cd8a2dc 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -32,6 +32,7 @@
  #include linux/i2c.h
  #include linux/kernel.h
  #include linux/module.h
 +#include linux/of_gpio.h
  #include linux/slab.h
  #include linux/v4l2-dv-timings.h
  #include linux/videodev2.h
 @@ -2641,13 +2642,83 @@ static const struct adv7604_chip_info 
 adv7604_chip_info[] = {
   },
  };
  
 +static struct i2c_device_id adv7604_i2c_id[] = {
 + { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
 + { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
 + { }
 +};
 +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
 +
 +static struct of_device_id adv7604_of_id[] = {
 + { .compatible = adi,adv7604, .data = adv7604_chip_info[ADV7604] },
 + { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
 + { }
 +};
 +MODULE_DEVICE_TABLE(of, adv7604_of_id);
 +
 +static int adv7604_parse_dt(struct adv7604_state *state)

Put this under #ifdef CONFIG_OF. It fails to compile if CONFIG_OF is not set
(as it is in my case since this driver is used with a PCIe card).

Regards,

Hans

 +{
 + struct device_node *np;
 + unsigned int i;
 + int ret;
 +
 + np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node;
 + state-info = of_match_node(adv7604_of_id, np)-data;
 +
 + state-pdata.disable_pwrdnb =
 + of_property_read_bool(np, adi,disable-power-down);
 + state-pdata.disable_cable_det_rst =
 + of_property_read_bool(np, adi,disable-cable-reset);
 +
 + ret = of_property_read_u32(np, adi,default-input,
 +state-pdata.default_input);
 + if (ret  0)
 + state-pdata.default_input = -1;
 +
 + for (i = 0; i  state-info-num_dv_ports; ++i) {
 + enum of_gpio_flags flags;
 +
 + state-pdata.hpd_gpio[i] =
 + of_get_named_gpio_flags(np, hpd-gpios, i, flags);
 + if (IS_ERR_VALUE(state-pdata.hpd_gpio[i]))
 + continue;
 +
 + state-pdata.hpd_gpio_low[i] = flags == OF_GPIO_ACTIVE_LOW;
 + }
 +
 + /* Disable the interrupt for now as no DT-based board uses it. */
 + state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED

[PATCH v2 46/48] adv7604: Add DT support

2014-03-10 Thread Laurent Pinchart
Parse the device tree node to populate platform data.

Cc: devicet...@vger.kernel.org
Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt  | 56 +
 drivers/media/i2c/adv7604.c| 92 ++
 2 files changed, 134 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
new file mode 100644
index 000..0845c50
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -0,0 +1,56 @@
+* Analog Devices ADV7604/11 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.
+
+Required Properties:
+
+  - compatible: Must contain one of the following
+- adi,adv7604 for the ADV7604
+- adi,adv7611 for the ADV7611
+
+  - reg: I2C slave address
+
+  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
+detection pins, one per HDMI input. The active flag indicates the GPIO
+level that enables hot-plug detection.
+
+Optional Properties:
+
+  - reset-gpios: Reference to the GPIO connected to the device's reset pin.
+
+  - adi,default-input: Index of the input to be configured as default. Valid
+values are 0..5 for the ADV7604 and 0 for the ADV7611.
+
+  - adi,disable-power-down: Boolean property. When set forces the device to
+ignore the power-down pin. The property is valid for the ADV7604 only as
+the ADV7611 has no power-down pin.
+
+  - adi,disable-cable-reset: Boolean property. When set disables the HDMI
+receiver automatic reset when the HDMI cable is unplugged.
+
+Example:
+
+   hdmi_receiver@4c {
+   compatible = adi,adv7611;
+   reg = 0x4c;
+
+   reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
+   hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
+
+   adi,default-input = 0;
+
+   #address-cells = 1;
+   #size-cells = 0;
+
+   port@0 {
+   reg = 0;
+   };
+   port@1 {
+   reg = 1;
+   hdmi_in: endpoint {
+   remote-endpoint = ccdc_in;
+   };
+   };
+   };
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index cce140c..de44213 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2626,13 +2626,70 @@ static const struct adv7604_chip_info 
adv7604_chip_info[] = {
},
 };
 
+static struct i2c_device_id adv7604_i2c_id[] = {
+   { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
+   { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
+   { }
+};
+MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
+
+static struct of_device_id adv7604_of_id[] = {
+   { .compatible = adi,adv7604, .data = adv7604_chip_info[ADV7604] },
+   { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
+   { }
+};
+MODULE_DEVICE_TABLE(of, adv7604_of_id);
+
+static int adv7604_parse_dt(struct adv7604_state *state)
+{
+   struct device_node *np;
+   int ret;
+
+   np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node;
+
+   state-pdata.disable_pwrdnb =
+   of_property_read_bool(np, adi,disable-power-down);
+   state-pdata.disable_cable_det_rst =
+   of_property_read_bool(np, adi,disable-cable-reset);
+
+   ret = of_property_read_u32(np, adi,default-input,
+  state-pdata.default_input);
+   if (ret  0)
+   state-pdata.default_input = -1;
+
+   /* Disable the interrupt for now as no DT-based board uses it. */
+   state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
+
+   /* Use the default I2C addresses. */
+   state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
+   state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
+   state-pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e;
+   state-pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38;
+   state-pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c;
+   state-pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26;
+   state-pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32;
+   state-pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36;
+   state-pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34;
+   state-pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30;
+   state-pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22;
+   state-pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24;
+
+   /* HACK: Hardcode the remaining platform data fields. */
+   state-pdata.blank_data = 1;
+   state-pdata.op_656_range = 1;
+   state

[PATCH v3 46/48] adv7604: Add DT support

2014-03-11 Thread Laurent Pinchart
Parse the device tree node to populate platform data.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
Acked-by: Hans Verkuil hans.verk...@cisco.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt  | 56 +
 drivers/media/i2c/adv7604.c| 92 ++
 2 files changed, 134 insertions(+), 14 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7604.txt

Changes since v2:

- Rebased on top of 36/48 v3.

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
new file mode 100644
index 000..0845c50
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -0,0 +1,56 @@
+* Analog Devices ADV7604/11 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.
+
+Required Properties:
+
+  - compatible: Must contain one of the following
+- adi,adv7604 for the ADV7604
+- adi,adv7611 for the ADV7611
+
+  - reg: I2C slave address
+
+  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
+detection pins, one per HDMI input. The active flag indicates the GPIO
+level that enables hot-plug detection.
+
+Optional Properties:
+
+  - reset-gpios: Reference to the GPIO connected to the device's reset pin.
+
+  - adi,default-input: Index of the input to be configured as default. Valid
+values are 0..5 for the ADV7604 and 0 for the ADV7611.
+
+  - adi,disable-power-down: Boolean property. When set forces the device to
+ignore the power-down pin. The property is valid for the ADV7604 only as
+the ADV7611 has no power-down pin.
+
+  - adi,disable-cable-reset: Boolean property. When set disables the HDMI
+receiver automatic reset when the HDMI cable is unplugged.
+
+Example:
+
+   hdmi_receiver@4c {
+   compatible = adi,adv7611;
+   reg = 0x4c;
+
+   reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
+   hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
+
+   adi,default-input = 0;
+
+   #address-cells = 1;
+   #size-cells = 0;
+
+   port@0 {
+   reg = 0;
+   };
+   port@1 {
+   reg = 1;
+   hdmi_in: endpoint {
+   remote-endpoint = ccdc_in;
+   };
+   };
+   };
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index b352b62..5901b78 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2663,13 +2663,70 @@ static const struct adv7604_chip_info 
adv7604_chip_info[] = {
},
 };
 
+static struct i2c_device_id adv7604_i2c_id[] = {
+   { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
+   { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
+   { }
+};
+MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
+
+static struct of_device_id adv7604_of_id[] = {
+   { .compatible = adi,adv7604, .data = adv7604_chip_info[ADV7604] },
+   { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
+   { }
+};
+MODULE_DEVICE_TABLE(of, adv7604_of_id);
+
+static int adv7604_parse_dt(struct adv7604_state *state)
+{
+   struct device_node *np;
+   int ret;
+
+   np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node;
+
+   state-pdata.disable_pwrdnb =
+   of_property_read_bool(np, adi,disable-power-down);
+   state-pdata.disable_cable_det_rst =
+   of_property_read_bool(np, adi,disable-cable-reset);
+
+   ret = of_property_read_u32(np, adi,default-input,
+  state-pdata.default_input);
+   if (ret  0)
+   state-pdata.default_input = -1;
+
+   /* Disable the interrupt for now as no DT-based board uses it. */
+   state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
+
+   /* Use the default I2C addresses. */
+   state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
+   state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
+   state-pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e;
+   state-pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38;
+   state-pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c;
+   state-pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26;
+   state-pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32;
+   state-pdata.i2c_addresses[ADV7604_PAGE_EDID] = 0x36;
+   state-pdata.i2c_addresses[ADV7604_PAGE_HDMI] = 0x34;
+   state-pdata.i2c_addresses[ADV7604_PAGE_TEST] = 0x30;
+   state-pdata.i2c_addresses[ADV7604_PAGE_CP] = 0x22;
+   state-pdata.i2c_addresses[ADV7604_PAGE_VDP] = 0x24;
+
+   /* HACK: Hardcode the remaining platform data fields. */
+   state-pdata.blank_data

[PATCH] adv7611: Set HPD GPIO direction to output

2014-03-25 Thread Laurent Pinchart
The HPD GPIO is used as an output but its direction is never set. Fix
it.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

This patch applies on top of the ADV7611 support series queued for v3.16.

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 51f14ab..b38ebb9 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2845,7 +2845,7 @@ static int adv7604_probe(struct i2c_client *client,
if (IS_ERR(state-hpd_gpio[i]))
continue;
 
-   gpiod_set_value_cansleep(state-hpd_gpio[i], 0);
+   gpiod_direction_output(state-hpd_gpio[i], 0);
 
v4l_info(client, Handling HPD %u GPIO\n, i);
}
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] adv7611: Set HPD GPIO direction to output

2014-03-26 Thread Hans Verkuil
Hi Laurent,

Stupid question perhaps, but why is gpiod_set_value_cansleep() removed?
Does setting the output direction force the value to 0 as well?

Regards,

Hans

On 03/26/14 03:28, Laurent Pinchart wrote:
 The HPD GPIO is used as an output but its direction is never set. Fix
 it.
 
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---
  drivers/media/i2c/adv7604.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 This patch applies on top of the ADV7611 support series queued for v3.16.
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index 51f14ab..b38ebb9 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -2845,7 +2845,7 @@ static int adv7604_probe(struct i2c_client *client,
   if (IS_ERR(state-hpd_gpio[i]))
   continue;
  
 - gpiod_set_value_cansleep(state-hpd_gpio[i], 0);
 + gpiod_direction_output(state-hpd_gpio[i], 0);
  
   v4l_info(client, Handling HPD %u GPIO\n, i);
   }
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] adv7604: Mark adv7604_of_id table with __maybe_unused

2014-03-28 Thread Laurent Pinchart
The table is always declared but is unused when both CONFIG_OF and
CONFIG_MODULES are not set. This results in a compile warning. Fix it by
marking the table as __maybe_unused. The compiler will discard it if
unused.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index c864db9..5de6dad 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2672,7 +2672,7 @@ static struct i2c_device_id adv7604_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
 
-static struct of_device_id adv7604_of_id[] = {
+static struct of_device_id adv7604_of_id[] __maybe_unused = {
{ .compatible = adi,adv7604, .data = adv7604_chip_info[ADV7604] },
{ .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
{ }
-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v4 49/49] adv7604: Mark adv7604_of_id table with __maybe_unused

2014-04-17 Thread Laurent Pinchart
The table is always declared but is unused when both CONFIG_OF and
CONFIG_MODULES are not set. This results in a compile warning. Fix it by
marking the table as __maybe_unused. The compiler will discard it if
unused.

Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
---
 drivers/media/i2c/adv7604.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 51029e1..1778d32 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2672,7 +2672,7 @@ static struct i2c_device_id adv7604_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
 
-static struct of_device_id adv7604_of_id[] = {
+static struct of_device_id adv7604_of_id[] __maybe_unused = {
{ .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
{ }
 };
-- 
1.8.3.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] adv7604: Add DT parsing support

2014-09-05 Thread Jean-Michel Hautbois
This allows specifying I²C secodnary addresses different from default ones.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
 drivers/media/i2c/adv7604.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 8336c02..75613a4 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2705,6 +2705,7 @@ 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,adv7604, .data = adv7604_chip_info[ADV7604] },
{ }
 };
 MODULE_DEVICE_TABLE(of, adv7604_of_id);
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] media: adv7604: CP CSC uses a different register on adv7604 and adv7611

2015-01-26 Thread Jean-Michel Hautbois
The bits are the same, but register is 0xf4 on ADV7611 instead of 0xfc.
When reading back the value in log_status, differentiate both.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
 drivers/media/i2c/adv7604.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index e43dd2e..32e53e0 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2310,8 +2310,12 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
(reg_io_0x02  0x04) ? (16-235) : (0-255),
((reg_io_0x02  0x04) ^ (reg_io_0x02  0x01)) ?
enabled : disabled);
-   v4l2_info(sd, Color space conversion: %s\n,
+   if (state-info-type == ADV7604)
+   v4l2_info(sd, Color space conversion: %s\n,
csc_coeff_sel_rb[cp_read(sd, 0xfc)  4]);
+   else
+   v4l2_info(sd, Color space conversion: %s\n,
+   csc_coeff_sel_rb[cp_read(sd, 0xf4)  4]);
 
if (!is_digital_input(sd))
return 0;
-- 
2.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/13] media: adv7604: fix probe of ADV7611/7612

2015-07-23 Thread William Towle
Prior to commit f862f57d ([media] media: i2c: ADV7604: Migrate to
regmap), the local variable 'val' contained the combined register
reads used in the chipset version ID test. Restore this expectation
so that the comparison works as it used to.
---
 drivers/media/i2c/adv7604.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index bfb0b6a..0587d27 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3108,7 +3108,7 @@ static int adv76xx_probe(struct i2c_client *client,
v4l2_err(sd, Error %d reading IO Regmap\n, err);
return -ENODEV;
}
-   val2 |= val;
+   val |= val2;
if ((state-info-type == ADV7611  val != 0x2051) ||
(state-info-type == ADV7612  val != 0x2041)) {
v4l2_err(sd, not an adv761x on address 0x%x\n,
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL for 3.16-rc1] updates and DT support for adv7604

2014-06-06 Thread Ben Dooks
On 05/06/14 13:55, Mauro Carvalho Chehab wrote:
 Linus,
 
 Please pull from:
   git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
 topic/adv76xx
 
 For adv7604 driver updates, including DT support.

Can we use the adv7611 for the adv7612 with these?

-- 
Ben Dooks   http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 2/2] adv7604: Use DT parsing in dummy creation

2014-08-29 Thread Mark Rutland
Hi,

On Fri, Aug 29, 2014 at 02:28:17PM +0100, Jean-Michel Hautbois wrote:
 This patch uses DT in order to parse addresses for dummy devices of adv7604.
 If nothing is defined, it uses default addresses.
 The main prupose is using two adv76xx on the same i2c bus.

This is rather opaque.

It seems from the code below that a single adv7611 device has multiple
I2C addresses at which different registers may be accessed. I guess the
secondary instances of the unit have different addresses for all of the
pages?

 Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
 ---
  .../devicetree/bindings/media/i2c/adv7604.txt  |  7 ++-
  drivers/media/i2c/adv7604.c| 56 
 ++
  2 files changed, 42 insertions(+), 21 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 index c27cede..221b75c 100644
 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -10,6 +10,7 @@ Required Properties:
  
- compatible: Must contain one of the following
  - adi,adv7611 for the ADV7611
 +- adi,adv7604 for the ADV7604
  
- reg: I2C slave address

This should be updated, at least to say address(es).

  
 @@ -32,6 +33,8 @@ The digital output port node must contain at least one 
 endpoint.
  Optional Properties:
  
- reset-gpios: Reference to the GPIO connected to the device's reset pin.
 +  - reg-names : Names of registers to be reprogrammed.

This doesn't describe _which_ names you expect, and I have no idea what
is meant by to be reprogrammed.

 + Refer to source code for possible values.

Bindings shouldn't say things like this. The binding should describe the
contract between the DTB and the OS, which this clearly doesn't.

A binding document shouldn't necessitate reading code.

  Optional Endpoint Properties:
  
 @@ -50,7 +53,9 @@ Example:
  
   hdmi_receiver@4c {
   compatible = adi,adv7611;
 - reg = 0x4c;
 + /* edid page will be accessible @ 0x66 on i2c bus*/
 + reg = 0x4c 0x66;
 + reg-names = main, edid;

What about the other IDs? Are they accessible or not?

Why didn't we always list the full set of IDs in the first place? That
would have made this far less painful.

Thanks,
Mark.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-26 Thread Lars-Peter Clausen
On 11/26/2013 10:28 PM, Valentine wrote:
 On 11/20/2013 07:53 PM, Valentine wrote:
 On 11/20/2013 07:42 PM, Hans Verkuil wrote:
 Hi Valentine,
 
 Hi Hans,
 

 Did you ever look at this adv7611 driver:

 https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e4afa42af2daa12


 No, I missed that one somehow, although I did search for the adv7611/7612
 before implementing this one.
 I'm going to look closer at the patch and test it.

 
 I've tried the patch and I doubt that it was ever tested on adv7611.

It was and it works.

 I haven't been able to make it work so far. Here's the description of some
 of the issues
 I've encountered.
 
 The patch does not apply cleanly so I had to make small adjustments just to
 make it apply
 without changing the functionality.

I have an updated version of the patch, which I intend to submit soon.

[...]

 It adds adv761x support to the adv7604 in a pretty clean way.
 
 Doesn't seem that clean to me after having a look at it.
 It tries to handle both 7604 and 7611 chips in the same way, though,
 I'm not exactly sure if it's a good idea since 7611/12 is a pure HDMI
 receiver with no analog inputs.

It is the same HDMI core (with minor modifications) though. So you end end
up with largely the same code for the 7604 and the 7611.

- Lars
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-26 Thread Valentine

On 11/27/2013 01:43 AM, Lars-Peter Clausen wrote:

On 11/26/2013 10:28 PM, Valentine wrote:

On 11/20/2013 07:53 PM, Valentine wrote:

On 11/20/2013 07:42 PM, Hans Verkuil wrote:

Hi Valentine,


Hi Hans,



Did you ever look at this adv7611 driver:

https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e4afa42af2daa12



No, I missed that one somehow, although I did search for the adv7611/7612
before implementing this one.
I'm going to look closer at the patch and test it.



I've tried the patch and I doubt that it was ever tested on adv7611.


It was and it works.


That's good to hear.




I haven't been able to make it work so far. Here's the description of some
of the issues
I've encountered.

The patch does not apply cleanly so I had to make small adjustments just to
make it apply
without changing the functionality.


I have an updated version of the patch, which I intend to submit soon.


That's great, thanks!



[...]


I'd also appreciate your thoughts about the issues I've described,
which have been replaced by [...] here.



It adds adv761x support to the adv7604 in a pretty clean way.


Doesn't seem that clean to me after having a look at it.
It tries to handle both 7604 and 7611 chips in the same way, though,
I'm not exactly sure if it's a good idea since 7611/12 is a pure HDMI
receiver with no analog inputs.


It is the same HDMI core (with minor modifications) though. So you end end
up with largely the same code for the 7604 and the 7611.


Yes, but that's about half of the code while 7611 doesn't really need the 
non-HDMI part.
Just thought that we may end up with a bigger mess if we keep adding adv76xx 
support to 7604 driver.



- Lars



Thanks,
Val.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-26 Thread Laurent Pinchart
Hi Lars,

On Tuesday 26 November 2013 22:43:32 Lars-Peter Clausen wrote:
 On 11/26/2013 10:28 PM, Valentine wrote:
  On 11/20/2013 07:53 PM, Valentine wrote:
  On 11/20/2013 07:42 PM, Hans Verkuil wrote:
  Hi Valentine,
  
  Hi Hans,
  
  Did you ever look at this adv7611 driver:
  
  https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e4a
  fa42af2daa12
  No, I missed that one somehow, although I did search for the adv7611/7612
  before implementing this one.
  I'm going to look closer at the patch and test it.
  
  I've tried the patch and I doubt that it was ever tested on adv7611.
 
 It was and it works.
 
  I haven't been able to make it work so far. Here's the description of some
  of the issues I've encountered.
  
  The patch does not apply cleanly so I had to make small adjustments just
  to make it apply without changing the functionality.
 
 I have an updated version of the patch, which I intend to submit soon.

Is it publicly available already ?

 [...]
 
  It adds adv761x support to the adv7604 in a pretty clean way.
  
  Doesn't seem that clean to me after having a look at it.
  It tries to handle both 7604 and 7611 chips in the same way, though,
  I'm not exactly sure if it's a good idea since 7611/12 is a pure HDMI
  receiver with no analog inputs.
 
 It is the same HDMI core (with minor modifications) though. So you end end
 up with largely the same code for the 7604 and the 7611.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-26 Thread Lars-Peter Clausen
On 11/26/2013 11:00 PM, Laurent Pinchart wrote:
 Hi Lars,
 
 On Tuesday 26 November 2013 22:43:32 Lars-Peter Clausen wrote:
 On 11/26/2013 10:28 PM, Valentine wrote:
 On 11/20/2013 07:53 PM, Valentine wrote:
 On 11/20/2013 07:42 PM, Hans Verkuil wrote:
 Hi Valentine,

 Hi Hans,

 Did you ever look at this adv7611 driver:

 https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e4a
 fa42af2daa12
 No, I missed that one somehow, although I did search for the adv7611/7612
 before implementing this one.
 I'm going to look closer at the patch and test it.

 I've tried the patch and I doubt that it was ever tested on adv7611.

 It was and it works.

 I haven't been able to make it work so far. Here's the description of some
 of the issues I've encountered.

 The patch does not apply cleanly so I had to make small adjustments just
 to make it apply without changing the functionality.

 I have an updated version of the patch, which I intend to submit soon.
 
 Is it publicly available already ?
 

Just started working on it the other day.

 [...]

 It adds adv761x support to the adv7604 in a pretty clean way.

 Doesn't seem that clean to me after having a look at it.
 It tries to handle both 7604 and 7611 chips in the same way, though,
 I'm not exactly sure if it's a good idea since 7611/12 is a pure HDMI
 receiver with no analog inputs.

 It is the same HDMI core (with minor modifications) though. So you end end
 up with largely the same code for the 7604 and the 7611.
 

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-26 Thread Laurent Pinchart
On Tuesday 26 November 2013 23:03:19 Lars-Peter Clausen wrote:
 On 11/26/2013 11:00 PM, Laurent Pinchart wrote:
  On Tuesday 26 November 2013 22:43:32 Lars-Peter Clausen wrote:
  On 11/26/2013 10:28 PM, Valentine wrote:
  On 11/20/2013 07:53 PM, Valentine wrote:
  On 11/20/2013 07:42 PM, Hans Verkuil wrote:
  Hi Valentine,
  
  Hi Hans,
  
  Did you ever look at this adv7611 driver:
  
  https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e
  4afa42af2daa12
  
  No, I missed that one somehow, although I did search for the
  adv7611/7612 before implementing this one.
  I'm going to look closer at the patch and test it.
  
  I've tried the patch and I doubt that it was ever tested on adv7611.
  
  It was and it works.
  
  I haven't been able to make it work so far. Here's the description of
  some of the issues I've encountered.
  
  The patch does not apply cleanly so I had to make small adjustments just
  to make it apply without changing the functionality.
  
  I have an updated version of the patch, which I intend to submit soon.
  
  Is it publicly available already ?
 
 Just started working on it the other day.

I'm working on the same chip, how can we avoid effort duplication ?

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-26 Thread Lars-Peter Clausen
On 11/26/2013 11:03 PM, Laurent Pinchart wrote:
 On Tuesday 26 November 2013 23:03:19 Lars-Peter Clausen wrote:
 On 11/26/2013 11:00 PM, Laurent Pinchart wrote:
 On Tuesday 26 November 2013 22:43:32 Lars-Peter Clausen wrote:
 On 11/26/2013 10:28 PM, Valentine wrote:
 On 11/20/2013 07:53 PM, Valentine wrote:
 On 11/20/2013 07:42 PM, Hans Verkuil wrote:
 Hi Valentine,

 Hi Hans,

 Did you ever look at this adv7611 driver:

 https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e
 4afa42af2daa12

 No, I missed that one somehow, although I did search for the
 adv7611/7612 before implementing this one.
 I'm going to look closer at the patch and test it.

 I've tried the patch and I doubt that it was ever tested on adv7611.

 It was and it works.

 I haven't been able to make it work so far. Here's the description of
 some of the issues I've encountered.

 The patch does not apply cleanly so I had to make small adjustments just
 to make it apply without changing the functionality.

 I have an updated version of the patch, which I intend to submit soon.

 Is it publicly available already ?

 Just started working on it the other day.
 
 I'm working on the same chip, how can we avoid effort duplication ?

I'll have something by the end of the week, latest.

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-29 Thread Lars-Peter Clausen
On 11/26/2013 11:06 PM, Lars-Peter Clausen wrote:
 On 11/26/2013 11:03 PM, Laurent Pinchart wrote:
 On Tuesday 26 November 2013 23:03:19 Lars-Peter Clausen wrote:
 On 11/26/2013 11:00 PM, Laurent Pinchart wrote:
 On Tuesday 26 November 2013 22:43:32 Lars-Peter Clausen wrote:
 On 11/26/2013 10:28 PM, Valentine wrote:
 On 11/20/2013 07:53 PM, Valentine wrote:
 On 11/20/2013 07:42 PM, Hans Verkuil wrote:
 Hi Valentine,

 Hi Hans,

 Did you ever look at this adv7611 driver:

 https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e
 4afa42af2daa12

 No, I missed that one somehow, although I did search for the
 adv7611/7612 before implementing this one.
 I'm going to look closer at the patch and test it.

 I've tried the patch and I doubt that it was ever tested on adv7611.

 It was and it works.

 I haven't been able to make it work so far. Here's the description of
 some of the issues I've encountered.

 The patch does not apply cleanly so I had to make small adjustments just
 to make it apply without changing the functionality.

 I have an updated version of the patch, which I intend to submit soon.

 Is it publicly available already ?

 Just started working on it the other day.

 I'm working on the same chip, how can we avoid effort duplication ?
 
 I'll have something by the end of the week, latest.

Sorry, this has to wait until next week. Didn't had the time to do further
work on it this week.

- Lars

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] adv7604: Update recommended writes for the adv7611

2014-06-17 Thread Lars-Peter Clausen
Update the recommended writes to those mentioned in the Rev 1.5 version of the
ADV7611 Register Settings Recommendations document released by Analog Devices.
The document does not mention why the recommended settings have been updated,
but presumably those are more fine tuned settings that can enhance performance
in some cases.

Signed-off-by: Lars-Peter Clausen l...@metafoo.de
---
 drivers/media/i2c/adv7604.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 1778d32..d4fa213 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2588,8 +2588,11 @@ static const struct adv7604_reg_seq 
adv7604_recommended_settings_hdmi[] = {
 };
 
 static const struct adv7604_reg_seq adv7611_recommended_settings_hdmi[] = {
+   /* ADV7611 Register Settings Recommendations Rev 1.5, May 2014 */
{ ADV7604_REG(ADV7604_PAGE_CP, 0x6c), 0x00 },
-   { ADV7604_REG(ADV7604_PAGE_HDMI, 0x6f), 0x0c },
+   { 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 },
-- 
1.8.0

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] [media] adv7604: Update recommended writes for the adv7611

2014-06-17 Thread Laurent Pinchart
Hi Lars,

Thank you for the patch.

On Tuesday 17 June 2014 13:52:24 Lars-Peter Clausen wrote:
 Update the recommended writes to those mentioned in the Rev 1.5 version of
 the ADV7611 Register Settings Recommendations document released by Analog
 Devices. The document does not mention why the recommended settings have
 been updated, but presumably those are more fine tuned settings that can
 enhance performance in some cases.

At least the HDMI register 0x6f change is documented as optimized DVI 
detection. You could include that in the commit message.

 Signed-off-by: Lars-Peter Clausen l...@metafoo.de

Acked-by: Laurent Pinchart laurent.pinch...@ideasonboard.com

(although all I can do is check that the patch matches the document)

 ---
  drivers/media/i2c/adv7604.c | 5 -
  1 file changed, 4 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index 1778d32..d4fa213 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -2588,8 +2588,11 @@ static const struct adv7604_reg_seq
 adv7604_recommended_settings_hdmi[] = { };
 
  static const struct adv7604_reg_seq adv7611_recommended_settings_hdmi[] = {
 + /* ADV7611 Register Settings Recommendations Rev 1.5, May 2014 */ {
 ADV7604_REG(ADV7604_PAGE_CP, 0x6c), 0x00 },
 - { ADV7604_REG(ADV7604_PAGE_HDMI, 0x6f), 0x0c },
 + { 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 },

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/13] media: adv7604: fix probe of ADV7611/7612

2015-07-27 Thread William Towle

On Fri, 24 Jul 2015, Hans Verkuil wrote:

-   val2 |= val;
+   val |= val2;



Oops. Added to my TODO list, I'll probably pick this up on Tuesday for a pull
request.


  And an oops from me: a keen-eyed local correspondent spotted that
I'd omitted the S-o-b :(

Wills.

...
Subject: [PATCH] media: adv7604: fix probe of ADV7611/7612

Prior to commit f862f57d ([media] media: i2c: ADV7604: Migrate to
regmap), the local variable 'val' contained the combined register
reads used in the chipset version ID test. Restore this expectation
so that the comparison works as it used to.

Signed-off-by: William Towle william.to...@codethink.co.uk
---
 drivers/media/i2c/adv7604.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index bfb0b6a..0587d27 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -3108,7 +3108,7 @@ static int adv76xx_probe(struct i2c_client *client,
v4l2_err(sd, Error %d reading IO Regmap\n, err);
return -ENODEV;
}
-   val2 |= val;
+   val |= val2;
if ((state-info-type == ADV7611  val != 0x2051) ||
(state-info-type == ADV7612  val != 0x2041)) {
v4l2_err(sd, not an adv761x on address 0x%x\n,
--
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Connecting ADV76xx to CSI via SFMC

2014-11-24 Thread Jean-Michel Hautbois
Hi,

I am working on using the CSI bus of i.MX6 with a adv7611 chip.
I started to work with Steve Longerbeam's tree, and here is the
current tree I am using :
https://github.com/Vodalys/linux-2.6-imx/tree/mx6-camera-staging-v2-vbx

This is a WiP tree, and not intended to be complete right now.
But at least, it should be possible to get a picture.
I will try to be as complete and synthetic as possible...

Right now, I am configuring the ADV7611 in 16-Bit SDR ITU-R BT.656
4:2:2 Mode 0 (Table 73 in Appendix C of the Reference Manual).
This means that I have pins [15:8] = [Y7..Y0] and [7:0]=[Cb7,Cr7..Cb0,Cr0].
On my board, thanks to a FPGA, pin 15 is connected to
MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 and pin 0 to
MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04.

In the source code, I am asking for a  4:2:2 YUYV packed format.

Then, when starting the board, I am doing the following :
$ v4l2-ctl -d2
--set-fmt-video=width=1280,height=720,pixelformat=YUYV,field=none,bytesperline=2560
-i3
$ v4l2-ctl -d2 --set-dv-bt-timings index=4 -i3
$   [   69.360256] adv7611 1-004c: -Chip status-
   [   69.365652] adv7611 1-004c: Chip power: on
   [   69.370446] adv7611 1-004c: EDID enabled port A: No, B: No, C: No, D: No
   [   69.378110] adv7611 1-004c: CEC: disabled
   [   69.382132] adv7611 1-004c: -Signal status-
   [   69.387722] adv7611 1-004c: Cable detected (+5V power) port A:
No, B: No, C: No, D: No
   [   69.396344] adv7611 1-004c: TMDS signal detected: false
   [   69.402245] adv7611 1-004c: TMDS signal locked: false
   [   69.408015] adv7611 1-004c: SSPD locked: true
   [   69.413047] adv7611 1-004c: STDI locked: false
   [   69.417529] adv7611 1-004c: CP locked: true
   [   69.422402] adv7611 1-004c: CP free run: on
   [   69.429013] adv7611 1-004c: Prim-mode = 0x5, video std = 0x13,
v_freq = 0x1
   [   69.436022] adv7611 1-004c: -Video Timings-
   [   69.441594] adv7611 1-004c: STDI: not locked
   [   69.449212] adv7611 1-004c: No video detected
   [   69.453587] adv7611 1-004c: Configured format: 1280x720p50 (1980x750)
   [   69.460066] adv7611 1-004c: horizontal: fp = 440, +sync = 40, bp = 220
   [   69.466637] adv7611 1-004c: vertical: fp = 5, +sync = 5, bp = 20
   [   69.472653] adv7611 1-004c: pixelclock: 7425
   [   69.477300] adv7611 1-004c: flags (0x0):
   [   69.481233] adv7611 1-004c: standards (0x1): CEA
   [   69.490112] adv7604 1-0020: -Chip status-

I keep the ADV7611 running in Free mode, which produces a blue frame,
with Y=0x23 and Cr=0x72, Cb=0xD4.

Now, I try to capture a frame :
$ v4l2-ctl -d2 --stream-mmap --stream-to x.raw --stream-count=1

I don't get anything, and here is the dmesg :
[  187.191644] imx-ipuv3 240.ipu: CSI_SENS_CONF = 0x4920
[  187.191849] imx-ipuv3 240.ipu: CSI_ACT_FRM_SIZE = 0x02CF04FF
[  187.200454] ipu_cpmem_set_image: resolution: 1280x720 stride: 2560
[  187.200472] ipu_ch_param_write_field 0 125 13
[  187.200486] ipu_ch_param_write_field 0 138 12
[  187.200498] ipu_ch_param_write_field 1 102 14
[  187.200510] ipu_ch_param_write_field 0 107 3
[  187.200521] ipu_ch_param_write_field 1 85 4
[  187.200532] ipu_ch_param_write_field 1 78 7
[  187.200543] ipu_ch_param_write_field 1 0 29
[  187.200554] ipu_ch_param_write_field 1 29 29
[  187.200566] ipu_ch_param_write_field 1 78 7
[  187.200586] ipu_ch_param_write_field 1 93 2
[  187.201077] mx6-camera-encoder: Enable CSI
[  187.205206] imx-ipuv3 240.ipu: ch 0 word 0 -  
 E0001800 000B3C9F
[  187.205226] imx-ipuv3 240.ipu: ch 0 word 1 - 09E6 013D4000
0103C000 00027FC0 
[  187.205240] ipu_ch_param_read_field 1 85 4
[  187.205254] imx-ipuv3 240.ipu: PFS 0x8,
[  187.205265] ipu_ch_param_read_field 0 107 3
[  187.205278] imx-ipuv3 240.ipu: BPP 0x3,
[  187.205289] ipu_ch_param_read_field 1 78 7
[  187.205302] imx-ipuv3 240.ipu: NPB 0xf
[  187.205313] ipu_ch_param_read_field 0 125 13
[  187.205326] imx-ipuv3 240.ipu: FW 1279,
[  187.205337] ipu_ch_param_read_field 0 138 12
[  187.205350] imx-ipuv3 240.ipu: FH 719,
[  187.205361] ipu_ch_param_read_field 1 0 29
[  187.205374] imx-ipuv3 240.ipu: EBA0 0x4f30
[  187.205385] ipu_ch_param_read_field 1 29 29
[  187.205398] imx-ipuv3 240.ipu: EBA1 0x4f50
[  187.205409] ipu_ch_param_read_field 1 102 14
[  187.205422] imx-ipuv3 240.ipu: Stride 2559
[  187.205433] ipu_ch_param_read_field 0 113 1
[  187.205445] imx-ipuv3 240.ipu: scan_order 0
[  187.205456] ipu_ch_param_read_field 1 128 14
[  187.205469] imx-ipuv3 240.ipu: uv_stride 0
[  187.205480] ipu_ch_param_read_field 0 46 22
[  187.205492] imx-ipuv3 240.ipu: u_offset 0x0
[  187.205541] ipu_ch_param_read_field 0 68 22
[  187.205557] imx-ipuv3 240.ipu: v_offset 0x0
[  187.205568] ipu_ch_param_read_field 1 116 3
[  187.205581] imx-ipuv3 240.ipu: Width0 0+1,
[  187.205592] ipu_ch_param_read_field 1 119 3
[  187.205604] imx-ipuv3 240.ipu: Width1 0+1,
[  187.205615] ipu_ch_param_read_field 1 122 3

[PATCH] media: adv7604: Fix masks used for querying timings in ADV7611

2015-04-09 Thread Jean-Michel Hautbois
All masks for timings are different between ADV7604 and ADV7611.
Most of the values have 1 precision bit more in the latter.
Fix this by adding new fields to the chip_info structure.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
 drivers/media/i2c/adv7604.c | 69 -
 1 file changed, 56 insertions(+), 13 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 60ffcf0..c1be0f7 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -124,6 +124,20 @@ struct adv76xx_chip_info {
unsigned int num_recommended_settings[2];
 
unsigned long page_mask;
+
+   /* Masks for timings */
+   unsigned int linewidth_mask;
+   unsigned int field0_height_mask;
+   unsigned int field1_height_mask;
+   unsigned int hfrontporch_mask;
+   unsigned int hsync_mask;
+   unsigned int hbackporch_mask;
+   unsigned int field0_vfrontporch_mask;
+   unsigned int field1_vfrontporch_mask;
+   unsigned int field0_vsync_mask;
+   unsigned int field1_vsync_mask;
+   unsigned int field0_vbackporch_mask;
+   unsigned int field1_vbackporch_mask;
 };
 
 /*
@@ -1504,23 +1518,28 @@ static int adv76xx_query_dv_timings(struct v4l2_subdev 
*sd,
if (is_digital_input(sd)) {
timings-type = V4L2_DV_BT_656_1120;
 
-   /* FIXME: All masks are incorrect for ADV7611 */
-   bt-width = hdmi_read16(sd, 0x07, 0xfff);
-   bt-height = hdmi_read16(sd, 0x09, 0xfff);
+   bt-width = hdmi_read16(sd, 0x07, info-linewidth_mask);
+   bt-height = hdmi_read16(sd, 0x09, info-field0_height_mask);
bt-pixelclock = info-read_hdmi_pixelclock(sd);
-   bt-hfrontporch = hdmi_read16(sd, 0x20, 0x3ff);
-   bt-hsync = hdmi_read16(sd, 0x22, 0x3ff);
-   bt-hbackporch = hdmi_read16(sd, 0x24, 0x3ff);
-   bt-vfrontporch = hdmi_read16(sd, 0x2a, 0x1fff) / 2;
-   bt-vsync = hdmi_read16(sd, 0x2e, 0x1fff) / 2;
-   bt-vbackporch = hdmi_read16(sd, 0x32, 0x1fff) / 2;
+   bt-hfrontporch = hdmi_read16(sd, 0x20, info-hfrontporch_mask);
+   bt-hsync = hdmi_read16(sd, 0x22, info-hsync_mask);
+   bt-hbackporch = hdmi_read16(sd, 0x24, info-hbackporch_mask);
+   bt-vfrontporch = hdmi_read16(sd, 0x2a,
+   info-field0_vfrontporch_mask) / 2;
+   bt-vsync = hdmi_read16(sd, 0x2e, info-field0_vsync_mask) / 2;
+   bt-vbackporch = hdmi_read16(sd, 0x32,
+   info-field0_vbackporch_mask) / 2;
bt-polarities = ((hdmi_read(sd, 0x05)  0x10) ? 
V4L2_DV_VSYNC_POS_POL : 0) |
((hdmi_read(sd, 0x05)  0x20) ? V4L2_DV_HSYNC_POS_POL : 
0);
if (bt-interlaced == V4L2_DV_INTERLACED) {
-   bt-height += hdmi_read16(sd, 0x0b, 0xfff);
-   bt-il_vfrontporch = hdmi_read16(sd, 0x2c, 0x1fff) / 2;
-   bt-il_vsync = hdmi_read16(sd, 0x30, 0x1fff) / 2;
-   bt-il_vbackporch = hdmi_read16(sd, 0x34, 0x1fff) / 2;
+   bt-height += hdmi_read16(sd, 0x0b,
+   info-field1_height_mask);
+   bt-il_vfrontporch = hdmi_read16(sd, 0x2c,
+   info-field1_vfrontporch_mask) / 2;
+   bt-il_vsync = hdmi_read16(sd, 0x30,
+   info-field1_vsync_mask) / 2;
+   bt-il_vbackporch = hdmi_read16(sd, 0x34,
+   info-field1_vbackporch_mask) / 2;
}
adv76xx_fill_optional_dv_timings_fields(sd, timings);
} else {
@@ -2567,6 +2586,18 @@ static const struct adv76xx_chip_info 
adv76xx_chip_info[] = {
BIT(ADV76XX_PAGE_EDID) | BIT(ADV76XX_PAGE_HDMI) |
BIT(ADV76XX_PAGE_TEST) | BIT(ADV76XX_PAGE_CP) |
BIT(ADV7604_PAGE_VDP),
+   .linewidth_mask = 0xfff,
+   .field0_height_mask = 0xfff,
+   .field1_height_mask = 0xfff,
+   .hfrontporch_mask = 0x3ff,
+   .hsync_mask = 0x3ff,
+   .hbackporch_mask = 0x3ff,
+   .field0_vfrontporch_mask = 0x1fff,
+   .field0_vsync_mask = 0x1fff,
+   .field0_vbackporch_mask = 0x1fff,
+   .field1_vfrontporch_mask = 0x1fff,
+   .field1_vsync_mask = 0x1fff,
+   .field1_vbackporch_mask = 0x1fff,
},
[ADV7611] = {
.type = ADV7611,
@@ -2596,6 +2627,18 @@ static const struct adv76xx_chip_info 
adv76xx_chip_info[] = {
BIT(ADV76XX_PAGE_INFOFRAME) | BIT(ADV76XX_PAGE_AFE) |
BIT(ADV76XX_PAGE_REP) |  BIT(ADV76XX_PAGE_EDID) |
BIT

Re: [PATCH 45/47] adv7604: Add DT support

2014-02-11 Thread Hans Verkuil


On 02/11/14 13:08, Laurent Pinchart wrote:
 Hi Hans,
 
 On Tuesday 11 February 2014 10:23:03 Hans Verkuil wrote:
 On 02/05/14 17:42, Laurent Pinchart wrote:
 Parse the device tree node to populate platform data.

 Cc: devicet...@vger.kernel.org
 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---

  .../devicetree/bindings/media/i2c/adv7604.txt  |  56 
  drivers/media/i2c/adv7604.c| 101 ++--
  2 files changed, 143 insertions(+), 14 deletions(-)
  create mode 100644
  Documentation/devicetree/bindings/media/i2c/adv7604.txt

 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt new file mode
 100644
 index 000..0845c50
 --- /dev/null
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -0,0 +1,56 @@
 +* Analog Devices ADV7604/11 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.
 +
 +Required Properties:
 +
 +  - compatible: Must contain one of the following
 +- adi,adv7604 for the ADV7604
 +- adi,adv7611 for the ADV7611
 +
 +  - reg: I2C slave address
 +
 +  - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 +detection pins, one per HDMI input. The active flag indicates the
 GPIO
 +level that enables hot-plug detection.
 +
 +Optional Properties:
 +
 +  - reset-gpios: Reference to the GPIO connected to the device's reset
 pin. +
 +  - adi,default-input: Index of the input to be configured as default.
 Valid +values are 0..5 for the ADV7604 and 0 for the ADV7611.
 +
 +  - adi,disable-power-down: Boolean property. When set forces the device
 to +ignore the power-down pin. The property is valid for the ADV7604
 only as +the ADV7611 has no power-down pin.
 +
 +  - adi,disable-cable-reset: Boolean property. When set disables the HDMI
 +receiver automatic reset when the HDMI cable is unplugged.
 +
 +Example:
 +
 +   hdmi_receiver@4c {
 +   compatible = adi,adv7611;
 +   reg = 0x4c;
 +
 +   reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
 +   hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
 +
 +   adi,default-input = 0;
 +
 +   #address-cells = 1;
 +   #size-cells = 0;
 +
 +   port@0 {
 +   reg = 0;
 +   };
 +   port@1 {
 +   reg = 1;
 +   hdmi_in: endpoint {
 +   remote-endpoint = ccdc_in;
 +   };
 +   };
 +   };
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index e586c1c..cd8a2dc 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -32,6 +32,7 @@

  #include linux/i2c.h
  #include linux/kernel.h
  #include linux/module.h

 +#include linux/of_gpio.h

  #include linux/slab.h
  #include linux/v4l2-dv-timings.h
  #include linux/videodev2.h

 @@ -2641,13 +2642,83 @@ static const struct adv7604_chip_info
 adv7604_chip_info[] = { 
 },
  
  };

 +static struct i2c_device_id adv7604_i2c_id[] = {
 +   { adv7604, (kernel_ulong_t)adv7604_chip_info[ADV7604] },
 +   { adv7611, (kernel_ulong_t)adv7604_chip_info[ADV7611] },
 +   { }
 +};
 +MODULE_DEVICE_TABLE(i2c, adv7604_i2c_id);
 +
 +static struct of_device_id adv7604_of_id[] = {
 +   { .compatible = adi,adv7604, .data = adv7604_chip_info[ADV7604] },
 +   { .compatible = adi,adv7611, .data = adv7604_chip_info[ADV7611] },
 +   { }
 +};
 +MODULE_DEVICE_TABLE(of, adv7604_of_id);
 +
 +static int adv7604_parse_dt(struct adv7604_state *state)

 Put this under #ifdef CONFIG_OF.
 
 #ifdef CONFIG_OF has been discouraged. I'll add an IS_ENABLED(CONFIG_OF) to 
 condition the call of adv7604_parse_dt() and let the compiler optimize the 
 function out, but I've been recommended to fix compilation errors instead of 
 using conditional compilation.
 
 It fails to compile if CONFIG_OF is not set (as it is in my case since this
 driver is used with a PCIe card).
 
 What's the compilation failure ?

drivers/media/i2c/adv7604.c: In function ‘adv7604_parse_dt’:
drivers/media/i2c/adv7604.c:2671:48: warning: dereferencing ‘void *’ pointer 
[enabled by default]
  state-info = of_match_node(adv7604_of_id, np)-data;
^
drivers/media/i2c/adv7604.c:2671:48: error: request for member ‘data’ in 
something not a structure or union
make[3]: *** [drivers/media/i2c/adv7604.o] Error 1

 
 +{
 +   struct device_node *np;
 +   unsigned int i;
 +   int ret;
 +
 +   np = state-i2c_clients[ADV7604_PAGE_IO]-dev.of_node;
 +   state-info = of_match_node(adv7604_of_id, np)-data;
 +
 +   state-pdata.disable_pwrdnb =
 +   of_property_read_bool(np, adi,disable-power-down);
 +   state-pdata.disable_cable_det_rst

[PATCH 03/20] media: adv7604: chip info and formats for ADV7612

2015-05-21 Thread William Towle
Add support for the ADV7612 chip as implemented on Renesas' Lager
board to adv7604.c, including lists for formats/colourspace/timing
selection and an IRQ handler.

Signed-off-by: William Towle william.to...@codethink.co.uk
---
 drivers/media/i2c/adv7604.c |   83 +--
 1 file changed, 81 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index be3f866..a2abb04 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -80,6 +80,7 @@ MODULE_LICENSE(GPL);
 enum adv76xx_type {
ADV7604,
ADV7611,
+   ADV7612,
 };
 
 struct adv76xx_reg_seq {
@@ -753,6 +754,23 @@ static const struct adv76xx_format_info adv7611_formats[] 
= {
  ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_12BIT },
 };
 
+static const struct adv76xx_format_info adv7612_formats[] = {
+   { MEDIA_BUS_FMT_RGB888_1X24, ADV76XX_OP_CH_SEL_RGB, true, false,
+ ADV76XX_OP_MODE_SEL_SDR_444 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_2X8, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_2X8, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_UYVY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_VYUY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_1X16, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_1X16, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+};
+
 static const struct adv76xx_format_info *
 adv76xx_format_info(struct adv76xx_state *state, u32 code)
 {
@@ -2465,6 +2483,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 adv76xx_unregister_clients(struct adv76xx_state *state)
 {
unsigned int i;
@@ -2552,6 +2575,19 @@ static const struct adv76xx_reg_seq 
adv7611_recommended_settings_hdmi[] = {
{ ADV76XX_REG_SEQ_TERM, 0 },
 };
 
+static const struct adv76xx_reg_seq adv7612_recommended_settings_hdmi[] = {
+   { ADV76XX_REG(ADV76XX_PAGE_CP, 0x6c), 0x00 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x9b), 0x03 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x6f), 0x08 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x85), 0x1f },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x87), 0x70 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x57), 0xda },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x58), 0x01 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x03), 0x98 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x4c), 0x44 },
+   { ADV76XX_REG_SEQ_TERM, 0 },
+};
+
 static const struct adv76xx_chip_info adv76xx_chip_info[] = {
[ADV7604] = {
.type = ADV7604,
@@ -2640,17 +2676,59 @@ static const struct adv76xx_chip_info 
adv76xx_chip_info[] = {
.field1_vsync_mask = 0x3fff,
.field1_vbackporch_mask = 0x3fff,
},
+   [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 = adv7612_formats,
+   .nformats = ARRAY_SIZE(adv7612_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(ADV76XX_PAGE_IO) | BIT(ADV76XX_PAGE_CEC) |
+   BIT(ADV76XX_PAGE_INFOFRAME) | BIT(ADV76XX_PAGE_AFE) |
+   BIT(ADV76XX_PAGE_REP) |  BIT(ADV76XX_PAGE_EDID) |
+   BIT(ADV76XX_PAGE_HDMI) | BIT(ADV76XX_PAGE_CP),
+   .linewidth_mask = 0x1fff,
+   .field0_height_mask = 0x1fff,
+   .field1_height_mask = 0x1fff,
+   .hfrontporch_mask = 0x1fff,
+   .hsync_mask

[PATCH 04/15] media: adv7604: chip info and formats for ADV7612

2015-05-27 Thread William Towle
Add support for the ADV7612 chip as implemented on Renesas' Lager
board to adv7604.c, including lists for formats/colourspace/timing
selection and an IRQ handler.

Signed-off-by: William Towle william.to...@codethink.co.uk
---
 drivers/media/i2c/adv7604.c |   83 +--
 1 file changed, 81 insertions(+), 2 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index aaa37b0..c5a1566 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -80,6 +80,7 @@ MODULE_LICENSE(GPL);
 enum adv76xx_type {
ADV7604,
ADV7611,
+   ADV7612,
 };
 
 struct adv76xx_reg_seq {
@@ -758,6 +759,23 @@ static const struct adv76xx_format_info adv7611_formats[] 
= {
  ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_12BIT },
 };
 
+static const struct adv76xx_format_info adv7612_formats[] = {
+   { MEDIA_BUS_FMT_RGB888_1X24, ADV76XX_OP_CH_SEL_RGB, true, false,
+ ADV76XX_OP_MODE_SEL_SDR_444 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_2X8, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_2X8, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422 | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_UYVY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_VYUY8_1X16, ADV76XX_OP_CH_SEL_RBG, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YUYV8_1X16, ADV76XX_OP_CH_SEL_RGB, false, false,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_1X16, ADV76XX_OP_CH_SEL_RGB, false, true,
+ ADV76XX_OP_MODE_SEL_SDR_422_2X | ADV76XX_OP_FORMAT_SEL_8BIT },
+};
+
 static const struct adv76xx_format_info *
 adv76xx_format_info(struct adv76xx_state *state, u32 code)
 {
@@ -2471,6 +2489,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 adv76xx_unregister_clients(struct adv76xx_state *state)
 {
unsigned int i;
@@ -2558,6 +2581,19 @@ static const struct adv76xx_reg_seq 
adv7611_recommended_settings_hdmi[] = {
{ ADV76XX_REG_SEQ_TERM, 0 },
 };
 
+static const struct adv76xx_reg_seq adv7612_recommended_settings_hdmi[] = {
+   { ADV76XX_REG(ADV76XX_PAGE_CP, 0x6c), 0x00 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x9b), 0x03 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x6f), 0x08 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x85), 0x1f },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x87), 0x70 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x57), 0xda },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x58), 0x01 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x03), 0x98 },
+   { ADV76XX_REG(ADV76XX_PAGE_HDMI, 0x4c), 0x44 },
+   { ADV76XX_REG_SEQ_TERM, 0 },
+};
+
 static const struct adv76xx_chip_info adv76xx_chip_info[] = {
[ADV7604] = {
.type = ADV7604,
@@ -2646,17 +2682,59 @@ static const struct adv76xx_chip_info 
adv76xx_chip_info[] = {
.field1_vsync_mask = 0x3fff,
.field1_vbackporch_mask = 0x3fff,
},
+   [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 = adv7612_formats,
+   .nformats = ARRAY_SIZE(adv7612_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(ADV76XX_PAGE_IO) | BIT(ADV76XX_PAGE_CEC) |
+   BIT(ADV76XX_PAGE_INFOFRAME) | BIT(ADV76XX_PAGE_AFE) |
+   BIT(ADV76XX_PAGE_REP) |  BIT(ADV76XX_PAGE_EDID) |
+   BIT(ADV76XX_PAGE_HDMI) | BIT(ADV76XX_PAGE_CP),
+   .linewidth_mask = 0x1fff,
+   .field0_height_mask = 0x1fff,
+   .field1_height_mask = 0x1fff,
+   .hfrontporch_mask = 0x1fff,
+   .hsync_mask

[PATCH v2 2/2] adv7604: Use DT parsing in dummy creation

2014-08-29 Thread Jean-Michel Hautbois
This patch uses DT in order to parse addresses for dummy devices of adv7604.
The ADV7604 has thirteen 256-byte maps that can be accessed via the main
I²C ports. Each map has it own I²C address and acts
as a standard slave device on the I²C bus.

If nothing is defined, it uses default addresses.
The main prupose is using two adv76xx on the same i2c bus.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt  | 17 +-
 drivers/media/i2c/adv7604.c| 60 ++
 2 files changed, 55 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..8486b5c 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -10,8 +10,12 @@ Required Properties:
 
   - compatible: Must contain one of the following
 - adi,adv7611 for the ADV7611
+- adi,adv7604 for the ADV7604
 
-  - reg: I2C slave address
+  - reg: I2C slave addresses
+The ADV7604 has thirteen 256-byte maps that can be accessed via the main
+I²C ports. Each map has it own I²C address and acts
+as a standard slave device on the I²C bus.
 
   - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 detection pins, one per HDMI input. The active flag indicates the GPIO
@@ -32,6 +36,12 @@ The digital output port node must contain at least one 
endpoint.
 Optional Properties:
 
   - reset-gpios: Reference to the GPIO connected to the device's reset pin.
+  - reg-names : Names of maps with programmable addresses.
+   It can contain any map needing another address than default one.
+   Possible maps names are :
+ADV7604 : main, avlink, cec, infoframe, esdp, dpp, afe, rep,
+   edid, hdmi, test, cp, vdp
+ADV7611 : main, cec, infoframe, afe, rep, edid, hdmi, cp
 
 Optional Endpoint Properties:
 
@@ -50,7 +60,10 @@ Example:
 
hdmi_receiver@4c {
compatible = adi,adv7611;
-   reg = 0x4c;
+   /* edid page will be accessible @ 0x66 on i2c bus */
+   /* other maps keep their default addresses */
+   reg = 0x4c 0x66;
+   reg-names = main, edid;
 
reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index d4fa213..56037dd 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -326,6 +326,22 @@ static const struct adv7604_video_standards 
adv7604_prim_mode_hdmi_gr[] = {
{ },
 };
 
+static const char const *adv7604_secondary_names[] = {
+   main, /* ADV7604_PAGE_IO */
+   avlink, /* ADV7604_PAGE_AVLINK */
+   cec, /* ADV7604_PAGE_CEC */
+   infoframe, /* ADV7604_PAGE_INFOFRAME */
+   esdp, /* ADV7604_PAGE_ESDP */
+   dpp, /* ADV7604_PAGE_DPP */
+   afe, /* ADV7604_PAGE_AFE */
+   rep, /* ADV7604_PAGE_REP */
+   edid, /* ADV7604_PAGE_EDID */
+   hdmi, /* ADV7604_PAGE_HDMI */
+   test, /* ADV7604_PAGE_TEST */
+   cp, /* ADV7604_PAGE_CP */
+   vdp /* ADV7604_PAGE_VDP */
+};
+
 /* --- */
 
 static inline struct adv7604_state *to_state(struct v4l2_subdev *sd)
@@ -2528,13 +2544,31 @@ static void adv7604_unregister_clients(struct 
adv7604_state *state)
 }
 
 static struct i2c_client *adv7604_dummy_client(struct v4l2_subdev *sd,
-   u8 addr, u8 io_reg)
+   unsigned int i)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
+   struct adv7604_platform_data *pdata = client-dev.platform_data;
+   unsigned int io_reg = 0xf2 + i;
+   unsigned int default_addr = io_read(sd, io_reg)  1;
+   struct i2c_client *new_client;
+
+   if (IS_ENABLED(CONFIG_OF)) {
+   /* Try to find it in DT */
+   new_client = i2c_new_secondary_device(client,
+   adv7604_secondary_names[i], default_addr);
+   } else if (pdata) {
+   if (pdata-i2c_addresses[i])
+   new_client = i2c_new_dummy(client-adapter,
+   pdata-i2c_addresses[i]);
+   else
+   new_client = i2c_new_dummy(client-adapter,
+   default_addr);
+   }
 
-   if (addr)
-   io_write(sd, io_reg, addr  1);
-   return i2c_new_dummy(client-adapter, io_read(sd, io_reg)  1);
+   if (new_client)
+   io_write(sd, io_reg, new_client-addr  1);
+
+   return new_client;
 }
 
 static const struct adv7604_reg_seq adv7604_recommended_settings_afe[] = {
@@ -2677,6 +2711,7

Re: [PATCH] [media] adv7604: Don't shift the I2C address

2015-07-27 Thread Lars-Peter Clausen

Cc Hans and media mailing list

On 07/27/2015 02:21 PM, Mike Looijmans wrote:

Messages like this are rather confusing:
   adv7611 5-004c: not an adv7611 on address 0x98
The driver shifts the I2C address left by one (0x98 = 4c  1)
probably to match the datasheet. But in all Linux drivers and
software, I2C addresses are in 7-bit notation, so it's better
to stick to that. Remove the 1 in a few places where it
logs the I2C address.

Signed-off-by: Mike Looijmans mike.looijm...@topic.nl


Looks ok to me.

Acked-by: Lars-Peter Clausen l...@metafoo.de




---
  drivers/media/i2c/adv7604.c | 8 
  1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index aa396c3..b6ebb88 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2791,7 +2791,7 @@ static int adv76xx_probe(struct i2c_client *client,
if (!i2c_check_functionality(client-adapter, I2C_FUNC_SMBUS_BYTE_DATA))
return -EIO;
v4l_dbg(1, debug, client, detecting adv76xx client on address 0x%x\n,
-   client-addr  1);
+   client-addr);

state = devm_kzalloc(client-dev, sizeof(*state), GFP_KERNEL);
if (!state) {
@@ -2870,7 +2870,7 @@ static int adv76xx_probe(struct i2c_client *client,
val = adv_smbus_read_byte_data_check(client, 0xfb, false);
if (val != 0x68) {
v4l2_info(sd, not an adv7604 on address 0x%x\n,
-   client-addr  1);
+   client-addr);
return -ENODEV;
}
} else {
@@ -2878,7 +2878,7 @@ static int adv76xx_probe(struct i2c_client *client,
| (adv_smbus_read_byte_data_check(client, 0xeb, false)  
0);
if (val != 0x2051) {
v4l2_info(sd, not an adv7611 on address 0x%x\n,
-   client-addr  1);
+   client-addr);
return -ENODEV;
}
}
@@ -2973,7 +2973,7 @@ static int adv76xx_probe(struct i2c_client *client,
if (err)
goto err_entity;
v4l2_info(sd, %s found @ 0x%x (%s)\n, client-name,
-   client-addr  1, client-adapter-name);
+   client-addr, client-adapter-name);

/* Request IRQ if available. */
if (client-irq) {



--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL for 3.16-rc1] updates and DT support for adv7604

2014-06-06 Thread Lars-Peter Clausen

On 06/06/2014 05:49 PM, Ben Dooks wrote:

On 05/06/14 13:55, Mauro Carvalho Chehab wrote:

Linus,

Please pull from:
   git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media 
topic/adv76xx

For adv7604 driver updates, including DT support.


Can we use the adv7611 for the adv7612 with these?



You can, except that you won't be able to use the second HDMI in. But it 
should be fairly trivial to add that.


- Lars
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


i.MX6 status for IPU/VPU/GPU

2014-07-28 Thread Jean-Michel Hautbois
Hi there !

We have a custom board, based on i.MX6 SoC.
We are currently using Freescale's release of Linux, but this is a
3.10.17 kernel, and several drivers are lacking (adv7611 for instance)
or badly written (all the MXC part).
As we want to have nice things :) we would like to use a mainline
kernel, or at least a tree which can be mainlined.

It seems (#v4l told me so) that some people (Steeve :) ?) are working
on a rewriting of the IPU and all DRM part for i.MX6.
What is the current status (compared to Freescale's release maybe) ?
And what can we expect in a near future ? Maybe, how can we help too ?

Thanks,
JM
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


ADV76xx : Endpoint parsing

2014-09-02 Thread Jean-Michel Hautbois
Hi,

I am trying to understand how endpoint parsing is done in adv7604/11
and the main objective is to get adv7604 endpoint parsing from DT for
all its ports (4 HDMI and one VGA as input, one output).
I am stuck on the function adv7604_parse_dt().
Tell me if I am wrong, but this function takes the first endpoint from
DT, puts the node, and that's all...

At least for ADV7611, there is two endpoints : one HDMI as input, one output.
I am not even sure that this function gets both...

And last but not least, how can we get support for all endpoints in
the ADV7604 case ?

Thanks,
JM
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [Linux-kernel] [PATCH 03/13] media: adv7604: fix probe of ADV7611/7612

2015-07-24 Thread Ben Dooks
On 23/07/15 13:21, William Towle wrote:
 Prior to commit f862f57d ([media] media: i2c: ADV7604: Migrate to
 regmap), the local variable 'val' contained the combined register
 reads used in the chipset version ID test. Restore this expectation
 so that the comparison works as it used to.

Forgot the Signed-off-by: line here.

-- 
Ben Dooks   http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-sunxi] [PATCH v3 2/3] dt-bindings: media: Add Allwinner V3s Camera Sensor Interface (CSI)

2017-12-18 Thread Maxime Ripard
Hi,

On Mon, Dec 18, 2017 at 04:49:21PM +0800, Yong wrote:
> > > +   compatible = "allwinner,sun8i-v3s-csi";
> > > +   reg = <0x01cb4000 0x1000>;
> > > +   interrupts = ;
> > > +   clocks = < CLK_BUS_CSI>,
> > > +< CLK_CSI1_SCLK>,
> > 
> > CSI also has an MCLK. Do you need that one?
> 
> MCLK is not needed if the front end is not a sensor (like adv7611).
> I will add it as an option.

I guess this should always be needed then. And the driver will make
the decision to enable it or not.

Maxime

-- 
Maxime Ripard, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com


signature.asc
Description: PGP signature


Re: [PATCH] adv7611: Set HPD GPIO direction to output

2014-03-26 Thread Laurent Pinchart
Hi Hans,

On Wednesday 26 March 2014 10:52:30 Hans Verkuil wrote:
 Hi Laurent,
 
 Stupid question perhaps, but why is gpiod_set_value_cansleep() removed?
 Does setting the output direction force the value to 0 as well?

The last argument to gpiod_direction_output() sets the initial output level, 
yes.

 On 03/26/14 03:28, Laurent Pinchart wrote:
  The HPD GPIO is used as an output but its direction is never set. Fix
  it.
  
  Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
  ---
  
   drivers/media/i2c/adv7604.c | 2 +-
   1 file changed, 1 insertion(+), 1 deletion(-)
  
  This patch applies on top of the ADV7611 support series queued for v3.16.
  
  diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
  index 51f14ab..b38ebb9 100644
  --- a/drivers/media/i2c/adv7604.c
  +++ b/drivers/media/i2c/adv7604.c
  @@ -2845,7 +2845,7 @@ static int adv7604_probe(struct i2c_client *client,
  if (IS_ERR(state-hpd_gpio[i]))
  continue;
  
  -   gpiod_set_value_cansleep(state-hpd_gpio[i], 0);
  +   gpiod_direction_output(state-hpd_gpio[i], 0);
  
  v4l_info(client, Handling HPD %u GPIO\n, i);
  }

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] adv7611: Set HPD GPIO direction to output

2014-03-26 Thread Hans Verkuil
In that case:

Acked-by: Hans Verkuil hans.verk...@cisco.com

Regards,

Hans

On 03/26/14 11:03, Laurent Pinchart wrote:
 Hi Hans,
 
 On Wednesday 26 March 2014 10:52:30 Hans Verkuil wrote:
 Hi Laurent,

 Stupid question perhaps, but why is gpiod_set_value_cansleep() removed?
 Does setting the output direction force the value to 0 as well?
 
 The last argument to gpiod_direction_output() sets the initial output level, 
 yes.
 
 On 03/26/14 03:28, Laurent Pinchart wrote:
 The HPD GPIO is used as an output but its direction is never set. Fix
 it.

 Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
 ---

  drivers/media/i2c/adv7604.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

 This patch applies on top of the ADV7611 support series queued for v3.16.

 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index 51f14ab..b38ebb9 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -2845,7 +2845,7 @@ static int adv7604_probe(struct i2c_client *client,
 if (IS_ERR(state-hpd_gpio[i]))
 continue;

 -   gpiod_set_value_cansleep(state-hpd_gpio[i], 0);
 +   gpiod_direction_output(state-hpd_gpio[i], 0);

 v4l_info(client, Handling HPD %u GPIO\n, i);
 }
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Connecting ADV76xx to CSI via SFMC

2014-11-25 Thread Philipp Zabel
Hi Jean-Michel,

Am Montag, den 24.11.2014, 16:19 +0100 schrieb Jean-Michel Hautbois:
 Hi,
 
 I am working on using the CSI bus of i.MX6 with a adv7611 chip.
 I started to work with Steve Longerbeam's tree, and here is the
 current tree I am using :
 https://github.com/Vodalys/linux-2.6-imx/tree/mx6-camera-staging-v2-vbx
 
 This is a WiP tree, and not intended to be complete right now.
 But at least, it should be possible to get a picture.
 I will try to be as complete and synthetic as possible...
 
 Right now, I am configuring the ADV7611 in 16-Bit SDR ITU-R BT.656
 4:2:2 Mode 0 (Table 73 in Appendix C of the Reference Manual).

ITU-R BT.656 only specifies 8-bit (or 10-bit) streams, the 16-bit BT.656
SDR/DDR modes with two values on the bus at the same time are somewhat
nonstandard. As far as I can tell, this mode should correspond to the
CSI's BT.1120 SDR mode (Figure 37-20 in MX6DQ Reference Manual v1), so
I'd expect CSI_SENS_CONF to be configured as DATA_WIDTH=1 (8-bit
components), SENS_DATA_FORMAT=1 (YUV422), SENS_PRCTL=5 (progressive
BT.1120 SDR).

regards
Philipp

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] media: adv7604: CP CSC uses a different register on adv7604 and adv7611

2015-02-02 Thread Hans Verkuil
Hi Jean-Michel,

On 01/26/2015 02:52 PM, Jean-Michel Hautbois wrote:
 The bits are the same, but register is 0xf4 on ADV7611 instead of 0xfc.
 When reading back the value in log_status, differentiate both.
 
 Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
 ---
  drivers/media/i2c/adv7604.c | 6 +-
  1 file changed, 5 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index e43dd2e..32e53e0 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -2310,8 +2310,12 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
   (reg_io_0x02  0x04) ? (16-235) : (0-255),
   ((reg_io_0x02  0x04) ^ (reg_io_0x02  0x01)) ?
   enabled : disabled);
 - v4l2_info(sd, Color space conversion: %s\n,
 + if (state-info-type == ADV7604)
 + v4l2_info(sd, Color space conversion: %s\n,
   csc_coeff_sel_rb[cp_read(sd, 0xfc)  4]);
 + else
 + v4l2_info(sd, Color space conversion: %s\n,
 + csc_coeff_sel_rb[cp_read(sd, 0xf4)  4]);
  
   if (!is_digital_input(sd))
   return 0;
 

You need to add this register to the adv7604_chip_info struct, just like is
done for other registers that have this issue.

Regards,

Hans
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] media: adv7604: CP CSC uses a different register on adv7604 and adv7611

2015-02-04 Thread Jean-Michel Hautbois
The bits are the same, but register is 0xf4 on ADV7611 instead of 0xfc.
When reading back the value in log_status, differentiate both.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
v2: Use adv7604_chip_info to get register instead of testing the chip ID

 drivers/media/i2c/adv7604.c | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index e43dd2e..0ee1255 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -109,6 +109,7 @@ struct adv7604_chip_info {
unsigned int cable_det_mask;
unsigned int tdms_lock_mask;
unsigned int fmt_change_digital_mask;
+   unsigned int cp_csc;
 
const struct adv7604_format_info *formats;
unsigned int nformats;
@@ -2311,7 +2312,7 @@ static int adv7604_log_status(struct v4l2_subdev *sd)
((reg_io_0x02  0x04) ^ (reg_io_0x02  0x01)) ?
enabled : disabled);
v4l2_info(sd, Color space conversion: %s\n,
-   csc_coeff_sel_rb[cp_read(sd, 0xfc)  4]);
+   csc_coeff_sel_rb[cp_read(sd, info-cp_csc)  4]);
 
if (!is_digital_input(sd))
return 0;
@@ -2615,6 +2616,7 @@ static const struct adv7604_chip_info adv7604_chip_info[] 
= {
.tdms_lock_mask = 0xe0,
.cable_det_mask = 0x1e,
.fmt_change_digital_mask = 0xc1,
+   .cp_csc = 0xfc,
.formats = adv7604_formats,
.nformats = ARRAY_SIZE(adv7604_formats),
.set_termination = adv7604_set_termination,
@@ -2648,6 +2650,7 @@ static const struct adv7604_chip_info adv7604_chip_info[] 
= {
.tdms_lock_mask = 0x43,
.cable_det_mask = 0x01,
.fmt_change_digital_mask = 0x03,
+   .cp_csc = 0xf4,
.formats = adv7611_formats,
.nformats = ARRAY_SIZE(adv7611_formats),
.set_termination = adv7611_set_termination,
-- 
2.2.2

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/8] adv7604.c: formats, default colourspace, and IRQs

2015-01-29 Thread William Towle
** for lx3.18.x+; from previous description **

The original adv7612-specific driver only contained formats meeting
a certain specification; allowing the adv7612 chip to permit all the
formats the adv7611 supports breaks this restriction and means that
enum_mbus_code can end up containing values that cause problems with
frame capture.

...Specifically, introducing a fully identical supported formats list
breaks video capture for video/x-raw-rgb in particular unless the
code path in rcar_vin.c marked Ian HACK is present. Reducing the
list leads to the possibility of gstreamer creating zero-length files.

This patch enables the reduced list by default, and does not enable
the corresponding fixup hack.

Support for 'video/x-raw-yuv' is unaffected in either case.

WmT: rcar_vin.c adv7604 driver compatibility

Add 'struct media_pad pad' member and suitable glue code, so that
soc_camera/rcar_vin can become agnostic to whether an old or new-
style driver (wrt pad API use) can sit underneath

This version has been reworked to include appropriate constant and
datatype names for kernel v3.18
---
 drivers/media/i2c/adv7604.c |  148 ++-
 1 file changed, 145 insertions(+), 3 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 803..30bbd9d 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -43,7 +43,18 @@
 #include media/v4l2-dv-timings.h
 #include media/v4l2-of.h
 
-static int debug;
+#if 1  /*  WmT: TESTING  */
+#define HAVE_ADV7612_FORMATS
+   /*  Possible issue: adv7604_formats[] is extensive, whereas
+   adv7612.c only had RGB888_1X24 (- V4L2_COLORSPACE_SRGB)
+   ...this doesn't cover MEDIA_BUS_FMT_YUYV8_2X8, which appears
+   to be the new default format. Forcing 'code' helps
+*/
+//define HAVE_ADV7611_EXTRA_FORMATS/* identical list to 7611 */
+//#define HAVE_ADV7604_EXTRA_FORMATS   /* - unsupported warnings */
+#endif
+
+static int debug = 0;
 module_param(debug, int, 0644);
 MODULE_PARM_DESC(debug, debug level (0-2));
 
@@ -80,6 +91,7 @@ MODULE_LICENSE(GPL);
 enum adv7604_type {
ADV7604,
ADV7611,
+   ADV7612,
 };
 
 struct adv7604_reg_seq {
@@ -818,6 +830,73 @@ static const struct adv7604_format_info adv7611_formats[] 
= {
  ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_12BIT },
 };
 
+#ifdef HAVE_ADV7612_FORMATS
+static const struct adv7604_format_info adv7612_formats[] = {
+   { MEDIA_BUS_FMT_RGB888_1X24, ADV7604_OP_CH_SEL_RGB, true, false,
+ ADV7604_OP_MODE_SEL_SDR_444 | ADV7604_OP_FORMAT_SEL_8BIT },
+#ifdef HAVE_ADV7611_EXTRA_FORMATS  /* breaks without Ian HACK? */
+   { MEDIA_BUS_FMT_YUYV8_2X8, ADV7604_OP_CH_SEL_RGB, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_8BIT },
+#endif
+   { MEDIA_BUS_FMT_YVYU8_2X8, ADV7604_OP_CH_SEL_RGB, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_8BIT },
+#ifdef HAVE_ADV7604_EXTRA_FORMATS
+   /* 0x200b not in soc_mediabus.c mbus_fmt[] (07/01/2015) */
+   { MEDIA_BUS_FMT_YUYV10_2X10, ADV7604_OP_CH_SEL_RGB, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_10BIT },
+   /* 0x200c not in soc_mediabus.c mbus_fmt[] (07/01/2015) */
+   { MEDIA_BUS_FMT_YVYU10_2X10, ADV7604_OP_CH_SEL_RGB, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_10BIT },
+   /* 0x201e not in soc_mediabus.c mbus_fmt[] (07/01/2015) */
+   { MEDIA_BUS_FMT_YUYV12_2X12, ADV7604_OP_CH_SEL_RGB, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_12BIT },
+   /* 0x201f not in soc_mediabus.c mbus_fmt[] (07/01/2015) */
+   { MEDIA_BUS_FMT_YVYU12_2X12, ADV7604_OP_CH_SEL_RGB, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422 | ADV7604_OP_FORMAT_SEL_12BIT },
+#endif
+   { MEDIA_BUS_FMT_UYVY8_1X16, ADV7604_OP_CH_SEL_RBG, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_VYUY8_1X16, ADV7604_OP_CH_SEL_RBG, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT },
+#ifdef HAVE_ADV7611_EXTRA_FORMATS  /* inconsistent RGB - RGB without 
Ian HACK */
+   { MEDIA_BUS_FMT_YUYV8_1X16, ADV7604_OP_CH_SEL_RGB, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT },
+   { MEDIA_BUS_FMT_YVYU8_1X16, ADV7604_OP_CH_SEL_RGB, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_8BIT },
+#endif
+#ifdef HAVE_ADV7604_EXTRA_FORMATS
+   /* 0x201a not in soc_mediabus.c mbus_fmt[] (07/01/2015) */
+   { MEDIA_BUS_FMT_UYVY10_1X20, ADV7604_OP_CH_SEL_RBG, false, false,
+ ADV7604_OP_MODE_SEL_SDR_422_2X | ADV7604_OP_FORMAT_SEL_10BIT },
+   /* 0x201b not in soc_mediabus.c mbus_fmt[] (07/01/2015) */
+   { MEDIA_BUS_FMT_VYUY10_1X20, ADV7604_OP_CH_SEL_RBG, false, true,
+ ADV7604_OP_MODE_SEL_SDR_422_2X

Re: [PATCH 03/20] media: adv7604: chip info and formats for ADV7612

2015-05-25 Thread Guennadi Liakhovetski
Hi William,

Just a nitpick:

On Wed, 20 May 2015, William Towle wrote:

 Add support for the ADV7612 chip as implemented on Renesas' Lager
 board to adv7604.c, including lists for formats/colourspace/timing
 selection and an IRQ handler.
 
 Signed-off-by: William Towle william.to...@codethink.co.uk
 ---
  drivers/media/i2c/adv7604.c |   83 
 +--
  1 file changed, 81 insertions(+), 2 deletions(-)
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index be3f866..a2abb04 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c

[snip]

 @@ -2805,8 +2883,9 @@ static int adv76xx_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,

A switch / case might look slightly better here.

Thanks
Guennadi

   client-addr  1);
   return -ENODEV;
   }
 -- 
 1.7.10.4
 
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/3] media: adv7604: automatic default-input selection

2015-08-13 Thread William Towle
Add logic such that the default-input property becomes unnecessary
for chips that only have one suitable input (ADV7611 by design, and
ADV7612 due to commit 7111cddd [media] media: adv7604: reduce support
to first (digital) input).

Additionally, Ian's documentation in commit bf9c8227 ([media] media:
adv7604: ability to read default input port from DT) states that the
default-input property should reside directly in the node for
adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Signed-off-by: William Towle william.to...@codethink.co.uk
---
 drivers/media/i2c/adv7604.c |   25 ++---
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 5631ec0..5bd81bd 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2799,7 +2799,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
struct device_node *endpoint;
struct device_node *np;
unsigned int flags;
-   u32 v;
+   u32 v= -1;
 
np = state-i2c_clients[ADV76XX_PAGE_IO]-dev.of_node;
 
@@ -2809,14 +2809,25 @@ static int adv76xx_parse_dt(struct adv76xx_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);
 
+   if (of_property_read_u32(np, default-input, v)) {
+   /* not specified ... can we choose automatically? */
+   switch (state-info-type) {
+   case ADV7611:
+   v = 0;
+   break;
+   case ADV7612:
+   if (state-info-max_port
+   == ADV76XX_PAD_HDMI_PORT_A)
+   v = 0;
+   /* else is unhobbled, leave unspecified */
+   default:
+   break;
+   }
+   }
+   state-pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags  V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
1.7.10.4

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: HDMI and Composite capture on Lager, for kernel 4.1, version 5

2015-07-28 Thread Guennadi Liakhovetski
On Thu, 23 Jul 2015, William Towle wrote:

   Version 5. Some successful upstreaming and some further modification
 means this obsoletes version 4, as seen at:
   
 http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/92832
 
   This version of the patch series contains a fix for probing the
 ADV7611/ADV7612 chips, a reduced (and renamed) chip info and formats
 patch intended to pave the way for better ADV7612 support, and updates
 to rcar_vin_try_fmt() in line with the latest feedback.
 
 Cheers,
   Wills.
 
 To follow:
   [PATCH 01/13] ARM: shmobile: lager dts: Add entries for VIN HDMI
   [PATCH 02/13] ARM: shmobile: lager dts: specify default-input for
   [PATCH 03/13] media: adv7604: fix probe of ADV7611/7612
   [PATCH 04/13] media: adv7604: reduce support to first (digital)
   [PATCH 05/13] v4l: subdev: Add pad config allocator and init
   [PATCH 06/13] media: soc_camera: rcar_vin: Add BT.709 24-bit RGB888
   [PATCH 07/13] media: soc_camera pad-aware driver initialisation
   [PATCH 08/13] media: rcar_vin: Use correct pad number in try_fmt
   [PATCH 09/13] media: soc_camera: soc_scale_crop: Use correct pad
   [PATCH 10/13] media: soc_camera: Fill std field in enum_input
   [PATCH 11/13] media: soc_camera: Fix error reporting in expbuf
   [PATCH 12/13] media: rcar_vin: fill in bus_info field
   [PATCH 13/13] media: rcar_vin: Reject videobufs that are too small

Since Hans would like to pull these patches urgently: for patches #6, 7 
(in its updated version 6 of yesterday 27.07.2015), and 8-13:

Acked-by: Guennadi Liakhovetski g.liakhovet...@gmx.de

Thanks
Guennadi
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 03/13] media: adv7604: fix probe of ADV7611/7612

2015-07-24 Thread Hans Verkuil
On 07/23/2015 02:21 PM, William Towle wrote:
 Prior to commit f862f57d ([media] media: i2c: ADV7604: Migrate to
 regmap), the local variable 'val' contained the combined register
 reads used in the chipset version ID test. Restore this expectation
 so that the comparison works as it used to.
 ---
  drivers/media/i2c/adv7604.c |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
 
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index bfb0b6a..0587d27 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -3108,7 +3108,7 @@ static int adv76xx_probe(struct i2c_client *client,
   v4l2_err(sd, Error %d reading IO Regmap\n, err);
   return -ENODEV;
   }
 - val2 |= val;
 + val |= val2;
   if ((state-info-type == ADV7611  val != 0x2051) ||
   (state-info-type == ADV7612  val != 0x2041)) {
   v4l2_err(sd, not an adv761x on address 0x%x\n,
 

Oops. Added to my TODO list, I'll probably pick this up on Tuesday for a pull
request.

Regards,

Hans
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


HDMI and Composite capture on Lager, for kernel 4.1, version 5

2015-07-23 Thread William Towle
  Version 5. Some successful upstreaming and some further modification
means this obsoletes version 4, as seen at:

http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/92832

  This version of the patch series contains a fix for probing the
ADV7611/ADV7612 chips, a reduced (and renamed) chip info and formats
patch intended to pave the way for better ADV7612 support, and updates
to rcar_vin_try_fmt() in line with the latest feedback.

Cheers,
  Wills.

To follow:
[PATCH 01/13] ARM: shmobile: lager dts: Add entries for VIN HDMI
[PATCH 02/13] ARM: shmobile: lager dts: specify default-input for
[PATCH 03/13] media: adv7604: fix probe of ADV7611/7612
[PATCH 04/13] media: adv7604: reduce support to first (digital)
[PATCH 05/13] v4l: subdev: Add pad config allocator and init
[PATCH 06/13] media: soc_camera: rcar_vin: Add BT.709 24-bit RGB888
[PATCH 07/13] media: soc_camera pad-aware driver initialisation
[PATCH 08/13] media: rcar_vin: Use correct pad number in try_fmt
[PATCH 09/13] media: soc_camera: soc_scale_crop: Use correct pad
[PATCH 10/13] media: soc_camera: Fill std field in enum_input
[PATCH 11/13] media: soc_camera: Fix error reporting in expbuf
[PATCH 12/13] media: rcar_vin: fill in bus_info field
[PATCH 13/13] media: rcar_vin: Reject videobufs that are too small
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 2/9] media: adv7604: automatic "default-input" selection

2016-03-02 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add logic such that the "default-input" property becomes unnecessary
for chips that only have one suitable input (ADV7611 by design, and
ADV7612 due to commit 7111cddd "[media] media: adv7604: reduce support
to first (digital) input").

Additionally, Ian's documentation in commit bf9c8227 ("[media] media:
adv7604: ability to read default input port from DT") states that the
"default-input" property should reside directly in the node for
adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 24 +---
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index f8dd750..2097c48 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2799,7 +2799,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
struct device_node *endpoint;
struct device_node *np;
unsigned int flags;
-   u32 v;
+   u32 v = -1;
 
np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
 
@@ -2809,14 +2809,24 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
return -EINVAL;
 
v4l2_of_parse_endpoint(endpoint, _cfg);
-
-   if (!of_property_read_u32(endpoint, "default-input", ))
-   state->pdata.default_input = v;
-   else
-   state->pdata.default_input = -1;
-
of_node_put(endpoint);
 
+   if (of_property_read_u32(np, "default-input", )) {
+   /* not specified ... can we choose automatically? */
+   switch (state->info->type) {
+   case ADV7611:
+   v = 0;
+   break;
+   case ADV7612:
+   if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A)
+   v = 0;
+   /* else is unhobbled, leave unspecified */
+   default:
+   break;
+   }
+   }
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.6.4

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


[PATCH v4 2/8] media: adv7604: automatic "default-input" selection

2016-05-11 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add logic such that the "default-input" property becomes unnecessary
for chips that only have one suitable input (ADV7611 by design, and
ADV7612 due to commit 7111cddd518f ("[media] media: adv7604: reduce
support to first (digital) input").

Additionally, Ian's documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 41a1bfc..d722c16 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2788,7 +2788,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
struct device_node *np;
unsigned int flags;
int ret;
-   u32 v;
+   u32 v = -1;
 
np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
 
@@ -2810,6 +2810,22 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 
of_node_put(endpoint);
 
+   if (of_property_read_u32(np, "default-input", )) {
+   /* not specified ... can we choose automatically? */
+   switch (state->info->type) {
+   case ADV7611:
+   v = 0;
+   break;
+   case ADV7612:
+   if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A)
+   v = 0;
+   /* else is unhobbled, leave unspecified */
+   default:
+   break;
+   }
+   }
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.7.4

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


[PATCH v3 2/7] media: adv7604: automatic "default-input" selection

2016-04-14 Thread Ulrich Hecht
From: William Towle <william.to...@codethink.co.uk>

Add logic such that the "default-input" property becomes unnecessary
for chips that only have one suitable input (ADV7611 by design, and
ADV7612 due to commit 7111cddd518f ("[media] media: adv7604: reduce
support to first (digital) input").

Additionally, Ian's documentation in commit bf9c82278c34 ("[media]
media: adv7604: ability to read default input port from DT") states
that the "default-input" property should reside directly in the node
for adv7612. Hence, also adjust the parsing to make the implementation
consistent with this.

Signed-off-by: William Towle <william.to...@codethink.co.uk>
Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
---
 drivers/media/i2c/adv7604.c | 18 +-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 41a1bfc..d722c16 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -2788,7 +2788,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
struct device_node *np;
unsigned int flags;
int ret;
-   u32 v;
+   u32 v = -1;
 
np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
 
@@ -2810,6 +2810,22 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
 
of_node_put(endpoint);
 
+   if (of_property_read_u32(np, "default-input", )) {
+   /* not specified ... can we choose automatically? */
+   switch (state->info->type) {
+   case ADV7611:
+   v = 0;
+   break;
+   case ADV7612:
+   if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A)
+   v = 0;
+   /* else is unhobbled, leave unspecified */
+   default:
+   break;
+   }
+   }
+   state->pdata.default_input = v;
+
flags = bus_cfg.bus.parallel.flags;
 
if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
-- 
2.7.4

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


[PATCH 2/2] adv7604: Use DT parsing in dummy creation

2014-08-29 Thread Jean-Michel Hautbois
This patch uses DT in order to parse addresses for dummy devices of adv7604.
If nothing is defined, it uses default addresses.
The main prupose is using two adv76xx on the same i2c bus.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt  |  7 ++-
 drivers/media/i2c/adv7604.c| 56 ++
 2 files changed, 42 insertions(+), 21 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..221b75c 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -10,6 +10,7 @@ Required Properties:
 
   - compatible: Must contain one of the following
 - adi,adv7611 for the ADV7611
+- adi,adv7604 for the ADV7604
 
   - reg: I2C slave address
 
@@ -32,6 +33,8 @@ The digital output port node must contain at least one 
endpoint.
 Optional Properties:
 
   - reset-gpios: Reference to the GPIO connected to the device's reset pin.
+  - reg-names : Names of registers to be reprogrammed.
+   Refer to source code for possible values.
 
 Optional Endpoint Properties:
 
@@ -50,7 +53,9 @@ Example:
 
hdmi_receiver@4c {
compatible = adi,adv7611;
-   reg = 0x4c;
+   /* edid page will be accessible @ 0x66 on i2c bus*/
+   reg = 0x4c 0x66;
+   reg-names = main, edid;
 
reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index d4fa213..4e660a2 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -326,6 +326,22 @@ static const struct adv7604_video_standards 
adv7604_prim_mode_hdmi_gr[] = {
{ },
 };
 
+static const char const *adv7604_secondary_names[] = {
+   main, /* ADV7604_PAGE_IO */
+   avlink, /* ADV7604_PAGE_AVLINK */
+   cec, /* ADV7604_PAGE_CEC */
+   infoframe, /* ADV7604_PAGE_INFOFRAME */
+   esdp, /* ADV7604_PAGE_ESDP */
+   dpp, /* ADV7604_PAGE_DPP */
+   afe, /* ADV7604_PAGE_AFE */
+   rep, /* ADV7604_PAGE_REP */
+   edid, /* ADV7604_PAGE_EDID */
+   hdmi, /* ADV7604_PAGE_HDMI */
+   test, /* ADV7604_PAGE_TEST */
+   cp, /* ADV7604_PAGE_CP */
+   vdp /* ADV7604_PAGE_VDP */
+};
+
 /* --- */
 
 static inline struct adv7604_state *to_state(struct v4l2_subdev *sd)
@@ -2528,13 +2544,27 @@ static void adv7604_unregister_clients(struct 
adv7604_state *state)
 }
 
 static struct i2c_client *adv7604_dummy_client(struct v4l2_subdev *sd,
-   u8 addr, u8 io_reg)
+   unsigned int i)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
+   struct adv7604_platform_data *pdata = client-dev.platform_data;
+   unsigned int io_reg = 0xf2 + i;
+   struct i2c_client *new_client;
+
+   /* Try to find it in DT */
+   new_client = i2c_new_secondary_device(client,
+   adv7604_secondary_names[i], io_read(sd, io_reg)  1);
 
-   if (addr)
-   io_write(sd, io_reg, addr  1);
-   return i2c_new_dummy(client-adapter, io_read(sd, io_reg)  1);
+   if (!new_client)
+   /* if not defined in DT, use default if available */
+   if (pdata  pdata-i2c_addresses[i])
+   new_client = i2c_new_dummy(client-adapter,
+   pdata-i2c_addresses[i]);
+
+   if (new_client)
+   io_write(sd, io_reg, new_client-addr  1);
+
+   return new_client;
 }
 
 static const struct adv7604_reg_seq adv7604_recommended_settings_afe[] = {
@@ -2677,6 +2707,7 @@ 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,adv7604, .data = adv7604_chip_info[ADV7604] },
{ }
 };
 MODULE_DEVICE_TABLE(of, adv7604_of_id);
@@ -2717,20 +2748,6 @@ static int adv7604_parse_dt(struct adv7604_state *state)
/* Disable the interrupt for now as no DT-based board uses it. */
state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
 
-   /* Use the default I2C addresses. */
-   state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
-   state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
-   state-pdata.i2c_addresses[ADV7604_PAGE_INFOFRAME] = 0x3e;
-   state-pdata.i2c_addresses[ADV7604_PAGE_ESDP] = 0x38;
-   state-pdata.i2c_addresses[ADV7604_PAGE_DPP] = 0x3c;
-   state-pdata.i2c_addresses[ADV7604_PAGE_AFE] = 0x26;
-   state-pdata.i2c_addresses[ADV7604_PAGE_REP] = 0x32;
-   state

Re: [PATCH 2/2] adv7604: Use DT parsing in dummy creation

2014-08-29 Thread Hans Verkuil
On 08/29/2014 03:28 PM, Jean-Michel Hautbois wrote:
 This patch uses DT in order to parse addresses for dummy devices of adv7604.
 If nothing is defined, it uses default addresses.
 The main prupose is using two adv76xx on the same i2c bus.
 
 Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
 ---
  .../devicetree/bindings/media/i2c/adv7604.txt  |  7 ++-
  drivers/media/i2c/adv7604.c| 56 
 ++
  2 files changed, 42 insertions(+), 21 deletions(-)
 
 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 index c27cede..221b75c 100644
 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -10,6 +10,7 @@ Required Properties:
  
- compatible: Must contain one of the following
  - adi,adv7611 for the ADV7611
 +- adi,adv7604 for the ADV7604
  
- reg: I2C slave address
  
 @@ -32,6 +33,8 @@ The digital output port node must contain at least one 
 endpoint.
  Optional Properties:
  
- reset-gpios: Reference to the GPIO connected to the device's reset pin.
 +  - reg-names : Names of registers to be reprogrammed.
 + Refer to source code for possible values.
  
  Optional Endpoint Properties:
  
 @@ -50,7 +53,9 @@ Example:
  
   hdmi_receiver@4c {
   compatible = adi,adv7611;
 - reg = 0x4c;
 + /* edid page will be accessible @ 0x66 on i2c bus*/
 + reg = 0x4c 0x66;
 + reg-names = main, edid;
  
   reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
   hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index d4fa213..4e660a2 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -326,6 +326,22 @@ static const struct adv7604_video_standards 
 adv7604_prim_mode_hdmi_gr[] = {
   { },
  };
  
 +static const char const *adv7604_secondary_names[] = {
 + main, /* ADV7604_PAGE_IO */
 + avlink, /* ADV7604_PAGE_AVLINK */
 + cec, /* ADV7604_PAGE_CEC */
 + infoframe, /* ADV7604_PAGE_INFOFRAME */
 + esdp, /* ADV7604_PAGE_ESDP */
 + dpp, /* ADV7604_PAGE_DPP */
 + afe, /* ADV7604_PAGE_AFE */
 + rep, /* ADV7604_PAGE_REP */
 + edid, /* ADV7604_PAGE_EDID */
 + hdmi, /* ADV7604_PAGE_HDMI */
 + test, /* ADV7604_PAGE_TEST */
 + cp, /* ADV7604_PAGE_CP */
 + vdp /* ADV7604_PAGE_VDP */
 +};
 +
  /* --- */
  
  static inline struct adv7604_state *to_state(struct v4l2_subdev *sd)
 @@ -2528,13 +2544,27 @@ static void adv7604_unregister_clients(struct 
 adv7604_state *state)
  }
  
  static struct i2c_client *adv7604_dummy_client(struct v4l2_subdev *sd,
 - u8 addr, u8 io_reg)
 + unsigned int i)
  {
   struct i2c_client *client = v4l2_get_subdevdata(sd);
 + struct adv7604_platform_data *pdata = client-dev.platform_data;
 + unsigned int io_reg = 0xf2 + i;
 + struct i2c_client *new_client;
 +
 + /* Try to find it in DT */
 + new_client = i2c_new_secondary_device(client,
 + adv7604_secondary_names[i], io_read(sd, io_reg)  1);

Does this work if CONFIG_OF isn't set? I suspect not.

  
 - if (addr)
 - io_write(sd, io_reg, addr  1);
 - return i2c_new_dummy(client-adapter, io_read(sd, io_reg)  1);
 + if (!new_client)
 + /* if not defined in DT, use default if available */
 + if (pdata  pdata-i2c_addresses[i])
 + new_client = i2c_new_dummy(client-adapter,
 + pdata-i2c_addresses[i]);

This is not the same as the original code. If pdata-i2c_addresses[i] == 0,
then it should use io_read(sd, io_reg)  1 as the address for i2c_new_dummy.

This would break existing code that uses platform_data (such as on our PCIe
board).

Regards,

Hans

 +
 + if (new_client)
 + io_write(sd, io_reg, new_client-addr  1);
 +
 + return new_client;
  }
  
  static const struct adv7604_reg_seq adv7604_recommended_settings_afe[] = {
 @@ -2677,6 +2707,7 @@ 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,adv7604, .data = adv7604_chip_info[ADV7604] },
   { }
  };
  MODULE_DEVICE_TABLE(of, adv7604_of_id);
 @@ -2717,20 +2748,6 @@ static int adv7604_parse_dt(struct adv7604_state 
 *state)
   /* Disable the interrupt for now as no DT-based board uses it. */
   state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
  
 - /* Use the default I2C addresses. */
 - state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42

Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-26 Thread Valentine

On 11/20/2013 07:53 PM, Valentine wrote:

On 11/20/2013 07:42 PM, Hans Verkuil wrote:

Hi Valentine,


Hi Hans,



Did you ever look at this adv7611 driver:

https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e4afa42af2daa12


No, I missed that one somehow, although I did search for the adv7611/7612 
before implementing this one.
I'm going to look closer at the patch and test it.



I've tried the patch and I doubt that it was ever tested on adv7611.
I haven't been able to make it work so far. Here's the description of some of 
the issues
I've encountered.

The patch does not apply cleanly so I had to make small adjustments just to 
make it apply
without changing the functionality.

First of all the driver (adv7604_dummy_client function) does not set default 
I2C slave addresses
in the I/O map in case they are not set in the platform data.
This is not needed for 7604, since the default addresses are already set in the 
I/O map after chip reset.
However, the map is zeroed on 7611/7612 after power up, and we always have to 
set it manually.

I had to implement the IRQ handler since the soc_camera model does not use
interrupt_service_routine subdevice callback and R-Car VIN knows nothing about 
adv7612
interrupt routed to a GPIO pin.
So I had to schedule a workqueue and call adv7604_isr from there in case an 
interrupt happens.

The driver enables multiple interrupts on the chip, however, the adv7604_isr 
callback doesn't
seem to handle them correctly.
According to the docs:
If an interrupt event occurs, and then a second interrupt event occurs before 
the system controller
has cleared or masked the first interrupt event, the ADV7611 does not generate a 
second interrupt signal.

However, the interrupt_service_routine doesn't account for that.
For example, in case fmt_change interrupt happens while fmt_change_digital 
interrupt is being
processed by the adv7604_isr routine. If fmt_change status is set just before 
we clear fmt_change_digital,
we never clear fmt_change. Thus, we end up with fmt_change interrupt missed and 
therefore further interrupts disabled.
I've tried to call the adv7604_isr routine in a loop and return from the 
worlqueue only when all interrupt status bits are cleared.
This did help a bit, but sometimes I started getting lots of I2C read/write 
errors for some reason.

I'm also not sure how the dv_timing API should be used.
The internal adv7604 state-timings structure is used when getting mbus format.
However, the driver does not set the structure neither at start-up nor in the 
interrupt service callback when format changes.
Is it supposed to be set by the upper level camera driver?
For example, when the camera driver receives v4l2_subdev_notify(sd, 
ADV7604_FMT_CHANGE, NULL);
does it have to do the following:
v4l2_subdev_call(sd, video, query_dv_timings, timings);
v4l2_subdev_call(sd, video, s_dv_timings, timings);?

I don't think that this is how it should work.

Anyways, I've tried to call query_dv_timings to initialize state-timings from 
the interrupt service workqueue.
I've been able to catch format change events though it looks very sloppy at the 
moment.

BTW, the driver doesn't provide any locking for reading/writing the 
state-settings which I believe could cause
some issues reading incomplete format when it changes asynchronously to the 
subdevice g_mbus_fmt operation.



It adds adv761x support to the adv7604 in a pretty clean way.


Doesn't seem that clean to me after having a look at it.
It tries to handle both 7604 and 7611 chips in the same way, though,
I'm not exactly sure if it's a good idea since 7611/12 is a pure HDMI receiver 
with no analog inputs.



Thinking it over I prefer to use that code (although you will have to
add the soc-camera hack for the time being) over your driver.

Others need adv7611 support as well, but with all the dv_timings etc. features
that are removed in your driver. So I am thinking that it is easier to merge
the xilinx version and add whatever you need on top of that.


To be honest I'm more inclined to drop non-soc camera support from my driver and
move it to media/i2c/soc_camera/ the moment. That would be easier.
I don't have any h/w I could test the xilinx version with non-SoC camera 
interface.
Currently I'm trying to play with core settings since even though I've managed 
to glue adv7611 support and
the R-Car VIN SoC camera driver I haven't been able to capture a frame.





Thanks,
Val.


Regards,

Hans



Thanks,
Val.


On 11/20/13 13:24, Valentine wrote:

On 11/20/2013 03:19 PM, Hans Verkuil wrote:

Hi Valentine,


Hi Hans,



On 11/20/13 11:14, Valentine wrote:

On 11/19/2013 01:50 PM, Hans Verkuil wrote:

Hi Valentine,


Hi Hans,
thanks for your review.



I don't entirely understand how you use this driver with soc-camera.
Since soc-camera doesn't support FMT_CHANGE notifies it can't really
act on it. Did you hack soc-camera to do this?


I did not. The format is queried before reading the frame

Re: Connecting ADV76xx to CSI via SFMC

2014-11-25 Thread Jean-Michel Hautbois
Hi Philipp,

Thanks for answering.

2014-11-25 9:16 GMT+01:00 Philipp Zabel p.za...@pengutronix.de:
 Hi Jean-Michel,

 Am Montag, den 24.11.2014, 16:19 +0100 schrieb Jean-Michel Hautbois:
 Hi,

 I am working on using the CSI bus of i.MX6 with a adv7611 chip.
 I started to work with Steve Longerbeam's tree, and here is the
 current tree I am using :
 https://github.com/Vodalys/linux-2.6-imx/tree/mx6-camera-staging-v2-vbx

 This is a WiP tree, and not intended to be complete right now.
 But at least, it should be possible to get a picture.
 I will try to be as complete and synthetic as possible...

 Right now, I am configuring the ADV7611 in 16-Bit SDR ITU-R BT.656
 4:2:2 Mode 0 (Table 73 in Appendix C of the Reference Manual).

 ITU-R BT.656 only specifies 8-bit (or 10-bit) streams, the 16-bit BT.656
 SDR/DDR modes with two values on the bus at the same time are somewhat
 nonstandard. As far as I can tell, this mode should correspond to the
 CSI's BT.1120 SDR mode (Figure 37-20 in MX6DQ Reference Manual v1), so
 I'd expect CSI_SENS_CONF to be configured as DATA_WIDTH=1 (8-bit
 components), SENS_DATA_FORMAT=1 (YUV422), SENS_PRCTL=5 (progressive
 BT.1120 SDR).

OK, so I tested in a brutal way :
diff --git a/drivers/gpu/ipu-v3/ipu-csi.c b/drivers/gpu/ipu-v3/ipu-csi.c
index 293262d..ff48819 100644
--- a/drivers/gpu/ipu-v3/ipu-csi.c
+++ b/drivers/gpu/ipu-v3/ipu-csi.c
@@ -342,10 +342,16 @@ static void fill_csi_bus_cfg(struct
ipu_csi_bus_config *csicfg,
break;
case V4L2_MBUS_BT656:
csicfg-ext_vsync = 0;
-   if (V4L2_FIELD_HAS_BOTH(mbus_fmt-field))
-   csicfg-clk_mode = IPU_CSI_CLK_MODE_CCIR656_INTERLACED;
+   if (mbus_fmt-code == V4L2_MBUS_FMT_YUYV8_2X8)
+   if (V4L2_FIELD_HAS_BOTH(mbus_fmt-field))
+   csicfg-clk_mode =
IPU_CSI_CLK_MODE_CCIR1120_PROGRESSIVE_SDR;
+   else
+   csicfg-clk_mode =
IPU_CSI_CLK_MODE_CCIR1120_INTERLACED_SDR;
else
-   csicfg-clk_mode = IPU_CSI_CLK_MODE_CCIR656_PROGRESSIVE;
+   if (V4L2_FIELD_HAS_BOTH(mbus_fmt-field))
+   csicfg-clk_mode =
IPU_CSI_CLK_MODE_CCIR656_INTERLACED;
+   else
+   csicfg-clk_mode =
IPU_CSI_CLK_MODE_CCIR656_PROGRESSIVE;
break;
case V4L2_MBUS_CSI2:


And before launching capture, I configure manually register 0x3 of
ADV7611 in order to have the SDR 4:2:2 mode I want.
It works better, but still have a little issue :
I am expecting : 0x23 0x72 0x23 0xd4 ...
I am getting : 0x23 0xc8 0x23 0x50

If I take binary values :
0x72 = 01110010b
0xc8 = 11001000b = 0x72  2

0xd4 = 11010100
0x50 = 0101 = 0xd4  2

In my DT, I have specified :
csi0: endpoint@0 {
reg = 0;
bus-width = 16;
data-shift = 4; /* Lines 19:4 used */
};

pinctrl_ipu1_csi0: ipu1_csi0grp {
fsl,pins = 
MX6QDL_PAD_EIM_D27__IPU1_CSI0_DATA00 0x8000
MX6QDL_PAD_EIM_D26__IPU1_CSI0_DATA01 0x8000
MX6QDL_PAD_EIM_D30__IPU1_CSI0_DATA03 0x8000
MX6QDL_PAD_EIM_D31__IPU1_CSI0_DATA02 0x8000
MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04 0x8000
MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05 0x8000
MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06 0x8000
MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07 0x8000
MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08 0x8000
MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09 0x8000
MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10 0x8000
MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11 0x8000
MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12 0x8000
MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13 0x8000
MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14 0x8000
MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15 0x8000
MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16 0x8000
MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17 0x8000
MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18 0x8000
MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 0x8000
/* Clock and Data only : BT.656 mode */
MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x8000
/*MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC 0x8000
MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 0x8000
MX6QDL_PAD_CSI0_DATA_EN__IPU1_CSI0_DATA_EN 0x8000*/
;
};

Can it be linked to the data-shift ?
Thanks again.
Regards,
JM
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] media: i2c: ADV7604: Rename adv7604 prefixes.

2015-02-04 Thread Hans Verkuil
On 02/04/15 12:27, Laurent Pinchart wrote:
 Hi Hans,
 
 Thank you for the patch.
 
 On Wednesday 04 February 2015 10:55:21 Hans Verkuil wrote:
 On 02/03/15 18:13, Pablo Anton wrote:
 It is confusing which parts of the driver are adv7604 specific, adv7611
 specific or common for both. This patch renames any adv7604 prefixes
 (both for functions and defines) to adv76xx whenever they are common.

 Signed-off-by: Pablo Anton pablo.an...@vodalys-labs.com
 Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com

 I'm happy with this, except for three small changes:

 - I had to rebase
 - ADV76xx_fsc should be ADV76XX_FSC
 - The driver name should stay the same to keep in sync with the module name.
 Besides, we might have a future driver for the adv7622/3, so adv76xx as the
 driver name is potentially confusing.

 I've applied these changes and the updated patch is below. If possible I
 would like to get this in 3.20 so future patches for 3.21 can all be based
 on these renamed functions/defines.

 Acks from Lars and Laurent would be welcome, though.

 Regards,

  Hans

 From bff6f026de4fe276f99be6ca38206720659938dc Mon Sep 17 00:00:00 2001
 From: Pablo Anton pablo.an...@vodalys-labs.com
 Date: Tue, 3 Feb 2015 18:13:18 +0100
 Subject: [PATCH] media: i2c: ADV7604: Rename adv7604 prefixes.

 It is confusing which parts of the driver are adv7604 specific, adv7611
 specific or common for both. This patch renames any adv7604 prefixes (both
 for functions and defines) to adv76xx whenever they are common.

 Signed-off-by: Pablo Anton pablo.an...@vodalys-labs.com
 Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
 [hans.verk...@cisco.com: rebased and renamed ADV76xx_fsc to ADV76XX_FSC]
 [hans.verk...@cisco.com: kept the existing adv7604 driver name]
 Signed-off-by: Hans Verkuil hans.verk...@cisco.com
 ---
  drivers/media/i2c/adv7604.c | 898 -
  include/media/adv7604.h |  83 ++--
  2 files changed, 491 insertions(+), 490 deletions(-)
 
 [snip]
 
 diff --git a/include/media/adv7604.h b/include/media/adv7604.h
 index aa1c447..9ecf353 100644
 --- a/include/media/adv7604.h
 +++ b/include/media/adv7604.h
 @@ -47,16 +47,16 @@ enum adv7604_bus_order {
 
 [snip]
 
 -enum adv7604_page {
 -ADV7604_PAGE_IO,
 +enum adv76xx_page {
 +ADV76XX_PAGE_IO,
  ADV7604_PAGE_AVLINK,
 -ADV7604_PAGE_CEC,
 -ADV7604_PAGE_INFOFRAME,
 +ADV76XX_PAGE_CEC,
 +ADV76XX_PAGE_INFOFRAME,
  ADV7604_PAGE_ESDP,
  ADV7604_PAGE_DPP,
 -ADV7604_PAGE_AFE,
 -ADV7604_PAGE_REP,
 -ADV7604_PAGE_EDID,
 -ADV7604_PAGE_HDMI,
 -ADV7604_PAGE_TEST,
 -ADV7604_PAGE_CP,
 +ADV76XX_PAGE_AFE,
 +ADV76XX_PAGE_REP,
 +ADV76XX_PAGE_EDID,
 +ADV76XX_PAGE_HDMI,
 +ADV76XX_PAGE_TEST,
 +ADV76XX_PAGE_CP,
  ADV7604_PAGE_VDP,
 -ADV7604_PAGE_MAX,
 +ADV76XX_PAGE_MAX,
  };
 
 (Taking the above chunk as one particular example, the comment applies to the 
 rest of the driver.)
 
 I'm fine with the change in general, but I wonder how we will handle it going 
 forward. Here the ADV7604-specific pages keep their ADV7604_ prefix, while 
 the 
 pages common to all supported chips now use an ADV76XX_ prefix. If a new chip 
 comes out tomorrow with support, let's say, for AVLINK, how will you name 
 ADV7604_PAGE_AVLINK ? Renaming it to ADV76XX_PAGE_AVLINK would imply that 
 it's 
 supported on all chips, which wouldn't be true, and keeping the existing name 
 would imply that it's only supported on the ADV7604, which wouldn't be true 
 either.
 

I'd probably choose something like: ADV7604_12_PAGE_AVLINK if this was supported
for e.g. the ADV7604 and ADV7612, but not ADV7611.

More likely would be scenarios where registers are supported for the adv761x but
not for the adv7604, and in that case it would be ADV761X of course.

Regards,

Hans
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] media: i2c: ADV7604: Rename adv7604 prefixes.

2015-02-04 Thread Laurent Pinchart
Hi Hans,

On Wednesday 04 February 2015 12:35:34 Hans Verkuil wrote:
 On 02/04/15 12:27, Laurent Pinchart wrote:
  On Wednesday 04 February 2015 10:55:21 Hans Verkuil wrote:
  On 02/03/15 18:13, Pablo Anton wrote:
  It is confusing which parts of the driver are adv7604 specific, adv7611
  specific or common for both. This patch renames any adv7604 prefixes
  (both for functions and defines) to adv76xx whenever they are common.
  
  Signed-off-by: Pablo Anton pablo.an...@vodalys-labs.com
  Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
  
  I'm happy with this, except for three small changes:
  
  - I had to rebase
  - ADV76xx_fsc should be ADV76XX_FSC
  - The driver name should stay the same to keep in sync with the module
  name. Besides, we might have a future driver for the adv7622/3, so
  adv76xx as the driver name is potentially confusing.
  
  I've applied these changes and the updated patch is below. If possible I
  would like to get this in 3.20 so future patches for 3.21 can all be
  based on these renamed functions/defines.
  
  Acks from Lars and Laurent would be welcome, though.
  
  Regards,
  
 Hans
  
  From bff6f026de4fe276f99be6ca38206720659938dc Mon Sep 17 00:00:00 2001
  From: Pablo Anton pablo.an...@vodalys-labs.com
  Date: Tue, 3 Feb 2015 18:13:18 +0100
  Subject: [PATCH] media: i2c: ADV7604: Rename adv7604 prefixes.
  
  It is confusing which parts of the driver are adv7604 specific, adv7611
  specific or common for both. This patch renames any adv7604 prefixes
  (both for functions and defines) to adv76xx whenever they are common.
  
  Signed-off-by: Pablo Anton pablo.an...@vodalys-labs.com
  Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
  [hans.verk...@cisco.com: rebased and renamed ADV76xx_fsc to ADV76XX_FSC]
  [hans.verk...@cisco.com: kept the existing adv7604 driver name]
  Signed-off-by: Hans Verkuil hans.verk...@cisco.com
  ---
  
   drivers/media/i2c/adv7604.c | 898  ++---
   include/media/adv7604.h |  83 ++--
   2 files changed, 491 insertions(+), 490 deletions(-)
  
  [snip]
  
  diff --git a/include/media/adv7604.h b/include/media/adv7604.h
  index aa1c447..9ecf353 100644
  --- a/include/media/adv7604.h
  +++ b/include/media/adv7604.h
  @@ -47,16 +47,16 @@ enum adv7604_bus_order {
  
  [snip]
  
  -enum adv7604_page {
  -  ADV7604_PAGE_IO,
  +enum adv76xx_page {
  +  ADV76XX_PAGE_IO,
 ADV7604_PAGE_AVLINK,
  -  ADV7604_PAGE_CEC,
  -  ADV7604_PAGE_INFOFRAME,
  +  ADV76XX_PAGE_CEC,
  +  ADV76XX_PAGE_INFOFRAME,
 ADV7604_PAGE_ESDP,
 ADV7604_PAGE_DPP,
  -  ADV7604_PAGE_AFE,
  -  ADV7604_PAGE_REP,
  -  ADV7604_PAGE_EDID,
  -  ADV7604_PAGE_HDMI,
  -  ADV7604_PAGE_TEST,
  -  ADV7604_PAGE_CP,
  +  ADV76XX_PAGE_AFE,
  +  ADV76XX_PAGE_REP,
  +  ADV76XX_PAGE_EDID,
  +  ADV76XX_PAGE_HDMI,
  +  ADV76XX_PAGE_TEST,
  +  ADV76XX_PAGE_CP,
 ADV7604_PAGE_VDP,
  -  ADV7604_PAGE_MAX,
  +  ADV76XX_PAGE_MAX,
   };
  
  (Taking the above chunk as one particular example, the comment applies to
  the rest of the driver.)
  
  I'm fine with the change in general, but I wonder how we will handle it
  going forward. Here the ADV7604-specific pages keep their ADV7604_
  prefix, while the pages common to all supported chips now use an ADV76XX_
  prefix. If a new chip comes out tomorrow with support, let's say, for
  AVLINK, how will you name ADV7604_PAGE_AVLINK ? Renaming it to
  ADV76XX_PAGE_AVLINK would imply that it's supported on all chips, which
  wouldn't be true, and keeping the existing name would imply that it's
  only supported on the ADV7604, which wouldn't be true either.
 
 I'd probably choose something like: ADV7604_12_PAGE_AVLINK if this was
 supported for e.g. the ADV7604 and ADV7612, but not ADV7611.
 
 More likely would be scenarios where registers are supported for the adv761x
 but not for the adv7604, and in that case it would be ADV761X of course.

I guess it will be a wait-and-see kind of situation. I'm fine with the patch 
if you believe it improves readability.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] media: i2c: ADV7604: Migrate to regmap

2015-06-19 Thread Lars-Peter Clausen

On 06/16/2015 10:38 AM, Pablo Anton wrote:

This is a preliminary patch in order to add support for ALSA.
It replaces all current i2c access with regmap.


Looks pretty good.


  #define ADV76XX_REG(page, offset) (((page)  8) | (offset))
@@ -633,13 +618,15 @@ static int adv76xx_read_reg(struct v4l2_subdev *sd, 
unsigned int reg)
  {
struct adv76xx_state *state = to_state(sd);
unsigned int page = reg  8;
+   unsigned int val;

if (!(BIT(page)  state-info-page_mask))
return -EINVAL;

reg = 0xff;
+   regmap_read(state-regmap[page], reg, val);


should check return value of regmap_read.



-   return adv_smbus_read_byte_data(state, page, reg);
+   return val;
  }
  #endif



+static int configure_regmap(struct adv76xx_state *state, int region)
+{
+   int err;
+
+   if (!state-i2c_clients[region])
+   return -ENODEV;
+
+   if (!state-regmap[region]) {
+
+   state-regmap[region] =
+   devm_regmap_init_i2c(state-i2c_clients[region],
+adv76xx_regmap_cnf[region]);
+
+   if (IS_ERR(state-regmap[region])) {
+   err = PTR_ERR(state-regmap[region]);
+   v4l_err(state-i2c_clients[region],
+   Error initializing regmap %d with error 
%d\n,
+   region, err);
+   return -EINVAL;
+   }
+   }
+
+   return 0;
+}
+
+static int configure_regmaps(struct adv76xx_state *state)
+{
+   int i, err;
+
+   for (i = 0 ; i  ADV76XX_PAGE_MAX; i++) {


The IO page was already initilaized earlier on, so this should start with i 
= ADV7604_PAGE_AVLINK.



+   err = configure_regmap(state, i);
+   if (err  (err != -ENODEV))
+   return err;
+   }
+   return 0;
+}
+
  static int adv76xx_probe(struct i2c_client *client,
 const struct i2c_device_id *id)
  {
@@ -2683,7 +2815,7 @@ static int adv76xx_probe(struct i2c_client *client,
struct v4l2_ctrl_handler *hdl;
struct v4l2_subdev *sd;
unsigned int i;
-   u16 val;
+   unsigned int val, val2;
int err;

/* Check if the adapter supports the needed features */
@@ -2747,22 +2879,36 @@ static int adv76xx_probe(struct i2c_client *client,
client-addr);
sd-flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;

+   /* Configure IO Regmap region */
+   err = configure_regmap(state, ADV76XX_PAGE_IO);
+
+   if (err) {
+   v4l2_info(sd, Error configuring IO regmap region\n);
+   return -ENODEV;
+   }
+
/*
 * Verify that the chip is present. On ADV7604 the RD_INFO register only
 * identifies the revision, while on ADV7611 it identifies the model as
 * well. Use the HDMI slave address on ADV7604 and RD_INFO on ADV7611.
 */
if (state-info-type == ADV7604) {
-   val = adv_smbus_read_byte_data_check(client, 0xfb, false);
+   regmap_read(state-regmap[ADV76XX_PAGE_IO], 0xfb, val);
if (val != 0x68) {
v4l2_info(sd, not an adv7604 on address 0x%x\n,
client-addr  1);
return -ENODEV;
}
} 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) {
+   regmap_read(state-regmap[ADV76XX_PAGE_IO],
+   0xea,
+   val);
+   val2 = val  8;
+   regmap_read(state-regmap[ADV76XX_PAGE_IO],
+   0xeb,
+   val);


we should check the return value of regmap_read to make sure the device 
responds.



+   val2 |= val;
+   if (val2 != 0x2051) {
v4l2_info(sd, not an adv7611 on address 0x%x\n,
client-addr  1);
return -ENODEV;
@@ -2853,6 +2999,11 @@ static int adv76xx_probe(struct i2c_client *client,
if (err)
goto err_work_queues;

+   /* Configure regmaps */
+   err = configure_regmaps(state);
+   if (err)
+   goto err_entity;
+
err = adv76xx_core_init(sd);
if (err)
goto err_entity;



--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2 1/5] dt-bindings: media: adv7604: Add support for i2c_new_secondary_device

2018-02-12 Thread Kieran Bingham
From: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>

The ADV7604 has thirteen 256-byte maps that can be accessed via the main
I²C ports. Each map has it own I²C address and acts as a standard slave
device on the I²C bus.

Extend the device tree node bindings to be able to override the default
addresses so that address conflicts with other devices on the same bus
may be resolved at the board description level.

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>
[Kieran: Re-adapted for mainline]
Signed-off-by: Kieran Bingham <kieran.bingham+rene...@ideasonboard.com>
Reviewed-by: Rob Herring <r...@kernel.org>

---
Based upon the original posting :
  https://lkml.org/lkml/2014/10/22/469

v2:
 - DT Binding update separated from code change
 - Minor reword to commit message to account for DT only change.
 - Collected Rob's RB tag.

 .../devicetree/bindings/media/i2c/adv7604.txt  | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index 9cbd92eb5d05..b64e313dcc66 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -13,7 +13,11 @@ Required Properties:
 - "adi,adv7611" for the ADV7611
 - "adi,adv7612" for the ADV7612
 
-  - reg: I2C slave address
+  - reg: I2C slave addresses
+The ADV76xx has up to thirteen 256-byte maps that can be accessed via the
+main I²C ports. Each map has it own I²C address and acts as a standard
+slave device on the I²C bus. The main address is mandatory, others are
+optional and revert to defaults if not specified.
 
   - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 detection pins, one per HDMI input. The active flag indicates the GPIO
@@ -35,6 +39,11 @@ Optional Properties:
 
   - reset-gpios: Reference to the GPIO connected to the device's reset pin.
   - default-input: Select which input is selected after reset.
+  - reg-names : Names of maps with programmable addresses.
+   It can contain any map needing a non-default address.
+   Possible maps names are :
+ "main", "avlink", "cec", "infoframe", "esdp", "dpp", "afe",
+ "rep", "edid", "hdmi", "test", "cp", "vdp"
 
 Optional Endpoint Properties:
 
@@ -52,7 +61,12 @@ Example:
 
hdmi_receiver@4c {
compatible = "adi,adv7611";
-   reg = <0x4c>;
+   /*
+* The edid page will be accessible @ 0x66 on the i2c bus. All
+* other maps will retain their default addresses.
+*/
+   reg = <0x4c 0x66>;
+   reg-names "main", "edid";
 
reset-gpios = < 0 GPIO_ACTIVE_LOW>;
hpd-gpios = < 2 GPIO_ACTIVE_HIGH>;
-- 
2.7.4



[PATCH v3 1/5] dt-bindings: media: adv7604: Add support for i2c_new_secondary_device

2018-02-12 Thread Kieran Bingham
From: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>

The ADV7604 has thirteen 256-byte maps that can be accessed via the main
I²C ports. Each map has it own I²C address and acts as a standard slave
device on the I²C bus.

Extend the device tree node bindings to be able to override the default
addresses so that address conflicts with other devices on the same bus
may be resolved at the board description level.

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>
[Kieran: Re-adapted for mainline]
Signed-off-by: Kieran Bingham <kieran.bingham+rene...@ideasonboard.com>
Reviewed-by: Rob Herring <r...@kernel.org>

---
Based upon the original posting :
  https://lkml.org/lkml/2014/10/22/469

v2:
 - DT Binding update separated from code change
 - Minor reword to commit message to account for DT only change.
 - Collected Rob's RB tag.

v3:
 - Split map register addresses into individual declarations.

 .../devicetree/bindings/media/i2c/adv7604.txt  | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index 9cbd92eb5d05..ebb5f070c05b 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -13,7 +13,11 @@ Required Properties:
 - "adi,adv7611" for the ADV7611
 - "adi,adv7612" for the ADV7612
 
-  - reg: I2C slave address
+  - reg: I2C slave addresses
+The ADV76xx has up to thirteen 256-byte maps that can be accessed via the
+main I²C ports. Each map has it own I²C address and acts as a standard
+slave device on the I²C bus. The main address is mandatory, others are
+optional and revert to defaults if not specified.
 
   - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 detection pins, one per HDMI input. The active flag indicates the GPIO
@@ -35,6 +39,11 @@ Optional Properties:
 
   - reset-gpios: Reference to the GPIO connected to the device's reset pin.
   - default-input: Select which input is selected after reset.
+  - reg-names : Names of maps with programmable addresses.
+   It can contain any map needing a non-default address.
+   Possible maps names are :
+ "main", "avlink", "cec", "infoframe", "esdp", "dpp", "afe",
+ "rep", "edid", "hdmi", "test", "cp", "vdp"
 
 Optional Endpoint Properties:
 
@@ -52,7 +61,12 @@ Example:
 
hdmi_receiver@4c {
compatible = "adi,adv7611";
-   reg = <0x4c>;
+   /*
+* The edid page will be accessible @ 0x66 on the i2c bus. All
+* other maps will retain their default addresses.
+*/
+   reg = <0x4c>, <0x66>;
+   reg-names "main", "edid";
 
reset-gpios = < 0 GPIO_ACTIVE_LOW>;
hpd-gpios = < 2 GPIO_ACTIVE_HIGH>;
-- 
2.7.4



Re: [PATCH v3 1/5] dt-bindings: media: adv7604: Add support for i2c_new_secondary_device

2018-02-13 Thread Kieran Bingham
Hi Laurent,

On 13/02/18 12:06, Laurent Pinchart wrote:
> Hi Kieran,
> 
> Thank you for the patch.

Thank you for your review,

> On Tuesday, 13 February 2018 00:07:49 EET Kieran Bingham wrote:
>> From: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>
>>
>> The ADV7604 has thirteen 256-byte maps that can be accessed via the main
>> I²C ports. Each map has it own I²C address and acts as a standard slave
>> device on the I²C bus.
>>
>> Extend the device tree node bindings to be able to override the default
>> addresses so that address conflicts with other devices on the same bus
>> may be resolved at the board description level.
>>
>> Signed-off-by: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>
>> [Kieran: Re-adapted for mainline]
>> Signed-off-by: Kieran Bingham <kieran.bingham+rene...@ideasonboard.com>
>> Reviewed-by: Rob Herring <r...@kernel.org>
> 
> Nitpicking, I might not mention i2c_new_secondary_device in the subject, as 
> this is a DT bindings change. I don't mind too much though, as long as the 
> bindings themselves don't contain Linux-specific information, and they don't, 
> so
How about: ... adv7604: Extend bindings to allow specifying slave map addresses



> Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>

Collected, thanks.

--
Kieran


> 
>> ---
>> Based upon the original posting :
>>   https://lkml.org/lkml/2014/10/22/469
>>
>> v2:
>>  - DT Binding update separated from code change
>>  - Minor reword to commit message to account for DT only change.
>>  - Collected Rob's RB tag.
>>
>> v3:
>>  - Split map register addresses into individual declarations.
>>
>>  .../devicetree/bindings/media/i2c/adv7604.txt  | 18
>> -- 1 file changed, 16 insertions(+), 2 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
>> b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index
>> 9cbd92eb5d05..ebb5f070c05b 100644
>> --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
>> +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
>> @@ -13,7 +13,11 @@ Required Properties:
>>  - "adi,adv7611" for the ADV7611
>>  - "adi,adv7612" for the ADV7612
>>
>> -  - reg: I2C slave address
>> +  - reg: I2C slave addresses
>> +The ADV76xx has up to thirteen 256-byte maps that can be accessed via
>> the +main I²C ports. Each map has it own I²C address and acts as a
>> standard +slave device on the I²C bus. The main address is mandatory,
>> others are +optional and revert to defaults if not specified.
>>
>>- hpd-gpios: References to the GPIOs that control the HDMI hot-plug
>>  detection pins, one per HDMI input. The active flag indicates the GPIO
>> @@ -35,6 +39,11 @@ Optional Properties:
>>
>>- reset-gpios: Reference to the GPIO connected to the device's reset pin.
>> - default-input: Select which input is selected after reset.
>> +  - reg-names : Names of maps with programmable addresses.
>> +It can contain any map needing a non-default address.
>> +Possible maps names are :
>> +  "main", "avlink", "cec", "infoframe", "esdp", "dpp", "afe",
>> +  "rep", "edid", "hdmi", "test", "cp", "vdp"
>>
>>  Optional Endpoint Properties:
>>
>> @@ -52,7 +61,12 @@ Example:
>>
>>  hdmi_receiver@4c {
>>  compatible = "adi,adv7611";
>> -reg = <0x4c>;
>> +/*
>> + * The edid page will be accessible @ 0x66 on the i2c bus. All
>> + * other maps will retain their default addresses.
>> + */
>> +reg = <0x4c>, <0x66>;
>> +reg-names "main", "edid";
>>
>>  reset-gpios = < 0 GPIO_ACTIVE_LOW>;
>>  hpd-gpios = < 2 GPIO_ACTIVE_HIGH>;
> 
> 


Re: [PATCH v3 1/5] dt-bindings: media: adv7604: Add support for i2c_new_secondary_device

2018-02-13 Thread Laurent Pinchart
Hi Kieran,

On Tuesday, 13 February 2018 15:14:43 EET Kieran Bingham wrote:
> On 13/02/18 12:06, Laurent Pinchart wrote:
> > On Tuesday, 13 February 2018 00:07:49 EET Kieran Bingham wrote:
> >> From: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>
> >> 
> >> The ADV7604 has thirteen 256-byte maps that can be accessed via the main
> >> I²C ports. Each map has it own I²C address and acts as a standard slave
> >> device on the I²C bus.
> >> 
> >> Extend the device tree node bindings to be able to override the default
> >> addresses so that address conflicts with other devices on the same bus
> >> may be resolved at the board description level.
> >> 
> >> Signed-off-by: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>
> >> [Kieran: Re-adapted for mainline]
> >> Signed-off-by: Kieran Bingham <kieran.bingham+rene...@ideasonboard.com>
> >> Reviewed-by: Rob Herring <r...@kernel.org>
> > 
> > Nitpicking, I might not mention i2c_new_secondary_device in the subject,
> > as this is a DT bindings change. I don't mind too much though, as long as
> > the bindings themselves don't contain Linux-specific information, and they
> > don't, so
> 
> How about: ... adv7604: Extend bindings to allow specifying slave map
> addresses

Sounds good to me.

> > Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
> 
> Collected, thanks.
> 
> --
> Kieran
> 
> >> ---
> >> 
> >> Based upon the original posting :
> >>   https://lkml.org/lkml/2014/10/22/469
> >> 
> >> v2:
> >>  - DT Binding update separated from code change
> >>  - Minor reword to commit message to account for DT only change.
> >>  - Collected Rob's RB tag.
> >> 
> >> v3:
> >>  - Split map register addresses into individual declarations.
> >>  
> >>  .../devicetree/bindings/media/i2c/adv7604.txt  | 18
> >> 
> >> -- 1 file changed, 16 insertions(+), 2 deletions(-)
> >> 
> >> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> >> b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index
> >> 9cbd92eb5d05..ebb5f070c05b 100644
> >> --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> >> +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> >> 
> >> @@ -13,7 +13,11 @@ Required Properties:
> >>  - "adi,adv7611" for the ADV7611
> >>  - "adi,adv7612" for the ADV7612
> >> 
> >> -  - reg: I2C slave address
> >> +  - reg: I2C slave addresses
> >> +The ADV76xx has up to thirteen 256-byte maps that can be accessed
> >> via
> >> the +main I²C ports. Each map has it own I²C address and acts as a
> >> standard +slave device on the I²C bus. The main address is mandatory,
> >> others are +optional and revert to defaults if not specified.
> >> 
> >>- hpd-gpios: References to the GPIOs that control the HDMI hot-plug
> >>
> >>  detection pins, one per HDMI input. The active flag indicates the
> >>  GPIO
> >> 
> >> @@ -35,6 +39,11 @@ Optional Properties:
> >>- reset-gpios: Reference to the GPIO connected to the device's reset
> >>pin.
> >> 
> >> - default-input: Select which input is selected after reset.
> >> +  - reg-names : Names of maps with programmable addresses.
> >> +  It can contain any map needing a non-default address.
> >> +  Possible maps names are :
> >> +"main", "avlink", "cec", "infoframe", "esdp", "dpp", "afe",
> >> +"rep", "edid", "hdmi", "test", "cp", "vdp"
> >> 
> >>  Optional Endpoint Properties:
> >> @@ -52,7 +61,12 @@ Example:
> >>hdmi_receiver@4c {
> >>
> >>compatible = "adi,adv7611";
> >> 
> >> -  reg = <0x4c>;
> >> +  /*
> >> +   * The edid page will be accessible @ 0x66 on the i2c bus. All
> >> +   * other maps will retain their default addresses.
> >> +   */
> >> +  reg = <0x4c>, <0x66>;
> >> +  reg-names "main", "edid";
> >> 
> >>reset-gpios = < 0 GPIO_ACTIVE_LOW>;
> >>hpd-gpios = < 2 GPIO_ACTIVE_HIGH>;

-- 
Regards,

Laurent Pinchart



Re: [PATCH v3 1/5] dt-bindings: media: adv7604: Add support for i2c_new_secondary_device

2018-02-13 Thread Laurent Pinchart
Hi Kieran,

Thank you for the patch.

On Tuesday, 13 February 2018 00:07:49 EET Kieran Bingham wrote:
> From: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>
> 
> The ADV7604 has thirteen 256-byte maps that can be accessed via the main
> I²C ports. Each map has it own I²C address and acts as a standard slave
> device on the I²C bus.
> 
> Extend the device tree node bindings to be able to override the default
> addresses so that address conflicts with other devices on the same bus
> may be resolved at the board description level.
> 
> Signed-off-by: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>
> [Kieran: Re-adapted for mainline]
> Signed-off-by: Kieran Bingham <kieran.bingham+rene...@ideasonboard.com>
> Reviewed-by: Rob Herring <r...@kernel.org>

Nitpicking, I might not mention i2c_new_secondary_device in the subject, as 
this is a DT bindings change. I don't mind too much though, as long as the 
bindings themselves don't contain Linux-specific information, and they don't, 
so

Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>

> ---
> Based upon the original posting :
>   https://lkml.org/lkml/2014/10/22/469
> 
> v2:
>  - DT Binding update separated from code change
>  - Minor reword to commit message to account for DT only change.
>  - Collected Rob's RB tag.
> 
> v3:
>  - Split map register addresses into individual declarations.
> 
>  .../devicetree/bindings/media/i2c/adv7604.txt  | 18
> -- 1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index
> 9cbd92eb5d05..ebb5f070c05b 100644
> --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
> @@ -13,7 +13,11 @@ Required Properties:
>  - "adi,adv7611" for the ADV7611
>  - "adi,adv7612" for the ADV7612
> 
> -  - reg: I2C slave address
> +  - reg: I2C slave addresses
> +The ADV76xx has up to thirteen 256-byte maps that can be accessed via
> the +main I²C ports. Each map has it own I²C address and acts as a
> standard +slave device on the I²C bus. The main address is mandatory,
> others are +optional and revert to defaults if not specified.
> 
>- hpd-gpios: References to the GPIOs that control the HDMI hot-plug
>  detection pins, one per HDMI input. The active flag indicates the GPIO
> @@ -35,6 +39,11 @@ Optional Properties:
> 
>- reset-gpios: Reference to the GPIO connected to the device's reset pin.
> - default-input: Select which input is selected after reset.
> +  - reg-names : Names of maps with programmable addresses.
> + It can contain any map needing a non-default address.
> + Possible maps names are :
> +   "main", "avlink", "cec", "infoframe", "esdp", "dpp", "afe",
> +   "rep", "edid", "hdmi", "test", "cp", "vdp"
> 
>  Optional Endpoint Properties:
> 
> @@ -52,7 +61,12 @@ Example:
> 
>   hdmi_receiver@4c {
>   compatible = "adi,adv7611";
> - reg = <0x4c>;
> + /*
> +  * The edid page will be accessible @ 0x66 on the i2c bus. All
> +  * other maps will retain their default addresses.
> +  */
> + reg = <0x4c>, <0x66>;
> + reg-names "main", "edid";
> 
>   reset-gpios = < 0 GPIO_ACTIVE_LOW>;
>   hpd-gpios = < 2 GPIO_ACTIVE_HIGH>;


-- 
Regards,

Laurent Pinchart



[PATCH v4 1/5] dt-bindings: media: adv7604: Extend bindings to allow specifying slave map addresses

2018-02-13 Thread Kieran Bingham
From: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>

The ADV7604 has thirteen 256-byte maps that can be accessed via the main
I2C ports. Each map has it own I2C address and acts as a standard slave
device on the I2C bus.

Extend the device tree node bindings to be able to override the default
addresses so that address conflicts with other devices on the same bus
may be resolved at the board description level.

Signed-off-by: Jean-Michel Hautbois <jean-michel.hautb...@vodalys.com>
[Kieran: Re-adapted for mainline]
Signed-off-by: Kieran Bingham <kieran.bingham+rene...@ideasonboard.com>
Reviewed-by: Rob Herring <r...@kernel.org>
Reviewed-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>

---
Based upon the original posting :
  https://lkml.org/lkml/2014/10/22/469

v2:
 - DT Binding update separated from code change
 - Minor reword to commit message to account for DT only change.
 - Collected Rob's RB tag.

v3:
 - Split map register addresses into individual declarations.

v4:
 - Collect Laurents RB tag
 - Adapt commit title
 - Normalise I2C usage (I²C is harder to grep for)

 .../devicetree/bindings/media/i2c/adv7604.txt  | 18 --
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index 9cbd92eb5d05..dcf57e7c60eb 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -13,7 +13,11 @@ Required Properties:
 - "adi,adv7611" for the ADV7611
 - "adi,adv7612" for the ADV7612
 
-  - reg: I2C slave address
+  - reg: I2C slave addresses
+The ADV76xx has up to thirteen 256-byte maps that can be accessed via the
+main I2C ports. Each map has it own I2C address and acts as a standard
+slave device on the I2C bus. The main address is mandatory, others are
+optional and revert to defaults if not specified.
 
   - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 detection pins, one per HDMI input. The active flag indicates the GPIO
@@ -35,6 +39,11 @@ Optional Properties:
 
   - reset-gpios: Reference to the GPIO connected to the device's reset pin.
   - default-input: Select which input is selected after reset.
+  - reg-names : Names of maps with programmable addresses.
+   It can contain any map needing a non-default address.
+   Possible maps names are :
+ "main", "avlink", "cec", "infoframe", "esdp", "dpp", "afe",
+ "rep", "edid", "hdmi", "test", "cp", "vdp"
 
 Optional Endpoint Properties:
 
@@ -52,7 +61,12 @@ Example:
 
hdmi_receiver@4c {
compatible = "adi,adv7611";
-   reg = <0x4c>;
+   /*
+* The edid page will be accessible @ 0x66 on the I2C bus. All
+* other maps will retain their default addresses.
+*/
+   reg = <0x4c>, <0x66>;
+   reg-names "main", "edid";
 
reset-gpios = < 0 GPIO_ACTIVE_LOW>;
hpd-gpios = < 2 GPIO_ACTIVE_HIGH>;
-- 
2.7.4



[PATCH 0/3] media: Add SH-Mobile RCAR-H2 Lager board support

2013-09-24 Thread Valentine Barshak
The following patches add ADV7611/ADV7612 HDMI receiver I2C driver
and add RCAR H2 SOC support along with ADV761x output format support
to rcar_vin soc_camera driver.

These changes are needed for SH-Mobile R8A7790 Lager board
video input support.

Valentine Barshak (3):
  media: i2c: Add ADV761X support
  media: rcar_vin: Add preliminary r8a7790 H2 support
  media: rcar_vin: Add RGB888_1X24 input format support

 drivers/media/i2c/Kconfig|   11 +
 drivers/media/i2c/Makefile   |1 +
 drivers/media/i2c/adv761x.c  | 1060 ++
 drivers/media/platform/soc_camera/rcar_vin.c |   17 +-
 include/media/adv761x.h  |   28 +
 5 files changed, 1114 insertions(+), 3 deletions(-)
 create mode 100644 drivers/media/i2c/adv761x.c
 create mode 100644 include/media/adv761x.h

-- 
1.8.3.1

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/3] media: i2c: Add ADV761X support

2013-09-25 Thread Laurent Pinchart
Hi Guennadi,

On Tuesday 24 September 2013 17:54:11 Guennadi Liakhovetski wrote:
 Hi Valentine,
 
 On Tue, 24 Sep 2013, Valentine Barshak wrote:
  This adds ADV7611/ADV7612 Dual Port Xpressview
  225 MHz HDMI Receiver support.
  
  The code is based on the ADV7604 driver, and ADV7612 patch
  by Shinobu Uehara shinobu.uehara...@renesas.com
  
  Signed-off-by: Valentine Barshak valentine.bars...@cogentembedded.com
 
 IIRC, Laurent is reviewing all new media I2C drivers, I added him to cc.

Actually I only handle sensor drivers. I can of course review other I2C V4L2 
subdevice drivers from time to time :-)

I'll review the patch and send comments.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] media: Add SH-Mobile RCAR-H2 Lager board support

2013-11-12 Thread Valentine

On 11/12/2013 03:42 AM, Laurent Pinchart wrote:

Hi Valentine,

On Tuesday 24 September 2013 17:38:33 Valentine Barshak wrote:

The following patches add ADV7611/ADV7612 HDMI receiver I2C driver
and add RCAR H2 SOC support along with ADV761x output format support
to rcar_vin soc_camera driver.

These changes are needed for SH-Mobile R8A7790 Lager board
video input support.


Do you plan to submit a v2 ? I need the ADV761x driver pretty soon and I'd
like to avoid submitting a competing patch :-)


Yes, I plan to submit v2 when it's ready.
Currently it's a work in progress.

Do you already have anything to submit for the ADV761x support?

Thanks,
Val.
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 0/3] media: Add SH-Mobile RCAR-H2 Lager board support

2013-11-12 Thread Laurent Pinchart
Hi Valentine,

On Wednesday 13 November 2013 00:34:04 Valentine wrote:
 On 11/12/2013 03:42 AM, Laurent Pinchart wrote:
  On Tuesday 24 September 2013 17:38:33 Valentine Barshak wrote:
  The following patches add ADV7611/ADV7612 HDMI receiver I2C driver
  and add RCAR H2 SOC support along with ADV761x output format support
  to rcar_vin soc_camera driver.
  
  These changes are needed for SH-Mobile R8A7790 Lager board
  video input support.
  
  Do you plan to submit a v2 ? I need the ADV761x driver pretty soon and I'd
  like to avoid submitting a competing patch :-)
 
 Yes, I plan to submit v2 when it's ready.
 Currently it's a work in progress.
 
 Do you already have anything to submit for the ADV761x support?

Not yet, but I will likely work on it in the next few days.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-20 Thread Valentine

On 11/20/2013 07:42 PM, Hans Verkuil wrote:

Hi Valentine,

Did you ever look at this adv7611 driver:

https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e4afa42af2daa12


No, I missed that one somehow, although I did search for the adv7611/7612 
before implementing this one.
I'm going to look closer at the patch and test it.



It adds adv761x support to the adv7604 in a pretty clean way.

Thinking it over I prefer to use that code (although you will have to
add the soc-camera hack for the time being) over your driver.

Others need adv7611 support as well, but with all the dv_timings etc. features
that are removed in your driver. So I am thinking that it is easier to merge
the xilinx version and add whatever you need on top of that.



Thanks,
Val.


Regards,

Hans

On 11/20/13 13:24, Valentine wrote:

On 11/20/2013 03:19 PM, Hans Verkuil wrote:

Hi Valentine,


Hi Hans,



On 11/20/13 11:14, Valentine wrote:

On 11/19/2013 01:50 PM, Hans Verkuil wrote:

Hi Valentine,


Hi Hans,
thanks for your review.



I don't entirely understand how you use this driver with soc-camera.
Since soc-camera doesn't support FMT_CHANGE notifies it can't really
act on it. Did you hack soc-camera to do this?


I did not. The format is queried before reading the frame by the user-space.
I'm not sure if there's some kind of generic interface to notify the camera
layer about format change events. Different subdevices use different FMT_CHANGE
defines for that. I've implemented the format change notifier based on the 
adv7604
in hope that it may be useful later.


Yes, I need to generalize the FMT_CHANGE event.

But what happens if you are streaming and the HDMI connector is unplugged?
Or plugged back in again, possibly with a larger resolution? I'm not sure
if the soc_camera driver supports such scenarios.


It doesn't. Currently it's up to the UI to poll the format and do the necessary 
changes.
Otherwise the picture will be incorrect.







The way it stands I would prefer to see a version of the driver without
soc-camera support. I wouldn't have a problem merging that as this driver
is a good base for further development.


I've tried to implement the driver base good enough to work with both SoC
and non-SoC cameras since I don't think having 2 separate drivers for
different camera models is a good idea.

The problem is that I'm using it with R-Car VIN SoC camera driver and don't
have any other h/w. Having a platform data quirk for SoC camera in
the subdevice driver seemed simple and clean enough.


I hate it, but it isn't something you can do anything about. So it will have
to do for now.


Hacking SoC camera to make it support both generic and SoC cam subdevices
doesn't seem that straightforward to me.


Guennadi, what is the status of this? I'm getting really tired of soc-camera
infecting sub-devices. Subdev drivers should be independent of any bridge
driver using them, but soc-camera keeps breaking that. It's driving me nuts.

I'll be honest, it's getting to the point that I want to just NACK any
future subdev drivers that depend on soc-camera, just to force a solution.
There is no technical reason for this dependency, it just takes some time
to fix soc-camera.


Re-implementing R-Car VIN as a non-SoC model seems quite a big task that
involves a lot of regression testing with other R-Car boards that use different
subdevices with VIN.

What would you suggest?


Let's leave it as-is for now :-(

I'm not happy, but as I said, it's not your fault.


OK, thanks.
Once a better solution is available we can remove the quirk.



Regards,

 Hans


Thanks,
Val.







You do however have to add support for the V4L2_CID_DV_RX_POWER_PRESENT
control. It's easy to implement and that way apps can be notified when
the hotplug changes value.


OK, thanks.



Regards,

  Hans


Thanks,
Val.



On 11/15/13 13:54, Valentine Barshak wrote:

This adds ADV7611/ADV7612 Xpressview  HDMI Receiver base
support. Only one HDMI port is supported on ADV7612.

The code is based on the ADV7604 driver, and ADV7612 patch by
Shinobu Uehara shinobu.uehara...@renesas.com

Changes in version 2:
* Used platform data for I2C addresses setup. The driver
 should work with both SoC and non-SoC camera models.
* Dropped unnecessary code and unsupported callbacks.
* Implemented IRQ handling for format change detection.

Signed-off-by: Valentine Barshak valentine.bars...@cogentembedded.com







--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-27 Thread Hans Verkuil
Hi Laurent,

On 11/27/13 12:39, Laurent Pinchart wrote:
 Hi Hans,
 
 On Wednesday 27 November 2013 09:21:22 Hans Verkuil wrote:
 On 11/26/2013 10:28 PM, Valentine wrote:
 On 11/20/2013 07:53 PM, Valentine wrote:
 On 11/20/2013 07:42 PM, Hans Verkuil wrote:
 Hi Valentine,

 Hi Hans,

 Did you ever look at this adv7611 driver:

 https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e4a
 fa42af2daa12

 No, I missed that one somehow, although I did search for the adv7611/7612
 before implementing this one. I'm going to look closer at the patch and
 test it.

 I've tried the patch and I doubt that it was ever tested on adv7611.
 I haven't been able to make it work so far. Here's the description of some
 of the issues I've encountered.

 The patch does not apply cleanly so I had to make small adjustments just
 to make it apply without changing the functionality.

 First of all the driver (adv7604_dummy_client function) does not set
 default I2C slave addresses in the I/O map in case they are not set in
 the platform data.
 This is not needed for 7604, since the default addresses are already set
 in the I/O map after chip reset. However, the map is zeroed on 7611/7612
 after power up, and we always have to set it manually.

 So, the platform data for the 7611/2 should always give i2c addresses. That
 seems reasonable.

 I had to implement the IRQ handler since the soc_camera model does not use
 interrupt_service_routine subdevice callback and R-Car VIN knows nothing
 about adv7612 interrupt routed to a GPIO pin.
 So I had to schedule a workqueue and call adv7604_isr from there in case
 an interrupt happens.

 For our systems the adv7604 interrupts is not always hooked up to a gpio
 irq, instead a register has to be read to figure out which device actually
 produced the irq.
 
 Where is that register located ? Shouldn't it be modeled as an interrupt 
 controller ?

It's a PCIe interrupt whose handler needs to read several FPGA registers
in order to figure out which interrupt was actually triggered. I don't
know enough about interrupt controller to understand whether it can be
modeled as a 'standard' interrupt.

 
 So I want to keep the interrupt_service_routine(). However, adding a gpio
 field to the platform_data that, if set, will tell the driver to request an
 irq and setup a workqueue that calls interrupt_service_routine() would be
 fine with me. That will benefit a lot of people since using gpios is much
 more common.
 
 We should use the i2c_board_info.irq field for that, not a field in the 
 platform data structure. The IRQ line could be hooked up to a non-GPIO IRQ.

Yes, of course. Although the adv7604 has two interrupt lines, so if you
would want to use the second, then that would still have to be specified
through the platform data.

 
 The driver enables multiple interrupts on the chip, however, the
 adv7604_isr callback doesn't seem to handle them correctly.
 According to the docs:
 If an interrupt event occurs, and then a second interrupt event occurs
 before the system controller has cleared or masked the first interrupt
 event, the ADV7611 does not generate a second interrupt signal.

 However, the interrupt_service_routine doesn't account for that.
 For example, in case fmt_change interrupt happens while fmt_change_digital
 interrupt is being processed by the adv7604_isr routine. If fmt_change
 status is set just before we clear fmt_change_digital, we never clear
 fmt_change. Thus, we end up with fmt_change interrupt missed and
 therefore further interrupts disabled. I've tried to call the adv7604_isr
 routine in a loop and return from the worlqueue only when all interrupt
 status bits are cleared. This did help a bit, but sometimes I started
 getting lots of I2C read/write errors for some reason.

 I'm not sure if there is much that can be done about this. The code reads
 the interrupt status, then clears the interrupts right after. There is
 always a race condition there since this isn't atomic ('read and clear').
 Unless Lars-Peter has a better idea?

 What can be improved, though, is to clear not just the interrupts that were
 read, but all the interrupts that are unmasked. You are right, you could
 loose an interrupt that way.
 
 Wouldn't level-trigerred interrupts fix the issue ?

See my earlier reply.

Regards,

Hans
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH V2] media: i2c: Add ADV761X support

2013-11-27 Thread Laurent Pinchart
Hi Hans,

On Wednesday 27 November 2013 13:14:41 Hans Verkuil wrote:
 On 11/27/13 12:39, Laurent Pinchart wrote:
  On Wednesday 27 November 2013 09:21:22 Hans Verkuil wrote:
  On 11/26/2013 10:28 PM, Valentine wrote:
  On 11/20/2013 07:53 PM, Valentine wrote:
  On 11/20/2013 07:42 PM, Hans Verkuil wrote:
  Hi Valentine,
  
  Hi Hans,
  
  Did you ever look at this adv7611 driver:
  
  https://github.com/Xilinx/linux-xlnx/commit/610b9d5de22ae7c0047c65a07e
  4afa42af2daa12
  
  No, I missed that one somehow, although I did search for the
  adv7611/7612 before implementing this one. I'm going to look closer at
  the patch and test it.
  
  I've tried the patch and I doubt that it was ever tested on adv7611.
  I haven't been able to make it work so far. Here's the description of
  some of the issues I've encountered.
  
  The patch does not apply cleanly so I had to make small adjustments just
  to make it apply without changing the functionality.
  
  First of all the driver (adv7604_dummy_client function) does not set
  default I2C slave addresses in the I/O map in case they are not set in
  the platform data.
  This is not needed for 7604, since the default addresses are already set
  in the I/O map after chip reset. However, the map is zeroed on 7611/7612
  after power up, and we always have to set it manually.
  
  So, the platform data for the 7611/2 should always give i2c addresses.
  That seems reasonable.
  
  I had to implement the IRQ handler since the soc_camera model does not
  use interrupt_service_routine subdevice callback and R-Car VIN knows
  nothing about adv7612 interrupt routed to a GPIO pin. So I had to
  schedule a workqueue and call adv7604_isr from there in case an
  interrupt happens.
  
  For our systems the adv7604 interrupts is not always hooked up to a gpio
  irq, instead a register has to be read to figure out which device
  actually produced the irq.
  
  Where is that register located ? Shouldn't it be modeled as an interrupt
  controller ?
 
 It's a PCIe interrupt whose handler needs to read several FPGA registers
 in order to figure out which interrupt was actually triggered. I don't
 know enough about interrupt controller to understand whether it can be
 modeled as a 'standard' interrupt.

I've replied to this separately.

  So I want to keep the interrupt_service_routine(). However, adding a gpio
  field to the platform_data that, if set, will tell the driver to request
  an irq and setup a workqueue that calls interrupt_service_routine() would
  be fine with me. That will benefit a lot of people since using gpios is
  much more common.
  
  We should use the i2c_board_info.irq field for that, not a field in the
  platform data structure. The IRQ line could be hooked up to a non-GPIO
  IRQ.
 
 Yes, of course. Although the adv7604 has two interrupt lines, so if you
 would want to use the second, then that would still have to be specified
 through the platform data.

I believe we should then extend the I2C interrupt support. The reason for 
doing so is that we want to use the interrupt DT bindings for DT platforms, 
and those are handled by the I2C core.

  The driver enables multiple interrupts on the chip, however, the
  adv7604_isr callback doesn't seem to handle them correctly.
  According to the docs:
  If an interrupt event occurs, and then a second interrupt event occurs
  before the system controller has cleared or masked the first interrupt
  event, the ADV7611 does not generate a second interrupt signal.
  
  However, the interrupt_service_routine doesn't account for that.
  For example, in case fmt_change interrupt happens while
  fmt_change_digital interrupt is being processed by the adv7604_isr
  routine. If fmt_change status is set just before we clear
  fmt_change_digital, we never clear fmt_change. Thus, we end up with
  fmt_change interrupt missed and therefore further interrupts disabled.
  I've tried to call the adv7604_isr routine in a loop and return from the
  worlqueue only when all interrupt status bits are cleared. This did help
  a bit, but sometimes I started getting lots of I2C read/write errors for
  some reason.
  
  I'm not sure if there is much that can be done about this. The code reads
  the interrupt status, then clears the interrupts right after. There is
  always a race condition there since this isn't atomic ('read and clear').
  Unless Lars-Peter has a better idea?
  
  What can be improved, though, is to clear not just the interrupts that
  were read, but all the interrupts that are unmasked. You are right, you
  couldloose an interrupt that way.
  
  Wouldn't level-trigerred interrupts fix the issue ?
 
 See my earlier reply.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 45/49] adv7604: Add DT support

2014-04-17 Thread Sylwester Nawrocki
On 17/04/14 16:39, Sylwester Nawrocki wrote:
 On 17/04/14 16:13, Laurent Pinchart wrote:
  Parse the device tree node to populate platform data. Only the ADV7611
  is currently support with DT.
  
  Cc: devicet...@vger.kernel.org
  Cc: Sylwester Nawrocki s.nawro...@samsung.com
  Signed-off-by: Laurent Pinchart laurent.pinch...@ideasonboard.com
  Acked-by: Hans Verkuil hans.verk...@cisco.com
 The patch looks good to me.
 
 Acked-by: Sylwester Nawrocki s.nawro...@samsung.com
 
 Just one comment below...
  ---
[...]
  +static struct of_device_id adv7604_of_id[] = {

 Not adding __maybe_unused attribute to this one ?

I missed it's added in the last patch in this series, please ignore
this comment.

-- 
Regards,
Sylwester
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [GIT PULL for 3.16-rc1] updates and DT support for adv7604

2014-06-06 Thread Ben Dooks
On 06/06/14 16:51, Lars-Peter Clausen wrote:
 On 06/06/2014 05:49 PM, Ben Dooks wrote:
 On 05/06/14 13:55, Mauro Carvalho Chehab wrote:
 Linus,

 Please pull from:
git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media
 topic/adv76xx

 For adv7604 driver updates, including DT support.

 Can we use the adv7611 for the adv7612 with these?

 
 You can, except that you won't be able to use the second HDMI in. But it
 should be fairly trivial to add that.

Thanks, we're going to try the rcar_vin driver and the HDMI in on the
Lager board next week.

-- 
Ben Dooks   http://www.codethink.co.uk/
Senior Engineer Codethink - Providing Genius
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2 2/2] adv7604: Use DT parsing in dummy creation

2014-09-01 Thread Jean-Michel Hautbois
2014-08-31 19:18 GMT+02:00 Laurent Pinchart laurent.pinch...@ideasonboard.com:
 Hi Jean-Michel,

 Thank you for the patch.

 On Friday 29 August 2014 17:15:03 Jean-Michel Hautbois wrote:
 This patch uses DT in order to parse addresses for dummy devices of adv7604.
 The ADV7604 has thirteen 256-byte maps that can be accessed via the main
 I²C ports. Each map has it own I²C address and acts
 as a standard slave device on the I²C bus.

 If nothing is defined, it uses default addresses.
 The main prupose is using two adv76xx on the same i2c bus.

 Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
 ---
  .../devicetree/bindings/media/i2c/adv7604.txt  | 17 +-
  drivers/media/i2c/adv7604.c| 60 ---
  2 files changed, 55 insertions(+), 22 deletions(-)

 diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 b/Documentation/devicetree/bindings/media/i2c/adv7604.txt index
 c27cede..8486b5c 100644
 --- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 +++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
 @@ -10,8 +10,12 @@ Required Properties:

- compatible: Must contain one of the following
  - adi,adv7611 for the ADV7611
 +- adi,adv7604 for the ADV7604

 Addition of ADV7604 support is unrelated to the subject and needs to be split
 into a separate patch.

OK, I will do that.

 -  - reg: I2C slave address
 +  - reg: I2C slave addresses
 +The ADV7604 has thirteen 256-byte maps that can be accessed via the
 main
 +I²C ports. Each map has it own I²C address and acts
 +as a standard slave device on the I²C bus.

- hpd-gpios: References to the GPIOs that control the HDMI hot-plug
  detection pins, one per HDMI input. The active flag indicates the GPIO
 @@ -32,6 +36,12 @@ The digital output port node must contain at least one
 endpoint. Optional Properties:

- reset-gpios: Reference to the GPIO connected to the device's reset pin.
 +  - reg-names : Names of maps with programmable addresses.
 + It can contain any map needing another address than default 
 one.
 + Possible maps names are :
 +ADV7604 : main, avlink, cec, infoframe, esdp, dpp, afe,
 rep,
 + edid, hdmi, test, cp, vdp
 +ADV7611 : main, cec, infoframe, afe, rep, edid, hdmi, cp

  Optional Endpoint Properties:

 @@ -50,7 +60,10 @@ Example:

   hdmi_receiver@4c {
   compatible = adi,adv7611;
 - reg = 0x4c;
 + /* edid page will be accessible @ 0x66 on i2c bus */
 + /* other maps keep their default addresses */
 + reg = 0x4c 0x66;
 + reg-names = main, edid;

   reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
   hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
 diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
 index d4fa213..56037dd 100644
 --- a/drivers/media/i2c/adv7604.c
 +++ b/drivers/media/i2c/adv7604.c
 @@ -326,6 +326,22 @@ static const struct adv7604_video_standards
 adv7604_prim_mode_hdmi_gr[] = { { },
  };

 +static const char const *adv7604_secondary_names[] = {
 + main, /* ADV7604_PAGE_IO */
 + avlink, /* ADV7604_PAGE_AVLINK */
 + cec, /* ADV7604_PAGE_CEC */
 + infoframe, /* ADV7604_PAGE_INFOFRAME */
 + esdp, /* ADV7604_PAGE_ESDP */
 + dpp, /* ADV7604_PAGE_DPP */
 + afe, /* ADV7604_PAGE_AFE */
 + rep, /* ADV7604_PAGE_REP */
 + edid, /* ADV7604_PAGE_EDID */
 + hdmi, /* ADV7604_PAGE_HDMI */
 + test, /* ADV7604_PAGE_TEST */
 + cp, /* ADV7604_PAGE_CP */
 + vdp /* ADV7604_PAGE_VDP */
 +};
 +
  /* ---
 */

  static inline struct adv7604_state *to_state(struct v4l2_subdev *sd)
 @@ -2528,13 +2544,31 @@ static void adv7604_unregister_clients(struct
 adv7604_state *state) }

  static struct i2c_client *adv7604_dummy_client(struct v4l2_subdev *sd,
 - u8 addr, u8 io_reg)
 + unsigned int i)
  {
   struct i2c_client *client = v4l2_get_subdevdata(sd);
 + struct adv7604_platform_data *pdata = client-dev.platform_data;
 + unsigned int io_reg = 0xf2 + i;
 + unsigned int default_addr = io_read(sd, io_reg)  1;

 This modifies the behaviour of the driver. It previously used fixed default
 addresses in the DT case, and now defaults to whatever has been programmed in
 the chip. This might not be an issue in itself, but it should be documented in
 the commit message (and possibly split to a separate patch).

Then, let's decide if this is a problem or not :) ? I naively thought
that it would be good to have default address, if defined in platform
data, use this one instead, and if it is in DT, it should be the prior
address to use (priority on DT and not on platform data).
But this is probably ideal for me but not for others ?

Thanks,
JM
--
To unsubscribe from this list: send

[PATCH 1/2] adv7604: Add support for i2c_new_secondary_device

2014-09-05 Thread Jean-Michel Hautbois
The ADV7604 has thirteen 256-byte maps that can be accessed via the main
I²C ports. Each map has it own I²C address and acts
as a standard slave device on the I²C bus.

If nothing is defined, it uses default addresses.
The main purpose is using two adv76xx on the same i2c bus.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt  | 17 ++-
 drivers/media/i2c/adv7604.c| 53 ++
 2 files changed, 48 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index c27cede..8486b5c 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -10,8 +10,12 @@ Required Properties:
 
   - compatible: Must contain one of the following
 - adi,adv7611 for the ADV7611
+- adi,adv7604 for the ADV7604
 
-  - reg: I2C slave address
+  - reg: I2C slave addresses
+The ADV7604 has thirteen 256-byte maps that can be accessed via the main
+I²C ports. Each map has it own I²C address and acts
+as a standard slave device on the I²C bus.
 
   - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 detection pins, one per HDMI input. The active flag indicates the GPIO
@@ -32,6 +36,12 @@ The digital output port node must contain at least one 
endpoint.
 Optional Properties:
 
   - reset-gpios: Reference to the GPIO connected to the device's reset pin.
+  - reg-names : Names of maps with programmable addresses.
+   It can contain any map needing another address than default one.
+   Possible maps names are :
+ADV7604 : main, avlink, cec, infoframe, esdp, dpp, afe, rep,
+   edid, hdmi, test, cp, vdp
+ADV7611 : main, cec, infoframe, afe, rep, edid, hdmi, cp
 
 Optional Endpoint Properties:
 
@@ -50,7 +60,10 @@ Example:
 
hdmi_receiver@4c {
compatible = adi,adv7611;
-   reg = 0x4c;
+   /* edid page will be accessible @ 0x66 on i2c bus */
+   /* other maps keep their default addresses */
+   reg = 0x4c 0x66;
+   reg-names = main, edid;
 
reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index d4fa213..8336c02 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -326,6 +326,22 @@ static const struct adv7604_video_standards 
adv7604_prim_mode_hdmi_gr[] = {
{ },
 };
 
+static const char const *adv7604_secondary_names[] = {
+   [ADV7604_PAGE_IO] = main,
+   [ADV7604_PAGE_AVLINK] = avlink,
+   [ADV7604_PAGE_CEC] = cec,
+   [ADV7604_PAGE_INFOFRAME] = infoframe,
+   [ADV7604_PAGE_ESDP] = esdp,
+   [ADV7604_PAGE_DPP] = dpp,
+   [ADV7604_PAGE_AFE] = afe,
+   [ADV7604_PAGE_REP] = rep,
+   [ADV7604_PAGE_EDID] = edid,
+   [ADV7604_PAGE_HDMI] = hdmi,
+   [ADV7604_PAGE_TEST] = test,
+   [ADV7604_PAGE_CP] = cp,
+   [ADV7604_PAGE_VDP] = vdp
+};
+
 /* --- */
 
 static inline struct adv7604_state *to_state(struct v4l2_subdev *sd)
@@ -2528,13 +2544,25 @@ static void adv7604_unregister_clients(struct 
adv7604_state *state)
 }
 
 static struct i2c_client *adv7604_dummy_client(struct v4l2_subdev *sd,
-   u8 addr, u8 io_reg)
+   unsigned int i)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
+   struct adv7604_platform_data *pdata = client-dev.platform_data;
+   unsigned int io_reg = 0xf2 + i;
+   unsigned int default_addr = io_read(sd, io_reg)  1;
+   struct i2c_client *new_client;
+
+   if (pdata  pdata-i2c_addresses[i])
+   new_client = i2c_new_dummy(client-adapter,
+   pdata-i2c_addresses[i]);
+   else
+   new_client = i2c_new_secondary_device(client,
+   adv7604_secondary_names[i], default_addr);
 
-   if (addr)
-   io_write(sd, io_reg, addr  1);
-   return i2c_new_dummy(client-adapter, io_read(sd, io_reg)  1);
+   if (new_client)
+   io_write(sd, io_reg, new_client-addr  1);
+
+   return new_client;
 }
 
 static const struct adv7604_reg_seq adv7604_recommended_settings_afe[] = {
@@ -2717,20 +2745,6 @@ static int adv7604_parse_dt(struct adv7604_state *state)
/* Disable the interrupt for now as no DT-based board uses it. */
state-pdata.int1_config = ADV7604_INT1_CONFIG_DISABLED;
 
-   /* Use the default I2C addresses. */
-   state-pdata.i2c_addresses[ADV7604_PAGE_AVLINK] = 0x42;
-   state-pdata.i2c_addresses[ADV7604_PAGE_CEC] = 0x40;
-   state

[PATCH 2/2] adv7604: Add support for i2c_new_secondary_device

2014-10-22 Thread Jean-Michel Hautbois
The ADV7604 has thirteen 256-byte maps that can be accessed via the main
I²C ports. Each map has it own I²C address and acts
as a standard slave device on the I²C bus.

If nothing is defined, it uses default addresses.
The main purpose is using two adv76xx on the same i2c bus.

Signed-off-by: Jean-Michel Hautbois jean-michel.hautb...@vodalys.com
---
 .../devicetree/bindings/media/i2c/adv7604.txt  | 16 +-
 drivers/media/i2c/adv7604.c| 59 ++
 2 files changed, 53 insertions(+), 22 deletions(-)

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7604.txt 
b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
index 5c8b3e6..8486b5c 100644
--- a/Documentation/devicetree/bindings/media/i2c/adv7604.txt
+++ b/Documentation/devicetree/bindings/media/i2c/adv7604.txt
@@ -12,7 +12,10 @@ Required Properties:
 - adi,adv7611 for the ADV7611
 - adi,adv7604 for the ADV7604
 
-  - reg: I2C slave address
+  - reg: I2C slave addresses
+The ADV7604 has thirteen 256-byte maps that can be accessed via the main
+I²C ports. Each map has it own I²C address and acts
+as a standard slave device on the I²C bus.
 
   - hpd-gpios: References to the GPIOs that control the HDMI hot-plug
 detection pins, one per HDMI input. The active flag indicates the GPIO
@@ -33,6 +36,12 @@ The digital output port node must contain at least one 
endpoint.
 Optional Properties:
 
   - reset-gpios: Reference to the GPIO connected to the device's reset pin.
+  - reg-names : Names of maps with programmable addresses.
+   It can contain any map needing another address than default one.
+   Possible maps names are :
+ADV7604 : main, avlink, cec, infoframe, esdp, dpp, afe, rep,
+   edid, hdmi, test, cp, vdp
+ADV7611 : main, cec, infoframe, afe, rep, edid, hdmi, cp
 
 Optional Endpoint Properties:
 
@@ -51,7 +60,10 @@ Example:
 
hdmi_receiver@4c {
compatible = adi,adv7611;
-   reg = 0x4c;
+   /* edid page will be accessible @ 0x66 on i2c bus */
+   /* other maps keep their default addresses */
+   reg = 0x4c 0x66;
+   reg-names = main, edid;
 
reset-gpios = ioexp 0 GPIO_ACTIVE_LOW;
hpd-gpios = ioexp 2 GPIO_ACTIVE_HIGH;
diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
index 421035f..e4e30a2 100644
--- a/drivers/media/i2c/adv7604.c
+++ b/drivers/media/i2c/adv7604.c
@@ -326,6 +326,27 @@ static const struct adv7604_video_standards 
adv7604_prim_mode_hdmi_gr[] = {
{ },
 };
 
+struct adv7604_register {
+   const char *name;
+   u8 default_addr;
+};
+
+static const struct adv7604_register adv7604_secondary_names[] = {
+   [ADV7604_PAGE_IO] = { main, 0x4c },
+   [ADV7604_PAGE_AVLINK] = { avlink, 0x42 },
+   [ADV7604_PAGE_CEC] = { cec, 0x40 },
+   [ADV7604_PAGE_INFOFRAME] = { infoframe, 0x3e },
+   [ADV7604_PAGE_ESDP] = { esdp, 0x38 },
+   [ADV7604_PAGE_DPP] = { dpp, 0x3c },
+   [ADV7604_PAGE_AFE] = { afe, 0x26 },
+   [ADV7604_PAGE_REP] = { rep, 0x32 },
+   [ADV7604_PAGE_EDID] = { edid, 0x36 },
+   [ADV7604_PAGE_HDMI] = { hdmi, 0x34 },
+   [ADV7604_PAGE_TEST] = { test, 0x30 },
+   [ADV7604_PAGE_CP] = { cp, 0x22 },
+   [ADV7604_PAGE_VDP] = { vdp, 0x24 },
+};
+
 /* --- */
 
 static inline struct adv7604_state *to_state(struct v4l2_subdev *sd)
@@ -2528,13 +2549,26 @@ static void adv7604_unregister_clients(struct 
adv7604_state *state)
 }
 
 static struct i2c_client *adv7604_dummy_client(struct v4l2_subdev *sd,
-   u8 addr, u8 io_reg)
+   unsigned int i)
 {
struct i2c_client *client = v4l2_get_subdevdata(sd);
+   struct adv7604_platform_data *pdata = client-dev.platform_data;
+   unsigned int io_reg = 0xf2 + i;
+   unsigned int default_addr = io_read(sd, io_reg)  1;
+   struct i2c_client *new_client;
+
+   if (pdata  pdata-i2c_addresses[i])
+   new_client = i2c_new_dummy(client-adapter,
+   pdata-i2c_addresses[i]);
+   else
+   new_client = i2c_new_secondary_device(client,
+   adv7604_secondary_names[i].name,
+   adv7604_secondary_names[i].default_addr);
+
+   if (new_client)
+   io_write(sd, io_reg, new_client-addr  1);
 
-   if (addr)
-   io_write(sd, io_reg, addr  1);
-   return i2c_new_dummy(client-adapter, io_read(sd, io_reg)  1);
+   return new_client;
 }
 
 static const struct adv7604_reg_seq adv7604_recommended_settings_afe[] = {
@@ -2718,20 +2752,6 @@ static int adv7604_parse_dt(struct adv7604_state *state)
/* Disable the interrupt for now as no DT-based board uses it. */
state-pdata.int1_config

Re: [linux-sunxi] [PATCH v3 2/3] dt-bindings: media: Add Allwinner V3s Camera Sensor Interface (CSI)

2017-12-18 Thread Yong
Hi,

On Mon, 18 Dec 2017 10:24:37 +0100
Maxime Ripard <maxime.rip...@free-electrons.com> wrote:

> Hi,
> 
> On Mon, Dec 18, 2017 at 04:49:21PM +0800, Yong wrote:
> > > > +   compatible = "allwinner,sun8i-v3s-csi";
> > > > +   reg = <0x01cb4000 0x1000>;
> > > > +   interrupts = ;
> > > > +   clocks = < CLK_BUS_CSI>,
> > > > +< CLK_CSI1_SCLK>,
> > > 
> > > CSI also has an MCLK. Do you need that one?
> > 
> > MCLK is not needed if the front end is not a sensor (like adv7611).
> > I will add it as an option.
> 
> I guess this should always be needed then. And the driver will make
> the decision to enable it or not.

But how the driver to know if it should be enabled?
I think MCLK should be added in DT just if the subdev need it.

> 
> Maxime
> 
> -- 
> Maxime Ripard, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com


Thanks,
Yong


Re: [PATCH] adv7604: Add DT parsing support

2015-01-09 Thread Jean-Michel Hautbois
Hi,

2014-10-27 0:30 GMT+01:00 Laurent Pinchart laurent.pinch...@ideasonboard.com:
 Hi Jean-Michel,

 On Thursday 23 October 2014 07:51:50 Jean-Michel Hautbois wrote:
 2014-10-23 1:53 GMT+02:00 Laurent Pinchart:
  On Wednesday 22 October 2014 17:34:21 Jean-Michel Hautbois wrote:
  This patch adds support for DT parsing of ADV7604 as well as ADV7611.
  It needs to be improved in order to get ports parsing too.
 
  Let's improve it then :-) The DT bindings as proposed by this patch are
  incomplete, that's just asking for trouble.
 
  How would you model the adv7604 ports ?

 I am opened to suggestions :).
 But it has to remain as simple as possible, ideally allowing for giving
 names to the ports.
 As done today, it works, ports are parsed but are all the same...

 The ADV7611 was easy, it had a single HDMI input only. The ADV7612 is easy as
 well as it just has two separate HDMI inputs.

 The ADV7604 is a more complex beast. The HDMI inputs shouldn't be much of an
 issue as they're independent and multiplexed internally. You can just create
 one pad per HDMI input.

 The analog inputs, however, can't be modeled as easily. A naive approach would
 be to create one pad for each of the 12 analog inputs, but the chip has three
 separate ADCs and can combine 3 inputs in a single digital video stream. I
 don't know how we should model support for that. Lars-Peter, Hans, would you
 have a revolutionary idea to same the world today ?

I get back to working on this specific part, but I don't know how
these analog inputs should be modeled.
On page 68 of ADV7604_HW_RevF there is Figure 11 showing typical
configurations using AIN_SEL[2:0].
I can see 4 inputs muxed : this would suggest to have 4 pads for analog inputs.
Not sure it makes sense though...

Thanks,
JM
--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: HDMI and Composite capture on Lager, for kernel 4.1, version 5

2015-07-28 Thread Hans Verkuil
Hi William,

On 07/23/2015 02:21 PM, William Towle wrote:
   Version 5. Some successful upstreaming and some further modification
 means this obsoletes version 4, as seen at:
   
 http://permalink.gmane.org/gmane.linux.drivers.video-input-infrastructure/92832
 
   This version of the patch series contains a fix for probing the
 ADV7611/ADV7612 chips, a reduced (and renamed) chip info and formats
 patch intended to pave the way for better ADV7612 support, and updates
 to rcar_vin_try_fmt() in line with the latest feedback.
 
 Cheers,
   Wills.

I've merged patches 3-13 (patches 10 and 11 are marked superseded since I'm
using versions I posted as part of another patch series).

But you need to repost patches 1 and 2 with a CC to linux...@vger.kernel.org
so Simon Horman can either pull them in or Ack them and then I'll merge these
patches. It probably makes more sense that Simon merges them since I believe
these two patches are independent of the others.

Regards,

Hans

 
 To follow:
   [PATCH 01/13] ARM: shmobile: lager dts: Add entries for VIN HDMI
   [PATCH 02/13] ARM: shmobile: lager dts: specify default-input for
   [PATCH 03/13] media: adv7604: fix probe of ADV7611/7612
   [PATCH 04/13] media: adv7604: reduce support to first (digital)
   [PATCH 05/13] v4l: subdev: Add pad config allocator and init
   [PATCH 06/13] media: soc_camera: rcar_vin: Add BT.709 24-bit RGB888
   [PATCH 07/13] media: soc_camera pad-aware driver initialisation
   [PATCH 08/13] media: rcar_vin: Use correct pad number in try_fmt
   [PATCH 09/13] media: soc_camera: soc_scale_crop: Use correct pad
   [PATCH 10/13] media: soc_camera: Fill std field in enum_input
   [PATCH 11/13] media: soc_camera: Fix error reporting in expbuf
   [PATCH 12/13] media: rcar_vin: fill in bus_info field
   [PATCH 13/13] media: rcar_vin: Reject videobufs that are too small
 --
 To unsubscribe from this list: send the line unsubscribe linux-media in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 

--
To unsubscribe from this list: send the line unsubscribe linux-media in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v4 2/8] media: adv7604: automatic "default-input" selection

2016-06-27 Thread Hans Verkuil
On 05/11/2016 04:02 PM, Ulrich Hecht wrote:
> From: William Towle <william.to...@codethink.co.uk>
> 
> Add logic such that the "default-input" property becomes unnecessary
> for chips that only have one suitable input (ADV7611 by design, and
> ADV7612 due to commit 7111cddd518f ("[media] media: adv7604: reduce
> support to first (digital) input").
> 
> Additionally, Ian's documentation in commit bf9c82278c34 ("[media]
> media: adv7604: ability to read default input port from DT") states
> that the "default-input" property should reside directly in the node
> for adv7612. Hence, also adjust the parsing to make the implementation
> consistent with this.
> 
> Signed-off-by: William Towle <william.to...@codethink.co.uk>
> Signed-off-by: Ulrich Hecht <ulrich.hecht+rene...@gmail.com>
> ---
>  drivers/media/i2c/adv7604.c | 18 +-
>  1 file changed, 17 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/adv7604.c b/drivers/media/i2c/adv7604.c
> index 41a1bfc..d722c16 100644
> --- a/drivers/media/i2c/adv7604.c
> +++ b/drivers/media/i2c/adv7604.c
> @@ -2788,7 +2788,7 @@ static int adv76xx_parse_dt(struct adv76xx_state *state)
>   struct device_node *np;
>   unsigned int flags;
>   int ret;
> - u32 v;
> + u32 v = -1;
>  
>   np = state->i2c_clients[ADV76XX_PAGE_IO]->dev.of_node;
>  
> @@ -2810,6 +2810,22 @@ static int adv76xx_parse_dt(struct adv76xx_state 
> *state)
>  
>   of_node_put(endpoint);
>  
> + if (of_property_read_u32(np, "default-input", )) {
> + /* not specified ... can we choose automatically? */
> + switch (state->info->type) {
> + case ADV7611:
> + v = 0;
> + break;
> + case ADV7612:
> + if (state->info->max_port == ADV76XX_PAD_HDMI_PORT_A)
> + v = 0;
> + /* else is unhobbled, leave unspecified */

Please add a break here, don't fall through.

What happens when the default_input is unspecified? I don't really like this,
I think that if nothing is specified, then it should just fall back to
input 0.

Note that neither include/media/i2c/adv7604.h nor 
Documentation/devicetree/bindings/media/i2c/adv7604.txt
say anything about this either.

Regards,

Hans

> + default:
> + break;
> + }
> + }
> + state->pdata.default_input = v;
> +
>   flags = bus_cfg.bus.parallel.flags;
>  
>   if (flags & V4L2_MBUS_HSYNC_ACTIVE_HIGH)
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


  1   2   3   >