diff mbox

[media] stk-webcam: fix an endian bug in stk_camera_read_reg()

Message ID 20161115094808.GA15424@mwanda (mailing list archive)
State New, archived
Headers show

Commit Message

Dan Carpenter Nov. 15, 2016, 9:48 a.m. UTC
We pass an int pointer to stk_camera_read_reg() but only write to the
highest byte.  It's a bug on big endian systems and generally a nasty
thing to do and doesn't match the write function either.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

kernel test robot Nov. 15, 2016, 2:46 p.m. UTC | #1
Hi Dan,

[auto build test ERROR on linuxtv-media/master]
[also build test ERROR on v4.9-rc5 next-20161115]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dan-Carpenter/stk-webcam-fix-an-endian-bug-in-stk_camera_read_reg/20161115-213514
base:   git://linuxtv.org/media_tree.git master
config: i386-randconfig-s1-201646 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/media/usb/stkwebcam/stk-sensor.c: In function 'stk_sensor_outb':
>> drivers/media/usb/stkwebcam/stk-sensor.c:240:46: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
                                                 ^
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   drivers/media/usb/stkwebcam/stk-sensor.c: In function 'stk_sensor_inb':
   drivers/media/usb/stkwebcam/stk-sensor.c:263:46: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
                                                 ^
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   drivers/media/usb/stkwebcam/stk-sensor.c:274:49: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (stk_camera_read_reg(dev, STK_IIC_RX_VALUE, &tmpval))
                                                    ^
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/stk_camera_read_reg +240 drivers/media/usb/stkwebcam/stk-sensor.c

ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  234  		return 1;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  235  	if (stk_camera_write_reg(dev, STK_IIC_TX_VALUE, val))
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  236  		return 1;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  237  	if (stk_camera_write_reg(dev, STK_IIC_OP, STK_IIC_OP_TX))
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  238  		return 1;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  239  	do {
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12 @240  		if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  241  			return 1;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  242  		i++;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  243  	} while (tmpval == 0 && i < MAX_RETRIES);

:::::: The code at line 240 was first introduced by commit
:::::: ec16dae5453eafd1586f35c4ec1ef854e5a808e0 V4L/DVB (7019): V4L: add support for Syntek DC1125 webcams

:::::: TO: Jaime Velasco Juan <jsagarribay@gmail.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@infradead.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Nov. 15, 2016, 4:31 p.m. UTC | #2
Hi Dan,

[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v4.9-rc5 next-20161115]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Dan-Carpenter/stk-webcam-fix-an-endian-bug-in-stk_camera_read_reg/20161115-213514
base:   git://linuxtv.org/media_tree.git master
config: x86_64-randconfig-s5-11152316 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All warnings (new ones prefixed by >>):

   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/mod_devicetable.h:11,
                    from include/linux/usb.h:4,
                    from drivers/media/usb/stkwebcam/stk-webcam.h:25,
                    from drivers/media/usb/stkwebcam/stk-sensor.c:48:
   drivers/media/usb/stkwebcam/stk-sensor.c: In function 'stk_sensor_outb':
   drivers/media/usb/stkwebcam/stk-sensor.c:240:46: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
                                                 ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
>> drivers/media/usb/stkwebcam/stk-sensor.c:240:3: note: in expansion of macro 'if'
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
      ^~
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/mod_devicetable.h:11,
                    from include/linux/usb.h:4,
                    from drivers/media/usb/stkwebcam/stk-webcam.h:25,
                    from drivers/media/usb/stkwebcam/stk-sensor.c:48:
   drivers/media/usb/stkwebcam/stk-sensor.c:240:46: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
                                                 ^
   include/linux/compiler.h:149:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
>> drivers/media/usb/stkwebcam/stk-sensor.c:240:3: note: in expansion of macro 'if'
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
      ^~
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/mod_devicetable.h:11,
                    from include/linux/usb.h:4,
                    from drivers/media/usb/stkwebcam/stk-webcam.h:25,
                    from drivers/media/usb/stkwebcam/stk-sensor.c:48:
   drivers/media/usb/stkwebcam/stk-sensor.c:240:46: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
                                                 ^
   include/linux/compiler.h:160:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
>> drivers/media/usb/stkwebcam/stk-sensor.c:240:3: note: in expansion of macro 'if'
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
      ^~
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/mod_devicetable.h:11,
                    from include/linux/usb.h:4,
                    from drivers/media/usb/stkwebcam/stk-webcam.h:25,
                    from drivers/media/usb/stkwebcam/stk-sensor.c:48:
   drivers/media/usb/stkwebcam/stk-sensor.c: In function 'stk_sensor_inb':
   drivers/media/usb/stkwebcam/stk-sensor.c:263:46: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
                                                 ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   drivers/media/usb/stkwebcam/stk-sensor.c:263:3: note: in expansion of macro 'if'
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
      ^~
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/mod_devicetable.h:11,
                    from include/linux/usb.h:4,
                    from drivers/media/usb/stkwebcam/stk-webcam.h:25,
                    from drivers/media/usb/stkwebcam/stk-sensor.c:48:
   drivers/media/usb/stkwebcam/stk-sensor.c:263:46: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
                                                 ^
   include/linux/compiler.h:149:42: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                             ^~~~
   drivers/media/usb/stkwebcam/stk-sensor.c:263:3: note: in expansion of macro 'if'
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
      ^~
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/mod_devicetable.h:11,
                    from include/linux/usb.h:4,
                    from drivers/media/usb/stkwebcam/stk-webcam.h:25,
                    from drivers/media/usb/stkwebcam/stk-sensor.c:48:
   drivers/media/usb/stkwebcam/stk-sensor.c:263:46: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
                                                 ^
   include/linux/compiler.h:160:16: note: in definition of macro '__trace_if'
      ______r = !!(cond);     \
                   ^~~~
   drivers/media/usb/stkwebcam/stk-sensor.c:263:3: note: in expansion of macro 'if'
      if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
      ^~
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,
                    from include/linux/mod_devicetable.h:11,
                    from include/linux/usb.h:4,
                    from drivers/media/usb/stkwebcam/stk-webcam.h:25,
                    from drivers/media/usb/stkwebcam/stk-sensor.c:48:
   drivers/media/usb/stkwebcam/stk-sensor.c:274:49: error: passing argument 3 of 'stk_camera_read_reg' from incompatible pointer type [-Werror=incompatible-pointer-types]
     if (stk_camera_read_reg(dev, STK_IIC_RX_VALUE, &tmpval))
                                                    ^
   include/linux/compiler.h:149:30: note: in definition of macro '__trace_if'
     if (__builtin_constant_p(!!(cond)) ? !!(cond) :   \
                                 ^~~~
   drivers/media/usb/stkwebcam/stk-sensor.c:274:2: note: in expansion of macro 'if'
     if (stk_camera_read_reg(dev, STK_IIC_RX_VALUE, &tmpval))
     ^~
   In file included from drivers/media/usb/stkwebcam/stk-sensor.c:48:0:
   drivers/media/usb/stkwebcam/stk-webcam.h:132:5: note: expected 'u8 * {aka unsigned char *}' but argument is of type 'int *'
    int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
        ^~~~~~~~~~~~~~~~~~~
   In file included from include/uapi/linux/stddef.h:1:0,
                    from include/linux/stddef.h:4,
                    from include/uapi/linux/posix_types.h:4,
                    from include/uapi/linux/types.h:13,
                    from include/linux/types.h:5,

vim +/if +240 drivers/media/usb/stkwebcam/stk-sensor.c

ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   42   *   output 0x0005 to index 0x0200
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   43   *   input 1 byte from index 0x0201 until its value becomes 0x04
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   44   */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   45  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   46  /* It seems the i2c bus is controlled with these registers */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   47  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  @48  #include "stk-webcam.h"
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   49  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   50  #define STK_IIC_BASE		(0x0200)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   51  #  define STK_IIC_OP		(STK_IIC_BASE)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   52  #    define STK_IIC_OP_TX	(0x05)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   53  #    define STK_IIC_OP_RX	(0x70)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   54  #  define STK_IIC_STAT		(STK_IIC_BASE+1)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   55  #    define STK_IIC_STAT_TX_OK	(0x04)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   56  #    define STK_IIC_STAT_RX_OK	(0x01)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   57  /* I don't know what does this register.
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   58   * when it is 0x00 or 0x01, we cannot talk to the sensor,
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   59   * other values work */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   60  #  define STK_IIC_ENABLE	(STK_IIC_BASE+2)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   61  #    define STK_IIC_ENABLE_NO	(0x00)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   62  /* This is what the driver writes in windows */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   63  #    define STK_IIC_ENABLE_YES	(0x1e)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   64  /*
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   65   * Address of the slave. Seems like the binary driver look for the
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   66   * sensor in multiple places, attempting a reset sequence.
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   67   * We only know about the ov9650
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   68   */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   69  #  define STK_IIC_ADDR		(STK_IIC_BASE+3)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   70  #  define STK_IIC_TX_INDEX	(STK_IIC_BASE+4)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   71  #  define STK_IIC_TX_VALUE	(STK_IIC_BASE+5)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   72  #  define STK_IIC_RX_INDEX	(STK_IIC_BASE+8)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   73  #  define STK_IIC_RX_VALUE	(STK_IIC_BASE+9)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   74  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   75  #define MAX_RETRIES		(50)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   76  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   77  #define SENSOR_ADDRESS		(0x60)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   78  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   79  /* From ov7670.c (These registers aren't fully accurate) */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   80  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   81  /* Registers */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   82  #define REG_GAIN	0x00	/* Gain lower 8 bits (rest in vref) */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   83  #define REG_BLUE	0x01	/* blue gain */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   84  #define REG_RED		0x02	/* red gain */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   85  #define REG_VREF	0x03	/* Pieces of GAIN, VSTART, VSTOP */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   86  #define REG_COM1	0x04	/* Control 1 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   87  #define  COM1_CCIR656	  0x40  /* CCIR656 enable */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   88  #define  COM1_QFMT	  0x20  /* QVGA/QCIF format */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   89  #define  COM1_SKIP_0	  0x00  /* Do not skip any row */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   90  #define  COM1_SKIP_2	  0x04  /* Skip 2 rows of 4 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   91  #define  COM1_SKIP_3	  0x08  /* Skip 3 rows of 4 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   92  #define REG_BAVE	0x05	/* U/B Average level */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   93  #define REG_GbAVE	0x06	/* Y/Gb Average level */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   94  #define REG_AECHH	0x07	/* AEC MS 5 bits */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   95  #define REG_RAVE	0x08	/* V/R Average level */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   96  #define REG_COM2	0x09	/* Control 2 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   97  #define  COM2_SSLEEP	  0x10	/* Soft sleep mode */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   98  #define REG_PID		0x0a	/* Product ID MSB */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12   99  #define REG_VER		0x0b	/* Product ID LSB */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  100  #define REG_COM3	0x0c	/* Control 3 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  101  #define  COM3_SWAP	  0x40	  /* Byte swap */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  102  #define  COM3_SCALEEN	  0x08	  /* Enable scaling */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  103  #define  COM3_DCWEN	  0x04	  /* Enable downsamp/crop/window */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  104  #define REG_COM4	0x0d	/* Control 4 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  105  #define REG_COM5	0x0e	/* All "reserved" */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  106  #define REG_COM6	0x0f	/* Control 6 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  107  #define REG_AECH	0x10	/* More bits of AEC value */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  108  #define REG_CLKRC	0x11	/* Clock control */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  109  #define   CLK_PLL	  0x80	  /* Enable internal PLL */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  110  #define   CLK_EXT	  0x40	  /* Use external clock directly */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  111  #define   CLK_SCALE	  0x3f	  /* Mask for internal clock scale */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  112  #define REG_COM7	0x12	/* Control 7 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  113  #define   COM7_RESET	  0x80	  /* Register reset */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  114  #define   COM7_FMT_MASK	  0x38
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  115  #define   COM7_FMT_SXGA	  0x00
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  116  #define   COM7_FMT_VGA	  0x40
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  117  #define	  COM7_FMT_CIF	  0x20	  /* CIF format */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  118  #define   COM7_FMT_QVGA	  0x10	  /* QVGA format */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  119  #define   COM7_FMT_QCIF	  0x08	  /* QCIF format */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  120  #define	  COM7_RGB	  0x04	  /* bits 0 and 2 - RGB format */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  121  #define	  COM7_YUV	  0x00	  /* YUV */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  122  #define	  COM7_BAYER	  0x01	  /* Bayer format */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  123  #define	  COM7_PBAYER	  0x05	  /* "Processed bayer" */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  124  #define REG_COM8	0x13	/* Control 8 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  125  #define   COM8_FASTAEC	  0x80	  /* Enable fast AGC/AEC */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  126  #define   COM8_AECSTEP	  0x40	  /* Unlimited AEC step size */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  127  #define   COM8_BFILT	  0x20	  /* Band filter enable */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  128  #define   COM8_AGC	  0x04	  /* Auto gain enable */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  129  #define   COM8_AWB	  0x02	  /* White balance enable */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  130  #define   COM8_AEC	  0x01	  /* Auto exposure enable */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  131  #define REG_COM9	0x14	/* Control 9  - gain ceiling */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  132  #define REG_COM10	0x15	/* Control 10 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  133  #define   COM10_HSYNC	  0x40	  /* HSYNC instead of HREF */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  134  #define   COM10_PCLK_HB	  0x20	  /* Suppress PCLK on horiz blank */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  135  #define   COM10_HREF_REV  0x08	  /* Reverse HREF */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  136  #define   COM10_VS_LEAD	  0x04	  /* VSYNC on clock leading edge */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  137  #define   COM10_VS_NEG	  0x02	  /* VSYNC negative */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  138  #define   COM10_HS_NEG	  0x01	  /* HSYNC negative */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  139  #define REG_HSTART	0x17	/* Horiz start high bits */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  140  #define REG_HSTOP	0x18	/* Horiz stop high bits */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  141  #define REG_VSTART	0x19	/* Vert start high bits */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  142  #define REG_VSTOP	0x1a	/* Vert stop high bits */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  143  #define REG_PSHFT	0x1b	/* Pixel delay after HREF */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  144  #define REG_MIDH	0x1c	/* Manuf. ID high */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  145  #define REG_MIDL	0x1d	/* Manuf. ID low */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  146  #define REG_MVFP	0x1e	/* Mirror / vflip */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  147  #define   MVFP_MIRROR	  0x20	  /* Mirror image */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  148  #define   MVFP_FLIP	  0x10	  /* Vertical flip */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  149  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  150  #define REG_AEW		0x24	/* AGC upper limit */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  151  #define REG_AEB		0x25	/* AGC lower limit */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  152  #define REG_VPT		0x26	/* AGC/AEC fast mode op region */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  153  #define REG_ADVFL	0x2d	/* Insert dummy lines (LSB) */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  154  #define REG_ADVFH	0x2e	/* Insert dummy lines (MSB) */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  155  #define REG_HSYST	0x30	/* HSYNC rising edge delay */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  156  #define REG_HSYEN	0x31	/* HSYNC falling edge delay */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  157  #define REG_HREF	0x32	/* HREF pieces */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  158  #define REG_TSLB	0x3a	/* lots of stuff */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  159  #define   TSLB_YLAST	  0x04	  /* UYVY or VYUY - see com13 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  160  #define   TSLB_BYTEORD	  0x08	  /* swap bytes in 16bit mode? */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  161  #define REG_COM11	0x3b	/* Control 11 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  162  #define   COM11_NIGHT	  0x80	  /* NIght mode enable */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  163  #define   COM11_NMFR	  0x60	  /* Two bit NM frame rate */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  164  #define   COM11_HZAUTO	  0x10	  /* Auto detect 50/60 Hz */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  165  #define	  COM11_50HZ	  0x08	  /* Manual 50Hz select */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  166  #define   COM11_EXP	  0x02
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  167  #define REG_COM12	0x3c	/* Control 12 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  168  #define   COM12_HREF	  0x80	  /* HREF always */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  169  #define REG_COM13	0x3d	/* Control 13 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  170  #define   COM13_GAMMA	  0x80	  /* Gamma enable */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  171  #define	  COM13_UVSAT	  0x40	  /* UV saturation auto adjustment */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  172  #define	  COM13_CMATRIX	  0x10	  /* Enable color matrix for RGB or YUV */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  173  #define   COM13_UVSWAP	  0x01	  /* V before U - w/TSLB */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  174  #define REG_COM14	0x3e	/* Control 14 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  175  #define   COM14_DCWEN	  0x10	  /* DCW/PCLK-scale enable */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  176  #define REG_EDGE	0x3f	/* Edge enhancement factor */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  177  #define REG_COM15	0x40	/* Control 15 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  178  #define   COM15_R10F0	  0x00	  /* Data range 10 to F0 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  179  #define	  COM15_R01FE	  0x80	  /*            01 to FE */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  180  #define   COM15_R00FF	  0xc0	  /*            00 to FF */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  181  #define   COM15_RGB565	  0x10	  /* RGB565 output */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  182  #define   COM15_RGBFIXME	  0x20	  /* FIXME  */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  183  #define   COM15_RGB555	  0x30	  /* RGB555 output */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  184  #define REG_COM16	0x41	/* Control 16 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  185  #define   COM16_AWBGAIN   0x08	  /* AWB gain enable */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  186  #define REG_COM17	0x42	/* Control 17 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  187  #define   COM17_AECWIN	  0xc0	  /* AEC window - must match COM4 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  188  #define   COM17_CBAR	  0x08	  /* DSP Color bar */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  189  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  190  /*
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  191   * This matrix defines how the colors are generated, must be
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  192   * tweaked to adjust hue and saturation.
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  193   *
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  194   * Order: v-red, v-green, v-blue, u-red, u-green, u-blue
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  195   *
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  196   * They are nine-bit signed quantities, with the sign bit
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  197   * stored in 0x58.  Sign for v-red is bit 0, and up from there.
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  198   */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  199  #define	REG_CMATRIX_BASE 0x4f
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  200  #define   CMATRIX_LEN 6
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  201  #define REG_CMATRIX_SIGN 0x58
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  202  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  203  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  204  #define REG_BRIGHT	0x55	/* Brightness */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  205  #define REG_CONTRAS	0x56	/* Contrast control */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  206  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  207  #define REG_GFIX	0x69	/* Fix gain control */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  208  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  209  #define REG_RGB444	0x8c	/* RGB 444 control */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  210  #define   R444_ENABLE	  0x02	  /* Turn on RGB444, overrides 5x5 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  211  #define   R444_RGBX	  0x01	  /* Empty nibble at end */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  212  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  213  #define REG_HAECC1	0x9f	/* Hist AEC/AGC control 1 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  214  #define REG_HAECC2	0xa0	/* Hist AEC/AGC control 2 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  215  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  216  #define REG_BD50MAX	0xa5	/* 50hz banding step limit */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  217  #define REG_HAECC3	0xa6	/* Hist AEC/AGC control 3 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  218  #define REG_HAECC4	0xa7	/* Hist AEC/AGC control 4 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  219  #define REG_HAECC5	0xa8	/* Hist AEC/AGC control 5 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  220  #define REG_HAECC6	0xa9	/* Hist AEC/AGC control 6 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  221  #define REG_HAECC7	0xaa	/* Hist AEC/AGC control 7 */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  222  #define REG_BD60MAX	0xab	/* 60hz banding step limit */
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  223  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  224  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  225  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  226  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  227  /* Returns 0 if OK */
fe2b8f50 drivers/media/video/stk-sensor.c Adrian Bunk        2008-01-28  228  static int stk_sensor_outb(struct stk_camera *dev, u8 reg, u8 val)
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  229  {
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  230  	int i = 0;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  231  	int tmpval = 0;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  232  
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  233  	if (stk_camera_write_reg(dev, STK_IIC_TX_INDEX, reg))
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  234  		return 1;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  235  	if (stk_camera_write_reg(dev, STK_IIC_TX_VALUE, val))
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  236  		return 1;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  237  	if (stk_camera_write_reg(dev, STK_IIC_OP, STK_IIC_OP_TX))
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  238  		return 1;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  239  	do {
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12 @240  		if (stk_camera_read_reg(dev, STK_IIC_STAT, &tmpval))
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  241  			return 1;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  242  		i++;
ec16dae5 drivers/media/video/stk-sensor.c Jaime Velasco Juan 2008-01-12  243  	} while (tmpval == 0 && i < MAX_RETRIES);

:::::: The code at line 240 was first introduced by commit
:::::: ec16dae5453eafd1586f35c4ec1ef854e5a808e0 V4L/DVB (7019): V4L: add support for Syntek DC1125 webcams

:::::: TO: Jaime Velasco Juan <jsagarribay@gmail.com>
:::::: CC: Mauro Carvalho Chehab <mchehab@infradead.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/media/usb/stkwebcam/stk-webcam.h b/drivers/media/usb/stkwebcam/stk-webcam.h
index 9bbfa3d..92bb48e 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.h
+++ b/drivers/media/usb/stkwebcam/stk-webcam.h
@@ -129,7 +129,7 @@  struct stk_camera {
 #define vdev_to_camera(d) container_of(d, struct stk_camera, vdev)
 
 int stk_camera_write_reg(struct stk_camera *, u16, u8);
-int stk_camera_read_reg(struct stk_camera *, u16, int *);
+int stk_camera_read_reg(struct stk_camera *, u16, u8 *);
 
 int stk_sensor_init(struct stk_camera *);
 int stk_sensor_configure(struct stk_camera *);
diff --git a/drivers/media/usb/stkwebcam/stk-webcam.c b/drivers/media/usb/stkwebcam/stk-webcam.c
index 22a9aae..1c48f2f 100644
--- a/drivers/media/usb/stkwebcam/stk-webcam.c
+++ b/drivers/media/usb/stkwebcam/stk-webcam.c
@@ -144,7 +144,7 @@  int stk_camera_write_reg(struct stk_camera *dev, u16 index, u8 value)
 		return 0;
 }
 
-int stk_camera_read_reg(struct stk_camera *dev, u16 index, int *value)
+int stk_camera_read_reg(struct stk_camera *dev, u16 index, u8 *value)
 {
 	struct usb_device *udev = dev->udev;
 	unsigned char *buf;
@@ -163,7 +163,7 @@  int stk_camera_read_reg(struct stk_camera *dev, u16 index, int *value)
 			sizeof(u8),
 			500);
 	if (ret >= 0)
-		memcpy(value, buf, sizeof(u8));
+		*value = *buf;
 
 	kfree(buf);
 	return ret;
@@ -171,9 +171,10 @@  int stk_camera_read_reg(struct stk_camera *dev, u16 index, int *value)
 
 static int stk_start_stream(struct stk_camera *dev)
 {
-	int value;
+	u8 value;
 	int i, ret;
-	int value_116, value_117;
+	u8 value_116, value_117;
+
 
 	if (!is_present(dev))
 		return -ENODEV;
@@ -213,7 +214,7 @@  static int stk_start_stream(struct stk_camera *dev)
 
 static int stk_stop_stream(struct stk_camera *dev)
 {
-	int value;
+	u8 value;
 	int i;
 	if (is_present(dev)) {
 		stk_camera_read_reg(dev, 0x0100, &value);