~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise-security

« back to all changes in this revision

Viewing changes to drivers/media/video/gspca/spca1528.c

  • Committer: Package Import Robot
  • Author(s): Paolo Pisati, Paolo Pisati
  • Date: 2011-12-06 15:56:07 UTC
  • Revision ID: package-import@ubuntu.com-20111206155607-pcf44kv5fmhk564f
Tags: 3.2.0-1401.1
[ Paolo Pisati ]

* Rebased on top of Ubuntu-3.2.0-3.8
* Tilt-tracking @ ef2487af4bb15bdd0689631774b5a5e3a59f74e2
* Delete debian.ti-omap4/control, it shoudln't be tracked
* Fix architecture spelling (s/armel/armhf/)
* [Config] Update configs following 3.2 import
* [Config] Fix compilation: disable CODA and ARCH_OMAP3
* [Config] Fix compilation: disable Ethernet Faraday
* Update series to precise

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * spca1528 subdriver
3
3
 *
4
 
 * Copyright (C) 2010 Jean-Francois Moine (http://moinejf.free.fr)
 
4
 * Copyright (C) 2010-2011 Jean-Francois Moine (http://moinejf.free.fr)
5
5
 *
6
6
 * This program is free software; you can redistribute it and/or modify
7
7
 * it under the terms of the GNU General Public License as published by
18
18
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
19
 */
20
20
 
 
21
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
22
 
21
23
#define MODULE_NAME "spca1528"
22
24
 
23
25
#include "gspca.h"
171
173
        PDEBUG(D_USBI, "GET %02x 0000 %04x %02x", req, index,
172
174
                         gspca_dev->usb_buf[0]);
173
175
        if (ret < 0) {
174
 
                err("reg_r err %d", ret);
 
176
                pr_err("reg_r err %d\n", ret);
175
177
                gspca_dev->usb_err = ret;
176
178
        }
177
179
}
193
195
                        value, index,
194
196
                        NULL, 0, 500);
195
197
        if (ret < 0) {
196
 
                err("reg_w err %d", ret);
 
198
                pr_err("reg_w err %d\n", ret);
197
199
                gspca_dev->usb_err = ret;
198
200
        }
199
201
}
217
219
                        value, index,
218
220
                        gspca_dev->usb_buf, 1, 500);
219
221
        if (ret < 0) {
220
 
                err("reg_w err %d", ret);
 
222
                pr_err("reg_w err %d\n", ret);
221
223
                gspca_dev->usb_err = ret;
222
224
        }
223
225
}
224
226
 
225
227
static void wait_status_0(struct gspca_dev *gspca_dev)
226
228
{
227
 
        int i;
 
229
        int i, w;
228
230
 
229
 
        i = 20;
 
231
        i = 16;
 
232
        w = 0;
230
233
        do {
231
234
                reg_r(gspca_dev, 0x21, 0x0000, 1);
232
235
                if (gspca_dev->usb_buf[0] == 0)
233
236
                        return;
234
 
                msleep(30);
 
237
                w += 15;
 
238
                msleep(w);
235
239
        } while (--i > 0);
236
240
        PDEBUG(D_ERR, "wait_status_0 timeout");
237
241
        gspca_dev->usb_err = -ETIME;
307
311
        sd->color = COLOR_DEF;
308
312
        sd->sharpness = SHARPNESS_DEF;
309
313
 
310
 
        gspca_dev->nbalt = 4;           /* use alternate setting 3 */
311
 
 
312
314
        return 0;
313
315
}
314
316
 
347
349
        mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv;
348
350
        reg_wb(gspca_dev, 0x25, 0x0000, 0x0004, mode);
349
351
        reg_r(gspca_dev, 0x25, 0x0004, 1);
350
 
        reg_wb(gspca_dev, 0x27, 0x0000, 0x0000, 0x06);
 
352
        reg_wb(gspca_dev, 0x27, 0x0000, 0x0000, 0x06);  /* 420 */
351
353
        reg_r(gspca_dev, 0x27, 0x0000, 1);
 
354
 
 
355
/* not useful..
 
356
        gspca_dev->alt = 4;             * use alternate setting 3 */
 
357
 
352
358
        return gspca_dev->usb_err;
353
359
}
354
360
 
361
367
        jpeg_define(sd->jpeg_hdr, gspca_dev->height, gspca_dev->width,
362
368
                        0x22);          /* JPEG 411 */
363
369
 
364
 
        /* the JPEG quality seems to be 82% */
365
 
        jpeg_set_qual(sd->jpeg_hdr, 82);
 
370
        /* the JPEG quality shall be 85% */
 
371
        jpeg_set_qual(sd->jpeg_hdr, 85);
366
372
 
367
373
        /* set the controls */
368
374
        setbrightness(gspca_dev);
377
383
 
378
384
        /* start the capture */
379
385
        wait_status_0(gspca_dev);
380
 
        reg_w(gspca_dev, 0x31, 0x0000, 0x0004);
 
386
        reg_w(gspca_dev, 0x31, 0x0000, 0x0004); /* start request */
381
387
        wait_status_1(gspca_dev);
382
388
        wait_status_0(gspca_dev);
383
389
        msleep(200);
390
396
{
391
397
        /* stop the capture */
392
398
        wait_status_0(gspca_dev);
393
 
        reg_w(gspca_dev, 0x31, 0x0000, 0x0000);
 
399
        reg_w(gspca_dev, 0x31, 0x0000, 0x0000); /* stop request */
394
400
        wait_status_1(gspca_dev);
395
401
        wait_status_0(gspca_dev);
396
402
}