unsigned int delay_ms;
};
+enum ov10635_frame_rate {
+ OV10635_15_FPS,
+ OV10635_30_FPS,
+};
+
static struct reg_value ov10635_init_data[] = {
{ 0x0103, 0x01, 0 },
{ 0x300c, 0x61, 0 },
switch (a->type) {
/* This is the only case currently handled. */
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
memset(a, 0, sizeof(*a));
a->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
cparm->capability = max9286_data->streamcap.capability;
*/
static int max9286_s_parm(struct v4l2_subdev *sd, struct v4l2_streamparm *a)
{
+ struct sensor_data *max9286_data = subdev_to_sensor_data(sd);
+ struct v4l2_fract *timeperframe = &a->parm.capture.timeperframe;
+ enum ov10635_frame_rate frame_rate;
+ u32 tgt_fps;
int ret = 0;
switch (a->type) {
/* This is the only case currently handled. */
case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ /* Check that the new frame rate is allowed. */
+ if ((timeperframe->numerator == 0) ||
+ (timeperframe->denominator == 0)) {
+ timeperframe->denominator = DEFAULT_FPS;
+ timeperframe->numerator = 1;
+ }
+
+ tgt_fps = timeperframe->denominator /
+ timeperframe->numerator;
+
+ if (tgt_fps > MAX_FPS) {
+ timeperframe->denominator = MAX_FPS;
+ timeperframe->numerator = 1;
+ } else if (tgt_fps < MIN_FPS) {
+ timeperframe->denominator = MIN_FPS;
+ timeperframe->numerator = 1;
+ }
+
+ /* Actual frame rate we use */
+ tgt_fps = timeperframe->denominator /
+ timeperframe->numerator;
+
+ if (tgt_fps == 15)
+ frame_rate = OV10635_15_FPS;
+ else if (tgt_fps == 30)
+ frame_rate = OV10635_30_FPS;
+ else {
+ pr_err(" The camera frame rate is not supported!\n");
+ return -EINVAL;
+ }
+
+ /* TODO Reserved to extension */
+
+ max9286_data->streamcap.timeperframe = *timeperframe;
+ max9286_data->streamcap.capturemode = a->parm.capture.capturemode;
+
+
break;
/* These are all the possible cases. */
return 0;
}
+static int mxc_isi_cap_g_parm(struct file *file, void *fh,
+ struct v4l2_streamparm *a)
+{
+ struct mxc_isi_dev *mxc_isi = video_drvdata(file);
+ struct v4l2_device *v4l2_dev = mxc_isi->isi_cap.sd.v4l2_dev;
+ struct v4l2_subdev *sd;
+
+ sd = mxc_isi_get_subdev_by_name(v4l2_dev, "max9286_mipi");
+ if (sd == NULL) {
+ v4l2_err(&mxc_isi->isi_cap.sd, "Can't find subdev\n");
+ return -ENODEV;
+ }
+ return v4l2_subdev_call(sd, video, g_parm, a);
+}
+
+static int mxc_isi_cap_s_parm(struct file *file, void *fh,
+ struct v4l2_streamparm *a)
+{
+ struct mxc_isi_dev *mxc_isi = video_drvdata(file);
+ struct v4l2_device *v4l2_dev = mxc_isi->isi_cap.sd.v4l2_dev;
+ struct v4l2_subdev *sd;
+
+ sd = mxc_isi_get_subdev_by_name(v4l2_dev, "max9286_mipi");
+ if (sd == NULL) {
+ v4l2_err(&mxc_isi->isi_cap.sd, "Can't find subdev\n");
+ return -ENODEV;
+ }
+ return v4l2_subdev_call(sd, video, s_parm, a);
+}
+
static const struct v4l2_ioctl_ops mxc_isi_capture_ioctl_ops = {
.vidioc_querycap = mxc_isi_cap_querycap,
.vidioc_g_selection = mxc_isi_cap_g_selection,
.vidioc_s_selection = mxc_isi_cap_s_selection,
.vidioc_g_chip_ident = mxc_isi_cap_g_chip_ident,
+
+ .vidioc_g_parm = mxc_isi_cap_g_parm,
+ .vidioc_s_parm = mxc_isi_cap_s_parm,
};
/* Capture subdev media entity operations */