Hello,
The attached patch does two major things:
1) A total rework of the initialization of the m5602. This includes an
import of all used ov9650 registers and the m5602 as extracted from a
BisonCam.inf.
2. A fix to get the 32 bit bayer decode routine to work somewhat. This
in turn was also compromised by two different problems.
2.1 The order of the sub-pixels were shifted.
2.2 The two first lines of the frame were filled with end-of-frame noise
(0xaa and 0x55). This fix is a workaround as it simply ignores the first
two lines of the frame and the real bug should be found, but hey I'm
desperate.
Please note that the image is still very dark and has a twisted color
composition. I'm going to tweak this out and I also already have some
half-working V4L2-controls. Expect a patch pretty soon.
Also not that other resolutions than 640x480 and non-bayer32 does still
not work.
I'm interested in getting commit access to this project.
I can either share the same branch as Iljes if it's ok with or start a
new one.
Regards,
Erik
Index: m5602.h
===================================================================
--- m5602.h (revision 115)
+++ m5602.h (working copy)
@@ -49,6 +49,126 @@
info("[%s:%d] " fmt, __FUNCTION__, __LINE__ , ## args); \
} while (0)
+#define OV9650_GAIN 0x00
+#define OV9650_BLUE 0x01
+#define OV9650_RED 0x02
+#define OV9650_VREF 0x03
+#define OV9650_COM1 0x04
+#define OV9650_BAVE 0x05
+#define OV9650_GEAVE 0x06
+#define OV9650_RSVD 0x07
+#define OV9650_COM5 0x0e
+#define OV9650_COM6 0x0f
+#define OV9650_AECH 0x10
+#define OV9650_CLKRC 0x11
+#define OV9650_COM7 0x12
+#define OV9650_COM8 0x13
+#define OV9650_COM9 0x14
+#define OV9650_COM10 0x15
+#define OV9650_RSVD16 0x16
+#define OV9650_HSTART 0x17
+#define OV9650_HSTOP 0x18
+#define OV9650_VSTRT 0x19
+#define OV9650_VSTOP 0x1a
+#define OV9650_PSHFT 0x1b
+#define OV9650_MVFP 0x1e
+#define OV9650_AEW 0x24
+#define OV9650_AEB 0x25
+#define OV9650_VPT 0x26
+#define OV9650_BBIAS 0x27
+#define OV9650_GbBIAS 0x28
+#define OV9650_Gr_COM 0x29
+#define OV9650_RBIAS 0x2c
+#define OV9650_HREF 0x32
+#define OV9650_CHLF 0x33
+#define OV9650_ARBLM 0x34
+#define OV9650_RSVD1 0x35
+#define OV9650_ADC 0x37
+#define OV9650_ACOM38 0x38
+#define OV9650_OFON 0x39
+#define OV9650_TSLB 0x3a
+#define OV9650_COM12 0x3c
+#define OV9650_COM13 0x3d
+#define OV9650_COM15 0x40
+#define OV9650_COM16 0x41
+#define OV9650_LCC1 0x62
+#define OV9650_LCC2 0x63
+#define OV9650_LCC3 0x64
+#define OV9650_LCC4 0x65
+#define OV9650_LCC5 0x66
+#define OV9650_HV 0x69
+#define OV9650_COM21 0x8b
+#define OV9650_COM22 0x8c
+#define OV9650_COM24 0x8e
+#define OV9650_DBLC1 0x8f
+#define OV9650_RSVD94 0x94
+#define OV9650_RSVD95 0x95
+#define OV9650_RSVD96 0x96
+#define OV9650_LCCFB 0x9d
+#define OV9650_LCCFR 0x9e
+#define OV9650_AECHM 0xa1
+#define OV9650_COM26 0xa5
+#define OV9650_ACOMA8 0xa8
+#define OV9650_ACOMA9 0xa9
+
+#define M5602_XB_SENSOR_TYPE 0x00
+#define M5602_XB_SENSOR_CTRL 0x01
+#define M5602_XB_LINE_OF_FRAME_H 0x02
+#define M5602_XB_LINE_OF_FRAME_L 0x03
+#define M5602_XB_PIX_OF_LINE_H 0x04
+#define M5602_XB_PIX_OF_LINE_L 0x05
+#define M5602_XB_VSYNC_PARA 0x06
+#define M5602_XB_HSYNC_PARA 0x07
+#define M5602_XB_TEST_MODE_1 0x08
+#define M5602_XB_TEST_MODE_2 0x09
+#define M5602_XB_SIG_INI 0x0a
+#define M5602_XB_DS_PARA 0x0e
+#define M5602_XB_TRIG_PARA 0x0f
+#define M5602_XB_CLK_PD 0x10
+#define M5602_XB_MCU_CLK_CTRL 0x12
+#define M5602_XB_MCU_CLK_DIV 0x13
+#define M5602_XB_SEN_CLK_CTRL 0x14
+#define M5602_XB_SEN_CLK_DIV 0x15
+#define M5602_XB_AUD_CLK_CTRL 0x16
+#define M5602_XB_AUD_CLK_DIV 0x17
+#define M5602_XB_ADC_CTRL 0x60
+#define M5602_XB_ADC_DATA 0x61
+#define M5602_XB_MISC_CTRL 0x62
+#define M5602_XB_SNAPSHOT 0x63
+#define M5602_XB_SCRATCH_1 0x64
+#define M5602_XB_SCRATCH_2 0x65
+#define M5602_XB_SCRATCH_3 0x66
+#define M5602_XB_SCRATCH_4 0x67
+#define M5602_XB_I2C_CTRL 0x68
+#define M5602_XB_I2C_CLK_DIV 0x69
+#define M5602_XB_I2C_DEV_ADDR 0x6A
+#define M5602_XB_I2C_REG_ADDR 0x6B
+#define M5602_XB_I2C_DATA 0x6C
+#define M5602_XB_I2C_STATUS 0x6D
+#define M5602_XB_GPIO_DAT_H 0x70
+#define M5602_XB_GPIO_DAT_L 0x71
+#define M5602_XB_GPIO_DIR_H 0x72
+#define M5602_XB_GPIO_DIR_L 0x73
+#define M5602_XB_GPIO_EN_H 0x74
+#define M5602_XB_GPIO_EN_L 0x75
+#define M5602_XB_GPIO_DAT 0x76
+#define M5602_XB_GPIO_DIR 0x77
+#define M5602_XB_DEVCTR1 0x41
+#define M5602_XB_EPSETR0 0x42
+#define M5602_XB_EPAFCTR 0x47
+#define M5602_XB_EPBFCTR 0x49
+#define M5602_XB_EPEFCTR 0x4F
+#define M5602_XB_TEST_REG 0x53
+#define M5602_XB_ALT2SIZE 0x54
+#define M5602_XB_ALT3SIZE 0x55
+#define M5602_XB_OBSFRAME 0x56
+#define M5602_XB_PWR_CTL 0x59
+#define M5602_XB_MISC_CTL 0x70
+
+#define BRIDGE 0
+#define SENSOR 1
+#define END 2
+
struct nlist{
struct nlist *next;
char *name;
@@ -180,295 +300,144 @@
#define to_m5602_camera(d) container_of(d, struct m5602_camera, kref)
+static int write_sensor(struct m5602_camera *cam, u8 address, u8 value);
+static int write_bridge(struct m5602_camera *cam, u8 address, u8 value);
+
void bayer_decode_rgb32(unsigned char *src, unsigned char *dest, int width, int height);
void bayer_decode_rgb24(unsigned char *src, unsigned char *dest, int width, int height);
void bayer_decode_yu12(unsigned char *src, unsigned char *dest, int width, int height);
-static const unsigned char init_webcam_magic_4[124][4] =
+static const unsigned char bridge_urb_skeleton[4] =
{
- {0x13, 0x13, 0x81, 0x02},
- {0x13, 0x12, 0x81, 0xb0},
- {0x13, 0x15, 0x81, 0x00},
- {0x13, 0x14, 0x81, 0xb0},
- {0x13, 0x60, 0x81, 0xc0},
- {0x13, 0x00, 0x81, 0x0d},
- {0x13, 0x01, 0x81, 0x00},
+ 0x13, 0x00, 0x81, 0x00
+};
- {0x13, 0x77, 0x81, 0x27},
-
- {0x13, 0x77, 0x81, 0x77},
- {0x13, 0x60, 0x81, 0xc0},
- {0x13, 0x00, 0x81, 0x08},
- {0x13, 0x15, 0x81, 0x04},
- {0x13, 0x14, 0x81, 0xb0},
-
- {0x13, 0x77, 0x81, 0x05},
- {0x13, 0x76, 0x81, 0x04},
- {0x13, 0x74, 0x81, 0x06},
- {0x13, 0x72, 0x81, 0x06},
- {0x13, 0x70, 0x81, 0x00},
- {0x13, 0x15, 0x81, 0x04},
- {0x13, 0x14, 0x81, 0xb0},
- {0x13, 0x15, 0x81, 0x00},
- {0x13, 0x14, 0x81, 0xb0},
- {0x13, 0x60, 0x81, 0xc0},
- {0x13, 0x00, 0x81, 0x08},
- {0x13, 0x77, 0x81, 0x05},
- {0x13, 0x76, 0x81, 0x00},
- {0x13, 0x74, 0x81, 0x06},
- {0x13, 0x75, 0x81, 0x00},
- {0x13, 0x69, 0x81, 0x0a},
-
- {0x13, 0x15, 0x81, 0x06},
- {0x13, 0x14, 0x81, 0xb0},
- {0x13, 0x60, 0x81, 0xc0},
- {0x13, 0x00, 0x81, 0x08},
- {0x13, 0x02, 0x81, 0x81},
- {0x13, 0x04, 0x81, 0x82},
- {0x13, 0x0a, 0x81, 0x01},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x07},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x01},
- {0x13, 0x06, 0x81, 0xeb},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x0a, 0x81, 0x00},
- {0x13, 0x0a, 0x81, 0x02},
- {0x13, 0x07, 0x81, 0x00},
- {0x13, 0x07, 0x81, 0x5e},
- {0x13, 0x07, 0x81, 0x02},
- {0x13, 0x07, 0x81, 0xe5},
- {0x13, 0x0a, 0x81, 0x00},
-
- {0x13, 0x15, 0x81, 0x00},
- {0x13, 0x14, 0x81, 0xb0},
- {0x13, 0x69, 0x81, 0x0a},
- {0x13, 0x15, 0x81, 0x01},
- {0x13, 0x14, 0x81, 0xb0},
-
- {0x13, 0x15, 0x81, 0x06},
- {0x13, 0x14, 0x81, 0xb0},
- {0x13, 0x60, 0x81, 0xc0},
- {0x13, 0x00, 0x81, 0x08},
- {0x13, 0x02, 0x81, 0x81},
- {0x13, 0x04, 0x81, 0x82},
- {0x13, 0x0a, 0x81, 0x01},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x07},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x01},
- {0x13, 0x06, 0x81, 0xeb},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x0a, 0x81, 0x00},
- {0x13, 0x0a, 0x81, 0x02},
- {0x13, 0x07, 0x81, 0x00},
- {0x13, 0x07, 0x81, 0x5e},
- {0x13, 0x07, 0x81, 0x02},
- {0x13, 0x07, 0x81, 0xe5},
- {0x13, 0x0a, 0x81, 0x00},
- {0x13, 0x15, 0x81, 0x04},
- {0x13, 0x14, 0x81, 0xb0},
-
- {0x13, 0x77, 0x81, 0x05},
- {0x13, 0x76, 0x81, 0x04},
- {0x13, 0x74, 0x81, 0x06},
- {0x13, 0x72, 0x81, 0x06},
- {0x13, 0x70, 0x81, 0x00},
- {0x13, 0x15, 0x81, 0x04},
- {0x13, 0x14, 0x81, 0xb0},
-
- {0x13, 0x15, 0x81, 0x00},
- {0x13, 0x14, 0x81, 0xb0},
- {0x13, 0x60, 0x81, 0xc0},
- {0x13, 0x00, 0x81, 0x08},
- {0x13, 0x77, 0x81, 0x05},
- {0x13, 0x76, 0x81, 0x00},
- {0x13, 0x74, 0x81, 0x06},
- {0x13, 0x75, 0x81, 0x00},
- {0x13, 0x69, 0x81, 0x0a},
-
- {0x13, 0x15, 0x81, 0x06},
- {0x13, 0x14, 0x81, 0xb0},
- {0x13, 0x60, 0x81, 0xc0},
- {0x13, 0x00, 0x81, 0x08},
- {0x13, 0x02, 0x81, 0x81},
- {0x13, 0x04, 0x81, 0x82},
- {0x13, 0x0a, 0x81, 0x01},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x07},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x01},
- {0x13, 0x06, 0x81, 0xeb},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x06, 0x81, 0x00},
- {0x13, 0x0a, 0x81, 0x00},
- {0x13, 0x0a, 0x81, 0x02},
- {0x13, 0x07, 0x81, 0x00},
- {0x13, 0x07, 0x81, 0x5e},
- {0x13, 0x07, 0x81, 0x02},
- {0x13, 0x07, 0x81, 0xe5},
- {0x13, 0x0a, 0x81, 0x00},
-
- {0x13, 0x15, 0x81, 0x00},
- {0x13, 0x14, 0x81, 0xb0},
- {0x13, 0x69, 0x81, 0x0a},
- {0x13, 0x15, 0x81, 0x01},
- {0x13, 0x14, 0x81, 0xb0}
+static unsigned char sensor_urb_skeleton[24] =
+{
+ 0x23, 0x74, 0x81, 0x06,
+ 0x23, 0x62, 0x81, 0x80,
+ 0x13, 0x6a, 0x81, 0x60,
+ 0x13, 0x6b, 0x81, 0x00,
+ 0x13, 0x6c, 0x81, 0x00,
+ 0x13, 0x68, 0x81, 0x11
};
-static const unsigned char init_webcam_magic_24[138][24] =
+static const unsigned char init_webcam_magic[][3] =
{
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x12, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x12, 0x13, 0x6c, 0x81, 0x05, 0x13, 0x68, 0x81, 0x11},
+ /* [INITCAM] */
+ {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02},
+ {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0},
+ {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00},
+ {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
+ {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
+ {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0d},
+ {BRIDGE, M5602_XB_SENSOR_CTRL, 0x00},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x12, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x11, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x35, 0x13, 0x6c, 0x81, 0x91, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x37, 0x13, 0x6c, 0x81, 0x04, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x39, 0x13, 0x6c, 0x81, 0x40, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x38, 0x13, 0x6c, 0x81, 0x12, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x0e, 0x13, 0x6c, 0x81, 0x20, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x13, 0x13, 0x6c, 0x81, 0xc0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x01, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x02, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x00, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x10, 0x13, 0x6c, 0x81, 0xf0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1b, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x16, 0x13, 0x6c, 0x81, 0x06, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x33, 0x13, 0x6c, 0x81, 0x10, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x34, 0x13, 0x6c, 0x81, 0xbf, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0xa8, 0x13, 0x6c, 0x81, 0x81, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x41, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x96, 0x13, 0x6c, 0x81, 0x04, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x3d, 0x13, 0x6c, 0x81, 0x19, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x69, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x3a, 0x13, 0x6c, 0x81, 0x0d, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x8e, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x3c, 0x13, 0x6c, 0x81, 0x73, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x8f, 0x13, 0x6c, 0x81, 0xdf, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x8b, 0x13, 0x6c, 0x81, 0x06, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x35, 0x13, 0x6c, 0x81, 0x91, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x94, 0x13, 0x6c, 0x81, 0x99, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x95, 0x13, 0x6c, 0x81, 0x99, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x40, 0x13, 0x6c, 0x81, 0xc0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x0f, 0x13, 0x6c, 0x81, 0x4b, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x27, 0x13, 0x6c, 0x81, 0xa0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x28, 0x13, 0x6c, 0x81, 0xa0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x29, 0x13, 0x6c, 0x81, 0xa0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x2c, 0x13, 0x6c, 0x81, 0xa0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0xa5, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1e, 0x13, 0x6c, 0x81, 0x04, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0xa9, 0x13, 0x6c, 0x81, 0x98, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x24, 0x13, 0x6c, 0x81, 0x68, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x25, 0x13, 0x6c, 0x81, 0x5c, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x26, 0x13, 0x6c, 0x81, 0xc3, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x14, 0x13, 0x6c, 0x81, 0x4e, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1e, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x15, 0x13, 0x6c, 0x81, 0x42, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x17, 0x13, 0x6c, 0x81, 0x1a, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x18, 0x13, 0x6c, 0x81, 0xbf, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x32, 0x13, 0x6c, 0x81, 0xb2, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x19, 0x13, 0x6c, 0x81, 0x02, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1a, 0x13, 0x6c, 0x81, 0x7e, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x03, 0x13, 0x6c, 0x81, 0x10, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x12, 0x13, 0x6c, 0x81, 0x45, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1b, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x37, 0x13, 0x6c, 0x81, 0x04, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x69, 0x13, 0x6c, 0x81, 0x40, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x8c, 0x13, 0x6c, 0x81, 0x23, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x62, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x63, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x64, 0x13, 0x6c, 0x81, 0x10, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x65, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x66, 0x13, 0x6c, 0x81, 0x01, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x9d, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x9e, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
+ {BRIDGE, M5602_XB_GPIO_DIR, 0x77},
+ {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
+ {BRIDGE, M5602_XB_SENSOR_TYPE, 0x08},
+ {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x04},
+ {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
+ {BRIDGE, M5602_XB_GPIO_DIR, 0x05},
+ {BRIDGE, M5602_XB_GPIO_DAT, 0x04},
+ {BRIDGE, M5602_XB_GPIO_EN_H, 0x06},
+ {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06},
+ {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00},
+ {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x04},
+ {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
+ {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00},
+ {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
+ {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
+ {BRIDGE, M5602_XB_SENSOR_TYPE, 0x08},
+ {BRIDGE, M5602_XB_GPIO_DIR, 0x05},
+ {BRIDGE, M5602_XB_GPIO_DAT, 0x00},
+ {BRIDGE, M5602_XB_GPIO_EN_H, 0x06},
+ {BRIDGE, M5602_XB_GPIO_EN_L, 0x00},
+ {BRIDGE, M5602_XB_I2C_CLK_DIV, 0x0a},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x01, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x02, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
+ {SENSOR, OV9650_COM7, 0x80}, /* Reset chip */
+ {SENSOR, OV9650_CLKRC, 0x80}, /* Enable double clock */
+ {SENSOR, OV9650_OFON, 0x40}, /* Do something out of spec with the power */
+ {SENSOR, OV9650_COM1, 0x20}, /* Set QQVGA or QQCIF */
+ {SENSOR, OV9650_COM8, 0xc0}, /* Set fast AGC/AEC algorithm with unlimited step size */
+ {SENSOR, OV9650_RSVD16, 0x06},
+ {SENSOR, OV9650_CHLF, 0x10},
+ {SENSOR, OV9650_ARBLM, 0xbf},
+ {SENSOR, OV9650_ACOM38, 0x81},
+ {SENSOR, OV9650_COM16, 0x00}, /* Turn off color matrix coefficient double option */
+ {SENSOR, OV9650_RSVD96, 0x04},
+ {SENSOR, OV9650_COM13, 0x19}, /* Enable color matrix for RGB/YUV, Delay Y channel, set output Y/UV delay to 1 */
+ {SENSOR, OV9650_TSLB, 0x0d}, /* Enable digital BLC, Set output mode to U Y V Y */
+ {SENSOR, OV9650_COM24, 0x00}, /* Limit the AGC/AEC stable upper region */
+ {SENSOR, OV9650_COM12, 0x73}, /* Enable HREF and some out of spec things */
+ {SENSOR, OV9650_DBLC1, 0xdf}, /* Set all DBLC offset signs to positive and do some out of spec stuff */
+ {SENSOR, OV9650_COM21, 0x06},
+ {SENSOR, OV9650_RSVD1, 0x91},
+ {SENSOR, OV9650_RSVD94, 0x99},
+ {SENSOR, OV9650_RSVD95, 0x99},
+ {SENSOR, OV9650_COM15, 0xc0}, /* Enable full range output */
+ {SENSOR, OV9650_COM6, 0x4b}, /* Enable HREF at optical black, enable ADBLC bias, enable ADBLC, reset timings at format change */
+ {SENSOR, OV9650_BBIAS, 0xa0}, /* Subtract 32 from the B channel bias */
+ {SENSOR, OV9650_GbBIAS, 0xa0}, /* Subtract 32 from the Gb channel bias */
+ {SENSOR, OV9650_Gr_COM, 0xa0}, /* Bypass the analog BLC and to some out of spec stuff */
+ {SENSOR, OV9650_RBIAS, 0xa0}, /* Subtract 32 from the R channel bias */
+ {SENSOR, OV9650_COM26, 0x80},
+ {SENSOR, OV9650_ACOMA9, 0x98},
+ {SENSOR, OV9650_AEW, 0x68}, /* Set the AGC/AEC stable region upper limit */
+ {SENSOR, OV9650_AEB, 0x5c}, /* Set the AGC/AEC stable region lower limit */
+ {SENSOR, OV9650_VPT, 0xc3}, /* Set the high and low limit nibbles to 3 */
+ {SENSOR, OV9650_COM9, 0x4e}, /* Set the Automatic Gain Ceiling (AGC) to 32x,
+ drop VSYNC at frame drop,
+ limit exposure timing
+ drop frame when the AEC step is larger than the exposure gap */
+ {SENSOR, OV9650_MVFP, 0x20}, /* flip the image */
+ {SENSOR, OV9650_COM10, 0x42}, /* Set VSYNC negative, Set RESET to SLHS (slave mode horizontal sync) and set PWDN to SLVS (slave mode vertical sync) */
+ {SENSOR, OV9650_HSTART, 0x1a}, /* Set horizontal column start high to default value */
+ {SENSOR, OV9650_HSTOP, 0xbf}, /* Set horizontal column end */
+ {SENSOR, OV9650_HREF, 0xb2}, /* Complementing register to the two writes above */
+ {SENSOR, OV9650_VSTRT, 0x02}, /* Set vertical row start high bits */
+ {SENSOR, OV9650_VSTOP, 0x7e}, /* Set vertical row end low bits */
+ {SENSOR, OV9650_VREF, 0x10}, /* Set complementing vertical frame control */
+ {SENSOR, OV9650_COM7, 0x45}, /* Set raw RGB output format with VGA resolution */
+ {SENSOR, OV9650_ADC, 0x04},
+ {SENSOR, OV9650_HV, 0x40},
+ {SENSOR, OV9650_COM22, 0x23}, /* Enable denoise, and white-pixel erase */
+ {SENSOR, OV9650_LCC5, 0x01}, /* Set lens correction from 00 to 01 */
+ {SENSOR, OV9650_AECH, 0x29}, /* Set the high bits of the exposure value */
+ {SENSOR, OV9650_COM1, 0x03}, /* Set the low bits of the exposure value */
+ {SENSOR, OV9650_GAIN, 0x02}, /* Set the gain */
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x10, 0x13, 0x6c, 0x81, 0x29, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x04, 0x13, 0x6c, 0x81, 0x03, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x00, 0x13, 0x6c, 0x81, 0x02, 0x13, 0x68, 0x81, 0x11},
+ /* [STARTCAM] */
+ {BRIDGE, M5602_XB_ADC_CTRL, 0xc0},
+ {BRIDGE, M5602_XB_SENSOR_TYPE, 0x08},
+ {BRIDGE, M5602_XB_GPIO_DIR, 0x05},
+ {BRIDGE, M5602_XB_GPIO_DAT, 0x00},
+ {BRIDGE, M5602_XB_GPIO_EN_H, 0x06},
+ {BRIDGE, M5602_XB_GPIO_EN_L, 0x00},
+ {BRIDGE, M5602_XB_I2C_CLK_DIV, 0x0a},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x12, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x12, 0x13, 0x6c, 0x81, 0x05, 0x13, 0x68, 0x81, 0x11},
+ /* [SETSIZE2] */
+ {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81},
+ {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82},
+ {BRIDGE, M5602_XB_SIG_INI, 0x01},
+ {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
+ {BRIDGE, M5602_XB_VSYNC_PARA, 0x07}, /* Does something with the height, originally 0x07 */
+ {BRIDGE, M5602_XB_VSYNC_PARA, 0x00},
+ {BRIDGE, M5602_XB_VSYNC_PARA, 0x01}, /* These two registers define the picture height. Originally 491 */
+ {BRIDGE, M5602_XB_VSYNC_PARA, 0xeb}, /* 0xe0 */
+ {BRIDGE, M5602_XB_SIG_INI, 0x02},
+ {BRIDGE, M5602_XB_HSYNC_PARA, 0x00},
+ {BRIDGE, M5602_XB_HSYNC_PARA, 0x5e}, /* Does something with the width, originally 0x5e */
+ {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, /* These two registers define the picture width. Originally 741 */
+ {BRIDGE, M5602_XB_HSYNC_PARA, 0xdd}, /* 0xe5 originally */
+ {BRIDGE, M5602_XB_SIG_INI, 0x00},
+ {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00},
+ {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
+ {BRIDGE, M5602_XB_I2C_CLK_DIV, 0x0a},
+ {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x01},
+ {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x12, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x11, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x35, 0x13, 0x6c, 0x81, 0x91, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x37, 0x13, 0x6c, 0x81, 0x04, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x39, 0x13, 0x6c, 0x81, 0x40, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x38, 0x13, 0x6c, 0x81, 0x12, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x0e, 0x13, 0x6c, 0x81, 0x20, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x13, 0x13, 0x6c, 0x81, 0xc0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x01, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x02, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x00, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x10, 0x13, 0x6c, 0x81, 0xf0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1b, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x16, 0x13, 0x6c, 0x81, 0x06, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x33, 0x13, 0x6c, 0x81, 0x10, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x34, 0x13, 0x6c, 0x81, 0xbf, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0xa8, 0x13, 0x6c, 0x81, 0x81, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x41, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x96, 0x13, 0x6c, 0x81, 0x04, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x3d, 0x13, 0x6c, 0x81, 0x19, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x69, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x3a, 0x13, 0x6c, 0x81, 0x0d, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x8e, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x3c, 0x13, 0x6c, 0x81, 0x73, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x8f, 0x13, 0x6c, 0x81, 0xdf, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x8b, 0x13, 0x6c, 0x81, 0x06, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x35, 0x13, 0x6c, 0x81, 0x91, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x94, 0x13, 0x6c, 0x81, 0x99, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x95, 0x13, 0x6c, 0x81, 0x99, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x40, 0x13, 0x6c, 0x81, 0xc0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x0f, 0x13, 0x6c, 0x81, 0x4b, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x27, 0x13, 0x6c, 0x81, 0xa0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x28, 0x13, 0x6c, 0x81, 0xa0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x29, 0x13, 0x6c, 0x81, 0xa0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x2c, 0x13, 0x6c, 0x81, 0xa0, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0xa5, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1e, 0x13, 0x6c, 0x81, 0x04, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0xa9, 0x13, 0x6c, 0x81, 0x98, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x24, 0x13, 0x6c, 0x81, 0x68, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x25, 0x13, 0x6c, 0x81, 0x5c, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x26, 0x13, 0x6c, 0x81, 0xc3, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x14, 0x13, 0x6c, 0x81, 0x4e, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1e, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x15, 0x13, 0x6c, 0x81, 0x42, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x17, 0x13, 0x6c, 0x81, 0x1a, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x18, 0x13, 0x6c, 0x81, 0xbf, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x32, 0x13, 0x6c, 0x81, 0xb2, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x19, 0x13, 0x6c, 0x81, 0x02, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1a, 0x13, 0x6c, 0x81, 0x7e, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x03, 0x13, 0x6c, 0x81, 0x10, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x12, 0x13, 0x6c, 0x81, 0x45, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x1b, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x37, 0x13, 0x6c, 0x81, 0x04, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x69, 0x13, 0x6c, 0x81, 0x40, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x8c, 0x13, 0x6c, 0x81, 0x23, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x62, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x63, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x64, 0x13, 0x6c, 0x81, 0x10, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x65, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x66, 0x13, 0x6c, 0x81, 0x01, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x9d, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x9e, 0x13, 0x6c, 0x81, 0x00, 0x13, 0x68, 0x81, 0x11},
-
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x01, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x02, 0x13, 0x6c, 0x81, 0x80, 0x13, 0x68, 0x81, 0x11},
-
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x10, 0x13, 0x6c, 0x81, 0x29, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x04, 0x13, 0x6c, 0x81, 0x03, 0x13, 0x68, 0x81, 0x11},
- {0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, 0x6a, 0x81, 0x60, 0x13, 0x6b, 0x81, 0x00, 0x13, 0x6c, 0x81, 0x02, 0x13, 0x68, 0x81, 0x11}
+ {END, 0x00, 0x00}
};
-
#endif /*M5602_H_*/
Index: m5602.c
===================================================================
--- m5602.c (revision 115)
+++ m5602.c (working copy)
@@ -245,151 +245,69 @@
.cropcap = {0, {0, 0, 640, 480}, {0, 0, 640, 480}, }
};
-static int m5602_initialize_camera(struct m5602_camera *cam)
+static int write_sensor(struct m5602_camera *cam, u8 address, u8 value)
{
- int array4 = 0, array24 = 0;
- struct usb_device* udev = cam->udev;
+ int result = 0;
+ PDEBUG(DBG_TRACE, "Writing 0x%x to the 0x%x sensor register", value, address);
- PDEBUG(DBG_TRACE, "m5602_initialize_camera");
+ memcpy(cam->control_buffer, sensor_urb_skeleton, sizeof(sensor_urb_skeleton));
+ cam->control_buffer[15] = address;
+ cam->control_buffer[19] = value;
- if (!(cam->state & DEV_INITIALIZED))
- {
- init_waitqueue_head(&cam->open);
+ result = usb_control_msg(cam->udev, usb_sndctrlpipe(cam->udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 24, URB_MSG_TIMEOUT);
+ return result;
+}
- init_MUTEX(&cam->fileop_sem);
+static int write_bridge(struct m5602_camera *cam, u8 address, u8 value)
+{
+ int result = 0;
+ PDEBUG(DBG_TRACE, "Writing 0x%x to the 0x%x bridge register", value, address);
- spin_lock_init(&cam->queue_lock);
+ memcpy(cam->control_buffer, bridge_urb_skeleton, sizeof(bridge_urb_skeleton));
+ cam->control_buffer[1] = address;
+ cam->control_buffer[3] = value;
- init_waitqueue_head(&cam->wait_frame);
- init_waitqueue_head(&cam->wait_stream);
+ result = usb_control_msg(cam->udev, usb_sndctrlpipe(cam->udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
+ return result;
+}
- cam->nreadbuffers = 2;
- cam->state |= DEV_INITIALIZED;
- }
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x14, 0x0ffb, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0x00
+static int m5602_initialize_camera(struct m5602_camera *cam)
+{
+ int i;
+ struct usb_device *udev = cam->udev;
+ PDEBUG(DBG_TRACE, "m5602_initialize_camera");
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x14, 0x0ffb, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0x00
+ if (!(cam->state & DEV_INITIALIZED)) {
+ init_waitqueue_head(&cam->open);
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x14, 0x0ffb, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0x00
+ init_MUTEX(&cam->fileop_sem);
- for(; array4 < 7; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
+ spin_lock_init(&cam->queue_lock);
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x14, 0x8177, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0x77
+ init_waitqueue_head(&cam->wait_frame);
+ init_waitqueue_head(&cam->wait_stream);
- for(; array4 < 8; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
+ cam->nreadbuffers = 2;
+ cam->state |= DEV_INITIALIZED;
+ }
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x14, 0x8176, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0x5c
-
- for(; array4 < 13; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
+ for (i = 0; init_webcam_magic[i][0] != END; i++) {
+ if (init_webcam_magic[i][0] == BRIDGE)
+ write_bridge(cam, init_webcam_magic[i][1], init_webcam_magic[i][2]);
+ else
+ write_sensor(cam, init_webcam_magic[i][1], init_webcam_magic[i][2]);
+ }
- for(; array24 < 2; array24++) {
- memcpy(cam->control_buffer, init_webcam_magic_24[array24], 24);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 24, URB_MSG_TIMEOUT);
- }
+ usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x14, 0x8173, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0xff
+ PDEBUG(DBG_V4L2, "m5602_initialize_camera done! Cam returned: 0x%x, expected 0xff", cam->control_buffer[0]);
- for(; array4 < 29; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
+ cam->control_buffer[0] = 0xdf;
+ usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x13, 0x8173, cam->control_buffer, 1, URB_MSG_TIMEOUT);
- for(; array24 < 64; array24++) {
- memcpy(cam->control_buffer, init_webcam_magic_24[array24], 24);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 24, URB_MSG_TIMEOUT);
- }
-
- for(; array4 < 51; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
-
- for(; array24 < 66; array24++) {
- memcpy(cam->control_buffer, init_webcam_magic_24[array24], 24);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 24, URB_MSG_TIMEOUT);
- }
-
- for(; array4 < 56; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
-
- for(; array24 < 69; array24++) {
- memcpy(cam->control_buffer, init_webcam_magic_24[array24], 24);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 24, URB_MSG_TIMEOUT);
- }
-
- for(; array4 < 80; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
-
- for(; array24 < 71; array24++) {
- memcpy(cam->control_buffer, init_webcam_magic_24[array24], 24);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 24, URB_MSG_TIMEOUT);
- }
-
- for(; array4 < 87; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x14, 0x8177, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0x05
-
- cam->control_buffer[0] = 0x05;
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x13, 0x8177, cam->control_buffer, 1, URB_MSG_TIMEOUT);
-
- for(; array4 < 96; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
-
- for(; array24 < 133; array24++) {
- memcpy(cam->control_buffer, init_webcam_magic_24[array24], 24);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 24, URB_MSG_TIMEOUT);
- }
-
- for (; array4 < 119; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
-
- for(; array24 < 135; array24++) {
- memcpy(cam->control_buffer, init_webcam_magic_24[array24], 24);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 24, URB_MSG_TIMEOUT);
- }
-
- for (; array4 < 124; array4++) {
- memcpy(cam->control_buffer, init_webcam_magic_4[array4], 4);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 4, URB_MSG_TIMEOUT);
- }
-
- for(; array24 < 138; array24++) {
- memcpy(cam->control_buffer, init_webcam_magic_24[array24], 24);
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x19, 0x0000, cam->control_buffer, 24, URB_MSG_TIMEOUT);
- }
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x14, 0x8175, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0x00
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x13, 0x8175, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0x00
-
- usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x04, 0xc0, 0x14, 0x8173, cam->control_buffer, 1, URB_MSG_TIMEOUT); // should be 0xff
- PDEBUG(DBG_V4L2, "m5602_initialize_camera done! Cam returned: 0x%x, expected 0xff", cam->control_buffer[0]);
-
- cam->control_buffer[0] = 0xdf;
- usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x04, 0x40, 0x13, 0x8173, cam->control_buffer, 1, URB_MSG_TIMEOUT);
-
- return 0;
+ return 0;
}
+
static void m5602_release_resources(struct m5602_camera* cam)
{
down(&m5602_sysfs_lock);
Index: m5602_bayer.c
===================================================================
--- m5602_bayer.c (revision 115)
+++ m5602_bayer.c (working copy)
@@ -15,52 +15,52 @@
void bayer_decode_rgb32(unsigned char *src, unsigned char *dest, int width, int height)
{
- unsigned char *outR, *outG, *outB;
- register int i, j;
+ unsigned char *outR, *outG, *outB;
+ register int i, j;
- outR = &dest[2];
- outG = &dest[1];
- outB = &dest[0];
+ outR = &dest[0];
+ outG = &dest[2];
+ outB = &dest[1];
- for (i = 0; i < height - 1; i += 2) {
- for (j = 0; j < width - 1; j += 2) {
- outG[(i * width + j) * 4] = src[i * width + j];
- outG[((i + 1) * width + (j + 1)) * 4] = src[(i + 1) * width + (j + 1)];
- outR[(i * width + j + 1) * 4] = src[i * width + j + 1];
- outB[((i + 1) * width + j) * 4] = src[(i + 1) * width + j];
- }
- }
+ for (i = 2; i < height - 1; i += 2) {
+ for (j = 0; j < width - 1; j += 2) {
+ outG[(i * width + j) * 4] = src[i * width + j];
+ outG[((i + 1) * width + (j + 1)) * 4] = src[(i + 1) * width + (j + 1)];
+ outR[(i * width + j + 1) * 4] = src[i * width + j + 1];
+ outB[((i + 1) * width + j) * 4] = src[(i + 1) * width + j];
+ }
+ }
// R channel
- for (i = 0; i < height; i += 2) {
- for (j = 0; j < width - 1; j += 2) {
- outR[(i * width + j) * 4] = outR[(i * width + j + 1) * 4];
- outR[((i + 1) * width + j + 1) * 4] = outR[(i * width + j + 1) * 4];
- outR[((i + 1) * width + j) * 4] = outR[(i * width + j + 1) * 4];
- }
- }
-
+ for (i = 2; i < height; i += 2) {
+ for (j = 0; j < width - 1; j += 2) {
+ outR[(i * width + j) * 4] = outR[(i * width + j + 1) * 4];
+ outR[((i + 1) * width + j + 1) * 4] = outR[(i * width + j + 1) * 4];
+ outR[((i + 1) * width + j) * 4] = outR[(i * width + j + 1) * 4];
+ }
+ }
+
// B channel
- for (i = 0; i < height - 1; i += 2) { //every two lines
- for (j = 0; j < width - 1; j += 2) {
- outB[(i * width + j) * 4] = outB[((i + 1) * width + j) * 4];
- outB[(i * width + j + 1) * 4] = outB[((i + 1) * width + j) * 4];
- outB[((i + 1) * width + j + 1) * 4] = outB[((i + 1) * width + j) * 4];
- }
- }
-
+ for (i = 2; i < height - 1; i += 2) { //every two lines
+ for (j = 0; j < width - 1; j += 2) {
+ outB[(i * width + j) * 4] = outB[((i + 1) * width + j) * 4];
+ outB[(i * width + j + 1) * 4] = outB[((i + 1) * width + j) * 4];
+ outB[((i + 1) * width + j + 1) * 4] = outB[((i + 1) * width + j) * 4];
+ }
+ }
+
// G channel
- for (i = 0; i < height - 1; i += 2)
- for (j = 1; j < width; j += 2)
- outG[(i * width + j) * 4] = outG[((i + 1) * width + j) * 4];
+ for (i = 2; i < height - 1; i += 2)
+ for (j = 1; j < width; j += 2)
+ outG[(i * width + j) * 4] = outG[((i + 1) * width + j) * 4];
- for (i = 1; i < height - 2; i += 2)
- for (j = 0; j < width - 1; j += 2)
- outG[(i * width + j) * 4] = outG[((i + 1) * width + j) * 4];
-
+ for (i = 3; i < height - 2; i += 2)
+ for (j = 0; j < width - 1; j += 2)
+ outG[(i * width + j) * 4] = outG[((i + 1) * width + j) * 4];
+
// copy it for the next line
- for (j = 0; j < width - 1; j += 2)
- outG[((height - 1) * width + j) * 4] = outG[((height - 2) * width + j) * 4];
+ for (j = 0; j < width - 1; j += 2)
+ outG[((height - 1) * width + j) * 4] = outG[((height - 2) * width + j) * 4];
}
void bayer_decode_rgb24(unsigned char *src, unsigned char *dest, int width, int height)
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
M560x-driver-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/m560x-driver-devel