linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] adv7343 add OF support
@ 2013-07-20  6:21 Lad, Prabhakar
  2013-07-20  6:21 ` [PATCH v3 1/2] media: i2c: adv7343: make the platform data members as array Lad, Prabhakar
  2013-07-20  6:21 ` [PATCH v3 2/2] media: i2c: adv7343: add OF support Lad, Prabhakar
  0 siblings, 2 replies; 12+ messages in thread
From: Lad, Prabhakar @ 2013-07-20  6:21 UTC (permalink / raw)
  To: LMML; +Cc: DLOS, LKML, devicetree-discuss, linux-doc, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

This series adds OF support for adv7343 driver.
The first patch makes platform data members as a array,
so to ease in adding DT support.

Lad, Prabhakar (2):
  media: i2c: adv7343: make the platform data members as array
  media: i2c: adv7343: add OF support

 .../devicetree/bindings/media/i2c/adv7343.txt      |   48 +++++++++++++
 arch/arm/mach-davinci/board-da850-evm.c            |    6 +-
 drivers/media/i2c/adv7343.c                        |   74 ++++++++++++++++----
 include/media/adv7343.h                            |   20 ++----
 4 files changed, 113 insertions(+), 35 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt

-- 
1.7.9.5


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

* [PATCH v3 1/2] media: i2c: adv7343: make the platform data members as array
  2013-07-20  6:21 [PATCH v3 0/2] adv7343 add OF support Lad, Prabhakar
@ 2013-07-20  6:21 ` Lad, Prabhakar
  2013-07-22  9:37   ` Sekhar Nori
  2013-07-20  6:21 ` [PATCH v3 2/2] media: i2c: adv7343: add OF support Lad, Prabhakar
  1 sibling, 1 reply; 12+ messages in thread
From: Lad, Prabhakar @ 2013-07-20  6:21 UTC (permalink / raw)
  To: LMML
  Cc: DLOS, LKML, devicetree-discuss, linux-doc, Lad, Prabhakar,
	Sekhar Nori, linux-arm-kernel

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

This patch makes the platform data members as array wherever
possible, so as this makes easier while collecting the data
in DT case and read the entire array at once.

This patch also makes appropriate changes to board-da850-evm.c

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
Cc: Sekhar Nori <nsekhar@ti.com>
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/mach-davinci/board-da850-evm.c |    6 ++----
 drivers/media/i2c/adv7343.c             |   28 ++++++++++++++--------------
 include/media/adv7343.h                 |   20 ++++----------------
 3 files changed, 20 insertions(+), 34 deletions(-)

diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index e6f5b5d..ab6bdbe 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -733,12 +733,10 @@ static struct tvp514x_platform_data tvp5146_pdata = {
 
 static struct adv7343_platform_data adv7343_pdata = {
 	.mode_config = {
-		.dac_3 = 1,
-		.dac_2 = 1,
-		.dac_1 = 1,
+		.dac = { 1, 1, 1 },
 	},
 	.sd_config = {
-		.sd_dac_out1 = 1,
+		.sd_dac_out = { 1 },
 	},
 };
 
diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
index 8080c2c..f0238fb 100644
--- a/drivers/media/i2c/adv7343.c
+++ b/drivers/media/i2c/adv7343.c
@@ -227,12 +227,12 @@ static int adv7343_setoutput(struct v4l2_subdev *sd, u32 output_type)
 	else
 		val = state->pdata->mode_config.sleep_mode << 0 |
 		      state->pdata->mode_config.pll_control << 1 |
-		      state->pdata->mode_config.dac_3 << 2 |
-		      state->pdata->mode_config.dac_2 << 3 |
-		      state->pdata->mode_config.dac_1 << 4 |
-		      state->pdata->mode_config.dac_6 << 5 |
-		      state->pdata->mode_config.dac_5 << 6 |
-		      state->pdata->mode_config.dac_4 << 7;
+		      state->pdata->mode_config.dac[2] << 2 |
+		      state->pdata->mode_config.dac[1] << 3 |
+		      state->pdata->mode_config.dac[0] << 4 |
+		      state->pdata->mode_config.dac[5] << 5 |
+		      state->pdata->mode_config.dac[4] << 6 |
+		      state->pdata->mode_config.dac[3] << 7;
 
 	err = adv7343_write(sd, ADV7343_POWER_MODE_REG, val);
 	if (err < 0)
@@ -251,15 +251,15 @@ static int adv7343_setoutput(struct v4l2_subdev *sd, u32 output_type)
 	/* configure SD DAC Output 2 and SD DAC Output 1 bit to zero */
 	val = state->reg82 & (SD_DAC_1_DI & SD_DAC_2_DI);
 
-	if (state->pdata && state->pdata->sd_config.sd_dac_out1)
-		val = val | (state->pdata->sd_config.sd_dac_out1 << 1);
-	else if (state->pdata && !state->pdata->sd_config.sd_dac_out1)
-		val = val & ~(state->pdata->sd_config.sd_dac_out1 << 1);
+	if (state->pdata && state->pdata->sd_config.sd_dac_out[0])
+		val = val | (state->pdata->sd_config.sd_dac_out[0] << 1);
+	else if (state->pdata && !state->pdata->sd_config.sd_dac_out[0])
+		val = val & ~(state->pdata->sd_config.sd_dac_out[0] << 1);
 
-	if (state->pdata && state->pdata->sd_config.sd_dac_out2)
-		val = val | (state->pdata->sd_config.sd_dac_out2 << 2);
-	else if (state->pdata && !state->pdata->sd_config.sd_dac_out2)
-		val = val & ~(state->pdata->sd_config.sd_dac_out2 << 2);
+	if (state->pdata && state->pdata->sd_config.sd_dac_out[1])
+		val = val | (state->pdata->sd_config.sd_dac_out[1] << 2);
+	else if (state->pdata && !state->pdata->sd_config.sd_dac_out[1])
+		val = val & ~(state->pdata->sd_config.sd_dac_out[1] << 2);
 
 	err = adv7343_write(sd, ADV7343_SD_MODE_REG2, val);
 	if (err < 0)
diff --git a/include/media/adv7343.h b/include/media/adv7343.h
index 944757b..e4142b1 100644
--- a/include/media/adv7343.h
+++ b/include/media/adv7343.h
@@ -28,12 +28,7 @@
  * @pll_control: PLL and oversampling control. This control allows internal
  *		 PLL 1 circuit to be powered down and the oversampling to be
  *		 switched off.
- * @dac_1: power on/off DAC 1.
- * @dac_2: power on/off DAC 2.
- * @dac_3: power on/off DAC 3.
- * @dac_4: power on/off DAC 4.
- * @dac_5: power on/off DAC 5.
- * @dac_6: power on/off DAC 6.
+ * @dac: array to configure power on/off DAC's 1..6
  *
  * Power mode register (Register 0x0), for more info refer REGISTER MAP ACCESS
  * section of datasheet[1], table 17 page no 30.
@@ -43,23 +38,16 @@
 struct adv7343_power_mode {
 	bool sleep_mode;
 	bool pll_control;
-	bool dac_1;
-	bool dac_2;
-	bool dac_3;
-	bool dac_4;
-	bool dac_5;
-	bool dac_6;
+	u32 dac[6];
 };
 
 /**
  * struct adv7343_sd_config - SD Only Output Configuration.
- * @sd_dac_out1: Configure SD DAC Output 1.
- * @sd_dac_out2: Configure SD DAC Output 2.
+ * @sd_dac_out: array configuring SD DAC Outputs 1 and 2
  */
 struct adv7343_sd_config {
 	/* SD only Output Configuration */
-	bool sd_dac_out1;
-	bool sd_dac_out2;
+	u32 sd_dac_out[2];
 };
 
 /**
-- 
1.7.9.5


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

* [PATCH v3 2/2] media: i2c: adv7343: add OF support
  2013-07-20  6:21 [PATCH v3 0/2] adv7343 add OF support Lad, Prabhakar
  2013-07-20  6:21 ` [PATCH v3 1/2] media: i2c: adv7343: make the platform data members as array Lad, Prabhakar
@ 2013-07-20  6:21 ` Lad, Prabhakar
  2013-08-23 18:03   ` Sylwester Nawrocki
  1 sibling, 1 reply; 12+ messages in thread
From: Lad, Prabhakar @ 2013-07-20  6:21 UTC (permalink / raw)
  To: LMML; +Cc: DLOS, LKML, devicetree-discuss, linux-doc, Lad, Prabhakar

From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>

add OF support for the adv7343 driver.

Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
---
 Changes for v3:
 1: Fixed review comments pointed by Sylwester.
 
 Changes for v2:
 1: Fixed naming of properties.
 
 .../devicetree/bindings/media/i2c/adv7343.txt      |   48 ++++++++++++++++++++
 drivers/media/i2c/adv7343.c                        |   46 ++++++++++++++++++-
 2 files changed, 93 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt

diff --git a/Documentation/devicetree/bindings/media/i2c/adv7343.txt b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
new file mode 100644
index 0000000..5653bc2
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
@@ -0,0 +1,48 @@
+* Analog Devices adv7343 video encoder
+
+The ADV7343 are high speed, digital-to-analog video encoders in a 64-lead LQFP
+package. Six high speed, 3.3 V, 11-bit video DACs provide support for composite
+(CVBS), S-Video (Y-C), and component (YPrPb/RGB) analog outputs in standard
+definition (SD), enhanced definition (ED), or high definition (HD) video
+formats.
+
+Required Properties :
+- compatible: Must be "adi,adv7343"
+
+Optional Properties :
+- adi,power-mode-sleep-mode: on enable the current consumption is reduced to
+			      micro ampere level. All DACs and the internal PLL
+			      circuit are disabled.
+- adi,power-mode-pll-ctrl: PLL and oversampling control. This control allows
+			   internal PLL 1 circuit to be powered down and the
+			   oversampling to be switched off.
+- ad,adv7343-power-mode-dac: array configuring the power on/off DAC's 1..6,
+			      0 = OFF and 1 = ON, Default value when this
+			      property is not specified is <0 0 0 0 0 0>.
+- ad,adv7343-sd-config-dac-out: array configure SD DAC Output's 1 and 2, 0 = OFF
+				 and 1 = ON, Default value when this property is
+				 not specified is <0 0>.
+
+Example:
+
+i2c0@1c22000 {
+	...
+	...
+
+	adv7343@2a {
+		compatible = "adi,adv7343";
+		reg = <0x2a>;
+
+		port {
+			adv7343_1: endpoint {
+					adi,power-mode-sleep-mode;
+					adi,power-mode-pll-ctrl;
+					/* Use DAC1..3, DAC6 */
+					adi,dac-enable = <1 1 1 0 0 1>;
+					/* Use SD DAC output 1 */
+					adi,sd-dac-enable = <1 0>;
+			};
+		};
+	};
+	...
+};
diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
index f0238fb..aeb56c5 100644
--- a/drivers/media/i2c/adv7343.c
+++ b/drivers/media/i2c/adv7343.c
@@ -30,6 +30,7 @@
 #include <media/v4l2-async.h>
 #include <media/v4l2-device.h>
 #include <media/v4l2-ctrls.h>
+#include <media/v4l2-of.h>
 
 #include "adv7343_regs.h"
 
@@ -399,6 +400,40 @@ static int adv7343_initialize(struct v4l2_subdev *sd)
 	return err;
 }
 
+static struct adv7343_platform_data *
+adv7343_get_pdata(struct i2c_client *client)
+{
+	struct adv7343_platform_data *pdata;
+	struct device_node *np;
+
+	if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
+		return client->dev.platform_data;
+
+	np = v4l2_of_get_next_endpoint(client->dev.of_node, NULL);
+	if (!np)
+		return NULL;
+
+	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
+	if (!pdata)
+		goto done;
+
+	pdata->mode_config.sleep_mode =
+			of_property_read_bool(np, "adi,power-mode-sleep-mode");
+
+	pdata->mode_config.pll_control =
+			of_property_read_bool(np, "adi,power-mode-pll-ctrl");
+
+	of_property_read_u32_array(np, "adi,dac-enable",
+				   pdata->mode_config.dac, 6);
+
+	of_property_read_u32_array(np, "adi,sd-dac-enable",
+				   pdata->sd_config.sd_dac_out, 2);
+
+done:
+	of_node_put(np);
+	return pdata;
+}
+
 static int adv7343_probe(struct i2c_client *client,
 				const struct i2c_device_id *id)
 {
@@ -417,7 +452,7 @@ static int adv7343_probe(struct i2c_client *client,
 		return -ENOMEM;
 
 	/* Copy board specific information here */
-	state->pdata = client->dev.platform_data;
+	state->pdata = adv7343_get_pdata(client);
 
 	state->reg00	= 0x80;
 	state->reg01	= 0x00;
@@ -483,8 +518,17 @@ static const struct i2c_device_id adv7343_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, adv7343_id);
 
+#if IS_ENABLED(CONFIG_OF)
+static const struct of_device_id adv7343_of_match[] = {
+	{.compatible = "adi,adv7343", },
+	{ /* sentinel */ },
+};
+MODULE_DEVICE_TABLE(of, adv7343_of_match);
+#endif
+
 static struct i2c_driver adv7343_driver = {
 	.driver = {
+		.of_match_table = of_match_ptr(adv7343_of_match),
 		.owner	= THIS_MODULE,
 		.name	= "adv7343",
 	},
-- 
1.7.9.5


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

* Re: [PATCH v3 1/2] media: i2c: adv7343: make the platform data members as array
  2013-07-20  6:21 ` [PATCH v3 1/2] media: i2c: adv7343: make the platform data members as array Lad, Prabhakar
@ 2013-07-22  9:37   ` Sekhar Nori
  0 siblings, 0 replies; 12+ messages in thread
From: Sekhar Nori @ 2013-07-22  9:37 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: LMML, DLOS, LKML, devicetree-discuss, linux-doc, linux-arm-kernel

On Saturday 20 July 2013 11:51 AM, Lad, Prabhakar wrote:
> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> 
> This patch makes the platform data members as array wherever
> possible, so as this makes easier while collecting the data
> in DT case and read the entire array at once.
> 
> This patch also makes appropriate changes to board-da850-evm.c
> 
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> Cc: Sekhar Nori <nsekhar@ti.com>
> Cc: linux-arm-kernel@lists.infradead.org

For the board-da850-evm.c change:

Acked-by: Sekhar Nori <nsekhar@ti.com>

Thanks,
Sekhar


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

* Re: [PATCH v3 2/2] media: i2c: adv7343: add OF support
  2013-07-20  6:21 ` [PATCH v3 2/2] media: i2c: adv7343: add OF support Lad, Prabhakar
@ 2013-08-23 18:03   ` Sylwester Nawrocki
  2013-08-26  2:41     ` Prabhakar Lad
  0 siblings, 1 reply; 12+ messages in thread
From: Sylwester Nawrocki @ 2013-08-23 18:03 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: LMML, DLOS, LKML, devicetree-discuss, linux-doc, Stephen Warren,
	Mark Rutland, Pawel Moll, Kumar Gala, Rob Herring

Cc: DT binding maintainers

On 07/20/2013 08:21 AM, Lad, Prabhakar wrote:
> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> 
> add OF support for the adv7343 driver.
> 
> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> ---
[...]
>  .../devicetree/bindings/media/i2c/adv7343.txt      |   48 ++++++++++++++++++++
>  drivers/media/i2c/adv7343.c                        |   46 ++++++++++++++++++-
>  2 files changed, 93 insertions(+), 1 deletion(-)
>  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt
> 
> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7343.txt b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> new file mode 100644
> index 0000000..5653bc2
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> @@ -0,0 +1,48 @@
> +* Analog Devices adv7343 video encoder
> +
> +The ADV7343 are high speed, digital-to-analog video encoders in a 64-lead LQFP
> +package. Six high speed, 3.3 V, 11-bit video DACs provide support for composite
> +(CVBS), S-Video (Y-C), and component (YPrPb/RGB) analog outputs in standard
> +definition (SD), enhanced definition (ED), or high definition (HD) video
> +formats.
> +
> +Required Properties :
> +- compatible: Must be "adi,adv7343"
> +
> +Optional Properties :
> +- adi,power-mode-sleep-mode: on enable the current consumption is reduced to
> +			      micro ampere level. All DACs and the internal PLL
> +			      circuit are disabled.

Sorry for getting back so late to this. I realize this is already queued in 
the media tree. But this binding doesn't look good enough to me. I think it 
will need to be corrected during upcoming -rc period.

It might be hard to figure out only from the chip's datasheet what
adi,power-mode-sleep-mode really refers to. AFAICS it is for assigning some
value to a specific register. If we really need to specify register values
in the device tree then it would probably make sense to describe to which
register this apply. Now the name looks like derived from some structure
member name in the Linux driver of the device.

> +- adi,power-mode-pll-ctrl: PLL and oversampling control. This control allows
> +			   internal PLL 1 circuit to be powered down and the
> +			   oversampling to be switched off.

Similar comments applies to this property.

> +- ad,adv7343-power-mode-dac: array configuring the power on/off DAC's 1..6,
> +			      0 = OFF and 1 = ON, Default value when this
> +			      property is not specified is <0 0 0 0 0 0>.

Name of the property is incorrect here. It has changed to "adi,dac-enable".

> +- ad,adv7343-sd-config-dac-out: array configure SD DAC Output's 1 and 2, 0 = OFF
> +				 and 1 = ON, Default value when this property is
> +				 not specified is <0 0>.

Similarly, "adi,sd-dac-enable.

> +Example:
> +
> +i2c0@1c22000 {
> +	...
> +	...
> +
> +	adv7343@2a {
> +		compatible = "adi,adv7343";
> +		reg = <0x2a>;
> +
> +		port {
> +			adv7343_1: endpoint {
> +					adi,power-mode-sleep-mode;
> +					adi,power-mode-pll-ctrl;
> +					/* Use DAC1..3, DAC6 */
> +					adi,dac-enable = <1 1 1 0 0 1>;
> +					/* Use SD DAC output 1 */
> +					adi,sd-dac-enable = <1 0>;
> +			};
> +		};
> +	};
> +	...
> +};
> diff --git a/drivers/media/i2c/adv7343.c b/drivers/media/i2c/adv7343.c
> index f0238fb..aeb56c5 100644
> --- a/drivers/media/i2c/adv7343.c
> +++ b/drivers/media/i2c/adv7343.c
> @@ -30,6 +30,7 @@
>  #include <media/v4l2-async.h>
>  #include <media/v4l2-device.h>
>  #include <media/v4l2-ctrls.h>
> +#include <media/v4l2-of.h>
>  
>  #include "adv7343_regs.h"
>  
> @@ -399,6 +400,40 @@ static int adv7343_initialize(struct v4l2_subdev *sd)
>  	return err;
>  }
>  
> +static struct adv7343_platform_data *
> +adv7343_get_pdata(struct i2c_client *client)
> +{
> +	struct adv7343_platform_data *pdata;
> +	struct device_node *np;
> +
> +	if (!IS_ENABLED(CONFIG_OF) || !client->dev.of_node)
> +		return client->dev.platform_data;
> +
> +	np = v4l2_of_get_next_endpoint(client->dev.of_node, NULL);
> +	if (!np)
> +		return NULL;
> +
> +	pdata = devm_kzalloc(&client->dev, sizeof(*pdata), GFP_KERNEL);
> +	if (!pdata)
> +		goto done;
> +
> +	pdata->mode_config.sleep_mode =
> +			of_property_read_bool(np, "adi,power-mode-sleep-mode");
> +
> +	pdata->mode_config.pll_control =
> +			of_property_read_bool(np, "adi,power-mode-pll-ctrl");
> +
> +	of_property_read_u32_array(np, "adi,dac-enable",
> +				   pdata->mode_config.dac, 6);
> +
> +	of_property_read_u32_array(np, "adi,sd-dac-enable",
> +				   pdata->sd_config.sd_dac_out, 2);
> +
> +done:
> +	of_node_put(np);
> +	return pdata;
> +}
> +
>  static int adv7343_probe(struct i2c_client *client,
>  				const struct i2c_device_id *id)
>  {
> @@ -417,7 +452,7 @@ static int adv7343_probe(struct i2c_client *client,
>  		return -ENOMEM;
>  
>  	/* Copy board specific information here */
> -	state->pdata = client->dev.platform_data;
> +	state->pdata = adv7343_get_pdata(client);
>  
>  	state->reg00	= 0x80;
>  	state->reg01	= 0x00;
> @@ -483,8 +518,17 @@ static const struct i2c_device_id adv7343_id[] = {
>  
>  MODULE_DEVICE_TABLE(i2c, adv7343_id);
>  
> +#if IS_ENABLED(CONFIG_OF)
> +static const struct of_device_id adv7343_of_match[] = {
> +	{.compatible = "adi,adv7343", },
> +	{ /* sentinel */ },
> +};
> +MODULE_DEVICE_TABLE(of, adv7343_of_match);
> +#endif
> +
>  static struct i2c_driver adv7343_driver = {
>  	.driver = {
> +		.of_match_table = of_match_ptr(adv7343_of_match),
>  		.owner	= THIS_MODULE,
>  		.name	= "adv7343",
>  	},


-- 
Sylwester Nawrocki
Samsung R&D Institute Poland

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

* Re: [PATCH v3 2/2] media: i2c: adv7343: add OF support
  2013-08-23 18:03   ` Sylwester Nawrocki
@ 2013-08-26  2:41     ` Prabhakar Lad
  2013-08-27 15:20       ` Mark Rutland
  2013-08-27 15:24       ` Mark Rutland
  0 siblings, 2 replies; 12+ messages in thread
From: Prabhakar Lad @ 2013-08-26  2:41 UTC (permalink / raw)
  To: Sylwester Nawrocki
  Cc: LMML, DLOS, LKML, device-tree, LDOC, Stephen Warren,
	Mark Rutland, Pawel Moll, Kumar Gala, Rob Herring

Hi Sylwester,

On Fri, Aug 23, 2013 at 11:33 PM, Sylwester Nawrocki
<s.nawrocki@samsung.com> wrote:
> Cc: DT binding maintainers
>
> On 07/20/2013 08:21 AM, Lad, Prabhakar wrote:
>> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>>
>> add OF support for the adv7343 driver.
>>
>> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>> ---
> [...]
>>  .../devicetree/bindings/media/i2c/adv7343.txt      |   48 ++++++++++++++++++++
>>  drivers/media/i2c/adv7343.c                        |   46 ++++++++++++++++++-
>>  2 files changed, 93 insertions(+), 1 deletion(-)
>>  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt
>>
>> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7343.txt b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
>> new file mode 100644
>> index 0000000..5653bc2
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
>> @@ -0,0 +1,48 @@
>> +* Analog Devices adv7343 video encoder
>> +
>> +The ADV7343 are high speed, digital-to-analog video encoders in a 64-lead LQFP
>> +package. Six high speed, 3.3 V, 11-bit video DACs provide support for composite
>> +(CVBS), S-Video (Y-C), and component (YPrPb/RGB) analog outputs in standard
>> +definition (SD), enhanced definition (ED), or high definition (HD) video
>> +formats.
>> +
>> +Required Properties :
>> +- compatible: Must be "adi,adv7343"
>> +
>> +Optional Properties :
>> +- adi,power-mode-sleep-mode: on enable the current consumption is reduced to
>> +                           micro ampere level. All DACs and the internal PLL
>> +                           circuit are disabled.
>
> Sorry for getting back so late to this. I realize this is already queued in
> the media tree. But this binding doesn't look good enough to me. I think it
> will need to be corrected during upcoming -rc period.
>
Thanks for the catch :-)

> It might be hard to figure out only from the chip's datasheet what
> adi,power-mode-sleep-mode really refers to. AFAICS it is for assigning some
> value to a specific register. If we really need to specify register values
> in the device tree then it would probably make sense to describe to which
> register this apply. Now the name looks like derived from some structure
> member name in the Linux driver of the device.
>
the property is derived from the datasheet itself for example the
'adi,power-mode-sleep-mode' --> Register 0x0 power mode bit 0
'adi,power-mode-pll-ctrl' ---> Register 0x0 power mode bit 1
'adi,dac-enable' ----> Register 0x0 power mode bit 2-7
'adi,sd-dac-enable' ---> Register 0x82 SD mode register bit 1-2

[1] http://www.analog.com/static/imported-files/data_sheets/ADV7342_7343.pdf

>> +- adi,power-mode-pll-ctrl: PLL and oversampling control. This control allows
>> +                        internal PLL 1 circuit to be powered down and the
>> +                        oversampling to be switched off.
>
> Similar comments applies to this property.
>
>> +- ad,adv7343-power-mode-dac: array configuring the power on/off DAC's 1..6,
>> +                           0 = OFF and 1 = ON, Default value when this
>> +                           property is not specified is <0 0 0 0 0 0>.
>
> Name of the property is incorrect here. It has changed to "adi,dac-enable".
>
OK

>> +- ad,adv7343-sd-config-dac-out: array configure SD DAC Output's 1 and 2, 0 = OFF
>> +                              and 1 = ON, Default value when this property is
>> +                              not specified is <0 0>.
>
> Similarly, "adi,sd-dac-enable.
>
OK

Regards,
--Prabhakar Lad

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

* Re: [PATCH v3 2/2] media: i2c: adv7343: add OF support
  2013-08-26  2:41     ` Prabhakar Lad
@ 2013-08-27 15:20       ` Mark Rutland
  2013-08-27 15:24       ` Mark Rutland
  1 sibling, 0 replies; 12+ messages in thread
From: Mark Rutland @ 2013-08-27 15:20 UTC (permalink / raw)
  To: Prabhakar Lad
  Cc: Sylwester Nawrocki, LMML, DLOS, LKML, device-tree, LDOC,
	Stephen Warren, Pawel Moll, Kumar Gala, rob.herring

On Mon, Aug 26, 2013 at 03:41:45AM +0100, Prabhakar Lad wrote:
> Hi Sylwester,
> 
> On Fri, Aug 23, 2013 at 11:33 PM, Sylwester Nawrocki
> <s.nawrocki@samsung.com> wrote:
> > Cc: DT binding maintainers

Cheers!

> >
> > On 07/20/2013 08:21 AM, Lad, Prabhakar wrote:
> >> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> >>
> >> add OF support for the adv7343 driver.
> >>
> >> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> >> ---
> > [...]
> >>  .../devicetree/bindings/media/i2c/adv7343.txt      |   48 ++++++++++++++++++++
> >>  drivers/media/i2c/adv7343.c                        |   46 ++++++++++++++++++-
> >>  2 files changed, 93 insertions(+), 1 deletion(-)
> >>  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7343.txt b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> new file mode 100644
> >> index 0000000..5653bc2
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> @@ -0,0 +1,48 @@
> >> +* Analog Devices adv7343 video encoder
> >> +
> >> +The ADV7343 are high speed, digital-to-analog video encoders in a 64-lead LQFP
> >> +package. Six high speed, 3.3 V, 11-bit video DACs provide support for composite
> >> +(CVBS), S-Video (Y-C), and component (YPrPb/RGB) analog outputs in standard
> >> +definition (SD), enhanced definition (ED), or high definition (HD) video
> >> +formats.
> >> +
> >> +Required Properties :
> >> +- compatible: Must be "adi,adv7343"
> >> +
> >> +Optional Properties :
> >> +- adi,power-mode-sleep-mode: on enable the current consumption is reduced to
> >> +                           micro ampere level. All DACs and the internal PLL
> >> +                           circuit are disabled.

This seems to be a boolean property, and I couldn't find any description
in the linked datasheet of the constraints under which the unit may be
put into sleep mode.

Why do we require this property in the dt? Can the driver not always put
a adv734x into sleep mode if it wants to, and then wake it up as
required?

> >
> > Sorry for getting back so late to this. I realize this is already queued in
> > the media tree. But this binding doesn't look good enough to me. I think it
> > will need to be corrected during upcoming -rc period.
> >
> Thanks for the catch :-)
> 
> > It might be hard to figure out only from the chip's datasheet what
> > adi,power-mode-sleep-mode really refers to. AFAICS it is for assigning some
> > value to a specific register. If we really need to specify register values
> > in the device tree then it would probably make sense to describe to which
> > register this apply. Now the name looks like derived from some structure
> > member name in the Linux driver of the device.
> >
> the property is derived from the datasheet itself for example the
> 'adi,power-mode-sleep-mode' --> Register 0x0 power mode bit 0
> 'adi,power-mode-pll-ctrl' ---> Register 0x0 power mode bit 1
> 'adi,dac-enable' ----> Register 0x0 power mode bit 2-7
> 'adi,sd-dac-enable' ---> Register 0x82 SD mode register bit 1-2
> 
> [1] http://www.analog.com/static/imported-files/data_sheets/ADV7342_7343.pdf
> 
> >> +- adi,power-mode-pll-ctrl: PLL and oversampling control. This control allows
> >> +                        internal PLL 1 circuit to be powered down and the
> >> +                        oversampling to be switched off.

This affects whether or not oversampling is possible. That sounds like
it should be a run-time configurable rather than a fixed property of the
device.

> >
> > Similar comments applies to this property.
> >
> >> +- ad,adv7343-power-mode-dac: array configuring the power on/off DAC's 1..6,
> >> +                           0 = OFF and 1 = ON, Default value when this
> >> +                           property is not specified is <0 0 0 0 0 0>.
> >
> > Name of the property is incorrect here. It has changed to "adi,dac-enable".
> >
> OK

Why do we need this property at all? Might some DACs not be wired up to
anything?

Surely this could be configured at run-time as and when the user wants
to use the DACs.

> 
> >> +- ad,adv7343-sd-config-dac-out: array configure SD DAC Output's 1 and 2, 0 = OFF
> >> +                              and 1 = ON, Default value when this property is
> >> +                              not specified is <0 0>.
> >
> > Similarly, "adi,sd-dac-enable.
> >
> OK

Again, couldn't this be done at run-time?

Do we need to permanently disable/enable some DACs? If so, why?

I also note from the spec that the unit has two clocks, CLKIN_A and
CLKIN_B that aren't in the binding, but should be. Some regulators
too (VDD, PVDD, VAA, VDD_IO, VREF?).

Thanks,
Mark.

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

* Re: [PATCH v3 2/2] media: i2c: adv7343: add OF support
  2013-08-26  2:41     ` Prabhakar Lad
  2013-08-27 15:20       ` Mark Rutland
@ 2013-08-27 15:24       ` Mark Rutland
  2013-08-28  2:43         ` Prabhakar Lad
  1 sibling, 1 reply; 12+ messages in thread
From: Mark Rutland @ 2013-08-27 15:24 UTC (permalink / raw)
  To: Prabhakar Lad
  Cc: Sylwester Nawrocki, LMML, DLOS, LKML, devicetree, LDOC,
	Stephen Warren, Pawel Moll, Kumar Gala, rob.herring

[fixing up devicetree list address]

On Mon, Aug 26, 2013 at 03:41:45AM +0100, Prabhakar Lad wrote:
> Hi Sylwester,
> 
> On Fri, Aug 23, 2013 at 11:33 PM, Sylwester Nawrocki
> <s.nawrocki@samsung.com> wrote:
> > Cc: DT binding maintainers

Cheers!

> >
> > On 07/20/2013 08:21 AM, Lad, Prabhakar wrote:
> >> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> >>
> >> add OF support for the adv7343 driver.
> >>
> >> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> >> ---
> > [...]
> >>  .../devicetree/bindings/media/i2c/adv7343.txt      |   48 ++++++++++++++++++++
> >>  drivers/media/i2c/adv7343.c                        |   46 ++++++++++++++++++-
> >>  2 files changed, 93 insertions(+), 1 deletion(-)
> >>  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >>
> >> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7343.txt b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> new file mode 100644
> >> index 0000000..5653bc2
> >> --- /dev/null
> >> +++ b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> @@ -0,0 +1,48 @@
> >> +* Analog Devices adv7343 video encoder
> >> +
> >> +The ADV7343 are high speed, digital-to-analog video encoders in a 64-lead LQFP
> >> +package. Six high speed, 3.3 V, 11-bit video DACs provide support for composite
> >> +(CVBS), S-Video (Y-C), and component (YPrPb/RGB) analog outputs in standard
> >> +definition (SD), enhanced definition (ED), or high definition (HD) video
> >> +formats.
> >> +
> >> +Required Properties :
> >> +- compatible: Must be "adi,adv7343"
> >> +
> >> +Optional Properties :
> >> +- adi,power-mode-sleep-mode: on enable the current consumption is reduced to
> >> +                           micro ampere level. All DACs and the internal PLL
> >> +                           circuit are disabled.

This seems to be a boolean property, and I couldn't find any description
in the linked datasheet of the constraints under which the unit may be
put into sleep mode.

Why do we require this property in the dt? Can the driver not always put
a adv734x into sleep mode if it wants to, and then wake it up as
required?

> >
> > Sorry for getting back so late to this. I realize this is already queued in
> > the media tree. But this binding doesn't look good enough to me. I think it
> > will need to be corrected during upcoming -rc period.
> >
> Thanks for the catch :-)
> 
> > It might be hard to figure out only from the chip's datasheet what
> > adi,power-mode-sleep-mode really refers to. AFAICS it is for assigning some
> > value to a specific register. If we really need to specify register values
> > in the device tree then it would probably make sense to describe to which
> > register this apply. Now the name looks like derived from some structure
> > member name in the Linux driver of the device.
> >
> the property is derived from the datasheet itself for example the
> 'adi,power-mode-sleep-mode' --> Register 0x0 power mode bit 0
> 'adi,power-mode-pll-ctrl' ---> Register 0x0 power mode bit 1
> 'adi,dac-enable' ----> Register 0x0 power mode bit 2-7
> 'adi,sd-dac-enable' ---> Register 0x82 SD mode register bit 1-2
> 
> [1] http://www.analog.com/static/imported-files/data_sheets/ADV7342_7343.pdf
> 
> >> +- adi,power-mode-pll-ctrl: PLL and oversampling control. This control allows
> >> +                        internal PLL 1 circuit to be powered down and the
> >> +                        oversampling to be switched off.

This affects whether or not oversampling is possible. That sounds like
it should be a run-time configurable rather than a fixed property of the
device.

> >
> > Similar comments applies to this property.
> >
> >> +- ad,adv7343-power-mode-dac: array configuring the power on/off DAC's 1..6,
> >> +                           0 = OFF and 1 = ON, Default value when this
> >> +                           property is not specified is <0 0 0 0 0 0>.
> >
> > Name of the property is incorrect here. It has changed to "adi,dac-enable".
> >
> OK

Why do we need this property at all? Might some DACs not be wired up to
anything?

Surely this could be configured at run-time as and when the user wants
to use the DACs.

> 
> >> +- ad,adv7343-sd-config-dac-out: array configure SD DAC Output's 1 and 2, 0 = OFF
> >> +                              and 1 = ON, Default value when this property is
> >> +                              not specified is <0 0>.
> >
> > Similarly, "adi,sd-dac-enable.
> >
> OK

Again, couldn't this be done at run-time?

Do we need to permanently disable/enable some DACs? If so, why?

I also note from the spec that the unit has two clocks, CLKIN_A and
CLKIN_B that aren't in the binding, but should be. Some regulators
too (VDD, PVDD, VAA, VDD_IO, VREF?).

Thanks,
Mark.

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

* Re: [PATCH v3 2/2] media: i2c: adv7343: add OF support
  2013-08-27 15:24       ` Mark Rutland
@ 2013-08-28  2:43         ` Prabhakar Lad
  2013-09-02 16:17           ` Mark Rutland
  0 siblings, 1 reply; 12+ messages in thread
From: Prabhakar Lad @ 2013-08-28  2:43 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Sylwester Nawrocki, LMML, DLOS, LKML, devicetree, LDOC,
	Stephen Warren, Pawel Moll, Kumar Gala, rob.herring

Hi Mark,

On Tue, Aug 27, 2013 at 8:54 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> [fixing up devicetree list address]
>
Thanks!

> On Mon, Aug 26, 2013 at 03:41:45AM +0100, Prabhakar Lad wrote:
>> Hi Sylwester,
>>
>> On Fri, Aug 23, 2013 at 11:33 PM, Sylwester Nawrocki
>> <s.nawrocki@samsung.com> wrote:
>> > Cc: DT binding maintainers
>
> Cheers!
>
>> >
>> > On 07/20/2013 08:21 AM, Lad, Prabhakar wrote:
>> >> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>> >>
>> >> add OF support for the adv7343 driver.
>> >>
>> >> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>> >> ---
>> > [...]
>> >>  .../devicetree/bindings/media/i2c/adv7343.txt      |   48 ++++++++++++++++++++
>> >>  drivers/media/i2c/adv7343.c                        |   46 ++++++++++++++++++-
>> >>  2 files changed, 93 insertions(+), 1 deletion(-)
>> >>  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt
>> >>
>> >> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7343.txt b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
>> >> new file mode 100644
>> >> index 0000000..5653bc2
>> >> --- /dev/null
>> >> +++ b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
>> >> @@ -0,0 +1,48 @@
>> >> +* Analog Devices adv7343 video encoder
>> >> +
>> >> +The ADV7343 are high speed, digital-to-analog video encoders in a 64-lead LQFP
>> >> +package. Six high speed, 3.3 V, 11-bit video DACs provide support for composite
>> >> +(CVBS), S-Video (Y-C), and component (YPrPb/RGB) analog outputs in standard
>> >> +definition (SD), enhanced definition (ED), or high definition (HD) video
>> >> +formats.
>> >> +
>> >> +Required Properties :
>> >> +- compatible: Must be "adi,adv7343"
>> >> +
>> >> +Optional Properties :
>> >> +- adi,power-mode-sleep-mode: on enable the current consumption is reduced to
>> >> +                           micro ampere level. All DACs and the internal PLL
>> >> +                           circuit are disabled.
>
> This seems to be a boolean property, and I couldn't find any description
> in the linked datasheet of the constraints under which the unit may be
> put into sleep mode.
>
> Why do we require this property in the dt? Can the driver not always put
> a adv734x into sleep mode if it wants to, and then wake it up as
> required?
>
The adv7343 decoder, fits on da850/dm6467 etc.. For the da850 it supports
only SD where as the dm6467 supports HD/SD/ED for which DAC 1-6 of
Register 0x0 varies for this board so I added them as the platform data
but I got a review comment in the ML asking to add entire register as
the pdata instead of DAC 1-6, so because of which it is being converted
in the same way for DT.

>> >
>> > Sorry for getting back so late to this. I realize this is already queued in
>> > the media tree. But this binding doesn't look good enough to me. I think it
>> > will need to be corrected during upcoming -rc period.
>> >
>> Thanks for the catch :-)
>>
>> > It might be hard to figure out only from the chip's datasheet what
>> > adi,power-mode-sleep-mode really refers to. AFAICS it is for assigning some
>> > value to a specific register. If we really need to specify register values
>> > in the device tree then it would probably make sense to describe to which
>> > register this apply. Now the name looks like derived from some structure
>> > member name in the Linux driver of the device.
>> >
>> the property is derived from the datasheet itself for example the
>> 'adi,power-mode-sleep-mode' --> Register 0x0 power mode bit 0
>> 'adi,power-mode-pll-ctrl' ---> Register 0x0 power mode bit 1
>> 'adi,dac-enable' ----> Register 0x0 power mode bit 2-7
>> 'adi,sd-dac-enable' ---> Register 0x82 SD mode register bit 1-2
>>
>> [1] http://www.analog.com/static/imported-files/data_sheets/ADV7342_7343.pdf
>>
>> >> +- adi,power-mode-pll-ctrl: PLL and oversampling control. This control allows
>> >> +                        internal PLL 1 circuit to be powered down and the
>> >> +                        oversampling to be switched off.
>
> This affects whether or not oversampling is possible. That sounds like
> it should be a run-time configurable rather than a fixed property of the
> device.
>
ditto

>> >
>> > Similar comments applies to this property.
>> >
>> >> +- ad,adv7343-power-mode-dac: array configuring the power on/off DAC's 1..6,
>> >> +                           0 = OFF and 1 = ON, Default value when this
>> >> +                           property is not specified is <0 0 0 0 0 0>.
>> >
>> > Name of the property is incorrect here. It has changed to "adi,dac-enable".
>> >
>> OK
>
> Why do we need this property at all? Might some DACs not be wired up to
> anything?
>
> Surely this could be configured at run-time as and when the user wants
> to use the DACs.
>
>>
>> >> +- ad,adv7343-sd-config-dac-out: array configure SD DAC Output's 1 and 2, 0 = OFF
>> >> +                              and 1 = ON, Default value when this property is
>> >> +                              not specified is <0 0>.
>> >
>> > Similarly, "adi,sd-dac-enable.
>> >
>> OK
>
> Again, couldn't this be done at run-time?
>
> Do we need to permanently disable/enable some DACs? If so, why?
>
ditto.

> I also note from the spec that the unit has two clocks, CLKIN_A and
> CLKIN_B that aren't in the binding, but should be. Some regulators
> too (VDD, PVDD, VAA, VDD_IO, VREF?).
>
OK

Regards,
--Prabhakar Lad

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

* Re: [PATCH v3 2/2] media: i2c: adv7343: add OF support
  2013-08-28  2:43         ` Prabhakar Lad
@ 2013-09-02 16:17           ` Mark Rutland
  2013-09-04  7:13             ` Prabhakar Lad
  0 siblings, 1 reply; 12+ messages in thread
From: Mark Rutland @ 2013-09-02 16:17 UTC (permalink / raw)
  To: Prabhakar Lad
  Cc: Sylwester Nawrocki, LMML, DLOS, LKML, devicetree, LDOC,
	Stephen Warren, Pawel Moll, Kumar Gala, rob.herring

On Wed, Aug 28, 2013 at 03:43:04AM +0100, Prabhakar Lad wrote:
> Hi Mark,
> 
> On Tue, Aug 27, 2013 at 8:54 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> > [fixing up devicetree list address]
> >
> Thanks!
> 
> > On Mon, Aug 26, 2013 at 03:41:45AM +0100, Prabhakar Lad wrote:
> >> Hi Sylwester,
> >>
> >> On Fri, Aug 23, 2013 at 11:33 PM, Sylwester Nawrocki
> >> <s.nawrocki@samsung.com> wrote:
> >> > Cc: DT binding maintainers
> >
> > Cheers!
> >
> >> >
> >> > On 07/20/2013 08:21 AM, Lad, Prabhakar wrote:
> >> >> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> >> >>
> >> >> add OF support for the adv7343 driver.
> >> >>
> >> >> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> >> >> ---
> >> > [...]
> >> >>  .../devicetree/bindings/media/i2c/adv7343.txt      |   48 ++++++++++++++++++++
> >> >>  drivers/media/i2c/adv7343.c                        |   46 ++++++++++++++++++-
> >> >>  2 files changed, 93 insertions(+), 1 deletion(-)
> >> >>  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> >>
> >> >> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7343.txt b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> >> new file mode 100644
> >> >> index 0000000..5653bc2
> >> >> --- /dev/null
> >> >> +++ b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> >> @@ -0,0 +1,48 @@
> >> >> +* Analog Devices adv7343 video encoder
> >> >> +
> >> >> +The ADV7343 are high speed, digital-to-analog video encoders in a 64-lead LQFP
> >> >> +package. Six high speed, 3.3 V, 11-bit video DACs provide support for composite
> >> >> +(CVBS), S-Video (Y-C), and component (YPrPb/RGB) analog outputs in standard
> >> >> +definition (SD), enhanced definition (ED), or high definition (HD) video
> >> >> +formats.
> >> >> +
> >> >> +Required Properties :
> >> >> +- compatible: Must be "adi,adv7343"
> >> >> +
> >> >> +Optional Properties :
> >> >> +- adi,power-mode-sleep-mode: on enable the current consumption is reduced to
> >> >> +                           micro ampere level. All DACs and the internal PLL
> >> >> +                           circuit are disabled.
> >
> > This seems to be a boolean property, and I couldn't find any description
> > in the linked datasheet of the constraints under which the unit may be
> > put into sleep mode.
> >
> > Why do we require this property in the dt? Can the driver not always put
> > a adv734x into sleep mode if it wants to, and then wake it up as
> > required?
> >
> The adv7343 decoder, fits on da850/dm6467 etc.. For the da850 it supports
> only SD where as the dm6467 supports HD/SD/ED for which DAC 1-6 of
> Register 0x0 varies for this board so I added them as the platform data
> but I got a review comment in the ML asking to add entire register as
> the pdata instead of DAC 1-6, so because of which it is being converted
> in the same way for DT.

Not everything that appears in platform data should appear in the dt.
This seems more like a run-time decision that a description of the
hardware. 

I don't see why we need the "adi,power-mode-sleep-mode" property.

> 
> >> >
> >> > Sorry for getting back so late to this. I realize this is already queued in
> >> > the media tree. But this binding doesn't look good enough to me. I think it
> >> > will need to be corrected during upcoming -rc period.
> >> >
> >> Thanks for the catch :-)
> >>
> >> > It might be hard to figure out only from the chip's datasheet what
> >> > adi,power-mode-sleep-mode really refers to. AFAICS it is for assigning some
> >> > value to a specific register. If we really need to specify register values
> >> > in the device tree then it would probably make sense to describe to which
> >> > register this apply. Now the name looks like derived from some structure
> >> > member name in the Linux driver of the device.
> >> >
> >> the property is derived from the datasheet itself for example the
> >> 'adi,power-mode-sleep-mode' --> Register 0x0 power mode bit 0
> >> 'adi,power-mode-pll-ctrl' ---> Register 0x0 power mode bit 1
> >> 'adi,dac-enable' ----> Register 0x0 power mode bit 2-7
> >> 'adi,sd-dac-enable' ---> Register 0x82 SD mode register bit 1-2
> >>
> >> [1] http://www.analog.com/static/imported-files/data_sheets/ADV7342_7343.pdf
> >>
> >> >> +- adi,power-mode-pll-ctrl: PLL and oversampling control. This control allows
> >> >> +                        internal PLL 1 circuit to be powered down and the
> >> >> +                        oversampling to be switched off.
> >
> > This affects whether or not oversampling is possible. That sounds like
> > it should be a run-time configurable rather than a fixed property of the
> > device.
> >
> ditto

Not all platform data is suitable for dt. This seems like a decision as
to how to use the hardware, rather than a description of the hardware.
Hardware description should go in the dt, decisions should go in the
driver.

> 
> >> >
> >> > Similar comments applies to this property.
> >> >
> >> >> +- ad,adv7343-power-mode-dac: array configuring the power on/off DAC's 1..6,
> >> >> +                           0 = OFF and 1 = ON, Default value when this
> >> >> +                           property is not specified is <0 0 0 0 0 0>.
> >> >
> >> > Name of the property is incorrect here. It has changed to "adi,dac-enable".
> >> >
> >> OK
> >
> > Why do we need this property at all? Might some DACs not be wired up to
> > anything?
> >
> > Surely this could be configured at run-time as and when the user wants
> > to use the DACs.
> >
> >>
> >> >> +- ad,adv7343-sd-config-dac-out: array configure SD DAC Output's 1 and 2, 0 = OFF
> >> >> +                              and 1 = ON, Default value when this property is
> >> >> +                              not specified is <0 0>.
> >> >
> >> > Similarly, "adi,sd-dac-enable.
> >> >
> >> OK
> >
> > Again, couldn't this be done at run-time?
> >
> > Do we need to permanently disable/enable some DACs? If so, why?
> >
> ditto.

And ditto to my points above.

Cheers,
Mark.

> 
> > I also note from the spec that the unit has two clocks, CLKIN_A and
> > CLKIN_B that aren't in the binding, but should be. Some regulators
> > too (VDD, PVDD, VAA, VDD_IO, VREF?).
> >
> OK
> 
> Regards,
> --Prabhakar Lad
> 

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

* Re: [PATCH v3 2/2] media: i2c: adv7343: add OF support
  2013-09-02 16:17           ` Mark Rutland
@ 2013-09-04  7:13             ` Prabhakar Lad
  2013-09-04 14:48               ` Mark Rutland
  0 siblings, 1 reply; 12+ messages in thread
From: Prabhakar Lad @ 2013-09-04  7:13 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Sylwester Nawrocki, LMML, DLOS, LKML, devicetree, LDOC,
	Stephen Warren, Pawel Moll, Kumar Gala, rob.herring

Hi Mark,

On Mon, Sep 2, 2013 at 9:47 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> On Wed, Aug 28, 2013 at 03:43:04AM +0100, Prabhakar Lad wrote:
>> Hi Mark,
>>
>> On Tue, Aug 27, 2013 at 8:54 PM, Mark Rutland <mark.rutland@arm.com> wrote:
>> > [fixing up devicetree list address]
>> >
>> Thanks!
>>
>> > On Mon, Aug 26, 2013 at 03:41:45AM +0100, Prabhakar Lad wrote:
>> >> Hi Sylwester,
>> >>
>> >> On Fri, Aug 23, 2013 at 11:33 PM, Sylwester Nawrocki
>> >> <s.nawrocki@samsung.com> wrote:
>> >> > Cc: DT binding maintainers
>> >
>> > Cheers!
>> >
>> >> >
>> >> > On 07/20/2013 08:21 AM, Lad, Prabhakar wrote:
>> >> >> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
>> >> >>
>> >> >> add OF support for the adv7343 driver.
>> >> >>
>> >> >> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
>> >> >> ---
>> >> > [...]
>> >> >>  .../devicetree/bindings/media/i2c/adv7343.txt      |   48 ++++++++++++++++++++
>> >> >>  drivers/media/i2c/adv7343.c                        |   46 ++++++++++++++++++-
>> >> >>  2 files changed, 93 insertions(+), 1 deletion(-)
>> >> >>  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt
>> >> >>
>> >> >> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7343.txt b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
>> >> >> new file mode 100644
>> >> >> index 0000000..5653bc2
>> >> >> --- /dev/null
>> >> >> +++ b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
>> >> >> @@ -0,0 +1,48 @@
>> >> >> +* Analog Devices adv7343 video encoder
>> >> >> +
>> >> >> +The ADV7343 are high speed, digital-to-analog video encoders in a 64-lead LQFP
>> >> >> +package. Six high speed, 3.3 V, 11-bit video DACs provide support for composite
>> >> >> +(CVBS), S-Video (Y-C), and component (YPrPb/RGB) analog outputs in standard
>> >> >> +definition (SD), enhanced definition (ED), or high definition (HD) video
>> >> >> +formats.
>> >> >> +
>> >> >> +Required Properties :
>> >> >> +- compatible: Must be "adi,adv7343"
>> >> >> +
>> >> >> +Optional Properties :
>> >> >> +- adi,power-mode-sleep-mode: on enable the current consumption is reduced to
>> >> >> +                           micro ampere level. All DACs and the internal PLL
>> >> >> +                           circuit are disabled.
>> >
>> > This seems to be a boolean property, and I couldn't find any description
>> > in the linked datasheet of the constraints under which the unit may be
>> > put into sleep mode.
>> >
>> > Why do we require this property in the dt? Can the driver not always put
>> > a adv734x into sleep mode if it wants to, and then wake it up as
>> > required?
>> >
>> The adv7343 decoder, fits on da850/dm6467 etc.. For the da850 it supports
>> only SD where as the dm6467 supports HD/SD/ED for which DAC 1-6 of
>> Register 0x0 varies for this board so I added them as the platform data
>> but I got a review comment in the ML asking to add entire register as
>> the pdata instead of DAC 1-6, so because of which it is being converted
>> in the same way for DT.
>
> Not everything that appears in platform data should appear in the dt.
> This seems more like a run-time decision that a description of the
> hardware.
>
> I don't see why we need the "adi,power-mode-sleep-mode" property.
>
Ok I will drop "adi,power-mode-sleep-mode" and "adi,power-mode-pll-ctrl"
property from the DT bindings and just have "adi,dac-enable",
"adi,sd-dac-enable" properties as this cannot be handled runtime.

Regards,
--Prabhakar Lad

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

* Re: [PATCH v3 2/2] media: i2c: adv7343: add OF support
  2013-09-04  7:13             ` Prabhakar Lad
@ 2013-09-04 14:48               ` Mark Rutland
  0 siblings, 0 replies; 12+ messages in thread
From: Mark Rutland @ 2013-09-04 14:48 UTC (permalink / raw)
  To: Prabhakar Lad
  Cc: Sylwester Nawrocki, LMML, DLOS, LKML, devicetree, LDOC,
	Stephen Warren, Pawel Moll, Kumar Gala, rob.herring

On Wed, Sep 04, 2013 at 08:13:38AM +0100, Prabhakar Lad wrote:
> Hi Mark,

Hi Prabhakar,

> 
> On Mon, Sep 2, 2013 at 9:47 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> > On Wed, Aug 28, 2013 at 03:43:04AM +0100, Prabhakar Lad wrote:
> >> Hi Mark,
> >>
> >> On Tue, Aug 27, 2013 at 8:54 PM, Mark Rutland <mark.rutland@arm.com> wrote:
> >> > [fixing up devicetree list address]
> >> >
> >> Thanks!
> >>
> >> > On Mon, Aug 26, 2013 at 03:41:45AM +0100, Prabhakar Lad wrote:
> >> >> Hi Sylwester,
> >> >>
> >> >> On Fri, Aug 23, 2013 at 11:33 PM, Sylwester Nawrocki
> >> >> <s.nawrocki@samsung.com> wrote:
> >> >> > Cc: DT binding maintainers
> >> >
> >> > Cheers!
> >> >
> >> >> >
> >> >> > On 07/20/2013 08:21 AM, Lad, Prabhakar wrote:
> >> >> >> From: "Lad, Prabhakar" <prabhakar.csengg@gmail.com>
> >> >> >>
> >> >> >> add OF support for the adv7343 driver.
> >> >> >>
> >> >> >> Signed-off-by: Lad, Prabhakar <prabhakar.csengg@gmail.com>
> >> >> >> ---
> >> >> > [...]
> >> >> >>  .../devicetree/bindings/media/i2c/adv7343.txt      |   48 ++++++++++++++++++++
> >> >> >>  drivers/media/i2c/adv7343.c                        |   46 ++++++++++++++++++-
> >> >> >>  2 files changed, 93 insertions(+), 1 deletion(-)
> >> >> >>  create mode 100644 Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> >> >>
> >> >> >> diff --git a/Documentation/devicetree/bindings/media/i2c/adv7343.txt b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> >> >> new file mode 100644
> >> >> >> index 0000000..5653bc2
> >> >> >> --- /dev/null
> >> >> >> +++ b/Documentation/devicetree/bindings/media/i2c/adv7343.txt
> >> >> >> @@ -0,0 +1,48 @@
> >> >> >> +* Analog Devices adv7343 video encoder
> >> >> >> +
> >> >> >> +The ADV7343 are high speed, digital-to-analog video encoders in a 64-lead LQFP
> >> >> >> +package. Six high speed, 3.3 V, 11-bit video DACs provide support for composite
> >> >> >> +(CVBS), S-Video (Y-C), and component (YPrPb/RGB) analog outputs in standard
> >> >> >> +definition (SD), enhanced definition (ED), or high definition (HD) video
> >> >> >> +formats.
> >> >> >> +
> >> >> >> +Required Properties :
> >> >> >> +- compatible: Must be "adi,adv7343"
> >> >> >> +
> >> >> >> +Optional Properties :
> >> >> >> +- adi,power-mode-sleep-mode: on enable the current consumption is reduced to
> >> >> >> +                           micro ampere level. All DACs and the internal PLL
> >> >> >> +                           circuit are disabled.
> >> >
> >> > This seems to be a boolean property, and I couldn't find any description
> >> > in the linked datasheet of the constraints under which the unit may be
> >> > put into sleep mode.
> >> >
> >> > Why do we require this property in the dt? Can the driver not always put
> >> > a adv734x into sleep mode if it wants to, and then wake it up as
> >> > required?
> >> >
> >> The adv7343 decoder, fits on da850/dm6467 etc.. For the da850 it supports
> >> only SD where as the dm6467 supports HD/SD/ED for which DAC 1-6 of
> >> Register 0x0 varies for this board so I added them as the platform data
> >> but I got a review comment in the ML asking to add entire register as
> >> the pdata instead of DAC 1-6, so because of which it is being converted
> >> in the same way for DT.
> >
> > Not everything that appears in platform data should appear in the dt.
> > This seems more like a run-time decision that a description of the
> > hardware.
> >
> > I don't see why we need the "adi,power-mode-sleep-mode" property.
> >
> Ok I will drop "adi,power-mode-sleep-mode" and "adi,power-mode-pll-ctrl"
> property from the DT bindings and just have "adi,dac-enable",
> "adi,sd-dac-enable" properties as this cannot be handled runtime.

I'm still somewhat confused by these properties. The "adi,sd-dac-enable"
property only describes two, the "sd" DACs, and "adi,dac-enable"
describes 6. From the block diagram in the device manual, there are only
6 DACs (1...6). None of the DACs seem to be limited in what they support
(unless that's described elsewhere), so I don't understand what the "sd"
DACs are. Could you elaborate?

Which DACs are being described by each property? They seem to overlap.

Why do we need to program them as on or off? Surely that depends on
whether or not they're connected to anything and whether or not we want
something to appear on that output? Can the "REFERENCE AND CABLE DETECT"
unit tell us that?

Until the binding is clarified and stabilised, I don't think the binding
or driver should be merged.

Thanks,
Mark.

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

end of thread, other threads:[~2013-09-04 14:48 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-20  6:21 [PATCH v3 0/2] adv7343 add OF support Lad, Prabhakar
2013-07-20  6:21 ` [PATCH v3 1/2] media: i2c: adv7343: make the platform data members as array Lad, Prabhakar
2013-07-22  9:37   ` Sekhar Nori
2013-07-20  6:21 ` [PATCH v3 2/2] media: i2c: adv7343: add OF support Lad, Prabhakar
2013-08-23 18:03   ` Sylwester Nawrocki
2013-08-26  2:41     ` Prabhakar Lad
2013-08-27 15:20       ` Mark Rutland
2013-08-27 15:24       ` Mark Rutland
2013-08-28  2:43         ` Prabhakar Lad
2013-09-02 16:17           ` Mark Rutland
2013-09-04  7:13             ` Prabhakar Lad
2013-09-04 14:48               ` Mark Rutland

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).