diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-20 13:35:04 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-12-20 13:35:04 -0500 |
| commit | 8cad7f06e3b1d3f9a28bb7385e8fc09d5e1bf84c (patch) | |
| tree | 128fc5d979cb590b68ff05366dff93065bdd7ebe | |
| parent | 92d7c9b2312474ce1259d71b4e50e01ae9fa95ea (diff) | |
| parent | 0e4d413af1a9ddd12f82617734eb535007e186a8 (diff) | |
Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6
* 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6:
[media] gspca - sonixj: Better handling of the bridge registers 0x01 and 0x17
[media] gspca - sonixj: Add the bit definitions of the bridge reg 0x01 and 0x17
[media] gspca - sonixj: Set the flag for some devices
[media] gspca - sonixj: Add a flag in the driver_info table
[media] gspca - sonixj: Fix a bad probe exchange
[media] gspca - sonixj: Move bridge init to sd start
[media] bttv: remove unneeded locking comments
[media] bttv: fix mutex use before init (BZ#24602)
[media] Don't export format_by_forcc on two different drivers
| -rw-r--r-- | drivers/media/common/saa7146_hlp.c | 8 | ||||
| -rw-r--r-- | drivers/media/common/saa7146_video.c | 16 | ||||
| -rw-r--r-- | drivers/media/video/bt8xx/bttv-driver.c | 117 | ||||
| -rw-r--r-- | drivers/media/video/gspca/sonixj.c | 416 | ||||
| -rw-r--r-- | drivers/staging/cx25821/cx25821-video.c | 8 | ||||
| -rw-r--r-- | drivers/staging/cx25821/cx25821-video.h | 2 | ||||
| -rw-r--r-- | include/media/saa7146.h | 2 |
7 files changed, 205 insertions, 364 deletions
diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c index 05bde9ccb770..1d1d8d200755 100644 --- a/drivers/media/common/saa7146_hlp.c +++ b/drivers/media/common/saa7146_hlp.c | |||
| @@ -558,7 +558,7 @@ static void saa7146_set_window(struct saa7146_dev *dev, int width, int height, e | |||
| 558 | static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) | 558 | static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) |
| 559 | { | 559 | { |
| 560 | struct saa7146_vv *vv = dev->vv_data; | 560 | struct saa7146_vv *vv = dev->vv_data; |
| 561 | struct saa7146_format *sfmt = format_by_fourcc(dev, pixelformat); | 561 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev, pixelformat); |
| 562 | 562 | ||
| 563 | int b_depth = vv->ov_fmt->depth; | 563 | int b_depth = vv->ov_fmt->depth; |
| 564 | int b_bpl = vv->ov_fb.fmt.bytesperline; | 564 | int b_bpl = vv->ov_fb.fmt.bytesperline; |
| @@ -702,7 +702,7 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71 | |||
| 702 | struct saa7146_vv *vv = dev->vv_data; | 702 | struct saa7146_vv *vv = dev->vv_data; |
| 703 | struct saa7146_video_dma vdma1; | 703 | struct saa7146_video_dma vdma1; |
| 704 | 704 | ||
| 705 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 705 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
| 706 | 706 | ||
| 707 | int width = buf->fmt->width; | 707 | int width = buf->fmt->width; |
| 708 | int height = buf->fmt->height; | 708 | int height = buf->fmt->height; |
| @@ -827,7 +827,7 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71 | |||
| 827 | struct saa7146_video_dma vdma2; | 827 | struct saa7146_video_dma vdma2; |
| 828 | struct saa7146_video_dma vdma3; | 828 | struct saa7146_video_dma vdma3; |
| 829 | 829 | ||
| 830 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 830 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
| 831 | 831 | ||
| 832 | int width = buf->fmt->width; | 832 | int width = buf->fmt->width; |
| 833 | int height = buf->fmt->height; | 833 | int height = buf->fmt->height; |
| @@ -994,7 +994,7 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar) | |||
| 994 | 994 | ||
| 995 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) | 995 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) |
| 996 | { | 996 | { |
| 997 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 997 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
| 998 | struct saa7146_vv *vv = dev->vv_data; | 998 | struct saa7146_vv *vv = dev->vv_data; |
| 999 | u32 vdma1_prot_addr; | 999 | u32 vdma1_prot_addr; |
| 1000 | 1000 | ||
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 741c5732b430..d246910129e8 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
| @@ -84,7 +84,7 @@ static struct saa7146_format formats[] = { | |||
| 84 | 84 | ||
| 85 | static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); | 85 | static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); |
| 86 | 86 | ||
| 87 | struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc) | 87 | struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc) |
| 88 | { | 88 | { |
| 89 | int i, j = NUM_FORMATS; | 89 | int i, j = NUM_FORMATS; |
| 90 | 90 | ||
| @@ -266,7 +266,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu | |||
| 266 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); | 266 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); |
| 267 | struct scatterlist *list = dma->sglist; | 267 | struct scatterlist *list = dma->sglist; |
| 268 | int length = dma->sglen; | 268 | int length = dma->sglen; |
| 269 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 269 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
| 270 | 270 | ||
| 271 | DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); | 271 | DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); |
| 272 | 272 | ||
| @@ -408,7 +408,7 @@ static int video_begin(struct saa7146_fh *fh) | |||
| 408 | } | 408 | } |
| 409 | } | 409 | } |
| 410 | 410 | ||
| 411 | fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 411 | fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
| 412 | /* we need to have a valid format set here */ | 412 | /* we need to have a valid format set here */ |
| 413 | BUG_ON(NULL == fmt); | 413 | BUG_ON(NULL == fmt); |
| 414 | 414 | ||
| @@ -460,7 +460,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file) | |||
| 460 | return -EBUSY; | 460 | return -EBUSY; |
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 463 | fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
| 464 | /* we need to have a valid format set here */ | 464 | /* we need to have a valid format set here */ |
| 465 | BUG_ON(NULL == fmt); | 465 | BUG_ON(NULL == fmt); |
| 466 | 466 | ||
| @@ -536,7 +536,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f | |||
| 536 | return -EPERM; | 536 | return -EPERM; |
| 537 | 537 | ||
| 538 | /* check args */ | 538 | /* check args */ |
| 539 | fmt = format_by_fourcc(dev, fb->fmt.pixelformat); | 539 | fmt = saa7146_format_by_fourcc(dev, fb->fmt.pixelformat); |
| 540 | if (NULL == fmt) | 540 | if (NULL == fmt) |
| 541 | return -EINVAL; | 541 | return -EINVAL; |
| 542 | 542 | ||
| @@ -760,7 +760,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma | |||
| 760 | 760 | ||
| 761 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); | 761 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); |
| 762 | 762 | ||
| 763 | fmt = format_by_fourcc(dev, f->fmt.pix.pixelformat); | 763 | fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat); |
| 764 | if (NULL == fmt) | 764 | if (NULL == fmt) |
| 765 | return -EINVAL; | 765 | return -EINVAL; |
| 766 | 766 | ||
| @@ -1264,7 +1264,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
| 1264 | buf->fmt = &fh->video_fmt; | 1264 | buf->fmt = &fh->video_fmt; |
| 1265 | buf->vb.field = fh->video_fmt.field; | 1265 | buf->vb.field = fh->video_fmt.field; |
| 1266 | 1266 | ||
| 1267 | sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 1267 | sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
| 1268 | 1268 | ||
| 1269 | release_all_pagetables(dev, buf); | 1269 | release_all_pagetables(dev, buf); |
| 1270 | if( 0 != IS_PLANAR(sfmt->trans)) { | 1270 | if( 0 != IS_PLANAR(sfmt->trans)) { |
| @@ -1378,7 +1378,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file) | |||
| 1378 | fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; | 1378 | fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; |
| 1379 | fh->video_fmt.bytesperline = 0; | 1379 | fh->video_fmt.bytesperline = 0; |
| 1380 | fh->video_fmt.field = V4L2_FIELD_ANY; | 1380 | fh->video_fmt.field = V4L2_FIELD_ANY; |
| 1381 | sfmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 1381 | sfmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
| 1382 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; | 1382 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; |
| 1383 | 1383 | ||
| 1384 | videobuf_queue_sg_init(&fh->video_q, &video_qops, | 1384 | videobuf_queue_sg_init(&fh->video_q, &video_qops, |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index a529619e51f6..0902ec041c7a 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
| @@ -854,7 +854,6 @@ int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit) | |||
| 854 | xbits |= RESOURCE_VIDEO_READ | RESOURCE_VIDEO_STREAM; | 854 | xbits |= RESOURCE_VIDEO_READ | RESOURCE_VIDEO_STREAM; |
| 855 | 855 | ||
| 856 | /* is it free? */ | 856 | /* is it free? */ |
| 857 | mutex_lock(&btv->lock); | ||
| 858 | if (btv->resources & xbits) { | 857 | if (btv->resources & xbits) { |
| 859 | /* no, someone else uses it */ | 858 | /* no, someone else uses it */ |
| 860 | goto fail; | 859 | goto fail; |
| @@ -884,11 +883,9 @@ int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit) | |||
| 884 | /* it's free, grab it */ | 883 | /* it's free, grab it */ |
| 885 | fh->resources |= bit; | 884 | fh->resources |= bit; |
| 886 | btv->resources |= bit; | 885 | btv->resources |= bit; |
| 887 | mutex_unlock(&btv->lock); | ||
| 888 | return 1; | 886 | return 1; |
| 889 | 887 | ||
| 890 | fail: | 888 | fail: |
| 891 | mutex_unlock(&btv->lock); | ||
| 892 | return 0; | 889 | return 0; |
| 893 | } | 890 | } |
| 894 | 891 | ||
| @@ -940,7 +937,6 @@ void free_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bits) | |||
| 940 | /* trying to free ressources not allocated by us ... */ | 937 | /* trying to free ressources not allocated by us ... */ |
| 941 | printk("bttv: BUG! (btres)\n"); | 938 | printk("bttv: BUG! (btres)\n"); |
| 942 | } | 939 | } |
| 943 | mutex_lock(&btv->lock); | ||
| 944 | fh->resources &= ~bits; | 940 | fh->resources &= ~bits; |
| 945 | btv->resources &= ~bits; | 941 | btv->resources &= ~bits; |
| 946 | 942 | ||
| @@ -951,8 +947,6 @@ void free_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bits) | |||
| 951 | 947 | ||
| 952 | if (0 == (bits & VBI_RESOURCES)) | 948 | if (0 == (bits & VBI_RESOURCES)) |
| 953 | disclaim_vbi_lines(btv); | 949 | disclaim_vbi_lines(btv); |
| 954 | |||
| 955 | mutex_unlock(&btv->lock); | ||
| 956 | } | 950 | } |
| 957 | 951 | ||
| 958 | /* ----------------------------------------------------------------------- */ | 952 | /* ----------------------------------------------------------------------- */ |
| @@ -1713,28 +1707,20 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, | |||
| 1713 | 1707 | ||
| 1714 | /* Make sure tvnorm and vbi_end remain consistent | 1708 | /* Make sure tvnorm and vbi_end remain consistent |
| 1715 | until we're done. */ | 1709 | until we're done. */ |
| 1716 | mutex_lock(&btv->lock); | ||
| 1717 | 1710 | ||
| 1718 | norm = btv->tvnorm; | 1711 | norm = btv->tvnorm; |
| 1719 | 1712 | ||
| 1720 | /* In this mode capturing always starts at defrect.top | 1713 | /* In this mode capturing always starts at defrect.top |
| 1721 | (default VDELAY), ignoring cropping parameters. */ | 1714 | (default VDELAY), ignoring cropping parameters. */ |
| 1722 | if (btv->vbi_end > bttv_tvnorms[norm].cropcap.defrect.top) { | 1715 | if (btv->vbi_end > bttv_tvnorms[norm].cropcap.defrect.top) { |
| 1723 | mutex_unlock(&btv->lock); | ||
| 1724 | return -EINVAL; | 1716 | return -EINVAL; |
| 1725 | } | 1717 | } |
| 1726 | 1718 | ||
| 1727 | mutex_unlock(&btv->lock); | ||
| 1728 | |||
| 1729 | c.rect = bttv_tvnorms[norm].cropcap.defrect; | 1719 | c.rect = bttv_tvnorms[norm].cropcap.defrect; |
| 1730 | } else { | 1720 | } else { |
| 1731 | mutex_lock(&btv->lock); | ||
| 1732 | |||
| 1733 | norm = btv->tvnorm; | 1721 | norm = btv->tvnorm; |
| 1734 | c = btv->crop[!!fh->do_crop]; | 1722 | c = btv->crop[!!fh->do_crop]; |
| 1735 | 1723 | ||
| 1736 | mutex_unlock(&btv->lock); | ||
| 1737 | |||
| 1738 | if (width < c.min_scaled_width || | 1724 | if (width < c.min_scaled_width || |
| 1739 | width > c.max_scaled_width || | 1725 | width > c.max_scaled_width || |
| 1740 | height < c.min_scaled_height) | 1726 | height < c.min_scaled_height) |
| @@ -1858,7 +1844,6 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
| 1858 | unsigned int i; | 1844 | unsigned int i; |
| 1859 | int err; | 1845 | int err; |
| 1860 | 1846 | ||
| 1861 | mutex_lock(&btv->lock); | ||
| 1862 | err = v4l2_prio_check(&btv->prio, fh->prio); | 1847 | err = v4l2_prio_check(&btv->prio, fh->prio); |
| 1863 | if (err) | 1848 | if (err) |
| 1864 | goto err; | 1849 | goto err; |
| @@ -1874,7 +1859,6 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
| 1874 | set_tvnorm(btv, i); | 1859 | set_tvnorm(btv, i); |
| 1875 | 1860 | ||
| 1876 | err: | 1861 | err: |
| 1877 | mutex_unlock(&btv->lock); | ||
| 1878 | 1862 | ||
| 1879 | return err; | 1863 | return err; |
| 1880 | } | 1864 | } |
| @@ -1898,7 +1882,6 @@ static int bttv_enum_input(struct file *file, void *priv, | |||
| 1898 | struct bttv *btv = fh->btv; | 1882 | struct bttv *btv = fh->btv; |
| 1899 | int rc = 0; | 1883 | int rc = 0; |
| 1900 | 1884 | ||
| 1901 | mutex_lock(&btv->lock); | ||
| 1902 | if (i->index >= bttv_tvcards[btv->c.type].video_inputs) { | 1885 | if (i->index >= bttv_tvcards[btv->c.type].video_inputs) { |
| 1903 | rc = -EINVAL; | 1886 | rc = -EINVAL; |
| 1904 | goto err; | 1887 | goto err; |
| @@ -1928,7 +1911,6 @@ static int bttv_enum_input(struct file *file, void *priv, | |||
| 1928 | i->std = BTTV_NORMS; | 1911 | i->std = BTTV_NORMS; |
| 1929 | 1912 | ||
| 1930 | err: | 1913 | err: |
| 1931 | mutex_unlock(&btv->lock); | ||
| 1932 | 1914 | ||
| 1933 | return rc; | 1915 | return rc; |
| 1934 | } | 1916 | } |
| @@ -1938,9 +1920,7 @@ static int bttv_g_input(struct file *file, void *priv, unsigned int *i) | |||
| 1938 | struct bttv_fh *fh = priv; | 1920 | struct bttv_fh *fh = priv; |
| 1939 | struct bttv *btv = fh->btv; | 1921 | struct bttv *btv = fh->btv; |
| 1940 | 1922 | ||
| 1941 | mutex_lock(&btv->lock); | ||
| 1942 | *i = btv->input; | 1923 | *i = btv->input; |
| 1943 | mutex_unlock(&btv->lock); | ||
| 1944 | 1924 | ||
| 1945 | return 0; | 1925 | return 0; |
| 1946 | } | 1926 | } |
| @@ -1952,7 +1932,6 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i) | |||
| 1952 | 1932 | ||
| 1953 | int err; | 1933 | int err; |
| 1954 | 1934 | ||
| 1955 | mutex_lock(&btv->lock); | ||
| 1956 | err = v4l2_prio_check(&btv->prio, fh->prio); | 1935 | err = v4l2_prio_check(&btv->prio, fh->prio); |
| 1957 | if (unlikely(err)) | 1936 | if (unlikely(err)) |
| 1958 | goto err; | 1937 | goto err; |
| @@ -1965,7 +1944,6 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i) | |||
| 1965 | set_input(btv, i, btv->tvnorm); | 1944 | set_input(btv, i, btv->tvnorm); |
| 1966 | 1945 | ||
| 1967 | err: | 1946 | err: |
| 1968 | mutex_unlock(&btv->lock); | ||
| 1969 | return 0; | 1947 | return 0; |
| 1970 | } | 1948 | } |
| 1971 | 1949 | ||
| @@ -1979,7 +1957,6 @@ static int bttv_s_tuner(struct file *file, void *priv, | |||
| 1979 | if (unlikely(0 != t->index)) | 1957 | if (unlikely(0 != t->index)) |
| 1980 | return -EINVAL; | 1958 | return -EINVAL; |
| 1981 | 1959 | ||
| 1982 | mutex_lock(&btv->lock); | ||
| 1983 | if (unlikely(btv->tuner_type == TUNER_ABSENT)) { | 1960 | if (unlikely(btv->tuner_type == TUNER_ABSENT)) { |
| 1984 | err = -EINVAL; | 1961 | err = -EINVAL; |
| 1985 | goto err; | 1962 | goto err; |
| @@ -1995,7 +1972,6 @@ static int bttv_s_tuner(struct file *file, void *priv, | |||
| 1995 | btv->audio_mode_gpio(btv, t, 1); | 1972 | btv->audio_mode_gpio(btv, t, 1); |
| 1996 | 1973 | ||
| 1997 | err: | 1974 | err: |
| 1998 | mutex_unlock(&btv->lock); | ||
| 1999 | 1975 | ||
| 2000 | return 0; | 1976 | return 0; |
| 2001 | } | 1977 | } |
| @@ -2006,10 +1982,8 @@ static int bttv_g_frequency(struct file *file, void *priv, | |||
| 2006 | struct bttv_fh *fh = priv; | 1982 | struct bttv_fh *fh = priv; |
| 2007 | struct bttv *btv = fh->btv; | 1983 | struct bttv *btv = fh->btv; |
| 2008 | 1984 | ||
| 2009 | mutex_lock(&btv->lock); | ||
| 2010 | f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; | 1985 | f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; |
| 2011 | f->frequency = btv->freq; | 1986 | f->frequency = btv->freq; |
| 2012 | mutex_unlock(&btv->lock); | ||
| 2013 | 1987 | ||
| 2014 | return 0; | 1988 | return 0; |
| 2015 | } | 1989 | } |
| @@ -2024,7 +1998,6 @@ static int bttv_s_frequency(struct file *file, void *priv, | |||
| 2024 | if (unlikely(f->tuner != 0)) | 1998 | if (unlikely(f->tuner != 0)) |
| 2025 | return -EINVAL; | 1999 | return -EINVAL; |
| 2026 | 2000 | ||
| 2027 | mutex_lock(&btv->lock); | ||
| 2028 | err = v4l2_prio_check(&btv->prio, fh->prio); | 2001 | err = v4l2_prio_check(&btv->prio, fh->prio); |
| 2029 | if (unlikely(err)) | 2002 | if (unlikely(err)) |
| 2030 | goto err; | 2003 | goto err; |
| @@ -2039,7 +2012,6 @@ static int bttv_s_frequency(struct file *file, void *priv, | |||
| 2039 | if (btv->has_matchbox && btv->radio_user) | 2012 | if (btv->has_matchbox && btv->radio_user) |
| 2040 | tea5757_set_freq(btv, btv->freq); | 2013 | tea5757_set_freq(btv, btv->freq); |
| 2041 | err: | 2014 | err: |
| 2042 | mutex_unlock(&btv->lock); | ||
| 2043 | 2015 | ||
| 2044 | return 0; | 2016 | return 0; |
| 2045 | } | 2017 | } |
| @@ -2172,7 +2144,6 @@ limit_scaled_size_lock (struct bttv_fh * fh, | |||
| 2172 | 2144 | ||
| 2173 | /* Make sure tvnorm, vbi_end and the current cropping parameters | 2145 | /* Make sure tvnorm, vbi_end and the current cropping parameters |
| 2174 | remain consistent until we're done. */ | 2146 | remain consistent until we're done. */ |
| 2175 | mutex_lock(&btv->lock); | ||
| 2176 | 2147 | ||
| 2177 | b = &bttv_tvnorms[btv->tvnorm].cropcap.bounds; | 2148 | b = &bttv_tvnorms[btv->tvnorm].cropcap.bounds; |
| 2178 | 2149 | ||
| @@ -2250,7 +2221,6 @@ limit_scaled_size_lock (struct bttv_fh * fh, | |||
| 2250 | rc = 0; /* success */ | 2221 | rc = 0; /* success */ |
| 2251 | 2222 | ||
| 2252 | fail: | 2223 | fail: |
| 2253 | mutex_unlock(&btv->lock); | ||
| 2254 | 2224 | ||
| 2255 | return rc; | 2225 | return rc; |
| 2256 | } | 2226 | } |
| @@ -2282,9 +2252,7 @@ verify_window_lock (struct bttv_fh * fh, | |||
| 2282 | if (V4L2_FIELD_ANY == field) { | 2252 | if (V4L2_FIELD_ANY == field) { |
| 2283 | __s32 height2; | 2253 | __s32 height2; |
| 2284 | 2254 | ||
| 2285 | mutex_lock(&fh->btv->lock); | ||
| 2286 | height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1; | 2255 | height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1; |
| 2287 | mutex_unlock(&fh->btv->lock); | ||
| 2288 | field = (win->w.height > height2) | 2256 | field = (win->w.height > height2) |
| 2289 | ? V4L2_FIELD_INTERLACED | 2257 | ? V4L2_FIELD_INTERLACED |
| 2290 | : V4L2_FIELD_TOP; | 2258 | : V4L2_FIELD_TOP; |
| @@ -2360,7 +2328,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, | |||
| 2360 | } | 2328 | } |
| 2361 | } | 2329 | } |
| 2362 | 2330 | ||
| 2363 | mutex_lock(&fh->cap.vb_lock); | ||
| 2364 | /* clip against screen */ | 2331 | /* clip against screen */ |
| 2365 | if (NULL != btv->fbuf.base) | 2332 | if (NULL != btv->fbuf.base) |
| 2366 | n = btcx_screen_clips(btv->fbuf.fmt.width, btv->fbuf.fmt.height, | 2333 | n = btcx_screen_clips(btv->fbuf.fmt.width, btv->fbuf.fmt.height, |
| @@ -2391,13 +2358,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, | |||
| 2391 | fh->ov.field = win->field; | 2358 | fh->ov.field = win->field; |
| 2392 | fh->ov.setup_ok = 1; | 2359 | fh->ov.setup_ok = 1; |
| 2393 | 2360 | ||
| 2394 | /* | ||
| 2395 | * FIXME: btv is protected by btv->lock mutex, while btv->init | ||
| 2396 | * is protected by fh->cap.vb_lock. This seems to open the | ||
| 2397 | * possibility for some race situations. Maybe the better would | ||
| 2398 | * be to unify those locks or to use another way to store the | ||
| 2399 | * init values that will be consumed by videobuf callbacks | ||
| 2400 | */ | ||
| 2401 | btv->init.ov.w.width = win->w.width; | 2361 | btv->init.ov.w.width = win->w.width; |
| 2402 | btv->init.ov.w.height = win->w.height; | 2362 | btv->init.ov.w.height = win->w.height; |
| 2403 | btv->init.ov.field = win->field; | 2363 | btv->init.ov.field = win->field; |
| @@ -2412,7 +2372,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, | |||
| 2412 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2372 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
| 2413 | retval = bttv_switch_overlay(btv,fh,new); | 2373 | retval = bttv_switch_overlay(btv,fh,new); |
| 2414 | } | 2374 | } |
| 2415 | mutex_unlock(&fh->cap.vb_lock); | ||
| 2416 | return retval; | 2375 | return retval; |
| 2417 | } | 2376 | } |
| 2418 | 2377 | ||
| @@ -2526,9 +2485,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv, | |||
| 2526 | if (V4L2_FIELD_ANY == field) { | 2485 | if (V4L2_FIELD_ANY == field) { |
| 2527 | __s32 height2; | 2486 | __s32 height2; |
| 2528 | 2487 | ||
| 2529 | mutex_lock(&btv->lock); | ||
| 2530 | height2 = btv->crop[!!fh->do_crop].rect.height >> 1; | 2488 | height2 = btv->crop[!!fh->do_crop].rect.height >> 1; |
| 2531 | mutex_unlock(&btv->lock); | ||
| 2532 | field = (f->fmt.pix.height > height2) | 2489 | field = (f->fmt.pix.height > height2) |
| 2533 | ? V4L2_FIELD_INTERLACED | 2490 | ? V4L2_FIELD_INTERLACED |
| 2534 | : V4L2_FIELD_BOTTOM; | 2491 | : V4L2_FIELD_BOTTOM; |
| @@ -2614,7 +2571,6 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv, | |||
| 2614 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 2571 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); |
| 2615 | 2572 | ||
| 2616 | /* update our state informations */ | 2573 | /* update our state informations */ |
| 2617 | mutex_lock(&fh->cap.vb_lock); | ||
| 2618 | fh->fmt = fmt; | 2574 | fh->fmt = fmt; |
| 2619 | fh->cap.field = f->fmt.pix.field; | 2575 | fh->cap.field = f->fmt.pix.field; |
| 2620 | fh->cap.last = V4L2_FIELD_NONE; | 2576 | fh->cap.last = V4L2_FIELD_NONE; |
| @@ -2623,7 +2579,6 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv, | |||
| 2623 | btv->init.fmt = fmt; | 2579 | btv->init.fmt = fmt; |
| 2624 | btv->init.width = f->fmt.pix.width; | 2580 | btv->init.width = f->fmt.pix.width; |
| 2625 | btv->init.height = f->fmt.pix.height; | 2581 | btv->init.height = f->fmt.pix.height; |
| 2626 | mutex_unlock(&fh->cap.vb_lock); | ||
| 2627 | 2582 | ||
| 2628 | return 0; | 2583 | return 0; |
| 2629 | } | 2584 | } |
| @@ -2649,11 +2604,9 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
| 2649 | unsigned int i; | 2604 | unsigned int i; |
| 2650 | struct bttv_fh *fh = priv; | 2605 | struct bttv_fh *fh = priv; |
| 2651 | 2606 | ||
| 2652 | mutex_lock(&fh->cap.vb_lock); | ||
| 2653 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, | 2607 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, |
| 2654 | V4L2_MEMORY_MMAP); | 2608 | V4L2_MEMORY_MMAP); |
| 2655 | if (retval < 0) { | 2609 | if (retval < 0) { |
| 2656 | mutex_unlock(&fh->cap.vb_lock); | ||
| 2657 | return retval; | 2610 | return retval; |
| 2658 | } | 2611 | } |
| 2659 | 2612 | ||
| @@ -2665,7 +2618,6 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
| 2665 | for (i = 0; i < gbuffers; i++) | 2618 | for (i = 0; i < gbuffers; i++) |
| 2666 | mbuf->offsets[i] = i * gbufsize; | 2619 | mbuf->offsets[i] = i * gbufsize; |
| 2667 | 2620 | ||
| 2668 | mutex_unlock(&fh->cap.vb_lock); | ||
| 2669 | return 0; | 2621 | return 0; |
| 2670 | } | 2622 | } |
| 2671 | #endif | 2623 | #endif |
| @@ -2775,10 +2727,8 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
| 2775 | int retval = 0; | 2727 | int retval = 0; |
| 2776 | 2728 | ||
| 2777 | if (on) { | 2729 | if (on) { |
| 2778 | mutex_lock(&fh->cap.vb_lock); | ||
| 2779 | /* verify args */ | 2730 | /* verify args */ |
| 2780 | if (unlikely(!btv->fbuf.base)) { | 2731 | if (unlikely(!btv->fbuf.base)) { |
| 2781 | mutex_unlock(&fh->cap.vb_lock); | ||
| 2782 | return -EINVAL; | 2732 | return -EINVAL; |
| 2783 | } | 2733 | } |
| 2784 | if (unlikely(!fh->ov.setup_ok)) { | 2734 | if (unlikely(!fh->ov.setup_ok)) { |
| @@ -2787,13 +2737,11 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
| 2787 | } | 2737 | } |
| 2788 | if (retval) | 2738 | if (retval) |
| 2789 | return retval; | 2739 | return retval; |
| 2790 | mutex_unlock(&fh->cap.vb_lock); | ||
| 2791 | } | 2740 | } |
| 2792 | 2741 | ||
| 2793 | if (!check_alloc_btres_lock(btv, fh, RESOURCE_OVERLAY)) | 2742 | if (!check_alloc_btres_lock(btv, fh, RESOURCE_OVERLAY)) |
| 2794 | return -EBUSY; | 2743 | return -EBUSY; |
| 2795 | 2744 | ||
| 2796 | mutex_lock(&fh->cap.vb_lock); | ||
| 2797 | if (on) { | 2745 | if (on) { |
| 2798 | fh->ov.tvnorm = btv->tvnorm; | 2746 | fh->ov.tvnorm = btv->tvnorm; |
| 2799 | new = videobuf_sg_alloc(sizeof(*new)); | 2747 | new = videobuf_sg_alloc(sizeof(*new)); |
| @@ -2805,7 +2753,6 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
| 2805 | 2753 | ||
| 2806 | /* switch over */ | 2754 | /* switch over */ |
| 2807 | retval = bttv_switch_overlay(btv, fh, new); | 2755 | retval = bttv_switch_overlay(btv, fh, new); |
| 2808 | mutex_unlock(&fh->cap.vb_lock); | ||
| 2809 | return retval; | 2756 | return retval; |
| 2810 | } | 2757 | } |
| 2811 | 2758 | ||
| @@ -2844,7 +2791,6 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
| 2844 | } | 2791 | } |
| 2845 | 2792 | ||
| 2846 | /* ok, accept it */ | 2793 | /* ok, accept it */ |
| 2847 | mutex_lock(&fh->cap.vb_lock); | ||
| 2848 | btv->fbuf.base = fb->base; | 2794 | btv->fbuf.base = fb->base; |
| 2849 | btv->fbuf.fmt.width = fb->fmt.width; | 2795 | btv->fbuf.fmt.width = fb->fmt.width; |
| 2850 | btv->fbuf.fmt.height = fb->fmt.height; | 2796 | btv->fbuf.fmt.height = fb->fmt.height; |
| @@ -2876,7 +2822,6 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
| 2876 | retval = bttv_switch_overlay(btv, fh, new); | 2822 | retval = bttv_switch_overlay(btv, fh, new); |
| 2877 | } | 2823 | } |
| 2878 | } | 2824 | } |
| 2879 | mutex_unlock(&fh->cap.vb_lock); | ||
| 2880 | return retval; | 2825 | return retval; |
| 2881 | } | 2826 | } |
| 2882 | 2827 | ||
| @@ -2955,7 +2900,6 @@ static int bttv_queryctrl(struct file *file, void *priv, | |||
| 2955 | c->id >= V4L2_CID_PRIVATE_LASTP1)) | 2900 | c->id >= V4L2_CID_PRIVATE_LASTP1)) |
| 2956 | return -EINVAL; | 2901 | return -EINVAL; |
| 2957 | 2902 | ||
| 2958 | mutex_lock(&btv->lock); | ||
| 2959 | if (!btv->volume_gpio && (c->id == V4L2_CID_AUDIO_VOLUME)) | 2903 | if (!btv->volume_gpio && (c->id == V4L2_CID_AUDIO_VOLUME)) |
| 2960 | *c = no_ctl; | 2904 | *c = no_ctl; |
| 2961 | else { | 2905 | else { |
| @@ -2963,7 +2907,6 @@ static int bttv_queryctrl(struct file *file, void *priv, | |||
| 2963 | 2907 | ||
| 2964 | *c = (NULL != ctrl) ? *ctrl : no_ctl; | 2908 | *c = (NULL != ctrl) ? *ctrl : no_ctl; |
| 2965 | } | 2909 | } |
| 2966 | mutex_unlock(&btv->lock); | ||
| 2967 | 2910 | ||
| 2968 | return 0; | 2911 | return 0; |
| 2969 | } | 2912 | } |
| @@ -2974,10 +2917,8 @@ static int bttv_g_parm(struct file *file, void *f, | |||
| 2974 | struct bttv_fh *fh = f; | 2917 | struct bttv_fh *fh = f; |
| 2975 | struct bttv *btv = fh->btv; | 2918 | struct bttv *btv = fh->btv; |
| 2976 | 2919 | ||
| 2977 | mutex_lock(&btv->lock); | ||
| 2978 | v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id, | 2920 | v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id, |
| 2979 | &parm->parm.capture.timeperframe); | 2921 | &parm->parm.capture.timeperframe); |
| 2980 | mutex_unlock(&btv->lock); | ||
| 2981 | 2922 | ||
| 2982 | return 0; | 2923 | return 0; |
| 2983 | } | 2924 | } |
| @@ -2993,7 +2934,6 @@ static int bttv_g_tuner(struct file *file, void *priv, | |||
| 2993 | if (0 != t->index) | 2934 | if (0 != t->index) |
| 2994 | return -EINVAL; | 2935 | return -EINVAL; |
| 2995 | 2936 | ||
| 2996 | mutex_lock(&btv->lock); | ||
| 2997 | t->rxsubchans = V4L2_TUNER_SUB_MONO; | 2937 | t->rxsubchans = V4L2_TUNER_SUB_MONO; |
| 2998 | bttv_call_all(btv, tuner, g_tuner, t); | 2938 | bttv_call_all(btv, tuner, g_tuner, t); |
| 2999 | strcpy(t->name, "Television"); | 2939 | strcpy(t->name, "Television"); |
| @@ -3005,7 +2945,6 @@ static int bttv_g_tuner(struct file *file, void *priv, | |||
| 3005 | if (btv->audio_mode_gpio) | 2945 | if (btv->audio_mode_gpio) |
| 3006 | btv->audio_mode_gpio(btv, t, 0); | 2946 | btv->audio_mode_gpio(btv, t, 0); |
| 3007 | 2947 | ||
| 3008 | mutex_unlock(&btv->lock); | ||
| 3009 | return 0; | 2948 | return 0; |
| 3010 | } | 2949 | } |
| 3011 | 2950 | ||
| @@ -3014,9 +2953,7 @@ static int bttv_g_priority(struct file *file, void *f, enum v4l2_priority *p) | |||
| 3014 | struct bttv_fh *fh = f; | 2953 | struct bttv_fh *fh = f; |
| 3015 | struct bttv *btv = fh->btv; | 2954 | struct bttv *btv = fh->btv; |
| 3016 | 2955 | ||
| 3017 | mutex_lock(&btv->lock); | ||
| 3018 | *p = v4l2_prio_max(&btv->prio); | 2956 | *p = v4l2_prio_max(&btv->prio); |
| 3019 | mutex_unlock(&btv->lock); | ||
| 3020 | 2957 | ||
| 3021 | return 0; | 2958 | return 0; |
| 3022 | } | 2959 | } |
| @@ -3028,9 +2965,7 @@ static int bttv_s_priority(struct file *file, void *f, | |||
| 3028 | struct bttv *btv = fh->btv; | 2965 | struct bttv *btv = fh->btv; |
| 3029 | int rc; | 2966 | int rc; |
| 3030 | 2967 | ||
| 3031 | mutex_lock(&btv->lock); | ||
| 3032 | rc = v4l2_prio_change(&btv->prio, &fh->prio, prio); | 2968 | rc = v4l2_prio_change(&btv->prio, &fh->prio, prio); |
| 3033 | mutex_unlock(&btv->lock); | ||
| 3034 | 2969 | ||
| 3035 | return rc; | 2970 | return rc; |
| 3036 | } | 2971 | } |
| @@ -3045,9 +2980,7 @@ static int bttv_cropcap(struct file *file, void *priv, | |||
| 3045 | cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) | 2980 | cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) |
| 3046 | return -EINVAL; | 2981 | return -EINVAL; |
| 3047 | 2982 | ||
| 3048 | mutex_lock(&btv->lock); | ||
| 3049 | *cap = bttv_tvnorms[btv->tvnorm].cropcap; | 2983 | *cap = bttv_tvnorms[btv->tvnorm].cropcap; |
| 3050 | mutex_unlock(&btv->lock); | ||
| 3051 | 2984 | ||
| 3052 | return 0; | 2985 | return 0; |
| 3053 | } | 2986 | } |
| @@ -3065,9 +2998,7 @@ static int bttv_g_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
| 3065 | inconsistent with fh->width or fh->height and apps | 2998 | inconsistent with fh->width or fh->height and apps |
| 3066 | do not expect a change here. */ | 2999 | do not expect a change here. */ |
| 3067 | 3000 | ||
| 3068 | mutex_lock(&btv->lock); | ||
| 3069 | crop->c = btv->crop[!!fh->do_crop].rect; | 3001 | crop->c = btv->crop[!!fh->do_crop].rect; |
| 3070 | mutex_unlock(&btv->lock); | ||
| 3071 | 3002 | ||
| 3072 | return 0; | 3003 | return 0; |
| 3073 | } | 3004 | } |
| @@ -3091,17 +3022,14 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
| 3091 | /* Make sure tvnorm, vbi_end and the current cropping | 3022 | /* Make sure tvnorm, vbi_end and the current cropping |
| 3092 | parameters remain consistent until we're done. Note | 3023 | parameters remain consistent until we're done. Note |
| 3093 | read() may change vbi_end in check_alloc_btres_lock(). */ | 3024 | read() may change vbi_end in check_alloc_btres_lock(). */ |
| 3094 | mutex_lock(&btv->lock); | ||
| 3095 | retval = v4l2_prio_check(&btv->prio, fh->prio); | 3025 | retval = v4l2_prio_check(&btv->prio, fh->prio); |
| 3096 | if (0 != retval) { | 3026 | if (0 != retval) { |
| 3097 | mutex_unlock(&btv->lock); | ||
| 3098 | return retval; | 3027 | return retval; |
| 3099 | } | 3028 | } |
| 3100 | 3029 | ||
| 3101 | retval = -EBUSY; | 3030 | retval = -EBUSY; |
| 3102 | 3031 | ||
| 3103 | if (locked_btres(fh->btv, VIDEO_RESOURCES)) { | 3032 | if (locked_btres(fh->btv, VIDEO_RESOURCES)) { |
| 3104 | mutex_unlock(&btv->lock); | ||
| 3105 | return retval; | 3033 | return retval; |
| 3106 | } | 3034 | } |
| 3107 | 3035 | ||
| @@ -3113,7 +3041,6 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
| 3113 | 3041 | ||
| 3114 | b_top = max(b->top, btv->vbi_end); | 3042 | b_top = max(b->top, btv->vbi_end); |
| 3115 | if (b_top + 32 >= b_bottom) { | 3043 | if (b_top + 32 >= b_bottom) { |
| 3116 | mutex_unlock(&btv->lock); | ||
| 3117 | return retval; | 3044 | return retval; |
| 3118 | } | 3045 | } |
| 3119 | 3046 | ||
| @@ -3136,12 +3063,8 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
| 3136 | 3063 | ||
| 3137 | btv->crop[1] = c; | 3064 | btv->crop[1] = c; |
| 3138 | 3065 | ||
| 3139 | mutex_unlock(&btv->lock); | ||
| 3140 | |||
| 3141 | fh->do_crop = 1; | 3066 | fh->do_crop = 1; |
| 3142 | 3067 | ||
| 3143 | mutex_lock(&fh->cap.vb_lock); | ||
| 3144 | |||
| 3145 | if (fh->width < c.min_scaled_width) { | 3068 | if (fh->width < c.min_scaled_width) { |
| 3146 | fh->width = c.min_scaled_width; | 3069 | fh->width = c.min_scaled_width; |
| 3147 | btv->init.width = c.min_scaled_width; | 3070 | btv->init.width = c.min_scaled_width; |
| @@ -3158,8 +3081,6 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
| 3158 | btv->init.height = c.max_scaled_height; | 3081 | btv->init.height = c.max_scaled_height; |
| 3159 | } | 3082 | } |
| 3160 | 3083 | ||
| 3161 | mutex_unlock(&fh->cap.vb_lock); | ||
| 3162 | |||
| 3163 | return 0; | 3084 | return 0; |
| 3164 | } | 3085 | } |
| 3165 | 3086 | ||
| @@ -3227,7 +3148,6 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
| 3227 | return videobuf_poll_stream(file, &fh->vbi, wait); | 3148 | return videobuf_poll_stream(file, &fh->vbi, wait); |
| 3228 | } | 3149 | } |
| 3229 | 3150 | ||
| 3230 | mutex_lock(&fh->cap.vb_lock); | ||
| 3231 | if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { | 3151 | if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { |
| 3232 | /* streaming capture */ | 3152 | /* streaming capture */ |
| 3233 | if (list_empty(&fh->cap.stream)) | 3153 | if (list_empty(&fh->cap.stream)) |
| @@ -3262,7 +3182,6 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
| 3262 | else | 3182 | else |
| 3263 | rc = 0; | 3183 | rc = 0; |
| 3264 | err: | 3184 | err: |
| 3265 | mutex_unlock(&fh->cap.vb_lock); | ||
| 3266 | return rc; | 3185 | return rc; |
| 3267 | } | 3186 | } |
| 3268 | 3187 | ||
| @@ -3293,23 +3212,11 @@ static int bttv_open(struct file *file) | |||
| 3293 | return -ENOMEM; | 3212 | return -ENOMEM; |
| 3294 | file->private_data = fh; | 3213 | file->private_data = fh; |
| 3295 | 3214 | ||
| 3296 | /* | ||
| 3297 | * btv is protected by btv->lock mutex, while btv->init and other | ||
| 3298 | * streaming vars are protected by fh->cap.vb_lock. We need to take | ||
| 3299 | * care of both locks to avoid troubles. However, vb_lock is used also | ||
| 3300 | * inside videobuf, without calling buf->lock. So, it is a very bad | ||
| 3301 | * idea to hold both locks at the same time. | ||
| 3302 | * Let's first copy btv->init at fh, holding cap.vb_lock, and then work | ||
| 3303 | * with the rest of init, holding btv->lock. | ||
| 3304 | */ | ||
| 3305 | mutex_lock(&fh->cap.vb_lock); | ||
| 3306 | *fh = btv->init; | 3215 | *fh = btv->init; |
| 3307 | mutex_unlock(&fh->cap.vb_lock); | ||
| 3308 | 3216 | ||
| 3309 | fh->type = type; | 3217 | fh->type = type; |
| 3310 | fh->ov.setup_ok = 0; | 3218 | fh->ov.setup_ok = 0; |
| 3311 | 3219 | ||
| 3312 | mutex_lock(&btv->lock); | ||
| 3313 | v4l2_prio_open(&btv->prio, &fh->prio); | 3220 | v4l2_prio_open(&btv->prio, &fh->prio); |
| 3314 | 3221 | ||
| 3315 | videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, | 3222 | videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, |
| @@ -3317,13 +3224,13 @@ static int bttv_open(struct file *file) | |||
| 3317 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 3224 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
| 3318 | V4L2_FIELD_INTERLACED, | 3225 | V4L2_FIELD_INTERLACED, |
| 3319 | sizeof(struct bttv_buffer), | 3226 | sizeof(struct bttv_buffer), |
| 3320 | fh, NULL); | 3227 | fh, &btv->lock); |
| 3321 | videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, | 3228 | videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, |
| 3322 | &btv->c.pci->dev, &btv->s_lock, | 3229 | &btv->c.pci->dev, &btv->s_lock, |
| 3323 | V4L2_BUF_TYPE_VBI_CAPTURE, | 3230 | V4L2_BUF_TYPE_VBI_CAPTURE, |
| 3324 | V4L2_FIELD_SEQ_TB, | 3231 | V4L2_FIELD_SEQ_TB, |
| 3325 | sizeof(struct bttv_buffer), | 3232 | sizeof(struct bttv_buffer), |
| 3326 | fh, NULL); | 3233 | fh, &btv->lock); |
| 3327 | set_tvnorm(btv,btv->tvnorm); | 3234 | set_tvnorm(btv,btv->tvnorm); |
| 3328 | set_input(btv, btv->input, btv->tvnorm); | 3235 | set_input(btv, btv->input, btv->tvnorm); |
| 3329 | 3236 | ||
| @@ -3346,7 +3253,6 @@ static int bttv_open(struct file *file) | |||
| 3346 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); | 3253 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); |
| 3347 | 3254 | ||
| 3348 | bttv_field_count(btv); | 3255 | bttv_field_count(btv); |
| 3349 | mutex_unlock(&btv->lock); | ||
| 3350 | return 0; | 3256 | return 0; |
| 3351 | } | 3257 | } |
| 3352 | 3258 | ||
| @@ -3355,7 +3261,6 @@ static int bttv_release(struct file *file) | |||
| 3355 | struct bttv_fh *fh = file->private_data; | 3261 | struct bttv_fh *fh = file->private_data; |
| 3356 | struct bttv *btv = fh->btv; | 3262 | struct bttv *btv = fh->btv; |
| 3357 | 3263 | ||
| 3358 | mutex_lock(&btv->lock); | ||
| 3359 | /* turn off overlay */ | 3264 | /* turn off overlay */ |
| 3360 | if (check_btres(fh, RESOURCE_OVERLAY)) | 3265 | if (check_btres(fh, RESOURCE_OVERLAY)) |
| 3361 | bttv_switch_overlay(btv,fh,NULL); | 3266 | bttv_switch_overlay(btv,fh,NULL); |
| @@ -3381,14 +3286,8 @@ static int bttv_release(struct file *file) | |||
| 3381 | 3286 | ||
| 3382 | /* free stuff */ | 3287 | /* free stuff */ |
| 3383 | 3288 | ||
| 3384 | /* | ||
| 3385 | * videobuf uses cap.vb_lock - we should avoid holding btv->lock, | ||
| 3386 | * otherwise we may have dead lock conditions | ||
| 3387 | */ | ||
| 3388 | mutex_unlock(&btv->lock); | ||
| 3389 | videobuf_mmap_free(&fh->cap); | 3289 | videobuf_mmap_free(&fh->cap); |
| 3390 | videobuf_mmap_free(&fh->vbi); | 3290 | videobuf_mmap_free(&fh->vbi); |
| 3391 | mutex_lock(&btv->lock); | ||
| 3392 | v4l2_prio_close(&btv->prio, fh->prio); | 3291 | v4l2_prio_close(&btv->prio, fh->prio); |
| 3393 | file->private_data = NULL; | 3292 | file->private_data = NULL; |
| 3394 | kfree(fh); | 3293 | kfree(fh); |
| @@ -3398,7 +3297,6 @@ static int bttv_release(struct file *file) | |||
| 3398 | 3297 | ||
| 3399 | if (!btv->users) | 3298 | if (!btv->users) |
| 3400 | audio_mute(btv, 1); | 3299 | audio_mute(btv, 1); |
| 3401 | mutex_unlock(&btv->lock); | ||
| 3402 | 3300 | ||
| 3403 | return 0; | 3301 | return 0; |
| 3404 | } | 3302 | } |
| @@ -3502,11 +3400,8 @@ static int radio_open(struct file *file) | |||
| 3502 | if (unlikely(!fh)) | 3400 | if (unlikely(!fh)) |
| 3503 | return -ENOMEM; | 3401 | return -ENOMEM; |
| 3504 | file->private_data = fh; | 3402 | file->private_data = fh; |
| 3505 | mutex_lock(&fh->cap.vb_lock); | ||
| 3506 | *fh = btv->init; | 3403 | *fh = btv->init; |
| 3507 | mutex_unlock(&fh->cap.vb_lock); | ||
| 3508 | 3404 | ||
| 3509 | mutex_lock(&btv->lock); | ||
| 3510 | v4l2_prio_open(&btv->prio, &fh->prio); | 3405 | v4l2_prio_open(&btv->prio, &fh->prio); |
| 3511 | 3406 | ||
| 3512 | btv->radio_user++; | 3407 | btv->radio_user++; |
| @@ -3514,7 +3409,6 @@ static int radio_open(struct file *file) | |||
| 3514 | bttv_call_all(btv, tuner, s_radio); | 3409 | bttv_call_all(btv, tuner, s_radio); |
| 3515 | audio_input(btv,TVAUDIO_INPUT_RADIO); | 3410 | audio_input(btv,TVAUDIO_INPUT_RADIO); |
| 3516 | 3411 | ||
| 3517 | mutex_unlock(&btv->lock); | ||
| 3518 | return 0; | 3412 | return 0; |
| 3519 | } | 3413 | } |
| 3520 | 3414 | ||
| @@ -3524,7 +3418,6 @@ static int radio_release(struct file *file) | |||
| 3524 | struct bttv *btv = fh->btv; | 3418 | struct bttv *btv = fh->btv; |
| 3525 | struct rds_command cmd; | 3419 | struct rds_command cmd; |
| 3526 | 3420 | ||
| 3527 | mutex_lock(&btv->lock); | ||
| 3528 | v4l2_prio_close(&btv->prio, fh->prio); | 3421 | v4l2_prio_close(&btv->prio, fh->prio); |
| 3529 | file->private_data = NULL; | 3422 | file->private_data = NULL; |
| 3530 | kfree(fh); | 3423 | kfree(fh); |
| @@ -3532,7 +3425,6 @@ static int radio_release(struct file *file) | |||
| 3532 | btv->radio_user--; | 3425 | btv->radio_user--; |
| 3533 | 3426 | ||
| 3534 | bttv_call_all(btv, core, ioctl, RDS_CMD_CLOSE, &cmd); | 3427 | bttv_call_all(btv, core, ioctl, RDS_CMD_CLOSE, &cmd); |
| 3535 | mutex_unlock(&btv->lock); | ||
| 3536 | 3428 | ||
| 3537 | return 0; | 3429 | return 0; |
| 3538 | } | 3430 | } |
| @@ -3561,7 +3453,6 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | |||
| 3561 | return -EINVAL; | 3453 | return -EINVAL; |
| 3562 | if (0 != t->index) | 3454 | if (0 != t->index) |
| 3563 | return -EINVAL; | 3455 | return -EINVAL; |
| 3564 | mutex_lock(&btv->lock); | ||
| 3565 | strcpy(t->name, "Radio"); | 3456 | strcpy(t->name, "Radio"); |
| 3566 | t->type = V4L2_TUNER_RADIO; | 3457 | t->type = V4L2_TUNER_RADIO; |
| 3567 | 3458 | ||
| @@ -3570,8 +3461,6 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | |||
| 3570 | if (btv->audio_mode_gpio) | 3461 | if (btv->audio_mode_gpio) |
| 3571 | btv->audio_mode_gpio(btv, t, 0); | 3462 | btv->audio_mode_gpio(btv, t, 0); |
| 3572 | 3463 | ||
| 3573 | mutex_unlock(&btv->lock); | ||
| 3574 | |||
| 3575 | return 0; | 3464 | return 0; |
| 3576 | } | 3465 | } |
| 3577 | 3466 | ||
| @@ -3692,7 +3581,7 @@ static const struct v4l2_file_operations radio_fops = | |||
| 3692 | .open = radio_open, | 3581 | .open = radio_open, |
| 3693 | .read = radio_read, | 3582 | .read = radio_read, |
| 3694 | .release = radio_release, | 3583 | .release = radio_release, |
| 3695 | .ioctl = video_ioctl2, | 3584 | .unlocked_ioctl = video_ioctl2, |
| 3696 | .poll = radio_poll, | 3585 | .poll = radio_poll, |
| 3697 | }; | 3586 | }; |
| 3698 | 3587 | ||
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 330dadc00106..e23de57e2c73 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
| @@ -63,7 +63,10 @@ struct sd { | |||
| 63 | #define QUALITY_DEF 80 | 63 | #define QUALITY_DEF 80 |
| 64 | u8 jpegqual; /* webcam quality */ | 64 | u8 jpegqual; /* webcam quality */ |
| 65 | 65 | ||
| 66 | u8 reg01; | ||
| 67 | u8 reg17; | ||
| 66 | u8 reg18; | 68 | u8 reg18; |
| 69 | u8 flags; | ||
| 67 | 70 | ||
| 68 | s8 ag_cnt; | 71 | s8 ag_cnt; |
| 69 | #define AG_CNT_START 13 | 72 | #define AG_CNT_START 13 |
| @@ -96,6 +99,22 @@ enum sensors { | |||
| 96 | SENSOR_SP80708, | 99 | SENSOR_SP80708, |
| 97 | }; | 100 | }; |
| 98 | 101 | ||
| 102 | /* device flags */ | ||
| 103 | #define PDN_INV 1 /* inverse pin S_PWR_DN / sn_xxx tables */ | ||
| 104 | |||
| 105 | /* sn9c1xx definitions */ | ||
| 106 | /* register 0x01 */ | ||
| 107 | #define S_PWR_DN 0x01 /* sensor power down */ | ||
| 108 | #define S_PDN_INV 0x02 /* inverse pin S_PWR_DN */ | ||
| 109 | #define V_TX_EN 0x04 /* video transfer enable */ | ||
| 110 | #define LED 0x08 /* output to pin LED */ | ||
| 111 | #define SCL_SEL_OD 0x20 /* open-drain mode */ | ||
| 112 | #define SYS_SEL_48M 0x40 /* system clock 0: 24MHz, 1: 48MHz */ | ||
| 113 | /* register 0x17 */ | ||
| 114 | #define MCK_SIZE_MASK 0x1f /* sensor master clock */ | ||
| 115 | #define SEN_CLK_EN 0x20 /* enable sensor clock */ | ||
| 116 | #define DEF_EN 0x80 /* defect pixel by 0: soft, 1: hard */ | ||
| 117 | |||
| 99 | /* V4L2 controls supported by the driver */ | 118 | /* V4L2 controls supported by the driver */ |
| 100 | static void setbrightness(struct gspca_dev *gspca_dev); | 119 | static void setbrightness(struct gspca_dev *gspca_dev); |
| 101 | static void setcontrast(struct gspca_dev *gspca_dev); | 120 | static void setcontrast(struct gspca_dev *gspca_dev); |
| @@ -1755,141 +1774,6 @@ static void po2030n_probe(struct gspca_dev *gspca_dev) | |||
| 1755 | } | 1774 | } |
| 1756 | } | 1775 | } |
| 1757 | 1776 | ||
| 1758 | static void bridge_init(struct gspca_dev *gspca_dev, | ||
| 1759 | const u8 *sn9c1xx) | ||
| 1760 | { | ||
| 1761 | struct sd *sd = (struct sd *) gspca_dev; | ||
| 1762 | u8 reg0102[2]; | ||
| 1763 | const u8 *reg9a; | ||
| 1764 | static const u8 reg9a_def[] = | ||
| 1765 | {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; | ||
| 1766 | static const u8 reg9a_spec[] = | ||
| 1767 | {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; | ||
| 1768 | static const u8 regd4[] = {0x60, 0x00, 0x00}; | ||
| 1769 | |||
| 1770 | /* sensor clock already enabled in sd_init */ | ||
| 1771 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ | ||
| 1772 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | ||
| 1773 | |||
| 1774 | /* configure gpio */ | ||
| 1775 | reg0102[0] = sn9c1xx[1]; | ||
| 1776 | reg0102[1] = sn9c1xx[2]; | ||
| 1777 | if (gspca_dev->audio) | ||
| 1778 | reg0102[1] |= 0x04; /* keep the audio connection */ | ||
| 1779 | reg_w(gspca_dev, 0x01, reg0102, 2); | ||
| 1780 | reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); | ||
| 1781 | reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); | ||
| 1782 | switch (sd->sensor) { | ||
| 1783 | case SENSOR_GC0307: | ||
| 1784 | case SENSOR_OV7660: | ||
| 1785 | case SENSOR_PO1030: | ||
| 1786 | case SENSOR_PO2030N: | ||
| 1787 | case SENSOR_SOI768: | ||
| 1788 | case SENSOR_SP80708: | ||
| 1789 | reg9a = reg9a_spec; | ||
| 1790 | break; | ||
| 1791 | default: | ||
| 1792 | reg9a = reg9a_def; | ||
| 1793 | break; | ||
| 1794 | } | ||
| 1795 | reg_w(gspca_dev, 0x9a, reg9a, 6); | ||
| 1796 | |||
| 1797 | reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); | ||
| 1798 | |||
| 1799 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); | ||
| 1800 | |||
| 1801 | switch (sd->sensor) { | ||
| 1802 | case SENSOR_ADCM1700: | ||
| 1803 | reg_w1(gspca_dev, 0x01, 0x43); | ||
| 1804 | reg_w1(gspca_dev, 0x17, 0x62); | ||
| 1805 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 1806 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 1807 | break; | ||
| 1808 | case SENSOR_GC0307: | ||
| 1809 | msleep(50); | ||
| 1810 | reg_w1(gspca_dev, 0x01, 0x61); | ||
| 1811 | reg_w1(gspca_dev, 0x17, 0x22); | ||
| 1812 | reg_w1(gspca_dev, 0x01, 0x60); | ||
| 1813 | reg_w1(gspca_dev, 0x01, 0x40); | ||
| 1814 | msleep(50); | ||
| 1815 | break; | ||
| 1816 | case SENSOR_MI0360B: | ||
| 1817 | reg_w1(gspca_dev, 0x01, 0x61); | ||
| 1818 | reg_w1(gspca_dev, 0x17, 0x60); | ||
| 1819 | reg_w1(gspca_dev, 0x01, 0x60); | ||
| 1820 | reg_w1(gspca_dev, 0x01, 0x40); | ||
| 1821 | break; | ||
| 1822 | case SENSOR_MT9V111: | ||
| 1823 | reg_w1(gspca_dev, 0x01, 0x61); | ||
| 1824 | reg_w1(gspca_dev, 0x17, 0x61); | ||
| 1825 | reg_w1(gspca_dev, 0x01, 0x60); | ||
| 1826 | reg_w1(gspca_dev, 0x01, 0x40); | ||
| 1827 | break; | ||
| 1828 | case SENSOR_OM6802: | ||
| 1829 | msleep(10); | ||
| 1830 | reg_w1(gspca_dev, 0x02, 0x73); | ||
| 1831 | reg_w1(gspca_dev, 0x17, 0x60); | ||
| 1832 | reg_w1(gspca_dev, 0x01, 0x22); | ||
| 1833 | msleep(100); | ||
| 1834 | reg_w1(gspca_dev, 0x01, 0x62); | ||
| 1835 | reg_w1(gspca_dev, 0x17, 0x64); | ||
| 1836 | reg_w1(gspca_dev, 0x17, 0x64); | ||
| 1837 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 1838 | msleep(10); | ||
| 1839 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 1840 | i2c_w8(gspca_dev, om6802_init0[0]); | ||
| 1841 | i2c_w8(gspca_dev, om6802_init0[1]); | ||
| 1842 | msleep(15); | ||
| 1843 | reg_w1(gspca_dev, 0x02, 0x71); | ||
| 1844 | msleep(150); | ||
| 1845 | break; | ||
| 1846 | case SENSOR_OV7630: | ||
| 1847 | reg_w1(gspca_dev, 0x01, 0x61); | ||
| 1848 | reg_w1(gspca_dev, 0x17, 0xe2); | ||
| 1849 | reg_w1(gspca_dev, 0x01, 0x60); | ||
| 1850 | reg_w1(gspca_dev, 0x01, 0x40); | ||
| 1851 | break; | ||
| 1852 | case SENSOR_OV7648: | ||
| 1853 | reg_w1(gspca_dev, 0x01, 0x63); | ||
| 1854 | reg_w1(gspca_dev, 0x17, 0x20); | ||
| 1855 | reg_w1(gspca_dev, 0x01, 0x62); | ||
| 1856 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 1857 | break; | ||
| 1858 | case SENSOR_PO1030: | ||
| 1859 | case SENSOR_SOI768: | ||
| 1860 | reg_w1(gspca_dev, 0x01, 0x61); | ||
| 1861 | reg_w1(gspca_dev, 0x17, 0x20); | ||
| 1862 | reg_w1(gspca_dev, 0x01, 0x60); | ||
| 1863 | reg_w1(gspca_dev, 0x01, 0x40); | ||
| 1864 | break; | ||
| 1865 | case SENSOR_PO2030N: | ||
| 1866 | case SENSOR_OV7660: | ||
| 1867 | reg_w1(gspca_dev, 0x01, 0x63); | ||
| 1868 | reg_w1(gspca_dev, 0x17, 0x20); | ||
| 1869 | reg_w1(gspca_dev, 0x01, 0x62); | ||
| 1870 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 1871 | break; | ||
| 1872 | case SENSOR_SP80708: | ||
| 1873 | reg_w1(gspca_dev, 0x01, 0x63); | ||
| 1874 | reg_w1(gspca_dev, 0x17, 0x20); | ||
| 1875 | reg_w1(gspca_dev, 0x01, 0x62); | ||
| 1876 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 1877 | msleep(100); | ||
| 1878 | reg_w1(gspca_dev, 0x02, 0x62); | ||
| 1879 | break; | ||
| 1880 | default: | ||
| 1881 | /* case SENSOR_HV7131R: */ | ||
| 1882 | /* case SENSOR_MI0360: */ | ||
| 1883 | /* case SENSOR_MO4000: */ | ||
| 1884 | reg_w1(gspca_dev, 0x01, 0x43); | ||
| 1885 | reg_w1(gspca_dev, 0x17, 0x61); | ||
| 1886 | reg_w1(gspca_dev, 0x01, 0x42); | ||
| 1887 | if (sd->sensor == SENSOR_HV7131R) | ||
| 1888 | hv7131r_probe(gspca_dev); | ||
| 1889 | break; | ||
| 1890 | } | ||
| 1891 | } | ||
| 1892 | |||
| 1893 | /* this function is called at probe time */ | 1777 | /* this function is called at probe time */ |
| 1894 | static int sd_config(struct gspca_dev *gspca_dev, | 1778 | static int sd_config(struct gspca_dev *gspca_dev, |
| 1895 | const struct usb_device_id *id) | 1779 | const struct usb_device_id *id) |
| @@ -1898,7 +1782,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
| 1898 | struct cam *cam; | 1782 | struct cam *cam; |
| 1899 | 1783 | ||
| 1900 | sd->bridge = id->driver_info >> 16; | 1784 | sd->bridge = id->driver_info >> 16; |
| 1901 | sd->sensor = id->driver_info; | 1785 | sd->sensor = id->driver_info >> 8; |
| 1786 | sd->flags = id->driver_info; | ||
| 1902 | 1787 | ||
| 1903 | cam = &gspca_dev->cam; | 1788 | cam = &gspca_dev->cam; |
| 1904 | if (sd->sensor == SENSOR_ADCM1700) { | 1789 | if (sd->sensor == SENSOR_ADCM1700) { |
| @@ -1929,7 +1814,7 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
| 1929 | /* setup a selector by bridge */ | 1814 | /* setup a selector by bridge */ |
| 1930 | reg_w1(gspca_dev, 0xf1, 0x01); | 1815 | reg_w1(gspca_dev, 0xf1, 0x01); |
| 1931 | reg_r(gspca_dev, 0x00, 1); | 1816 | reg_r(gspca_dev, 0x00, 1); |
| 1932 | reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]); | 1817 | reg_w1(gspca_dev, 0xf1, 0x00); |
| 1933 | reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */ | 1818 | reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */ |
| 1934 | regF1 = gspca_dev->usb_buf[0]; | 1819 | regF1 = gspca_dev->usb_buf[0]; |
| 1935 | if (gspca_dev->usb_err < 0) | 1820 | if (gspca_dev->usb_err < 0) |
| @@ -2423,10 +2308,17 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
| 2423 | { | 2308 | { |
| 2424 | struct sd *sd = (struct sd *) gspca_dev; | 2309 | struct sd *sd = (struct sd *) gspca_dev; |
| 2425 | int i; | 2310 | int i; |
| 2426 | u8 reg1, reg17; | 2311 | u8 reg01, reg17; |
| 2312 | u8 reg0102[2]; | ||
| 2427 | const u8 *sn9c1xx; | 2313 | const u8 *sn9c1xx; |
| 2428 | const u8 (*init)[8]; | 2314 | const u8 (*init)[8]; |
| 2315 | const u8 *reg9a; | ||
| 2429 | int mode; | 2316 | int mode; |
| 2317 | static const u8 reg9a_def[] = | ||
| 2318 | {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; | ||
| 2319 | static const u8 reg9a_spec[] = | ||
| 2320 | {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; | ||
| 2321 | static const u8 regd4[] = {0x60, 0x00, 0x00}; | ||
| 2430 | static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; | 2322 | static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; |
| 2431 | static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; | 2323 | static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; |
| 2432 | static const u8 CA_adcm1700[] = | 2324 | static const u8 CA_adcm1700[] = |
| @@ -2448,7 +2340,85 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
| 2448 | 2340 | ||
| 2449 | /* initialize the bridge */ | 2341 | /* initialize the bridge */ |
| 2450 | sn9c1xx = sn_tb[sd->sensor]; | 2342 | sn9c1xx = sn_tb[sd->sensor]; |
| 2451 | bridge_init(gspca_dev, sn9c1xx); | 2343 | |
| 2344 | /* sensor clock already enabled in sd_init */ | ||
| 2345 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ | ||
| 2346 | reg01 = sn9c1xx[1]; | ||
| 2347 | if (sd->flags & PDN_INV) | ||
| 2348 | reg01 ^= S_PDN_INV; /* power down inverted */ | ||
| 2349 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2350 | |||
| 2351 | /* configure gpio */ | ||
| 2352 | reg0102[0] = reg01; | ||
| 2353 | reg0102[1] = sn9c1xx[2]; | ||
| 2354 | if (gspca_dev->audio) | ||
| 2355 | reg0102[1] |= 0x04; /* keep the audio connection */ | ||
| 2356 | reg_w(gspca_dev, 0x01, reg0102, 2); | ||
| 2357 | reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); | ||
| 2358 | reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); | ||
| 2359 | switch (sd->sensor) { | ||
| 2360 | case SENSOR_GC0307: | ||
| 2361 | case SENSOR_OV7660: | ||
| 2362 | case SENSOR_PO1030: | ||
| 2363 | case SENSOR_PO2030N: | ||
| 2364 | case SENSOR_SOI768: | ||
| 2365 | case SENSOR_SP80708: | ||
| 2366 | reg9a = reg9a_spec; | ||
| 2367 | break; | ||
| 2368 | default: | ||
| 2369 | reg9a = reg9a_def; | ||
| 2370 | break; | ||
| 2371 | } | ||
| 2372 | reg_w(gspca_dev, 0x9a, reg9a, 6); | ||
| 2373 | |||
| 2374 | reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); | ||
| 2375 | |||
| 2376 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); | ||
| 2377 | |||
| 2378 | reg17 = sn9c1xx[0x17]; | ||
| 2379 | switch (sd->sensor) { | ||
| 2380 | case SENSOR_GC0307: | ||
| 2381 | msleep(50); /*fixme: is it useful? */ | ||
| 2382 | break; | ||
| 2383 | case SENSOR_OM6802: | ||
| 2384 | msleep(10); | ||
| 2385 | reg_w1(gspca_dev, 0x02, 0x73); | ||
| 2386 | reg17 |= SEN_CLK_EN; | ||
| 2387 | reg_w1(gspca_dev, 0x17, reg17); | ||
| 2388 | reg_w1(gspca_dev, 0x01, 0x22); | ||
| 2389 | msleep(100); | ||
| 2390 | reg01 = SCL_SEL_OD | S_PDN_INV; | ||
| 2391 | reg17 &= MCK_SIZE_MASK; | ||
| 2392 | reg17 |= 0x04; /* clock / 4 */ | ||
| 2393 | break; | ||
| 2394 | } | ||
| 2395 | reg01 |= SYS_SEL_48M; | ||
| 2396 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2397 | reg17 |= SEN_CLK_EN; | ||
| 2398 | reg_w1(gspca_dev, 0x17, reg17); | ||
| 2399 | reg01 &= ~S_PWR_DN; /* sensor power on */ | ||
| 2400 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2401 | reg01 &= ~SYS_SEL_48M; | ||
| 2402 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2403 | |||
| 2404 | switch (sd->sensor) { | ||
| 2405 | case SENSOR_HV7131R: | ||
| 2406 | hv7131r_probe(gspca_dev); /*fixme: is it useful? */ | ||
| 2407 | break; | ||
| 2408 | case SENSOR_OM6802: | ||
| 2409 | msleep(10); | ||
| 2410 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2411 | i2c_w8(gspca_dev, om6802_init0[0]); | ||
| 2412 | i2c_w8(gspca_dev, om6802_init0[1]); | ||
| 2413 | msleep(15); | ||
| 2414 | reg_w1(gspca_dev, 0x02, 0x71); | ||
| 2415 | msleep(150); | ||
| 2416 | break; | ||
| 2417 | case SENSOR_SP80708: | ||
| 2418 | msleep(100); | ||
| 2419 | reg_w1(gspca_dev, 0x02, 0x62); | ||
| 2420 | break; | ||
| 2421 | } | ||
| 2452 | 2422 | ||
| 2453 | /* initialize the sensor */ | 2423 | /* initialize the sensor */ |
| 2454 | i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); | 2424 | i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); |
| @@ -2476,30 +2446,11 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
| 2476 | } | 2446 | } |
| 2477 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); | 2447 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); |
| 2478 | switch (sd->sensor) { | 2448 | switch (sd->sensor) { |
| 2479 | case SENSOR_GC0307: | 2449 | case SENSOR_OM6802: |
| 2480 | reg17 = 0xa2; | 2450 | /* case SENSOR_OV7648: * fixme: sometimes */ |
| 2481 | break; | ||
| 2482 | case SENSOR_MT9V111: | ||
| 2483 | case SENSOR_MI0360B: | ||
| 2484 | reg17 = 0xe0; | ||
| 2485 | break; | ||
| 2486 | case SENSOR_ADCM1700: | ||
| 2487 | case SENSOR_OV7630: | ||
| 2488 | reg17 = 0xe2; | ||
| 2489 | break; | ||
| 2490 | case SENSOR_OV7648: | ||
| 2491 | reg17 = 0x20; | ||
| 2492 | break; | ||
| 2493 | case SENSOR_OV7660: | ||
| 2494 | case SENSOR_SOI768: | ||
| 2495 | reg17 = 0xa0; | ||
| 2496 | break; | ||
| 2497 | case SENSOR_PO1030: | ||
| 2498 | case SENSOR_PO2030N: | ||
| 2499 | reg17 = 0xa0; | ||
| 2500 | break; | 2451 | break; |
| 2501 | default: | 2452 | default: |
| 2502 | reg17 = 0x60; | 2453 | reg17 |= DEF_EN; |
| 2503 | break; | 2454 | break; |
| 2504 | } | 2455 | } |
| 2505 | reg_w1(gspca_dev, 0x17, reg17); | 2456 | reg_w1(gspca_dev, 0x17, reg17); |
| @@ -2546,95 +2497,67 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
| 2546 | 2497 | ||
| 2547 | init = NULL; | 2498 | init = NULL; |
| 2548 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; | 2499 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; |
| 2549 | if (mode) | 2500 | reg01 |= SYS_SEL_48M | V_TX_EN; |
| 2550 | reg1 = 0x46; /* 320x240: clk 48Mhz, video trf enable */ | 2501 | reg17 &= ~MCK_SIZE_MASK; |
| 2551 | else | 2502 | reg17 |= 0x02; /* clock / 2 */ |
| 2552 | reg1 = 0x06; /* 640x480: clk 24Mhz, video trf enable */ | ||
| 2553 | reg17 = 0x61; /* 0x:20: enable sensor clock */ | ||
| 2554 | switch (sd->sensor) { | 2503 | switch (sd->sensor) { |
| 2555 | case SENSOR_ADCM1700: | 2504 | case SENSOR_ADCM1700: |
| 2556 | init = adcm1700_sensor_param1; | 2505 | init = adcm1700_sensor_param1; |
| 2557 | reg1 = 0x46; | ||
| 2558 | reg17 = 0xe2; | ||
| 2559 | break; | 2506 | break; |
| 2560 | case SENSOR_GC0307: | 2507 | case SENSOR_GC0307: |
| 2561 | init = gc0307_sensor_param1; | 2508 | init = gc0307_sensor_param1; |
| 2562 | reg17 = 0xa2; | 2509 | break; |
| 2563 | reg1 = 0x44; | 2510 | case SENSOR_HV7131R: |
| 2511 | case SENSOR_MI0360: | ||
| 2512 | if (mode) | ||
| 2513 | reg01 |= SYS_SEL_48M; /* 320x240: clk 48Mhz */ | ||
| 2514 | else | ||
| 2515 | reg01 &= ~SYS_SEL_48M; /* 640x480: clk 24Mhz */ | ||
| 2516 | reg17 &= ~MCK_SIZE_MASK; | ||
| 2517 | reg17 |= 0x01; /* clock / 1 */ | ||
| 2564 | break; | 2518 | break; |
| 2565 | case SENSOR_MI0360B: | 2519 | case SENSOR_MI0360B: |
| 2566 | init = mi0360b_sensor_param1; | 2520 | init = mi0360b_sensor_param1; |
| 2567 | reg1 &= ~0x02; /* don't inverse pin S_PWR_DN */ | ||
| 2568 | reg17 = 0xe2; | ||
| 2569 | break; | 2521 | break; |
| 2570 | case SENSOR_MO4000: | 2522 | case SENSOR_MO4000: |
| 2571 | if (mode) { | 2523 | if (mode) { /* if 320x240 */ |
| 2572 | /* reg1 = 0x46; * 320 clk 48Mhz 60fp/s */ | 2524 | reg01 &= ~SYS_SEL_48M; /* clk 24Mz */ |
| 2573 | reg1 = 0x06; /* clk 24Mz */ | 2525 | reg17 &= ~MCK_SIZE_MASK; |
| 2574 | } else { | 2526 | reg17 |= 0x01; /* clock / 1 */ |
| 2575 | reg17 = 0x22; /* 640 MCKSIZE */ | ||
| 2576 | /* reg1 = 0x06; * 640 clk 24Mz (done) */ | ||
| 2577 | } | 2527 | } |
| 2578 | break; | 2528 | break; |
| 2579 | case SENSOR_MT9V111: | 2529 | case SENSOR_MT9V111: |
| 2580 | init = mt9v111_sensor_param1; | 2530 | init = mt9v111_sensor_param1; |
| 2581 | if (mode) { | ||
| 2582 | reg1 = 0x04; /* 320 clk 48Mhz */ | ||
| 2583 | } else { | ||
| 2584 | /* reg1 = 0x06; * 640 clk 24Mz (done) */ | ||
| 2585 | reg17 = 0xc2; | ||
| 2586 | } | ||
| 2587 | break; | 2531 | break; |
| 2588 | case SENSOR_OM6802: | 2532 | case SENSOR_OM6802: |
| 2589 | init = om6802_sensor_param1; | 2533 | init = om6802_sensor_param1; |
| 2590 | reg17 = 0x64; /* 640 MCKSIZE */ | 2534 | if (!mode) { /* if 640x480 */ |
| 2535 | reg17 &= ~MCK_SIZE_MASK; | ||
| 2536 | reg17 |= 0x01; /* clock / 4 */ | ||
| 2537 | } | ||
| 2591 | break; | 2538 | break; |
| 2592 | case SENSOR_OV7630: | 2539 | case SENSOR_OV7630: |
| 2593 | init = ov7630_sensor_param1; | 2540 | init = ov7630_sensor_param1; |
| 2594 | reg17 = 0xe2; | ||
| 2595 | reg1 = 0x44; | ||
| 2596 | break; | 2541 | break; |
| 2597 | case SENSOR_OV7648: | 2542 | case SENSOR_OV7648: |
| 2598 | init = ov7648_sensor_param1; | 2543 | init = ov7648_sensor_param1; |
| 2599 | reg17 = 0x21; | 2544 | reg17 &= ~MCK_SIZE_MASK; |
| 2600 | /* reg1 = 0x42; * 42 - 46? */ | 2545 | reg17 |= 0x01; /* clock / 1 */ |
| 2601 | break; | 2546 | break; |
| 2602 | case SENSOR_OV7660: | 2547 | case SENSOR_OV7660: |
| 2603 | init = ov7660_sensor_param1; | 2548 | init = ov7660_sensor_param1; |
| 2604 | if (sd->bridge == BRIDGE_SN9C120) { | ||
| 2605 | if (mode) { /* 320x240 - 160x120 */ | ||
| 2606 | reg17 = 0xa2; | ||
| 2607 | reg1 = 0x44; /* 48 Mhz, video trf eneble */ | ||
| 2608 | } | ||
| 2609 | } else { | ||
| 2610 | reg17 = 0x22; | ||
| 2611 | reg1 = 0x06; /* 24 Mhz, video trf eneble | ||
| 2612 | * inverse power down */ | ||
| 2613 | } | ||
| 2614 | break; | 2549 | break; |
| 2615 | case SENSOR_PO1030: | 2550 | case SENSOR_PO1030: |
| 2616 | init = po1030_sensor_param1; | 2551 | init = po1030_sensor_param1; |
| 2617 | reg17 = 0xa2; | ||
| 2618 | reg1 = 0x44; | ||
| 2619 | break; | 2552 | break; |
| 2620 | case SENSOR_PO2030N: | 2553 | case SENSOR_PO2030N: |
| 2621 | init = po2030n_sensor_param1; | 2554 | init = po2030n_sensor_param1; |
| 2622 | reg1 = 0x46; | ||
| 2623 | reg17 = 0xa2; | ||
| 2624 | break; | 2555 | break; |
| 2625 | case SENSOR_SOI768: | 2556 | case SENSOR_SOI768: |
| 2626 | init = soi768_sensor_param1; | 2557 | init = soi768_sensor_param1; |
| 2627 | reg1 = 0x44; | ||
| 2628 | reg17 = 0xa2; | ||
| 2629 | break; | 2558 | break; |
| 2630 | case SENSOR_SP80708: | 2559 | case SENSOR_SP80708: |
| 2631 | init = sp80708_sensor_param1; | 2560 | init = sp80708_sensor_param1; |
| 2632 | if (mode) { | ||
| 2633 | /*?? reg1 = 0x04; * 320 clk 48Mhz */ | ||
| 2634 | } else { | ||
| 2635 | reg1 = 0x46; /* 640 clk 48Mz */ | ||
| 2636 | reg17 = 0xa2; | ||
| 2637 | } | ||
| 2638 | break; | 2561 | break; |
| 2639 | } | 2562 | } |
| 2640 | 2563 | ||
| @@ -2684,7 +2607,9 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
| 2684 | setjpegqual(gspca_dev); | 2607 | setjpegqual(gspca_dev); |
| 2685 | 2608 | ||
| 2686 | reg_w1(gspca_dev, 0x17, reg17); | 2609 | reg_w1(gspca_dev, 0x17, reg17); |
| 2687 | reg_w1(gspca_dev, 0x01, reg1); | 2610 | reg_w1(gspca_dev, 0x01, reg01); |
| 2611 | sd->reg01 = reg01; | ||
| 2612 | sd->reg17 = reg17; | ||
| 2688 | 2613 | ||
| 2689 | sethvflip(gspca_dev); | 2614 | sethvflip(gspca_dev); |
| 2690 | setbrightness(gspca_dev); | 2615 | setbrightness(gspca_dev); |
| @@ -2706,41 +2631,64 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
| 2706 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; | 2631 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; |
| 2707 | static const u8 stopsoi768[] = | 2632 | static const u8 stopsoi768[] = |
| 2708 | { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 }; | 2633 | { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 }; |
| 2709 | u8 data; | 2634 | u8 reg01; |
| 2710 | const u8 *sn9c1xx; | 2635 | u8 reg17; |
| 2711 | 2636 | ||
| 2712 | data = 0x0b; | 2637 | reg01 = sd->reg01; |
| 2638 | reg17 = sd->reg17 & ~SEN_CLK_EN; | ||
| 2713 | switch (sd->sensor) { | 2639 | switch (sd->sensor) { |
| 2640 | case SENSOR_ADCM1700: | ||
| 2714 | case SENSOR_GC0307: | 2641 | case SENSOR_GC0307: |
| 2715 | data = 0x29; | 2642 | case SENSOR_PO2030N: |
| 2643 | case SENSOR_SP80708: | ||
| 2644 | reg01 |= LED; | ||
| 2645 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2646 | reg01 &= ~(LED | V_TX_EN); | ||
| 2647 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2648 | /* reg_w1(gspca_dev, 0x02, 0x??); * LED off ? */ | ||
| 2716 | break; | 2649 | break; |
| 2717 | case SENSOR_HV7131R: | 2650 | case SENSOR_HV7131R: |
| 2651 | reg01 &= ~V_TX_EN; | ||
| 2652 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2718 | i2c_w8(gspca_dev, stophv7131); | 2653 | i2c_w8(gspca_dev, stophv7131); |
| 2719 | data = 0x2b; | ||
| 2720 | break; | 2654 | break; |
| 2721 | case SENSOR_MI0360: | 2655 | case SENSOR_MI0360: |
| 2722 | case SENSOR_MI0360B: | 2656 | case SENSOR_MI0360B: |
| 2657 | reg01 &= ~V_TX_EN; | ||
| 2658 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2659 | /* reg_w1(gspca_dev, 0x02, 0x40); * LED off ? */ | ||
| 2723 | i2c_w8(gspca_dev, stopmi0360); | 2660 | i2c_w8(gspca_dev, stopmi0360); |
| 2724 | data = 0x29; | ||
| 2725 | break; | 2661 | break; |
| 2726 | case SENSOR_OV7648: | ||
| 2727 | i2c_w8(gspca_dev, stopov7648); | ||
| 2728 | /* fall thru */ | ||
| 2729 | case SENSOR_MT9V111: | 2662 | case SENSOR_MT9V111: |
| 2730 | case SENSOR_OV7630: | 2663 | case SENSOR_OM6802: |
| 2731 | case SENSOR_PO1030: | 2664 | case SENSOR_PO1030: |
| 2732 | data = 0x29; | 2665 | reg01 &= ~V_TX_EN; |
| 2666 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2667 | break; | ||
| 2668 | case SENSOR_OV7630: | ||
| 2669 | case SENSOR_OV7648: | ||
| 2670 | reg01 &= ~V_TX_EN; | ||
| 2671 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2672 | i2c_w8(gspca_dev, stopov7648); | ||
| 2673 | break; | ||
| 2674 | case SENSOR_OV7660: | ||
| 2675 | reg01 &= ~V_TX_EN; | ||
| 2676 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2733 | break; | 2677 | break; |
| 2734 | case SENSOR_SOI768: | 2678 | case SENSOR_SOI768: |
| 2735 | i2c_w8(gspca_dev, stopsoi768); | 2679 | i2c_w8(gspca_dev, stopsoi768); |
| 2736 | data = 0x29; | ||
| 2737 | break; | 2680 | break; |
| 2738 | } | 2681 | } |
| 2739 | sn9c1xx = sn_tb[sd->sensor]; | 2682 | |
| 2740 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | 2683 | reg01 |= SCL_SEL_OD; |
| 2741 | reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]); | 2684 | reg_w1(gspca_dev, 0x01, reg01); |
| 2742 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | 2685 | reg01 |= S_PWR_DN; /* sensor power down */ |
| 2743 | reg_w1(gspca_dev, 0x01, data); | 2686 | reg_w1(gspca_dev, 0x01, reg01); |
| 2687 | reg_w1(gspca_dev, 0x17, reg17); | ||
| 2688 | reg01 &= ~SYS_SEL_48M; /* clock 24MHz */ | ||
| 2689 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2690 | reg01 |= LED; | ||
| 2691 | reg_w1(gspca_dev, 0x01, reg01); | ||
| 2744 | /* Don't disable sensor clock as that disables the button on the cam */ | 2692 | /* Don't disable sensor clock as that disables the button on the cam */ |
| 2745 | /* reg_w1(gspca_dev, 0xf1, 0x01); */ | 2693 | /* reg_w1(gspca_dev, 0xf1, 0x01); */ |
| 2746 | } | 2694 | } |
| @@ -2954,14 +2902,18 @@ static const struct sd_desc sd_desc = { | |||
| 2954 | /* -- module initialisation -- */ | 2902 | /* -- module initialisation -- */ |
| 2955 | #define BS(bridge, sensor) \ | 2903 | #define BS(bridge, sensor) \ |
| 2956 | .driver_info = (BRIDGE_ ## bridge << 16) \ | 2904 | .driver_info = (BRIDGE_ ## bridge << 16) \ |
| 2957 | | SENSOR_ ## sensor | 2905 | | (SENSOR_ ## sensor << 8) |
| 2906 | #define BSF(bridge, sensor, flags) \ | ||
| 2907 | .driver_info = (BRIDGE_ ## bridge << 16) \ | ||
| 2908 | | (SENSOR_ ## sensor << 8) \ | ||
| 2909 | | (flags) | ||
| 2958 | static const __devinitdata struct usb_device_id device_table[] = { | 2910 | static const __devinitdata struct usb_device_id device_table[] = { |
| 2959 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | 2911 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE |
| 2960 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, | 2912 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, |
| 2961 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, | 2913 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, |
| 2962 | #endif | 2914 | #endif |
| 2963 | {USB_DEVICE(0x045e, 0x00f5), BS(SN9C105, OV7660)}, | 2915 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, PDN_INV)}, |
| 2964 | {USB_DEVICE(0x045e, 0x00f7), BS(SN9C105, OV7660)}, | 2916 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, PDN_INV)}, |
| 2965 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, | 2917 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, |
| 2966 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, | 2918 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, |
| 2967 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, | 2919 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, |
diff --git a/drivers/staging/cx25821/cx25821-video.c b/drivers/staging/cx25821/cx25821-video.c index e7f1d5778cec..52389308f333 100644 --- a/drivers/staging/cx25821/cx25821-video.c +++ b/drivers/staging/cx25821/cx25821-video.c | |||
| @@ -92,7 +92,7 @@ int cx25821_get_format_size(void) | |||
| 92 | return ARRAY_SIZE(formats); | 92 | return ARRAY_SIZE(formats); |
| 93 | } | 93 | } |
| 94 | 94 | ||
| 95 | struct cx25821_fmt *format_by_fourcc(unsigned int fourcc) | 95 | struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc) |
| 96 | { | 96 | { |
| 97 | unsigned int i; | 97 | unsigned int i; |
| 98 | 98 | ||
| @@ -848,7 +848,7 @@ static int video_open(struct file *file) | |||
| 848 | pix_format = | 848 | pix_format = |
| 849 | (dev->channels[ch_id].pixel_formats == | 849 | (dev->channels[ch_id].pixel_formats == |
| 850 | PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; | 850 | PIXEL_FRMT_411) ? V4L2_PIX_FMT_Y41P : V4L2_PIX_FMT_YUYV; |
| 851 | fh->fmt = format_by_fourcc(pix_format); | 851 | fh->fmt = cx25821_format_by_fourcc(pix_format); |
| 852 | 852 | ||
| 853 | v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); | 853 | v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); |
| 854 | 854 | ||
| @@ -1010,7 +1010,7 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, | |||
| 1010 | if (0 != err) | 1010 | if (0 != err) |
| 1011 | return err; | 1011 | return err; |
| 1012 | 1012 | ||
| 1013 | fh->fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 1013 | fh->fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat); |
| 1014 | fh->vidq.field = f->fmt.pix.field; | 1014 | fh->vidq.field = f->fmt.pix.field; |
| 1015 | 1015 | ||
| 1016 | /* check if width and height is valid based on set standard */ | 1016 | /* check if width and height is valid based on set standard */ |
| @@ -1119,7 +1119,7 @@ int cx25821_vidioc_try_fmt_vid_cap(struct file *file, void *priv, struct v4l2_fo | |||
| 1119 | enum v4l2_field field; | 1119 | enum v4l2_field field; |
| 1120 | unsigned int maxw, maxh; | 1120 | unsigned int maxw, maxh; |
| 1121 | 1121 | ||
| 1122 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 1122 | fmt = cx25821_format_by_fourcc(f->fmt.pix.pixelformat); |
| 1123 | if (NULL == fmt) | 1123 | if (NULL == fmt) |
| 1124 | return -EINVAL; | 1124 | return -EINVAL; |
| 1125 | 1125 | ||
diff --git a/drivers/staging/cx25821/cx25821-video.h b/drivers/staging/cx25821/cx25821-video.h index cc6034b1a95d..a2415d33235b 100644 --- a/drivers/staging/cx25821/cx25821-video.h +++ b/drivers/staging/cx25821/cx25821-video.h | |||
| @@ -87,7 +87,7 @@ extern unsigned int vid_limit; | |||
| 87 | 87 | ||
| 88 | #define FORMAT_FLAGS_PACKED 0x01 | 88 | #define FORMAT_FLAGS_PACKED 0x01 |
| 89 | extern struct cx25821_fmt formats[]; | 89 | extern struct cx25821_fmt formats[]; |
| 90 | extern struct cx25821_fmt *format_by_fourcc(unsigned int fourcc); | 90 | extern struct cx25821_fmt *cx25821_format_by_fourcc(unsigned int fourcc); |
| 91 | extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; | 91 | extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; |
| 92 | 92 | ||
| 93 | extern void cx25821_dump_video_queue(struct cx25821_dev *dev, | 93 | extern void cx25821_dump_video_queue(struct cx25821_dev *dev, |
diff --git a/include/media/saa7146.h b/include/media/saa7146.h index 7a9f76ecbbbd..ac7ce00f39cf 100644 --- a/include/media/saa7146.h +++ b/include/media/saa7146.h | |||
| @@ -161,7 +161,7 @@ extern struct list_head saa7146_devices; | |||
| 161 | extern struct mutex saa7146_devices_lock; | 161 | extern struct mutex saa7146_devices_lock; |
| 162 | int saa7146_register_extension(struct saa7146_extension*); | 162 | int saa7146_register_extension(struct saa7146_extension*); |
| 163 | int saa7146_unregister_extension(struct saa7146_extension*); | 163 | int saa7146_unregister_extension(struct saa7146_extension*); |
| 164 | struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc); | 164 | struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc); |
| 165 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt); | 165 | int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt); |
| 166 | void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt); | 166 | void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt); |
| 167 | int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length ); | 167 | int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length ); |
