media/i2c: Add a driver for the Sony IMX708 image sensor

The imx708 is a 12MP MIPI sensor with a 16:9 aspect ratio, here using
two CSI-2 lanes. It is a "quad Bayer" sensor with all 3 modes offering
10-bit output:

12MP: 4608x2592 up to 14.35fps (full FoV)
1080p: 2304x1296 up to 56.02fps (full FoV)
720p: 1536x864 up to 120.12fps (cropped)

This imx708 sensor driver is based heavily on the imx477 driver and
has been tested on the Raspberry Pi platform using libcamera.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>
Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>

drivers: media: imx708: Enable long exposure mode

Enable long exposure modes by using the long exposure shift register setting
in the imx708 sensor.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

drivers: media: i2c: imx708: Fix crop information

The 1536x864 mode contained incorrect crop information.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>

drivers: media: i2c: imx708: Fix WIDE_DYNAMIC_RANGE control with long exposure

Setting V4L2_CID_WIDE_DYNAMIC_RANGE was causing the long exposure
shift count to be reset, which is incorrect if the user has already
changed the frame length to cause it to have a non-zero value.

Because it only updates control ranges and doesn't set any registers,
the control can also be applied when the sensor is not powered on.

Signed-off-by: David Plowman <david.plowman@raspberrypi.com>

drivers: media: imx708: Increase usable link frequencies

Add support for three different usable link frequencies (default 450Mhz,
447Mhz, and 453MHz) for the IMX708 camera sensor. The choice of
frequency is handled thorugh the "link-frequency" overlay parameter.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

drivers: media: imx708: Remove unused control fields

Remove unused and redundant control fields from the state structure.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

drivers: media: imx708: Tidy-ups to address upstream review comments

This commit addresses vaious tidy-ups requesed for upstreaming the
IMX708 driver. Notably:

- Remove #define IMX708_NUM_SUPPLIES and use ARRAY_SIZE() directly
- Use dev_err_probe where possible in imx708_probe()
- Fix error handling paths in imx708_probe()

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

drivers: media: imx708: Follow the standard devicetree labels

Switch the system clock name from "xclk" to "inclk".
Use lower case lables for all regulator names.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

drives: media: imx708: Put HFLIP and VFLIP controls in a cluster

Create a cluster for the HVLIP and VFLIP controls so they are treated
as a single composite control.

Signed-off-by: Naushir Patuck <naush@raspberrypi.com>

drivers: media: imx708: Adjust broken line correction parameter

In full-resolution mode, the LPF_INTENSITY_EN and LPF_INTENSITY
registers control Quad Bayer Re-mosaic broken line correction.
Expose this as a module parameter "qbc_adjust": zero disables
the correction and values in the range 2 to 5 set its strength.

There is a trade-off between coloured and monochrome patterns.
The previous fixed value 4 could produce ladder/spots artefacts
in coloured textures. The new default value 2 may suit a wider
range of scenes.

Signed-off-by: Nick Hollinghurst <nick.hollinghurst@raspberrypi.com>

media: i2c: imx708: Squash fixes
This commit is contained in:
Nick Hollinghurst
2022-12-22 13:59:33 +00:00
committed by Dom Cobley
parent 85e4949a08
commit 398f851aa6
3 changed files with 2130 additions and 0 deletions

View File

@@ -297,6 +297,19 @@ config VIDEO_IMX519
To compile this driver as a module, choose M here: the
module will be called IMX519.
config VIDEO_IMX708
tristate "Sony IMX708 sensor support"
depends on I2C && VIDEO_DEV
select MEDIA_CONTROLLER
select VIDEO_V4L2_SUBDEV_API
select V4L2_FWNODE
help
This is a Video4Linux2 sensor driver for the Sony
IMX708 camera.
To compile this driver as a module, choose M here: the
module will be called imx708.
config VIDEO_MAX9271_LIB
tristate

View File

@@ -64,6 +64,7 @@ obj-$(CONFIG_VIDEO_IMX412) += imx412.o
obj-$(CONFIG_VIDEO_IMX415) += imx415.o
obj-$(CONFIG_VIDEO_IMX477) += imx477.o
obj-$(CONFIG_VIDEO_IMX519) += imx519.o
obj-$(CONFIG_VIDEO_IMX708) += imx708.o
obj-$(CONFIG_VIDEO_IR_I2C) += ir-kbd-i2c.o
obj-$(CONFIG_VIDEO_IRS1125) += irs1125.o
obj-$(CONFIG_VIDEO_ISL7998X) += isl7998x.o

2116
drivers/media/i2c/imx708.c Normal file

File diff suppressed because it is too large Load Diff