i.MX Media Driver
Subsystems (7)
Steve Longerbeam
maintainerv2 cover i.MX Media Driver
In version 2 (no functional changes):
- removed patch "gpio: pca953x: Add optional reset gpio control", it has been submitted separately.
- fixed some whitespace errors.
- added a few missing Signed-off-by's.
Philipp Zabel (2):
ARM: dts: imx6qdl: Add mipi_ipu1/2 multiplexers, mipi_csi, and their
connections
media: imx: Add video switch subdev driver
Steve Longerbeam (17):
ARM: dts: imx6qdl: Add compatible, clocks, irqs to MIPI CSI-2 node
ARM: dts: imx6qdl: add media device
ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors
ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors
ARM: dts: imx6-sabreauto: create i2cmux for i2c3
ARM: dts: imx6-sabreauto: add reset-gpios property for max7310_b
ARM: dts: imx6-sabreauto: add pinctrl for gpt input capture
ARM: dts: imx6-sabreauto: add the ADV7180 video decoder
media: Add i.MX media core driver
media: imx: Add CSI subdev driver
media: imx: Add SMFC subdev driver
media: imx: Add IC subdev drivers
media: imx: Add Camera Interface subdev driver
media: imx: Add MIPI CSI-2 Receiver subdev driver
media: imx: Add MIPI CSI-2 OV5640 sensor subdev driver
media: imx: Add Parallel OV5642 sensor subdev driver
ARM: imx_v6_v7_defconfig: Enable staging video4linux drivers
Documentation/devicetree/bindings/media/imx.txt | 205 + Documentation/media/v4l-drivers/imx.rst | 430 ++ arch/arm/boot/dts/imx6dl-sabrelite.dts | 5 + arch/arm/boot/dts/imx6dl-sabresd.dts | 5 + arch/arm/boot/dts/imx6dl.dtsi | 183 + arch/arm/boot/dts/imx6q-sabrelite.dts | 6 + arch/arm/boot/dts/imx6q-sabresd.dts | 5 + arch/arm/boot/dts/imx6q.dtsi | 123 + arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 142 +- arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 122 +- arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 114 +- arch/arm/boot/dts/imx6qdl.dtsi | 25 +- arch/arm/configs/imx_v6_v7_defconfig | 10 +- drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/imx/Kconfig | 36 + drivers/staging/media/imx/Makefile | 16 + drivers/staging/media/imx/TODO | 18 + drivers/staging/media/imx/imx-camif.c | 1010 +++++ drivers/staging/media/imx/imx-csi.c | 638 +++ drivers/staging/media/imx/imx-ic-common.c | 113 + drivers/staging/media/imx/imx-ic-pp.c | 636 +++ drivers/staging/media/imx/imx-ic-prpenc.c | 1037 +++++ drivers/staging/media/imx/imx-ic-prpvf.c | 1180 ++++++ drivers/staging/media/imx/imx-ic.h | 36 + drivers/staging/media/imx/imx-media-common.c | 985 +++++ drivers/staging/media/imx/imx-media-dev.c | 479 +++ drivers/staging/media/imx/imx-media-fim.c | 509 +++ drivers/staging/media/imx/imx-media-internal-sd.c | 457 +++ drivers/staging/media/imx/imx-media-of.c | 291 ++ drivers/staging/media/imx/imx-media-of.h | 25 + drivers/staging/media/imx/imx-media.h | 299 ++ drivers/staging/media/imx/imx-mipi-csi2.c | 509 +++ drivers/staging/media/imx/imx-smfc.c | 739 ++++ drivers/staging/media/imx/imx-video-switch.c | 351 ++ drivers/staging/media/imx/ov5640-mipi.c | 2349 +++++++++++ drivers/staging/media/imx/ov5642.c | 4364 +++++++++++++++++++++ include/media/imx.h | 15 + include/uapi/Kbuild | 1 + include/uapi/linux/v4l2-controls.h | 4 + include/uapi/media/Kbuild | 2 + include/uapi/media/imx.h | 30 + 42 files changed, 17479 insertions(+), 28 deletions(-) create mode 100644 Documentation/devicetree/bindings/media/imx.txt create mode 100644 Documentation/media/v4l-drivers/imx.rst create mode 100644 drivers/staging/media/imx/Kconfig create mode 100644 drivers/staging/media/imx/Makefile create mode 100644 drivers/staging/media/imx/TODO create mode 100644 drivers/staging/media/imx/imx-camif.c create mode 100644 drivers/staging/media/imx/imx-csi.c create mode 100644 drivers/staging/media/imx/imx-ic-common.c create mode 100644 drivers/staging/media/imx/imx-ic-pp.c create mode 100644 drivers/staging/media/imx/imx-ic-prpenc.c create mode 100644 drivers/staging/media/imx/imx-ic-prpvf.c create mode 100644 drivers/staging/media/imx/imx-ic.h create mode 100644 drivers/staging/media/imx/imx-media-common.c create mode 100644 drivers/staging/media/imx/imx-media-dev.c create mode 100644 drivers/staging/media/imx/imx-media-fim.c create mode 100644 drivers/staging/media/imx/imx-media-internal-sd.c create mode 100644 drivers/staging/media/imx/imx-media-of.c create mode 100644 drivers/staging/media/imx/imx-media-of.h create mode 100644 drivers/staging/media/imx/imx-media.h create mode 100644 drivers/staging/media/imx/imx-mipi-csi2.c create mode 100644 drivers/staging/media/imx/imx-smfc.c create mode 100644 drivers/staging/media/imx/imx-video-switch.c create mode 100644 drivers/staging/media/imx/ov5640-mipi.c create mode 100644 drivers/staging/media/imx/ov5642.c create mode 100644 include/media/imx.h create mode 100644 include/uapi/media/Kbuild create mode 100644 include/uapi/media/imx.h
Signature · 1 line
2.7.4
Steve Longerbeam
maintainerPATCH v2 1/19 ARM: dts: imx6qdl: Add compatible, clocks, irqs to MIPI CSI-2 node
Add to the MIPI CSI2 receiver node: compatible string, interrupt sources, clocks.
--- arch/arm/boot/dts/imx6qdl.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/boot/dts/imx6qdl.dtsi +7 -0
@@ -1125,7 +1125,14 @@ }; mipi_csi: mipi at 021dc000 { + compatible = "fsl,imx-mipi-csi2"; reg = <0x021dc000 0x4000>; + interrupts = <0 100 0x04>, <0 101 0x04>; + clocks = <&clks IMX6QDL_CLK_HSI_TX>, + <&clks IMX6QDL_CLK_VIDEO_27M>, + <&clks IMX6QDL_CLK_EIM_SEL>; + clock-names = "dphy_clk", "cfg_clk", "pix_clk"; + status = "disabled"; }; mipi_dsi: mipi at 021e0000 {
Signature · 1 line
2.7.4
Steve Longerbeam
maintainerPATCH v2 2/19 ARM: dts: imx6qdl: Add mipi_ipu1/2 multiplexers, mipi_csi, and their connections
In reply to Steve LongerbeamFrom: Philipp Zabel <[email protected]>
This patch adds the device tree graph connecting the input multiplexers to the IPU CSIs and the MIPI-CSI2 gasket on i.MX6. The MIPI_IPU multiplexers are added as children of the iomuxc-gpr syscon device node. On i.MX6Q/D two two-input multiplexers in front of IPU1 CSI0 and IPU2 CSI1 allow to select between CSI0/1 parallel input pads and the MIPI CSI-2 virtual channels 0/3.
On i.MX6DL/S two five-input multiplexers in front of IPU1 CSI0 and IPU1 CSI1 allow to select between CSI0/1 parallel input pads and any of the four MIPI CSI-2 virtual channels.
- Removed some dangling/unused endpoints (ipu2_csi0_from_csi2ipu)
- Renamed the mipi virtual channel endpoint labels, from "mipi_csiX_..." to "mipi_vcX...".
- Added input endpoints to the video muxes for the connections from parallel sensors.
- Added input endpoints to the mipi_csi for the connections from mipi csi-2 sensors.
- The video multiplexer node has compatible string "imx-video-mux" instead of "video-multiplexer".
- The video multiplexer node indicates GPR register via reg propert only, (register offset and bitmask), instead of specifying with "bit-mask" and "bit-shift" properties.
--- arch/arm/boot/dts/imx6dl.dtsi | 183 +++++++++++++++++++++++++++++++++++++++++ arch/arm/boot/dts/imx6q.dtsi | 119 +++++++++++++++++++++++++++ arch/arm/boot/dts/imx6qdl.dtsi | 10 ++- 3 files changed, 311 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx6dl.dtsi +183 -0
@@ -181,6 +181,189 @@ "di0", "di1"; }; +&gpr { + ipu1_csi0_mux: ipu1_csi0_mux at 34 { + compatible = "imx-video-mux"; + reg = <0x34 0x07>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + port at 0 { + reg = <0>; + + ipu1_csi0_mux_from_mipi_vc0: endpoint { + remote-endpoint = <&mipi_vc0_to_ipu1_csi0_mux>; + }; + }; + + port at 1 { + reg = <1>; + + ipu1_csi0_mux_from_mipi_vc1: endpoint { + remote-endpoint = <&mipi_vc1_to_ipu1_csi0_mux>; + }; + }; + + port at 2 { + reg = <2>; + + ipu1_csi0_mux_from_mipi_vc2: endpoint { + remote-endpoint = <&mipi_vc2_to_ipu1_csi0_mux>; + }; + }; + + port at 3 { + reg = <3>; + + ipu1_csi0_mux_from_mipi_vc3: endpoint { + remote-endpoint = <&mipi_vc3_to_ipu1_csi0_mux>; + }; + }; + + port at 4 { + reg = <4>; + + ipu1_csi0_mux_from_parallel_sensor: endpoint { + }; + }; + + port at 5 { + reg = <5>; + + ipu1_csi0_mux_to_ipu1_csi0: endpoint { + remote-endpoint = <&ipu1_csi0_from_ipu1_csi0_mux>; + }; + }; + }; + + ipu1_csi1_mux: ipu1_csi1_mux at 34 { + compatible = "imx-video-mux"; + reg = <0x34 0x38>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + + port at 0 { + reg = <0>; + + ipu1_csi1_mux_from_mipi_vc0: endpoint { + remote-endpoint = <&mipi_vc0_to_ipu1_csi1_mux>; + }; + }; + + port at 1 { + reg = <1>; + + ipu1_csi1_mux_from_mipi_vc1: endpoint { + remote-endpoint = <&mipi_vc1_to_ipu1_csi1_mux>; + }; + }; + + port at 2 { + reg = <2>; + + ipu1_csi1_mux_from_mipi_vc2: endpoint { + remote-endpoint = <&mipi_vc2_to_ipu1_csi1_mux>; + }; + }; + + port at 3 { + reg = <3>; + + ipu1_csi1_mux_from_mipi_vc3: endpoint { + remote-endpoint = <&mipi_vc3_to_ipu1_csi1_mux>; + }; + }; + + port at 4 { + reg = <4>; + + ipu1_csi1_mux_from_parallel_sensor: endpoint { + }; + }; + + port at 5 { + reg = <5>; + + ipu1_csi1_mux_to_ipu1_csi1: endpoint { + remote-endpoint = <&ipu1_csi1_from_ipu1_csi1_mux>; + }; + }; + }; +}; + +&ipu1_csi1 { + ipu1_csi1_from_ipu1_csi1_mux: endpoint { + remote-endpoint = <&ipu1_csi1_mux_to_ipu1_csi1>; + }; +}; + +&mipi_csi { + port at 0 { + reg = <0>; + + mipi_csi_from_mipi_sensor: endpoint { + }; + }; + + port at 1 { + reg = <1>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_vc0_to_ipu1_csi0_mux: endpoint at 0 { + remote-endpoint = <&ipu1_csi0_mux_from_mipi_vc0>; + }; + + mipi_vc0_to_ipu1_csi1_mux: endpoint at 1 { + remote-endpoint = <&ipu1_csi1_mux_from_mipi_vc0>; + }; + }; + + port at 2 { + reg = <2>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_vc1_to_ipu1_csi0_mux: endpoint at 0 { + remote-endpoint = <&ipu1_csi0_mux_from_mipi_vc1>; + }; + + mipi_vc1_to_ipu1_csi1_mux: endpoint at 1 { + remote-endpoint = <&ipu1_csi1_mux_from_mipi_vc1>; + }; + }; + + port at 3 { + reg = <3>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_vc2_to_ipu1_csi0_mux: endpoint at 0 { + remote-endpoint = <&ipu1_csi0_mux_from_mipi_vc2>; + }; + + mipi_vc2_to_ipu1_csi1_mux: endpoint at 1 { + remote-endpoint = <&ipu1_csi1_mux_from_mipi_vc2>; + }; + }; + + port at 4 { + reg = <4>; + #address-cells = <1>; + #size-cells = <0>; + + mipi_vc3_to_ipu1_csi0_mux: endpoint at 0 { + remote-endpoint = <&ipu1_csi0_mux_from_mipi_vc3>; + }; + + mipi_vc3_to_ipu1_csi1_mux: endpoint at 1 { + remote-endpoint = <&ipu1_csi1_mux_from_mipi_vc3>; + }; + }; +}; + &vpu { compatible = "fsl,imx6dl-vpu", "cnm,coda960"; };
arch/arm/boot/dts/imx6q.dtsi +119 -0
141 lines not on this page · raw message
arch/arm/boot/dts/imx6qdl.dtsi +9 -1
@@ -799,8 +799,10 @@ }; gpr: iomuxc-gpr at 020e0000 { - compatible = "fsl,imx6q-iomuxc-gpr", "syscon"; + compatible = "fsl,imx6q-iomuxc-gpr", "syscon", "simple-mfd"; reg = <0x020e0000 0x38>; + #address-cells = <1>; + #size-cells = <0>; }; iomuxc: iomuxc at 020e0000 {
@@ -1127,6 +1129,8 @@ mipi_csi: mipi at 021dc000 { compatible = "fsl,imx-mipi-csi2"; reg = <0x021dc000 0x4000>; + #address-cells = <1>; + #size-cells = <0>; interrupts = <0 100 0x04>, <0 101 0x04>; clocks = <&clks IMX6QDL_CLK_HSI_TX>, <&clks IMX6QDL_CLK_VIDEO_27M>,
@@ -1232,6 +1236,10 @@ ipu1_csi0: port at 0 { reg = <0>; + + ipu1_csi0_from_ipu1_csi0_mux: endpoint { + remote-endpoint = <&ipu1_csi0_mux_to_ipu1_csi0>; + }; }; ipu1_csi1: port at 1 {
Signature · 1 line
2.7.4
Steve Longerbeam
maintainerPATCH v2 3/19 ARM: dts: imx6qdl: add media device
In reply to Steve Longerbeam--- arch/arm/boot/dts/imx6q.dtsi | 4 ++++ arch/arm/boot/dts/imx6qdl.dtsi | 8 ++++++++ 2 files changed, 12 insertions(+)
arch/arm/boot/dts/imx6q.dtsi +4 -0
@@ -454,3 +454,7 @@ &vpu { compatible = "fsl,imx6q-vpu", "cnm,coda960"; }; + +&media0 { + ports = <&ipu1_csi0>, <&ipu1_csi1>, <&ipu2_csi0>, <&ipu2_csi1>; +};
arch/arm/boot/dts/imx6qdl.dtsi +8 -0
@@ -1296,5 +1296,13 @@ }; }; }; + + media0: media at 0 { + compatible = "fsl,imx-media"; + ports = <&ipu1_csi0>, <&ipu1_csi1>; + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + }; }; };
Signature · 1 line
2.7.4
Steve Longerbeam
maintainerPATCH v2 4/19 ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors
In reply to Steve LongerbeamEnables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor. Both hang off the same i2c2 bus, so they require different (and non- default) i2c slave addresses.
The OV5642 connects to the parallel-bus mux input port on ipu1_csi0_mux.
The OV5640 connects to the input port on the MIPI CSI-2 receiver on mipi_csi. It is set to transmit over MIPI virtual channel 1.
Note there is a pin conflict with GPIO6. This pin functions as a power input pin to the OV5642, but ENET uses it as the h/w workaround for erratum ERR006687, to wake-up the ARM cores on normal RX and TX packet done events (see 6261c4c8). So workaround 6261c4c8 is reverted here to support the OV5642, and the "fsl,err006687-workaround-present" boolean also must be removed. The result is that the CPUidle driver will no longer allow entering the deep idle states on the sabrelite.
--- arch/arm/boot/dts/imx6dl-sabrelite.dts | 5 ++ arch/arm/boot/dts/imx6q-sabrelite.dts | 6 ++ arch/arm/boot/dts/imx6qdl-sabrelite.dtsi | 122 ++++++++++++++++++++++++++++++- 3 files changed, 129 insertions(+), 4 deletions(-)
arch/arm/boot/dts/imx6dl-sabrelite.dts +5 -0
@@ -48,3 +48,8 @@ model = "Freescale i.MX6 DualLite SABRE Lite Board"; compatible = "fsl,imx6dl-sabrelite", "fsl,imx6dl"; }; + +&ipu1_csi1_from_ipu1_csi1_mux { + data-lanes = <0 1>; + clock-lanes = <2>; +};
arch/arm/boot/dts/imx6q-sabrelite.dts +6 -0
@@ -52,3 +52,9 @@ &sata { status = "okay"; }; + +&ipu1_csi1_from_mipi_vc1 { + data-lanes = <0 1>; + clock-lanes = <2>; +}; +
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +118 -4
167 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 04/19] ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors
Hi Steve,
Quoted 9 lines · Steve Longerbeam
Enables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor. Both hang off the same i2c2 bus, so they require different (and non- default) i2c slave addresses.
The OV5642 connects to the parallel-bus mux input port on
ipu1_csi0_mux.The OV5640 connects to the input port on the MIPI CSI-2 receiver on
mipi_csi. It is set to transmit over MIPI virtual channel 1.
Quoted 7 lines
Note there is a pin conflict with GPIO6. This pin functions as a power input pin to the OV5642, but ENET uses it as the h/w workaround for erratum ERR006687, to wake-up the ARM cores on normal RX and TX packet done events (see
6261c4c8). So workaround6261c4c8is reverted here to support the OV5642, and the "fsl,err006687-workaround-present" boolean also must be removed. The result is that the CPUidle driver will no longer allow entering the deep idle states on the sabrelite.
For me it sounds like a candidate of its own separate change.
Quoted 3 lines
Signed-off-by Steve Longerbeam <[email protected]>---
[snip]
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi line 275
Quoted 9 lines
&audmux {
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +0
-2pinctrl-names = "default"; pinctrl-0 = <&pinctrl_audmux>;@@ -271,9 +298,6 @@ txd1-skew-ps = <0>; txd2-skew-ps = <0>; txd3-skew-ps = <0>; - interrupts-extended = <&gpio1 6 IRQ_TYPE_LEVEL_HIGH>, - <&intc 0 119 IRQ_TYPE_LEVEL_HIGH>;
Like you say in the commit message this is a partial revert of 6261c4c8f13e ("ARM: dts: imx6qdl-sabrelite: use GPIO_6 for FEC interrupt.")
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi line 276
Quoted 1 line
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +0
-1- fsl,err006687-workaround-present;
This is a partial revert of a28eeb43ee57 ("ARM: dts: imx6: tag boards that have the HW workaround for ERR006687").
The change should be split and reviewed separately in my opinion, also cc Gary Bisson <[email protected]> for SabreLite changes.
Quoted 21 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +14
-0status = "okay"; };@@ -302,6 +326,52 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c2>; status = "okay"; + + camera: ov5642 at 42 { + compatible = "ovti,ov5642"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5642>; + clocks = <&clks IMX6QDL_CLK_CKO2>; + clock-names = "xclk"; + reg = <0x42>; + xclk = <24000000>; + reset-gpios = <&gpio1 8 GPIO_ACTIVE_LOW>; + pwdn-gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>; + gp-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; + + port {
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi line 352
Quoted 10 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +10
-0+ ov5642_to_ipu1_csi0_mux: endpoint { + remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>; + bus-width = <8>; + hsync-active = <1>; + vsync-active = <1>; + }; + }; + }; + + mipi_camera: ov5640 at 40 {
Please reorder device nodes by address value, also according to ePAPR node names should be generic, labels can be specific:
ov5640: camera at 40 {
...
};
ov5642: camera at 42 {
...
};Quoted 26 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +22
-0+ compatible = "ovti,ov5640_mipi"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5640>; + clocks = <&mipi_xclk>; + clock-names = "xclk"; + reg = <0x40>; + xclk = <22000000>; + reset-gpios = <&gpio2 5 GPIO_ACTIVE_LOW>; /* NANDF_D5 */ + pwdn-gpios = <&gpio6 9 GPIO_ACTIVE_HIGH>; /* NANDF_WP_B */ + + port { + #address-cells = <1>; + #size-cells = <0>; + + ov5640_to_mipi_csi: endpoint at 1 { + reg = <1>; + remote-endpoint = <&mipi_csi_from_mipi_sensor>; + data-lanes = <0 1>; + clock-lanes = <2>; + }; + }; + }; }; &i2c3 {
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi line 377
Quoted 4 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +0
-1@@ -374,7 +444,6 @@ MX6QDL_PAD_RGMII_RX_CTL__RGMII_RX_CTL 0x1b030 /* Phy reset */ MX6QDL_PAD_EIM_D23__GPIO3_IO23 0x000b0 - MX6QDL_PAD_GPIO_6__ENET_IRQ 0x000b1
Yep.
Quoted 7 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +0
-0>; };@@ -449,6 +518,39 @@ >; };
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi line 530
Quoted 10 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +10
-0+ pinctrl_ov5642: ov5642grp { + fsl,pins = < + MX6QDL_PAD_SD1_DAT0__GPIO1_IO16 0x80000000 + MX6QDL_PAD_GPIO_6__GPIO1_IO06 0x80000000 + MX6QDL_PAD_GPIO_8__GPIO1_IO08 0x80000000 + MX6QDL_PAD_GPIO_3__CCM_CLKO2 0x80000000 + >; + }; + + pinctrl_ipu1_csi0: ipu1grp-csi0 {
Please rename node name to ipu1csi0grp.
Quoted 13 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +13
-0+ fsl,pins = < + MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12 0x80000000 + MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13 0x80000000 + MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14 0x80000000 + MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15 0x80000000 + MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16 0x80000000 + MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17 0x80000000 + MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18 0x80000000 + MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 0x80000000 + MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x80000000 + MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC 0x80000000 + MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 0x80000000 + MX6QDL_PAD_CSI0_DATA_EN__IPU1_CSI0_DATA_EN 0x80000000
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi line 553
Quoted 10 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +10
-0+ >; + }; + + pinctrl_ov5640: ov5640grp { + fsl,pins = < + MX6QDL_PAD_NANDF_D5__GPIO2_IO05 0x000b0 + MX6QDL_PAD_NANDF_WP_B__GPIO6_IO09 0x0b0b0 + >; + }; +
Indentation issues above, please use tabs instead of spaces.
Also please add new pin control groups preserving the alphanimerical order.
--
With best wishes,
Vladimir
Steve Longerbeam
maintainerRe: [PATCH v2 04/19] ARM: dts: imx6-sabrelite: add OV5642 and OV5640 camera sensors
Hi Vladimir,
Quoted 12 lines · Vladimir Zapolskiy
Hi Steve,
Quoted 9 lines · Steve Longerbeam
Enables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor. Both hang off the same i2c2 bus, so they require different (and non- default) i2c slave addresses.
The OV5642 connects to the parallel-bus mux input port on
ipu1_csi0_mux.The OV5640 connects to the input port on the MIPI CSI-2 receiver on
mipi_csi. It is set to transmit over MIPI virtual channel 1.
Quoted 8 lines
Quoted 7 lines
Note there is a pin conflict with GPIO6. This pin functions as a power input pin to the OV5642, but ENET uses it as the h/w workaround for erratum ERR006687, to wake-up the ARM cores on normal RX and TX packet done events (see
6261c4c8). So workaround6261c4c8is reverted here to support the OV5642, and the "fsl,err006687-workaround-present" boolean also must be removed. The result is that the CPUidle driver will no longer allow entering the deep idle states on the sabrelite.For me it sounds like a candidate of its own separate change.
Yes, I split out the two partial reverts into a separate commit ("ARM: dts: imx6qdl-sabrelite: remove erratum ERR006687
workaround").
Quoted 6 lines
Review
Quoted 5 lines
(quoted diff) +2
-0+ + mipi_camera: ov5640 at 40 {Please reorder device nodes by address value,
done.
Quoted 10 lines
also according to ePAPR
node names should be generic, labels can be specific:ov5640: camera at 40 { ... }; ov5642: camera at 42 { ... };
fixed.
Quoted 3 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi line 530
Quoted 2 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +1
-0+ pinctrl_ipu1_csi0: ipu1grp-csi0 {Please rename node name to ipu1csi0grp.
done.
Quoted 10 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi line 553
Quoted 9 lines
arch/arm/boot/dts/imx6qdl-sabrelite.dtsi +8
-0+ + pinctrl_ov5640: ov5640grp { + fsl,pins = < + MX6QDL_PAD_NANDF_D5__GPIO2_IO05 0x000b0 + MX6QDL_PAD_NANDF_WP_B__GPIO6_IO09 0x0b0b0 + >; + }; +Indentation issues above, please use tabs instead of spaces.
fixed.
Quoted 2 lines
Also please add new pin control groups preserving the alphanimerical order.
done.
Steve
Steve Longerbeam
maintainerPATCH v2 5/19 ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors
In reply to Steve LongerbeamEnables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor.
The OV5642 connects to the parallel-bus mux input port on ipu1_csi0_mux.
The OV5640 connects to the input port on the MIPI CSI-2 receiver on mipi_csi. It is set to transmit over MIPI virtual channel 1.
Until the OV5652 sensor module compatible with the SabreSD becomes available for testing, the ov5642 node is currently disabled.
--- arch/arm/boot/dts/imx6dl-sabresd.dts | 5 ++ arch/arm/boot/dts/imx6q-sabresd.dts | 5 ++ arch/arm/boot/dts/imx6qdl-sabresd.dtsi | 114 ++++++++++++++++++++++++++++++++- 3 files changed, 123 insertions(+), 1 deletion(-)
arch/arm/boot/dts/imx6dl-sabresd.dts +5 -0
@@ -15,3 +15,8 @@ model = "Freescale i.MX6 DualLite SABRE Smart Device Board"; compatible = "fsl,imx6dl-sabresd", "fsl,imx6dl"; }; + +&ipu1_csi1_from_ipu1_csi1_mux { + data-lanes = <0 1>; + clock-lanes = <2>; +};
arch/arm/boot/dts/imx6q-sabresd.dts +5 -0
@@ -23,3 +23,8 @@ &sata { status = "okay"; }; + +&ipu1_csi1_from_mipi_vc1 { + data-lanes = <0 1>; + clock-lanes = <2>; +};
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +113 -1
144 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 05/19] ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors
Quoted 12 lines · Steve Longerbeam
Enables the OV5642 parallel-bus sensor, and the OV5640 MIPI CSI-2 sensor.
The OV5642 connects to the parallel-bus mux input port on
ipu1_csi0_mux.The OV5640 connects to the input port on the MIPI CSI-2 receiver on
mipi_csi. It is set to transmit over MIPI virtual channel 1.Until the OV5652 sensor module compatible with the SabreSD becomes available for testing, the ov5642 node is currently disabled.
Signed-off-by Steve Longerbeam <[email protected]>---
[snip]
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 247
Quoted 2 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +2
-0+ + camera: ov5642 at 3c {
ov5642: camera at 3c
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 260
Quoted 13 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +13
-0+ compatible = "ovti,ov5642"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5642>; + clocks = <&clks IMX6QDL_CLK_CKO>; + clock-names = "xclk"; + reg = <0x3c>; + xclk = <24000000>; + DOVDD-supply = <&vgen4_reg>; /* 1.8v */ + AVDD-supply = <&vgen5_reg>; /* 2.8v, rev C board is VGEN3 + rev B board is VGEN5 */ + DVDD-supply = <&vgen2_reg>; /* 1.5v*/ + pwdn-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; /* SD1_DAT0 */ + reset-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; /* SD1_DAT1 */
Comments about SD1_* pad names are redundant.
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 261
Quoted 1 line
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +1
-0+ status = "disabled";
Why is it disabled here?
Quoted 14 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +10
-0+ + port { + ov5642_to_ipu1_csi0_mux: endpoint { + remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>; + bus-width = <8>; + hsync-active = <1>; + vsync-active = <1>; + }; + }; + }; }; &i2c2 {
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 380
Quoted 5 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +2
-0@@ -322,6 +376,34 @@ }; }; }; + + mipi_camera: ov5640 at 3c {
ov5640: camera at 3c
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 393
Quoted 13 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +13
-0+ compatible = "ovti,ov5640_mipi"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5640>; + reg = <0x3c>; + clocks = <&clks IMX6QDL_CLK_CKO>; + clock-names = "xclk"; + xclk = <24000000>; + DOVDD-supply = <&vgen4_reg>; /* 1.8v */ + AVDD-supply = <&vgen5_reg>; /* 2.8v, rev C board is VGEN3 + rev B board is VGEN5 */ + DVDD-supply = <&vgen2_reg>; /* 1.5v*/ + pwdn-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>; /* SD1_DAT2 */ + reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>; /* SD1_CLK */
Comments about SD1_* pad names are redundant.
Quoted 25 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +18
-0+ + port { + #address-cells = <1>; + #size-cells = <0>; + + ov5640_to_mipi_csi: endpoint at 1 { + reg = <1>; + remote-endpoint = <&mipi_csi_from_mipi_sensor>; + data-lanes = <0 1>; + clock-lanes = <2>; + }; + }; + }; }; &i2c3 {@@ -426,6 +508,36 @@ >; }; + pinctrl_ov5640: ov5640grp { + fsl,pins = < + MX6QDL_PAD_SD1_DAT2__GPIO1_IO19 0x80000000 + MX6QDL_PAD_SD1_CLK__GPIO1_IO20 0x80000000 + >;
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 525
Quoted 10 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +10
-0+ }; + + pinctrl_ov5642: ov5642grp { + fsl,pins = < + MX6QDL_PAD_SD1_DAT0__GPIO1_IO16 0x80000000 + MX6QDL_PAD_SD1_DAT1__GPIO1_IO17 0x80000000 + >; + }; + + pinctrl_ipu1_csi0: ipu1grp-csi0 {
Please rename the node name to ipu1csi0grp.
Please add new pin control groups preserving the alphanimerical order.
Quoted 9 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +8
-0+ fsl,pins = < + MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12 0x80000000 + MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13 0x80000000 + MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14 0x80000000 + MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15 0x80000000 + MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16 0x80000000 + MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17 0x80000000 + MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18 0x80000000
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 543
Quoted 10 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +7
-0+ MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 0x80000000 + MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x80000000 + MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC 0x80000000 + MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 0x80000000 + >; + }; + pinctrl_pcie: pciegrp { fsl,pins = < MX6QDL_PAD_GPIO_17__GPIO7_IO12 0x1b0b0
--
With best wishes,
Vladimir
Steve Longerbeam
maintainerRe: [PATCH v2 05/19] ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors
Quoted 4 lines · Vladimir Zapolskiy
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 247
Quoted 3 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +2
-0+ + camera: ov5642 at 3c {ov5642: camera at 3c
done.
Quoted 3 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 260
Quoted 2 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +2
-0+ pwdn-gpios = <&gpio1 16 GPIO_ACTIVE_HIGH>; /* SD1_DAT0 */ + reset-gpios = <&gpio1 17 GPIO_ACTIVE_LOW>; /* SD1_DAT1 */Comments about SD1_* pad names are redundant.
sure, removed.
Quoted 2 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 261
Quoted 1 line
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +1
-0+ status = "disabled";Why is it disabled here?
It's explained in the header. I don't yet have the OV5642 module for the sabresd for testing, so it is disabled for now.
Quoted 3 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 380
Quoted 2 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +2
-0+ + mipi_camera: ov5640 at 3c {ov5640: camera at 3c
done.
Quoted 4 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 393
Quoted 3 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +2
-0+ pwdn-gpios = <&gpio1 19 GPIO_ACTIVE_HIGH>; /* SD1_DAT2 */ + reset-gpios = <&gpio1 20 GPIO_ACTIVE_LOW>; /* SD1_CLK */Comments about SD1_* pad names are redundant.
removed.
Quoted 5 lines
Review
Quoted 2 lines
(quoted diff) +2
-0+ + pinctrl_ipu1_csi0: ipu1grp-csi0 {Please rename the node name to ipu1csi0grp.
Please add new pin control groups preserving the alphanimerical order.
done and done.
Steve
Fabio Estevam
reviewerRe: [PATCH v2 05/19] ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors
In reply to Steve Longerbeamarch/arm/boot/dts/imx6qdl-sabresd.dtsi line 257
Quoted 11 lines · Steve Longerbeam
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +11
-0+ camera: ov5642 at 3c { + compatible = "ovti,ov5642"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5642>; + clocks = <&clks IMX6QDL_CLK_CKO>; + clock-names = "xclk"; + reg = <0x3c>; + xclk = <24000000>; + DOVDD-supply = <&vgen4_reg>; /* 1.8v */ + AVDD-supply = <&vgen5_reg>; /* 2.8v, rev C board is VGEN3 + rev B board is VGEN5 */
Please use vgen3 so that by default we have the valid AVDD-supply for revC boards which is more recent and more the users have access to.
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 390
Quoted 11 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +11
-0+ mipi_camera: ov5640 at 3c { + compatible = "ovti,ov5640_mipi"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5640>; + reg = <0x3c>; + clocks = <&clks IMX6QDL_CLK_CKO>; + clock-names = "xclk"; + xclk = <24000000>; + DOVDD-supply = <&vgen4_reg>; /* 1.8v */ + AVDD-supply = <&vgen5_reg>; /* 2.8v, rev C board is VGEN3 + rev B board is VGEN5 */
Same here.
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 514
Quoted 4 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +4
-0+ pinctrl_ov5640: ov5640grp { + fsl,pins = < + MX6QDL_PAD_SD1_DAT2__GPIO1_IO19 0x80000000 + MX6QDL_PAD_SD1_CLK__GPIO1_IO20 0x80000000
Please avoid all the 0x80000000 IOMUX settings and replace them by their real values.
Steve Longerbeam
maintainerRe: [PATCH v2 05/19] ARM: dts: imx6-sabresd: add OV5642 and OV5640 camera sensors
Quoted 13 lines · Fabio Estevam
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 257
Quoted 11 lines · Steve Longerbeam
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +11
-0+ camera: ov5642 at 3c { + compatible = "ovti,ov5642"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5642>; + clocks = <&clks IMX6QDL_CLK_CKO>; + clock-names = "xclk"; + reg = <0x3c>; + xclk = <24000000>; + DOVDD-supply = <&vgen4_reg>; /* 1.8v */ + AVDD-supply = <&vgen5_reg>; /* 2.8v, rev C board is VGEN3 + rev B board is VGEN5 */
Quoted 2 lines
Please use vgen3 so that by default we have the valid AVDD-supply for revC boards which is more recent and more the users have access to.
done.
Quoted 12 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 390
Quoted 12 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +11
-0+ mipi_camera: ov5640 at 3c { + compatible = "ovti,ov5640_mipi"; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ov5640>; + reg = <0x3c>; + clocks = <&clks IMX6QDL_CLK_CKO>; + clock-names = "xclk"; + xclk = <24000000>; + DOVDD-supply = <&vgen4_reg>; /* 1.8v */ + AVDD-supply = <&vgen5_reg>; /* 2.8v, rev C board is VGEN3 + rev B board is VGEN5 */
Quoted 1 line
Same here.
done.
Quoted 7 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi line 514
Quoted 5 lines
arch/arm/boot/dts/imx6qdl-sabresd.dtsi +4
-0+ pinctrl_ov5640: ov5640grp { + fsl,pins = < + MX6QDL_PAD_SD1_DAT2__GPIO1_IO19 0x80000000 + MX6QDL_PAD_SD1_CLK__GPIO1_IO20 0x80000000Please avoid all the
0x80000000IOMUX settings and replace them by their real values.
yeah, finally got around to this, done!
Steve
Steve Longerbeam
maintainerPATCH v2 6/19 ARM: dts: imx6-sabreauto: create i2cmux for i2c3
In reply to Steve LongerbeamThe sabreauto uses a steering pin to select between the SDA signal on i2c3 bus, and a data-in pin for an SPI NOR chip. Use i2cmux to control this steering pin. Idle state of the i2cmux selects SPI NOR. This is not a classic way to use i2cmux, since one side of the mux selects something other than an i2c bus, but it works and is probably the cleanest solution. Note that if one thread is attempting to access SPI NOR while another thread is accessing i2c3, the SPI NOR access will fail since the i2cmux has selected the SDA pin rather than SPI NOR data-in. This couldn't be avoided in any case, the board is not designed to allow concurrent i2c3 and SPI NOR functions (and the default device-tree does not enable SPI NOR anyway).
Devices hanging off i2c3 should now be defined under i2cmux, so that the steering pin can be properly controlled to access those devices. The port expanders (MAX7310) are thus moved into i2cmux.
--- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 65 +++++++++++++++++++++----------- 1 file changed, 44 insertions(+), 21 deletions(-)
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +44 -21
@@ -108,6 +108,44 @@ default-brightness-level = <7>; status = "okay"; }; + + i2cmux { + compatible = "i2c-mux-gpio"; + #address-cells = <1>; + #size-cells = <0>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_i2c3mux>; + mux-gpios = <&gpio5 4 0>; + i2c-parent = <&i2c3>; + idle-state = <0>; + + i2c at 1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + + max7310_a: gpio at 30 { + compatible = "maxim,max7310"; + reg = <0x30>; + gpio-controller; + #gpio-cells = <2>; + }; + + max7310_b: gpio at 32 { + compatible = "maxim,max7310"; + reg = <0x32>; + gpio-controller; + #gpio-cells = <2>; + }; + + max7310_c: gpio at 34 { + compatible = "maxim,max7310"; + reg = <0x34>; + gpio-controller; + #gpio-cells = <2>; + }; + }; + }; }; &clks {
@@ -291,27 +329,6 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_i2c3>; status = "okay"; - - max7310_a: gpio at 30 { - compatible = "maxim,max7310"; - reg = <0x30>; - gpio-controller; - #gpio-cells = <2>; - }; - - max7310_b: gpio at 32 { - compatible = "maxim,max7310"; - reg = <0x32>; - gpio-controller; - #gpio-cells = <2>; - }; - - max7310_c: gpio at 34 { - compatible = "maxim,max7310"; - reg = <0x34>; - gpio-controller; - #gpio-cells = <2>; - }; }; &iomuxc {
@@ -419,6 +436,12 @@ >; }; + pinctrl_i2c3mux: i2c3muxgrp { + fsl,pins = < + MX6QDL_PAD_EIM_A24__GPIO5_IO04 0x80000000 + >; + }; + pinctrl_pwm3: pwm1grp { fsl,pins = < MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1
Signature · 1 line
2.7.4
Steve Longerbeam
maintainerPATCH v2 7/19 ARM: dts: imx6-sabreauto: add reset-gpios property for max7310_b
In reply to Steve LongerbeamThe reset pin to the port expander chip (MAX7310) is controlled by a gpio, so define a reset-gpios property to control it. There are three MAX7310's on the SabreAuto CPU card (max7310_[abc]), but all use the same pin for their reset. Since all can't acquire the same pin, assign it to max7310_b, that chip is needed by more functions (usb and adv7180).
--- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 9 +++++++++ 1 file changed, 9 insertions(+)
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +9 -0
@@ -136,6 +136,9 @@ reg = <0x32>; gpio-controller; #gpio-cells = <2>; + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_max7310>; + reset-gpios = <&gpio1 15 GPIO_ACTIVE_LOW>; }; max7310_c: gpio at 34 {
@@ -442,6 +445,12 @@ >; }; + pinctrl_max7310: max7310grp { + fsl,pins = < + MX6QDL_PAD_SD2_DAT0__GPIO1_IO15 0x80000000 + >; + }; + pinctrl_pwm3: pwm1grp { fsl,pins = < MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1
Signature · 1 line
2.7.4
Steve Longerbeam
maintainerPATCH v2 8/19 ARM: dts: imx6-sabreauto: add pinctrl for gpt input capture
In reply to Steve LongerbeamAdd pinctrl groups for both GPT input capture channels.
--- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +12 -0
@@ -457,6 +457,18 @@ >; }; + pinctrl_gpt_input_capture0: gptinputcapture0grp { + fsl,pins = < + MX6QDL_PAD_SD1_DAT0__GPT_CAPTURE1 0x80000000 + >; + }; + + pinctrl_gpt_input_capture1: gptinputcapture1grp { + fsl,pins = < + MX6QDL_PAD_SD1_DAT1__GPT_CAPTURE2 0x80000000 + >; + }; + pinctrl_spdif: spdifgrp { fsl,pins = < MX6QDL_PAD_KEY_COL3__SPDIF_IN 0x1b0b0
Signature · 1 line
2.7.4
Steve Longerbeam
maintainerPATCH v2 9/19 ARM: dts: imx6-sabreauto: add the ADV7180 video decoder
In reply to Steve LongerbeamEnables the ADV7180 decoder sensor. The ADV7180 connects to the parallel-bus mux input on ipu1_csi0_mux.
On the sabreauto, two analog video inputs are routed to the ADV7180, composite on Ain1, and composite on Ain3. Those inputs are defined via inputs and input-names under the ADV7180 node. The ADV7180 power pin is via max7310_b port expander.
--- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +56 -0
@@ -147,10 +147,42 @@ gpio-controller; #gpio-cells = <2>; }; + + camera: adv7180 at 21 { + compatible = "adi,adv7180"; + reg = <0x21>; + powerdown-gpios = <&max7310_b 2 GPIO_ACTIVE_LOW>; + interrupt-parent = <&gpio1>; + interrupts = <27 0x8>; + inputs = <0x00 0x02>; + input-names = "ADV7180 Composite on Ain1", + "ADV7180 Composite on Ain3"; + + port { + adv7180_to_ipu1_csi0_mux: endpoint { + remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>; + bus-width = <8>; + }; + }; + }; }; }; }; +&ipu1_csi0_from_ipu1_csi0_mux { + bus-width = <8>; +}; + +&ipu1_csi0_mux_from_parallel_sensor { + remote-endpoint = <&adv7180_to_ipu1_csi0_mux>; + bus-width = <8>; +}; + +&ipu1_csi0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ipu1_csi0>; +}; + &clks { assigned-clocks = <&clks IMX6QDL_PLL4_BYPASS_SRC>, <&clks IMX6QDL_PLL4_BYPASS>,
@@ -451,6 +483,30 @@ >; }; + pinctrl_ipu1_csi0: ipu1grp-csi0 { + fsl,pins = < + MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04 0x80000000 + MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05 0x80000000 + MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06 0x80000000 + MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07 0x80000000 + MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08 0x80000000 + MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09 0x80000000 + MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10 0x80000000 + MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11 0x80000000 + MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12 0x80000000 + MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13 0x80000000 + MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14 0x80000000 + MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15 0x80000000 + MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16 0x80000000 + MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17 0x80000000 + MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18 0x80000000 + MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 0x80000000 + MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x80000000 + MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC 0x80000000 + MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 0x80000000 + >; + }; + pinctrl_pwm3: pwm1grp { fsl,pins = < MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1
Signature · 1 line
2.7.4
Re: [PATCH v2 09/19] ARM: dts: imx6-sabreauto: add the ADV7180 video decoder
Quoted 18 lines · Steve Longerbeam
Enables the ADV7180 decoder sensor. The ADV7180 connects to the parallel-bus mux input on
ipu1_csi0_mux.On the sabreauto, two analog video inputs are routed to the ADV7180, composite on Ain1, and composite on Ain3. Those inputs are defined via inputs and input-names under the ADV7180 node. The ADV7180 power pin is via
max7310_bport expander.Signed-off-by Steve Longerbeam <[email protected]>--- arch/arm/boot/dts/imx6qdl-sabreauto.dtsi | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+)arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +0
-0
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi line 151
Quoted 5 lines
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +2
-0@@ -147,10 +147,42 @@ gpio-controller; #gpio-cells = <2>; }; + + camera: adv7180 at 21 {
adv7180: camera at 21
Quoted 38 lines
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +30
-0+ compatible = "adi,adv7180"; + reg = <0x21>; + powerdown-gpios = <&max7310_b 2 GPIO_ACTIVE_LOW>; + interrupt-parent = <&gpio1>; + interrupts = <27 0x8>; + inputs = <0x00 0x02>; + input-names = "ADV7180 Composite on Ain1", + "ADV7180 Composite on Ain3"; + + port { + adv7180_to_ipu1_csi0_mux: endpoint { + remote-endpoint = <&ipu1_csi0_mux_from_parallel_sensor>; + bus-width = <8>; + }; + }; + }; }; }; }; +&ipu1_csi0_from_ipu1_csi0_mux { + bus-width = <8>; +}; + +&ipu1_csi0_mux_from_parallel_sensor { + remote-endpoint = <&adv7180_to_ipu1_csi0_mux>; + bus-width = <8>; +}; + +&ipu1_csi0 { + pinctrl-names = "default"; + pinctrl-0 = <&pinctrl_ipu1_csi0>; +}; + &clks { assigned-clocks = <&clks IMX6QDL_PLL4_BYPASS_SRC>, <&clks IMX6QDL_PLL4_BYPASS>,
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi line 486
Quoted 4 lines
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +1
-0@@ -451,6 +483,30 @@ >; }; + pinctrl_ipu1_csi0: ipu1grp-csi0 {
Please rename node name to ipu1csi0grp.
Quoted 17 lines
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +16
-0+ fsl,pins = < + MX6QDL_PAD_CSI0_DAT4__IPU1_CSI0_DATA04 0x80000000 + MX6QDL_PAD_CSI0_DAT5__IPU1_CSI0_DATA05 0x80000000 + MX6QDL_PAD_CSI0_DAT6__IPU1_CSI0_DATA06 0x80000000 + MX6QDL_PAD_CSI0_DAT7__IPU1_CSI0_DATA07 0x80000000 + MX6QDL_PAD_CSI0_DAT8__IPU1_CSI0_DATA08 0x80000000 + MX6QDL_PAD_CSI0_DAT9__IPU1_CSI0_DATA09 0x80000000 + MX6QDL_PAD_CSI0_DAT10__IPU1_CSI0_DATA10 0x80000000 + MX6QDL_PAD_CSI0_DAT11__IPU1_CSI0_DATA11 0x80000000 + MX6QDL_PAD_CSI0_DAT12__IPU1_CSI0_DATA12 0x80000000 + MX6QDL_PAD_CSI0_DAT13__IPU1_CSI0_DATA13 0x80000000 + MX6QDL_PAD_CSI0_DAT14__IPU1_CSI0_DATA14 0x80000000 + MX6QDL_PAD_CSI0_DAT15__IPU1_CSI0_DATA15 0x80000000 + MX6QDL_PAD_CSI0_DAT16__IPU1_CSI0_DATA16 0x80000000 + MX6QDL_PAD_CSI0_DAT17__IPU1_CSI0_DATA17 0x80000000 + MX6QDL_PAD_CSI0_DAT18__IPU1_CSI0_DATA18 0x80000000
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi line 512
Quoted 10 lines
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +7
-0+ MX6QDL_PAD_CSI0_DAT19__IPU1_CSI0_DATA19 0x80000000 + MX6QDL_PAD_CSI0_PIXCLK__IPU1_CSI0_PIXCLK 0x80000000 + MX6QDL_PAD_CSI0_MCLK__IPU1_CSI0_HSYNC 0x80000000 + MX6QDL_PAD_CSI0_VSYNC__IPU1_CSI0_VSYNC 0x80000000 + >; + }; + pinctrl_pwm3: pwm1grp { fsl,pins = < MX6QDL_PAD_SD4_DAT1__PWM3_OUT 0x1b0b1
--
With best wishes,
Vladimir
Steve Longerbeam
maintainerRe: [PATCH v2 09/19] ARM: dts: imx6-sabreauto: add the ADV7180 video decoder
Quoted 4 lines · Vladimir Zapolskiy
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi line 151
Quoted 2 lines · Steve Longerbeam
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +2
-0+ + camera: adv7180 at 21 {adv7180: camera at 21
done.
Quoted 3 lines
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi line 486
Quoted 2 lines
arch/arm/boot/dts/imx6qdl-sabreauto.dtsi +1
-0+ pinctrl_ipu1_csi0: ipu1grp-csi0 {Please rename node name to ipu1csi0grp.
done.
Steve
Steve Longerbeam
maintainerPATCH v2 10/19 media: Add i.MX media core driver
In reply to Steve LongerbeamAdd the core media driver for i.MX SOC.
--- Documentation/devicetree/bindings/media/imx.txt | 205 +++++ Documentation/media/v4l-drivers/imx.rst | 430 ++++++++++ drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/imx/Kconfig | 8 + drivers/staging/media/imx/Makefile | 6 + drivers/staging/media/imx/TODO | 18 + drivers/staging/media/imx/imx-media-common.c | 985 ++++++++++++++++++++++ drivers/staging/media/imx/imx-media-dev.c | 479 +++++++++++ drivers/staging/media/imx/imx-media-fim.c | 509 +++++++++++ drivers/staging/media/imx/imx-media-internal-sd.c | 457 ++++++++++ drivers/staging/media/imx/imx-media-of.c | 291 +++++++ drivers/staging/media/imx/imx-media-of.h | 25 + drivers/staging/media/imx/imx-media.h | 299 +++++++ include/media/imx.h | 15 + include/uapi/Kbuild | 1 + include/uapi/linux/v4l2-controls.h | 4 + include/uapi/media/Kbuild | 2 + include/uapi/media/imx.h | 30 + 19 files changed, 3767 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/imx.txt create mode 100644 Documentation/media/v4l-drivers/imx.rst create mode 100644 drivers/staging/media/imx/Kconfig create mode 100644 drivers/staging/media/imx/Makefile create mode 100644 drivers/staging/media/imx/TODO create mode 100644 drivers/staging/media/imx/imx-media-common.c create mode 100644 drivers/staging/media/imx/imx-media-dev.c create mode 100644 drivers/staging/media/imx/imx-media-fim.c create mode 100644 drivers/staging/media/imx/imx-media-internal-sd.c create mode 100644 drivers/staging/media/imx/imx-media-of.c create mode 100644 drivers/staging/media/imx/imx-media-of.h create mode 100644 drivers/staging/media/imx/imx-media.h create mode 100644 include/media/imx.h create mode 100644 include/uapi/media/Kbuild create mode 100644 include/uapi/media/imx.h
Documentation/devicetree/bindings/media/imx.txt new file +205 -0
@@ -0,0 +1,205 @@ +Freescale i.MX Media Video Devices + +Video Media Controller node +--------------------------- + +This is the parent media controller node for video capture support. + +Required properties: +- compatible : "fsl,imx-media"; +- ports : Should contain a list of phandles pointing to camera + sensor interface ports of IPU devices + + +fim child node +-------------- + +This is an optional child node of the ipu_csi port nodes. It can be used +to modify the default control values for the video capture Frame +Interval Monitor. Refer to Documentation/media/v4l-drivers/imx.rst for +more info on the Frame Interval Monitor. + +Optional properties: +- enable : enable (1) or disable (0) the FIM; +- num-avg : how many frame intervals the FIM will average; +- num-skip : how many frames the FIM will skip after a video + capture restart before beginning to sample frame + intervals; +- tolerance-range : a range of tolerances for the averaged frame + interval error, specified as <min max>, in usec. + The FIM will signal a frame interval error if + min < error < max. If the max is <= min, then + tolerance range is disabled (interval error if + error > min). +- input-capture-channel: an input capture channel and channel flags, + specified as <chan flags>. The channel number + must be 0 or 1. The flags can be + IRQ_TYPE_EDGE_RISING, IRQ_TYPE_EDGE_FALLING, or + IRQ_TYPE_EDGE_BOTH, and specify which input + capture signal edge will trigger the event. If + an input capture channel is specified, the FIM + will use this method to measure frame intervals + instead of via the EOF interrupt. The input capture + method is much preferred over EOF as it is not + subject to interrupt latency errors. However it + requires routing the VSYNC or FIELD output + signals of the camera sensor to one of the + i.MX input capture pads (SD1_DAT0, SD1_DAT1), + which also gives up support for SD1. + + +mipi_csi2 node +-------------- + +This is the device node for the MIPI CSI-2 Receiver, required for MIPI +CSI-2 sensors. + +Required properties: +- compatible : "fsl,imx-mipi-csi2"; +- reg : physical base address and length of the register set; +- clocks : the MIPI CSI-2 receiver requires three clocks: hsi_tx + (the DPHY clock), video_27m, and eim_sel; +- clock-names : must contain "dphy_clk", "cfg_clk", "pix_clk"; + +Optional properties: +- interrupts : must contain two level-triggered interrupts, + in order: 100 and 101; + + +video mux node +-------------- + +This is the device node for the video multiplexer. It can control +either the i.MX internal video mux that selects between parallel image +sensors and MIPI CSI-2 virtual channels, or an external mux controlled +by a GPIO. It must be a child device of the syscon GPR device. + +Required properties: +- compatible : "imx-video-mux"; +- sink-ports : the number of sink (input) ports that follow +- ports : at least 2 sink ports must be specified that define + the endpoint inputs to the video mux, and there must + be exactly one output port endpoint which must be the + last port endpoint defined; + +Optional properties: +- reg : the GPR iomuxc register offset and bitmask of the + internal mux bits; +- mux-gpios : if reg is not specified, this must exist to define + a GPIO to control an external mux; + + +SabreLite Quad with OV5642 and OV5640 +------------------------------------- + +On the Sabrelite, the OV5642 module is connected to the parallel bus +input on the i.MX internal video mux to IPU1 CSI0. It's i2c bus connects +to i2c bus 2, so the ov5642 sensor node must be a child of i2c2. + +The MIPI CSI-2 OV5640 module is connected to the i.MX internal MIPI CSI-2 +receiver, and the four virtual channel outputs from the receiver are +routed as follows: vc0 to the IPU1 CSI0 mux, vc1 directly to IPU1 CSI1, +vc2 directly to IPU2 CSI0, and vc3 to the IPU2 CSI1 mux. The OV5640 is +also connected to i2c bus 2 on the SabreLite, so it also must be a child +of i2c2. Therefore the OV5642 and OV5640 must not share the same i2c slave +address. + +OV5642 Required properties: +- compatible : "ovti,ov5642"; +- clocks : the OV5642 system clock (cko2, 200 on Sabrelite); +- clock-names : must be "xclk"; +- reg : i2c slave address (must not be default 0x3c on Sabrelite); +- xclk : the system clock frequency (24000000 on Sabrelite); +- reset-gpios : gpio for the reset pin to OV5642 +- pwdn-gpios : gpio for the powewr-down pin to OV5642 + +OV5642 Endpoint Required properties: +- remote-endpoint : must connect to parallel sensor interface input endpoint + on ipu1_csi0 video mux (ipu1_csi0_mux_from_parallel_sensor). +- bus-width : must be 8; +- hsync-active : must be 1; +- vsync-active : must be 1; + +OV5640 Required properties: +- compatible : "ovti,ov5640_mipi"; +- clocks : the OV5640 system clock (pwm3 on Sabrelite); +- clock-names : must be "xclk"; +- reg : i2c slave address (must not be default 0x3c on Sabrelite); +- xclk : the system clock frequency (22000000 on Sabrelite); +- reset-gpios : gpio for the reset pin to OV5640 +- pwdn-gpios : gpio for the power-down pin to OV5640 + +OV5640 MIPI CSI-2 Endpoint Required properties: +- remote-endpoint : must connect to mipi_csi receiver input endpoint + (mipi_csi_from_mipi_sensor). +- reg : the MIPI CSI-2 virtual channel to transmit over; +- data-lanes : must be <0 1>; +- clock-lanes : must be <2>; + +OV5640/OV5642 Optional properties: +- DOVDD-supply : DOVDD regulator supply; +- AVDD-supply : AVDD regulator supply; +- DVDD-supply : DVDD regulator supply; + + +SabreAuto Quad with ADV7180 +--------------------------- + +On the SabreAuto, an on-board ADV7180 SD decoder is connected to the +parallel bus input on the internal video mux to IPU1 CSI0. + +Two analog video inputs are routed to the ADV7180 on the SabreAuto, +composite on Ain1, and composite on Ain3. Those inputs are defined +via inputs and input-names properties in the ADV7180 device node. + +Regulators and port expanders are required for the ADV7180 (power pin +is via port expander gpio on i2c3). The reset pin to the port expander +chip (MAX7310) is controlled by a gpio, so a reset-gpios property must +be defined under the port expander node to control it. + +The sabreauto uses a steering pin to select between the SDA signal on +i2c3 bus, and a data-in pin for an SPI NOR chip. i2cmux can be used to +control this steering pin. Idle state of the i2cmux selects SPI NOR. +This is not classic way to use i2cmux, since one side of the mux selects +something other than an i2c bus, but it works and is probably the cleanest +solution. Note that if one thread is attempting to access SPI NOR while +another thread is accessing i2c3, the SPI NOR access will fail since the +i2cmux has selected the SDA pin rather than SPI NOR data-in. This couldn't +be avoided in any case, the board is not designed to allow concurrent +i2c3 and SPI NOR functions (and the default device-tree does not enable +SPI NOR anyway). + +ADV7180 Required properties: +- compatible : "adi,adv7180"; +- reg : must be 0x21; + +ADV7180 Optional properties: +- DOVDD-supply : DOVDD regulator supply; +- AVDD-supply : AVDD regulator supply; +- DVDD-supply : DVDD regulator supply; +- PVDD-supply : PVDD regulator supply; +- pwdn-gpios : gpio to control ADV7180 power pin, must be + <&port_exp_b 2 GPIO_ACTIVE_LOW> on SabreAuto; +- interrupts : interrupt from ADV7180, must be <27 0x8> on SabreAuto; +- interrupt-parent : must be <&gpio1> on SabreAuto; +- inputs : list of input mux values, must be 0x00 followed by + 0x02 on SabreAuto; +- input-names : names of the inputs; + +ADV7180 Endpoint Required properties: +- remote-endpoint : must connect to parallel sensor interface input endpoint + on ipu1_csi0 video mux (ipu1_csi0_mux_from_parallel_sensor). +- bus-width : must be 8; + + +SabreSD Quad with OV5642 and MIPI CSI-2 OV5640 +---------------------------------------------- + +Similarly to SabreLite, the SabreSD supports a parallel interface +OV5642 module on IPU1 CSI0, and a MIPI CSI-2 OV5640 module. The OV5642 +connects to i2c bus 1 (i2c1) and the OV5640 to i2c bus 2 (i2c2). + +OV5640 and OV5642 properties are as described above on SabreLite. + +The OV5642 support has not been tested yet due to lack of hardware, +so only OV5640 is enabled in the device tree at this time.
Documentation/media/v4l-drivers/imx.rst new file +430 -0
430 lines not on this page · raw message
drivers/staging/media/Kconfig +2 -0
@@ -25,6 +25,8 @@ source "drivers/staging/media/cxd2099/Kconfig" source "drivers/staging/media/davinci_vpfe/Kconfig" +source "drivers/staging/media/imx/Kconfig" + source "drivers/staging/media/omap4iss/Kconfig" source "drivers/staging/media/s5p-cec/Kconfig"
drivers/staging/media/Makefile +1 -0
@@ -1,6 +1,7 @@ obj-$(CONFIG_I2C_BCM2048) += bcm2048/ obj-$(CONFIG_VIDEO_SAMSUNG_S5P_CEC) += s5p-cec/ obj-$(CONFIG_DVB_CXD2099) += cxd2099/ +obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx/ obj-$(CONFIG_LIRC_STAGING) += lirc/ obj-$(CONFIG_VIDEO_DM365_VPFE) += davinci_vpfe/ obj-$(CONFIG_VIDEO_OMAP4) += omap4iss/
drivers/staging/media/imx/Kconfig new file +8 -0
@@ -0,0 +1,8 @@ +config VIDEO_IMX_MEDIA + tristate "i.MX5/6 V4L2 media core driver" + depends on MEDIA_CONTROLLER && VIDEO_V4L2 && ARCH_MXC && IMX_IPUV3_CORE + default y + ---help--- + Say yes here to enable support for video4linux media controller + driver for the i.MX5/6 SOC. +
drivers/staging/media/imx/Makefile new file +6 -0
@@ -0,0 +1,6 @@ +imx-media-objs := imx-media-dev.o imx-media-fim.o imx-media-internal-sd.o \ + imx-media-of.o + +obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o +obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o +
drivers/staging/media/imx/TODO new file +18 -0
@@ -0,0 +1,18 @@ + +- v4l2-compliance + +- imx-csi subdev is not being autoloaded as a kernel module, probably + because ipu_add_client_devices() does not register the IPU client + platform devices, but only allocates those devices. + +- Verify driver remove paths. + +- Currently registering with notifications from subdevs are only + available through the subdev device nodes and not through the main + capture device node. Need to come up with a way to find the camif in + the current pipeline that owns the subdev that sent the notify. + +- Need to decide whether a mem2mem device should be incorporated into + the media graph, or whether it should be a separate device that does + not link with any other entities. +
drivers/staging/media/imx/imx-media-common.c new file +985 -0
985 lines not on this page · raw message
drivers/staging/media/imx/imx-media-dev.c new file +479 -0
479 lines not on this page · raw message
drivers/staging/media/imx/imx-media-fim.c new file +509 -0
509 lines not on this page · raw message
drivers/staging/media/imx/imx-media-internal-sd.c new file +457 -0
345 lines not on this page · raw message
drivers/staging/media/imx/imx-media-of.c new file +291 -0
291 lines not on this page · raw message
drivers/staging/media/imx/imx-media-of.h new file +25 -0
Lines of this file are not shown. View the raw message.
drivers/staging/media/imx/imx-media.h new file +299 -0
299 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH v2 10/19] media: Add i.MX media core driver
Hi Steve,
Quoted 5 lines · Steve Longerbeam
Add the core media driver for i.MX SOC.
Signed-off-by Steve Longerbeam <[email protected]>--- Documentation/devicetree/bindings/media/imx.txt | 205 +++++
v2 was sent before getting Rob's review comments, but still they should be addressed in v3.
Also I would suggest to separate device tree binding documentation change and place it as the first patch in the series, this should make the following DTS changes valid.
Quoted 10 lines
Documentation/media/v4l-drivers/imx.rst | 430 ++++++++++ drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/imx/Kconfig | 8 + drivers/staging/media/imx/Makefile | 6 + drivers/staging/media/imx/TODO | 18 + drivers/staging/media/imx/imx-media-common.c | 985 ++++++++++++++++++++++ drivers/staging/media/imx/imx-media-dev.c | 479 +++++++++++ drivers/staging/media/imx/imx-media-fim.c | 509 +++++++++++ drivers/staging/media/imx/imx-media-internal-sd.c | 457 ++++++++++
Quoted 8 lines
drivers/staging/media/imx/imx-media-of.c | 291 +++++++ drivers/staging/media/imx/imx-media-of.h | 25 + drivers/staging/media/imx/imx-media.h | 299 +++++++ include/media/imx.h | 15 + include/uapi/Kbuild | 1 + include/uapi/linux/v4l2-controls.h | 4 + include/uapi/media/Kbuild | 2 + include/uapi/media/imx.h | 30 +
Probably Greg should ack the UAPI changes, you may consider to split them into a separate patch.
Quoted 17 lines
19 files changed, 3767 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/imx.txt create mode 100644 Documentation/media/v4l-drivers/imx.rst create mode 100644 drivers/staging/media/imx/Kconfig create mode 100644 drivers/staging/media/imx/Makefile create mode 100644 drivers/staging/media/imx/TODO create mode 100644 drivers/staging/media/imx/imx-media-common.c create mode 100644 drivers/staging/media/imx/imx-media-dev.c create mode 100644 drivers/staging/media/imx/imx-media-fim.c create mode 100644 drivers/staging/media/imx/imx-media-internal-sd.c create mode 100644 drivers/staging/media/imx/imx-media-of.c create mode 100644 drivers/staging/media/imx/imx-media-of.h create mode 100644 drivers/staging/media/imx/imx-media.h create mode 100644 include/media/imx.h create mode 100644 include/uapi/media/Kbuild create mode 100644 include/uapi/media/imx.h
[snip]
drivers/staging/media/imx/imx-media-common.c line 608
Quoted 11 lines
drivers/staging/media/imx/imx-media-common.c new file +11
-0+ +struct imx_media_subdev * +imx_media_find_subdev_by_sd (struct imx_media_dev *imxmd, +struct v4l2_subdev *sd) +{ +struct imx_media_subdev *imxsd; +int i, ret = -ENODEV ; + +for (i =0 ; i < imxmd->num_subdevs; i++) { + imxsd = &imxmd->subdev[i]; +if (sd == imxsd->sd) {
This can be simplifed:
...
if (sd == imxsd->sd) return imxsd; }
return ERR_PTR(-ENODEV);
Quoted 10 lines
drivers/staging/media/imx/imx-media-common.c new file +10
-0+ ret =0 ; +break ; + } + } + +return ret ?ERR_PTR (ret) : imxsd; +} +EXPORT_SYMBOL_GPL (imx_media_find_subdev_by_sd); + +struct imx_media_subdev *
drivers/staging/media/imx/imx-media-common.c line 628
Quoted 10 lines
drivers/staging/media/imx/imx-media-common.c new file +10
-0+imx_media_find_subdev_by_id(struct imx_media_dev *imxmd, u32 grp_id) +{ +struct imx_media_subdev *imxsd; +int i, ret = -ENODEV ; + +for (i =0 ; i < imxmd->num_subdevs; i++) { + imxsd = &imxmd->subdev[i]; +if (imxsd->sd && imxsd->sd->grp_id == grp_id) { + ret =0 ; +break ;
This can be simplifed:
...
if (imxsd->sd && imxsd->sd->grp_id == grp_i) return imxsd; }
return ERR_PTR(-ENODEV);
Quoted 7 lines
drivers/staging/media/imx/imx-media-common.c new file +7
-0+ } + } + +return ret ?ERR_PTR (ret) : imxsd; +} +EXPORT_SYMBOL_GPL (imx_media_find_subdev_by_id); +
[snip]
Quoted 20 lines
drivers/staging/media/imx/imx-media-dev.c new file +14
-0@@ -0,0 +1,479 @@ +/* +* V4L2 Media Controller Driver for Freescale i.MX5/6 SOC +* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h>
drivers/staging/media/imx/imx-media-dev.c line 24
Quoted 10 lines
drivers/staging/media/imx/imx-media-dev.c new file +10
-0+#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/spinlock.h> +#include <linux/platform_device.h> +#include <linux/pinctrl/consumer.h> +#include <linux/of_platform.h> +#include <media/v4l2-ioctl.h> +#include <media/v4l2-ctrls.h> +#include <media/v4l2-event.h> +#include <media/v4l2-mc.h>
Please sort out the list of headers alphabetically.
drivers/staging/media/imx/imx-media-dev.c line 30
Quoted 6 lines
drivers/staging/media/imx/imx-media-dev.c new file +6
-0+#include <video/imx-ipu-v3.h> +#include <media/imx.h> +#include "imx-media.h" +#include "imx-media-of.h" + +#define DEVICE_NAME "imx-media"
I suppose you don't need this macro.
[snip]
Quoted 47 lines
drivers/staging/media/imx/imx-media-dev.c new file +47
-0+*/ +static int imx_media_create_links (struct imx_media_dev *imxmd) +{ +struct imx_media_subdev *local_sd; +struct imx_media_subdev *remote_sd; +struct v4l2_subdev *source, *sink; +struct imx_media_link *link; +struct imx_media_pad *pad; +u16 source_pad, sink_pad; +int num_pads, i, j, k; +int ret =0 ; + +for (i =0 ; i < imxmd->num_subdevs; i++) { + local_sd = &imxmd->subdev[i]; + num_pads = local_sd->num_sink_pads + local_sd->num_src_pads; + +for (j =0 ; j < num_pads; j++) { + pad = &local_sd->pad[j]; + +for (k =0 ; k < pad->num_links; k++) { + link = &pad->link[k]; + + remote_sd =imx_media_find_async_subdev ( + imxmd, link->remote_sd_node, + link->remote_devname); +if (!remote_sd) { +v4l2_warn (&imxmd->v4l2_dev, +"%s: no remote for %s:%d\n" , + __func__, local_sd->sd->name, + link->local_pad); +continue ; + } + +/* only create the source->sink links */ +if (pad->pad.flags &MEDIA_PAD_FL_SINK ) +continue ; + + source = local_sd->sd; + sink = remote_sd->sd; + source_pad = link->local_pad; + sink_pad = link->remote_pad; + +v4l2_info (&imxmd->v4l2_dev, +"%s: %s:%d -> %s:%d\n" , __func__, + source->name, source_pad, + sink->name, sink_pad); +
drivers/staging/media/imx/imx-media-dev.c line 297
Quoted 10 lines
drivers/staging/media/imx/imx-media-dev.c new file +10
-0+ ret =media_create_pad_link (&source->entity, + source_pad, + &sink->entity, + sink_pad, +0 ); +if (ret) { +v4l2_err (&imxmd->v4l2_dev, +"create_pad_link failed: %d\n" , + ret); + goto out;
Indentation depth is quite terrific.
Quoted 8 lines
drivers/staging/media/imx/imx-media-dev.c new file +7
-0+ } + } + } + } + +out: +return ret;
[snip]
drivers/staging/media/imx/imx-media-dev.c line 470
Quoted 13 lines
drivers/staging/media/imx/imx-media-dev.c new file +13
-0+ +static const struct of_device_id imx_media_dt_ids[] = { + { .compatible ="fsl,imx-media" }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, imx_media_dt_ids); + +static struct platform_driver imx_media_pdrv = { + .probe = imx_media_probe, + .remove = imx_media_remove, + .driver = { + .name =DEVICE_NAME , + .owner =THIS_MODULE ,
Setting of .owner is not needed nowadays IIRC.
Quoted 22 lines
drivers/staging/media/imx/imx-media-dev.c new file +9
-0+ .of_match_table = imx_media_dt_ids, + }, +}; + +module_platform_driver (imx_media_pdrv); + +MODULE_DESCRIPTION ("i.MX5/6 v4l2 media controller driver" ); +MODULE_AUTHOR ("Steve Longerbeam <[email protected]>" ); +MODULE_LICENSE ("GPL" );drivers/staging/media/imx/imx-media-fim.c new file +7
-0@@ -0,0 +1,509 @@ +/* +* Frame Interval Monitor. +* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by
drivers/staging/media/imx/imx-media-fim.c line 17
Quoted 10 lines
drivers/staging/media/imx/imx-media-fim.c new file +10
-0+* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/slab.h> +#include <linux/platform_device.h> +#ifdef CONFIG_IMX_GPT_ICAP +#include <linux/mxc_icap.h> +#endif
This looks clumsy. Include it unconditionally, if needed do #ifdef's inside the header file.
drivers/staging/media/imx/imx-media-fim.c line 20
Quoted 3 lines
drivers/staging/media/imx/imx-media-fim.c new file +3
-0+#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h>
Please sort out the list alphabetically.
Quoted 3 lines
drivers/staging/media/imx/imx-media-fim.c new file +3
-0+#include <media/imx.h> +#include "imx-media.h" +
[snip]
Quoted 43 lines
drivers/staging/media/imx/imx-media-fim.c new file +43
-0+ +static int of_parse_fim (struct imx_media_fim *fim,struct device_node *np) +{ +struct device_node *fim_np; +u32 val, tol[2 ], icap[2 ]; +int ret; + + fim_np =of_get_child_by_name (np,"fim" ); +if (!fim_np) { +/* set to the default defaults */ + fim->of_defaults[FIM_CL_ENABLE ] =FIM_CL_ENABLE_DEF ; + fim->of_defaults[FIM_CL_NUM ] =FIM_CL_NUM_DEF ; + fim->of_defaults[FIM_CL_NUM_SKIP ] =FIM_CL_NUM_SKIP_DEF ; + fim->of_defaults[FIM_CL_TOLERANCE_MIN ] = +FIM_CL_TOLERANCE_MIN_DEF ; + fim->of_defaults[FIM_CL_TOLERANCE_MAX ] = +FIM_CL_TOLERANCE_MAX_DEF ; + fim->icap_channel =-1 ; +return 0 ; + } + + ret =of_property_read_u32 (fim_np,"enable" , &val); +if (ret) + val =FIM_CL_ENABLE_DEF ; + fim->of_defaults[FIM_CL_ENABLE ] = val; + + ret =of_property_read_u32 (fim_np,"num-avg" , &val); +if (ret) + val =FIM_CL_NUM_DEF ; + fim->of_defaults[FIM_CL_NUM ] = val; + + ret =of_property_read_u32 (fim_np,"num-skip" , &val); +if (ret) + val =FIM_CL_NUM_SKIP_DEF ; + fim->of_defaults[FIM_CL_NUM_SKIP ] = val; + + ret =of_property_read_u32_array (fim_np,"tolerance-range" , tol,2 ); +if (ret) { + tol[0 ] =FIM_CL_TOLERANCE_MIN_DEF ; + tol[1 ] =FIM_CL_TOLERANCE_MAX_DEF ; + } + fim->of_defaults[FIM_CL_TOLERANCE_MIN ] = tol[0 ]; + fim->of_defaults[FIM_CL_TOLERANCE_MAX ] = tol[1 ];
drivers/staging/media/imx/imx-media-fim.c line 419
Quoted 10 lines
drivers/staging/media/imx/imx-media-fim.c new file +10
-0+ + fim->icap_channel =-1 ; +if (IS_ENABLED (CONFIG_IMX_GPT_ICAP )) { + ret =of_property_read_u32_array (fim_np, +"input-capture-channel" , + icap,2 ); +if (!ret) { + fim->icap_channel = icap[0 ]; + fim->icap_flags = icap[1 ]; + }
Should you return error otherwise?
Quoted 5 lines
drivers/staging/media/imx/imx-media-fim.c new file +5
-0+ } + +of_node_put (fim_np); +return 0 ; +}
[snip]
Quoted 14 lines
drivers/staging/media/imx/imx-media-of.c new file +8
-0@@ -0,0 +1,291 @@ +/* +* Media driver for Freescale i.MX5/6 SOC +* +* Open Firmware parsing. +* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify
drivers/staging/media/imx/imx-media-of.c line 18
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/of_platform.h> +#include <media/v4l2-device.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h>
Please sort out the list alphabetically.
Quoted 72 lines
drivers/staging/media/imx/imx-media-of.c new file +72
-0+#include <video/imx-ipu-v3.h> +#include "imx-media.h" + +static int of_add_pad_link (struct imx_media_dev *imxmd, +struct imx_media_pad *pad, +struct device_node *local_sd_node, +struct device_node *remote_sd_node, +int local_pad,int remote_pad) +{ +dev_dbg (imxmd->dev,"%s: adding %s:%d -> %s:%d\n" , __func__, + local_sd_node->name, local_pad, + remote_sd_node->name, remote_pad); + +return imx_media_add_pad_link (imxmd, pad, remote_sd_node,NULL , + local_pad, remote_pad); +} + +/* parse inputs property from a sensor node */ +static void of_parse_sensor_inputs (struct imx_media_dev *imxmd, +struct imx_media_subdev *sensor, +struct device_node *sensor_np) +{ +struct imx_media_sensor_input *sinput = &sensor->input; +int ret, i; + +for (i =0 ; i <IMX_MEDIA_MAX_SENSOR_INPUTS ; i++) { +const char *input_name; +u32 val; + + ret =of_property_read_u32_index (sensor_np,"inputs" , i, &val); +if (ret) +break ; + + sinput->value[i] = val; + + ret =of_property_read_string_index (sensor_np,"input-names" , + i, &input_name); +/* +* if input-names not provided, they will be set using +* the subdev name once the sensor is known during +* async bind +*/ +if (!ret) +strncpy (sinput->name[i], input_name, +sizeof (sinput->name[i])); + } + + sinput->num = i; + +/* if no inputs provided just assume a single input */ +if (sinput->num ==0 ) + sinput->num =1 ; +} + +static void of_parse_sensor (struct imx_media_dev *imxmd, +struct imx_media_subdev *sensor, +struct device_node *sensor_np) +{ +struct device_node *endpoint; + +of_parse_sensor_inputs (imxmd, sensor, sensor_np); + + endpoint =of_graph_get_next_endpoint (sensor_np,NULL ); +if (endpoint) { +v4l2_of_parse_endpoint (endpoint, &sensor->sensor_ep); +of_node_put (endpoint); + } +} + +static int of_get_port_count (const struct device_node *np) +{ +struct device_node *child;
drivers/staging/media/imx/imx-media-of.c line 100
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+int num =0 ; + +/* if this node is itself a port, return 1 */ +if (of_node_cmp (np->name,"port" ) ==0 ) +return 1 ; + +for_each_child_of_node (np, child) { +if (of_node_cmp (child->name,"port" ) ==0 ) + num++; + }
Unneeded bracers.
Quoted 45 lines
drivers/staging/media/imx/imx-media-of.c new file +45
-0+return num; +} + +/* +* find the remote device node and remote port id (remote pad #) +* given local endpoint node +*/ +static void of_get_remote_pad (struct device_node *epnode, +struct device_node **remote_node, +int *remote_pad) +{ +struct device_node *rp, *rpp; +struct device_node *remote; + + rp =of_graph_get_remote_port (epnode); + rpp =of_graph_get_remote_port_parent (epnode); + +if (of_device_is_compatible (rpp,"fsl,imx6q-ipu" )) { +/* the remote is one of the CSI ports */ + remote = rp; + *remote_pad =0 ; +of_node_put (rpp); + }else { + remote = rpp; +of_property_read_u32 (rp,"reg" , remote_pad); +of_node_put (rp); + } + +if (!remote || !of_device_is_available (remote)) { +of_node_put (remote); + *remote_node =NULL ; + }else { + *remote_node = remote; + } +} + +static struct imx_media_subdev * +of_parse_subdev (struct imx_media_dev *imxmd,struct device_node *sd_np, +bool is_csi_port) +{ +struct imx_media_subdev *imxsd; +int i, num_pads, ret; + +if (!of_device_is_available (sd_np)) { + dev_dbg(imxmd->dev, "%s: %s not enabled\n", __func__,
drivers/staging/media/imx/imx-media-of.c line 155
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+ sd_np->name); +return NULL ; + } + +/* register this subdev with async notifier */ + imxsd =imx_media_add_async_subdev (imxmd, sd_np,NULL ); +if (!imxsd) +return NULL ; +if (IS_ERR (imxsd)) +return imxsd;
if (IS_ERR_OR_NULL(imxsd))
return imxsd;
Quoted 26 lines
drivers/staging/media/imx/imx-media-of.c new file +26
-0+ +if (is_csi_port) { +/* +* the ipu-csi has one sink port and one source port. +* The source port is not represented in the device tree, +* but is described by the internal pads and links later. +*/ + num_pads =2 ; + imxsd->num_sink_pads =1 ; + }else if (of_device_is_compatible (sd_np,"fsl,imx-mipi-csi2" )) { + num_pads =of_get_port_count (sd_np); +/* the mipi csi2 receiver has only one sink port */ + imxsd->num_sink_pads =1 ; + }else if (of_device_is_compatible (sd_np,"imx-video-mux" )) { + num_pads =of_get_port_count (sd_np); +/* for the video mux, all but the last port are sinks */ + imxsd->num_sink_pads = num_pads -1 ; + }else { +/* must be a sensor */ + num_pads =1 ; + imxsd->num_sink_pads =0 ; + } + +if (imxsd->num_sink_pads >= num_pads) +return ERR_PTR (-EINVAL ); +
drivers/staging/media/imx/imx-media-of.c line 191
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+ imxsd->num_src_pads = num_pads - imxsd->num_sink_pads; + +dev_dbg (imxmd->dev,"%s: %s has %d pads (%d sink, %d src)\n" , + __func__, sd_np->name, num_pads, + imxsd->num_sink_pads, imxsd->num_src_pads); + +if (imxsd->num_sink_pads ==0 ) { +/* this might be a sensor */ +of_parse_sensor (imxmd, imxsd, sd_np); + }
Unneeded bracers.
drivers/staging/media/imx/imx-media-of.c line 197
Quoted 6 lines
drivers/staging/media/imx/imx-media-of.c new file +6
-0+ +for (i =0 ; i < num_pads; i++) { +struct device_node *epnode =NULL , *port, *remote_np; +struct imx_media_subdev *remote_imxsd; +struct imx_media_pad *pad; +int remote_pad;
Too deep indentation, may be move the cycle body into a separate function?
Quoted 4 lines
drivers/staging/media/imx/imx-media-of.c new file +4
-0+ +/* init this pad */ + pad = &imxsd->pad[i]; + pad->pad.flags = (i < imxsd->num_sink_pads) ?
drivers/staging/media/imx/imx-media-of.c line 211
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+ MEDIA_PAD_FL_SINK :MEDIA_PAD_FL_SOURCE ; + +if (is_csi_port) + port = (i < imxsd->num_sink_pads) ? sd_np :NULL ; +else + port =of_graph_get_port_by_id (sd_np, i); +if (!port) +continue ; + +while ((epnode =of_get_next_child (port, epnode))) {
Please reuse for_each_child_of_node() here.
drivers/staging/media/imx/imx-media-of.c line 214
Quoted 3 lines
drivers/staging/media/imx/imx-media-of.c new file +3
-0+of_get_remote_pad (epnode, &remote_np, &remote_pad); +if (!remote_np) { +of_node_put (epnode);
Please remove of_node_put() here, of_get_next_child() does it.
Quoted 33 lines
drivers/staging/media/imx/imx-media-of.c new file +33
-0+continue ; + } + + ret =of_add_pad_link (imxmd, pad, sd_np, remote_np, + i, remote_pad); +if (ret) { + imxsd =ERR_PTR (ret); +break ; + } + +if (i < imxsd->num_sink_pads) { +/* follow sink endpoints upstream */ + remote_imxsd =of_parse_subdev (imxmd, + remote_np, + false); +if (IS_ERR (remote_imxsd)) { + imxsd = remote_imxsd; +break ; + } + } + +of_node_put (remote_np); +of_node_put (epnode); + } + +if (port != sd_np) +of_node_put (port); +if (IS_ERR (imxsd)) { +of_node_put (remote_np); +of_node_put (epnode); +break ; + } + }
drivers/staging/media/imx/imx-media-of.c line 257
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+ +return imxsd; +} + +int imx_media_of_parse (struct imx_media_dev *imxmd, +struct imx_media_subdev *(*csi)[4 ], +struct device_node *np) +{ +struct device_node *csi_np; +struct imx_media_subdev *lcsi;
Please swap two lines above to get the reverse christmas tree ordering.
Quoted 5 lines
drivers/staging/media/imx/imx-media-of.c new file +5
-0+u32 ipu_id, csi_id; +int i, ret; + +for (i =0 ; ; i++) { + csi_np =of_parse_phandle (np,"ports" , i);
drivers/staging/media/imx/imx-media-of.c line 272
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+if (!csi_np) +break ; + + lcsi =of_parse_subdev (imxmd, csi_np, true); +if (IS_ERR (lcsi)) { + ret =PTR_ERR (lcsi); + goto err_put; + } + +of_property_read_u32 (csi_np,"reg" , &csi_id);
Not sure if it is safe enough to ignore return value and potentially left csi_id uninitialized.
drivers/staging/media/imx/imx-media-of.c line 282
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+ ipu_id =of_alias_get_id (csi_np->parent,"ipu" ); + +if (ipu_id >1 || csi_id >1 ) { +dev_err (imxmd->dev,"%s: invalid ipu/csi id (%u/%u)\n" , + __func__, ipu_id, csi_id); + ret = -EINVAL ; + goto err_put; + } + +of_node_put (csi_np);
You can put the node right after of_alias_get_id() call, then in case of error return right from the if block and remove the goto label.
Quoted 20 lines
drivers/staging/media/imx/imx-media-of.c new file +9
-0+ + (*csi)[ipu_id *2 + csi_id] = lcsi; + } + +return 0 ; +err_put: +of_node_put (csi_np); +return ret; +}drivers/staging/media/imx/imx-media-of.h new file +5
-0@@ -0,0 +1,25 @@ +/* +* V4L2 Media Controller Driver for Freescale i.MX5/6 SOC +* +* Open Firmware parsing. +*
drivers/staging/media/imx/imx-media-of.h line 15
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.h new file +10
-0+* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#ifndef _IMX_MEDIA_OF_H +#define _IMX_MEDIA_OF_H +
I do believe you should include some headers or add declarations of "struct imx_media_dev", "struct imx_media_subdev", "struct device_node".
Quoted 18 lines
drivers/staging/media/imx/imx-media-of.h new file +10
-0+struct imx_media_subdev * +imx_media_of_find_subdev (struct imx_media_dev *imxmd, +struct device_node *np, +const char *name); + +int imx_media_of_parse (struct imx_media_dev *dev, +struct imx_media_subdev *(*csi)[4 ], +struct device_node *np); + +#endif drivers/staging/media/imx/imx-media.h new file +2
-0@@ -0,0 +1,299 @@ +/* +* V4L2 Media Controller Driver for Freescale i.MX5/6 SOC
drivers/staging/media/imx/imx-media.h line 12
Quoted 10 lines
drivers/staging/media/imx/imx-media.h new file +10
-0+* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#ifndef _IMX_MEDIA_H +#define _IMX_MEDIA_H
Please insert here an empty line to improve readability.
drivers/staging/media/imx/imx-media.h line 16
Quoted 4 lines
drivers/staging/media/imx/imx-media.h new file +4
-0+#include <media/v4l2-device.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-ctrls.h> +#include <media/v4l2-of.h>
Please sort out the list alphabetically.
Quoted 4 lines
drivers/staging/media/imx/imx-media.h new file +4
-0+#include <media/videobuf2-dma-contig.h> +#include <video/imx-ipu-v3.h> + +/*
drivers/staging/media/imx/imx-media.h line 30
Quoted 10 lines
drivers/staging/media/imx/imx-media.h new file +10
-0+* This is somewhat arbitrary, but we need at least: +* - 2 camera interface subdevs +* - 3 IC subdevs +* - 2 CSI subdevs +* - 1 mipi-csi2 receiver subdev +* - 2 video-mux subdevs +* - 3 camera sensor subdevs (2 parallel, 1 mipi-csi2) +* +* And double the above numbers for quad i.mx! +*/
[snip]
--
With best wishes,
Vladimir
Steve Longerbeam
maintainerRe: [PATCH v2 10/19] media: Add i.MX media core driver
Quoted 10 lines · Vladimir Zapolskiy
Hi Steve,
Quoted 5 lines · Steve Longerbeam
Add the core media driver for i.MX SOC.
Signed-off-by Steve Longerbeam <[email protected]>--- Documentation/devicetree/bindings/media/imx.txt | 205 +++++v2 was sent before getting Rob's review comments, but still they should be addressed in v3.
yes, those changes will be part of v3 as well.
Quoted 4 lines
Also I would suggest to separate device tree binding documentation change and place it as the first patch in the series, this should make the following DTS changes valid.
done.
Quoted 19 lines
Quoted 11 lines
Documentation/media/v4l-drivers/imx.rst | 430 ++++++++++ drivers/staging/media/Kconfig | 2 + drivers/staging/media/Makefile | 1 + drivers/staging/media/imx/Kconfig | 8 + drivers/staging/media/imx/Makefile | 6 + drivers/staging/media/imx/TODO | 18 + drivers/staging/media/imx/imx-media-common.c | 985 ++++++++++++++++++++++ drivers/staging/media/imx/imx-media-dev.c | 479 +++++++++++ drivers/staging/media/imx/imx-media-fim.c | 509 +++++++++++ drivers/staging/media/imx/imx-media-internal-sd.c | 457 ++++++++++Quoted 8 lines
drivers/staging/media/imx/imx-media-of.c | 291 +++++++ drivers/staging/media/imx/imx-media-of.h | 25 + drivers/staging/media/imx/imx-media.h | 299 +++++++ include/media/imx.h | 15 + include/uapi/Kbuild | 1 + include/uapi/linux/v4l2-controls.h | 4 + include/uapi/media/Kbuild | 2 + include/uapi/media/imx.h | 30 +
Quoted 2 lines
Probably Greg should ack the UAPI changes, you may consider to split them into a separate patch.
I split out the one-line addition to include/uapi/Kbuild with an empty include/uapi/media/Kbuild into a new patch "UAPI: Add media UAPI Kbuild file".
Also added a patch "media: Add userspace header file for i.MX".
Quoted 15 lines
drivers/staging/media/imx/imx-media-common.c line 608
Quoted 13 lines
drivers/staging/media/imx/imx-media-common.c new file +11
-0+ +struct imx_media_subdev * +imx_media_find_subdev_by_sd (struct imx_media_dev *imxmd, +struct v4l2_subdev *sd) +{ +struct imx_media_subdev *imxsd; +int i, ret = -ENODEV ; + +for (i =0 ; i < imxmd->num_subdevs; i++) { + imxsd = &imxmd->subdev[i]; +if (sd == imxsd->sd) {This can be simplifed:
Quoted 7 lines
...
if (sd == imxsd->sd) return imxsd; }return
ERR_PTR(-ENODEV);
yep, done.
Quoted 14 lines
drivers/staging/media/imx/imx-media-common.c line 628
Quoted 12 lines
drivers/staging/media/imx/imx-media-common.c new file +11
-0+struct imx_media_subdev * +imx_media_find_subdev_by_id (struct imx_media_dev *imxmd,u32 grp_id) +{ +struct imx_media_subdev *imxsd; +int i, ret = -ENODEV ; + +for (i =0 ; i < imxmd->num_subdevs; i++) { + imxsd = &imxmd->subdev[i]; +if (imxsd->sd && imxsd->sd->grp_id == grp_id) { + ret =0 ; +break ;This can be simplifed:
Quoted 7 lines
...
if (imxsd->sd && imxsd->sd->grp_id == grp_i) return imxsd; }return
ERR_PTR(-ENODEV);
done.
Quoted 25 lines
Quoted 25 lines
drivers/staging/media/imx/imx-media-dev.c new file +17
-0@@ -0,0 +1,479 @@ +/* +* V4L2 Media Controller Driver for Freescale i.MX5/6 SOC +* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/spinlock.h>
Quoted 8 lines
drivers/staging/media/imx/imx-media-dev.c line 24
Quoted 7 lines
drivers/staging/media/imx/imx-media-dev.c new file +7
-0+#include <linux/platform_device.h> +#include <linux/pinctrl/consumer.h> +#include <linux/of_platform.h> +#include <media/v4l2-ioctl.h> +#include <media/v4l2-ctrls.h> +#include <media/v4l2-event.h> +#include <media/v4l2-mc.h> Please sort out the list of headers alphabetically.
done.
Quoted 7 lines
drivers/staging/media/imx/imx-media-dev.c line 30
Quoted 6 lines
drivers/staging/media/imx/imx-media-dev.c new file +6
-0+#include <video/imx-ipu-v3.h> +#include <media/imx.h> +#include "imx-media.h" +#include "imx-media-of.h" + +#define DEVICE_NAME "imx-media"I suppose you don't need this macro.
sure why not, removed.
Quoted 19 lines
[snip]
Quoted 16 lines
+ */
drivers/staging/media/imx/imx-media-dev.c new file +15
-0+static int imx_media_create_links (struct imx_media_dev *imxmd) +{ +struct imx_media_subdev *local_sd; +struct imx_media_subdev *remote_sd; +struct v4l2_subdev *source, *sink; +struct imx_media_link *link; +struct imx_media_pad *pad; +u16 source_pad, sink_pad; +int num_pads, i, j, k; +int ret =0 ; + +for (i =0 ; i < imxmd->num_subdevs; i++) { + local_sd = &imxmd->subdev[i]; + num_pads = local_sd->num_sink_pads + local_sd->num_src_pads; +
Quoted 8 lines
drivers/staging/media/imx/imx-media-dev.c line 262
Quoted 7 lines
drivers/staging/media/imx/imx-media-dev.c new file +6
-0+for (j =0 ; j < num_pads; j++) { + pad = &local_sd->pad[j]; + +for (k =0 ; k < pad->num_links; k++) { + link = &pad->link[k]; +Indentation depth is quite terrific.
yes, it needs to iterate by subdev, pads in the subdev, then links in the pad. But I moved the code under the innermost loop into a function imx_media_create_link(), which creates a single media link. So it's not so much an eye-sore now.
Quoted 9 lines
drivers/staging/media/imx/imx-media-dev.c line 470
Quoted 8 lines
drivers/staging/media/imx/imx-media-dev.c new file +6
-0+static struct platform_driver imx_media_pdrv = { + .probe = imx_media_probe, + .remove = imx_media_remove, + .driver = { + .name =DEVICE_NAME , + .owner =THIS_MODULE ,Setting of .owner is not needed nowadays IIRC.
a quick look at struct device_driver definition didn't mention that .owner member is deprecated or not needed, so for now I'll leave it in place. We can revisit that later.
Quoted 27 lines
Quoted 27 lines
drivers/staging/media/imx/imx-media-dev.c new file +9
-0+ .of_match_table = imx_media_dt_ids, + }, +}; + +module_platform_driver (imx_media_pdrv); + +MODULE_DESCRIPTION ("i.MX5/6 v4l2 media controller driver" ); +MODULE_AUTHOR ("Steve Longerbeam <[email protected]>" ); +MODULE_LICENSE ("GPL" );drivers/staging/media/imx/imx-media-fim.c new file +11
-0@@ -0,0 +1,509 @@ +/* +* Frame Interval Monitor. +* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h>
Quoted 8 lines
drivers/staging/media/imx/imx-media-fim.c line 17
Quoted 6 lines
drivers/staging/media/imx/imx-media-fim.c new file +6
-0+#include <linux/delay.h> +#include <linux/slab.h> +#include <linux/platform_device.h> +#ifdef CONFIG_IMX_GPT_ICAP +#include <linux/mxc_icap.h> +#endif This looks clumsy. Include it unconditionally, if needed do #ifdef's inside the header file.
The i.MX input capture patch will come later. These are just placeholders until then, the config name could even change. For now I just removed the above conditional include.
Quoted 5 lines
drivers/staging/media/imx/imx-media-fim.c line 20
Quoted 4 lines
drivers/staging/media/imx/imx-media-fim.c new file +3
-0+#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h> Please sort out the list alphabetically.
done.
Quoted 9 lines
drivers/staging/media/imx/imx-media-fim.c line 419
Quoted 8 lines
drivers/staging/media/imx/imx-media-fim.c new file +8
-0+if (IS_ENABLED (CONFIG_IMX_GPT_ICAP )) { + ret =of_property_read_u32_array (fim_np, +"input-capture-channel" , + icap,2 ); +if (!ret) { + fim->icap_channel = icap[0 ]; + fim->icap_flags = icap[1 ]; + }Should you return error otherwise?
nope, it's an optional property.
Quoted 18 lines
Quoted 18 lines
drivers/staging/media/imx/imx-media-of.c new file +11
-0@@ -0,0 +1,291 @@ +/* +* Media driver for Freescale i.MX5/6 SOC +* +* Open Firmware parsing. +* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version.
Quoted 8 lines
drivers/staging/media/imx/imx-media-of.c line 18
Quoted 7 lines
drivers/staging/media/imx/imx-media-of.c new file +7
-0+*/ +#include <linux/of_platform.h> +#include <media/v4l2-device.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h> Please sort out the list alphabetically.
done.
Quoted 15 lines
Quoted 4 lines
drivers/staging/media/imx/imx-media-of.c new file +3
-0+static int of_get_port_count (const struct device_node *np) +{ +struct device_node *child;drivers/staging/media/imx/imx-media-of.c line 100
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+int num =0 ; + +/* if this node is itself a port, return 1 */ +if (of_node_cmp (np->name,"port" ) ==0 ) +return 1 ; + +for_each_child_of_node (np, child) { +if (of_node_cmp (child->name,"port" ) ==0 ) + num++; + }Unneeded bracers.
fixed.
Quoted 21 lines
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +9
-0+static struct imx_media_subdev * +of_parse_subdev (struct imx_media_dev *imxmd,struct device_node *sd_np, +bool is_csi_port) +{ +struct imx_media_subdev *imxsd; +int i, num_pads, ret; + +if (!of_device_is_available (sd_np)) { + dev_dbg(imxmd->dev, "%s: %s not enabled\n", __func__,drivers/staging/media/imx/imx-media-of.c line 155
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+ sd_np->name); +return NULL ; + } + +/* register this subdev with async notifier */ + imxsd =imx_media_add_async_subdev (imxmd, sd_np,NULL ); +if (!imxsd) +return NULL ; +if (IS_ERR (imxsd)) +return imxsd;if (
IS_ERR_OR_NULL(imxsd))
Quoted 1 line
return imxsd;
yep, done.
Quoted 6 lines
drivers/staging/media/imx/imx-media-of.c line 191
Quoted 5 lines
drivers/staging/media/imx/imx-media-of.c new file +5
-0+ +if (imxsd->num_sink_pads ==0 ) { +/* this might be a sensor */ +of_parse_sensor (imxmd, imxsd, sd_np); + }Unneeded bracers.
ok removed.
Quoted 8 lines
drivers/staging/media/imx/imx-media-of.c line 197
Quoted 7 lines
drivers/staging/media/imx/imx-media-of.c new file +6
-0+ +for (i =0 ; i < num_pads; i++) { +struct device_node *epnode =NULL , *port, *remote_np; +struct imx_media_subdev *remote_imxsd; +struct imx_media_pad *pad; +int remote_pad;Too deep indentation, may be move the cycle body into a separate function?
in this case I prefer not to, of_parse_subdev() is called recursively, and I think it's bad form to hide that fact by moving the recursive call into a separate function. The indentation is not that deep, only two loops deep.
Quoted 16 lines
Quoted 5 lines
drivers/staging/media/imx/imx-media-of.c new file +4
-0+ +/* init this pad */ + pad = &imxsd->pad[i]; + pad->pad.flags = (i < imxsd->num_sink_pads) ?drivers/staging/media/imx/imx-media-of.c line 211
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+ MEDIA_PAD_FL_SINK :MEDIA_PAD_FL_SOURCE ; + +if (is_csi_port) + port = (i < imxsd->num_sink_pads) ? sd_np :NULL ; +else + port =of_graph_get_port_by_id (sd_np, i); +if (!port) +continue ; + +while ((epnode =of_get_next_child (port, epnode))) {Please reuse
for_each_child_of_node()here.
done.
Quoted 5 lines
drivers/staging/media/imx/imx-media-of.c line 214
Quoted 4 lines
drivers/staging/media/imx/imx-media-of.c new file +3
-0+of_get_remote_pad (epnode, &remote_np, &remote_pad); +if (!remote_np) { +of_node_put (epnode);Please remove
of_node_put()here,of_get_next_child()does it.
oops, good catch, fixed.
Quoted 16 lines
Quoted 16 lines
drivers/staging/media/imx/imx-media-of.c new file +15
-0+continue ; + } + + ret =of_add_pad_link (imxmd, pad, sd_np, remote_np, + i, remote_pad); +if (ret) { + imxsd =ERR_PTR (ret); +break ; + } + +if (i < imxsd->num_sink_pads) { +/* follow sink endpoints upstream */ + remote_imxsd =of_parse_subdev (imxmd, + remote_np, + false);
Quoted 8 lines
drivers/staging/media/imx/imx-media-of.c line 237
Quoted 8 lines
drivers/staging/media/imx/imx-media-of.c new file +8
-0+if (IS_ERR (remote_imxsd)) { + imxsd = remote_imxsd; +break ; + } + } + +of_node_put (remote_np); +of_node_put (epnode);
also removed this put of epnode.
Quoted 9 lines
drivers/staging/media/imx/imx-media-of.c line 257
Quoted 8 lines
drivers/staging/media/imx/imx-media-of.c new file +7
-0+ +int imx_media_of_parse (struct imx_media_dev *imxmd, +struct imx_media_subdev *(*csi)[4 ], +struct device_node *np) +{ +struct device_node *csi_np; +struct imx_media_subdev *lcsi;Please swap two lines above to get the reverse christmas tree ordering.
done.
Quoted 10 lines
Quoted 10 lines
drivers/staging/media/imx/imx-media-of.c new file +9
-0+u32 ipu_id, csi_id; +int i, ret; + +for (i =0 ; ; i++) { + csi_np =of_parse_phandle (np,"ports" , i); +if (!csi_np) +break ; + + lcsi =of_parse_subdev (imxmd, csi_np, true);
Quoted 8 lines
drivers/staging/media/imx/imx-media-of.c line 272
Quoted 6 lines
drivers/staging/media/imx/imx-media-of.c new file +6
-0+if (IS_ERR (lcsi)) { + ret =PTR_ERR (lcsi); + goto err_put; + } + +of_property_read_u32 (csi_np,"reg" , &csi_id);Not sure if it is safe enough to ignore return value and potentially left
csi_iduninitialized.
The CSI nodes are port nodes, and the reg property is required, so I added a check and error return here.
Quoted 13 lines
drivers/staging/media/imx/imx-media-of.c line 282
Quoted 11 lines
drivers/staging/media/imx/imx-media-of.c new file +10
-0+ ipu_id =of_alias_get_id (csi_np->parent,"ipu" ); + +if (ipu_id >1 || csi_id >1 ) { +dev_err (imxmd->dev,"%s: invalid ipu/csi id (%u/%u)\n" , + __func__, ipu_id, csi_id); + ret = -EINVAL ; + goto err_put; + } + +of_node_put (csi_np);You can put the node right after
of_alias_get_id()call, then in case of error return right from the if block and remove the goto label.
done.
Quoted 25 lines
Quoted 25 lines
drivers/staging/media/imx/imx-media-of.c new file +9
-0+ + (*csi)[ipu_id *2 + csi_id] = lcsi; + } + +return 0 ; +err_put: +of_node_put (csi_np); +return ret; +}drivers/staging/media/imx/imx-media-of.h new file +9
-0@@ -0,0 +1,25 @@ +/* +* V4L2 Media Controller Driver for Freescale i.MX5/6 SOC +* +* Open Firmware parsing. +* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by
Quoted 8 lines
drivers/staging/media/imx/imx-media-of.h line 15
Quoted 6 lines
drivers/staging/media/imx/imx-media-of.h new file +6
-0+* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#ifndef _IMX_MEDIA_OF_H +#define _IMX_MEDIA_OF_H +I do believe you should include some headers or add declarations of "struct
imx_media_dev", "structimx_media_subdev", "structdevice_node".
actually imx-media-of.h isn't really needed, I just moved those prototypes into imx-media.h and removed imx-media-of.h.
Quoted 11 lines
Quoted 11 lines
drivers/staging/media/imx/imx-media.h new file +5
-0@@ -0,0 +1,299 @@ +/* +* V4L2 Media Controller Driver for Freescale i.MX5/6 SOC +* +* Copyright (c) 2016 Mentor Graphics Inc. +*
Quoted 8 lines
drivers/staging/media/imx/imx-media.h line 12
Quoted 7 lines
drivers/staging/media/imx/imx-media.h new file +7
-0+* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#ifndef _IMX_MEDIA_H +#define _IMX_MEDIA_HPlease insert here an empty line to improve readability.
done.
Quoted 6 lines
drivers/staging/media/imx/imx-media.h line 16
Quoted 5 lines
drivers/staging/media/imx/imx-media.h new file +4
-0+#include <media/v4l2-device.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-ctrls.h> +#include <media/v4l2-of.h> Please sort out the list alphabetically.
done.
Steve
Steve Longerbeam
maintainerPATCH v2 11/19 media: imx: Add CSI subdev driver
In reply to Steve LongerbeamThis is a media entity subdevice for the i.MX Camera Serial Interface module.
--- drivers/staging/media/imx/Kconfig | 13 + drivers/staging/media/imx/Makefile | 2 + drivers/staging/media/imx/imx-csi.c | 638 ++++++++++++++++++++++++++++++++++++ 3 files changed, 653 insertions(+) create mode 100644 drivers/staging/media/imx/imx-csi.c
drivers/staging/media/imx/Kconfig +13 -0
@@ -6,3 +6,16 @@ config VIDEO_IMX_MEDIA Say yes here to enable support for video4linux media controller driver for the i.MX5/6 SOC. +if VIDEO_IMX_MEDIA +menu "i.MX5/6 Media Sub devices" + +config VIDEO_IMX_CAMERA + tristate "i.MX5/6 Camera driver" + depends on VIDEO_IMX_MEDIA && VIDEO_DEV && I2C + select VIDEOBUF2_DMA_CONTIG + default y + ---help--- + A video4linux camera capture driver for i.MX5/6. + +endmenu +endif
drivers/staging/media/imx/Makefile +2 -0
@@ -4,3 +4,5 @@ imx-media-objs := imx-media-dev.o imx-media-fim.o imx-media-internal-sd.o \ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o +
drivers/staging/media/imx/imx-csi.c new file +638 -0
638 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 11/19] media: imx: Add CSI subdev driver
Quoted 5 lines · Steve Longerbeam
This is a media entity subdevice for the i.MX Camera Serial Interface module.
Signed-off-by Steve Longerbeam <[email protected]>---
[snip]
Quoted 13 lines
drivers/staging/media/imx/imx-csi.c new file +7
-0@@ -0,0 +1,638 @@ +/* +* V4L2 Capture CSI Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2014-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by
drivers/staging/media/imx/imx-csi.c line 17
Quoted 10 lines
drivers/staging/media/imx/imx-csi.c new file +10
-0+* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/platform_device.h> +#include <media/v4l2-device.h> +#include <media/v4l2-subdev.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h>
Please add the headers alphabetically ordered.
Quoted 78 lines
drivers/staging/media/imx/imx-csi.c new file +78
-0+#include <video/imx-ipu-v3.h> +#include "imx-media.h" + +#define CSI_NUM_PADS 2 + +struct csi_priv { +struct device *dev; +struct ipu_soc *ipu; +struct imx_media_dev *md; +struct v4l2_subdev sd; +struct media_pad pad[CSI_NUM_PADS ]; +struct v4l2_mbus_framefmt format_mbus[CSI_NUM_PADS ]; +struct v4l2_mbus_config sensor_mbus_cfg; +struct v4l2_rect crop; +struct ipu_csi *csi; +int csi_id; +int input_pad; +int output_pad; +bool power_on;/* power is on */ +bool stream_on;/* streaming is on */ + +/* the sink for the captured frames */ +struct v4l2_subdev *sink_sd; +enum ipu_csi_dest dest; +struct v4l2_subdev *src_sd; + +struct v4l2_ctrl_handler ctrl_hdlr; +struct imx_media_fim *fim; + +/* the attached sensor at stream on */ +struct imx_media_subdev *sensor; +}; + +static inline struct csi_priv *sd_to_dev (struct v4l2_subdev *sdev) +{ + return container_of(sdev, struct csi_priv, sd); +} + +/* Update the CSI whole sensor and active windows */ +static int csi_setup (struct csi_priv *priv) +{ +struct v4l2_mbus_framefmt infmt; + +ipu_csi_set_window (priv->csi, &priv->crop); + +/* +* the ipu-csi doesn't understand ALTERNATE, but it only +* needs to know whether the stream is interlaced, so set +* to INTERLACED if infmt field is ALTERNATE. +*/ + infmt = priv->format_mbus[priv->input_pad]; +if (infmt.field ==V4L2_FIELD_ALTERNATE ) + infmt.field =V4L2_FIELD_INTERLACED ; + +ipu_csi_init_interface (priv->csi, &priv->sensor_mbus_cfg, &infmt); + +ipu_csi_set_dest (priv->csi, priv->dest); + +ipu_csi_dump (priv->csi); + +return 0 ; +} + +static int csi_start (struct csi_priv *priv) +{ +int ret; + +if (!priv->sensor) { +v4l2_err (&priv->sd,"no sensor attached\n" ); +return -EINVAL ; + } + + ret =csi_setup (priv); +if (ret) +return ret; + +/* start the frame interval monitor */ + ret =imx_media_fim_set_stream (priv->fim, priv->sensor, true);
drivers/staging/media/imx/imx-csi.c line 105
Quoted 10 lines
drivers/staging/media/imx/imx-csi.c new file +10
-0+if (ret) +return ret; + + ret =ipu_csi_enable (priv->csi); +if (ret) { +v4l2_err (&priv->sd,"CSI enable error: %d\n" , ret); +return ret; + } + +return 0 ;
if (ret)
v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);
return ret;
Quoted 56 lines
drivers/staging/media/imx/imx-csi.c new file +56
-0+} + +static void csi_stop (struct csi_priv *priv) +{ +/* stop the frame interval monitor */ +imx_media_fim_set_stream (priv->fim, priv->sensor, false); + +ipu_csi_disable (priv->csi); +} + +static int csi_s_stream (struct v4l2_subdev *sd,int enable) +{ +struct csi_priv *priv =v4l2_get_subdevdata (sd); +int ret =0 ; + +if (!priv->src_sd || !priv->sink_sd) +return -EPIPE ; + +v4l2_info (sd,"stream %s\n" , enable ?"ON" :"OFF" ); + +if (enable && !priv->stream_on) + ret =csi_start (priv); +else if (!enable && priv->stream_on) +csi_stop (priv); + +if (!ret) + priv->stream_on = enable; +return ret; +} + +static int csi_s_power (struct v4l2_subdev *sd,int on) +{ +struct csi_priv *priv =v4l2_get_subdevdata (sd); +int ret =0 ; + +v4l2_info (sd,"power %s\n" , on ?"ON" :"OFF" ); + +if (on != priv->power_on) + ret =imx_media_fim_set_power (priv->fim, on); + +if (!ret) + priv->power_on = on; +return ret; +} + +static int csi_link_setup (struct media_entity *entity, +const struct media_pad *local, +const struct media_pad *remote,u32 flags) +{ +struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity); +struct csi_priv *priv =v4l2_get_subdevdata (sd); +struct v4l2_subdev *remote_sd; + +dev_dbg (priv->dev,"link setup %s -> %s" , remote->entity->name, + local->entity->name); +
drivers/staging/media/imx/imx-csi.c line 171
Quoted 10 lines
drivers/staging/media/imx/imx-csi.c new file +10
-0+ remote_sd =media_entity_to_v4l2_subdev (remote->entity); + +if (local->flags &MEDIA_PAD_FL_SINK ) { +if (flags &MEDIA_LNK_FL_ENABLED ) { +if (priv->src_sd) +return -EBUSY ; + priv->src_sd = remote_sd; + }else { + priv->src_sd =NULL ; +return 0 ;
You can remove the return above.
Quoted 5 lines
drivers/staging/media/imx/imx-csi.c new file +5
-0+ } + +return 0 ; + } +
[snip]
Quoted 36 lines
drivers/staging/media/imx/imx-csi.c new file +36
-0+ +static int imx_csi_probe (struct platform_device *pdev) +{ +struct ipu_client_platformdata *pdata; +struct csi_priv *priv; +int ret; + + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + +platform_set_drvdata (pdev, &priv->sd); + priv->dev = &pdev->dev; + +/* get parent IPU */ + priv->ipu =dev_get_drvdata (priv->dev->parent); + +/* get our CSI id */ + pdata = priv->dev->platform_data; + priv->csi_id = pdata->csi; + +v4l2_subdev_init (&priv->sd, &csi_subdev_ops); +v4l2_set_subdevdata (&priv->sd, priv); + priv->sd.internal_ops = &csi_internal_ops; + priv->sd.entity.ops = &csi_entity_ops; +/* FIXME: this the right function? */ + priv->sd.entity.function =MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER ; + priv->sd.grp_id = priv->csi_id ? +IMX_MEDIA_GRP_ID_CSI1 :IMX_MEDIA_GRP_ID_CSI0 ; + priv->sd.dev = &pdev->dev; + priv->sd.owner =THIS_MODULE ; + priv->sd.flags =V4L2_SUBDEV_FL_HAS_DEVNODE |V4L2_SUBDEV_FL_HAS_EVENTS ; +imx_media_grp_id_to_sd_name (priv->sd.name,sizeof (priv->sd.name), + priv->sd.grp_id,ipu_get_num (priv->ipu)); + +v4l2_ctrl_handler_init (&priv->ctrl_hdlr,0 );
drivers/staging/media/imx/imx-csi.c line 599
Quoted 10 lines
drivers/staging/media/imx/imx-csi.c new file +10
-0+ priv->sd.ctrl_handler = &priv->ctrl_hdlr; + + ret =v4l2_async_register_subdev (&priv->sd); +if (ret) + goto free_ctrls; + +return 0 ; +free_ctrls: +v4l2_ctrl_handler_free (&priv->ctrl_hdlr); +return ret;
This is a functionally equal and simplified version:
if (ret)
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
return ret;
Quoted 21 lines
drivers/staging/media/imx/imx-csi.c new file +21
-0+} + +static int imx_csi_remove (struct platform_device *pdev) +{ +struct v4l2_subdev *sd =platform_get_drvdata (pdev); +struct csi_priv *priv =sd_to_dev (sd); + +imx_media_fim_free (priv->fim); +v4l2_async_unregister_subdev (&priv->sd); +media_entity_cleanup (&priv->sd.entity); +v4l2_device_unregister_subdev (sd); + +if (!IS_ERR_OR_NULL (priv->csi)) +ipu_csi_put (priv->csi); + +return 0 ; +} + +static const struct platform_device_id imx_csi_ids[] = { + { .name ="imx-ipuv3-csi" }, + { },
drivers/staging/media/imx/imx-csi.c line 630
Quoted 10 lines
drivers/staging/media/imx/imx-csi.c new file +10
-0+}; +MODULE_DEVICE_TABLE (platform, imx_csi_ids); + +static struct platform_driver imx_csi_driver = { + .probe = imx_csi_probe, + .remove = imx_csi_remove, + .id_table = imx_csi_ids, + .driver = { + .name ="imx-ipuv3-csi" , + .owner =THIS_MODULE ,
Please drop .owner.
drivers/staging/media/imx/imx-csi.c line 638
Quoted 9 lines
drivers/staging/media/imx/imx-csi.c new file +8
-0+ }, +}; +module_platform_driver (imx_csi_driver); + +MODULE_DESCRIPTION ("i.MX CSI subdev driver" ); +MODULE_AUTHOR ("Steve Longerbeam <[email protected]>" ); +MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:imx-ipuv3-csi" );
--
With best wishes,
Vladimir
Steve Longerbeam
maintainerRe: [PATCH v2 11/19] media: imx: Add CSI subdev driver
Quoted 17 lines · Vladimir Zapolskiy
Quoted 17 lines
drivers/staging/media/imx/imx-csi.c new file +10
-0@@ -0,0 +1,638 @@ +/* +* V4L2 Capture CSI Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2014-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/
Quoted 8 lines
drivers/staging/media/imx/imx-csi.c line 17
Quoted 7 lines
drivers/staging/media/imx/imx-csi.c new file +7
-0+#include <linux/module.h> +#include <linux/platform_device.h> +#include <media/v4l2-device.h> +#include <media/v4l2-subdev.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h> Please add the headers alphabetically ordered.
done.
Quoted 27 lines
Quoted 16 lines
drivers/staging/media/imx/imx-csi.c new file +16
-0+ +static int csi_start (struct csi_priv *priv) +{ +int ret; + +if (!priv->sensor) { +v4l2_err (&priv->sd,"no sensor attached\n" ); +return -EINVAL ; + } + + ret =csi_setup (priv); +if (ret) +return ret; + +/* start the frame interval monitor */ + ret =imx_media_fim_set_stream (priv->fim, priv->sensor, true);drivers/staging/media/imx/imx-csi.c line 105
Quoted 10 lines
drivers/staging/media/imx/imx-csi.c new file +10
-0+if (ret) +return ret; + + ret =ipu_csi_enable (priv->csi); +if (ret) { +v4l2_err (&priv->sd,"CSI enable error: %d\n" , ret); +return ret; + } + +return 0 ;if (ret)
Quoted 3 lines
v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);return ret;
I failed to cleanup in this path, so it is now:
ret = ipu_csi_enable(priv->csi);
if (ret) {
v4l2_err(&priv->sd, "CSI enable error: %d\n", ret);
goto fim_off;
}
return 0;
fim_off:
if (priv->fim)
imx_media_fim_set_stream(priv->fim, priv->sensor, false);
return ret;Quoted 15 lines
Quoted 15 lines
drivers/staging/media/imx/imx-csi.c new file +15
-0+ +static int csi_link_setup (struct media_entity *entity, +const struct media_pad *local, +const struct media_pad *remote,u32 flags) +{ +struct v4l2_subdev *sd =media_entity_to_v4l2_subdev (entity); +struct csi_priv *priv =v4l2_get_subdevdata (sd); +struct v4l2_subdev *remote_sd; + +dev_dbg (priv->dev,"link setup %s -> %s" , remote->entity->name, + local->entity->name); + + remote_sd =media_entity_to_v4l2_subdev (remote->entity); + +if (local->flags &MEDIA_PAD_FL_SINK ) {
Quoted 8 lines
drivers/staging/media/imx/imx-csi.c line 171
Quoted 7 lines
drivers/staging/media/imx/imx-csi.c new file +7
-0+if (flags &MEDIA_LNK_FL_ENABLED ) { +if (priv->src_sd) +return -EBUSY ; + priv->src_sd = remote_sd; + }else { + priv->src_sd =NULL ; +return 0 ;You can remove the return above.
right, fixed.
Quoted 12 lines
drivers/staging/media/imx/imx-csi.c line 599
Quoted 10 lines
drivers/staging/media/imx/imx-csi.c new file +9
-0+ + ret =v4l2_async_register_subdev (&priv->sd); +if (ret) + goto free_ctrls; + +return 0 ; +free_ctrls: +v4l2_ctrl_handler_free (&priv->ctrl_hdlr); +return ret;This is a functionally equal and simplified version:
Quoted 4 lines
if (ret)
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);return ret;
thanks, done.
Quoted 9 lines
drivers/staging/media/imx/imx-csi.c line 630
Quoted 8 lines
drivers/staging/media/imx/imx-csi.c new file +8
-0+ +static struct platform_driver imx_csi_driver = { + .probe = imx_csi_probe, + .remove = imx_csi_remove, + .id_table = imx_csi_ids, + .driver = { + .name ="imx-ipuv3-csi" , + .owner =THIS_MODULE ,Please drop .owner.
ok, I tested this and there are no regressions, done for all modules.
Steve
Steve Longerbeam
maintainerPATCH v2 12/19 media: imx: Add SMFC subdev driver
In reply to Steve LongerbeamThis is a media entity subdevice driver for the i.MX Sensor Multi-FIFO Controller module. Video frames are received from the CSI and can be routed to various sinks including the i.MX Image Converter for scaling, color-space conversion, motion compensated deinterlacing, and image rotation.
--- drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/imx-smfc.c | 739 +++++++++++++++++++++++++++++++++++ 2 files changed, 740 insertions(+) create mode 100644 drivers/staging/media/imx/imx-smfc.c
drivers/staging/media/imx/Makefile +1 -0
@@ -5,4 +5,5 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
drivers/staging/media/imx/imx-smfc.c new file +739 -0
739 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 12/19] media: imx: Add SMFC subdev driver
Quoted 18 lines · Steve Longerbeam
This is a media entity subdevice driver for the i.MX Sensor Multi-FIFO Controller module. Video frames are received from the CSI and can be routed to various sinks including the i.MX Image Converter for scaling, color-space conversion, motion compensated deinterlacing, and image rotation.
Signed-off-by Steve Longerbeam <[email protected]>--- drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/imx-smfc.c | 739 +++++++++++++++++++++++++++++++++++ 2 files changed, 740 insertions(+) create mode 100644 drivers/staging/media/imx/imx-smfc.cdrivers/staging/media/imx/Makefile +0
-0
drivers/staging/media/imx/Makefile obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o · line 8
Quoted 4 lines
drivers/staging/media/imx/Makefile +1
-0@@ -5,4 +5,5 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
May be
obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o imx-smfc.o
Quoted 26 lines
drivers/staging/media/imx/imx-smfc.c new file +19
-0@@ -0,0 +1,739 @@ +/* +* V4L2 Capture SMFC Subdev for Freescale i.MX5/6 SOC +* +* This subdevice handles capture of raw/unconverted video frames +* from the CSI, directly to memory via the Sensor Multi-FIFO Controller. +* +* Copyright (c) 2012-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h> +#include <linux/slab.h>
drivers/staging/media/imx/imx-smfc.c line 29
Quoted 10 lines
drivers/staging/media/imx/imx-smfc.c new file +10
-0+#include <linux/interrupt.h> +#include <linux/spinlock.h> +#include <linux/platform_device.h> +#include <linux/pinctrl/consumer.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h>
Please sort the list of headers alphabetically.
Quoted 3 lines
drivers/staging/media/imx/imx-smfc.c new file +3
-0+#include <media/imx.h> +#include "imx-media.h" +
[snip]
drivers/staging/media/imx/imx-smfc.c line 144
Quoted 7 lines
drivers/staging/media/imx/imx-smfc.c new file +7
-0+static irqreturn_t imx_smfc_eof_interrupt (int irq,void *dev_id) +{ +struct imx_smfc_priv *priv = dev_id; +struct imx_media_dma_buf *done, *next; +unsigned long flags; + +spin_lock_irqsave (&priv->irqlock, flags);
spin_lock(&priv->irqlock) should be sufficient.
Quoted 41 lines
drivers/staging/media/imx/imx-smfc.c new file +41
-0+ +if (priv->last_eof) { +complete (&priv->last_eof_comp); + priv->last_eof = false; + goto unlock; + } + +/* inform CSI of this EOF so it can monitor frame intervals */ +v4l2_subdev_call (priv->src_sd, core, interrupt_service_routine, +0 ,NULL ); + + done =imx_media_dma_buf_get_active (priv->out_ring); +/* give the completed buffer to the sink */ +if (!WARN_ON (!done)) +imx_media_dma_buf_done (done,IMX_MEDIA_BUF_STATUS_DONE ); + +/* priv->next buffer is now the active one */ +imx_media_dma_buf_set_active (priv->next); + +/* bump the EOF timeout timer */ +mod_timer (&priv->eof_timeout_timer, + jiffies +msecs_to_jiffies (IMX_MEDIA_EOF_TIMEOUT )); + +if (ipu_idmac_buffer_is_ready (priv->smfc_ch, priv->ipu_buf_num)) +ipu_idmac_clear_buffer (priv->smfc_ch, priv->ipu_buf_num); + +/* get next queued buffer */ + next =imx_media_dma_buf_get_next_queued (priv->out_ring); + +ipu_cpmem_set_buffer (priv->smfc_ch, priv->ipu_buf_num, next->phys); +ipu_idmac_select_buffer (priv->smfc_ch, priv->ipu_buf_num); + +/* toggle IPU double-buffer index */ + priv->ipu_buf_num ^=1 ; + priv->next = next; + +unlock: +spin_unlock_irqrestore (&priv->irqlock, flags); +return IRQ_HANDLED ; +} +
[snip]
Quoted 4 lines
drivers/staging/media/imx/imx-smfc.c new file +4
-0+ +static const struct platform_device_id imx_smfc_ids[] = { + { .name ="imx-ipuv3-smfc" }, + { },
drivers/staging/media/imx/imx-smfc.c line 731
Quoted 10 lines
drivers/staging/media/imx/imx-smfc.c new file +10
-0+}; +MODULE_DEVICE_TABLE (platform, imx_smfc_ids); + +static struct platform_driver imx_smfc_driver = { + .probe = imx_smfc_probe, + .remove = imx_smfc_remove, + .id_table = imx_smfc_ids, + .driver = { + .name ="imx-ipuv3-smfc" , + .owner =THIS_MODULE ,
You can drop owner assignment.
drivers/staging/media/imx/imx-smfc.c line 739
Quoted 9 lines
drivers/staging/media/imx/imx-smfc.c new file +8
-0+ }, +}; +module_platform_driver (imx_smfc_driver); + +MODULE_DESCRIPTION ("i.MX SMFC subdev driver" ); +MODULE_AUTHOR ("Steve Longerbeam <[email protected]>" ); +MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:imx-ipuv3-smfc" );
--
With best wishes,
Vladimir
Steve Longerbeam
maintainerRe: [PATCH v2 12/19] media: imx: Add SMFC subdev driver
Quoted 21 lines · Vladimir Zapolskiy
Quoted 20 lines · Steve Longerbeam
This is a media entity subdevice driver for the i.MX Sensor Multi-FIFO Controller module. Video frames are received from the CSI and can be routed to various sinks including the i.MX Image Converter for scaling, color-space conversion, motion compensated deinterlacing, and image rotation.
Signed-off-by Steve Longerbeam <[email protected]>--- drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/imx-smfc.c | 739 +++++++++++++++++++++++++++++++++++ 2 files changed, 740 insertions(+)create mode 100644
drivers/staging/media/imx/imx-smfc.cdrivers/staging/media/imx/Makefile +0
-0@@ -5,4 +5,5 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o
Quoted 5 lines
drivers/staging/media/imx/Makefile obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o · line 8
Quoted 2 lines
drivers/staging/media/imx/Makefile +1
-0obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.oMay be
obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o imx-smfc.o
I'd prefer to keep them on separate lines, to indicate they are all built as separate modules.
Quoted 30 lines
Quoted 30 lines
drivers/staging/media/imx/imx-smfc.c new file +22
-0@@ -0,0 +1,739 @@ +/* +* V4L2 Capture SMFC Subdev for Freescale i.MX5/6 SOC +* +* This subdevice handles capture of raw/unconverted video frames +* from the CSI, directly to memory via the Sensor Multi-FIFO Controller. +* +* Copyright (c) 2012-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/interrupt.h> +#include <linux/spinlock.h> +#include <linux/platform_device.h>
Quoted 8 lines
drivers/staging/media/imx/imx-smfc.c line 29
Quoted 7 lines
drivers/staging/media/imx/imx-smfc.c new file +7
-0+#include <linux/pinctrl/consumer.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h> Please sort the list of headers alphabetically.
done.
Quoted 9 lines
drivers/staging/media/imx/imx-smfc.c line 144
Quoted 8 lines
drivers/staging/media/imx/imx-smfc.c new file +7
-0+static irqreturn_t imx_smfc_eof_interrupt (int irq,void *dev_id) +{ +struct imx_smfc_priv *priv = dev_id; +struct imx_media_dma_buf *done, *next; +unsigned long flags; + +spin_lock_irqsave (&priv->irqlock, flags);
spin_lock(&priv->irqlock)should be sufficient.
yes thanks.
Quoted 16 lines
Quoted 5 lines
drivers/staging/media/imx/imx-smfc.c new file +4
-0+ +static const struct platform_device_id imx_smfc_ids[] = { + { .name ="imx-ipuv3-smfc" }, + { },drivers/staging/media/imx/imx-smfc.c line 731
Quoted 10 lines
drivers/staging/media/imx/imx-smfc.c new file +10
-0+}; +MODULE_DEVICE_TABLE (platform, imx_smfc_ids); + +static struct platform_driver imx_smfc_driver = { + .probe = imx_smfc_probe, + .remove = imx_smfc_remove, + .id_table = imx_smfc_ids, + .driver = { + .name ="imx-ipuv3-smfc" , + .owner =THIS_MODULE ,You can drop owner assignment.
done.
Steve
Steve Longerbeam
maintainerPATCH v2 13/19 media: imx: Add IC subdev drivers
In reply to Steve LongerbeamThis is a set of three media entity subdevice drivers for the i.MX Image Converter. The i.MX IC module contains three independent "tasks":
- Pre-processing Encode task: video frames are routed directly from the CSI and can be scaled, color-space converted, and rotated. Scaled output is limited to 1024x1024 resolution. Output frames are routed to the camera interface entities (camif).
- Pre-processing Viewfinder task: this task can perform the same conversions as the pre-process encode task, but in addition can be used for hardware motion compensated deinterlacing. Frames can come either directly from the CSI or from the SMFC entities (memory buffers via IDMAC channels). Scaled output is limited to 1024x1024 resolution. Output frames can be routed to various sinks including the post-processing task entities.
- Post-processing task: same conversions as pre-process encode. However this entity sends frames to the i.MX IPU image converter which supports image tiling, which allows scaled output up to 4096x4096 resolution. Output frames can be routed to the camera interfaces.
--- drivers/staging/media/imx/Makefile | 2 + drivers/staging/media/imx/imx-ic-common.c | 113 +++ drivers/staging/media/imx/imx-ic-pp.c | 636 ++++++++++++++++ drivers/staging/media/imx/imx-ic-prpenc.c | 1037 +++++++++++++++++++++++++ drivers/staging/media/imx/imx-ic-prpvf.c | 1180 +++++++++++++++++++++++++++++ drivers/staging/media/imx/imx-ic.h | 36 + 6 files changed, 3004 insertions(+) create mode 100644 drivers/staging/media/imx/imx-ic-common.c create mode 100644 drivers/staging/media/imx/imx-ic-pp.c create mode 100644 drivers/staging/media/imx/imx-ic-prpenc.c create mode 100644 drivers/staging/media/imx/imx-ic-prpvf.c create mode 100644 drivers/staging/media/imx/imx-ic.h
drivers/staging/media/imx/Makefile +2 -0
@@ -1,8 +1,10 @@ imx-media-objs := imx-media-dev.o imx-media-fim.o imx-media-internal-sd.o \ imx-media-of.o +imx-ic-objs := imx-ic-common.o imx-ic-prpenc.o imx-ic-prpvf.o imx-ic-pp.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media.o obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-media-common.o +obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o
drivers/staging/media/imx/imx-ic-common.c new file +113 -0
113 lines not on this page · raw message
drivers/staging/media/imx/imx-ic-pp.c new file +636 -0
636 lines not on this page · raw message
drivers/staging/media/imx/imx-ic-prpenc.c new file +1037 -0
1,037 lines not on this page · raw message
drivers/staging/media/imx/imx-ic-prpvf.c new file +1180 -0
1,180 lines not on this page · raw message
drivers/staging/media/imx/imx-ic.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* V4L2 Image Converter Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#ifndef _IMX_IC_H +#define _IMX_IC_H + +struct imx_ic_priv { + struct device *dev; + struct v4l2_subdev sd; + int ipu_id; + int task_id; + void *task_priv; +}; + +struct imx_ic_ops { + struct v4l2_subdev_ops *subdev_ops; + struct v4l2_subdev_internal_ops *internal_ops;
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
Re: [PATCH v2 13/19] media: imx: Add IC subdev drivers
Quoted 24 lines · Steve Longerbeam
This is a set of three media entity subdevice drivers for the i.MX Image Converter. The i.MX IC module contains three independent "tasks":
- Pre-processing Encode task: video frames are routed directly from the CSI and can be scaled, color-space converted, and rotated. Scaled output is limited to 1024x1024 resolution. Output frames are routed to the camera interface entities (camif).
- Pre-processing Viewfinder task: this task can perform the same conversions as the pre-process encode task, but in addition can be used for hardware motion compensated deinterlacing. Frames can come either directly from the CSI or from the SMFC entities (memory buffers via IDMAC channels). Scaled output is limited to 1024x1024 resolution. Output frames can be routed to various sinks including the post-processing task entities.
- Post-processing task: same conversions as pre-process encode. However this entity sends frames to the i.MX IPU image converter which supports image tiling, which allows scaled output up to 4096x4096 resolution. Output frames can be routed to the camera interfaces.
Signed-off-by Steve Longerbeam <[email protected]>---
[snip]
Quoted 43 lines
drivers/staging/media/imx/imx-ic-common.c new file +43
-0+static int imx_ic_probe (struct platform_device *pdev) +{ +struct imx_media_internal_sd_platformdata *pdata; +struct imx_ic_priv *priv; +int ret; + + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + +platform_set_drvdata (pdev, &priv->sd); + priv->dev = &pdev->dev; + +/* get our ipu_id, grp_id and IC task id */ + pdata = priv->dev->platform_data; + priv->ipu_id = pdata->ipu_id; +switch (pdata->grp_id) { +case IMX_MEDIA_GRP_ID_IC_PRPENC : + priv->task_id =IC_TASK_ENCODER ; +break ; +case IMX_MEDIA_GRP_ID_IC_PRPVF : + priv->task_id =IC_TASK_VIEWFINDER ; +break ; + case IMX_MEDIA_GRP_ID_IC_PP0...IMX_MEDIA_GRP_ID_IC_PP3: + priv->task_id =IC_TASK_POST_PROCESSOR ; +break ; +default : +return -EINVAL ; + } + +v4l2_subdev_init (&priv->sd, ic_ops[priv->task_id]->subdev_ops); +v4l2_set_subdevdata (&priv->sd, priv); + priv->sd.internal_ops = ic_ops[priv->task_id]->internal_ops; + priv->sd.entity.ops = ic_ops[priv->task_id]->entity_ops; + priv->sd.entity.function =MEDIA_ENT_F_PROC_VIDEO_SCALER ; + priv->sd.dev = &pdev->dev; + priv->sd.owner =THIS_MODULE ; + priv->sd.flags =V4L2_SUBDEV_FL_HAS_DEVNODE |V4L2_SUBDEV_FL_HAS_EVENTS ; + priv->sd.grp_id = pdata->grp_id; +strncpy (priv->sd.name, pdata->sd_name,sizeof (priv->sd.name)); + + ret = ic_ops[priv->task_id]->init (priv); +if (ret)
drivers/staging/media/imx/imx-ic-common.c line 76
Quoted 10 lines
drivers/staging/media/imx/imx-ic-common.c new file +10
-0+return ret; + + ret =v4l2_async_register_subdev (&priv->sd); +if (ret) + goto remove; + +return 0 ; +remove: + ic_ops[priv->task_id]->remove (priv); +return ret;
if (ret)
ic_ops[priv->task_id]->remove(priv);
return ret;
as an alternative.
[snip]
drivers/staging/media/imx/imx-ic-common.c line 105
Quoted 13 lines
drivers/staging/media/imx/imx-ic-common.c new file +13
-0+static const struct platform_device_id imx_ic_ids[] = { + { .name ="imx-ipuv3-ic" }, + { }, +}; +MODULE_DEVICE_TABLE (platform, imx_ic_ids); + +static struct platform_driver imx_ic_driver = { + .probe = imx_ic_probe, + .remove = imx_ic_remove, + .id_table = imx_ic_ids, + .driver = { + .name ="imx-ipuv3-ic" , + .owner =THIS_MODULE ,
Please drop .owner assignment.
Quoted 29 lines
drivers/staging/media/imx/imx-ic-common.c new file +8
-0+ }, +}; +module_platform_driver (imx_ic_driver); + +MODULE_DESCRIPTION ("i.MX IC subdev driver" ); +MODULE_AUTHOR ("Steve Longerbeam <[email protected]>" ); +MODULE_LICENSE ("GPL" ); +MODULE_ALIAS ("platform:imx-ipuv3-ic" );drivers/staging/media/imx/imx-ic-pp.c new file +15
-0@@ -0,0 +1,636 @@ +/* +* V4L2 IC Post-Processor Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2014-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h>
drivers/staging/media/imx/imx-ic-pp.c line 25
Quoted 10 lines
drivers/staging/media/imx/imx-ic-pp.c new file +10
-0+#include <linux/slab.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/pinctrl/consumer.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h>
Please sort the list of headers alphabetically.
Quoted 5 lines
drivers/staging/media/imx/imx-ic-pp.c new file +5
-0+#include <media/imx.h> +#include <video/imx-ipu-image-convert.h> +#include "imx-media.h" +#include "imx-ic.h" +
[snip]
Quoted 51 lines
drivers/staging/media/imx/imx-ic-pp.c new file +51
-0+ +static int pp_start (struct pp_priv *priv) +{ +struct imx_ic_priv *ic_priv = priv->ic_priv; +struct ipu_image image_in, image_out; +const struct imx_media_pixfmt *incc; +struct v4l2_mbus_framefmt *infmt; +int i, in_size, ret; + +/* ask the sink for the buffer ring */ + ret =v4l2_subdev_call (priv->sink_sd, core, ioctl, +IMX_MEDIA_REQ_DMA_BUF_SINK_RING , + &priv->out_ring); +if (ret) +return ret; + +imx_media_mbus_fmt_to_ipu_image (&image_in, + &priv->format_mbus[priv->input_pad]); +imx_media_mbus_fmt_to_ipu_image (&image_out, + &priv->format_mbus[priv->output_pad]); + + priv->ipu = priv->md->ipu[ic_priv->ipu_id]; + priv->ic_ctx =ipu_image_convert_prepare (priv->ipu, +IC_TASK_POST_PROCESSOR , + &image_in, &image_out, + priv->rot_mode, + pp_convert_complete, priv); +if (IS_ERR (priv->ic_ctx)) +return PTR_ERR (priv->ic_ctx); + + infmt = &priv->format_mbus[priv->input_pad]; + incc = priv->cc[priv->input_pad]; + in_size = (infmt->width * incc->bpp * infmt->height) >>3 ; + +if (priv->in_ring) { +v4l2_warn (&ic_priv->sd,"%s: dma-buf ring was not freed\n" , + __func__); +imx_media_free_dma_buf_ring (priv->in_ring); + } + + priv->in_ring =imx_media_alloc_dma_buf_ring (priv->md, + &priv->src_sd->entity, + &ic_priv->sd.entity, + in_size, +IMX_MEDIA_MIN_RING_BUFS , + true); +if (IS_ERR (priv->in_ring)) { +v4l2_err (&ic_priv->sd, +"failed to alloc dma-buf ring\n" ); + ret =PTR_ERR (priv->in_ring); + priv->in_ring =NULL ;
drivers/staging/media/imx/imx-ic-pp.c line 220
Quoted 10 lines
drivers/staging/media/imx/imx-ic-pp.c new file +10
-0+ goto out_unprep; + } + +for (i =0 ; i <IMX_MEDIA_MIN_RING_BUFS ; i++) +imx_media_dma_buf_queue (priv->in_ring, i); + + priv->out_run =kzalloc (IMX_MEDIA_MAX_RING_BUFS * +sizeof (*priv->out_run),GFP_KERNEL ); +if (!priv->out_run) { +v4l2_err (&ic_priv->sd,"failed to alloc src ring runs\n" );
In OOM situation the core will report it, probably you can drop the message.
Quoted 16 lines
drivers/staging/media/imx/imx-ic-pp.c new file +16
-0+ ret = -ENOMEM ; + goto out_free_ring; + } + + priv->stop = false; + +return 0 ; + +out_free_ring: +imx_media_free_dma_buf_ring (priv->in_ring); + priv->in_ring =NULL ; +out_unprep: +ipu_image_convert_unprepare (priv->ic_ctx); +return ret; +} +
[snip]
Quoted 26 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +20
-0@@ -0,0 +1,1037 @@ +/* +* V4L2 Capture IC Encoder Subdev for Freescale i.MX5/6 SOC +* +* This subdevice handles capture of video frames from the CSI, which +* are routed directly to the Image Converter preprocess encode task, +* for resizing, colorspace conversion, and rotation. +* +* Copyright (c) 2012-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h> +#include <linux/slab.h>
drivers/staging/media/imx/imx-ic-prpenc.c line 30
Quoted 10 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +10
-0+#include <linux/interrupt.h> +#include <linux/spinlock.h> +#include <linux/platform_device.h> +#include <linux/pinctrl/consumer.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h>
Please sort the list of headers alphabetically.
Quoted 4 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +4
-0+#include <media/imx.h> +#include "imx-media.h" +#include "imx-ic.h" +
[snip]
drivers/staging/media/imx/imx-ic-prpenc.c line 178
Quoted 8 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +8
-0+static irqreturn_t prpenc_eof_interrupt (int irq,void *dev_id) +{ +struct prpenc_priv *priv = dev_id; +struct imx_media_dma_buf *done, *next; +struct ipuv3_channel *channel; +unsigned long flags; + +spin_lock_irqsave (&priv->irqlock, flags);
Here spin_lock(&priv->irqlock) should be sufficient.
Quoted 43 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +43
-0+ +if (priv->last_eof) { +complete (&priv->last_eof_comp); + priv->last_eof = false; + goto unlock; + } + +/* inform CSI of this EOF so it can monitor frame intervals */ +v4l2_subdev_call (priv->src_sd, core, interrupt_service_routine, +0 ,NULL ); + + channel = (ipu_rot_mode_is_irt (priv->rot_mode)) ? + priv->enc_rot_out_ch : priv->enc_ch; + + done =imx_media_dma_buf_get_active (priv->out_ring); +/* give the completed buffer to the sink */ +if (!WARN_ON (!done)) +imx_media_dma_buf_done (done,IMX_MEDIA_BUF_STATUS_DONE ); + +/* priv->next buffer is now the active one */ +imx_media_dma_buf_set_active (priv->next); + +/* bump the EOF timeout timer */ +mod_timer (&priv->eof_timeout_timer, + jiffies +msecs_to_jiffies (IMX_MEDIA_EOF_TIMEOUT )); + +if (ipu_idmac_buffer_is_ready (channel, priv->ipu_buf_num)) +ipu_idmac_clear_buffer (channel, priv->ipu_buf_num); + +/* get next queued buffer */ + next =imx_media_dma_buf_get_next_queued (priv->out_ring); + +ipu_cpmem_set_buffer (channel, priv->ipu_buf_num, next->phys); +ipu_idmac_select_buffer (channel, priv->ipu_buf_num); + +/* toggle IPU double-buffer index */ + priv->ipu_buf_num ^=1 ; + priv->next = next; + +unlock: +spin_unlock_irqrestore (&priv->irqlock, flags); +return IRQ_HANDLED ; +}
[snip]
Quoted 35 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +35
-0+static int prpenc_registered (struct v4l2_subdev *sd) +{ +struct prpenc_priv *priv =sd_to_priv (sd); +struct imx_media_subdev *imxsd; +struct imx_media_pad *pad; +int i, ret; + +/* get media device */ + priv->md =dev_get_drvdata (sd->v4l2_dev->dev); + + imxsd =imx_media_find_subdev_by_sd (priv->md, sd); +if (IS_ERR (imxsd)) +return PTR_ERR (imxsd); + +if (imxsd->num_sink_pads !=1 || imxsd->num_src_pads !=1 ) +return -EINVAL ; + +for (i =0 ; i <PRPENC_NUM_PADS ; i++) { + pad = &imxsd->pad[i]; + priv->pad[i] = pad->pad; +if (priv->pad[i].flags &MEDIA_PAD_FL_SINK ) + priv->input_pad = i; +else + priv->output_pad = i; + +/* set a default mbus format */ + ret =imx_media_init_mbus_fmt (&priv->format_mbus[i], +640 ,480 ,0 ,V4L2_FIELD_NONE , + &priv->cc[i]); +if (ret) +return ret; + } + + ret =prpenc_init_controls (priv); +if (ret)
drivers/staging/media/imx/imx-ic-prpenc.c line 977
Quoted 10 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +10
-0+return ret; + + ret =media_entity_pads_init (&sd->entity,PRPENC_NUM_PADS , priv->pad); +if (ret) + goto free_ctrls; + +return 0 ; +free_ctrls: +v4l2_ctrl_handler_free (&priv->ctrl_hdlr); +return ret;
if (ret)
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
return ret;
version is shorter.
Quoted 1 line
+}
[snip]
Quoted 21 lines
drivers/staging/media/imx/imx-ic-prpvf.c new file +15
-0@@ -0,0 +1,1180 @@ +/* +* V4L2 IC Deinterlacer Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2014-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h>
drivers/staging/media/imx/imx-ic-prpvf.c line 25
Quoted 10 lines
drivers/staging/media/imx/imx-ic-prpvf.c new file +10
-0+#include <linux/slab.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h> +#include <linux/pinctrl/consumer.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h>
Please sort the list of headers alphabetically.
Quoted 5 lines
drivers/staging/media/imx/imx-ic-prpvf.c new file +5
-0+#include <media/imx.h> +#include "imx-media.h" +#include "imx-ic.h" + +/*
[snip]
drivers/staging/media/imx/imx-ic-prpvf.c line 320
Quoted 8 lines
drivers/staging/media/imx/imx-ic-prpvf.c new file +8
-0+/* prpvf_out_ch EOF interrupt (progressive frame ready) */ +static irqreturn_t prpvf_out_eof_interrupt (int irq,void *dev_id) +{ +struct prpvf_priv *priv = dev_id; +struct imx_media_dma_buf *done; +unsigned long flags; + +spin_lock_irqsave (&priv->irqlock, flags);
Here spin_lock(&priv->irqlock) should be sufficient.
Quoted 49 lines
drivers/staging/media/imx/imx-ic-prpvf.c new file +49
-0+ +if (priv->last_eof) { +complete (&priv->last_eof_comp); + priv->last_eof = false; + goto unlock; + } + +if (priv->csi_direct) { +/* inform CSI of this EOF so it can monitor frame intervals */ +/* FIXME: frames are coming in twice as fast in direct path! */ +v4l2_subdev_call (priv->src_sd, core, interrupt_service_routine, +0 ,NULL ); + } + + done =imx_media_dma_buf_get_active (priv->out_ring); +/* give the completed buffer to the sink */ +if (!WARN_ON (!done)) +imx_media_dma_buf_done (done,IMX_MEDIA_BUF_STATUS_DONE ); + +if (!priv->csi_direct) { +/* we're done with the input buffer, queue it back */ +imx_media_dma_buf_queue (priv->in_ring, + priv->curr_in_buf->index); + +/* current input buffer is now last */ + priv->last_in_buf = priv->curr_in_buf; + }else { +/* +* priv->next buffer is now the active one due +* to IPU double-buffering +*/ +imx_media_dma_buf_set_active (priv->next_out_buf); + } + +/* bump the EOF timeout timer */ +mod_timer (&priv->eof_timeout_timer, + jiffies +msecs_to_jiffies (IMX_MEDIA_EOF_TIMEOUT )); + +if (priv->csi_direct) { +prepare_prpvf_out_buffer (priv); +/* toggle IPU double-buffer index */ + priv->ipu_buf_num ^=1 ; + } + +unlock: +spin_unlock_irqrestore (&priv->irqlock, flags); +return IRQ_HANDLED ; +} +
[snip]
Quoted 9 lines
drivers/staging/media/imx/imx-ic.h new file +3
-0@@ -0,0 +1,36 @@ +/* +* V4L2 Image Converter Subdev for Freescale i.MX5/6 SOC +*
drivers/staging/media/imx/imx-ic.h line 13
Quoted 10 lines
drivers/staging/media/imx/imx-ic.h new file +10
-0+* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#ifndef _IMX_IC_H +#define _IMX_IC_H +
Please add header files or declarations of all used structs.
Quoted 14 lines
drivers/staging/media/imx/imx-ic.h new file +13
-0+struct imx_ic_priv { +struct device *dev; +struct v4l2_subdev sd; +int ipu_id; +int task_id; +void *task_priv; +}; + +struct imx_ic_ops { +struct v4l2_subdev_ops *subdev_ops; +struct v4l2_subdev_internal_ops *internal_ops; +struct media_entity_operations *entity_ops; +
drivers/staging/media/imx/imx-ic.h line 36
Quoted 10 lines
drivers/staging/media/imx/imx-ic.h new file +10
-0+int (*init)(struct imx_ic_priv *ic_priv); + void (*remove)(struct imx_ic_priv *ic_priv); +}; + +extern struct imx_ic_ops imx_ic_prpenc_ops; +extern struct imx_ic_ops imx_ic_prpvf_ops; +extern struct imx_ic_ops imx_ic_pp_ops; + +#endif +
--
With best wishes,
Vladimir
Steve Longerbeam
maintainerRe: [PATCH v2 13/19] media: imx: Add IC subdev drivers
Quoted 16 lines · Vladimir Zapolskiy
drivers/staging/media/imx/imx-ic-common.c line 76
Quoted 13 lines · Steve Longerbeam
drivers/staging/media/imx/imx-ic-common.c new file +13
-0+ + ret = ic_ops[priv->task_id]->init (priv); +if (ret) +return ret; + + ret =v4l2_async_register_subdev (&priv->sd); +if (ret) + goto remove; + +return 0 ; +remove: + ic_ops[priv->task_id]->remove (priv); +return ret;if (ret)
Quoted 5 lines
ic_ops[priv->task_id]->remove(priv);return ret;
as an alternative.
done.
Quoted 11 lines
drivers/staging/media/imx/imx-ic-common.c new file +8
-0+ +static struct platform_driver imx_ic_driver = { + .probe = imx_ic_probe, + .remove = imx_ic_remove, + .id_table = imx_ic_ids, + .driver = { + .name ="imx-ipuv3-ic" , + .owner =THIS_MODULE ,Please drop .owner assignment.
done.
Quoted 24 lines
Quoted 24 lines
drivers/staging/media/imx/imx-ic-pp.c new file +18
-0@@ -0,0 +1,636 @@ +/* +* V4L2 IC Post-Processor Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2014-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h>
Quoted 8 lines
drivers/staging/media/imx/imx-ic-pp.c line 25
Quoted 7 lines
drivers/staging/media/imx/imx-ic-pp.c new file +7
-0+#include <linux/pinctrl/consumer.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h> Please sort the list of headers alphabetically.
done.
Quoted 8 lines
drivers/staging/media/imx/imx-ic-pp.c line 220
Quoted 7 lines
drivers/staging/media/imx/imx-ic-pp.c new file +5
-0+ + priv->out_run =kzalloc (IMX_MEDIA_MAX_RING_BUFS * +sizeof (*priv->out_run),GFP_KERNEL ); +if (!priv->out_run) { +v4l2_err (&ic_priv->sd,"failed to alloc src ring runs\n" );In OOM situation the core will report it, probably you can drop the message.
with a backtrace? I can't remember, if not I'd like to keep this.
Quoted 29 lines
Quoted 29 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +23
-0@@ -0,0 +1,1037 @@ +/* +* V4L2 Capture IC Encoder Subdev for Freescale i.MX5/6 SOC +* +* This subdevice handles capture of video frames from the CSI, which +* are routed directly to the Image Converter preprocess encode task, +* for resizing, colorspace conversion, and rotation. +* +* Copyright (c) 2012-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/interrupt.h> +#include <linux/spinlock.h> +#include <linux/platform_device.h>
Quoted 8 lines
drivers/staging/media/imx/imx-ic-prpenc.c line 30
Quoted 7 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +7
-0+#include <linux/pinctrl/consumer.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h> Please sort the list of headers alphabetically.
done.
Quoted 10 lines
drivers/staging/media/imx/imx-ic-prpenc.c line 178
Quoted 9 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +8
-0+static irqreturn_t prpenc_eof_interrupt (int irq,void *dev_id) +{ +struct prpenc_priv *priv = dev_id; +struct imx_media_dma_buf *done, *next; +struct ipuv3_channel *channel; +unsigned long flags; + +spin_lock_irqsave (&priv->irqlock, flags);Here
spin_lock(&priv->irqlock)should be sufficient.
done.
Quoted 10 lines
drivers/staging/media/imx/imx-ic-prpenc.c line 977
Quoted 9 lines
drivers/staging/media/imx/imx-ic-prpenc.c new file +9
-0+ + ret =media_entity_pads_init (&sd->entity,PRPENC_NUM_PADS , priv->pad); +if (ret) + goto free_ctrls; + +return 0 ; +free_ctrls: +v4l2_ctrl_handler_free (&priv->ctrl_hdlr); +return ret;if (ret)
Quoted 5 lines
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);return ret;
version is shorter.
done.
Quoted 26 lines
drivers/staging/media/imx/imx-ic-prpvf.c +0
-0Quoted 23 lines
new file mode 100644
index 0000000..53ce006drivers/staging/media/imx/imx-ic-prpvf.c new file +18
-0@@ -0,0 +1,1180 @@ +/* +* V4L2 IC Deinterlacer Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2014-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/interrupt.h> +#include <linux/platform_device.h>
Quoted 8 lines
drivers/staging/media/imx/imx-ic-prpvf.c line 25
Quoted 7 lines
drivers/staging/media/imx/imx-ic-prpvf.c new file +7
-0+#include <linux/pinctrl/consumer.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h> Please sort the list of headers alphabetically.
done.
Quoted 11 lines
drivers/staging/media/imx/imx-ic-prpvf.c line 320
Quoted 9 lines
drivers/staging/media/imx/imx-ic-prpvf.c new file +8
-0+/* prpvf_out_ch EOF interrupt (progressive frame ready) */ +static irqreturn_t prpvf_out_eof_interrupt (int irq,void *dev_id) +{ +struct prpvf_priv *priv = dev_id; +struct imx_media_dma_buf *done; +unsigned long flags; + +spin_lock_irqsave (&priv->irqlock, flags);Here
spin_lock(&priv->irqlock)should be sufficient.
done.
Quoted 13 lines
Quoted 13 lines
drivers/staging/media/imx/imx-ic.h new file +6
-0@@ -0,0 +1,36 @@ +/* +* V4L2 Image Converter Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify
Quoted 8 lines
drivers/staging/media/imx/imx-ic.h line 13
Quoted 7 lines
drivers/staging/media/imx/imx-ic.h new file +7
-0+* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#ifndef _IMX_IC_H +#define _IMX_IC_H +Please add header files or declarations of all used structs.
done (it only needs v4l2-subdev.h).
Steve
Steve Longerbeam
maintainerPATCH v2 14/19 media: imx: Add Camera Interface subdev driver
In reply to Steve LongerbeamThis is the camera interface driver that provides the v4l2 user interface. Frames can be received from various sources:
- directly from SMFC for capturing unconverted images directly from camera sensors.
- from the IC pre-process encode task.
- from the IC pre-process viewfinder task.
- from the IC post-process task.
--- drivers/staging/media/imx/Makefile | 2 +- drivers/staging/media/imx/imx-camif.c | 1010 +++++++++++++++++++++++++++++++++ 2 files changed, 1011 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/media/imx/imx-camif.c
drivers/staging/media/imx/Makefile +1 -1
@@ -8,4 +8,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o - +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o
drivers/staging/media/imx/imx-camif.c new file +1010 -0
1,010 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 14/19] media: imx: Add Camera Interface subdev driver
Quoted 24 lines · Steve Longerbeam
This is the camera interface driver that provides the v4l2 user interface. Frames can be received from various sources:
- directly from SMFC for capturing unconverted images directly from camera sensors.
- from the IC pre-process encode task.
- from the IC pre-process viewfinder task.
- from the IC post-process task.
Signed-off-by Steve Longerbeam <[email protected]>--- drivers/staging/media/imx/Makefile | 2 +- drivers/staging/media/imx/imx-camif.c | 1010 +++++++++++++++++++++++++++++++++ 2 files changed, 1011 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/media/imx/imx-camif.cdrivers/staging/media/imx/Makefile +0
-0
drivers/staging/media/imx/Makefile obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o · line 11
Quoted 5 lines
drivers/staging/media/imx/Makefile +1
-1@@ -8,4 +8,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o - +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o
obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o imx-csi.o imx-smfc.o
as an option.
Quoted 23 lines
drivers/staging/media/imx/imx-camif.c new file +17
-0@@ -0,0 +1,1010 @@ +/* +* Video Camera Capture Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2012-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/spinlock.h>
drivers/staging/media/imx/imx-camif.c line 27
Quoted 10 lines
drivers/staging/media/imx/imx-camif.c new file +10
-0+#include <linux/platform_device.h> +#include <linux/pinctrl/consumer.h> +#include <linux/of_platform.h> +#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h> +#include <media/v4l2-event.h>
Please sort the list of headers alphabetically.
drivers/staging/media/imx/imx-camif.c line 32
Quoted 5 lines
drivers/staging/media/imx/imx-camif.c new file +5
-0+#include <video/imx-ipu-v3.h> +#include <media/imx.h> +#include "imx-media.h" + +#define DEVICE_NAME "imx-media-camif"
I would propose to drop this macro.
drivers/staging/media/imx/imx-camif.c line 36
Quoted 4 lines
drivers/staging/media/imx/imx-camif.c new file +4
-0+ +#define CAMIF_NUM_PADS 2 + +#define CAMIF_DQ_TIMEOUT 5000
Add a comment about time unit?
drivers/staging/media/imx/imx-camif.c line 39
Quoted 3 lines
drivers/staging/media/imx/imx-camif.c new file +3
-0+ +struct camif_priv ; +
This is a leftover apparently.
Quoted 5 lines
drivers/staging/media/imx/imx-camif.c new file +5
-0+struct camif_priv { +struct device *dev; +struct video_device vfd; +struct media_pipeline mp; +struct imx_media_dev *md;
[snip]
Quoted 42 lines
drivers/staging/media/imx/imx-camif.c new file +42
-0+static int camif_probe (struct platform_device *pdev) +{ +struct imx_media_internal_sd_platformdata *pdata; +struct camif_priv *priv; +struct video_device *vfd; +int ret; + + priv =devm_kzalloc (&pdev->dev,sizeof (*priv),GFP_KERNEL ); +if (!priv) +return -ENOMEM ; + +platform_set_drvdata (pdev, priv); + priv->dev = &pdev->dev; + + pdata = priv->dev->platform_data; + +mutex_init (&priv->mutex); +spin_lock_init (&priv->q_lock); + +v4l2_subdev_init (&priv->sd, &camif_subdev_ops); +v4l2_set_subdevdata (&priv->sd, priv); + priv->sd.internal_ops = &camif_internal_ops; + priv->sd.entity.ops = &camif_entity_ops; + priv->sd.entity.function =MEDIA_ENT_F_PROC_VIDEO_PIXEL_FORMATTER ; + priv->sd.dev = &pdev->dev; + priv->sd.owner =THIS_MODULE ; +/* get our group id and camif id */ + priv->sd.grp_id = pdata->grp_id; + priv->id = (pdata->grp_id >>IMX_MEDIA_GRP_ID_CAMIF_BIT ) -1 ; +strncpy (priv->sd.name, pdata->sd_name,sizeof (priv->sd.name)); +snprintf (camif_videodev.name,sizeof (camif_videodev.name), +"%s devnode" , pdata->sd_name); + + priv->sd.flags =V4L2_SUBDEV_FL_HAS_DEVNODE |V4L2_SUBDEV_FL_HAS_EVENTS ; + + vfd = &priv->vfd; + *vfd = camif_videodev; + vfd->lock = &priv->mutex; + vfd->queue = &priv->buffer_queue; + +video_set_drvdata (vfd, priv); +
drivers/staging/media/imx/imx-camif.c line 975
Quoted 10 lines
drivers/staging/media/imx/imx-camif.c new file +10
-0+v4l2_ctrl_handler_init (&priv->ctrl_hdlr,0 ); + + ret =v4l2_async_register_subdev (&priv->sd); +if (ret) + goto free_ctrls; + +return 0 ; +free_ctrls: +v4l2_ctrl_handler_free (&priv->ctrl_hdlr); +return ret;
A shorter version:
if (ret)
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);
return ret;
Quoted 17 lines
drivers/staging/media/imx/imx-camif.c new file +17
-0+} + +static int camif_remove (struct platform_device *pdev) +{ +struct camif_priv *priv = + (struct camif_priv *)platform_get_drvdata (pdev); + +v4l2_ctrl_handler_free (&priv->ctrl_hdlr); +v4l2_async_unregister_subdev (&priv->sd); +media_entity_cleanup (&priv->sd.entity); +v4l2_device_unregister_subdev (&priv->sd); + +return 0 ; +} + +static const struct platform_device_id camif_ids[] = { + { .name =DEVICE_NAME },
drivers/staging/media/imx/imx-camif.c line 1002
Quoted 10 lines
drivers/staging/media/imx/imx-camif.c new file +10
-0+ { }, +}; +MODULE_DEVICE_TABLE (platform, camif_ids); + +static struct platform_driver imx_camif_driver = { + .probe = camif_probe, + .remove = camif_remove, + .driver = { + .name =DEVICE_NAME , + .owner =THIS_MODULE ,
Please drop the owner assignment.
drivers/staging/media/imx/imx-camif.c line 1010
Quoted 9 lines
drivers/staging/media/imx/imx-camif.c new file +8
-0+ }, +}; + +module_platform_driver (imx_camif_driver); + +MODULE_DESCRIPTION ("i.MX camera interface subdev driver" ); +MODULE_AUTHOR ("Steve Longerbeam <[email protected]>" ); +MODULE_LICENSE ("GPL" );
--
With best wishes,
Vladimir
Steve Longerbeam
maintainerRe: [PATCH v2 14/19] media: imx: Add Camera Interface subdev driver
Quoted 8 lines · Vladimir Zapolskiy
Quoted 7 lines · Steve Longerbeam
drivers/staging/media/imx/Makefile +0
-0@@ -8,4 +8,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o
Quoted 7 lines
drivers/staging/media/imx/Makefile obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o · line 11
Quoted 4 lines
drivers/staging/media/imx/Makefile +1
-1obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o - +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.oobj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o imx-csi.o imx-smfc.o
as an option.
I prefer to keep on separate lines as explained earlier.
Quoted 27 lines
Quoted 27 lines
drivers/staging/media/imx/imx-camif.c new file +20
-0@@ -0,0 +1,1010 @@ +/* +* Video Camera Capture Subdev for Freescale i.MX5/6 SOC +* +* Copyright (c) 2012-2016 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/delay.h> +#include <linux/fs.h> +#include <linux/timer.h> +#include <linux/sched.h> +#include <linux/slab.h> +#include <linux/spinlock.h> +#include <linux/platform_device.h> +#include <linux/pinctrl/consumer.h> +#include <linux/of_platform.h>
Quoted 8 lines
drivers/staging/media/imx/imx-camif.c line 27
Quoted 7 lines
drivers/staging/media/imx/imx-camif.c new file +7
-0+#include <media/v4l2-device.h> +#include <media/v4l2-ioctl.h> +#include <media/videobuf2-dma-contig.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-of.h> +#include <media/v4l2-ctrls.h> +#include <media/v4l2-event.h> Please sort the list of headers alphabetically.
done.
Quoted 6 lines
drivers/staging/media/imx/imx-camif.c line 32
Quoted 5 lines
drivers/staging/media/imx/imx-camif.c new file +5
-0+#include <video/imx-ipu-v3.h> +#include <media/imx.h> +#include "imx-media.h" + +#define DEVICE_NAME "imx-media-camif"I would propose to drop this macro.
done.
Quoted 3 lines
drivers/staging/media/imx/imx-camif.c line 34
Quoted 2 lines
drivers/staging/media/imx/imx-camif.c new file +2
-0+ +#define CAMIF_DQ_TIMEOUT 5000Add a comment about time unit?
actually that was ancient and no longer used, removed.
Quoted 5 lines
drivers/staging/media/imx/imx-camif.c line 39
Quoted 4 lines
drivers/staging/media/imx/imx-camif.c new file +3
-0+ +struct camif_priv ; +This is a leftover apparently.
ditto, removed.
Quoted 11 lines
drivers/staging/media/imx/imx-camif.c line 975
Quoted 9 lines
drivers/staging/media/imx/imx-camif.c new file +9
-0+ + ret =v4l2_async_register_subdev (&priv->sd); +if (ret) + goto free_ctrls; + +return 0 ; +free_ctrls: +v4l2_ctrl_handler_free (&priv->ctrl_hdlr); +return ret;A shorter version:
Quoted 4 lines
if (ret)
v4l2_ctrl_handler_free(&priv->ctrl_hdlr);return ret;
done.
Quoted 8 lines
drivers/staging/media/imx/imx-camif.c line 1002
Quoted 7 lines
drivers/staging/media/imx/imx-camif.c new file +7
-0+ +static struct platform_driver imx_camif_driver = { + .probe = camif_probe, + .remove = camif_remove, + .driver = { + .name =DEVICE_NAME , + .owner =THIS_MODULE ,Please drop the owner assignment.
done.
Steve
Steve Longerbeam
maintainerPATCH v2 15/19 media: imx: Add MIPI CSI-2 Receiver subdev driver
In reply to Steve LongerbeamAdds MIPI CSI-2 Receiver subdev driver. This subdev is required for sensors with a MIPI CSI2 interface.
--- drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/imx-mipi-csi2.c | 509 ++++++++++++++++++++++++++++++ 2 files changed, 510 insertions(+) create mode 100644 drivers/staging/media/imx/imx-mipi-csi2.c
drivers/staging/media/imx/Makefile +1 -0
@@ -9,3 +9,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o
drivers/staging/media/imx/imx-mipi-csi2.c new file +509 -0
509 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH v2 15/19] media: imx: Add MIPI CSI-2 Receiver subdev driver
Quoted 42 lines · Steve Longerbeam
Adds MIPI CSI-2 Receiver subdev driver. This subdev is required for sensors with a MIPI CSI2 interface.
Signed-off-by Steve Longerbeam <[email protected]>--- drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/imx-mipi-csi2.c | 509 ++++++++++++++++++++++++++++++ 2 files changed, 510 insertions(+) create mode 100644 drivers/staging/media/imx/imx-mipi-csi2.cdrivers/staging/media/imx/Makefile +1
-0@@ -9,3 +9,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.odrivers/staging/media/imx/imx-mipi-csi2.c new file +17
-0@@ -0,0 +1,509 @@ +/* +* MIPI CSI-2 Receiver Subdev for Freescale i.MX5/6 SOC. +* +* Copyright (c) 2012-2014 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/export.h> +#include <linux/types.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/err.h> +#include <linux/delay.h>
drivers/staging/media/imx/imx-mipi-csi2.c line 27
Quoted 10 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +10
-0+#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/clk.h> +#include <linux/list.h> +#include <linux/irq.h> +#include <linux/of_device.h> +#include <media/v4l2-device.h> +#include <media/v4l2-of.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-async.h>
Please sort the list of headers alphabetically.
drivers/staging/media/imx/imx-mipi-csi2.c line 28
Quoted 1 line
drivers/staging/media/imx/imx-mipi-csi2.c new file +1
-0+#include <asm/mach/irq.h>
Why do you need to include this header?
Quoted 3 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +3
-0+#include <video/imx-ipu-v3.h> +#include "imx-media.h" +
[snip]
Quoted 8 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +8
-0+static int imxcsi2_s_stream (struct v4l2_subdev *sd,int enable) +{ +struct imxcsi2_dev *csi2 =sd_to_dev (sd); +int i, ret =0 ; + +if (!csi2->src_sd) +return -EPIPE ; +for (i =0 ; i <CSI2_NUM_SRC_PADS ; i++) {
drivers/staging/media/imx/imx-mipi-csi2.c line 264
Quoted 10 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +10
-0+if (csi2->sink_sd[i]) +break ; + } +if (i >=CSI2_NUM_SRC_PADS ) +return -EPIPE ; + +v4l2_info (sd,"stream %s\n" , enable ?"ON" :"OFF" ); + +if (enable && !csi2->stream_on) { +clk_prepare_enable (csi2->pix_clk);
It can complicate the design for you, but in general clk_prepare_enable() can return an error.
Quoted 12 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +12
-0+ ret =imxcsi2_dphy_wait (csi2); +if (ret) +clk_disable_unprepare (csi2->pix_clk); + }else if (!enable && csi2->stream_on) { +clk_disable_unprepare (csi2->pix_clk); + } + +if (!ret) + csi2->stream_on = enable; +return ret; +} +
[snip]
Quoted 5 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +5
-0+ +static int imxcsi2_parse_endpoints (struct imxcsi2_dev *csi2) +{ +struct device_node *node = csi2->dev->of_node; +struct device_node *epnode;
drivers/staging/media/imx/imx-mipi-csi2.c line 389
Quoted 10 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +10
-0+struct v4l2_of_endpoint ep; +int ret =0 ; + + epnode =of_graph_get_next_endpoint (node,NULL ); +if (!epnode) { +v4l2_err (&csi2->sd,"failed to get endpoint node\n" ); +return -EINVAL ; + } + +v4l2_of_parse_endpoint (epnode, &ep);
Do of_node_put(epnode) here and remove 'out' goto label.
Quoted 15 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +15
-0+if (ep.bus_type !=V4L2_MBUS_CSI2 ) { +v4l2_err (&csi2->sd,"invalid bus type, must be MIPI CSI2\n" ); + ret = -EINVAL ; + goto out; + } + + csi2->bus = ep.bus.mipi_csi2; + +v4l2_info (&csi2->sd,"data lanes: %d\n" , csi2->bus.num_data_lanes); +v4l2_info (&csi2->sd,"flags: 0x%08x\n" , csi2->bus.flags); +out: +of_node_put (epnode); +return ret; +} +
[snip]
drivers/staging/media/imx/imx-mipi-csi2.c line 497
Quoted 10 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +10
-0+static const struct of_device_id imxcsi2_dt_ids[] = { + { .compatible ="fsl,imx-mipi-csi2" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, imxcsi2_dt_ids); + +static struct platform_driver imxcsi2_driver = { + .driver = { + .name =DEVICE_NAME , + .owner =THIS_MODULE ,
Please drop .owner assignment.
drivers/staging/media/imx/imx-mipi-csi2.c line 509
Quoted 13 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +12
-0+ .of_match_table = imxcsi2_dt_ids, + }, + .probe = imxcsi2_probe, + .remove = imxcsi2_remove, +}; + +module_platform_driver (imxcsi2_driver); + +MODULE_DESCRIPTION ("i.MX5/6 MIPI CSI-2 Receiver driver" ); +MODULE_AUTHOR ("Steve Longerbeam <[email protected]>" ); +MODULE_LICENSE ("GPL" ); +
--
With best wishes,
Vladimir
Steve Longerbeam
maintainerRe: [PATCH v2 15/19] media: imx: Add MIPI CSI-2 Receiver subdev driver
Quoted 46 lines · Vladimir Zapolskiy
Quoted 45 lines · Steve Longerbeam
Adds MIPI CSI-2 Receiver subdev driver. This subdev is required for sensors with a MIPI CSI2 interface.
Signed-off-by Steve Longerbeam <[email protected]>--- drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/imx-mipi-csi2.c | 509 ++++++++++++++++++++++++++++++ 2 files changed, 510 insertions(+)create mode 100644
drivers/staging/media/imx/imx-mipi-csi2.cdrivers/staging/media/imx/Makefile +1
-0@@ -9,3 +9,4 @@ obj-$(CONFIG_VIDEO_IMX_MEDIA) += imx-ic.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.odrivers/staging/media/imx/imx-mipi-csi2.c new file +20
-0@@ -0,0 +1,509 @@ +/* +* MIPI CSI-2 Receiver Subdev for Freescale i.MX5/6 SOC. +* +* Copyright (c) 2012-2014 Mentor Graphics Inc. +* +* This program is free software; you can redistribute it and/or modify +* it under the terms of the GNU General Public License as published by +* the Free Software Foundation; either version 2 of the License, or +* (at your option) any later version. +*/ +#include <linux/module.h> +#include <linux/export.h> +#include <linux/types.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/err.h> +#include <linux/delay.h> +#include <linux/interrupt.h> +#include <linux/io.h> +#include <linux/clk.h>
Quoted 8 lines
drivers/staging/media/imx/imx-mipi-csi2.c line 27
Quoted 7 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +7
-0+#include <linux/list.h> +#include <linux/irq.h> +#include <linux/of_device.h> +#include <media/v4l2-device.h> +#include <media/v4l2-of.h> +#include <media/v4l2-subdev.h> +#include <media/v4l2-async.h> Please sort the list of headers alphabetically.
done.
Quoted 3 lines
drivers/staging/media/imx/imx-mipi-csi2.c line 28
Quoted 2 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +1
-0+#include <asm/mach/irq.h> Why do you need to include this header?
good question. In fact this include list was in need of a lot of pruning, so I paired it down to the essentials.
Quoted 12 lines
Quoted 12 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +12
-0+static int imxcsi2_s_stream (struct v4l2_subdev *sd,int enable) +{ +struct imxcsi2_dev *csi2 =sd_to_dev (sd); +int i, ret =0 ; + +if (!csi2->src_sd) +return -EPIPE ; +for (i =0 ; i <CSI2_NUM_SRC_PADS ; i++) { +if (csi2->sink_sd[i]) +break ; + } +if (i >=CSI2_NUM_SRC_PADS )
Quoted 8 lines
drivers/staging/media/imx/imx-mipi-csi2.c line 264
Quoted 6 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +6
-0+return -EPIPE ; + +v4l2_info (sd,"stream %s\n" , enable ?"ON" :"OFF" ); + +if (enable && !csi2->stream_on) { +clk_prepare_enable (csi2->pix_clk);It can complicate the design for you, but in general
clk_prepare_enable()can return an error.
I added an error check and reorganized a little.
Quoted 8 lines
Quoted 8 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +8
-0+ +static int imxcsi2_parse_endpoints (struct imxcsi2_dev *csi2) +{ +struct device_node *node = csi2->dev->of_node; +struct device_node *epnode; +struct v4l2_of_endpoint ep; +int ret =0 ; +
Quoted 8 lines
drivers/staging/media/imx/imx-mipi-csi2.c line 389
Quoted 7 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +7
-0+ epnode =of_graph_get_next_endpoint (node,NULL ); +if (!epnode) { +v4l2_err (&csi2->sd,"failed to get endpoint node\n" ); +return -EINVAL ; + } + +v4l2_of_parse_endpoint (epnode, &ep);Do
of_node_put(epnode)here and remove 'out' goto label.
done.
Quoted 11 lines
drivers/staging/media/imx/imx-mipi-csi2.c line 497
Quoted 10 lines
drivers/staging/media/imx/imx-mipi-csi2.c new file +10
-0+static const struct of_device_id imxcsi2_dt_ids[] = { + { .compatible ="fsl,imx-mipi-csi2" , }, + {/* sentinel */ } +}; +MODULE_DEVICE_TABLE (of, imxcsi2_dt_ids); + +static struct platform_driver imxcsi2_driver = { + .driver = { + .name =DEVICE_NAME , + .owner =THIS_MODULE ,Please drop .owner assignment.
done.
Steve
Steve Longerbeam
maintainerPATCH v2 16/19 media: imx: Add video switch subdev driver
In reply to Steve LongerbeamFrom: Philipp Zabel <[email protected]>
This driver can handle SoC internal and extern video bus multiplexers, controlled either by register bit fields or by GPIO.
--- drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/imx-video-switch.c | 351 +++++++++++++++++++++++++++ 2 files changed, 352 insertions(+) create mode 100644 drivers/staging/media/imx/imx-video-switch.c
drivers/staging/media/imx/Makefile +1 -0
@@ -10,3 +10,4 @@ obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-csi.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o +obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-video-switch.o
drivers/staging/media/imx/imx-video-switch.c new file +351 -0
351 lines not on this page · raw message
Signature · 1 line
2.7.4
Steve Longerbeam
maintainerPATCH v2 17/19 media: imx: Add MIPI CSI-2 OV5640 sensor subdev driver
In reply to Steve LongerbeamThis driver is based on ov5640_mipi.c from Freescale imx_3.10.17_1.0.0_beta branch, modified heavily to bring forward to latest interfaces and code cleanup.
--- drivers/staging/media/imx/Kconfig | 8 + drivers/staging/media/imx/Makefile | 2 + drivers/staging/media/imx/ov5640-mipi.c | 2349 +++++++++++++++++++++++++++++++ 3 files changed, 2359 insertions(+) create mode 100644 drivers/staging/media/imx/ov5640-mipi.c
drivers/staging/media/imx/Kconfig +8 -0
@@ -17,5 +17,13 @@ config VIDEO_IMX_CAMERA ---help--- A video4linux camera capture driver for i.MX5/6. +config IMX_OV5640_MIPI + tristate "OmniVision OV5640 MIPI CSI-2 camera support" + depends on GPIOLIB && VIDEO_IMX_CAMERA + select IMX_MIPI_CSI2 + default y + ---help--- + MIPI CSI-2 OV5640 Camera support. + endmenu endif
drivers/staging/media/imx/Makefile +2 -0
@@ -11,3 +11,5 @@ obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-smfc.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-camif.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-video-switch.o + +obj-$(CONFIG_IMX_OV5640_MIPI) += ov5640-mipi.o
drivers/staging/media/imx/ov5640-mipi.c new file +2349 -0
2,349 lines not on this page · raw message
Signature · 1 line
2.7.4
Steve Longerbeam
maintainerPATCH v2 18/19 media: imx: Add Parallel OV5642 sensor subdev driver
In reply to Steve LongerbeamThis driver is based on ov5642.c from Freescale imx_3.10.17_1.0.0_beta branch, modified heavily to bring forward to latest interfaces and code cleanup.
--- drivers/staging/media/imx/Kconfig | 7 + drivers/staging/media/imx/Makefile | 1 + drivers/staging/media/imx/ov5642.c | 4364 ++++++++++++++++++++++++++++++++++++ 3 files changed, 4372 insertions(+) create mode 100644 drivers/staging/media/imx/ov5642.c
drivers/staging/media/imx/Kconfig +7 -0
@@ -25,5 +25,12 @@ config IMX_OV5640_MIPI ---help--- MIPI CSI-2 OV5640 Camera support. +config IMX_OV5642 + tristate "OmniVision OV5642 Parallel camera support" + depends on GPIOLIB && VIDEO_IMX_CAMERA + default y + ---help--- + Parallel interface OV5642 camera support. + endmenu endif
drivers/staging/media/imx/Makefile +1 -0
@@ -13,3 +13,4 @@ obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-mipi-csi2.o obj-$(CONFIG_VIDEO_IMX_CAMERA) += imx-video-switch.o obj-$(CONFIG_IMX_OV5640_MIPI) += ov5640-mipi.o +obj-$(CONFIG_IMX_OV5642) += ov5642.o
drivers/staging/media/imx/ov5642.c new file +4364 -0
2,984 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.7.4
Part of the diff is not shown here. View the raw message.
Steve Longerbeam
maintainerPATCH v2 19/19 ARM: imx_v6_v7_defconfig: Enable staging video4linux drivers
In reply to Steve LongerbeamEnable imx v4l2 staging drivers. For video capture on the SabreAuto, the ADV7180 video decoder also requires the i2c-mux-gpio and the max7310 port expander. The Sabrelite requires PWM clocks for the OV5640.
--- arch/arm/configs/imx_v6_v7_defconfig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
arch/arm/configs/imx_v6_v7_defconfig +9 -1
@@ -51,6 +51,7 @@ CONFIG_PREEMPT_VOLUNTARY=y CONFIG_AEABI=y CONFIG_HIGHMEM=y CONFIG_CMA=y +CONFIG_FORCE_MAX_ZONEORDER=14 CONFIG_CMDLINE="noinitrd console=ttymxc0,115200" CONFIG_KEXEC=y CONFIG_CPU_FREQ=y
@@ -181,6 +182,7 @@ CONFIG_SERIAL_FSL_LPUART=y CONFIG_SERIAL_FSL_LPUART_CONSOLE=y # CONFIG_I2C_COMPAT is not set CONFIG_I2C_CHARDEV=y +CONFIG_I2C_MUX=y CONFIG_I2C_MUX_GPIO=y # CONFIG_I2C_HELPER_AUTO is not set CONFIG_I2C_ALGOPCF=m
@@ -194,11 +196,11 @@ CONFIG_GPIO_SYSFS=y CONFIG_GPIO_MC9S08DZ60=y CONFIG_GPIO_PCA953X=y CONFIG_GPIO_STMPE=y -CONFIG_POWER_SUPPLY=y CONFIG_POWER_RESET=y CONFIG_POWER_RESET_IMX=y CONFIG_POWER_RESET_SYSCON=y CONFIG_POWER_RESET_SYSCON_POWEROFF=y +CONFIG_POWER_SUPPLY=y CONFIG_SENSORS_GPIO_FAN=y CONFIG_SENSORS_IIO_HWMON=y CONFIG_THERMAL=y
@@ -221,6 +223,8 @@ CONFIG_REGULATOR_PFUZE100=y CONFIG_MEDIA_SUPPORT=y CONFIG_MEDIA_CAMERA_SUPPORT=y CONFIG_MEDIA_RC_SUPPORT=y +CONFIG_MEDIA_CONTROLLER=y +CONFIG_VIDEO_V4L2_SUBDEV_API=y CONFIG_RC_DEVICES=y CONFIG_IR_GPIO_CIR=y CONFIG_MEDIA_USB_SUPPORT=y
@@ -229,6 +233,8 @@ CONFIG_V4L_PLATFORM_DRIVERS=y CONFIG_SOC_CAMERA=y CONFIG_V4L_MEM2MEM_DRIVERS=y CONFIG_VIDEO_CODA=y +# CONFIG_MEDIA_SUBDRV_AUTOSELECT is not set +CONFIG_VIDEO_ADV7180=m CONFIG_SOC_CAMERA_OV2640=y CONFIG_IMX_IPUV3_CORE=y CONFIG_DRM=y
@@ -338,6 +344,8 @@ CONFIG_FSL_EDMA=y CONFIG_IMX_SDMA=y CONFIG_MXS_DMA=y CONFIG_STAGING=y +CONFIG_STAGING_MEDIA=y +CONFIG_COMMON_CLK_PWM=y CONFIG_IIO=y CONFIG_VF610_ADC=y CONFIG_MPL3115=y
Signature · 1 line
2.7.4
Quoted 6 lines · Steve Longerbeam
In version 2 (no functional changes):
- removed patch "gpio: pca953x: Add optional reset gpio control", it has been submitted separately.
- fixed some whitespace errors.
- added a few missing Signed-off-by's.
Tested the series on a mx6qsabresd, so: