Lines Matching +full:standard +full:- +full:vt
1 // SPDX-License-Identifier: GPL-2.0-only
10 #include "pvrusb2-context.h"
11 #include "pvrusb2-hdw.h"
13 #include "pvrusb2-debug.h"
14 #include "pvrusb2-v4l2.h"
15 #include "pvrusb2-ioread.h"
18 #include <media/v4l2-dev.h>
19 #include <media/v4l2-device.h>
20 #include <media/v4l2-fh.h>
21 #include <media/v4l2-common.h>
22 #include <media/v4l2-ioctl.h>
35 enum pvr2_v4l_type minor_type; /* pvr2-understood minor device type */
54 /* streams - Note that these must be separately, individually,
56 * manage their deletion - separately, individually... */
61 static int video_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1};
64 static int radio_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1};
67 static int vbi_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1};
111 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_querycap()
112 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_querycap()
114 strscpy(cap->driver, "pvrusb2", sizeof(cap->driver)); in pvr2_querycap()
115 strscpy(cap->bus_info, pvr2_hdw_get_bus_info(hdw), in pvr2_querycap()
116 sizeof(cap->bus_info)); in pvr2_querycap()
117 strscpy(cap->card, pvr2_hdw_get_desc(hdw), sizeof(cap->card)); in pvr2_querycap()
118 cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_TUNER | in pvr2_querycap()
126 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_g_std()
127 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_g_std()
139 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_s_std()
140 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_s_std()
151 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_querystd()
152 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_querystd()
164 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_enum_input()
165 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_enum_input()
174 tmp.index = vi->index; in pvr2_enum_input()
175 if (vi->index >= fh->input_cnt) in pvr2_enum_input()
176 return -EINVAL; in pvr2_enum_input()
177 val = fh->input_map[vi->index]; in pvr2_enum_input()
189 return -EINVAL; in pvr2_enum_input()
194 tmp.name, sizeof(tmp.name) - 1, &cnt); in pvr2_enum_input()
202 sense in cases where a device might be multi-standard. in pvr2_enum_input()
204 standard, but it can change over time. For now just in pvr2_enum_input()
212 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_g_input()
213 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_g_input()
223 for (idx = 0; idx < fh->input_cnt; idx++) { in pvr2_g_input()
224 if (fh->input_map[idx] == val) { in pvr2_g_input()
234 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_s_input()
235 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_s_input()
238 if (inp >= fh->input_cnt) in pvr2_s_input()
239 return -EINVAL; in pvr2_s_input()
242 fh->input_map[inp]); in pvr2_s_input()
259 up with a more standard way to say "we have inputs but we in pvr2_enumaudio()
264 if (vin->index > 0) in pvr2_enumaudio()
265 return -EINVAL; in pvr2_enumaudio()
266 strscpy(vin->name, "PVRUSB2 Audio", sizeof(vin->name)); in pvr2_enumaudio()
267 vin->capability = V4L2_AUDCAP_STEREO; in pvr2_enumaudio()
274 vin->index = 0; in pvr2_g_audio()
275 strscpy(vin->name, "PVRUSB2 Audio", sizeof(vin->name)); in pvr2_g_audio()
276 vin->capability = V4L2_AUDCAP_STEREO; in pvr2_g_audio()
282 if (vout->index) in pvr2_s_audio()
283 return -EINVAL; in pvr2_s_audio()
287 static int pvr2_g_tuner(struct file *file, void *priv, struct v4l2_tuner *vt) in pvr2_g_tuner() argument
289 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_g_tuner()
290 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_g_tuner()
292 if (vt->index != 0) in pvr2_g_tuner()
293 return -EINVAL; /* Only answer for the 1st tuner */ in pvr2_g_tuner()
296 return pvr2_hdw_get_tuner_status(hdw, vt); in pvr2_g_tuner()
299 static int pvr2_s_tuner(struct file *file, void *priv, const struct v4l2_tuner *vt) in pvr2_s_tuner() argument
301 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_s_tuner()
302 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_s_tuner()
305 if (vt->index != 0) in pvr2_s_tuner()
306 return -EINVAL; in pvr2_s_tuner()
310 vt->audmode); in pvr2_s_tuner()
317 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_s_frequency()
318 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_s_frequency()
320 struct v4l2_tuner vt; in pvr2_s_frequency() local
325 ret = pvr2_hdw_get_tuner_status(hdw, &vt); in pvr2_s_frequency()
332 if (vf->type == V4L2_TUNER_RADIO) { in pvr2_s_frequency()
339 fv = vf->frequency; in pvr2_s_frequency()
340 if (vt.capability & V4L2_TUNER_CAP_LOW) in pvr2_s_frequency()
352 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_g_frequency()
353 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_g_frequency()
356 struct v4l2_tuner vt; in pvr2_g_frequency() local
359 ret = pvr2_hdw_get_tuner_status(hdw, &vt); in pvr2_g_frequency()
371 vf->type = V4L2_TUNER_RADIO; in pvr2_g_frequency()
373 vf->type = V4L2_TUNER_ANALOG_TV; in pvr2_g_frequency()
374 if (vt.capability & V4L2_TUNER_CAP_LOW) in pvr2_g_frequency()
378 vf->frequency = val; in pvr2_g_frequency()
385 if (fd->index) in pvr2_enum_fmt_vid_cap()
386 return -EINVAL; in pvr2_enum_fmt_vid_cap()
388 fd->pixelformat = V4L2_PIX_FMT_MPEG; in pvr2_enum_fmt_vid_cap()
394 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_g_fmt_vid_cap()
395 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_g_fmt_vid_cap()
403 vf->fmt.pix.width = val; in pvr2_g_fmt_vid_cap()
408 vf->fmt.pix.height = val; in pvr2_g_fmt_vid_cap()
414 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_try_fmt_vid_cap()
415 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_try_fmt_vid_cap()
418 int h = vf->fmt.pix.height; in pvr2_try_fmt_vid_cap()
419 int w = vf->fmt.pix.width; in pvr2_try_fmt_vid_cap()
427 if (w == -1) in pvr2_try_fmt_vid_cap()
436 if (h == -1) in pvr2_try_fmt_vid_cap()
445 vf->fmt.pix.width = w; in pvr2_try_fmt_vid_cap()
446 vf->fmt.pix.height = h; in pvr2_try_fmt_vid_cap()
452 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_s_fmt_vid_cap()
453 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_s_fmt_vid_cap()
461 pvr2_ctrl_set_value(hcp, vf->fmt.pix.width); in pvr2_s_fmt_vid_cap()
462 pvr2_ctrl_set_value(vcp, vf->fmt.pix.height); in pvr2_s_fmt_vid_cap()
469 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_streamon()
470 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_streamon()
471 struct pvr2_v4l2_dev *pdi = fh->pdi; in pvr2_streamon()
474 if (!fh->pdi->stream) { in pvr2_streamon()
478 return -EPERM; in pvr2_streamon()
480 ret = pvr2_hdw_set_stream_type(hdw, pdi->config); in pvr2_streamon()
488 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_streamoff()
489 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_streamoff()
491 if (!fh->pdi->stream) { in pvr2_streamoff()
495 return -EPERM; in pvr2_streamoff()
503 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_queryctrl()
504 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_queryctrl()
508 if (vc->id & V4L2_CTRL_FLAG_NEXT_CTRL) { in pvr2_queryctrl()
510 hdw, (vc->id & ~V4L2_CTRL_FLAG_NEXT_CTRL)); in pvr2_queryctrl()
512 vc->id = pvr2_ctrl_get_v4lid(cptr); in pvr2_queryctrl()
514 cptr = pvr2_hdw_get_ctrl_v4l(hdw, vc->id); in pvr2_queryctrl()
519 vc->id); in pvr2_queryctrl()
520 return -EINVAL; in pvr2_queryctrl()
525 vc->id, pvr2_ctrl_get_name(cptr), in pvr2_queryctrl()
527 strscpy(vc->name, pvr2_ctrl_get_desc(cptr), sizeof(vc->name)); in pvr2_queryctrl()
528 vc->flags = pvr2_ctrl_get_v4lflags(cptr); in pvr2_queryctrl()
530 vc->default_value = val; in pvr2_queryctrl()
533 vc->type = V4L2_CTRL_TYPE_MENU; in pvr2_queryctrl()
534 vc->minimum = 0; in pvr2_queryctrl()
535 vc->maximum = pvr2_ctrl_get_cnt(cptr) - 1; in pvr2_queryctrl()
536 vc->step = 1; in pvr2_queryctrl()
539 vc->type = V4L2_CTRL_TYPE_BOOLEAN; in pvr2_queryctrl()
540 vc->minimum = 0; in pvr2_queryctrl()
541 vc->maximum = 1; in pvr2_queryctrl()
542 vc->step = 1; in pvr2_queryctrl()
545 vc->type = V4L2_CTRL_TYPE_INTEGER; in pvr2_queryctrl()
546 vc->minimum = pvr2_ctrl_get_min(cptr); in pvr2_queryctrl()
547 vc->maximum = pvr2_ctrl_get_max(cptr); in pvr2_queryctrl()
548 vc->step = 1; in pvr2_queryctrl()
553 vc->id, pvr2_ctrl_get_name(cptr)); in pvr2_queryctrl()
554 return -EINVAL; in pvr2_queryctrl()
561 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_querymenu()
562 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_querymenu()
566 ret = pvr2_ctrl_get_valname(pvr2_hdw_get_ctrl_v4l(hdw, vm->id), in pvr2_querymenu()
567 vm->index, in pvr2_querymenu()
568 vm->name, sizeof(vm->name) - 1, in pvr2_querymenu()
570 vm->name[cnt] = 0; in pvr2_querymenu()
576 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_g_ctrl()
577 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_g_ctrl()
581 ret = pvr2_ctrl_get_value(pvr2_hdw_get_ctrl_v4l(hdw, vc->id), in pvr2_g_ctrl()
583 vc->value = val; in pvr2_g_ctrl()
589 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_s_ctrl()
590 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_s_ctrl()
593 ret = pvr2_ctrl_set_value(pvr2_hdw_get_ctrl_v4l(hdw, vc->id), in pvr2_s_ctrl()
594 vc->value); in pvr2_s_ctrl()
602 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_g_ext_ctrls()
603 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_g_ext_ctrls()
611 for (idx = 0; idx < ctls->count; idx++) { in pvr2_g_ext_ctrls()
612 ctrl = ctls->controls + idx; in pvr2_g_ext_ctrls()
613 cptr = pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id); in pvr2_g_ext_ctrls()
615 if (ctls->which == V4L2_CTRL_WHICH_DEF_VAL) in pvr2_g_ext_ctrls()
620 ret = -EINVAL; in pvr2_g_ext_ctrls()
623 ctls->error_idx = idx; in pvr2_g_ext_ctrls()
628 ctrl->value64 = 0; in pvr2_g_ext_ctrls()
629 ctrl->value = val; in pvr2_g_ext_ctrls()
637 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_s_ext_ctrls()
638 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_s_ext_ctrls()
644 if (ctls->which == V4L2_CTRL_WHICH_DEF_VAL) in pvr2_s_ext_ctrls()
645 return -EINVAL; in pvr2_s_ext_ctrls()
648 for (idx = 0; idx < ctls->count; idx++) { in pvr2_s_ext_ctrls()
649 ctrl = ctls->controls + idx; in pvr2_s_ext_ctrls()
651 pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id), in pvr2_s_ext_ctrls()
652 ctrl->value); in pvr2_s_ext_ctrls()
654 ctls->error_idx = idx; in pvr2_s_ext_ctrls()
666 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_try_ext_ctrls()
667 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_try_ext_ctrls()
674 for (idx = 0; idx < ctls->count; idx++) { in pvr2_try_ext_ctrls()
675 ctrl = ctls->controls + idx; in pvr2_try_ext_ctrls()
676 pctl = pvr2_hdw_get_ctrl_v4l(hdw, ctrl->id); in pvr2_try_ext_ctrls()
678 ctls->error_idx = idx; in pvr2_try_ext_ctrls()
679 return -EINVAL; in pvr2_try_ext_ctrls()
688 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_g_pixelaspect()
689 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_g_pixelaspect()
694 return -EINVAL; in pvr2_g_pixelaspect()
704 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_g_selection()
705 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_g_selection()
710 if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) in pvr2_g_selection()
711 return -EINVAL; in pvr2_g_selection()
715 switch (sel->target) { in pvr2_g_selection()
720 return -EINVAL; in pvr2_g_selection()
721 sel->r.left = val; in pvr2_g_selection()
725 return -EINVAL; in pvr2_g_selection()
726 sel->r.top = val; in pvr2_g_selection()
730 return -EINVAL; in pvr2_g_selection()
731 sel->r.width = val; in pvr2_g_selection()
735 return -EINVAL; in pvr2_g_selection()
736 sel->r.height = val; in pvr2_g_selection()
740 sel->r = cap.defrect; in pvr2_g_selection()
744 sel->r = cap.bounds; in pvr2_g_selection()
747 return -EINVAL; in pvr2_g_selection()
755 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_s_selection()
756 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_s_selection()
759 if (sel->type != V4L2_BUF_TYPE_VIDEO_CAPTURE || in pvr2_s_selection()
760 sel->target != V4L2_SEL_TGT_CROP) in pvr2_s_selection()
761 return -EINVAL; in pvr2_s_selection()
764 sel->r.left); in pvr2_s_selection()
769 sel->r.top); in pvr2_s_selection()
774 sel->r.width); in pvr2_s_selection()
779 sel->r.height); in pvr2_s_selection()
787 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_log_status()
788 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_log_status()
830 struct pvr2_hdw *hdw = dip->v4lp->channel.mc_head->hdw; in pvr2_v4l2_dev_destroy()
831 enum pvr2_config cfg = dip->config; in pvr2_v4l2_dev_destroy()
838 mcnt = scnprintf(msg, sizeof(msg) - 1, in pvr2_v4l2_dev_destroy()
840 video_device_node_name(&dip->devbase), in pvr2_v4l2_dev_destroy()
844 pvr2_hdw_v4l_store_minor_number(hdw,dip->minor_type,-1); in pvr2_v4l2_dev_destroy()
847 dip->v4lp = NULL; in pvr2_v4l2_dev_destroy()
848 dip->stream = NULL; in pvr2_v4l2_dev_destroy()
852 video_unregister_device(&dip->devbase); in pvr2_v4l2_dev_destroy()
862 if (!dip->devbase.v4l2_dev->dev) return; in pvr2_v4l2_dev_disassociate_parent()
863 dip->devbase.v4l2_dev->dev = NULL; in pvr2_v4l2_dev_disassociate_parent()
864 device_move(&dip->devbase.dev, NULL, DPM_ORDER_NONE); in pvr2_v4l2_dev_disassociate_parent()
870 if (vp->dev_video) { in pvr2_v4l2_destroy_no_lock()
871 pvr2_v4l2_dev_destroy(vp->dev_video); in pvr2_v4l2_destroy_no_lock()
872 vp->dev_video = NULL; in pvr2_v4l2_destroy_no_lock()
874 if (vp->dev_radio) { in pvr2_v4l2_destroy_no_lock()
875 pvr2_v4l2_dev_destroy(vp->dev_radio); in pvr2_v4l2_destroy_no_lock()
876 vp->dev_radio = NULL; in pvr2_v4l2_destroy_no_lock()
880 pvr2_channel_done(&vp->channel); in pvr2_v4l2_destroy_no_lock()
897 if (!vp->channel.mc_head->disconnect_flag) return; in pvr2_v4l2_internal_check()
898 pvr2_v4l2_dev_disassociate_parent(vp->dev_video); in pvr2_v4l2_internal_check()
899 pvr2_v4l2_dev_disassociate_parent(vp->dev_radio); in pvr2_v4l2_internal_check()
900 if (!list_empty(&vp->dev_video->devbase.fh_list) || in pvr2_v4l2_internal_check()
901 (vp->dev_radio && in pvr2_v4l2_internal_check()
902 !list_empty(&vp->dev_radio->devbase.fh_list))) { in pvr2_v4l2_internal_check()
904 "pvr2_v4l2 internal_check exit-empty id=%p", vp); in pvr2_v4l2_internal_check()
913 struct pvr2_v4l2_fh *fhp = file->private_data; in pvr2_v4l2_release()
914 struct pvr2_v4l2 *vp = fhp->pdi->v4lp; in pvr2_v4l2_release()
915 struct pvr2_hdw *hdw = fhp->channel.mc_head->hdw; in pvr2_v4l2_release()
919 if (fhp->rhp) { in pvr2_v4l2_release()
922 sp = pvr2_ioread_get_stream(fhp->rhp); in pvr2_v4l2_release()
924 pvr2_ioread_destroy(fhp->rhp); in pvr2_v4l2_release()
925 fhp->rhp = NULL; in pvr2_v4l2_release()
928 v4l2_fh_del(&fhp->fh); in pvr2_v4l2_release()
929 v4l2_fh_exit(&fhp->fh); in pvr2_v4l2_release()
930 file->private_data = NULL; in pvr2_v4l2_release()
932 pvr2_channel_done(&fhp->channel); in pvr2_v4l2_release()
935 if (fhp->input_map) { in pvr2_v4l2_release()
936 kfree(fhp->input_map); in pvr2_v4l2_release()
937 fhp->input_map = NULL; in pvr2_v4l2_release()
940 if (vp->channel.mc_head->disconnect_flag && in pvr2_v4l2_release()
941 list_empty(&vp->dev_video->devbase.fh_list) && in pvr2_v4l2_release()
942 (!vp->dev_radio || in pvr2_v4l2_release()
943 list_empty(&vp->dev_radio->devbase.fh_list))) { in pvr2_v4l2_release()
962 vp = dip->v4lp; in pvr2_v4l2_open()
963 hdw = vp->channel.hdw; in pvr2_v4l2_open()
970 return -EIO; in pvr2_v4l2_open()
975 return -ENOMEM; in pvr2_v4l2_open()
978 v4l2_fh_init(&fhp->fh, &dip->devbase); in pvr2_v4l2_open()
979 init_waitqueue_head(&fhp->wait_data); in pvr2_v4l2_open()
980 fhp->pdi = dip; in pvr2_v4l2_open()
983 pvr2_channel_init(&fhp->channel,vp->channel.mc_head); in pvr2_v4l2_open()
985 if (dip->v4l_type == VFL_TYPE_RADIO) { in pvr2_v4l2_open()
997 ret = pvr2_channel_limit_inputs(&fhp->channel,input_mask); in pvr2_v4l2_open()
999 pvr2_channel_done(&fhp->channel); in pvr2_v4l2_open()
1003 v4l2_fh_exit(&fhp->fh); in pvr2_v4l2_open()
1013 fhp->input_cnt = input_cnt; in pvr2_v4l2_open()
1014 fhp->input_map = kzalloc(input_cnt,GFP_KERNEL); in pvr2_v4l2_open()
1015 if (!fhp->input_map) { in pvr2_v4l2_open()
1016 pvr2_channel_done(&fhp->channel); in pvr2_v4l2_open()
1020 v4l2_fh_exit(&fhp->fh); in pvr2_v4l2_open()
1022 return -ENOMEM; in pvr2_v4l2_open()
1027 fhp->input_map[input_cnt++] = idx; in pvr2_v4l2_open()
1030 fhp->file = file; in pvr2_v4l2_open()
1031 file->private_data = fhp; in pvr2_v4l2_open()
1033 fhp->fw_mode_flag = pvr2_hdw_cpufw_get_enabled(hdw); in pvr2_v4l2_open()
1034 v4l2_fh_add(&fhp->fh); in pvr2_v4l2_open()
1042 wake_up(&fhp->wait_data); in pvr2_v4l2_notify()
1050 if (fh->rhp) return 0; in pvr2_v4l2_iosetup()
1052 if (!fh->pdi->stream) { in pvr2_v4l2_iosetup()
1055 return -EPERM; in pvr2_v4l2_iosetup()
1060 if ((ret = pvr2_channel_claim_stream(&fh->channel, in pvr2_v4l2_iosetup()
1061 fh->pdi->stream)) != 0) { in pvr2_v4l2_iosetup()
1066 fh->rhp = pvr2_channel_create_mpeg_stream(fh->pdi->stream); in pvr2_v4l2_iosetup()
1067 if (!fh->rhp) { in pvr2_v4l2_iosetup()
1068 pvr2_channel_claim_stream(&fh->channel,NULL); in pvr2_v4l2_iosetup()
1069 return -ENOMEM; in pvr2_v4l2_iosetup()
1072 hdw = fh->channel.mc_head->hdw; in pvr2_v4l2_iosetup()
1073 sp = fh->pdi->stream->stream; in pvr2_v4l2_iosetup()
1075 pvr2_hdw_set_stream_type(hdw,fh->pdi->config); in pvr2_v4l2_iosetup()
1077 return pvr2_ioread_set_enabled(fh->rhp,!0); in pvr2_v4l2_iosetup()
1084 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_v4l2_read()
1087 if (fh->fw_mode_flag) { in pvr2_v4l2_read()
1088 struct pvr2_hdw *hdw = fh->channel.mc_head->hdw; in pvr2_v4l2_read()
1095 if (!tbuf) return -ENOMEM; in pvr2_v4l2_read()
1107 tcnt = -EFAULT; in pvr2_v4l2_read()
1113 count -= c2; in pvr2_v4l2_read()
1120 if (!fh->rhp) { in pvr2_v4l2_read()
1128 ret = pvr2_ioread_read(fh->rhp,buff,count); in pvr2_v4l2_read()
1130 if (ret != -EAGAIN) break; in pvr2_v4l2_read()
1131 if (file->f_flags & O_NONBLOCK) break; in pvr2_v4l2_read()
1134 fh->wait_data, in pvr2_v4l2_read()
1135 pvr2_ioread_avail(fh->rhp) >= 0); in pvr2_v4l2_read()
1146 struct pvr2_v4l2_fh *fh = file->private_data; in pvr2_v4l2_poll()
1149 if (fh->fw_mode_flag) { in pvr2_v4l2_poll()
1154 if (!fh->rhp) { in pvr2_v4l2_poll()
1159 poll_wait(file,&fh->wait_data,wait); in pvr2_v4l2_poll()
1161 if (pvr2_ioread_avail(fh->rhp) >= 0) { in pvr2_v4l2_poll()
1194 dip->v4lp = vp; in pvr2_v4l2_dev_init()
1196 hdw = vp->channel.mc_head->hdw; in pvr2_v4l2_dev_init()
1197 dip->v4l_type = v4l_type; in pvr2_v4l2_dev_init()
1200 dip->stream = &vp->channel.mc_head->video_stream; in pvr2_v4l2_dev_init()
1201 dip->config = pvr2_config_mpeg; in pvr2_v4l2_dev_init()
1202 dip->minor_type = pvr2_v4l_type_video; in pvr2_v4l2_dev_init()
1205 if (!dip->stream) { in pvr2_v4l2_dev_init()
1212 dip->config = pvr2_config_vbi; in pvr2_v4l2_dev_init()
1213 dip->minor_type = pvr2_v4l_type_vbi; in pvr2_v4l2_dev_init()
1218 dip->stream = &vp->channel.mc_head->video_stream; in pvr2_v4l2_dev_init()
1219 dip->config = pvr2_config_mpeg; in pvr2_v4l2_dev_init()
1220 dip->minor_type = pvr2_v4l_type_radio; in pvr2_v4l2_dev_init()
1230 dip->devbase = vdev_template; in pvr2_v4l2_dev_init()
1231 dip->devbase.release = pvr2_video_device_release; in pvr2_v4l2_dev_init()
1232 dip->devbase.ioctl_ops = &pvr2_ioctl_ops; in pvr2_v4l2_dev_init()
1233 dip->devbase.device_caps = caps; in pvr2_v4l2_dev_init()
1239 dip->devbase.tvnorms = (v4l2_std_id)val; in pvr2_v4l2_dev_init()
1242 mindevnum = -1; in pvr2_v4l2_dev_init()
1247 pvr2_hdw_set_v4l2_dev(hdw, &dip->devbase); in pvr2_v4l2_dev_init()
1248 if ((video_register_device(&dip->devbase, in pvr2_v4l2_dev_init()
1249 dip->v4l_type, mindevnum) < 0) && in pvr2_v4l2_dev_init()
1250 (video_register_device(&dip->devbase, in pvr2_v4l2_dev_init()
1251 dip->v4l_type, -1) < 0)) { in pvr2_v4l2_dev_init()
1257 video_device_node_name(&dip->devbase), in pvr2_v4l2_dev_init()
1258 pvr2_config_get_name(dip->config)); in pvr2_v4l2_dev_init()
1261 dip->minor_type,dip->devbase.minor); in pvr2_v4l2_dev_init()
1271 pvr2_channel_init(&vp->channel,mnp); in pvr2_v4l2_create()
1274 vp->channel.check_func = pvr2_v4l2_internal_check; in pvr2_v4l2_create()
1277 vp->dev_video = kzalloc(sizeof(*vp->dev_video),GFP_KERNEL); in pvr2_v4l2_create()
1278 if (!vp->dev_video) goto fail; in pvr2_v4l2_create()
1279 pvr2_v4l2_dev_init(vp->dev_video,vp,VFL_TYPE_VIDEO); in pvr2_v4l2_create()
1280 if (pvr2_hdw_get_input_available(vp->channel.mc_head->hdw) & in pvr2_v4l2_create()
1282 vp->dev_radio = kzalloc(sizeof(*vp->dev_radio),GFP_KERNEL); in pvr2_v4l2_create()
1283 if (!vp->dev_radio) goto fail; in pvr2_v4l2_create()
1284 pvr2_v4l2_dev_init(vp->dev_radio,vp,VFL_TYPE_RADIO); in pvr2_v4l2_create()