Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+205 -364
+4 -4
drivers/media/common/saa7146_hlp.c
··· 558 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 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 563 int b_depth = vv->ov_fmt->depth; 564 564 int b_bpl = vv->ov_fb.fmt.bytesperline; ··· 702 702 struct saa7146_vv *vv = dev->vv_data; 703 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 707 int width = buf->fmt->width; 708 708 int height = buf->fmt->height; ··· 827 827 struct saa7146_video_dma vdma2; 828 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 832 int width = buf->fmt->width; 833 833 int height = buf->fmt->height; ··· 994 994 995 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 998 struct saa7146_vv *vv = dev->vv_data; 999 999 u32 vdma1_prot_addr; 1000 1000
+8 -8
drivers/media/common/saa7146_video.c
··· 84 84 85 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 89 int i, j = NUM_FORMATS; 90 90 ··· 266 266 struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); 267 267 struct scatterlist *list = dma->sglist; 268 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 271 DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); 272 272 ··· 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 412 /* we need to have a valid format set here */ 413 413 BUG_ON(NULL == fmt); 414 414 ··· 460 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 464 /* we need to have a valid format set here */ 465 465 BUG_ON(NULL == fmt); 466 466 ··· 536 536 return -EPERM; 537 537 538 538 /* check args */ 539 - fmt = format_by_fourcc(dev, fb->fmt.pixelformat); 539 + fmt = saa7146_format_by_fourcc(dev, fb->fmt.pixelformat); 540 540 if (NULL == fmt) 541 541 return -EINVAL; 542 542 ··· 760 760 761 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 764 if (NULL == fmt) 765 765 return -EINVAL; 766 766 ··· 1264 1264 buf->fmt = &fh->video_fmt; 1265 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 1269 release_all_pagetables(dev, buf); 1270 1270 if( 0 != IS_PLANAR(sfmt->trans)) { ··· 1378 1378 fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; 1379 1379 fh->video_fmt.bytesperline = 0; 1380 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 1382 fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; 1383 1383 1384 1384 videobuf_queue_sg_init(&fh->video_q, &video_qops,
+3 -114
drivers/media/video/bt8xx/bttv-driver.c
··· 854 854 xbits |= RESOURCE_VIDEO_READ | RESOURCE_VIDEO_STREAM; 855 855 856 856 /* is it free? */ 857 - mutex_lock(&btv->lock); 858 857 if (btv->resources & xbits) { 859 858 /* no, someone else uses it */ 860 859 goto fail; ··· 883 884 /* it's free, grab it */ 884 885 fh->resources |= bit; 885 886 btv->resources |= bit; 886 - mutex_unlock(&btv->lock); 887 887 return 1; 888 888 889 889 fail: 890 - mutex_unlock(&btv->lock); 891 890 return 0; 892 891 } 893 892 ··· 937 940 /* trying to free ressources not allocated by us ... */ 938 941 printk("bttv: BUG! (btres)\n"); 939 942 } 940 - mutex_lock(&btv->lock); 941 943 fh->resources &= ~bits; 942 944 btv->resources &= ~bits; 943 945 ··· 947 951 948 952 if (0 == (bits & VBI_RESOURCES)) 949 953 disclaim_vbi_lines(btv); 950 - 951 - mutex_unlock(&btv->lock); 952 954 } 953 955 954 956 /* ----------------------------------------------------------------------- */ ··· 1707 1713 1708 1714 /* Make sure tvnorm and vbi_end remain consistent 1709 1715 until we're done. */ 1710 - mutex_lock(&btv->lock); 1711 1716 1712 1717 norm = btv->tvnorm; 1713 1718 1714 1719 /* In this mode capturing always starts at defrect.top 1715 1720 (default VDELAY), ignoring cropping parameters. */ 1716 1721 if (btv->vbi_end > bttv_tvnorms[norm].cropcap.defrect.top) { 1717 - mutex_unlock(&btv->lock); 1718 1722 return -EINVAL; 1719 1723 } 1720 1724 1721 - mutex_unlock(&btv->lock); 1722 - 1723 1725 c.rect = bttv_tvnorms[norm].cropcap.defrect; 1724 1726 } else { 1725 - mutex_lock(&btv->lock); 1726 - 1727 1727 norm = btv->tvnorm; 1728 1728 c = btv->crop[!!fh->do_crop]; 1729 - 1730 - mutex_unlock(&btv->lock); 1731 1729 1732 1730 if (width < c.min_scaled_width || 1733 1731 width > c.max_scaled_width || ··· 1844 1858 unsigned int i; 1845 1859 int err; 1846 1860 1847 - mutex_lock(&btv->lock); 1848 1861 err = v4l2_prio_check(&btv->prio, fh->prio); 1849 1862 if (err) 1850 1863 goto err; ··· 1859 1874 set_tvnorm(btv, i); 1860 1875 1861 1876 err: 1862 - mutex_unlock(&btv->lock); 1863 1877 1864 1878 return err; 1865 1879 } ··· 1882 1898 struct bttv *btv = fh->btv; 1883 1899 int rc = 0; 1884 1900 1885 - mutex_lock(&btv->lock); 1886 1901 if (i->index >= bttv_tvcards[btv->c.type].video_inputs) { 1887 1902 rc = -EINVAL; 1888 1903 goto err; ··· 1911 1928 i->std = BTTV_NORMS; 1912 1929 1913 1930 err: 1914 - mutex_unlock(&btv->lock); 1915 1931 1916 1932 return rc; 1917 1933 } ··· 1920 1938 struct bttv_fh *fh = priv; 1921 1939 struct bttv *btv = fh->btv; 1922 1940 1923 - mutex_lock(&btv->lock); 1924 1941 *i = btv->input; 1925 - mutex_unlock(&btv->lock); 1926 1942 1927 1943 return 0; 1928 1944 } ··· 1932 1952 1933 1953 int err; 1934 1954 1935 - mutex_lock(&btv->lock); 1936 1955 err = v4l2_prio_check(&btv->prio, fh->prio); 1937 1956 if (unlikely(err)) 1938 1957 goto err; ··· 1944 1965 set_input(btv, i, btv->tvnorm); 1945 1966 1946 1967 err: 1947 - mutex_unlock(&btv->lock); 1948 1968 return 0; 1949 1969 } 1950 1970 ··· 1957 1979 if (unlikely(0 != t->index)) 1958 1980 return -EINVAL; 1959 1981 1960 - mutex_lock(&btv->lock); 1961 1982 if (unlikely(btv->tuner_type == TUNER_ABSENT)) { 1962 1983 err = -EINVAL; 1963 1984 goto err; ··· 1972 1995 btv->audio_mode_gpio(btv, t, 1); 1973 1996 1974 1997 err: 1975 - mutex_unlock(&btv->lock); 1976 1998 1977 1999 return 0; 1978 2000 } ··· 1982 2006 struct bttv_fh *fh = priv; 1983 2007 struct bttv *btv = fh->btv; 1984 2008 1985 - mutex_lock(&btv->lock); 1986 2009 f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; 1987 2010 f->frequency = btv->freq; 1988 - mutex_unlock(&btv->lock); 1989 2011 1990 2012 return 0; 1991 2013 } ··· 1998 2024 if (unlikely(f->tuner != 0)) 1999 2025 return -EINVAL; 2000 2026 2001 - mutex_lock(&btv->lock); 2002 2027 err = v4l2_prio_check(&btv->prio, fh->prio); 2003 2028 if (unlikely(err)) 2004 2029 goto err; ··· 2012 2039 if (btv->has_matchbox && btv->radio_user) 2013 2040 tea5757_set_freq(btv, btv->freq); 2014 2041 err: 2015 - mutex_unlock(&btv->lock); 2016 2042 2017 2043 return 0; 2018 2044 } ··· 2144 2172 2145 2173 /* Make sure tvnorm, vbi_end and the current cropping parameters 2146 2174 remain consistent until we're done. */ 2147 - mutex_lock(&btv->lock); 2148 2175 2149 2176 b = &bttv_tvnorms[btv->tvnorm].cropcap.bounds; 2150 2177 ··· 2221 2250 rc = 0; /* success */ 2222 2251 2223 2252 fail: 2224 - mutex_unlock(&btv->lock); 2225 2253 2226 2254 return rc; 2227 2255 } ··· 2252 2282 if (V4L2_FIELD_ANY == field) { 2253 2283 __s32 height2; 2254 2284 2255 - mutex_lock(&fh->btv->lock); 2256 2285 height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1; 2257 - mutex_unlock(&fh->btv->lock); 2258 2286 field = (win->w.height > height2) 2259 2287 ? V4L2_FIELD_INTERLACED 2260 2288 : V4L2_FIELD_TOP; ··· 2328 2360 } 2329 2361 } 2330 2362 2331 - mutex_lock(&fh->cap.vb_lock); 2332 2363 /* clip against screen */ 2333 2364 if (NULL != btv->fbuf.base) 2334 2365 n = btcx_screen_clips(btv->fbuf.fmt.width, btv->fbuf.fmt.height, ··· 2358 2391 fh->ov.field = win->field; 2359 2392 fh->ov.setup_ok = 1; 2360 2393 2361 - /* 2362 - * FIXME: btv is protected by btv->lock mutex, while btv->init 2363 - * is protected by fh->cap.vb_lock. This seems to open the 2364 - * possibility for some race situations. Maybe the better would 2365 - * be to unify those locks or to use another way to store the 2366 - * init values that will be consumed by videobuf callbacks 2367 - */ 2368 2394 btv->init.ov.w.width = win->w.width; 2369 2395 btv->init.ov.w.height = win->w.height; 2370 2396 btv->init.ov.field = win->field; ··· 2372 2412 bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); 2373 2413 retval = bttv_switch_overlay(btv,fh,new); 2374 2414 } 2375 - mutex_unlock(&fh->cap.vb_lock); 2376 2415 return retval; 2377 2416 } 2378 2417 ··· 2485 2526 if (V4L2_FIELD_ANY == field) { 2486 2527 __s32 height2; 2487 2528 2488 - mutex_lock(&btv->lock); 2489 2529 height2 = btv->crop[!!fh->do_crop].rect.height >> 1; 2490 - mutex_unlock(&btv->lock); 2491 2530 field = (f->fmt.pix.height > height2) 2492 2531 ? V4L2_FIELD_INTERLACED 2493 2532 : V4L2_FIELD_BOTTOM; ··· 2571 2614 fmt = format_by_fourcc(f->fmt.pix.pixelformat); 2572 2615 2573 2616 /* update our state informations */ 2574 - mutex_lock(&fh->cap.vb_lock); 2575 2617 fh->fmt = fmt; 2576 2618 fh->cap.field = f->fmt.pix.field; 2577 2619 fh->cap.last = V4L2_FIELD_NONE; ··· 2579 2623 btv->init.fmt = fmt; 2580 2624 btv->init.width = f->fmt.pix.width; 2581 2625 btv->init.height = f->fmt.pix.height; 2582 - mutex_unlock(&fh->cap.vb_lock); 2583 2626 2584 2627 return 0; 2585 2628 } ··· 2604 2649 unsigned int i; 2605 2650 struct bttv_fh *fh = priv; 2606 2651 2607 - mutex_lock(&fh->cap.vb_lock); 2608 2652 retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, 2609 2653 V4L2_MEMORY_MMAP); 2610 2654 if (retval < 0) { 2611 - mutex_unlock(&fh->cap.vb_lock); 2612 2655 return retval; 2613 2656 } 2614 2657 ··· 2618 2665 for (i = 0; i < gbuffers; i++) 2619 2666 mbuf->offsets[i] = i * gbufsize; 2620 2667 2621 - mutex_unlock(&fh->cap.vb_lock); 2622 2668 return 0; 2623 2669 } 2624 2670 #endif ··· 2727 2775 int retval = 0; 2728 2776 2729 2777 if (on) { 2730 - mutex_lock(&fh->cap.vb_lock); 2731 2778 /* verify args */ 2732 2779 if (unlikely(!btv->fbuf.base)) { 2733 - mutex_unlock(&fh->cap.vb_lock); 2734 2780 return -EINVAL; 2735 2781 } 2736 2782 if (unlikely(!fh->ov.setup_ok)) { ··· 2737 2787 } 2738 2788 if (retval) 2739 2789 return retval; 2740 - mutex_unlock(&fh->cap.vb_lock); 2741 2790 } 2742 2791 2743 2792 if (!check_alloc_btres_lock(btv, fh, RESOURCE_OVERLAY)) 2744 2793 return -EBUSY; 2745 2794 2746 - mutex_lock(&fh->cap.vb_lock); 2747 2795 if (on) { 2748 2796 fh->ov.tvnorm = btv->tvnorm; 2749 2797 new = videobuf_sg_alloc(sizeof(*new)); ··· 2753 2805 2754 2806 /* switch over */ 2755 2807 retval = bttv_switch_overlay(btv, fh, new); 2756 - mutex_unlock(&fh->cap.vb_lock); 2757 2808 return retval; 2758 2809 } 2759 2810 ··· 2791 2844 } 2792 2845 2793 2846 /* ok, accept it */ 2794 - mutex_lock(&fh->cap.vb_lock); 2795 2847 btv->fbuf.base = fb->base; 2796 2848 btv->fbuf.fmt.width = fb->fmt.width; 2797 2849 btv->fbuf.fmt.height = fb->fmt.height; ··· 2822 2876 retval = bttv_switch_overlay(btv, fh, new); 2823 2877 } 2824 2878 } 2825 - mutex_unlock(&fh->cap.vb_lock); 2826 2879 return retval; 2827 2880 } 2828 2881 ··· 2900 2955 c->id >= V4L2_CID_PRIVATE_LASTP1)) 2901 2956 return -EINVAL; 2902 2957 2903 - mutex_lock(&btv->lock); 2904 2958 if (!btv->volume_gpio && (c->id == V4L2_CID_AUDIO_VOLUME)) 2905 2959 *c = no_ctl; 2906 2960 else { ··· 2907 2963 2908 2964 *c = (NULL != ctrl) ? *ctrl : no_ctl; 2909 2965 } 2910 - mutex_unlock(&btv->lock); 2911 2966 2912 2967 return 0; 2913 2968 } ··· 2917 2974 struct bttv_fh *fh = f; 2918 2975 struct bttv *btv = fh->btv; 2919 2976 2920 - mutex_lock(&btv->lock); 2921 2977 v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id, 2922 2978 &parm->parm.capture.timeperframe); 2923 - mutex_unlock(&btv->lock); 2924 2979 2925 2980 return 0; 2926 2981 } ··· 2934 2993 if (0 != t->index) 2935 2994 return -EINVAL; 2936 2995 2937 - mutex_lock(&btv->lock); 2938 2996 t->rxsubchans = V4L2_TUNER_SUB_MONO; 2939 2997 bttv_call_all(btv, tuner, g_tuner, t); 2940 2998 strcpy(t->name, "Television"); ··· 2945 3005 if (btv->audio_mode_gpio) 2946 3006 btv->audio_mode_gpio(btv, t, 0); 2947 3007 2948 - mutex_unlock(&btv->lock); 2949 3008 return 0; 2950 3009 } 2951 3010 ··· 2953 3014 struct bttv_fh *fh = f; 2954 3015 struct bttv *btv = fh->btv; 2955 3016 2956 - mutex_lock(&btv->lock); 2957 3017 *p = v4l2_prio_max(&btv->prio); 2958 - mutex_unlock(&btv->lock); 2959 3018 2960 3019 return 0; 2961 3020 } ··· 2965 3028 struct bttv *btv = fh->btv; 2966 3029 int rc; 2967 3030 2968 - mutex_lock(&btv->lock); 2969 3031 rc = v4l2_prio_change(&btv->prio, &fh->prio, prio); 2970 - mutex_unlock(&btv->lock); 2971 3032 2972 3033 return rc; 2973 3034 } ··· 2980 3045 cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) 2981 3046 return -EINVAL; 2982 3047 2983 - mutex_lock(&btv->lock); 2984 3048 *cap = bttv_tvnorms[btv->tvnorm].cropcap; 2985 - mutex_unlock(&btv->lock); 2986 3049 2987 3050 return 0; 2988 3051 } ··· 2998 3065 inconsistent with fh->width or fh->height and apps 2999 3066 do not expect a change here. */ 3000 3067 3001 - mutex_lock(&btv->lock); 3002 3068 crop->c = btv->crop[!!fh->do_crop].rect; 3003 - mutex_unlock(&btv->lock); 3004 3069 3005 3070 return 0; 3006 3071 } ··· 3022 3091 /* Make sure tvnorm, vbi_end and the current cropping 3023 3092 parameters remain consistent until we're done. Note 3024 3093 read() may change vbi_end in check_alloc_btres_lock(). */ 3025 - mutex_lock(&btv->lock); 3026 3094 retval = v4l2_prio_check(&btv->prio, fh->prio); 3027 3095 if (0 != retval) { 3028 - mutex_unlock(&btv->lock); 3029 3096 return retval; 3030 3097 } 3031 3098 3032 3099 retval = -EBUSY; 3033 3100 3034 3101 if (locked_btres(fh->btv, VIDEO_RESOURCES)) { 3035 - mutex_unlock(&btv->lock); 3036 3102 return retval; 3037 3103 } 3038 3104 ··· 3041 3113 3042 3114 b_top = max(b->top, btv->vbi_end); 3043 3115 if (b_top + 32 >= b_bottom) { 3044 - mutex_unlock(&btv->lock); 3045 3116 return retval; 3046 3117 } 3047 3118 ··· 3063 3136 3064 3137 btv->crop[1] = c; 3065 3138 3066 - mutex_unlock(&btv->lock); 3067 - 3068 3139 fh->do_crop = 1; 3069 - 3070 - mutex_lock(&fh->cap.vb_lock); 3071 3140 3072 3141 if (fh->width < c.min_scaled_width) { 3073 3142 fh->width = c.min_scaled_width; ··· 3080 3157 fh->height = c.max_scaled_height; 3081 3158 btv->init.height = c.max_scaled_height; 3082 3159 } 3083 - 3084 - mutex_unlock(&fh->cap.vb_lock); 3085 3160 3086 3161 return 0; 3087 3162 } ··· 3148 3227 return videobuf_poll_stream(file, &fh->vbi, wait); 3149 3228 } 3150 3229 3151 - mutex_lock(&fh->cap.vb_lock); 3152 3230 if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { 3153 3231 /* streaming capture */ 3154 3232 if (list_empty(&fh->cap.stream)) ··· 3182 3262 else 3183 3263 rc = 0; 3184 3264 err: 3185 - mutex_unlock(&fh->cap.vb_lock); 3186 3265 return rc; 3187 3266 } 3188 3267 ··· 3212 3293 return -ENOMEM; 3213 3294 file->private_data = fh; 3214 3295 3215 - /* 3216 - * btv is protected by btv->lock mutex, while btv->init and other 3217 - * streaming vars are protected by fh->cap.vb_lock. We need to take 3218 - * care of both locks to avoid troubles. However, vb_lock is used also 3219 - * inside videobuf, without calling buf->lock. So, it is a very bad 3220 - * idea to hold both locks at the same time. 3221 - * Let's first copy btv->init at fh, holding cap.vb_lock, and then work 3222 - * with the rest of init, holding btv->lock. 3223 - */ 3224 - mutex_lock(&fh->cap.vb_lock); 3225 3296 *fh = btv->init; 3226 - mutex_unlock(&fh->cap.vb_lock); 3227 3297 3228 3298 fh->type = type; 3229 3299 fh->ov.setup_ok = 0; 3230 3300 3231 - mutex_lock(&btv->lock); 3232 3301 v4l2_prio_open(&btv->prio, &fh->prio); 3233 3302 3234 3303 videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, ··· 3224 3317 V4L2_BUF_TYPE_VIDEO_CAPTURE, 3225 3318 V4L2_FIELD_INTERLACED, 3226 3319 sizeof(struct bttv_buffer), 3227 - fh, NULL); 3320 + fh, &btv->lock); 3228 3321 videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, 3229 3322 &btv->c.pci->dev, &btv->s_lock, 3230 3323 V4L2_BUF_TYPE_VBI_CAPTURE, 3231 3324 V4L2_FIELD_SEQ_TB, 3232 3325 sizeof(struct bttv_buffer), 3233 - fh, NULL); 3326 + fh, &btv->lock); 3234 3327 set_tvnorm(btv,btv->tvnorm); 3235 3328 set_input(btv, btv->input, btv->tvnorm); 3236 3329 ··· 3253 3346 bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); 3254 3347 3255 3348 bttv_field_count(btv); 3256 - mutex_unlock(&btv->lock); 3257 3349 return 0; 3258 3350 } 3259 3351 ··· 3261 3355 struct bttv_fh *fh = file->private_data; 3262 3356 struct bttv *btv = fh->btv; 3263 3357 3264 - mutex_lock(&btv->lock); 3265 3358 /* turn off overlay */ 3266 3359 if (check_btres(fh, RESOURCE_OVERLAY)) 3267 3360 bttv_switch_overlay(btv,fh,NULL); ··· 3286 3381 3287 3382 /* free stuff */ 3288 3383 3289 - /* 3290 - * videobuf uses cap.vb_lock - we should avoid holding btv->lock, 3291 - * otherwise we may have dead lock conditions 3292 - */ 3293 - mutex_unlock(&btv->lock); 3294 3384 videobuf_mmap_free(&fh->cap); 3295 3385 videobuf_mmap_free(&fh->vbi); 3296 - mutex_lock(&btv->lock); 3297 3386 v4l2_prio_close(&btv->prio, fh->prio); 3298 3387 file->private_data = NULL; 3299 3388 kfree(fh); ··· 3297 3398 3298 3399 if (!btv->users) 3299 3400 audio_mute(btv, 1); 3300 - mutex_unlock(&btv->lock); 3301 3401 3302 3402 return 0; 3303 3403 } ··· 3400 3502 if (unlikely(!fh)) 3401 3503 return -ENOMEM; 3402 3504 file->private_data = fh; 3403 - mutex_lock(&fh->cap.vb_lock); 3404 3505 *fh = btv->init; 3405 - mutex_unlock(&fh->cap.vb_lock); 3406 3506 3407 - mutex_lock(&btv->lock); 3408 3507 v4l2_prio_open(&btv->prio, &fh->prio); 3409 3508 3410 3509 btv->radio_user++; ··· 3409 3514 bttv_call_all(btv, tuner, s_radio); 3410 3515 audio_input(btv,TVAUDIO_INPUT_RADIO); 3411 3516 3412 - mutex_unlock(&btv->lock); 3413 3517 return 0; 3414 3518 } 3415 3519 ··· 3418 3524 struct bttv *btv = fh->btv; 3419 3525 struct rds_command cmd; 3420 3526 3421 - mutex_lock(&btv->lock); 3422 3527 v4l2_prio_close(&btv->prio, fh->prio); 3423 3528 file->private_data = NULL; 3424 3529 kfree(fh); ··· 3425 3532 btv->radio_user--; 3426 3533 3427 3534 bttv_call_all(btv, core, ioctl, RDS_CMD_CLOSE, &cmd); 3428 - mutex_unlock(&btv->lock); 3429 3535 3430 3536 return 0; 3431 3537 } ··· 3453 3561 return -EINVAL; 3454 3562 if (0 != t->index) 3455 3563 return -EINVAL; 3456 - mutex_lock(&btv->lock); 3457 3564 strcpy(t->name, "Radio"); 3458 3565 t->type = V4L2_TUNER_RADIO; 3459 3566 ··· 3460 3569 3461 3570 if (btv->audio_mode_gpio) 3462 3571 btv->audio_mode_gpio(btv, t, 0); 3463 - 3464 - mutex_unlock(&btv->lock); 3465 3572 3466 3573 return 0; 3467 3574 } ··· 3581 3692 .open = radio_open, 3582 3693 .read = radio_read, 3583 3694 .release = radio_release, 3584 - .ioctl = video_ioctl2, 3695 + .unlocked_ioctl = video_ioctl2, 3585 3696 .poll = radio_poll, 3586 3697 }; 3587 3698
+184 -232
drivers/media/video/gspca/sonixj.c
··· 63 63 #define QUALITY_DEF 80 64 64 u8 jpegqual; /* webcam quality */ 65 65 66 + u8 reg01; 67 + u8 reg17; 66 68 u8 reg18; 69 + u8 flags; 67 70 68 71 s8 ag_cnt; 69 72 #define AG_CNT_START 13 ··· 98 95 SENSOR_SOI768, 99 96 SENSOR_SP80708, 100 97 }; 98 + 99 + /* device flags */ 100 + #define PDN_INV 1 /* inverse pin S_PWR_DN / sn_xxx tables */ 101 + 102 + /* sn9c1xx definitions */ 103 + /* register 0x01 */ 104 + #define S_PWR_DN 0x01 /* sensor power down */ 105 + #define S_PDN_INV 0x02 /* inverse pin S_PWR_DN */ 106 + #define V_TX_EN 0x04 /* video transfer enable */ 107 + #define LED 0x08 /* output to pin LED */ 108 + #define SCL_SEL_OD 0x20 /* open-drain mode */ 109 + #define SYS_SEL_48M 0x40 /* system clock 0: 24MHz, 1: 48MHz */ 110 + /* register 0x17 */ 111 + #define MCK_SIZE_MASK 0x1f /* sensor master clock */ 112 + #define SEN_CLK_EN 0x20 /* enable sensor clock */ 113 + #define DEF_EN 0x80 /* defect pixel by 0: soft, 1: hard */ 101 114 102 115 /* V4L2 controls supported by the driver */ 103 116 static void setbrightness(struct gspca_dev *gspca_dev); ··· 1774 1755 } 1775 1756 } 1776 1757 1777 - static void bridge_init(struct gspca_dev *gspca_dev, 1778 - const u8 *sn9c1xx) 1779 - { 1780 - struct sd *sd = (struct sd *) gspca_dev; 1781 - u8 reg0102[2]; 1782 - const u8 *reg9a; 1783 - static const u8 reg9a_def[] = 1784 - {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; 1785 - static const u8 reg9a_spec[] = 1786 - {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; 1787 - static const u8 regd4[] = {0x60, 0x00, 0x00}; 1788 - 1789 - /* sensor clock already enabled in sd_init */ 1790 - /* reg_w1(gspca_dev, 0xf1, 0x00); */ 1791 - reg_w1(gspca_dev, 0x01, sn9c1xx[1]); 1792 - 1793 - /* configure gpio */ 1794 - reg0102[0] = sn9c1xx[1]; 1795 - reg0102[1] = sn9c1xx[2]; 1796 - if (gspca_dev->audio) 1797 - reg0102[1] |= 0x04; /* keep the audio connection */ 1798 - reg_w(gspca_dev, 0x01, reg0102, 2); 1799 - reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); 1800 - reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); 1801 - switch (sd->sensor) { 1802 - case SENSOR_GC0307: 1803 - case SENSOR_OV7660: 1804 - case SENSOR_PO1030: 1805 - case SENSOR_PO2030N: 1806 - case SENSOR_SOI768: 1807 - case SENSOR_SP80708: 1808 - reg9a = reg9a_spec; 1809 - break; 1810 - default: 1811 - reg9a = reg9a_def; 1812 - break; 1813 - } 1814 - reg_w(gspca_dev, 0x9a, reg9a, 6); 1815 - 1816 - reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); 1817 - 1818 - reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); 1819 - 1820 - switch (sd->sensor) { 1821 - case SENSOR_ADCM1700: 1822 - reg_w1(gspca_dev, 0x01, 0x43); 1823 - reg_w1(gspca_dev, 0x17, 0x62); 1824 - reg_w1(gspca_dev, 0x01, 0x42); 1825 - reg_w1(gspca_dev, 0x01, 0x42); 1826 - break; 1827 - case SENSOR_GC0307: 1828 - msleep(50); 1829 - reg_w1(gspca_dev, 0x01, 0x61); 1830 - reg_w1(gspca_dev, 0x17, 0x22); 1831 - reg_w1(gspca_dev, 0x01, 0x60); 1832 - reg_w1(gspca_dev, 0x01, 0x40); 1833 - msleep(50); 1834 - break; 1835 - case SENSOR_MI0360B: 1836 - reg_w1(gspca_dev, 0x01, 0x61); 1837 - reg_w1(gspca_dev, 0x17, 0x60); 1838 - reg_w1(gspca_dev, 0x01, 0x60); 1839 - reg_w1(gspca_dev, 0x01, 0x40); 1840 - break; 1841 - case SENSOR_MT9V111: 1842 - reg_w1(gspca_dev, 0x01, 0x61); 1843 - reg_w1(gspca_dev, 0x17, 0x61); 1844 - reg_w1(gspca_dev, 0x01, 0x60); 1845 - reg_w1(gspca_dev, 0x01, 0x40); 1846 - break; 1847 - case SENSOR_OM6802: 1848 - msleep(10); 1849 - reg_w1(gspca_dev, 0x02, 0x73); 1850 - reg_w1(gspca_dev, 0x17, 0x60); 1851 - reg_w1(gspca_dev, 0x01, 0x22); 1852 - msleep(100); 1853 - reg_w1(gspca_dev, 0x01, 0x62); 1854 - reg_w1(gspca_dev, 0x17, 0x64); 1855 - reg_w1(gspca_dev, 0x17, 0x64); 1856 - reg_w1(gspca_dev, 0x01, 0x42); 1857 - msleep(10); 1858 - reg_w1(gspca_dev, 0x01, 0x42); 1859 - i2c_w8(gspca_dev, om6802_init0[0]); 1860 - i2c_w8(gspca_dev, om6802_init0[1]); 1861 - msleep(15); 1862 - reg_w1(gspca_dev, 0x02, 0x71); 1863 - msleep(150); 1864 - break; 1865 - case SENSOR_OV7630: 1866 - reg_w1(gspca_dev, 0x01, 0x61); 1867 - reg_w1(gspca_dev, 0x17, 0xe2); 1868 - reg_w1(gspca_dev, 0x01, 0x60); 1869 - reg_w1(gspca_dev, 0x01, 0x40); 1870 - break; 1871 - case SENSOR_OV7648: 1872 - reg_w1(gspca_dev, 0x01, 0x63); 1873 - reg_w1(gspca_dev, 0x17, 0x20); 1874 - reg_w1(gspca_dev, 0x01, 0x62); 1875 - reg_w1(gspca_dev, 0x01, 0x42); 1876 - break; 1877 - case SENSOR_PO1030: 1878 - case SENSOR_SOI768: 1879 - reg_w1(gspca_dev, 0x01, 0x61); 1880 - reg_w1(gspca_dev, 0x17, 0x20); 1881 - reg_w1(gspca_dev, 0x01, 0x60); 1882 - reg_w1(gspca_dev, 0x01, 0x40); 1883 - break; 1884 - case SENSOR_PO2030N: 1885 - case SENSOR_OV7660: 1886 - reg_w1(gspca_dev, 0x01, 0x63); 1887 - reg_w1(gspca_dev, 0x17, 0x20); 1888 - reg_w1(gspca_dev, 0x01, 0x62); 1889 - reg_w1(gspca_dev, 0x01, 0x42); 1890 - break; 1891 - case SENSOR_SP80708: 1892 - reg_w1(gspca_dev, 0x01, 0x63); 1893 - reg_w1(gspca_dev, 0x17, 0x20); 1894 - reg_w1(gspca_dev, 0x01, 0x62); 1895 - reg_w1(gspca_dev, 0x01, 0x42); 1896 - msleep(100); 1897 - reg_w1(gspca_dev, 0x02, 0x62); 1898 - break; 1899 - default: 1900 - /* case SENSOR_HV7131R: */ 1901 - /* case SENSOR_MI0360: */ 1902 - /* case SENSOR_MO4000: */ 1903 - reg_w1(gspca_dev, 0x01, 0x43); 1904 - reg_w1(gspca_dev, 0x17, 0x61); 1905 - reg_w1(gspca_dev, 0x01, 0x42); 1906 - if (sd->sensor == SENSOR_HV7131R) 1907 - hv7131r_probe(gspca_dev); 1908 - break; 1909 - } 1910 - } 1911 - 1912 1758 /* this function is called at probe time */ 1913 1759 static int sd_config(struct gspca_dev *gspca_dev, 1914 1760 const struct usb_device_id *id) ··· 1782 1898 struct cam *cam; 1783 1899 1784 1900 sd->bridge = id->driver_info >> 16; 1785 - sd->sensor = id->driver_info; 1901 + sd->sensor = id->driver_info >> 8; 1902 + sd->flags = id->driver_info; 1786 1903 1787 1904 cam = &gspca_dev->cam; 1788 1905 if (sd->sensor == SENSOR_ADCM1700) { ··· 1814 1929 /* setup a selector by bridge */ 1815 1930 reg_w1(gspca_dev, 0xf1, 0x01); 1816 1931 reg_r(gspca_dev, 0x00, 1); 1817 - reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]); 1932 + reg_w1(gspca_dev, 0xf1, 0x00); 1818 1933 reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */ 1819 1934 regF1 = gspca_dev->usb_buf[0]; 1820 1935 if (gspca_dev->usb_err < 0) ··· 2308 2423 { 2309 2424 struct sd *sd = (struct sd *) gspca_dev; 2310 2425 int i; 2311 - u8 reg1, reg17; 2426 + u8 reg01, reg17; 2427 + u8 reg0102[2]; 2312 2428 const u8 *sn9c1xx; 2313 2429 const u8 (*init)[8]; 2430 + const u8 *reg9a; 2314 2431 int mode; 2432 + static const u8 reg9a_def[] = 2433 + {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; 2434 + static const u8 reg9a_spec[] = 2435 + {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; 2436 + static const u8 regd4[] = {0x60, 0x00, 0x00}; 2315 2437 static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; 2316 2438 static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; 2317 2439 static const u8 CA_adcm1700[] = ··· 2340 2448 2341 2449 /* initialize the bridge */ 2342 2450 sn9c1xx = sn_tb[sd->sensor]; 2343 - bridge_init(gspca_dev, sn9c1xx); 2451 + 2452 + /* sensor clock already enabled in sd_init */ 2453 + /* reg_w1(gspca_dev, 0xf1, 0x00); */ 2454 + reg01 = sn9c1xx[1]; 2455 + if (sd->flags & PDN_INV) 2456 + reg01 ^= S_PDN_INV; /* power down inverted */ 2457 + reg_w1(gspca_dev, 0x01, reg01); 2458 + 2459 + /* configure gpio */ 2460 + reg0102[0] = reg01; 2461 + reg0102[1] = sn9c1xx[2]; 2462 + if (gspca_dev->audio) 2463 + reg0102[1] |= 0x04; /* keep the audio connection */ 2464 + reg_w(gspca_dev, 0x01, reg0102, 2); 2465 + reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); 2466 + reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); 2467 + switch (sd->sensor) { 2468 + case SENSOR_GC0307: 2469 + case SENSOR_OV7660: 2470 + case SENSOR_PO1030: 2471 + case SENSOR_PO2030N: 2472 + case SENSOR_SOI768: 2473 + case SENSOR_SP80708: 2474 + reg9a = reg9a_spec; 2475 + break; 2476 + default: 2477 + reg9a = reg9a_def; 2478 + break; 2479 + } 2480 + reg_w(gspca_dev, 0x9a, reg9a, 6); 2481 + 2482 + reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); 2483 + 2484 + reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); 2485 + 2486 + reg17 = sn9c1xx[0x17]; 2487 + switch (sd->sensor) { 2488 + case SENSOR_GC0307: 2489 + msleep(50); /*fixme: is it useful? */ 2490 + break; 2491 + case SENSOR_OM6802: 2492 + msleep(10); 2493 + reg_w1(gspca_dev, 0x02, 0x73); 2494 + reg17 |= SEN_CLK_EN; 2495 + reg_w1(gspca_dev, 0x17, reg17); 2496 + reg_w1(gspca_dev, 0x01, 0x22); 2497 + msleep(100); 2498 + reg01 = SCL_SEL_OD | S_PDN_INV; 2499 + reg17 &= MCK_SIZE_MASK; 2500 + reg17 |= 0x04; /* clock / 4 */ 2501 + break; 2502 + } 2503 + reg01 |= SYS_SEL_48M; 2504 + reg_w1(gspca_dev, 0x01, reg01); 2505 + reg17 |= SEN_CLK_EN; 2506 + reg_w1(gspca_dev, 0x17, reg17); 2507 + reg01 &= ~S_PWR_DN; /* sensor power on */ 2508 + reg_w1(gspca_dev, 0x01, reg01); 2509 + reg01 &= ~SYS_SEL_48M; 2510 + reg_w1(gspca_dev, 0x01, reg01); 2511 + 2512 + switch (sd->sensor) { 2513 + case SENSOR_HV7131R: 2514 + hv7131r_probe(gspca_dev); /*fixme: is it useful? */ 2515 + break; 2516 + case SENSOR_OM6802: 2517 + msleep(10); 2518 + reg_w1(gspca_dev, 0x01, reg01); 2519 + i2c_w8(gspca_dev, om6802_init0[0]); 2520 + i2c_w8(gspca_dev, om6802_init0[1]); 2521 + msleep(15); 2522 + reg_w1(gspca_dev, 0x02, 0x71); 2523 + msleep(150); 2524 + break; 2525 + case SENSOR_SP80708: 2526 + msleep(100); 2527 + reg_w1(gspca_dev, 0x02, 0x62); 2528 + break; 2529 + } 2344 2530 2345 2531 /* initialize the sensor */ 2346 2532 i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); ··· 2446 2476 } 2447 2477 reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); 2448 2478 switch (sd->sensor) { 2449 - case SENSOR_GC0307: 2450 - reg17 = 0xa2; 2451 - break; 2452 - case SENSOR_MT9V111: 2453 - case SENSOR_MI0360B: 2454 - reg17 = 0xe0; 2455 - break; 2456 - case SENSOR_ADCM1700: 2457 - case SENSOR_OV7630: 2458 - reg17 = 0xe2; 2459 - break; 2460 - case SENSOR_OV7648: 2461 - reg17 = 0x20; 2462 - break; 2463 - case SENSOR_OV7660: 2464 - case SENSOR_SOI768: 2465 - reg17 = 0xa0; 2466 - break; 2467 - case SENSOR_PO1030: 2468 - case SENSOR_PO2030N: 2469 - reg17 = 0xa0; 2479 + case SENSOR_OM6802: 2480 + /* case SENSOR_OV7648: * fixme: sometimes */ 2470 2481 break; 2471 2482 default: 2472 - reg17 = 0x60; 2483 + reg17 |= DEF_EN; 2473 2484 break; 2474 2485 } 2475 2486 reg_w1(gspca_dev, 0x17, reg17); ··· 2497 2546 2498 2547 init = NULL; 2499 2548 mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; 2500 - if (mode) 2501 - reg1 = 0x46; /* 320x240: clk 48Mhz, video trf enable */ 2502 - else 2503 - reg1 = 0x06; /* 640x480: clk 24Mhz, video trf enable */ 2504 - reg17 = 0x61; /* 0x:20: enable sensor clock */ 2549 + reg01 |= SYS_SEL_48M | V_TX_EN; 2550 + reg17 &= ~MCK_SIZE_MASK; 2551 + reg17 |= 0x02; /* clock / 2 */ 2505 2552 switch (sd->sensor) { 2506 2553 case SENSOR_ADCM1700: 2507 2554 init = adcm1700_sensor_param1; 2508 - reg1 = 0x46; 2509 - reg17 = 0xe2; 2510 2555 break; 2511 2556 case SENSOR_GC0307: 2512 2557 init = gc0307_sensor_param1; 2513 - reg17 = 0xa2; 2514 - reg1 = 0x44; 2558 + break; 2559 + case SENSOR_HV7131R: 2560 + case SENSOR_MI0360: 2561 + if (mode) 2562 + reg01 |= SYS_SEL_48M; /* 320x240: clk 48Mhz */ 2563 + else 2564 + reg01 &= ~SYS_SEL_48M; /* 640x480: clk 24Mhz */ 2565 + reg17 &= ~MCK_SIZE_MASK; 2566 + reg17 |= 0x01; /* clock / 1 */ 2515 2567 break; 2516 2568 case SENSOR_MI0360B: 2517 2569 init = mi0360b_sensor_param1; 2518 - reg1 &= ~0x02; /* don't inverse pin S_PWR_DN */ 2519 - reg17 = 0xe2; 2520 2570 break; 2521 2571 case SENSOR_MO4000: 2522 - if (mode) { 2523 - /* reg1 = 0x46; * 320 clk 48Mhz 60fp/s */ 2524 - reg1 = 0x06; /* clk 24Mz */ 2525 - } else { 2526 - reg17 = 0x22; /* 640 MCKSIZE */ 2527 - /* reg1 = 0x06; * 640 clk 24Mz (done) */ 2572 + if (mode) { /* if 320x240 */ 2573 + reg01 &= ~SYS_SEL_48M; /* clk 24Mz */ 2574 + reg17 &= ~MCK_SIZE_MASK; 2575 + reg17 |= 0x01; /* clock / 1 */ 2528 2576 } 2529 2577 break; 2530 2578 case SENSOR_MT9V111: 2531 2579 init = mt9v111_sensor_param1; 2532 - if (mode) { 2533 - reg1 = 0x04; /* 320 clk 48Mhz */ 2534 - } else { 2535 - /* reg1 = 0x06; * 640 clk 24Mz (done) */ 2536 - reg17 = 0xc2; 2537 - } 2538 2580 break; 2539 2581 case SENSOR_OM6802: 2540 2582 init = om6802_sensor_param1; 2541 - reg17 = 0x64; /* 640 MCKSIZE */ 2583 + if (!mode) { /* if 640x480 */ 2584 + reg17 &= ~MCK_SIZE_MASK; 2585 + reg17 |= 0x01; /* clock / 4 */ 2586 + } 2542 2587 break; 2543 2588 case SENSOR_OV7630: 2544 2589 init = ov7630_sensor_param1; 2545 - reg17 = 0xe2; 2546 - reg1 = 0x44; 2547 2590 break; 2548 2591 case SENSOR_OV7648: 2549 2592 init = ov7648_sensor_param1; 2550 - reg17 = 0x21; 2551 - /* reg1 = 0x42; * 42 - 46? */ 2593 + reg17 &= ~MCK_SIZE_MASK; 2594 + reg17 |= 0x01; /* clock / 1 */ 2552 2595 break; 2553 2596 case SENSOR_OV7660: 2554 2597 init = ov7660_sensor_param1; 2555 - if (sd->bridge == BRIDGE_SN9C120) { 2556 - if (mode) { /* 320x240 - 160x120 */ 2557 - reg17 = 0xa2; 2558 - reg1 = 0x44; /* 48 Mhz, video trf eneble */ 2559 - } 2560 - } else { 2561 - reg17 = 0x22; 2562 - reg1 = 0x06; /* 24 Mhz, video trf eneble 2563 - * inverse power down */ 2564 - } 2565 2598 break; 2566 2599 case SENSOR_PO1030: 2567 2600 init = po1030_sensor_param1; 2568 - reg17 = 0xa2; 2569 - reg1 = 0x44; 2570 2601 break; 2571 2602 case SENSOR_PO2030N: 2572 2603 init = po2030n_sensor_param1; 2573 - reg1 = 0x46; 2574 - reg17 = 0xa2; 2575 2604 break; 2576 2605 case SENSOR_SOI768: 2577 2606 init = soi768_sensor_param1; 2578 - reg1 = 0x44; 2579 - reg17 = 0xa2; 2580 2607 break; 2581 2608 case SENSOR_SP80708: 2582 2609 init = sp80708_sensor_param1; 2583 - if (mode) { 2584 - /*?? reg1 = 0x04; * 320 clk 48Mhz */ 2585 - } else { 2586 - reg1 = 0x46; /* 640 clk 48Mz */ 2587 - reg17 = 0xa2; 2588 - } 2589 2610 break; 2590 2611 } 2591 2612 ··· 2607 2684 setjpegqual(gspca_dev); 2608 2685 2609 2686 reg_w1(gspca_dev, 0x17, reg17); 2610 - reg_w1(gspca_dev, 0x01, reg1); 2687 + reg_w1(gspca_dev, 0x01, reg01); 2688 + sd->reg01 = reg01; 2689 + sd->reg17 = reg17; 2611 2690 2612 2691 sethvflip(gspca_dev); 2613 2692 setbrightness(gspca_dev); ··· 2631 2706 { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; 2632 2707 static const u8 stopsoi768[] = 2633 2708 { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 }; 2634 - u8 data; 2635 - const u8 *sn9c1xx; 2709 + u8 reg01; 2710 + u8 reg17; 2636 2711 2637 - data = 0x0b; 2712 + reg01 = sd->reg01; 2713 + reg17 = sd->reg17 & ~SEN_CLK_EN; 2638 2714 switch (sd->sensor) { 2715 + case SENSOR_ADCM1700: 2639 2716 case SENSOR_GC0307: 2640 - data = 0x29; 2717 + case SENSOR_PO2030N: 2718 + case SENSOR_SP80708: 2719 + reg01 |= LED; 2720 + reg_w1(gspca_dev, 0x01, reg01); 2721 + reg01 &= ~(LED | V_TX_EN); 2722 + reg_w1(gspca_dev, 0x01, reg01); 2723 + /* reg_w1(gspca_dev, 0x02, 0x??); * LED off ? */ 2641 2724 break; 2642 2725 case SENSOR_HV7131R: 2726 + reg01 &= ~V_TX_EN; 2727 + reg_w1(gspca_dev, 0x01, reg01); 2643 2728 i2c_w8(gspca_dev, stophv7131); 2644 - data = 0x2b; 2645 2729 break; 2646 2730 case SENSOR_MI0360: 2647 2731 case SENSOR_MI0360B: 2732 + reg01 &= ~V_TX_EN; 2733 + reg_w1(gspca_dev, 0x01, reg01); 2734 + /* reg_w1(gspca_dev, 0x02, 0x40); * LED off ? */ 2648 2735 i2c_w8(gspca_dev, stopmi0360); 2649 - data = 0x29; 2650 2736 break; 2651 - case SENSOR_OV7648: 2652 - i2c_w8(gspca_dev, stopov7648); 2653 - /* fall thru */ 2654 2737 case SENSOR_MT9V111: 2655 - case SENSOR_OV7630: 2738 + case SENSOR_OM6802: 2656 2739 case SENSOR_PO1030: 2657 - data = 0x29; 2740 + reg01 &= ~V_TX_EN; 2741 + reg_w1(gspca_dev, 0x01, reg01); 2742 + break; 2743 + case SENSOR_OV7630: 2744 + case SENSOR_OV7648: 2745 + reg01 &= ~V_TX_EN; 2746 + reg_w1(gspca_dev, 0x01, reg01); 2747 + i2c_w8(gspca_dev, stopov7648); 2748 + break; 2749 + case SENSOR_OV7660: 2750 + reg01 &= ~V_TX_EN; 2751 + reg_w1(gspca_dev, 0x01, reg01); 2658 2752 break; 2659 2753 case SENSOR_SOI768: 2660 2754 i2c_w8(gspca_dev, stopsoi768); 2661 - data = 0x29; 2662 2755 break; 2663 2756 } 2664 - sn9c1xx = sn_tb[sd->sensor]; 2665 - reg_w1(gspca_dev, 0x01, sn9c1xx[1]); 2666 - reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]); 2667 - reg_w1(gspca_dev, 0x01, sn9c1xx[1]); 2668 - reg_w1(gspca_dev, 0x01, data); 2757 + 2758 + reg01 |= SCL_SEL_OD; 2759 + reg_w1(gspca_dev, 0x01, reg01); 2760 + reg01 |= S_PWR_DN; /* sensor power down */ 2761 + reg_w1(gspca_dev, 0x01, reg01); 2762 + reg_w1(gspca_dev, 0x17, reg17); 2763 + reg01 &= ~SYS_SEL_48M; /* clock 24MHz */ 2764 + reg_w1(gspca_dev, 0x01, reg01); 2765 + reg01 |= LED; 2766 + reg_w1(gspca_dev, 0x01, reg01); 2669 2767 /* Don't disable sensor clock as that disables the button on the cam */ 2670 2768 /* reg_w1(gspca_dev, 0xf1, 0x01); */ 2671 2769 } ··· 2902 2954 /* -- module initialisation -- */ 2903 2955 #define BS(bridge, sensor) \ 2904 2956 .driver_info = (BRIDGE_ ## bridge << 16) \ 2905 - | SENSOR_ ## sensor 2957 + | (SENSOR_ ## sensor << 8) 2958 + #define BSF(bridge, sensor, flags) \ 2959 + .driver_info = (BRIDGE_ ## bridge << 16) \ 2960 + | (SENSOR_ ## sensor << 8) \ 2961 + | (flags) 2906 2962 static const __devinitdata struct usb_device_id device_table[] = { 2907 2963 #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE 2908 2964 {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, 2909 2965 {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, 2910 2966 #endif 2911 - {USB_DEVICE(0x045e, 0x00f5), BS(SN9C105, OV7660)}, 2912 - {USB_DEVICE(0x045e, 0x00f7), BS(SN9C105, OV7660)}, 2967 + {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, PDN_INV)}, 2968 + {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, PDN_INV)}, 2913 2969 {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, 2914 2970 {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, 2915 2971 {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)},
+4 -4
drivers/staging/cx25821/cx25821-video.c
··· 92 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 97 unsigned int i; 98 98 ··· 848 848 pix_format = 849 849 (dev->channels[ch_id].pixel_formats == 850 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 853 v4l2_prio_open(&dev->channels[ch_id].prio, &fh->prio); 854 854 ··· 1010 1010 if (0 != err) 1011 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 1014 fh->vidq.field = f->fmt.pix.field; 1015 1015 1016 1016 /* check if width and height is valid based on set standard */ ··· 1119 1119 enum v4l2_field field; 1120 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 1123 if (NULL == fmt) 1124 1124 return -EINVAL; 1125 1125
+1 -1
drivers/staging/cx25821/cx25821-video.h
··· 87 87 88 88 #define FORMAT_FLAGS_PACKED 0x01 89 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 91 extern struct cx25821_data timeout_data[MAX_VID_CHANNEL_NUM]; 92 92 93 93 extern void cx25821_dump_video_queue(struct cx25821_dev *dev,
+1 -1
include/media/saa7146.h
··· 161 161 extern struct mutex saa7146_devices_lock; 162 162 int saa7146_register_extension(struct saa7146_extension*); 163 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 165 int saa7146_pgtable_alloc(struct pci_dev *pci, struct saa7146_pgtable *pt); 166 166 void saa7146_pgtable_free(struct pci_dev *pci, struct saa7146_pgtable *pt); 167 167 int saa7146_pgtable_build_single(struct pci_dev *pci, struct saa7146_pgtable *pt, struct scatterlist *list, int length );