Lines Matching refs:v4l2
147 struct em28xx_v4l2 *v4l2 = dev->v4l2; in norm_maxw() local
150 return v4l2->sensor_xres; in norm_maxw()
160 struct em28xx_v4l2 *v4l2 = dev->v4l2; in norm_maxh() local
163 return v4l2->sensor_yres; in norm_maxh()
168 return (v4l2->norm & V4L2_STD_625_50) ? 576 : 480; in norm_maxh()
196 struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; in em28xx_wake_i2c()
225 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_set_outfmt() local
227 fmt = v4l2->format->reg; in em28xx_set_outfmt()
243 ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, v4l2->vinmode); in em28xx_set_outfmt()
247 vinctrl = v4l2->vinctl; in em28xx_set_outfmt()
251 em28xx_write_reg(dev, EM28XX_R36_VBI_WIDTH, v4l2->vbi_width/4); in em28xx_set_outfmt()
252 em28xx_write_reg(dev, EM28XX_R37_VBI_HEIGHT, v4l2->vbi_height); in em28xx_set_outfmt()
253 if (v4l2->norm & V4L2_STD_525_60) { in em28xx_set_outfmt()
256 } else if (v4l2->norm & V4L2_STD_625_50) { in em28xx_set_outfmt()
331 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_resolution_set() local
336 v4l2->vbi_width = 720; in em28xx_resolution_set()
337 if (v4l2->norm & V4L2_STD_525_60) in em28xx_resolution_set()
338 v4l2->vbi_height = 12; in em28xx_resolution_set()
340 v4l2->vbi_height = 18; in em28xx_resolution_set()
358 return em28xx_scaler_set(dev, v4l2->hscale, v4l2->vscale); in em28xx_resolution_set()
364 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_set_alternate() local
367 unsigned int min_pkt_size = v4l2->width * 2 + 4; in em28xx_set_alternate()
384 if (v4l2->width * 2 * v4l2->height > 720 * 240 * 2) in em28xx_set_alternate()
437 buf->vb.v4l2_buf.sequence = dev->v4l2->field_count++; in finish_buffer()
438 if (dev->v4l2->progressive) in finish_buffer()
455 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_copy_video() local
458 int bytesperline = v4l2->width << 1; in em28xx_copy_video()
466 if (v4l2->progressive || buf->top_field) in em28xx_copy_video()
474 if (v4l2->progressive) in em28xx_copy_video()
498 if (v4l2->progressive) in em28xx_copy_video()
544 offset += dev->v4l2->vbi_width * dev->v4l2->vbi_height; in em28xx_copy_vbi()
620 struct em28xx_v4l2 *v4l2 = dev->v4l2; in finish_field_prepare_next() local
622 if (v4l2->progressive || v4l2->top_field) { /* Brand new frame */ in finish_field_prepare_next()
628 buf->top_field = v4l2->top_field; in finish_field_prepare_next()
642 struct em28xx_v4l2 *v4l2 = dev->v4l2; in process_frame_data_em28xx() local
662 v4l2->capture_type = 0; in process_frame_data_em28xx()
663 v4l2->vbi_read = 0; in process_frame_data_em28xx()
665 v4l2->top_field = !(data_pkt[2] & 1); in process_frame_data_em28xx()
670 v4l2->capture_type = 2; in process_frame_data_em28xx()
672 v4l2->top_field = !(data_pkt[2] & 1); in process_frame_data_em28xx()
680 if (v4l2->capture_type == 0) { in process_frame_data_em28xx()
683 v4l2->capture_type = 1; in process_frame_data_em28xx()
686 if (v4l2->capture_type == 1) { in process_frame_data_em28xx()
687 int vbi_size = v4l2->vbi_width * v4l2->vbi_height; in process_frame_data_em28xx()
688 int vbi_data_len = ((v4l2->vbi_read + data_len) > vbi_size) ? in process_frame_data_em28xx()
689 (vbi_size - v4l2->vbi_read) : data_len; in process_frame_data_em28xx()
694 v4l2->vbi_read += vbi_data_len; in process_frame_data_em28xx()
698 v4l2->capture_type = 2; in process_frame_data_em28xx()
704 if (v4l2->capture_type == 2) { in process_frame_data_em28xx()
707 v4l2->capture_type = 3; in process_frame_data_em28xx()
710 if (v4l2->capture_type == 3 && buf != NULL && data_len > 0) in process_frame_data_em28xx()
723 struct em28xx_v4l2 *v4l2 = dev->v4l2; in process_frame_data_em25xx() local
732 v4l2->top_field = !(data_pkt[1] & in process_frame_data_em25xx()
882 struct em28xx_v4l2 *v4l2 = dev->v4l2; in queue_setup() local
889 (v4l2->width * v4l2->height * v4l2->format->depth + 7) >> 3; in queue_setup()
907 struct em28xx_v4l2 *v4l2 = dev->v4l2; in buffer_prepare() local
913 size = (v4l2->width * v4l2->height * v4l2->format->depth + 7) >> 3; in buffer_prepare()
928 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_start_analog_streaming() local
940 if (v4l2->streaming_users == 0) { in em28xx_start_analog_streaming()
951 v4l2->capture_type = -1; in em28xx_start_analog_streaming()
969 f.frequency = v4l2->frequency; in em28xx_start_analog_streaming()
974 v4l2_device_call_all(&v4l2->v4l2_dev, in em28xx_start_analog_streaming()
978 v4l2->streaming_users++; in em28xx_start_analog_streaming()
986 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_stop_streaming() local
994 if (v4l2->streaming_users-- == 1) { in em28xx_stop_streaming()
1016 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_stop_vbi_streaming() local
1024 if (v4l2->streaming_users-- == 1) { in em28xx_stop_vbi_streaming()
1074 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_vb2_setup() local
1077 q = &v4l2->vb_vidq; in em28xx_vb2_setup()
1091 q = &v4l2->vb_vbiq; in em28xx_vb2_setup()
1111 struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; in video_mux()
1164 struct em28xx_v4l2 *v4l2 = in em28xx_s_ctrl() local
1166 struct em28xx *dev = v4l2->dev; in em28xx_s_ctrl()
1240 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_fmt_vid_cap() local
1242 f->fmt.pix.width = v4l2->width; in vidioc_g_fmt_vid_cap()
1243 f->fmt.pix.height = v4l2->height; in vidioc_g_fmt_vid_cap()
1244 f->fmt.pix.pixelformat = v4l2->format->fourcc; in vidioc_g_fmt_vid_cap()
1245 f->fmt.pix.bytesperline = (v4l2->width * v4l2->format->depth + 7) >> 3; in vidioc_g_fmt_vid_cap()
1246 f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * v4l2->height; in vidioc_g_fmt_vid_cap()
1250 if (v4l2->progressive) in vidioc_g_fmt_vid_cap()
1253 f->fmt.pix.field = v4l2->interlaced_fieldmode ? in vidioc_g_fmt_vid_cap()
1273 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_try_fmt_vid_cap() local
1315 if (v4l2->progressive) in vidioc_try_fmt_vid_cap()
1318 f->fmt.pix.field = v4l2->interlaced_fieldmode ? in vidioc_try_fmt_vid_cap()
1329 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_set_video_format() local
1335 v4l2->format = fmt; in em28xx_set_video_format()
1336 v4l2->width = width; in em28xx_set_video_format()
1337 v4l2->height = height; in em28xx_set_video_format()
1340 size_to_scale(dev, v4l2->width, v4l2->height, in em28xx_set_video_format()
1341 &v4l2->hscale, &v4l2->vscale); in em28xx_set_video_format()
1352 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_s_fmt_vid_cap() local
1354 if (vb2_is_busy(&v4l2->vb_vidq)) in vidioc_s_fmt_vid_cap()
1367 *norm = dev->v4l2->norm; in vidioc_g_std()
1376 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, video, querystd, norm); in vidioc_querystd()
1384 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_s_std() local
1387 if (norm == v4l2->norm) in vidioc_s_std()
1390 if (v4l2->streaming_users > 0) in vidioc_s_std()
1393 v4l2->norm = norm; in vidioc_s_std()
1401 v4l2->width = f.fmt.pix.width; in vidioc_s_std()
1402 v4l2->height = f.fmt.pix.height; in vidioc_s_std()
1403 size_to_scale(dev, v4l2->width, v4l2->height, in vidioc_s_std()
1404 &v4l2->hscale, &v4l2->vscale); in vidioc_s_std()
1407 v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_std, v4l2->norm); in vidioc_s_std()
1416 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_parm() local
1421 rc = v4l2_device_call_until_err(&v4l2->v4l2_dev, 0, in vidioc_g_parm()
1424 v4l2_video_std_frame_period(v4l2->norm, in vidioc_g_parm()
1436 return v4l2_device_call_until_err(&dev->v4l2->v4l2_dev, in vidioc_s_parm()
1473 i->std = dev->v4l2->vdev->tvnorms; in vidioc_enum_input()
1570 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, g_tuner, t); in vidioc_g_tuner()
1582 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, s_tuner, t); in vidioc_s_tuner()
1590 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_frequency() local
1595 f->frequency = v4l2->frequency; in vidioc_g_frequency()
1604 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_s_frequency() local
1609 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_frequency, f); in vidioc_s_frequency()
1610 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, g_frequency, &new_freq); in vidioc_s_frequency()
1611 v4l2->frequency = new_freq.frequency; in vidioc_s_frequency()
1628 dev->v4l2->v4l2_dev.name, sizeof(chip->name)); in vidioc_g_chip_info()
1709 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_querycap() local
1731 if (v4l2->vbi_dev) in vidioc_querycap()
1733 if (v4l2->radio_dev) in vidioc_querycap()
1798 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_fmt_vbi_cap() local
1800 format->fmt.vbi.samples_per_line = v4l2->vbi_width; in vidioc_g_fmt_vbi_cap()
1805 format->fmt.vbi.count[0] = v4l2->vbi_height; in vidioc_g_fmt_vbi_cap()
1806 format->fmt.vbi.count[1] = v4l2->vbi_height; in vidioc_g_fmt_vbi_cap()
1810 if (v4l2->norm & V4L2_STD_525_60) { in vidioc_g_fmt_vbi_cap()
1814 } else if (v4l2->norm & V4L2_STD_625_50) { in vidioc_g_fmt_vbi_cap()
1837 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, g_tuner, t); in radio_g_tuner()
1850 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, s_tuner, t); in radio_s_tuner()
1864 struct em28xx_v4l2 *v4l2 = container_of(ref, struct em28xx_v4l2, ref); in em28xx_free_v4l2() local
1866 v4l2->dev->v4l2 = NULL; in em28xx_free_v4l2()
1867 kfree(v4l2); in em28xx_free_v4l2()
1878 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_v4l2_open() local
1897 v4l2->users); in em28xx_v4l2_open()
1910 if (v4l2->users == 0) { in em28xx_v4l2_open()
1925 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_radio); in em28xx_v4l2_open()
1929 kref_get(&v4l2->ref); in em28xx_v4l2_open()
1930 v4l2->users++; in em28xx_v4l2_open()
1944 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_v4l2_fini() local
1956 if (v4l2 == NULL) in em28xx_v4l2_fini()
1963 v4l2_device_disconnect(&v4l2->v4l2_dev); in em28xx_v4l2_fini()
1967 if (v4l2->radio_dev) { in em28xx_v4l2_fini()
1969 video_device_node_name(v4l2->radio_dev)); in em28xx_v4l2_fini()
1970 video_unregister_device(v4l2->radio_dev); in em28xx_v4l2_fini()
1972 if (v4l2->vbi_dev) { in em28xx_v4l2_fini()
1974 video_device_node_name(v4l2->vbi_dev)); in em28xx_v4l2_fini()
1975 video_unregister_device(v4l2->vbi_dev); in em28xx_v4l2_fini()
1977 if (v4l2->vdev) { in em28xx_v4l2_fini()
1979 video_device_node_name(v4l2->vdev)); in em28xx_v4l2_fini()
1980 video_unregister_device(v4l2->vdev); in em28xx_v4l2_fini()
1983 v4l2_ctrl_handler_free(&v4l2->ctrl_handler); in em28xx_v4l2_fini()
1984 v4l2_device_unregister(&v4l2->v4l2_dev); in em28xx_v4l2_fini()
1986 if (v4l2->clk) { in em28xx_v4l2_fini()
1987 v4l2_clk_unregister_fixed(v4l2->clk); in em28xx_v4l2_fini()
1988 v4l2->clk = NULL; in em28xx_v4l2_fini()
1991 kref_put(&v4l2->ref, em28xx_free_v4l2); in em28xx_v4l2_fini()
2034 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_v4l2_close() local
2037 em28xx_videodbg("users=%d\n", v4l2->users); in em28xx_v4l2_close()
2042 if (v4l2->users == 1) { in em28xx_v4l2_close()
2048 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_power, 0); in em28xx_v4l2_close()
2064 v4l2->users--; in em28xx_v4l2_close()
2065 kref_put(&v4l2->ref, em28xx_free_v4l2); in em28xx_v4l2_close()
2191 vfd->v4l2_dev = &dev->v4l2->v4l2_dev; in em28xx_vdev_init()
2206 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_tuner_setup() local
2207 struct v4l2_device *v4l2_dev = &v4l2->v4l2_dev; in em28xx_tuner_setup()
2261 v4l2->frequency = f.frequency; in em28xx_tuner_setup()
2271 struct em28xx_v4l2 *v4l2; in em28xx_v4l2_init() local
2287 v4l2 = kzalloc(sizeof(struct em28xx_v4l2), GFP_KERNEL); in em28xx_v4l2_init()
2288 if (v4l2 == NULL) { in em28xx_v4l2_init()
2293 kref_init(&v4l2->ref); in em28xx_v4l2_init()
2294 v4l2->dev = dev; in em28xx_v4l2_init()
2295 dev->v4l2 = v4l2; in em28xx_v4l2_init()
2297 ret = v4l2_device_register(&dev->udev->dev, &v4l2->v4l2_dev); in em28xx_v4l2_init()
2303 hdl = &v4l2->ctrl_handler; in em28xx_v4l2_init()
2305 v4l2->v4l2_dev.ctrl_handler = hdl; in em28xx_v4l2_init()
2308 v4l2->progressive = true; in em28xx_v4l2_init()
2313 v4l2->vinmode = 0x10; in em28xx_v4l2_init()
2314 v4l2->vinctl = EM28XX_VINCTRL_INTERLACED | in em28xx_v4l2_init()
2320 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2325 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2330 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2335 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2346 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2351 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2359 sd = v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2366 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2424 v4l2->norm = V4L2_STD_PAL; in em28xx_v4l2_init()
2425 v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_std, v4l2->norm); in em28xx_v4l2_init()
2426 v4l2->interlaced_fieldmode = EM28XX_INTERLACED_DEFAULT; in em28xx_v4l2_init()
2429 v4l2->format = &format[0]; in em28xx_v4l2_init()
2489 v4l2->vdev = em28xx_vdev_init(dev, &em28xx_video_template, "video"); in em28xx_v4l2_init()
2490 if (!v4l2->vdev) { in em28xx_v4l2_init()
2495 mutex_init(&v4l2->vb_queue_lock); in em28xx_v4l2_init()
2496 mutex_init(&v4l2->vb_vbi_queue_lock); in em28xx_v4l2_init()
2497 v4l2->vdev->queue = &v4l2->vb_vidq; in em28xx_v4l2_init()
2498 v4l2->vdev->queue->lock = &v4l2->vb_queue_lock; in em28xx_v4l2_init()
2502 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_QUERYSTD); in em28xx_v4l2_init()
2503 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_G_STD); in em28xx_v4l2_init()
2504 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_S_STD); in em28xx_v4l2_init()
2506 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_S_PARM); in em28xx_v4l2_init()
2509 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_G_TUNER); in em28xx_v4l2_init()
2510 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_S_TUNER); in em28xx_v4l2_init()
2511 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_G_FREQUENCY); in em28xx_v4l2_init()
2512 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_S_FREQUENCY); in em28xx_v4l2_init()
2515 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_G_AUDIO); in em28xx_v4l2_init()
2516 v4l2_disable_ioctl(v4l2->vdev, VIDIOC_S_AUDIO); in em28xx_v4l2_init()
2520 ret = video_register_device(v4l2->vdev, VFL_TYPE_GRABBER, in em28xx_v4l2_init()
2530 v4l2->vbi_dev = em28xx_vdev_init(dev, &em28xx_video_template, in em28xx_v4l2_init()
2533 v4l2->vbi_dev->queue = &v4l2->vb_vbiq; in em28xx_v4l2_init()
2534 v4l2->vbi_dev->queue->lock = &v4l2->vb_vbi_queue_lock; in em28xx_v4l2_init()
2537 v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_S_PARM); in em28xx_v4l2_init()
2539 v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_G_TUNER); in em28xx_v4l2_init()
2540 v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_S_TUNER); in em28xx_v4l2_init()
2541 v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_G_FREQUENCY); in em28xx_v4l2_init()
2542 v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_S_FREQUENCY); in em28xx_v4l2_init()
2545 v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_G_AUDIO); in em28xx_v4l2_init()
2546 v4l2_disable_ioctl(v4l2->vbi_dev, VIDIOC_S_AUDIO); in em28xx_v4l2_init()
2550 ret = video_register_device(v4l2->vbi_dev, VFL_TYPE_VBI, in em28xx_v4l2_init()
2559 v4l2->radio_dev = em28xx_vdev_init(dev, &em28xx_radio_template, in em28xx_v4l2_init()
2561 if (!v4l2->radio_dev) { in em28xx_v4l2_init()
2566 ret = video_register_device(v4l2->radio_dev, VFL_TYPE_RADIO, in em28xx_v4l2_init()
2573 video_device_node_name(v4l2->radio_dev)); in em28xx_v4l2_init()
2577 video_device_node_name(v4l2->vdev)); in em28xx_v4l2_init()
2579 if (v4l2->vbi_dev) in em28xx_v4l2_init()
2581 video_device_node_name(v4l2->vbi_dev)); in em28xx_v4l2_init()
2584 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_power, 0); in em28xx_v4l2_init()
2597 v4l2_ctrl_handler_free(&v4l2->ctrl_handler); in em28xx_v4l2_init()
2598 v4l2_device_unregister(&v4l2->v4l2_dev); in em28xx_v4l2_init()
2600 dev->v4l2 = NULL; in em28xx_v4l2_init()
2601 kref_put(&v4l2->ref, em28xx_free_v4l2); in em28xx_v4l2_init()