diff --git a/drivers/media/i2c/imx219.c b/drivers/media/i2c/imx219.c index 34f908898552..bfd3742896c1 100644 --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -156,8 +156,11 @@ static const struct imx219_reg imx219_init_tab_1920_1080_30fps[] = { {0x016F, 0x38}, {0x0170, 0x01}, {0x0171, 0x01}, + {0x0172, 0x00}, {0x0174, 0x00}, {0x0175, 0x00}, + {0x0176, 0x01}, + {0x0177, 0x01}, {0x018C, 0x0A}, {0x018D, 0x0A}, {0x0301, 0x05}, @@ -179,6 +182,143 @@ static const struct imx219_reg imx219_init_tab_1920_1080_30fps[] = { {IMX219_TABLE_END, 0x00} }; + +static const struct imx219_reg mode_1640_1232_regs[] = { + {0x0100, 0x00}, + {0x30eb, 0x05}, + {0x30eb, 0x0c}, + {0x300a, 0xff}, + {0x300b, 0xff}, + {0x30eb, 0x05}, + {0x30eb, 0x09}, + {0x0114, 0x01}, + {0x0128, 0x00}, + {0x012a, 0x18}, + {0x012b, 0x00}, + {0x0160, 0x06}, + {0x0161, 0xe6}, + {0x0162, 0x0d}, + {0x0163, 0x78}, + {0x0164, 0x00}, + {0x0165, 0x00}, + {0x0166, 0x0c}, + {0x0167, 0xcf}, + {0x0168, 0x00}, + {0x0169, 0x00}, + {0x016a, 0x09}, + {0x016b, 0x9f}, + {0x016c, 0x06}, + {0x016d, 0x68}, + {0x016e, 0x04}, + {0x016f, 0xd0}, + {0x0170, 0x01}, + {0x0171, 0x01}, + {0x0172, 0x00}, + {0x0174, 0x01}, + {0x0175, 0x01}, + {0x0176, 0x01}, + {0x0177, 0x01}, + {0x018C, 0x0a}, + {0x018D, 0x0a}, + {0x0301, 0x05}, + {0x0303, 0x01}, + {0x0304, 0x03}, + {0x0305, 0x03}, + {0x0306, 0x00}, + {0x0307, 0x39}, + {0x0309, 0x0a}, + {0x030b, 0x01}, + {0x030c, 0x00}, + {0x030d, 0x72}, + {0x0624, 0x06}, + {0x0625, 0x68}, + {0x0626, 0x04}, + {0x0627, 0xd0}, + {0x455e, 0x00}, + {0x471e, 0x4b}, + {0x4767, 0x0f}, + {0x4750, 0x14}, + {0x4540, 0x00}, + {0x47b4, 0x14}, + {0x4713, 0x30}, + {0x478b, 0x10}, + {0x478f, 0x10}, + {0x4793, 0x10}, + {0x4797, 0x0e}, + {0x479b, 0x0e}, + {0x0162, 0x0d}, + {0x0163, 0x78}, + {IMX219_TABLE_END, 0x00}, +}; + +static const struct imx219_reg mode_640_480_regs[] = { + {0x0100, 0x00}, + {0x30eb, 0x05}, + {0x30eb, 0x0c}, + {0x300a, 0xff}, + {0x300b, 0xff}, + {0x30eb, 0x05}, + {0x30eb, 0x09}, + {0x0114, 0x01}, + {0x0128, 0x00}, + {0x012a, 0x18}, + {0x012b, 0x00}, + {0x0160, 0x06}, + {0x0161, 0xe6}, + {0x0162, 0x0d}, + {0x0163, 0x78}, + {0x0164, 0x03}, + {0x0165, 0xe8}, + {0x0166, 0x08}, + {0x0167, 0xe7}, + {0x0168, 0x02}, + {0x0169, 0xf0}, + {0x016a, 0x06}, + {0x016b, 0xaf}, + {0x016c, 0x02}, + {0x016d, 0x80}, + {0x016e, 0x01}, + {0x016f, 0xe0}, + {0x0170, 0x01}, + {0x0171, 0x01}, + {0x0172, 0x00}, + {0x0174, 0x00}, + {0x0175, 0x00}, + {0x0176, 0x01}, + {0x0177, 0x01}, + {0x018C, 0x0a}, + {0x018D, 0x0a}, + {0x0301, 0x05}, + {0x0303, 0x01}, + {0x0304, 0x03}, + {0x0305, 0x03}, + {0x0306, 0x00}, + {0x0307, 0x39}, + {0x0309, 0x0a}, + {0x030b, 0x01}, + {0x030c, 0x00}, + {0x030d, 0x72}, + {0x0624, 0x06}, + {0x0625, 0x68}, + {0x0626, 0x04}, + {0x0627, 0xd0}, + {0x455e, 0x00}, + {0x471e, 0x4b}, + {0x4767, 0x0f}, + {0x4750, 0x14}, + {0x4540, 0x00}, + {0x47b4, 0x14}, + {0x4713, 0x30}, + {0x478b, 0x10}, + {0x478f, 0x10}, + {0x4793, 0x10}, + {0x4797, 0x0e}, + {0x479b, 0x0e}, + {0x0162, 0x0d}, + {0x0163, 0x78}, + {IMX219_TABLE_END, 0x00}, +}; + static const struct imx219_reg start[] = { {0x0100, 0x01}, /* mode select streaming on */ {IMX219_TABLE_END, 0x00} @@ -277,6 +417,29 @@ static const struct imx219_mode supported_modes[] = { .vts_def = 0x09c4, .reg_list = imx219_init_tab_3280_2464_21fps, }, + { + /* 2x2 binned 30fps mode */ + .width = 1640, + .height = 1232, + .max_fps = { + .numerator = 10000, + .denominator = 300000, + }, + .vts_def = 0x06e3, + .reg_list = mode_1640_1232_regs, + }, + { + /* 640x480 30fps mode */ + .width = 640, + .height = 480, + .max_fps = { + .numerator = 10000, + .denominator = 300000, + }, + .hts_def = 0x0d78 - IMX219_EXP_LINES_MARGIN, + .vts_def = 0x0437, + .reg_list = mode_640_480_regs, + } }; static struct imx219 *to_imx219(const struct i2c_client *client) @@ -363,18 +526,18 @@ static int imx219_s_stream(struct v4l2_subdev *sd, int enable) return ret; /* Handle crop */ - ret = reg_write(client, 0x0164, priv->crop_rect.left >> 8); - ret |= reg_write(client, 0x0165, priv->crop_rect.left & 0xff); - ret |= reg_write(client, 0x0166, (priv->crop_rect.left + priv->crop_rect.width - 1) >> 8); - ret |= reg_write(client, 0x0167, (priv->crop_rect.left + priv->crop_rect.width - 1) & 0xff); - ret |= reg_write(client, 0x0168, priv->crop_rect.top >> 8); - ret |= reg_write(client, 0x0169, priv->crop_rect.top & 0xff); - ret |= reg_write(client, 0x016A, (priv->crop_rect.top + priv->crop_rect.height - 1) >> 8); - ret |= reg_write(client, 0x016B, (priv->crop_rect.top + priv->crop_rect.height - 1) & 0xff); - ret |= reg_write(client, 0x016C, priv->crop_rect.width >> 8); - ret |= reg_write(client, 0x016D, priv->crop_rect.width & 0xff); - ret |= reg_write(client, 0x016E, priv->crop_rect.height >> 8); - ret |= reg_write(client, 0x016F, priv->crop_rect.height & 0xff); + // ret = reg_write(client, 0x0164, priv->crop_rect.left >> 8); + // ret |= reg_write(client, 0x0165, priv->crop_rect.left & 0xff); + // ret |= reg_write(client, 0x0166, (priv->crop_rect.left + priv->crop_rect.width - 1) >> 8); + // ret |= reg_write(client, 0x0167, (priv->crop_rect.left + priv->crop_rect.width - 1) & 0xff); + // ret |= reg_write(client, 0x0168, priv->crop_rect.top >> 8); + // ret |= reg_write(client, 0x0169, priv->crop_rect.top & 0xff); + // ret |= reg_write(client, 0x016A, (priv->crop_rect.top + priv->crop_rect.height - 1) >> 8); + // ret |= reg_write(client, 0x016B, (priv->crop_rect.top + priv->crop_rect.height - 1) & 0xff); + // ret |= reg_write(client, 0x016C, priv->crop_rect.width >> 8); + // ret |= reg_write(client, 0x016D, priv->crop_rect.width & 0xff); + // ret |= reg_write(client, 0x016E, priv->crop_rect.height >> 8); + // ret |= reg_write(client, 0x016F, priv->crop_rect.height & 0xff); if (ret) return ret;