[PATCH] media: Add a driver for the ov5640 sensor.

2015-09-30 Thread Javier Martin
The ov5640 sensor from Omnivision supports up to 2592x1944
and both CSI and MIPI interfaces.

The following driver adds support for the CSI interface only
and VGA, 720p resolutions at 30fps.

Signed-off-by: Javier Martin 
---
 .../devicetree/bindings/media/i2c/ov5640.txt   |   47 +
 arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts  |   50 -
 arch/arm/boot/dts/imx6qdl-var-som.dtsi |  422 ++
 drivers/media/i2c/Kconfig  |   11 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/ov5640.c | 1403 
 drivers/media/i2c/ov5642.c |  129 +-
 drivers/media/v4l2-core/v4l2-ctrls.c   |   30 +-
 8 files changed, 1702 insertions(+), 391 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ov5640.txt
 create mode 100644 drivers/media/i2c/ov5640.c

diff --git a/Documentation/devicetree/bindings/media/i2c/ov5640.txt 
b/Documentation/devicetree/bindings/media/i2c/ov5640.txt
new file mode 100644
index 000..2e93e97
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/ov5640.txt
@@ -0,0 +1,47 @@
+* Omnivision 1/4-Inch 5Mp CMOS Digital Image Sensor
+
+The Omnivision OV5640 is a 1/4-Inch CMOS active pixel digital image sensor with
+an active array size of 2592H x 1932V. It is programmable through a simple
+two-wire serial interface.
+
+Required Properties:
+- compatible: value should be "ovti,ov5640"
+- clocks: reference to the xclk clock
+- clock-names: should be "xclk"
+- clock-rates: the xclk clock frequency
+
+Optional Properties:
+- reset-gpio: Chip reset GPIO
+- pwdn-gpio: Chip power down GPIO
+
+The device node must contain one 'port' child node for its digital output
+video port, in accordance with the video interface bindings defined in
+Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+
+{
+   ...
+
+   ov5640: ov5640@3c {
+   compatible = "ovti,ov5640";
+   pinctrl-names = "default";
+   pinctrl-0 = <_ov5640 _csi0>;
+   reg = <0x3c>;
+
+   clocks = < 200>;
+   clock-names = "xclk";
+   clock-rates = <2400>;
+
+   reset-gpio = < 20 GPIO_ACTIVE_LOW>;
+   pwdn-gpio = < 6 GPIO_ACTIVE_HIGH>;
+
+   port {
+   ov5640_to_csi0: endpoint {
+   remote-endpoint = <_from_ov5640>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   };
+   };
+   };
+   };
diff --git a/arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts 
b/arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts
index 5431e90..f92f68c 100644
--- a/arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts
+++ b/arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts
@@ -23,53 +23,3 @@
 };
 
 
- {
-   status = "okay";
-
-   lvds-channel@0 {
-   fsl,data-mapping = "spwg";
-   fsl,data-width = <24>;
-   crtc = "ipu1-di0";
-   status = "okay";
-
-   display-timings {
-   native-mode = <>;
-   timingr0: hsd100pxn1 {
-   clock-frequency = <7110>;
-   hactive = <1280>;
-   vactive = <800>;
-   hback-porch = <50>;
-   hfront-porch = <50>;
-   vback-porch = <6>;
-   vfront-porch = <6>;
-   hsync-len = <60>;
-   vsync-len = <11>;
-   };
-   };
-   };
-
-   lvds-channel@1 {
-   fsl,data-mapping = "spwg";
-   fsl,data-width = <24>;
-   crtc = "ipu1-di1";
-   primary;
-   status = "okay";
-
-   display-timings {
-   native-mode = <>;
-   timing1: hsd100pxn1 {
-   clock-frequency = <7110>;
-   hactive = <1280>;
-   vactive = <800>;
-   hback-porch = <50>;
-   hfront-porch = <50>;
-   vback-porch = <6>;
-   vfront-porch = <6>;
-   hsync-len = <60>;
-   vsync-len = <11>;
-   };
-   };
-   };
-};
-
-
diff --git a/arch/arm/boot/dts/imx6qdl-var-som.dtsi 
b/arch/arm/boot/dts/imx6qdl-var-som.dtsi
index 3a68114..44d820e 100755
--- a/arch/arm/boot/dts/imx6qdl-var-som.dtsi

Re: [PATCH] media: Add a driver for the ov5640 sensor.

2015-09-30 Thread Javier Martin

Sorry for the unrelated patches,
I will submit this again.

On 30/09/15 09:34, Javier Martin wrote:

The ov5640 sensor from Omnivision supports up to 2592x1944
and both CSI and MIPI interfaces.

The following driver adds support for the CSI interface only
and VGA, 720p resolutions at 30fps.

Signed-off-by: Javier Martin 
---
  .../devicetree/bindings/media/i2c/ov5640.txt   |   47 +
  arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts  |   50 -
  arch/arm/boot/dts/imx6qdl-var-som.dtsi |  422 ++
  drivers/media/i2c/Kconfig  |   11 +
  drivers/media/i2c/Makefile |1 +
  drivers/media/i2c/ov5640.c | 1403 
  drivers/media/i2c/ov5642.c |  129 +-
  drivers/media/v4l2-core/v4l2-ctrls.c   |   30 +-
  8 files changed, 1702 insertions(+), 391 deletions(-)
  create mode 100644 Documentation/devicetree/bindings/media/i2c/ov5640.txt
  create mode 100644 drivers/media/i2c/ov5640.c

diff --git a/Documentation/devicetree/bindings/media/i2c/ov5640.txt 
b/Documentation/devicetree/bindings/media/i2c/ov5640.txt
new file mode 100644
index 000..2e93e97
--- /dev/null
+++ b/Documentation/devicetree/bindings/media/i2c/ov5640.txt
@@ -0,0 +1,47 @@
+* Omnivision 1/4-Inch 5Mp CMOS Digital Image Sensor
+
+The Omnivision OV5640 is a 1/4-Inch CMOS active pixel digital image sensor with
+an active array size of 2592H x 1932V. It is programmable through a simple
+two-wire serial interface.
+
+Required Properties:
+- compatible: value should be "ovti,ov5640"
+- clocks: reference to the xclk clock
+- clock-names: should be "xclk"
+- clock-rates: the xclk clock frequency
+
+Optional Properties:
+- reset-gpio: Chip reset GPIO
+- pwdn-gpio: Chip power down GPIO
+
+The device node must contain one 'port' child node for its digital output
+video port, in accordance with the video interface bindings defined in
+Documentation/devicetree/bindings/media/video-interfaces.txt.
+
+Example:
+
+{
+   ...
+
+   ov5640: ov5640@3c {
+   compatible = "ovti,ov5640";
+   pinctrl-names = "default";
+   pinctrl-0 = <_ov5640 _csi0>;
+   reg = <0x3c>;
+
+   clocks = < 200>;
+   clock-names = "xclk";
+   clock-rates = <2400>;
+
+   reset-gpio = < 20 GPIO_ACTIVE_LOW>;
+   pwdn-gpio = < 6 GPIO_ACTIVE_HIGH>;
+
+   port {
+   ov5640_to_csi0: endpoint {
+   remote-endpoint = <_from_ov5640>;
+   hsync-active = <1>;
+   vsync-active = <1>;
+   };
+   };
+   };
+   };
diff --git a/arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts 
b/arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts
index 5431e90..f92f68c 100644
--- a/arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts
+++ b/arch/arm/boot/dts/imx6dl-var-som-solo-vsc.dts
@@ -23,53 +23,3 @@
  };


- {
-   status = "okay";
-
-   lvds-channel@0 {
-   fsl,data-mapping = "spwg";
-   fsl,data-width = <24>;
-   crtc = "ipu1-di0";
-   status = "okay";
-
-   display-timings {
-   native-mode = <>;
-   timingr0: hsd100pxn1 {
-   clock-frequency = <7110>;
-   hactive = <1280>;
-   vactive = <800>;
-   hback-porch = <50>;
-   hfront-porch = <50>;
-   vback-porch = <6>;
-   vfront-porch = <6>;
-   hsync-len = <60>;
-   vsync-len = <11>;
-   };
-   };
-   };
-
-   lvds-channel@1 {
-   fsl,data-mapping = "spwg";
-   fsl,data-width = <24>;
-   crtc = "ipu1-di1";
-   primary;
-   status = "okay";
-
-   display-timings {
-   native-mode = <>;
-   timing1: hsd100pxn1 {
-   clock-frequency = <7110>;
-   hactive = <1280>;
-   vactive = <800>;
-   hback-porch = <50>;
-   hfront-porch = <50>;
-   vback-porch = <6>;
-   vfront-porch = <6>;
-   hsync-len = <60>;
-   vsync-len = <11>;
-   };
-   };
-   };
-};
-
-
diff --git a/arch/arm/boot/dts/imx6qdl-var-som.dtsi