struct v4l2_ctrl *test_pattern;
};
+struct ov2680_mode {
+ struct v4l2_mbus_framefmt fmt;
+ struct v4l2_fract frame_interval;
+};
+
struct ov2680_dev {
struct device *dev;
struct regmap *regmap;
bool is_streaming;
struct ov2680_ctrls ctrls;
- struct v4l2_mbus_framefmt fmt;
- struct v4l2_fract frame_interval;
+ struct ov2680_mode mode;
const struct ov2680_mode_info *current_mode;
};
if (ret < 0)
return ret;
- ov2680_set_bayer_order(sensor, &sensor->fmt);
+ ov2680_set_bayer_order(sensor, &sensor->mode.fmt);
return 0;
}
if (ret < 0)
return ret;
- ov2680_set_bayer_order(sensor, &sensor->fmt);
+ ov2680_set_bayer_order(sensor, &sensor->mode.fmt);
return 0;
}
struct ov2680_dev *sensor = to_ov2680_dev(sd);
mutex_lock(&sensor->lock);
- fi->interval = sensor->frame_interval;
+ fi->interval = sensor->mode.frame_interval;
mutex_unlock(&sensor->lock);
return 0;
if (code->pad != 0 || code->index != 0)
return -EINVAL;
- code->code = sensor->fmt.code;
+ code->code = sensor->mode.fmt.code;
return 0;
}
fmt = v4l2_subdev_get_try_format(&sensor->sd, sd_state,
format->pad);
} else {
- fmt = &sensor->fmt;
+ fmt = &sensor->mode.fmt;
}
format->format = *fmt;
}
sensor->current_mode = mode;
- sensor->fmt = format->format;
+ sensor->mode.fmt = format->format;
unlock:
mutex_unlock(&sensor->lock);
if (fie->index || !ov2680_valid_frame_size(fie))
return -EINVAL;
- fie->interval = sensor->frame_interval;
+ fie->interval = sensor->mode.frame_interval;
return 0;
}
/* Only apply changes to the controls if the device is powered up */
if (!pm_runtime_get_if_in_use(sensor->sd.dev)) {
- ov2680_set_bayer_order(sensor, &sensor->fmt);
+ ov2680_set_bayer_order(sensor, &sensor->mode.fmt);
return 0;
}
const struct ov2680_mode_info *init_mode;
/* set initial mode */
- ov2680_fill_format(sensor, &sensor->fmt,
+ ov2680_fill_format(sensor, &sensor->mode.fmt,
OV2680_DEFAULT_WIDTH, OV2680_DEFAULT_HEIGHT);
- sensor->frame_interval.denominator = OV2680_FRAME_RATE;
- sensor->frame_interval.numerator = 1;
+ sensor->mode.frame_interval.denominator = OV2680_FRAME_RATE;
+ sensor->mode.frame_interval.numerator = 1;
init_mode = &ov2680_mode_init_data;