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()
357 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_enum_framesizes() local
359 return ici->ops->enum_framesizes(icd, fsize); in soc_camera_enum_framesizes()
367 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_reqbufs() local
374 if (ici->ops->init_videobuf) { in soc_camera_reqbufs()
379 ret = ici->ops->reqbufs(icd, p); in soc_camera_reqbufs()
394 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_querybuf() local
398 if (ici->ops->init_videobuf) in soc_camera_querybuf()
408 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_qbuf() local
415 if (ici->ops->init_videobuf) in soc_camera_qbuf()
425 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_dqbuf() local
432 if (ici->ops->init_videobuf) in soc_camera_dqbuf()
442 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_create_bufs() local
445 if (ici->ops->init_videobuf) in soc_camera_create_bufs()
455 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_prepare_buf() local
458 if (ici->ops->init_videobuf) in soc_camera_prepare_buf()
468 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_expbuf() local
474 if (ici->ops->init_videobuf) in soc_camera_expbuf()
484 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_init_user_formats() local
492 if (!ici->ops->get_formats) in soc_camera_init_user_formats()
504 ret = ici->ops->get_formats(icd, i, NULL); in soc_camera_init_user_formats()
523 if (!ici->ops->get_formats) { in soc_camera_init_user_formats()
530 ret = ici->ops->get_formats(icd, i, in soc_camera_init_user_formats()
550 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_free_user_formats() local
552 if (ici->ops->put_formats) in soc_camera_free_user_formats()
553 ici->ops->put_formats(icd); in soc_camera_free_user_formats()
564 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_set_fmt() local
576 ret = ici->ops->set_fmt(icd, f); in soc_camera_set_fmt()
592 if (ici->ops->init_videobuf) in soc_camera_set_fmt()
599 return ici->ops->set_bus_param(icd); in soc_camera_set_fmt()
604 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_add_device() local
607 if (ici->icd) in soc_camera_add_device()
611 ret = soc_camera_clock_start(ici); in soc_camera_add_device()
616 if (ici->ops->add) { in soc_camera_add_device()
617 ret = ici->ops->add(icd); in soc_camera_add_device()
622 ici->icd = icd; in soc_camera_add_device()
628 soc_camera_clock_stop(ici); in soc_camera_add_device()
634 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_remove_device() local
636 if (WARN_ON(icd != ici->icd)) in soc_camera_remove_device()
639 if (ici->ops->remove) in soc_camera_remove_device()
640 ici->ops->remove(icd); in soc_camera_remove_device()
642 soc_camera_clock_stop(ici); in soc_camera_remove_device()
643 ici->icd = NULL; in soc_camera_remove_device()
650 struct soc_camera_host *ici; in soc_camera_open() local
667 ici = to_soc_camera_host(icd->parent); in soc_camera_open()
669 ret = try_module_get(ici->ops->owner) ? 0 : -ENODEV; in soc_camera_open()
683 if (mutex_lock_interruptible(&ici->host_lock)) { in soc_camera_open()
735 if (ici->ops->init_videobuf) { in soc_camera_open()
736 ici->ops->init_videobuf(&icd->vb_vidq, icd); in soc_camera_open()
738 ret = ici->ops->init_videobuf2(&icd->vb2_vidq, icd); in soc_camera_open()
744 mutex_unlock(&ici->host_lock); in soc_camera_open()
764 mutex_unlock(&ici->host_lock); in soc_camera_open()
767 module_put(ici->ops->owner); in soc_camera_open()
775 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_close() local
777 mutex_lock(&ici->host_lock); in soc_camera_close()
783 if (ici->ops->init_videobuf2) in soc_camera_close()
792 mutex_unlock(&ici->host_lock); in soc_camera_close()
794 module_put(ici->ops->owner); in soc_camera_close()
805 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_read() local
809 if (ici->ops->init_videobuf2 && icd->vb2_vidq.io_modes & VB2_READ) in soc_camera_read()
821 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_mmap() local
829 if (mutex_lock_interruptible(&ici->host_lock)) in soc_camera_mmap()
831 if (ici->ops->init_videobuf) in soc_camera_mmap()
835 mutex_unlock(&ici->host_lock); in soc_camera_mmap()
848 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_poll() local
854 mutex_lock(&ici->host_lock); in soc_camera_poll()
855 if (ici->ops->init_videobuf && list_empty(&icd->vb_vidq.stream)) in soc_camera_poll()
858 res = ici->ops->poll(file, pt); in soc_camera_poll()
859 mutex_unlock(&ici->host_lock); in soc_camera_poll()
948 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_querycap() local
952 strlcpy(cap->driver, ici->drv_name, sizeof(cap->driver)); in soc_camera_querycap()
953 return ici->ops->querycap(ici, cap); in soc_camera_querycap()
960 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_streamon() local
973 if (ici->ops->init_videobuf) in soc_camera_streamon()
989 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_streamoff() local
1003 if (ici->ops->init_videobuf) in soc_camera_streamoff()
1017 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_cropcap() local
1019 return ici->ops->cropcap(icd, a); in soc_camera_cropcap()
1026 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_g_crop() local
1029 ret = ici->ops->get_crop(icd, a); in soc_camera_g_crop()
1043 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_s_crop() local
1057 ret = ici->ops->get_crop(icd, &current_crop); in soc_camera_s_crop()
1065 !is_streaming(ici, icd)) { in soc_camera_s_crop()
1067 ret = ici->ops->set_crop(icd, a); in soc_camera_s_crop()
1068 } else if (ici->ops->set_livecrop) { in soc_camera_s_crop()
1069 ret = ici->ops->set_livecrop(icd, a); in soc_camera_s_crop()
1083 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_g_selection() local
1089 if (!ici->ops->get_selection) in soc_camera_g_selection()
1092 return ici->ops->get_selection(icd, s); in soc_camera_g_selection()
1099 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_s_selection() local
1110 if (is_streaming(ici, icd) && in soc_camera_s_selection()
1123 if (!ici->ops->set_selection) in soc_camera_s_selection()
1126 ret = ici->ops->set_selection(icd, s); in soc_camera_s_selection()
1142 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_g_parm() local
1144 if (ici->ops->get_parm) in soc_camera_g_parm()
1145 return ici->ops->get_parm(icd, a); in soc_camera_g_parm()
1154 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_s_parm() local
1156 if (ici->ops->set_parm) in soc_camera_s_parm()
1157 return ici->ops->set_parm(icd, a); in soc_camera_s_parm()
1162 static int soc_camera_probe(struct soc_camera_host *ici,
1166 static void scan_add_host(struct soc_camera_host *ici) in scan_add_host() argument
1173 if (icd->iface == ici->nr) { in scan_add_host()
1182 icd->parent = ici->v4l2_dev.dev; in scan_add_host()
1185 soc_camera_probe(ici, icd); in scan_add_host()
1198 struct soc_camera_host *ici; in soc_camera_clk_enable() local
1203 ici = to_soc_camera_host(icd->parent); in soc_camera_clk_enable()
1205 if (!try_module_get(ici->ops->owner)) in soc_camera_clk_enable()
1212 return soc_camera_clock_start(ici); in soc_camera_clk_enable()
1218 struct soc_camera_host *ici; in soc_camera_clk_disable() local
1223 ici = to_soc_camera_host(icd->parent); in soc_camera_clk_disable()
1225 soc_camera_clock_stop(ici); in soc_camera_clk_disable()
1227 module_put(ici->ops->owner); in soc_camera_clk_disable()
1341 struct soc_camera_host *ici; in soc_camera_i2c_init() local
1354 ici = to_soc_camera_host(icd->parent); in soc_camera_i2c_init()
1385 subdev = v4l2_i2c_new_subdev_board(&ici->v4l2_dev, adap, in soc_camera_i2c_init()
1491 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in soc_camera_async_complete() local
1495 ret = soc_camera_probe(ici, icd); in soc_camera_async_complete()
1504 static int scan_async_group(struct soc_camera_host *ici, in scan_async_group() argument
1510 struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,}; in scan_async_group()
1524 dev_err(ici->v4l2_dev.dev, "No I2C data source found!\n"); in scan_async_group()
1529 sasc = devm_kzalloc(ici->v4l2_dev.dev, sizeof(*sasc), GFP_KERNEL); in scan_async_group()
1555 icd->parent = ici->v4l2_dev.dev; in scan_async_group()
1566 ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier); in scan_async_group()
1577 devm_kfree(ici->v4l2_dev.dev, sasc); in scan_async_group()
1578 dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret); in scan_async_group()
1583 static void scan_async_host(struct soc_camera_host *ici) in scan_async_host() argument
1588 for (j = 0, asd = ici->asd; ici->asd_sizes[j]; j++) { in scan_async_host()
1589 scan_async_group(ici, asd, ici->asd_sizes[j]); in scan_async_host()
1590 asd += ici->asd_sizes[j]; in scan_async_host()
1596 #define scan_async_host(ici) do {} while (0) argument
1607 static int soc_of_bind(struct soc_camera_host *ici, in soc_of_bind() argument
1612 struct soc_camera_desc sdesc = {.host_desc.bus_id = ici->nr,}; in soc_of_bind()
1620 info = devm_kzalloc(ici->v4l2_dev.dev, sizeof(struct soc_of_info), in soc_of_bind()
1654 icd->parent = ici->v4l2_dev.dev; in soc_of_bind()
1671 ret = v4l2_async_notifier_register(&ici->v4l2_dev, &sasc->notifier); in soc_of_bind()
1682 devm_kfree(ici->v4l2_dev.dev, info); in soc_of_bind()
1683 dev_err(ici->v4l2_dev.dev, "group probe failed: %d\n", ret); in soc_of_bind()
1688 static void scan_of_host(struct soc_camera_host *ici) in scan_of_host() argument
1690 struct device *dev = ici->v4l2_dev.dev; in scan_of_host()
1709 soc_of_bind(ici, epn, ren->parent); in scan_of_host()
1723 static inline void scan_of_host(struct soc_camera_host *ici) { } in scan_of_host() argument
1727 static int soc_camera_probe(struct soc_camera_host *ici, in soc_camera_probe() argument
1768 ret = soc_camera_clock_start(ici); in soc_camera_probe()
1792 mutex_lock(&ici->host_lock); in soc_camera_probe()
1794 mutex_unlock(&ici->host_lock); in soc_camera_probe()
1808 soc_camera_clock_stop(ici); in soc_camera_probe()
1933 int soc_camera_host_register(struct soc_camera_host *ici) in soc_camera_host_register() argument
1938 if (!ici || !ici->ops || in soc_camera_host_register()
1939 !ici->ops->try_fmt || in soc_camera_host_register()
1940 !ici->ops->set_fmt || in soc_camera_host_register()
1941 !ici->ops->set_bus_param || in soc_camera_host_register()
1942 !ici->ops->querycap || in soc_camera_host_register()
1943 ((!ici->ops->init_videobuf || in soc_camera_host_register()
1944 !ici->ops->reqbufs) && in soc_camera_host_register()
1945 !ici->ops->init_videobuf2) || in soc_camera_host_register()
1946 !ici->ops->poll || in soc_camera_host_register()
1947 !ici->v4l2_dev.dev) in soc_camera_host_register()
1950 if (!ici->ops->set_crop) in soc_camera_host_register()
1951 ici->ops->set_crop = default_s_crop; in soc_camera_host_register()
1952 if (!ici->ops->get_crop) in soc_camera_host_register()
1953 ici->ops->get_crop = default_g_crop; in soc_camera_host_register()
1954 if (!ici->ops->cropcap) in soc_camera_host_register()
1955 ici->ops->cropcap = default_cropcap; in soc_camera_host_register()
1956 if (!ici->ops->set_parm) in soc_camera_host_register()
1957 ici->ops->set_parm = default_s_parm; in soc_camera_host_register()
1958 if (!ici->ops->get_parm) in soc_camera_host_register()
1959 ici->ops->get_parm = default_g_parm; in soc_camera_host_register()
1960 if (!ici->ops->enum_framesizes) in soc_camera_host_register()
1961 ici->ops->enum_framesizes = default_enum_framesizes; in soc_camera_host_register()
1965 if (ix->nr == ici->nr) { in soc_camera_host_register()
1971 ret = v4l2_device_register(ici->v4l2_dev.dev, &ici->v4l2_dev); in soc_camera_host_register()
1975 list_add_tail(&ici->list, &hosts); in soc_camera_host_register()
1978 mutex_init(&ici->host_lock); in soc_camera_host_register()
1979 mutex_init(&ici->clk_lock); in soc_camera_host_register()
1981 if (ici->v4l2_dev.dev->of_node) in soc_camera_host_register()
1982 scan_of_host(ici); in soc_camera_host_register()
1983 else if (ici->asd_sizes) in soc_camera_host_register()
1989 scan_async_host(ici); in soc_camera_host_register()
1992 scan_add_host(ici); in soc_camera_host_register()
2003 void soc_camera_host_unregister(struct soc_camera_host *ici) in soc_camera_host_unregister() argument
2010 list_del(&ici->list); in soc_camera_host_unregister()
2012 if (icd->iface == ici->nr && icd->sasc) { in soc_camera_host_unregister()
2028 if (icd->iface == ici->nr) in soc_camera_host_unregister()
2033 v4l2_device_unregister(&ici->v4l2_dev); in soc_camera_host_unregister()
2119 struct soc_camera_host *ici = to_soc_camera_host(icd->parent); in video_dev_create() local
2125 strlcpy(vdev->name, ici->drv_name, sizeof(vdev->name)); in video_dev_create()
2127 vdev->v4l2_dev = &ici->v4l2_dev; in video_dev_create()
2132 vdev->lock = &ici->host_lock; in video_dev_create()