media: i2c: gc5035: fix compile error

Signed-off-by: Wang Panzhenzhuan <randy.wang@rock-chips.com>
Change-Id: I5baa609d0028d7cbcfc26334d68ace1db741e340
This commit is contained in:
Wang Panzhenzhuan
2022-07-09 06:55:55 +00:00
committed by Tao Huang
parent df5f7115ff
commit fb39bd5bec
3 changed files with 27 additions and 7 deletions

View File

@@ -1019,6 +1019,17 @@ config VIDEO_GC5025
To compile this driver as a module, choose M here: the
module will be called gc5025.
config VIDEO_GC5035
tristate "GalaxyCore GC5035 sensor support"
depends on VIDEO_V4L2 && I2C && MEDIA_CONTROLLER
depends on MEDIA_CAMERA_SUPPORT
select V4L2_FWNODE
help
Support for the GalaxyCore GC5035 sensor.
To compile this driver as a module, choose M here: the
module will be called gc5035.
config VIDEO_GC8034
tristate "GalaxyCore GC8034 sensor support"
depends on I2C && VIDEO_V4L2 && VIDEO_V4L2_SUBDEV_API

View File

@@ -173,6 +173,7 @@ obj-$(CONFIG_VIDEO_GC4653) += gc4653.o
obj-$(CONFIG_VIDEO_GC4663) += gc4663.o
obj-$(CONFIG_VIDEO_GC4C33) += gc4c33.o
obj-$(CONFIG_VIDEO_GC5025) += gc5025.o
obj-$(CONFIG_VIDEO_GC5035) += gc5035.o
obj-$(CONFIG_VIDEO_GC8034) += gc8034.o
obj-$(CONFIG_VIDEO_HI556) += hi556.o
obj-$(CONFIG_VIDEO_IMX214) += imx214.o

View File

@@ -698,8 +698,11 @@ static long gc5035_compat_ioctl32(struct v4l2_subdev *sd,
}
ret = gc5035_ioctl(sd, cmd, inf);
if (!ret)
if (!ret) {
ret = copy_to_user(up, inf, sizeof(*inf));
if (ret)
ret = -EFAULT;
}
kfree(inf);
break;
case RKMODULE_AWB_CFG:
@@ -712,12 +715,17 @@ static long gc5035_compat_ioctl32(struct v4l2_subdev *sd,
ret = copy_from_user(cfg, up, sizeof(*cfg));
if (!ret)
ret = gc5035_ioctl(sd, cmd, cfg);
else
ret = -EFAULT;
kfree(cfg);
break;
case RKMODULE_SET_QUICK_STREAM:
ret = copy_from_user(&stream, up, sizeof(u32));
if (!ret)
ret = gc5035_ioctl(sd, cmd, &stream);
else
ret = -EFAULT;
break;
default:
ret = -ENOTTY;
@@ -956,8 +964,8 @@ static int gc5035_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
}
#endif
static int sensor_g_mbus_config(struct v4l2_subdev *sd,
struct v4l2_mbus_config *config)
static int sensor_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
struct v4l2_mbus_config *config)
{
struct gc5035 *sensor = to_gc5035(sd);
struct device *dev = &sensor->client->dev;
@@ -965,7 +973,7 @@ static int sensor_g_mbus_config(struct v4l2_subdev *sd,
dev_info(dev, "%s(%d) enter!\n", __func__, __LINE__);
if (2 == sensor->lane_num) {
config->type = V4L2_MBUS_CSI2;
config->type = V4L2_MBUS_CSI2_DPHY;
config->flags = V4L2_MBUS_CSI2_2_LANE |
V4L2_MBUS_CSI2_CHANNEL_0 |
V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
@@ -1014,7 +1022,6 @@ static const struct v4l2_subdev_core_ops gc5035_core_ops = {
};
static const struct v4l2_subdev_video_ops gc5035_video_ops = {
.g_mbus_config = sensor_g_mbus_config,
.s_stream = gc5035_s_stream,
.g_frame_interval = gc5035_g_frame_interval,
};
@@ -1025,6 +1032,7 @@ static const struct v4l2_subdev_pad_ops gc5035_pad_ops = {
.enum_frame_interval = gc5035_enum_frame_interval,
.get_fmt = gc5035_get_fmt,
.set_fmt = gc5035_set_fmt,
.get_mbus_config = sensor_g_mbus_config,
};
static const struct v4l2_subdev_ops gc5035_subdev_ops = {
@@ -1039,8 +1047,8 @@ static int gc5035_set_test_pattern(struct gc5035 *gc5035, int value)
dev_info(&gc5035->client->dev, "Test Pattern!!\n");
ret = gc5035_write_reg(gc5035->client, 0xfe, 0x01);
ret = gc5035_write_reg(gc5035->client, 0x8c, value);
ret = gc5035_write_reg(gc5035->client, 0xfe, 0x00);
ret |= gc5035_write_reg(gc5035->client, 0x8c, value);
ret |= gc5035_write_reg(gc5035->client, 0xfe, 0x00);
return ret;
}