From c442f838e276ee98f635e4205d4d3c6f86325100 Mon Sep 17 00:00:00 2001
From: Jeong-Seok Yang <jseok.yang@samsung.com>
Date: Fri, 3 Sep 2010 06:43:00 +0900
Subject: S5PC11X: FIMC: added supporting s_ext_ctrls function.

added supporting s_ext_ctrls function in only capture devices.

Signed-off-by: Jeong-Seok Yang <jseok.yang@samsung.com>
Change-Id: Ib90fd82104df66a6e57b3177e9ae77c77d83e85f
---
 drivers/media/video/samsung/fimc/fimc.h         |  1 +
 drivers/media/video/samsung/fimc/fimc_capture.c | 15 +++++++++++++++
 drivers/media/video/samsung/fimc/fimc_v4l2.c    | 17 +++++++++++++++++
 3 files changed, 33 insertions(+)

diff --git a/drivers/media/video/samsung/fimc/fimc.h b/drivers/media/video/samsung/fimc/fimc.h
index e05d5f5..71872ac 100644
--- a/drivers/media/video/samsung/fimc/fimc.h
+++ b/drivers/media/video/samsung/fimc/fimc.h
@@ -458,6 +458,7 @@ extern int fimc_reqbufs_capture(void *fh, struct v4l2_requestbuffers *b);
 extern int fimc_querybuf_capture(void *fh, struct v4l2_buffer *b);
 extern int fimc_g_ctrl_capture(void *fh, struct v4l2_control *c);
 extern int fimc_s_ctrl_capture(void *fh, struct v4l2_control *c);
+extern int fimc_s_ext_ctrls_capture(void *fh, struct v4l2_ext_controls *c);
 extern int fimc_cropcap_capture(void *fh, struct v4l2_cropcap *a);
 extern int fimc_g_crop_capture(void *fh, struct v4l2_crop *a);
 extern int fimc_s_crop_capture(void *fh, struct v4l2_crop *a);
diff --git a/drivers/media/video/samsung/fimc/fimc_capture.c b/drivers/media/video/samsung/fimc/fimc_capture.c
index 10a54d1..7e6c487 100644
--- a/drivers/media/video/samsung/fimc/fimc_capture.c
+++ b/drivers/media/video/samsung/fimc/fimc_capture.c
@@ -1195,6 +1195,21 @@ int fimc_s_ctrl_capture(void *fh, struct v4l2_control *c)
 	return ret;
 }
 
+int fimc_s_ext_ctrls_capture(void *fh, struct v4l2_ext_controls *c)
+{
+	struct fimc_control *ctrl = ((struct fimc_prv_data *)fh)->ctrl;
+	int ret = 0;
+
+	mutex_lock(&ctrl->v4l2_lock);
+
+	/* try on subdev */
+	ret = subdev_call(ctrl, core, s_ext_ctrls, c);
+
+	mutex_unlock(&ctrl->v4l2_lock);
+
+	return ret;
+}
+
 int fimc_cropcap_capture(void *fh, struct v4l2_cropcap *a)
 {
 	struct fimc_control *ctrl = ((struct fimc_prv_data *)fh)->ctrl;
diff --git a/drivers/media/video/samsung/fimc/fimc_v4l2.c b/drivers/media/video/samsung/fimc/fimc_v4l2.c
index 5c8aba1..3632ded 100644
--- a/drivers/media/video/samsung/fimc/fimc_v4l2.c
+++ b/drivers/media/video/samsung/fimc/fimc_v4l2.c
@@ -112,6 +112,22 @@ static int fimc_s_ctrl(struct file *filp, void *fh, struct v4l2_control *c)
 	return ret;
 }
 
+static int fimc_s_ext_ctrls(struct file *filp, void *fh,
+				struct v4l2_ext_controls *c)
+{
+	struct fimc_control *ctrl = ((struct fimc_prv_data *)fh)->ctrl;
+	int ret = -1;
+
+	if (ctrl->cap != NULL) {
+		ret = fimc_s_ext_ctrls_capture(fh, c);
+	} else {
+		fimc_err("%s: Invalid case\n", __func__);
+		return -EINVAL;
+	}
+
+	return ret;
+}
+
 static int fimc_cropcap(struct file *filp, void *fh, struct v4l2_cropcap *a)
 {
 	struct fimc_control *ctrl = ((struct fimc_prv_data *)fh)->ctrl;
@@ -250,6 +266,7 @@ const struct v4l2_ioctl_ops fimc_v4l2_ops = {
 	.vidioc_querybuf		= fimc_querybuf,
 	.vidioc_g_ctrl			= fimc_g_ctrl,
 	.vidioc_s_ctrl			= fimc_s_ctrl,
+	.vidioc_s_ext_ctrls		= fimc_s_ext_ctrls,
 	.vidioc_cropcap			= fimc_cropcap,
 	.vidioc_g_crop			= fimc_g_crop,
 	.vidioc_s_crop			= fimc_s_crop,
-- 
cgit v1.1