Re: [PATCH v5 2/2] Add support for OV5647 sensor
Hi Ramiro, On Mon, Dec 12, 2016 at 11:39:13AM +, Ramiro Oliveira wrote: > Hi Sakari > > On 12/7/2016 11:01 PM, Sakari Ailus wrote: > > Hi Ramiro, > > > > On Mon, Dec 05, 2016 at 05:36:34PM +, Ramiro Oliveira wrote: > >> Add support for OV5647 sensor. > >> > >> Modes supported: > >> - 640x480 RAW 8 > >> > >> Signed-off-by: Ramiro Oliveira> >> --- > >> MAINTAINERS| 7 + > >> drivers/media/i2c/Kconfig | 12 + > >> drivers/media/i2c/Makefile | 1 + > >> drivers/media/i2c/ov5647.c | 866 > >> + > >> 4 files changed, 886 insertions(+) > >> create mode 100644 drivers/media/i2c/ov5647.c > >> > >> diff --git a/MAINTAINERS b/MAINTAINERS > >> index 52cc077..72e828a 100644 > >> --- a/MAINTAINERS > >> +++ b/MAINTAINERS > >> @@ -8923,6 +8923,13 @@ M: Harald Welte > >> S:Maintained > >> F:drivers/char/pcmcia/cm4040_cs.* > >> > >> +OMNIVISION OV5647 SENSOR DRIVER > >> +M:Ramiro Oliveira > >> +L:linux-media@vger.kernel.org > >> +T:git git://linuxtv.org/media_tree.git > >> +S:Maintained > >> +F:drivers/media/i2c/ov5647.c > >> + > >> OMNIVISION OV7670 SENSOR DRIVER > >> M:Jonathan Corbet > >> L:linux-media@vger.kernel.org > >> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig > >> index b31fa6f..c1b78e5 100644 > >> --- a/drivers/media/i2c/Kconfig > >> +++ b/drivers/media/i2c/Kconfig > >> @@ -531,6 +531,18 @@ config VIDEO_OV2659 > >> To compile this driver as a module, choose M here: the > >> module will be called ov2659. > >> > >> +config VIDEO_OV5647 > >> + tristate "OmniVision OV5647 sensor support" > >> + depends on OF > > > > How does this driver depend on OF, other than matching the compatible > > string? > > > > It doesn't, should I proceed diferently? You should drop the dependency if you don't need it. But I bet you will actually need it. > > >> + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API > >> + depends on MEDIA_CAMERA_SUPPORT > >> + ---help--- > >> +This is a Video4Linux2 sensor-level driver for the OmniVision > >> +OV5647 camera. > >> + > >> +To compile this driver as a module, choose M here: the > >> +module will be called ov5647. > >> + > >> config VIDEO_OV7640 > >>tristate "OmniVision OV7640 sensor support" > >>depends on I2C && VIDEO_V4L2 > >> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile > >> index 92773b2..0d9014c 100644 > >> --- a/drivers/media/i2c/Makefile > >> +++ b/drivers/media/i2c/Makefile > >> @@ -82,3 +82,4 @@ obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o > >> obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o > >> obj-$(CONFIG_VIDEO_OV2659)+= ov2659.o > >> obj-$(CONFIG_VIDEO_TC358743) += tc358743.o > >> +obj-$(CONFIG_VIDEO_OV5647)+= ov5647.o > >> diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c > >> new file mode 100644 > >> index 000..2aae806 > >> --- /dev/null > >> +++ b/drivers/media/i2c/ov5647.c > >> @@ -0,0 +1,866 @@ > >> +/* > >> + * A V4L2 driver for OmniVision OV5647 cameras. > >> + * > >> + * Based on Samsung S5K6AAFX SXGA 1/6" 1.3M CMOS Image Sensor driver > >> + * Copyright (C) 2011 Sylwester Nawrocki > >> + * > >> + * Based on Omnivision OV7670 Camera Driver > >> + * Copyright (C) 2006-7 Jonathan Corbet > >> + * > >> + * Copyright (C) 2016, Synopsys, Inc. > >> + * > >> + * This program is free software; you can redistribute it and/or > >> + * modify it under the terms of the GNU General Public License as > >> + * published by the Free Software Foundation version 2. > >> + * > >> + * This program is distributed .as is. WITHOUT ANY WARRANTY of any > >> + * kind, whether express or implied; 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 > > > > Alphabetical order, please. > > > >> + > >> +#define SENSOR_NAME "ov5647" > >> + > >> +#define OV5647_SW_RESET 0x1003 > >> +#define OV5647_REG_CHIPID_H 0x300A > >> +#define OV5647_REG_CHIPID_L 0x300B > >> + > >> +#define REG_TERM 0xfffe > >> +#define VAL_TERM 0xfe > >> +#define REG_DLY 0x > >> + > >> +#define OV5647_ROW_START 0x01 > >> +#define OV5647_ROW_START_MIN 0 > >> +#define OV5647_ROW_START_MAX 2004 > >> +#define OV5647_ROW_START_DEF 54 > >> + > >> +#define OV5647_COLUMN_START 0x02 > >> +#define OV5647_COLUMN_START_MIN 0 > >> +#define OV5647_COLUMN_START_MAX 2750 > >> +#define
Re: [PATCH v5 2/2] Add support for OV5647 sensor
Hi Sakari On 12/7/2016 11:01 PM, Sakari Ailus wrote: > Hi Ramiro, > > On Mon, Dec 05, 2016 at 05:36:34PM +, Ramiro Oliveira wrote: >> Add support for OV5647 sensor. >> >> Modes supported: >> - 640x480 RAW 8 >> >> Signed-off-by: Ramiro Oliveira>> --- >> MAINTAINERS| 7 + >> drivers/media/i2c/Kconfig | 12 + >> drivers/media/i2c/Makefile | 1 + >> drivers/media/i2c/ov5647.c | 866 >> + >> 4 files changed, 886 insertions(+) >> create mode 100644 drivers/media/i2c/ov5647.c >> >> diff --git a/MAINTAINERS b/MAINTAINERS >> index 52cc077..72e828a 100644 >> --- a/MAINTAINERS >> +++ b/MAINTAINERS >> @@ -8923,6 +8923,13 @@ M:Harald Welte >> S: Maintained >> F: drivers/char/pcmcia/cm4040_cs.* >> >> +OMNIVISION OV5647 SENSOR DRIVER >> +M: Ramiro Oliveira >> +L: linux-media@vger.kernel.org >> +T: git git://linuxtv.org/media_tree.git >> +S: Maintained >> +F: drivers/media/i2c/ov5647.c >> + >> OMNIVISION OV7670 SENSOR DRIVER >> M: Jonathan Corbet >> L: linux-media@vger.kernel.org >> diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig >> index b31fa6f..c1b78e5 100644 >> --- a/drivers/media/i2c/Kconfig >> +++ b/drivers/media/i2c/Kconfig >> @@ -531,6 +531,18 @@ config VIDEO_OV2659 >>To compile this driver as a module, choose M here: the >>module will be called ov2659. >> >> +config VIDEO_OV5647 >> +tristate "OmniVision OV5647 sensor support" >> +depends on OF > > How does this driver depend on OF, other than matching the compatible > string? > It doesn't, should I proceed diferently? >> +depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API >> +depends on MEDIA_CAMERA_SUPPORT >> +---help--- >> + This is a Video4Linux2 sensor-level driver for the OmniVision >> + OV5647 camera. >> + >> + To compile this driver as a module, choose M here: the >> + module will be called ov5647. >> + >> config VIDEO_OV7640 >> tristate "OmniVision OV7640 sensor support" >> depends on I2C && VIDEO_V4L2 >> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile >> index 92773b2..0d9014c 100644 >> --- a/drivers/media/i2c/Makefile >> +++ b/drivers/media/i2c/Makefile >> @@ -82,3 +82,4 @@ obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o >> obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o >> obj-$(CONFIG_VIDEO_OV2659) += ov2659.o >> obj-$(CONFIG_VIDEO_TC358743)+= tc358743.o >> +obj-$(CONFIG_VIDEO_OV5647) += ov5647.o >> diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c >> new file mode 100644 >> index 000..2aae806 >> --- /dev/null >> +++ b/drivers/media/i2c/ov5647.c >> @@ -0,0 +1,866 @@ >> +/* >> + * A V4L2 driver for OmniVision OV5647 cameras. >> + * >> + * Based on Samsung S5K6AAFX SXGA 1/6" 1.3M CMOS Image Sensor driver >> + * Copyright (C) 2011 Sylwester Nawrocki >> + * >> + * Based on Omnivision OV7670 Camera Driver >> + * Copyright (C) 2006-7 Jonathan Corbet >> + * >> + * Copyright (C) 2016, Synopsys, Inc. >> + * >> + * This program is free software; you can redistribute it and/or >> + * modify it under the terms of the GNU General Public License as >> + * published by the Free Software Foundation version 2. >> + * >> + * This program is distributed .as is. WITHOUT ANY WARRANTY of any >> + * kind, whether express or implied; 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 > > Alphabetical order, please. > >> + >> +#define SENSOR_NAME "ov5647" >> + >> +#define OV5647_SW_RESET 0x1003 >> +#define OV5647_REG_CHIPID_H 0x300A >> +#define OV5647_REG_CHIPID_L 0x300B >> + >> +#define REG_TERM 0xfffe >> +#define VAL_TERM 0xfe >> +#define REG_DLY 0x >> + >> +#define OV5647_ROW_START0x01 >> +#define OV5647_ROW_START_MIN0 >> +#define OV5647_ROW_START_MAX2004 >> +#define OV5647_ROW_START_DEF54 >> + >> +#define OV5647_COLUMN_START 0x02 >> +#define OV5647_COLUMN_START_MIN 0 >> +#define OV5647_COLUMN_START_MAX 2750 >> +#define OV5647_COLUMN_START_DEF 16 >> + >> +#define OV5647_WINDOW_HEIGHT0x03 >> +#define OV5647_WINDOW_HEIGHT_MIN2 >> +#define OV5647_WINDOW_HEIGHT_MAX2006 >> +#define OV5647_WINDOW_HEIGHT_DEF1944 >> + >> +#define OV5647_WINDOW_WIDTH 0x04 >> +#define OV5647_WINDOW_WIDTH_MIN 2 >> +#define OV5647_WINDOW_WIDTH_MAX 2752 >> +#define OV5647_WINDOW_WIDTH_DEF 2592 >> + >> +struct regval_list { >> +u16 addr; >> +u8 data; >>
Re: [PATCH v5 2/2] Add support for OV5647 sensor
Hi Ramiro, On Mon, Dec 05, 2016 at 05:36:34PM +, Ramiro Oliveira wrote: > Add support for OV5647 sensor. > > Modes supported: > - 640x480 RAW 8 > > Signed-off-by: Ramiro Oliveira> --- > MAINTAINERS| 7 + > drivers/media/i2c/Kconfig | 12 + > drivers/media/i2c/Makefile | 1 + > drivers/media/i2c/ov5647.c | 866 > + > 4 files changed, 886 insertions(+) > create mode 100644 drivers/media/i2c/ov5647.c > > diff --git a/MAINTAINERS b/MAINTAINERS > index 52cc077..72e828a 100644 > --- a/MAINTAINERS > +++ b/MAINTAINERS > @@ -8923,6 +8923,13 @@ M: Harald Welte > S: Maintained > F: drivers/char/pcmcia/cm4040_cs.* > > +OMNIVISION OV5647 SENSOR DRIVER > +M: Ramiro Oliveira > +L: linux-media@vger.kernel.org > +T: git git://linuxtv.org/media_tree.git > +S: Maintained > +F: drivers/media/i2c/ov5647.c > + > OMNIVISION OV7670 SENSOR DRIVER > M: Jonathan Corbet > L: linux-media@vger.kernel.org > diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig > index b31fa6f..c1b78e5 100644 > --- a/drivers/media/i2c/Kconfig > +++ b/drivers/media/i2c/Kconfig > @@ -531,6 +531,18 @@ config VIDEO_OV2659 > To compile this driver as a module, choose M here: the > module will be called ov2659. > > +config VIDEO_OV5647 > + tristate "OmniVision OV5647 sensor support" > + depends on OF How does this driver depend on OF, other than matching the compatible string? > + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API > + depends on MEDIA_CAMERA_SUPPORT > + ---help--- > + This is a Video4Linux2 sensor-level driver for the OmniVision > + OV5647 camera. > + > + To compile this driver as a module, choose M here: the > + module will be called ov5647. > + > config VIDEO_OV7640 > tristate "OmniVision OV7640 sensor support" > depends on I2C && VIDEO_V4L2 > diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile > index 92773b2..0d9014c 100644 > --- a/drivers/media/i2c/Makefile > +++ b/drivers/media/i2c/Makefile > @@ -82,3 +82,4 @@ obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o > obj-$(CONFIG_VIDEO_ML86V7667)+= ml86v7667.o > obj-$(CONFIG_VIDEO_OV2659) += ov2659.o > obj-$(CONFIG_VIDEO_TC358743) += tc358743.o > +obj-$(CONFIG_VIDEO_OV5647) += ov5647.o > diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c > new file mode 100644 > index 000..2aae806 > --- /dev/null > +++ b/drivers/media/i2c/ov5647.c > @@ -0,0 +1,866 @@ > +/* > + * A V4L2 driver for OmniVision OV5647 cameras. > + * > + * Based on Samsung S5K6AAFX SXGA 1/6" 1.3M CMOS Image Sensor driver > + * Copyright (C) 2011 Sylwester Nawrocki > + * > + * Based on Omnivision OV7670 Camera Driver > + * Copyright (C) 2006-7 Jonathan Corbet > + * > + * Copyright (C) 2016, Synopsys, Inc. > + * > + * This program is free software; you can redistribute it and/or > + * modify it under the terms of the GNU General Public License as > + * published by the Free Software Foundation version 2. > + * > + * This program is distributed .as is. WITHOUT ANY WARRANTY of any > + * kind, whether express or implied; 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 Alphabetical order, please. > + > +#define SENSOR_NAME "ov5647" > + > +#define OV5647_SW_RESET 0x1003 > +#define OV5647_REG_CHIPID_H 0x300A > +#define OV5647_REG_CHIPID_L 0x300B > + > +#define REG_TERM 0xfffe > +#define VAL_TERM 0xfe > +#define REG_DLY 0x > + > +#define OV5647_ROW_START 0x01 > +#define OV5647_ROW_START_MIN 0 > +#define OV5647_ROW_START_MAX 2004 > +#define OV5647_ROW_START_DEF 54 > + > +#define OV5647_COLUMN_START 0x02 > +#define OV5647_COLUMN_START_MIN 0 > +#define OV5647_COLUMN_START_MAX 2750 > +#define OV5647_COLUMN_START_DEF 16 > + > +#define OV5647_WINDOW_HEIGHT 0x03 > +#define OV5647_WINDOW_HEIGHT_MIN 2 > +#define OV5647_WINDOW_HEIGHT_MAX 2006 > +#define OV5647_WINDOW_HEIGHT_DEF 1944 > + > +#define OV5647_WINDOW_WIDTH 0x04 > +#define OV5647_WINDOW_WIDTH_MIN 2 > +#define OV5647_WINDOW_WIDTH_MAX 2752 > +#define OV5647_WINDOW_WIDTH_DEF 2592 > + > +struct regval_list { > + u16 addr; > + u8 data; > +}; > + > +struct cfg_array { > + struct regval_list *regs; > + int size; > +}; > + > +struct sensor_win_size { > + int width; > + int height; > + unsigned int hoffset; > + unsigned int voffset; > + unsigned int hts;
[PATCH v5 2/2] Add support for OV5647 sensor
Add support for OV5647 sensor. Modes supported: - 640x480 RAW 8 Signed-off-by: Ramiro Oliveira--- MAINTAINERS| 7 + drivers/media/i2c/Kconfig | 12 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/ov5647.c | 866 + 4 files changed, 886 insertions(+) create mode 100644 drivers/media/i2c/ov5647.c diff --git a/MAINTAINERS b/MAINTAINERS index 52cc077..72e828a 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -8923,6 +8923,13 @@ M: Harald Welte S: Maintained F: drivers/char/pcmcia/cm4040_cs.* +OMNIVISION OV5647 SENSOR DRIVER +M: Ramiro Oliveira +L: linux-media@vger.kernel.org +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: drivers/media/i2c/ov5647.c + OMNIVISION OV7670 SENSOR DRIVER M: Jonathan Corbet L: linux-media@vger.kernel.org diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig index b31fa6f..c1b78e5 100644 --- a/drivers/media/i2c/Kconfig +++ b/drivers/media/i2c/Kconfig @@ -531,6 +531,18 @@ config VIDEO_OV2659 To compile this driver as a module, choose M here: the module will be called ov2659. +config VIDEO_OV5647 + tristate "OmniVision OV5647 sensor support" + depends on OF + depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API + depends on MEDIA_CAMERA_SUPPORT + ---help--- + This is a Video4Linux2 sensor-level driver for the OmniVision + OV5647 camera. + + To compile this driver as a module, choose M here: the + module will be called ov5647. + config VIDEO_OV7640 tristate "OmniVision OV7640 sensor support" depends on I2C && VIDEO_V4L2 diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile index 92773b2..0d9014c 100644 --- a/drivers/media/i2c/Makefile +++ b/drivers/media/i2c/Makefile @@ -82,3 +82,4 @@ obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o obj-$(CONFIG_VIDEO_ML86V7667) += ml86v7667.o obj-$(CONFIG_VIDEO_OV2659) += ov2659.o obj-$(CONFIG_VIDEO_TC358743) += tc358743.o +obj-$(CONFIG_VIDEO_OV5647) += ov5647.o diff --git a/drivers/media/i2c/ov5647.c b/drivers/media/i2c/ov5647.c new file mode 100644 index 000..2aae806 --- /dev/null +++ b/drivers/media/i2c/ov5647.c @@ -0,0 +1,866 @@ +/* + * A V4L2 driver for OmniVision OV5647 cameras. + * + * Based on Samsung S5K6AAFX SXGA 1/6" 1.3M CMOS Image Sensor driver + * Copyright (C) 2011 Sylwester Nawrocki + * + * Based on Omnivision OV7670 Camera Driver + * Copyright (C) 2006-7 Jonathan Corbet + * + * Copyright (C) 2016, Synopsys, Inc. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation version 2. + * + * This program is distributed .as is. WITHOUT ANY WARRANTY of any + * kind, whether express or implied; 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 SENSOR_NAME "ov5647" + +#define OV5647_SW_RESET0x1003 +#define OV5647_REG_CHIPID_H0x300A +#define OV5647_REG_CHIPID_L0x300B + +#define REG_TERM 0xfffe +#define VAL_TERM 0xfe +#define REG_DLY 0x + +#define OV5647_ROW_START 0x01 +#define OV5647_ROW_START_MIN 0 +#define OV5647_ROW_START_MAX 2004 +#define OV5647_ROW_START_DEF 54 + +#define OV5647_COLUMN_START0x02 +#define OV5647_COLUMN_START_MIN0 +#define OV5647_COLUMN_START_MAX2750 +#define OV5647_COLUMN_START_DEF16 + +#define OV5647_WINDOW_HEIGHT 0x03 +#define OV5647_WINDOW_HEIGHT_MIN 2 +#define OV5647_WINDOW_HEIGHT_MAX 2006 +#define OV5647_WINDOW_HEIGHT_DEF 1944 + +#define OV5647_WINDOW_WIDTH0x04 +#define OV5647_WINDOW_WIDTH_MIN2 +#define OV5647_WINDOW_WIDTH_MAX2752 +#define OV5647_WINDOW_WIDTH_DEF2592 + +struct regval_list { + u16 addr; + u8 data; +}; + +struct cfg_array { + struct regval_list *regs; + int size; +}; + +struct sensor_win_size { + int width; + int height; + unsigned int hoffset; + unsigned int voffset; + unsigned int hts; + unsigned int vts; + unsigned int pclk; + unsigned int mipi_bps; + unsigned int fps_fixed; + unsigned int bin_factor; + unsigned int intg_min; + unsigned int intg_max; + void *regs; + int regs_size; + int (*set_size)(struct v4l2_subdev *sd); +}; + + +struct ov5647 { + struct device *dev; +