Lines Matching refs:mt9m001

88 struct mt9m001 {  struct
105 static struct mt9m001 *to_mt9m001(const struct i2c_client *client) in to_mt9m001() argument
107 return container_of(i2c_get_clientdata(client), struct mt9m001, subdev); in to_mt9m001()
177 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_s_crop() local
182 if (mt9m001->fmts == mt9m001_colour_fmts) in mt9m001_s_crop()
199 mt9m001->total_h = rect.height + mt9m001->y_skip_top + vblank; in mt9m001_s_crop()
218 rect.height + mt9m001->y_skip_top - 1); in mt9m001_s_crop()
219 if (!ret && v4l2_ctrl_g_ctrl(mt9m001->autoexposure) == V4L2_EXPOSURE_AUTO) in mt9m001_s_crop()
220 ret = reg_write(client, MT9M001_SHUTTER_WIDTH, mt9m001->total_h); in mt9m001_s_crop()
223 mt9m001->rect = rect; in mt9m001_s_crop()
231 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_g_crop() local
233 a->c = mt9m001->rect; in mt9m001_g_crop()
258 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_get_fmt() local
264 mf->width = mt9m001->rect.width; in mt9m001_get_fmt()
265 mf->height = mt9m001->rect.height; in mt9m001_get_fmt()
266 mf->code = mt9m001->fmt->code; in mt9m001_get_fmt()
267 mf->colorspace = mt9m001->fmt->colorspace; in mt9m001_get_fmt()
277 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_s_fmt() local
280 .left = mt9m001->rect.left, in mt9m001_s_fmt()
281 .top = mt9m001->rect.top, in mt9m001_s_fmt()
291 mf->width = mt9m001->rect.width; in mt9m001_s_fmt()
292 mf->height = mt9m001->rect.height; in mt9m001_s_fmt()
293 mt9m001->fmt = mt9m001_find_datafmt(mf->code, in mt9m001_s_fmt()
294 mt9m001->fmts, mt9m001->num_fmts); in mt9m001_s_fmt()
295 mf->colorspace = mt9m001->fmt->colorspace; in mt9m001_s_fmt()
307 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_set_fmt() local
315 &mf->height, MT9M001_MIN_HEIGHT + mt9m001->y_skip_top, in mt9m001_set_fmt()
316 MT9M001_MAX_HEIGHT + mt9m001->y_skip_top, 0, 0); in mt9m001_set_fmt()
318 if (mt9m001->fmts == mt9m001_colour_fmts) in mt9m001_set_fmt()
321 fmt = mt9m001_find_datafmt(mf->code, mt9m001->fmts, in mt9m001_set_fmt()
322 mt9m001->num_fmts); in mt9m001_set_fmt()
324 fmt = mt9m001->fmt; in mt9m001_set_fmt()
373 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_s_power() local
375 return soc_camera_set_power(&client->dev, ssdd, mt9m001->clk, on); in mt9m001_s_power()
380 struct mt9m001 *mt9m001 = container_of(ctrl->handler, in mt9m001_g_volatile_ctrl() local
381 struct mt9m001, hdl); in mt9m001_g_volatile_ctrl()
386 min = mt9m001->exposure->minimum; in mt9m001_g_volatile_ctrl()
387 max = mt9m001->exposure->maximum; in mt9m001_g_volatile_ctrl()
388 mt9m001->exposure->val = in mt9m001_g_volatile_ctrl()
389 (524 + (mt9m001->total_h - 1) * (max - min)) / 1048 + min; in mt9m001_g_volatile_ctrl()
397 struct mt9m001 *mt9m001 = container_of(ctrl->handler, in mt9m001_s_ctrl() local
398 struct mt9m001, hdl); in mt9m001_s_ctrl()
399 struct v4l2_subdev *sd = &mt9m001->subdev; in mt9m001_s_ctrl()
401 struct v4l2_ctrl *exp = mt9m001->exposure; in mt9m001_s_ctrl()
461 mt9m001->total_h = mt9m001->rect.height + in mt9m001_s_ctrl()
462 mt9m001->y_skip_top + vblank; in mt9m001_s_ctrl()
463 if (reg_write(client, MT9M001_SHUTTER_WIDTH, mt9m001->total_h) < 0) in mt9m001_s_ctrl()
478 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_video_probe() local
483 ret = mt9m001_s_power(&mt9m001->subdev, 1); in mt9m001_video_probe()
498 mt9m001->fmts = mt9m001_colour_fmts; in mt9m001_video_probe()
501 mt9m001->fmts = mt9m001_monochrome_fmts; in mt9m001_video_probe()
510 mt9m001->num_fmts = 0; in mt9m001_video_probe()
523 mt9m001->num_fmts++; in mt9m001_video_probe()
525 mt9m001->fmts++; in mt9m001_video_probe()
528 mt9m001->num_fmts++; in mt9m001_video_probe()
530 mt9m001->fmt = &mt9m001->fmts[0]; in mt9m001_video_probe()
542 ret = v4l2_ctrl_handler_setup(&mt9m001->hdl); in mt9m001_video_probe()
545 mt9m001_s_power(&mt9m001->subdev, 0); in mt9m001_video_probe()
558 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_g_skip_top_lines() local
560 *lines = mt9m001->y_skip_top; in mt9m001_g_skip_top_lines()
583 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_enum_mbus_code() local
585 if (code->pad || code->index >= mt9m001->num_fmts) in mt9m001_enum_mbus_code()
588 code->code = mt9m001->fmts[code->index].code; in mt9m001_enum_mbus_code()
613 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_s_mbus_config() local
614 unsigned int bps = soc_mbus_get_fmtdesc(mt9m001->fmt->code)->bits_per_sample; in mt9m001_s_mbus_config()
655 struct mt9m001 *mt9m001; in mt9m001_probe() local
671 mt9m001 = devm_kzalloc(&client->dev, sizeof(struct mt9m001), GFP_KERNEL); in mt9m001_probe()
672 if (!mt9m001) in mt9m001_probe()
675 v4l2_i2c_subdev_init(&mt9m001->subdev, client, &mt9m001_subdev_ops); in mt9m001_probe()
676 v4l2_ctrl_handler_init(&mt9m001->hdl, 4); in mt9m001_probe()
677 v4l2_ctrl_new_std(&mt9m001->hdl, &mt9m001_ctrl_ops, in mt9m001_probe()
679 v4l2_ctrl_new_std(&mt9m001->hdl, &mt9m001_ctrl_ops, in mt9m001_probe()
681 mt9m001->exposure = v4l2_ctrl_new_std(&mt9m001->hdl, &mt9m001_ctrl_ops, in mt9m001_probe()
687 mt9m001->autoexposure = v4l2_ctrl_new_std_menu(&mt9m001->hdl, in mt9m001_probe()
690 mt9m001->subdev.ctrl_handler = &mt9m001->hdl; in mt9m001_probe()
691 if (mt9m001->hdl.error) in mt9m001_probe()
692 return mt9m001->hdl.error; in mt9m001_probe()
694 v4l2_ctrl_auto_cluster(2, &mt9m001->autoexposure, in mt9m001_probe()
698 mt9m001->y_skip_top = 0; in mt9m001_probe()
699 mt9m001->rect.left = MT9M001_COLUMN_SKIP; in mt9m001_probe()
700 mt9m001->rect.top = MT9M001_ROW_SKIP; in mt9m001_probe()
701 mt9m001->rect.width = MT9M001_MAX_WIDTH; in mt9m001_probe()
702 mt9m001->rect.height = MT9M001_MAX_HEIGHT; in mt9m001_probe()
704 mt9m001->clk = v4l2_clk_get(&client->dev, "mclk"); in mt9m001_probe()
705 if (IS_ERR(mt9m001->clk)) { in mt9m001_probe()
706 ret = PTR_ERR(mt9m001->clk); in mt9m001_probe()
712 v4l2_clk_put(mt9m001->clk); in mt9m001_probe()
714 v4l2_ctrl_handler_free(&mt9m001->hdl); in mt9m001_probe()
722 struct mt9m001 *mt9m001 = to_mt9m001(client); in mt9m001_remove() local
725 v4l2_clk_put(mt9m001->clk); in mt9m001_remove()
726 v4l2_device_unregister_subdev(&mt9m001->subdev); in mt9m001_remove()
727 v4l2_ctrl_handler_free(&mt9m001->hdl); in mt9m001_remove()