All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers
@ 2018-11-12 16:00 Akinobu Mita
  2018-11-12 16:00 ` [PATCH 1/7] media: mt9m111: support log_status ioctl and event interface Akinobu Mita
                   ` (7 more replies)
  0 siblings, 8 replies; 12+ messages in thread
From: Akinobu Mita @ 2018-11-12 16:00 UTC (permalink / raw)
  To: linux-media
  Cc: Akinobu Mita, Steve Longerbeam, Jonathan Corbet, Jacopo Mondi,
	Sakari Ailus, Mauro Carvalho Chehab

This patchset addds relatively small enhancements (log_status ioctl, event
interface, V4L2_CID_TEST_PATTERN control, and V4L2_CID_COLORFX control) for
mt9m111, ov2640, ov5640, ov7670, and ov772x drivers.  I have these devices
so these patches are tested with real devices.

Akinobu Mita (7):
  media: mt9m111: support log_status ioctl and event interface
  media: mt9m111: add V4L2_CID_COLORFX control
  media: ov2640: add V4L2_CID_TEST_PATTERN control
  media: ov2640: support log_status ioctl and event interface
  media: ov5640: support log_status ioctl and event interface
  media: ov7670: support log_status ioctl and event interface
  media: ov772x: support log_status ioctl and event interface

 drivers/media/i2c/mt9m111.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
 drivers/media/i2c/ov2640.c  | 21 +++++++++++++++++++--
 drivers/media/i2c/ov5640.c  |  7 ++++++-
 drivers/media/i2c/ov7670.c  |  6 +++++-
 drivers/media/i2c/ov772x.c  |  7 ++++++-
 5 files changed, 78 insertions(+), 7 deletions(-)

Cc: Steve Longerbeam <slongerbeam@gmail.com>
Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Jacopo Mondi <jacopo@jmondi.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
-- 
2.7.4

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH 1/7] media: mt9m111: support log_status ioctl and event interface
  2018-11-12 16:00 [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers Akinobu Mita
@ 2018-11-12 16:00 ` Akinobu Mita
  2018-11-12 16:00 ` [PATCH 2/7] media: mt9m111: add V4L2_CID_COLORFX control Akinobu Mita
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Akinobu Mita @ 2018-11-12 16:00 UTC (permalink / raw)
  To: linux-media; +Cc: Akinobu Mita, Sakari Ailus, Mauro Carvalho Chehab

This adds log_status ioctl and event interface for mt9m111's v4l2 controls.

Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/mt9m111.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
index 1395986..f4fc459 100644
--- a/drivers/media/i2c/mt9m111.c
+++ b/drivers/media/i2c/mt9m111.c
@@ -21,6 +21,7 @@
 #include <media/v4l2-common.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
 
 /*
  * MT9M111, MT9M112 and MT9M131:
@@ -862,6 +863,9 @@ static const struct v4l2_ctrl_ops mt9m111_ctrl_ops = {
 
 static const struct v4l2_subdev_core_ops mt9m111_subdev_core_ops = {
 	.s_power	= mt9m111_s_power,
+	.log_status = v4l2_ctrl_subdev_log_status,
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 	.g_register	= mt9m111_g_register,
 	.s_register	= mt9m111_s_register,
@@ -976,7 +980,8 @@ static int mt9m111_probe(struct i2c_client *client,
 	mt9m111->ctx = &context_b;
 
 	v4l2_i2c_subdev_init(&mt9m111->subdev, client, &mt9m111_subdev_ops);
-	mt9m111->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	mt9m111->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+				 V4L2_SUBDEV_FL_HAS_EVENTS;
 
 	v4l2_ctrl_handler_init(&mt9m111->hdl, 5);
 	v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops,
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 2/7] media: mt9m111: add V4L2_CID_COLORFX control
  2018-11-12 16:00 [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers Akinobu Mita
  2018-11-12 16:00 ` [PATCH 1/7] media: mt9m111: support log_status ioctl and event interface Akinobu Mita
@ 2018-11-12 16:00 ` Akinobu Mita
  2018-11-12 16:00 ` [PATCH 3/7] media: ov2640: add V4L2_CID_TEST_PATTERN control Akinobu Mita
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Akinobu Mita @ 2018-11-12 16:00 UTC (permalink / raw)
  To: linux-media; +Cc: Akinobu Mita, Sakari Ailus, Mauro Carvalho Chehab

The mt9m111 has special camera effects feature.  This makes use of
it through V4L2_CID_COLORFX control.

Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/mt9m111.c | 37 ++++++++++++++++++++++++++++++++++++-
 1 file changed, 36 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/mt9m111.c b/drivers/media/i2c/mt9m111.c
index f4fc459..58d134d 100644
--- a/drivers/media/i2c/mt9m111.c
+++ b/drivers/media/i2c/mt9m111.c
@@ -102,6 +102,7 @@
 #define MT9M111_REDUCER_XSIZE_A		0x1a7
 #define MT9M111_REDUCER_YZOOM_A		0x1a9
 #define MT9M111_REDUCER_YSIZE_A		0x1aa
+#define MT9M111_EFFECTS_MODE		0x1e2
 
 #define MT9M111_OUTPUT_FORMAT_CTRL2_A	0x13a
 #define MT9M111_OUTPUT_FORMAT_CTRL2_B	0x19b
@@ -127,6 +128,7 @@
 #define MT9M111_OUTFMT_SWAP_YCbCr_C_Y_RGB_EVEN	(1 << 1)
 #define MT9M111_OUTFMT_SWAP_YCbCr_Cb_Cr_RGB_R_B	(1 << 0)
 #define MT9M111_TPG_SEL_MASK		GENMASK(2, 0)
+#define MT9M111_EFFECTS_MODE_MASK	GENMASK(2, 0)
 
 /*
  * Camera control register addresses (0x200..0x2ff not implemented)
@@ -727,6 +729,29 @@ static int mt9m111_set_test_pattern(struct mt9m111 *mt9m111, int val)
 				MT9M111_TPG_SEL_MASK);
 }
 
+static int mt9m111_set_colorfx(struct mt9m111 *mt9m111, int val)
+{
+	struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev);
+	static const struct v4l2_control colorfx[] = {
+		{ V4L2_COLORFX_NONE,		0 },
+		{ V4L2_COLORFX_BW,		1 },
+		{ V4L2_COLORFX_SEPIA,		2 },
+		{ V4L2_COLORFX_NEGATIVE,	3 },
+		{ V4L2_COLORFX_SOLARIZATION,	4 },
+	};
+	int i;
+
+	for (i = 0; i < ARRAY_SIZE(colorfx); i++) {
+		if (colorfx[i].id == val) {
+			return mt9m111_reg_mask(client, MT9M111_EFFECTS_MODE,
+						colorfx[i].value,
+						MT9M111_EFFECTS_MODE_MASK);
+		}
+	}
+
+	return -EINVAL;
+}
+
 static int mt9m111_s_ctrl(struct v4l2_ctrl *ctrl)
 {
 	struct mt9m111 *mt9m111 = container_of(ctrl->handler,
@@ -747,6 +772,8 @@ static int mt9m111_s_ctrl(struct v4l2_ctrl *ctrl)
 		return mt9m111_set_autowhitebalance(mt9m111, ctrl->val);
 	case V4L2_CID_TEST_PATTERN:
 		return mt9m111_set_test_pattern(mt9m111, ctrl->val);
+	case V4L2_CID_COLORFX:
+		return mt9m111_set_colorfx(mt9m111, ctrl->val);
 	}
 
 	return -EINVAL;
@@ -983,7 +1010,7 @@ static int mt9m111_probe(struct i2c_client *client,
 	mt9m111->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
 				 V4L2_SUBDEV_FL_HAS_EVENTS;
 
-	v4l2_ctrl_handler_init(&mt9m111->hdl, 5);
+	v4l2_ctrl_handler_init(&mt9m111->hdl, 7);
 	v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops,
 			V4L2_CID_VFLIP, 0, 1, 1, 0);
 	v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops,
@@ -999,6 +1026,14 @@ static int mt9m111_probe(struct i2c_client *client,
 			&mt9m111_ctrl_ops, V4L2_CID_TEST_PATTERN,
 			ARRAY_SIZE(mt9m111_test_pattern_menu) - 1, 0, 0,
 			mt9m111_test_pattern_menu);
+	v4l2_ctrl_new_std_menu(&mt9m111->hdl, &mt9m111_ctrl_ops,
+			V4L2_CID_COLORFX, V4L2_COLORFX_SOLARIZATION,
+			~(BIT(V4L2_COLORFX_NONE) |
+				BIT(V4L2_COLORFX_BW) |
+				BIT(V4L2_COLORFX_SEPIA) |
+				BIT(V4L2_COLORFX_NEGATIVE) |
+				BIT(V4L2_COLORFX_SOLARIZATION)),
+			V4L2_COLORFX_NONE);
 	mt9m111->subdev.ctrl_handler = &mt9m111->hdl;
 	if (mt9m111->hdl.error) {
 		ret = mt9m111->hdl.error;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 3/7] media: ov2640: add V4L2_CID_TEST_PATTERN control
  2018-11-12 16:00 [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers Akinobu Mita
  2018-11-12 16:00 ` [PATCH 1/7] media: mt9m111: support log_status ioctl and event interface Akinobu Mita
  2018-11-12 16:00 ` [PATCH 2/7] media: mt9m111: add V4L2_CID_COLORFX control Akinobu Mita
@ 2018-11-12 16:00 ` Akinobu Mita
  2018-11-13 10:36   ` Sakari Ailus
  2018-11-12 16:00 ` [PATCH 4/7] media: ov2640: support log_status ioctl and event interface Akinobu Mita
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 12+ messages in thread
From: Akinobu Mita @ 2018-11-12 16:00 UTC (permalink / raw)
  To: linux-media; +Cc: Akinobu Mita, Sakari Ailus, Mauro Carvalho Chehab

The ov2640 has the test pattern generator features.  This makes use of
it through V4L2_CID_TEST_PATTERN control.

Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/ov2640.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index 20a8853..4992d77 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -705,6 +705,11 @@ static int ov2640_reset(struct i2c_client *client)
 	return ret;
 }
 
+static const char * const ov2640_test_pattern_menu[] = {
+	"Disabled",
+	"Color bar",
+};
+
 /*
  * functions
  */
@@ -740,6 +745,9 @@ static int ov2640_s_ctrl(struct v4l2_ctrl *ctrl)
 	case V4L2_CID_HFLIP:
 		val = ctrl->val ? REG04_HFLIP_IMG : 0x00;
 		return ov2640_mask_set(client, REG04, REG04_HFLIP_IMG, val);
+	case V4L2_CID_TEST_PATTERN:
+		val = ctrl->val ? COM7_COLOR_BAR_TEST : 0x00;
+		return ov2640_mask_set(client, COM7, COM7_COLOR_BAR_TEST, val);
 	}
 
 	return -EINVAL;
@@ -1184,12 +1192,16 @@ static int ov2640_probe(struct i2c_client *client,
 	v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
 	priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
 	mutex_init(&priv->lock);
-	v4l2_ctrl_handler_init(&priv->hdl, 2);
+	v4l2_ctrl_handler_init(&priv->hdl, 3);
 	priv->hdl.lock = &priv->lock;
 	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
 			V4L2_CID_VFLIP, 0, 1, 1, 0);
 	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
 			V4L2_CID_HFLIP, 0, 1, 1, 0);
+	v4l2_ctrl_new_std_menu_items(&priv->hdl, &ov2640_ctrl_ops,
+			V4L2_CID_TEST_PATTERN,
+			ARRAY_SIZE(ov2640_test_pattern_menu) - 1, 0, 0,
+			ov2640_test_pattern_menu);
 	priv->subdev.ctrl_handler = &priv->hdl;
 	if (priv->hdl.error) {
 		ret = priv->hdl.error;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 4/7] media: ov2640: support log_status ioctl and event interface
  2018-11-12 16:00 [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers Akinobu Mita
                   ` (2 preceding siblings ...)
  2018-11-12 16:00 ` [PATCH 3/7] media: ov2640: add V4L2_CID_TEST_PATTERN control Akinobu Mita
@ 2018-11-12 16:00 ` Akinobu Mita
  2018-11-12 16:00 ` [PATCH 5/7] media: ov5640: " Akinobu Mita
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Akinobu Mita @ 2018-11-12 16:00 UTC (permalink / raw)
  To: linux-media; +Cc: Akinobu Mita, Sakari Ailus, Mauro Carvalho Chehab

This adds log_status ioctl and event interface for ov2640's v4l2 controls.

Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/ov2640.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index 4992d77..d8e91bc 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -26,6 +26,7 @@
 #include <linux/videodev2.h>
 
 #include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-subdev.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-image-sizes.h>
@@ -1096,6 +1097,9 @@ static const struct v4l2_ctrl_ops ov2640_ctrl_ops = {
 };
 
 static const struct v4l2_subdev_core_ops ov2640_subdev_core_ops = {
+	.log_status = v4l2_ctrl_subdev_log_status,
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 	.g_register	= ov2640_g_register,
 	.s_register	= ov2640_s_register,
@@ -1190,7 +1194,8 @@ static int ov2640_probe(struct i2c_client *client,
 		goto err_clk;
 
 	v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
-	priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+			      V4L2_SUBDEV_FL_HAS_EVENTS;
 	mutex_init(&priv->lock);
 	v4l2_ctrl_handler_init(&priv->hdl, 3);
 	priv->hdl.lock = &priv->lock;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 5/7] media: ov5640: support log_status ioctl and event interface
  2018-11-12 16:00 [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers Akinobu Mita
                   ` (3 preceding siblings ...)
  2018-11-12 16:00 ` [PATCH 4/7] media: ov2640: support log_status ioctl and event interface Akinobu Mita
@ 2018-11-12 16:00 ` Akinobu Mita
  2018-11-12 16:00 ` [PATCH 6/7] media: ov7670: " Akinobu Mita
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 12+ messages in thread
From: Akinobu Mita @ 2018-11-12 16:00 UTC (permalink / raw)
  To: linux-media
  Cc: Akinobu Mita, Steve Longerbeam, Sakari Ailus, Mauro Carvalho Chehab

This adds log_status ioctl and event interface for ov5640's v4l2 controls.

Cc: Steve Longerbeam <slongerbeam@gmail.com>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/ov5640.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c
index eaefdb5..a91d917 100644
--- a/drivers/media/i2c/ov5640.c
+++ b/drivers/media/i2c/ov5640.c
@@ -25,6 +25,7 @@
 #include <media/v4l2-async.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-fwnode.h>
 #include <media/v4l2-subdev.h>
 
@@ -2641,6 +2642,9 @@ static int ov5640_s_stream(struct v4l2_subdev *sd, int enable)
 
 static const struct v4l2_subdev_core_ops ov5640_core_ops = {
 	.s_power = ov5640_s_power,
+	.log_status = v4l2_ctrl_subdev_log_status,
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 };
 
 static const struct v4l2_subdev_video_ops ov5640_video_ops = {
@@ -2795,7 +2799,8 @@ static int ov5640_probe(struct i2c_client *client,
 
 	v4l2_i2c_subdev_init(&sensor->sd, client, &ov5640_subdev_ops);
 
-	sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	sensor->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+			    V4L2_SUBDEV_FL_HAS_EVENTS;
 	sensor->pad.flags = MEDIA_PAD_FL_SOURCE;
 	sensor->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
 	ret = media_entity_pads_init(&sensor->sd.entity, 1, &sensor->pad);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 6/7] media: ov7670: support log_status ioctl and event interface
  2018-11-12 16:00 [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers Akinobu Mita
                   ` (4 preceding siblings ...)
  2018-11-12 16:00 ` [PATCH 5/7] media: ov5640: " Akinobu Mita
@ 2018-11-12 16:00 ` Akinobu Mita
  2018-11-12 16:00 ` [PATCH 7/7] media: ov772x: " Akinobu Mita
  2018-11-14  0:20 ` [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers jacopo mondi
  7 siblings, 0 replies; 12+ messages in thread
From: Akinobu Mita @ 2018-11-12 16:00 UTC (permalink / raw)
  To: linux-media
  Cc: Akinobu Mita, Jonathan Corbet, Sakari Ailus, Mauro Carvalho Chehab

This adds log_status ioctl and event interface for ov7670's v4l2 controls.

Cc: Jonathan Corbet <corbet@lwn.net>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/ov7670.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov7670.c b/drivers/media/i2c/ov7670.c
index bc68a3a..a70a6ff 100644
--- a/drivers/media/i2c/ov7670.c
+++ b/drivers/media/i2c/ov7670.c
@@ -20,6 +20,7 @@
 #include <linux/gpio.h>
 #include <linux/gpio/consumer.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-fwnode.h>
 #include <media/v4l2-mediabus.h>
@@ -1651,6 +1652,9 @@ static int ov7670_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
 static const struct v4l2_subdev_core_ops ov7670_core_ops = {
 	.reset = ov7670_reset,
 	.init = ov7670_init,
+	.log_status = v4l2_ctrl_subdev_log_status,
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 	.g_register = ov7670_g_register,
 	.s_register = ov7670_s_register,
@@ -1773,7 +1777,7 @@ static int ov7670_probe(struct i2c_client *client,
 
 #ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
 	sd->internal_ops = &ov7670_subdev_internal_ops;
-	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	sd->flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | V4L2_SUBDEV_FL_HAS_EVENTS;
 #endif
 
 	info->clock_speed = 30; /* default: a guess */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH 7/7] media: ov772x: support log_status ioctl and event interface
  2018-11-12 16:00 [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers Akinobu Mita
                   ` (5 preceding siblings ...)
  2018-11-12 16:00 ` [PATCH 6/7] media: ov7670: " Akinobu Mita
@ 2018-11-12 16:00 ` Akinobu Mita
  2018-11-14  0:20 ` [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers jacopo mondi
  7 siblings, 0 replies; 12+ messages in thread
From: Akinobu Mita @ 2018-11-12 16:00 UTC (permalink / raw)
  To: linux-media
  Cc: Akinobu Mita, Jacopo Mondi, Sakari Ailus, Mauro Carvalho Chehab

This adds log_status ioctl and event interface for ov772x's v4l2 controls.

Cc: Jacopo Mondi <jacopo@jmondi.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
 drivers/media/i2c/ov772x.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/media/i2c/ov772x.c b/drivers/media/i2c/ov772x.c
index fefff7f..2e9a758 100644
--- a/drivers/media/i2c/ov772x.c
+++ b/drivers/media/i2c/ov772x.c
@@ -30,6 +30,7 @@
 
 #include <media/v4l2-ctrls.h>
 #include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
 #include <media/v4l2-image-sizes.h>
 #include <media/v4l2-subdev.h>
 
@@ -1287,6 +1288,9 @@ static const struct v4l2_ctrl_ops ov772x_ctrl_ops = {
 };
 
 static const struct v4l2_subdev_core_ops ov772x_subdev_core_ops = {
+	.log_status = v4l2_ctrl_subdev_log_status,
+	.subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+	.unsubscribe_event = v4l2_event_subdev_unsubscribe,
 #ifdef CONFIG_VIDEO_ADV_DEBUG
 	.g_register	= ov772x_g_register,
 	.s_register	= ov772x_s_register,
@@ -1379,7 +1383,8 @@ static int ov772x_probe(struct i2c_client *client,
 	mutex_init(&priv->lock);
 
 	v4l2_i2c_subdev_init(&priv->subdev, client, &ov772x_subdev_ops);
-	priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+	priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+			      V4L2_SUBDEV_FL_HAS_EVENTS;
 	v4l2_ctrl_handler_init(&priv->hdl, 3);
 	/* Use our mutex for the controls */
 	priv->hdl.lock = &priv->lock;
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/7] media: ov2640: add V4L2_CID_TEST_PATTERN control
  2018-11-12 16:00 ` [PATCH 3/7] media: ov2640: add V4L2_CID_TEST_PATTERN control Akinobu Mita
@ 2018-11-13 10:36   ` Sakari Ailus
  2018-11-13 13:55     ` Akinobu Mita
  0 siblings, 1 reply; 12+ messages in thread
From: Sakari Ailus @ 2018-11-13 10:36 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-media, Mauro Carvalho Chehab

On Tue, Nov 13, 2018 at 01:00:50AM +0900, Akinobu Mita wrote:
> The ov2640 has the test pattern generator features.  This makes use of
> it through V4L2_CID_TEST_PATTERN control.
> 
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> ---
>  drivers/media/i2c/ov2640.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
> index 20a8853..4992d77 100644
> --- a/drivers/media/i2c/ov2640.c
> +++ b/drivers/media/i2c/ov2640.c
> @@ -705,6 +705,11 @@ static int ov2640_reset(struct i2c_client *client)
>  	return ret;
>  }
>  
> +static const char * const ov2640_test_pattern_menu[] = {
> +	"Disabled",
> +	"Color bar",

s/b/B/

The smiapp driver uses "Eight Vertical Colour Bars", not sure if that'd fit
here or not. FYI.

> +};
> +
>  /*
>   * functions
>   */
> @@ -740,6 +745,9 @@ static int ov2640_s_ctrl(struct v4l2_ctrl *ctrl)
>  	case V4L2_CID_HFLIP:
>  		val = ctrl->val ? REG04_HFLIP_IMG : 0x00;
>  		return ov2640_mask_set(client, REG04, REG04_HFLIP_IMG, val);
> +	case V4L2_CID_TEST_PATTERN:
> +		val = ctrl->val ? COM7_COLOR_BAR_TEST : 0x00;
> +		return ov2640_mask_set(client, COM7, COM7_COLOR_BAR_TEST, val);
>  	}
>  
>  	return -EINVAL;
> @@ -1184,12 +1192,16 @@ static int ov2640_probe(struct i2c_client *client,
>  	v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
>  	priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
>  	mutex_init(&priv->lock);
> -	v4l2_ctrl_handler_init(&priv->hdl, 2);
> +	v4l2_ctrl_handler_init(&priv->hdl, 3);
>  	priv->hdl.lock = &priv->lock;
>  	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
>  			V4L2_CID_VFLIP, 0, 1, 1, 0);
>  	v4l2_ctrl_new_std(&priv->hdl, &ov2640_ctrl_ops,
>  			V4L2_CID_HFLIP, 0, 1, 1, 0);
> +	v4l2_ctrl_new_std_menu_items(&priv->hdl, &ov2640_ctrl_ops,
> +			V4L2_CID_TEST_PATTERN,
> +			ARRAY_SIZE(ov2640_test_pattern_menu) - 1, 0, 0,
> +			ov2640_test_pattern_menu);
>  	priv->subdev.ctrl_handler = &priv->hdl;
>  	if (priv->hdl.error) {
>  		ret = priv->hdl.error;
> -- 
> 2.7.4
> 

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/7] media: ov2640: add V4L2_CID_TEST_PATTERN control
  2018-11-13 10:36   ` Sakari Ailus
@ 2018-11-13 13:55     ` Akinobu Mita
  2018-11-13 21:32       ` Sakari Ailus
  0 siblings, 1 reply; 12+ messages in thread
From: Akinobu Mita @ 2018-11-13 13:55 UTC (permalink / raw)
  To: Sakari Ailus; +Cc: linux-media, Mauro Carvalho Chehab

2018年11月13日(火) 19:37 Sakari Ailus <sakari.ailus@linux.intel.com>:
>
> On Tue, Nov 13, 2018 at 01:00:50AM +0900, Akinobu Mita wrote:
> > The ov2640 has the test pattern generator features.  This makes use of
> > it through V4L2_CID_TEST_PATTERN control.
> >
> > Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> > ---
> >  drivers/media/i2c/ov2640.c | 14 +++++++++++++-
> >  1 file changed, 13 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
> > index 20a8853..4992d77 100644
> > --- a/drivers/media/i2c/ov2640.c
> > +++ b/drivers/media/i2c/ov2640.c
> > @@ -705,6 +705,11 @@ static int ov2640_reset(struct i2c_client *client)
> >       return ret;
> >  }
> >
> > +static const char * const ov2640_test_pattern_menu[] = {
> > +     "Disabled",
> > +     "Color bar",
>
> s/b/B/
>
> The smiapp driver uses "Eight Vertical Colour Bars", not sure if that'd fit
> here or not. FYI.

This test pattern shows eight vertical color bars with blending actual
sensor image, although the datasheet tells just 'Color bar'.

So either is fine for me.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 3/7] media: ov2640: add V4L2_CID_TEST_PATTERN control
  2018-11-13 13:55     ` Akinobu Mita
@ 2018-11-13 21:32       ` Sakari Ailus
  0 siblings, 0 replies; 12+ messages in thread
From: Sakari Ailus @ 2018-11-13 21:32 UTC (permalink / raw)
  To: Akinobu Mita; +Cc: linux-media, Mauro Carvalho Chehab

On Tue, Nov 13, 2018 at 10:55:46PM +0900, Akinobu Mita wrote:
> 2018年11月13日(火) 19:37 Sakari Ailus <sakari.ailus@linux.intel.com>:
> >
> > On Tue, Nov 13, 2018 at 01:00:50AM +0900, Akinobu Mita wrote:
> > > The ov2640 has the test pattern generator features.  This makes use of
> > > it through V4L2_CID_TEST_PATTERN control.
> > >
> > > Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> > > Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> > > Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
> > > ---
> > >  drivers/media/i2c/ov2640.c | 14 +++++++++++++-
> > >  1 file changed, 13 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
> > > index 20a8853..4992d77 100644
> > > --- a/drivers/media/i2c/ov2640.c
> > > +++ b/drivers/media/i2c/ov2640.c
> > > @@ -705,6 +705,11 @@ static int ov2640_reset(struct i2c_client *client)
> > >       return ret;
> > >  }
> > >
> > > +static const char * const ov2640_test_pattern_menu[] = {
> > > +     "Disabled",
> > > +     "Color bar",
> >
> > s/b/B/
> >
> > The smiapp driver uses "Eight Vertical Colour Bars", not sure if that'd fit
> > here or not. FYI.
> 
> This test pattern shows eight vertical color bars with blending actual
> sensor image, although the datasheet tells just 'Color bar'.
> 
> So either is fine for me.

I'll use what the smiapp driver does.

Thanks.

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers
  2018-11-12 16:00 [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers Akinobu Mita
                   ` (6 preceding siblings ...)
  2018-11-12 16:00 ` [PATCH 7/7] media: ov772x: " Akinobu Mita
@ 2018-11-14  0:20 ` jacopo mondi
  7 siblings, 0 replies; 12+ messages in thread
From: jacopo mondi @ 2018-11-14  0:20 UTC (permalink / raw)
  To: Akinobu Mita
  Cc: linux-media, Steve Longerbeam, Jonathan Corbet, Sakari Ailus,
	Mauro Carvalho Chehab

[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]

Hello Mita-san,
   thanks for the patches

On Tue, Nov 13, 2018 at 01:00:47AM +0900, Akinobu Mita wrote:
> This patchset addds relatively small enhancements (log_status ioctl, event
> interface, V4L2_CID_TEST_PATTERN control, and V4L2_CID_COLORFX control) for
> mt9m111, ov2640, ov5640, ov7670, and ov772x drivers.  I have these devices
> so these patches are tested with real devices.
>

For the ov772x part:
Acked-by: Jacopo Mondi <jacopo@jmondi.org>

Thanks
   j

> Akinobu Mita (7):
>   media: mt9m111: support log_status ioctl and event interface
>   media: mt9m111: add V4L2_CID_COLORFX control
>   media: ov2640: add V4L2_CID_TEST_PATTERN control
>   media: ov2640: support log_status ioctl and event interface
>   media: ov5640: support log_status ioctl and event interface
>   media: ov7670: support log_status ioctl and event interface
>   media: ov772x: support log_status ioctl and event interface
>
>  drivers/media/i2c/mt9m111.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
>  drivers/media/i2c/ov2640.c  | 21 +++++++++++++++++++--
>  drivers/media/i2c/ov5640.c  |  7 ++++++-
>  drivers/media/i2c/ov7670.c  |  6 +++++-
>  drivers/media/i2c/ov772x.c  |  7 ++++++-
>  5 files changed, 78 insertions(+), 7 deletions(-)
>
> Cc: Steve Longerbeam <slongerbeam@gmail.com>
> Cc: Jonathan Corbet <corbet@lwn.net>
> Cc: Jacopo Mondi <jacopo@jmondi.org>
> Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> --
> 2.7.4
>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2018-11-14 10:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-12 16:00 [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers Akinobu Mita
2018-11-12 16:00 ` [PATCH 1/7] media: mt9m111: support log_status ioctl and event interface Akinobu Mita
2018-11-12 16:00 ` [PATCH 2/7] media: mt9m111: add V4L2_CID_COLORFX control Akinobu Mita
2018-11-12 16:00 ` [PATCH 3/7] media: ov2640: add V4L2_CID_TEST_PATTERN control Akinobu Mita
2018-11-13 10:36   ` Sakari Ailus
2018-11-13 13:55     ` Akinobu Mita
2018-11-13 21:32       ` Sakari Ailus
2018-11-12 16:00 ` [PATCH 4/7] media: ov2640: support log_status ioctl and event interface Akinobu Mita
2018-11-12 16:00 ` [PATCH 5/7] media: ov5640: " Akinobu Mita
2018-11-12 16:00 ` [PATCH 6/7] media: ov7670: " Akinobu Mita
2018-11-12 16:00 ` [PATCH 7/7] media: ov772x: " Akinobu Mita
2018-11-14  0:20 ` [PATCH 0/7] media: i2c: small enhancements for camera sensor drivers jacopo mondi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.