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
763 spin_lock_irqsave(&dev->video_mode.slock, flags); in free_buffer()
764 if (dev->USE_ISO) { in free_buffer()
765 if (dev->video_mode.isoc_ctl.buf == buf) in free_buffer()
766 dev->video_mode.isoc_ctl.buf = NULL; in free_buffer()
768 if (dev->video_mode.bulk_ctl.buf == buf) in free_buffer()
769 dev->video_mode.bulk_ctl.buf = NULL; in free_buffer()
771 spin_unlock_irqrestore(&dev->video_mode.slock, flags); in free_buffer()
784 struct cx231xx *dev = fh->dev; in buffer_prepare() local
788 buf->vb.size = (fh->dev->width * fh->dev->height * dev->format->depth in buffer_prepare()
793 buf->vb.width = dev->width; in buffer_prepare()
794 buf->vb.height = dev->height; in buffer_prepare()
803 if (dev->USE_ISO) { in buffer_prepare()
804 if (!dev->video_mode.isoc_ctl.num_bufs) in buffer_prepare()
807 if (!dev->video_mode.bulk_ctl.num_bufs) in buffer_prepare()
810 dev_dbg(dev->dev, in buffer_prepare()
812 urb_init, dev->video_mode.max_pkt_size); in buffer_prepare()
814 dev->mode_tv = 0; in buffer_prepare()
815 if (dev->USE_ISO) in buffer_prepare()
816 rc = cx231xx_init_isoc(dev, CX231XX_NUM_PACKETS, in buffer_prepare()
818 dev->video_mode.max_pkt_size, in buffer_prepare()
821 rc = cx231xx_init_bulk(dev, CX231XX_NUM_PACKETS, in buffer_prepare()
823 dev->video_mode.max_pkt_size, in buffer_prepare()
843 struct cx231xx *dev = fh->dev; in buffer_queue() local
844 struct cx231xx_dmaqueue *vidq = &dev->video_mode.vidq; in buffer_queue()
857 struct cx231xx *dev = (struct cx231xx *)fh->dev; in buffer_release() local
873 void video_mux(struct cx231xx *dev, int index) in video_mux() argument
875 dev->video_input = index; in video_mux()
876 dev->ctl_ainput = INPUT(index)->amux; in video_mux()
878 cx231xx_set_video_input_mux(dev, index); in video_mux()
880 cx25840_call(dev, video, s_routing, INPUT(index)->vmux, 0, 0); in video_mux()
882 cx231xx_set_audio_input(dev, dev->ctl_ainput); in video_mux()
884 dev_dbg(dev->dev, "video_mux : %d\n", index); in video_mux()
887 cx231xx_do_mode_ctrl_overrides(dev); in video_mux()
893 struct cx231xx *dev = fh->dev; in res_get() local
901 if (dev->stream_on) in res_get()
903 dev->stream_on = 1; in res_get()
905 if (dev->vbi_stream_on) in res_get()
907 dev->vbi_stream_on = 1; in res_get()
923 struct cx231xx *dev = fh->dev; in res_free() local
928 dev->stream_on = 0; in res_free()
930 dev->vbi_stream_on = 0; in res_free()
933 static int check_dev(struct cx231xx *dev) in check_dev() argument
935 if (dev->state & DEV_DISCONNECTED) { in check_dev()
936 dev_err(dev->dev, "v4l2 ioctl: device not present\n"); in check_dev()
950 struct cx231xx *dev = fh->dev; in vidioc_g_fmt_vid_cap() local
952 f->fmt.pix.width = dev->width; in vidioc_g_fmt_vid_cap()
953 f->fmt.pix.height = dev->height; in vidioc_g_fmt_vid_cap()
954 f->fmt.pix.pixelformat = dev->format->fourcc; in vidioc_g_fmt_vid_cap()
955 f->fmt.pix.bytesperline = (dev->width * dev->format->depth + 7) >> 3; in vidioc_g_fmt_vid_cap()
956 f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * dev->height; in vidioc_g_fmt_vid_cap()
979 struct cx231xx *dev = fh->dev; in vidioc_try_fmt_vid_cap() local
982 unsigned int maxw = norm_maxw(dev); in vidioc_try_fmt_vid_cap()
983 unsigned int maxh = norm_maxh(dev); in vidioc_try_fmt_vid_cap()
1012 struct cx231xx *dev = fh->dev; in vidioc_s_fmt_vid_cap() local
1019 rc = check_dev(dev); in vidioc_s_fmt_vid_cap()
1030 dev_err(dev->dev, "%s: queue busy\n", __func__); in vidioc_s_fmt_vid_cap()
1034 if (dev->stream_on && !fh->stream_on) { in vidioc_s_fmt_vid_cap()
1035 dev_err(dev->dev, in vidioc_s_fmt_vid_cap()
1041 dev->width = f->fmt.pix.width; in vidioc_s_fmt_vid_cap()
1042 dev->height = f->fmt.pix.height; in vidioc_s_fmt_vid_cap()
1043 dev->format = fmt; in vidioc_s_fmt_vid_cap()
1046 call_all(dev, pad, set_fmt, NULL, &format); in vidioc_s_fmt_vid_cap()
1055 struct cx231xx *dev = fh->dev; in vidioc_g_std() local
1057 *id = dev->norm; in vidioc_g_std()
1064 struct cx231xx *dev = fh->dev; in vidioc_s_std() local
1070 rc = check_dev(dev); in vidioc_s_std()
1074 if (dev->norm == norm) in vidioc_s_std()
1080 dev->norm = norm; in vidioc_s_std()
1083 dev->width = 720; in vidioc_s_std()
1084 dev->height = (dev->norm & V4L2_STD_625_50) ? 576 : 480; in vidioc_s_std()
1086 call_all(dev, video, s_std, dev->norm); in vidioc_s_std()
1092 format.format.width = dev->width; in vidioc_s_std()
1093 format.format.height = dev->height; in vidioc_s_std()
1094 call_all(dev, pad, set_fmt, NULL, &format); in vidioc_s_std()
1097 cx231xx_do_mode_ctrl_overrides(dev); in vidioc_s_std()
1115 struct cx231xx *dev = fh->dev; in cx231xx_enum_input() local
1135 i->std = dev->vdev.tvnorms; in cx231xx_enum_input()
1138 if (n == dev->video_input) { in cx231xx_enum_input()
1139 ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_enum_input()
1155 struct cx231xx *dev = fh->dev; in cx231xx_g_input() local
1157 *i = dev->video_input; in cx231xx_g_input()
1165 struct cx231xx *dev = fh->dev; in cx231xx_s_input() local
1168 dev->mode_tv = 0; in cx231xx_s_input()
1169 rc = check_dev(dev); in cx231xx_s_input()
1178 video_mux(dev, i); in cx231xx_s_input()
1185 call_all(dev, video, s_std, dev->norm); in cx231xx_s_input()
1194 struct cx231xx *dev = fh->dev; in cx231xx_g_tuner() local
1197 rc = check_dev(dev); in cx231xx_g_tuner()
1210 call_all(dev, tuner, g_tuner, t); in cx231xx_g_tuner()
1218 struct cx231xx *dev = fh->dev; in cx231xx_s_tuner() local
1221 rc = check_dev(dev); in cx231xx_s_tuner()
1228 call_all(dev, tuner, s_tuner, t); in cx231xx_s_tuner()
1237 struct cx231xx *dev = fh->dev; in cx231xx_g_frequency() local
1242 f->frequency = dev->ctl_freq; in cx231xx_g_frequency()
1251 struct cx231xx *dev = fh->dev; in cx231xx_s_frequency() local
1256 dev_dbg(dev->dev, in cx231xx_s_frequency()
1260 rc = check_dev(dev); in cx231xx_s_frequency()
1268 rc = cx231xx_tuner_pre_channel_change(dev); in cx231xx_s_frequency()
1270 call_all(dev, tuner, s_frequency, f); in cx231xx_s_frequency()
1271 call_all(dev, tuner, g_frequency, &new_freq); in cx231xx_s_frequency()
1272 dev->ctl_freq = new_freq.frequency; in cx231xx_s_frequency()
1275 rc = cx231xx_tuner_post_channel_change(dev); in cx231xx_s_frequency()
1277 if (dev->tuner_type == TUNER_NXP_TDA18271) { in cx231xx_s_frequency()
1278 if (dev->norm & (V4L2_STD_MN | V4L2_STD_NTSC_443)) in cx231xx_s_frequency()
1280 else if (dev->norm & V4L2_STD_B) in cx231xx_s_frequency()
1282 else if (dev->norm & (V4L2_STD_PAL_DK | V4L2_STD_SECAM_DK)) in cx231xx_s_frequency()
1284 else if (dev->norm & V4L2_STD_GH) in cx231xx_s_frequency()
1286 else if (dev->norm & V4L2_STD_PAL_I) in cx231xx_s_frequency()
1288 else if (dev->norm & V4L2_STD_SECAM_L) in cx231xx_s_frequency()
1290 else if (dev->norm & V4L2_STD_SECAM_LC) in cx231xx_s_frequency()
1293 dev_dbg(dev->dev, in cx231xx_s_frequency()
1295 cx231xx_set_Colibri_For_LowIF(dev, if_frequency, 1, 1); in cx231xx_s_frequency()
1297 update_HH_register_after_set_DIF(dev); in cx231xx_s_frequency()
1300 dev_dbg(dev->dev, "Set New FREQUENCY to %d\n", f->frequency); in cx231xx_s_frequency()
1339 struct cx231xx *dev = fh->dev; in cx231xx_g_register() local
1346 ret = cx231xx_read_ctrl_reg(dev, VRT_GET_REGISTER, in cx231xx_g_register()
1353 ret = cx231xx_read_i2c_data(dev, AFE_DEVICE_ADDRESS, in cx231xx_g_register()
1359 ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_g_register()
1365 ret = cx231xx_read_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS, in cx231xx_g_register()
1371 ret = cx231xx_read_i2c_data(dev, AFE_DEVICE_ADDRESS, in cx231xx_g_register()
1377 ret = cx231xx_read_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_g_register()
1383 ret = cx231xx_read_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS, in cx231xx_g_register()
1398 struct cx231xx *dev = fh->dev; in cx231xx_s_register() local
1408 ret = cx231xx_write_ctrl_reg(dev, VRT_SET_REGISTER, in cx231xx_s_register()
1412 ret = cx231xx_write_i2c_data(dev, AFE_DEVICE_ADDRESS, in cx231xx_s_register()
1416 ret = cx231xx_write_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_s_register()
1420 ret = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS, in cx231xx_s_register()
1424 ret = cx231xx_write_i2c_data(dev, AFE_DEVICE_ADDRESS, in cx231xx_s_register()
1428 ret = cx231xx_write_i2c_data(dev, VID_BLK_I2C_ADDRESS, in cx231xx_s_register()
1432 ret = cx231xx_write_i2c_data(dev, I2S_BLK_DEVICE_ADDRESS, in cx231xx_s_register()
1446 struct cx231xx *dev = fh->dev; in vidioc_cropcap() local
1453 cc->bounds.width = dev->width; in vidioc_cropcap()
1454 cc->bounds.height = dev->height; in vidioc_cropcap()
1466 struct cx231xx *dev = fh->dev; in vidioc_streamon() local
1469 rc = check_dev(dev); in vidioc_streamon()
1478 call_all(dev, video, s_stream, 1); in vidioc_streamon()
1487 struct cx231xx *dev = fh->dev; in vidioc_streamoff() local
1490 rc = check_dev(dev); in vidioc_streamoff()
1497 cx25840_call(dev, video, s_stream, 0); in vidioc_streamoff()
1510 struct cx231xx *dev = fh->dev; in cx231xx_querycap() local
1513 strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card)); in cx231xx_querycap()
1514 usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); in cx231xx_querycap()
1525 if (dev->tuner_type != TUNER_ABSENT) in cx231xx_querycap()
1530 if (video_is_registered(&dev->radio_dev)) in cx231xx_querycap()
1554 struct cx231xx *dev = fh->dev; in vidioc_g_fmt_vbi_cap() local
1560 f->fmt.vbi.start[0] = (dev->norm & V4L2_STD_625_50) ? in vidioc_g_fmt_vbi_cap()
1562 f->fmt.vbi.count[0] = (dev->norm & V4L2_STD_625_50) ? in vidioc_g_fmt_vbi_cap()
1564 f->fmt.vbi.start[1] = (dev->norm & V4L2_STD_625_50) ? in vidioc_g_fmt_vbi_cap()
1577 struct cx231xx *dev = fh->dev; in vidioc_try_fmt_vbi_cap() local
1584 f->fmt.vbi.start[0] = (dev->norm & V4L2_STD_625_50) ? in vidioc_try_fmt_vbi_cap()
1586 f->fmt.vbi.count[0] = (dev->norm & V4L2_STD_625_50) ? in vidioc_try_fmt_vbi_cap()
1588 f->fmt.vbi.start[1] = (dev->norm & V4L2_STD_625_50) ? in vidioc_try_fmt_vbi_cap()
1601 struct cx231xx *dev = fh->dev; in vidioc_s_fmt_vbi_cap() local
1603 if (dev->vbi_stream_on && !fh->stream_on) { in vidioc_s_fmt_vbi_cap()
1604 dev_err(dev->dev, in vidioc_s_fmt_vbi_cap()
1615 struct cx231xx *dev = fh->dev; in vidioc_reqbufs() local
1618 rc = check_dev(dev); in vidioc_reqbufs()
1628 struct cx231xx *dev = fh->dev; in vidioc_querybuf() local
1631 rc = check_dev(dev); in vidioc_querybuf()
1641 struct cx231xx *dev = fh->dev; in vidioc_qbuf() local
1644 rc = check_dev(dev); in vidioc_qbuf()
1654 struct cx231xx *dev = fh->dev; in vidioc_dqbuf() local
1657 rc = check_dev(dev); in vidioc_dqbuf()
1670 struct cx231xx *dev = ((struct cx231xx_fh *)priv)->dev; in radio_g_tuner() local
1677 call_all(dev, tuner, g_tuner, t); in radio_g_tuner()
1683 struct cx231xx *dev = ((struct cx231xx_fh *)priv)->dev; in radio_s_tuner() local
1688 call_all(dev, tuner, s_tuner, t); in radio_s_tuner()
1701 struct cx231xx *dev = video_drvdata(filp); in cx231xx_v4l2_open() local
1719 dev->users); in cx231xx_v4l2_open()
1722 errCode = cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); in cx231xx_v4l2_open()
1724 dev_err(dev->dev, in cx231xx_v4l2_open()
1733 if (mutex_lock_interruptible(&dev->lock)) { in cx231xx_v4l2_open()
1737 fh->dev = dev; in cx231xx_v4l2_open()
1742 if (fh->type == V4L2_BUF_TYPE_VIDEO_CAPTURE && dev->users == 0) { in cx231xx_v4l2_open()
1744 if (dev->board.external_av) in cx231xx_v4l2_open()
1745 cx231xx_set_power_mode(dev, in cx231xx_v4l2_open()
1748 cx231xx_set_power_mode(dev, POLARIS_AVMODE_ANALOGT_TV); in cx231xx_v4l2_open()
1751 cx231xx_set_mode(dev, CX231XX_ANALOG_MODE); in cx231xx_v4l2_open()
1755 cx231xx_set_video_alternate(dev); in cx231xx_v4l2_open()
1759 cx231xx_config_i2c(dev); in cx231xx_v4l2_open()
1762 dev->video_input = dev->video_input > 2 ? 2 : dev->video_input; in cx231xx_v4l2_open()
1770 call_all(dev, tuner, s_radio); in cx231xx_v4l2_open()
1773 dev->users++; in cx231xx_v4l2_open()
1777 NULL, &dev->video_mode.slock, in cx231xx_v4l2_open()
1780 fh, &dev->lock); in cx231xx_v4l2_open()
1784 cx231xx_set_alt_setting(dev, INDEX_VANC, 0); in cx231xx_v4l2_open()
1787 NULL, &dev->vbi_mode.slock, in cx231xx_v4l2_open()
1790 fh, &dev->lock); in cx231xx_v4l2_open()
1792 mutex_unlock(&dev->lock); in cx231xx_v4l2_open()
1803 void cx231xx_release_analog_resources(struct cx231xx *dev) in cx231xx_release_analog_resources() argument
1808 if (video_is_registered(&dev->radio_dev)) in cx231xx_release_analog_resources()
1809 video_unregister_device(&dev->radio_dev); in cx231xx_release_analog_resources()
1810 if (video_is_registered(&dev->vbi_dev)) { in cx231xx_release_analog_resources()
1811 dev_info(dev->dev, "V4L2 device %s deregistered\n", in cx231xx_release_analog_resources()
1812 video_device_node_name(&dev->vbi_dev)); in cx231xx_release_analog_resources()
1813 video_unregister_device(&dev->vbi_dev); in cx231xx_release_analog_resources()
1815 if (video_is_registered(&dev->vdev)) { in cx231xx_release_analog_resources()
1816 dev_info(dev->dev, "V4L2 device %s deregistered\n", in cx231xx_release_analog_resources()
1817 video_device_node_name(&dev->vdev)); in cx231xx_release_analog_resources()
1819 if (dev->board.has_417) in cx231xx_release_analog_resources()
1820 cx231xx_417_unregister(dev); in cx231xx_release_analog_resources()
1822 video_unregister_device(&dev->vdev); in cx231xx_release_analog_resources()
1824 v4l2_ctrl_handler_free(&dev->ctrl_handler); in cx231xx_release_analog_resources()
1825 v4l2_ctrl_handler_free(&dev->radio_ctrl_handler); in cx231xx_release_analog_resources()
1836 struct cx231xx *dev = fh->dev; in cx231xx_close() local
1838 cx231xx_videodbg("users=%d\n", dev->users); in cx231xx_close()
1840 cx231xx_videodbg("users=%d\n", dev->users); in cx231xx_close()
1850 if (!dev->board.no_alt_vanc) in cx231xx_close()
1857 if (dev->state & DEV_DISCONNECTED) { in cx231xx_close()
1858 if (atomic_read(&dev->devlist_count) > 0) { in cx231xx_close()
1859 cx231xx_release_resources(dev); in cx231xx_close()
1860 fh->dev = NULL; in cx231xx_close()
1867 cx231xx_uninit_vbi_isoc(dev); in cx231xx_close()
1870 if (!dev->vbi_or_sliced_cc_mode) in cx231xx_close()
1871 cx231xx_set_alt_setting(dev, INDEX_VANC, 0); in cx231xx_close()
1873 cx231xx_set_alt_setting(dev, INDEX_HANC, 0); in cx231xx_close()
1878 dev->users--; in cx231xx_close()
1879 wake_up_interruptible(&dev->open); in cx231xx_close()
1884 dev->users--; in cx231xx_close()
1885 if (!dev->users) { in cx231xx_close()
1891 if (dev->state & DEV_DISCONNECTED) { in cx231xx_close()
1892 cx231xx_release_resources(dev); in cx231xx_close()
1893 fh->dev = NULL; in cx231xx_close()
1898 call_all(dev, core, s_power, 0); in cx231xx_close()
1901 if (dev->USE_ISO) in cx231xx_close()
1902 cx231xx_uninit_isoc(dev); in cx231xx_close()
1904 cx231xx_uninit_bulk(dev); in cx231xx_close()
1905 cx231xx_set_mode(dev, CX231XX_SUSPEND); in cx231xx_close()
1908 cx231xx_set_alt_setting(dev, INDEX_VIDEO, 0); in cx231xx_close()
1912 wake_up_interruptible(&dev->open); in cx231xx_close()
1919 struct cx231xx *dev = fh->dev; in cx231xx_v4l2_close() local
1922 mutex_lock(&dev->lock); in cx231xx_v4l2_close()
1924 mutex_unlock(&dev->lock); in cx231xx_v4l2_close()
1937 struct cx231xx *dev = fh->dev; in cx231xx_v4l2_read() local
1940 rc = check_dev(dev); in cx231xx_v4l2_read()
1951 if (mutex_lock_interruptible(&dev->lock)) in cx231xx_v4l2_read()
1955 mutex_unlock(&dev->lock); in cx231xx_v4l2_read()
1969 struct cx231xx *dev = fh->dev; in cx231xx_v4l2_poll() local
1973 rc = check_dev(dev); in cx231xx_v4l2_poll()
1992 mutex_lock(&dev->lock); in cx231xx_v4l2_poll()
1994 mutex_unlock(&dev->lock); in cx231xx_v4l2_poll()
2006 struct cx231xx *dev = fh->dev; in cx231xx_v4l2_mmap() local
2009 rc = check_dev(dev); in cx231xx_v4l2_mmap()
2018 if (mutex_lock_interruptible(&dev->lock)) in cx231xx_v4l2_mmap()
2021 mutex_unlock(&dev->lock); in cx231xx_v4l2_mmap()
2115 static void cx231xx_vdev_init(struct cx231xx *dev, in cx231xx_vdev_init() argument
2121 vfd->v4l2_dev = &dev->v4l2_dev; in cx231xx_vdev_init()
2123 vfd->lock = &dev->lock; in cx231xx_vdev_init()
2125 snprintf(vfd->name, sizeof(vfd->name), "%s %s", dev->name, type_name); in cx231xx_vdev_init()
2127 video_set_drvdata(vfd, dev); in cx231xx_vdev_init()
2128 if (dev->tuner_type == TUNER_ABSENT) { in cx231xx_vdev_init()
2136 int cx231xx_register_analog_devices(struct cx231xx *dev) in cx231xx_register_analog_devices() argument
2140 dev_info(dev->dev, "v4l2 driver version %s\n", CX231XX_VERSION); in cx231xx_register_analog_devices()
2143 dev->norm = V4L2_STD_PAL; in cx231xx_register_analog_devices()
2144 dev->width = norm_maxw(dev); in cx231xx_register_analog_devices()
2145 dev->height = norm_maxh(dev); in cx231xx_register_analog_devices()
2146 dev->interlaced = 0; in cx231xx_register_analog_devices()
2149 dev->format = &format[0]; in cx231xx_register_analog_devices()
2152 video_mux(dev, dev->video_input); in cx231xx_register_analog_devices()
2154 call_all(dev, video, s_std, dev->norm); in cx231xx_register_analog_devices()
2156 v4l2_ctrl_handler_init(&dev->ctrl_handler, 10); in cx231xx_register_analog_devices()
2157 v4l2_ctrl_handler_init(&dev->radio_ctrl_handler, 5); in cx231xx_register_analog_devices()
2159 if (dev->sd_cx25840) { in cx231xx_register_analog_devices()
2160 v4l2_ctrl_add_handler(&dev->ctrl_handler, in cx231xx_register_analog_devices()
2161 dev->sd_cx25840->ctrl_handler, NULL); in cx231xx_register_analog_devices()
2162 v4l2_ctrl_add_handler(&dev->radio_ctrl_handler, in cx231xx_register_analog_devices()
2163 dev->sd_cx25840->ctrl_handler, in cx231xx_register_analog_devices()
2167 if (dev->ctrl_handler.error) in cx231xx_register_analog_devices()
2168 return dev->ctrl_handler.error; in cx231xx_register_analog_devices()
2169 if (dev->radio_ctrl_handler.error) in cx231xx_register_analog_devices()
2170 return dev->radio_ctrl_handler.error; in cx231xx_register_analog_devices()
2176 cx231xx_vdev_init(dev, &dev->vdev, &cx231xx_video_template, "video"); in cx231xx_register_analog_devices()
2178 dev->video_pad.flags = MEDIA_PAD_FL_SINK; in cx231xx_register_analog_devices()
2179 ret = media_entity_init(&dev->vdev.entity, 1, &dev->video_pad, 0); in cx231xx_register_analog_devices()
2181 dev_err(dev->dev, "failed to initialize video media entity!\n"); in cx231xx_register_analog_devices()
2183 dev->vdev.ctrl_handler = &dev->ctrl_handler; in cx231xx_register_analog_devices()
2185 ret = video_register_device(&dev->vdev, VFL_TYPE_GRABBER, in cx231xx_register_analog_devices()
2186 video_nr[dev->devno]); in cx231xx_register_analog_devices()
2188 dev_err(dev->dev, in cx231xx_register_analog_devices()
2194 dev_info(dev->dev, "Registered video device %s [v4l2]\n", in cx231xx_register_analog_devices()
2195 video_device_node_name(&dev->vdev)); in cx231xx_register_analog_devices()
2202 cx231xx_vdev_init(dev, &dev->vbi_dev, &cx231xx_vbi_template, "vbi"); in cx231xx_register_analog_devices()
2205 dev->vbi_pad.flags = MEDIA_PAD_FL_SINK; in cx231xx_register_analog_devices()
2206 ret = media_entity_init(&dev->vbi_dev.entity, 1, &dev->vbi_pad, 0); in cx231xx_register_analog_devices()
2208 dev_err(dev->dev, "failed to initialize vbi media entity!\n"); in cx231xx_register_analog_devices()
2210 dev->vbi_dev.ctrl_handler = &dev->ctrl_handler; in cx231xx_register_analog_devices()
2212 ret = video_register_device(&dev->vbi_dev, VFL_TYPE_VBI, in cx231xx_register_analog_devices()
2213 vbi_nr[dev->devno]); in cx231xx_register_analog_devices()
2215 dev_err(dev->dev, "unable to register vbi device\n"); in cx231xx_register_analog_devices()
2219 dev_info(dev->dev, "Registered VBI device %s\n", in cx231xx_register_analog_devices()
2220 video_device_node_name(&dev->vbi_dev)); in cx231xx_register_analog_devices()
2222 if (cx231xx_boards[dev->model].radio.type == CX231XX_RADIO) { in cx231xx_register_analog_devices()
2223 cx231xx_vdev_init(dev, &dev->radio_dev, in cx231xx_register_analog_devices()
2225 dev->radio_dev.ctrl_handler = &dev->radio_ctrl_handler; in cx231xx_register_analog_devices()
2226 ret = video_register_device(&dev->radio_dev, VFL_TYPE_RADIO, in cx231xx_register_analog_devices()
2227 radio_nr[dev->devno]); in cx231xx_register_analog_devices()
2229 dev_err(dev->dev, in cx231xx_register_analog_devices()
2233 dev_info(dev->dev, "Registered radio device as %s\n", in cx231xx_register_analog_devices()
2234 video_device_node_name(&dev->radio_dev)); in cx231xx_register_analog_devices()