diff options
author | Jean-François Moine <moinejf@free.fr> | 2010-07-06 04:05:05 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-02 15:42:51 -0400 |
commit | ef35d34fea38c52a595c30424d332a9dddd2200d (patch) | |
tree | 1c4e442ec08eb6c7456cb065ba1eb20fb0142404 /drivers/media/video/gspca | |
parent | fe854ec07cada95296e882aa795db83409c61eeb (diff) |
V4L/DVB: gspca - vc032x: Add trace of USB exchanges
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')
-rw-r--r-- | drivers/media/video/gspca/vc032x.c | 48 |
1 files changed, 38 insertions, 10 deletions
diff --git a/drivers/media/video/gspca/vc032x.c b/drivers/media/video/gspca/vc032x.c index c9df1ac5dff5..072785368265 100644 --- a/drivers/media/video/gspca/vc032x.c +++ b/drivers/media/video/gspca/vc032x.c | |||
@@ -3068,7 +3068,7 @@ static const struct sensor_info vc0323_probe_data[] = { | |||
3068 | }; | 3068 | }; |
3069 | 3069 | ||
3070 | /* read 'len' bytes in gspca_dev->usb_buf */ | 3070 | /* read 'len' bytes in gspca_dev->usb_buf */ |
3071 | static void reg_r(struct gspca_dev *gspca_dev, | 3071 | static void reg_r_i(struct gspca_dev *gspca_dev, |
3072 | u16 req, | 3072 | u16 req, |
3073 | u16 index, | 3073 | u16 index, |
3074 | u16 len) | 3074 | u16 len) |
@@ -3089,8 +3089,28 @@ static void reg_r(struct gspca_dev *gspca_dev, | |||
3089 | gspca_dev->usb_err = ret; | 3089 | gspca_dev->usb_err = ret; |
3090 | } | 3090 | } |
3091 | } | 3091 | } |
3092 | static void reg_r(struct gspca_dev *gspca_dev, | ||
3093 | u16 req, | ||
3094 | u16 index, | ||
3095 | u16 len) | ||
3096 | { | ||
3097 | reg_r_i(gspca_dev, req, index, len); | ||
3098 | #ifdef GSPCA_DEBUG | ||
3099 | if (gspca_dev->usb_err < 0) | ||
3100 | return; | ||
3101 | if (len == 1) | ||
3102 | PDEBUG(D_USBI, "GET %02x 0001 %04x %02x", req, index, | ||
3103 | gspca_dev->usb_buf[0]); | ||
3104 | else | ||
3105 | PDEBUG(D_USBI, "GET %02x 0001 %04x %02x %02x %02x", | ||
3106 | req, index, | ||
3107 | gspca_dev->usb_buf[0], | ||
3108 | gspca_dev->usb_buf[1], | ||
3109 | gspca_dev->usb_buf[2]); | ||
3110 | #endif | ||
3111 | } | ||
3092 | 3112 | ||
3093 | static void reg_w(struct usb_device *dev, | 3113 | static void reg_w_i(struct gspca_dev *gspca_dev, |
3094 | u16 req, | 3114 | u16 req, |
3095 | u16 value, | 3115 | u16 value, |
3096 | u16 index) | 3116 | u16 index) |
@@ -3221,23 +3241,31 @@ static void i2c_write(struct gspca_dev *gspca_dev, | |||
3221 | { | 3241 | { |
3222 | int retry; | 3242 | int retry; |
3223 | 3243 | ||
3224 | reg_r(gspca_dev, 0xa1, 0xb33f, 1); | 3244 | #ifdef GSPCA_DEBUG |
3245 | if (gspca_dev->usb_err < 0) | ||
3246 | return; | ||
3247 | if (size == 1) | ||
3248 | PDEBUG(D_USBO, "i2c_w %02x %02x", reg, *val); | ||
3249 | else | ||
3250 | PDEBUG(D_USBO, "i2c_w %02x %02x%02x", reg, *val, val[1]); | ||
3251 | #endif | ||
3252 | reg_r_i(gspca_dev, 0xa1, 0xb33f, 1); | ||
3225 | /*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/ | 3253 | /*fixme:should check if (!(gspca_dev->usb_buf[0] & 0x02)) error*/ |
3226 | reg_w(gspca_dev, 0xa0, size, 0xb334); | 3254 | reg_w_i(gspca_dev, 0xa0, size, 0xb334); |
3227 | reg_w(gspca_dev, 0xa0, reg, 0xb33a); | 3255 | reg_w_i(gspca_dev, 0xa0, reg, 0xb33a); |
3228 | reg_w(gspca_dev, 0xa0, val[0], 0xb336); | 3256 | reg_w_i(gspca_dev, 0xa0, val[0], 0xb336); |
3229 | if (size > 1) | 3257 | if (size > 1) |
3230 | reg_w(gspca_dev, 0xa0, val[1], 0xb337); | 3258 | reg_w_i(gspca_dev, 0xa0, val[1], 0xb337); |
3231 | reg_w(gspca_dev, 0xa0, 0x01, 0xb339); | 3259 | reg_w_i(gspca_dev, 0xa0, 0x01, 0xb339); |
3232 | retry = 4; | 3260 | retry = 4; |
3233 | do { | 3261 | do { |
3234 | reg_r(gspca_dev, 0xa1, 0xb33b, 1); | 3262 | reg_r_i(gspca_dev, 0xa1, 0xb33b, 1); |
3235 | if (gspca_dev->usb_buf[0] == 0) | 3263 | if (gspca_dev->usb_buf[0] == 0) |
3236 | break; | 3264 | break; |
3237 | msleep(20); | 3265 | msleep(20); |
3238 | } while (--retry > 0); | 3266 | } while (--retry > 0); |
3239 | if (retry <= 0) | 3267 | if (retry <= 0) |
3240 | PDEBUG(D_ERR, "i2c_write failed"); | 3268 | PDEBUG(D_ERR, "i2c_write timeout"); |
3241 | } | 3269 | } |
3242 | 3270 | ||
3243 | static void put_tab_to_reg(struct gspca_dev *gspca_dev, | 3271 | static void put_tab_to_reg(struct gspca_dev *gspca_dev, |