Lines Matching refs:ov08d10

68 #define to_ov08d10(_sd)		container_of(_sd, struct ov08d10, sd)
517 struct ov08d10 { struct
612 static u32 ov08d10_get_format_code(struct ov08d10 *ov08d10) in ov08d10_get_format_code() argument
619 return codes[ov08d10->vflip->val][ov08d10->hflip->val]; in ov08d10_get_format_code()
622 static unsigned int ov08d10_modes_num(const struct ov08d10 *ov08d10) in ov08d10_modes_num() argument
626 for (i = 0; i < ARRAY_SIZE(ov08d10->priv_lane->sp_modes); i++) { in ov08d10_modes_num()
627 if (ov08d10->priv_lane->sp_modes[i].width == 0) in ov08d10_modes_num()
655 static int ov08d10_write_reg_list(struct ov08d10 *ov08d10, in ov08d10_write_reg_list() argument
658 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_write_reg_list()
676 static int ov08d10_update_analog_gain(struct ov08d10 *ov08d10, u32 a_gain) in ov08d10_update_analog_gain() argument
678 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_update_analog_gain()
697 static int ov08d10_update_digital_gain(struct ov08d10 *ov08d10, u32 d_gain) in ov08d10_update_digital_gain() argument
699 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_update_digital_gain()
724 static int ov08d10_set_exposure(struct ov08d10 *ov08d10, u32 exposure) in ov08d10_set_exposure() argument
726 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_set_exposure()
732 cur_vts = ov08d10->cur_mode->vts_def; in ov08d10_set_exposure()
767 static int ov08d10_set_vblank(struct ov08d10 *ov08d10, u32 vblank) in ov08d10_set_vblank() argument
769 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_set_vblank()
793 static int ov08d10_test_pattern(struct ov08d10 *ov08d10, u32 pattern) in ov08d10_test_pattern() argument
795 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_test_pattern()
818 static int ov08d10_set_ctrl_flip(struct ov08d10 *ov08d10, u32 ctrl_val) in ov08d10_set_ctrl_flip() argument
820 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_set_ctrl_flip()
850 struct ov08d10 *ov08d10 = container_of(ctrl->handler, in ov08d10_set_ctrl() local
851 struct ov08d10, ctrl_handler); in ov08d10_set_ctrl()
852 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_set_ctrl()
859 exposure_max = ov08d10->cur_mode->height + ctrl->val - in ov08d10_set_ctrl()
861 __v4l2_ctrl_modify_range(ov08d10->exposure, in ov08d10_set_ctrl()
862 ov08d10->exposure->minimum, in ov08d10_set_ctrl()
863 exposure_max, ov08d10->exposure->step, in ov08d10_set_ctrl()
873 ret = ov08d10_update_analog_gain(ov08d10, ctrl->val); in ov08d10_set_ctrl()
877 ret = ov08d10_update_digital_gain(ov08d10, ctrl->val); in ov08d10_set_ctrl()
881 ret = ov08d10_set_exposure(ov08d10, ctrl->val); in ov08d10_set_ctrl()
885 ret = ov08d10_set_vblank(ov08d10, ctrl->val); in ov08d10_set_ctrl()
889 ret = ov08d10_test_pattern(ov08d10, ctrl->val); in ov08d10_set_ctrl()
894 ret = ov08d10_set_ctrl_flip(ov08d10, in ov08d10_set_ctrl()
895 ov08d10->hflip->val | in ov08d10_set_ctrl()
896 ov08d10->vflip->val << 1); in ov08d10_set_ctrl()
913 static int ov08d10_init_controls(struct ov08d10 *ov08d10) in ov08d10_init_controls() argument
925 ctrl_hdlr = &ov08d10->ctrl_handler; in ov08d10_init_controls()
930 ctrl_hdlr->lock = &ov08d10->mutex; in ov08d10_init_controls()
931 link_freq_size = ARRAY_SIZE(ov08d10->priv_lane->link_freq_menu); in ov08d10_init_controls()
932 ov08d10->link_freq = in ov08d10_init_controls()
937 ov08d10->priv_lane->link_freq_menu); in ov08d10_init_controls()
938 if (ov08d10->link_freq) in ov08d10_init_controls()
939 ov08d10->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; in ov08d10_init_controls()
941 pixel_rate_max = to_rate(ov08d10->priv_lane->link_freq_menu, 0, in ov08d10_init_controls()
942 ov08d10->cur_mode->data_lanes); in ov08d10_init_controls()
943 ov08d10->pixel_rate = in ov08d10_init_controls()
948 mode = ov08d10->cur_mode; in ov08d10_init_controls()
951 ov08d10->vblank = in ov08d10_init_controls()
957 h_blank = to_pixels_per_line(ov08d10->priv_lane->link_freq_menu, in ov08d10_init_controls()
961 ov08d10->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &ov08d10_ctrl_ops, in ov08d10_init_controls()
964 if (ov08d10->hblank) in ov08d10_init_controls()
965 ov08d10->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; in ov08d10_init_controls()
976 ov08d10->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &ov08d10_ctrl_ops, in ov08d10_init_controls()
988 ov08d10->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov08d10_ctrl_ops, in ov08d10_init_controls()
990 if (ov08d10->hflip) in ov08d10_init_controls()
991 ov08d10->hflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT; in ov08d10_init_controls()
992 ov08d10->vflip = v4l2_ctrl_new_std(ctrl_hdlr, &ov08d10_ctrl_ops, in ov08d10_init_controls()
994 if (ov08d10->vflip) in ov08d10_init_controls()
995 ov08d10->vflip->flags |= V4L2_CTRL_FLAG_MODIFY_LAYOUT; in ov08d10_init_controls()
1000 ov08d10->sd.ctrl_handler = ctrl_hdlr; in ov08d10_init_controls()
1005 static void ov08d10_update_pad_format(struct ov08d10 *ov08d10, in ov08d10_update_pad_format() argument
1011 fmt->code = ov08d10_get_format_code(ov08d10); in ov08d10_update_pad_format()
1015 static int ov08d10_start_streaming(struct ov08d10 *ov08d10) in ov08d10_start_streaming() argument
1017 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_start_streaming()
1021 link_freq_index = ov08d10->cur_mode->link_freq_index; in ov08d10_start_streaming()
1023 &ov08d10->priv_lane->link_freq_configs[link_freq_index].reg_list; in ov08d10_start_streaming()
1044 ret = ov08d10_write_reg_list(ov08d10, reg_list); in ov08d10_start_streaming()
1050 reg_list = &ov08d10->cur_mode->reg_list; in ov08d10_start_streaming()
1051 ret = ov08d10_write_reg_list(ov08d10, reg_list); in ov08d10_start_streaming()
1057 ret = __v4l2_ctrl_handler_setup(ov08d10->sd.ctrl_handler); in ov08d10_start_streaming()
1073 static void ov08d10_stop_streaming(struct ov08d10 *ov08d10) in ov08d10_stop_streaming() argument
1075 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_stop_streaming()
1099 struct ov08d10 *ov08d10 = to_ov08d10(sd); in ov08d10_set_stream() local
1103 mutex_lock(&ov08d10->mutex); in ov08d10_set_stream()
1107 mutex_unlock(&ov08d10->mutex); in ov08d10_set_stream()
1111 ret = ov08d10_start_streaming(ov08d10); in ov08d10_set_stream()
1114 ov08d10_stop_streaming(ov08d10); in ov08d10_set_stream()
1118 ov08d10_stop_streaming(ov08d10); in ov08d10_set_stream()
1123 __v4l2_ctrl_grab(ov08d10->vflip, enable); in ov08d10_set_stream()
1124 __v4l2_ctrl_grab(ov08d10->hflip, enable); in ov08d10_set_stream()
1126 mutex_unlock(&ov08d10->mutex); in ov08d10_set_stream()
1135 struct ov08d10 *ov08d10 = to_ov08d10(sd); in ov08d10_set_format() local
1140 mode = v4l2_find_nearest_size(ov08d10->priv_lane->sp_modes, in ov08d10_set_format()
1141 ov08d10->modes_size, in ov08d10_set_format()
1145 mutex_lock(&ov08d10->mutex); in ov08d10_set_format()
1146 ov08d10_update_pad_format(ov08d10, mode, &fmt->format); in ov08d10_set_format()
1151 ov08d10->cur_mode = mode; in ov08d10_set_format()
1152 __v4l2_ctrl_s_ctrl(ov08d10->link_freq, mode->link_freq_index); in ov08d10_set_format()
1153 pixel_rate = to_rate(ov08d10->priv_lane->link_freq_menu, in ov08d10_set_format()
1155 ov08d10->cur_mode->data_lanes); in ov08d10_set_format()
1156 __v4l2_ctrl_s_ctrl_int64(ov08d10->pixel_rate, pixel_rate); in ov08d10_set_format()
1160 __v4l2_ctrl_modify_range(ov08d10->vblank, in ov08d10_set_format()
1164 __v4l2_ctrl_s_ctrl(ov08d10->vblank, vblank_def); in ov08d10_set_format()
1165 h_blank = to_pixels_per_line(ov08d10->priv_lane->link_freq_menu, in ov08d10_set_format()
1168 ov08d10->cur_mode->data_lanes) in ov08d10_set_format()
1170 __v4l2_ctrl_modify_range(ov08d10->hblank, h_blank, h_blank, 1, in ov08d10_set_format()
1174 mutex_unlock(&ov08d10->mutex); in ov08d10_set_format()
1183 struct ov08d10 *ov08d10 = to_ov08d10(sd); in ov08d10_get_format() local
1185 mutex_lock(&ov08d10->mutex); in ov08d10_get_format()
1190 ov08d10_update_pad_format(ov08d10, ov08d10->cur_mode, in ov08d10_get_format()
1193 mutex_unlock(&ov08d10->mutex); in ov08d10_get_format()
1202 struct ov08d10 *ov08d10 = to_ov08d10(sd); in ov08d10_enum_mbus_code() local
1207 mutex_lock(&ov08d10->mutex); in ov08d10_enum_mbus_code()
1208 code->code = ov08d10_get_format_code(ov08d10); in ov08d10_enum_mbus_code()
1209 mutex_unlock(&ov08d10->mutex); in ov08d10_enum_mbus_code()
1218 struct ov08d10 *ov08d10 = to_ov08d10(sd); in ov08d10_enum_frame_size() local
1220 if (fse->index >= ov08d10->modes_size) in ov08d10_enum_frame_size()
1223 mutex_lock(&ov08d10->mutex); in ov08d10_enum_frame_size()
1224 if (fse->code != ov08d10_get_format_code(ov08d10)) { in ov08d10_enum_frame_size()
1225 mutex_unlock(&ov08d10->mutex); in ov08d10_enum_frame_size()
1228 mutex_unlock(&ov08d10->mutex); in ov08d10_enum_frame_size()
1230 fse->min_width = ov08d10->priv_lane->sp_modes[fse->index].width; in ov08d10_enum_frame_size()
1232 fse->min_height = ov08d10->priv_lane->sp_modes[fse->index].height; in ov08d10_enum_frame_size()
1240 struct ov08d10 *ov08d10 = to_ov08d10(sd); in ov08d10_open() local
1242 mutex_lock(&ov08d10->mutex); in ov08d10_open()
1243 ov08d10_update_pad_format(ov08d10, &ov08d10->priv_lane->sp_modes[0], in ov08d10_open()
1245 mutex_unlock(&ov08d10->mutex); in ov08d10_open()
1270 static int ov08d10_identify_module(struct ov08d10 *ov08d10) in ov08d10_identify_module() argument
1272 struct i2c_client *client = v4l2_get_subdevdata(&ov08d10->sd); in ov08d10_identify_module()
1304 static int ov08d10_get_hwcfg(struct ov08d10 *ov08d10, struct device *dev) in ov08d10_get_hwcfg() argument
1343 dev_dbg(dev, "Using %u data lanes\n", ov08d10->cur_mode->data_lanes); in ov08d10_get_hwcfg()
1345 ov08d10->priv_lane = &lane_cfg_2; in ov08d10_get_hwcfg()
1346 ov08d10->modes_size = ov08d10_modes_num(ov08d10); in ov08d10_get_hwcfg()
1354 for (i = 0; i < ARRAY_SIZE(ov08d10->priv_lane->link_freq_menu); i++) { in ov08d10_get_hwcfg()
1356 if (ov08d10->priv_lane->link_freq_menu[i] == in ov08d10_get_hwcfg()
1363 ov08d10->priv_lane->link_freq_menu[i]); in ov08d10_get_hwcfg()
1378 struct ov08d10 *ov08d10 = to_ov08d10(sd); in ov08d10_remove() local
1384 mutex_destroy(&ov08d10->mutex); in ov08d10_remove()
1389 struct ov08d10 *ov08d10; in ov08d10_probe() local
1392 ov08d10 = devm_kzalloc(&client->dev, sizeof(*ov08d10), GFP_KERNEL); in ov08d10_probe()
1393 if (!ov08d10) in ov08d10_probe()
1396 ret = ov08d10_get_hwcfg(ov08d10, &client->dev); in ov08d10_probe()
1403 v4l2_i2c_subdev_init(&ov08d10->sd, client, &ov08d10_subdev_ops); in ov08d10_probe()
1405 ret = ov08d10_identify_module(ov08d10); in ov08d10_probe()
1411 mutex_init(&ov08d10->mutex); in ov08d10_probe()
1412 ov08d10->cur_mode = &ov08d10->priv_lane->sp_modes[0]; in ov08d10_probe()
1413 ret = ov08d10_init_controls(ov08d10); in ov08d10_probe()
1419 ov08d10->sd.internal_ops = &ov08d10_internal_ops; in ov08d10_probe()
1420 ov08d10->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE; in ov08d10_probe()
1421 ov08d10->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR; in ov08d10_probe()
1422 ov08d10->pad.flags = MEDIA_PAD_FL_SOURCE; in ov08d10_probe()
1423 ret = media_entity_pads_init(&ov08d10->sd.entity, 1, &ov08d10->pad); in ov08d10_probe()
1429 ret = v4l2_async_register_subdev_sensor(&ov08d10->sd); in ov08d10_probe()
1447 media_entity_cleanup(&ov08d10->sd.entity); in ov08d10_probe()
1450 v4l2_ctrl_handler_free(ov08d10->sd.ctrl_handler); in ov08d10_probe()
1451 mutex_destroy(&ov08d10->mutex); in ov08d10_probe()