media: rk-isp10: add control for clear exposure list

Change-Id: I57aae7bfcf54d0055b63824fb608e6beb621e974
Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
This commit is contained in:
Hu Kejun
2018-11-30 15:13:35 +08:00
committed by Tao Huang
parent bf14d07061
commit 60edcb0765
4 changed files with 38 additions and 9 deletions

View File

@@ -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);

View File

@@ -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,

View File

@@ -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;
}

View File

@@ -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