media: i2c: imx415: add dcphy param for hdr2 mode

Signed-off-by: Wang Panzhenzhuan <randy.wang@rock-chips.com>
Change-Id: Ib59b19aa65aac0aaeb4a5d51c9b7f3cbd6e1ee76
This commit is contained in:
Wang Panzhenzhuan
2022-06-08 10:04:15 +08:00
committed by Tao Huang
parent 335ff91245
commit 95c6c7edb6
+42 -1
View File
@@ -27,6 +27,8 @@
* 1. fix set_fmt & ioctl get mode unmatched issue.
* 2. need to set default vblank when change format.
* 3. enum all supported mode mbus_code, not just cur_mode.
* V0.0X01.0X08
* 1. add dcphy param for hdrx2 mode.
*/
#define DEBUG
@@ -50,7 +52,7 @@
#include <linux/rk-preisp.h>
#include "../platform/rockchip/isp/rkisp_tb_helper.h"
#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x07)
#define DRIVER_VERSION KERNEL_VERSION(0, 0x01, 0x08)
#ifndef V4L2_CID_DIGITAL_GAIN
#define V4L2_CID_DIGITAL_GAIN V4L2_CID_GAIN
@@ -232,6 +234,17 @@ struct imx415 {
struct preisp_hdrae_exp_s init_hdrae_exp;
};
static struct rkmodule_csi_dphy_param dcphy_param = {
.vendor = PHY_VENDOR_SAMSUNG,
.lp_vol_ref = 6,
.lp_hys_sw = {3, 0, 0, 0},
.lp_escclk_pol_sel = {1, 1, 1, 1},
.skew_data_cal_clk = {0, 3, 3, 3},
.clk_hs_term_sel = 2,
.data_hs_term_sel = {2, 2, 2, 2},
.reserved = {0},
};
#define to_imx415(sd) container_of(sd, struct imx415, subdev)
/*
@@ -1675,6 +1688,7 @@ static long imx415_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
long ret = 0;
const struct imx415_mode *mode;
u64 pixel_rate = 0;
struct rkmodule_csi_dphy_param *dphy_param;
switch (cmd) {
case PREISP_CMD_SET_HDRAE_EXP:
@@ -1756,6 +1770,16 @@ static long imx415_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg)
ch_info = (struct rkmodule_channel_info *)arg;
ret = imx415_get_channel_info(imx415, ch_info);
break;
case RKMODULE_GET_CSI_DPHY_PARAM:
if (imx415->cur_mode->hdr_mode == HDR_X2) {
dphy_param = (struct rkmodule_csi_dphy_param *)arg;
if (dphy_param->vendor == dcphy_param.vendor)
*dphy_param = dcphy_param;
dev_info(&imx415->client->dev,
"get sensor dphy param\n");
} else
ret = -EINVAL;
break;
default:
ret = -ENOIOCTLCMD;
break;
@@ -1777,6 +1801,7 @@ static long imx415_compat_ioctl32(struct v4l2_subdev *sd,
long ret;
u32 stream;
u32 brl = 0;
struct rkmodule_csi_dphy_param *dphy_param;
switch (cmd) {
case RKMODULE_GET_MODULE_INFO:
@@ -1880,6 +1905,22 @@ static long imx415_compat_ioctl32(struct v4l2_subdev *sd,
}
kfree(ch_info);
break;
case RKMODULE_GET_CSI_DPHY_PARAM:
dphy_param = kzalloc(sizeof(*dphy_param), GFP_KERNEL);
if (!dphy_param) {
ret = -ENOMEM;
return ret;
}
ret = imx415_ioctl(sd, cmd, dphy_param);
if (!ret) {
ret = copy_to_user(up, dphy_param, sizeof(*dphy_param));
if (ret)
ret = -EFAULT;
}
kfree(dphy_param);
break;
default:
ret = -ENOIOCTLCMD;
break;