Skip to contentSkip to conversation

media: i2c: adv7343: fix the DT binding properties

PATCH New Prabhakar Lad 6 participants 17 messages Sep 13, 2013 – Sep 30, 2013

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

From: "Lad, Prabhakar" <[email protected]>

This patch fixes the DT binding properties of adv7343 decoder. The pdata which was being read from the DT property, is removed as this can done internally in the driver using cable detection register.

This patch also removes the pdata of ADV7343 which was passed from DA850 machine.

---
 .../devicetree/bindings/media/i2c/adv7343.txt      |   33 ++++----
 arch/arm/mach-davinci/board-da850-evm.c            |   10 ---
 drivers/media/i2c/adv7343.c                        |   86 ++++++--------------
 drivers/media/i2c/adv7343_regs.h                   |    8 +-
 include/media/adv7343.h                            |   40 ---------
 5 files changed, 42 insertions(+), 135 deletions(-)
Documentation/devicetree/bindings/media/i2c/adv7343.txt +14 -19
index 5653bc2..5d0e7e4 100644
@@ -8,39 +8,34 @@ formats.
 
 Required Properties :
 - compatible: Must be "adi,adv7343"
+- reg: I2C device address.
+- vddio-supply: I/O voltage supply.
+- vddcore-supply: core voltage supply.
+- vaa-supply: Analog power supply.
+- pvdd-supply: PLL power supply.
 
 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>.
+- vref-supply: Voltage reference output.
+
+For further reading on port node refer to
+Documentation/devicetree/bindings/media/video-interfaces.txt.
 
 Example:
 
 i2c0@1c22000 {
 	...
 	...
-
 	adv7343@2a {
 		compatible = "adi,adv7343";
 		reg = <0x2a>;
+		vddio-supply = <&regulator1>;
+		vddcore-supply = <&regulator2>;
+		vaa-supply = <&regulator3>;
+		pvdd-supply = <&regulator4>;
 
 		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>;
+				remote-endpoint = <&vpif0_1>;
 			};
 		};
 	};
arch/arm/mach-davinci/board-da850-evm.c +0 -10
index dd1fb24..5c72c8a 100644
@@ -1243,21 +1243,11 @@ static struct vpif_capture_config da850_vpif_capture_config = {
 
 /* VPIF display configuration */
 
-static struct adv7343_platform_data adv7343_pdata = {
-	.mode_config = {
-		.dac = { 1, 1, 1 },
-	},
-	.sd_config = {
-		.sd_dac_out = { 1 },
-	},
-};
-
 static struct vpif_subdev_info da850_vpif_subdev[] = {
 	{
 		.name = "adv7343",
 		.board_info = {
 			I2C_BOARD_INFO("adv7343", 0x2a),
-			.platform_data = &adv7343_pdata,
 		},
 	},
 };
drivers/media/i2c/adv7343.c +23 -63

135 lines not on this page · raw message

drivers/media/i2c/adv7343_regs.h +5 -3
index 4466067..94d9722 100644
@@ -29,6 +29,8 @@ struct adv7343_std_info {
 
 #define ADV7343_DAC2_OUTPUT_LEVEL	(0x0b)
 
+#define ADV7343_CABLE_DETECTION		0x10
+
 #define ADV7343_SOFT_RESET		(0x17)
 
 #define ADV7343_HD_MODE_REG1		(0x30)
@@ -72,9 +74,7 @@ struct adv7343_std_info {
 #define ADV7343_HD_MODE_REG7_DEFAULT		(0x00)
 #define ADV7343_SD_MODE_REG8_DEFAULT		(0x00)
 #define ADV7343_SOFT_RESET_DEFAULT		(0x02)
-#define ADV7343_COMPOSITE_POWER_VALUE		(0x80)
-#define ADV7343_COMPONENT_POWER_VALUE		(0x1C)
-#define ADV7343_SVIDEO_POWER_VALUE		(0x60)
+#define ADV7343_POWER_VALUE			0xfc
 #define ADV7343_SD_HUE_REG_DEFAULT		(127)
 #define ADV7343_SD_BRIGHTNESS_WSS_DEFAULT	(0x03)
 
@@ -178,4 +178,6 @@ struct adv7343_std_info {
 #define ADV7343_GAIN_MIN	(-64)
 #define ADV7343_GAIN_DEF	(0)
 
+#define ADV7343_AUTO_POWER_DOWN_ENABLE	0x10
+
 #endif
include/media/adv7343.h +0 -40
index e4142b1..d6f8a4e 100644
@@ -20,44 +20,4 @@
 #define ADV7343_COMPONENT_ID	(1)
 #define ADV7343_SVIDEO_ID	(2)
 
-/**
- * adv7343_power_mode - power mode configuration.
- * @sleep_mode: on enable the current consumption is reduced to micro ampere
- *		level. All DACs and the internal PLL circuit are disabled.
- *		Registers can be read from and written in sleep mode.
- * @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: 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.
- *
- * [1] http://www.analog.com/static/imported-files/data_sheets/ADV7342_7343.pdf
- */
-struct adv7343_power_mode {
-	bool sleep_mode;
-	bool pll_control;
-	u32 dac[6];
-};
-
-/**
- * struct adv7343_sd_config - SD Only Output Configuration.
- * @sd_dac_out: array configuring SD DAC Outputs 1 and 2
- */
-struct adv7343_sd_config {
-	/* SD only Output Configuration */
-	u32 sd_dac_out[2];
-};
-
-/**
- * struct adv7343_platform_data - Platform data values and access functions.
- * @mode_config: Configuration for power mode.
- * @sd_config: SD Only Configuration.
- */
-struct adv7343_platform_data {
-	struct adv7343_power_mode mode_config;
-	struct adv7343_sd_config sd_config;
-};
-
 #endif				/* End of #ifndef ADV7343_H */
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Quoted 11 lines · Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

This patch fixes the DT binding properties of adv7343 decoder. The pdata which was being read from the DT property, is removed as this can done internally in the driver using cable detection register.

This patch also removes the pdata of ADV7343 which was passed from DA850 machine.

Documentation/devicetree/bindings/media/i2c/adv7343.txt formats. · line 15

Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/adv7343.txt +5 -0
 
 Required Properties :
 - compatible: Must be "adi,adv7343"
+- reg: I2C device address.
+- vddio-supply: I/O voltage supply.
+- vddcore-supply: core voltage supply.
+- vaa-supply: Analog power supply.
+- pvdd-supply: PLL power supply.

Old DTs won't contain those properties. This breaks the DT ABI if those properties are required. Is that acceptable?

If it is, I think we should document that older versions of the binding didn't require those properties, so they may in fact be missing.

I note that this patch doesn't actually update the driver to regulator_get() anything. Shouldn't it?

Documentation/devicetree/bindings/media/i2c/adv7343.txt formats. · line 24

Quoted 13 lines

Optional Properties :
-- adi,power-mode-sleep-mode: on enable the current consumption is reduced to

Documentation/devicetree/bindings/media/i2c/adv7343.txt +0 -11
-			      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>.

At a very quick glance, it's not really clear why those properties are being removed. They seem like HW configuration, so might be fine to put into DT. What replaces these?

#2 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Hi Stephen,

This patch should have been marked as RFC.

Thanks for the review.

Quoted 21 lines · Stephen Warren
Quoted 11 lines · Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

This patch fixes the DT binding properties of adv7343 decoder. The pdata which was being read from the DT property, is removed as this can done internally in the driver using cable detection register.

This patch also removes the pdata of ADV7343 which was passed from DA850 machine.

Documentation/devicetree/bindings/media/i2c/adv7343.txt formats. · line 15

Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/adv7343.txt +5 -0
 
 Required Properties :
 - compatible: Must be "adi,adv7343"
+- reg: I2C device address.
+- vddio-supply: I/O voltage supply.
+- vddcore-supply: core voltage supply.
+- vaa-supply: Analog power supply.
+- pvdd-supply: PLL power supply.
Quoted 3 lines

Old DTs won't contain those properties. This breaks the DT ABI if those properties are required. Is that acceptable?

As of now adv7343 via DT binding is not enabled in any platforms so this wont break any DT ABI.

Quoted 6 lines

If it is, I think we should document that older versions of the binding didn't require those properties, so they may in fact be missing.

I note that this patch doesn't actually update the driver to regulator_get() anything. Shouldn't it?

As of now the driver isn?t enabling/accepting the regulators, so should I add those in DT properties or not ?

Quoted 14 lines

Documentation/devicetree/bindings/media/i2c/adv7343.txt formats. · line 24

Quoted 13 lines

Optional Properties :
-- adi,power-mode-sleep-mode: on enable the current consumption is reduced to

Documentation/devicetree/bindings/media/i2c/adv7343.txt +0 -11
-                           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>.
Quoted 3 lines

At a very quick glance, it's not really clear why those properties are being removed. They seem like HW configuration, so might be fine to put into DT. What replaces these?

Yes these were HW configuration but, its now internally handled in the driver. The 'ad,adv7343-power-mode-dac' property which enabled the DAC's 1..6 , so now in the driver by default all the DAC's are enabled by default and enable unconnected DAC auto power down. Similarly 'ad,adv7343-sd-config-dac-out' property enabled SD DAC's 1..2 but now is enabled by reading the CABLE DETECT register which tells the status of DAC1/2.

Regards,
--Prabhakar

#3 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Quoted 28 lines · Prabhakar Lad

Hi Stephen,

This patch should have been marked as RFC.

Thanks for the review.

Quoted 21 lines · Stephen Warren
Quoted 19 lines · Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

This patch fixes the DT binding properties of adv7343 decoder. The pdata which was being read from the DT property, is removed as this can done internally in the driver using cable detection register.

This patch also removes the pdata of ADV7343 which was passed from DA850 machine.

Documentation/devicetree/bindings/media/i2c/adv7343.txt +5 -0
 
 Required Properties :
 - compatible: Must be "adi,adv7343"
+- reg: I2C device address.
+- vddio-supply: I/O voltage supply.
+- vddcore-supply: core voltage supply.
+- vaa-supply: Analog power supply.
+- pvdd-supply: PLL power supply.
Quoted 5 lines
Quoted 2 lines

Old DTs won't contain those properties. This breaks the DT ABI if those properties are required. Is that acceptable?

As of now adv7343 via DT binding is not enabled in any platforms so this wont break any DT ABI.

Well, if the binding has already been written, it technically already is an ABI. Perhaps the binding can be fixed if it isn't in use yet, but this is definitely not the correct approach to DT.

Quoted 8 lines
Quoted 5 lines

If it is, I think we should document that older versions of the binding didn't require those properties, so they may in fact be missing.

I note that this patch doesn't actually update the driver to regulator_get() anything. Shouldn't it?

As of now the driver isn?t enabling/accepting the regulators, so should I add those in DT properties or not ?

The binding should describe the HW, not what the driver does/doesn't yet do. I wrote the above because it looked like the driver was broken, not to encourage you to remove properties from the binding. How does the driver work if it doesn't enable the required regulators though, I wonder? I suppose the boards this driver has been tested on all must used fixed (non-SW-controlled) regulators.

Quoted 18 lines
Quoted 14 lines

Documentation/devicetree/bindings/media/i2c/adv7343.txt formats. · line 24

Quoted 13 lines

Optional Properties :
-- adi,power-mode-sleep-mode: on enable the current consumption is reduced to

Documentation/devicetree/bindings/media/i2c/adv7343.txt +0 -11
-                           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>.
Quoted 3 lines

At a very quick glance, it's not really clear why those properties are being removed. They seem like HW configuration, so might be fine to put into DT. What replaces these?

Quoted 7 lines

Yes these were HW configuration but, its now internally handled in the driver. The 'ad,adv7343-power-mode-dac' property which enabled the DAC's 1..6 , so now in the driver by default all the DAC's are enabled by default and enable unconnected DAC auto power down. Similarly 'ad,adv7343-sd-config-dac-out' property enabled SD DAC's 1..2 but now is enabled by reading the CABLE DETECT register which tells the status of DAC1/2.

OK, that's probably fine for the two properties you mentioned (you didn't describe two of them...). Some more discussion on why SW doesn't need these options might be useful in the patch description. Note that the discussion should be written for software in general (i.e. any OS's driver), and not for Linux's specific driver, since DT is not tied to any one OS.

#4 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Hi Stephen,

Quoted 32 lines · Stephen Warren
Quoted 31 lines · Prabhakar Lad

Hi Stephen,

This patch should have been marked as RFC.

Thanks for the review.

Quoted 23 lines · Stephen Warren
Quoted 11 lines · Prabhakar Lad

From: "Lad, Prabhakar" <[email protected]>

This patch fixes the DT binding properties of adv7343 decoder. The pdata which was being read from the DT property, is removed as this can done internally in the driver using cable detection register.

This patch also removes the pdata of ADV7343 which was passed from DA850 machine.

Documentation/devicetree/bindings/media/i2c/adv7343.txt formats. · line 15

Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/adv7343.txt +5 -0
 
 Required Properties :
 - compatible: Must be "adi,adv7343"
+- reg: I2C device address.
+- vddio-supply: I/O voltage supply.
+- vddcore-supply: core voltage supply.
+- vaa-supply: Analog power supply.
+- pvdd-supply: PLL power supply.

Old DTs won't contain those properties. This breaks the DT ABI if those properties are required. Is that acceptable?

Quoted 7 lines
Quoted 2 lines

As of now adv7343 via DT binding is not enabled in any platforms so this wont break any DT ABI.

Well, if the binding has already been written, it technically already is an ABI. Perhaps the binding can be fixed if it isn't in use yet, but this is definitely not the correct approach to DT.

Ok

Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

If it is, I think we should document that older versions of the binding didn't require those properties, so they may in fact be missing.

I note that this patch doesn't actually update the driver to regulator_get() anything. Shouldn't it?

Quoted 6 lines
Quoted 2 lines

As of now the driver isn?t enabling/accepting the regulators, so should I add those in DT properties or not ?

The binding should describe the HW, not what the driver does/doesn't yet do. I wrote the above because it looked like the driver was broken, not to encourage you to remove properties from the binding.

OK

Quoted 5 lines

How does the
driver work if it doesn't enable the required regulators though, I wonder? I suppose the boards this driver has been tested on all must used fixed (non-SW-controlled) regulators.

on all the boards on which this decoder is connected the power to it is provided by static circuit and not by regulators, So for this how would you suggest to add the DT nodes for regulators ?

Quoted 26 lines
Quoted 18 lines
Quoted 14 lines

Documentation/devicetree/bindings/media/i2c/adv7343.txt formats. · line 24

Quoted 13 lines

Optional Properties :
-- adi,power-mode-sleep-mode: on enable the current consumption is reduced to

Documentation/devicetree/bindings/media/i2c/adv7343.txt +0 -11
-                           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>.
Quoted 3 lines

At a very quick glance, it's not really clear why those properties are being removed. They seem like HW configuration, so might be fine to put into DT. What replaces these?

Quoted 7 lines

Yes these were HW configuration but, its now internally handled in the driver. The 'ad,adv7343-power-mode-dac' property which enabled the DAC's 1..6 , so now in the driver by default all the DAC's are enabled by default and enable unconnected DAC auto power down. Similarly 'ad,adv7343-sd-config-dac-out' property enabled SD DAC's 1..2 but now is enabled by reading the CABLE DETECT register which tells the status of DAC1/2.

Quoted 6 lines

OK, that's probably fine for the two properties you mentioned (you didn't describe two of them...). Some more discussion on why SW doesn't need these options might be useful in the patch description. Note that the discussion should be written for software in general (i.e. any OS's driver), and not for Linux's specific driver, since DT is not tied to any one OS.

OK will update the description.

Regards,
--Prabhakar Lad

#5 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Quoted 27 lines · Prabhakar Lad
Quoted 26 lines · Stephen Warren
Quoted 25 lines · Prabhakar Lad
Quoted 23 lines · Stephen Warren
Quoted 11 lines · Prabhakar Lad

From: "Lad, Prabhakar"<[email protected]>

This patch fixes the DT binding properties of adv7343 decoder. The pdata which was being read from the DT property, is removed as this can done internally in the driver using cable detection register.

This patch also removes the pdata of ADV7343 which was passed from DA850 machine.

Documentation/devicetree/bindings/media/i2c/adv7343.txt formats. · line 15

Quoted 8 lines
Documentation/devicetree/bindings/media/i2c/adv7343.txt +5 -0
 
  Required Properties :
  - compatible: Must be "adi,adv7343"
+- reg: I2C device address.
+- vddio-supply: I/O voltage supply.
+- vddcore-supply: core voltage supply.
+- vaa-supply: Analog power supply.
+- pvdd-supply: PLL power supply.

Old DTs won't contain those properties. This breaks the DT ABI if those properties are required. Is that acceptable?

Quoted 6 lines
Quoted 6 lines
Quoted 2 lines

As of now adv7343 via DT binding is not enabled in any platforms so this wont break any DT ABI.

Well, if the binding has already been written, it technically already is an ABI. Perhaps the binding can be fixed if it isn't in use yet, but this is definitely not the correct approach to DT.

The binding got merged for 3.12-rc1 and the intention of this patch was to correct that binding. There we some issues like mismatch between names of properties documented and used in the driver.

After Mark's suggestion Prabhakar removed some properties and the platform data usage altogether. IMHO there should be only minimal changes in that "fixup" patch, i.e. no platform data usage should be removed. Perhaps it is fine since that's just code removal. I guess it is better to do this sort of cleanup for the next kernel release.

Also I believe the argument of backward compatibility shouldn't really be considered here. The $subject patch is supposed to correct the binding before it becomes and ABI.

Quoted 14 lines
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines

If it is, I think we should document that older versions of the binding didn't require those properties, so they may in fact be missing.

I note that this patch doesn't actually update the driver to regulator_get() anything. Shouldn't it?

Quoted 6 lines
Quoted 2 lines

As of now the driver isn?t enabling/accepting the regulators, so should I add those in DT properties or not ?

The binding should describe the HW, not what the driver does/doesn't yet do. I wrote the above because it looked like the driver was broken, not to encourage you to remove properties from the binding.

OK

Quoted 8 lines
Quoted 5 lines

How does the
driver work if it doesn't enable the required regulators though, I wonder? I suppose the boards this driver has been tested on all must used fixed (non-SW-controlled) regulators.

on all the boards on which this decoder is connected the power to it is provided by static circuit and not by regulators, So for this how would you suggest to add the DT nodes for regulators ?

I believe the regulator DT properties should be made optional. Since some (actually all upstream) boards don't bother with software controlled regulators. We might have specified them and have defined relevant fixed regulator(s) in DT. But I doubt it is sensible, given that it may never happen in practice the regulators are required to be controlled by software through the regulators API. Such devices can often be put in a low power mode by a write to one of the registers, where their supply current is at uA level. Looking at the datasheet ADV7343 has SLEEP_MODE in which its typical current consumption is 5 uA.

That said the chip could be supplied from shared voltage regulators and the driver would then have to properly request and enable the regulators.

Anyway I'm inclined to make the regulator properties optional.

--
Thanks,
Sylwester

#6 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Hi Sylwester,

Quoted 53 lines · Sylwester Nawrocki
Quoted 39 lines · Prabhakar Lad
Quoted 36 lines · Stephen Warren
Quoted 34 lines · Prabhakar Lad
Quoted 29 lines · Stephen Warren
Quoted 14 lines · Prabhakar Lad

From: "Lad, Prabhakar"<[email protected]>

This patch fixes the DT binding properties of adv7343 decoder. The pdata which was being read from the DT property, is removed as this can done internally in the driver using cable detection register.

This patch also removes the pdata of ADV7343 which was passed from DA850 machine.

Documentation/devicetree/bindings/media/i2c/adv7343.txt formats. · line 15

Quoted 9 lines
Documentation/devicetree/bindings/media/i2c/adv7343.txt +5 -0
 
 
  Required Properties :
  - compatible: Must be "adi,adv7343"
+- reg: I2C device address.
+- vddio-supply: I/O voltage supply.
+- vddcore-supply: core voltage supply.
+- vaa-supply: Analog power supply.
+- pvdd-supply: PLL power supply.

Old DTs won't contain those properties. This breaks the DT ABI if those properties are required. Is that acceptable?

Quoted 7 lines
Quoted 7 lines
Quoted 2 lines

As of now adv7343 via DT binding is not enabled in any platforms so this wont break any DT ABI.

Well, if the binding has already been written, it technically already is an ABI. Perhaps the binding can be fixed if it isn't in use yet, but this is definitely not the correct approach to DT.

The binding got merged for 3.12-rc1 and the intention of this patch was to correct that binding. There we some issues like mismatch between names of properties documented and used in the driver.

Quoted 6 lines

After Mark's suggestion Prabhakar removed some properties and the platform data usage altogether. IMHO there should be only minimal changes in that "fixup" patch, i.e. no platform data usage should be removed. Perhaps it is fine since that's just code removal. I guess it is better to do this sort of cleanup for the next kernel release.

OK I will, just send out a fix up patch which fixes the mismatch between names for the rc-cycle, and later send out a patch which removes the platform data usage for next release with proper DT bindings.

Quoted 42 lines

Also I believe the argument of backward compatibility shouldn't really be considered here. The $subject patch is supposed to correct the binding before it becomes and ABI.

Quoted 17 lines
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

If it is, I think we should document that older versions of the binding didn't require those properties, so they may in fact be missing.

I note that this patch doesn't actually update the driver to regulator_get() anything. Shouldn't it?

Quoted 7 lines
Quoted 2 lines

As of now the driver isn?t enabling/accepting the regulators, so should I add those in DT properties or not ?

The binding should describe the HW, not what the driver does/doesn't yet do. I wrote the above because it looked like the driver was broken, not to encourage you to remove properties from the binding.

OK

Quoted 8 lines
Quoted 5 lines

How does the
driver work if it doesn't enable the required regulators though, I wonder? I suppose the boards this driver has been tested on all must used fixed (non-SW-controlled) regulators.

on all the boards on which this decoder is connected the power to it is provided by static circuit and not by regulators, So for this how would you suggest to add the DT nodes for regulators ?

I believe the regulator DT properties should be made optional. Since some (actually all upstream) boards don't bother with software controlled regulators. We might have specified them and have defined relevant fixed regulator(s) in DT. But I doubt it is sensible, given that it may never happen in practice the regulators are required to be controlled by software through the regulators API. Such devices can often be put in a low power mode by a write to one of the registers, where their supply current is at uA level. Looking at the datasheet ADV7343 has SLEEP_MODE in which its typical current consumption is 5 uA.

Quoted 5 lines

That said the chip could be supplied from shared voltage regulators and the driver would then have to properly request and enable the regulators.

Anyway I'm inclined to make the regulator properties optional.

I'm OK with making regulator properties as optional, But still it would change the meaning of what DT is, we know that the VDD/VDD_IO .. etc pins are required properties (but still making them as optional) :-(

I think there might several devices where this situation may arise so just thinking of a alternative solution.

say we have property 'software-regulator' which takes true/false(0/1) If set to true we make the regulators as required property or else we assume it is handled and ignore it ?

Thanks,
--Prabhakar Lad

#7 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Hi Prabhakar,

Quoted 3 lines · Prabhakar Lad

OK I will, just send out a fix up patch which fixes the mismatch between names for the rc-cycle, and later send out a patch which removes the platform data usage for next release with proper DT bindings.

I think the binding need to be fully corrected now, I just meant to not touch the board file, i.e. leave non-dt support unchanged.

Quoted 10 lines

I'm OK with making regulator properties as optional, But still it would change the meaning of what DT is, we know that the VDD/VDD_IO .. etc pins are required properties (but still making them as optional) :-(

I think there might several devices where this situation may arise so just thinking of a alternative solution.

say we have property 'software-regulator' which takes true/false(0/1) If set to true we make the regulators as required property or else we assume it is handled and ignore it ?

I don't think this is a good idea. You would have to add a similar platform data flag for non-dt, it doesn't sound right. I can see two options here:

1. Make the regulator properties mandatory and, e.g. define a fixed voltage GPIO regulator in DT with an empty 'gpio' property. Then pass a phandle to that regulator in the adv7343 *-supply properties. For non-dt similarly a fixed voltage regulator(s) and voltage supplies would need to be defined in the board files.

2. Make the properties optional and use (devm_)regulator_get_optional() calls in the driver (a recently added function). I must admit I don't fully understand description of this function, it currently looks pretty much same as (devm_)regulator_get(). Thus the driver would need to be handling regulator supplies only when non ERR_PTR() is returned from regulator_get_optional() and otherwise assume a non critical error. There is already quite a few example occurrences of regulator_get_optional() usage.

--
Regards,
Sylwester

#8 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Hi Sylwester,

Quoted 10 lines · Sylwester Nawrocki

Hi Prabhakar,

Quoted 3 lines · Prabhakar Lad

OK I will, just send out a fix up patch which fixes the mismatch between names for the rc-cycle, and later send out a patch which removes the platform data usage for next release with proper DT bindings.

I think the binding need to be fully corrected now, I just meant to not touch the board file, i.e. leave non-dt support unchanged.

Ok

Quoted 20 lines
Quoted 10 lines

I'm OK with making regulator properties as optional, But still it would change the meaning of what DT is, we know that the VDD/VDD_IO .. etc pins are required properties (but still making them as optional) :-(

I think there might several devices where this situation may arise so just thinking of a alternative solution.

say we have property 'software-regulator' which takes true/false(0/1) If set to true we make the regulators as required property or else we assume it is handled and ignore it ?

I don't think this is a good idea. You would have to add a similar platform data flag for non-dt, it doesn't sound right. I can see two options here:

1. Make the regulator properties mandatory and, e.g. define a fixed voltage GPIO regulator in DT with an empty 'gpio' property. Then pass a phandle to that regulator in the adv7343 *-supply properties. For non-dt similarly a fixed voltage regulator(s) and voltage supplies would need to be defined in the board files.

Quoted 9 lines

2. Make the properties optional and use (devm_)regulator_get_optional() calls in the driver (a recently added function). I must admit I don't fully understand description of this function, it currently looks pretty much same as (devm_)regulator_get(). Thus the driver would need to be handling regulator supplies only when non ERR_PTR() is returned from regulator_get_optional() and otherwise assume a non critical error. There is already quite a few example occurrences of regulator_get_optional() usage.

Thanks for pointing it I'll choose option 2 and post the patch.

Regards,
--Prabhakar Lad

#9 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Quoted 41 lines · On Monday 23 September 2013 08:18:52 Prabhakar Lad wrote:
Quoted 7 lines · Sylwester Nawrocki
Quoted 3 lines · Prabhakar Lad

OK I will, just send out a fix up patch which fixes the mismatch between names for the rc-cycle, and later send out a patch which removes the platform data usage for next release with proper DT bindings.

I think the binding need to be fully corrected now, I just meant to not touch the board file, i.e. leave non-dt support unchanged.

Ok

Quoted 21 lines
Quoted 10 lines

I'm OK with making regulator properties as optional, But still it would change the meaning of what DT is, we know that the VDD/VDD_IO .. etc pins are required properties (but still making them as optional) :-(

I think there might several devices where this situation may arise so just thinking of a alternative solution.

say we have property 'software-regulator' which takes true/false(0/1) If set to true we make the regulators as required property or else we assume it is handled and ignore it ?

I don't think this is a good idea. You would have to add a similar platform data flag for non-dt, it doesn't sound right. I can see two options here:

1. Make the regulator properties mandatory and, e.g. define a fixed voltage GPIO regulator in DT with an empty 'gpio' property. Then pass a phandle to that regulator in the adv7343 *-supply properties. For non-dt similarly a fixed voltage regulator(s) and voltage supplies would need to be defined in the board files.

Quoted 8 lines

2. Make the properties optional and use (devm_)regulator_get_optional() calls in the driver (a recently added function). I must admit I don't fully understand description of this function, it currently looks pretty much same as (devm_)regulator_get(). Thus the driver would need to be handling regulator supplies only when non ERR_PTR() is returned from regulator_get_optional() and otherwise assume a non critical error. There is already quite a few example occurrences of regulator_get_optional() usage.

Quoted 1 line

Thanks for pointing it I'll choose option 2 and post the patch.

Isn't regulator_get_optional() intended for devices that can have supplies unconnected in normal use ? The ADV7343 supplies are mandatory from a hardware point of view, so I think we should use regulator_get(). Otherwise the driver won't be able to tell the difference between a regulator that isn't present yet (for instance because the regulator device/driver hasn't been probed yet), which should result in deferred probing, and an always-on regulator that has been left out.

Signature · 3 lines
Regards,

Laurent Pinchart
#10 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Quoted 42 lines · Laurent Pinchart
Quoted 41 lines · On Monday 23 September 2013 08:18:52 Prabhakar Lad wrote:
Quoted 7 lines · Sylwester Nawrocki
Quoted 3 lines · Prabhakar Lad

OK I will, just send out a fix up patch which fixes the mismatch between names for the rc-cycle, and later send out a patch which removes the platform data usage for next release with proper DT bindings.

I think the binding need to be fully corrected now, I just meant to not touch the board file, i.e. leave non-dt support unchanged.

Ok

Quoted 29 lines
Quoted 10 lines

I'm OK with making regulator properties as optional, But still it would change the meaning of what DT is, we know that the VDD/VDD_IO .. etc pins are required properties (but still making them as optional) :-(

I think there might several devices where this situation may arise so just thinking of a alternative solution.

say we have property 'software-regulator' which takes true/false(0/1) If set to true we make the regulators as required property or else we assume it is handled and ignore it ?

I don't think this is a good idea. You would have to add a similar platform data flag for non-dt, it doesn't sound right. I can see two options here:

1. Make the regulator properties mandatory and, e.g. define a fixed voltage GPIO regulator in DT with an empty 'gpio' property. Then pass a phandle to that regulator in the adv7343 *-supply properties. For non-dt similarly a fixed voltage regulator(s) and voltage supplies would need to be defined in the board files.

2. Make the properties optional and use (devm_)regulator_get_optional() calls in the driver (a recently added function). I must admit I don't fully understand description of this function, it currently looks pretty much same as (devm_)regulator_get(). Thus the driver would need to be handling regulator supplies only when non ERR_PTR() is returned from regulator_get_optional() and otherwise assume a non critical error. There is already quite a few example occurrences of regulator_get_optional() usage.

Quoted 4 lines
Quoted 1 line

Thanks for pointing it I'll choose option 2 and post the patch.

Isn't regulator_get_optional() intended for devices that can have supplies unconnected in normal use ?

I believe so, yes.

Quoted 6 lines

The ADV7343 supplies are mandatory from a hardware
point of view, so I think we should use regulator_get(). Otherwise the driver won't be able to tell the difference between a regulator that isn't present yet (for instance because the regulator device/driver hasn't been probed yet), which should result in deferred probing, and an always-on regulator that has been left out.

So I think you want to make the supply properties mandatory in DT (since some form of supply is mandatory in HW), yet make the driver support broken DTs which don't have those properties, by error-checking the return value from regulator_get(). You might want to put a note into DT saying that a previous version of the binding didn't require those supply properties, so they may be missing from older DTs.

#11 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Quoted 43 lines · Stephen Warren
Quoted 42 lines · Laurent Pinchart
Quoted 41 lines · On Monday 23 September 2013 08:18:52 Prabhakar Lad wrote:
Quoted 7 lines · Sylwester Nawrocki
Quoted 3 lines · Prabhakar Lad

OK I will, just send out a fix up patch which fixes the mismatch between names for the rc-cycle, and later send out a patch which removes the platform data usage for next release with proper DT bindings.

I think the binding need to be fully corrected now, I just meant to not touch the board file, i.e. leave non-dt support unchanged.

Ok

Quoted 29 lines
Quoted 10 lines

I'm OK with making regulator properties as optional, But still it would change the meaning of what DT is, we know that the VDD/VDD_IO .. etc pins are required properties (but still making them as optional) :-(

I think there might several devices where this situation may arise so just thinking of a alternative solution.

say we have property 'software-regulator' which takes true/false(0/1) If set to true we make the regulators as required property or else we assume it is handled and ignore it ?

I don't think this is a good idea. You would have to add a similar platform data flag for non-dt, it doesn't sound right. I can see two options here:

1. Make the regulator properties mandatory and, e.g. define a fixed voltage GPIO regulator in DT with an empty 'gpio' property. Then pass a phandle to that regulator in the adv7343 *-supply properties. For non-dt similarly a fixed voltage regulator(s) and voltage supplies would need to be defined in the board files.

2. Make the properties optional and use (devm_)regulator_get_optional() calls in the driver (a recently added function). I must admit I don't fully understand description of this function, it currently looks pretty much same as (devm_)regulator_get(). Thus the driver would need to be handling regulator supplies only when non ERR_PTR() is returned from regulator_get_optional() and otherwise assume a non critical error. There is already quite a few example occurrences of regulator_get_optional() usage.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

Thanks for pointing it I'll choose option 2 and post the patch.

Isn't regulator_get_optional() intended for devices that can have supplies unconnected in normal use ?

I believe so, yes.

Agreed

Quoted 7 lines
Quoted 6 lines

The ADV7343 supplies are mandatory from a hardware
point of view, so I think we should use regulator_get(). Otherwise the driver won't be able to tell the difference between a regulator that isn't present yet (for instance because the regulator device/driver hasn't been probed yet), which should result in deferred probing, and an always-on regulator that has been left out.

Quoted 6 lines

So I think you want to make the supply properties mandatory in DT (since some form of supply is mandatory in HW), yet make the driver support broken DTs which don't have those properties, by error-checking the return value from regulator_get(). You might want to put a note into DT saying that a previous version of the binding didn't require those supply properties, so they may be missing from older DTs.

OK, I'll fix it and repost the patch.

Regards,
--Prabhakar

#12 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

In reply to Stephen Warren
Quoted 60 lines · On Monday 23 September 2013 15:33:10 Stephen Warren wrote:
Quoted 45 lines · Laurent Pinchart
Quoted 44 lines · On Monday 23 September 2013 08:18:52 Prabhakar Lad wrote:
Quoted 8 lines · Sylwester Nawrocki
Quoted 4 lines · Prabhakar Lad

OK I will, just send out a fix up patch which fixes the mismatch between
names for the rc-cycle, and later send out a patch which removes the platform data usage for next release with proper DT bindings.

I think the binding need to be fully corrected now, I just meant to not touch the board file, i.e. leave non-dt support unchanged.

Ok

Quoted 31 lines
Quoted 10 lines

I'm OK with making regulator properties as optional, But still it would change the meaning of what DT is, we know that the VDD/VDD_IO .. etc pins are required properties (but still making them as optional) :-(

I think there might several devices where this situation may arise so just thinking of a alternative solution.

say we have property 'software-regulator' which takes true/false(0/1) If set to true we make the regulators as required property or else we assume it is handled and ignore it ?

I don't think this is a good idea. You would have to add a similar platform data flag for non-dt, it doesn't sound right. I can see two options here:

1. Make the regulator properties mandatory and, e.g. define a fixed

voltage GPIO regulator in DT with an empty 'gpio' property. Then pass a phandle to that regulator in the adv7343 *-supply properties. For non-dt similarly a fixed voltage regulator(s) and voltage supplies would need to be defined in the board files.

2. Make the properties optional and use (devm_)regulator_get_optional()

calls in the driver (a recently added function). I must admit I don't fully understand description of this function, it currently looks pretty much same as (devm_)regulator_get(). Thus the driver would need to be handling regulator supplies only when non ERR_PTR() is returned from regulator_get_optional() and otherwise assume a non critical error. There is already quite a few example occurrences of regulator_get_optional() usage.

Quoted 4 lines
Quoted 1 line

Thanks for pointing it I'll choose option 2 and post the patch.

Isn't regulator_get_optional() intended for devices that can have supplies unconnected in normal use ?

I believe so, yes.

Quoted 6 lines

The ADV7343 supplies are mandatory from a hardware
point of view, so I think we should use regulator_get(). Otherwise the driver won't be able to tell the difference between a regulator that isn't present yet (for instance because the regulator device/driver hasn't been probed yet), which should result in deferred probing, and an always-on regulator that has been left out.

Quoted 6 lines

So I think you want to make the supply properties mandatory in DT (since some form of supply is mandatory in HW), yet make the driver support broken DTs which don't have those properties, by error-checking the return value from regulator_get(). You might want to put a note into DT saying that a previous version of the binding didn't require those supply properties, so they may be missing from older DTs.

Are there such devices in the wild ?

Signature · 3 lines
Regards,

Laurent Pinchart
#13 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Quoted 9 lines · Laurent Pinchart
Quoted 6 lines · On Monday 23 September 2013 15:33:10 Stephen Warren wrote:

So I think you want to make the supply properties mandatory in DT (since some form of supply is mandatory in HW), yet make the driver support broken DTs which don't have those properties, by error-checking the return value from regulator_get(). You might want to put a note into DT saying that a previous version of the binding didn't require those supply properties, so they may be missing from older DTs.

Quoted 3 lines

Are there such devices in the wild ?

From v3.12 on the kernel will stub in a dummy supply if one isn't found

when using DT but I wouldn't mention that in the bindings since it's
very much fixing up broken DTs rather than a good idea.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130924/c9956124/attachment.sig>

#14 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

In reply to Laurent Pinchart
Quoted 7 lines · Laurent Pinchart

Isn't regulator_get_optional() intended for devices that can have supplies unconnected in normal use ? The ADV7343 supplies are mandatory from a hardware point of view, so I think we should use regulator_get(). Otherwise the driver won't be able to tell the difference between a regulator that isn't present yet (for instance because the regulator device/driver hasn't been probed yet), which should result in deferred probing, and an always-on regulator that has been left out.

Yes, everything you say here is correct.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20130924/fc1dba98/attachment-0001.sig>

#15 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

In reply to Prabhakar Lad

Hi All,

Quoted 7 lines · Prabhakar Lad

Hi Sylwester,

Quoted 3 lines · Sylwester Nawrocki

Hi Prabhakar,

On 09/20/2013 10:11 AM, Prabhakar Lad wrote:

Quoted 38 lines
Quoted 7 lines
Quoted 3 lines

OK I will, just send out a fix up patch which fixes the mismatch between names for the rc-cycle, and later send out a patch which removes the platform data usage for next release with proper DT bindings.

I think the binding need to be fully corrected now, I just meant to not touch the board file, i.e. leave non-dt support unchanged.

Ok

Quoted 29 lines
Quoted 10 lines

I'm OK with making regulator properties as optional, But still it would change the meaning of what DT is, we know that the VDD/VDD_IO .. etc pins are required properties (but still making them as optional) :-(

I think there might several devices where this situation may arise so just thinking of a alternative solution.

say we have property 'software-regulator' which takes true/false(0/1) If set to true we make the regulators as required property or else we assume it is handled and ignore it ?

I don't think this is a good idea. You would have to add a similar platform data flag for non-dt, it doesn't sound right. I can see two options here:

1. Make the regulator properties mandatory and, e.g. define a fixed voltage GPIO regulator in DT with an empty 'gpio' property. Then pass a phandle to that regulator in the adv7343 *-supply properties. For non-dt similarly a fixed voltage regulator(s) and voltage supplies would need to be defined in the board files.

2. Make the properties optional and use (devm_)regulator_get_optional() calls in the driver (a recently added function). I must admit I don't fully understand description of this function, it currently looks pretty much same as (devm_)regulator_get(). Thus the driver would need to be handling regulator supplies only when non ERR_PTR() is returned from regulator_get_optional() and otherwise assume a non critical error. There is already quite a few example occurrences of regulator_get_optional() usage.

The same question arises in case of the clock, The adv7343 encoder has two input clocks CLKIN_A and CLKIN_B. I case of da850 EVM the clock source to adv7343 encoder is fixed source which is enabled by default so none of the bridge nor the adv7343 driver cares of the clock to enable/disable.
So in this case should I be registering (v4l2_clk_register() / v4l2_clk_unregister())
a dummy clock in the bridge driver or in the board file ?

Regards,
--Prabhakar Lad

#16 lore raw

PATCH 1/1 media: i2c: adv7343: fix the DT binding properties

Hi Prabhakar,

Quoted 42 lines · On Monday 30 September 2013 18:57:01 Prabhakar Lad wrote:
Quoted 40 lines · Prabhakar Lad
Quoted 7 lines · Sylwester Nawrocki
Quoted 3 lines · Prabhakar Lad

OK I will, just send out a fix up patch which fixes the mismatch between names for the rc-cycle, and later send out a patch which removes the platform data usage for next release with proper DT bindings.

I think the binding need to be fully corrected now, I just meant to not touch the board file, i.e. leave non-dt support unchanged.

Ok

Quoted 29 lines
Quoted 10 lines

I'm OK with making regulator properties as optional, But still it would change the meaning of what DT is, we know that the VDD/VDD_IO .. etc pins are required properties (but still making them as optional) :-(

I think there might several devices where this situation may arise so just thinking of a alternative solution.

say we have property 'software-regulator' which takes true/false(0/1) If set to true we make the regulators as required property or else we assume it is handled and ignore it ?

I don't think this is a good idea. You would have to add a similar platform data flag for non-dt, it doesn't sound right. I can see two options here:

1. Make the regulator properties mandatory and, e.g. define a fixed voltage GPIO regulator in DT with an empty 'gpio' property. Then pass a phandle to that regulator in the adv7343 *-supply properties. For non-dt similarly a fixed voltage regulator(s) and voltage supplies would need to be defined in the board files.

2. Make the properties optional and use (devm_)regulator_get_optional() calls in the driver (a recently added function). I must admit I don't fully understand description of this function, it currently looks pretty much same as (devm_)regulator_get(). Thus the driver would need to be handling regulator supplies only when non ERR_PTR() is returned from regulator_get_optional() and otherwise assume a non critical error. There is already quite a few example occurrences of regulator_get_optional() usage.

Quoted 7 lines

The same question arises in case of the clock, The adv7343 encoder has two input clocks CLKIN_A and CLKIN_B. I case of da850 EVM the clock source to adv7343 encoder is fixed source which is enabled by default so none of the bridge nor the adv7343 driver cares of the clock to enable/disable. So in this case should I be registering (v4l2_clk_register() / v4l2_clk_unregister()) a dummy clock in the bridge driver or in the board file ?

The fixed clock (which is a real clock, not a dummy clock) should be registered in board file, preferably using the common clock framework if that's available on your platform.

Signature · 3 lines
Regards,

Laurent Pinchart