Skip to contentSkip to conversation

media: ov7740: Add a V4L2 sensor-level driver

PATCH Superseded Wenyou Yang 3 participants 7 messages Oct 27, 2017 – Oct 30, 2017

Subsystems (4)

v2 of 9 Superseded Latest is v9 →

lore
Share & tools
lore
#0 lore raw

v2 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 v2:
- Split off the bindings into a separate patch.
- Add a new entry to the MAINTAINERS file.

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

 .../devicetree/bindings/media/i2c/ov7740.txt       |   43 +
 MAINTAINERS                                        |    8 +
 drivers/media/i2c/Kconfig                          |    8 +
 drivers/media/i2c/Makefile                         |    1 +
 drivers/media/i2c/ov7740.c                         | 1220 ++++++++++++++++++++
 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.13.0
#1 lore raw

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

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 v2: None

 drivers/media/i2c/Kconfig  |    8 +
 drivers/media/i2c/Makefile |    1 +
 drivers/media/i2c/ov7740.c | 1220 ++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 1229 insertions(+)
 create mode 100644 drivers/media/i2c/ov7740.c
drivers/media/i2c/Kconfig +8 -0
index 47113774a297..402ad0e4024c 100644
@@ -657,6 +657,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 c843c181dfb9..f94cb2a8ed91 100644
@@ -67,6 +67,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 +1220 -0

1,220 lines not on this page · raw message

Signature · 1 line
2.13.0
#2 lore raw

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

I love your patch! Perhaps something to improve:

Hi Wenyou,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.14-rc7 next-20171018]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Wenyou-Yang/media-i2c-Add-the-ov7740-image-sensor-driver/20171030-140347
base:   git://linuxtv.org/media_tree.git master
config: blackfin-allyesconfig (attached as .config)
compiler: bfin-uclinux-gcc (GCC) 6.2.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=blackfin

Note: it may well be a FALSE warning. FWIW you are at least aware of it now.
http://gcc.gnu.org/wiki/Better_Uninitialized_Warnings

All warnings (new ones prefixed by >>):

In file included from drivers/media//i2c/ov7740.c:21:0:
drivers/media//i2c/ov7740.c: In function 'ov7740_set_ctrl':

>> include/linux/regmap.h:73:2: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
     regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
     ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/media//i2c/ov7740.c:512:5: note: 'val' was declared here
     u8 val;
        ^~~
--
   In file included from drivers/media/i2c/ov7740.c:21:0:
   drivers/media/i2c/ov7740.c: In function 'ov7740_set_ctrl':
>> include/linux/regmap.h:73:2: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
     regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
     ^~~~~~~~~~~~~~~~~~~~~~~
   drivers/media/i2c/ov7740.c:512:5: note: 'val' was declared here
     u8 val;
        ^~~

vim +/val +73 include/linux/regmap.h

8019ff6cf Nariman Poushin 2015-07-16 71

ca7a94464 Kuninori Morimoto 2016-02-15  72  #define	regmap_update_bits(map, reg, mask, val) \
ca7a94464 Kuninori Morimoto 2016-02-15 @73  	regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
30ed9cb7a Kuninori Morimoto 2016-02-15  74  #define	regmap_update_bits_async(map, reg, mask, val)\
30ed9cb7a Kuninori Morimoto 2016-02-15  75  	regmap_update_bits_base(map, reg, mask, val, NULL, true, false)
98c2dc486 Kuninori Morimoto 2016-02-15  76  #define	regmap_update_bits_check(map, reg, mask, val, change)\
98c2dc486 Kuninori Morimoto 2016-02-15  77  	regmap_update_bits_base(map, reg, mask, val, change, false, false)
89d8d4b83 Kuninori Morimoto 2016-02-15  78  #define	regmap_update_bits_check_async(map, reg, mask, val, change)\
89d8d4b83 Kuninori Morimoto 2016-02-15  79  	regmap_update_bits_base(map, reg, mask, val, change, true, false)

ca7a94464 Kuninori Morimoto 2016-02-15 80

:::::: The code at line 73 was first introduced by commit
:::::: ca7a94464b5457a8dc5add19f6fc3bea59d6193f regmap: merge regmap_update_bits() into macro

:::::: TO: Kuninori Morimoto <[email protected]> :::::: CC: Mark Brown <[email protected]>

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 46053 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171030/a5031113/attachment-0001.gz>

#3 lore raw

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

In reply to Wenyou Yang
I love your patch! Perhaps something to improve:

Hi Wenyou,

I love your patch! Perhaps something to improve:

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.14-rc7 next-20171018]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Wenyou-Yang/media-i2c-Add-the-ov7740-image-sensor-driver/20171030-140347
base:   git://linuxtv.org/media_tree.git master
config: sh-allmodconfig (attached as .config)
compiler: sh4-linux-gnu-gcc (Debian 6.1.1-9) 6.1.1 20160705

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=sh

All warnings (new ones prefixed by >>):

>> drivers/media/i2c/ov7740.c:57:0: warning: "REG_REG15" redefined
    #define REG_REG15 0x15

In file included from arch/sh/include/asm/ptrace_32.h:4:0,

                    from arch/sh/include/uapi/asm/ptrace.h:30,
                    from arch/sh/include/asm/ptrace.h:13,
                    from include/linux/irq.h:28,
                    from include/linux/gpio/driver.h:6,
                    from include/asm-generic/gpio.h:12,
                    from arch/sh/include/asm/gpio.h:23,
                    from include/linux/gpio.h:48,
                    from drivers/media/i2c/ov7740.c:16:
   arch/sh/include/uapi/asm/ptrace_32.h:20:0: note: this is the location of the previous definition
    #define REG_REG15 15

In file included from drivers/media/i2c/ov7740.c:21:0:
drivers/media/i2c/ov7740.c: In function 'ov7740_set_ctrl':
include/linux/regmap.h:73:2: warning: 'val' may be used uninitialized in this function [-Wmaybe-uninitialized]
regmap_update_bits_base(map, reg, mask, val, NULL, false, false)
^~~~~~~~~~~~~~~~~~~~~~~
drivers/media/i2c/ov7740.c:512:5: note: 'val' was declared here

     u8 val;
        ^~~

vim +/REG_REG15 +57 drivers/media/i2c/ov7740.c

    55	
    56	#define REG_REG14	0x14
  > 57	#define REG_REG15	0x15
    58	#define REG15_GAIN_MSB	0x03
    59	

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 46548 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20171030/928ea05a/attachment-0001.gz>

#4 lore raw

PATCH v2 2/2 media: ov7740: Document device tree bindings

In reply to Wenyou Yang

Add the device tree binding documentation for ov7740 driver and add a new entry of ov7740 to the MAINTAINERS file.

---

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

 .../devicetree/bindings/media/i2c/ov7740.txt       | 43 ++++++++++++++++++++++
 MAINTAINERS                                        |  8 ++++
 2 files changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ov7740.txt
Documentation/devicetree/bindings/media/i2c/ov7740.txt new file +43 -0
new file mode 100644
index 000000000000..b306e5aa97bf
@@ -0,0 +1,43 @@
+* 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.
+
+Required Properties:
+- compatible: should be "ovti,ov7740"
+- clocks: reference to the xvclk input clock.
+- clock-names: should be "xvclk".
+
+Optional Properties:
+- reset-gpios: reference 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.
+
+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:
+
+	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>;
+				};
+			};
+		};
+	};
MAINTAINERS +8 -0
index 90230fe020f3..f0f3f121d1d8 100644
@@ -9965,6 +9965,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
Signature · 1 line
2.13.0
#5 lore raw

Re: [PATCH v2 2/2] media: ov7740: Document device tree bindings

Hi Wenyou,

Quoted 31 lines · Wenyou Yang

Add the device tree binding documentation for ov7740 driver and add a new entry of ov7740 to the MAINTAINERS file.

---

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

 .../devicetree/bindings/media/i2c/ov7740.txt       | 43 ++++++++++++++++++++++
 MAINTAINERS                                        |  8 ++++
 2 files changed, 51 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/media/i2c/ov7740.txt
Documentation/devicetree/bindings/media/i2c/ov7740.txt new file +10 -0
new file mode 100644
index 000000000000..b306e5aa97bf
@@ -0,0 +1,43 @@
+* 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.
+
+Required Properties:
+- compatible: should be "ovti,ov7740"
+- clocks: reference to the xvclk input clock.
+- clock-names: should be "xvclk".

Documentation/devicetree/bindings/media/i2c/ov7740.txt line 20

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/ov7740.txt new file +10 -0
+
+Optional Properties:
+- reset-gpios: reference 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.
+
+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.

Could you add there's a single endpoint node as well, and explicitly document the relevant properties? E.g. as in Documentation/devicetree/bindings/media/i2c/nokia,smia.txt .

Quoted 32 lines
Documentation/devicetree/bindings/media/i2c/ov7740.txt new file +23 -0
+
+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>;
+				};
+			};
+		};
+	};
MAINTAINERS +1 -0
index 90230fe020f3..f0f3f121d1d8 100644
@@ -9965,6 +9965,14 @@ S:	Maintained
 F:	drivers/media/i2c/ov7670.c
 F:	Documentation/devicetree/bindings/media/i2c/ov7670.txt
 
+OMNIVISION OV7740 SENSOR DRIVER

MAINTAINERS S: Maintained · line 9978

Quoted 10 lines
MAINTAINERS +7 -0
+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

Please put the MAINTAINERS change to the driver patch after the DT binding patch.

Signature · 4 lines
Kind regards,

Sakari Ailus
e-mail: sakari.ailus at iki.fi
#6 lore raw

Re: [PATCH v2 2/2] media: ov7740: Document device tree bindings

Hi Sakari,

Thank you very much for your review and advice.

I will send a new version to fix it.

Quoted 79 lines · Sakari Ailus

Hi Wenyou,

Quoted 31 lines · Wenyou Yang

Add the device tree binding documentation for ov7740 driver and add a new entry of ov7740 to the MAINTAINERS file.

---

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

  .../devicetree/bindings/media/i2c/ov7740.txt       | 43 ++++++++++++++++++++++
  MAINTAINERS                                        |  8 ++++
  2 files changed, 51 insertions(+)

create mode 100644 Documentation/devicetree/bindings/media/i2c/ov7740.txt

Documentation/devicetree/bindings/media/i2c/ov7740.txt new file +10 -0
new file mode 100644
index 000000000000..b306e5aa97bf
@@ -0,0 +1,43 @@
+* 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.
+
+Required Properties:
+- compatible: should be "ovti,ov7740"
+- clocks: reference to the xvclk input clock.
+- clock-names: should be "xvclk".

Documentation/devicetree/bindings/media/i2c/ov7740.txt line 20

Quoted 10 lines
Documentation/devicetree/bindings/media/i2c/ov7740.txt new file +10 -0
+
+Optional Properties:
+- reset-gpios: reference 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.
+
+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.

Could you add there's a single endpoint node as well, and explicitly document the relevant properties? E.g. as in Documentation/devicetree/bindings/media/i2c/nokia,smia.txt .

Quoted 31 lines
Documentation/devicetree/bindings/media/i2c/ov7740.txt new file +23 -0
+
+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>;
+				};
+			};
+		};
+	};
MAINTAINERS +0 -0
index 90230fe020f3..f0f3f121d1d8 100644
@@ -9965,6 +9965,14 @@ S:	Maintained
  F:	drivers/media/i2c/ov7670.c
  F:	Documentation/devicetree/bindings/media/i2c/ov7670.txt
 
Quoted 14 lines

MAINTAINERS S: Maintained · line 9978

Quoted 11 lines
MAINTAINERS +8 -0
+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

Please put the MAINTAINERS change to the driver patch after the DT binding patch.

Best Regards,
Wenyou Yang