Lines Matching defs:ov13858

1030 struct ov13858 {
1052 #define to_ov13858(_sd) container_of(_sd, struct ov13858, sd)
1055 static int ov13858_read_reg(struct ov13858 *ov13858, u16 reg, u32 len,
1058 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1091 static int ov13858_write_reg(struct ov13858 *ov13858, u16 reg, u32 len,
1094 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1120 static int ov13858_write_regs(struct ov13858 *ov13858,
1123 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1128 ret = ov13858_write_reg(ov13858, regs[i].address, 1,
1143 static int ov13858_write_reg_list(struct ov13858 *ov13858,
1146 return ov13858_write_regs(ov13858, r_list->regs, r_list->num_of_regs);
1152 struct ov13858 *ov13858 = to_ov13858(sd);
1157 mutex_lock(&ov13858->mutex);
1160 try_fmt->width = ov13858->cur_mode->width;
1161 try_fmt->height = ov13858->cur_mode->height;
1166 mutex_unlock(&ov13858->mutex);
1171 static int ov13858_update_digital_gain(struct ov13858 *ov13858, u32 d_gain)
1175 ret = ov13858_write_reg(ov13858, OV13858_REG_B_MWB_GAIN,
1180 ret = ov13858_write_reg(ov13858, OV13858_REG_G_MWB_GAIN,
1185 ret = ov13858_write_reg(ov13858, OV13858_REG_R_MWB_GAIN,
1191 static int ov13858_enable_test_pattern(struct ov13858 *ov13858, u32 pattern)
1196 ret = ov13858_read_reg(ov13858, OV13858_REG_TEST_PATTERN,
1208 return ov13858_write_reg(ov13858, OV13858_REG_TEST_PATTERN,
1214 struct ov13858 *ov13858 = container_of(ctrl->handler,
1215 struct ov13858, ctrl_handler);
1216 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1224 max = ov13858->cur_mode->height + ctrl->val - 8;
1225 __v4l2_ctrl_modify_range(ov13858->exposure,
1226 ov13858->exposure->minimum,
1227 max, ov13858->exposure->step, max);
1241 ret = ov13858_write_reg(ov13858, OV13858_REG_ANALOG_GAIN,
1245 ret = ov13858_update_digital_gain(ov13858, ctrl->val);
1248 ret = ov13858_write_reg(ov13858, OV13858_REG_EXPOSURE,
1254 ret = ov13858_write_reg(ov13858, OV13858_REG_VTS,
1256 ov13858->cur_mode->height
1260 ret = ov13858_enable_test_pattern(ov13858, ctrl->val);
1318 static int ov13858_do_get_pad_format(struct ov13858 *ov13858,
1323 struct v4l2_subdev *sd = &ov13858->sd;
1329 ov13858_update_pad_format(ov13858->cur_mode, fmt);
1339 struct ov13858 *ov13858 = to_ov13858(sd);
1342 mutex_lock(&ov13858->mutex);
1343 ret = ov13858_do_get_pad_format(ov13858, sd_state, fmt);
1344 mutex_unlock(&ov13858->mutex);
1354 struct ov13858 *ov13858 = to_ov13858(sd);
1363 mutex_lock(&ov13858->mutex);
1378 ov13858->cur_mode = mode;
1379 __v4l2_ctrl_s_ctrl(ov13858->link_freq, mode->link_freq_index);
1382 __v4l2_ctrl_s_ctrl_int64(ov13858->pixel_rate, pixel_rate);
1385 vblank_def = ov13858->cur_mode->vts_def -
1386 ov13858->cur_mode->height;
1387 vblank_min = ov13858->cur_mode->vts_min -
1388 ov13858->cur_mode->height;
1390 ov13858->vblank, vblank_min,
1391 OV13858_VTS_MAX - ov13858->cur_mode->height, 1,
1393 __v4l2_ctrl_s_ctrl(ov13858->vblank, vblank_def);
1396 - ov13858->cur_mode->width;
1397 __v4l2_ctrl_modify_range(ov13858->hblank, h_blank,
1401 mutex_unlock(&ov13858->mutex);
1414 static int ov13858_start_streaming(struct ov13858 *ov13858)
1416 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1421 ret = ov13858_write_reg(ov13858, OV13858_REG_SOFTWARE_RST,
1430 link_freq_index = ov13858->cur_mode->link_freq_index;
1432 ret = ov13858_write_reg_list(ov13858, reg_list);
1439 reg_list = &ov13858->cur_mode->reg_list;
1440 ret = ov13858_write_reg_list(ov13858, reg_list);
1447 ret = __v4l2_ctrl_handler_setup(ov13858->sd.ctrl_handler);
1451 return ov13858_write_reg(ov13858, OV13858_REG_MODE_SELECT,
1457 static int ov13858_stop_streaming(struct ov13858 *ov13858)
1459 return ov13858_write_reg(ov13858, OV13858_REG_MODE_SELECT,
1465 struct ov13858 *ov13858 = to_ov13858(sd);
1469 mutex_lock(&ov13858->mutex);
1470 if (ov13858->streaming == enable) {
1471 mutex_unlock(&ov13858->mutex);
1484 ret = ov13858_start_streaming(ov13858);
1488 ov13858_stop_streaming(ov13858);
1492 ov13858->streaming = enable;
1493 mutex_unlock(&ov13858->mutex);
1500 mutex_unlock(&ov13858->mutex);
1508 struct ov13858 *ov13858 = to_ov13858(sd);
1510 if (ov13858->streaming)
1511 ov13858_stop_streaming(ov13858);
1519 struct ov13858 *ov13858 = to_ov13858(sd);
1522 if (ov13858->streaming) {
1523 ret = ov13858_start_streaming(ov13858);
1531 ov13858_stop_streaming(ov13858);
1532 ov13858->streaming = false;
1537 static int ov13858_identify_module(struct ov13858 *ov13858)
1539 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1543 ret = ov13858_read_reg(ov13858, OV13858_REG_CHIP_ID,
1594 static int ov13858_init_controls(struct ov13858 *ov13858)
1596 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1608 ctrl_hdlr = &ov13858->ctrl_handler;
1613 mutex_init(&ov13858->mutex);
1614 ctrl_hdlr->lock = &ov13858->mutex;
1615 ov13858->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr,
1621 if (ov13858->link_freq)
1622 ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1627 ov13858->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov13858_ctrl_ops,
1632 mode = ov13858->cur_mode;
1635 ov13858->vblank = v4l2_ctrl_new_std(
1642 ov13858->hblank = v4l2_ctrl_new_std(
1645 if (ov13858->hblank)
1646 ov13858->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1649 ov13858->exposure = v4l2_ctrl_new_std(
1684 ov13858->sd.ctrl_handler = ctrl_hdlr;
1690 mutex_destroy(&ov13858->mutex);
1695 static void ov13858_free_controls(struct ov13858 *ov13858)
1697 v4l2_ctrl_handler_free(ov13858->sd.ctrl_handler);
1698 mutex_destroy(&ov13858->mutex);
1703 struct ov13858 *ov13858;
1711 ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL);
1712 if (!ov13858)
1716 v4l2_i2c_subdev_init(&ov13858->sd, client, &ov13858_subdev_ops);
1719 ret = ov13858_identify_module(ov13858);
1726 ov13858->cur_mode = &supported_modes[0];
1728 ret = ov13858_init_controls(ov13858);
1733 ov13858->sd.internal_ops = &ov13858_internal_ops;
1734 ov13858->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
1736 ov13858->sd.entity.ops = &ov13858_subdev_entity_ops;
1737 ov13858->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
1740 ov13858->pad.flags = MEDIA_PAD_FL_SOURCE;
1741 ret = media_entity_pads_init(&ov13858->sd.entity, 1, &ov13858->pad);
1747 ret = v4l2_async_register_subdev_sensor(&ov13858->sd);
1762 media_entity_cleanup(&ov13858->sd.entity);
1765 ov13858_free_controls(ov13858);
1774 struct ov13858 *ov13858 = to_ov13858(sd);
1778 ov13858_free_controls(ov13858);
1784 {"ov13858", 0},
1805 .name = "ov13858",
1819 MODULE_DESCRIPTION("Omnivision ov13858 sensor driver");