Lines Matching refs:mt9m001

88 struct mt9m001 {  struct
110 static struct mt9m001 *to_mt9m001(const struct i2c_client *client) in to_mt9m001() argument
112 return container_of(i2c_get_clientdata(client), struct mt9m001, subdev); in to_mt9m001()
189 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_apply_selection() local
198 { MT9M001_COLUMN_START, mt9m001->rect.left }, in mt9m001_apply_selection()
199 { MT9M001_ROW_START, mt9m001->rect.top }, in mt9m001_apply_selection()
200 { MT9M001_WINDOW_WIDTH, mt9m001->rect.width - 1 }, in mt9m001_apply_selection()
202 mt9m001->rect.height + mt9m001->y_skip_top - 1 }, in mt9m001_apply_selection()
211 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_s_stream() local
214 mutex_lock(&mt9m001->mutex); in mt9m001_s_stream()
216 if (mt9m001->streaming == enable) in mt9m001_s_stream()
228 ret = __v4l2_ctrl_handler_setup(&mt9m001->hdl); in mt9m001_s_stream()
242 mt9m001->streaming = enable; in mt9m001_s_stream()
244 mutex_unlock(&mt9m001->mutex); in mt9m001_s_stream()
250 mutex_unlock(&mt9m001->mutex); in mt9m001_s_stream()
260 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_set_selection() local
267 if (mt9m001->fmts == mt9m001_colour_fmts) in mt9m001_set_selection()
288 mt9m001->total_h = rect.height + mt9m001->y_skip_top + in mt9m001_set_selection()
291 mt9m001->rect = rect; in mt9m001_set_selection()
301 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_get_selection() local
314 sel->r = mt9m001->rect; in mt9m001_get_selection()
326 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_get_fmt() local
338 mf->width = mt9m001->rect.width; in mt9m001_get_fmt()
339 mf->height = mt9m001->rect.height; in mt9m001_get_fmt()
340 mf->code = mt9m001->fmt->code; in mt9m001_get_fmt()
341 mf->colorspace = mt9m001->fmt->colorspace; in mt9m001_get_fmt()
355 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_s_fmt() local
359 .r.left = mt9m001->rect.left, in mt9m001_s_fmt()
360 .r.top = mt9m001->rect.top, in mt9m001_s_fmt()
369 mf->width = mt9m001->rect.width; in mt9m001_s_fmt()
370 mf->height = mt9m001->rect.height; in mt9m001_s_fmt()
371 mt9m001->fmt = fmt; in mt9m001_s_fmt()
384 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_set_fmt() local
392 &mf->height, MT9M001_MIN_HEIGHT + mt9m001->y_skip_top, in mt9m001_set_fmt()
393 MT9M001_MAX_HEIGHT + mt9m001->y_skip_top, 0, 0); in mt9m001_set_fmt()
395 if (mt9m001->fmts == mt9m001_colour_fmts) in mt9m001_set_fmt()
398 fmt = mt9m001_find_datafmt(mf->code, mt9m001->fmts, in mt9m001_set_fmt()
399 mt9m001->num_fmts); in mt9m001_set_fmt()
401 fmt = mt9m001->fmt; in mt9m001_set_fmt()
453 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_power_on() local
456 ret = clk_prepare_enable(mt9m001->clk); in mt9m001_power_on()
460 if (mt9m001->standby_gpio) { in mt9m001_power_on()
461 gpiod_set_value_cansleep(mt9m001->standby_gpio, 0); in mt9m001_power_on()
465 if (mt9m001->reset_gpio) { in mt9m001_power_on()
466 gpiod_set_value_cansleep(mt9m001->reset_gpio, 1); in mt9m001_power_on()
468 gpiod_set_value_cansleep(mt9m001->reset_gpio, 0); in mt9m001_power_on()
478 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_power_off() local
480 gpiod_set_value_cansleep(mt9m001->standby_gpio, 1); in mt9m001_power_off()
481 clk_disable_unprepare(mt9m001->clk); in mt9m001_power_off()
488 struct mt9m001 *mt9m001 = container_of(ctrl->handler, in mt9m001_g_volatile_ctrl() local
489 struct mt9m001, hdl); in mt9m001_g_volatile_ctrl()
494 min = mt9m001->exposure->minimum; in mt9m001_g_volatile_ctrl()
495 max = mt9m001->exposure->maximum; in mt9m001_g_volatile_ctrl()
496 mt9m001->exposure->val = in mt9m001_g_volatile_ctrl()
497 (524 + (mt9m001->total_h - 1) * (max - min)) / 1048 + min; in mt9m001_g_volatile_ctrl()
505 struct mt9m001 *mt9m001 = container_of(ctrl->handler, in mt9m001_s_ctrl() local
506 struct mt9m001, hdl); in mt9m001_s_ctrl()
507 struct v4l2_subdev *sd = &mt9m001->subdev; in mt9m001_s_ctrl()
509 struct v4l2_ctrl *exp = mt9m001->exposure; in mt9m001_s_ctrl()
564 mt9m001->total_h = mt9m001->rect.height + in mt9m001_s_ctrl()
565 mt9m001->y_skip_top + MT9M001_DEFAULT_VBLANK; in mt9m001_s_ctrl()
567 mt9m001->total_h); in mt9m001_s_ctrl()
586 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_video_probe() local
601 mt9m001->fmts = mt9m001_colour_fmts; in mt9m001_video_probe()
602 mt9m001->num_fmts = ARRAY_SIZE(mt9m001_colour_fmts); in mt9m001_video_probe()
605 mt9m001->fmts = mt9m001_monochrome_fmts; in mt9m001_video_probe()
606 mt9m001->num_fmts = ARRAY_SIZE(mt9m001_monochrome_fmts); in mt9m001_video_probe()
615 mt9m001->fmt = &mt9m001->fmts[0]; in mt9m001_video_probe()
627 ret = v4l2_ctrl_handler_setup(&mt9m001->hdl); in mt9m001_video_probe()
636 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_g_skip_top_lines() local
638 *lines = mt9m001->y_skip_top; in mt9m001_g_skip_top_lines()
662 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_init_cfg() local
668 try_fmt->code = mt9m001->fmts[0].code; in mt9m001_init_cfg()
669 try_fmt->colorspace = mt9m001->fmts[0].colorspace; in mt9m001_init_cfg()
683 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_enum_mbus_code() local
685 if (code->pad || code->index >= mt9m001->num_fmts) in mt9m001_enum_mbus_code()
688 code->code = mt9m001->fmts[code->index].code; in mt9m001_enum_mbus_code()
732 struct mt9m001 *mt9m001; in mt9m001_probe() local
742 mt9m001 = devm_kzalloc(&client->dev, sizeof(*mt9m001), GFP_KERNEL); in mt9m001_probe()
743 if (!mt9m001) in mt9m001_probe()
746 mt9m001->clk = devm_clk_get(&client->dev, NULL); in mt9m001_probe()
747 if (IS_ERR(mt9m001->clk)) in mt9m001_probe()
748 return PTR_ERR(mt9m001->clk); in mt9m001_probe()
750 mt9m001->standby_gpio = devm_gpiod_get_optional(&client->dev, "standby", in mt9m001_probe()
752 if (IS_ERR(mt9m001->standby_gpio)) in mt9m001_probe()
753 return PTR_ERR(mt9m001->standby_gpio); in mt9m001_probe()
755 mt9m001->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", in mt9m001_probe()
757 if (IS_ERR(mt9m001->reset_gpio)) in mt9m001_probe()
758 return PTR_ERR(mt9m001->reset_gpio); in mt9m001_probe()
760 v4l2_i2c_subdev_init(&mt9m001->subdev, client, &mt9m001_subdev_ops); in mt9m001_probe()
761 mt9m001->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | in mt9m001_probe()
763 v4l2_ctrl_handler_init(&mt9m001->hdl, 4); in mt9m001_probe()
764 v4l2_ctrl_new_std(&mt9m001->hdl, &mt9m001_ctrl_ops, in mt9m001_probe()
766 v4l2_ctrl_new_std(&mt9m001->hdl, &mt9m001_ctrl_ops, in mt9m001_probe()
768 mt9m001->exposure = v4l2_ctrl_new_std(&mt9m001->hdl, &mt9m001_ctrl_ops, in mt9m001_probe()
774 mt9m001->autoexposure = v4l2_ctrl_new_std_menu(&mt9m001->hdl, in mt9m001_probe()
777 mt9m001->subdev.ctrl_handler = &mt9m001->hdl; in mt9m001_probe()
778 if (mt9m001->hdl.error) in mt9m001_probe()
779 return mt9m001->hdl.error; in mt9m001_probe()
781 v4l2_ctrl_auto_cluster(2, &mt9m001->autoexposure, in mt9m001_probe()
784 mutex_init(&mt9m001->mutex); in mt9m001_probe()
785 mt9m001->hdl.lock = &mt9m001->mutex; in mt9m001_probe()
788 mt9m001->y_skip_top = 0; in mt9m001_probe()
789 mt9m001->rect.left = MT9M001_COLUMN_SKIP; in mt9m001_probe()
790 mt9m001->rect.top = MT9M001_ROW_SKIP; in mt9m001_probe()
791 mt9m001->rect.width = MT9M001_MAX_WIDTH; in mt9m001_probe()
792 mt9m001->rect.height = MT9M001_MAX_HEIGHT; in mt9m001_probe()
805 mt9m001->pad.flags = MEDIA_PAD_FL_SOURCE; in mt9m001_probe()
806 mt9m001->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; in mt9m001_probe()
807 ret = media_entity_pads_init(&mt9m001->subdev.entity, 1, &mt9m001->pad); in mt9m001_probe()
811 ret = v4l2_async_register_subdev(&mt9m001->subdev); in mt9m001_probe()
820 media_entity_cleanup(&mt9m001->subdev.entity); in mt9m001_probe()
827 v4l2_ctrl_handler_free(&mt9m001->hdl); in mt9m001_probe()
828 mutex_destroy(&mt9m001->mutex); in mt9m001_probe()
835 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_remove() local
839 v4l2_async_unregister_subdev(&mt9m001->subdev); in mt9m001_remove()
840 media_entity_cleanup(&mt9m001->subdev.entity); in mt9m001_remove()
847 v4l2_ctrl_handler_free(&mt9m001->hdl); in mt9m001_remove()
848 mutex_destroy(&mt9m001->mutex); in mt9m001_remove()