Skip to contentSkip to conversation

ov5675: Add support for OV5675 sensor

PATCH Superseded Shawnx Tu 2 participants 2 messages Jul 31, 2019 – Aug 7, 2019

Subsystems (3)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Shawnx Tu

author
#0 lore raw

PATCH 1/1 ov5675: Add support for OV5675 sensor

From: Shawn Tu <[email protected]>

Add a V4L2 sub-device driver for Omnivision ov5675 image sensor. This is a camera sensor using the I2C bus for control and the CSI-2 bus for data.

This driver supports following features:
- manual exposure and analog/digital gain control support
- vblank/hblank control support
- test pattern support
- media controller support
- runtime PM support
- support following resolutions:
+ 2592x1944 at 30FPS
+ 1296x972 at 30FPS

---
 MAINTAINERS                |    7 +
 drivers/media/i2c/Kconfig  |   13 +
 drivers/media/i2c/Makefile |    1 +
 drivers/media/i2c/ov5675.c | 1175 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1196 insertions(+)
 create mode 100644 drivers/media/i2c/ov5675.c
MAINTAINERS +7 -0
index 6426db5..1e4692d 100644
@@ -11845,6 +11845,13 @@ T:	git git://linuxtv.org/media_tree.git
 S:	Maintained
 F:	drivers/media/i2c/ov5647.c
 
+OMNIVISION OV5675 SENSOR DRIVER
+M:	Shawn Tu <[email protected]>
+L:	[email protected]
+T:	git git://linuxtv.org/media_tree.git
+S:	Maintained
+F:	drivers/media/i2c/ov5675.c
+
 OMNIVISION OV5695 SENSOR DRIVER
 M:	Shunqian Zheng <[email protected]>
 L:	[email protected]
drivers/media/i2c/Kconfig +13 -0
index 79ce9ec..7d5aba9 100644
@@ -723,6 +723,19 @@ config VIDEO_OV5670
 	  To compile this driver as a module, choose M here: the
 	  module will be called ov5670.
 
+config VIDEO_OV5675
+	tristate "OmniVision OV5675 sensor support"
+	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	depends on MEDIA_CAMERA_SUPPORT
+	depends on MEDIA_CONTROLLER
+	select V4L2_FWNODE
+	help
+	  This is a Video4Linux2 sensor driver for the OmniVision
+	  OV5675 camera.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called ov5675.
+
 config VIDEO_OV5695
 	tristate "OmniVision OV5695 sensor support"
 	depends on I2C && VIDEO_V4L2
drivers/media/i2c/Makefile +1 -0
index fd4ea86..beb170b 100644
@@ -70,6 +70,7 @@ obj-$(CONFIG_VIDEO_OV5640) += ov5640.o
 obj-$(CONFIG_VIDEO_OV5645) += ov5645.o
 obj-$(CONFIG_VIDEO_OV5647) += ov5647.o
 obj-$(CONFIG_VIDEO_OV5670) += ov5670.o
+obj-$(CONFIG_VIDEO_OV5675) += ov5675.o
 obj-$(CONFIG_VIDEO_OV5695) += ov5695.o
 obj-$(CONFIG_VIDEO_OV6650) += ov6650.o
 obj-$(CONFIG_VIDEO_OV7251) += ov7251.o
drivers/media/i2c/ov5675.c new file +1175 -0

1,175 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#1 lore raw

Hi Shawn,

Thanks for the patch. A few comments below.

On Wed, Jul 31, 2019 at 06:53:36PM +0800, Shawnx Tu wrote:

...

Quoted 5 lines
drivers/media/i2c/ov5675.c new file +5 -0
+static int ov5675_check_hwcfg(struct device *dev)
+{
+	struct fwnode_handle *ep;
+	struct fwnode_handle *fwnode = dev_fwnode(dev);
+	struct v4l2_fwnode_endpoint bus_cfg = {

drivers/media/i2c/ov5675.c line 1016

Quoted 10 lines
drivers/media/i2c/ov5675.c new file +10 -0
+		.bus_type = V4L2_MBUS_CSI2_DPHY
+	};
+	u32 mclk;
+	int ret;
+	unsigned int i, j;
+
+	if (!fwnode)
+		return -ENXIO;
+
+	fwnode_property_read_u32(fwnode, "clock-frequency", &mclk);

Please check reading the property succeeded. Otherwise mclk will be uninitialised.

Apart from that, this seems good.

Signature · 4 lines
Kind regards,

Sakari Ailus
[email protected]