ARM: davinci: da850: add/enable video capture
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
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
@@ -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
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
Signed-off-by Kevin Hilman <[email protected]>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
-0aemif: aemif at 68000000 { compatible = "ti,da850-aemif"; #address-cells = <2>;
PATCH v2 2/6 ARM: dts: davinci: da850-evm: enable VPIF
In reply to Kevin HilmanEnable 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
@@ -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
Sekhar Nori
AppliedPATCH 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.
Signed-off-by Kevin Hilman <[email protected]>
Applied to v4.11/dt
Thanks,
Sekhar
PATCH v2 3/6 ARM: dts: davinci: da850-lcdk: enable VPIF
In reply to Kevin HilmanEnable 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
@@ -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
Sekhar Nori
AppliedPATCH 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.
Signed-off-by Kevin Hilman <[email protected]>
Applied to v4.11/dt
Thanks,
Sekhar
PATCH v2 4/6 ARM: davinci: add skeleton for pdata-quirks
In reply to Kevin HilmanAdd 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
@@ -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
@@ -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
Sekhar Nori
AppliedPATCH 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
Signed-off-by Kevin Hilman <[email protected]>
Applied to v4.11/soc
Thanks,
Sekhar
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
Signed-off-by Kevin Hilman <[email protected]>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
@@ -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
@@ -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
@@ -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
@@ -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); +}
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
Signed-off-by Kevin Hilman <[email protected]>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
PATCH v2 5/6 ARM: davinci: da8xx: add pdata-quirks, use for VPIF capture
In reply to Kevin HilmanFor 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
@@ -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
@@ -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
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_capturedriver.Passing legacy
platform_datais required until the V4L2 framework, and subdevice drivers (such as the tvp514x) grow a way of selecting input and output routing (c.f. V4L2s_routingAPI)Signed-off-by Kevin Hilman <[email protected]>--- 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
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
-0obj-$(CONFIG_MACH_DAVINCI_EVM) += board-dm644x-evm.o obj-$(CONFIG_MACH_SFFSDR) += board-sffsdr.o obj-$(CONFIG_MACH_NEUROS_OSD2) += board-neuros-osd2.oarch/arm/mach-davinci/da8xx-dt.c +1
-0@@ -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
PATCH v2 6/6 ARM: davinci: board-da850-evm: add I2C ID for VPIF
In reply to Kevin HilmanVPIF 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
@@ -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