Lines Matching refs:v4l2

145 	struct em28xx_v4l2 *v4l2 = dev->v4l2;  in norm_maxw()  local
148 return v4l2->sensor_xres; in norm_maxw()
158 struct em28xx_v4l2 *v4l2 = dev->v4l2; in norm_maxh() local
161 return v4l2->sensor_yres; in norm_maxh()
166 return (v4l2->norm & V4L2_STD_625_50) ? 576 : 480; in norm_maxh()
194 struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; in em28xx_wake_i2c()
224 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_set_outfmt() local
226 fmt = v4l2->format->reg; in em28xx_set_outfmt()
242 ret = em28xx_write_reg(dev, EM28XX_R10_VINMODE, v4l2->vinmode); in em28xx_set_outfmt()
246 vinctrl = v4l2->vinctl; in em28xx_set_outfmt()
250 em28xx_write_reg(dev, EM28XX_R36_VBI_WIDTH, v4l2->vbi_width/4); in em28xx_set_outfmt()
251 em28xx_write_reg(dev, EM28XX_R37_VBI_HEIGHT, v4l2->vbi_height); in em28xx_set_outfmt()
252 if (v4l2->norm & V4L2_STD_525_60) { in em28xx_set_outfmt()
255 } else if (v4l2->norm & V4L2_STD_625_50) { in em28xx_set_outfmt()
330 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_resolution_set() local
335 v4l2->vbi_width = 720; in em28xx_resolution_set()
336 if (v4l2->norm & V4L2_STD_525_60) in em28xx_resolution_set()
337 v4l2->vbi_height = 12; in em28xx_resolution_set()
339 v4l2->vbi_height = 18; in em28xx_resolution_set()
357 return em28xx_scaler_set(dev, v4l2->hscale, v4l2->vscale); in em28xx_resolution_set()
363 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_set_alternate() local
366 unsigned int min_pkt_size = v4l2->width * 2 + 4; in em28xx_set_alternate()
383 if (v4l2->width * 2 * v4l2->height > 720 * 240 * 2) in em28xx_set_alternate()
436 buf->vb.v4l2_buf.sequence = dev->v4l2->field_count++; in finish_buffer()
437 if (dev->v4l2->progressive) in finish_buffer()
454 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_copy_video() local
457 int bytesperline = v4l2->width << 1; in em28xx_copy_video()
465 if (v4l2->progressive || buf->top_field) in em28xx_copy_video()
473 if (v4l2->progressive) in em28xx_copy_video()
497 if (v4l2->progressive) in em28xx_copy_video()
543 offset += dev->v4l2->vbi_width * dev->v4l2->vbi_height; in em28xx_copy_vbi()
619 struct em28xx_v4l2 *v4l2 = dev->v4l2; in finish_field_prepare_next() local
621 if (v4l2->progressive || v4l2->top_field) { /* Brand new frame */ in finish_field_prepare_next()
627 buf->top_field = v4l2->top_field; in finish_field_prepare_next()
641 struct em28xx_v4l2 *v4l2 = dev->v4l2; in process_frame_data_em28xx() local
661 v4l2->capture_type = 0; in process_frame_data_em28xx()
662 v4l2->vbi_read = 0; in process_frame_data_em28xx()
664 v4l2->top_field = !(data_pkt[2] & 1); in process_frame_data_em28xx()
669 v4l2->capture_type = 2; in process_frame_data_em28xx()
671 v4l2->top_field = !(data_pkt[2] & 1); in process_frame_data_em28xx()
679 if (v4l2->capture_type == 0) { in process_frame_data_em28xx()
682 v4l2->capture_type = 1; in process_frame_data_em28xx()
685 if (v4l2->capture_type == 1) { in process_frame_data_em28xx()
686 int vbi_size = v4l2->vbi_width * v4l2->vbi_height; in process_frame_data_em28xx()
687 int vbi_data_len = ((v4l2->vbi_read + data_len) > vbi_size) ? in process_frame_data_em28xx()
688 (vbi_size - v4l2->vbi_read) : data_len; in process_frame_data_em28xx()
693 v4l2->vbi_read += vbi_data_len; in process_frame_data_em28xx()
697 v4l2->capture_type = 2; in process_frame_data_em28xx()
703 if (v4l2->capture_type == 2) { in process_frame_data_em28xx()
706 v4l2->capture_type = 3; in process_frame_data_em28xx()
709 if (v4l2->capture_type == 3 && buf != NULL && data_len > 0) in process_frame_data_em28xx()
722 struct em28xx_v4l2 *v4l2 = dev->v4l2; in process_frame_data_em25xx() local
731 v4l2->top_field = !(data_pkt[1] & in process_frame_data_em25xx()
880 struct em28xx_v4l2 *v4l2 = dev->v4l2; in queue_setup() local
887 (v4l2->width * v4l2->height * v4l2->format->depth + 7) >> 3; in queue_setup()
905 struct em28xx_v4l2 *v4l2 = dev->v4l2; in buffer_prepare() local
911 size = (v4l2->width * v4l2->height * v4l2->format->depth + 7) >> 3; in buffer_prepare()
926 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_start_analog_streaming() local
938 if (v4l2->streaming_users == 0) { in em28xx_start_analog_streaming()
949 v4l2->capture_type = -1; in em28xx_start_analog_streaming()
967 f.frequency = v4l2->frequency; in em28xx_start_analog_streaming()
972 v4l2_device_call_all(&v4l2->v4l2_dev, in em28xx_start_analog_streaming()
976 v4l2->streaming_users++; in em28xx_start_analog_streaming()
984 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_stop_streaming() local
992 if (v4l2->streaming_users-- == 1) { in em28xx_stop_streaming()
1015 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_stop_vbi_streaming() local
1023 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()
1166 struct em28xx_v4l2 *v4l2 = in em28xx_s_ctrl() local
1168 struct em28xx *dev = v4l2->dev; in em28xx_s_ctrl()
1242 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_fmt_vid_cap() local
1244 f->fmt.pix.width = v4l2->width; in vidioc_g_fmt_vid_cap()
1245 f->fmt.pix.height = v4l2->height; in vidioc_g_fmt_vid_cap()
1246 f->fmt.pix.pixelformat = v4l2->format->fourcc; in vidioc_g_fmt_vid_cap()
1247 f->fmt.pix.bytesperline = (v4l2->width * v4l2->format->depth + 7) >> 3; in vidioc_g_fmt_vid_cap()
1248 f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * v4l2->height; in vidioc_g_fmt_vid_cap()
1252 if (v4l2->progressive) in vidioc_g_fmt_vid_cap()
1255 f->fmt.pix.field = v4l2->interlaced_fieldmode ? in vidioc_g_fmt_vid_cap()
1275 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_try_fmt_vid_cap() local
1317 if (v4l2->progressive) in vidioc_try_fmt_vid_cap()
1320 f->fmt.pix.field = v4l2->interlaced_fieldmode ? in vidioc_try_fmt_vid_cap()
1331 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_set_video_format() local
1337 v4l2->format = fmt; in em28xx_set_video_format()
1338 v4l2->width = width; in em28xx_set_video_format()
1339 v4l2->height = height; in em28xx_set_video_format()
1342 size_to_scale(dev, v4l2->width, v4l2->height, in em28xx_set_video_format()
1343 &v4l2->hscale, &v4l2->vscale); in em28xx_set_video_format()
1354 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_s_fmt_vid_cap() local
1356 if (vb2_is_busy(&v4l2->vb_vidq)) in vidioc_s_fmt_vid_cap()
1369 *norm = dev->v4l2->norm; in vidioc_g_std()
1378 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, video, querystd, norm); in vidioc_querystd()
1386 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_s_std() local
1389 if (norm == v4l2->norm) in vidioc_s_std()
1392 if (v4l2->streaming_users > 0) in vidioc_s_std()
1395 v4l2->norm = norm; in vidioc_s_std()
1403 v4l2->width = f.fmt.pix.width; in vidioc_s_std()
1404 v4l2->height = f.fmt.pix.height; in vidioc_s_std()
1405 size_to_scale(dev, v4l2->width, v4l2->height, in vidioc_s_std()
1406 &v4l2->hscale, &v4l2->vscale); in vidioc_s_std()
1409 v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_std, v4l2->norm); in vidioc_s_std()
1418 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_parm() local
1423 rc = v4l2_device_call_until_err(&v4l2->v4l2_dev, 0, in vidioc_g_parm()
1426 v4l2_video_std_frame_period(v4l2->norm, in vidioc_g_parm()
1438 return v4l2_device_call_until_err(&dev->v4l2->v4l2_dev, in vidioc_s_parm()
1475 i->std = dev->v4l2->vdev.tvnorms; in vidioc_enum_input()
1572 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, g_tuner, t); in vidioc_g_tuner()
1584 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, s_tuner, t); in vidioc_s_tuner()
1592 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_frequency() local
1597 f->frequency = v4l2->frequency; in vidioc_g_frequency()
1606 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_s_frequency() local
1611 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_frequency, f); in vidioc_s_frequency()
1612 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, g_frequency, &new_freq); in vidioc_s_frequency()
1613 v4l2->frequency = new_freq.frequency; in vidioc_s_frequency()
1630 dev->v4l2->v4l2_dev.name, sizeof(chip->name)); in vidioc_g_chip_info()
1711 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_querycap() local
1733 if (video_is_registered(&v4l2->vbi_dev)) in vidioc_querycap()
1735 if (video_is_registered(&v4l2->radio_dev)) in vidioc_querycap()
1800 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_fmt_vbi_cap() local
1802 format->fmt.vbi.samples_per_line = v4l2->vbi_width; in vidioc_g_fmt_vbi_cap()
1807 format->fmt.vbi.count[0] = v4l2->vbi_height; in vidioc_g_fmt_vbi_cap()
1808 format->fmt.vbi.count[1] = v4l2->vbi_height; in vidioc_g_fmt_vbi_cap()
1812 if (v4l2->norm & V4L2_STD_525_60) { in vidioc_g_fmt_vbi_cap()
1816 } else if (v4l2->norm & V4L2_STD_625_50) { in vidioc_g_fmt_vbi_cap()
1839 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, g_tuner, t); in radio_g_tuner()
1852 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, s_tuner, t); in radio_s_tuner()
1866 struct em28xx_v4l2 *v4l2 = container_of(ref, struct em28xx_v4l2, ref); in em28xx_free_v4l2() local
1868 v4l2->dev->v4l2 = NULL; in em28xx_free_v4l2()
1869 kfree(v4l2); in em28xx_free_v4l2()
1880 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_v4l2_open() local
1899 v4l2->users); in em28xx_v4l2_open()
1912 if (v4l2->users == 0) { in em28xx_v4l2_open()
1927 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_radio); in em28xx_v4l2_open()
1931 kref_get(&v4l2->ref); in em28xx_v4l2_open()
1932 v4l2->users++; in em28xx_v4l2_open()
1946 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_v4l2_fini() local
1958 if (v4l2 == NULL) in em28xx_v4l2_fini()
1965 v4l2_device_disconnect(&v4l2->v4l2_dev); in em28xx_v4l2_fini()
1969 if (video_is_registered(&v4l2->radio_dev)) { in em28xx_v4l2_fini()
1971 video_device_node_name(&v4l2->radio_dev)); in em28xx_v4l2_fini()
1972 video_unregister_device(&v4l2->radio_dev); in em28xx_v4l2_fini()
1974 if (video_is_registered(&v4l2->vbi_dev)) { in em28xx_v4l2_fini()
1976 video_device_node_name(&v4l2->vbi_dev)); in em28xx_v4l2_fini()
1977 video_unregister_device(&v4l2->vbi_dev); in em28xx_v4l2_fini()
1979 if (video_is_registered(&v4l2->vdev)) { in em28xx_v4l2_fini()
1981 video_device_node_name(&v4l2->vdev)); in em28xx_v4l2_fini()
1982 video_unregister_device(&v4l2->vdev); in em28xx_v4l2_fini()
1985 v4l2_ctrl_handler_free(&v4l2->ctrl_handler); in em28xx_v4l2_fini()
1986 v4l2_device_unregister(&v4l2->v4l2_dev); in em28xx_v4l2_fini()
1988 if (v4l2->clk) { in em28xx_v4l2_fini()
1989 v4l2_clk_unregister_fixed(v4l2->clk); in em28xx_v4l2_fini()
1990 v4l2->clk = NULL; in em28xx_v4l2_fini()
1993 kref_put(&v4l2->ref, em28xx_free_v4l2); in em28xx_v4l2_fini()
2036 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_v4l2_close() local
2039 em28xx_videodbg("users=%d\n", v4l2->users); in em28xx_v4l2_close()
2044 if (v4l2->users == 1) { in em28xx_v4l2_close()
2050 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_power, 0); in em28xx_v4l2_close()
2066 v4l2->users--; in em28xx_v4l2_close()
2067 kref_put(&v4l2->ref, em28xx_free_v4l2); in em28xx_v4l2_close()
2188 vfd->v4l2_dev = &dev->v4l2->v4l2_dev; in em28xx_vdev_init()
2201 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_tuner_setup() local
2202 struct v4l2_device *v4l2_dev = &v4l2->v4l2_dev; in em28xx_tuner_setup()
2256 v4l2->frequency = f.frequency; in em28xx_tuner_setup()
2266 struct em28xx_v4l2 *v4l2; in em28xx_v4l2_init() local
2282 v4l2 = kzalloc(sizeof(struct em28xx_v4l2), GFP_KERNEL); in em28xx_v4l2_init()
2283 if (v4l2 == NULL) { in em28xx_v4l2_init()
2288 kref_init(&v4l2->ref); in em28xx_v4l2_init()
2289 v4l2->dev = dev; in em28xx_v4l2_init()
2290 dev->v4l2 = v4l2; in em28xx_v4l2_init()
2292 ret = v4l2_device_register(&dev->udev->dev, &v4l2->v4l2_dev); in em28xx_v4l2_init()
2298 hdl = &v4l2->ctrl_handler; in em28xx_v4l2_init()
2300 v4l2->v4l2_dev.ctrl_handler = hdl; in em28xx_v4l2_init()
2303 v4l2->progressive = true; in em28xx_v4l2_init()
2308 v4l2->vinmode = 0x10; in em28xx_v4l2_init()
2309 v4l2->vinctl = EM28XX_VINCTRL_INTERLACED | in em28xx_v4l2_init()
2315 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, 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()
2341 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2347 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2356 sd = v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2364 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2422 v4l2->norm = V4L2_STD_PAL; in em28xx_v4l2_init()
2423 v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_std, v4l2->norm); in em28xx_v4l2_init()
2424 v4l2->interlaced_fieldmode = EM28XX_INTERLACED_DEFAULT; in em28xx_v4l2_init()
2427 v4l2->format = &format[0]; in em28xx_v4l2_init()
2487 em28xx_vdev_init(dev, &v4l2->vdev, &em28xx_video_template, "video"); in em28xx_v4l2_init()
2488 mutex_init(&v4l2->vb_queue_lock); in em28xx_v4l2_init()
2489 mutex_init(&v4l2->vb_vbi_queue_lock); in em28xx_v4l2_init()
2490 v4l2->vdev.queue = &v4l2->vb_vidq; in em28xx_v4l2_init()
2491 v4l2->vdev.queue->lock = &v4l2->vb_queue_lock; in em28xx_v4l2_init()
2495 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_QUERYSTD); in em28xx_v4l2_init()
2496 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_STD); in em28xx_v4l2_init()
2497 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_STD); in em28xx_v4l2_init()
2499 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_PARM); in em28xx_v4l2_init()
2502 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_TUNER); in em28xx_v4l2_init()
2503 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_TUNER); in em28xx_v4l2_init()
2504 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_FREQUENCY); in em28xx_v4l2_init()
2505 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_FREQUENCY); in em28xx_v4l2_init()
2508 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_AUDIO); in em28xx_v4l2_init()
2509 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_AUDIO); in em28xx_v4l2_init()
2513 ret = video_register_device(&v4l2->vdev, VFL_TYPE_GRABBER, in em28xx_v4l2_init()
2523 em28xx_vdev_init(dev, &v4l2->vbi_dev, &em28xx_video_template, in em28xx_v4l2_init()
2526 v4l2->vbi_dev.queue = &v4l2->vb_vbiq; in em28xx_v4l2_init()
2527 v4l2->vbi_dev.queue->lock = &v4l2->vb_vbi_queue_lock; in em28xx_v4l2_init()
2530 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_PARM); in em28xx_v4l2_init()
2532 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_G_TUNER); in em28xx_v4l2_init()
2533 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_TUNER); in em28xx_v4l2_init()
2534 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_G_FREQUENCY); in em28xx_v4l2_init()
2535 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_FREQUENCY); in em28xx_v4l2_init()
2538 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_G_AUDIO); in em28xx_v4l2_init()
2539 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_AUDIO); in em28xx_v4l2_init()
2543 ret = video_register_device(&v4l2->vbi_dev, VFL_TYPE_VBI, in em28xx_v4l2_init()
2552 em28xx_vdev_init(dev, &v4l2->radio_dev, &em28xx_radio_template, in em28xx_v4l2_init()
2554 ret = video_register_device(&v4l2->radio_dev, VFL_TYPE_RADIO, in em28xx_v4l2_init()
2561 video_device_node_name(&v4l2->radio_dev)); in em28xx_v4l2_init()
2565 video_device_node_name(&v4l2->vdev)); in em28xx_v4l2_init()
2567 if (video_is_registered(&v4l2->vbi_dev)) in em28xx_v4l2_init()
2569 video_device_node_name(&v4l2->vbi_dev)); in em28xx_v4l2_init()
2572 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_power, 0); in em28xx_v4l2_init()
2585 v4l2_ctrl_handler_free(&v4l2->ctrl_handler); in em28xx_v4l2_init()
2586 v4l2_device_unregister(&v4l2->v4l2_dev); in em28xx_v4l2_init()
2588 dev->v4l2 = NULL; in em28xx_v4l2_init()
2589 kref_put(&v4l2->ref, em28xx_free_v4l2); in em28xx_v4l2_init()