Skip to contentSkip to conversation

ARM: davinci: da850: add/enable video capture

PATCH New Kevin Hilman 2 participants 14 messages Jan 9, 2017 – Jan 10, 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

Changes since v1:
- split DT patches into separate SoC and board patches
- split pdata-quirks into base/skeleton driver and da8xx

Kevin Hilman (6):
ARM: dts: davinci: da850: VPIF: add node and muxing
ARM: dts: davinci: da850-evm: enable VPIF
ARM: dts: davinci: da850-lcdk: enable VPIF
ARM: davinci: add skeleton for pdata-quirks
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             |  20 ++++
 arch/arm/boot/dts/da850-lcdk.dts            |  13 +++
 arch/arm/boot/dts/da850.dtsi                |  26 ++++-
 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 |   2 +
 arch/arm/mach-davinci/pdata-quirks.c        | 154 ++++++++++++++++++++++++++++
 8 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/6 ARM: dts: davinci: da850: VPIF: add node and muxing

Add VPIF node an pins to da850 SoC. VPIF has two input channels which can be described using the standard DT ports and enpoints.

---
 arch/arm/boot/dts/da850.dtsi | 26 +++++++++++++++++++++++++-
 1 file changed, 25 insertions(+), 1 deletion(-)
arch/arm/boot/dts/da850.dtsi +25 -1
index 104155d12c2f..edab8bb92ec5 100644
@@ -208,7 +208,18 @@
 					0x4c 0x02000022 0x0f0000ff
 				>;
 			};
-
+			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
+				>;
+			};
 		};
 		prictrl: priority-controller at 14110 {
 			compatible = "ti,da850-mstpri";
@@ -324,6 +335,18 @@
 			dma-names = "rx", "tx";
 			status = "disabled";
 		};
+		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>;
+			};
+		};
 		mmc1: mmc at 21b000 {
 			compatible = "ti,da830-mmc";
 			reg = <0x21b000 0x1000>;
@@ -465,6 +488,7 @@
 			status = "disabled";
 		};
 	};
+
 	aemif: aemif at 68000000 {
 		compatible = "ti,da850-aemif";
 		#address-cells = <2>;
Signature · 1 line
2.9.3
#2 lore raw

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

Quoted 1 line · Kevin Hilman

Add VPIF node an pins to da850 SoC. VPIF has two input channels which

s/an/and

Quoted 1 line

can be described using the standard DT ports and enpoints.

s/enpoints/endpoints

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

Quoted 8 lines
arch/arm/boot/dts/da850.dtsi +1 -0
@@ -465,6 +488,7 @@
 			status = "disabled";
 		};
 	};
+

This seems like a stray newline addition. I dropped it while applying to v4.11/dt

Thanks,
Sekhar

Quoted 4 lines
arch/arm/boot/dts/da850.dtsi +0 -0
 	aemif: aemif at 68000000 {
 		compatible = "ti,da850-aemif";
 		#address-cells = <2>;
#3 lore raw

PATCH v2 2/6 ARM: dts: davinci: da850-evm: enable VPIF

In reply to Kevin Hilman

Enable VPIF node for video capture, and configure ports. EVM board uses channel 0 for composite input and channel 1 S-Video input.

---
 arch/arm/boot/dts/da850-evm.dts | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)
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>;
+		};
+	};
+};
Signature · 1 line
2.9.3
Applied
#4 lore raw

PATCH v2 2/6 ARM: dts: davinci: da850-evm: enable VPIF

Quoted 4 lines · Kevin Hilman

Enable VPIF node for video capture, and configure ports. EVM board uses channel 0 for composite input and channel 1 S-Video input.

Applied to v4.11/dt

Thanks,
Sekhar

#5 lore raw

PATCH v2 3/6 ARM: dts: davinci: da850-lcdk: enable VPIF

In reply to Kevin Hilman

Enable VPIF for video captpure and configure input channel 0, used for composite input.

---
 arch/arm/boot/dts/da850-lcdk.dts | 13 +++++++++++++
 1 file changed, 13 insertions(+)
arch/arm/boot/dts/da850-lcdk.dts +13 -0
index afcb4821deb1..9b1f3695607c 100644
@@ -236,3 +236,16 @@
 &memctrl {
 	status = "okay";
 };
+
+&vpif {
+	pinctrl-names = "default";
+	pinctrl-0 = <&vpif_capture_pins>;
+	status = "okay";
+
+	/* VPIF capture port */
+	port {
+		vpif_ch0: endpoint {
+			  bus-width = <8>;
+		};
+	};
+};
Signature · 1 line
2.9.3
Applied
#6 lore raw

PATCH v2 3/6 ARM: dts: davinci: da850-lcdk: enable VPIF

Quoted 4 lines · Kevin Hilman

Enable VPIF for video captpure and configure input channel 0, used for composite input.

Applied to v4.11/dt

Thanks,
Sekhar

#7 lore raw

PATCH v2 4/6 ARM: davinci: add skeleton for pdata-quirks

In reply to Kevin Hilman

Add skeleton pdata-quirks for for davinci.

---
 arch/arm/mach-davinci/include/mach/common.h |  2 ++
 arch/arm/mach-davinci/pdata-quirks.c        | 39 +++++++++++++++++++++++++++++
 2 files changed, 41 insertions(+)
 create mode 100644 arch/arm/mach-davinci/pdata-quirks.c
arch/arm/mach-davinci/include/mach/common.h +2 -0
index 0b3c169758ed..037aa66bcac1 100644
@@ -102,6 +102,8 @@ int davinci_pm_init(void);
 static inline int davinci_pm_init(void) { return 0; }
 #endif
 
+void __init pdata_quirks_init(void);
+
 #define SRAM_SIZE	SZ_128K
 
 #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
arch/arm/mach-davinci/pdata-quirks.c new file +39 -0
new file mode 100644
index 000000000000..5b57da475065
@@ -0,0 +1,39 @@
+/*
+ * 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
+ * published by the Free Software Foundation.
+ */
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+
+#include <mach/common.h>
+
+struct pdata_init {
+	const char *compatible;
+	void (*fn)(void);
+};
+
+static void pdata_quirks_check(struct pdata_init *quirks)
+{
+	while (quirks->compatible) {
+		if (of_machine_is_compatible(quirks->compatible)) {
+			if (quirks->fn)
+				quirks->fn();
+			break;
+		}
+		quirks++;
+	}
+}
+
+static struct pdata_init pdata_quirks[] __initdata = {
+	{ /* sentinel */ },
+};
+
+void __init pdata_quirks_init(void)
+{
+	pdata_quirks_check(pdata_quirks);
+}
Signature · 1 line
2.9.3
Applied
#8 lore raw

PATCH v2 4/6 ARM: davinci: add skeleton for pdata-quirks

Quoted 1 line · Kevin Hilman

Add skeleton pdata-quirks for for davinci.

s/for for/for

Quoted 2 lines

Applied to v4.11/soc

Thanks,
Sekhar

#9 lore raw

PATCH v2 4/6 ARM: davinci: add skeleton for pdata-quirks

Quoted 9 lines · Sekhar Nori
Quoted 1 line · Kevin Hilman

Add skeleton pdata-quirks for for davinci.

s/for for/for

Quoted 2 lines

Applied to v4.11/soc

After reviewing 5/6, I think some parts of that patch should actually be part of basic pdata-quirks support addition. I have moved them here. Here is the updated patch. Let me know if it looks fine.

Thanks,
Sekhar

---8<---

Author:     Kevin Hilman <[email protected]>
AuthorDate: Mon Jan 9 12:55:29 2017 -0800
Commit:     Sekhar Nori <[email protected]>
CommitDate: Tue Jan 10 16:12:22 2017 +0530

ARM: davinci: add skeleton for pdata-quirks

Add skeleton pdata-quirks for davinci.

[nsekhar at ti.com: move changes to build pdata-quirks.c and call
to pdata_quirks_init() to this patch]

arch/arm/mach-davinci/Makefile +1 -1
index 0a2e6da45f28..df96ca9eab6d 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 +1 -0
index 9ee44da6eb7b..d2be1941a687 100644
@@ -62,6 +62,7 @@ static void __init da850_init_machine(void)
 
 	of_platform_default_populate(NULL, da850_auxdata_lookup, NULL);
 	davinci_pm_init();
+	pdata_quirks_init();
 }
 
 static const char *const da850_boards_compat[] __initconst = {
arch/arm/mach-davinci/include/mach/common.h +2 -0
index 0b3c169758ed..037aa66bcac1 100644
@@ -102,6 +102,8 @@ int davinci_pm_init(void);
 static inline int davinci_pm_init(void) { return 0; }
 #endif
 
+void __init pdata_quirks_init(void);
+
 #define SRAM_SIZE	SZ_128K
 
 #endif /* __ARCH_ARM_MACH_DAVINCI_COMMON_H */
arch/arm/mach-davinci/pdata-quirks.c new file +39 -0
new file mode 100644
index 000000000000..5b57da475065
@@ -0,0 +1,39 @@
+/*
+ * 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
+ * published by the Free Software Foundation.
+ */
+#include <linux/kernel.h>
+#include <linux/of_platform.h>
+
+#include <mach/common.h>
+
+struct pdata_init {
+	const char *compatible;
+	void (*fn)(void);
+};
+
+static void pdata_quirks_check(struct pdata_init *quirks)
+{
+	while (quirks->compatible) {
+		if (of_machine_is_compatible(quirks->compatible)) {
+			if (quirks->fn)
+				quirks->fn();
+			break;
+		}
+		quirks++;
+	}
+}
+
+static struct pdata_init pdata_quirks[] __initdata = {
+	{ /* sentinel */ },
+};
+
+void __init pdata_quirks_init(void)
+{
+	pdata_quirks_check(pdata_quirks);
+}
#10 lore raw

PATCH v2 4/6 ARM: davinci: add skeleton for pdata-quirks

Quoted 7 lines · Sekhar Nori
Quoted 6 lines · Sekhar Nori
Quoted 1 line · Kevin Hilman

Add skeleton pdata-quirks for for davinci.

s/for for/for

Quoted 1 line
Quoted 7 lines
Quoted 3 lines
Quoted 1 line

Applied to v4.11/soc

After reviewing 5/6, I think some parts of that patch should actually be part of basic pdata-quirks support addition. I have moved them here. Here is the updated patch. Let me know if it looks fine.

It looks fine. I hesitated with that part, but I'm OK either way.

Kevin

#11 lore raw

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

In reply to Kevin Hilman

For da8xx DT platforms, use pdata-quirks to add 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/pdata-quirks.c | 115 +++++++++++++++++++++++++++++++++++
 3 files changed, 118 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/Makefile +1 -1
index 0a2e6da45f28..df96ca9eab6d 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 9ee44da6eb7b..fe4a9e30d937 100644
@@ -42,6 +42,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci-da8xx", NULL),
 	OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL),
 	OF_DEV_AUXDATA("ti,da830-usb-phy", 0x01c1417c, "da8xx-usb-phy", NULL),
+	OF_DEV_AUXDATA("ti,da850-vpif", 0x01e17000, "vpif", NULL),
 	{}
 };
 
@@ -62,6 +63,7 @@ static void __init da850_init_machine(void)
 
 	of_platform_default_populate(NULL, da850_auxdata_lookup, NULL);
 	davinci_pm_init();
+	pdata_quirks_init();
 }
 
 static const char *const da850_boards_compat[] __initconst = {
arch/arm/mach-davinci/pdata-quirks.c +115 -0

134 lines not on this page · raw message

Signature · 1 line
2.9.3
#12 lore raw

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

Quoted 19 lines · Kevin Hilman

For da8xx DT platforms, use pdata-quirks to add 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/pdata-quirks.c | 115 +++++++++++++++++++++++++++++++++++
 3 files changed, 118 insertions(+), 1 deletion(-)
arch/arm/mach-davinci/Makefile +0 -0
index 0a2e6da45f28..df96ca9eab6d 100644

arch/arm/mach-davinci/Makefile obj-$(CONFIG_AINTC) += irq.o · line 24

Quoted 5 lines
arch/arm/mach-davinci/Makefile +1 -1
@@ -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

This should be done in 4/6 along with addition of pdata-quirks.c

Quoted 16 lines
arch/arm/mach-davinci/Makefile +0 -0
 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 +1 -0
index 9ee44da6eb7b..fe4a9e30d937 100644
@@ -42,6 +42,7 @@ static struct of_dev_auxdata da850_auxdata_lookup[] __initdata = {
 	OF_DEV_AUXDATA("ti,da830-ohci", 0x01e25000, "ohci-da8xx", NULL),
 	OF_DEV_AUXDATA("ti,da830-musb", 0x01e00000, "musb-da8xx", NULL),
 	OF_DEV_AUXDATA("ti,da830-usb-phy", 0x01c1417c, "da8xx-usb-phy", NULL),
+	OF_DEV_AUXDATA("ti,da850-vpif", 0x01e17000, "vpif", NULL),
 	{}
 };
 

arch/arm/mach-davinci/da8xx-dt.c static void __init da850_init_machine(void) · line 66

Quoted 4 lines
arch/arm/mach-davinci/da8xx-dt.c +1 -0
@@ -62,6 +63,7 @@ static void __init da850_init_machine(void)
 
 	of_platform_default_populate(NULL, da850_auxdata_lookup, NULL);
 	davinci_pm_init();
+	pdata_quirks_init();

This too belongs to 4/6.

Rest of the patch looks good to me. But I cannot apply it until I get a branch from Mauro with driver changes hosted.

Thanks,
Sekhar

#13 lore raw

PATCH v2 6/6 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 aac3ab1a044f..e5d4ded38d12 100644
@@ -1212,6 +1212,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