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-clk.h>
20 #include <media/v4l2-common.h>
21 #include <media/v4l2-ctrls.h>
22 #include <media/v4l2-device.h>
23 #include <media/v4l2-event.h>
24 #include <media/v4l2-fwnode.h>
246 /* user point of view - 0: falling 1: rising edge */
293 return mt9m111->fmt; in mt9m111_find_datafmt()
308 if (page == mt9m111->lastpage) in reg_page_map_set()
311 return -EINVAL; in reg_page_map_set()
315 mt9m111->lastpage = page; in reg_page_map_set()
327 dev_dbg(&client->dev, "read reg.%03x -> %04x\n", reg, ret); in mt9m111_reg_read()
339 dev_dbg(&client->dev, "write reg.%03x = %04x -> %d\n", reg, data, ret); in mt9m111_reg_write()
379 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_context()
380 return reg_write(CONTEXT_CONTROL, ctx->control); in mt9m111_set_context()
387 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_rect_ctx()
388 int ret = mt9m111_reg_write(client, ctx->reducer_xzoom, rect->width); in mt9m111_setup_rect_ctx()
390 ret = mt9m111_reg_write(client, ctx->reducer_yzoom, rect->height); in mt9m111_setup_rect_ctx()
392 ret = mt9m111_reg_write(client, ctx->reducer_xsize, width); in mt9m111_setup_rect_ctx()
394 ret = mt9m111_reg_write(client, ctx->reducer_ysize, height); in mt9m111_setup_rect_ctx()
401 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_geometry()
404 ret = reg_write(COLUMN_START, rect->left); in mt9m111_setup_geometry()
406 ret = reg_write(ROW_START, rect->top); in mt9m111_setup_geometry()
409 ret = reg_write(WINDOW_WIDTH, rect->width); in mt9m111_setup_geometry()
411 ret = reg_write(WINDOW_HEIGHT, rect->height); in mt9m111_setup_geometry()
414 /* IFP in use, down-scaling possible */ in mt9m111_setup_geometry()
423 dev_dbg(&client->dev, "%s(%x): %ux%u@%u:%u -> %ux%u = %d\n", in mt9m111_setup_geometry()
424 __func__, code, rect->width, rect->height, rect->left, rect->top, in mt9m111_setup_geometry()
432 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_enable()
438 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_reset()
457 struct v4l2_rect rect = sel->r; in mt9m111_set_selection()
461 if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || in mt9m111_set_selection()
462 sel->target != V4L2_SEL_TGT_CROP) in mt9m111_set_selection()
463 return -EINVAL; in mt9m111_set_selection()
465 if (mt9m111->fmt->code == MEDIA_BUS_FMT_SBGGR8_1X8 || in mt9m111_set_selection()
466 mt9m111->fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) { in mt9m111_set_selection()
467 /* Bayer format - even size lengths */ in mt9m111_set_selection()
476 MT9M111_MIN_DARK_COLS + MT9M111_MAX_WIDTH - in mt9m111_set_selection()
479 MT9M111_MIN_DARK_ROWS + MT9M111_MAX_HEIGHT - in mt9m111_set_selection()
482 width = min(mt9m111->width, rect.width); in mt9m111_set_selection()
483 height = min(mt9m111->height, rect.height); in mt9m111_set_selection()
485 ret = mt9m111_setup_geometry(mt9m111, &rect, width, height, mt9m111->fmt->code); in mt9m111_set_selection()
487 mt9m111->rect = rect; in mt9m111_set_selection()
488 mt9m111->width = width; in mt9m111_set_selection()
489 mt9m111->height = height; in mt9m111_set_selection()
502 if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) in mt9m111_get_selection()
503 return -EINVAL; in mt9m111_get_selection()
505 switch (sel->target) { in mt9m111_get_selection()
507 sel->r.left = MT9M111_MIN_DARK_COLS; in mt9m111_get_selection()
508 sel->r.top = MT9M111_MIN_DARK_ROWS; in mt9m111_get_selection()
509 sel->r.width = MT9M111_MAX_WIDTH; in mt9m111_get_selection()
510 sel->r.height = MT9M111_MAX_HEIGHT; in mt9m111_get_selection()
513 sel->r = mt9m111->rect; in mt9m111_get_selection()
516 return -EINVAL; in mt9m111_get_selection()
524 struct v4l2_mbus_framefmt *mf = &format->format; in mt9m111_get_fmt()
527 if (format->pad) in mt9m111_get_fmt()
528 return -EINVAL; in mt9m111_get_fmt()
530 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { in mt9m111_get_fmt()
532 mf = v4l2_subdev_get_try_format(sd, cfg, format->pad); in mt9m111_get_fmt()
533 format->format = *mf; in mt9m111_get_fmt()
536 return -EINVAL; in mt9m111_get_fmt()
540 mf->width = mt9m111->width; in mt9m111_get_fmt()
541 mf->height = mt9m111->height; in mt9m111_get_fmt()
542 mf->code = mt9m111->fmt->code; in mt9m111_get_fmt()
543 mf->colorspace = mt9m111->fmt->colorspace; in mt9m111_get_fmt()
544 mf->field = V4L2_FIELD_NONE; in mt9m111_get_fmt()
545 mf->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; in mt9m111_get_fmt()
546 mf->quantization = V4L2_QUANTIZATION_DEFAULT; in mt9m111_get_fmt()
547 mf->xfer_func = V4L2_XFER_FUNC_DEFAULT; in mt9m111_get_fmt()
555 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_pixfmt()
609 dev_err(&client->dev, "Pixel format not handled: %x\n", code); in mt9m111_set_pixfmt()
610 return -EINVAL; in mt9m111_set_pixfmt()
613 /* receiver samples on falling edge, chip-hw default is rising */ in mt9m111_set_pixfmt()
614 if (mt9m111->pclk_sample == 0) in mt9m111_set_pixfmt()
630 struct v4l2_mbus_framefmt *mf = &format->format; in mt9m111_set_fmt()
634 struct v4l2_rect *rect = &mt9m111->rect; in mt9m111_set_fmt()
638 if (mt9m111->is_streaming) in mt9m111_set_fmt()
639 return -EBUSY; in mt9m111_set_fmt()
641 if (format->pad) in mt9m111_set_fmt()
642 return -EINVAL; in mt9m111_set_fmt()
644 fmt = mt9m111_find_datafmt(mt9m111, mf->code); in mt9m111_set_fmt()
646 bayer = fmt->code == MEDIA_BUS_FMT_SBGGR8_1X8 || in mt9m111_set_fmt()
647 fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE; in mt9m111_set_fmt()
650 * With Bayer format enforce even side lengths, but let the user play in mt9m111_set_fmt()
654 rect->width = ALIGN(rect->width, 2); in mt9m111_set_fmt()
655 rect->height = ALIGN(rect->height, 2); in mt9m111_set_fmt()
658 if (fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) { in mt9m111_set_fmt()
659 /* IFP bypass mode, no scaling */ in mt9m111_set_fmt()
660 mf->width = rect->width; in mt9m111_set_fmt()
661 mf->height = rect->height; in mt9m111_set_fmt()
664 if (mf->width > rect->width) in mt9m111_set_fmt()
665 mf->width = rect->width; in mt9m111_set_fmt()
666 if (mf->height > rect->height) in mt9m111_set_fmt()
667 mf->height = rect->height; in mt9m111_set_fmt()
670 dev_dbg(&client->dev, "%s(): %ux%u, code=%x\n", __func__, in mt9m111_set_fmt()
671 mf->width, mf->height, fmt->code); in mt9m111_set_fmt()
673 mf->code = fmt->code; in mt9m111_set_fmt()
674 mf->colorspace = fmt->colorspace; in mt9m111_set_fmt()
675 mf->field = V4L2_FIELD_NONE; in mt9m111_set_fmt()
676 mf->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; in mt9m111_set_fmt()
677 mf->quantization = V4L2_QUANTIZATION_DEFAULT; in mt9m111_set_fmt()
678 mf->xfer_func = V4L2_XFER_FUNC_DEFAULT; in mt9m111_set_fmt()
680 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { in mt9m111_set_fmt()
681 cfg->try_fmt = *mf; in mt9m111_set_fmt()
685 ret = mt9m111_setup_geometry(mt9m111, rect, mf->width, mf->height, mf->code); in mt9m111_set_fmt()
687 ret = mt9m111_set_pixfmt(mt9m111, mf->code); in mt9m111_set_fmt()
689 mt9m111->width = mf->width; in mt9m111_set_fmt()
690 mt9m111->height = mf->height; in mt9m111_set_fmt()
691 mt9m111->fmt = fmt; in mt9m111_set_fmt()
701 const struct mt9m111_mode_info *mode; in mt9m111_find_mode() local
702 struct v4l2_rect *sensor_rect = &mt9m111->rect; in mt9m111_find_mode()
703 unsigned int gap, gap_best = (unsigned int) -1; in mt9m111_find_mode()
712 if (sensor_rect->width != MT9M111_MAX_WIDTH || in mt9m111_find_mode()
713 sensor_rect->height != MT9M111_MAX_HEIGHT) { in mt9m111_find_mode()
714 dev_info(mt9m111->subdev.dev, in mt9m111_find_mode()
722 dev_dbg(mt9m111->subdev.dev, in mt9m111_find_mode()
735 gap = abs(fps - req_fps); in mt9m111_find_mode()
746 mode = &mt9m111_mode_data[best_gap_idx]; in mt9m111_find_mode()
747 mt9m111->ctx = (best_gap_idx == MT9M111_MODE_QSXGA_30FPS) ? &context_a : in mt9m111_find_mode()
749 return mode; in mt9m111_find_mode()
759 if (reg->reg > 0x2ff) in mt9m111_g_register()
760 return -EINVAL; in mt9m111_g_register()
762 val = mt9m111_reg_read(client, reg->reg); in mt9m111_g_register()
763 reg->size = 2; in mt9m111_g_register()
764 reg->val = (u64)val; in mt9m111_g_register()
766 if (reg->val > 0xffff) in mt9m111_g_register()
767 return -EIO; in mt9m111_g_register()
777 if (reg->reg > 0x2ff) in mt9m111_s_register()
778 return -EINVAL; in mt9m111_s_register()
780 if (mt9m111_reg_write(client, reg->reg, reg->val) < 0) in mt9m111_s_register()
781 return -EIO; in mt9m111_s_register()
789 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_flip()
793 ret = mt9m111_reg_set(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
795 ret = mt9m111_reg_clear(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
802 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_get_global_gain()
814 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_global_gain()
818 return -EINVAL; in mt9m111_set_global_gain()
832 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autoexposure()
841 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autowhitebalance()
861 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_test_pattern()
869 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_colorfx()
887 return -EINVAL; in mt9m111_set_colorfx()
892 struct mt9m111 *mt9m111 = container_of(ctrl->handler, in mt9m111_s_ctrl()
895 switch (ctrl->id) { in mt9m111_s_ctrl()
897 return mt9m111_set_flip(mt9m111, ctrl->val, in mt9m111_s_ctrl()
900 return mt9m111_set_flip(mt9m111, ctrl->val, in mt9m111_s_ctrl()
903 return mt9m111_set_global_gain(mt9m111, ctrl->val); in mt9m111_s_ctrl()
905 return mt9m111_set_autoexposure(mt9m111, ctrl->val); in mt9m111_s_ctrl()
907 return mt9m111_set_autowhitebalance(mt9m111, ctrl->val); in mt9m111_s_ctrl()
909 return mt9m111_set_test_pattern(mt9m111, ctrl->val); in mt9m111_s_ctrl()
911 return mt9m111_set_colorfx(mt9m111, ctrl->val); in mt9m111_s_ctrl()
914 return -EINVAL; in mt9m111_s_ctrl()
919 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_suspend()
922 v4l2_ctrl_s_ctrl(mt9m111->gain, mt9m111_get_global_gain(mt9m111)); in mt9m111_suspend()
937 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_restore_state()
939 mt9m111_set_context(mt9m111, mt9m111->ctx); in mt9m111_restore_state()
940 mt9m111_set_pixfmt(mt9m111, mt9m111->fmt->code); in mt9m111_restore_state()
941 mt9m111_setup_geometry(mt9m111, &mt9m111->rect, in mt9m111_restore_state()
942 mt9m111->width, mt9m111->height, mt9m111->fmt->code); in mt9m111_restore_state()
943 v4l2_ctrl_handler_setup(&mt9m111->hdl); in mt9m111_restore_state()
944 mt9m111_reg_mask(client, mt9m111->ctx->read_mode, in mt9m111_restore_state()
945 mt9m111->current_mode->reg_val, in mt9m111_restore_state()
946 mt9m111->current_mode->reg_mask); in mt9m111_restore_state()
962 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_init()
969 ret = mt9m111_set_context(mt9m111, mt9m111->ctx); in mt9m111_init()
971 dev_err(&client->dev, "mt9m111 init failed: %d\n", ret); in mt9m111_init()
977 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_power_on()
980 ret = v4l2_clk_enable(mt9m111->clk); in mt9m111_power_on()
984 ret = regulator_enable(mt9m111->regulator); in mt9m111_power_on()
995 regulator_disable(mt9m111->regulator); in mt9m111_power_on()
998 v4l2_clk_disable(mt9m111->clk); in mt9m111_power_on()
1000 dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret); in mt9m111_power_on()
1008 regulator_disable(mt9m111->regulator); in mt9m111_power_off()
1009 v4l2_clk_disable(mt9m111->clk); in mt9m111_power_off()
1017 mutex_lock(&mt9m111->power_lock); in mt9m111_s_power()
1023 if (mt9m111->power_count == !on) { in mt9m111_s_power()
1032 mt9m111->power_count += on ? 1 : -1; in mt9m111_s_power()
1033 WARN_ON(mt9m111->power_count < 0); in mt9m111_s_power()
1036 mutex_unlock(&mt9m111->power_lock); in mt9m111_s_power()
1060 fi->interval = mt9m111->frame_interval; in mt9m111_g_frame_interval()
1069 const struct mt9m111_mode_info *mode; in mt9m111_s_frame_interval() local
1070 struct v4l2_fract *fract = &fi->interval; in mt9m111_s_frame_interval()
1073 if (mt9m111->is_streaming) in mt9m111_s_frame_interval()
1074 return -EBUSY; in mt9m111_s_frame_interval()
1076 if (fi->pad != 0) in mt9m111_s_frame_interval()
1077 return -EINVAL; in mt9m111_s_frame_interval()
1079 if (fract->numerator == 0) { in mt9m111_s_frame_interval()
1080 fract->denominator = 30; in mt9m111_s_frame_interval()
1081 fract->numerator = 1; in mt9m111_s_frame_interval()
1084 fps = DIV_ROUND_CLOSEST(fract->denominator, fract->numerator); in mt9m111_s_frame_interval()
1086 /* Find best fitting mode. Do not update the mode if no one was found. */ in mt9m111_s_frame_interval()
1087 mode = mt9m111_find_mode(mt9m111, fps, mt9m111->width, mt9m111->height); in mt9m111_s_frame_interval()
1088 if (!mode) in mt9m111_s_frame_interval()
1091 if (mode->max_fps != fps) { in mt9m111_s_frame_interval()
1092 fract->denominator = mode->max_fps; in mt9m111_s_frame_interval()
1093 fract->numerator = 1; in mt9m111_s_frame_interval()
1096 mt9m111->current_mode = mode; in mt9m111_s_frame_interval()
1097 mt9m111->frame_interval = fi->interval; in mt9m111_s_frame_interval()
1106 if (code->pad || code->index >= ARRAY_SIZE(mt9m111_colour_fmts)) in mt9m111_enum_mbus_code()
1107 return -EINVAL; in mt9m111_enum_mbus_code()
1109 code->code = mt9m111_colour_fmts[code->index].code; in mt9m111_enum_mbus_code()
1117 mt9m111->is_streaming = !!enable; in mt9m111_s_stream()
1128 format->width = MT9M111_MAX_WIDTH; in mt9m111_init_cfg()
1129 format->height = MT9M111_MAX_HEIGHT; in mt9m111_init_cfg()
1130 format->code = mt9m111_colour_fmts[0].code; in mt9m111_init_cfg()
1131 format->colorspace = mt9m111_colour_fmts[0].colorspace; in mt9m111_init_cfg()
1132 format->field = V4L2_FIELD_NONE; in mt9m111_init_cfg()
1133 format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; in mt9m111_init_cfg()
1134 format->quantization = V4L2_QUANTIZATION_DEFAULT; in mt9m111_init_cfg()
1135 format->xfer_func = V4L2_XFER_FUNC_DEFAULT; in mt9m111_init_cfg()
1146 cfg->flags = V4L2_MBUS_MASTER | in mt9m111_get_mbus_config()
1150 cfg->flags |= mt9m111->pclk_sample ? V4L2_MBUS_PCLK_SAMPLE_RISING : in mt9m111_get_mbus_config()
1153 cfg->type = V4L2_MBUS_PARALLEL; in mt9m111_get_mbus_config()
1176 .video = &mt9m111_subdev_video_ops,
1190 ret = mt9m111_s_power(&mt9m111->subdev, 1); in mt9m111_video_probe()
1198 dev_info(&client->dev, in mt9m111_video_probe()
1202 dev_info(&client->dev, "Detected a MT9M112 chip ID %x\n", data); in mt9m111_video_probe()
1205 dev_err(&client->dev, in mt9m111_video_probe()
1208 ret = -ENODEV; in mt9m111_video_probe()
1216 ret = v4l2_ctrl_handler_setup(&mt9m111->hdl); in mt9m111_video_probe()
1219 mt9m111_s_power(&mt9m111->subdev, 0); in mt9m111_video_probe()
1231 np = fwnode_graph_get_next_endpoint(dev_fwnode(&client->dev), NULL); in mt9m111_probe_fw()
1233 return -EINVAL; in mt9m111_probe_fw()
1239 mt9m111->pclk_sample = !!(bus_cfg.bus.parallel.flags & in mt9m111_probe_fw()
1250 struct i2c_adapter *adapter = client->adapter; in mt9m111_probe()
1254 dev_warn(&adapter->dev, in mt9m111_probe()
1255 "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n"); in mt9m111_probe()
1256 return -EIO; in mt9m111_probe()
1259 mt9m111 = devm_kzalloc(&client->dev, sizeof(struct mt9m111), GFP_KERNEL); in mt9m111_probe()
1261 return -ENOMEM; in mt9m111_probe()
1263 if (dev_fwnode(&client->dev)) { in mt9m111_probe()
1269 mt9m111->clk = v4l2_clk_get(&client->dev, "mclk"); in mt9m111_probe()
1270 if (IS_ERR(mt9m111->clk)) in mt9m111_probe()
1271 return PTR_ERR(mt9m111->clk); in mt9m111_probe()
1273 mt9m111->regulator = devm_regulator_get(&client->dev, "vdd"); in mt9m111_probe()
1274 if (IS_ERR(mt9m111->regulator)) { in mt9m111_probe()
1275 dev_err(&client->dev, "regulator not found: %ld\n", in mt9m111_probe()
1276 PTR_ERR(mt9m111->regulator)); in mt9m111_probe()
1277 return PTR_ERR(mt9m111->regulator); in mt9m111_probe()
1281 mt9m111->ctx = &context_b; in mt9m111_probe()
1283 v4l2_i2c_subdev_init(&mt9m111->subdev, client, &mt9m111_subdev_ops); in mt9m111_probe()
1284 mt9m111->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | in mt9m111_probe()
1287 v4l2_ctrl_handler_init(&mt9m111->hdl, 7); in mt9m111_probe()
1288 v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1290 v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1292 v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1294 mt9m111->gain = v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1296 v4l2_ctrl_new_std_menu(&mt9m111->hdl, in mt9m111_probe()
1299 v4l2_ctrl_new_std_menu_items(&mt9m111->hdl, in mt9m111_probe()
1301 ARRAY_SIZE(mt9m111_test_pattern_menu) - 1, 0, 0, in mt9m111_probe()
1303 v4l2_ctrl_new_std_menu(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1311 mt9m111->subdev.ctrl_handler = &mt9m111->hdl; in mt9m111_probe()
1312 if (mt9m111->hdl.error) { in mt9m111_probe()
1313 ret = mt9m111->hdl.error; in mt9m111_probe()
1318 mt9m111->pad.flags = MEDIA_PAD_FL_SOURCE; in mt9m111_probe()
1319 mt9m111->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; in mt9m111_probe()
1320 ret = media_entity_pads_init(&mt9m111->subdev.entity, 1, &mt9m111->pad); in mt9m111_probe()
1325 mt9m111->current_mode = &mt9m111_mode_data[MT9M111_MODE_SXGA_15FPS]; in mt9m111_probe()
1326 mt9m111->frame_interval.numerator = 1; in mt9m111_probe()
1327 mt9m111->frame_interval.denominator = mt9m111->current_mode->max_fps; in mt9m111_probe()
1329 /* Second stage probe - when a capture adapter is there */ in mt9m111_probe()
1330 mt9m111->rect.left = MT9M111_MIN_DARK_COLS; in mt9m111_probe()
1331 mt9m111->rect.top = MT9M111_MIN_DARK_ROWS; in mt9m111_probe()
1332 mt9m111->rect.width = MT9M111_MAX_WIDTH; in mt9m111_probe()
1333 mt9m111->rect.height = MT9M111_MAX_HEIGHT; in mt9m111_probe()
1334 mt9m111->width = mt9m111->rect.width; in mt9m111_probe()
1335 mt9m111->height = mt9m111->rect.height; in mt9m111_probe()
1336 mt9m111->fmt = &mt9m111_colour_fmts[0]; in mt9m111_probe()
1337 mt9m111->lastpage = -1; in mt9m111_probe()
1338 mutex_init(&mt9m111->power_lock); in mt9m111_probe()
1344 mt9m111->subdev.dev = &client->dev; in mt9m111_probe()
1345 ret = v4l2_async_register_subdev(&mt9m111->subdev); in mt9m111_probe()
1353 media_entity_cleanup(&mt9m111->subdev.entity); in mt9m111_probe()
1356 v4l2_ctrl_handler_free(&mt9m111->hdl); in mt9m111_probe()
1358 v4l2_clk_put(mt9m111->clk); in mt9m111_probe()
1367 v4l2_async_unregister_subdev(&mt9m111->subdev); in mt9m111_remove()
1368 media_entity_cleanup(&mt9m111->subdev.entity); in mt9m111_remove()
1369 v4l2_clk_put(mt9m111->clk); in mt9m111_remove()
1370 v4l2_ctrl_handler_free(&mt9m111->hdl); in mt9m111_remove()