Lines Matching refs:channel
261 struct s2255_channel channel[MAX_CHANNELS]; member
305 struct s2255_channel *channel; member
359 static int s2255_start_acquire(struct s2255_channel *channel);
360 static int s2255_stop_acquire(struct s2255_channel *channel);
447 static int norm_maxw(struct s2255_channel *channel) in norm_maxw() argument
449 return (channel->std & V4L2_STD_525_60) ? in norm_maxw()
453 static int norm_maxh(struct s2255_channel *channel) in norm_maxh() argument
455 return (channel->std & V4L2_STD_525_60) ? in norm_maxh()
459 static int norm_minw(struct s2255_channel *channel) in norm_minw() argument
461 return (channel->std & V4L2_STD_525_60) ? in norm_minw()
465 static int norm_minh(struct s2255_channel *channel) in norm_minh() argument
467 return (channel->std & V4L2_STD_525_60) ? in norm_minh()
587 static int s2255_got_frame(struct s2255_channel *channel, int jpgsize) in s2255_got_frame() argument
589 struct s2255_dmaqueue *dma_q = &channel->vidq; in s2255_got_frame()
591 struct s2255_dev *dev = to_s2255_dev(channel->vdev.v4l2_dev); in s2255_got_frame()
604 s2255_fillbuff(channel, buf, jpgsize); in s2255_got_frame()
635 static void s2255_fillbuff(struct s2255_channel *channel, in s2255_fillbuff() argument
645 last_frame = channel->last_frame; in s2255_fillbuff()
648 (const char *)channel->buffer.frame[last_frame].lpvbits; in s2255_fillbuff()
672 channel->last_frame = -1; in s2255_fillbuff()
682 buf->vb.field_count = channel->frame_count * 2; in s2255_fillbuff()
696 struct s2255_channel *channel = fh->channel; in buffer_setup() local
697 *size = channel->width * channel->height * (channel->fmt->depth >> 3); in buffer_setup()
720 struct s2255_channel *channel = fh->channel; in buffer_prepare() local
723 int w = channel->width; in buffer_prepare()
724 int h = channel->height; in buffer_prepare()
726 if (channel->fmt == NULL) in buffer_prepare()
729 if ((w < norm_minw(channel)) || in buffer_prepare()
730 (w > norm_maxw(channel)) || in buffer_prepare()
731 (h < norm_minh(channel)) || in buffer_prepare()
732 (h > norm_maxh(channel))) { in buffer_prepare()
736 buf->vb.size = w * h * (channel->fmt->depth >> 3); in buffer_prepare()
742 buf->fmt = channel->fmt; in buffer_prepare()
764 struct s2255_channel *channel = fh->channel; in buffer_queue() local
765 struct s2255_dmaqueue *vidq = &channel->vidq; in buffer_queue()
776 dprintk(4, "%s %d\n", __func__, fh->channel->idx); in buffer_release()
790 struct s2255_channel *channel = fh->channel; in res_get() local
792 if (channel->resources) in res_get()
795 channel->resources = 1; in res_get()
803 return fh->channel->resources; in res_locked()
814 struct s2255_channel *channel = fh->channel; in res_free() local
815 channel->resources = 0; in res_free()
854 struct s2255_channel *channel = fh->channel; in vidioc_g_fmt_vid_cap() local
855 int is_ntsc = channel->std & V4L2_STD_525_60; in vidioc_g_fmt_vid_cap()
857 f->fmt.pix.width = channel->width; in vidioc_g_fmt_vid_cap()
858 f->fmt.pix.height = channel->height; in vidioc_g_fmt_vid_cap()
864 f->fmt.pix.pixelformat = channel->fmt->fourcc; in vidioc_g_fmt_vid_cap()
865 f->fmt.pix.bytesperline = f->fmt.pix.width * (channel->fmt->depth >> 3); in vidioc_g_fmt_vid_cap()
878 struct s2255_channel *channel = fh->channel; in vidioc_try_fmt_vid_cap() local
879 int is_ntsc = channel->std & V4L2_STD_525_60; in vidioc_try_fmt_vid_cap()
939 struct s2255_channel *channel = fh->channel; in vidioc_s_fmt_vid_cap() local
968 mode = channel->mode; in vidioc_s_fmt_vid_cap()
969 channel->fmt = fmt; in vidioc_s_fmt_vid_cap()
970 channel->width = f->fmt.pix.width; in vidioc_s_fmt_vid_cap()
971 channel->height = f->fmt.pix.height; in vidioc_s_fmt_vid_cap()
974 if (channel->width > norm_minw(channel)) { in vidioc_s_fmt_vid_cap()
975 if (channel->height > norm_minh(channel)) { in vidioc_s_fmt_vid_cap()
976 if (channel->cap_parm.capturemode & in vidioc_s_fmt_vid_cap()
988 switch (channel->fmt->fourcc) { in vidioc_s_fmt_vid_cap()
997 mode.color |= (channel->jpegqual << 8); in vidioc_s_fmt_vid_cap()
1010 if ((mode.color & MASK_COLOR) != (channel->mode.color & MASK_COLOR)) in vidioc_s_fmt_vid_cap()
1012 else if (mode.scale != channel->mode.scale) in vidioc_s_fmt_vid_cap()
1014 else if (mode.format != channel->mode.format) in vidioc_s_fmt_vid_cap()
1016 channel->mode = mode; in vidioc_s_fmt_vid_cap()
1017 (void) s2255_set_mode(channel, &mode); in vidioc_s_fmt_vid_cap()
1153 static int s2255_set_mode(struct s2255_channel *channel, in s2255_set_mode() argument
1159 struct s2255_dev *dev = to_s2255_dev(channel->vdev.v4l2_dev); in s2255_set_mode()
1162 chn_rev = G_chnmap[channel->idx]; in s2255_set_mode()
1163 dprintk(3, "%s channel: %d\n", __func__, channel->idx); in s2255_set_mode()
1169 mode->color |= (channel->jpegqual << 8); in s2255_set_mode()
1172 channel->mode = *mode; in s2255_set_mode()
1173 channel->req_image_size = get_transfer_size(mode); in s2255_set_mode()
1174 dprintk(1, "%s: reqsize %ld\n", __func__, channel->req_image_size); in s2255_set_mode()
1185 buffer[3 + i] = cpu_to_le32(((u32 *)&channel->mode)[i]); in s2255_set_mode()
1186 channel->setmode_ready = 0; in s2255_set_mode()
1193 wait_event_timeout(channel->wait_setmode, in s2255_set_mode()
1194 (channel->setmode_ready != 0), in s2255_set_mode()
1196 if (channel->setmode_ready != 1) { in s2255_set_mode()
1202 channel->mode.restart = 0; in s2255_set_mode()
1203 dprintk(1, "%s chn %d, result: %d\n", __func__, channel->idx, res); in s2255_set_mode()
1207 static int s2255_cmd_status(struct s2255_channel *channel, u32 *pstatus) in s2255_cmd_status() argument
1212 struct s2255_dev *dev = to_s2255_dev(channel->vdev.v4l2_dev); in s2255_cmd_status()
1213 chn_rev = G_chnmap[channel->idx]; in s2255_cmd_status()
1214 dprintk(4, "%s chan %d\n", __func__, channel->idx); in s2255_cmd_status()
1225 channel->vidstatus_ready = 0; in s2255_cmd_status()
1228 wait_event_timeout(channel->wait_vidstatus, in s2255_cmd_status()
1229 (channel->vidstatus_ready != 0), in s2255_cmd_status()
1231 if (channel->vidstatus_ready != 1) { in s2255_cmd_status()
1235 *pstatus = channel->vidstatus; in s2255_cmd_status()
1245 struct s2255_channel *channel = fh->channel; in vidioc_streamon() local
1261 channel->last_frame = -1; in vidioc_streamon()
1262 channel->bad_payload = 0; in vidioc_streamon()
1263 channel->cur_frame = 0; in vidioc_streamon()
1264 channel->frame_count = 0; in vidioc_streamon()
1266 channel->buffer.frame[j].ulState = S2255_READ_IDLE; in vidioc_streamon()
1267 channel->buffer.frame[j].cur_size = 0; in vidioc_streamon()
1271 s2255_start_acquire(channel); in vidioc_streamon()
1272 channel->b_acquire = 1; in vidioc_streamon()
1282 dprintk(4, "%s\n, channel: %d", __func__, fh->channel->idx); in vidioc_streamoff()
1291 s2255_stop_acquire(fh->channel); in vidioc_streamoff()
1302 struct s2255_channel *channel = fh->channel; in vidioc_s_std() local
1316 mode = fh->channel->mode; in vidioc_s_std()
1324 channel->width = LINE_SZ_4CIFS_NTSC; in vidioc_s_std()
1325 channel->height = NUM_LINES_4CIFS_NTSC * 2; in vidioc_s_std()
1333 channel->width = LINE_SZ_4CIFS_PAL; in vidioc_s_std()
1334 channel->height = NUM_LINES_4CIFS_PAL * 2; in vidioc_s_std()
1340 fh->channel->std = i; in vidioc_s_std()
1342 s2255_set_mode(fh->channel, &mode); in vidioc_s_std()
1352 *i = fh->channel->std; in vidioc_g_std()
1368 struct s2255_channel *channel = fh->channel; in vidioc_enum_input() local
1377 rc = s2255_cmd_status(fh->channel, &status); in vidioc_enum_input()
1389 strlcpy(inp->name, (channel->idx < 2) ? "Composite" : "S-Video", in vidioc_enum_input()
1410 struct s2255_channel *channel = in s2255_s_ctrl() local
1414 mode = channel->mode; in s2255_s_ctrl()
1436 channel->jpegqual = ctrl->val; in s2255_s_ctrl()
1446 s2255_set_mode(channel, &mode); in s2255_s_ctrl()
1454 struct s2255_channel *channel = fh->channel; in vidioc_g_jpegcomp() local
1457 jc->quality = channel->jpegqual; in vidioc_g_jpegcomp()
1466 struct s2255_channel *channel = fh->channel; in vidioc_s_jpegcomp() local
1469 v4l2_ctrl_s_ctrl(channel->jpegqual_ctrl, jc->quality); in vidioc_s_jpegcomp()
1479 struct s2255_channel *channel = fh->channel; in vidioc_g_parm() local
1483 sp->parm.capture.capturemode = channel->cap_parm.capturemode; in vidioc_g_parm()
1484 def_num = (channel->mode.format == FORMAT_NTSC) ? 1001 : 1000; in vidioc_g_parm()
1485 def_dem = (channel->mode.format == FORMAT_NTSC) ? 30000 : 25000; in vidioc_g_parm()
1487 switch (channel->mode.fdec) { in vidioc_g_parm()
1513 struct s2255_channel *channel = fh->channel; in vidioc_s_parm() local
1519 mode = channel->mode; in vidioc_s_parm()
1521 if (channel->cap_parm.capturemode in vidioc_s_parm()
1542 s2255_set_mode(channel, &mode); in vidioc_s_parm()
1567 struct s2255_channel *channel = fh->channel; in vidioc_enum_framesizes() local
1568 int is_ntsc = channel->std & V4L2_STD_525_60; in vidioc_enum_framesizes()
1586 struct s2255_channel *channel = fh->channel; in vidioc_enum_frameintervals() local
1589 int is_ntsc = channel->std & V4L2_STD_525_60; in vidioc_enum_frameintervals()
1620 struct s2255_channel *channel = video_drvdata(file); in __s2255_open() local
1698 fh->channel = channel; in __s2255_open()
1699 if (!channel->configured) { in __s2255_open()
1701 channel->fmt = &formats[0]; in __s2255_open()
1702 s2255_set_mode(channel, &channel->mode); in __s2255_open()
1703 channel->configured = 1; in __s2255_open()
1709 (unsigned long)&channel->vidq); in __s2255_open()
1711 list_empty(&channel->vidq.active)); in __s2255_open()
1777 struct s2255_channel *channel = fh->channel; in s2255_release() local
1783 if (channel->b_acquire) in s2255_release()
1784 s2255_stop_acquire(fh->channel); in s2255_release()
1857 struct s2255_channel *channel = in s2255_video_device_release() local
1860 v4l2_ctrl_handler_free(&channel->hdl); in s2255_video_device_release()
1896 struct s2255_channel *channel; in s2255_probe_v4l() local
1903 channel = &dev->channel[i]; in s2255_probe_v4l()
1904 INIT_LIST_HEAD(&channel->vidq.active); in s2255_probe_v4l()
1906 v4l2_ctrl_handler_init(&channel->hdl, 6); in s2255_probe_v4l()
1907 v4l2_ctrl_new_std(&channel->hdl, &s2255_ctrl_ops, in s2255_probe_v4l()
1909 v4l2_ctrl_new_std(&channel->hdl, &s2255_ctrl_ops, in s2255_probe_v4l()
1911 v4l2_ctrl_new_std(&channel->hdl, &s2255_ctrl_ops, in s2255_probe_v4l()
1913 v4l2_ctrl_new_std(&channel->hdl, &s2255_ctrl_ops, in s2255_probe_v4l()
1915 channel->jpegqual_ctrl = v4l2_ctrl_new_std(&channel->hdl, in s2255_probe_v4l()
1920 (dev->pid != 0x2257 || channel->idx <= 1)) in s2255_probe_v4l()
1921 v4l2_ctrl_new_custom(&channel->hdl, &color_filter_ctrl, NULL); in s2255_probe_v4l()
1922 if (channel->hdl.error) { in s2255_probe_v4l()
1923 ret = channel->hdl.error; in s2255_probe_v4l()
1924 v4l2_ctrl_handler_free(&channel->hdl); in s2255_probe_v4l()
1928 channel->vidq.dev = dev; in s2255_probe_v4l()
1930 channel->vdev = template; in s2255_probe_v4l()
1931 channel->vdev.ctrl_handler = &channel->hdl; in s2255_probe_v4l()
1932 channel->vdev.lock = &dev->lock; in s2255_probe_v4l()
1933 channel->vdev.v4l2_dev = &dev->v4l2_dev; in s2255_probe_v4l()
1934 set_bit(V4L2_FL_USE_FH_PRIO, &channel->vdev.flags); in s2255_probe_v4l()
1935 video_set_drvdata(&channel->vdev, channel); in s2255_probe_v4l()
1937 ret = video_register_device(&channel->vdev, in s2255_probe_v4l()
1941 ret = video_register_device(&channel->vdev, in s2255_probe_v4l()
1952 video_device_node_name(&channel->vdev)); in s2255_probe_v4l()
1989 struct s2255_channel *channel; in save_frame() local
1991 channel = &dev->channel[dev->cc]; in save_frame()
1992 idx = channel->cur_frame; in save_frame()
1993 frm = &channel->buffer.frame[idx]; in save_frame()
2018 channel = &dev->channel[dev->cc]; in save_frame()
2020 if (payload > channel->req_image_size) { in save_frame()
2021 channel->bad_payload++; in save_frame()
2025 channel->pkt_size = payload; in save_frame()
2026 channel->jpg_size = le32_to_cpu(pdword[4]); in save_frame()
2037 channel = &dev->channel[cc]; in save_frame()
2042 channel->setmode_ready = 1; in save_frame()
2043 wake_up(&channel->wait_setmode); in save_frame()
2057 channel->vidstatus = le32_to_cpu(pdword[3]); in save_frame()
2058 channel->vidstatus_ready = 1; in save_frame()
2059 wake_up(&channel->wait_vidstatus); in save_frame()
2076 channel = &dev->channel[dev->cc]; in save_frame()
2077 idx = channel->cur_frame; in save_frame()
2078 frm = &channel->buffer.frame[idx]; in save_frame()
2080 if (!channel->b_acquire) { in save_frame()
2105 size = channel->pkt_size - PREFIX_SIZE; in save_frame()
2108 if ((copy_size + frm->cur_size) < channel->req_image_size) in save_frame()
2117 channel->last_frame = channel->cur_frame; in save_frame()
2118 channel->cur_frame++; in save_frame()
2120 if ((channel->cur_frame == SYS_FRAMES) || in save_frame()
2121 (channel->cur_frame == channel->buffer.dwFrames)) in save_frame()
2122 channel->cur_frame = 0; in save_frame()
2124 if (channel->b_acquire) in save_frame()
2125 s2255_got_frame(channel, channel->jpg_size); in save_frame()
2126 channel->frame_count++; in save_frame()
2199 static int s2255_create_sys_buffers(struct s2255_channel *channel) in s2255_create_sys_buffers() argument
2204 channel->buffer.dwFrames = SYS_FRAMES; in s2255_create_sys_buffers()
2213 channel->buffer.frame[i].lpvbits = vmalloc(reqsize); in s2255_create_sys_buffers()
2215 &channel->buffer.frame[i], channel->idx, i, in s2255_create_sys_buffers()
2216 channel->buffer.frame[i].lpvbits); in s2255_create_sys_buffers()
2217 channel->buffer.frame[i].size = reqsize; in s2255_create_sys_buffers()
2218 if (channel->buffer.frame[i].lpvbits == NULL) { in s2255_create_sys_buffers()
2220 channel->buffer.dwFrames = i; in s2255_create_sys_buffers()
2227 channel->buffer.frame[i].ulState = 0; in s2255_create_sys_buffers()
2228 channel->buffer.frame[i].cur_size = 0; in s2255_create_sys_buffers()
2231 channel->cur_frame = 0; in s2255_create_sys_buffers()
2232 channel->last_frame = -1; in s2255_create_sys_buffers()
2236 static int s2255_release_sys_buffers(struct s2255_channel *channel) in s2255_release_sys_buffers() argument
2241 if (channel->buffer.frame[i].lpvbits) { in s2255_release_sys_buffers()
2243 channel->buffer.frame[i].lpvbits); in s2255_release_sys_buffers()
2244 vfree(channel->buffer.frame[i].lpvbits); in s2255_release_sys_buffers()
2246 channel->buffer.frame[i].lpvbits = NULL; in s2255_release_sys_buffers()
2280 struct s2255_channel *channel = &dev->channel[j]; in s2255_board_init() local
2281 channel->b_acquire = 0; in s2255_board_init()
2282 channel->mode = mode_def; in s2255_board_init()
2284 channel->mode.color |= (1 << 16); in s2255_board_init()
2285 channel->jpegqual = S2255_DEF_JPEG_QUAL; in s2255_board_init()
2286 channel->width = LINE_SZ_4CIFS_NTSC; in s2255_board_init()
2287 channel->height = NUM_LINES_4CIFS_NTSC * 2; in s2255_board_init()
2288 channel->std = V4L2_STD_NTSC_M; in s2255_board_init()
2289 channel->fmt = &formats[0]; in s2255_board_init()
2290 channel->mode.restart = 1; in s2255_board_init()
2291 channel->req_image_size = get_transfer_size(&mode_def); in s2255_board_init()
2292 channel->frame_count = 0; in s2255_board_init()
2294 s2255_create_sys_buffers(channel); in s2255_board_init()
2308 if (dev->channel[i].b_acquire) in s2255_board_shutdown()
2309 s2255_stop_acquire(&dev->channel[i]); in s2255_board_shutdown()
2313 s2255_release_sys_buffers(&dev->channel[i]); in s2255_board_shutdown()
2406 static int s2255_start_acquire(struct s2255_channel *channel) in s2255_start_acquire() argument
2412 struct s2255_dev *dev = to_s2255_dev(channel->vdev.v4l2_dev); in s2255_start_acquire()
2413 chn_rev = G_chnmap[channel->idx]; in s2255_start_acquire()
2420 channel->last_frame = -1; in s2255_start_acquire()
2421 channel->bad_payload = 0; in s2255_start_acquire()
2422 channel->cur_frame = 0; in s2255_start_acquire()
2424 channel->buffer.frame[j].ulState = 0; in s2255_start_acquire()
2425 channel->buffer.frame[j].cur_size = 0; in s2255_start_acquire()
2436 dprintk(2, "start acquire exit[%d] %d \n", channel->idx, res); in s2255_start_acquire()
2441 static int s2255_stop_acquire(struct s2255_channel *channel) in s2255_stop_acquire() argument
2446 struct s2255_dev *dev = to_s2255_dev(channel->vdev.v4l2_dev); in s2255_stop_acquire()
2447 chn_rev = G_chnmap[channel->idx]; in s2255_stop_acquire()
2461 channel->b_acquire = 0; in s2255_stop_acquire()
2462 dprintk(4, "%s: chn %d, res %d\n", __func__, channel->idx, res); in s2255_stop_acquire()
2552 struct s2255_channel *channel = &dev->channel[i]; in s2255_probe() local
2553 dev->channel[i].idx = i; in s2255_probe()
2554 init_waitqueue_head(&channel->wait_setmode); in s2255_probe()
2555 init_waitqueue_head(&channel->wait_vidstatus); in s2255_probe()
2643 video_unregister_device(&dev->channel[i].vdev); in s2255_disconnect()
2648 dev->channel[i].setmode_ready = 1; in s2255_disconnect()
2649 wake_up(&dev->channel[i].wait_setmode); in s2255_disconnect()
2650 dev->channel[i].vidstatus_ready = 1; in s2255_disconnect()
2651 wake_up(&dev->channel[i].wait_vidstatus); in s2255_disconnect()