aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/spca561.c
diff options
context:
space:
mode:
authorJean-Francois Moine <moinejf@free.fr>2008-12-19 05:21:26 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:39:41 -0500
commitf8a04a6fc4373001a7f311540dba5e4f4d86300f (patch)
tree2ba100feddfb9072695cd962d69006568a59306f /drivers/media/video/gspca/spca561.c
parent5b7ed28ec5deb57f790e38af8d813310b830743c (diff)
V4L/DVB (9988): gspca - spca561: Separate the bridge and sensor tables of Rev72a
Signed-off-by: Jean-Francois Moine <moinejf@free.fr> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/spca561.c')
-rw-r--r--drivers/media/video/gspca/spca561.c110
1 files changed, 49 insertions, 61 deletions
diff --git a/drivers/media/video/gspca/spca561.c b/drivers/media/video/gspca/spca561.c
index b31772c6ed32..0f7df3b3fba1 100644
--- a/drivers/media/video/gspca/spca561.c
+++ b/drivers/media/video/gspca/spca561.c
@@ -146,7 +146,7 @@ static struct v4l2_pix_format sif_072a_mode[] = {
146#define SPCA561_SNAPBIT 0x20 146#define SPCA561_SNAPBIT 0x20
147#define SPCA561_SNAPCTRL 0x40 147#define SPCA561_SNAPCTRL 0x40
148 148
149static const __u16 rev72a_init_data[][2] = { 149static const __u16 rev72a_init_data1[][2] = {
150 {0x0000, 0x8114}, /* Software GPIO output data */ 150 {0x0000, 0x8114}, /* Software GPIO output data */
151 {0x0001, 0x8114}, /* Software GPIO output data */ 151 {0x0001, 0x8114}, /* Software GPIO output data */
152 {0x0000, 0x8112}, /* Some kind of reset */ 152 {0x0000, 0x8112}, /* Some kind of reset */
@@ -156,44 +156,26 @@ static const __u16 rev72a_init_data[][2] = {
156 {0x0001, 0x8118}, /* Conf sensor */ 156 {0x0001, 0x8118}, /* Conf sensor */
157 {0x0092, 0x8804}, /* I know nothing about these */ 157 {0x0092, 0x8804}, /* I know nothing about these */
158 {0x0010, 0x8802}, /* 0x88xx registers, so I won't */ 158 {0x0010, 0x8802}, /* 0x88xx registers, so I won't */
159 /***************/
160 {0x000d, 0x8805}, /* sensor default setting */ 159 {0x000d, 0x8805}, /* sensor default setting */
161 {0x0001, 0x8801}, /* 1 <- 0x0d */ 160 {}
162 {0x0000, 0x8800}, 161};
163 {0x0018, 0x8805}, 162static const __u16 rev72a_init_sensor1[][2] = {
164 {0x0002, 0x8801}, /* 2 <- 0x18 */ 163 /* ms-win values */
165 {0x0000, 0x8800}, 164 {0x0001, 0x0018}, /* 0x01 <- 0x0d */
166 {0x0065, 0x8805}, 165 {0x0002, 0x0065}, /* 0x02 <- 0x18 */
167 {0x0004, 0x8801}, /* 4 <- 0x01 0x65 */ 166 {0x0004, 0x0121}, /* 0x04 <- 0x0165 */
168 {0x0001, 0x8800}, 167 {0x0005, 0x00aa}, /* 0x05 <- 0x21 */
169 {0x0021, 0x8805}, 168 {0x0007, 0x0004}, /* 0x07 <- 0xaa */
170 {0x0005, 0x8801}, /* 5 <- 0x21 */ 169 {0x0020, 0x1502}, /* 0x20 <- 0x1504 */
171 {0x0000, 0x8800}, 170 {0x0039, 0x0010}, /* 0x39 <- 0x02 */
172 {0x00aa, 0x8805}, 171 {0x0035, 0x0049}, /* 0x35 <- 0x10 */
173 {0x0007, 0x8801}, /* 7 <- 0xaa */ 172 {0x0009, 0x100b}, /* 0x09 <- 0x1049 */
174 {0x0000, 0x8800}, 173 {0x0028, 0x000f}, /* 0x28 <- 0x0b */
175 {0x0004, 0x8805}, 174 {0x003b, 0x003c}, /* 0x3b <- 0x0f */
176 {0x0020, 0x8801}, /* 0x20 <- 0x15 0x04 */ 175 {0x003c, 0x0000}, /* 0x3c <- 0x00 */
177 {0x0015, 0x8800}, 176 {}
178 {0x0002, 0x8805}, 177};
179 {0x0039, 0x8801}, /* 0x39 <- 0x02 */ 178static const __u16 rev72a_init_data2[][2] = {
180 {0x0000, 0x8800},
181 {0x0010, 0x8805},
182 {0x0035, 0x8801}, /* 0x35 <- 0x10 */
183 {0x0000, 0x8800},
184 {0x0049, 0x8805},
185 {0x0009, 0x8801}, /* 0x09 <- 0x10 0x49 */
186 {0x0010, 0x8800},
187 {0x000b, 0x8805},
188 {0x0028, 0x8801}, /* 0x28 <- 0x0b */
189 {0x0000, 0x8800},
190 {0x000f, 0x8805},
191 {0x003b, 0x8801}, /* 0x3b <- 0x0f */
192 {0x0000, 0x8800},
193 {0x0000, 0x8805},
194 {0x003c, 0x8801}, /* 0x3c <- 0x00 */
195 {0x0000, 0x8800},
196 /***************/
197 {0x0018, 0x8601}, /* Pixel/line selection for color separation */ 179 {0x0018, 0x8601}, /* Pixel/line selection for color separation */
198 {0x0000, 0x8602}, /* Optical black level for user setting */ 180 {0x0000, 0x8602}, /* Optical black level for user setting */
199 {0x0060, 0x8604}, /* Optical black horizontal offset */ 181 {0x0060, 0x8604}, /* Optical black horizontal offset */
@@ -234,29 +216,22 @@ static const __u16 rev72a_init_data[][2] = {
234 216
235 {0x0002, 0x865b}, /* Horizontal offset for valid pixels */ 217 {0x0002, 0x865b}, /* Horizontal offset for valid pixels */
236 {0x0003, 0x865c}, /* Vertical offset for valid lines */ 218 {0x0003, 0x865c}, /* Vertical offset for valid lines */
237 /***************/ /* sensor active */ 219 {}
238 {0x0003, 0x8801}, /* 0x03 <- 0x01 0x21 //289 */ 220};
239 {0x0021, 0x8805}, 221static const __u16 rev72a_init_sensor2[][2] = {
240 {0x0001, 0x8800}, 222 /* ms-win values */
241 {0x0004, 0x8801}, /* 0x04 <- 0x01 0x65 //357 */ 223 {0x0003, 0x0121}, /* 0x03 <- 0x01 0x21 //289 */
242 {0x0065, 0x8805}, 224 {0x0004, 0x0165}, /* 0x04 <- 0x01 0x65 //357 */
243 {0x0001, 0x8800}, 225 {0x0005, 0x002f}, /* 0x05 <- 0x2f */
244 {0x0005, 0x8801}, /* 0x05 <- 0x2f */ 226 {0x0006, 0x0000}, /* 0x06 <- 0 */
245 {0x002f, 0x8805}, 227 {0x000a, 0x0002}, /* 0x0a <- 2 */
246 {0x0000, 0x8800}, 228 {0x0009, 0x1061}, /* 0x09 <- 0x1061 */
247 {0x0006, 0x8801}, /* 0x06 <- 0 */ 229 {0x0035, 0x0014}, /* 0x35 <- 0x14 */
248 {0x0000, 0x8805}, 230 {}
249 {0x0000, 0x8800}, 231};
250 {0x000a, 0x8801}, /* 0x0a <- 2 */ 232static const __u16 rev72a_init_data3[][2] = {
251 {0x0002, 0x8805},
252 {0x0000, 0x8800},
253 {0x0009, 0x8801}, /* 0x09 <- 0x1061 */
254 {0x0061, 0x8805},
255 {0x0010, 0x8800},
256 {0x0035, 0x8801}, /* 0x35 <-0x14 */
257 {0x0014, 0x8805},
258 {0x0000, 0x8800},
259 {0x0030, 0x8112}, /* ISO and drop packet enable */ 233 {0x0030, 0x8112}, /* ISO and drop packet enable */
234/*fixme: should stop here*/
260 {0x0000, 0x8112}, /* Some kind of reset ???? */ 235 {0x0000, 0x8112}, /* Some kind of reset ???? */
261 {0x0009, 0x8118}, /* Enable sensor and set standby */ 236 {0x0009, 0x8118}, /* Enable sensor and set standby */
262 {0x0000, 0x8114}, /* Software GPIO output data */ 237 {0x0000, 0x8114}, /* Software GPIO output data */
@@ -519,6 +494,15 @@ static void sensor_mapwrite(struct gspca_dev *gspca_dev,
519 } 494 }
520} 495}
521 496
497static void write_sensor_72a(struct gspca_dev *gspca_dev,
498 const __u16 (*sensor)[2])
499{
500 while ((*sensor)[0]) {
501 i2c_write(gspca_dev, (*sensor)[1], (*sensor)[0]);
502 sensor++;
503 }
504}
505
522static void init_161rev12A(struct gspca_dev *gspca_dev) 506static void init_161rev12A(struct gspca_dev *gspca_dev)
523{ 507{
524 write_vector(gspca_dev, spca561_161rev12A_data1); 508 write_vector(gspca_dev, spca561_161rev12A_data1);
@@ -588,7 +572,11 @@ static int sd_init_12a(struct gspca_dev *gspca_dev)
588static int sd_init_72a(struct gspca_dev *gspca_dev) 572static int sd_init_72a(struct gspca_dev *gspca_dev)
589{ 573{
590 PDEBUG(D_STREAM, "Chip revision: 072a"); 574 PDEBUG(D_STREAM, "Chip revision: 072a");
591 write_vector(gspca_dev, rev72a_init_data); 575 write_vector(gspca_dev, rev72a_init_data1);
576 write_sensor_72a(gspca_dev, rev72a_init_sensor1);
577 write_vector(gspca_dev, rev72a_init_data2);
578 write_sensor_72a(gspca_dev, rev72a_init_sensor2);
579 write_vector(gspca_dev, rev72a_init_data3);
592 return 0; 580 return 0;
593} 581}
594 582