From 1f00b84d993e1f8de17ef936e00f4264266cb5d1 Mon Sep 17 00:00:00 2001 From: Lad Prabhakar Date: Tue, 10 Mar 2020 14:17:08 +0100 Subject: [PATCH] media: i2c: imx219: Add support for RAW8 bit bayer format Commit 22da1d56e982151e0bdfafe9de6fe94098a51356 upstream. IMX219 sensor is capable for RAW8/RAW10 modes. This commit adds support for RAW8 bayer format. Signed-off-by: Lad Prabhakar Signed-off-by: Dave Stevenson Signed-off-by: Sakari Ailus Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/imx219.c | 148 +++++++++++++++++++++++++++++-------- 1 file changed, 116 insertions(+), 32 deletions(-) --- a/drivers/media/i2c/imx219.c +++ b/drivers/media/i2c/imx219.c @@ -168,15 +168,12 @@ static const struct imx219_reg mode_3280 {0x0171, 0x01}, {0x0174, 0x00}, {0x0175, 0x00}, - {0x018c, 0x0a}, - {0x018d, 0x0a}, {0x0301, 0x05}, {0x0303, 0x01}, {0x0304, 0x03}, {0x0305, 0x03}, {0x0306, 0x00}, {0x0307, 0x39}, - {0x0309, 0x0a}, {0x030b, 0x01}, {0x030c, 0x00}, {0x030d, 0x72}, @@ -230,15 +227,12 @@ static const struct imx219_reg mode_1920 {0x0171, 0x01}, {0x0174, 0x00}, {0x0175, 0x00}, - {0x018c, 0x0a}, - {0x018d, 0x0a}, {0x0301, 0x05}, {0x0303, 0x01}, {0x0304, 0x03}, {0x0305, 0x03}, {0x0306, 0x00}, {0x0307, 0x39}, - {0x0309, 0x0a}, {0x030b, 0x01}, {0x030c, 0x00}, {0x030d, 0x72}, @@ -290,15 +284,12 @@ static const struct imx219_reg mode_1640 {0x0171, 0x01}, {0x0174, 0x01}, {0x0175, 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}, @@ -322,6 +313,18 @@ static const struct imx219_reg mode_1640 {0x0163, 0x78}, }; +static const struct imx219_reg raw8_framefmt_regs[] = { + {0x018c, 0x08}, + {0x018d, 0x08}, + {0x0309, 0x08}, +}; + +static const struct imx219_reg raw10_framefmt_regs[] = { + {0x018c, 0x0a}, + {0x018d, 0x0a}, + {0x0309, 0x0a}, +}; + static const char * const imx219_test_pattern_menu[] = { "Disabled", "Color Bars", @@ -349,6 +352,27 @@ static const char * const imx219_supply_ #define IMX219_NUM_SUPPLIES ARRAY_SIZE(imx219_supply_name) /* + * The supported formats. + * This table MUST contain 4 entries per format, to cover the various flip + * combinations in the order + * - no flip + * - h flip + * - v flip + * - h&v flips + */ +static const u32 codes[] = { + MEDIA_BUS_FMT_SRGGB10_1X10, + MEDIA_BUS_FMT_SGRBG10_1X10, + MEDIA_BUS_FMT_SGBRG10_1X10, + MEDIA_BUS_FMT_SBGGR10_1X10, + + MEDIA_BUS_FMT_SRGGB8_1X8, + MEDIA_BUS_FMT_SGRBG8_1X8, + MEDIA_BUS_FMT_SGBRG8_1X8, + MEDIA_BUS_FMT_SBGGR8_1X8, +}; + +/* * Initialisation delay between XCLR low->high and the moment when the sensor * can start capture (i.e. can leave software stanby) must be not less than: * t4 + max(t5, t6 +