[git:media_tree/master] media: hi556: Add support for Hi-556 sensor

2019-11-09 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: hi556: Add support for Hi-556 sensor
Author:  Shawn Tu 
Date:Fri Nov 1 07:44:31 2019 -0300

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

[sakari.ai...@linux.intel.com: Remove MEDIA_CAMERA_SUPPORT from Kconfig 
dependencies]

Signed-off-by: Shawn Tu 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 

 MAINTAINERS|7 +
 drivers/media/i2c/Kconfig  |   12 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/hi556.c  | 1200 
 4 files changed, 1220 insertions(+)

---

diff --git a/MAINTAINERS b/MAINTAINERS
index 4e3300162ade..ea0dcc0b9763 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7554,6 +7554,13 @@ L:   linux-ker...@vger.kernel.org
 S: Maintained
 F: arch/x86/kernel/cpu/hygon.c
 
+HYNIX HI556 SENSOR DRIVER
+M: Shawn Tu 
+L: linux-me...@vger.kernel.org
+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" 
 M: Haiyang Zhang 
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 992f60825ccd..c68e002d26ea 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -568,6 +568,18 @@ 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_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
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 6a80a353393f..c147bb9d28db 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -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
diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c
new file mode 100644
index ..c66cd1446c0f
--- /dev/null
+++ b/drivers/media/i2c/hi556.c
@@ -0,0 +1,1200 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2019 Intel Corporation.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define HI556_REG_VALUE_08BIT  1
+#define HI556_REG_VALUE_16BIT  2
+#define HI556_REG_VALUE_24BIT  3
+
+#define HI556_LINK_FREQ_437MHZ 43700ULL
+#define HI556_MCLK 1920
+#define HI556_DATA_LANES   2
+#define HI556_RGB_DEPTH10
+
+#define HI556_REG_CHIP_ID  0x0f16
+#define HI556_CHIP_ID  0x0556
+
+#define HI556_REG_MODE_SELECT  0x0a00
+#define HI556_MODE_STANDBY 0x
+#define HI556_MODE_STREAMING   0x0100
+
+/* vertical-timings from sensor */
+#define HI556_REG_FLL  0x0006
+#define HI556_FLL_30FPS0x0814
+#define HI556_FLL_30FPS_MIN0x0814
+#define HI556_FLL_MAX  0x7fff
+
+/* horizontal-timings from sensor */
+#define HI556_REG_LLP  0x0008
+
+/* Exposure controls from sensor */
+#define HI556_REG_EXPOSURE 0x0074
+#define HI556_EXPOSURE_MIN 6
+#define HI556_EXPOSURE_MAX_MARGIN  2
+#define HI556_EXPOSURE_STEP1
+
+/* Analog gain controls from sensor */
+#define HI556_REG_ANALOG_GAIN  0x0077
+#define HI556_ANAL_GAIN_MIN0
+#define HI556_ANAL_GAIN_MAX240
+#define HI556_ANAL_GAIN_STEP   1
+
+/* Digital gain controls from sensor */
+#define HI556_REG_MWB_GR_GAIN  0x0078
+#define HI556_REG_MWB_GB_GAIN  0x007a
+#define HI556_REG_MWB_R_GAIN   0x007c
+#define HI556_REG_MWB_B_GAIN   0x007e
+#define HI556_DGTL_GAIN_MIN0
+#define HI556_DGTL_GAIN_MAX2048
+#define HI556_DGTL_GAIN_STEP   1
+#define HI556_DGTL_GAIN_DEFAULT256
+
+/* Test Pattern Control 

[git:media_tree/master] media: hi556: Add support for Hi-556 sensor

2019-11-05 Thread Mauro Carvalho Chehab
This is an automatic generated email to let you know that the following patch 
were queued:

Subject: media: hi556: Add support for Hi-556 sensor
Author:  Shawn Tu 
Date:Fri Nov 1 07:44:31 2019 -0300

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

[sakari.ai...@linux.intel.com: Remove MEDIA_CAMERA_SUPPORT from Kconfig 
dependencies]

Signed-off-by: Shawn Tu 
Signed-off-by: Sakari Ailus 
Signed-off-by: Mauro Carvalho Chehab 

 MAINTAINERS|7 +
 drivers/media/i2c/Kconfig  |   12 +
 drivers/media/i2c/Makefile |1 +
 drivers/media/i2c/hi556.c  | 1200 
 4 files changed, 1220 insertions(+)

---

diff --git a/MAINTAINERS b/MAINTAINERS
index 4e3300162ade..ea0dcc0b9763 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -7554,6 +7554,13 @@ L:   linux-ker...@vger.kernel.org
 S: Maintained
 F: arch/x86/kernel/cpu/hygon.c
 
+HYNIX HI556 SENSOR DRIVER
+M: Shawn Tu 
+L: linux-me...@vger.kernel.org
+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" 
 M: Haiyang Zhang 
diff --git a/drivers/media/i2c/Kconfig b/drivers/media/i2c/Kconfig
index 992f60825ccd..c68e002d26ea 100644
--- a/drivers/media/i2c/Kconfig
+++ b/drivers/media/i2c/Kconfig
@@ -568,6 +568,18 @@ 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_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
diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
index 6a80a353393f..c147bb9d28db 100644
--- a/drivers/media/i2c/Makefile
+++ b/drivers/media/i2c/Makefile
@@ -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
diff --git a/drivers/media/i2c/hi556.c b/drivers/media/i2c/hi556.c
new file mode 100644
index ..c66cd1446c0f
--- /dev/null
+++ b/drivers/media/i2c/hi556.c
@@ -0,0 +1,1200 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2019 Intel Corporation.
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define HI556_REG_VALUE_08BIT  1
+#define HI556_REG_VALUE_16BIT  2
+#define HI556_REG_VALUE_24BIT  3
+
+#define HI556_LINK_FREQ_437MHZ 43700ULL
+#define HI556_MCLK 1920
+#define HI556_DATA_LANES   2
+#define HI556_RGB_DEPTH10
+
+#define HI556_REG_CHIP_ID  0x0f16
+#define HI556_CHIP_ID  0x0556
+
+#define HI556_REG_MODE_SELECT  0x0a00
+#define HI556_MODE_STANDBY 0x
+#define HI556_MODE_STREAMING   0x0100
+
+/* vertical-timings from sensor */
+#define HI556_REG_FLL  0x0006
+#define HI556_FLL_30FPS0x0814
+#define HI556_FLL_30FPS_MIN0x0814
+#define HI556_FLL_MAX  0x7fff
+
+/* horizontal-timings from sensor */
+#define HI556_REG_LLP  0x0008
+
+/* Exposure controls from sensor */
+#define HI556_REG_EXPOSURE 0x0074
+#define HI556_EXPOSURE_MIN 6
+#define HI556_EXPOSURE_MAX_MARGIN  2
+#define HI556_EXPOSURE_STEP1
+
+/* Analog gain controls from sensor */
+#define HI556_REG_ANALOG_GAIN  0x0077
+#define HI556_ANAL_GAIN_MIN0
+#define HI556_ANAL_GAIN_MAX240
+#define HI556_ANAL_GAIN_STEP   1
+
+/* Digital gain controls from sensor */
+#define HI556_REG_MWB_GR_GAIN  0x0078
+#define HI556_REG_MWB_GB_GAIN  0x007a
+#define HI556_REG_MWB_R_GAIN   0x007c
+#define HI556_REG_MWB_B_GAIN   0x007e
+#define HI556_DGTL_GAIN_MIN0
+#define HI556_DGTL_GAIN_MAX2048
+#define HI556_DGTL_GAIN_STEP   1
+#define HI556_DGTL_GAIN_DEFAULT256
+
+/* Test Pattern Control