summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHu Kejun <william.hu@rock-chips.com>2018-11-30 15:13:35 +0800
committerTao Huang <huangtao@rock-chips.com>2019-01-24 14:28:30 +0800
commit60edcb0765113a21387de88e0df6b97984dfa0d9 (patch)
tree878ebcd9b297fa6d90cdc996395134f0ea961403
parentbf14d07061b46604781fe23a9a2f62b7853e4407 (diff)
media: rk-isp10: add control for clear exposure list
Change-Id: I57aae7bfcf54d0055b63824fb608e6beb621e974 Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
-rw-r--r--drivers/media/platform/rk-isp10/cif_isp10.c20
-rw-r--r--drivers/media/platform/rk-isp10/cif_isp10.h3
-rw-r--r--drivers/media/platform/rk-isp10/cif_isp10_v4l2.c22
-rw-r--r--include/media/v4l2-controls_rockchip.h2
4 files changed, 38 insertions, 9 deletions
diff --git a/drivers/media/platform/rk-isp10/cif_isp10.c b/drivers/media/platform/rk-isp10/cif_isp10.c
index e9cf016b6470..f8a77161ecc5 100644
--- a/drivers/media/platform/rk-isp10/cif_isp10.c
+++ b/drivers/media/platform/rk-isp10/cif_isp10.c
@@ -5786,7 +5786,7 @@ int cif_isp10_streamoff(
if (streamoff_all == (CIF_ISP10_STREAM_MP | CIF_ISP10_STREAM_SP)) {
struct cif_isp10_img_src_exp *exp;
spin_lock_irqsave(&dev->img_src_exps.lock, lock_flags);
- if (!list_empty(&dev->img_src_exps.list)) {
+ while (!list_empty(&dev->img_src_exps.list)) {
exp = list_first_entry(&dev->img_src_exps.list,
struct cif_isp10_img_src_exp,
list);
@@ -6306,7 +6306,8 @@ int cif_isp10_reqbufs(
int cif_isp10_s_exp(
struct cif_isp10_device *dev,
- struct cif_isp10_img_src_ext_ctrl *exp_ctrl)
+ struct cif_isp10_img_src_ext_ctrl *exp_ctrl,
+ bool cls_exp)
{
struct cif_isp10_img_src_ctrl *ctrl_exp_t = NULL, *ctrl_exp_g = NULL;
struct cif_isp10_img_src_exp *exp = NULL, *exp_t = NULL, *exp_g = NULL;
@@ -6322,6 +6323,21 @@ int cif_isp10_s_exp(
dev->img_src_exps.inited = true;
}
+ /* clean exposure list before */
+ if (cls_exp) {
+ spin_lock_irqsave(&dev->img_src_exps.lock, lock_flags);
+ while (!list_empty(&dev->img_src_exps.list)) {
+ exp = list_first_entry(&dev->img_src_exps.list,
+ struct cif_isp10_img_src_exp,
+ list);
+ list_del(&exp->list);
+ kfree(exp->exp.ctrls);
+ kfree(exp);
+ }
+ spin_unlock_irqrestore(&dev->img_src_exps.lock, lock_flags);
+ exp = NULL;
+ }
+
if (dev->img_src_exps.exp_valid_frms[VALID_FR_EXP_T_INDEX] ==
dev->img_src_exps.exp_valid_frms[VALID_FR_EXP_G_INDEX]) {
exp = kmalloc(sizeof(*exp), GFP_KERNEL);
diff --git a/drivers/media/platform/rk-isp10/cif_isp10.h b/drivers/media/platform/rk-isp10/cif_isp10.h
index 3188c977ba93..eb570430f2ae 100644
--- a/drivers/media/platform/rk-isp10/cif_isp10.h
+++ b/drivers/media/platform/rk-isp10/cif_isp10.h
@@ -800,7 +800,8 @@ int cif_isp10_s_vb_metadata(
int cif_isp10_s_exp(
struct cif_isp10_device *dev,
- struct cif_isp10_img_src_ext_ctrl *exp_ctrl);
+ struct cif_isp10_img_src_ext_ctrl *exp_ctrl,
+ bool cls_exp);
int cif_isp10_s_vcm(
struct cif_isp10_device *dev,
diff --git a/drivers/media/platform/rk-isp10/cif_isp10_v4l2.c b/drivers/media/platform/rk-isp10/cif_isp10_v4l2.c
index 8fae8fcfb6ea..b19efe054892 100644
--- a/drivers/media/platform/rk-isp10/cif_isp10_v4l2.c
+++ b/drivers/media/platform/rk-isp10/cif_isp10_v4l2.c
@@ -1609,7 +1609,8 @@ static int v4l2_s_ext_ctrls(struct file *file, void *priv,
struct cif_isp10_device *dev = to_cif_isp10_device(queue);
struct cif_isp10_img_src_ext_ctrl ctrl;
int ret = -EINVAL;
- unsigned int i;
+ unsigned int i, j;
+ bool cls_exp = false;
/* The only use-case is gain and exposure to sensor. Thus no check if
* this shall go to img_src or not as of now.
@@ -1625,19 +1626,28 @@ static int v4l2_s_ext_ctrls(struct file *file, void *priv,
if (!ctrls)
return -ENOMEM;
- ctrl.cnt = vc_ext->count;
+ if (vc_ext->controls[0].id == RK_V4L2_CID_CLS_EXP) {
+ j = 1;
+ cls_exp = true;
+ ctrl.cnt = vc_ext->count - 1;
+ } else {
+ j = 0;
+ cls_exp = false;
+ ctrl.cnt = vc_ext->count;
+ }
+
/*current kernel version don't define
*this member for struct v4l2_ext_control.
*/
/*ctrl.class = vc_ext->ctrl_class;*/
ctrl.ctrls = ctrls;
- for (i = 0; i < vc_ext->count; i++) {
- ctrls[i].id = vc_ext->controls[i].id;
- ctrls[i].val = vc_ext->controls[i].value;
+ for (i = 0; i < ctrl.cnt; i++, j++) {
+ ctrls[i].id = vc_ext->controls[j].id;
+ ctrls[i].val = vc_ext->controls[j].value;
}
- ret = cif_isp10_s_exp(dev, &ctrl);
+ ret = cif_isp10_s_exp(dev, &ctrl, cls_exp);
return ret;
}
diff --git a/include/media/v4l2-controls_rockchip.h b/include/media/v4l2-controls_rockchip.h
index c185a58e33da..62c2b8d87c7f 100644
--- a/include/media/v4l2-controls_rockchip.h
+++ b/include/media/v4l2-controls_rockchip.h
@@ -34,4 +34,6 @@
#define RK_V4L2_CID_GAIN_PERCENT (V4L2_CID_USER_RK_BASE + 2)
#define RK_V4L2_CID_AUTO_FPS (V4L2_CID_USER_RK_BASE + 3)
#define RK_V4L2_CID_VTS (V4L2_CID_USER_RK_BASE + 4)
+#define RK_V4L2_CID_CLS_EXP (V4L2_CID_USER_RK_BASE + 5)
+
#endif