diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c index 413c5b899d88..800b5f4cb0e4 100644 --- a/drivers/media/video/gspca/m5602/m5602_po1030.c +++ b/drivers/media/video/gspca/m5602/m5602_po1030.c @@ -315,7 +315,7 @@ int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val) struct sd *sd = (struct sd *) gspca_dev; s32 *sensor_settings = sd->sensor_priv; - *val= sensor_settings[VFLIP_IDX]; + *val = sensor_settings[VFLIP_IDX]; PDEBUG(D_V4L2, "Read vflip %d", *val); return 0; diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.h b/drivers/media/video/gspca/m5602/m5602_po1030.h index 7402701d5213..3e9648794df2 100644 --- a/drivers/media/video/gspca/m5602/m5602_po1030.h +++ b/drivers/media/video/gspca/m5602/m5602_po1030.h @@ -115,8 +115,23 @@ #define PO1030_YCONTRAST 0x74 #define PO1030_YSATURATION 0x75 -#define PO1030_HFLIP (1 << 7) -#define PO1030_VFLIP (1 << 6) +#define PO1030_HFLIP (1 << 7) +#define PO1030_VFLIP (1 << 6) + +#define PO1030_HREF_ENABLE (1 << 6) + +#define PO1030_RAW_RGB_BAYER 0x4 + +#define PO1030_FRAME_EQUAL (1 << 3) +#define PO1030_AUTO_SUBSAMPLING (1 << 4) + +#define PO1030_WEIGHT_WIN_2X (1 << 3) + +#define PO1030_SHUTTER_MODE (1 << 6) +#define PO1030_AUTO_SUBSAMPLING (1 << 4) +#define PO1030_FRAME_EQUAL (1 << 3) + +#define PO1030_SENSOR_RESET (1 << 5) /*****************************************************************************/ @@ -171,7 +186,7 @@ static const unsigned char preinit_po1030[][3] = {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, - {SENSOR, PO1030_AUTOCTRL2, 0x24}, + {SENSOR, PO1030_AUTOCTRL2, PO1030_SENSOR_RESET | (1 << 2)}, {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, @@ -203,7 +218,7 @@ static const unsigned char preinit_po1030[][3] = {BRIDGE, M5602_XB_HSYNC_PARA, 0x87}, {BRIDGE, M5602_XB_SIG_INI, 0x00}, - {SENSOR, PO1030_AUTOCTRL2, 0x24}, + {SENSOR, PO1030_AUTOCTRL2, PO1030_SENSOR_RESET | (1 << 2)}, {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, @@ -271,9 +286,8 @@ static const unsigned char init_po1030[][4] = {BRIDGE, M5602_XB_HSYNC_PARA, 0x87}, {BRIDGE, M5602_XB_SIG_INI, 0x00}, /*end of sequence 5*/ - /*sequence 2 stop */ - {SENSOR, PO1030_AUTOCTRL2, 0x24}, + {SENSOR, PO1030_AUTOCTRL2, PO1030_SENSOR_RESET | (1 << 2)}, {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, @@ -318,31 +332,35 @@ static const unsigned char init_po1030[][4] = {SENSOR, PO1030_WINDOWY_H, 0x00}, {SENSOR, PO1030_WINDOWY_L, 0x01}, + /* Set the window width to 647 */ {SENSOR, PO1030_WINDOWWIDTH_H, 0x02}, {SENSOR, PO1030_WINDOWWIDTH_L, 0x87}, + + /* Set the window height to 483 */ {SENSOR, PO1030_WINDOWHEIGHT_H, 0x01}, {SENSOR, PO1030_WINDOWHEIGHT_L, 0xe3}, - {SENSOR, PO1030_OUTFORMCTRL2, 0x04}, - {SENSOR, PO1030_OUTFORMCTRL2, 0x04}, - {SENSOR, PO1030_AUTOCTRL1, 0x08}, + {SENSOR, PO1030_OUTFORMCTRL2, PO1030_RAW_RGB_BAYER}, + {SENSOR, PO1030_AUTOCTRL1, PO1030_WEIGHT_WIN_2X}, + /* This makes no sense, hflip and vflp is located at bit 7, 6 */ {SENSOR, PO1030_CONTROL2, 0x03}, {SENSOR, 0x21, 0x90}, {SENSOR, PO1030_YTARGET, 0x60}, {SENSOR, 0x59, 0x13}, - {SENSOR, PO1030_OUTFORMCTRL1, 0x40}, + {SENSOR, PO1030_OUTFORMCTRL1, PO1030_HREF_ENABLE}, {SENSOR, PO1030_EDGE_ENH_OFF, 0x00}, {SENSOR, PO1030_EGA, 0x80}, {SENSOR, 0x78, 0x14}, {SENSOR, 0x6f, 0x01}, - {SENSOR, PO1030_CONTROL1, 0x18}, + {SENSOR, PO1030_CONTROL1, PO1030_AUTO_SUBSAMPLING | + PO1030_FRAME_EQUAL}, {SENSOR, PO1030_GLOBALGAINMAX, 0x14}, {SENSOR, PO1030_Cb_U_GAIN, 0x38}, {SENSOR, PO1030_Cr_V_GAIN, 0x38}, - {SENSOR, PO1030_CONTROL1, 0x58}, - {SENSOR, PO1030_RED_GAIN, 0x30}, + {SENSOR, PO1030_CONTROL1, PO1030_SHUTTER_MODE | + PO1030_AUTO_SUBSAMPLING | + PO1030_FRAME_EQUAL}, {SENSOR, PO1030_GREEN_1_GAIN, 0x30}, - {SENSOR, PO1030_BLUE_GAIN, 0x30}, {SENSOR, PO1030_GREEN_2_GAIN, 0x30}, {SENSOR, PO1030_GC0, 0x10}, {SENSOR, PO1030_GC1, 0x20}, @@ -377,7 +395,6 @@ static const unsigned char init_po1030[][4] = {BRIDGE, M5602_XB_HSYNC_PARA, 0x7e}, {BRIDGE, M5602_XB_SIG_INI, 0x00}, /*end of sequence 5*/ - /*sequence 6*/ /* Changing 40 in f0 the image becomes green in bayer mode and red in * rgb mode */