ov2685            103 drivers/media/i2c/ov2685.c #define to_ov2685(sd) container_of(sd, struct ov2685, subdev)
ov2685            334 drivers/media/i2c/ov2685.c 	struct ov2685 *ov2685 = to_ov2685(sd);
ov2685            338 drivers/media/i2c/ov2685.c 	ov2685_fill_fmt(ov2685->cur_mode, mbus_fmt);
ov2685            347 drivers/media/i2c/ov2685.c 	struct ov2685 *ov2685 = to_ov2685(sd);
ov2685            350 drivers/media/i2c/ov2685.c 	ov2685_fill_fmt(ov2685->cur_mode, mbus_fmt);
ov2685            392 drivers/media/i2c/ov2685.c static int __ov2685_power_on(struct ov2685 *ov2685)
ov2685            396 drivers/media/i2c/ov2685.c 	struct device *dev = &ov2685->client->dev;
ov2685            398 drivers/media/i2c/ov2685.c 	ret = clk_prepare_enable(ov2685->xvclk);
ov2685            404 drivers/media/i2c/ov2685.c 	gpiod_set_value_cansleep(ov2685->reset_gpio, 1);
ov2685            406 drivers/media/i2c/ov2685.c 	ret = regulator_bulk_enable(OV2685_NUM_SUPPLIES, ov2685->supplies);
ov2685            413 drivers/media/i2c/ov2685.c 	gpiod_set_value_cansleep(ov2685->reset_gpio, 0);
ov2685            421 drivers/media/i2c/ov2685.c 	ret = ov2685_write_array(ov2685->client, ov2685->cur_mode->reg_list);
ov2685            428 drivers/media/i2c/ov2685.c 	regulator_bulk_disable(OV2685_NUM_SUPPLIES, ov2685->supplies);
ov2685            430 drivers/media/i2c/ov2685.c 	clk_disable_unprepare(ov2685->xvclk);
ov2685            435 drivers/media/i2c/ov2685.c static void __ov2685_power_off(struct ov2685 *ov2685)
ov2685            441 drivers/media/i2c/ov2685.c 	clk_disable_unprepare(ov2685->xvclk);
ov2685            442 drivers/media/i2c/ov2685.c 	gpiod_set_value_cansleep(ov2685->reset_gpio, 1);
ov2685            443 drivers/media/i2c/ov2685.c 	regulator_bulk_disable(OV2685_NUM_SUPPLIES, ov2685->supplies);
ov2685            448 drivers/media/i2c/ov2685.c 	struct ov2685 *ov2685 = to_ov2685(sd);
ov2685            449 drivers/media/i2c/ov2685.c 	struct i2c_client *client = ov2685->client;
ov2685            452 drivers/media/i2c/ov2685.c 	mutex_lock(&ov2685->mutex);
ov2685            455 drivers/media/i2c/ov2685.c 	if (on == ov2685->streaming)
ov2685            459 drivers/media/i2c/ov2685.c 		ret = pm_runtime_get_sync(&ov2685->client->dev);
ov2685            464 drivers/media/i2c/ov2685.c 		ret = __v4l2_ctrl_handler_setup(&ov2685->ctrl_handler);
ov2685            478 drivers/media/i2c/ov2685.c 		pm_runtime_put(&ov2685->client->dev);
ov2685            481 drivers/media/i2c/ov2685.c 	ov2685->streaming = on;
ov2685            484 drivers/media/i2c/ov2685.c 	mutex_unlock(&ov2685->mutex);
ov2685            492 drivers/media/i2c/ov2685.c 	struct ov2685 *ov2685 = to_ov2685(sd);
ov2685            495 drivers/media/i2c/ov2685.c 	mutex_lock(&ov2685->mutex);
ov2685            501 drivers/media/i2c/ov2685.c 	mutex_unlock(&ov2685->mutex);
ov2685            511 drivers/media/i2c/ov2685.c 	struct ov2685 *ov2685 = to_ov2685(sd);
ov2685            513 drivers/media/i2c/ov2685.c 	return __ov2685_power_on(ov2685);
ov2685            520 drivers/media/i2c/ov2685.c 	struct ov2685 *ov2685 = to_ov2685(sd);
ov2685            522 drivers/media/i2c/ov2685.c 	__ov2685_power_off(ov2685);
ov2685            534 drivers/media/i2c/ov2685.c 	struct ov2685 *ov2685 = container_of(ctrl->handler,
ov2685            535 drivers/media/i2c/ov2685.c 					     struct ov2685, ctrl_handler);
ov2685            536 drivers/media/i2c/ov2685.c 	struct i2c_client *client = ov2685->client;
ov2685            544 drivers/media/i2c/ov2685.c 		max_expo = ov2685->cur_mode->height + ctrl->val - 4;
ov2685            545 drivers/media/i2c/ov2685.c 		__v4l2_ctrl_modify_range(ov2685->exposure,
ov2685            546 drivers/media/i2c/ov2685.c 					 ov2685->exposure->minimum, max_expo,
ov2685            547 drivers/media/i2c/ov2685.c 					 ov2685->exposure->step,
ov2685            548 drivers/media/i2c/ov2685.c 					 ov2685->exposure->default_value);
ov2685            557 drivers/media/i2c/ov2685.c 		ret = ov2685_write_reg(ov2685->client, OV2685_REG_EXPOSURE,
ov2685            561 drivers/media/i2c/ov2685.c 		ret = ov2685_write_reg(ov2685->client, OV2685_REG_GAIN,
ov2685            565 drivers/media/i2c/ov2685.c 		ret = ov2685_write_reg(ov2685->client, OV2685_REG_VTS,
ov2685            567 drivers/media/i2c/ov2685.c 				       ctrl->val + ov2685->cur_mode->height);
ov2685            570 drivers/media/i2c/ov2685.c 		ret = ov2685_write_reg(ov2685->client, OV2685_REG_TEST_PATTERN,
ov2685            612 drivers/media/i2c/ov2685.c static int ov2685_initialize_controls(struct ov2685 *ov2685)
ov2685            621 drivers/media/i2c/ov2685.c 	handler = &ov2685->ctrl_handler;
ov2685            622 drivers/media/i2c/ov2685.c 	mode = ov2685->cur_mode;
ov2685            626 drivers/media/i2c/ov2685.c 	handler->lock = &ov2685->mutex;
ov2685            639 drivers/media/i2c/ov2685.c 	ov2685->hblank = v4l2_ctrl_new_std(handler, NULL, V4L2_CID_HBLANK,
ov2685            641 drivers/media/i2c/ov2685.c 	if (ov2685->hblank)
ov2685            642 drivers/media/i2c/ov2685.c 		ov2685->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY;
ov2685            644 drivers/media/i2c/ov2685.c 	ov2685->vblank = v4l2_ctrl_new_std(handler, &ov2685_ctrl_ops,
ov2685            650 drivers/media/i2c/ov2685.c 	ov2685->exposure = v4l2_ctrl_new_std(handler, &ov2685_ctrl_ops,
ov2685            655 drivers/media/i2c/ov2685.c 	ov2685->anal_gain = v4l2_ctrl_new_std(handler, &ov2685_ctrl_ops,
ov2685            660 drivers/media/i2c/ov2685.c 	ov2685->test_pattern = v4l2_ctrl_new_std_menu_items(handler,
ov2685            667 drivers/media/i2c/ov2685.c 		dev_err(&ov2685->client->dev,
ov2685            672 drivers/media/i2c/ov2685.c 	ov2685->subdev.ctrl_handler = handler;
ov2685            682 drivers/media/i2c/ov2685.c static int ov2685_check_sensor_id(struct ov2685 *ov2685,
ov2685            685 drivers/media/i2c/ov2685.c 	struct device *dev = &ov2685->client->dev;
ov2685            701 drivers/media/i2c/ov2685.c static int ov2685_configure_regulators(struct ov2685 *ov2685)
ov2685            706 drivers/media/i2c/ov2685.c 		ov2685->supplies[i].supply = ov2685_supply_names[i];
ov2685            708 drivers/media/i2c/ov2685.c 	return devm_regulator_bulk_get(&ov2685->client->dev,
ov2685            710 drivers/media/i2c/ov2685.c 				       ov2685->supplies);
ov2685            717 drivers/media/i2c/ov2685.c 	struct ov2685 *ov2685;
ov2685            720 drivers/media/i2c/ov2685.c 	ov2685 = devm_kzalloc(dev, sizeof(*ov2685), GFP_KERNEL);
ov2685            721 drivers/media/i2c/ov2685.c 	if (!ov2685)
ov2685            724 drivers/media/i2c/ov2685.c 	ov2685->client = client;
ov2685            725 drivers/media/i2c/ov2685.c 	ov2685->cur_mode = &supported_modes[0];
ov2685            727 drivers/media/i2c/ov2685.c 	ov2685->xvclk = devm_clk_get(dev, "xvclk");
ov2685            728 drivers/media/i2c/ov2685.c 	if (IS_ERR(ov2685->xvclk)) {
ov2685            732 drivers/media/i2c/ov2685.c 	ret = clk_set_rate(ov2685->xvclk, OV2685_XVCLK_FREQ);
ov2685            737 drivers/media/i2c/ov2685.c 	if (clk_get_rate(ov2685->xvclk) != OV2685_XVCLK_FREQ)
ov2685            740 drivers/media/i2c/ov2685.c 	ov2685->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW);
ov2685            741 drivers/media/i2c/ov2685.c 	if (IS_ERR(ov2685->reset_gpio)) {
ov2685            746 drivers/media/i2c/ov2685.c 	ret = ov2685_configure_regulators(ov2685);
ov2685            752 drivers/media/i2c/ov2685.c 	mutex_init(&ov2685->mutex);
ov2685            753 drivers/media/i2c/ov2685.c 	v4l2_i2c_subdev_init(&ov2685->subdev, client, &ov2685_subdev_ops);
ov2685            754 drivers/media/i2c/ov2685.c 	ret = ov2685_initialize_controls(ov2685);
ov2685            758 drivers/media/i2c/ov2685.c 	ret = __ov2685_power_on(ov2685);
ov2685            762 drivers/media/i2c/ov2685.c 	ret = ov2685_check_sensor_id(ov2685, client);
ov2685            767 drivers/media/i2c/ov2685.c 	ov2685->subdev.internal_ops = &ov2685_internal_ops;
ov2685            768 drivers/media/i2c/ov2685.c 	ov2685->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
ov2685            771 drivers/media/i2c/ov2685.c 	ov2685->pad.flags = MEDIA_PAD_FL_SOURCE;
ov2685            772 drivers/media/i2c/ov2685.c 	ov2685->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR;
ov2685            773 drivers/media/i2c/ov2685.c 	ret = media_entity_pads_init(&ov2685->subdev.entity, 1, &ov2685->pad);
ov2685            778 drivers/media/i2c/ov2685.c 	ret = v4l2_async_register_subdev(&ov2685->subdev);
ov2685            792 drivers/media/i2c/ov2685.c 	media_entity_cleanup(&ov2685->subdev.entity);
ov2685            795 drivers/media/i2c/ov2685.c 	__ov2685_power_off(ov2685);
ov2685            797 drivers/media/i2c/ov2685.c 	v4l2_ctrl_handler_free(&ov2685->ctrl_handler);
ov2685            799 drivers/media/i2c/ov2685.c 	mutex_destroy(&ov2685->mutex);
ov2685            807 drivers/media/i2c/ov2685.c 	struct ov2685 *ov2685 = to_ov2685(sd);
ov2685            813 drivers/media/i2c/ov2685.c 	v4l2_ctrl_handler_free(&ov2685->ctrl_handler);
ov2685            814 drivers/media/i2c/ov2685.c 	mutex_destroy(&ov2685->mutex);
ov2685            818 drivers/media/i2c/ov2685.c 		__ov2685_power_off(ov2685);