Lines Matching refs:gc2093
93 #define to_gc2093(sd) container_of(sd, struct gc2093, subdev)
122 struct gc2093 { struct
473 static inline int gc2093_read_reg(struct gc2093 *gc2093, u16 addr, u8 *value) in gc2093_read_reg() argument
478 ret = regmap_read(gc2093->regmap, addr, &val); in gc2093_read_reg()
480 dev_err(gc2093->dev, "i2c read failed at addr: %x\n", addr); in gc2093_read_reg()
489 static inline int gc2093_write_reg(struct gc2093 *gc2093, u16 addr, u8 value) in gc2093_write_reg() argument
493 ret = regmap_write(gc2093->regmap, addr, value); in gc2093_write_reg()
495 dev_err(gc2093->dev, "i2c write failed at addr: %x\n", addr); in gc2093_write_reg()
530 static int gc2093_set_gain(struct gc2093 *gc2093, u32 gain) in gc2093_set_gain() argument
539 ret = gc2093_write_reg(gc2093, 0x00b4, gain_reg_configs[i].analog_gain >> 8); in gc2093_set_gain()
540 ret |= gc2093_write_reg(gc2093, 0x00b3, gain_reg_configs[i].analog_gain & 0xff); in gc2093_set_gain()
541 ret |= gc2093_write_reg(gc2093, 0x00b8, gain_reg_configs[i].col_gain >> 8); in gc2093_set_gain()
542 ret |= gc2093_write_reg(gc2093, 0x00b9, gain_reg_configs[i].col_gain & 0xff); in gc2093_set_gain()
543 ret |= gc2093_write_reg(gc2093, 0x00ce, gain_reg_configs[i].analog_sw >> 8); in gc2093_set_gain()
544 ret |= gc2093_write_reg(gc2093, 0x00c2, gain_reg_configs[i].analog_sw & 0xff); in gc2093_set_gain()
545 ret |= gc2093_write_reg(gc2093, 0x00cf, gain_reg_configs[i].ram_width >> 8); in gc2093_set_gain()
546 ret |= gc2093_write_reg(gc2093, 0x00d9, gain_reg_configs[i].ram_width & 0xff); in gc2093_set_gain()
550 ret |= gc2093_write_reg(gc2093, 0x00b1, (pre_gain >> 6)); in gc2093_set_gain()
551 ret |= gc2093_write_reg(gc2093, 0x00b2, ((pre_gain & 0x3f) << 2)); in gc2093_set_gain()
556 static void gc2093_modify_fps_info(struct gc2093 *gc2093) in gc2093_modify_fps_info() argument
558 const struct gc2093_mode *mode = gc2093->cur_mode; in gc2093_modify_fps_info()
560 gc2093->cur_fps.denominator = mode->max_fps.denominator * mode->vts_def / in gc2093_modify_fps_info()
561 gc2093->cur_vts; in gc2093_modify_fps_info()
566 struct gc2093 *gc2093 = container_of(ctrl->handler, in gc2093_set_ctrl() local
567 struct gc2093, ctrl_handler); in gc2093_set_ctrl()
576 max = gc2093->cur_mode->height + ctrl->val - 4; in gc2093_set_ctrl()
577 __v4l2_ctrl_modify_range(gc2093->exposure, in gc2093_set_ctrl()
578 gc2093->exposure->minimum, max, in gc2093_set_ctrl()
579 gc2093->exposure->step, in gc2093_set_ctrl()
580 gc2093->exposure->default_value); in gc2093_set_ctrl()
583 if (!pm_runtime_get_if_in_use(gc2093->dev)) in gc2093_set_ctrl()
588 if (gc2093->cur_mode->hdr_mode != NO_HDR) in gc2093_set_ctrl()
590 dev_dbg(gc2093->dev, "set exposure value 0x%x\n", ctrl->val); in gc2093_set_ctrl()
591 ret = gc2093_write_reg(gc2093, GC2093_REG_EXP_LONG_H, in gc2093_set_ctrl()
593 ret |= gc2093_write_reg(gc2093, GC2093_REG_EXP_LONG_L, in gc2093_set_ctrl()
597 if (gc2093->cur_mode->hdr_mode != NO_HDR) in gc2093_set_ctrl()
599 dev_dbg(gc2093->dev, "set gain value 0x%x\n", ctrl->val); in gc2093_set_ctrl()
600 gc2093_set_gain(gc2093, ctrl->val); in gc2093_set_ctrl()
603 vts = gc2093->cur_mode->height + ctrl->val; in gc2093_set_ctrl()
604 gc2093->cur_vts = vts; in gc2093_set_ctrl()
605 ret = gc2093_write_reg(gc2093, GC2093_REG_VTS_H, in gc2093_set_ctrl()
607 ret |= gc2093_write_reg(gc2093, GC2093_REG_VTS_L, in gc2093_set_ctrl()
609 gc2093_modify_fps_info(gc2093); in gc2093_set_ctrl()
610 dev_dbg(gc2093->dev, " set blank value 0x%x\n", ctrl->val); in gc2093_set_ctrl()
613 regmap_update_bits(gc2093->regmap, GC2093_MIRROR_FLIP_REG, in gc2093_set_ctrl()
617 regmap_update_bits(gc2093->regmap, GC2093_MIRROR_FLIP_REG, in gc2093_set_ctrl()
621 dev_warn(gc2093->dev, "%s Unhandled id:0x%x, val:0x%x\n", in gc2093_set_ctrl()
627 pm_runtime_put(gc2093->dev); in gc2093_set_ctrl()
635 static int gc2093_get_regulators(struct gc2093 *gc2093) in gc2093_get_regulators() argument
640 gc2093->supplies[i].supply = gc2093_supply_names[i]; in gc2093_get_regulators()
642 return devm_regulator_bulk_get(gc2093->dev, in gc2093_get_regulators()
644 gc2093->supplies); in gc2093_get_regulators()
647 static int gc2093_initialize_controls(struct gc2093 *gc2093) in gc2093_initialize_controls() argument
655 handler = &gc2093->ctrl_handler; in gc2093_initialize_controls()
656 mode = gc2093->cur_mode; in gc2093_initialize_controls()
660 handler->lock = &gc2093->lock; in gc2093_initialize_controls()
662 gc2093->link_freq = v4l2_ctrl_new_int_menu(handler, NULL, V4L2_CID_LINK_FREQ, in gc2093_initialize_controls()
666 gc2093->pixel_rate = v4l2_ctrl_new_std(handler, NULL, V4L2_CID_PIXEL_RATE, in gc2093_initialize_controls()
671 gc2093->hblank = v4l2_ctrl_new_std(handler, NULL, V4L2_CID_HBLANK, in gc2093_initialize_controls()
673 if (gc2093->hblank) in gc2093_initialize_controls()
674 gc2093->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; in gc2093_initialize_controls()
677 gc2093->cur_vts = mode->vts_def; in gc2093_initialize_controls()
678 gc2093->vblank = v4l2_ctrl_new_std(handler, &gc2093_ctrl_ops, in gc2093_initialize_controls()
684 gc2093->exposure = v4l2_ctrl_new_std(handler, &gc2093_ctrl_ops, in gc2093_initialize_controls()
689 gc2093->anal_gain = v4l2_ctrl_new_std(handler, &gc2093_ctrl_ops, in gc2093_initialize_controls()
694 gc2093->h_flip = v4l2_ctrl_new_std(handler, &gc2093_ctrl_ops, in gc2093_initialize_controls()
697 gc2093->v_flip = v4l2_ctrl_new_std(handler, &gc2093_ctrl_ops, in gc2093_initialize_controls()
702 dev_err(gc2093->dev, "Failed to init controls(%d)\n", ret); in gc2093_initialize_controls()
706 gc2093->subdev.ctrl_handler = handler; in gc2093_initialize_controls()
707 gc2093->has_init_exp = false; in gc2093_initialize_controls()
708 gc2093->cur_vts = mode->vts_def; in gc2093_initialize_controls()
709 gc2093->cur_fps = mode->max_fps; in gc2093_initialize_controls()
718 static int __gc2093_power_on(struct gc2093 *gc2093) in __gc2093_power_on() argument
721 struct device *dev = gc2093->dev; in __gc2093_power_on()
723 ret = clk_set_rate(gc2093->xvclk, GC2093_XVCLK_FREQ); in __gc2093_power_on()
727 if (clk_get_rate(gc2093->xvclk) != GC2093_XVCLK_FREQ) in __gc2093_power_on()
730 ret = clk_prepare_enable(gc2093->xvclk); in __gc2093_power_on()
736 if (gc2093->is_thunderboot) in __gc2093_power_on()
739 ret = regulator_bulk_enable(GC2093_NUM_SUPPLIES, gc2093->supplies); in __gc2093_power_on()
745 if (!IS_ERR(gc2093->reset_gpio)) in __gc2093_power_on()
746 gpiod_direction_output(gc2093->reset_gpio, 1); in __gc2093_power_on()
750 if (!IS_ERR(gc2093->pwdn_gpio)) in __gc2093_power_on()
751 gpiod_direction_output(gc2093->pwdn_gpio, 1); in __gc2093_power_on()
752 if (!IS_ERR(gc2093->reset_gpio)) in __gc2093_power_on()
753 gpiod_direction_output(gc2093->reset_gpio, 0); in __gc2093_power_on()
760 clk_disable_unprepare(gc2093->xvclk); in __gc2093_power_on()
764 static void __gc2093_power_off(struct gc2093 *gc2093) in __gc2093_power_off() argument
766 clk_disable_unprepare(gc2093->xvclk); in __gc2093_power_off()
767 if (gc2093->is_thunderboot) { in __gc2093_power_off()
768 if (gc2093->is_first_streamoff) { in __gc2093_power_off()
769 gc2093->is_thunderboot = false; in __gc2093_power_off()
770 gc2093->is_first_streamoff = false; in __gc2093_power_off()
776 if (!IS_ERR(gc2093->reset_gpio)) in __gc2093_power_off()
777 gpiod_direction_output(gc2093->reset_gpio, 1); in __gc2093_power_off()
778 if (!IS_ERR(gc2093->pwdn_gpio)) in __gc2093_power_off()
779 gpiod_direction_output(gc2093->pwdn_gpio, 0); in __gc2093_power_off()
781 regulator_bulk_disable(GC2093_NUM_SUPPLIES, gc2093->supplies); in __gc2093_power_off()
784 static int gc2093_check_sensor_id(struct gc2093 *gc2093) in gc2093_check_sensor_id() argument
786 struct device *dev = gc2093->dev; in gc2093_check_sensor_id()
791 if (gc2093->is_thunderboot) { in gc2093_check_sensor_id()
796 ret = gc2093_read_reg(gc2093, GC2093_REG_CHIP_ID_H, &id_h); in gc2093_check_sensor_id()
797 ret |= gc2093_read_reg(gc2093, GC2093_REG_CHIP_ID_L, &id_l); in gc2093_check_sensor_id()
799 dev_err(gc2093->dev, "Failed to read sensor id, (%d)\n", ret); in gc2093_check_sensor_id()
805 dev_err(gc2093->dev, "sensor id: %04X mismatched\n", id); in gc2093_check_sensor_id()
809 dev_info(gc2093->dev, "Detected GC2093 sensor\n"); in gc2093_check_sensor_id()
813 static void gc2093_get_module_inf(struct gc2093 *gc2093, in gc2093_get_module_inf() argument
817 strlcpy(inf->base.lens, gc2093->len_name, sizeof(inf->base.lens)); in gc2093_get_module_inf()
819 strlcpy(inf->base.module, gc2093->module_name, sizeof(inf->base.module)); in gc2093_get_module_inf()
824 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_ioctl() local
837 if (!gc2093->has_init_exp && !gc2093->streaming) { in gc2093_ioctl()
838 gc2093->init_hdrae_exp = *hdrae_exp; in gc2093_ioctl()
839 gc2093->has_init_exp = true; in gc2093_ioctl()
840 dev_info(gc2093->dev, "don't streaming, record hdrae\n"); in gc2093_ioctl()
844 ret = gc2093_set_gain(gc2093, hdrae_exp->short_gain_reg); in gc2093_ioctl()
846 dev_err(gc2093->dev, "Failed to set gain!)\n"); in gc2093_ioctl()
850 dev_dbg(gc2093->dev, "%s exp_reg middle: 0x%x, short: 0x%x, gain 0x%x\n", in gc2093_ioctl()
855 gc2093_write_reg(gc2093, 0x0032, 0xfd); in gc2093_ioctl()
857 gc2093_write_reg(gc2093, 0x0032, 0xf8); in gc2093_ioctl()
870 ret = gc2093_read_reg(gc2093, GC2093_REG_VB_H, &vb_h); in gc2093_ioctl()
871 ret |= gc2093_read_reg(gc2093, GC2093_REG_VB_L, &vb_l); in gc2093_ioctl()
873 dev_err(gc2093->dev, "Failed to read vb data)\n"); in gc2093_ioctl()
883 dev_err(gc2093->dev, "short exposure should be less than %d\n", in gc2093_ioctl()
886 cur_vts = gc2093->cur_vts; in gc2093_ioctl()
887 dev_dbg(gc2093->dev, "%s cur_vts: 0x%x\n", __func__, cur_vts); in gc2093_ioctl()
891 dev_err(gc2093->dev, "total exposure should be less than %d\n", in gc2093_ioctl()
896 dev_dbg(gc2093->dev, "%s cal exp_reg middle: 0x%x, short: 0x%x\n", in gc2093_ioctl()
898 ret |= gc2093_write_reg(gc2093, GC2093_REG_EXP_LONG_H, in gc2093_ioctl()
900 ret |= gc2093_write_reg(gc2093, GC2093_REG_EXP_LONG_L, in gc2093_ioctl()
902 ret |= gc2093_write_reg(gc2093, GC2093_REG_EXP_SHORT_H, in gc2093_ioctl()
904 ret |= gc2093_write_reg(gc2093, GC2093_REG_EXP_SHORT_L, in gc2093_ioctl()
910 hdr_cfg->hdr_mode = gc2093->cur_mode->hdr_mode; in gc2093_ioctl()
914 w = gc2093->cur_mode->width; in gc2093_ioctl()
915 h = gc2093->cur_mode->height; in gc2093_ioctl()
916 for (i = 0; i < gc2093->cfg_num; i++) { in gc2093_ioctl()
920 gc2093->cur_mode = &supported_modes[i]; in gc2093_ioctl()
924 if (i == gc2093->cfg_num) { in gc2093_ioctl()
925 dev_err(gc2093->dev, "not find hdr mode:%d %dx%d config\n", in gc2093_ioctl()
929 w = gc2093->cur_mode->hts_def - gc2093->cur_mode->width; in gc2093_ioctl()
930 h = gc2093->cur_mode->vts_def - gc2093->cur_mode->height; in gc2093_ioctl()
931 __v4l2_ctrl_modify_range(gc2093->hblank, w, w, 1, w); in gc2093_ioctl()
932 __v4l2_ctrl_modify_range(gc2093->vblank, h, in gc2093_ioctl()
933 GC2093_VTS_MAX - gc2093->cur_mode->height, in gc2093_ioctl()
935 gc2093->cur_vts = gc2093->cur_mode->vts_def; in gc2093_ioctl()
936 gc2093->cur_fps = gc2093->cur_mode->max_fps; in gc2093_ioctl()
937 dev_info(gc2093->dev, "sensor mode: %d\n", in gc2093_ioctl()
938 gc2093->cur_mode->hdr_mode); in gc2093_ioctl()
942 gc2093_get_module_inf(gc2093, (struct rkmodule_inf *)arg); in gc2093_ioctl()
949 ret = gc2093_write_reg(gc2093, GC2093_REG_CTRL_MODE, in gc2093_ioctl()
952 ret = gc2093_write_reg(gc2093, GC2093_REG_CTRL_MODE, in gc2093_ioctl()
954 fps = gc2093->cur_mode->max_fps.denominator / in gc2093_ioctl()
955 gc2093->cur_mode->max_fps.numerator; in gc2093_ioctl()
956 delay_us = 1000000 / (gc2093->cur_mode->vts_def * fps / gc2093->cur_vts); in gc2093_ioctl()
967 static int __gc2093_start_stream(struct gc2093 *gc2093) in __gc2093_start_stream() argument
971 if (!gc2093->is_thunderboot) { in __gc2093_start_stream()
972 ret = regmap_multi_reg_write(gc2093->regmap, in __gc2093_start_stream()
973 gc2093->cur_mode->reg_list, in __gc2093_start_stream()
974 gc2093->cur_mode->reg_num); in __gc2093_start_stream()
979 mutex_unlock(&gc2093->lock); in __gc2093_start_stream()
980 v4l2_ctrl_handler_setup(&gc2093->ctrl_handler); in __gc2093_start_stream()
981 mutex_lock(&gc2093->lock); in __gc2093_start_stream()
983 if (gc2093->has_init_exp && gc2093->cur_mode->hdr_mode != NO_HDR) { in __gc2093_start_stream()
984 ret = gc2093_ioctl(&gc2093->subdev, PREISP_CMD_SET_HDRAE_EXP, in __gc2093_start_stream()
985 &gc2093->init_hdrae_exp); in __gc2093_start_stream()
987 dev_err(gc2093->dev, "init exp fail in hdr mode\n"); in __gc2093_start_stream()
992 return gc2093_write_reg(gc2093, GC2093_REG_CTRL_MODE, in __gc2093_start_stream()
996 static int __gc2093_stop_stream(struct gc2093 *gc2093) in __gc2093_stop_stream() argument
998 gc2093->has_init_exp = false; in __gc2093_stop_stream()
999 if (gc2093->is_thunderboot) { in __gc2093_stop_stream()
1000 gc2093->is_first_streamoff = true; in __gc2093_stop_stream()
1001 pm_runtime_put(gc2093->dev); in __gc2093_stop_stream()
1003 return gc2093_write_reg(gc2093, GC2093_REG_CTRL_MODE, in __gc2093_stop_stream()
1094 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_s_stream() local
1099 fps = DIV_ROUND_CLOSEST(gc2093->cur_mode->max_fps.denominator, in gc2093_s_stream()
1100 gc2093->cur_mode->max_fps.numerator); in gc2093_s_stream()
1102 dev_info(gc2093->dev, "%s: on: %d, %dx%d@%d\n", __func__, on, in gc2093_s_stream()
1103 gc2093->cur_mode->width, in gc2093_s_stream()
1104 gc2093->cur_mode->height, in gc2093_s_stream()
1107 mutex_lock(&gc2093->lock); in gc2093_s_stream()
1109 if (on == gc2093->streaming) in gc2093_s_stream()
1113 if (gc2093->is_thunderboot && rkisp_tb_get_state() == RKISP_TB_NG) { in gc2093_s_stream()
1114 gc2093->is_thunderboot = false; in gc2093_s_stream()
1115 __gc2093_power_on(gc2093); in gc2093_s_stream()
1117 ret = pm_runtime_get_sync(gc2093->dev); in gc2093_s_stream()
1119 pm_runtime_put_noidle(gc2093->dev); in gc2093_s_stream()
1123 ret = __gc2093_start_stream(gc2093); in gc2093_s_stream()
1125 dev_err(gc2093->dev, "Failed to start gc2093 stream\n"); in gc2093_s_stream()
1126 pm_runtime_put(gc2093->dev); in gc2093_s_stream()
1130 __gc2093_stop_stream(gc2093); in gc2093_s_stream()
1134 dev_info(gc2093->dev, "%s: on: %d, sleep(%dus)\n", in gc2093_s_stream()
1137 pm_runtime_put(gc2093->dev); in gc2093_s_stream()
1140 gc2093->streaming = on; in gc2093_s_stream()
1143 mutex_unlock(&gc2093->lock); in gc2093_s_stream()
1150 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_g_frame_interval() local
1151 const struct gc2093_mode *mode = gc2093->cur_mode; in gc2093_g_frame_interval()
1161 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_g_mbus_config() local
1166 config->flags = (gc2093->cur_mode->hdr_mode == NO_HDR) ? in gc2093_g_mbus_config()
1186 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_enum_frame_sizes() local
1188 if (fse->index >= gc2093->cfg_num) in gc2093_enum_frame_sizes()
1205 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_enum_frame_interval() local
1207 if (fie->index >= gc2093->cfg_num) in gc2093_enum_frame_interval()
1222 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_set_fmt() local
1226 mutex_lock(&gc2093->lock); in gc2093_set_fmt()
1241 mutex_unlock(&gc2093->lock); in gc2093_set_fmt()
1245 gc2093->cur_mode = mode; in gc2093_set_fmt()
1246 __v4l2_ctrl_s_ctrl(gc2093->link_freq, mode->link_freq_index); in gc2093_set_fmt()
1247 __v4l2_ctrl_s_ctrl_int64(gc2093->pixel_rate, in gc2093_set_fmt()
1250 __v4l2_ctrl_modify_range(gc2093->hblank, h_blank, in gc2093_set_fmt()
1253 __v4l2_ctrl_modify_range(gc2093->vblank, vblank_def, in gc2093_set_fmt()
1256 gc2093->cur_vts = mode->vts_def; in gc2093_set_fmt()
1257 gc2093->cur_fps = mode->max_fps; in gc2093_set_fmt()
1260 mutex_unlock(&gc2093->lock); in gc2093_set_fmt()
1268 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_get_fmt() local
1269 const struct gc2093_mode *mode = gc2093->cur_mode; in gc2093_get_fmt()
1271 mutex_lock(&gc2093->lock); in gc2093_get_fmt()
1276 mutex_unlock(&gc2093->lock); in gc2093_get_fmt()
1292 mutex_unlock(&gc2093->lock); in gc2093_get_fmt()
1299 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_open() local
1304 mutex_lock(&gc2093->lock); in gc2093_open()
1310 mutex_unlock(&gc2093->lock); in gc2093_open()
1324 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_s_power() local
1327 mutex_lock(&gc2093->lock); in gc2093_s_power()
1329 if (gc2093->power_on == !!on) in gc2093_s_power()
1333 ret = pm_runtime_get_sync(gc2093->dev); in gc2093_s_power()
1335 pm_runtime_put_noidle(gc2093->dev); in gc2093_s_power()
1338 gc2093->power_on = true; in gc2093_s_power()
1340 pm_runtime_put(gc2093->dev); in gc2093_s_power()
1341 gc2093->power_on = false; in gc2093_s_power()
1345 mutex_unlock(&gc2093->lock); in gc2093_s_power()
1382 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_runtime_resume() local
1384 __gc2093_power_on(gc2093); in gc2093_runtime_resume()
1392 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_runtime_suspend() local
1394 __gc2093_power_off(gc2093); in gc2093_runtime_suspend()
1408 struct gc2093 *gc2093; in gc2093_probe() local
1418 gc2093 = devm_kzalloc(dev, sizeof(*gc2093), GFP_KERNEL); in gc2093_probe()
1419 if (!gc2093) in gc2093_probe()
1422 gc2093->dev = dev; in gc2093_probe()
1423 gc2093->regmap = devm_regmap_init_i2c(client, &gc2093_regmap_config); in gc2093_probe()
1424 if (IS_ERR(gc2093->regmap)) { in gc2093_probe()
1430 &gc2093->module_index); in gc2093_probe()
1432 &gc2093->module_facing); in gc2093_probe()
1434 &gc2093->module_name); in gc2093_probe()
1436 &gc2093->len_name); in gc2093_probe()
1442 gc2093->is_thunderboot = IS_ENABLED(CONFIG_VIDEO_ROCKCHIP_THUNDER_BOOT_ISP); in gc2093_probe()
1444 gc2093->xvclk = devm_clk_get(gc2093->dev, "xvclk"); in gc2093_probe()
1445 if (IS_ERR(gc2093->xvclk)) { in gc2093_probe()
1446 dev_err(gc2093->dev, "Failed to get xvclk\n"); in gc2093_probe()
1450 gc2093->reset_gpio = devm_gpiod_get(dev, "reset", GPIOD_ASIS); in gc2093_probe()
1451 if (IS_ERR(gc2093->reset_gpio)) in gc2093_probe()
1454 gc2093->pwdn_gpio = devm_gpiod_get(dev, "pwdn", GPIOD_ASIS); in gc2093_probe()
1455 if (IS_ERR(gc2093->pwdn_gpio)) in gc2093_probe()
1458 ret = gc2093_get_regulators(gc2093); in gc2093_probe()
1464 mutex_init(&gc2093->lock); in gc2093_probe()
1467 gc2093->cur_mode = &supported_modes[0]; in gc2093_probe()
1468 gc2093->cfg_num = ARRAY_SIZE(supported_modes); in gc2093_probe()
1469 gc2093->cur_vts = gc2093->cur_mode->vts_def; in gc2093_probe()
1471 sd = &gc2093->subdev; in gc2093_probe()
1473 ret = gc2093_initialize_controls(gc2093); in gc2093_probe()
1477 ret = __gc2093_power_on(gc2093); in gc2093_probe()
1481 ret = gc2093_check_sensor_id(gc2093); in gc2093_probe()
1491 gc2093->pad.flags = MEDIA_PAD_FL_SOURCE; in gc2093_probe()
1493 ret = media_entity_pads_init(&sd->entity, 1, &gc2093->pad); in gc2093_probe()
1499 if (strcmp(gc2093->module_facing, "back") == 0) in gc2093_probe()
1505 gc2093->module_index, facing, in gc2093_probe()
1516 if (gc2093->is_thunderboot) in gc2093_probe()
1528 __gc2093_power_off(gc2093); in gc2093_probe()
1530 v4l2_ctrl_handler_free(&gc2093->ctrl_handler); in gc2093_probe()
1532 mutex_destroy(&gc2093->lock); in gc2093_probe()
1540 struct gc2093 *gc2093 = to_gc2093(sd); in gc2093_remove() local
1546 v4l2_ctrl_handler_free(&gc2093->ctrl_handler); in gc2093_remove()
1547 mutex_destroy(&gc2093->lock); in gc2093_remove()
1551 __gc2093_power_off(gc2093); in gc2093_remove()