aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorJean-François Moine <moinejf@free.fr>2010-11-11 06:27:24 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-29 05:16:41 -0500
commit7bbe6b8d1f63c2f7482c93d8cd986b1774e6436d (patch)
tree45edc75d50ebcddd835c9aa6448ac96e2bda99a0 /drivers/media
parentd6fa66384b38165126ce2866b4bdff756c6fc761 (diff)
[media] gspca - ov519: Define the sensor types in an enum
This patch also checks if the sensor is well detected at connection 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')
-rw-r--r--drivers/media/video/gspca/ov519.c37
1 files changed, 21 insertions, 16 deletions
diff --git a/drivers/media/video/gspca/ov519.c b/drivers/media/video/gspca/ov519.c
index d73e1c75541b..5da1a4e3737d 100644
--- a/drivers/media/video/gspca/ov519.c
+++ b/drivers/media/video/gspca/ov519.c
@@ -107,21 +107,7 @@ struct sd {
107 u8 frame_rate; /* current Framerate */ 107 u8 frame_rate; /* current Framerate */
108 u8 clockdiv; /* clockdiv override */ 108 u8 clockdiv; /* clockdiv override */
109 109
110 u8 sensor; /* Type of image sensor chip (SEN_*) */ 110 s8 sensor; /* Type of image sensor chip (SEN_*) */
111#define SEN_UNKNOWN 0
112#define SEN_OV2610 1
113#define SEN_OV3610 2
114#define SEN_OV6620 3
115#define SEN_OV6630 4
116#define SEN_OV66308AF 5
117#define SEN_OV7610 6
118#define SEN_OV7620 7
119#define SEN_OV7620AE 8
120#define SEN_OV7640 9
121#define SEN_OV7648 10
122#define SEN_OV7670 11
123#define SEN_OV76BE 12
124#define SEN_OV8610 13
125 111
126 u8 sensor_addr; 112 u8 sensor_addr;
127 u16 sensor_width; 113 u16 sensor_width;
@@ -130,6 +116,21 @@ struct sd {
130 116
131 u8 jpeg_hdr[JPEG_HDR_SZ]; 117 u8 jpeg_hdr[JPEG_HDR_SZ];
132}; 118};
119enum sensors {
120 SEN_OV2610,
121 SEN_OV3610,
122 SEN_OV6620,
123 SEN_OV6630,
124 SEN_OV66308AF,
125 SEN_OV7610,
126 SEN_OV7620,
127 SEN_OV7620AE,
128 SEN_OV7640,
129 SEN_OV7648,
130 SEN_OV7670,
131 SEN_OV76BE,
132 SEN_OV8610,
133};
133 134
134/* Note this is a bit of a hack, but the w9968cf driver needs the code for all 135/* Note this is a bit of a hack, but the w9968cf driver needs the code for all
135 the ov sensors which is already present here. When we have the time we 136 the ov sensors which is already present here. When we have the time we
@@ -3010,6 +3011,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
3010 /* The OV519 must be more aggressive about sensor detection since 3011 /* The OV519 must be more aggressive about sensor detection since
3011 * I2C write will never fail if the sensor is not present. We have 3012 * I2C write will never fail if the sensor is not present. We have
3012 * to try to initialize the sensor to detect its presence */ 3013 * to try to initialize the sensor to detect its presence */
3014 sd->sensor = -1;
3013 3015
3014 /* Test for 76xx */ 3016 /* Test for 76xx */
3015 if (init_ov_sensor(sd, OV7xx0_SID) >= 0) { 3017 if (init_ov_sensor(sd, OV7xx0_SID) >= 0) {
@@ -3040,6 +3042,9 @@ static int sd_config(struct gspca_dev *gspca_dev,
3040 goto error; 3042 goto error;
3041 } 3043 }
3042 3044
3045 if (sd->sensor < 0)
3046 goto error;
3047
3043 switch (sd->bridge) { 3048 switch (sd->bridge) {
3044 case BRIDGE_OV511: 3049 case BRIDGE_OV511:
3045 case BRIDGE_OV511PLUS: 3050 case BRIDGE_OV511PLUS:
@@ -3117,7 +3122,7 @@ static int sd_config(struct gspca_dev *gspca_dev,
3117 return 0; 3122 return 0;
3118error: 3123error:
3119 PDEBUG(D_ERR, "OV519 Config failed"); 3124 PDEBUG(D_ERR, "OV519 Config failed");
3120 return -EBUSY; 3125 return -EINVAL;
3121} 3126}
3122 3127
3123/* this function is called at probe and resume time */ 3128/* this function is called at probe and resume time */