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.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()
906 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
939 if (v4l2->streaming_users == 0) { in em28xx_start_analog_streaming()
950 v4l2->capture_type = -1; in em28xx_start_analog_streaming()
968 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()
1018 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_stop_vbi_streaming() local
1026 if (v4l2->streaming_users-- == 1) { in em28xx_stop_vbi_streaming()
1080 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_vb2_setup() local
1083 q = &v4l2->vb_vidq; in em28xx_vb2_setup()
1097 q = &v4l2->vb_vbiq; in em28xx_vb2_setup()
1117 struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; in video_mux()
1172 struct em28xx_v4l2 *v4l2 = in em28xx_s_ctrl() local
1174 struct em28xx *dev = v4l2->dev; in em28xx_s_ctrl()
1248 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_fmt_vid_cap() local
1250 f->fmt.pix.width = v4l2->width; in vidioc_g_fmt_vid_cap()
1251 f->fmt.pix.height = v4l2->height; in vidioc_g_fmt_vid_cap()
1252 f->fmt.pix.pixelformat = v4l2->format->fourcc; in vidioc_g_fmt_vid_cap()
1253 f->fmt.pix.bytesperline = (v4l2->width * v4l2->format->depth + 7) >> 3; in vidioc_g_fmt_vid_cap()
1254 f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * v4l2->height; in vidioc_g_fmt_vid_cap()
1258 if (v4l2->progressive) in vidioc_g_fmt_vid_cap()
1261 f->fmt.pix.field = v4l2->interlaced_fieldmode ? in vidioc_g_fmt_vid_cap()
1281 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_try_fmt_vid_cap() local
1323 if (v4l2->progressive) in vidioc_try_fmt_vid_cap()
1326 f->fmt.pix.field = v4l2->interlaced_fieldmode ? in vidioc_try_fmt_vid_cap()
1337 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_set_video_format() local
1343 v4l2->format = fmt; in em28xx_set_video_format()
1344 v4l2->width = width; in em28xx_set_video_format()
1345 v4l2->height = height; in em28xx_set_video_format()
1348 size_to_scale(dev, v4l2->width, v4l2->height, in em28xx_set_video_format()
1349 &v4l2->hscale, &v4l2->vscale); in em28xx_set_video_format()
1360 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_s_fmt_vid_cap() local
1362 if (vb2_is_busy(&v4l2->vb_vidq)) in vidioc_s_fmt_vid_cap()
1375 *norm = dev->v4l2->norm; in vidioc_g_std()
1384 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, video, querystd, norm); in vidioc_querystd()
1392 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_s_std() local
1395 if (norm == v4l2->norm) in vidioc_s_std()
1398 if (v4l2->streaming_users > 0) in vidioc_s_std()
1401 v4l2->norm = norm; in vidioc_s_std()
1409 v4l2->width = f.fmt.pix.width; in vidioc_s_std()
1410 v4l2->height = f.fmt.pix.height; in vidioc_s_std()
1411 size_to_scale(dev, v4l2->width, v4l2->height, in vidioc_s_std()
1412 &v4l2->hscale, &v4l2->vscale); in vidioc_s_std()
1415 v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_std, v4l2->norm); in vidioc_s_std()
1424 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_parm() local
1429 rc = v4l2_device_call_until_err(&v4l2->v4l2_dev, 0, in vidioc_g_parm()
1432 v4l2_video_std_frame_period(v4l2->norm, in vidioc_g_parm()
1444 return v4l2_device_call_until_err(&dev->v4l2->v4l2_dev, in vidioc_s_parm()
1481 i->std = dev->v4l2->vdev.tvnorms; in vidioc_enum_input()
1578 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, g_tuner, t); in vidioc_g_tuner()
1590 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, s_tuner, t); in vidioc_s_tuner()
1598 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_frequency() local
1603 f->frequency = v4l2->frequency; in vidioc_g_frequency()
1612 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_s_frequency() local
1617 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_frequency, f); in vidioc_s_frequency()
1618 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, g_frequency, &new_freq); in vidioc_s_frequency()
1619 v4l2->frequency = new_freq.frequency; in vidioc_s_frequency()
1636 dev->v4l2->v4l2_dev.name, sizeof(chip->name)); in vidioc_g_chip_info()
1717 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_querycap() local
1739 if (video_is_registered(&v4l2->vbi_dev)) in vidioc_querycap()
1741 if (video_is_registered(&v4l2->radio_dev)) in vidioc_querycap()
1806 struct em28xx_v4l2 *v4l2 = dev->v4l2; in vidioc_g_fmt_vbi_cap() local
1808 format->fmt.vbi.samples_per_line = v4l2->vbi_width; in vidioc_g_fmt_vbi_cap()
1813 format->fmt.vbi.count[0] = v4l2->vbi_height; in vidioc_g_fmt_vbi_cap()
1814 format->fmt.vbi.count[1] = v4l2->vbi_height; in vidioc_g_fmt_vbi_cap()
1818 if (v4l2->norm & V4L2_STD_525_60) { in vidioc_g_fmt_vbi_cap()
1822 } else if (v4l2->norm & V4L2_STD_625_50) { in vidioc_g_fmt_vbi_cap()
1845 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, g_tuner, t); in radio_g_tuner()
1858 v4l2_device_call_all(&dev->v4l2->v4l2_dev, 0, tuner, s_tuner, t); in radio_s_tuner()
1872 struct em28xx_v4l2 *v4l2 = container_of(ref, struct em28xx_v4l2, ref); in em28xx_free_v4l2() local
1874 v4l2->dev->v4l2 = NULL; in em28xx_free_v4l2()
1875 kfree(v4l2); in em28xx_free_v4l2()
1886 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_v4l2_open() local
1905 v4l2->users); in em28xx_v4l2_open()
1918 if (v4l2->users == 0) { in em28xx_v4l2_open()
1933 v4l2_device_call_all(&v4l2->v4l2_dev, 0, tuner, s_radio); in em28xx_v4l2_open()
1937 kref_get(&v4l2->ref); in em28xx_v4l2_open()
1938 v4l2->users++; in em28xx_v4l2_open()
1952 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_v4l2_fini() local
1964 if (v4l2 == NULL) in em28xx_v4l2_fini()
1971 v4l2_device_disconnect(&v4l2->v4l2_dev); in em28xx_v4l2_fini()
1975 if (video_is_registered(&v4l2->radio_dev)) { in em28xx_v4l2_fini()
1977 video_device_node_name(&v4l2->radio_dev)); in em28xx_v4l2_fini()
1978 video_unregister_device(&v4l2->radio_dev); in em28xx_v4l2_fini()
1980 if (video_is_registered(&v4l2->vbi_dev)) { in em28xx_v4l2_fini()
1982 video_device_node_name(&v4l2->vbi_dev)); in em28xx_v4l2_fini()
1983 video_unregister_device(&v4l2->vbi_dev); in em28xx_v4l2_fini()
1985 if (video_is_registered(&v4l2->vdev)) { in em28xx_v4l2_fini()
1987 video_device_node_name(&v4l2->vdev)); in em28xx_v4l2_fini()
1988 video_unregister_device(&v4l2->vdev); in em28xx_v4l2_fini()
1991 v4l2_ctrl_handler_free(&v4l2->ctrl_handler); in em28xx_v4l2_fini()
1992 v4l2_device_unregister(&v4l2->v4l2_dev); in em28xx_v4l2_fini()
1994 if (v4l2->clk) { in em28xx_v4l2_fini()
1995 v4l2_clk_unregister_fixed(v4l2->clk); in em28xx_v4l2_fini()
1996 v4l2->clk = NULL; in em28xx_v4l2_fini()
1999 kref_put(&v4l2->ref, em28xx_free_v4l2); in em28xx_v4l2_fini()
2042 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_v4l2_close() local
2045 em28xx_videodbg("users=%d\n", v4l2->users); in em28xx_v4l2_close()
2050 if (v4l2->users == 1) { in em28xx_v4l2_close()
2056 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_power, 0); in em28xx_v4l2_close()
2072 v4l2->users--; in em28xx_v4l2_close()
2073 kref_put(&v4l2->ref, em28xx_free_v4l2); in em28xx_v4l2_close()
2194 vfd->v4l2_dev = &dev->v4l2->v4l2_dev; in em28xx_vdev_init()
2207 struct em28xx_v4l2 *v4l2 = dev->v4l2; in em28xx_tuner_setup() local
2208 struct v4l2_device *v4l2_dev = &v4l2->v4l2_dev; in em28xx_tuner_setup()
2262 v4l2->frequency = f.frequency; in em28xx_tuner_setup()
2272 struct em28xx_v4l2 *v4l2; in em28xx_v4l2_init() local
2288 v4l2 = kzalloc(sizeof(struct em28xx_v4l2), GFP_KERNEL); in em28xx_v4l2_init()
2289 if (v4l2 == NULL) { in em28xx_v4l2_init()
2294 kref_init(&v4l2->ref); in em28xx_v4l2_init()
2295 v4l2->dev = dev; in em28xx_v4l2_init()
2296 dev->v4l2 = v4l2; in em28xx_v4l2_init()
2298 ret = v4l2_device_register(&dev->udev->dev, &v4l2->v4l2_dev); in em28xx_v4l2_init()
2304 hdl = &v4l2->ctrl_handler; in em28xx_v4l2_init()
2306 v4l2->v4l2_dev.ctrl_handler = hdl; in em28xx_v4l2_init()
2309 v4l2->progressive = true; in em28xx_v4l2_init()
2314 v4l2->vinmode = 0x10; in em28xx_v4l2_init()
2315 v4l2->vinctl = EM28XX_VINCTRL_INTERLACED | in em28xx_v4l2_init()
2321 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2326 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2331 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2336 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2347 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2353 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2362 sd = v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2370 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, in em28xx_v4l2_init()
2428 v4l2->norm = V4L2_STD_PAL; in em28xx_v4l2_init()
2429 v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_std, v4l2->norm); in em28xx_v4l2_init()
2430 v4l2->interlaced_fieldmode = EM28XX_INTERLACED_DEFAULT; in em28xx_v4l2_init()
2433 v4l2->format = &format[0]; in em28xx_v4l2_init()
2493 em28xx_vdev_init(dev, &v4l2->vdev, &em28xx_video_template, "video"); in em28xx_v4l2_init()
2494 mutex_init(&v4l2->vb_queue_lock); in em28xx_v4l2_init()
2495 mutex_init(&v4l2->vb_vbi_queue_lock); in em28xx_v4l2_init()
2496 v4l2->vdev.queue = &v4l2->vb_vidq; in em28xx_v4l2_init()
2497 v4l2->vdev.queue->lock = &v4l2->vb_queue_lock; in em28xx_v4l2_init()
2501 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_QUERYSTD); in em28xx_v4l2_init()
2502 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_STD); in em28xx_v4l2_init()
2503 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_STD); in em28xx_v4l2_init()
2505 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_PARM); in em28xx_v4l2_init()
2508 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_TUNER); in em28xx_v4l2_init()
2509 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_TUNER); in em28xx_v4l2_init()
2510 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_FREQUENCY); in em28xx_v4l2_init()
2511 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_FREQUENCY); in em28xx_v4l2_init()
2514 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_G_AUDIO); in em28xx_v4l2_init()
2515 v4l2_disable_ioctl(&v4l2->vdev, VIDIOC_S_AUDIO); in em28xx_v4l2_init()
2519 ret = video_register_device(&v4l2->vdev, VFL_TYPE_GRABBER, in em28xx_v4l2_init()
2529 em28xx_vdev_init(dev, &v4l2->vbi_dev, &em28xx_video_template, in em28xx_v4l2_init()
2532 v4l2->vbi_dev.queue = &v4l2->vb_vbiq; in em28xx_v4l2_init()
2533 v4l2->vbi_dev.queue->lock = &v4l2->vb_vbi_queue_lock; in em28xx_v4l2_init()
2536 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_PARM); in em28xx_v4l2_init()
2538 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_G_TUNER); in em28xx_v4l2_init()
2539 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_TUNER); in em28xx_v4l2_init()
2540 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_G_FREQUENCY); in em28xx_v4l2_init()
2541 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_FREQUENCY); in em28xx_v4l2_init()
2544 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_G_AUDIO); in em28xx_v4l2_init()
2545 v4l2_disable_ioctl(&v4l2->vbi_dev, VIDIOC_S_AUDIO); in em28xx_v4l2_init()
2549 ret = video_register_device(&v4l2->vbi_dev, VFL_TYPE_VBI, in em28xx_v4l2_init()
2558 em28xx_vdev_init(dev, &v4l2->radio_dev, &em28xx_radio_template, in em28xx_v4l2_init()
2560 ret = video_register_device(&v4l2->radio_dev, VFL_TYPE_RADIO, in em28xx_v4l2_init()
2567 video_device_node_name(&v4l2->radio_dev)); in em28xx_v4l2_init()
2571 video_device_node_name(&v4l2->vdev)); in em28xx_v4l2_init()
2573 if (video_is_registered(&v4l2->vbi_dev)) in em28xx_v4l2_init()
2575 video_device_node_name(&v4l2->vbi_dev)); in em28xx_v4l2_init()
2578 v4l2_device_call_all(&v4l2->v4l2_dev, 0, core, s_power, 0); in em28xx_v4l2_init()
2591 v4l2_ctrl_handler_free(&v4l2->ctrl_handler); in em28xx_v4l2_init()
2592 v4l2_device_unregister(&v4l2->v4l2_dev); in em28xx_v4l2_init()
2594 dev->v4l2 = NULL; in em28xx_v4l2_init()
2595 kref_put(&v4l2->ref, em28xx_free_v4l2); in em28xx_v4l2_init()