[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;
 + 

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


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