media: i2c: rk628: Compatible with both kernel-5.10 and kernel-6.1

Signed-off-by: Algea Cao <algea.cao@rock-chips.com>
Change-Id: I44d2e7e78c0b340daff88d98833ba72a24156a69
This commit is contained in:
Algea Cao
2024-01-17 17:25:26 +08:00
committed by Tao Huang
parent bd0e0fedb6
commit e3f7d79af1
2 changed files with 14 additions and 1 deletions

View File

@@ -1192,11 +1192,19 @@ static int rk628_bt1120_g_mbus_config(struct v4l2_subdev *sd,
struct rk628_bt1120 *bt1120 = to_bt1120(sd);
cfg->type = V4L2_MBUS_BT656;
#if KERNEL_VERSION(5, 18, 0) <= LINUX_VERSION_CODE
cfg->bus.parallel.flags = V4L2_MBUS_HSYNC_ACTIVE_HIGH |
V4L2_MBUS_VSYNC_ACTIVE_HIGH |
V4L2_MBUS_PCLK_SAMPLE_RISING;
if (bt1120->dual_edge)
cfg->bus.parallel.flags |= V4L2_MBUS_PCLK_SAMPLE_FALLING;
#else
cfg->flags = V4L2_MBUS_HSYNC_ACTIVE_HIGH |
V4L2_MBUS_VSYNC_ACTIVE_HIGH |
V4L2_MBUS_PCLK_SAMPLE_RISING;
if (bt1120->dual_edge)
cfg->flags |= V4L2_MBUS_PCLK_SAMPLE_FALLING;
#endif
return 0;
}

View File

@@ -2842,7 +2842,11 @@ err_hdl:
return err;
}
#if KERNEL_VERSION(6, 1, 0) <= LINUX_VERSION_CODE
static void rk628_csi_remove(struct i2c_client *client)
#else
static int rk628_csi_remove(struct i2c_client *client)
#endif
{
struct rk628_csi *csi = i2c_get_clientdata(client);
@@ -2872,8 +2876,9 @@ static int rk628_csi_remove(struct i2c_client *client)
rk628_control_assert(csi->rk628, RGU_CSI);
if (csi->rk628->version >= RK628F_VERSION)
rk628_control_assert(csi->rk628, RGU_CSI1);
#if KERNEL_VERSION(6, 1, 0) > LINUX_VERSION_CODE
return 0;
#endif
}
static struct i2c_driver rk628_csi_i2c_driver = {