Lines Matching +full:abs +full:- +full:flat
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 */
290 return mt9m111->fmt; in mt9m111_find_datafmt()
305 if (page == mt9m111->lastpage) in reg_page_map_set()
308 return -EINVAL; in reg_page_map_set()
312 mt9m111->lastpage = page; in reg_page_map_set()
324 dev_dbg(&client->dev, "read reg.%03x -> %04x\n", reg, ret); in mt9m111_reg_read()
336 dev_dbg(&client->dev, "write reg.%03x = %04x -> %d\n", reg, data, ret); in mt9m111_reg_write()
376 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_context()
377 return reg_write(CONTEXT_CONTROL, ctx->control); in mt9m111_set_context()
384 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_rect_ctx()
385 int ret = mt9m111_reg_write(client, ctx->reducer_xzoom, rect->width); in mt9m111_setup_rect_ctx()
387 ret = mt9m111_reg_write(client, ctx->reducer_yzoom, rect->height); in mt9m111_setup_rect_ctx()
389 ret = mt9m111_reg_write(client, ctx->reducer_xsize, width); in mt9m111_setup_rect_ctx()
391 ret = mt9m111_reg_write(client, ctx->reducer_ysize, height); in mt9m111_setup_rect_ctx()
398 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_setup_geometry()
401 ret = reg_write(COLUMN_START, rect->left); in mt9m111_setup_geometry()
403 ret = reg_write(ROW_START, rect->top); in mt9m111_setup_geometry()
406 ret = reg_write(WINDOW_WIDTH, rect->width); in mt9m111_setup_geometry()
408 ret = reg_write(WINDOW_HEIGHT, rect->height); in mt9m111_setup_geometry()
411 /* IFP in use, down-scaling possible */ in mt9m111_setup_geometry()
420 dev_dbg(&client->dev, "%s(%x): %ux%u@%u:%u -> %ux%u = %d\n", in mt9m111_setup_geometry()
421 __func__, code, rect->width, rect->height, rect->left, rect->top, in mt9m111_setup_geometry()
429 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_enable()
435 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_reset()
454 struct v4l2_rect rect = sel->r; in mt9m111_set_selection()
458 if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE || in mt9m111_set_selection()
459 sel->target != V4L2_SEL_TGT_CROP) in mt9m111_set_selection()
460 return -EINVAL; in mt9m111_set_selection()
462 if (mt9m111->fmt->code == MEDIA_BUS_FMT_SBGGR8_1X8 || in mt9m111_set_selection()
463 mt9m111->fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) { in mt9m111_set_selection()
464 /* Bayer format - even size lengths */ in mt9m111_set_selection()
473 MT9M111_MIN_DARK_COLS + MT9M111_MAX_WIDTH - in mt9m111_set_selection()
476 MT9M111_MIN_DARK_ROWS + MT9M111_MAX_HEIGHT - in mt9m111_set_selection()
479 width = min(mt9m111->width, rect.width); in mt9m111_set_selection()
480 height = min(mt9m111->height, rect.height); in mt9m111_set_selection()
482 ret = mt9m111_setup_geometry(mt9m111, &rect, width, height, mt9m111->fmt->code); in mt9m111_set_selection()
484 mt9m111->rect = rect; in mt9m111_set_selection()
485 mt9m111->width = width; in mt9m111_set_selection()
486 mt9m111->height = height; in mt9m111_set_selection()
499 if (sel->which != V4L2_SUBDEV_FORMAT_ACTIVE) in mt9m111_get_selection()
500 return -EINVAL; in mt9m111_get_selection()
502 switch (sel->target) { in mt9m111_get_selection()
504 sel->r.left = MT9M111_MIN_DARK_COLS; in mt9m111_get_selection()
505 sel->r.top = MT9M111_MIN_DARK_ROWS; in mt9m111_get_selection()
506 sel->r.width = MT9M111_MAX_WIDTH; in mt9m111_get_selection()
507 sel->r.height = MT9M111_MAX_HEIGHT; in mt9m111_get_selection()
510 sel->r = mt9m111->rect; in mt9m111_get_selection()
513 return -EINVAL; in mt9m111_get_selection()
521 struct v4l2_mbus_framefmt *mf = &format->format; in mt9m111_get_fmt()
524 if (format->pad) in mt9m111_get_fmt()
525 return -EINVAL; in mt9m111_get_fmt()
527 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { in mt9m111_get_fmt()
528 mf = v4l2_subdev_state_get_format(sd_state, format->pad); in mt9m111_get_fmt()
529 format->format = *mf; in mt9m111_get_fmt()
533 mf->width = mt9m111->width; in mt9m111_get_fmt()
534 mf->height = mt9m111->height; in mt9m111_get_fmt()
535 mf->code = mt9m111->fmt->code; in mt9m111_get_fmt()
536 mf->colorspace = mt9m111->fmt->colorspace; in mt9m111_get_fmt()
537 mf->field = V4L2_FIELD_NONE; in mt9m111_get_fmt()
538 mf->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; in mt9m111_get_fmt()
539 mf->quantization = V4L2_QUANTIZATION_DEFAULT; in mt9m111_get_fmt()
540 mf->xfer_func = V4L2_XFER_FUNC_DEFAULT; in mt9m111_get_fmt()
548 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_pixfmt()
602 dev_err(&client->dev, "Pixel format not handled: %x\n", code); in mt9m111_set_pixfmt()
603 return -EINVAL; in mt9m111_set_pixfmt()
606 /* receiver samples on falling edge, chip-hw default is rising */ in mt9m111_set_pixfmt()
607 if (mt9m111->pclk_sample == 0) in mt9m111_set_pixfmt()
623 struct v4l2_mbus_framefmt *mf = &format->format; in mt9m111_set_fmt()
627 struct v4l2_rect *rect = &mt9m111->rect; in mt9m111_set_fmt()
631 if (mt9m111->is_streaming) in mt9m111_set_fmt()
632 return -EBUSY; in mt9m111_set_fmt()
634 if (format->pad) in mt9m111_set_fmt()
635 return -EINVAL; in mt9m111_set_fmt()
637 fmt = mt9m111_find_datafmt(mt9m111, mf->code); in mt9m111_set_fmt()
639 bayer = fmt->code == MEDIA_BUS_FMT_SBGGR8_1X8 || in mt9m111_set_fmt()
640 fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE; in mt9m111_set_fmt()
647 rect->width = ALIGN(rect->width, 2); in mt9m111_set_fmt()
648 rect->height = ALIGN(rect->height, 2); in mt9m111_set_fmt()
651 if (fmt->code == MEDIA_BUS_FMT_SBGGR10_2X8_PADHI_LE) { in mt9m111_set_fmt()
653 mf->width = rect->width; in mt9m111_set_fmt()
654 mf->height = rect->height; in mt9m111_set_fmt()
657 if (mf->width > rect->width) in mt9m111_set_fmt()
658 mf->width = rect->width; in mt9m111_set_fmt()
659 if (mf->height > rect->height) in mt9m111_set_fmt()
660 mf->height = rect->height; in mt9m111_set_fmt()
663 dev_dbg(&client->dev, "%s(): %ux%u, code=%x\n", __func__, in mt9m111_set_fmt()
664 mf->width, mf->height, fmt->code); in mt9m111_set_fmt()
666 mf->code = fmt->code; in mt9m111_set_fmt()
667 mf->colorspace = fmt->colorspace; in mt9m111_set_fmt()
668 mf->field = V4L2_FIELD_NONE; in mt9m111_set_fmt()
669 mf->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; in mt9m111_set_fmt()
670 mf->quantization = V4L2_QUANTIZATION_DEFAULT; in mt9m111_set_fmt()
671 mf->xfer_func = V4L2_XFER_FUNC_DEFAULT; in mt9m111_set_fmt()
673 if (format->which == V4L2_SUBDEV_FORMAT_TRY) { in mt9m111_set_fmt()
678 ret = mt9m111_setup_geometry(mt9m111, rect, mf->width, mf->height, mf->code); in mt9m111_set_fmt()
680 ret = mt9m111_set_pixfmt(mt9m111, mf->code); in mt9m111_set_fmt()
682 mt9m111->width = mf->width; in mt9m111_set_fmt()
683 mt9m111->height = mf->height; in mt9m111_set_fmt()
684 mt9m111->fmt = fmt; in mt9m111_set_fmt()
695 struct v4l2_rect *sensor_rect = &mt9m111->rect; in mt9m111_find_mode()
696 unsigned int gap, gap_best = (unsigned int) -1; in mt9m111_find_mode()
705 if (sensor_rect->width != MT9M111_MAX_WIDTH || in mt9m111_find_mode()
706 sensor_rect->height != MT9M111_MAX_HEIGHT) { in mt9m111_find_mode()
707 dev_info(mt9m111->subdev.dev, in mt9m111_find_mode()
715 dev_dbg(mt9m111->subdev.dev, in mt9m111_find_mode()
728 gap = abs(fps - req_fps); in mt9m111_find_mode()
740 mt9m111->ctx = (best_gap_idx == MT9M111_MODE_QSXGA_30FPS) ? &context_a : in mt9m111_find_mode()
752 if (reg->reg > 0x2ff) in mt9m111_g_register()
753 return -EINVAL; in mt9m111_g_register()
755 val = mt9m111_reg_read(client, reg->reg); in mt9m111_g_register()
756 reg->size = 2; in mt9m111_g_register()
757 reg->val = (u64)val; in mt9m111_g_register()
759 if (reg->val > 0xffff) in mt9m111_g_register()
760 return -EIO; in mt9m111_g_register()
770 if (reg->reg > 0x2ff) in mt9m111_s_register()
771 return -EINVAL; in mt9m111_s_register()
773 if (mt9m111_reg_write(client, reg->reg, reg->val) < 0) in mt9m111_s_register()
774 return -EIO; in mt9m111_s_register()
782 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_flip()
786 ret = mt9m111_reg_set(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
788 ret = mt9m111_reg_clear(client, mt9m111->ctx->read_mode, mask); in mt9m111_set_flip()
795 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_get_global_gain()
807 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_global_gain()
811 return -EINVAL; in mt9m111_set_global_gain()
825 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autoexposure()
834 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_autowhitebalance()
844 "Flat color type 1",
845 "Flat color type 2",
846 "Flat color type 3",
847 "Flat color type 4",
848 "Flat color type 5",
854 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_test_pattern()
862 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_set_colorfx()
880 return -EINVAL; in mt9m111_set_colorfx()
885 struct mt9m111 *mt9m111 = container_of(ctrl->handler, in mt9m111_s_ctrl()
888 switch (ctrl->id) { in mt9m111_s_ctrl()
890 return mt9m111_set_flip(mt9m111, ctrl->val, in mt9m111_s_ctrl()
893 return mt9m111_set_flip(mt9m111, ctrl->val, in mt9m111_s_ctrl()
896 return mt9m111_set_global_gain(mt9m111, ctrl->val); in mt9m111_s_ctrl()
898 return mt9m111_set_autoexposure(mt9m111, ctrl->val); in mt9m111_s_ctrl()
900 return mt9m111_set_autowhitebalance(mt9m111, ctrl->val); in mt9m111_s_ctrl()
902 return mt9m111_set_test_pattern(mt9m111, ctrl->val); in mt9m111_s_ctrl()
904 return mt9m111_set_colorfx(mt9m111, ctrl->val); in mt9m111_s_ctrl()
907 return -EINVAL; in mt9m111_s_ctrl()
912 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_suspend()
915 v4l2_ctrl_s_ctrl(mt9m111->gain, mt9m111_get_global_gain(mt9m111)); in mt9m111_suspend()
930 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_restore_state()
932 mt9m111_set_context(mt9m111, mt9m111->ctx); in mt9m111_restore_state()
933 mt9m111_set_pixfmt(mt9m111, mt9m111->fmt->code); in mt9m111_restore_state()
934 mt9m111_setup_geometry(mt9m111, &mt9m111->rect, in mt9m111_restore_state()
935 mt9m111->width, mt9m111->height, mt9m111->fmt->code); in mt9m111_restore_state()
936 v4l2_ctrl_handler_setup(&mt9m111->hdl); in mt9m111_restore_state()
937 mt9m111_reg_mask(client, mt9m111->ctx->read_mode, in mt9m111_restore_state()
938 mt9m111->current_mode->reg_val, in mt9m111_restore_state()
939 mt9m111->current_mode->reg_mask); in mt9m111_restore_state()
955 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_init()
962 ret = mt9m111_set_context(mt9m111, mt9m111->ctx); in mt9m111_init()
964 dev_err(&client->dev, "mt9m111 init failed: %d\n", ret); in mt9m111_init()
970 struct i2c_client *client = v4l2_get_subdevdata(&mt9m111->subdev); in mt9m111_power_on()
973 ret = clk_prepare_enable(mt9m111->clk); in mt9m111_power_on()
977 ret = regulator_enable(mt9m111->regulator); in mt9m111_power_on()
988 regulator_disable(mt9m111->regulator); in mt9m111_power_on()
991 clk_disable_unprepare(mt9m111->clk); in mt9m111_power_on()
993 dev_err(&client->dev, "Failed to resume the sensor: %d\n", ret); in mt9m111_power_on()
1001 regulator_disable(mt9m111->regulator); in mt9m111_power_off()
1002 clk_disable_unprepare(mt9m111->clk); in mt9m111_power_off()
1010 mutex_lock(&mt9m111->power_lock); in mt9m111_s_power()
1016 if (mt9m111->power_count == !on) { in mt9m111_s_power()
1025 mt9m111->power_count += on ? 1 : -1; in mt9m111_s_power()
1026 WARN_ON(mt9m111->power_count < 0); in mt9m111_s_power()
1029 mutex_unlock(&mt9m111->power_lock); in mt9m111_s_power()
1058 if (fi->which != V4L2_SUBDEV_FORMAT_ACTIVE) in mt9m111_get_frame_interval()
1059 return -EINVAL; in mt9m111_get_frame_interval()
1061 fi->interval = mt9m111->frame_interval; in mt9m111_get_frame_interval()
1072 struct v4l2_fract *fract = &fi->interval; in mt9m111_set_frame_interval()
1075 if (mt9m111->is_streaming) in mt9m111_set_frame_interval()
1076 return -EBUSY; in mt9m111_set_frame_interval()
1082 if (fi->which != V4L2_SUBDEV_FORMAT_ACTIVE) in mt9m111_set_frame_interval()
1083 return -EINVAL; in mt9m111_set_frame_interval()
1085 if (fi->pad != 0) in mt9m111_set_frame_interval()
1086 return -EINVAL; in mt9m111_set_frame_interval()
1088 if (fract->numerator == 0) { in mt9m111_set_frame_interval()
1089 fract->denominator = 30; in mt9m111_set_frame_interval()
1090 fract->numerator = 1; in mt9m111_set_frame_interval()
1093 fps = DIV_ROUND_CLOSEST(fract->denominator, fract->numerator); in mt9m111_set_frame_interval()
1096 mode = mt9m111_find_mode(mt9m111, fps, mt9m111->width, mt9m111->height); in mt9m111_set_frame_interval()
1100 if (mode->max_fps != fps) { in mt9m111_set_frame_interval()
1101 fract->denominator = mode->max_fps; in mt9m111_set_frame_interval()
1102 fract->numerator = 1; in mt9m111_set_frame_interval()
1105 mt9m111->current_mode = mode; in mt9m111_set_frame_interval()
1106 mt9m111->frame_interval = fi->interval; in mt9m111_set_frame_interval()
1115 if (code->pad || code->index >= ARRAY_SIZE(mt9m111_colour_fmts)) in mt9m111_enum_mbus_code()
1116 return -EINVAL; in mt9m111_enum_mbus_code()
1118 code->code = mt9m111_colour_fmts[code->index].code; in mt9m111_enum_mbus_code()
1126 mt9m111->is_streaming = !!enable; in mt9m111_s_stream()
1136 format->width = MT9M111_MAX_WIDTH; in mt9m111_init_state()
1137 format->height = MT9M111_MAX_HEIGHT; in mt9m111_init_state()
1138 format->code = mt9m111_colour_fmts[0].code; in mt9m111_init_state()
1139 format->colorspace = mt9m111_colour_fmts[0].colorspace; in mt9m111_init_state()
1140 format->field = V4L2_FIELD_NONE; in mt9m111_init_state()
1141 format->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT; in mt9m111_init_state()
1142 format->quantization = V4L2_QUANTIZATION_DEFAULT; in mt9m111_init_state()
1143 format->xfer_func = V4L2_XFER_FUNC_DEFAULT; in mt9m111_init_state()
1154 cfg->type = V4L2_MBUS_PARALLEL; in mt9m111_get_mbus_config()
1156 cfg->bus.parallel.flags = V4L2_MBUS_MASTER | in mt9m111_get_mbus_config()
1161 cfg->bus.parallel.flags |= mt9m111->pclk_sample ? in mt9m111_get_mbus_config()
1203 ret = mt9m111_s_power(&mt9m111->subdev, 1); in mt9m111_video_probe()
1211 dev_info(&client->dev, in mt9m111_video_probe()
1215 dev_info(&client->dev, "Detected a MT9M112 chip ID %x\n", data); in mt9m111_video_probe()
1218 dev_err(&client->dev, in mt9m111_video_probe()
1221 ret = -ENODEV; in mt9m111_video_probe()
1229 ret = v4l2_ctrl_handler_setup(&mt9m111->hdl); in mt9m111_video_probe()
1232 mt9m111_s_power(&mt9m111->subdev, 0); in mt9m111_video_probe()
1244 np = fwnode_graph_get_next_endpoint(dev_fwnode(&client->dev), NULL); in mt9m111_probe_fw()
1246 return -EINVAL; in mt9m111_probe_fw()
1252 mt9m111->pclk_sample = !!(bus_cfg.bus.parallel.flags & in mt9m111_probe_fw()
1263 struct i2c_adapter *adapter = client->adapter; in mt9m111_probe()
1267 dev_warn(&adapter->dev, in mt9m111_probe()
1268 "I2C-Adapter doesn't support I2C_FUNC_SMBUS_WORD\n"); in mt9m111_probe()
1269 return -EIO; in mt9m111_probe()
1272 mt9m111 = devm_kzalloc(&client->dev, sizeof(struct mt9m111), GFP_KERNEL); in mt9m111_probe()
1274 return -ENOMEM; in mt9m111_probe()
1276 if (dev_fwnode(&client->dev)) { in mt9m111_probe()
1282 mt9m111->clk = devm_clk_get(&client->dev, "mclk"); in mt9m111_probe()
1283 if (IS_ERR(mt9m111->clk)) in mt9m111_probe()
1284 return PTR_ERR(mt9m111->clk); in mt9m111_probe()
1286 mt9m111->regulator = devm_regulator_get(&client->dev, "vdd"); in mt9m111_probe()
1287 if (IS_ERR(mt9m111->regulator)) { in mt9m111_probe()
1288 dev_err(&client->dev, "regulator not found: %ld\n", in mt9m111_probe()
1289 PTR_ERR(mt9m111->regulator)); in mt9m111_probe()
1290 return PTR_ERR(mt9m111->regulator); in mt9m111_probe()
1294 mt9m111->ctx = &context_b; in mt9m111_probe()
1296 v4l2_i2c_subdev_init(&mt9m111->subdev, client, &mt9m111_subdev_ops); in mt9m111_probe()
1297 mt9m111->subdev.internal_ops = &mt9m111_internal_ops; in mt9m111_probe()
1298 mt9m111->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | in mt9m111_probe()
1301 v4l2_ctrl_handler_init(&mt9m111->hdl, 7); in mt9m111_probe()
1302 v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1304 v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1306 v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1308 mt9m111->gain = v4l2_ctrl_new_std(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1310 v4l2_ctrl_new_std_menu(&mt9m111->hdl, in mt9m111_probe()
1313 v4l2_ctrl_new_std_menu_items(&mt9m111->hdl, in mt9m111_probe()
1315 ARRAY_SIZE(mt9m111_test_pattern_menu) - 1, 0, 0, in mt9m111_probe()
1317 v4l2_ctrl_new_std_menu(&mt9m111->hdl, &mt9m111_ctrl_ops, in mt9m111_probe()
1325 mt9m111->subdev.ctrl_handler = &mt9m111->hdl; in mt9m111_probe()
1326 if (mt9m111->hdl.error) { in mt9m111_probe()
1327 ret = mt9m111->hdl.error; in mt9m111_probe()
1331 mt9m111->pad.flags = MEDIA_PAD_FL_SOURCE; in mt9m111_probe()
1332 mt9m111->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; in mt9m111_probe()
1333 ret = media_entity_pads_init(&mt9m111->subdev.entity, 1, &mt9m111->pad); in mt9m111_probe()
1337 mt9m111->current_mode = &mt9m111_mode_data[MT9M111_MODE_SXGA_15FPS]; in mt9m111_probe()
1338 mt9m111->frame_interval.numerator = 1; in mt9m111_probe()
1339 mt9m111->frame_interval.denominator = mt9m111->current_mode->max_fps; in mt9m111_probe()
1341 /* Second stage probe - when a capture adapter is there */ in mt9m111_probe()
1342 mt9m111->rect.left = MT9M111_MIN_DARK_COLS; in mt9m111_probe()
1343 mt9m111->rect.top = MT9M111_MIN_DARK_ROWS; in mt9m111_probe()
1344 mt9m111->rect.width = MT9M111_MAX_WIDTH; in mt9m111_probe()
1345 mt9m111->rect.height = MT9M111_MAX_HEIGHT; in mt9m111_probe()
1346 mt9m111->width = mt9m111->rect.width; in mt9m111_probe()
1347 mt9m111->height = mt9m111->rect.height; in mt9m111_probe()
1348 mt9m111->fmt = &mt9m111_colour_fmts[0]; in mt9m111_probe()
1349 mt9m111->lastpage = -1; in mt9m111_probe()
1350 mutex_init(&mt9m111->power_lock); in mt9m111_probe()
1356 mt9m111->subdev.dev = &client->dev; in mt9m111_probe()
1357 ret = v4l2_async_register_subdev(&mt9m111->subdev); in mt9m111_probe()
1364 media_entity_cleanup(&mt9m111->subdev.entity); in mt9m111_probe()
1366 v4l2_ctrl_handler_free(&mt9m111->hdl); in mt9m111_probe()
1375 v4l2_async_unregister_subdev(&mt9m111->subdev); in mt9m111_remove()
1376 media_entity_cleanup(&mt9m111->subdev.entity); in mt9m111_remove()
1377 v4l2_ctrl_handler_free(&mt9m111->hdl); in mt9m111_remove()