Skip to contentSkip to conversation

hi556: Add support for Hi-556 sensor

PATCH Superseded Shawnx Tu 3 participants 3 messages Oct 30, 2019 – Nov 14, 2019

Subsystems (3)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore

Shawnx Tu

author
#0 lore raw

PATCH v2 1/1 hi556: Add support for Hi-556 sensor

From: Shawn Tu <[email protected]>

Add a V4L2 sub-device driver for Hynix Hi-556 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
- test pattern support
- media controller support
- runtime PM support
- support following resolutions:
+ 2592x1944 at 30FPS
+ 1296x972 at 30FPS

---
 MAINTAINERS                |    7 +
 drivers/media/i2c/Kconfig  |   13 +
 drivers/media/i2c/Makefile |    1 +
 drivers/media/i2c/hi556.c  | 1194 ++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 1215 insertions(+)
 create mode 100644 drivers/media/i2c/hi556.c
MAINTAINERS +7 -0
index 8077b45..84f29c0 100644
@@ -7554,6 +7554,13 @@ L:	[email protected]
 S:	Maintained
 F:	arch/x86/kernel/cpu/hygon.c
 
+HYNIX HI556 SENSOR DRIVER
+M:	Shawn Tu <[email protected]>
+L:	[email protected]
+T:	git git://linuxtv.org/media_tree.git
+S:	Maintained
+F:	drivers/media/i2c/hi556.c
+
 Hyper-V CORE AND DRIVERS
 M:	"K. Y. Srinivasan" <[email protected]>
 M:	Haiyang Zhang <[email protected]>
drivers/media/i2c/Kconfig +13 -0
index 992f608..f38dbd5 100644
@@ -568,6 +568,19 @@ config VIDEO_SMIAPP_PLL
 
 if MEDIA_CAMERA_SUPPORT
 
+config VIDEO_HI556
+	tristate "Hynix Hi-556 sensor support"
+	depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
+	depends on MEDIA_CAMERA_SUPPORT
+	depends on MEDIA_CONTROLLER
+	select V4L2_FWNODE
+	help
+	  This is a Video4Linux2 sensor driver for the Hynix
+	  Hi-556 camera.
+
+	To compile this driver as a module, choose M here: the
+	module will be called hi556.
+
 config VIDEO_IMX214
 	tristate "Sony IMX214 sensor support"
 	depends on GPIOLIB && I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
drivers/media/i2c/Makefile +1 -0
index 6a80a35..c147bb9 100644
@@ -109,6 +109,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_HI556)	+= hi556.o
 obj-$(CONFIG_VIDEO_IMX214)	+= imx214.o
 obj-$(CONFIG_VIDEO_IMX258)	+= imx258.o
 obj-$(CONFIG_VIDEO_IMX274)	+= imx274.o
drivers/media/i2c/hi556.c new file +1194 -0

1,194 lines not on this page · raw message

Signature · 1 line
2.7.4
maintainer
#1 lore raw

Hi Shawn,

On Wed, Oct 30, 2019 at 05:05:06PM +0800, Shawnx Tu wrote:

...

drivers/media/i2c/hi556.c line 67

Quoted 2 lines
drivers/media/i2c/hi556.c new file +2 -0
+enum {
+	HI556_LINK_FREQ_874MBPS,

Did you see my comments on v1 on the naming?

...

drivers/media/i2c/hi556.c line 430

Quoted 5 lines
drivers/media/i2c/hi556.c new file +5 -0
+static const char * const hi556_test_pattern_menu[] = {
+	"Disabled",
+	"Solid Colour",
+	"100% Colour Bars",
+	"Fade To Grey’ Colour Bars",

"'" is extra.

...

drivers/media/i2c/hi556.c line 970

Quoted 7 lines
drivers/media/i2c/hi556.c new file +7 -0
+static int hi556_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
+{
+	struct hi556 *hi556 = to_hi556(sd);
+
+	mutex_lock(&hi556->mutex);
+	hi556_update_pad_format(&supported_modes[0],
+				 v4l2_subdev_get_try_format(sd, fh->pad, 0));

The function assigns the given driver specific format to the mbus format struct. How about calling it e.g. hi556_assign_pad_format() instead?

Also see my comments on v1 to this.

Signature · 3 lines
Regards,

Sakari Ailus
#2 lore raw
In reply to Shawnx Tu
I love your patch! Yet something to improve:

Hi Shawnx,

I love your patch! Yet something to improve:

[auto build test ERROR on linuxtv-media/master]
[cannot apply to v5.4-rc7 next-20191113]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Shawnx-Tu/hi556-Add-support-for-Hi-556-sensor/20191101-185241
base:   git://linuxtv.org/media_tree.git master
config: riscv-allnoconfig
compiler: riscv64-linux-gcc (GCC) 7.4.0

reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
GCC_VERSION=7.4.0 make.cross ARCH=riscv allnoconfig
GCC_VERSION=7.4.0 make.cross ARCH=riscv

If you fix the issue, kindly add following tag

All errors (new ones prefixed by >>):

>> drivers/media/i2c/Kconfig:582: syntax error
   drivers/media/i2c/Kconfig:581:warning: ignoring unsupported character ','
   drivers/media/i2c/Kconfig:581:warning: ignoring unsupported character ':'
>> drivers/media/i2c/Kconfig:581: unknown statement "To"
   drivers/media/i2c/Kconfig:582:warning: ignoring unsupported character '.'
>> drivers/media/i2c/Kconfig:582: unknown statement "module"

make[2]: *** [allnoconfig] Error 1
make[1]: *** [allnoconfig] Error 2
make: *** [sub-make] Error 2
1 real 0 user 0 sys 47.75% cpu make allnoconfig
--

>> drivers/media/i2c/Kconfig:582: syntax error
   drivers/media/i2c/Kconfig:581:warning: ignoring unsupported character ','
   drivers/media/i2c/Kconfig:581:warning: ignoring unsupported character ':'
>> drivers/media/i2c/Kconfig:581: unknown statement "To"
   drivers/media/i2c/Kconfig:582:warning: ignoring unsupported character '.'
>> drivers/media/i2c/Kconfig:582: unknown statement "module"

make[2]: *** [oldconfig] Error 1
make[1]: *** [oldconfig] Error 2
make: *** [sub-make] Error 2
1 real 0 user 0 sys 52.28% cpu make oldconfig
--

>> drivers/media/i2c/Kconfig:582: syntax error
   drivers/media/i2c/Kconfig:581:warning: ignoring unsupported character ','
   drivers/media/i2c/Kconfig:581:warning: ignoring unsupported character ':'
>> drivers/media/i2c/Kconfig:581: unknown statement "To"
   drivers/media/i2c/Kconfig:582:warning: ignoring unsupported character '.'
>> drivers/media/i2c/Kconfig:582: unknown statement "module"

make[2]: *** [olddefconfig] Error 1
make[1]: *** [olddefconfig] Error 2
make: *** [sub-make] Error 2
1 real 0 user 0 sys 48.55% cpu make olddefconfig

vim +582 drivers/media/i2c/Kconfig

570
571 config VIDEO_HI556
572 tristate "Hynix Hi-556 sensor support"
573 depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API
574 depends on MEDIA_CAMERA_SUPPORT
575 depends on MEDIA_CONTROLLER
576 select V4L2_FWNODE
577 help
578 This is a Video4Linux2 sensor driver for the Hynix
579 Hi-556 camera.
580

 > 581		To compile this driver as a module, choose M here: the
 > 582		module will be called hi556.

583

---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org Intel Corporation