Lines Matching refs:mt9v022
141 struct mt9v022 { struct
168 static struct mt9v022 *to_mt9v022(const struct i2c_client *client) in to_mt9v022() argument
170 return container_of(i2c_get_clientdata(client), struct mt9v022, subdev); in to_mt9v022()
208 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_init() local
216 mt9v022->chip_control |= 0x10; in mt9v022_init()
217 ret = reg_write(client, MT9V022_CHIP_CONTROL, mt9v022->chip_control); in mt9v022_init()
230 ret = reg_write(client, mt9v022->reg->max_total_shutter_width, 480); in mt9v022_init()
237 return v4l2_ctrl_handler_setup(&mt9v022->hdl); in mt9v022_init()
245 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_s_stream() local
249 mt9v022->chip_control &= ~0x10; in mt9v022_s_stream()
250 if (is_mt9v022_rev3(mt9v022->chip_version) || in mt9v022_s_stream()
251 is_mt9v024(mt9v022->chip_version)) { in mt9v022_s_stream()
261 mt9v022->chip_control |= 0x10; in mt9v022_s_stream()
262 if (is_mt9v022_rev3(mt9v022->chip_version) || in mt9v022_s_stream()
263 is_mt9v024(mt9v022->chip_version)) { in mt9v022_s_stream()
274 if (reg_write(client, MT9V022_CHIP_CONTROL, mt9v022->chip_control) < 0) in mt9v022_s_stream()
282 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_s_crop() local
288 if (mt9v022->fmts == mt9v022_colour_fmts) { in mt9v022_s_crop()
304 ret = reg_write(client, mt9v022->reg->max_total_shutter_width, in mt9v022_s_crop()
305 rect.height + mt9v022->y_skip_top + 43); in mt9v022_s_crop()
324 if (is_mt9v024(mt9v022->chip_version)) { in mt9v022_s_crop()
332 ret = v4l2_ctrl_s_ctrl(mt9v022->hblank, in mt9v022_s_crop()
336 ret = v4l2_ctrl_s_ctrl(mt9v022->vblank, 45); in mt9v022_s_crop()
341 rect.height + mt9v022->y_skip_top); in mt9v022_s_crop()
348 mt9v022->rect = rect; in mt9v022_s_crop()
356 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_g_crop() local
358 a->c = mt9v022->rect; in mt9v022_g_crop()
384 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_get_fmt() local
389 mf->width = mt9v022->rect.width; in mt9v022_get_fmt()
390 mf->height = mt9v022->rect.height; in mt9v022_get_fmt()
391 mf->code = mt9v022->fmt->code; in mt9v022_get_fmt()
392 mf->colorspace = mt9v022->fmt->colorspace; in mt9v022_get_fmt()
402 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_s_fmt() local
405 .left = mt9v022->rect.left, in mt9v022_s_fmt()
406 .top = mt9v022->rect.top, in mt9v022_s_fmt()
420 if (mt9v022->model != MT9V022IX7ATM) in mt9v022_s_fmt()
425 if (mt9v022->model != MT9V022IX7ATC) in mt9v022_s_fmt()
435 mf->width = mt9v022->rect.width; in mt9v022_s_fmt()
436 mf->height = mt9v022->rect.height; in mt9v022_s_fmt()
437 mt9v022->fmt = mt9v022_find_datafmt(mf->code, in mt9v022_s_fmt()
438 mt9v022->fmts, mt9v022->num_fmts); in mt9v022_s_fmt()
439 mf->colorspace = mt9v022->fmt->colorspace; in mt9v022_s_fmt()
451 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_set_fmt() local
461 &mf->height, MT9V022_MIN_HEIGHT + mt9v022->y_skip_top, in mt9v022_set_fmt()
462 MT9V022_MAX_HEIGHT + mt9v022->y_skip_top, align, 0); in mt9v022_set_fmt()
464 fmt = mt9v022_find_datafmt(mf->code, mt9v022->fmts, in mt9v022_set_fmt()
465 mt9v022->num_fmts); in mt9v022_set_fmt()
467 fmt = mt9v022->fmt; in mt9v022_set_fmt()
516 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_s_power() local
518 return soc_camera_set_power(&client->dev, ssdd, mt9v022->clk, on); in mt9v022_s_power()
523 struct mt9v022 *mt9v022 = container_of(ctrl->handler, in mt9v022_g_volatile_ctrl() local
524 struct mt9v022, hdl); in mt9v022_g_volatile_ctrl()
525 struct v4l2_subdev *sd = &mt9v022->subdev; in mt9v022_g_volatile_ctrl()
527 struct v4l2_ctrl *gain = mt9v022->gain; in mt9v022_g_volatile_ctrl()
528 struct v4l2_ctrl *exp = mt9v022->exposure; in mt9v022_g_volatile_ctrl()
567 struct mt9v022 *mt9v022 = container_of(ctrl->handler, in mt9v022_s_ctrl() local
568 struct mt9v022, hdl); in mt9v022_s_ctrl()
569 struct v4l2_subdev *sd = &mt9v022->subdev; in mt9v022_s_ctrl()
595 struct v4l2_ctrl *gain = mt9v022->gain; in mt9v022_s_ctrl()
622 struct v4l2_ctrl *exp = mt9v022->exposure; in mt9v022_s_ctrl()
662 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_video_probe() local
668 ret = mt9v022_s_power(&mt9v022->subdev, 1); in mt9v022_video_probe()
683 mt9v022->chip_version = data; in mt9v022_video_probe()
685 mt9v022->reg = is_mt9v024(data) ? &mt9v024_register : in mt9v022_video_probe()
705 mt9v022->model = MT9V022IX7ATC; in mt9v022_video_probe()
706 mt9v022->fmts = mt9v022_colour_fmts; in mt9v022_video_probe()
709 mt9v022->model = MT9V022IX7ATM; in mt9v022_video_probe()
710 mt9v022->fmts = mt9v022_monochrome_fmts; in mt9v022_video_probe()
716 mt9v022->num_fmts = 0; in mt9v022_video_probe()
729 mt9v022->num_fmts++; in mt9v022_video_probe()
731 mt9v022->fmts++; in mt9v022_video_probe()
734 mt9v022->num_fmts++; in mt9v022_video_probe()
736 mt9v022->fmt = &mt9v022->fmts[0]; in mt9v022_video_probe()
739 data, mt9v022->model == MT9V022IX7ATM ? in mt9v022_video_probe()
747 mt9v022_s_power(&mt9v022->subdev, 0); in mt9v022_video_probe()
754 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_g_skip_top_lines() local
756 *lines = mt9v022->y_skip_top; in mt9v022_g_skip_top_lines()
779 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_enum_mbus_code() local
781 if (code->pad || code->index >= mt9v022->num_fmts) in mt9v022_enum_mbus_code()
784 code->code = mt9v022->fmts[code->index].code; in mt9v022_enum_mbus_code()
810 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_s_mbus_config() local
812 unsigned int bps = soc_mbus_get_fmtdesc(mt9v022->fmt->code)->bits_per_sample; in mt9v022_s_mbus_config()
837 ret = reg_write(client, mt9v022->reg->pixclk_fv_lv, pixclk); in mt9v022_s_mbus_config()
842 mt9v022->chip_control &= ~0x8; in mt9v022_s_mbus_config()
844 ret = reg_write(client, MT9V022_CHIP_CONTROL, mt9v022->chip_control); in mt9v022_s_mbus_config()
849 pixclk, mt9v022->chip_control); in mt9v022_s_mbus_config()
883 struct mt9v022 *mt9v022; in mt9v022_probe() local
900 mt9v022 = devm_kzalloc(&client->dev, sizeof(struct mt9v022), GFP_KERNEL); in mt9v022_probe()
901 if (!mt9v022) in mt9v022_probe()
905 v4l2_i2c_subdev_init(&mt9v022->subdev, client, &mt9v022_subdev_ops); in mt9v022_probe()
906 v4l2_ctrl_handler_init(&mt9v022->hdl, 6); in mt9v022_probe()
907 v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, in mt9v022_probe()
909 v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, in mt9v022_probe()
911 mt9v022->autogain = v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, in mt9v022_probe()
913 mt9v022->gain = v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, in mt9v022_probe()
920 mt9v022->autoexposure = v4l2_ctrl_new_std_menu(&mt9v022->hdl, in mt9v022_probe()
923 mt9v022->exposure = v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, in mt9v022_probe()
926 mt9v022->hblank = v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, in mt9v022_probe()
931 mt9v022->vblank = v4l2_ctrl_new_std(&mt9v022->hdl, &mt9v022_ctrl_ops, in mt9v022_probe()
936 mt9v022->subdev.ctrl_handler = &mt9v022->hdl; in mt9v022_probe()
937 if (mt9v022->hdl.error) { in mt9v022_probe()
938 int err = mt9v022->hdl.error; in mt9v022_probe()
943 v4l2_ctrl_auto_cluster(2, &mt9v022->autoexposure, in mt9v022_probe()
945 v4l2_ctrl_auto_cluster(2, &mt9v022->autogain, 0, true); in mt9v022_probe()
947 mt9v022->chip_control = MT9V022_CHIP_CONTROL_DEFAULT; in mt9v022_probe()
953 mt9v022->y_skip_top = pdata ? pdata->y_skip_top : 0; in mt9v022_probe()
954 mt9v022->rect.left = MT9V022_COLUMN_SKIP; in mt9v022_probe()
955 mt9v022->rect.top = MT9V022_ROW_SKIP; in mt9v022_probe()
956 mt9v022->rect.width = MT9V022_MAX_WIDTH; in mt9v022_probe()
957 mt9v022->rect.height = MT9V022_MAX_HEIGHT; in mt9v022_probe()
959 mt9v022->clk = v4l2_clk_get(&client->dev, "mclk"); in mt9v022_probe()
960 if (IS_ERR(mt9v022->clk)) { in mt9v022_probe()
961 ret = PTR_ERR(mt9v022->clk); in mt9v022_probe()
967 v4l2_clk_put(mt9v022->clk); in mt9v022_probe()
969 v4l2_ctrl_handler_free(&mt9v022->hdl); in mt9v022_probe()
977 struct mt9v022 *mt9v022 = to_mt9v022(client); in mt9v022_remove() local
980 v4l2_clk_put(mt9v022->clk); in mt9v022_remove()
981 v4l2_device_unregister_subdev(&mt9v022->subdev); in mt9v022_remove()
984 v4l2_ctrl_handler_free(&mt9v022->hdl); in mt9v022_remove()