media: i2c: camera driver gc4c33 add cmd for get nr switch threshold

Change-Id: Ibf8365c0c3d55496f37438577497b086b14a7496
Signed-off-by: Zefa Chen <zefa.chen@rock-chips.com>
This commit is contained in:
Zefa Chen 2020-06-16 20:41:06 +08:00 committed by Tao Huang
commit 7407ef7aeb
2 changed files with 39 additions and 0 deletions

View file

@ -1511,6 +1511,7 @@ static long gc4c33_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
{
struct gc4c33 *gc4c33 = to_gc4c33(sd);
struct rkmodule_hdr_cfg *hdr;
struct rkmodule_nr_switch_threshold *nr_switch;
u32 i, h, w;
long ret = 0;
@ -1557,6 +1558,14 @@ static long gc4c33_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
case RKMODULE_SET_DPCC_CFG:
ret = gc4c33_set_dpcc_cfg(gc4c33, (struct rkmodule_dpcc_cfg *)arg);
break;
case RKMODULE_GET_NR_SWITCH_THRESHOLD:
nr_switch = (struct rkmodule_nr_switch_threshold *)arg;
nr_switch->direct = 0;
nr_switch->up_thres = 3014;
nr_switch->down_thres = 3014;
nr_switch->div_coeff = 100;
ret = 0;
break;
default:
ret = -ENOIOCTLCMD;
break;
@ -1575,6 +1584,7 @@ static long gc4c33_compat_ioctl32(struct v4l2_subdev *sd,
struct rkmodule_hdr_cfg *hdr;
struct rkmodule_dpcc_cfg *dpcc;
struct preisp_hdrae_exp_s *hdrae;
struct rkmodule_nr_switch_threshold *nr_switch;
long ret;
switch (cmd) {
@ -1650,6 +1660,18 @@ static long gc4c33_compat_ioctl32(struct v4l2_subdev *sd,
ret = gc4c33_ioctl(sd, cmd, hdrae);
kfree(hdrae);
break;
case RKMODULE_GET_NR_SWITCH_THRESHOLD:
nr_switch = kzalloc(sizeof(*nr_switch), GFP_KERNEL);
if (!nr_switch) {
ret = -ENOMEM;
return ret;
}
ret = gc4c33_ioctl(sd, cmd, nr_switch);
if (!ret)
ret = copy_to_user(up, nr_switch, sizeof(*nr_switch));
kfree(nr_switch);
break;
default:
ret = -ENOIOCTLCMD;
break;

View file

@ -44,6 +44,9 @@
#define RKMODULE_SET_DPCC_CFG \
_IOW('V', BASE_VIDIOC_PRIVATE + 8, struct rkmodule_dpcc_cfg)
#define RKMODULE_GET_NR_SWITCH_THRESHOLD \
_IOR('V', BASE_VIDIOC_PRIVATE + 9, struct rkmodule_nr_switch_threshold)
/**
* struct rkmodule_base_inf - module base information
*
@ -247,4 +250,18 @@ struct rkmodule_dpcc_cfg {
__u32 total_dpcc;
} __attribute__ ((packed));
/**
* nr switch by gain
* direct: 0 -> up_thres LSNR to HSNR, 1 -> up_thres HSNR to LSNR
* up_thres: threshold of nr change from low gain to high gain
* down_thres: threshold of nr change from high gain to low gain;
* div_coeff: Coefficients converted from float to int
*/
struct rkmodule_nr_switch_threshold {
__u32 direct;
__u32 up_thres;
__u32 down_thres;
__u32 div_coeff;
} __attribute__ ((packed));
#endif /* _UAPI_RKMODULE_CAMERA_H */