• Home
  • Raw
  • Download

Lines Matching refs:fh

684 int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit)  in check_alloc_btres_lock()  argument
688 if (fh->resources & bit) in check_alloc_btres_lock()
705 __s32 top = btv->crop[!!fh->do_crop].rect.top; in check_alloc_btres_lock()
714 __s32 end = fh->vbi_fmt.end; in check_alloc_btres_lock()
724 fh->resources |= bit; in check_alloc_btres_lock()
733 int check_btres(struct bttv_fh *fh, int bit) in check_btres() argument
735 return (fh->resources & bit); in check_btres()
774 void free_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bits) in free_btres_lock() argument
776 if ((fh->resources & bits) != bits) { in free_btres_lock()
780 fh->resources &= ~bits; in free_btres_lock()
807 unsigned char fl, fh, fi; in set_pll_freq() local
817 fh=fout/fin; in set_pll_freq()
823 btwrite(fh, BT848_PLL_F_HI); in set_pll_freq()
1530 bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, in bttv_switch_overlay() argument
1549 bttv_dma_free(&fh->cap,btv, old); in bttv_switch_overlay()
1553 free_btres_lock(btv,fh,RESOURCE_OVERLAY); in bttv_switch_overlay()
1567 struct bttv_fh *fh = q->priv_data; in bttv_prepare_buffer() local
1597 c = btv->crop[!!fh->do_crop]; in bttv_prepare_buffer()
1664 struct bttv_fh *fh = q->priv_data; in buffer_setup() local
1666 *size = fh->fmt->depth*fh->width*fh->height >> 3; in buffer_setup()
1679 struct bttv_fh *fh = q->priv_data; in buffer_prepare() local
1681 return bttv_prepare_buffer(q,fh->btv, buf, fh->fmt, in buffer_prepare()
1682 fh->width, fh->height, field); in buffer_prepare()
1689 struct bttv_fh *fh = q->priv_data; in buffer_queue() local
1690 struct bttv *btv = fh->btv; in buffer_queue()
1703 struct bttv_fh *fh = q->priv_data; in buffer_release() local
1705 bttv_dma_free(q,fh->btv,buf); in buffer_release()
1728 struct bttv_fh *fh = priv; in bttv_s_std() local
1729 struct bttv *btv = fh->btv; in bttv_s_std()
1751 struct bttv_fh *fh = priv; in bttv_g_std() local
1752 struct bttv *btv = fh->btv; in bttv_g_std()
1760 struct bttv_fh *fh = f; in bttv_querystd() local
1761 struct bttv *btv = fh->btv; in bttv_querystd()
1773 struct bttv_fh *fh = priv; in bttv_enum_input() local
1774 struct bttv *btv = fh->btv; in bttv_enum_input()
1812 struct bttv_fh *fh = priv; in bttv_g_input() local
1813 struct bttv *btv = fh->btv; in bttv_g_input()
1822 struct bttv_fh *fh = priv; in bttv_s_input() local
1823 struct bttv *btv = fh->btv; in bttv_s_input()
1835 struct bttv_fh *fh = priv; in bttv_s_tuner() local
1836 struct bttv *btv = fh->btv; in bttv_s_tuner()
1854 struct bttv_fh *fh = priv; in bttv_g_frequency() local
1855 struct bttv *btv = fh->btv; in bttv_g_frequency()
1889 struct bttv_fh *fh = priv; in bttv_s_frequency() local
1890 struct bttv *btv = fh->btv; in bttv_s_frequency()
1902 struct bttv_fh *fh = f; in bttv_log_status() local
1903 struct bttv *btv = fh->btv; in bttv_log_status()
1912 struct bttv_fh *fh = f; in bttv_g_chip_ident() local
1913 struct bttv *btv = fh->btv; in bttv_g_chip_ident()
1936 struct bttv_fh *fh = f; in bttv_g_register() local
1937 struct bttv *btv = fh->btv; in bttv_g_register()
1960 struct bttv_fh *fh = f; in bttv_s_register() local
1961 struct bttv *btv = fh->btv; in bttv_s_register()
2031 limit_scaled_size_lock (struct bttv_fh * fh, in limit_scaled_size_lock() argument
2040 struct bttv *btv = fh->btv; in limit_scaled_size_lock()
2058 c = &btv->crop[!!fh->do_crop]; in limit_scaled_size_lock()
2060 if (fh->do_crop in limit_scaled_size_lock()
2143 verify_window_lock(struct bttv_fh *fh, struct v4l2_window *win, in verify_window_lock() argument
2173 height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1; in verify_window_lock()
2180 if (NULL == fh->ovfmt) in verify_window_lock()
2184 switch (fh->ovfmt->depth) { in verify_window_lock()
2201 rc = limit_scaled_size_lock(fh, &win->w.width, &win->w.height, in verify_window_lock()
2210 static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, in setup_window_lock() argument
2216 if (NULL == fh->ovfmt) in setup_window_lock()
2218 if (!(fh->ovfmt->flags & FORMAT_FLAGS_PACKED)) in setup_window_lock()
2220 retval = verify_window_lock(fh, win, in setup_window_lock()
2247 switch (fh->ovfmt->depth) { in setup_window_lock()
2262 kfree(fh->ov.clips); in setup_window_lock()
2263 fh->ov.clips = clips; in setup_window_lock()
2264 fh->ov.nclips = n; in setup_window_lock()
2266 fh->ov.w = win->w; in setup_window_lock()
2267 fh->ov.field = win->field; in setup_window_lock()
2268 fh->ov.setup_ok = 1; in setup_window_lock()
2276 if (check_btres(fh, RESOURCE_OVERLAY)) { in setup_window_lock()
2280 new->crop = btv->crop[!!fh->do_crop].rect; in setup_window_lock()
2281 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); in setup_window_lock()
2282 retval = bttv_switch_overlay(btv,fh,new); in setup_window_lock()
2289 static struct videobuf_queue* bttv_queue(struct bttv_fh *fh) in bttv_queue() argument
2293 switch (fh->type) { in bttv_queue()
2295 q = &fh->cap; in bttv_queue()
2298 q = &fh->vbi; in bttv_queue()
2306 static int bttv_resource(struct bttv_fh *fh) in bttv_resource() argument
2310 switch (fh->type) { in bttv_resource()
2323 static int bttv_switch_type(struct bttv_fh *fh, enum v4l2_buf_type type) in bttv_switch_type() argument
2325 struct videobuf_queue *q = bttv_queue(fh); in bttv_switch_type()
2326 int res = bttv_resource(fh); in bttv_switch_type()
2328 if (check_btres(fh,res)) in bttv_switch_type()
2332 fh->type = type; in bttv_switch_type()
2357 struct bttv_fh *fh = priv; in bttv_g_fmt_vid_cap() local
2359 pix_format_set_size(&f->fmt.pix, fh->fmt, in bttv_g_fmt_vid_cap()
2360 fh->width, fh->height); in bttv_g_fmt_vid_cap()
2361 f->fmt.pix.field = fh->cap.field; in bttv_g_fmt_vid_cap()
2362 f->fmt.pix.pixelformat = fh->fmt->fourcc; in bttv_g_fmt_vid_cap()
2371 struct bttv_fh *fh = priv; in bttv_g_fmt_vid_overlay() local
2373 f->fmt.win.w = fh->ov.w; in bttv_g_fmt_vid_overlay()
2374 f->fmt.win.field = fh->ov.field; in bttv_g_fmt_vid_overlay()
2383 struct bttv_fh *fh = priv; in bttv_try_fmt_vid_cap() local
2384 struct bttv *btv = fh->btv; in bttv_try_fmt_vid_cap()
2410 height2 = btv->crop[!!fh->do_crop].rect.height >> 1; in bttv_try_fmt_vid_cap()
2420 rc = limit_scaled_size_lock(fh, &width, &height, field, in bttv_try_fmt_vid_cap()
2439 struct bttv_fh *fh = priv; in bttv_try_fmt_vid_overlay() local
2441 verify_window_lock(fh, &f->fmt.win, in bttv_try_fmt_vid_overlay()
2452 struct bttv_fh *fh = priv; in bttv_s_fmt_vid_cap() local
2453 struct bttv *btv = fh->btv; in bttv_s_fmt_vid_cap()
2457 retval = bttv_switch_type(fh, f->type); in bttv_s_fmt_vid_cap()
2469 retval = limit_scaled_size_lock(fh, &width, &height, f->fmt.pix.field, in bttv_s_fmt_vid_cap()
2482 fh->fmt = fmt; in bttv_s_fmt_vid_cap()
2483 fh->cap.field = f->fmt.pix.field; in bttv_s_fmt_vid_cap()
2484 fh->cap.last = V4L2_FIELD_NONE; in bttv_s_fmt_vid_cap()
2485 fh->width = f->fmt.pix.width; in bttv_s_fmt_vid_cap()
2486 fh->height = f->fmt.pix.height; in bttv_s_fmt_vid_cap()
2497 struct bttv_fh *fh = priv; in bttv_s_fmt_vid_overlay() local
2498 struct bttv *btv = fh->btv; in bttv_s_fmt_vid_overlay()
2505 return setup_window_lock(fh, btv, &f->fmt.win, 1); in bttv_s_fmt_vid_overlay()
2512 struct bttv_fh *fh = priv; in bttv_querycap() local
2513 struct bttv *btv = fh->btv; in bttv_querycap()
2618 struct bttv_fh *fh = f; in bttv_g_fbuf() local
2619 struct bttv *btv = fh->btv; in bttv_g_fbuf()
2624 if (fh->ovfmt) in bttv_g_fbuf()
2625 fb->fmt.pixelformat = fh->ovfmt->fourcc; in bttv_g_fbuf()
2631 struct bttv_fh *fh = f; in bttv_overlay() local
2632 struct bttv *btv = fh->btv; in bttv_overlay()
2641 if (unlikely(!fh->ov.setup_ok)) { in bttv_overlay()
2649 if (!check_alloc_btres_lock(btv, fh, RESOURCE_OVERLAY)) in bttv_overlay()
2653 fh->ov.tvnorm = btv->tvnorm; in bttv_overlay()
2655 new->crop = btv->crop[!!fh->do_crop].rect; in bttv_overlay()
2656 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); in bttv_overlay()
2662 retval = bttv_switch_overlay(btv, fh, new); in bttv_overlay()
2669 struct bttv_fh *fh = f; in bttv_s_fbuf() local
2670 struct bttv *btv = fh->btv; in bttv_s_fbuf()
2690 retval = limit_scaled_size_lock(fh, &width, &height, in bttv_s_fbuf()
2710 fh->ovfmt = fmt; in bttv_s_fbuf()
2713 fh->ov.w.left = 0; in bttv_s_fbuf()
2714 fh->ov.w.top = 0; in bttv_s_fbuf()
2715 fh->ov.w.width = fb->fmt.width; in bttv_s_fbuf()
2716 fh->ov.w.height = fb->fmt.height; in bttv_s_fbuf()
2719 kfree(fh->ov.clips); in bttv_s_fbuf()
2720 fh->ov.clips = NULL; in bttv_s_fbuf()
2721 fh->ov.nclips = 0; in bttv_s_fbuf()
2723 if (check_btres(fh, RESOURCE_OVERLAY)) { in bttv_s_fbuf()
2727 new->crop = btv->crop[!!fh->do_crop].rect; in bttv_s_fbuf()
2728 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); in bttv_s_fbuf()
2729 retval = bttv_switch_overlay(btv, fh, new); in bttv_s_fbuf()
2738 struct bttv_fh *fh = priv; in bttv_reqbufs() local
2739 return videobuf_reqbufs(bttv_queue(fh), p); in bttv_reqbufs()
2745 struct bttv_fh *fh = priv; in bttv_querybuf() local
2746 return videobuf_querybuf(bttv_queue(fh), b); in bttv_querybuf()
2751 struct bttv_fh *fh = priv; in bttv_qbuf() local
2752 struct bttv *btv = fh->btv; in bttv_qbuf()
2753 int res = bttv_resource(fh); in bttv_qbuf()
2755 if (!check_alloc_btres_lock(btv, fh, res)) in bttv_qbuf()
2758 return videobuf_qbuf(bttv_queue(fh), b); in bttv_qbuf()
2763 struct bttv_fh *fh = priv; in bttv_dqbuf() local
2764 return videobuf_dqbuf(bttv_queue(fh), b, in bttv_dqbuf()
2771 struct bttv_fh *fh = priv; in bttv_streamon() local
2772 struct bttv *btv = fh->btv; in bttv_streamon()
2773 int res = bttv_resource(fh); in bttv_streamon()
2775 if (!check_alloc_btres_lock(btv, fh, res)) in bttv_streamon()
2777 return videobuf_streamon(bttv_queue(fh)); in bttv_streamon()
2784 struct bttv_fh *fh = priv; in bttv_streamoff() local
2785 struct bttv *btv = fh->btv; in bttv_streamoff()
2787 int res = bttv_resource(fh); in bttv_streamoff()
2790 retval = videobuf_streamoff(bttv_queue(fh)); in bttv_streamoff()
2793 free_btres_lock(btv, fh, res); in bttv_streamoff()
2800 struct bttv_fh *fh = f; in bttv_g_parm() local
2801 struct bttv *btv = fh->btv; in bttv_g_parm()
2815 struct bttv_fh *fh = priv; in bttv_g_tuner() local
2816 struct bttv *btv = fh->btv; in bttv_g_tuner()
2838 struct bttv_fh *fh = priv; in bttv_cropcap() local
2839 struct bttv *btv = fh->btv; in bttv_cropcap()
2852 struct bttv_fh *fh = f; in bttv_g_crop() local
2853 struct bttv *btv = fh->btv; in bttv_g_crop()
2863 crop->c = btv->crop[!!fh->do_crop].rect; in bttv_g_crop()
2870 struct bttv_fh *fh = f; in bttv_s_crop() local
2871 struct bttv *btv = fh->btv; in bttv_s_crop()
2889 if (locked_btres(fh->btv, VIDEO_RESOURCES)) { in bttv_s_crop()
2923 fh->do_crop = 1; in bttv_s_crop()
2925 if (fh->width < c.min_scaled_width) { in bttv_s_crop()
2926 fh->width = c.min_scaled_width; in bttv_s_crop()
2928 } else if (fh->width > c.max_scaled_width) { in bttv_s_crop()
2929 fh->width = c.max_scaled_width; in bttv_s_crop()
2933 if (fh->height < c.min_scaled_height) { in bttv_s_crop()
2934 fh->height = c.min_scaled_height; in bttv_s_crop()
2936 } else if (fh->height > c.max_scaled_height) { in bttv_s_crop()
2937 fh->height = c.max_scaled_height; in bttv_s_crop()
2947 struct bttv_fh *fh = file->private_data; in bttv_read() local
2950 if (fh->btv->errors) in bttv_read()
2951 bttv_reinit_bt848(fh->btv); in bttv_read()
2953 fh->btv->c.nr, (int)count, v4l2_type_names[fh->type]); in bttv_read()
2955 switch (fh->type) { in bttv_read()
2957 if (!check_alloc_btres_lock(fh->btv, fh, RESOURCE_VIDEO_READ)) { in bttv_read()
2962 retval = videobuf_read_one(&fh->cap, data, count, ppos, in bttv_read()
2964 free_btres_lock(fh->btv, fh, RESOURCE_VIDEO_READ); in bttv_read()
2967 if (!check_alloc_btres_lock(fh->btv,fh,RESOURCE_VBI)) in bttv_read()
2969 retval = videobuf_read_stream(&fh->vbi, data, count, ppos, 1, in bttv_read()
2980 struct bttv_fh *fh = file->private_data; in bttv_poll() local
2986 if (v4l2_event_pending(&fh->fh)) in bttv_poll()
2989 poll_wait(file, &fh->fh.wait, wait); in bttv_poll()
2994 if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) { in bttv_poll()
2995 if (!check_alloc_btres_lock(fh->btv,fh,RESOURCE_VBI)) in bttv_poll()
2997 return rc | videobuf_poll_stream(file, &fh->vbi, wait); in bttv_poll()
3000 if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { in bttv_poll()
3002 if (list_empty(&fh->cap.stream)) in bttv_poll()
3004 buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream); in bttv_poll()
3007 if (NULL == fh->cap.read_buf) { in bttv_poll()
3009 if (locked_btres(fh->btv,RESOURCE_VIDEO_STREAM)) in bttv_poll()
3011 fh->cap.read_buf = videobuf_sg_alloc(fh->cap.msize); in bttv_poll()
3012 if (NULL == fh->cap.read_buf) in bttv_poll()
3014 fh->cap.read_buf->memory = V4L2_MEMORY_USERPTR; in bttv_poll()
3015 field = videobuf_next_field(&fh->cap); in bttv_poll()
3016 if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,field)) { in bttv_poll()
3017 kfree (fh->cap.read_buf); in bttv_poll()
3018 fh->cap.read_buf = NULL; in bttv_poll()
3021 fh->cap.ops->buf_queue(&fh->cap,fh->cap.read_buf); in bttv_poll()
3022 fh->cap.read_off = 0; in bttv_poll()
3024 buf = (struct bttv_buffer*)fh->cap.read_buf; in bttv_poll()
3038 struct bttv_fh *fh; in bttv_open() local
3056 fh = kmalloc(sizeof(*fh), GFP_KERNEL); in bttv_open()
3057 if (unlikely(!fh)) in bttv_open()
3060 file->private_data = fh; in bttv_open()
3062 *fh = btv->init; in bttv_open()
3063 v4l2_fh_init(&fh->fh, vdev); in bttv_open()
3065 fh->type = type; in bttv_open()
3066 fh->ov.setup_ok = 0; in bttv_open()
3068 videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, in bttv_open()
3073 fh, &btv->lock); in bttv_open()
3074 videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, in bttv_open()
3079 fh, &btv->lock); in bttv_open()
3093 fh->do_crop = !reset_crop; /* module parameter */ in bttv_open()
3098 bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); in bttv_open()
3101 v4l2_fh_add(&fh->fh); in bttv_open()
3107 struct bttv_fh *fh = file->private_data; in bttv_release() local
3108 struct bttv *btv = fh->btv; in bttv_release()
3111 if (check_btres(fh, RESOURCE_OVERLAY)) in bttv_release()
3112 bttv_switch_overlay(btv,fh,NULL); in bttv_release()
3115 if (check_btres(fh, RESOURCE_VIDEO_STREAM)) { in bttv_release()
3116 videobuf_streamoff(&fh->cap); in bttv_release()
3117 free_btres_lock(btv,fh,RESOURCE_VIDEO_STREAM); in bttv_release()
3119 if (fh->cap.read_buf) { in bttv_release()
3120 buffer_release(&fh->cap,fh->cap.read_buf); in bttv_release()
3121 kfree(fh->cap.read_buf); in bttv_release()
3123 if (check_btres(fh, RESOURCE_VIDEO_READ)) { in bttv_release()
3124 free_btres_lock(btv, fh, RESOURCE_VIDEO_READ); in bttv_release()
3128 if (check_btres(fh, RESOURCE_VBI)) { in bttv_release()
3129 videobuf_stop(&fh->vbi); in bttv_release()
3130 free_btres_lock(btv,fh,RESOURCE_VBI); in bttv_release()
3135 videobuf_mmap_free(&fh->cap); in bttv_release()
3136 videobuf_mmap_free(&fh->vbi); in bttv_release()
3145 v4l2_fh_del(&fh->fh); in bttv_release()
3146 v4l2_fh_exit(&fh->fh); in bttv_release()
3147 kfree(fh); in bttv_release()
3154 struct bttv_fh *fh = file->private_data; in bttv_mmap() local
3157 fh->btv->c.nr, v4l2_type_names[fh->type], in bttv_mmap()
3159 return videobuf_mmap_mapper(bttv_queue(fh),vma); in bttv_mmap()
3232 struct bttv_fh *fh; in radio_open() local
3239 fh = kmalloc(sizeof(*fh), GFP_KERNEL); in radio_open()
3240 if (unlikely(!fh)) in radio_open()
3242 file->private_data = fh; in radio_open()
3243 *fh = btv->init; in radio_open()
3244 v4l2_fh_init(&fh->fh, vdev); in radio_open()
3249 v4l2_fh_add(&fh->fh); in radio_open()
3256 struct bttv_fh *fh = file->private_data; in radio_release() local
3257 struct bttv *btv = fh->btv; in radio_release()
3261 v4l2_fh_del(&fh->fh); in radio_release()
3262 v4l2_fh_exit(&fh->fh); in radio_release()
3263 kfree(fh); in radio_release()
3276 struct bttv_fh *fh = priv; in radio_g_tuner() local
3277 struct bttv *btv = fh->btv; in radio_g_tuner()
3296 struct bttv_fh *fh = priv; in radio_s_tuner() local
3297 struct bttv *btv = fh->btv; in radio_s_tuner()
3310 struct bttv_fh *fh = file->private_data; in radio_read() local
3311 struct bttv *btv = fh->btv; in radio_read()
3326 struct bttv_fh *fh = file->private_data; in radio_poll() local
3327 struct bttv *btv = fh->btv; in radio_poll()
3332 if (v4l2_event_pending(&fh->fh)) in radio_poll()
3335 poll_wait(file, &fh->fh.wait, wait); in radio_poll()