aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/spca506.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/gspca/spca506.c')
-rw-r--r--drivers/media/video/gspca/spca506.c35
1 files changed, 16 insertions, 19 deletions
diff --git a/drivers/media/video/gspca/spca506.c b/drivers/media/video/gspca/spca506.c
index 2d249b00bdcd..143203c1fd9f 100644
--- a/drivers/media/video/gspca/spca506.c
+++ b/drivers/media/video/gspca/spca506.c
@@ -25,8 +25,8 @@
25 25
26#include "gspca.h" 26#include "gspca.h"
27 27
28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 5) 28#define DRIVER_VERSION_NUMBER KERNEL_VERSION(2, 1, 7)
29static const char version[] = "2.1.5"; 29static const char version[] = "2.1.7";
30 30
31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>"); 31MODULE_AUTHOR("Michel Xhaard <mxhaard@users.sourceforge.net>");
32MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver"); 32MODULE_DESCRIPTION("GSPCA/SPCA506 USB Camera Driver");
@@ -153,17 +153,18 @@ static struct v4l2_pix_format vga_mode[] = {
153#define SAA7113_hue 0x0d /* defaults 0x00 */ 153#define SAA7113_hue 0x0d /* defaults 0x00 */
154#define SAA7113_I2C_BASE_WRITE 0x4a 154#define SAA7113_I2C_BASE_WRITE 0x4a
155 155
156static void reg_r(struct usb_device *dev, 156/* read 'len' bytes to gspca_dev->usb_buf */
157static void reg_r(struct gspca_dev *gspca_dev,
157 __u16 req, 158 __u16 req,
158 __u16 index, 159 __u16 index,
159 __u8 *buffer, __u16 length) 160 __u16 length)
160{ 161{
161 usb_control_msg(dev, 162 usb_control_msg(gspca_dev->dev,
162 usb_rcvctrlpipe(dev, 0), 163 usb_rcvctrlpipe(gspca_dev->dev, 0),
163 req, 164 req,
164 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, 165 USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
165 0, /* value */ 166 0, /* value */
166 index, buffer, length, 167 index, gspca_dev->usb_buf, length,
167 500); 168 500);
168} 169}
169 170
@@ -189,13 +190,12 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur,
189 __u16 reg) 190 __u16 reg)
190{ 191{
191 int retry = 60; 192 int retry = 60;
192 __u8 Data[2];
193 193
194 reg_w(gspca_dev->dev, 0x07, reg, 0x0001); 194 reg_w(gspca_dev->dev, 0x07, reg, 0x0001);
195 reg_w(gspca_dev->dev, 0x07, valeur, 0x0000); 195 reg_w(gspca_dev->dev, 0x07, valeur, 0x0000);
196 while (retry--) { 196 while (retry--) {
197 reg_r(gspca_dev->dev, 0x07, 0x0003, Data, 2); 197 reg_r(gspca_dev, 0x07, 0x0003, 2);
198 if ((Data[0] | Data[1]) == 0x00) 198 if ((gspca_dev->usb_buf[0] | gspca_dev->usb_buf[1]) == 0x00)
199 break; 199 break;
200 } 200 }
201} 201}
@@ -203,21 +203,19 @@ static void spca506_WriteI2c(struct gspca_dev *gspca_dev, __u16 valeur,
203static int spca506_ReadI2c(struct gspca_dev *gspca_dev, __u16 reg) 203static int spca506_ReadI2c(struct gspca_dev *gspca_dev, __u16 reg)
204{ 204{
205 int retry = 60; 205 int retry = 60;
206 __u8 Data[2];
207 __u8 value;
208 206
209 reg_w(gspca_dev->dev, 0x07, SAA7113_I2C_BASE_WRITE, 0x0004); 207 reg_w(gspca_dev->dev, 0x07, SAA7113_I2C_BASE_WRITE, 0x0004);
210 reg_w(gspca_dev->dev, 0x07, reg, 0x0001); 208 reg_w(gspca_dev->dev, 0x07, reg, 0x0001);
211 reg_w(gspca_dev->dev, 0x07, 0x01, 0x0002); 209 reg_w(gspca_dev->dev, 0x07, 0x01, 0x0002);
212 while (--retry) { 210 while (--retry) {
213 reg_r(gspca_dev->dev, 0x07, 0x0003, Data, 2); 211 reg_r(gspca_dev, 0x07, 0x0003, 2);
214 if ((Data[0] | Data[1]) == 0x00) 212 if ((gspca_dev->usb_buf[0] | gspca_dev->usb_buf[1]) == 0x00)
215 break; 213 break;
216 } 214 }
217 if (retry == 0) 215 if (retry == 0)
218 return -1; 216 return -1;
219 reg_r(gspca_dev->dev, 0x07, 0x0000, &value, 1); 217 reg_r(gspca_dev, 0x07, 0x0000, 1);
220 return value; 218 return gspca_dev->usb_buf[0];
221} 219}
222 220
223static void spca506_SetNormeInput(struct gspca_dev *gspca_dev, 221static void spca506_SetNormeInput(struct gspca_dev *gspca_dev,
@@ -437,7 +435,6 @@ static void sd_start(struct gspca_dev *gspca_dev)
437 struct usb_device *dev = gspca_dev->dev; 435 struct usb_device *dev = gspca_dev->dev;
438 __u16 norme; 436 __u16 norme;
439 __u16 channel; 437 __u16 channel;
440 __u8 Data[2];
441 438
442 /**************************************/ 439 /**************************************/
443 reg_w(dev, 0x03, 0x00, 0x0004); 440 reg_w(dev, 0x03, 0x00, 0x0004);
@@ -555,8 +552,8 @@ static void sd_start(struct gspca_dev *gspca_dev)
555 /* compress setting and size */ 552 /* compress setting and size */
556 /* set i2c luma */ 553 /* set i2c luma */
557 reg_w(dev, 0x02, 0x01, 0x0000); 554 reg_w(dev, 0x02, 0x01, 0x0000);
558 reg_w(dev, 0x03, 0x12, 0x000); 555 reg_w(dev, 0x03, 0x12, 0x0000);
559 reg_r(dev, 0x04, 0x0001, Data, 2); 556 reg_r(gspca_dev, 0x04, 0x0001, 2);
560 PDEBUG(D_STREAM, "webcam started"); 557 PDEBUG(D_STREAM, "webcam started");
561 spca506_GetNormeInput(gspca_dev, &norme, &channel); 558 spca506_GetNormeInput(gspca_dev, &norme, &channel);
562 spca506_SetNormeInput(gspca_dev, norme, channel); 559 spca506_SetNormeInput(gspca_dev, norme, channel);