Skip to contentSkip to conversation

media: imx208: Add imx208 camera sensor driver

PATCH RESEND Superseded Ping-chung Chen 3 participants 4 messages Aug 3, 2018

Subsystems (3)

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH RESEND v4 1/1 media: imx208: Add imx208 camera sensor driver

From: "Chen, Ping-chung" <[email protected]>

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

---
since v1:
-- Update the function media_entity_pads_init for upstreaming. -- Change the structure name mutex as imx208_mx.
-- Refine the control flow of test pattern function.
-- vflip/hflip control support (will impact the output bayer order) -- support 4 bayer orders output (via change v/hflip)
- SRGGB10(default), SGRBG10, SGBRG10, SBGGR10
-- Simplify error handling in the set_stream function. since v2:
-- Refine coding style.
-- Fix the if statement to use pm_runtime_get_if_in_use(). -- Print more error log during error handling.
-- Remove mutex_destroy() from imx208_free_controls(). -- Add more comments.
since v3:
-- Set explicit indices to link frequencies.

 MAINTAINERS                |   7 +
 drivers/media/i2c/Kconfig  |  11 +
 drivers/media/i2c/Makefile |   1 +
 drivers/media/i2c/imx208.c | 995 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1014 insertions(+)
 create mode 100644 drivers/media/i2c/imx208.c
MAINTAINERS +7 -0
index bbd9b9b..896c1df 100644
@@ -13268,6 +13268,13 @@ S:	Maintained
 F:	drivers/ssb/
 F:	include/linux/ssb/
 
+SONY IMX208 SENSOR DRIVER
+M:	Sakari Ailus <[email protected]>
+L:	[email protected]
+T:	git git://linuxtv.org/media_tree.git
+S:	Maintained
+F:	drivers/media/i2c/imx208.c
+
 SONY IMX258 SENSOR DRIVER
 M:	Sakari Ailus <[email protected]>
 L:	[email protected]
drivers/media/i2c/Kconfig +11 -0
index 8669853..ae11f1e 100644
@@ -595,6 +595,17 @@ config VIDEO_APTINA_PLL
 config VIDEO_SMIAPP_PLL
 	tristate
 
+config VIDEO_IMX208
+	tristate "Sony IMX208 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
+	  IMX208 camera.
+
+          To compile this driver as a module, choose M here: the
+          module will be called imx208.
+
 config VIDEO_IMX258
 	tristate "Sony IMX258 sensor support"
 	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
drivers/media/i2c/Makefile +1 -0
index 837c428..47604c2 100644
@@ -104,6 +104,7 @@ obj-$(CONFIG_VIDEO_I2C)		+= video-i2c.o
 obj-$(CONFIG_VIDEO_ML86V7667)	+= ml86v7667.o
 obj-$(CONFIG_VIDEO_OV2659)	+= ov2659.o
 obj-$(CONFIG_VIDEO_TC358743)	+= tc358743.o
+obj-$(CONFIG_VIDEO_IMX208)	+= imx208.o
 obj-$(CONFIG_VIDEO_IMX258)	+= imx258.o
 obj-$(CONFIG_VIDEO_IMX274)	+= imx274.o
 
drivers/media/i2c/imx208.c new file +995 -0

995 lines not on this page · raw message

Signature · 1 line
1.9.1
Reviewed-by on v4 1/1
#1 lore raw
Quoted 26 lines · Ping-chung Chen

From: "Chen, Ping-chung" <[email protected]>

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

---
since v1:
-- Update the function media_entity_pads_init for upstreaming. -- Change the structure name mutex as imx208_mx.
-- Refine the control flow of test pattern function.
-- vflip/hflip control support (will impact the output bayer order) -- support 4 bayer orders output (via change v/hflip)
- SRGGB10(default), SGRBG10, SGBRG10, SBGGR10
-- Simplify error handling in the set_stream function. since v2:
-- Refine coding style.
-- Fix the if statement to use pm_runtime_get_if_in_use(). -- Print more error log during error handling.
-- Remove mutex_destroy() from imx208_free_controls(). -- Add more comments.
since v3:
-- Set explicit indices to link frequencies.

[snip]

drivers/media/i2c/imx208.c line 218

Quoted 4 lines
drivers/media/i2c/imx208.c new file +4 -0
+/* Menu items for LINK_FREQ V4L2 control */
+static const s64 link_freq_menu_items[] = {
+       [IMX208_LINK_FREQ_384MHZ_INDEX] = IMX208_LINK_FREQ_384MHZ,
+       [IMX208_LINK_FREQ_384MHZ_INDEX] = IMX208_LINK_FREQ_96MHZ,

IMX208_LINK_FREQ_96MHZ_INDEX?

With this fixed (and if there are no other changes), feel free to add

Best regards,
Tomasz

#2 lore raw

Hi Tomasz,

Quoted 27 lines · Ping-chung Chen

From: "Chen, Ping-chung" <[email protected]>

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

---
since v1:
-- Update the function media_entity_pads_init for upstreaming. -- Change the structure name mutex as imx208_mx.
-- Refine the control flow of test pattern function.
-- vflip/hflip control support (will impact the output bayer order) -- support 4 bayer orders output (via change v/hflip)
- SRGGB10(default), SGRBG10, SGBRG10, SBGGR10
-- Simplify error handling in the set_stream function. since v2:
-- Refine coding style.
-- Fix the if statement to use pm_runtime_get_if_in_use(). -- Print more error log during error handling.
-- Remove mutex_destroy() from imx208_free_controls(). -- Add more comments.
since v3:
-- Set explicit indices to link frequencies.

[snip]

Quoted 6 lines
drivers/media/i2c/imx208.c new file +4 -0
+/* Menu items for LINK_FREQ V4L2 control */ static const s64 
+link_freq_menu_items[] = {
+       [IMX208_LINK_FREQ_384MHZ_INDEX] = IMX208_LINK_FREQ_384MHZ,
+       [IMX208_LINK_FREQ_384MHZ_INDEX] = IMX208_LINK_FREQ_96MHZ,

IMX208_LINK_FREQ_96MHZ_INDEX?

Oh... It's my mistake. Fixed.

Quoted 3 lines

With this fixed (and if there are no other changes), feel free to add

Sure.

Quoted 2 lines

Best regards,
Tomasz

maintainer
#3 lore raw
In reply to Ping-chung Chen

Hi Ping-chung,

Quoted 16 lines · Ping-chung Chen

From: "Chen, Ping-chung" <[email protected]>

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

---
since v1:
-- Update the function media_entity_pads_init for upstreaming. -- Change the structure name mutex as imx208_mx.
-- Refine the control flow of test pattern function.
-- vflip/hflip control support (will impact the output bayer order) -- support 4 bayer orders output (via change v/hflip)
- SRGGB10(default), SGRBG10, SGBRG10, SBGGR10
-- Simplify error handling in the set_stream function.

Quoted 8 lines

since v2:
-- Refine coding style.
-- Fix the if statement to use pm_runtime_get_if_in_use(). -- Print more error log during error handling.
-- Remove mutex_destroy() from imx208_free_controls(). -- Add more comments.
since v3:
-- Set explicit indices to link frequencies.

Could you add support for obtaining the link frequencies from firmware, please?

Signature · 4 lines
Kind regards,

Sakari Ailus
[email protected]