Skip to contentSkip to conversation

media: ov7740: Add a V4L2 sensor-level driver

PATCH Superseded Wenyou Yang 2 participants 5 messages Dec 8, 2017 – Dec 11, 2017

Subsystems (4)

v8 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v8 cover media: ov7740: Add a V4L2 sensor-level driver

Add a Video4Linux2 sensor-level driver for the OmniVision OV7740 VGA camera image sensor.

Changes in v8:
- As the registers are written at stream start, remove the written code from the set fmt function.

Changes in v7:
- Add Acked-by tag.
- Fix the wrong handle of default register configuration.
- Add the missed assignment of ov7740->frmsize.

Changes in v6:
- Remove unnecessary #include <linux/init>.
- Remove unnecessary comments and extra newline.
- Add const for some structures.
- Add the check of the return value from regmap_write().
- Simplify the calling of __v4l2_ctrl_handler_setup().
- Add the default format initialization function.
- Integrate the set_power() and enable/disable the clock into one function.

Changes in v5:
- Squash the driver and MAINTAINERS entry patches to one.
- Precede the driver patch with the bindings patch.

Changes in v4:
- Assign 'val' a initial value to avoid warning: 'val' may be used uninitialized.
- Rename REG_REG15 to avoid warning: "REG_REG15" redefined.

Changes in v3:
- Explicitly document the "remote-endpoint" property.
- Put the MAINTAINERS change to a separate patch.

Changes in v2:
- Split off the bindings into a separate patch.
- Add a new entry to the MAINTAINERS file.

Wenyou Yang (2):
media: ov7740: Document device tree bindings
media: i2c: Add the ov7740 image sensor driver

 .../devicetree/bindings/media/i2c/ov7740.txt       |   47 +
 MAINTAINERS                                        |    8 +
 drivers/media/i2c/Kconfig                          |    8 +
 drivers/media/i2c/Makefile                         |    1 +
 drivers/media/i2c/ov7740.c                         | 1226 ++++++++++++++++++++
 5 files changed, 1290 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ov7740.txt
 create mode 100644 drivers/media/i2c/ov7740.c
Signature · 1 line
2.15.0
#1 lore raw

PATCH v8 1/2 media: ov7740: Document device tree bindings

Add the device tree binding documentation for the ov7740 sensor driver.

---

Changes in v8: None
Changes in v7:
- Add Acked-by tag.

Changes in v6: None
Changes in v5: None
Changes in v4: None
Changes in v3:
- Explicitly document the "remote-endpoint" property.

Changes in v2: None

 .../devicetree/bindings/media/i2c/ov7740.txt       | 47 ++++++++++++++++++++++
 1 file changed, 47 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ov7740.txt
Documentation/devicetree/bindings/media/i2c/ov7740.txt new file +47 -0
new file mode 100644
index 000000000000..af781c3a5f0e
@@ -0,0 +1,47 @@
+* Omnivision OV7740 CMOS image sensor
+
+The Omnivision OV7740 image sensor supports multiple output image
+size, such as VGA, and QVGA, CIF and any size smaller. It also
+supports the RAW RGB and YUV output formats.
+
+The common video interfaces bindings (see video-interfaces.txt) should
+be used to specify link to the image data receiver. The OV7740 device
+node should contain one 'port' child node with an 'endpoint' subnode.
+
+Required Properties:
+- compatible:	"ovti,ov7740".
+- reg:		I2C slave address of the sensor.
+- clocks:	Reference to the xvclk input clock.
+- clock-names:	"xvclk".
+
+Optional Properties:
+- reset-gpios: Rreference to the GPIO connected to the reset_b pin,
+  if any. Active low with pull-ip resistor.
+- powerdown-gpios: Reference to the GPIO connected to the pwdn pin,
+  if any. Active high with pull-down resistor.
+
+Endpoint node mandatory properties:
+- remote-endpoint: A phandle to the bus receiver's endpoint node.
+
+Example:
+
+	i2c1: i2c at fc028000 {
+		ov7740: camera at 21 {
+			compatible = "ovti,ov7740";
+			reg = <0x21>;
+			pinctrl-names = "default";
+			pinctrl-0 = <&pinctrl_sensor_power &pinctrl_sensor_reset>;
+			clocks = <&isc>;
+			clock-names = "xvclk";
+			assigned-clocks = <&isc>;
+			assigned-clock-rates = <24000000>;
+			reset-gpios = <&pioA 43 GPIO_ACTIVE_LOW>;
+			powerdown-gpios = <&pioA 44 GPIO_ACTIVE_HIGH>;
+
+			port {
+				ov7740_0: endpoint {
+					remote-endpoint = <&isc_0>;
+				};
+			};
+		};
+	};
Signature · 1 line
2.15.0
#2 lore raw

PATCH v8 2/2 media: i2c: Add the ov7740 image sensor driver

In reply to Wenyou Yang

The ov7740 (color) image sensor is a high performance VGA CMOS image snesor, which supports for output formats: RAW RGB and YUV and image sizes: VGA, and QVGA, CIF and any size smaller.

---

Changes in v8:
- As the registers are written at stream start, remove the written code from the set fmt function.

Changes in v7:
- Fix the wrong handle of default register configuration.
- Add the missed assignment of ov7740->frmsize.

Changes in v6:
- Remove unnecessary #include <linux/init>.
- Remove unnecessary comments and extra newline.
- Add const for some structures.
- Add the check of the return value from regmap_write().
- Simplify the calling of __v4l2_ctrl_handler_setup().
- Add the default format initialization function.
- Integrate the set_power() and enable/disable the clock into one function.

Changes in v5:
- Squash the driver and MAINTAINERS entry patches to one.
- Precede the driver patch with the bindings patch.

Changes in v4:
- Assign 'val' a initial value to avoid warning: 'val' may be used uninitialized.
- Rename REG_REG15 to avoid warning: "REG_REG15" redefined.

Changes in v3:
- Put the MAINTAINERS change to a separate patch.

Changes in v2:
- Split off the bindings into a separate patch.
- Add a new entry to the MAINTAINERS file.

 MAINTAINERS                |    8 +
 drivers/media/i2c/Kconfig  |    8 +
 drivers/media/i2c/Makefile |    1 +
 drivers/media/i2c/ov7740.c | 1226 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1243 insertions(+)
 create mode 100644 drivers/media/i2c/ov7740.c
MAINTAINERS +8 -0
index 7a52a66aa991..1de965009b13 100644
@@ -10053,6 +10053,14 @@ S:	Maintained
 F:	drivers/media/i2c/ov7670.c
 F:	Documentation/devicetree/bindings/media/i2c/ov7670.txt
 
+OMNIVISION OV7740 SENSOR DRIVER
+M:	Wenyou Yang <[email protected]>
+L:	linux-media at vger.kernel.org
+T:	git git://linuxtv.org/media_tree.git
+S:	Maintained
+F:	drivers/media/i2c/ov7740.c
+F:	Documentation/devicetree/bindings/media/i2c/ov7740.txt
+
 ONENAND FLASH DRIVER
 M:	Kyungmin Park <[email protected]>
 L:	linux-mtd at lists.infradead.org
drivers/media/i2c/Kconfig +8 -0
index cb5d7ff82915..00b1c4c031d4 100644
@@ -665,6 +665,14 @@ config VIDEO_OV7670
 	  OV7670 VGA camera.  It currently only works with the M88ALP01
 	  controller.
 
+config VIDEO_OV7740
+	tristate "OmniVision OV7740 sensor support"
+	depends on I2C && VIDEO_V4L2
+	depends on MEDIA_CAMERA_SUPPORT
+	---help---
+	  This is a Video4Linux2 sensor-level driver for the OmniVision
+	  OV7740 VGA camera sensor.
+
 config VIDEO_OV9650
 	tristate "OmniVision OV9650/OV9652 sensor support"
 	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
drivers/media/i2c/Makefile +1 -0
index 548a9efce966..9b19ec7fcaf4 100644
@@ -68,6 +68,7 @@ obj-$(CONFIG_VIDEO_OV5670) += ov5670.o
 obj-$(CONFIG_VIDEO_OV6650) += ov6650.o
 obj-$(CONFIG_VIDEO_OV7640) += ov7640.o
 obj-$(CONFIG_VIDEO_OV7670) += ov7670.o
+obj-$(CONFIG_VIDEO_OV7740) += ov7740.o
 obj-$(CONFIG_VIDEO_OV9650) += ov9650.o
 obj-$(CONFIG_VIDEO_OV13858) += ov13858.o
 obj-$(CONFIG_VIDEO_MT9M032) += mt9m032.o
drivers/media/i2c/ov7740.c new file +1226 -0

1,226 lines not on this page · raw message

Signature · 1 line
2.15.0
#3 lore raw

Re: [PATCH v8 2/2] media: i2c: Add the ov7740 image sensor driver

Wenyou,

Quoted 6 lines · Wenyou Yang

The ov7740 (color) image sensor is a high performance VGA CMOS image snesor, which supports for output formats: RAW RGB and YUV and image sizes: VGA, and QVGA, CIF and any size smaller.

[]

Quoted 6 lines
drivers/media/i2c/ov7740.c new file +3 -0
@@ -0,0 +1,1226 @@
+/*
+ * Copyright (c) 2017 Microchip Corporation.
+ *

drivers/media/i2c/ov7740.c line 13

Quoted 10 lines
drivers/media/i2c/ov7740.c new file +10 -0
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version
+ * 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */

Have you considered using the new SPDX ids instead of this fine legalese? e.g.:

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017 Microchip Corporation.

Short and neat! Check also Thomas doc patches and Linus comments on why he prefers the C++ comment style for these.

Signature · 2 lines
Cordially
Philippe Ombredanne
#4 lore raw

Re: [PATCH v8 2/2] media: i2c: Add the ov7740 image sensor driver

Hi Philippe,

Quoted 29 lines · Philippe Ombredanne

Wenyou,

Quoted 6 lines · Wenyou Yang

The ov7740 (color) image sensor is a high performance VGA CMOS image snesor, which supports for output formats: RAW RGB and YUV and image sizes: VGA, and QVGA, CIF and any size smaller.

[]

Quoted 6 lines
drivers/media/i2c/ov7740.c new file +3 -0
@@ -0,0 +1,1226 @@
+/*
+ * Copyright (c) 2017 Microchip Corporation.
+ *

drivers/media/i2c/ov7740.c line 13

Quoted 10 lines
drivers/media/i2c/ov7740.c new file +10 -0
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License version
+ * 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ */

Have you considered using the new SPDX ids instead of this fine legalese? e.g.:

Quoted 5 lines

// SPDX-License-Identifier: GPL-2.0
// Copyright (c) 2017 Microchip Corporation.

Short and neat! Check also Thomas doc patches and Linus comments on why he prefers the C++ comment style for these.

Thank you for your suggestion and information.

Best Regards,
Wenyou Yang