V4L/DVB (11478): gspca - m5602-mt9m111: Replace various magic constants with defines

Signed-off-by: Erik Andr?n <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Erik Andr?n 2009-01-12 13:43:42 -03:00 committed by Mauro Carvalho Chehab
parent 926d503807
commit 7662dbb373
1 changed files with 39 additions and 21 deletions

View File

@ -37,7 +37,6 @@
#define MT9M111_SC_VBLANK_CONTEXT_A 0x08
#define MT9M111_SC_SHUTTER_WIDTH 0x09
#define MT9M111_SC_ROW_SPEED 0x0a
#define MT9M111_SC_EXTRA_DELAY 0x0b
#define MT9M111_SC_SHUTTER_DELAY 0x0c
#define MT9M111_SC_RESET 0x0d
@ -50,9 +49,6 @@
#define MT9M111_SC_GREEN_2_GAIN 0x2e
#define MT9M111_SC_GLOBAL_GAIN 0x2f
#define MT9M111_RMB_MIRROR_ROWS (1 << 0)
#define MT9M111_RMB_MIRROR_COLS (1 << 1)
#define MT9M111_CONTEXT_CONTROL 0xc8
#define MT9M111_PAGE_MAP 0xf0
#define MT9M111_BYTEWISE_ADDRESS 0xf1
@ -74,7 +70,24 @@
#define MT9M111_COLORPIPE 0x01
#define MT9M111_CAMERA_CONTROL 0x02
#define MT9M111_RESET (1 << 0)
#define MT9M111_RESTART (1 << 1)
#define MT9M111_ANALOG_STANDBY (1 << 2)
#define MT9M111_CHIP_ENABLE (1 << 3)
#define MT9M111_CHIP_DISABLE (0 << 3)
#define MT9M111_OUTPUT_DISABLE (1 << 4)
#define MT9M111_SHOW_BAD_FRAMES (1 << 0)
#define MT9M111_RESTART_BAD_FRAMES (1 << 1)
#define MT9M111_SYNCHRONIZE_CHANGES (1 << 7)
#define MT9M111_RMB_MIRROR_ROWS (1 << 0)
#define MT9M111_RMB_MIRROR_COLS (1 << 1)
#define MT9M111_COLOR_MATRIX_BYPASS (1 << 4)
#define MT9M111_SEL_CONTEXT_B (1 << 3)
#define MT9M111_TRISTATE_PIN_IN_STANDBY (1 << 1)
#define MT9M111_SOC_SOFT_STANDBY (1 << 0)
#define INITIAL_MAX_GAIN 64
#define DEFAULT_GAIN 283
@ -112,7 +125,14 @@ static const unsigned char preinit_mt9m111[][4] =
{BRIDGE, M5602_XB_SENSOR_TYPE, 0x09, 0x00},
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x00},
{SENSOR, MT9M111_SC_RESET, 0xff, 0xf7},
{SENSOR, MT9M111_SC_RESET,
MT9M111_RESET |
MT9M111_RESTART |
MT9M111_ANALOG_STANDBY |
MT9M111_CHIP_DISABLE,
MT9M111_SHOW_BAD_FRAMES |
MT9M111_RESTART_BAD_FRAMES |
MT9M111_SYNCHRONIZE_CHANGES},
{BRIDGE, M5602_XB_GPIO_DIR, 0x05, 0x00},
{BRIDGE, M5602_XB_GPIO_DAT, 0x04, 0x00},
@ -149,15 +169,13 @@ static const unsigned char init_mt9m111[][4] =
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x00},
{SENSOR, MT9M111_SC_RESET, 0xff, 0xff},
{SENSOR, MT9M111_SC_RESET, 0xff, 0xff},
{SENSOR, MT9M111_SC_RESET, 0xff, 0xde},
{SENSOR, MT9M111_SC_RESET, 0xff, 0xff},
{SENSOR, MT9M111_SC_RESET, 0xff, 0xf7},
{SENSOR, MT9M111_PAGE_MAP, 0x00, 0x01},
{BRIDGE, M5602_XB_I2C_REG_ADDR, 0xb3, 0x00},
{SENSOR, MT9M111_CP_GLOBAL_CLK_CONTROL, 0xff, 0xff},
{SENSOR, MT9M111_CP_GLOBAL_CLK_CONTROL, 0x00,
MT9M111_TRISTATE_PIN_IN_STANDBY |
MT9M111_SOC_SOFT_STANDBY},
{BRIDGE, M5602_XB_GPIO_EN_H, 0x06, 0x00},
{BRIDGE, M5602_XB_GPIO_EN_L, 0x00, 0x00},
@ -364,23 +382,23 @@ static const unsigned char init_mt9m111[][4] =
{SENSOR, 0x85, 0x48, 0x0e},
{SENSOR, 0x86, 0x5b, 0x02},
{SENSOR, 0x87, 0x00, 0x5c},
{SENSOR, MT9M111_CONTEXT_CONTROL, 0x00, 0x08},
{SENSOR, MT9M111_CONTEXT_CONTROL, 0x00, MT9M111_SEL_CONTEXT_B},
{SENSOR, 0x60, 0x00, 0x80},
{SENSOR, 0x61, 0x00, 0x00},
{SENSOR, 0x62, 0x00, 0x00},
{SENSOR, 0x63, 0x00, 0x00},
{SENSOR, 0x64, 0x00, 0x00},
{SENSOR, MT9M111_SC_ROWSTART, 0x00, 0x0d},
{SENSOR, MT9M111_SC_COLSTART, 0x00, 0x12},
{SENSOR, MT9M111_SC_WINDOW_HEIGHT, 0x04, 0x00},
{SENSOR, MT9M111_SC_WINDOW_WIDTH, 0x05, 0x10},
{SENSOR, MT9M111_SC_HBLANK_CONTEXT_B, 0x01, 0x60},
{SENSOR, MT9M111_SC_VBLANK_CONTEXT_B, 0x00, 0x11},
{SENSOR, MT9M111_SC_HBLANK_CONTEXT_A, 0x01, 0x60},
{SENSOR, MT9M111_SC_VBLANK_CONTEXT_A, 0x00, 0x11},
{SENSOR, MT9M111_SC_R_MODE_CONTEXT_B, 0x01, 0x0f},
{SENSOR, MT9M111_SC_R_MODE_CONTEXT_A, 0x01, 0x0f},
{SENSOR, MT9M111_SC_ROWSTART, 0x00, 0x0d}, /* 13 */
{SENSOR, MT9M111_SC_COLSTART, 0x00, 0x12}, /* 18 */
{SENSOR, MT9M111_SC_WINDOW_HEIGHT, 0x04, 0x00}, /* 1024 */
{SENSOR, MT9M111_SC_WINDOW_WIDTH, 0x05, 0x10}, /* 1296 */
{SENSOR, MT9M111_SC_HBLANK_CONTEXT_B, 0x01, 0x60}, /* 352 */
{SENSOR, MT9M111_SC_VBLANK_CONTEXT_B, 0x00, 0x11}, /* 17 */
{SENSOR, MT9M111_SC_HBLANK_CONTEXT_A, 0x01, 0x60}, /* 352 */
{SENSOR, MT9M111_SC_VBLANK_CONTEXT_A, 0x00, 0x11}, /* 17 */
{SENSOR, MT9M111_SC_R_MODE_CONTEXT_B, 0x01, 0x0f}, /* 271 */
{SENSOR, MT9M111_SC_R_MODE_CONTEXT_A, 0x01, 0x0f}, /* 271 */
{SENSOR, 0x30, 0x04, 0x00},
{BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06, 0x00},