media: add imx355 camera sensor driver
PATCH v3 1/1 media: add imx355 camera sensor driver
From: Bingbu Cao <[email protected]>
Add a v4l2 sub-device driver for the Sony imx355 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:
- 3268x2448, 3264x2448, 3280x2464 @ 30fps
- 1940x1096, 1936x1096, 1924x1080, 1920x1080 @ 60fps
- 1640x1232, 1640x922, 1300x736, 1296x736, 1284x720, 1280x720 820x616 @ 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.20-8
changes since v2:
- get CSI-2 link frequencies and external clock
from firmware
- select digital gain mode when streaming
changes v1 -> v2:
- 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
- correct link frequency
- add more info into commit message
---
Conflicts:
MAINTAINERS
drivers/media/i2c/Kconfig
drivers/media/i2c/Makefile
--- MAINTAINERS | 7 + drivers/media/i2c/Kconfig | 11 + drivers/media/i2c/Makefile | 1 + drivers/media/i2c/imx355.c | 1856 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 1875 insertions(+) create mode 100644 drivers/media/i2c/imx355.c
MAINTAINERS +7 -0
@@ -13543,6 +13543,13 @@ T: git git://linuxtv.org/media_tree.git S: Maintained F: drivers/media/i2c/imx319.c +SONY IMX355 SENSOR DRIVER +M: Tianshu Qiu <[email protected]> +L: [email protected] +T: git git://linuxtv.org/media_tree.git +S: Maintained +F: drivers/media/i2c/imx355.c + SONY MEMORYSTICK CARD SUPPORT M: Alex Dubov <[email protected]> W: http://tifmxx.berlios.de/
drivers/media/i2c/Kconfig +11 -0
@@ -625,6 +625,17 @@ config VIDEO_IMX319 To compile this driver as a module, choose M here: the module will be called imx319. +config VIDEO_IMX355 + tristate "Sony IMX355 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 + IMX355 camera. + + To compile this driver as a module, choose M here: the + module will be called imx355. + config VIDEO_OV2640 tristate "OmniVision OV2640 sensor support" depends on VIDEO_V4L2 && I2C
drivers/media/i2c/Makefile +1 -0
@@ -109,5 +109,6 @@ 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_VIDEO_IMX355) += imx355.o obj-$(CONFIG_SDR_MAX2175) += max2175.o
drivers/media/i2c/imx355.c new file +1856 -0
1,856 lines not on this page · raw message
Signature · 1 line
1.9.1
Sakari Ailus
maintainerHi Bingbu,
Quoted 35 lines · On Sat, Sep 29, 2018 at 06:03:54PM +0800, [email protected] wrote:
From: Bingbu Cao <[email protected]>
Add a v4l2 sub-device driver for the Sony imx355 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:
- 3268x2448, 3264x2448, 3280x2464 @ 30fps
- 1940x1096, 1936x1096, 1924x1080, 1920x1080 @ 60fps
- 1640x1232, 1640x922, 1300x736, 1296x736, 1284x720, 1280x720 820x616 @ 120fps
- support 4 bayer orders output (via change v/hflip)
- SRGGB10(default), SGRBG10, SGBRG10, SBGGR10Cc Tomasz Figa <[email protected]>Cc Sakari Ailus <[email protected]>Signed-off-by Tianshu Qiu <[email protected]>Signed-off-by Bingbu Cao <[email protected]>---
This patch is based on sakari's media-tree git:
https://git.linuxtv.org/sailus/media_tree.git/log/?h=for-4.20-8changes since v2:
- get CSI-2 link frequencies and external clock
from firmware
- select digital gain mode when streaming
Quoted 7 lines
changes v1 -> v2:
- fix some coding style issues - line breaks
- addv4l2_ctrl_grab()to prevent v/hflip change
during streaming
- add v4l2 ctrl event (un)subscribe support
- correct link frequency
- add more info into commit message
Thanks for the update.
I've applied the patch with the following diff, to make it work on systems without 64-bit division:
drivers/media/i2c/imx355.c +4 -2
@@ -1360,7 +1360,8 @@ imx355_set_pad_format(struct v4l2_subdev *sd, *framefmt = fmt->format; }else { imx355->cur_mode = mode; - pixel_rate = (imx355->link_def_freq *2 *4 ) /10 ; + pixel_rate = imx355->link_def_freq *2 *4 ; +do_div (pixel_rate,10 );__v4l2_ctrl_s_ctrl_int64 (imx355->pixel_rate, pixel_rate);/* Update limits and set FPS to default */ height = imx355->cur_mode->height;
@@ -1587,7 +1588,8 @@ static int imx355_init_controls(struct imx355 *imx355) imx355->link_freq->flags |=V4L2_CTRL_FLAG_READ_ONLY ;/* pixel_rate = link_freq * 2 * nr_of_lanes / bits_per_sample */ - pixel_rate = (imx355->link_def_freq *2 *4 ) /10 ; + pixel_rate = imx355->link_def_freq *2 *4 ; +do_div (pixel_rate,10 );/* By default, PIXEL_RATE is read only */ imx355->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &imx355_ctrl_ops, V4L2_CID_PIXEL_RATE, pixel_rate,
Signature · 4 lines
Kind regards, Sakari Ailus [email protected]