Lines Matching refs:icd

64 static int soc_camera_video_start(struct soc_camera_device *icd);
65 static int video_dev_create(struct soc_camera_device *icd);
151 static int __soc_camera_power_on(struct soc_camera_device *icd) in __soc_camera_power_on() argument
153 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in __soc_camera_power_on()
163 static int __soc_camera_power_off(struct soc_camera_device *icd) in __soc_camera_power_off() argument
165 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in __soc_camera_power_off()
200 struct soc_camera_device *icd, unsigned int fourcc) in soc_camera_xlate_by_fourcc() argument
204 for (i = 0; i < icd->num_user_formats; i++) in soc_camera_xlate_by_fourcc()
205 if (icd->user_formats[i].host_fmt->fourcc == fourcc) in soc_camera_xlate_by_fourcc()
206 return icd->user_formats + i; in soc_camera_xlate_by_fourcc()
248 static int soc_camera_try_fmt(struct soc_camera_device *icd, in soc_camera_try_fmt() argument
251 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_try_fmt()
256 dev_dbg(icd->pdev, "TRY_FMT(%c%c%c%c, %ux%u)\n", in soc_camera_try_fmt()
265 ret = ici->ops->try_fmt(icd, f); in soc_camera_try_fmt()
269 xlate = soc_camera_xlate_by_fourcc(icd, pix->pixelformat); in soc_camera_try_fmt()
292 struct soc_camera_device *icd = file->private_data; in soc_camera_try_fmt_vid_cap() local
301 return soc_camera_try_fmt(icd, f); in soc_camera_try_fmt_vid_cap()
307 struct soc_camera_device *icd = file->private_data; in soc_camera_enum_input() local
314 inp->std = icd->vdev->tvnorms; in soc_camera_enum_input()
337 struct soc_camera_device *icd = file->private_data; in soc_camera_s_std() local
338 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in soc_camera_s_std()
345 struct soc_camera_device *icd = file->private_data; in soc_camera_g_std() local
346 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in soc_camera_g_std()
354 struct soc_camera_device *icd = file->private_data; in soc_camera_enum_framesizes() local
355 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_enum_framesizes()
357 return ici->ops->enum_framesizes(icd, fsize); in soc_camera_enum_framesizes()
364 struct soc_camera_device *icd = file->private_data; in soc_camera_reqbufs() local
368 if (icd->streamer && icd->streamer != file) in soc_camera_reqbufs()
371 ret = vb2_reqbufs(&icd->vb2_vidq, p); in soc_camera_reqbufs()
373 icd->streamer = p->count ? file : NULL; in soc_camera_reqbufs()
380 struct soc_camera_device *icd = file->private_data; in soc_camera_querybuf() local
384 return vb2_querybuf(&icd->vb2_vidq, p); in soc_camera_querybuf()
390 struct soc_camera_device *icd = file->private_data; in soc_camera_qbuf() local
394 if (icd->streamer != file) in soc_camera_qbuf()
397 return vb2_qbuf(&icd->vb2_vidq, p); in soc_camera_qbuf()
403 struct soc_camera_device *icd = file->private_data; in soc_camera_dqbuf() local
407 if (icd->streamer != file) in soc_camera_dqbuf()
410 return vb2_dqbuf(&icd->vb2_vidq, p, file->f_flags & O_NONBLOCK); in soc_camera_dqbuf()
416 struct soc_camera_device *icd = file->private_data; in soc_camera_create_bufs() local
419 if (icd->streamer && icd->streamer != file) in soc_camera_create_bufs()
422 ret = vb2_create_bufs(&icd->vb2_vidq, create); in soc_camera_create_bufs()
424 icd->streamer = file; in soc_camera_create_bufs()
431 struct soc_camera_device *icd = file->private_data; in soc_camera_prepare_buf() local
433 return vb2_prepare_buf(&icd->vb2_vidq, b); in soc_camera_prepare_buf()
439 struct soc_camera_device *icd = file->private_data; in soc_camera_expbuf() local
441 if (icd->streamer && icd->streamer != file) in soc_camera_expbuf()
443 return vb2_expbuf(&icd->vb2_vidq, p); in soc_camera_expbuf()
447 static int soc_camera_init_user_formats(struct soc_camera_device *icd) in soc_camera_init_user_formats() argument
449 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in soc_camera_init_user_formats()
450 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_init_user_formats()
474 ret = ici->ops->get_formats(icd, i, NULL); in soc_camera_init_user_formats()
483 icd->user_formats = in soc_camera_init_user_formats()
486 if (!icd->user_formats) in soc_camera_init_user_formats()
489 dev_dbg(icd->pdev, "Found %d supported formats.\n", fmts); in soc_camera_init_user_formats()
497 icd->user_formats[fmts].host_fmt = in soc_camera_init_user_formats()
499 if (icd->user_formats[fmts].host_fmt) in soc_camera_init_user_formats()
500 icd->user_formats[fmts++].code = code.code; in soc_camera_init_user_formats()
502 ret = ici->ops->get_formats(icd, i, in soc_camera_init_user_formats()
503 &icd->user_formats[fmts]); in soc_camera_init_user_formats()
509 icd->num_user_formats = fmts; in soc_camera_init_user_formats()
510 icd->current_fmt = &icd->user_formats[0]; in soc_camera_init_user_formats()
515 vfree(icd->user_formats); in soc_camera_init_user_formats()
520 static void soc_camera_free_user_formats(struct soc_camera_device *icd) in soc_camera_free_user_formats() argument
522 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_free_user_formats()
525 ici->ops->put_formats(icd); in soc_camera_free_user_formats()
526 icd->current_fmt = NULL; in soc_camera_free_user_formats()
527 icd->num_user_formats = 0; in soc_camera_free_user_formats()
528 vfree(icd->user_formats); in soc_camera_free_user_formats()
529 icd->user_formats = NULL; in soc_camera_free_user_formats()
533 static int soc_camera_set_fmt(struct soc_camera_device *icd, in soc_camera_set_fmt() argument
536 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_set_fmt()
540 dev_dbg(icd->pdev, "S_FMT(%c%c%c%c, %ux%u)\n", in soc_camera_set_fmt()
544 ret = soc_camera_try_fmt(icd, f); in soc_camera_set_fmt()
548 ret = ici->ops->set_fmt(icd, f); in soc_camera_set_fmt()
551 } else if (!icd->current_fmt || in soc_camera_set_fmt()
552 icd->current_fmt->host_fmt->fourcc != pix->pixelformat) { in soc_camera_set_fmt()
553 dev_err(icd->pdev, in soc_camera_set_fmt()
558 icd->user_width = pix->width; in soc_camera_set_fmt()
559 icd->user_height = pix->height; in soc_camera_set_fmt()
560 icd->bytesperline = pix->bytesperline; in soc_camera_set_fmt()
561 icd->sizeimage = pix->sizeimage; in soc_camera_set_fmt()
562 icd->colorspace = pix->colorspace; in soc_camera_set_fmt()
563 icd->field = pix->field; in soc_camera_set_fmt()
565 dev_dbg(icd->pdev, "set width: %d height: %d\n", in soc_camera_set_fmt()
566 icd->user_width, icd->user_height); in soc_camera_set_fmt()
569 return ici->ops->set_bus_param(icd); in soc_camera_set_fmt()
572 static int soc_camera_add_device(struct soc_camera_device *icd) in soc_camera_add_device() argument
574 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_add_device()
577 if (ici->icd) in soc_camera_add_device()
580 if (!icd->clk) { in soc_camera_add_device()
587 ret = ici->ops->add(icd); in soc_camera_add_device()
592 ici->icd = icd; in soc_camera_add_device()
597 if (!icd->clk) in soc_camera_add_device()
602 static void soc_camera_remove_device(struct soc_camera_device *icd) in soc_camera_remove_device() argument
604 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_remove_device()
606 if (WARN_ON(icd != ici->icd)) in soc_camera_remove_device()
610 ici->ops->remove(icd); in soc_camera_remove_device()
611 if (!icd->clk) in soc_camera_remove_device()
613 ici->icd = NULL; in soc_camera_remove_device()
619 struct soc_camera_device *icd; in soc_camera_open() local
636 icd = video_get_drvdata(vdev); in soc_camera_open()
637 ici = to_soc_camera_host(icd->parent); in soc_camera_open()
643 dev_err(icd->pdev, "Couldn't lock capture bus driver.\n"); in soc_camera_open()
647 if (!to_soc_camera_control(icd)) { in soc_camera_open()
657 icd->use_count++; in soc_camera_open()
660 if (icd->use_count == 1) { in soc_camera_open()
661 struct soc_camera_desc *sdesc = to_soc_camera_desc(icd); in soc_camera_open()
666 .width = icd->user_width, in soc_camera_open()
667 .height = icd->user_height, in soc_camera_open()
668 .field = icd->field, in soc_camera_open()
669 .colorspace = icd->colorspace, in soc_camera_open()
671 icd->current_fmt->host_fmt->fourcc, in soc_camera_open()
677 if (icd->control) in soc_camera_open()
678 sdesc->subdev_desc.reset(icd->control); in soc_camera_open()
680 ret = soc_camera_add_device(icd); in soc_camera_open()
682 dev_err(icd->pdev, "Couldn't activate the camera: %d\n", ret); in soc_camera_open()
686 ret = __soc_camera_power_on(icd); in soc_camera_open()
690 pm_runtime_enable(&icd->vdev->dev); in soc_camera_open()
691 ret = pm_runtime_resume(&icd->vdev->dev); in soc_camera_open()
701 ret = soc_camera_set_fmt(icd, &f); in soc_camera_open()
705 ret = ici->ops->init_videobuf2(&icd->vb2_vidq, icd); in soc_camera_open()
708 v4l2_ctrl_handler_setup(&icd->ctrl_handler); in soc_camera_open()
712 file->private_data = icd; in soc_camera_open()
713 dev_dbg(icd->pdev, "camera device open\n"); in soc_camera_open()
723 pm_runtime_disable(&icd->vdev->dev); in soc_camera_open()
725 __soc_camera_power_off(icd); in soc_camera_open()
727 soc_camera_remove_device(icd); in soc_camera_open()
729 icd->use_count--; in soc_camera_open()
740 struct soc_camera_device *icd = file->private_data; in soc_camera_close() local
741 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_close()
744 if (icd->streamer == file) { in soc_camera_close()
746 vb2_queue_release(&icd->vb2_vidq); in soc_camera_close()
747 icd->streamer = NULL; in soc_camera_close()
749 icd->use_count--; in soc_camera_close()
750 if (!icd->use_count) { in soc_camera_close()
751 pm_runtime_suspend(&icd->vdev->dev); in soc_camera_close()
752 pm_runtime_disable(&icd->vdev->dev); in soc_camera_close()
754 __soc_camera_power_off(icd); in soc_camera_close()
756 soc_camera_remove_device(icd); in soc_camera_close()
763 dev_dbg(icd->pdev, "camera device close\n"); in soc_camera_close()
771 struct soc_camera_device *icd = file->private_data; in soc_camera_read() local
772 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_read()
774 dev_dbg(icd->pdev, "read called, buf %p\n", buf); in soc_camera_read()
776 if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) in soc_camera_read()
777 return vb2_read(&icd->vb2_vidq, buf, count, ppos, in soc_camera_read()
780 dev_err(icd->pdev, "camera device read not implemented\n"); in soc_camera_read()
787 struct soc_camera_device *icd = file->private_data; in soc_camera_mmap() local
788 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_mmap()
791 dev_dbg(icd->pdev, "mmap called, vma=%p\n", vma); in soc_camera_mmap()
793 if (icd->streamer != file) in soc_camera_mmap()
798 err = vb2_mmap(&icd->vb2_vidq, vma); in soc_camera_mmap()
801 dev_dbg(icd->pdev, "vma start=0x%08lx, size=%ld, ret=%d\n", in soc_camera_mmap()
811 struct soc_camera_device *icd = file->private_data; in soc_camera_poll() local
812 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_poll()
815 if (icd->streamer != file) in soc_camera_poll()
837 struct soc_camera_device *icd = file->private_data; in soc_camera_s_fmt_vid_cap() local
843 dev_warn(icd->pdev, "Wrong buf-type %d\n", f->type); in soc_camera_s_fmt_vid_cap()
847 if (icd->streamer && icd->streamer != file) in soc_camera_s_fmt_vid_cap()
850 if (vb2_is_streaming(&icd->vb2_vidq)) { in soc_camera_s_fmt_vid_cap()
851 dev_err(icd->pdev, "S_FMT denied: queue initialised\n"); in soc_camera_s_fmt_vid_cap()
855 ret = soc_camera_set_fmt(icd, f); in soc_camera_s_fmt_vid_cap()
857 if (!ret && !icd->streamer) in soc_camera_s_fmt_vid_cap()
858 icd->streamer = file; in soc_camera_s_fmt_vid_cap()
866 struct soc_camera_device *icd = file->private_data; in soc_camera_enum_fmt_vid_cap() local
871 if (f->index >= icd->num_user_formats) in soc_camera_enum_fmt_vid_cap()
874 format = icd->user_formats[f->index].host_fmt; in soc_camera_enum_fmt_vid_cap()
885 struct soc_camera_device *icd = file->private_data; in soc_camera_g_fmt_vid_cap() local
893 pix->width = icd->user_width; in soc_camera_g_fmt_vid_cap()
894 pix->height = icd->user_height; in soc_camera_g_fmt_vid_cap()
895 pix->bytesperline = icd->bytesperline; in soc_camera_g_fmt_vid_cap()
896 pix->sizeimage = icd->sizeimage; in soc_camera_g_fmt_vid_cap()
897 pix->field = icd->field; in soc_camera_g_fmt_vid_cap()
898 pix->pixelformat = icd->current_fmt->host_fmt->fourcc; in soc_camera_g_fmt_vid_cap()
899 pix->colorspace = icd->colorspace; in soc_camera_g_fmt_vid_cap()
900 dev_dbg(icd->pdev, "current_fmt->fourcc: 0x%08x\n", in soc_camera_g_fmt_vid_cap()
901 icd->current_fmt->host_fmt->fourcc); in soc_camera_g_fmt_vid_cap()
908 struct soc_camera_device *icd = file->private_data; in soc_camera_querycap() local
909 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_querycap()
920 struct soc_camera_device *icd = file->private_data; in soc_camera_streamon() local
921 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in soc_camera_streamon()
929 if (icd->streamer != file) in soc_camera_streamon()
933 ret = vb2_streamon(&icd->vb2_vidq, i); in soc_camera_streamon()
943 struct soc_camera_device *icd = file->private_data; in soc_camera_streamoff() local
944 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in soc_camera_streamoff()
952 if (icd->streamer != file) in soc_camera_streamoff()
959 ret = vb2_streamoff(&icd->vb2_vidq, i); in soc_camera_streamoff()
969 struct soc_camera_device *icd = file->private_data; in soc_camera_g_selection() local
970 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_g_selection()
976 return ici->ops->get_selection(icd, s); in soc_camera_g_selection()
982 struct soc_camera_device *icd = file->private_data; in soc_camera_s_selection() local
983 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_s_selection()
994 if (vb2_is_streaming(&icd->vb2_vidq) && in soc_camera_s_selection()
995 (icd->user_width != s->r.width || in soc_camera_s_selection()
996 icd->user_height != s->r.height)) in soc_camera_s_selection()
1003 if (icd->streamer && icd->streamer != file) in soc_camera_s_selection()
1008 vb2_is_streaming(&icd->vb2_vidq) && in soc_camera_s_selection()
1010 ret = ici->ops->set_liveselection(icd, s); in soc_camera_s_selection()
1012 ret = ici->ops->set_selection(icd, s); in soc_camera_s_selection()
1015 icd->user_width = s->r.width; in soc_camera_s_selection()
1016 icd->user_height = s->r.height; in soc_camera_s_selection()
1017 if (!icd->streamer) in soc_camera_s_selection()
1018 icd->streamer = file; in soc_camera_s_selection()
1027 struct soc_camera_device *icd = file->private_data; in soc_camera_g_parm() local
1028 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_g_parm()
1031 return ici->ops->get_parm(icd, a); in soc_camera_g_parm()
1039 struct soc_camera_device *icd = file->private_data; in soc_camera_s_parm() local
1040 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_s_parm()
1043 return ici->ops->set_parm(icd, a); in soc_camera_s_parm()
1049 struct soc_camera_device *icd);
1054 struct soc_camera_device *icd; in scan_add_host() local
1058 list_for_each_entry(icd, &devices, list) in scan_add_host()
1059 if (icd->iface == ici->nr) { in scan_add_host()
1060 struct soc_camera_desc *sdesc = to_soc_camera_desc(icd); in scan_add_host()
1065 if (icd->control) in scan_add_host()
1066 ssdd->reset(icd->control); in scan_add_host()
1068 icd->parent = ici->v4l2_dev.dev; in scan_add_host()
1071 soc_camera_probe(ici, icd); in scan_add_host()
1083 struct soc_camera_device *icd = clk->priv; in soc_camera_clk_enable() local
1086 if (!icd || !icd->parent) in soc_camera_clk_enable()
1089 ici = to_soc_camera_host(icd->parent); in soc_camera_clk_enable()
1103 struct soc_camera_device *icd = clk->priv; in soc_camera_clk_disable() local
1106 if (!icd || !icd->parent) in soc_camera_clk_disable()
1109 ici = to_soc_camera_host(icd->parent); in soc_camera_clk_disable()
1170 static int soc_camera_probe_finish(struct soc_camera_device *icd) in soc_camera_probe_finish() argument
1172 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in soc_camera_probe_finish()
1179 sd->grp_id = soc_camera_grp_id(icd); in soc_camera_probe_finish()
1180 v4l2_set_subdev_hostdata(sd, icd); in soc_camera_probe_finish()
1182 v4l2_subdev_call(sd, video, g_tvnorms, &icd->vdev->tvnorms); in soc_camera_probe_finish()
1184 ret = v4l2_ctrl_add_handler(&icd->ctrl_handler, sd->ctrl_handler, NULL); in soc_camera_probe_finish()
1188 ret = soc_camera_add_device(icd); in soc_camera_probe_finish()
1190 dev_err(icd->pdev, "Couldn't activate the camera: %d\n", ret); in soc_camera_probe_finish()
1195 ret = soc_camera_init_user_formats(icd); in soc_camera_probe_finish()
1199 icd->field = V4L2_FIELD_ANY; in soc_camera_probe_finish()
1201 ret = soc_camera_video_start(icd); in soc_camera_probe_finish()
1207 icd->user_width = mf->width; in soc_camera_probe_finish()
1208 icd->user_height = mf->height; in soc_camera_probe_finish()
1209 icd->colorspace = mf->colorspace; in soc_camera_probe_finish()
1210 icd->field = mf->field; in soc_camera_probe_finish()
1212 soc_camera_remove_device(icd); in soc_camera_probe_finish()
1217 soc_camera_free_user_formats(icd); in soc_camera_probe_finish()
1219 soc_camera_remove_device(icd); in soc_camera_probe_finish()
1225 static int soc_camera_i2c_init(struct soc_camera_device *icd, in soc_camera_i2c_init() argument
1238 if (icd->sasc) { in soc_camera_i2c_init()
1243 ici = to_soc_camera_host(icd->parent); in soc_camera_i2c_init()
1246 dev_err(icd->pdev, "Cannot get I2C adapter #%d. No driver?\n", in soc_camera_i2c_init()
1268 icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, icd); in soc_camera_i2c_init()
1269 if (IS_ERR(icd->clk)) { in soc_camera_i2c_init()
1270 ret = PTR_ERR(icd->clk); in soc_camera_i2c_init()
1284 icd->control = &client->dev; in soc_camera_i2c_init()
1288 v4l2_clk_unregister(icd->clk); in soc_camera_i2c_init()
1289 icd->clk = NULL; in soc_camera_i2c_init()
1297 static void soc_camera_i2c_free(struct soc_camera_device *icd) in soc_camera_i2c_free() argument
1300 to_i2c_client(to_soc_camera_control(icd)); in soc_camera_i2c_free()
1304 icd->control = NULL; in soc_camera_i2c_free()
1305 if (icd->sasc) in soc_camera_i2c_free()
1314 v4l2_clk_unregister(icd->clk); in soc_camera_i2c_free()
1315 icd->clk = NULL; in soc_camera_i2c_free()
1332 struct soc_camera_device *icd = platform_get_drvdata(sasc->pdev); in soc_camera_async_bound() local
1334 if (asd == sasc->sensor && !WARN_ON(icd->control)) { in soc_camera_async_bound()
1342 struct soc_camera_desc *sdesc = to_soc_camera_desc(icd); in soc_camera_async_bound()
1352 icd->control = &client->dev; in soc_camera_async_bound()
1365 struct soc_camera_device *icd = platform_get_drvdata(sasc->pdev); in soc_camera_async_unbind() local
1367 icd->control = NULL; in soc_camera_async_unbind()
1369 if (icd->clk) { in soc_camera_async_unbind()
1370 v4l2_clk_unregister(icd->clk); in soc_camera_async_unbind()
1371 icd->clk = NULL; in soc_camera_async_unbind()
1379 struct soc_camera_device *icd = platform_get_drvdata(sasc->pdev); in soc_camera_async_complete() local
1381 if (to_soc_camera_control(icd)) { in soc_camera_async_complete()
1382 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_async_complete()
1386 ret = soc_camera_probe(ici, icd); in soc_camera_async_complete()
1406 struct soc_camera_device *icd; in scan_async_group() local
1439 icd = soc_camera_add_pdev(sasc); in scan_async_group()
1440 if (!icd) { in scan_async_group()
1449 icd->sasc = sasc; in scan_async_group()
1450 icd->parent = ici->v4l2_dev.dev; in scan_async_group()
1456 icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, icd); in scan_async_group()
1457 if (IS_ERR(icd->clk)) { in scan_async_group()
1458 ret = PTR_ERR(icd->clk); in scan_async_group()
1466 v4l2_clk_unregister(icd->clk); in scan_async_group()
1468 icd->clk = NULL; in scan_async_group()
1490 #define soc_camera_i2c_init(icd, sdesc) (-ENODEV) argument
1491 #define soc_camera_i2c_free(icd) do {} while (0) argument
1507 struct soc_camera_device *icd; in soc_of_bind() local
1537 icd = soc_camera_add_pdev(sasc); in soc_of_bind()
1538 if (!icd) { in soc_of_bind()
1547 icd->sasc = sasc; in soc_of_bind()
1548 icd->parent = ici->v4l2_dev.dev; in soc_of_bind()
1558 icd->clk = v4l2_clk_register(&soc_camera_clk_ops, clk_name, icd); in soc_of_bind()
1559 if (IS_ERR(icd->clk)) { in soc_of_bind()
1560 ret = PTR_ERR(icd->clk); in soc_of_bind()
1568 v4l2_clk_unregister(icd->clk); in soc_of_bind()
1570 icd->clk = NULL; in soc_of_bind()
1620 struct soc_camera_device *icd) in soc_camera_probe() argument
1622 struct soc_camera_desc *sdesc = to_soc_camera_desc(icd); in soc_camera_probe()
1627 dev_info(icd->pdev, "Probing %s\n", dev_name(icd->pdev)); in soc_camera_probe()
1636 ret = v4l2_ctrl_handler_init(&icd->ctrl_handler, 16); in soc_camera_probe()
1641 ret = video_dev_create(icd); in soc_camera_probe()
1653 ret = soc_camera_i2c_init(icd, sdesc); in soc_camera_probe()
1667 ret = shd->add_device(icd); in soc_camera_probe()
1675 control = to_soc_camera_control(icd); in soc_camera_probe()
1678 shd->del_device(icd); in soc_camera_probe()
1685 ret = soc_camera_probe_finish(icd); in soc_camera_probe()
1694 soc_camera_i2c_free(icd); in soc_camera_probe()
1696 shd->del_device(icd); in soc_camera_probe()
1703 if (icd->vdev) { in soc_camera_probe()
1704 video_device_release(icd->vdev); in soc_camera_probe()
1705 icd->vdev = NULL; in soc_camera_probe()
1708 v4l2_ctrl_handler_free(&icd->ctrl_handler); in soc_camera_probe()
1718 static int soc_camera_remove(struct soc_camera_device *icd) in soc_camera_remove() argument
1720 struct soc_camera_desc *sdesc = to_soc_camera_desc(icd); in soc_camera_remove()
1721 struct video_device *vdev = icd->vdev; in soc_camera_remove()
1723 v4l2_ctrl_handler_free(&icd->ctrl_handler); in soc_camera_remove()
1726 icd->vdev = NULL; in soc_camera_remove()
1730 soc_camera_i2c_free(icd); in soc_camera_remove()
1732 struct device *dev = to_soc_camera_control(icd); in soc_camera_remove()
1735 sdesc->host_desc.del_device(icd); in soc_camera_remove()
1740 if (icd->num_user_formats) in soc_camera_remove()
1741 soc_camera_free_user_formats(icd); in soc_camera_remove()
1743 if (icd->clk) { in soc_camera_remove()
1745 v4l2_clk_unregister(icd->clk); in soc_camera_remove()
1746 icd->clk = NULL; in soc_camera_remove()
1749 if (icd->sasc) in soc_camera_remove()
1750 platform_device_unregister(icd->sasc->pdev); in soc_camera_remove()
1755 static int default_g_selection(struct soc_camera_device *icd, in default_g_selection() argument
1758 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in default_g_selection()
1772 static int default_s_selection(struct soc_camera_device *icd, in default_s_selection() argument
1775 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in default_s_selection()
1791 static int default_g_parm(struct soc_camera_device *icd, in default_g_parm() argument
1794 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in default_g_parm()
1796 return v4l2_g_parm_cap(icd->vdev, sd, a); in default_g_parm()
1799 static int default_s_parm(struct soc_camera_device *icd, in default_s_parm() argument
1802 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in default_s_parm()
1804 return v4l2_s_parm_cap(icd->vdev, sd, a); in default_s_parm()
1807 static int default_enum_framesizes(struct soc_camera_device *icd, in default_enum_framesizes() argument
1811 struct v4l2_subdev *sd = soc_camera_to_subdev(icd); in default_enum_framesizes()
1818 xlate = soc_camera_xlate_by_fourcc(icd, fsize->pixel_format); in default_enum_framesizes()
1912 struct soc_camera_device *icd, *tmp; in soc_camera_host_unregister() local
1918 list_for_each_entry(icd, &devices, list) in soc_camera_host_unregister()
1919 if (icd->iface == ici->nr && icd->sasc) { in soc_camera_host_unregister()
1921 get_device(icd->pdev); in soc_camera_host_unregister()
1922 list_add(&icd->sasc->list, &notifiers); in soc_camera_host_unregister()
1934 list_for_each_entry_safe(icd, tmp, &devices, list) in soc_camera_host_unregister()
1935 if (icd->iface == ici->nr) in soc_camera_host_unregister()
1936 soc_camera_remove(icd); in soc_camera_host_unregister()
1945 static int soc_camera_device_register(struct soc_camera_device *icd) in soc_camera_device_register() argument
1955 if (ix->iface == icd->iface && ix->devnum == i) { in soc_camera_device_register()
1971 icd->devnum = num; in soc_camera_device_register()
1972 icd->use_count = 0; in soc_camera_device_register()
1973 icd->host_priv = NULL; in soc_camera_device_register()
1979 i = to_platform_device(icd->pdev)->id; in soc_camera_device_register()
1988 list_add_tail(&icd->list, &devices); in soc_camera_device_register()
2021 static int video_dev_create(struct soc_camera_device *icd) in video_dev_create() argument
2023 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in video_dev_create()
2035 vdev->ctrl_handler = &icd->ctrl_handler; in video_dev_create()
2038 icd->vdev = vdev; in video_dev_create()
2046 static int soc_camera_video_start(struct soc_camera_device *icd) in soc_camera_video_start() argument
2048 const struct device_type *type = icd->vdev->dev.type; in soc_camera_video_start()
2051 if (!icd->parent) in soc_camera_video_start()
2054 video_set_drvdata(icd->vdev, icd); in soc_camera_video_start()
2055 if (icd->vdev->tvnorms == 0) { in soc_camera_video_start()
2057 v4l2_disable_ioctl(icd->vdev, VIDIOC_G_STD); in soc_camera_video_start()
2058 v4l2_disable_ioctl(icd->vdev, VIDIOC_S_STD); in soc_camera_video_start()
2059 v4l2_disable_ioctl(icd->vdev, VIDIOC_ENUMSTD); in soc_camera_video_start()
2061 ret = video_register_device(icd->vdev, VFL_TYPE_GRABBER, -1); in soc_camera_video_start()
2063 dev_err(icd->pdev, "video_register_device failed: %d\n", ret); in soc_camera_video_start()
2068 icd->vdev->dev.type = type; in soc_camera_video_start()
2077 struct soc_camera_device *icd; in soc_camera_pdrv_probe() local
2083 icd = devm_kzalloc(&pdev->dev, sizeof(*icd), GFP_KERNEL); in soc_camera_pdrv_probe()
2084 if (!icd) in soc_camera_pdrv_probe()
2099 icd->iface = sdesc->host_desc.bus_id; in soc_camera_pdrv_probe()
2100 icd->sdesc = sdesc; in soc_camera_pdrv_probe()
2101 icd->pdev = &pdev->dev; in soc_camera_pdrv_probe()
2102 platform_set_drvdata(pdev, icd); in soc_camera_pdrv_probe()
2104 icd->user_width = DEFAULT_WIDTH; in soc_camera_pdrv_probe()
2105 icd->user_height = DEFAULT_HEIGHT; in soc_camera_pdrv_probe()
2107 return soc_camera_device_register(icd); in soc_camera_pdrv_probe()
2117 struct soc_camera_device *icd = platform_get_drvdata(pdev); in soc_camera_pdrv_remove() local
2120 if (!icd) in soc_camera_pdrv_remove()
2135 list_del(&icd->list); in soc_camera_pdrv_remove()