Skip to contentSkip to conversation

ARM: davinci: da850: add/enable video capture

PATCH Superseded Kevin Hilman 3 participants 13 messages Dec 7, 2016 – Jan 9, 2017

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

v2 cover ARM: davinci: da850: add/enable video capture

Add support for VPIF video capture using DT (partially.)

The main VPIF device, and its pin muxing are using DT, but legacy platform_data is still required for the vpif_capture driver. Passing legacy platform_data is required until the V4L2 framework, and subdevice drivers (such as the tvp514x) grow a way of selecting input and output routing (c.f. V4L2 s_routing API)

Dependencies:
- VPIF driver changes:
[PATCH v6 0/5] davinci: VPIF: add DT support
https://marc.info/?l=linux-arm-kernel&m=148113556200610

Kevin Hilman (4):
ARM: dts: davinci: da850: VPIF: add node and muxing
ARM: davinci_all_defconfig: enable video capture as modules
ARM: davinci: da8xx: add pdata-quirks, use for VPIF capture
ARM: davinci: board-da850-evm: add I2C ID for VPIF

 arch/arm/boot/dts/da850-evm.dts             |   6 ++
 arch/arm/boot/dts/da850-lcdk.dts            |   6 ++
 arch/arm/boot/dts/da850.dtsi                |  38 ++++++-
 arch/arm/configs/davinci_all_defconfig      |   6 ++
 arch/arm/mach-davinci/Makefile              |   2 +-
 arch/arm/mach-davinci/board-da850-evm.c     |   1 +
 arch/arm/mach-davinci/da8xx-dt.c            |   2 +
 arch/arm/mach-davinci/include/mach/common.h |   4 +
 arch/arm/mach-davinci/pdata-quirks.c        | 155 ++++++++++++++++++++++++++++
 9 files changed, 218 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-davinci/pdata-quirks.c
Signature · 1 line
2.9.3
#1 lore raw

PATCH v2 1/4 ARM: dts: davinci: da850: VPIF: add node and muxing

Add VPIF node an pins to da850 and enable on boards. VPIF has two input channels described using the standard DT ports and enpoints.

---
 arch/arm/boot/dts/da850-evm.dts  |  6 ++++++
 arch/arm/boot/dts/da850-lcdk.dts |  6 ++++++
 arch/arm/boot/dts/da850.dtsi     | 38 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 49 insertions(+), 1 deletion(-)
arch/arm/boot/dts/da850-evm.dts +6 -0
index 41de15fe15a2..212b50d4f84b 100644
@@ -289,3 +289,9 @@
 		};
 	};
 };
+
+&vpif {
+       pinctrl-names = "default";
+       pinctrl-0 = <&vpif_capture_pins>;
+       status = "okay";
+};
arch/arm/boot/dts/da850-lcdk.dts +6 -0
index 7b8ab21fed6c..67f846f5bb35 100644
@@ -219,3 +219,9 @@
 		};
 	};
 };
+
+&vpif {
+       pinctrl-names = "default";
+       pinctrl-0 = <&vpif_capture_pins>;
+       status = "okay";
+};
arch/arm/boot/dts/da850.dtsi +37 -1
index f79e1b91c680..dd2a13ed106e 100644
@@ -186,7 +186,18 @@
 					0xc 0x88888888 0xffffffff
 				>;
 			};
-
+			vpif_capture_pins: vpif_capture_pins {
+				pinctrl-single,bits = <
+					/* VP_DIN[2..7], VP_CLKIN1, VP_CLKIN0 */
+					0x38 0x11111111 0xffffffff
+					/* VP_DIN[10..15,0..1] */
+					0x3c 0x11111111 0xffffffff
+					/* VP_DIN[8..9] */
+					0x40 0x00000011 0x000000ff
+					/* VP_CLKIN3, VP_CLKIN2 */
+					0x4c 0x00010100 0x000f0f00
+				>;
+			};
 		};
 		edma0: edma at 0 {
 			compatible = "ti,edma3-tpcc";
@@ -399,7 +410,32 @@
 				<&edma0 0 1>;
 			dma-names = "tx", "rx";
 		};
+
+		vpif: video at 217000 {
+			compatible = "ti,da850-vpif";
+			reg = <0x217000 0x1000>;
+			interrupts = <92>;
+			status = "disabled";
+
+			/* VPIF capture: input channels */
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				vpif_ch0: endpoint at 0 {
+					  reg = <0>;
+					  bus-width = <8>;
+				};
+
+				vpif_ch1: endpoint at 1 {
+					  reg = <1>;
+					  bus-width = <8>;
+					  data-shift = <8>;
+				};
+			};
+		};
 	};
+
 	aemif: aemif at 68000000 {
 		compatible = "ti,da850-aemif";
 		#address-cells = <2>;
Signature · 1 line
2.9.3
#2 lore raw

PATCH v2 1/4 ARM: dts: davinci: da850: VPIF: add node and muxing

Hi Kevin,

Thank you for the patch.

Quoted 43 lines · On Wednesday 07 Dec 2016 11:31:34 Kevin Hilman wrote:

Add VPIF node an pins to da850 and enable on boards. VPIF has two input channels described using the standard DT ports and enpoints.

---
 arch/arm/boot/dts/da850-evm.dts  |  6 ++++++
 arch/arm/boot/dts/da850-lcdk.dts |  6 ++++++
 arch/arm/boot/dts/da850.dtsi     | 38 +++++++++++++++++++++++++++++++++++-
 3 files changed, 49 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/boot/dts/da850-evm.dts index 41de15fe15a2..212b50d4f84b 100644

arch/arm/boot/dts/da850-evm.dts +6 -0
@@ -289,3 +289,9 @@
 		};
 	};
 };
+
+&vpif {
+       pinctrl-names = "default";
+       pinctrl-0 = <&vpif_capture_pins>;
+       status = "okay";
+};
(quoted diff) +0 -0

b/arch/arm/boot/dts/da850-lcdk.dts index 7b8ab21fed6c..67f846f5bb35 100644

arch/arm/boot/dts/da850-lcdk.dts +6 -0
@@ -219,3 +219,9 @@
 		};
 	};
 };
+
+&vpif {
+       pinctrl-names = "default";
+       pinctrl-0 = <&vpif_capture_pins>;
+       status = "okay";
+};
arch/arm/boot/dts/da850.dtsi +0 -0
index f79e1b91c680..dd2a13ed106e 100644

arch/arm/boot/dts/da850.dtsi line 193

Quoted 9 lines
arch/arm/boot/dts/da850.dtsi +3 -1
@@ -186,7 +186,18 @@
 					0xc 0x88888888 0xffffffff
 
 				>;
 
 			};
-
+			vpif_capture_pins: vpif_capture_pins {
+				pinctrl-single,bits = <
+					/* VP_DIN[2..7], VP_CLKIN1, VP_CLKIN0 

*/

Quoted 28 lines
arch/arm/boot/dts/da850.dtsi +9 -0
+					0x38 0x11111111 0xffffffff
+					/* VP_DIN[10..15,0..1] */
+					0x3c 0x11111111 0xffffffff
+					/* VP_DIN[8..9] */
+					0x40 0x00000011 0x000000ff
+					/* VP_CLKIN3, VP_CLKIN2 */
+					0x4c 0x00010100 0x000f0f00
+				>;
+			};
 		};
arch/arm/boot/dts/da850.dtsi +12 -0
 		edma0: edma at 0 {
 			compatible = "ti,edma3-tpcc";
@@ -399,7 +410,32 @@
 				<&edma0 0 1>;
 			dma-names = "tx", "rx";
 		};
+
+		vpif: video at 217000 {
+			compatible = "ti,da850-vpif";
+			reg = <0x217000 0x1000>;
+			interrupts = <92>;
+			status = "disabled";
+
+			/* VPIF capture: input channels */
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+

arch/arm/boot/dts/da850.dtsi line 434

Quoted 10 lines
arch/arm/boot/dts/da850.dtsi +10 -0
+				vpif_ch0: endpoint at 0 {
+					  reg = <0>;
+					  bus-width = <8>;
+				};
+
+				vpif_ch1: endpoint at 1 {
+					  reg = <1>;
+					  bus-width = <8>;
+					  data-shift = <8>;
+				};

Given that the VPIF can also accept a single 16-bit input, I'd move the endpoints to board files.

Quoted 7 lines
arch/arm/boot/dts/da850.dtsi +3 -0
+			};
+		};
 	};
+
 	aemif: aemif at 68000000 {
 		compatible = "ti,da850-aemif";
 		#address-cells = <2>;
Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw

PATCH v2 1/4 ARM: dts: davinci: da850: VPIF: add node and muxing

Quoted 91 lines · Laurent Pinchart

Hi Kevin,

Thank you for the patch.

Quoted 43 lines · On Wednesday 07 Dec 2016 11:31:34 Kevin Hilman wrote:

Add VPIF node an pins to da850 and enable on boards. VPIF has two input channels described using the standard DT ports and enpoints.

---
 arch/arm/boot/dts/da850-evm.dts  |  6 ++++++
 arch/arm/boot/dts/da850-lcdk.dts |  6 ++++++
 arch/arm/boot/dts/da850.dtsi     | 38 +++++++++++++++++++++++++++++++++++-
 3 files changed, 49 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/boot/dts/da850-evm.dts index 41de15fe15a2..212b50d4f84b 100644

arch/arm/boot/dts/da850-evm.dts +6 -0
@@ -289,3 +289,9 @@
 		};
 	};
 };
+
+&vpif {
+       pinctrl-names = "default";
+       pinctrl-0 = <&vpif_capture_pins>;
+       status = "okay";
+};
(quoted diff) +0 -0

b/arch/arm/boot/dts/da850-lcdk.dts index 7b8ab21fed6c..67f846f5bb35 100644

arch/arm/boot/dts/da850-lcdk.dts +6 -0
@@ -219,3 +219,9 @@
 		};
 	};
 };
+
+&vpif {
+       pinctrl-names = "default";
+       pinctrl-0 = <&vpif_capture_pins>;
+       status = "okay";
+};
arch/arm/boot/dts/da850.dtsi +0 -0
index f79e1b91c680..dd2a13ed106e 100644

arch/arm/boot/dts/da850.dtsi line 193

Quoted 9 lines
arch/arm/boot/dts/da850.dtsi +3 -1
@@ -186,7 +186,18 @@
 					0xc 0x88888888 0xffffffff
 
 				>;
 
 			};
-
+			vpif_capture_pins: vpif_capture_pins {
+				pinctrl-single,bits = <
+					/* VP_DIN[2..7], VP_CLKIN1, VP_CLKIN0 

*/

Quoted 33 lines
arch/arm/boot/dts/da850.dtsi +9 -0
+					0x38 0x11111111 0xffffffff
+					/* VP_DIN[10..15,0..1] */
+					0x3c 0x11111111 0xffffffff
+					/* VP_DIN[8..9] */
+					0x40 0x00000011 0x000000ff
+					/* VP_CLKIN3, VP_CLKIN2 */
+					0x4c 0x00010100 0x000f0f00
+				>;
+			};
 		};
arch/arm/boot/dts/da850.dtsi +17 -0
 		edma0: edma at 0 {
 			compatible = "ti,edma3-tpcc";
@@ -399,7 +410,32 @@
 				<&edma0 0 1>;
 			dma-names = "tx", "rx";
 		};
+
+		vpif: video at 217000 {
+			compatible = "ti,da850-vpif";
+			reg = <0x217000 0x1000>;
+			interrupts = <92>;
+			status = "disabled";
+
+			/* VPIF capture: input channels */
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				vpif_ch0: endpoint at 0 {
+					  reg = <0>;
+					  bus-width = <8>;
+				};
+
Quoted 9 lines

arch/arm/boot/dts/da850.dtsi line 434

Quoted 5 lines
arch/arm/boot/dts/da850.dtsi +5 -0
+				vpif_ch1: endpoint at 1 {
+					  reg = <1>;
+					  bus-width = <8>;
+					  data-shift = <8>;
+				};

Given that the VPIF can also accept a single 16-bit input, I'd move the endpoints to board files.

Yes, good point. Will move them.

Kevin

#4 lore raw

PATCH v2 1/4 ARM: dts: davinci: da850: VPIF: add node and muxing

In reply to Kevin Hilman

Add VPIF node an pins to da850 and enable on boards. VPIF has two input channels described using the standard DT ports and enpoints.

---
v2 -> v2.1: moved ports from SoC .dtsi to board .dts files.

 arch/arm/boot/dts/da850-evm.dts  | 20 ++++++++++++++++++++
 arch/arm/boot/dts/da850-lcdk.dts | 13 +++++++++++++
 arch/arm/boot/dts/da850.dtsi     | 27 ++++++++++++++++++++++++++-
 3 files changed, 59 insertions(+), 1 deletion(-)
arch/arm/boot/dts/da850-evm.dts +20 -0
index 41de15fe15a2..cea36ee6fd07 100644
@@ -289,3 +289,23 @@
 		};
 	};
 };
+
+&vpif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&vpif_capture_pins>;
+	status = "okay";
+
+	/* VPIF capture port */
+	port {
+		vpif_ch0: endpoint at 0 {
+			  reg = <0>;
+			  bus-width = <8>;
+		};
+
+		vpif_ch1: endpoint at 1 {
+			  reg = <1>;
+			  bus-width = <8>;
+			  data-shift = <8>;
+		};
+	};
+};
arch/arm/boot/dts/da850-lcdk.dts +13 -0
index 7b8ab21fed6c..5fc21528e0ba 100644
@@ -219,3 +219,16 @@
 		};
 	};
 };
+
+&vpif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&vpif_capture_pins>;
+	status = "okay";
+
+	/* VPIF capture port */
+	port {
+		vpif_ch0: endpoint {
+			  bus-width = <8>;
+		};
+	};
+};
arch/arm/boot/dts/da850.dtsi +26 -1
index f79e1b91c680..5f0b40510b2b 100644
@@ -186,7 +186,18 @@
 					0xc 0x88888888 0xffffffff
 				>;
 			};
-
+			vpif_capture_pins: vpif_capture_pins {
+				pinctrl-single,bits = <
+					/* VP_DIN[2..7], VP_CLKIN1, VP_CLKIN0 */
+					0x38 0x11111111 0xffffffff
+					/* VP_DIN[10..15,0..1] */
+					0x3c 0x11111111 0xffffffff
+					/* VP_DIN[8..9] */
+					0x40 0x00000011 0x000000ff
+					/* VP_CLKIN3, VP_CLKIN2 */
+					0x4c 0x00010100 0x000f0f00
+				>;
+			};
 		};
 		edma0: edma at 0 {
 			compatible = "ti,edma3-tpcc";
@@ -399,7 +410,21 @@
 				<&edma0 0 1>;
 			dma-names = "tx", "rx";
 		};
+
+		vpif: video at 217000 {
+			compatible = "ti,da850-vpif";
+			reg = <0x217000 0x1000>;
+			interrupts = <92>;
+			status = "disabled";
+
+			/* VPIF capture port */
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+			};
+		};
 	};
+
 	aemif: aemif at 68000000 {
 		compatible = "ti,da850-aemif";
 		#address-cells = <2>;
Signature · 1 line
2.9.3
#5 lore raw

PATCH 1/4 ARM: dts: davinci: da850: VPIF: add node and muxing

Hi Kevin,

Thank you for the patch.

Quoted 4 lines · On Wednesday 07 Dec 2016 16:14:18 Kevin Hilman wrote:

Add VPIF node an pins to da850 and enable on boards. VPIF has two input channels described using the standard DT ports and enpoints.

Quoted 62 lines

---
v2 -> v2.1: moved ports from SoC .dtsi to board .dts files.

 arch/arm/boot/dts/da850-evm.dts  | 20 ++++++++++++++++++++
 arch/arm/boot/dts/da850-lcdk.dts | 13 +++++++++++++
 arch/arm/boot/dts/da850.dtsi     | 27 ++++++++++++++++++++++++++-
 3 files changed, 59 insertions(+), 1 deletion(-)
(quoted diff) +0 -0

b/arch/arm/boot/dts/da850-evm.dts index 41de15fe15a2..cea36ee6fd07 100644

arch/arm/boot/dts/da850-evm.dts +20 -0
@@ -289,3 +289,23 @@
 		};
 	};
 };
+
+&vpif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&vpif_capture_pins>;
+	status = "okay";
+
+	/* VPIF capture port */
+	port {
+		vpif_ch0: endpoint at 0 {
+			  reg = <0>;
+			  bus-width = <8>;
+		};
+
+		vpif_ch1: endpoint at 1 {
+			  reg = <1>;
+			  bus-width = <8>;
+			  data-shift = <8>;
+		};
+	};
+};
(quoted diff) +0 -0

b/arch/arm/boot/dts/da850-lcdk.dts index 7b8ab21fed6c..5fc21528e0ba 100644

arch/arm/boot/dts/da850-lcdk.dts +13 -0
@@ -219,3 +219,16 @@
 		};
 	};
 };
+
+&vpif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&vpif_capture_pins>;
+	status = "okay";
+
+	/* VPIF capture port */
+	port {
+		vpif_ch0: endpoint {
+			  bus-width = <8>;
+		};
+	};
+};
arch/arm/boot/dts/da850.dtsi +0 -0
index f79e1b91c680..5f0b40510b2b 100644

arch/arm/boot/dts/da850.dtsi line 193

Quoted 9 lines
arch/arm/boot/dts/da850.dtsi +3 -1
@@ -186,7 +186,18 @@
 					0xc 0x88888888 0xffffffff
 
 				>;
 
 			};
-
+			vpif_capture_pins: vpif_capture_pins {
+				pinctrl-single,bits = <
+					/* VP_DIN[2..7], VP_CLKIN1, VP_CLKIN0 

*/

Quoted 34 lines
arch/arm/boot/dts/da850.dtsi +9 -0
+					0x38 0x11111111 0xffffffff
+					/* VP_DIN[10..15,0..1] */
+					0x3c 0x11111111 0xffffffff
+					/* VP_DIN[8..9] */
+					0x40 0x00000011 0x000000ff
+					/* VP_CLKIN3, VP_CLKIN2 */
+					0x4c 0x00010100 0x000f0f00
+				>;
+			};
 		};
arch/arm/boot/dts/da850.dtsi +14 -0
 		edma0: edma at 0 {
 			compatible = "ti,edma3-tpcc";
@@ -399,7 +410,21 @@
 				<&edma0 0 1>;
 			dma-names = "tx", "rx";
 		};
+
+		vpif: video at 217000 {
+			compatible = "ti,da850-vpif";
+			reg = <0x217000 0x1000>;
+			interrupts = <92>;
+			status = "disabled";
+
+			/* VPIF capture port */
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+			};
+		};
 	};
+
 	aemif: aemif at 68000000 {
 		compatible = "ti,da850-aemif";
 		#address-cells = <2>;
Signature · 3 lines
Regards,

Laurent Pinchart
#6 lore raw

PATCH 1/4 ARM: dts: davinci: da850: VPIF: add node and muxing

In reply to Kevin Hilman

Hi Kevin,

Quoted 11 lines · Kevin Hilman

Add VPIF node an pins to da850 and enable on boards. VPIF has two input channels described using the standard DT ports and enpoints.

---
v2 -> v2.1: moved ports from SoC .dtsi to board .dts files.

 arch/arm/boot/dts/da850-evm.dts  | 20 ++++++++++++++++++++
 arch/arm/boot/dts/da850-lcdk.dts | 13 +++++++++++++
 arch/arm/boot/dts/da850.dtsi     | 27 ++++++++++++++++++++++++++-
 3 files changed, 59 insertions(+), 1 deletion(-)

Can you split this patch to keep the SoC addition separate from board updates. Separating support addition for EVM and LCDK will be good also.

Quoted 12 lines
arch/arm/boot/dts/da850.dtsi +3 -0
index f79e1b91c680..5f0b40510b2b 100644
@@ -399,7 +410,21 @@
 				<&edma0 0 1>;
 			dma-names = "tx", "rx";
 		};
+
+		vpif: video at 217000 {
+			compatible = "ti,da850-vpif";

arch/arm/boot/dts/da850.dtsi line 425

Quoted 10 lines
arch/arm/boot/dts/da850.dtsi +10 -0
+			reg = <0x217000 0x1000>;
+			interrupts = <92>;
+			status = "disabled";
+
+			/* VPIF capture port */
+			port {
+				#address-cells = <1>;
+				#size-cells = <0>;
+			};
+		};

Can you add this node just above mmc1? I am trying to keep the nodes sorted in the order of unit address instead of new ones getting added at the end. Unfortunately, it was not strictly enforced and we have many breakages. But lets add the new ones where they will eventually end up.

Thanks,
Sekhar

#7 lore raw

PATCH v2 1/4 ARM: dts: davinci: da850: VPIF: add node and muxing

Quoted 10 lines · Sekhar Nori

Hi Kevin,

Quoted 7 lines · Kevin Hilman

Add VPIF node an pins to da850 and enable on boards. VPIF has two input channels described using the standard DT ports and enpoints.

---
v2 -> v2.1: moved ports from SoC .dtsi to board .dts files.

Quoted 7 lines
Quoted 4 lines
 arch/arm/boot/dts/da850-evm.dts  | 20 ++++++++++++++++++++
 arch/arm/boot/dts/da850-lcdk.dts | 13 +++++++++++++
 arch/arm/boot/dts/da850.dtsi     | 27 ++++++++++++++++++++++++++-
 3 files changed, 59 insertions(+), 1 deletion(-)

Can you split this patch to keep the SoC addition separate from board updates. Separating support addition for EVM and LCDK will be good also.

I don't understand why that matters, but OK.

Quoted 19 lines
Quoted 19 lines
arch/arm/boot/dts/da850.dtsi +10 -0
index f79e1b91c680..5f0b40510b2b 100644
@@ -399,7 +410,21 @@
 				<&edma0 0 1>;
 			dma-names = "tx", "rx";
 		};
+
+		vpif: video at 217000 {
+			compatible = "ti,da850-vpif";
+			reg = <0x217000 0x1000>;
+			interrupts = <92>;
+			status = "disabled";
+
+			/* VPIF capture port */
+			port {
+				#address-cells = <1>;
Quoted 8 lines

arch/arm/boot/dts/da850.dtsi line 425

Quoted 3 lines
arch/arm/boot/dts/da850.dtsi +3 -0
+				#size-cells = <0>;
+			};
+		};

Can you add this node just above mmc1? I am trying to keep the nodes sorted in the order of unit address instead of new ones getting added at the end. Unfortunately, it was not strictly enforced and we have many breakages. But lets add the new ones where they will eventually end up.

OK.

Kevin

#8 lore raw

PATCH v2 2/4 ARM: davinci_all_defconfig: enable video capture as modules

In reply to Kevin Hilman

Enable media support and V4L2 capture, along with video decoders used on da850 platforms.

Tested on da850-lcdk.

---
 arch/arm/configs/davinci_all_defconfig | 6 ++++++
 1 file changed, 6 insertions(+)
arch/arm/configs/davinci_all_defconfig +6 -0
index 5e5dd6bc5ed9..fd05bc35fb36 100644
@@ -123,6 +123,12 @@ CONFIG_TPS6507X=y
 CONFIG_REGULATOR=y
 CONFIG_REGULATOR_FIXED_VOLTAGE=y
 CONFIG_REGULATOR_TPS6507X=y
+CONFIG_MEDIA_SUPPORT=m
+CONFIG_MEDIA_CAMERA_SUPPORT=y
+CONFIG_V4L_PLATFORM_DRIVERS=y
+CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE=m
+# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set
+CONFIG_VIDEO_TVP514X=m
 CONFIG_FB=y
 CONFIG_FIRMWARE_EDID=y
 CONFIG_FB_DA8XX=y
Signature · 1 line
2.9.3
Applied
#9 lore raw

PATCH v2 2/4 ARM: davinci_all_defconfig: enable video capture as modules

Quoted 6 lines · Kevin Hilman

Enable media support and V4L2 capture, along with video decoders used on da850 platforms.

Tested on da850-lcdk.

Applied to v4.11/defconfig

Thanks,
Sekhar

#10 lore raw

PATCH v2 3/4 ARM: davinci: da8xx: add pdata-quirks, use for VPIF capture

In reply to Kevin Hilman

Add pdata-quirks for da8xx DT platforms, which adds the legacy platform data for vpif_capture driver.

Passing legacy platform_data is required until the V4L2 framework, and subdevice drivers (such as the tvp514x) grow a way of selecting input and output routing (c.f. V4L2 s_routing API)

---
 arch/arm/mach-davinci/Makefile              |   2 +-
 arch/arm/mach-davinci/da8xx-dt.c            |   2 +
 arch/arm/mach-davinci/include/mach/common.h |   4 +
 arch/arm/mach-davinci/pdata-quirks.c        | 155 ++++++++++++++++++++++++++++
 4 files changed, 162 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-davinci/pdata-quirks.c
arch/arm/mach-davinci/Makefile +1 -1
index da4c336b4637..90d2e6e4d913 100644
@@ -21,7 +21,7 @@ obj-$(CONFIG_AINTC)			+= irq.o
 obj-$(CONFIG_CP_INTC)			+= cp_intc.o
 
 # Board specific
-obj-$(CONFIG_MACH_DA8XX_DT)		+= da8xx-dt.o
+obj-$(CONFIG_MACH_DA8XX_DT)		+= da8xx-dt.o pdata-quirks.o
 obj-$(CONFIG_MACH_DAVINCI_EVM)  	+= board-dm644x-evm.o
 obj-$(CONFIG_MACH_SFFSDR)		+= board-sffsdr.o
 obj-$(CONFIG_MACH_NEUROS_OSD2)		+= board-neuros-osd2.o
arch/arm/mach-davinci/da8xx-dt.c +2 -0
index c9f7e9274aa8..69c8099de9f5 100644
@@ -38,6 +38,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 		       NULL),
 	OF_DEV_AUXDATA("ti,da830-mcasp-audio", 0x01d00000, "davinci-mcasp.0", NULL),
 	OF_DEV_AUXDATA("ti,da850-aemif", 0x68000000, "ti-aemif", NULL),
+	OF_DEV_AUXDATA("ti,da850-vpif", 0x01e17000, "vpif", NULL),
 	{}
 };
 
@@ -46,6 +47,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 static void __init da850_init_machine(void)
 {
 	of_platform_default_populate(NULL, da850_auxdata_lookup, NULL);
+	pdata_quirks_init();
 }
 
 static const char *const da850_boards_compat[] __initconst = {
arch/arm/mach-davinci/include/mach/common.h +4 -0
index 0b3c169758ed..1fd4cd2d1c23 100644
@@ -102,6 +102,10 @@ int davinci_pm_init(void);
 static inline int davinci_pm_init(void) { return 0; }
 #endif
 
+#ifdef CONFIG_MACH_DA8XX_DT
+extern void __init pdata_quirks_init(void);
+#endif
+
 #define SRAM_SIZE	SZ_128K
 
 #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
arch/arm/mach-davinci/pdata-quirks.c new file +155 -0

155 lines not on this page · raw message

Signature · 1 line
2.9.3
#11 lore raw

PATCH v2 3/4 ARM: davinci: da8xx: add pdata-quirks, use for VPIF capture

Hi Kevin,

Quoted 7 lines · Kevin Hilman

Add pdata-quirks for da8xx DT platforms, which adds the legacy platform data for vpif_capture driver.

Passing legacy platform_data is required until the V4L2 framework, and subdevice drivers (such as the tvp514x) grow a way of selecting input and output routing (c.f. V4L2 s_routing API)

Quoted 8 lines
---
 arch/arm/mach-davinci/Makefile              |   2 +-
 arch/arm/mach-davinci/da8xx-dt.c            |   2 +
 arch/arm/mach-davinci/include/mach/common.h |   4 +
 arch/arm/mach-davinci/pdata-quirks.c        | 155 ++++++++++++++++++++++++++++
 4 files changed, 162 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-davinci/pdata-quirks.c

Can you please split this to separate addition of pdata quirks from adding vpif capture support. I think it is fine to have a pre-patch adding support for pdata quirks with just the sentinel included.

Quoted 39 lines
arch/arm/mach-davinci/Makefile +1 -1
index da4c336b4637..90d2e6e4d913 100644
@@ -21,7 +21,7 @@ obj-$(CONFIG_AINTC)			+= irq.o
 obj-$(CONFIG_CP_INTC)			+= cp_intc.o
 
 # Board specific
-obj-$(CONFIG_MACH_DA8XX_DT)		+= da8xx-dt.o
+obj-$(CONFIG_MACH_DA8XX_DT)		+= da8xx-dt.o pdata-quirks.o
 obj-$(CONFIG_MACH_DAVINCI_EVM)  	+= board-dm644x-evm.o
 obj-$(CONFIG_MACH_SFFSDR)		+= board-sffsdr.o
 obj-$(CONFIG_MACH_NEUROS_OSD2)		+= board-neuros-osd2.o
arch/arm/mach-davinci/da8xx-dt.c +2 -0
index c9f7e9274aa8..69c8099de9f5 100644
@@ -38,6 +38,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 		       NULL),
 	OF_DEV_AUXDATA("ti,da830-mcasp-audio", 0x01d00000, "davinci-mcasp.0", NULL),
 	OF_DEV_AUXDATA("ti,da850-aemif", 0x68000000, "ti-aemif", NULL),
+	OF_DEV_AUXDATA("ti,da850-vpif", 0x01e17000, "vpif", NULL),
 	{}
 };
 
@@ -46,6 +47,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 static void __init da850_init_machine(void)
 {
 	of_platform_default_populate(NULL, da850_auxdata_lookup, NULL);
+	pdata_quirks_init();
 }
 
 static const char *const da850_boards_compat[] __initconst = {
arch/arm/mach-davinci/include/mach/common.h +0 -0
index 0b3c169758ed..1fd4cd2d1c23 100644

arch/arm/mach-davinci/include/mach/common.h int davinci_pm_init(void); · line 106

Quoted 5 lines
arch/arm/mach-davinci/include/mach/common.h +2 -0
@@ -102,6 +102,10 @@ int davinci_pm_init(void);
 static inline int davinci_pm_init(void) { return 0; }
 #endif
 
+#ifdef CONFIG_MACH_DA8XX_DT
+extern void __init pdata_quirks_init(void);

I noticed that checkpatch complains about the extern (with strict warnings turned on). I think its better to drop it. I know you probably added it to be consistent with other declarations in the file.

Quoted 18 lines
arch/arm/mach-davinci/include/mach/common.h +2 -0
+#endif
+
 #define SRAM_SIZE	SZ_128K
 
 #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
arch/arm/mach-davinci/pdata-quirks.c new file +7 -0
new file mode 100644
index 000000000000..a186513edf7e
@@ -0,0 +1,155 @@
+/*
+ * Legacy platform_data quirks
+ *
+ * Copyright (C) 2016 BayLibre, Inc
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as

arch/arm/mach-davinci/pdata-quirks.c line 17

Quoted 10 lines
arch/arm/mach-davinci/pdata-quirks.c new file +10 -0
+ * published by the Free Software Foundation.
+ */
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+
+#include <media/i2c/tvp514x.h>
+
+#include <mach/common.h>
+#include <mach/da8xx.h>
+#include <mach/mux.h>

The mux.h include can be dropped after you dropped the muxing from this patch.

Quoted 103 lines
arch/arm/mach-davinci/pdata-quirks.c new file +103 -0
+
+struct pdata_init {
+	const char *compatible;
+	void (*fn)(void);
+};
+
+#if IS_ENABLED(CONFIG_VIDEO_DAVINCI_VPIF_CAPTURE)
+
+#define TVP5147_CH0		"tvp514x-0"
+#define TVP5147_CH1		"tvp514x-1"
+
+/* VPIF capture configuration */
+static struct tvp514x_platform_data tvp5146_pdata = {
+		.clk_polarity = 0,
+		.hs_polarity  = 1,
+		.vs_polarity  = 1,
+};
+
+#define TVP514X_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)
+
+static const struct vpif_input da850_ch0_inputs[] = {
+	{
+		.input = {
+			.index = 0,
+			.name  = "Composite",
+			.type  = V4L2_INPUT_TYPE_CAMERA,
+			.capabilities = V4L2_IN_CAP_STD,
+			.std   = TVP514X_STD_ALL,
+		},
+		.input_route = INPUT_CVBS_VI2B,
+		.output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
+		.subdev_name = TVP5147_CH0,
+	},
+};
+
+static const struct vpif_input da850_ch1_inputs[] = {
+	{
+		.input = {
+			.index = 0,
+			.name  = "S-Video",
+			.type  = V4L2_INPUT_TYPE_CAMERA,
+			.capabilities = V4L2_IN_CAP_STD,
+			.std   = TVP514X_STD_ALL,
+		},
+		.input_route = INPUT_SVIDEO_VI2C_VI1C,
+		.output_route = OUTPUT_10BIT_422_EMBEDDED_SYNC,
+		.subdev_name = TVP5147_CH1,
+	},
+};
+
+static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
+	{
+		.name = TVP5147_CH0,
+		.board_info = {
+			I2C_BOARD_INFO("tvp5146", 0x5d),
+			.platform_data = &tvp5146_pdata,
+		},
+	},
+	{
+		.name = TVP5147_CH1,
+		.board_info = {
+			I2C_BOARD_INFO("tvp5146", 0x5c),
+			.platform_data = &tvp5146_pdata,
+		},
+	},
+};
+
+static struct vpif_capture_config da850_vpif_capture_config = {
+	.subdev_info = da850_vpif_capture_sdev_info,
+	.subdev_count = ARRAY_SIZE(da850_vpif_capture_sdev_info),
+	.chan_config[0] = {
+		.inputs = da850_ch0_inputs,
+		.input_count = ARRAY_SIZE(da850_ch0_inputs),
+		.vpif_if = {
+			.if_type = VPIF_IF_BT656,
+			.hd_pol  = 1,
+			.vd_pol  = 1,
+			.fid_pol = 0,
+		},
+	},
+	.chan_config[1] = {
+		.inputs = da850_ch1_inputs,
+		.input_count = ARRAY_SIZE(da850_ch1_inputs),
+		.vpif_if = {
+			.if_type = VPIF_IF_BT656,
+			.hd_pol  = 1,
+			.vd_pol  = 1,
+			.fid_pol = 0,
+		},
+	},
+	.card_name = "DA850/OMAP-L138 Video Capture",
+};
+
+static void __init da850_vpif_legacy_init(void)
+{
+	int ret;
+	
+	/* LCDK doesn't have the 2nd TVP514x on CH1 */
+	if (of_machine_is_compatible("ti,da850-lcdk"))
+		da850_vpif_capture_config.subdev_count = 1;
+
+	/* EVM (UI card) uses i2c adapter 1 (not default: zero) */
+	if (of_machine_is_compatible("ti,da850-evm"))

arch/arm/mach-davinci/pdata-quirks.c line 130

Quoted 10 lines
arch/arm/mach-davinci/pdata-quirks.c new file +10 -0
+		da850_vpif_capture_config.i2c_adapter_id = 1;
+
+	ret = da850_register_vpif_capture(&da850_vpif_capture_config);
+	if (ret)
+		pr_warn("%s: VPIF capture setup failed: %d\n",
+			__func__, ret);
+}
+#endif
+
+static void pdata_quirks_check(struct pdata_init *quirks)

This function can be marked __init too.

Thanks,
Sekhar

#12 lore raw

PATCH v2 4/4 ARM: davinci: board-da850-evm: add I2C ID for VPIF

In reply to Kevin Hilman

VPIF capture driver now has a way to specific I2C adapter ID (was previously hard-coded.) Use the new interface.

---
 arch/arm/mach-davinci/board-da850-evm.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mach-davinci/board-da850-evm.c +1 -0
index 8e4539f69fdc..60f15f276ab7 100644
@@ -1229,6 +1229,7 @@ static struct vpif_subdev_info da850_vpif_capture_sdev_info[] = {
 static struct vpif_capture_config da850_vpif_capture_config = {
 	.subdev_info = da850_vpif_capture_sdev_info,
 	.subdev_count = ARRAY_SIZE(da850_vpif_capture_sdev_info),
+	.i2c_adapter_id = 1,
 	.chan_config[0] = {
 		.inputs = da850_ch0_inputs,
 		.input_count = ARRAY_SIZE(da850_ch0_inputs),
Signature · 1 line
2.9.3