Lines Matching +full:enforce +full:- +full:video +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0-only
14 #include <linux/v4l2-mediabus.h>
18 #include <media/v4l2-async.h>
19 #include <media/v4l2-common.h>
20 #include <media/v4l2-ctrls.h>
21 #include <media/v4l2-device.h>
22 #include <media/v4l2-event.h>
23 #include <media/v4l2-fwnode.h>
245 /* user point of view - 0: falling 1: rising edge */
292 return mt9m111->fmt; in mt9m111_find_datafmt()
307 if (page == mt9m111->lastpage) in reg_page_map_set()
310 return -EINVAL; in reg_page_map_set()
314 mt9m111->lastpage = page; in reg_page_map_set()
326 dev_dbg(&client->dev, "read reg.%03x -> %04x\n", reg, ret); in mt9m111_reg_read()
338 dev_dbg(&client->dev, "write reg.%03x = %04x -> %d\n", reg, data, ret); in mt9m111_reg_write()
378 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_context()
379 return reg_write(CONTEXT_CONTROL, ctx->control); in mt9m111_set_context()
386 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_rect_ctx()
387 int ret = mt9m111_reg_write(client, ctx->reducer_xzoom, rect->width); in mt9m111_setup_rect_ctx()
389 ret = mt9m111_reg_write(client, ctx->reducer_yzoom, rect->height); in mt9m111_setup_rect_ctx()
391 ret = mt9m111_reg_write(client, ctx->reducer_xsize, width); in mt9m111_setup_rect_ctx()
393 ret = mt9m111_reg_write(client, ctx->reducer_ysize, height); in mt9m111_setup_rect_ctx()
400 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_geometry()
403 ret = reg_write(COLUMN_START, rect->left); in mt9m111_setup_geometry()
405 ret = reg_write(ROW_START, rect->top); in mt9m111_setup_geometry()
408 ret = reg_write(WINDOW_WIDTH, rect->width); in mt9m111_setup_geometry()
410 ret = reg_write(WINDOW_HEIGHT, rect->height); in mt9m111_setup_geometry()
413 /* IFP in use, down-scaling possible */ in mt9m111_setup_geometry()
422 dev_dbg(&client->dev, "%s(%x): %ux%u@%u:%u -> %ux%u = %d\n", in mt9m111_setup_geometry()
423 __func__, code, rect->width, rect->height, rect->left, rect->top, in mt9m111_setup_geometry()
431 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_enable()
437 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_reset()
456 struct v4l2_rect rect = sel->r; in mt9m111_set_selection()
460 if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || in mt9m111_set_selection()
461 sel->target != V4L2_SEL_TGT_CROP) in mt9m111_set_selection()
462 return -EINVAL; in mt9m111_set_selection()
464 if (mt9m111->fmt->code == MEDIA_BUS_FMT_SBGGR8_1X8 || in mt9m111_set_selection()
465 mt9m111->fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) { in mt9m111_set_selection()
466 /* Bayer format - even size lengths */ in mt9m111_set_selection()
475 MT9M111_MIN_DARK_COLS + MT9M111_MAX_WIDTH - in mt9m111_set_selection()
478 MT9M111_MIN_DARK_ROWS + MT9M111_MAX_HEIGHT - in mt9m111_set_selection()
481 width = min(mt9m111->width, rect.width); in mt9m111_set_selection()
482 height = min(mt9m111->height, rect.height); in mt9m111_set_selection()
484 ret = mt9m111_setup_geometry(mt9m111, &rect, width, height, mt9m111->fmt->code); in mt9m111_set_selection()
486 mt9m111->rect = rect; in mt9m111_set_selection()
487 mt9m111->width = width; in mt9m111_set_selection()
488 mt9m111->height = height; in mt9m111_set_selection()
501 if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) in mt9m111_get_selection()
502 return -EINVAL; in mt9m111_get_selection()
504 switch (sel->target) { in mt9m111_get_selection()
506 sel->r.left = MT9M111_MIN_DARK_COLS; in mt9m111_get_selection()
507 sel->r.top = MT9M111_MIN_DARK_ROWS; in mt9m111_get_selection()
508 sel->r.width = MT9M111_MAX_WIDTH; in mt9m111_get_selection()
509 sel->r.height = MT9M111_MAX_HEIGHT; in mt9m111_get_selection()
512 sel->r = mt9m111->rect; in mt9m111_get_selection()
515 return -EINVAL; in mt9m111_get_selection()
523 struct v4l2_mbus_framefmt *mf = &format->format; in mt9m111_get_fmt()
526 if (format->pad) in mt9m111_get_fmt()
527 return -EINVAL; in mt9m111_get_fmt()
529 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { in mt9m111_get_fmt()
531 mf = v4l2_subdev_get_try_format(sd, sd_state, format->pad); in mt9m111_get_fmt()
532 format->format = *mf; in mt9m111_get_fmt()
535 return -EINVAL; in mt9m111_get_fmt()
539 mf->width = mt9m111->width; in mt9m111_get_fmt()
540 mf->height = mt9m111->height; in mt9m111_get_fmt()
541 mf->code = mt9m111->fmt->code; in mt9m111_get_fmt()
542 mf->colorspace = mt9m111->fmt->colorspace; in mt9m111_get_fmt()
543 mf->field = V4L2_FIELD_NONE; in mt9m111_get_fmt()
544 mf->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; in mt9m111_get_fmt()
545 mf->quantization = V4L2_QUANTIZATION_DEFAULT; in mt9m111_get_fmt()
546 mf->xfer_func = V4L2_XFER_FUNC_DEFAULT; in mt9m111_get_fmt()
554 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_pixfmt()
608 dev_err(&client->dev, "Pixel format not handled: %x\n", code); in mt9m111_set_pixfmt()
609 return -EINVAL; in mt9m111_set_pixfmt()
612 /* receiver samples on falling edge, chip-hw default is rising */ in mt9m111_set_pixfmt()
613 if (mt9m111->pclk_sample == 0) in mt9m111_set_pixfmt()
629 struct v4l2_mbus_framefmt *mf = &format->format; in mt9m111_set_fmt()
633 struct v4l2_rect *rect = &mt9m111->rect; in mt9m111_set_fmt()
637 if (mt9m111->is_streaming) in mt9m111_set_fmt()
638 return -EBUSY; in mt9m111_set_fmt()
640 if (format->pad) in mt9m111_set_fmt()
641 return -EINVAL; in mt9m111_set_fmt()
643 fmt = mt9m111_find_datafmt(mt9m111, mf->code); in mt9m111_set_fmt()
645 bayer = fmt->code == MEDIA_BUS_FMT_SBGGR8_1X8 || in mt9m111_set_fmt()
646 fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE; in mt9m111_set_fmt()
649 * With Bayer format enforce even side lengths, but let the user play in mt9m111_set_fmt()
653 rect->width = ALIGN(rect->width, 2); in mt9m111_set_fmt()
654 rect->height = ALIGN(rect->height, 2); in mt9m111_set_fmt()
657 if (fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) { in mt9m111_set_fmt()
658 /* IFP bypass mode, no scaling */ in mt9m111_set_fmt()
659 mf->width = rect->width; in mt9m111_set_fmt()
660 mf->height = rect->height; in mt9m111_set_fmt()
663 if (mf->width > rect->width) in mt9m111_set_fmt()
664 mf->width = rect->width; in mt9m111_set_fmt()
665 if (mf->height > rect->height) in mt9m111_set_fmt()
666 mf->height = rect->height; in mt9m111_set_fmt()
669 dev_dbg(&client->dev, "%s(): %ux%u, code=%x\n", __func__, in mt9m111_set_fmt()
670 mf->width, mf->height, fmt->code); in mt9m111_set_fmt()
672 mf->code = fmt->code; in mt9m111_set_fmt()
673 mf->colorspace = fmt->colorspace; in mt9m111_set_fmt()
674 mf->field = V4L2_FIELD_NONE; in mt9m111_set_fmt()
675 mf->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; in mt9m111_set_fmt()
676 mf->quantization = V4L2_QUANTIZATION_DEFAULT; in mt9m111_set_fmt()
677 mf->xfer_func = V4L2_XFER_FUNC_DEFAULT; in mt9m111_set_fmt()
679 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { in mt9m111_set_fmt()
680 sd_state->pads->try_fmt = *mf; in mt9m111_set_fmt()
684 ret = mt9m111_setup_geometry(mt9m111, rect, mf->width, mf->height, mf->code); in mt9m111_set_fmt()
686 ret = mt9m111_set_pixfmt(mt9m111, mf->code); in mt9m111_set_fmt()
688 mt9m111->width = mf->width; in mt9m111_set_fmt()
689 mt9m111->height = mf->height; in mt9m111_set_fmt()
690 mt9m111->fmt = fmt; in mt9m111_set_fmt()
700 const struct mt9m111_mode_info *mode; in mt9m111_find_mode() local
701 struct v4l2_rect *sensor_rect = &mt9m111->rect; in mt9m111_find_mode()
702 unsigned int gap, gap_best = (unsigned int) -1; in mt9m111_find_mode()
711 if (sensor_rect->width != MT9M111_MAX_WIDTH || in mt9m111_find_mode()
712 sensor_rect->height != MT9M111_MAX_HEIGHT) { in mt9m111_find_mode()
713 dev_info(mt9m111->subdev.dev, in mt9m111_find_mode()
721 dev_dbg(mt9m111->subdev.dev, in mt9m111_find_mode()
734 gap = abs(fps - req_fps); in mt9m111_find_mode()
745 mode = &mt9m111_mode_data[best_gap_idx]; in mt9m111_find_mode()
746 mt9m111->ctx = (best_gap_idx == MT9M111_MODE_QSXGA_30FPS) ? &context_a : in mt9m111_find_mode()
748 return mode; in mt9m111_find_mode()
758 if (reg->reg > 0x2ff) in mt9m111_g_register()
759 return -EINVAL; in mt9m111_g_register()
761 val = mt9m111_reg_read(client, reg->reg); in mt9m111_g_register()
762 reg->size = 2; in mt9m111_g_register()
763 reg->val = (u64)val; in mt9m111_g_register()
765 if (reg->val > 0xffff) in mt9m111_g_register()
766 return -EIO; in mt9m111_g_register()
776 if (reg->reg > 0x2ff) in mt9m111_s_register()
777 return -EINVAL; in mt9m111_s_register()
779 if (mt9m111_reg_write(client, reg->reg, reg->val) < 0) in mt9m111_s_register()
780 return -EIO; in mt9m111_s_register()
788 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_flip()
792 ret = mt9m111_reg_set(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
794 ret = mt9m111_reg_clear(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
801 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_get_global_gain()
813 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_global_gain()
817 return -EINVAL; in mt9m111_set_global_gain()
831 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autoexposure()
840 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autowhitebalance()
860 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_test_pattern()
868 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_colorfx()
886 return -EINVAL; in mt9m111_set_colorfx()
891 struct mt9m111 *mt9m111 = container_of(ctrl->handler, in mt9m111_s_ctrl()
894 switch (ctrl->id) { in mt9m111_s_ctrl()
896 return mt9m111_set_flip(mt9m111, ctrl->val, in mt9m111_s_ctrl()
899 return mt9m111_set_flip(mt9m111, ctrl->val, in mt9m111_s_ctrl()
902 return mt9m111_set_global_gain(mt9m111, ctrl->val); in mt9m111_s_ctrl()
904 return mt9m111_set_autoexposure(mt9m111, ctrl->val); in mt9m111_s_ctrl()
906 return mt9m111_set_autowhitebalance(mt9m111, ctrl->val); in mt9m111_s_ctrl()
908 return mt9m111_set_test_pattern(mt9m111, ctrl->val); in mt9m111_s_ctrl()
910 return mt9m111_set_colorfx(mt9m111, ctrl->val); in mt9m111_s_ctrl()
913 return -EINVAL; in mt9m111_s_ctrl()
918 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_suspend()
921 v4l2_ctrl_s_ctrl(mt9m111->gain, mt9m111_get_global_gain(mt9m111)); in mt9m111_suspend()
936 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_restore_state()
938 mt9m111_set_context(mt9m111, mt9m111->ctx); in mt9m111_restore_state()
939 mt9m111_set_pixfmt(mt9m111, mt9m111->fmt->code); in mt9m111_restore_state()
940 mt9m111_setup_geometry(mt9m111, &mt9m111->rect, in mt9m111_restore_state()
941 mt9m111->width, mt9m111->height, mt9m111->fmt->code); in mt9m111_restore_state()
942 v4l2_ctrl_handler_setup(&mt9m111->hdl); in mt9m111_restore_state()
943 mt9m111_reg_mask(client, mt9m111->ctx->read_mode, in mt9m111_restore_state()
944 mt9m111->current_mode->reg_val, in mt9m111_restore_state()
945 mt9m111->current_mode->reg_mask); in mt9m111_restore_state()
961 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_init()
968 ret = mt9m111_set_context(mt9m111, mt9m111->ctx); in mt9m111_init()
970 dev_err(&client->dev, "mt9m111 init failed: %d\n", ret); in mt9m111_init()
976 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_power_on()
979 ret = clk_prepare_enable(mt9m111->clk); in mt9m111_power_on()
983 ret = regulator_enable(mt9m111->regulator); in mt9m111_power_on()
994 regulator_disable(mt9m111->regulator); in mt9m111_power_on()
997 clk_disable_unprepare(mt9m111->clk); in mt9m111_power_on()
999 dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret); in mt9m111_power_on()
1007 regulator_disable(mt9m111->regulator); in mt9m111_power_off()
1008 clk_disable_unprepare(mt9m111->clk); in mt9m111_power_off()
1016 mutex_lock(&mt9m111->power_lock); in mt9m111_s_power()
1022 if (mt9m111->power_count == !on) { in mt9m111_s_power()
1031 mt9m111->power_count += on ? 1 : -1; in mt9m111_s_power()
1032 WARN_ON(mt9m111->power_count < 0); in mt9m111_s_power()
1035 mutex_unlock(&mt9m111->power_lock); in mt9m111_s_power()
1059 fi->interval = mt9m111->frame_interval; in mt9m111_g_frame_interval()
1068 const struct mt9m111_mode_info *mode; in mt9m111_s_frame_interval() local
1069 struct v4l2_fract *fract = &fi->interval; in mt9m111_s_frame_interval()
1072 if (mt9m111->is_streaming) in mt9m111_s_frame_interval()
1073 return -EBUSY; in mt9m111_s_frame_interval()
1075 if (fi->pad != 0) in mt9m111_s_frame_interval()
1076 return -EINVAL; in mt9m111_s_frame_interval()
1078 if (fract->numerator == 0) { in mt9m111_s_frame_interval()
1079 fract->denominator = 30; in mt9m111_s_frame_interval()
1080 fract->numerator = 1; in mt9m111_s_frame_interval()
1083 fps = DIV_ROUND_CLOSEST(fract->denominator, fract->numerator); in mt9m111_s_frame_interval()
1085 /* Find best fitting mode. Do not update the mode if no one was found. */ in mt9m111_s_frame_interval()
1086 mode = mt9m111_find_mode(mt9m111, fps, mt9m111->width, mt9m111->height); in mt9m111_s_frame_interval()
1087 if (!mode) in mt9m111_s_frame_interval()
1090 if (mode->max_fps != fps) { in mt9m111_s_frame_interval()
1091 fract->denominator = mode->max_fps; in mt9m111_s_frame_interval()
1092 fract->numerator = 1; in mt9m111_s_frame_interval()
1095 mt9m111->current_mode = mode; in mt9m111_s_frame_interval()
1096 mt9m111->frame_interval = fi->interval; in mt9m111_s_frame_interval()
1105 if (code->pad || code->index >= ARRAY_SIZE(mt9m111_colour_fmts)) in mt9m111_enum_mbus_code()
1106 return -EINVAL; in mt9m111_enum_mbus_code()
1108 code->code = mt9m111_colour_fmts[code->index].code; in mt9m111_enum_mbus_code()
1116 mt9m111->is_streaming = !!enable; in mt9m111_s_stream()
1127 format->width = MT9M111_MAX_WIDTH; in mt9m111_init_cfg()
1128 format->height = MT9M111_MAX_HEIGHT; in mt9m111_init_cfg()
1129 format->code = mt9m111_colour_fmts[0].code; in mt9m111_init_cfg()
1130 format->colorspace = mt9m111_colour_fmts[0].colorspace; in mt9m111_init_cfg()
1131 format->field = V4L2_FIELD_NONE; in mt9m111_init_cfg()
1132 format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; in mt9m111_init_cfg()
1133 format->quantization = V4L2_QUANTIZATION_DEFAULT; in mt9m111_init_cfg()
1134 format->xfer_func = V4L2_XFER_FUNC_DEFAULT; in mt9m111_init_cfg()
1145 cfg->type = V4L2_MBUS_PARALLEL; in mt9m111_get_mbus_config()
1147 cfg->bus.parallel.flags = V4L2_MBUS_MASTER | in mt9m111_get_mbus_config()
1152 cfg->bus.parallel.flags |= mt9m111->pclk_sample ? in mt9m111_get_mbus_config()
1177 .video = &mt9m111_subdev_video_ops,
1191 ret = mt9m111_s_power(&mt9m111->subdev, 1); in mt9m111_video_probe()
1199 dev_info(&client->dev, in mt9m111_video_probe()
1203 dev_info(&client->dev, "Detected a MT9M112 chip ID %x\n", data); in mt9m111_video_probe()
1206 dev_err(&client->dev, in mt9m111_video_probe()
1209 ret = -ENODEV; in mt9m111_video_probe()
1217 ret = v4l2_ctrl_handler_setup(&mt9m111->hdl); in mt9m111_video_probe()
1220 mt9m111_s_power(&mt9m111->subdev, 0); in mt9m111_video_probe()
1232 np = fwnode_graph_get_next_endpoint(dev_fwnode(&client->dev), NULL); in mt9m111_probe_fw()
1234 return -EINVAL; in mt9m111_probe_fw()
1240 mt9m111->pclk_sample = !!(bus_cfg.bus.parallel.flags & in mt9m111_probe_fw()
1251 struct i2c_adapter *adapter = client->adapter; in mt9m111_probe()
1255 dev_warn(&adapter->dev, in mt9m111_probe()
1256 "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n"); in mt9m111_probe()
1257 return -EIO; in mt9m111_probe()
1260 mt9m111 = devm_kzalloc(&client->dev, sizeof(struct mt9m111), GFP_KERNEL); in mt9m111_probe()
1262 return -ENOMEM; in mt9m111_probe()
1264 if (dev_fwnode(&client->dev)) { in mt9m111_probe()
1270 mt9m111->clk = devm_clk_get(&client->dev, "mclk"); in mt9m111_probe()
1271 if (IS_ERR(mt9m111->clk)) in mt9m111_probe()
1272 return PTR_ERR(mt9m111->clk); in mt9m111_probe()
1274 mt9m111->regulator = devm_regulator_get(&client->dev, "vdd"); in mt9m111_probe()
1275 if (IS_ERR(mt9m111->regulator)) { in mt9m111_probe()
1276 dev_err(&client->dev, "regulator not found: %ld\n", in mt9m111_probe()
1277 PTR_ERR(mt9m111->regulator)); in mt9m111_probe()
1278 return PTR_ERR(mt9m111->regulator); in mt9m111_probe()
1282 mt9m111->ctx = &context_b; in mt9m111_probe()
1284 v4l2_i2c_subdev_init(&mt9m111->subdev, client, &mt9m111_subdev_ops); in mt9m111_probe()
1285 mt9m111->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | in mt9m111_probe()
1288 v4l2_ctrl_handler_init(&mt9m111->hdl, 7); in mt9m111_probe()
1289 v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1291 v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1293 v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1295 mt9m111->gain = v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1297 v4l2_ctrl_new_std_menu(&mt9m111->hdl, in mt9m111_probe()
1300 v4l2_ctrl_new_std_menu_items(&mt9m111->hdl, in mt9m111_probe()
1302 ARRAY_SIZE(mt9m111_test_pattern_menu) - 1, 0, 0, in mt9m111_probe()
1304 v4l2_ctrl_new_std_menu(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1312 mt9m111->subdev.ctrl_handler = &mt9m111->hdl; in mt9m111_probe()
1313 if (mt9m111->hdl.error) { in mt9m111_probe()
1314 ret = mt9m111->hdl.error; in mt9m111_probe()
1319 mt9m111->pad.flags = MEDIA_PAD_FL_SOURCE; in mt9m111_probe()
1320 mt9m111->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; in mt9m111_probe()
1321 ret = media_entity_pads_init(&mt9m111->subdev.entity, 1, &mt9m111->pad); in mt9m111_probe()
1326 mt9m111->current_mode = &mt9m111_mode_data[MT9M111_MODE_SXGA_15FPS]; in mt9m111_probe()
1327 mt9m111->frame_interval.numerator = 1; in mt9m111_probe()
1328 mt9m111->frame_interval.denominator = mt9m111->current_mode->max_fps; in mt9m111_probe()
1330 /* Second stage probe - when a capture adapter is there */ in mt9m111_probe()
1331 mt9m111->rect.left = MT9M111_MIN_DARK_COLS; in mt9m111_probe()
1332 mt9m111->rect.top = MT9M111_MIN_DARK_ROWS; in mt9m111_probe()
1333 mt9m111->rect.width = MT9M111_MAX_WIDTH; in mt9m111_probe()
1334 mt9m111->rect.height = MT9M111_MAX_HEIGHT; in mt9m111_probe()
1335 mt9m111->width = mt9m111->rect.width; in mt9m111_probe()
1336 mt9m111->height = mt9m111->rect.height; in mt9m111_probe()
1337 mt9m111->fmt = &mt9m111_colour_fmts[0]; in mt9m111_probe()
1338 mt9m111->lastpage = -1; in mt9m111_probe()
1339 mutex_init(&mt9m111->power_lock); in mt9m111_probe()
1345 mt9m111->subdev.dev = &client->dev; in mt9m111_probe()
1346 ret = v4l2_async_register_subdev(&mt9m111->subdev); in mt9m111_probe()
1354 media_entity_cleanup(&mt9m111->subdev.entity); in mt9m111_probe()
1357 v4l2_ctrl_handler_free(&mt9m111->hdl); in mt9m111_probe()
1366 v4l2_async_unregister_subdev(&mt9m111->subdev); in mt9m111_remove()
1367 media_entity_cleanup(&mt9m111->subdev.entity); in mt9m111_remove()
1368 v4l2_ctrl_handler_free(&mt9m111->hdl); in mt9m111_remove()