Skip to contentSkip to conversation

media: add imx319 camera sensor driver

PATCH Superseded [email protected] 3 participants 3 messages May 31, 2018 – Jun 27, 2018

Subsystems (3)

v4 of 7 Superseded Latest is v7 →

lore
Share & tools
lore
#0 lore raw

PATCH v4 1/1 media: add imx319 camera sensor driver

From: Bingbu Cao <[email protected]>

Add a v4l2 sub-device driver for the Sony imx319 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
- 4 test patterns control support
- vflip/hflip control support (will impact the output bayer order)
- support following resolutions:
- 3264x2448, 3280x2464 @ 30fps
- 1936x1096, 1920x1080 @ 60fps
- 1640x1232, 1640x922, 1296x736, 1280x720 @ 120fps
- support 4 bayer orders output (via change v/hflip)
- SRGGB10(default), SGRBG10, SGBRG10, SBGGR10

---

This patch is based on sakari's media-tree git:
https://git.linuxtv.org/sailus/media_tree.git/log/?h=for-4.18-5

Changes since v1:
- fix some coding style issues - line breaks
- add v4l2_ctrl_grab() to prevent v/hflip change
during streaming
- add v4l2 ctrl event (un)subscribe support
- add more info into commit message

---

---
 MAINTAINERS                |    7 +
 drivers/media/i2c/Kconfig  |   11 +
 drivers/media/i2c/Makefile |    1 +
 drivers/media/i2c/imx319.c | 2433 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 2452 insertions(+)
 create mode 100644 drivers/media/i2c/imx319.c
MAINTAINERS +7 -0
index ea362219c4aa..0af3addc99ef 100644
@@ -13085,6 +13085,13 @@ S:	Maintained
 F:	drivers/media/i2c/imx274.c
 F:	Documentation/devicetree/bindings/media/i2c/imx274.txt
 
+SONY IMX319 SENSOR DRIVER
+M:	Bingbu Cao <[email protected]>
+L:	[email protected]
+T:	git git://linuxtv.org/media_tree.git
+S:	Maintained
+F:	drivers/media/i2c/imx319.c
+
 SONY MEMORYSTICK CARD SUPPORT
 M:	Alex Dubov <[email protected]>
 W:	http://tifmxx.berlios.de/
drivers/media/i2c/Kconfig +11 -0
index 341452fe98df..cd7cab10a941 100644
@@ -594,6 +594,17 @@ config VIDEO_IMX274
 	  This is a V4L2 sensor-level driver for the Sony IMX274
 	  CMOS image sensor.
 
+config VIDEO_IMX319
+	tristate "Sony IMX319 sensor support"
+	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	depends on MEDIA_CAMERA_SUPPORT
+	help
+	  This is a Video4Linux2 sensor driver for the Sony
+	  IMX319 camera.
+
+	  To compile this driver as a module, choose M here: the
+	  module will be called imx319.
+
 config VIDEO_OV2640
 	tristate "OmniVision OV2640 sensor support"
 	depends on VIDEO_V4L2 && I2C
drivers/media/i2c/Makefile +1 -0
index d679d57cd3b3..acbf6da95db0 100644
@@ -103,5 +103,6 @@ obj-$(CONFIG_VIDEO_OV2659)	+= ov2659.o
 obj-$(CONFIG_VIDEO_TC358743)	+= tc358743.o
 obj-$(CONFIG_VIDEO_IMX258)	+= imx258.o
 obj-$(CONFIG_VIDEO_IMX274)	+= imx274.o
+obj-$(CONFIG_VIDEO_IMX319)	+= imx319.o
 
 obj-$(CONFIG_SDR_MAX2175) += max2175.o
drivers/media/i2c/imx319.c new file +2433 -0

2,433 lines not on this page · raw message

Signature · 1 line
1.9.1
maintainer
#1 lore raw

Hi Bingbu,

Quoted 18 lines · On Thu, May 31, 2018 at 06:19:24PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

Add a v4l2 sub-device driver for the Sony imx319 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
- 4 test patterns control support
- vflip/hflip control support (will impact the output bayer order)
- support following resolutions:
- 3264x2448, 3280x2464 @ 30fps
- 1936x1096, 1920x1080 @ 60fps
- 1640x1232, 1640x922, 1296x736, 1280x720 @ 120fps
- support 4 bayer orders output (via change v/hflip)
- SRGGB10(default), SGRBG10, SGBRG10, SBGGR10

Quoted 2 lines

Could you obtain the CSI-2 bus speed as well as the external clock frequency from the firmware? See e.g. drivers/media/i2c/smiapp/smiapp-core.c and v4l2_fwnode_endpoint_alloc_parse() there. You could use the clock-frequency property for the clock.

...

drivers/media/i2c/imx319.c line 2317

Quoted 4 lines
drivers/media/i2c/imx319.c new file +4 -0
+static void imx319_free_controls(struct imx319 *imx319)
+{
+	v4l2_ctrl_handler_free(imx319->sd.ctrl_handler);
+}

Please use v4l2_ctrl_handler_free() directly instead, and remove this function.

Both apply to the imx355 driver as well.

Signature · 4 lines
Kind regards,

Sakari Ailus
[email protected]
#2 lore raw
Quoted 21 lines · Sakari Ailus

Hi Bingbu,

Quoted 18 lines · On Thu, May 31, 2018 at 06:19:24PM +0800, [email protected] wrote:

From: Bingbu Cao <[email protected]>

Add a v4l2 sub-device driver for the Sony imx319 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
- 4 test patterns control support
- vflip/hflip control support (will impact the output bayer order)
- support following resolutions:
- 3264x2448, 3280x2464 @ 30fps
- 1936x1096, 1920x1080 @ 60fps
- 1640x1232, 1640x922, 1296x736, 1280x720 @ 120fps
- support 4 bayer orders output (via change v/hflip)
- SRGGB10(default), SGRBG10, SGBRG10, SBGGR10

Quoted 7 lines
Quoted 2 lines

Could you obtain the CSI-2 bus speed as well as the external clock frequency from the firmware? See e.g. drivers/media/i2c/smiapp/smiapp-core.c and v4l2_fwnode_endpoint_alloc_parse() there. You could use the clock-frequency property for the clock.

Ack.

Quoted 10 lines

...

drivers/media/i2c/imx319.c line 2317

Quoted 4 lines
drivers/media/i2c/imx319.c new file +4 -0
+static void imx319_free_controls(struct imx319 *imx319)
+{
+	v4l2_ctrl_handler_free(imx319->sd.ctrl_handler);
+}

Please use v4l2_ctrl_handler_free() directly instead, and remove this function.

Both apply to the imx355 driver as well.

Ack.

Quoted 1 line