Lines Matching refs:mt9t031
70 struct mt9t031 { struct
86 static struct mt9t031 *to_mt9t031(const struct i2c_client *client) in to_mt9t031() argument
88 return container_of(i2c_get_clientdata(client), struct mt9t031, subdev); in to_mt9t031()
204 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_set_params() local
253 if (yskip != mt9t031->yskip || xskip != mt9t031->xskip) { in mt9t031_set_params()
277 rect->height + mt9t031->y_skip_top - 1); in mt9t031_set_params()
278 if (ret >= 0 && v4l2_ctrl_g_ctrl(mt9t031->autoexposure) == V4L2_EXPOSURE_AUTO) { in mt9t031_set_params()
279 mt9t031->total_h = rect->height + mt9t031->y_skip_top + vblank; in mt9t031_set_params()
281 ret = set_shutter(client, mt9t031->total_h); in mt9t031_set_params()
289 mt9t031->rect = *rect; in mt9t031_set_params()
290 mt9t031->xskip = xskip; in mt9t031_set_params()
291 mt9t031->yskip = yskip; in mt9t031_set_params()
301 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_s_crop() local
312 return mt9t031_set_params(client, &rect, mt9t031->xskip, mt9t031->yskip); in mt9t031_s_crop()
318 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_g_crop() local
320 a->c = mt9t031->rect; in mt9t031_g_crop()
346 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_get_fmt() local
351 mf->width = mt9t031->rect.width / mt9t031->xskip; in mt9t031_get_fmt()
352 mf->height = mt9t031->rect.height / mt9t031->yskip; in mt9t031_get_fmt()
370 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_set_fmt() local
372 struct v4l2_rect rect = mt9t031->rect; in mt9t031_set_fmt()
437 struct mt9t031 *mt9t031 = container_of(ctrl->handler, in mt9t031_g_volatile_ctrl() local
438 struct mt9t031, hdl); in mt9t031_g_volatile_ctrl()
444 min = mt9t031->exposure->minimum; in mt9t031_g_volatile_ctrl()
445 max = mt9t031->exposure->maximum; in mt9t031_g_volatile_ctrl()
446 mt9t031->exposure->val = in mt9t031_g_volatile_ctrl()
447 (shutter_max / 2 + (mt9t031->total_h - 1) * (max - min)) in mt9t031_g_volatile_ctrl()
456 struct mt9t031 *mt9t031 = container_of(ctrl->handler, in mt9t031_s_ctrl() local
457 struct mt9t031, hdl); in mt9t031_s_ctrl()
458 struct v4l2_subdev *sd = &mt9t031->subdev; in mt9t031_s_ctrl()
460 struct v4l2_ctrl *exp = mt9t031->exposure; in mt9t031_s_ctrl()
529 mt9t031->total_h = mt9t031->rect.height + in mt9t031_s_ctrl()
530 mt9t031->y_skip_top + vblank; in mt9t031_s_ctrl()
532 if (set_shutter(client, mt9t031->total_h) < 0) in mt9t031_s_ctrl()
562 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_runtime_resume() local
567 xbin = min(mt9t031->xskip, (u16)3); in mt9t031_runtime_resume()
568 ybin = min(mt9t031->yskip, (u16)3); in mt9t031_runtime_resume()
571 ((xbin - 1) << 4) | (mt9t031->xskip - 1)); in mt9t031_runtime_resume()
576 ((ybin - 1) << 4) | (mt9t031->yskip - 1)); in mt9t031_runtime_resume()
598 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_s_power() local
602 ret = soc_camera_power_on(&client->dev, ssdd, mt9t031->clk); in mt9t031_s_power()
611 soc_camera_power_off(&client->dev, ssdd, mt9t031->clk); in mt9t031_s_power()
623 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_video_probe() local
627 ret = mt9t031_s_power(&mt9t031->subdev, 1); in mt9t031_video_probe()
652 ret = v4l2_ctrl_handler_setup(&mt9t031->hdl); in mt9t031_video_probe()
655 mt9t031_s_power(&mt9t031->subdev, 0); in mt9t031_video_probe()
663 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_g_skip_top_lines() local
665 *lines = mt9t031->y_skip_top; in mt9t031_g_skip_top_lines()
751 struct mt9t031 *mt9t031; in mt9t031_probe() local
767 mt9t031 = devm_kzalloc(&client->dev, sizeof(struct mt9t031), GFP_KERNEL); in mt9t031_probe()
768 if (!mt9t031) in mt9t031_probe()
771 v4l2_i2c_subdev_init(&mt9t031->subdev, client, &mt9t031_subdev_ops); in mt9t031_probe()
772 v4l2_ctrl_handler_init(&mt9t031->hdl, 5); in mt9t031_probe()
773 v4l2_ctrl_new_std(&mt9t031->hdl, &mt9t031_ctrl_ops, in mt9t031_probe()
775 v4l2_ctrl_new_std(&mt9t031->hdl, &mt9t031_ctrl_ops, in mt9t031_probe()
777 v4l2_ctrl_new_std(&mt9t031->hdl, &mt9t031_ctrl_ops, in mt9t031_probe()
784 mt9t031->autoexposure = v4l2_ctrl_new_std_menu(&mt9t031->hdl, in mt9t031_probe()
787 mt9t031->exposure = v4l2_ctrl_new_std(&mt9t031->hdl, &mt9t031_ctrl_ops, in mt9t031_probe()
790 mt9t031->subdev.ctrl_handler = &mt9t031->hdl; in mt9t031_probe()
791 if (mt9t031->hdl.error) in mt9t031_probe()
792 return mt9t031->hdl.error; in mt9t031_probe()
794 v4l2_ctrl_auto_cluster(2, &mt9t031->autoexposure, in mt9t031_probe()
797 mt9t031->y_skip_top = 0; in mt9t031_probe()
798 mt9t031->rect.left = MT9T031_COLUMN_SKIP; in mt9t031_probe()
799 mt9t031->rect.top = MT9T031_ROW_SKIP; in mt9t031_probe()
800 mt9t031->rect.width = MT9T031_MAX_WIDTH; in mt9t031_probe()
801 mt9t031->rect.height = MT9T031_MAX_HEIGHT; in mt9t031_probe()
803 mt9t031->xskip = 1; in mt9t031_probe()
804 mt9t031->yskip = 1; in mt9t031_probe()
806 mt9t031->clk = v4l2_clk_get(&client->dev, "mclk"); in mt9t031_probe()
807 if (IS_ERR(mt9t031->clk)) { in mt9t031_probe()
808 ret = PTR_ERR(mt9t031->clk); in mt9t031_probe()
814 v4l2_clk_put(mt9t031->clk); in mt9t031_probe()
816 v4l2_ctrl_handler_free(&mt9t031->hdl); in mt9t031_probe()
824 struct mt9t031 *mt9t031 = to_mt9t031(client); in mt9t031_remove() local
826 v4l2_clk_put(mt9t031->clk); in mt9t031_remove()
827 v4l2_device_unregister_subdev(&mt9t031->subdev); in mt9t031_remove()
828 v4l2_ctrl_handler_free(&mt9t031->hdl); in mt9t031_remove()