hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/media/i2c/gc5035.c
....@@ -609,9 +609,7 @@
609609 struct gc5035 *gc5035 = to_gc5035(sd);
610610 const struct gc5035_mode *mode = gc5035->cur_mode;
611611
612
- mutex_lock(&gc5035->mutex);
613612 fi->interval = mode->max_fps;
614
- mutex_unlock(&gc5035->mutex);
615613
616614 return 0;
617615 }
....@@ -698,8 +696,11 @@
698696 }
699697
700698 ret = gc5035_ioctl(sd, cmd, inf);
701
- if (!ret)
699
+ if (!ret) {
702700 ret = copy_to_user(up, inf, sizeof(*inf));
701
+ if (ret)
702
+ ret = -EFAULT;
703
+ }
703704 kfree(inf);
704705 break;
705706 case RKMODULE_AWB_CFG:
....@@ -712,12 +713,17 @@
712713 ret = copy_from_user(cfg, up, sizeof(*cfg));
713714 if (!ret)
714715 ret = gc5035_ioctl(sd, cmd, cfg);
716
+ else
717
+ ret = -EFAULT;
715718 kfree(cfg);
716719 break;
717720 case RKMODULE_SET_QUICK_STREAM:
718721 ret = copy_from_user(&stream, up, sizeof(u32));
719722 if (!ret)
720723 ret = gc5035_ioctl(sd, cmd, &stream);
724
+ else
725
+ ret = -EFAULT;
726
+
721727 break;
722728 default:
723729 ret = -ENOTTY;
....@@ -956,8 +962,8 @@
956962 }
957963 #endif
958964
959
-static int sensor_g_mbus_config(struct v4l2_subdev *sd,
960
- struct v4l2_mbus_config *config)
965
+static int sensor_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id,
966
+ struct v4l2_mbus_config *config)
961967 {
962968 struct gc5035 *sensor = to_gc5035(sd);
963969 struct device *dev = &sensor->client->dev;
....@@ -965,7 +971,7 @@
965971 dev_info(dev, "%s(%d) enter!\n", __func__, __LINE__);
966972
967973 if (2 == sensor->lane_num) {
968
- config->type = V4L2_MBUS_CSI2;
974
+ config->type = V4L2_MBUS_CSI2_DPHY;
969975 config->flags = V4L2_MBUS_CSI2_2_LANE |
970976 V4L2_MBUS_CSI2_CHANNEL_0 |
971977 V4L2_MBUS_CSI2_CONTINUOUS_CLOCK;
....@@ -985,8 +991,7 @@
985991 if (fie->index >= gc5035->cfg_num)
986992 return -EINVAL;
987993
988
- if (fie->code != MEDIA_BUS_FMT_SRGGB10_1X10)
989
- return -EINVAL;
994
+ fie->code = MEDIA_BUS_FMT_SRGGB10_1X10;
990995
991996 fie->width = supported_modes[fie->index].width;
992997 fie->height = supported_modes[fie->index].height;
....@@ -1014,7 +1019,6 @@
10141019 };
10151020
10161021 static const struct v4l2_subdev_video_ops gc5035_video_ops = {
1017
- .g_mbus_config = sensor_g_mbus_config,
10181022 .s_stream = gc5035_s_stream,
10191023 .g_frame_interval = gc5035_g_frame_interval,
10201024 };
....@@ -1025,6 +1029,7 @@
10251029 .enum_frame_interval = gc5035_enum_frame_interval,
10261030 .get_fmt = gc5035_get_fmt,
10271031 .set_fmt = gc5035_set_fmt,
1032
+ .get_mbus_config = sensor_g_mbus_config,
10281033 };
10291034
10301035 static const struct v4l2_subdev_ops gc5035_subdev_ops = {
....@@ -1039,8 +1044,8 @@
10391044
10401045 dev_info(&gc5035->client->dev, "Test Pattern!!\n");
10411046 ret = gc5035_write_reg(gc5035->client, 0xfe, 0x01);
1042
- ret = gc5035_write_reg(gc5035->client, 0x8c, value);
1043
- ret = gc5035_write_reg(gc5035->client, 0xfe, 0x00);
1047
+ ret |= gc5035_write_reg(gc5035->client, 0x8c, value);
1048
+ ret |= gc5035_write_reg(gc5035->client, 0xfe, 0x00);
10441049 return ret;
10451050 }
10461051