Lines Matching defs:ov13858

1029 struct ov13858 {
1051 #define to_ov13858(_sd) container_of(_sd, struct ov13858, sd)
1054 static int ov13858_read_reg(struct ov13858 *ov13858, u16 reg, u32 len,
1057 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1090 static int ov13858_write_reg(struct ov13858 *ov13858, u16 reg, u32 len,
1093 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1119 static int ov13858_write_regs(struct ov13858 *ov13858,
1122 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1127 ret = ov13858_write_reg(ov13858, regs[i].address, 1,
1142 static int ov13858_write_reg_list(struct ov13858 *ov13858,
1145 return ov13858_write_regs(ov13858, r_list->regs, r_list->num_of_regs);
1151 struct ov13858 *ov13858 = to_ov13858(sd);
1156 mutex_lock(&ov13858->mutex);
1159 try_fmt->width = ov13858->cur_mode->width;
1160 try_fmt->height = ov13858->cur_mode->height;
1165 mutex_unlock(&ov13858->mutex);
1170 static int ov13858_update_digital_gain(struct ov13858 *ov13858, u32 d_gain)
1174 ret = ov13858_write_reg(ov13858, OV13858_REG_B_MWB_GAIN,
1179 ret = ov13858_write_reg(ov13858, OV13858_REG_G_MWB_GAIN,
1184 ret = ov13858_write_reg(ov13858, OV13858_REG_R_MWB_GAIN,
1190 static int ov13858_enable_test_pattern(struct ov13858 *ov13858, u32 pattern)
1195 ret = ov13858_read_reg(ov13858, OV13858_REG_TEST_PATTERN,
1207 return ov13858_write_reg(ov13858, OV13858_REG_TEST_PATTERN,
1213 struct ov13858 *ov13858 = container_of(ctrl->handler,
1214 struct ov13858, ctrl_handler);
1215 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1223 max = ov13858->cur_mode->height + ctrl->val - 8;
1224 __v4l2_ctrl_modify_range(ov13858->exposure,
1225 ov13858->exposure->minimum,
1226 max, ov13858->exposure->step, max);
1240 ret = ov13858_write_reg(ov13858, OV13858_REG_ANALOG_GAIN,
1244 ret = ov13858_update_digital_gain(ov13858, ctrl->val);
1247 ret = ov13858_write_reg(ov13858, OV13858_REG_EXPOSURE,
1253 ret = ov13858_write_reg(ov13858, OV13858_REG_VTS,
1255 ov13858->cur_mode->height
1259 ret = ov13858_enable_test_pattern(ov13858, ctrl->val);
1317 static int ov13858_do_get_pad_format(struct ov13858 *ov13858,
1322 struct v4l2_subdev *sd = &ov13858->sd;
1328 ov13858_update_pad_format(ov13858->cur_mode, fmt);
1338 struct ov13858 *ov13858 = to_ov13858(sd);
1341 mutex_lock(&ov13858->mutex);
1342 ret = ov13858_do_get_pad_format(ov13858, cfg, fmt);
1343 mutex_unlock(&ov13858->mutex);
1353 struct ov13858 *ov13858 = to_ov13858(sd);
1362 mutex_lock(&ov13858->mutex);
1377 ov13858->cur_mode = mode;
1378 __v4l2_ctrl_s_ctrl(ov13858->link_freq, mode->link_freq_index);
1381 __v4l2_ctrl_s_ctrl_int64(ov13858->pixel_rate, pixel_rate);
1384 vblank_def = ov13858->cur_mode->vts_def -
1385 ov13858->cur_mode->height;
1386 vblank_min = ov13858->cur_mode->vts_min -
1387 ov13858->cur_mode->height;
1389 ov13858->vblank, vblank_min,
1390 OV13858_VTS_MAX - ov13858->cur_mode->height, 1,
1392 __v4l2_ctrl_s_ctrl(ov13858->vblank, vblank_def);
1395 - ov13858->cur_mode->width;
1396 __v4l2_ctrl_modify_range(ov13858->hblank, h_blank,
1400 mutex_unlock(&ov13858->mutex);
1413 static int ov13858_start_streaming(struct ov13858 *ov13858)
1415 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1420 ret = ov13858_write_reg(ov13858, OV13858_REG_SOFTWARE_RST,
1429 link_freq_index = ov13858->cur_mode->link_freq_index;
1431 ret = ov13858_write_reg_list(ov13858, reg_list);
1438 reg_list = &ov13858->cur_mode->reg_list;
1439 ret = ov13858_write_reg_list(ov13858, reg_list);
1446 ret = __v4l2_ctrl_handler_setup(ov13858->sd.ctrl_handler);
1450 return ov13858_write_reg(ov13858, OV13858_REG_MODE_SELECT,
1456 static int ov13858_stop_streaming(struct ov13858 *ov13858)
1458 return ov13858_write_reg(ov13858, OV13858_REG_MODE_SELECT,
1464 struct ov13858 *ov13858 = to_ov13858(sd);
1468 mutex_lock(&ov13858->mutex);
1469 if (ov13858->streaming == enable) {
1470 mutex_unlock(&ov13858->mutex);
1485 ret = ov13858_start_streaming(ov13858);
1489 ov13858_stop_streaming(ov13858);
1493 ov13858->streaming = enable;
1494 mutex_unlock(&ov13858->mutex);
1501 mutex_unlock(&ov13858->mutex);
1510 struct ov13858 *ov13858 = to_ov13858(sd);
1512 if (ov13858->streaming)
1513 ov13858_stop_streaming(ov13858);
1522 struct ov13858 *ov13858 = to_ov13858(sd);
1525 if (ov13858->streaming) {
1526 ret = ov13858_start_streaming(ov13858);
1534 ov13858_stop_streaming(ov13858);
1535 ov13858->streaming = false;
1540 static int ov13858_identify_module(struct ov13858 *ov13858)
1542 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1546 ret = ov13858_read_reg(ov13858, OV13858_REG_CHIP_ID,
1590 static int ov13858_init_controls(struct ov13858 *ov13858)
1592 struct i2c_client *client = v4l2_get_subdevdata(&ov13858->sd);
1604 ctrl_hdlr = &ov13858->ctrl_handler;
1609 mutex_init(&ov13858->mutex);
1610 ctrl_hdlr->lock = &ov13858->mutex;
1611 ov13858->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr,
1617 if (ov13858->link_freq)
1618 ov13858->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1623 ov13858->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &ov13858_ctrl_ops,
1628 mode = ov13858->cur_mode;
1631 ov13858->vblank = v4l2_ctrl_new_std(
1638 ov13858->hblank = v4l2_ctrl_new_std(
1641 if (ov13858->hblank)
1642 ov13858->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
1645 ov13858->exposure = v4l2_ctrl_new_std(
1680 ov13858->sd.ctrl_handler = ctrl_hdlr;
1686 mutex_destroy(&ov13858->mutex);
1691 static void ov13858_free_controls(struct ov13858 *ov13858)
1693 v4l2_ctrl_handler_free(ov13858->sd.ctrl_handler);
1694 mutex_destroy(&ov13858->mutex);
1700 struct ov13858 *ov13858;
1708 ov13858 = devm_kzalloc(&client->dev, sizeof(*ov13858), GFP_KERNEL);
1709 if (!ov13858)
1713 v4l2_i2c_subdev_init(&ov13858->sd, client, &ov13858_subdev_ops);
1716 ret = ov13858_identify_module(ov13858);
1723 ov13858->cur_mode = &supported_modes[0];
1725 ret = ov13858_init_controls(ov13858);
1730 ov13858->sd.internal_ops = &ov13858_internal_ops;
1731 ov13858->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
1732 ov13858->sd.entity.ops = &ov13858_subdev_entity_ops;
1733 ov13858->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
1736 ov13858->pad.flags = MEDIA_PAD_FL_SOURCE;
1737 ret = media_entity_pads_init(&ov13858->sd.entity, 1, &ov13858->pad);
1743 ret = v4l2_async_register_subdev_sensor_common(&ov13858->sd);
1758 media_entity_cleanup(&ov13858->sd.entity);
1761 ov13858_free_controls(ov13858);
1770 struct ov13858 *ov13858 = to_ov13858(sd);
1774 ov13858_free_controls(ov13858);
1782 {"ov13858", 0},
1803 .name = "ov13858",
1817 MODULE_DESCRIPTION("Omnivision ov13858 sensor driver");