.. | .. |
---|
841 | 841 | struct ov5695 *ov5695 = to_ov5695(sd); |
---|
842 | 842 | const struct ov5695_mode *mode = ov5695->cur_mode; |
---|
843 | 843 | |
---|
844 | | - mutex_lock(&ov5695->mutex); |
---|
845 | 844 | fi->interval = mode->max_fps; |
---|
846 | | - mutex_unlock(&ov5695->mutex); |
---|
847 | 845 | |
---|
848 | 846 | return 0; |
---|
849 | 847 | } |
---|
.. | .. |
---|
852 | 850 | struct rkmodule_inf *inf) |
---|
853 | 851 | { |
---|
854 | 852 | memset(inf, 0, sizeof(*inf)); |
---|
855 | | - strlcpy(inf->base.sensor, OV5695_NAME, sizeof(inf->base.sensor)); |
---|
856 | | - strlcpy(inf->base.module, ov5695->module_name, |
---|
| 853 | + strscpy(inf->base.sensor, OV5695_NAME, sizeof(inf->base.sensor)); |
---|
| 854 | + strscpy(inf->base.module, ov5695->module_name, |
---|
857 | 855 | sizeof(inf->base.module)); |
---|
858 | | - strlcpy(inf->base.lens, ov5695->len_name, sizeof(inf->base.lens)); |
---|
| 856 | + strscpy(inf->base.lens, ov5695->len_name, sizeof(inf->base.lens)); |
---|
859 | 857 | } |
---|
860 | 858 | |
---|
861 | 859 | static long ov5695_ioctl(struct v4l2_subdev *sd, unsigned int cmd, void *arg) |
---|
.. | .. |
---|
906 | 904 | } |
---|
907 | 905 | |
---|
908 | 906 | ret = ov5695_ioctl(sd, cmd, inf); |
---|
909 | | - if (!ret) |
---|
| 907 | + if (!ret) { |
---|
910 | 908 | ret = copy_to_user(up, inf, sizeof(*inf)); |
---|
| 909 | + if (ret) |
---|
| 910 | + ret = -EFAULT; |
---|
| 911 | + } |
---|
911 | 912 | kfree(inf); |
---|
912 | 913 | break; |
---|
913 | 914 | case RKMODULE_AWB_CFG: |
---|
.. | .. |
---|
920 | 921 | ret = copy_from_user(cfg, up, sizeof(*cfg)); |
---|
921 | 922 | if (!ret) |
---|
922 | 923 | ret = ov5695_ioctl(sd, cmd, cfg); |
---|
| 924 | + else |
---|
| 925 | + ret = -EFAULT; |
---|
923 | 926 | kfree(cfg); |
---|
924 | 927 | break; |
---|
925 | 928 | case RKMODULE_SET_QUICK_STREAM: |
---|
926 | 929 | ret = copy_from_user(&stream, up, sizeof(u32)); |
---|
927 | 930 | if (!ret) |
---|
928 | 931 | ret = ov5695_ioctl(sd, cmd, &stream); |
---|
| 932 | + else |
---|
| 933 | + ret = -EFAULT; |
---|
929 | 934 | break; |
---|
930 | 935 | default: |
---|
931 | 936 | ret = -ENOIOCTLCMD; |
---|
.. | .. |
---|
1098 | 1103 | regulator_bulk_disable(OV5695_NUM_SUPPLIES, ov5695->supplies); |
---|
1099 | 1104 | } |
---|
1100 | 1105 | |
---|
1101 | | -static int ov5695_runtime_resume(struct device *dev) |
---|
| 1106 | +static int __maybe_unused ov5695_runtime_resume(struct device *dev) |
---|
1102 | 1107 | { |
---|
1103 | 1108 | struct i2c_client *client = to_i2c_client(dev); |
---|
1104 | 1109 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
---|
.. | .. |
---|
1107 | 1112 | return __ov5695_power_on(ov5695); |
---|
1108 | 1113 | } |
---|
1109 | 1114 | |
---|
1110 | | -static int ov5695_runtime_suspend(struct device *dev) |
---|
| 1115 | +static int __maybe_unused ov5695_runtime_suspend(struct device *dev) |
---|
1111 | 1116 | { |
---|
1112 | 1117 | struct i2c_client *client = to_i2c_client(dev); |
---|
1113 | 1118 | struct v4l2_subdev *sd = i2c_get_clientdata(client); |
---|
.. | .. |
---|
1147 | 1152 | if (fie->index >= ARRAY_SIZE(supported_modes)) |
---|
1148 | 1153 | return -EINVAL; |
---|
1149 | 1154 | |
---|
1150 | | - if (fie->code != MEDIA_BUS_FMT_SBGGR10_1X10) |
---|
1151 | | - return -EINVAL; |
---|
1152 | | - |
---|
| 1155 | + fie->code = MEDIA_BUS_FMT_SBGGR10_1X10; |
---|
1153 | 1156 | fie->width = supported_modes[fie->index].width; |
---|
1154 | 1157 | fie->height = supported_modes[fie->index].height; |
---|
1155 | 1158 | fie->interval = supported_modes[fie->index].max_fps; |
---|
1156 | 1159 | return 0; |
---|
1157 | 1160 | } |
---|
1158 | 1161 | |
---|
1159 | | -static int ov5695_g_mbus_config(struct v4l2_subdev *sd, |
---|
| 1162 | +static int ov5695_g_mbus_config(struct v4l2_subdev *sd, unsigned int pad_id, |
---|
1160 | 1163 | struct v4l2_mbus_config *config) |
---|
1161 | 1164 | { |
---|
1162 | 1165 | u32 val = 0; |
---|
.. | .. |
---|
1164 | 1167 | val = 1 << (OV5695_LANES - 1) | |
---|
1165 | 1168 | V4L2_MBUS_CSI2_CHANNEL_0 | |
---|
1166 | 1169 | V4L2_MBUS_CSI2_CONTINUOUS_CLOCK; |
---|
1167 | | - config->type = V4L2_MBUS_CSI2; |
---|
| 1170 | + config->type = V4L2_MBUS_CSI2_DPHY; |
---|
1168 | 1171 | config->flags = val; |
---|
1169 | 1172 | |
---|
1170 | 1173 | return 0; |
---|
.. | .. |
---|
1192 | 1195 | static const struct v4l2_subdev_video_ops ov5695_video_ops = { |
---|
1193 | 1196 | .s_stream = ov5695_s_stream, |
---|
1194 | 1197 | .g_frame_interval = ov5695_g_frame_interval, |
---|
1195 | | - .g_mbus_config = ov5695_g_mbus_config, |
---|
1196 | 1198 | }; |
---|
1197 | 1199 | |
---|
1198 | 1200 | static const struct v4l2_subdev_pad_ops ov5695_pad_ops = { |
---|
.. | .. |
---|
1201 | 1203 | .enum_frame_interval = ov5695_enum_frame_interval, |
---|
1202 | 1204 | .get_fmt = ov5695_get_fmt, |
---|
1203 | 1205 | .set_fmt = ov5695_set_fmt, |
---|
| 1206 | + .get_mbus_config = ov5695_g_mbus_config, |
---|
1204 | 1207 | }; |
---|
1205 | 1208 | |
---|
1206 | 1209 | static const struct v4l2_subdev_ops ov5695_subdev_ops = { |
---|