media: ov7740: Add a V4L2 sensor-level driver
Subsystems (4)
v9 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 v9:
- Use the new SPDX ids.
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 | 1216 ++++++++++++++++++++ 5 files changed, 1280 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
PATCH v9 1/2 media: ov7740: Document device tree bindings
Add the device tree binding documentation for the ov7740 sensor driver.
---
Changes in v9: None
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
@@ -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
PATCH v9 2/2 media: i2c: Add the ov7740 image sensor driver
In reply to Wenyou YangThe 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 v9:
- Use the new SPDX ids.
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 | 1216 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1233 insertions(+) create mode 100644 drivers/media/i2c/ov7740.c
MAINTAINERS +8 -0
@@ -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
@@ -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
@@ -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 +1216 -0
1,216 lines not on this page · raw message
Signature · 1 line
2.15.0
Quoted 5 lines · Wenyou Yang
Add a Video4Linux2 sensor-level driver for the OmniVision OV7740 VGA camera image sensor.
Changes in v9:
- Use the new SPDX ids.
Thank you for this
Signature · 2 lines
Cordially Philippe Ombredanne
Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
In reply to Wenyou YangHi Wenyou,
Wenyou Yang wrote:
...
Quoted 11 lines
drivers/media/i2c/ov7740.c new file +11
-0+static int ov7740_start_streaming (struct ov7740 *ov7740) +{ +int ret; + +if (ov7740->fmt) { + ret =regmap_multi_reg_write (ov7740->regmap, + ov7740->fmt->regs, + ov7740->fmt->reg_num); +if (ret) +return ret; + }
drivers/media/i2c/ov7740.c line 586
Quoted 10 lines
drivers/media/i2c/ov7740.c new file +10
-0+ +if (ov7740->frmsize) { + ret =regmap_multi_reg_write (ov7740->regmap, + ov7740->frmsize->regs, + ov7740->frmsize->reg_num); +if (ret) +return ret; + } + +return __v4l2_ctrl_handler_setup (ov7740->subdev.ctrl_handler);
I believe you're still setting the controls after starting streaming.
Signature · 2 lines
Sakari Ailus sakari.ailus at iki.fi
Hi Sakari,
Do you have some comments on this version?
Best Regards,
Wenyou Yang
Quoted 71 lines
-----Original Message-----
From: linux-media-owner at vger.kernel.org [mailto:linux-media-
owner at vger.kernel.org] On Behalf Of Wenyou Yang
Sent: 2017?12?11? 9:32
To: Mauro Carvalho Chehab <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: linux-kernel at vger.kernel.org; Nicolas Ferre - M43238 <[email protected]>; devicetree at vger.kernel.org; Sakari Ailus <[email protected]>; Jonathan Corbet <[email protected]>; Hans Verkuil <[email protected]>; linux-arm-kernel at lists.infradead.org; Linux Media Mailing List <[email protected]>; Wenyou Yang - A41535 <[email protected]>
Subject: [PATCH v9 0/2] media: ov7740: Add a V4L2 sensor-level driverAdd a Video4Linux2 sensor-level driver for the OmniVision OV7740 VGA camera image sensor.
Changes in v9:
- Use the new SPDX ids.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 ofov7740->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 fromregmap_write().
- Simplify the calling of__v4l2_ctrl_handler_setup().
- Add the default format initialization function.
- Integrate theset_power()and enable/disable the clock into one function.Changes in v5:
- Squash the driver andMAINTAINERSentry 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.
- RenameREG_REG15to avoid warning: "REG_REG15" redefined.Changes in v3:
- Explicitly document the "remote-endpoint" property.
- Put theMAINTAINERSchange to a separate patch.Changes in v2:
- Split off the bindings into a separate patch.
- Add a new entry to theMAINTAINERSfile.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 | 1216 ++++++++++++++++++++ 5 files changed, 1280 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/ov7740.txt create mode 100644 drivers/media/i2c/ov7740.c--
2.15.0
RE: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
In reply to Sakari AilusHi Sakari,
Quoted 31 lines
-----Original Message-----
From: Sakari Ailus [mailto:sakari.ailus at iki.fi]
Sent: 2017?12?14? 4:06
To: Wenyou Yang - A41535 <[email protected]>; Mauro Carvalho Chehab <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: linux-kernel at vger.kernel.org; Nicolas Ferre - M43238 <[email protected]>; devicetree at vger.kernel.org; Jonathan Corbet <[email protected]>; Hans Verkuil <[email protected]>; linux-arm- kernel at lists.infradead.org; Linux Media Mailing List <linux- media at vger.kernel.org>; Songjun Wu <[email protected]>
Subject: Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driverHi Wenyou,
Wenyou Yang wrote:
...Quoted 14 lines
drivers/media/i2c/ov7740.c new file +14
-0+static int ov7740_start_streaming (struct ov7740 *ov7740) { +int ret; + +if (ov7740->fmt) { + ret =regmap_multi_reg_write (ov7740->regmap, + ov7740->fmt->regs, + ov7740->fmt->reg_num); +if (ret) +return ret; + } + +if (ov7740->frmsize) { + ret = regmap_multi_reg_write(ov7740->regmap, + ov7740->frmsize->regs,
Quoted 8 lines
drivers/media/i2c/ov7740.c line 586
Quoted 6 lines
drivers/media/i2c/ov7740.c new file +6
-0+ ov7740->frmsize->reg_num); +if (ret) +return ret; + } + +return __v4l2_ctrl_handler_setup (ov7740->subdev.ctrl_handler);I believe you're still setting the controls after starting streaming.
Yes, it sees it does so.
The OV7740 sensor generates the stream pixel data at the constant frame rate, no such start or stop control.
Quoted 4 lines
--
Sakari Ailus
sakari.ailus at iki.fi
Wenyou Yang
-------------- next part --------------
A non-text attachment was scrubbed...
Name: imx7d-sdb.dtb
Type: application/octet-stream
Size: 46918 bytes
Desc: imx7d-sdb.dtb
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171219/361b8cf3/attachment-0001.obj>
Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
Hi Wenyou,
Quoted 42 lines · Wenyou.Yang at microchip.com
Hi Sakari,
Quoted 31 lines
-----Original Message-----
From: Sakari Ailus [mailto:sakari.ailus at iki.fi]
Sent: 2017?12?14? 4:06
To: Wenyou Yang - A41535 <[email protected]>; Mauro Carvalho Chehab <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>
Cc: linux-kernel at vger.kernel.org; Nicolas Ferre - M43238 <[email protected]>; devicetree at vger.kernel.org; Jonathan Corbet <[email protected]>; Hans Verkuil <[email protected]>; linux-arm- kernel at lists.infradead.org; Linux Media Mailing List <linux- media at vger.kernel.org>; Songjun Wu <[email protected]>
Subject: Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driverHi Wenyou,
Wenyou Yang wrote:
...Quoted 14 lines
drivers/media/i2c/ov7740.c new file +14
-0+static int ov7740_start_streaming (struct ov7740 *ov7740) { +int ret; + +if (ov7740->fmt) { + ret =regmap_multi_reg_write (ov7740->regmap, + ov7740->fmt->regs, + ov7740->fmt->reg_num); +if (ret) +return ret; + } + +if (ov7740->frmsize) { + ret = regmap_multi_reg_write(ov7740->regmap, + ov7740->frmsize->regs,Quoted 8 lines
drivers/media/i2c/ov7740.c line 586
Quoted 6 lines
drivers/media/i2c/ov7740.c new file +6
-0+ ov7740->frmsize->reg_num); +if (ret) +return ret; + } + +return __v4l2_ctrl_handler_setup (ov7740->subdev.ctrl_handler);I believe you're still setting the controls after starting streaming.
Quoted 4 lines
Yes, it sees it does so.
The OV7740 sensor generates the stream pixel data at the constant frame rate, no such start or stop control.
That'd be odd but I guess hardware sometimes is. I'll apply the patches.
Thanks!
Signature · 2 lines
Sakari Ailus e-mail: sakari.ailus at iki.fi
Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
In reply to Wenyou YangQuoted 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.
Signed-off-by Songjun Wu <[email protected]>Signed-off-by Wenyou Yang <[email protected]>
Applied with this diff:
drivers/media/i2c/ov7740.c +4 -2
@@ -1,5 +1,7 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2017 Microchip Corporation. +/* +* SPDX-License-Identifier: GPL-2.0 +* Copyright (c) 2017 Microchip Corporation. +*/ #include <linux/clk.h> #include <linux/delay.h>
Signature · 2 lines
Sakari Ailus e-mail: sakari.ailus at iki.fi
RE: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
Hi Sakari,
Quoted 13 lines
-----Original Message-----
From: Sakari Ailus [mailto:sakari.ailus at iki.fi]
Sent: 2017?12?19? 17:23
To: Wenyou Yang - A41535 <[email protected]>
Cc: Mauro Carvalho Chehab <[email protected]>; Rob Herring <[email protected]>; Mark Rutland <[email protected]>; linux-
kernel at vger.kernel.org; Nicolas Ferre - M43238 <[email protected]>; devicetree at vger.kernel.org; Jonathan Corbet <[email protected]>; Hans Verkuil <[email protected]>; linux-arm-kernel at lists.infradead.org; Linux Media Mailing List <[email protected]>; Songjun Wu <[email protected]>
Subject: Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driverOn Mon, Dec 11, 2017 at 09:31:46AM +0800, Wenyou Yang wrote:
Quoted 8 lines
Quoted 6 lines
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.Signed-off-by Songjun Wu <[email protected]>Signed-off-by Wenyou Yang <[email protected]>Applied with this diff:
Thank you very much.
Quoted 17 lines
drivers/media/i2c/ov7740.c index renamed from drivers/media/i2c/ov7740.c +0
-0
0308ba437bbb..041a77039d70100644drivers/media/i2c/ov7740.c +4
-3@@ -1,5 +1,7 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2017 Microchip Corporation. +/* +* SPDX-License-Identifier: GPL-2.0 +* Copyright (c) 2017 Microchip Corporation. +*/ #include <linux/clk.h> #include <linux/delay.h> --
Quoted 2 lines
Sakari Ailus
e-mail: sakari.ailus at iki.fi
Best Regards,
Wenyou Yang
Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
In reply to Sakari AilusHi Sakari,
Quoted 15 lines · Sakari Ailus
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.
Signed-off-by Songjun Wu <[email protected]>Signed-off-by Wenyou Yang <[email protected]>Applied with this diff:
drivers/media/i2c/ov7740.c +0
-0
drivers/media/i2c/ov7740.c line 4
Quoted 6 lines
drivers/media/i2c/ov7740.c +4
-2@@ -1,5 +1,7 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2017 Microchip Corporation. +/* +* SPDX-License-Identifier: GPL-2.0 +* Copyright (c) 2017 Microchip Corporation. +*/
The original version is the recommended format for the SPDX identifier.
Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
Quoted 13 lines · Fabio Estevam
Hi Sakari,
Quoted 10 lines · Sakari Ailus
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.
Signed-off-by Songjun Wu <[email protected]>Signed-off-by Wenyou Yang <[email protected]>Applied with this diff:
Quoted 13 lines
drivers/media/i2c/ov7740.c line 4
Quoted 11 lines
drivers/media/i2c/ov7740.c +4
-2@@ -1,5 +1,7 @@ -// SPDX-License-Identifier: GPL-2.0 -// Copyright (c) 2017 Microchip Corporation. +/* +* SPDX-License-Identifier: GPL-2.0 +* Copyright (c) 2017 Microchip Corporation. +*/ The original version is the recommended format for the SPDX identifier.
I guess it depends on who do you ask and when. Looking at what has been recently merged to media tree master, the latter is preferred.
Signature · 2 lines
Sakari Ailus e-mail: sakari.ailus at iki.fi
Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
Hi Sakari,
Quoted 2 lines · Sakari Ailus
I guess it depends on who do you ask and when. Looking at what has been recently merged to media tree master, the latter is preferred.
Just did 'git grep SPDX drivers/media'
and it consistently shows // SPDX style for C files.
Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
Quoted 10 lines · Fabio Estevam
Hi Sakari,
Quoted 2 lines · Sakari Ailus
I guess it depends on who do you ask and when. Looking at what has been recently merged to media tree master, the latter is preferred.
Just did 'git grep SPDX
drivers/media'and it consistently shows // SPDX style for C files.
Both seem to exist. See e.g. c3a3d1d6b8b363a02234e5564692db3647f183e6 .
Signature · 2 lines
Sakari Ailus e-mail: sakari.ailus at iki.fi
Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
Quoted 1 line · Sakari Ailus
Both seem to exist. See e.g.
c3a3d1d6b8b363a02234e5564692db3647f183e6.
This patch fixes .h files to use /* SPDX style comment, which is the recommendation.
.c files should use // SPDX style.
Re: [PATCH v9 2/2] media: i2c: Add the ov7740 image sensor driver
Quoted 8 lines · Fabio Estevam
Quoted 1 line · Sakari Ailus
Both seem to exist. See e.g.
c3a3d1d6b8b363a02234e5564692db3647f183e6.This patch fixes .h files to use /* SPDX style comment, which is the recommendation.
.c files should use // SPDX style.
Agreed. I reverted the changes.
Thanks.
Signature · 2 lines
Sakari Ailus e-mail: sakari.ailus at iki.fi