Lines Matching refs:ici
47 #define is_streaming(ici, icd) \ argument
48 (((ici)->ops->init_videobuf) ? \
180 static int soc_camera_clock_start(struct soc_camera_host *ici) in soc_camera_clock_start() argument
184 if (!ici->ops->clock_start) in soc_camera_clock_start()
187 mutex_lock(&ici->clk_lock); in soc_camera_clock_start()
188 ret = ici->ops->clock_start(ici); in soc_camera_clock_start()
189 mutex_unlock(&ici->clk_lock); in soc_camera_clock_start()
194 static void soc_camera_clock_stop(struct soc_camera_host *ici) in soc_camera_clock_stop() argument
196 if (!ici->ops->clock_stop) in soc_camera_clock_stop()
199 mutex_lock(&ici->clk_lock); in soc_camera_clock_stop()
200 ici->ops->clock_stop(ici); in soc_camera_clock_stop()
201 mutex_unlock(&ici->clk_lock); in soc_camera_clock_stop()
256 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_try_fmt() local
265 !(ici->capabilities & SOCAM_HOST_CAP_STRIDE)) { in soc_camera_try_fmt()
270 ret = ici->ops->try_fmt(icd, f); in soc_camera_try_fmt()
360 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_enum_framesizes() local
362 return ici->ops->enum_framesizes(icd, fsize); in soc_camera_enum_framesizes()
370 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_reqbufs() local
377 if (ici->ops->init_videobuf) { in soc_camera_reqbufs()
382 ret = ici->ops->reqbufs(icd, p); in soc_camera_reqbufs()
396 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_querybuf() local
400 if (ici->ops->init_videobuf) in soc_camera_querybuf()
410 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_qbuf() local
417 if (ici->ops->init_videobuf) in soc_camera_qbuf()
427 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_dqbuf() local
434 if (ici->ops->init_videobuf) in soc_camera_dqbuf()
444 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_create_bufs() local
448 if (ici->ops->init_videobuf) in soc_camera_create_bufs()
464 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_prepare_buf() local
467 if (ici->ops->init_videobuf) in soc_camera_prepare_buf()
477 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_expbuf() local
480 if (ici->ops->init_videobuf) in soc_camera_expbuf()
492 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_init_user_formats() local
504 if (!ici->ops->get_formats) in soc_camera_init_user_formats()
516 ret = ici->ops->get_formats(icd, i, NULL); in soc_camera_init_user_formats()
535 if (!ici->ops->get_formats) { in soc_camera_init_user_formats()
543 ret = ici->ops->get_formats(icd, i, in soc_camera_init_user_formats()
563 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_free_user_formats() local
565 if (ici->ops->put_formats) in soc_camera_free_user_formats()
566 ici->ops->put_formats(icd); in soc_camera_free_user_formats()
577 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_set_fmt() local
589 ret = ici->ops->set_fmt(icd, f); in soc_camera_set_fmt()
605 if (ici->ops->init_videobuf) in soc_camera_set_fmt()
612 return ici->ops->set_bus_param(icd); in soc_camera_set_fmt()
617 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_add_device() local
620 if (ici->icd) in soc_camera_add_device()
624 ret = soc_camera_clock_start(ici); in soc_camera_add_device()
629 if (ici->ops->add) { in soc_camera_add_device()
630 ret = ici->ops->add(icd); in soc_camera_add_device()
635 ici->icd = icd; in soc_camera_add_device()
641 soc_camera_clock_stop(ici); in soc_camera_add_device()
647 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_remove_device() local
649 if (WARN_ON(icd != ici->icd)) in soc_camera_remove_device()
652 if (ici->ops->remove) in soc_camera_remove_device()
653 ici->ops->remove(icd); in soc_camera_remove_device()
655 soc_camera_clock_stop(ici); in soc_camera_remove_device()
656 ici->icd = NULL; in soc_camera_remove_device()
663 struct soc_camera_host *ici; in soc_camera_open() local
680 ici = to_soc_camera_host(icd->parent); in soc_camera_open()
682 ret = try_module_get(ici->ops->owner) ? 0 : -ENODEV; in soc_camera_open()
696 if (mutex_lock_interruptible(&ici->host_lock)) { in soc_camera_open()
748 if (ici->ops->init_videobuf) { in soc_camera_open()
749 ici->ops->init_videobuf(&icd->vb_vidq, icd); in soc_camera_open()
751 ret = ici->ops->init_videobuf2(&icd->vb2_vidq, icd); in soc_camera_open()
757 mutex_unlock(&ici->host_lock); in soc_camera_open()
777 mutex_unlock(&ici->host_lock); in soc_camera_open()
780 module_put(ici->ops->owner); in soc_camera_open()
788 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_close() local
790 mutex_lock(&ici->host_lock); in soc_camera_close()
792 if (ici->ops->init_videobuf2) in soc_camera_close()
806 mutex_unlock(&ici->host_lock); in soc_camera_close()
808 module_put(ici->ops->owner); in soc_camera_close()
819 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_read() local
823 if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) in soc_camera_read()
835 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_mmap() local
843 if (mutex_lock_interruptible(&ici->host_lock)) in soc_camera_mmap()
845 if (ici->ops->init_videobuf) in soc_camera_mmap()
849 mutex_unlock(&ici->host_lock); in soc_camera_mmap()
862 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_poll() local
868 mutex_lock(&ici->host_lock); in soc_camera_poll()
869 if (ici->ops->init_videobuf && list_empty(&icd->vb_vidq.stream)) in soc_camera_poll()
872 res = ici->ops->poll(file, pt); in soc_camera_poll()
873 mutex_unlock(&ici->host_lock); in soc_camera_poll()
962 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_querycap() local
966 strlcpy(cap->driver, ici->drv_name, sizeof(cap->driver)); in soc_camera_querycap()
967 return ici->ops->querycap(ici, cap); in soc_camera_querycap()
974 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_streamon() local
987 if (ici->ops->init_videobuf) in soc_camera_streamon()
1003 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_streamoff() local
1018 if (ici->ops->init_videobuf) in soc_camera_streamoff()
1032 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_cropcap() local
1034 return ici->ops->cropcap(icd, a); in soc_camera_cropcap()
1041 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_g_crop() local
1044 ret = ici->ops->get_crop(icd, a); in soc_camera_g_crop()
1058 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_s_crop() local
1072 ret = ici->ops->get_crop(icd, ¤t_crop); in soc_camera_s_crop()
1080 !is_streaming(ici, icd)) { in soc_camera_s_crop()
1082 ret = ici->ops->set_crop(icd, a); in soc_camera_s_crop()
1083 } else if (ici->ops->set_livecrop) { in soc_camera_s_crop()
1084 ret = ici->ops->set_livecrop(icd, a); in soc_camera_s_crop()
1098 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_g_selection() local
1104 if (!ici->ops->get_selection) in soc_camera_g_selection()
1107 return ici->ops->get_selection(icd, s); in soc_camera_g_selection()
1114 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_s_selection() local
1125 if (is_streaming(ici, icd) && in soc_camera_s_selection()
1138 if (!ici->ops->set_selection) in soc_camera_s_selection()
1141 ret = ici->ops->set_selection(icd, s); in soc_camera_s_selection()
1157 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_g_parm() local
1159 if (ici->ops->get_parm) in soc_camera_g_parm()
1160 return ici->ops->get_parm(icd, a); in soc_camera_g_parm()
1169 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_s_parm() local
1171 if (ici->ops->set_parm) in soc_camera_s_parm()
1172 return ici->ops->set_parm(icd, a); in soc_camera_s_parm()
1177 static int soc_camera_probe(struct soc_camera_host *ici,
1181 static void scan_add_host(struct soc_camera_host *ici) in scan_add_host() argument
1188 if (icd->iface == ici->nr) { in scan_add_host()
1197 icd->parent = ici->v4l2_dev.dev; in scan_add_host()
1200 soc_camera_probe(ici, icd); in scan_add_host()
1213 struct soc_camera_host *ici; in soc_camera_clk_enable() local
1218 ici = to_soc_camera_host(icd->parent); in soc_camera_clk_enable()
1220 if (!try_module_get(ici->ops->owner)) in soc_camera_clk_enable()
1227 return soc_camera_clock_start(ici); in soc_camera_clk_enable()
1233 struct soc_camera_host *ici; in soc_camera_clk_disable() local
1238 ici = to_soc_camera_host(icd->parent); in soc_camera_clk_disable()
1240 soc_camera_clock_stop(ici); in soc_camera_clk_disable()
1242 module_put(ici->ops->owner); in soc_camera_clk_disable()
1359 struct soc_camera_host *ici; in soc_camera_i2c_init() local
1372 ici = to_soc_camera_host(icd->parent); in soc_camera_i2c_init()
1403 subdev = v4l2_i2c_new_subdev_board(&ici->v4l2_dev, adap, in soc_camera_i2c_init()
1509 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_async_complete() local
1513 ret = soc_camera_probe(ici, icd); in soc_camera_async_complete()
1522 static int scan_async_group(struct soc_camera_host *ici, in scan_async_group() argument
1528 struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,}; in scan_async_group()
1542 dev_err(ici->v4l2_dev.dev, "No I2C data source found!\n"); in scan_async_group()
1547 sasc = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasc), GFP_KERNEL); in scan_async_group()
1573 icd->parent = ici->v4l2_dev.dev; in scan_async_group()
1584 ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier); in scan_async_group()
1595 devm_kfree(ici->v4l2_dev.dev, sasc); in scan_async_group()
1596 dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret); in scan_async_group()
1601 static void scan_async_host(struct soc_camera_host *ici) in scan_async_host() argument
1606 for (j = 0, asd = ici->asd; ici->asd_sizes[j]; j++) { in scan_async_host()
1607 scan_async_group(ici, asd, ici->asd_sizes[j]); in scan_async_host()
1608 asd += ici->asd_sizes[j]; in scan_async_host()
1614 #define scan_async_host(ici) do {} while (0) argument
1625 static int soc_of_bind(struct soc_camera_host *ici, in soc_of_bind() argument
1630 struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,}; in soc_of_bind()
1638 info = devm_kzalloc(ici->v4l2_dev.dev, sizeof(struct soc_of_info), in soc_of_bind()
1672 icd->parent = ici->v4l2_dev.dev; in soc_of_bind()
1689 ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier); in soc_of_bind()
1700 devm_kfree(ici->v4l2_dev.dev, info); in soc_of_bind()
1701 dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret); in soc_of_bind()
1706 static void scan_of_host(struct soc_camera_host *ici) in scan_of_host() argument
1708 struct device *dev = ici->v4l2_dev.dev; in scan_of_host()
1727 soc_of_bind(ici, epn, ren->parent); in scan_of_host()
1741 static inline void scan_of_host(struct soc_camera_host *ici) { } in scan_of_host() argument
1745 static int soc_camera_probe(struct soc_camera_host *ici, in soc_camera_probe() argument
1786 ret = soc_camera_clock_start(ici); in soc_camera_probe()
1810 mutex_lock(&ici->host_lock); in soc_camera_probe()
1812 mutex_unlock(&ici->host_lock); in soc_camera_probe()
1826 soc_camera_clock_stop(ici); in soc_camera_probe()
1951 int soc_camera_host_register(struct soc_camera_host *ici) in soc_camera_host_register() argument
1956 if (!ici || !ici->ops || in soc_camera_host_register()
1957 !ici->ops->try_fmt || in soc_camera_host_register()
1958 !ici->ops->set_fmt || in soc_camera_host_register()
1959 !ici->ops->set_bus_param || in soc_camera_host_register()
1960 !ici->ops->querycap || in soc_camera_host_register()
1961 ((!ici->ops->init_videobuf || in soc_camera_host_register()
1962 !ici->ops->reqbufs) && in soc_camera_host_register()
1963 !ici->ops->init_videobuf2) || in soc_camera_host_register()
1964 !ici->ops->poll || in soc_camera_host_register()
1965 !ici->v4l2_dev.dev) in soc_camera_host_register()
1968 if (!ici->ops->set_crop) in soc_camera_host_register()
1969 ici->ops->set_crop = default_s_crop; in soc_camera_host_register()
1970 if (!ici->ops->get_crop) in soc_camera_host_register()
1971 ici->ops->get_crop = default_g_crop; in soc_camera_host_register()
1972 if (!ici->ops->cropcap) in soc_camera_host_register()
1973 ici->ops->cropcap = default_cropcap; in soc_camera_host_register()
1974 if (!ici->ops->set_parm) in soc_camera_host_register()
1975 ici->ops->set_parm = default_s_parm; in soc_camera_host_register()
1976 if (!ici->ops->get_parm) in soc_camera_host_register()
1977 ici->ops->get_parm = default_g_parm; in soc_camera_host_register()
1978 if (!ici->ops->enum_framesizes) in soc_camera_host_register()
1979 ici->ops->enum_framesizes = default_enum_framesizes; in soc_camera_host_register()
1983 if (ix->nr == ici->nr) { in soc_camera_host_register()
1989 ret = v4l2_device_register(ici->v4l2_dev.dev, &ici->v4l2_dev); in soc_camera_host_register()
1993 list_add_tail(&ici->list, &hosts); in soc_camera_host_register()
1996 mutex_init(&ici->host_lock); in soc_camera_host_register()
1997 mutex_init(&ici->clk_lock); in soc_camera_host_register()
1999 if (ici->v4l2_dev.dev->of_node) in soc_camera_host_register()
2000 scan_of_host(ici); in soc_camera_host_register()
2001 else if (ici->asd_sizes) in soc_camera_host_register()
2007 scan_async_host(ici); in soc_camera_host_register()
2010 scan_add_host(ici); in soc_camera_host_register()
2021 void soc_camera_host_unregister(struct soc_camera_host *ici) in soc_camera_host_unregister() argument
2028 list_del(&ici->list); in soc_camera_host_unregister()
2030 if (icd->iface == ici->nr && icd->sasc) { in soc_camera_host_unregister()
2046 if (icd->iface == ici->nr) in soc_camera_host_unregister()
2051 v4l2_device_unregister(&ici->v4l2_dev); in soc_camera_host_unregister()
2137 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in video_dev_create() local
2143 strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); in video_dev_create()
2145 vdev->v4l2_dev = &ici->v4l2_dev; in video_dev_create()
2150 vdev->lock = &ici->host_lock; in video_dev_create()