Lines Matching refs:fh
496 static int res_get(struct saa7134_dev *dev, struct saa7134_fh *fh, unsigned int bit) in res_get() argument
498 if (fh->resources & bit) in res_get()
510 fh->resources |= bit; in res_get()
517 static int res_check(struct saa7134_fh *fh, unsigned int bit) in res_check() argument
519 return (fh->resources & bit); in res_check()
528 void res_free(struct saa7134_dev *dev, struct saa7134_fh *fh, unsigned int bits) in res_free() argument
530 BUG_ON((fh->resources & bits) != bits); in res_free()
533 fh->resources &= ~bits; in res_free()
870 static int start_preview(struct saa7134_dev *dev, struct saa7134_fh *fh) in start_preview() argument
875 err = verify_preview(dev,&fh->win); in start_preview()
879 dev->ovfield = fh->win.field; in start_preview()
881 fh->win.w.width,fh->win.w.height, in start_preview()
882 fh->win.w.left,fh->win.w.top, in start_preview()
886 set_size(dev,TASK_B,fh->win.w.width,fh->win.w.height, in start_preview()
888 setup_clipping(dev,fh->clips,fh->nclips, in start_preview()
898 base += dev->ovbuf.fmt.bytesperline * fh->win.w.top; in start_preview()
899 base += dev->ovfmt->depth/8 * fh->win.w.left; in start_preview()
925 static int stop_preview(struct saa7134_dev *dev, struct saa7134_fh *fh) in stop_preview() argument
1020 struct saa7134_fh *fh = q->priv_data; in buffer_prepare() local
1021 struct saa7134_dev *dev = fh->dev; in buffer_prepare()
1027 if (NULL == fh->fmt) in buffer_prepare()
1029 if (fh->width < 48 || in buffer_prepare()
1030 fh->height < 32 || in buffer_prepare()
1031 fh->width/4 > dev->crop_current.width || in buffer_prepare()
1032 fh->height/4 > dev->crop_current.height || in buffer_prepare()
1033 fh->width > dev->crop_bounds.width || in buffer_prepare()
1034 fh->height > dev->crop_bounds.height) in buffer_prepare()
1036 size = (fh->width * fh->height * fh->fmt->depth) >> 3; in buffer_prepare()
1041 vb->i,fh->width,fh->height,size,v4l2_field_names[field], in buffer_prepare()
1042 fh->fmt->name); in buffer_prepare()
1043 if (buf->vb.width != fh->width || in buffer_prepare()
1044 buf->vb.height != fh->height || in buffer_prepare()
1047 buf->fmt != fh->fmt) { in buffer_prepare()
1054 buf->vb.width = fh->width; in buffer_prepare()
1055 buf->vb.height = fh->height; in buffer_prepare()
1058 buf->fmt = fh->fmt; in buffer_prepare()
1059 buf->pt = &fh->pt_cap; in buffer_prepare()
1084 struct saa7134_fh *fh = q->priv_data; in buffer_setup() local
1086 *size = fh->fmt->depth * fh->width * fh->height >> 3; in buffer_setup()
1095 struct saa7134_fh *fh = q->priv_data; in buffer_queue() local
1098 saa7134_buffer_queue(fh->dev,&fh->dev->video_q,buf); in buffer_queue()
1117 int saa7134_g_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c) in saa7134_g_ctrl_internal() argument
1167 struct saa7134_fh *fh = priv; in saa7134_g_ctrl() local
1169 return saa7134_g_ctrl_internal(fh->dev, fh, c); in saa7134_g_ctrl()
1172 int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c) in saa7134_s_ctrl_internal() argument
1267 if (restart_overlay && fh && res_check(fh, RESOURCE_OVERLAY)) { in saa7134_s_ctrl_internal()
1269 stop_preview(dev,fh); in saa7134_s_ctrl_internal()
1270 start_preview(dev,fh); in saa7134_s_ctrl_internal()
1283 struct saa7134_fh *fh = f; in saa7134_s_ctrl() local
1285 return saa7134_s_ctrl_internal(fh->dev, fh, c); in saa7134_s_ctrl()
1290 static struct videobuf_queue* saa7134_queue(struct saa7134_fh *fh) in saa7134_queue() argument
1294 switch (fh->type) { in saa7134_queue()
1296 q = &fh->cap; in saa7134_queue()
1299 q = &fh->vbi; in saa7134_queue()
1307 static int saa7134_resource(struct saa7134_fh *fh) in saa7134_resource() argument
1309 if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) in saa7134_resource()
1312 if (fh->type == V4L2_BUF_TYPE_VBI_CAPTURE) in saa7134_resource()
1323 struct saa7134_fh *fh; in video_open() local
1343 fh = kzalloc(sizeof(*fh),GFP_KERNEL); in video_open()
1344 if (NULL == fh) in video_open()
1347 v4l2_fh_init(&fh->fh, vdev); in video_open()
1348 file->private_data = fh; in video_open()
1349 fh->dev = dev; in video_open()
1350 fh->radio = radio; in video_open()
1351 fh->type = type; in video_open()
1352 fh->fmt = format_by_fourcc(V4L2_PIX_FMT_BGR24); in video_open()
1353 fh->width = 720; in video_open()
1354 fh->height = 576; in video_open()
1356 videobuf_queue_sg_init(&fh->cap, &video_qops, in video_open()
1361 fh, NULL); in video_open()
1362 videobuf_queue_sg_init(&fh->vbi, &saa7134_vbi_qops, in video_open()
1367 fh, NULL); in video_open()
1368 saa7134_pgtable_alloc(dev->pci,&fh->pt_cap); in video_open()
1369 saa7134_pgtable_alloc(dev->pci,&fh->pt_vbi); in video_open()
1371 if (fh->radio) { in video_open()
1379 v4l2_fh_add(&fh->fh); in video_open()
1387 struct saa7134_fh *fh = file->private_data; in video_read() local
1389 switch (fh->type) { in video_read()
1391 if (res_locked(fh->dev,RESOURCE_VIDEO)) in video_read()
1393 return videobuf_read_one(saa7134_queue(fh), in video_read()
1397 if (!res_get(fh->dev,fh,RESOURCE_VBI)) in video_read()
1399 return videobuf_read_stream(saa7134_queue(fh), in video_read()
1412 struct saa7134_fh *fh = file->private_data; in video_poll() local
1416 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) in video_poll()
1417 return videobuf_poll_stream(file, &fh->vbi, wait); in video_poll()
1419 if (res_check(fh,RESOURCE_VIDEO)) { in video_poll()
1420 mutex_lock(&fh->cap.vb_lock); in video_poll()
1421 if (!list_empty(&fh->cap.stream)) in video_poll()
1422 buf = list_entry(fh->cap.stream.next, struct videobuf_buffer, stream); in video_poll()
1424 mutex_lock(&fh->cap.vb_lock); in video_poll()
1425 if (UNSET == fh->cap.read_off) { in video_poll()
1427 if (res_locked(fh->dev,RESOURCE_VIDEO)) in video_poll()
1429 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) in video_poll()
1431 fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); in video_poll()
1432 fh->cap.read_off = 0; in video_poll()
1434 buf = fh->cap.read_buf; in video_poll()
1444 mutex_unlock(&fh->cap.vb_lock); in video_poll()
1448 mutex_unlock(&fh->cap.vb_lock); in video_poll()
1454 struct saa7134_fh *fh = file->private_data; in video_release() local
1455 struct saa7134_dev *dev = fh->dev; in video_release()
1462 if (res_check(fh, RESOURCE_OVERLAY)) { in video_release()
1464 stop_preview(dev,fh); in video_release()
1466 res_free(dev,fh,RESOURCE_OVERLAY); in video_release()
1470 if (res_check(fh, RESOURCE_VIDEO)) { in video_release()
1471 videobuf_streamoff(&fh->cap); in video_release()
1472 res_free(dev,fh,RESOURCE_VIDEO); in video_release()
1474 if (fh->cap.read_buf) { in video_release()
1475 buffer_release(&fh->cap,fh->cap.read_buf); in video_release()
1476 kfree(fh->cap.read_buf); in video_release()
1480 if (res_check(fh, RESOURCE_VBI)) { in video_release()
1481 videobuf_stop(&fh->vbi); in video_release()
1482 res_free(dev,fh,RESOURCE_VBI); in video_release()
1492 if (fh->radio) in video_release()
1496 videobuf_mmap_free(&fh->cap); in video_release()
1497 videobuf_mmap_free(&fh->vbi); in video_release()
1498 saa7134_pgtable_free(dev->pci,&fh->pt_cap); in video_release()
1499 saa7134_pgtable_free(dev->pci,&fh->pt_vbi); in video_release()
1501 v4l2_fh_del(&fh->fh); in video_release()
1502 v4l2_fh_exit(&fh->fh); in video_release()
1504 kfree(fh); in video_release()
1510 struct saa7134_fh *fh = file->private_data; in video_mmap() local
1512 return videobuf_mmap_mapper(saa7134_queue(fh), vma); in video_mmap()
1518 struct saa7134_fh *fh = file->private_data; in radio_read() local
1519 struct saa7134_dev *dev = fh->dev; in radio_read()
1534 struct saa7134_fh *fh = file->private_data; in radio_poll() local
1535 struct saa7134_dev *dev = fh->dev; in radio_poll()
1551 struct saa7134_fh *fh = priv; in saa7134_try_get_set_fmt_vbi_cap() local
1552 struct saa7134_dev *dev = fh->dev; in saa7134_try_get_set_fmt_vbi_cap()
1572 struct saa7134_fh *fh = priv; in saa7134_g_fmt_vid_cap() local
1574 f->fmt.pix.width = fh->width; in saa7134_g_fmt_vid_cap()
1575 f->fmt.pix.height = fh->height; in saa7134_g_fmt_vid_cap()
1576 f->fmt.pix.field = fh->cap.field; in saa7134_g_fmt_vid_cap()
1577 f->fmt.pix.pixelformat = fh->fmt->fourcc; in saa7134_g_fmt_vid_cap()
1579 (f->fmt.pix.width * fh->fmt->depth) >> 3; in saa7134_g_fmt_vid_cap()
1588 struct saa7134_fh *fh = priv; in saa7134_g_fmt_vid_overlay() local
1594 f->fmt.win = fh->win; in saa7134_g_fmt_vid_overlay()
1602 struct saa7134_fh *fh = priv; in saa7134_try_fmt_vid_cap() local
1603 struct saa7134_dev *dev = fh->dev; in saa7134_try_fmt_vid_cap()
1653 struct saa7134_fh *fh = priv; in saa7134_try_fmt_vid_overlay() local
1654 struct saa7134_dev *dev = fh->dev; in saa7134_try_fmt_vid_overlay()
1667 struct saa7134_fh *fh = priv; in saa7134_s_fmt_vid_cap() local
1674 fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); in saa7134_s_fmt_vid_cap()
1675 fh->width = f->fmt.pix.width; in saa7134_s_fmt_vid_cap()
1676 fh->height = f->fmt.pix.height; in saa7134_s_fmt_vid_cap()
1677 fh->cap.field = f->fmt.pix.field; in saa7134_s_fmt_vid_cap()
1684 struct saa7134_fh *fh = priv; in saa7134_s_fmt_vid_overlay() local
1685 struct saa7134_dev *dev = fh->dev; in saa7134_s_fmt_vid_overlay()
1699 fh->win = f->fmt.win; in saa7134_s_fmt_vid_overlay()
1700 fh->nclips = f->fmt.win.clipcount; in saa7134_s_fmt_vid_overlay()
1702 if (fh->nclips > 8) in saa7134_s_fmt_vid_overlay()
1703 fh->nclips = 8; in saa7134_s_fmt_vid_overlay()
1705 if (copy_from_user(fh->clips, f->fmt.win.clips, in saa7134_s_fmt_vid_overlay()
1706 sizeof(struct v4l2_clip)*fh->nclips)) { in saa7134_s_fmt_vid_overlay()
1711 if (res_check(fh, RESOURCE_OVERLAY)) { in saa7134_s_fmt_vid_overlay()
1713 stop_preview(dev, fh); in saa7134_s_fmt_vid_overlay()
1714 start_preview(dev, fh); in saa7134_s_fmt_vid_overlay()
1740 struct saa7134_fh *fh = priv; in saa7134_enum_input() local
1741 struct saa7134_dev *dev = fh->dev; in saa7134_enum_input()
1771 struct saa7134_fh *fh = priv; in saa7134_g_input() local
1772 struct saa7134_dev *dev = fh->dev; in saa7134_g_input()
1780 struct saa7134_fh *fh = priv; in saa7134_s_input() local
1781 struct saa7134_dev *dev = fh->dev; in saa7134_s_input()
1796 struct saa7134_fh *fh = priv; in saa7134_querycap() local
1797 struct saa7134_dev *dev = fh->dev; in saa7134_querycap()
1844 int saa7134_s_std_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, v4l2_std_id id) in saa7134_s_std_internal() argument
1850 if (!fh && res_locked(dev, RESOURCE_OVERLAY)) { in saa7134_s_std_internal()
1890 if (fh && res_check(fh, RESOURCE_OVERLAY)) { in saa7134_s_std_internal()
1892 stop_preview(dev, fh); in saa7134_s_std_internal()
1898 start_preview(dev, fh); in saa7134_s_std_internal()
1911 struct saa7134_fh *fh = priv; in saa7134_s_std() local
1913 return saa7134_s_std_internal(fh->dev, fh, id); in saa7134_s_std()
1918 struct saa7134_fh *fh = priv; in saa7134_g_std() local
1919 struct saa7134_dev *dev = fh->dev; in saa7134_g_std()
1928 struct saa7134_fh *fh = priv; in saa7134_cropcap() local
1929 struct saa7134_dev *dev = fh->dev; in saa7134_cropcap()
1951 struct saa7134_fh *fh = f; in saa7134_g_crop() local
1952 struct saa7134_dev *dev = fh->dev; in saa7134_g_crop()
1963 struct saa7134_fh *fh = f; in saa7134_s_crop() local
1964 struct saa7134_dev *dev = fh->dev; in saa7134_s_crop()
1976 if (res_locked(fh->dev, RESOURCE_OVERLAY)) in saa7134_s_crop()
1978 if (res_locked(fh->dev, RESOURCE_VIDEO)) in saa7134_s_crop()
2001 struct saa7134_fh *fh = priv; in saa7134_g_tuner() local
2002 struct saa7134_dev *dev = fh->dev; in saa7134_g_tuner()
2033 struct saa7134_fh *fh = priv; in saa7134_s_tuner() local
2034 struct saa7134_dev *dev = fh->dev; in saa7134_s_tuner()
2054 struct saa7134_fh *fh = priv; in saa7134_g_frequency() local
2055 struct saa7134_dev *dev = fh->dev; in saa7134_g_frequency()
2060 f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; in saa7134_g_frequency()
2069 struct saa7134_fh *fh = priv; in saa7134_s_frequency() local
2070 struct saa7134_dev *dev = fh->dev; in saa7134_s_frequency()
2074 if (0 == fh->radio && V4L2_TUNER_ANALOG_TV != f->type) in saa7134_s_frequency()
2076 if (1 == fh->radio && V4L2_TUNER_RADIO != f->type) in saa7134_s_frequency()
2123 struct saa7134_fh *fh = f; in saa7134_g_fbuf() local
2124 struct saa7134_dev *dev = fh->dev; in saa7134_g_fbuf()
2135 struct saa7134_fh *fh = f; in saa7134_s_fbuf() local
2136 struct saa7134_dev *dev = fh->dev; in saa7134_s_fbuf()
2159 struct saa7134_fh *fh = f; in saa7134_overlay() local
2160 struct saa7134_dev *dev = fh->dev; in saa7134_overlay()
2169 if (!res_get(dev, fh, RESOURCE_OVERLAY)) in saa7134_overlay()
2172 start_preview(dev, fh); in saa7134_overlay()
2176 if (!res_check(fh, RESOURCE_OVERLAY)) in saa7134_overlay()
2179 stop_preview(dev, fh); in saa7134_overlay()
2181 res_free(dev, fh, RESOURCE_OVERLAY); in saa7134_overlay()
2189 struct saa7134_fh *fh = priv; in saa7134_reqbufs() local
2190 return videobuf_reqbufs(saa7134_queue(fh), p); in saa7134_reqbufs()
2196 struct saa7134_fh *fh = priv; in saa7134_querybuf() local
2197 return videobuf_querybuf(saa7134_queue(fh), b); in saa7134_querybuf()
2202 struct saa7134_fh *fh = priv; in saa7134_qbuf() local
2203 return videobuf_qbuf(saa7134_queue(fh), b); in saa7134_qbuf()
2208 struct saa7134_fh *fh = priv; in saa7134_dqbuf() local
2209 return videobuf_dqbuf(saa7134_queue(fh), b, in saa7134_dqbuf()
2216 struct saa7134_fh *fh = priv; in saa7134_streamon() local
2217 struct saa7134_dev *dev = fh->dev; in saa7134_streamon()
2218 int res = saa7134_resource(fh); in saa7134_streamon()
2220 if (!res_get(dev, fh, res)) in saa7134_streamon()
2230 pm_qos_add_request(&fh->qos_request, in saa7134_streamon()
2234 return videobuf_streamon(saa7134_queue(fh)); in saa7134_streamon()
2241 struct saa7134_fh *fh = priv; in saa7134_streamoff() local
2242 struct saa7134_dev *dev = fh->dev; in saa7134_streamoff()
2243 int res = saa7134_resource(fh); in saa7134_streamoff()
2245 pm_qos_remove_request(&fh->qos_request); in saa7134_streamoff()
2247 err = videobuf_streamoff(saa7134_queue(fh)); in saa7134_streamoff()
2250 res_free(dev, fh, res); in saa7134_streamoff()
2258 struct saa7134_fh *fh = priv; in vidioc_g_register() local
2259 struct saa7134_dev *dev = fh->dev; in vidioc_g_register()
2271 struct saa7134_fh *fh = priv; in vidioc_s_register() local
2272 struct saa7134_dev *dev = fh->dev; in vidioc_s_register()
2284 struct saa7134_fh *fh = file->private_data; in radio_g_tuner() local
2285 struct saa7134_dev *dev = fh->dev; in radio_g_tuner()
2306 struct saa7134_fh *fh = file->private_data; in radio_s_tuner() local
2307 struct saa7134_dev *dev = fh->dev; in radio_s_tuner()
2339 static int radio_s_std(struct file *file, void *fh, v4l2_std_id norm) in radio_s_std() argument