staging: atomisp: add a driver for ov5648 camera sensor
Subsystems (4)
PATCH v4 1/1 staging: atomisp: add a driver for ov5648 camera sensor
The ov5648 5-megapixel camera sensor from OmniVision supports up to 2592x1944 resolution and MIPI CSI-2 interface. Output format is raw sRGB/Bayer with 10 bits per colour (SGRBG10_1X10).
This patch is a port of ov5648 driver after applying following 01org/ProductionKernelQuilts patches:
- 0004-ov2680-ov5648-Fork-lift-source-from-CTS.patch
- 0005-ov2680-ov5648-gminification.patch
- 0006-ov5648-Focus-support.patch
- 0007-Fix-resolution-issues-on-rear-camera.patch
- 0008-ov2680-ov5648-Enabled-the-set_exposure-functions.patch
- 0010-IRDA-cameras-mode-list-cleanup-unification.patch
- 0012-ov5648-Add-1296x972-binned-mode.patch
- 0014-ov5648-Adapt-to-Atomisp2-Gmin-VCM-framework.patch
- 0015-dw9714-Gmin-Atomisp-specific-VCM-driver.patch
- 0017-ov5648-Fix-deadlock-on-I2C-error.patch
- 0018-gc2155-Fix-deadlock-on-error.patch
- 0019-ov5648-Add-1280x960-binned-mode.patch
- 0020-ov5648-Make-1280x960-as-default-video-resolution.patch
- 0021-MALATA-Fix-testCameraToSurfaceTextureMetadata-CTS.patch
- 0023-OV5648-Added-5MP-video-resolution.patch
New changes introduced during the port:
- Rename entity types to entity functions
- Replace v4l2_subdev_fh by v4l2_subdev_pad_config
- Make use of media_bus_format enum
- Rename media_entity_init function to media_entity_pads_init
- Replace try_mbus_fmt by set_fmt
- Replace s_mbus_fmt by set_fmt
- Replace g_mbus_fmt by get_fmt
- Use s_ctrl/g_volatile_ctrl instead of ctrl core ops
- Update gmin platform API path
- Constify acpi_device_id
- Add "INT5648" value to acpi_device_id
- Fix some checkpatch errors and warnings
- Remove FSF's mailing address from the sample GPL notice
"INT5648" ACPI device id can be found in following production hardware:
BIOS Information
Vendor: LENOVO
Version: 1HCN40WW
Release Date: 11/04/2016
...
BIOS Revision: 0.40
Firmware Revision: 0.0
...
System Information
Manufacturer: LENOVO
Product Name: 80SG
Version: MIIX 310-10ICR
...
SKU Number: LENOVO_MT_80SG_BU_idea_FM_MIIX 310-10ICR
Family: IDEAPAD
...Device DSDT excerpt:
Device (CA00)
{
Name (_ADR, Zero) // _ADR: Address
Name (_HID, "INT5648") // _HID: Hardware ID
Name (_CID, "INT5648") // _CID: Compatible ID
Name (_SUB, "INTL0000") // _SUB: Subsystem ID
Name (_DDN, "ov5648") // _DDN: DOS Device Name
...I was not able to properly test this patch on my Lenovo Miix 310 due to other issues with atomisp, the output is the same as ov2680 driver (OVTI2680) which is very similar to ov5648. As reported by dmesg, atomisp-gmin-platform fails to load CamClk, ClkSrc, CsiPort, CsiLanes variables from ACPI (although they are set as showed by DSDT) and it fails to get regulators. My Miix 310 uses AXP PMIC (INT33F4:00) which, as far as I can understand by looking at 01org/ProductionKernelQuilts code, it's yet not supported by mainline kernel.
---
Changes in v2:
- Fix indentation
- Add atomisp prefix to Kconfig option
Changes in v3:
- Use module_i2c_driver() macro
- Switch i2c drivers to use ->probe_new()
- Remove unused ->gpio_ctrl() callback
- Remove unused ->power_ctrl() callback
- Remove unneeded header inclusions
- Sort header inclusions alphabetically
- Replace kzalloc with devm_kzalloc
- Remove "XXOV5648" acpi_device_id, we don't know if it's used in any production device
- Use reverse XMAS tree declarations
- Fix comments style
- Remove __func__ from all dev_{dbg,info,err}() calls
- Add missing new line chars in all dev_{dbg,info,err}() calls
- Remove useless dev_{dbg,err}() calls
- Fix all checkpatch.pl issues
Changes in v4:
- Provide more details in the commit message
drivers/staging/media/atomisp/i2c/Kconfig | 12 + drivers/staging/media/atomisp/i2c/Makefile | 1 + drivers/staging/media/atomisp/i2c/atomisp-ov5648.c | 1787 ++++++++++++++++++++++++++++ drivers/staging/media/atomisp/i2c/ov5648.h | 828 +++++++++++++ 4 files changed, 2628 insertions(+) create mode 100644 drivers/staging/media/atomisp/i2c/atomisp-ov5648.c create mode 100644 drivers/staging/media/atomisp/i2c/ov5648.h
drivers/staging/media/atomisp/i2c/Kconfig +12 -0
@@ -83,6 +83,18 @@ config VIDEO_ATOMISP_OV2680 It currently only works with the atomisp driver. +config VIDEO_ATOMISP_OV5648 + tristate "Omnivision OV5648 sensor support" + depends on ACPI + depends on I2C && VIDEO_V4L2 + ---help--- + This is a Video4Linux2 sensor-level driver for the Omnivision + OV5648 raw camera. + + ov5648 is a 5M raw sensor. + + It currently only works with the atomisp driver. + # # Kconfig for flash drivers #
drivers/staging/media/atomisp/i2c/Makefile +1 -0
@@ -8,6 +8,7 @@ obj-$(CONFIG_VIDEO_ATOMISP_MT9M114) += atomisp-mt9m114.o obj-$(CONFIG_VIDEO_ATOMISP_GC2235) += atomisp-gc2235.o obj-$(CONFIG_VIDEO_ATOMISP_OV2722) += atomisp-ov2722.o obj-$(CONFIG_VIDEO_ATOMISP_OV2680) += atomisp-ov2680.o +obj-$(CONFIG_VIDEO_ATOMISP_OV5648) += atomisp-ov5648.o obj-$(CONFIG_VIDEO_ATOMISP_GC0310) += atomisp-gc0310.o obj-$(CONFIG_VIDEO_ATOMISP_MSRLIST_HELPER) += atomisp-libmsrlisthelper.o
drivers/staging/media/atomisp/i2c/atomisp-ov5648.c new file +1787 -0
1,787 lines not on this page · raw message
drivers/staging/media/atomisp/i2c/ov5648.h new file +828 -0
828 lines not on this page · raw message
Signature · 1 line
2.7.4
Sakari Ailus
reviewerHi Devid,
Quoted 7 lines · Devid Antonio Filoni
I was not able to properly test this patch on my Lenovo Miix 310 due to other issues with atomisp, the output is the same as ov2680 driver (OVTI2680) which is very similar to ov5648. As reported by dmesg, atomisp-gmin-platform fails to load CamClk, ClkSrc, CsiPort, CsiLanes variables from ACPI (although they are set as showed by DSDT) and it fails to get regulators. My Miix 310 uses AXP PMIC (INT33F4:00) which, as far as I can understand by looking at 01org/ProductionKernelQuilts code, it's yet not supported by mainline kernel.
Hmm. In other words this driver isn't usable due to lack of other drivers. Even if they'd be in place, this hasn't been tested. What would be the likelihood of it functioning in the end?
Would it make sense to first get the other drivers to upstream and then see what's the status of atomisp? The atomisp driver has a number of entries in its TODO file, one of which is making the sensor drivers to use the standard kernel interfaces to work with the main driver (atomisp), so that they could be used with any ISP / bridge driver.
Also, the interface the atomisp uses with the sensor drivers as well as how the board specific information from firmware is conveyed to the sensor drivers will change to what the rest of the sensor drivers are using. I think a most straightforward way would be to amend the ACPI tables to include the necessary information.
Therefore, applying this patch would not have an effective improvement to the users in form of support for new systems and would make the upcoming interface changes more difficult as there would be one more driver to change (and test).
For this reason I'm tempted to postpone applying this patch at least until the other drivers are available.
Andy, Alan; any opinion?
Signature · 4 lines
Kind regards, Sakari Ailus [email protected]
Quoted 2 lines
Would it make sense to first get the other drivers to upstream and then see what's the status of atomisp?
Agreed
Quoted 4 lines
the board specific information from firmware is conveyed to the sensor drivers will change to what the rest of the sensor drivers are using. I think a most straightforward way would be to amend the ACPI tables to include the necessary information.
I don't see that happening. The firmware they have today is the firmware they will always have, and for any new devices we manage to get going is probably going to end up entirely hardcoded.
Quoted 2 lines
For this reason I'm tempted to postpone applying this patch at least until the other drivers are available.
Yes - unless someone has a different controller and that sensor on a board so can test it that way ?
Alan
Sakari Ailus
reviewerHi Alan,
Quoted 5 lines · Alan Cox
Quoted 2 lines
Would it make sense to first get the other drivers to upstream and then see what's the status of atomisp?
Agreed
Quoted 8 lines
Quoted 4 lines
the board specific information from firmware is conveyed to the sensor drivers will change to what the rest of the sensor drivers are using. I think a most straightforward way would be to amend the ACPI tables to include the necessary information.
I don't see that happening. The firmware they have today is the firmware they will always have, and for any new devices we manage to get going is probably going to end up entirely hardcoded.
You'd need to pass the table use initrd to amend the existing tables.
Another option would be to parse the information from ACPI / EFI variables or whatever to set things up in the atomisp driver, and rely on e.g. I²C matching in the V4L2 async framework.
The board specific information needed by the sensor drivers need to be somehow conveyed to the drivers. Perhaps using pset / device_add_property()?
This is not trivial and would require at least either V4L2 framework or sensor driver changes to support atomisp, which currently is a staging driver.
Signature · 2 lines
Sakari Ailus [email protected]