diff options
author | Jean-François Moine <moinejf@free.fr> | 2010-11-13 01:56:41 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-29 05:16:43 -0500 |
commit | 7491f785dd02bc35551e0463d798959b15644c1d (patch) | |
tree | ffff9c19afb745c1d54d801152d9832d7c425d45 /drivers/media/video/gspca/ov519.c | |
parent | b4e96ea30a211c0979e9e0ea10f39dfa50afb8fa (diff) |
[media] gspca - ov519: Re-initialize the webcam at resume time
Signed-off-by: Jean-François Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/ov519.c')
-rw-r--r-- | drivers/media/video/gspca/ov519.c | 90 |
1 files changed, 52 insertions, 38 deletions
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c index 1d0fb4d91db4..08f07c3488d8 100644 --- a/drivers/media/video/gspca/ov519.c +++ b/drivers/media/video/gspca/ov519.c | |||
@@ -2948,28 +2948,64 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
2948 | switch (sd->bridge) { | 2948 | switch (sd->bridge) { |
2949 | case BRIDGE_OV511: | 2949 | case BRIDGE_OV511: |
2950 | case BRIDGE_OV511PLUS: | 2950 | case BRIDGE_OV511PLUS: |
2951 | ov511_configure(gspca_dev); | 2951 | cam->cam_mode = ov511_vga_mode; |
2952 | cam->nmodes = ARRAY_SIZE(ov511_vga_mode); | ||
2952 | break; | 2953 | break; |
2953 | case BRIDGE_OV518: | 2954 | case BRIDGE_OV518: |
2954 | case BRIDGE_OV518PLUS: | 2955 | case BRIDGE_OV518PLUS: |
2955 | ov518_configure(gspca_dev); | 2956 | cam->cam_mode = ov518_vga_mode; |
2957 | cam->nmodes = ARRAY_SIZE(ov518_vga_mode); | ||
2956 | break; | 2958 | break; |
2957 | case BRIDGE_OV519: | 2959 | case BRIDGE_OV519: |
2958 | ov519_configure(sd); | 2960 | cam->cam_mode = ov519_vga_mode; |
2961 | cam->nmodes = ARRAY_SIZE(ov519_vga_mode); | ||
2962 | sd->invert_led = !sd->invert_led; | ||
2959 | break; | 2963 | break; |
2960 | case BRIDGE_OVFX2: | 2964 | case BRIDGE_OVFX2: |
2961 | ovfx2_configure(sd); | 2965 | cam->cam_mode = ov519_vga_mode; |
2966 | cam->nmodes = ARRAY_SIZE(ov519_vga_mode); | ||
2962 | cam->bulk_size = OVFX2_BULK_SIZE; | 2967 | cam->bulk_size = OVFX2_BULK_SIZE; |
2963 | cam->bulk_nurbs = MAX_NURBS; | 2968 | cam->bulk_nurbs = MAX_NURBS; |
2964 | cam->bulk = 1; | 2969 | cam->bulk = 1; |
2965 | break; | 2970 | break; |
2966 | case BRIDGE_W9968CF: | 2971 | case BRIDGE_W9968CF: |
2967 | w9968cf_configure(sd); | 2972 | cam->cam_mode = w9968cf_vga_mode; |
2973 | cam->nmodes = ARRAY_SIZE(w9968cf_vga_mode); | ||
2968 | cam->reverse_alts = 1; | 2974 | cam->reverse_alts = 1; |
2969 | break; | 2975 | break; |
2970 | } | 2976 | } |
2971 | 2977 | ||
2972 | ov51x_led_control(sd, 0); /* turn LED off */ | 2978 | gspca_dev->cam.ctrls = sd->ctrls; |
2979 | sd->quality = QUALITY_DEF; | ||
2980 | |||
2981 | return 0; | ||
2982 | } | ||
2983 | |||
2984 | /* this function is called at probe and resume time */ | ||
2985 | static int sd_init(struct gspca_dev *gspca_dev) | ||
2986 | { | ||
2987 | struct sd *sd = (struct sd *) gspca_dev; | ||
2988 | struct cam *cam = &gspca_dev->cam; | ||
2989 | |||
2990 | switch (sd->bridge) { | ||
2991 | case BRIDGE_OV511: | ||
2992 | case BRIDGE_OV511PLUS: | ||
2993 | ov511_configure(gspca_dev); | ||
2994 | break; | ||
2995 | case BRIDGE_OV518: | ||
2996 | case BRIDGE_OV518PLUS: | ||
2997 | ov518_configure(gspca_dev); | ||
2998 | break; | ||
2999 | case BRIDGE_OV519: | ||
3000 | ov519_configure(sd); | ||
3001 | break; | ||
3002 | case BRIDGE_OVFX2: | ||
3003 | ovfx2_configure(sd); | ||
3004 | break; | ||
3005 | case BRIDGE_W9968CF: | ||
3006 | w9968cf_configure(sd); | ||
3007 | break; | ||
3008 | } | ||
2973 | 3009 | ||
2974 | /* The OV519 must be more aggressive about sensor detection since | 3010 | /* The OV519 must be more aggressive about sensor detection since |
2975 | * I2C write will never fail if the sensor is not present. We have | 3011 | * I2C write will never fail if the sensor is not present. We have |
@@ -2999,32 +3035,25 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
2999 | if (sd->sensor < 0) | 3035 | if (sd->sensor < 0) |
3000 | goto error; | 3036 | goto error; |
3001 | 3037 | ||
3038 | ov51x_led_control(sd, 0); /* turn LED off */ | ||
3039 | |||
3002 | switch (sd->bridge) { | 3040 | switch (sd->bridge) { |
3003 | case BRIDGE_OV511: | 3041 | case BRIDGE_OV511: |
3004 | case BRIDGE_OV511PLUS: | 3042 | case BRIDGE_OV511PLUS: |
3005 | if (!sd->sif) { | 3043 | if (sd->sif) { |
3006 | cam->cam_mode = ov511_vga_mode; | ||
3007 | cam->nmodes = ARRAY_SIZE(ov511_vga_mode); | ||
3008 | } else { | ||
3009 | cam->cam_mode = ov511_sif_mode; | 3044 | cam->cam_mode = ov511_sif_mode; |
3010 | cam->nmodes = ARRAY_SIZE(ov511_sif_mode); | 3045 | cam->nmodes = ARRAY_SIZE(ov511_sif_mode); |
3011 | } | 3046 | } |
3012 | break; | 3047 | break; |
3013 | case BRIDGE_OV518: | 3048 | case BRIDGE_OV518: |
3014 | case BRIDGE_OV518PLUS: | 3049 | case BRIDGE_OV518PLUS: |
3015 | if (!sd->sif) { | 3050 | if (sd->sif) { |
3016 | cam->cam_mode = ov518_vga_mode; | ||
3017 | cam->nmodes = ARRAY_SIZE(ov518_vga_mode); | ||
3018 | } else { | ||
3019 | cam->cam_mode = ov518_sif_mode; | 3051 | cam->cam_mode = ov518_sif_mode; |
3020 | cam->nmodes = ARRAY_SIZE(ov518_sif_mode); | 3052 | cam->nmodes = ARRAY_SIZE(ov518_sif_mode); |
3021 | } | 3053 | } |
3022 | break; | 3054 | break; |
3023 | case BRIDGE_OV519: | 3055 | case BRIDGE_OV519: |
3024 | if (!sd->sif) { | 3056 | if (sd->sif) { |
3025 | cam->cam_mode = ov519_vga_mode; | ||
3026 | cam->nmodes = ARRAY_SIZE(ov519_vga_mode); | ||
3027 | } else { | ||
3028 | cam->cam_mode = ov519_sif_mode; | 3057 | cam->cam_mode = ov519_sif_mode; |
3029 | cam->nmodes = ARRAY_SIZE(ov519_sif_mode); | 3058 | cam->nmodes = ARRAY_SIZE(ov519_sif_mode); |
3030 | } | 3059 | } |
@@ -3036,40 +3065,22 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
3036 | } else if (sd->sensor == SEN_OV3610) { | 3065 | } else if (sd->sensor == SEN_OV3610) { |
3037 | cam->cam_mode = ovfx2_ov3610_mode; | 3066 | cam->cam_mode = ovfx2_ov3610_mode; |
3038 | cam->nmodes = ARRAY_SIZE(ovfx2_ov3610_mode); | 3067 | cam->nmodes = ARRAY_SIZE(ovfx2_ov3610_mode); |
3039 | } else if (!sd->sif) { | 3068 | } else if (sd->sif) { |
3040 | cam->cam_mode = ov519_vga_mode; | ||
3041 | cam->nmodes = ARRAY_SIZE(ov519_vga_mode); | ||
3042 | } else { | ||
3043 | cam->cam_mode = ov519_sif_mode; | 3069 | cam->cam_mode = ov519_sif_mode; |
3044 | cam->nmodes = ARRAY_SIZE(ov519_sif_mode); | 3070 | cam->nmodes = ARRAY_SIZE(ov519_sif_mode); |
3045 | } | 3071 | } |
3046 | break; | 3072 | break; |
3047 | case BRIDGE_W9968CF: | 3073 | case BRIDGE_W9968CF: |
3048 | cam->cam_mode = w9968cf_vga_mode; | ||
3049 | cam->nmodes = ARRAY_SIZE(w9968cf_vga_mode); | ||
3050 | if (sd->sif) | 3074 | if (sd->sif) |
3051 | cam->nmodes--; | 3075 | cam->nmodes = ARRAY_SIZE(w9968cf_vga_mode) - 1; |
3052 | 3076 | ||
3053 | /* w9968cf needs initialisation once the sensor is known */ | 3077 | /* w9968cf needs initialisation once the sensor is known */ |
3054 | w9968cf_init(sd); | 3078 | w9968cf_init(sd); |
3055 | break; | 3079 | break; |
3056 | } | 3080 | } |
3057 | gspca_dev->cam.ctrls = sd->ctrls; | ||
3058 | sd->quality = QUALITY_DEF; | ||
3059 | 3081 | ||
3060 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; | 3082 | gspca_dev->ctrl_dis = ctrl_dis[sd->sensor]; |
3061 | 3083 | ||
3062 | return gspca_dev->usb_err; | ||
3063 | error: | ||
3064 | PDEBUG(D_ERR, "OV519 Config failed"); | ||
3065 | return -EINVAL; | ||
3066 | } | ||
3067 | |||
3068 | /* this function is called at probe and resume time */ | ||
3069 | static int sd_init(struct gspca_dev *gspca_dev) | ||
3070 | { | ||
3071 | struct sd *sd = (struct sd *) gspca_dev; | ||
3072 | |||
3073 | /* initialize the sensor */ | 3084 | /* initialize the sensor */ |
3074 | switch (sd->sensor) { | 3085 | switch (sd->sensor) { |
3075 | case SEN_OV2610: | 3086 | case SEN_OV2610: |
@@ -3117,6 +3128,9 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
3117 | break; | 3128 | break; |
3118 | } | 3129 | } |
3119 | return gspca_dev->usb_err; | 3130 | return gspca_dev->usb_err; |
3131 | error: | ||
3132 | PDEBUG(D_ERR, "OV519 Config failed"); | ||
3133 | return -EINVAL; | ||
3120 | } | 3134 | } |
3121 | 3135 | ||
3122 | /* Set up the OV511/OV511+ with the given image parameters. | 3136 | /* Set up the OV511/OV511+ with the given image parameters. |