Re: [PATCH] media: i2c: Add the ov7740 image sensor driver
On 2017/10/27 15:10, Hans Verkuil wrote: On 10/27/2017 05:30 AM, Wenyou Yang wrote: From: Songjun WuThe 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. Two short remarks: please split off the bindings into a separate patch. And add a new entry to the MAINTAINERS file. Thanks a lot. Will be done in the next version. Regards, Hans Signed-off-by: Songjun Wu Signed-off-by: Wenyou Yang --- .../devicetree/bindings/media/i2c/ov7740.txt | 43 + drivers/media/i2c/Kconfig |8 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/ov7740.c | 1220 4 files changed, 1272 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/ov7740.txt create mode 100644 drivers/media/i2c/ov7740.c diff --git a/Documentation/devicetree/bindings/media/i2c/ov7740.txt b/Documentation/devicetree/bindings/media/i2c/ov7740.txt new file mode 100644 index ..b306e5aa97bf --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/ov7740.txt @@ -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@fc028000 { + ov7740: camera@21 { + compatible = "ovti,ov7740"; + reg = <0x21>; + pinctrl-names = "default"; + pinctrl-0 = <_sensor_power _sensor_reset>; + clocks = <>; + clock-names = "xvclk"; + assigned-clocks = <>; + assigned-clock-rates = <2400>; + reset-gpios = < 43 GPIO_ACTIVE_LOW>; + powerdown-gpios = < 44 GPIO_ACTIVE_HIGH>; + + port { + ov7740_0: endpoint { + remote-endpoint = <_0>; + }; + }; + }; + }; diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 47113774a297..402ad0e4024c 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -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 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index c843c181dfb9..f94cb2a8ed91 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -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 diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c new file mode 100644 index ..d68add05b46e --- /dev/null +++ b/drivers/media/i2c/ov7740.c @@ -0,0 +1,1220 @@ +/* + * Copyright (c) 2017 Microchip Corporation. + * + * 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. + * + */ +#include +#include +#include +#include
Re: [PATCH] media: i2c: Add the ov7740 image sensor driver
On 10/27/2017 05:30 AM, Wenyou Yang wrote: > From: Songjun Wu> > 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. Two short remarks: please split off the bindings into a separate patch. And add a new entry to the MAINTAINERS file. Regards, Hans > > Signed-off-by: Songjun Wu > Signed-off-by: Wenyou Yang > --- > > .../devicetree/bindings/media/i2c/ov7740.txt | 43 + > drivers/media/i2c/Kconfig |8 + > drivers/media/i2c/Makefile |1 + > drivers/media/i2c/ov7740.c | 1220 > > 4 files changed, 1272 insertions(+) > create mode 100644 Documentation/devicetree/bindings/media/i2c/ov7740.txt > create mode 100644 drivers/media/i2c/ov7740.c > > diff --git a/Documentation/devicetree/bindings/media/i2c/ov7740.txt > b/Documentation/devicetree/bindings/media/i2c/ov7740.txt > new file mode 100644 > index ..b306e5aa97bf > --- /dev/null > +++ b/Documentation/devicetree/bindings/media/i2c/ov7740.txt > @@ -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@fc028000 { > + ov7740: camera@21 { > + compatible = "ovti,ov7740"; > + reg = <0x21>; > + pinctrl-names = "default"; > + pinctrl-0 = <_sensor_power > _sensor_reset>; > + clocks = <>; > + clock-names = "xvclk"; > + assigned-clocks = <>; > + assigned-clock-rates = <2400>; > + reset-gpios = < 43 GPIO_ACTIVE_LOW>; > + powerdown-gpios = < 44 GPIO_ACTIVE_HIGH>; > + > + port { > + ov7740_0: endpoint { > + remote-endpoint = <_0>; > + }; > + }; > + }; > + }; > diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig > index 47113774a297..402ad0e4024c 100644 > --- a/drivers/media/i2c/Kconfig > +++ b/drivers/media/i2c/Kconfig > @@ -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 > diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile > index c843c181dfb9..f94cb2a8ed91 100644 > --- a/drivers/media/i2c/Makefile > +++ b/drivers/media/i2c/Makefile > @@ -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 > diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c > new file mode 100644 > index ..d68add05b46e > --- /dev/null > +++ b/drivers/media/i2c/ov7740.c > @@ -0,0 +1,1220 @@ > +/* > + * Copyright (c) 2017 Microchip Corporation. > + * > + * 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
[PATCH] media: i2c: Add the ov7740 image sensor driver
From: Songjun WuThe 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 Signed-off-by: Wenyou Yang --- .../devicetree/bindings/media/i2c/ov7740.txt | 43 + drivers/media/i2c/Kconfig |8 + drivers/media/i2c/Makefile |1 + drivers/media/i2c/ov7740.c | 1220 4 files changed, 1272 insertions(+) create mode 100644 Documentation/devicetree/bindings/media/i2c/ov7740.txt create mode 100644 drivers/media/i2c/ov7740.c diff --git a/Documentation/devicetree/bindings/media/i2c/ov7740.txt b/Documentation/devicetree/bindings/media/i2c/ov7740.txt new file mode 100644 index ..b306e5aa97bf --- /dev/null +++ b/Documentation/devicetree/bindings/media/i2c/ov7740.txt @@ -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@fc028000 { + ov7740: camera@21 { + compatible = "ovti,ov7740"; + reg = <0x21>; + pinctrl-names = "default"; + pinctrl-0 = <_sensor_power _sensor_reset>; + clocks = <>; + clock-names = "xvclk"; + assigned-clocks = <>; + assigned-clock-rates = <2400>; + reset-gpios = < 43 GPIO_ACTIVE_LOW>; + powerdown-gpios = < 44 GPIO_ACTIVE_HIGH>; + + port { + ov7740_0: endpoint { + remote-endpoint = <_0>; + }; + }; + }; + }; diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index 47113774a297..402ad0e4024c 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -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 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index c843c181dfb9..f94cb2a8ed91 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -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 diff --git a/drivers/media/i2c/ov7740.c b/drivers/media/i2c/ov7740.c new file mode 100644 index ..d68add05b46e --- /dev/null +++ b/drivers/media/i2c/ov7740.c @@ -0,0 +1,1220 @@ +/* + * Copyright (c) 2017 Microchip Corporation. + * + * 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. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define REG_OUTSIZE_LSB 0x34 + +/* OV7740 register tables */ +#define REG_GAIN 0x00/* Gain lower 8 bits (rest in vref) */ +#define REG_BGAIN 0x01/* blue gain */ +#define REG_RGAIN 0x02