• Home
  • Raw
  • Download

Lines Matching full:ov5695

3  * ov5695 driver
95 struct ov5695 { struct
115 #define to_ov5695(sd) container_of(sd, struct ov5695, subdev) argument
812 struct ov5695 *ov5695 = to_ov5695(sd); in ov5695_set_fmt() local
816 mutex_lock(&ov5695->mutex); in ov5695_set_fmt()
828 ov5695->cur_mode = mode; in ov5695_set_fmt()
830 __v4l2_ctrl_modify_range(ov5695->hblank, h_blank, in ov5695_set_fmt()
833 __v4l2_ctrl_modify_range(ov5695->vblank, vblank_def, in ov5695_set_fmt()
838 mutex_unlock(&ov5695->mutex); in ov5695_set_fmt()
847 struct ov5695 *ov5695 = to_ov5695(sd); in ov5695_get_fmt() local
848 const struct ov5695_mode *mode = ov5695->cur_mode; in ov5695_get_fmt()
850 mutex_lock(&ov5695->mutex); in ov5695_get_fmt()
855 mutex_unlock(&ov5695->mutex); in ov5695_get_fmt()
864 mutex_unlock(&ov5695->mutex); in ov5695_get_fmt()
898 static int ov5695_enable_test_pattern(struct ov5695 *ov5695, u32 pattern) in ov5695_enable_test_pattern() argument
907 return ov5695_write_reg(ov5695->client, OV5695_REG_TEST_PATTERN, in ov5695_enable_test_pattern()
911 static int __ov5695_start_stream(struct ov5695 *ov5695) in __ov5695_start_stream() argument
915 ret = ov5695_write_array(ov5695->client, ov5695_global_regs); in __ov5695_start_stream()
918 ret = ov5695_write_array(ov5695->client, ov5695->cur_mode->reg_list); in __ov5695_start_stream()
923 ret = __v4l2_ctrl_handler_setup(&ov5695->ctrl_handler); in __ov5695_start_stream()
927 return ov5695_write_reg(ov5695->client, OV5695_REG_CTRL_MODE, in __ov5695_start_stream()
931 static int __ov5695_stop_stream(struct ov5695 *ov5695) in __ov5695_stop_stream() argument
933 return ov5695_write_reg(ov5695->client, OV5695_REG_CTRL_MODE, in __ov5695_stop_stream()
939 struct ov5695 *ov5695 = to_ov5695(sd); in ov5695_s_stream() local
940 struct i2c_client *client = ov5695->client; in ov5695_s_stream()
943 mutex_lock(&ov5695->mutex); in ov5695_s_stream()
945 if (on == ov5695->streaming) in ov5695_s_stream()
955 ret = __ov5695_start_stream(ov5695); in ov5695_s_stream()
962 __ov5695_stop_stream(ov5695); in ov5695_s_stream()
966 ov5695->streaming = on; in ov5695_s_stream()
969 mutex_unlock(&ov5695->mutex); in ov5695_s_stream()
974 static int __ov5695_power_on(struct ov5695 *ov5695) in __ov5695_power_on() argument
977 struct device *dev = &ov5695->client->dev; in __ov5695_power_on()
979 ret = clk_prepare_enable(ov5695->xvclk); in __ov5695_power_on()
985 gpiod_set_value_cansleep(ov5695->reset_gpio, 1); in __ov5695_power_on()
992 ret = regulator_enable(ov5695->supplies[i].consumer); in __ov5695_power_on()
995 ov5695->supplies[i].supply, ret); in __ov5695_power_on()
1000 gpiod_set_value_cansleep(ov5695->reset_gpio, 0); in __ov5695_power_on()
1008 regulator_disable(ov5695->supplies[i].consumer); in __ov5695_power_on()
1009 clk_disable_unprepare(ov5695->xvclk); in __ov5695_power_on()
1014 static void __ov5695_power_off(struct ov5695 *ov5695) in __ov5695_power_off() argument
1016 struct device *dev = &ov5695->client->dev; in __ov5695_power_off()
1019 clk_disable_unprepare(ov5695->xvclk); in __ov5695_power_off()
1020 gpiod_set_value_cansleep(ov5695->reset_gpio, 1); in __ov5695_power_off()
1027 ret = regulator_disable(ov5695->supplies[i].consumer); in __ov5695_power_off()
1030 ov5695->supplies[i].supply, ret); in __ov5695_power_off()
1038 struct ov5695 *ov5695 = to_ov5695(sd); in ov5695_runtime_resume() local
1040 return __ov5695_power_on(ov5695); in ov5695_runtime_resume()
1047 struct ov5695 *ov5695 = to_ov5695(sd); in ov5695_runtime_suspend() local
1049 __ov5695_power_off(ov5695); in ov5695_runtime_suspend()
1057 struct ov5695 *ov5695 = to_ov5695(sd); in ov5695_open() local
1062 mutex_lock(&ov5695->mutex); in ov5695_open()
1069 mutex_unlock(&ov5695->mutex); in ov5695_open()
1105 struct ov5695 *ov5695 = container_of(ctrl->handler, in ov5695_set_ctrl() local
1106 struct ov5695, ctrl_handler); in ov5695_set_ctrl()
1107 struct i2c_client *client = ov5695->client; in ov5695_set_ctrl()
1115 max = ov5695->cur_mode->height + ctrl->val - 4; in ov5695_set_ctrl()
1116 __v4l2_ctrl_modify_range(ov5695->exposure, in ov5695_set_ctrl()
1117 ov5695->exposure->minimum, max, in ov5695_set_ctrl()
1118 ov5695->exposure->step, in ov5695_set_ctrl()
1119 ov5695->exposure->default_value); in ov5695_set_ctrl()
1129 ret = ov5695_write_reg(ov5695->client, OV5695_REG_EXPOSURE, in ov5695_set_ctrl()
1133 ret = ov5695_write_reg(ov5695->client, OV5695_REG_ANALOG_GAIN, in ov5695_set_ctrl()
1137 ret = ov5695_write_reg(ov5695->client, OV5695_REG_DIGI_GAIN_L, in ov5695_set_ctrl()
1140 ret = ov5695_write_reg(ov5695->client, OV5695_REG_DIGI_GAIN_H, in ov5695_set_ctrl()
1145 ret = ov5695_write_reg(ov5695->client, OV5695_REG_VTS, in ov5695_set_ctrl()
1147 ctrl->val + ov5695->cur_mode->height); in ov5695_set_ctrl()
1150 ret = ov5695_enable_test_pattern(ov5695, ctrl->val); in ov5695_set_ctrl()
1167 static int ov5695_initialize_controls(struct ov5695 *ov5695) in ov5695_initialize_controls() argument
1176 handler = &ov5695->ctrl_handler; in ov5695_initialize_controls()
1177 mode = ov5695->cur_mode; in ov5695_initialize_controls()
1181 handler->lock = &ov5695->mutex; in ov5695_initialize_controls()
1192 ov5695->hblank = v4l2_ctrl_new_std(handler, NULL, V4L2_CID_HBLANK, in ov5695_initialize_controls()
1194 if (ov5695->hblank) in ov5695_initialize_controls()
1195 ov5695->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; in ov5695_initialize_controls()
1198 ov5695->vblank = v4l2_ctrl_new_std(handler, &ov5695_ctrl_ops, in ov5695_initialize_controls()
1204 ov5695->exposure = v4l2_ctrl_new_std(handler, &ov5695_ctrl_ops, in ov5695_initialize_controls()
1209 ov5695->anal_gain = v4l2_ctrl_new_std(handler, &ov5695_ctrl_ops, in ov5695_initialize_controls()
1215 ov5695->digi_gain = v4l2_ctrl_new_std(handler, &ov5695_ctrl_ops, in ov5695_initialize_controls()
1220 ov5695->test_pattern = v4l2_ctrl_new_std_menu_items(handler, in ov5695_initialize_controls()
1227 dev_err(&ov5695->client->dev, in ov5695_initialize_controls()
1232 ov5695->subdev.ctrl_handler = handler; in ov5695_initialize_controls()
1242 static int ov5695_check_sensor_id(struct ov5695 *ov5695, in ov5695_check_sensor_id() argument
1245 struct device *dev = &ov5695->client->dev; in ov5695_check_sensor_id()
1261 static int ov5695_configure_regulators(struct ov5695 *ov5695) in ov5695_configure_regulators() argument
1266 ov5695->supplies[i].supply = ov5695_supply_names[i]; in ov5695_configure_regulators()
1268 return devm_regulator_bulk_get(&ov5695->client->dev, in ov5695_configure_regulators()
1270 ov5695->supplies); in ov5695_configure_regulators()
1277 struct ov5695 *ov5695; in ov5695_probe() local
1281 ov5695 = devm_kzalloc(dev, sizeof(*ov5695), GFP_KERNEL); in ov5695_probe()
1282 if (!ov5695) in ov5695_probe()
1285 ov5695->client = client; in ov5695_probe()
1286 ov5695->cur_mode = &supported_modes[0]; in ov5695_probe()
1288 ov5695->xvclk = devm_clk_get(dev, "xvclk"); in ov5695_probe()
1289 if (IS_ERR(ov5695->xvclk)) { in ov5695_probe()
1293 ret = clk_set_rate(ov5695->xvclk, OV5695_XVCLK_FREQ); in ov5695_probe()
1298 if (clk_get_rate(ov5695->xvclk) != OV5695_XVCLK_FREQ) in ov5695_probe()
1301 ov5695->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); in ov5695_probe()
1302 if (IS_ERR(ov5695->reset_gpio)) { in ov5695_probe()
1307 ret = ov5695_configure_regulators(ov5695); in ov5695_probe()
1313 mutex_init(&ov5695->mutex); in ov5695_probe()
1315 sd = &ov5695->subdev; in ov5695_probe()
1317 ret = ov5695_initialize_controls(ov5695); in ov5695_probe()
1321 ret = __ov5695_power_on(ov5695); in ov5695_probe()
1325 ret = ov5695_check_sensor_id(ov5695, client); in ov5695_probe()
1334 ov5695->pad.flags = MEDIA_PAD_FL_SOURCE; in ov5695_probe()
1336 ret = media_entity_pads_init(&sd->entity, 1, &ov5695->pad); in ov5695_probe()
1358 __ov5695_power_off(ov5695); in ov5695_probe()
1360 v4l2_ctrl_handler_free(&ov5695->ctrl_handler); in ov5695_probe()
1362 mutex_destroy(&ov5695->mutex); in ov5695_probe()
1370 struct ov5695 *ov5695 = to_ov5695(sd); in ov5695_remove() local
1376 v4l2_ctrl_handler_free(&ov5695->ctrl_handler); in ov5695_remove()
1377 mutex_destroy(&ov5695->mutex); in ov5695_remove()
1381 __ov5695_power_off(ov5695); in ov5695_remove()
1389 { .compatible = "ovti,ov5695" },
1397 .name = "ov5695",
1407 MODULE_DESCRIPTION("OmniVision ov5695 sensor driver");