Lines Matching refs:dev

54 			 dev->name, __func__ , ##arg); } while (0)
64 dev->name, __func__ , ##arg); \
103 static int cx231xx_enable_analog_tuner(struct cx231xx *dev) in cx231xx_enable_analog_tuner() argument
106 struct media_device *mdev = dev->media_dev; in cx231xx_enable_analog_tuner()
156 dev_err(dev->dev, in cx231xx_enable_analog_tuner()
163 dev_dbg(dev->dev, in cx231xx_enable_analog_tuner()
179 static inline void buffer_filled(struct cx231xx *dev, in buffer_filled() argument
189 if (dev->USE_ISO) in buffer_filled()
190 dev->video_mode.isoc_ctl.buf = NULL; in buffer_filled()
192 dev->video_mode.bulk_ctl.buf = NULL; in buffer_filled()
198 static inline void print_err_status(struct cx231xx *dev, int packet, int status) in print_err_status() argument
244 struct cx231xx *dev = container_of(vmode, struct cx231xx, video_mode); in get_next_buf() local
250 if (dev->USE_ISO) in get_next_buf()
251 dev->video_mode.isoc_ctl.buf = NULL; in get_next_buf()
253 dev->video_mode.bulk_ctl.buf = NULL; in get_next_buf()
265 if (dev->USE_ISO) in get_next_buf()
266 dev->video_mode.isoc_ctl.buf = *buf; in get_next_buf()
268 dev->video_mode.bulk_ctl.buf = *buf; in get_next_buf()
276 static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) in cx231xx_isoc_copy() argument
284 if (!dev) in cx231xx_isoc_copy()
287 if (dev->state & DEV_DISCONNECTED) in cx231xx_isoc_copy()
291 print_err_status(dev, -1, urb->status); in cx231xx_isoc_copy()
300 print_err_status(dev, i, status); in cx231xx_isoc_copy()
310 dev->video_mode.max_pkt_size) { in cx231xx_isoc_copy()
336 bytes_parsed += cx231xx_get_video_line(dev, dma_q, in cx231xx_isoc_copy()
357 bytes_parsed += cx231xx_get_video_line(dev, in cx231xx_isoc_copy()
373 static inline int cx231xx_bulk_copy(struct cx231xx *dev, struct urb *urb) in cx231xx_bulk_copy() argument
380 if (!dev) in cx231xx_bulk_copy()
383 if (dev->state & DEV_DISCONNECTED) in cx231xx_bulk_copy()
387 print_err_status(dev, -1, urb->status); in cx231xx_bulk_copy()
415 bytes_parsed += cx231xx_get_video_line(dev, dma_q, in cx231xx_bulk_copy()
436 bytes_parsed += cx231xx_get_video_line(dev, in cx231xx_bulk_copy()
511 u32 cx231xx_get_video_line(struct cx231xx *dev, in cx231xx_get_video_line() argument
550 bytes_copied = cx231xx_copy_video_line(dev, dma_q, p_buffer, in cx231xx_get_video_line()
556 u32 cx231xx_copy_video_line(struct cx231xx *dev, in cx231xx_copy_video_line() argument
562 u32 _line_size = dev->width * 2; in cx231xx_copy_video_line()
565 cx231xx_reset_video_buffer(dev, dma_q); in cx231xx_copy_video_line()
568 if (dev->USE_ISO) in cx231xx_copy_video_line()
569 buf = dev->video_mode.isoc_ctl.buf; in cx231xx_copy_video_line()
571 buf = dev->video_mode.bulk_ctl.buf; in cx231xx_copy_video_line()
599 cx231xx_do_copy(dev, dma_q, p_line, bytes_to_copy); in cx231xx_copy_video_line()
609 if (cx231xx_is_buffer_done(dev, dma_q) && buf) { in cx231xx_copy_video_line()
610 buffer_filled(dev, dma_q, buf); in cx231xx_copy_video_line()
621 void cx231xx_reset_video_buffer(struct cx231xx *dev, in cx231xx_reset_video_buffer() argument
634 if (dev->USE_ISO) in cx231xx_reset_video_buffer()
635 buf = dev->video_mode.isoc_ctl.buf; in cx231xx_reset_video_buffer()
637 buf = dev->video_mode.bulk_ctl.buf; in cx231xx_reset_video_buffer()
649 dma_q->bytes_left_in_line = dev->width << 1; in cx231xx_reset_video_buffer()
653 int cx231xx_do_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, in cx231xx_do_copy() argument
659 u32 _line_size = dev->width << 1; in cx231xx_do_copy()
663 if (dev->USE_ISO) in cx231xx_do_copy()
664 buf = dev->video_mode.isoc_ctl.buf; in cx231xx_do_copy()
666 buf = dev->video_mode.bulk_ctl.buf; in cx231xx_do_copy()
710 u8 cx231xx_is_buffer_done(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q) in cx231xx_is_buffer_done() argument
730 struct cx231xx *dev = fh->dev; in buffer_setup() local
732 *size = (fh->dev->width * fh->dev->height * dev->format->depth + 7)>>3; in buffer_setup()
740 cx231xx_enable_analog_tuner(dev); in buffer_setup()
749 struct cx231xx *dev = fh->dev; in free_buffer() local
764 spin_lock_irqsave(&dev->video_mode.slock, flags); in free_buffer()
765 if (dev->USE_ISO) { in free_buffer()
766 if (dev->video_mode.isoc_ctl.buf == buf) in free_buffer()
767 dev->video_mode.isoc_ctl.buf = NULL; in free_buffer()
769 if (dev->video_mode.bulk_ctl.buf == buf) in free_buffer()
770 dev->video_mode.bulk_ctl.buf = NULL; in free_buffer()
772 spin_unlock_irqrestore(&dev->video_mode.slock, flags); in free_buffer()
785 struct cx231xx *dev = fh->dev; in buffer_prepare() local
789 buf->vb.size = (fh->dev->width * fh->dev->height * dev->format->depth in buffer_prepare()
794 buf->vb.width = dev->width; in buffer_prepare()
795 buf->vb.height = dev->height; in buffer_prepare()
804 if (dev->USE_ISO) { in buffer_prepare()
805 if (!dev->video_mode.isoc_ctl.num_bufs) in buffer_prepare()
808 if (!dev->video_mode.bulk_ctl.num_bufs) in buffer_prepare()
811 dev_dbg(dev->dev, in buffer_prepare()
813 urb_init, dev->video_mode.max_pkt_size); in buffer_prepare()
815 dev->mode_tv = 0; in buffer_prepare()
816 if (dev->USE_ISO) in buffer_prepare()
817 rc = cx231xx_init_isoc(dev, CX231XX_NUM_PACKETS, in buffer_prepare()
819 dev->video_mode.max_pkt_size, in buffer_prepare()
822 rc = cx231xx_init_bulk(dev, CX231XX_NUM_PACKETS, in buffer_prepare()
824 dev->video_mode.max_pkt_size, in buffer_prepare()
844 struct cx231xx *dev = fh->dev; in buffer_queue() local
845 struct cx231xx_dmaqueue *vidq = &dev->video_mode.vidq; in buffer_queue()
858 struct cx231xx *dev = (struct cx231xx *)fh->dev; in buffer_release() local
874 void video_mux(struct cx231xx *dev, int index) in video_mux() argument
876 dev->video_input = index; in video_mux()
877 dev->ctl_ainput = INPUT(index)->amux; in video_mux()
879 cx231xx_set_video_input_mux(dev, index); in video_mux()
881 cx25840_call(dev, video, s_routing, INPUT(index)->vmux, 0, 0); in video_mux()
883 cx231xx_set_audio_input(dev, dev->ctl_ainput); in video_mux()
885 dev_dbg(dev->dev, "video_mux : %d\n", index); in video_mux()
888 cx231xx_do_mode_ctrl_overrides(dev); in video_mux()
894 struct cx231xx *dev = fh->dev; in res_get() local
902 if (dev->stream_on) in res_get()
904 dev->stream_on = 1; in res_get()
906 if (dev->vbi_stream_on) in res_get()
908 dev->vbi_stream_on = 1; in res_get()
924 struct cx231xx *dev = fh->dev; in res_free() local
929 dev->stream_on = 0; in res_free()
931 dev->vbi_stream_on = 0; in res_free()
934 static int check_dev(struct cx231xx *dev) in check_dev() argument
936 if (dev->state & DEV_DISCONNECTED) { in check_dev()
937 dev_err(dev->dev, "v4l2 ioctl: device not present\n"); in check_dev()
951 struct cx231xx *dev = fh->dev; in vidioc_g_fmt_vid_cap() local
953 f->fmt.pix.width = dev->width; in vidioc_g_fmt_vid_cap()
954 f->fmt.pix.height = dev->height; in vidioc_g_fmt_vid_cap()
955 f->fmt.pix.pixelformat = dev->format->fourcc; in vidioc_g_fmt_vid_cap()
956 f->fmt.pix.bytesperline = (dev->width * dev->format->depth + 7) >> 3; in vidioc_g_fmt_vid_cap()
957 f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * dev->height; in vidioc_g_fmt_vid_cap()
980 struct cx231xx *dev = fh->dev; in vidioc_try_fmt_vid_cap() local
983 unsigned int maxw = norm_maxw(dev); in vidioc_try_fmt_vid_cap()
984 unsigned int maxh = norm_maxh(dev); in vidioc_try_fmt_vid_cap()
1013 struct cx231xx *dev = fh->dev; in vidioc_s_fmt_vid_cap() local
1018 rc = check_dev(dev); in vidioc_s_fmt_vid_cap()
1029 dev_err(dev->dev, "%s: queue busy\n", __func__); in vidioc_s_fmt_vid_cap()
1033 if (dev->stream_on && !fh->stream_on) { in vidioc_s_fmt_vid_cap()
1034 dev_err(dev->dev, in vidioc_s_fmt_vid_cap()
1040 dev->width = f->fmt.pix.width; in vidioc_s_fmt_vid_cap()
1041 dev->height = f->fmt.pix.height; in vidioc_s_fmt_vid_cap()
1042 dev->format = fmt; in vidioc_s_fmt_vid_cap()
1045 call_all(dev, video, s_mbus_fmt, &mbus_fmt); in vidioc_s_fmt_vid_cap()
1054 struct cx231xx *dev = fh->dev; in vidioc_g_std() local
1056 *id = dev->norm; in vidioc_g_std()
1063 struct cx231xx *dev = fh->dev; in vidioc_s_std() local
1067 rc = check_dev(dev); in vidioc_s_std()
1071 if (dev->norm == norm) in vidioc_s_std()
1077 dev->norm = norm; in vidioc_s_std()
1080 dev->width = 720; in vidioc_s_std()
1081 dev->height = (dev->norm & V4L2_STD_625_50) ? 576 : 480; in vidioc_s_std()
1083 call_all(dev, video, s_std, dev->norm); in vidioc_s_std()
1090 mbus_fmt.width = dev->width; in vidioc_s_std()
1091 mbus_fmt.height = dev->height; in vidioc_s_std()
1092 call_all(dev, video, s_mbus_fmt, &mbus_fmt); in vidioc_s_std()
1095 cx231xx_do_mode_ctrl_overrides(dev); in vidioc_s_std()
1113 struct cx231xx *dev = fh->dev; in cx231xx_enum_input() local
1132 i->std = dev->vdev.tvnorms; in cx231xx_enum_input()
1135 if (n == dev->video_input) { in cx231xx_enum_input()
1136 ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_enum_input()
1152 struct cx231xx *dev = fh->dev; in cx231xx_g_input() local
1154 *i = dev->video_input; in cx231xx_g_input()
1162 struct cx231xx *dev = fh->dev; in cx231xx_s_input() local
1165 dev->mode_tv = 0; in cx231xx_s_input()
1166 rc = check_dev(dev); in cx231xx_s_input()
1175 video_mux(dev, i); in cx231xx_s_input()
1182 call_all(dev, video, s_std, dev->norm); in cx231xx_s_input()
1191 struct cx231xx *dev = fh->dev; in cx231xx_g_tuner() local
1194 rc = check_dev(dev); in cx231xx_g_tuner()
1207 call_all(dev, tuner, g_tuner, t); in cx231xx_g_tuner()
1215 struct cx231xx *dev = fh->dev; in cx231xx_s_tuner() local
1218 rc = check_dev(dev); in cx231xx_s_tuner()
1225 call_all(dev, tuner, s_tuner, t); in cx231xx_s_tuner()
1234 struct cx231xx *dev = fh->dev; in cx231xx_g_frequency() local
1239 f->frequency = dev->ctl_freq; in cx231xx_g_frequency()
1248 struct cx231xx *dev = fh->dev; in cx231xx_s_frequency() local
1253 dev_dbg(dev->dev, in cx231xx_s_frequency()
1257 rc = check_dev(dev); in cx231xx_s_frequency()
1265 rc = cx231xx_tuner_pre_channel_change(dev); in cx231xx_s_frequency()
1267 call_all(dev, tuner, s_frequency, f); in cx231xx_s_frequency()
1268 call_all(dev, tuner, g_frequency, &new_freq); in cx231xx_s_frequency()
1269 dev->ctl_freq = new_freq.frequency; in cx231xx_s_frequency()
1272 rc = cx231xx_tuner_post_channel_change(dev); in cx231xx_s_frequency()
1274 if (dev->tuner_type == TUNER_NXP_TDA18271) { in cx231xx_s_frequency()
1275 if (dev->norm & (V4L2_STD_MN | V4L2_STD_NTSC_443)) in cx231xx_s_frequency()
1277 else if (dev->norm & V4L2_STD_B) in cx231xx_s_frequency()
1279 else if (dev->norm & (V4L2_STD_PAL_DK | V4L2_STD_SECAM_DK)) in cx231xx_s_frequency()
1281 else if (dev->norm & V4L2_STD_GH) in cx231xx_s_frequency()
1283 else if (dev->norm & V4L2_STD_PAL_I) in cx231xx_s_frequency()
1285 else if (dev->norm & V4L2_STD_SECAM_L) in cx231xx_s_frequency()
1287 else if (dev->norm & V4L2_STD_SECAM_LC) in cx231xx_s_frequency()
1290 dev_dbg(dev->dev, in cx231xx_s_frequency()
1292 cx231xx_set_Colibri_For_LowIF(dev, if_frequency, 1, 1); in cx231xx_s_frequency()
1294 update_HH_register_after_set_DIF(dev); in cx231xx_s_frequency()
1297 dev_dbg(dev->dev, "Set New FREQUENCY to %d\n", f->frequency); in cx231xx_s_frequency()
1336 struct cx231xx *dev = fh->dev; in cx231xx_g_register() local
1343 ret = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, in cx231xx_g_register()
1350 ret = cx231xx_read_i2c_data(dev, AFE_DEVICE_ADDRESS, in cx231xx_g_register()
1356 ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_g_register()
1362 ret = cx231xx_read_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS, in cx231xx_g_register()
1368 ret = cx231xx_read_i2c_data(dev, AFE_DEVICE_ADDRESS, in cx231xx_g_register()
1374 ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_g_register()
1380 ret = cx231xx_read_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS, in cx231xx_g_register()
1395 struct cx231xx *dev = fh->dev; in cx231xx_s_register() local
1405 ret = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, in cx231xx_s_register()
1409 ret = cx231xx_write_i2c_data(dev, AFE_DEVICE_ADDRESS, in cx231xx_s_register()
1413 ret = cx231xx_write_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_s_register()
1417 ret = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS, in cx231xx_s_register()
1421 ret = cx231xx_write_i2c_data(dev, AFE_DEVICE_ADDRESS, in cx231xx_s_register()
1425 ret = cx231xx_write_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_s_register()
1429 ret = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS, in cx231xx_s_register()
1443 struct cx231xx *dev = fh->dev; in vidioc_cropcap() local
1450 cc->bounds.width = dev->width; in vidioc_cropcap()
1451 cc->bounds.height = dev->height; in vidioc_cropcap()
1463 struct cx231xx *dev = fh->dev; in vidioc_streamon() local
1466 rc = check_dev(dev); in vidioc_streamon()
1475 call_all(dev, video, s_stream, 1); in vidioc_streamon()
1484 struct cx231xx *dev = fh->dev; in vidioc_streamoff() local
1487 rc = check_dev(dev); in vidioc_streamoff()
1494 cx25840_call(dev, video, s_stream, 0); in vidioc_streamoff()
1507 struct cx231xx *dev = fh->dev; in cx231xx_querycap() local
1510 strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); in cx231xx_querycap()
1511 usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); in cx231xx_querycap()
1522 if (dev->tuner_type != TUNER_ABSENT) in cx231xx_querycap()
1527 if (video_is_registered(&dev->radio_dev)) in cx231xx_querycap()
1551 struct cx231xx *dev = fh->dev; in vidioc_g_fmt_vbi_cap() local
1557 f->fmt.vbi.start[0] = (dev->norm & V4L2_STD_625_50) ? in vidioc_g_fmt_vbi_cap()
1559 f->fmt.vbi.count[0] = (dev->norm & V4L2_STD_625_50) ? in vidioc_g_fmt_vbi_cap()
1561 f->fmt.vbi.start[1] = (dev->norm & V4L2_STD_625_50) ? in vidioc_g_fmt_vbi_cap()
1574 struct cx231xx *dev = fh->dev; in vidioc_try_fmt_vbi_cap() local
1581 f->fmt.vbi.start[0] = (dev->norm & V4L2_STD_625_50) ? in vidioc_try_fmt_vbi_cap()
1583 f->fmt.vbi.count[0] = (dev->norm & V4L2_STD_625_50) ? in vidioc_try_fmt_vbi_cap()
1585 f->fmt.vbi.start[1] = (dev->norm & V4L2_STD_625_50) ? in vidioc_try_fmt_vbi_cap()
1598 struct cx231xx *dev = fh->dev; in vidioc_s_fmt_vbi_cap() local
1600 if (dev->vbi_stream_on && !fh->stream_on) { in vidioc_s_fmt_vbi_cap()
1601 dev_err(dev->dev, in vidioc_s_fmt_vbi_cap()
1612 struct cx231xx *dev = fh->dev; in vidioc_reqbufs() local
1615 rc = check_dev(dev); in vidioc_reqbufs()
1625 struct cx231xx *dev = fh->dev; in vidioc_querybuf() local
1628 rc = check_dev(dev); in vidioc_querybuf()
1638 struct cx231xx *dev = fh->dev; in vidioc_qbuf() local
1641 rc = check_dev(dev); in vidioc_qbuf()
1651 struct cx231xx *dev = fh->dev; in vidioc_dqbuf() local
1654 rc = check_dev(dev); in vidioc_dqbuf()
1667 struct cx231xx *dev = ((struct cx231xx_fh *)priv)->dev; in radio_g_tuner() local
1674 call_all(dev, tuner, g_tuner, t); in radio_g_tuner()
1680 struct cx231xx *dev = ((struct cx231xx_fh *)priv)->dev; in radio_s_tuner() local
1685 call_all(dev, tuner, s_tuner, t); in radio_s_tuner()
1698 struct cx231xx *dev = video_drvdata(filp); in cx231xx_v4l2_open() local
1716 dev->users); in cx231xx_v4l2_open()
1719 errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); in cx231xx_v4l2_open()
1721 dev_err(dev->dev, in cx231xx_v4l2_open()
1730 if (mutex_lock_interruptible(&dev->lock)) { in cx231xx_v4l2_open()
1734 fh->dev = dev; in cx231xx_v4l2_open()
1739 if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { in cx231xx_v4l2_open()
1741 if (dev->board.external_av) in cx231xx_v4l2_open()
1742 cx231xx_set_power_mode(dev, in cx231xx_v4l2_open()
1745 cx231xx_set_power_mode(dev, POLARIS_AVMODE_ANALOGT_TV); in cx231xx_v4l2_open()
1748 cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); in cx231xx_v4l2_open()
1752 cx231xx_set_video_alternate(dev); in cx231xx_v4l2_open()
1756 cx231xx_config_i2c(dev); in cx231xx_v4l2_open()
1759 dev->video_input = dev->video_input > 2 ? 2 : dev->video_input; in cx231xx_v4l2_open()
1767 call_all(dev, tuner, s_radio); in cx231xx_v4l2_open()
1770 dev->users++; in cx231xx_v4l2_open()
1774 NULL, &dev->video_mode.slock, in cx231xx_v4l2_open()
1777 fh, &dev->lock); in cx231xx_v4l2_open()
1781 cx231xx_set_alt_setting(dev, INDEX_VANC, 0); in cx231xx_v4l2_open()
1784 NULL, &dev->vbi_mode.slock, in cx231xx_v4l2_open()
1787 fh, &dev->lock); in cx231xx_v4l2_open()
1789 mutex_unlock(&dev->lock); in cx231xx_v4l2_open()
1800 void cx231xx_release_analog_resources(struct cx231xx *dev) in cx231xx_release_analog_resources() argument
1805 if (video_is_registered(&dev->radio_dev)) in cx231xx_release_analog_resources()
1806 video_unregister_device(&dev->radio_dev); in cx231xx_release_analog_resources()
1807 if (video_is_registered(&dev->vbi_dev)) { in cx231xx_release_analog_resources()
1808 dev_info(dev->dev, "V4L2 device %s deregistered\n", in cx231xx_release_analog_resources()
1809 video_device_node_name(&dev->vbi_dev)); in cx231xx_release_analog_resources()
1810 video_unregister_device(&dev->vbi_dev); in cx231xx_release_analog_resources()
1812 if (video_is_registered(&dev->vdev)) { in cx231xx_release_analog_resources()
1813 dev_info(dev->dev, "V4L2 device %s deregistered\n", in cx231xx_release_analog_resources()
1814 video_device_node_name(&dev->vdev)); in cx231xx_release_analog_resources()
1816 if (dev->board.has_417) in cx231xx_release_analog_resources()
1817 cx231xx_417_unregister(dev); in cx231xx_release_analog_resources()
1819 video_unregister_device(&dev->vdev); in cx231xx_release_analog_resources()
1821 v4l2_ctrl_handler_free(&dev->ctrl_handler); in cx231xx_release_analog_resources()
1822 v4l2_ctrl_handler_free(&dev->radio_ctrl_handler); in cx231xx_release_analog_resources()
1833 struct cx231xx *dev = fh->dev; in cx231xx_close() local
1835 cx231xx_videodbg("users=%d\n", dev->users); in cx231xx_close()
1837 cx231xx_videodbg("users=%d\n", dev->users); in cx231xx_close()
1847 if (!dev->board.no_alt_vanc) in cx231xx_close()
1854 if (dev->state & DEV_DISCONNECTED) { in cx231xx_close()
1855 if (atomic_read(&dev->devlist_count) > 0) { in cx231xx_close()
1856 cx231xx_release_resources(dev); in cx231xx_close()
1857 fh->dev = NULL; in cx231xx_close()
1864 cx231xx_uninit_vbi_isoc(dev); in cx231xx_close()
1867 if (!dev->vbi_or_sliced_cc_mode) in cx231xx_close()
1868 cx231xx_set_alt_setting(dev, INDEX_VANC, 0); in cx231xx_close()
1870 cx231xx_set_alt_setting(dev, INDEX_HANC, 0); in cx231xx_close()
1875 dev->users--; in cx231xx_close()
1876 wake_up_interruptible_nr(&dev->open, 1); in cx231xx_close()
1881 dev->users--; in cx231xx_close()
1882 if (!dev->users) { in cx231xx_close()
1888 if (dev->state & DEV_DISCONNECTED) { in cx231xx_close()
1889 cx231xx_release_resources(dev); in cx231xx_close()
1890 fh->dev = NULL; in cx231xx_close()
1895 call_all(dev, core, s_power, 0); in cx231xx_close()
1898 if (dev->USE_ISO) in cx231xx_close()
1899 cx231xx_uninit_isoc(dev); in cx231xx_close()
1901 cx231xx_uninit_bulk(dev); in cx231xx_close()
1902 cx231xx_set_mode(dev, CX231XX_SUSPEND); in cx231xx_close()
1905 cx231xx_set_alt_setting(dev, INDEX_VIDEO, 0); in cx231xx_close()
1909 wake_up_interruptible_nr(&dev->open, 1); in cx231xx_close()
1916 struct cx231xx *dev = fh->dev; in cx231xx_v4l2_close() local
1919 mutex_lock(&dev->lock); in cx231xx_v4l2_close()
1921 mutex_unlock(&dev->lock); in cx231xx_v4l2_close()
1934 struct cx231xx *dev = fh->dev; in cx231xx_v4l2_read() local
1937 rc = check_dev(dev); in cx231xx_v4l2_read()
1948 if (mutex_lock_interruptible(&dev->lock)) in cx231xx_v4l2_read()
1952 mutex_unlock(&dev->lock); in cx231xx_v4l2_read()
1966 struct cx231xx *dev = fh->dev; in cx231xx_v4l2_poll() local
1970 rc = check_dev(dev); in cx231xx_v4l2_poll()
1989 mutex_lock(&dev->lock); in cx231xx_v4l2_poll()
1991 mutex_unlock(&dev->lock); in cx231xx_v4l2_poll()
2003 struct cx231xx *dev = fh->dev; in cx231xx_v4l2_mmap() local
2006 rc = check_dev(dev); in cx231xx_v4l2_mmap()
2015 if (mutex_lock_interruptible(&dev->lock)) in cx231xx_v4l2_mmap()
2018 mutex_unlock(&dev->lock); in cx231xx_v4l2_mmap()
2112 static void cx231xx_vdev_init(struct cx231xx *dev, in cx231xx_vdev_init() argument
2118 vfd->v4l2_dev = &dev->v4l2_dev; in cx231xx_vdev_init()
2120 vfd->lock = &dev->lock; in cx231xx_vdev_init()
2122 snprintf(vfd->name, sizeof(vfd->name), "%s %s", dev->name, type_name); in cx231xx_vdev_init()
2124 video_set_drvdata(vfd, dev); in cx231xx_vdev_init()
2125 if (dev->tuner_type == TUNER_ABSENT) { in cx231xx_vdev_init()
2133 int cx231xx_register_analog_devices(struct cx231xx *dev) in cx231xx_register_analog_devices() argument
2137 dev_info(dev->dev, "v4l2 driver version %s\n", CX231XX_VERSION); in cx231xx_register_analog_devices()
2140 dev->norm = V4L2_STD_PAL; in cx231xx_register_analog_devices()
2141 dev->width = norm_maxw(dev); in cx231xx_register_analog_devices()
2142 dev->height = norm_maxh(dev); in cx231xx_register_analog_devices()
2143 dev->interlaced = 0; in cx231xx_register_analog_devices()
2146 dev->format = &format[0]; in cx231xx_register_analog_devices()
2149 video_mux(dev, dev->video_input); in cx231xx_register_analog_devices()
2151 call_all(dev, video, s_std, dev->norm); in cx231xx_register_analog_devices()
2153 v4l2_ctrl_handler_init(&dev->ctrl_handler, 10); in cx231xx_register_analog_devices()
2154 v4l2_ctrl_handler_init(&dev->radio_ctrl_handler, 5); in cx231xx_register_analog_devices()
2156 if (dev->sd_cx25840) { in cx231xx_register_analog_devices()
2157 v4l2_ctrl_add_handler(&dev->ctrl_handler, in cx231xx_register_analog_devices()
2158 dev->sd_cx25840->ctrl_handler, NULL); in cx231xx_register_analog_devices()
2159 v4l2_ctrl_add_handler(&dev->radio_ctrl_handler, in cx231xx_register_analog_devices()
2160 dev->sd_cx25840->ctrl_handler, in cx231xx_register_analog_devices()
2164 if (dev->ctrl_handler.error) in cx231xx_register_analog_devices()
2165 return dev->ctrl_handler.error; in cx231xx_register_analog_devices()
2166 if (dev->radio_ctrl_handler.error) in cx231xx_register_analog_devices()
2167 return dev->radio_ctrl_handler.error; in cx231xx_register_analog_devices()
2173 cx231xx_vdev_init(dev, &dev->vdev, &cx231xx_video_template, "video"); in cx231xx_register_analog_devices()
2175 dev->video_pad.flags = MEDIA_PAD_FL_SINK; in cx231xx_register_analog_devices()
2176 ret = media_entity_init(&dev->vdev.entity, 1, &dev->video_pad, 0); in cx231xx_register_analog_devices()
2178 dev_err(dev->dev, "failed to initialize video media entity!\n"); in cx231xx_register_analog_devices()
2180 dev->vdev.ctrl_handler = &dev->ctrl_handler; in cx231xx_register_analog_devices()
2182 ret = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, in cx231xx_register_analog_devices()
2183 video_nr[dev->devno]); in cx231xx_register_analog_devices()
2185 dev_err(dev->dev, in cx231xx_register_analog_devices()
2191 dev_info(dev->dev, "Registered video device %s [v4l2]\n", in cx231xx_register_analog_devices()
2192 video_device_node_name(&dev->vdev)); in cx231xx_register_analog_devices()
2199 cx231xx_vdev_init(dev, &dev->vbi_dev, &cx231xx_vbi_template, "vbi"); in cx231xx_register_analog_devices()
2202 dev->vbi_pad.flags = MEDIA_PAD_FL_SINK; in cx231xx_register_analog_devices()
2203 ret = media_entity_init(&dev->vbi_dev.entity, 1, &dev->vbi_pad, 0); in cx231xx_register_analog_devices()
2205 dev_err(dev->dev, "failed to initialize vbi media entity!\n"); in cx231xx_register_analog_devices()
2207 dev->vbi_dev.ctrl_handler = &dev->ctrl_handler; in cx231xx_register_analog_devices()
2209 ret = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI, in cx231xx_register_analog_devices()
2210 vbi_nr[dev->devno]); in cx231xx_register_analog_devices()
2212 dev_err(dev->dev, "unable to register vbi device\n"); in cx231xx_register_analog_devices()
2216 dev_info(dev->dev, "Registered VBI device %s\n", in cx231xx_register_analog_devices()
2217 video_device_node_name(&dev->vbi_dev)); in cx231xx_register_analog_devices()
2219 if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { in cx231xx_register_analog_devices()
2220 cx231xx_vdev_init(dev, &dev->radio_dev, in cx231xx_register_analog_devices()
2222 dev->radio_dev.ctrl_handler = &dev->radio_ctrl_handler; in cx231xx_register_analog_devices()
2223 ret = video_register_device(&dev->radio_dev, VFL_TYPE_RADIO, in cx231xx_register_analog_devices()
2224 radio_nr[dev->devno]); in cx231xx_register_analog_devices()
2226 dev_err(dev->dev, in cx231xx_register_analog_devices()
2230 dev_info(dev->dev, "Registered radio device as %s\n", in cx231xx_register_analog_devices()
2231 video_device_node_name(&dev->radio_dev)); in cx231xx_register_analog_devices()