From 9370bb92b2d16684ee45cf24e879c93c509162da Mon Sep 17 00:00:00 2001 From: hc <hc@nodka.com> Date: Thu, 19 Dec 2024 01:47:39 +0000 Subject: [PATCH] add wifi6 8852be driver --- kernel/drivers/media/i2c/ov5695.c | 31 +++++++++++++++++-------------- 1 files changed, 17 insertions(+), 14 deletions(-) diff --git a/kernel/drivers/media/i2c/ov5695.c b/kernel/drivers/media/i2c/ov5695.c index 94bee5b..32cdf5e 100644 --- a/kernel/drivers/media/i2c/ov5695.c +++ b/kernel/drivers/media/i2c/ov5695.c @@ -841,9 +841,7 @@ struct ov5695 *ov5695 = to_ov5695(sd); const struct ov5695_mode *mode = ov5695->cur_mode; - mutex_lock(&ov5695->mutex); fi->interval = mode->max_fps; - mutex_unlock(&ov5695->mutex); return 0; } @@ -852,10 +850,10 @@ struct rkmodule_inf *inf) { memset(inf, 0, sizeof(*inf)); - strlcpy(inf->base.sensor, OV5695_NAME, sizeof(inf->base.sensor)); - strlcpy(inf->base.module, ov5695->module_name, + strscpy(inf->base.sensor, OV5695_NAME, sizeof(inf->base.sensor)); + strscpy(inf->base.module, ov5695->module_name, sizeof(inf->base.module)); - strlcpy(inf->base.lens, ov5695->len_name, sizeof(inf->base.lens)); + strscpy(inf->base.lens, ov5695->len_name, sizeof(inf->base.lens)); } static long ov5695_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) @@ -906,8 +904,11 @@ } ret = ov5695_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: @@ -920,12 +921,16 @@ ret = copy_from_user(cfg, up, sizeof(*cfg)); if (!ret) ret = ov5695_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 = ov5695_ioctl(sd, cmd, &stream); + else + ret = -EFAULT; break; default: ret = -ENOIOCTLCMD; @@ -1098,7 +1103,7 @@ regulator_bulk_disable(OV5695_NUM_SUPPLIES, ov5695->supplies); } -static int ov5695_runtime_resume(struct device *dev) +static int __maybe_unused ov5695_runtime_resume(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct v4l2_subdev *sd = i2c_get_clientdata(client); @@ -1107,7 +1112,7 @@ return __ov5695_power_on(ov5695); } -static int ov5695_runtime_suspend(struct device *dev) +static int __maybe_unused ov5695_runtime_suspend(struct device *dev) { struct i2c_client *client = to_i2c_client(dev); struct v4l2_subdev *sd = i2c_get_clientdata(client); @@ -1147,16 +1152,14 @@ if (fie->index >= ARRAY_SIZE(supported_modes)) return -EINVAL; - if (fie->code != MEDIA_BUS_FMT_SBGGR10_1X10) - return -EINVAL; - + fie->code = MEDIA_BUS_FMT_SBGGR10_1X10; fie->width = supported_modes[fie->index].width; fie->height = supported_modes[fie->index].height; fie->interval = supported_modes[fie->index].max_fps; return 0; } -static int ov5695_g_mbus_config(struct v4l2_subdev *sd, +static int ov5695_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, struct v4l2_mbus_config *config) { u32 val = 0; @@ -1164,7 +1167,7 @@ val = 1 << (OV5695_LANES - 1) | V4L2_MBUS_CSI2_CHANNEL_0 | V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; - config->type = V4L2_MBUS_CSI2; + config->type = V4L2_MBUS_CSI2_DPHY; config->flags = val; return 0; @@ -1192,7 +1195,6 @@ static const struct v4l2_subdev_video_ops ov5695_video_ops = { .s_stream = ov5695_s_stream, .g_frame_interval = ov5695_g_frame_interval, - .g_mbus_config = ov5695_g_mbus_config, }; static const struct v4l2_subdev_pad_ops ov5695_pad_ops = { @@ -1201,6 +1203,7 @@ .enum_frame_interval = ov5695_enum_frame_interval, .get_fmt = ov5695_get_fmt, .set_fmt = ov5695_set_fmt, + .get_mbus_config = ov5695_g_mbus_config, }; static const struct v4l2_subdev_ops ov5695_subdev_ops = { -- Gitblit v1.6.2