mt9m001 110 drivers/media/i2c/mt9m001.c static struct mt9m001 *to_mt9m001(const struct i2c_client *client) mt9m001 112 drivers/media/i2c/mt9m001.c return container_of(i2c_get_clientdata(client), struct mt9m001, subdev); mt9m001 189 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 198 drivers/media/i2c/mt9m001.c { MT9M001_COLUMN_START, mt9m001->rect.left }, mt9m001 199 drivers/media/i2c/mt9m001.c { MT9M001_ROW_START, mt9m001->rect.top }, mt9m001 200 drivers/media/i2c/mt9m001.c { MT9M001_WINDOW_WIDTH, mt9m001->rect.width - 1 }, mt9m001 202 drivers/media/i2c/mt9m001.c mt9m001->rect.height + mt9m001->y_skip_top - 1 }, mt9m001 211 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 214 drivers/media/i2c/mt9m001.c mutex_lock(&mt9m001->mutex); mt9m001 216 drivers/media/i2c/mt9m001.c if (mt9m001->streaming == enable) mt9m001 228 drivers/media/i2c/mt9m001.c ret = __v4l2_ctrl_handler_setup(&mt9m001->hdl); mt9m001 242 drivers/media/i2c/mt9m001.c mt9m001->streaming = enable; mt9m001 244 drivers/media/i2c/mt9m001.c mutex_unlock(&mt9m001->mutex); mt9m001 250 drivers/media/i2c/mt9m001.c mutex_unlock(&mt9m001->mutex); mt9m001 260 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 267 drivers/media/i2c/mt9m001.c if (mt9m001->fmts == mt9m001_colour_fmts) mt9m001 288 drivers/media/i2c/mt9m001.c mt9m001->total_h = rect.height + mt9m001->y_skip_top + mt9m001 291 drivers/media/i2c/mt9m001.c mt9m001->rect = rect; mt9m001 301 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 314 drivers/media/i2c/mt9m001.c sel->r = mt9m001->rect; mt9m001 326 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 338 drivers/media/i2c/mt9m001.c mf->width = mt9m001->rect.width; mt9m001 339 drivers/media/i2c/mt9m001.c mf->height = mt9m001->rect.height; mt9m001 340 drivers/media/i2c/mt9m001.c mf->code = mt9m001->fmt->code; mt9m001 341 drivers/media/i2c/mt9m001.c mf->colorspace = mt9m001->fmt->colorspace; mt9m001 355 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 359 drivers/media/i2c/mt9m001.c .r.left = mt9m001->rect.left, mt9m001 360 drivers/media/i2c/mt9m001.c .r.top = mt9m001->rect.top, mt9m001 369 drivers/media/i2c/mt9m001.c mf->width = mt9m001->rect.width; mt9m001 370 drivers/media/i2c/mt9m001.c mf->height = mt9m001->rect.height; mt9m001 371 drivers/media/i2c/mt9m001.c mt9m001->fmt = fmt; mt9m001 384 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 392 drivers/media/i2c/mt9m001.c &mf->height, MT9M001_MIN_HEIGHT + mt9m001->y_skip_top, mt9m001 393 drivers/media/i2c/mt9m001.c MT9M001_MAX_HEIGHT + mt9m001->y_skip_top, 0, 0); mt9m001 395 drivers/media/i2c/mt9m001.c if (mt9m001->fmts == mt9m001_colour_fmts) mt9m001 398 drivers/media/i2c/mt9m001.c fmt = mt9m001_find_datafmt(mf->code, mt9m001->fmts, mt9m001 399 drivers/media/i2c/mt9m001.c mt9m001->num_fmts); mt9m001 401 drivers/media/i2c/mt9m001.c fmt = mt9m001->fmt; mt9m001 453 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 456 drivers/media/i2c/mt9m001.c ret = clk_prepare_enable(mt9m001->clk); mt9m001 460 drivers/media/i2c/mt9m001.c if (mt9m001->standby_gpio) { mt9m001 461 drivers/media/i2c/mt9m001.c gpiod_set_value_cansleep(mt9m001->standby_gpio, 0); mt9m001 465 drivers/media/i2c/mt9m001.c if (mt9m001->reset_gpio) { mt9m001 466 drivers/media/i2c/mt9m001.c gpiod_set_value_cansleep(mt9m001->reset_gpio, 1); mt9m001 468 drivers/media/i2c/mt9m001.c gpiod_set_value_cansleep(mt9m001->reset_gpio, 0); mt9m001 478 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 480 drivers/media/i2c/mt9m001.c gpiod_set_value_cansleep(mt9m001->standby_gpio, 1); mt9m001 481 drivers/media/i2c/mt9m001.c clk_disable_unprepare(mt9m001->clk); mt9m001 488 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = container_of(ctrl->handler, mt9m001 489 drivers/media/i2c/mt9m001.c struct mt9m001, hdl); mt9m001 494 drivers/media/i2c/mt9m001.c min = mt9m001->exposure->minimum; mt9m001 495 drivers/media/i2c/mt9m001.c max = mt9m001->exposure->maximum; mt9m001 496 drivers/media/i2c/mt9m001.c mt9m001->exposure->val = mt9m001 497 drivers/media/i2c/mt9m001.c (524 + (mt9m001->total_h - 1) * (max - min)) / 1048 + min; mt9m001 505 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = container_of(ctrl->handler, mt9m001 506 drivers/media/i2c/mt9m001.c struct mt9m001, hdl); mt9m001 507 drivers/media/i2c/mt9m001.c struct v4l2_subdev *sd = &mt9m001->subdev; mt9m001 509 drivers/media/i2c/mt9m001.c struct v4l2_ctrl *exp = mt9m001->exposure; mt9m001 564 drivers/media/i2c/mt9m001.c mt9m001->total_h = mt9m001->rect.height + mt9m001 565 drivers/media/i2c/mt9m001.c mt9m001->y_skip_top + MT9M001_DEFAULT_VBLANK; mt9m001 567 drivers/media/i2c/mt9m001.c mt9m001->total_h); mt9m001 586 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 601 drivers/media/i2c/mt9m001.c mt9m001->fmts = mt9m001_colour_fmts; mt9m001 602 drivers/media/i2c/mt9m001.c mt9m001->num_fmts = ARRAY_SIZE(mt9m001_colour_fmts); mt9m001 605 drivers/media/i2c/mt9m001.c mt9m001->fmts = mt9m001_monochrome_fmts; mt9m001 606 drivers/media/i2c/mt9m001.c mt9m001->num_fmts = ARRAY_SIZE(mt9m001_monochrome_fmts); mt9m001 615 drivers/media/i2c/mt9m001.c mt9m001->fmt = &mt9m001->fmts[0]; mt9m001 627 drivers/media/i2c/mt9m001.c ret = v4l2_ctrl_handler_setup(&mt9m001->hdl); mt9m001 636 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 638 drivers/media/i2c/mt9m001.c *lines = mt9m001->y_skip_top; mt9m001 662 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 668 drivers/media/i2c/mt9m001.c try_fmt->code = mt9m001->fmts[0].code; mt9m001 669 drivers/media/i2c/mt9m001.c try_fmt->colorspace = mt9m001->fmts[0].colorspace; mt9m001 683 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 685 drivers/media/i2c/mt9m001.c if (code->pad || code->index >= mt9m001->num_fmts) mt9m001 688 drivers/media/i2c/mt9m001.c code->code = mt9m001->fmts[code->index].code; mt9m001 731 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001; mt9m001 741 drivers/media/i2c/mt9m001.c mt9m001 = devm_kzalloc(&client->dev, sizeof(*mt9m001), GFP_KERNEL); mt9m001 742 drivers/media/i2c/mt9m001.c if (!mt9m001) mt9m001 745 drivers/media/i2c/mt9m001.c mt9m001->clk = devm_clk_get(&client->dev, NULL); mt9m001 746 drivers/media/i2c/mt9m001.c if (IS_ERR(mt9m001->clk)) mt9m001 747 drivers/media/i2c/mt9m001.c return PTR_ERR(mt9m001->clk); mt9m001 749 drivers/media/i2c/mt9m001.c mt9m001->standby_gpio = devm_gpiod_get_optional(&client->dev, "standby", mt9m001 751 drivers/media/i2c/mt9m001.c if (IS_ERR(mt9m001->standby_gpio)) mt9m001 752 drivers/media/i2c/mt9m001.c return PTR_ERR(mt9m001->standby_gpio); mt9m001 754 drivers/media/i2c/mt9m001.c mt9m001->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset", mt9m001 756 drivers/media/i2c/mt9m001.c if (IS_ERR(mt9m001->reset_gpio)) mt9m001 757 drivers/media/i2c/mt9m001.c return PTR_ERR(mt9m001->reset_gpio); mt9m001 759 drivers/media/i2c/mt9m001.c v4l2_i2c_subdev_init(&mt9m001->subdev, client, &mt9m001_subdev_ops); mt9m001 760 drivers/media/i2c/mt9m001.c mt9m001->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE | mt9m001 762 drivers/media/i2c/mt9m001.c v4l2_ctrl_handler_init(&mt9m001->hdl, 4); mt9m001 763 drivers/media/i2c/mt9m001.c v4l2_ctrl_new_std(&mt9m001->hdl, &mt9m001_ctrl_ops, mt9m001 765 drivers/media/i2c/mt9m001.c v4l2_ctrl_new_std(&mt9m001->hdl, &mt9m001_ctrl_ops, mt9m001 767 drivers/media/i2c/mt9m001.c mt9m001->exposure = v4l2_ctrl_new_std(&mt9m001->hdl, &mt9m001_ctrl_ops, mt9m001 773 drivers/media/i2c/mt9m001.c mt9m001->autoexposure = v4l2_ctrl_new_std_menu(&mt9m001->hdl, mt9m001 776 drivers/media/i2c/mt9m001.c mt9m001->subdev.ctrl_handler = &mt9m001->hdl; mt9m001 777 drivers/media/i2c/mt9m001.c if (mt9m001->hdl.error) mt9m001 778 drivers/media/i2c/mt9m001.c return mt9m001->hdl.error; mt9m001 780 drivers/media/i2c/mt9m001.c v4l2_ctrl_auto_cluster(2, &mt9m001->autoexposure, mt9m001 783 drivers/media/i2c/mt9m001.c mutex_init(&mt9m001->mutex); mt9m001 784 drivers/media/i2c/mt9m001.c mt9m001->hdl.lock = &mt9m001->mutex; mt9m001 787 drivers/media/i2c/mt9m001.c mt9m001->y_skip_top = 0; mt9m001 788 drivers/media/i2c/mt9m001.c mt9m001->rect.left = MT9M001_COLUMN_SKIP; mt9m001 789 drivers/media/i2c/mt9m001.c mt9m001->rect.top = MT9M001_ROW_SKIP; mt9m001 790 drivers/media/i2c/mt9m001.c mt9m001->rect.width = MT9M001_MAX_WIDTH; mt9m001 791 drivers/media/i2c/mt9m001.c mt9m001->rect.height = MT9M001_MAX_HEIGHT; mt9m001 804 drivers/media/i2c/mt9m001.c mt9m001->pad.flags = MEDIA_PAD_FL_SOURCE; mt9m001 805 drivers/media/i2c/mt9m001.c mt9m001->subdev.entity.function = MEDIA_ENT_F_CAM_SENSOR; mt9m001 806 drivers/media/i2c/mt9m001.c ret = media_entity_pads_init(&mt9m001->subdev.entity, 1, &mt9m001->pad); mt9m001 810 drivers/media/i2c/mt9m001.c ret = v4l2_async_register_subdev(&mt9m001->subdev); mt9m001 819 drivers/media/i2c/mt9m001.c media_entity_cleanup(&mt9m001->subdev.entity); mt9m001 826 drivers/media/i2c/mt9m001.c v4l2_ctrl_handler_free(&mt9m001->hdl); mt9m001 827 drivers/media/i2c/mt9m001.c mutex_destroy(&mt9m001->mutex); mt9m001 834 drivers/media/i2c/mt9m001.c struct mt9m001 *mt9m001 = to_mt9m001(client); mt9m001 838 drivers/media/i2c/mt9m001.c v4l2_async_unregister_subdev(&mt9m001->subdev); mt9m001 839 drivers/media/i2c/mt9m001.c media_entity_cleanup(&mt9m001->subdev.entity); mt9m001 846 drivers/media/i2c/mt9m001.c v4l2_ctrl_handler_free(&mt9m001->hdl); mt9m001 847 drivers/media/i2c/mt9m001.c mutex_destroy(&mt9m001->mutex);