Skip to content

Commit 60edcb0

Browse files
Hu Kejunrkhuangtao
authored andcommitted
media: rk-isp10: add control for clear exposure list
Change-Id: I57aae7bfcf54d0055b63824fb608e6beb621e974 Signed-off-by: Hu Kejun <william.hu@rock-chips.com>
1 parent bf14d07 commit 60edcb0

4 files changed

Lines changed: 38 additions & 9 deletions

File tree

drivers/media/platform/rk-isp10/cif_isp10.c

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5786,7 +5786,7 @@ int cif_isp10_streamoff(
57865786
if (streamoff_all == (CIF_ISP10_STREAM_MP | CIF_ISP10_STREAM_SP)) {
57875787
struct cif_isp10_img_src_exp *exp;
57885788
spin_lock_irqsave(&dev->img_src_exps.lock, lock_flags);
5789-
if (!list_empty(&dev->img_src_exps.list)) {
5789+
while (!list_empty(&dev->img_src_exps.list)) {
57905790
exp = list_first_entry(&dev->img_src_exps.list,
57915791
struct cif_isp10_img_src_exp,
57925792
list);
@@ -6306,7 +6306,8 @@ int cif_isp10_reqbufs(
63066306

63076307
int cif_isp10_s_exp(
63086308
struct cif_isp10_device *dev,
6309-
struct cif_isp10_img_src_ext_ctrl *exp_ctrl)
6309+
struct cif_isp10_img_src_ext_ctrl *exp_ctrl,
6310+
bool cls_exp)
63106311
{
63116312
struct cif_isp10_img_src_ctrl *ctrl_exp_t = NULL, *ctrl_exp_g = NULL;
63126313
struct cif_isp10_img_src_exp *exp = NULL, *exp_t = NULL, *exp_g = NULL;
@@ -6322,6 +6323,21 @@ int cif_isp10_s_exp(
63226323
dev->img_src_exps.inited = true;
63236324
}
63246325

6326+
/* clean exposure list before */
6327+
if (cls_exp) {
6328+
spin_lock_irqsave(&dev->img_src_exps.lock, lock_flags);
6329+
while (!list_empty(&dev->img_src_exps.list)) {
6330+
exp = list_first_entry(&dev->img_src_exps.list,
6331+
struct cif_isp10_img_src_exp,
6332+
list);
6333+
list_del(&exp->list);
6334+
kfree(exp->exp.ctrls);
6335+
kfree(exp);
6336+
}
6337+
spin_unlock_irqrestore(&dev->img_src_exps.lock, lock_flags);
6338+
exp = NULL;
6339+
}
6340+
63256341
if (dev->img_src_exps.exp_valid_frms[VALID_FR_EXP_T_INDEX] ==
63266342
dev->img_src_exps.exp_valid_frms[VALID_FR_EXP_G_INDEX]) {
63276343
exp = kmalloc(sizeof(*exp), GFP_KERNEL);

drivers/media/platform/rk-isp10/cif_isp10.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -800,7 +800,8 @@ int cif_isp10_s_vb_metadata(
800800

801801
int cif_isp10_s_exp(
802802
struct cif_isp10_device *dev,
803-
struct cif_isp10_img_src_ext_ctrl *exp_ctrl);
803+
struct cif_isp10_img_src_ext_ctrl *exp_ctrl,
804+
bool cls_exp);
804805

805806
int cif_isp10_s_vcm(
806807
struct cif_isp10_device *dev,

drivers/media/platform/rk-isp10/cif_isp10_v4l2.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1609,7 +1609,8 @@ static int v4l2_s_ext_ctrls(struct file *file, void *priv,
16091609
struct cif_isp10_device *dev = to_cif_isp10_device(queue);
16101610
struct cif_isp10_img_src_ext_ctrl ctrl;
16111611
int ret = -EINVAL;
1612-
unsigned int i;
1612+
unsigned int i, j;
1613+
bool cls_exp = false;
16131614

16141615
/* The only use-case is gain and exposure to sensor. Thus no check if
16151616
* 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,
16251626
if (!ctrls)
16261627
return -ENOMEM;
16271628

1628-
ctrl.cnt = vc_ext->count;
1629+
if (vc_ext->controls[0].id == RK_V4L2_CID_CLS_EXP) {
1630+
j = 1;
1631+
cls_exp = true;
1632+
ctrl.cnt = vc_ext->count - 1;
1633+
} else {
1634+
j = 0;
1635+
cls_exp = false;
1636+
ctrl.cnt = vc_ext->count;
1637+
}
1638+
16291639
/*current kernel version don't define
16301640
*this member for struct v4l2_ext_control.
16311641
*/
16321642
/*ctrl.class = vc_ext->ctrl_class;*/
16331643
ctrl.ctrls = ctrls;
16341644

1635-
for (i = 0; i < vc_ext->count; i++) {
1636-
ctrls[i].id = vc_ext->controls[i].id;
1637-
ctrls[i].val = vc_ext->controls[i].value;
1645+
for (i = 0; i < ctrl.cnt; i++, j++) {
1646+
ctrls[i].id = vc_ext->controls[j].id;
1647+
ctrls[i].val = vc_ext->controls[j].value;
16381648
}
16391649

1640-
ret = cif_isp10_s_exp(dev, &ctrl);
1650+
ret = cif_isp10_s_exp(dev, &ctrl, cls_exp);
16411651
return ret;
16421652
}
16431653

include/media/v4l2-controls_rockchip.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,6 @@
3434
#define RK_V4L2_CID_GAIN_PERCENT (V4L2_CID_USER_RK_BASE + 2)
3535
#define RK_V4L2_CID_AUTO_FPS (V4L2_CID_USER_RK_BASE + 3)
3636
#define RK_V4L2_CID_VTS (V4L2_CID_USER_RK_BASE + 4)
37+
#define RK_V4L2_CID_CLS_EXP (V4L2_CID_USER_RK_BASE + 5)
38+
3739
#endif

0 commit comments

Comments
 (0)