Re: [PATCH v1 2/5] media: i2c: imx492: driver's header

Kieran Bingham
2022-11-28T12:47:48Z

Quoting Petko Manolov (2022-11-25 15:31:17)
> The header. For the moment only two modes are supported.
>
> Signed-off-by: Petko Manolov <petko.manolov@konsulko.com>
> ---
> drivers/media/i2c/imx492.h | 555 +++++++++++++++++++++++++++++++++++++
> 1 file changed, 555 insertions(+)
> create mode 100644 drivers/media/i2c/imx492.h
>
> diff --git a/drivers/media/i2c/imx492.h b/drivers/media/i2c/imx492.h
> new file mode 100644
> index 000000000000..301fd66c77d5
> --- /dev/null
> +++ b/drivers/media/i2c/imx492.h
> @@ -0,0 +1,555 @@
> +#ifndef __imx492_h__
> +#define __imx492_h__
> +
> +struct imx492_reg {
> + u16 address;
> + u8 val;
> +};
> +
> +static const struct imx492_reg mode_17to9_regs[] = {

Why is this table in the header? Should it be available in multiple
locations?

I think it is likely better in the driver itself.

Even the struct imx492_reg could then be in the driver file, and there
wouldn't be a need for a header ?

--
Kieran

> + { 0x3033, 0x30 },
> + { 0x303c, 0x01 },
> + { 0x31e8, 0xa0 },
> + { 0x31f4, 0x01 },
> + { 0x31e9, 0x00 },
> + { 0x3122, 0x02 },
> + { 0x3129, 0x90 },
> + { 0x312a, 0x02 },
> + { 0x311f, 0x00 },
> + { 0x3123, 0x00 },
> + { 0x3124, 0x00 },
> + { 0x3125, 0x01 },
> + { 0x3127, 0x02 },
> + { 0x312d, 0x02 },
> + { 0x3000, 0x12 },
> + { 0x310b, 0x00 },
> + { 0x3004, 0x1c },
> + { 0x3005, 0x06 },
> + { 0x3006, 0x00 },
> + { 0x3007, 0xa7 },
> + { 0x3047, 0x02 },
> + { 0x304e, 0x0b },
> + { 0x304f, 0x2a },
> + { 0x3052, 0xee },
> + { 0x3062, 0x25 },
> + { 0x3064, 0x78 },
> + { 0x3065, 0x33 },
> + { 0x3066, 0x64 },
> + { 0x3067, 0x71 },
> + { 0x307e, 0x07 },
> + { 0x3081, 0x00 },
> + { 0x3088, 0x75 },
> + { 0x308a, 0x09 },
> + { 0x308c, 0x61 },
> + { 0x30ef, 0x01 },
> + { 0x3146, 0x00 },
> + { 0x31f5, 0x01 },
> + { 0x3234, 0x32 },
> + { 0x3248, 0xbc },
> + { 0x3250, 0xbc },
> + { 0x3258, 0xbc },
> + { 0x3260, 0xbc },
> + { 0x3274, 0x13 },
> + { 0x3276, 0x00 },
> + { 0x3277, 0x00 },
> + { 0x327c, 0x13 },
> + { 0x327e, 0x00 },
> + { 0x327f, 0x00 },
> + { 0x3284, 0x13 },
> + { 0x3286, 0x00 },
> + { 0x3287, 0x00 },
> + { 0x328c, 0x13 },
> + { 0x328e, 0x00 },
> + { 0x328f, 0x00 },
> + { 0x32ae, 0x00 },
> + { 0x32af, 0x00 },
> + { 0x32ca, 0x5a },
> + { 0x332c, 0x00 },
> + { 0x332f, 0x00 },
> + { 0x334a, 0x00 },
> + { 0x334c, 0x01 },
> + { 0x3352, 0x50 },
> + { 0x3356, 0x4f },
> + { 0x335a, 0x79 },
> + { 0x335e, 0x56 },
> + { 0x3360, 0x6a },
> + { 0x336a, 0x56 },
> + { 0x33d6, 0x79 },
> + { 0x340c, 0x6e },
> + { 0x3448, 0x7e },
> + { 0x348e, 0x6f },
> + { 0x3492, 0x11 },
> + { 0x34c4, 0x5a },
> + { 0x3506, 0x56 },
> + { 0x350c, 0x56 },
> + { 0x350e, 0x58 },
> + { 0x353d, 0x10 },
> + { 0x3549, 0x04 },
> + { 0x355d, 0x03 },
> + { 0x355e, 0x03 },
> + { 0x3574, 0x56 },
> + { 0x357f, 0x0c },
> + { 0x3580, 0x0a },
> + { 0x3581, 0x08 },
> + { 0x3583, 0x72 },
> + { 0x3587, 0x01 },
> + { 0x35b6, 0x00 },
> + { 0x35b8, 0x00 },
> + { 0x35d0, 0x5e },
> + { 0x35d4, 0x63 },
> + { 0x366a, 0x04 },
> + { 0x366b, 0x04 },
> + { 0x366c, 0x00 },
> + { 0x366d, 0x00 },
> + { 0x366e, 0x00 },
> + { 0x366f, 0x00 },
> + { 0x3670, 0x00 },
> + { 0x3671, 0x05 },
> + { 0x3676, 0x83 },
> + { 0x3677, 0x03 },
> + { 0x3678, 0x00 },
> + { 0x3679, 0x04 },
> + { 0x367a, 0x2c },
> + { 0x367b, 0x05 },
> + { 0x367d, 0x06 },
> + { 0x367e, 0xff },
> + { 0x367f, 0x06 },
> + { 0x3680, 0x4b },
> + { 0x3688, 0x05 },
> + { 0x3690, 0x27 },
> + { 0x3692, 0x65 },
> + { 0x3694, 0x4f },
> + { 0x3696, 0xa1 },
> + { 0x36bc, 0x00 },
> + { 0x371c, 0x02 },
> + { 0x372f, 0x3c },
> + { 0x3730, 0x01 },
> + { 0x3732, 0xb8 },
> + { 0x3734, 0x4a },
> + { 0x3736, 0x57 },
> + { 0x3738, 0x4d },
> + { 0x3744, 0x0f },
> + { 0x375b, 0x01 },
> + { 0x382b, 0x68 },
> + { 0x38b3, 0x00 },
> + { 0x3910, 0x90 },
> + { 0x3911, 0x70 },
> + { 0x3912, 0x92 },
> + { 0x3913, 0x24 },
> + { 0x3914, 0x93 },
> + { 0x3915, 0x0b },
> + { 0x3916, 0x01 },
> + { 0x3918, 0x04 },
> + { 0x391c, 0x90 },
> + { 0x391d, 0x05 },
> + { 0x3920, 0x96 },
> + { 0x3921, 0x06 },
> + { 0x3a2a, 0x01 },
> + { 0x3a7a, 0x01 },
> + { 0x3a7b, 0x01 },
> + { 0x3acb, 0x06 },
> + { 0x3c08, 0x3f },
> + { 0x3c0c, 0x1b },
> + { 0x3e80, 0x14 },
> + { 0x3e82, 0x30 },
> + { 0x3e84, 0x0c },
> + { 0x3e85, 0x06 },
> + { 0x3e86, 0xfc },
> + { 0x3e87, 0x10 },
> + { 0x3e88, 0x03 },
> + { 0x3e89, 0xfe },
> + { 0x3e8a, 0x01 },
> + { 0x3e8b, 0x06 },
> + { 0x3e8e, 0x03 },
> + { 0x3e8f, 0xfe },
> + { 0x3e90, 0x01 },
> + { 0x3e91, 0x06 },
> + { 0x3e94, 0x33 },
> + { 0x3e95, 0x01 },
> + { 0x3e96, 0x19 },
> + { 0x3e98, 0x30 },
> + { 0x3e9a, 0x11 },
> + { 0x3e9b, 0x06 },
> + { 0x3e9c, 0xfc },
> + { 0x3e9d, 0x10 },
> + { 0x3e9e, 0xfe },
> + { 0x3e9f, 0x03 },
> + { 0x3ea0, 0x06 },
> + { 0x3ea3, 0x01 },
> + { 0x3ea4, 0xfe },
> + { 0x3ea5, 0x03 },
> + { 0x3ea6, 0x06 },
> + { 0x3ea9, 0x33 },
> + { 0x3eaa, 0x00 },
> + { 0x3eab, 0x08 },
> + { 0x3eac, 0x08 },
> + { 0x3ead, 0x01 },
> + { 0x3eae, 0x08 },
> + { 0x3eaf, 0x08 },
> + { 0x3eb0, 0x00 },
> + { 0x3eb1, 0x10 },
> + { 0x3eb2, 0x10 },
> + { 0x3eb3, 0x01 },
> + { 0x3eb4, 0x10 },
> + { 0x3eb5, 0x10 },
> + { 0x3eb6, 0x00 },
> + { 0x3eb7, 0x00 },
> + { 0x3eb8, 0x00 },
> + { 0x3eb9, 0x00 },
> + { 0x3eba, 0x00 },
> + { 0x3ebb, 0x00 },
> + { 0x3ec0, 0x54 },
> + { 0x3ecc, 0x04 },
> + { 0x3ecd, 0x04 },
> + { 0x3ed0, 0xf0 },
> + { 0x3ed1, 0x20 },
> + { 0x3ed2, 0x0b },
> + { 0x3ed3, 0x04 },
> + { 0x3ed5, 0x13 },
> + { 0x3ed6, 0x00 },
> + { 0x3ed9, 0x0f },
> + { 0x3ee4, 0x02 },
> + { 0x3ee5, 0x02 },
> + { 0x3ee7, 0x00 },
> + { 0x3ef6, 0x00 },
> + { 0x3ef8, 0x10 },
> + { 0x3efa, 0x00 },
> + { 0x3efc, 0x10 },
> + { 0x3134, 0xa7 },
> + { 0x3135, 0x00 },
> + { 0x3136, 0x9f },
> + { 0x3137, 0x00 },
> + { 0x3138, 0x6f },
> + { 0x3139, 0x00 },
> + { 0x313a, 0x5f },
> + { 0x313b, 0x00 },
> + { 0x313c, 0x5f },
> + { 0x313d, 0x00 },
> + { 0x313e, 0x7f },
> + { 0x313f, 0x01 },
> + { 0x3140, 0x6f },
> + { 0x3141, 0x00 },
> + { 0x3142, 0x4f },
> + { 0x3143, 0x00 },
> + { 0x300e, 0x00 },
> + { 0x300f, 0x00 },
> + { 0x302c, 0x0c },
> + { 0x302d, 0x00 },
> + { 0x3034, 0x01 },
> + { 0x3035, 0x01 },
> + { 0x3036, 0x64 },
> + { 0x3037, 0x00 },
> + { 0x3038, 0xc8 },
> + { 0x3039, 0x00 },
> + { 0x3084, 0x4e },
> + { 0x3085, 0x04 },
> + { 0x3086, 0x4e },
> + { 0x3087, 0x04 },
> + { 0x30a9, 0xe0 },
> + { 0x30aa, 0x2e },
> + { 0x30ab, 0x00 },
> + { 0x30ac, 0x48 },
> + { 0x30ad, 0x0d },
> + { 0x30e2, 0x00 },
> + { 0x312f, 0x20 },
> + { 0x3130, 0x1c },
> + { 0x3131, 0x11 },
> + { 0x3132, 0xfc },
> + { 0x3133, 0x10 },
> + { 0x3a54, 0xf0 },
> + { 0x3a55, 0x20 },
> + { 0x3a43, 0x01 },
> + { 0x3a3b, 0x00 },
> + { 0x3042, 0x32 },
> + { 0x3092, 0x00 },
> + { 0x30dd, 0x00 },
> + { 0x30de, 0x00 },
> + { 0x30df, 0x00 },
> + { 0x30e0, 0x00 },
> + { 0x30e1, 0x00 },
> + { 0x332c, 0x00 },
> + { 0x332d, 0x00 },
> + { 0x334a, 0x00 },
> + { 0x334b, 0x00 },
> + { 0x35b6, 0x00 },
> + { 0x35b7, 0x00 },
> + { 0x35b8, 0x00 },
> + { 0x35b9, 0x00 },
> + { 0x36bc, 0x00 },
> + { 0x36bd, 0x00 },
> +};
> +
> +static const struct imx492_reg mode_all_regs[] = {
> + { 0x3033, 0x30 },
> + { 0x303c, 0x01 },
> + { 0x31e8, 0xa0 },
> + { 0x31f4, 0x01 },
> + { 0x31e9, 0x00 },
> + { 0x3122, 0x02 },
> + { 0x3129, 0x90 },
> + { 0x312a, 0x02 },
> + { 0x311f, 0x00 },
> + { 0x3123, 0x00 },
> + { 0x3124, 0x00 },
> + { 0x3125, 0x01 },
> + { 0x3127, 0x02 },
> + { 0x312d, 0x02 },
> + { 0x3000, 0x12 },
> + { 0x310b, 0x00 },
> + { 0x3004, 0x1c },
> + { 0x3005, 0x06 },
> + { 0x3006, 0x00 },
> + { 0x3007, 0xa7 },
> + { 0x3047, 0x02 },
> + { 0x304e, 0x0b },
> + { 0x304f, 0x2a },
> + { 0x3052, 0xee },
> + { 0x3062, 0x25 },
> + { 0x3064, 0x78 },
> + { 0x3065, 0x33 },
> + { 0x3066, 0x64 },
> + { 0x3067, 0x71 },
> + { 0x307e, 0x07 },
> + { 0x3081, 0x00 },
> + { 0x3088, 0x75 },
> + { 0x308a, 0x09 },
> + { 0x308c, 0x61 },
> + { 0x30ef, 0x01 },
> + { 0x3146, 0x00 },
> + { 0x31f5, 0x01 },
> + { 0x3234, 0x32 },
> + { 0x3248, 0xbc },
> + { 0x3250, 0xbc },
> + { 0x3258, 0xbc },
> + { 0x3260, 0xbc },
> + { 0x3274, 0x13 },
> + { 0x3276, 0x00 },
> + { 0x3277, 0x00 },
> + { 0x327c, 0x13 },
> + { 0x327e, 0x00 },
> + { 0x327f, 0x00 },
> + { 0x3284, 0x13 },
> + { 0x3286, 0x00 },
> + { 0x3287, 0x00 },
> + { 0x328c, 0x13 },
> + { 0x328e, 0x00 },
> + { 0x328f, 0x00 },
> + { 0x32ae, 0x00 },
> + { 0x32af, 0x00 },
> + { 0x32ca, 0x5a },
> + { 0x332c, 0x00 },
> + { 0x332f, 0x00 },
> + { 0x334a, 0x00 },
> + { 0x334c, 0x01 },
> + { 0x3352, 0x50 },
> + { 0x3356, 0x4f },
> + { 0x335a, 0x79 },
> + { 0x335e, 0x56 },
> + { 0x3360, 0x6a },
> + { 0x336a, 0x56 },
> + { 0x33d6, 0x79 },
> + { 0x340c, 0x6e },
> + { 0x3448, 0x7e },
> + { 0x348e, 0x6f },
> + { 0x3492, 0x11 },
> + { 0x34c4, 0x5a },
> + { 0x3506, 0x56 },
> + { 0x350c, 0x56 },
> + { 0x350e, 0x58 },
> + { 0x353d, 0x10 },
> + { 0x3549, 0x04 },
> + { 0x355d, 0x03 },
> + { 0x355e, 0x03 },
> + { 0x3574, 0x56 },
> + { 0x357f, 0x0c },
> + { 0x3580, 0x0a },
> + { 0x3581, 0x08 },
> + { 0x3583, 0x72 },
> + { 0x3587, 0x01 },
> + { 0x35b6, 0x00 },
> + { 0x35b8, 0x00 },
> + { 0x35d0, 0x5e },
> + { 0x35d4, 0x63 },
> + { 0x366a, 0x04 },
> + { 0x366b, 0x04 },
> + { 0x366c, 0x00 },
> + { 0x366d, 0x00 },
> + { 0x366e, 0x00 },
> + { 0x366f, 0x00 },
> + { 0x3670, 0x00 },
> + { 0x3671, 0x05 },
> + { 0x3676, 0x83 },
> + { 0x3677, 0x03 },
> + { 0x3678, 0x00 },
> + { 0x3679, 0x04 },
> + { 0x367a, 0x2c },
> + { 0x367b, 0x05 },
> + { 0x367d, 0x06 },
> + { 0x367e, 0xff },
> + { 0x367f, 0x06 },
> + { 0x3680, 0x4b },
> + { 0x3688, 0x05 },
> + { 0x3690, 0x27 },
> + { 0x3692, 0x65 },
> + { 0x3694, 0x4f },
> + { 0x3696, 0xa1 },
> + { 0x36bc, 0x00 },
> + { 0x371c, 0x02 },
> + { 0x372f, 0x3c },
> + { 0x3730, 0x01 },
> + { 0x3732, 0xb8 },
> + { 0x3734, 0x4a },
> + { 0x3736, 0x57 },
> + { 0x3738, 0x4d },
> + { 0x3744, 0x0f },
> + { 0x375b, 0x01 },
> + { 0x382b, 0x68 },
> + { 0x38b3, 0x00 },
> + { 0x3910, 0x90 },
> + { 0x3911, 0x70 },
> + { 0x3912, 0x92 },
> + { 0x3913, 0x24 },
> + { 0x3914, 0x93 },
> + { 0x3915, 0x0b },
> + { 0x3916, 0x01 },
> + { 0x3918, 0x04 },
> + { 0x391c, 0x90 },
> + { 0x391d, 0x05 },
> + { 0x3920, 0x96 },
> + { 0x3921, 0x06 },
> + { 0x3a2a, 0x01 },
> + { 0x3a7a, 0x01 },
> + { 0x3a7b, 0x01 },
> + { 0x3acb, 0x06 },
> + { 0x3c08, 0x3f },
> + { 0x3c0c, 0x1b },
> + { 0x3e80, 0x14 },
> + { 0x3e82, 0x30 },
> + { 0x3e84, 0x0c },
> + { 0x3e85, 0x06 },
> + { 0x3e86, 0xfc },
> + { 0x3e87, 0x10 },
> + { 0x3e88, 0x03 },
> + { 0x3e89, 0xfe },
> + { 0x3e8a, 0x01 },
> + { 0x3e8b, 0x06 },
> + { 0x3e8e, 0x03 },
> + { 0x3e8f, 0xfe },
> + { 0x3e90, 0x01 },
> + { 0x3e91, 0x06 },
> + { 0x3e94, 0x33 },
> + { 0x3e95, 0x01 },
> + { 0x3e96, 0x19 },
> + { 0x3e98, 0x30 },
> + { 0x3e9a, 0x11 },
> + { 0x3e9b, 0x06 },
> + { 0x3e9c, 0xfc },
> + { 0x3e9d, 0x10 },
> + { 0x3e9e, 0xfe },
> + { 0x3e9f, 0x03 },
> + { 0x3ea0, 0x06 },
> + { 0x3ea3, 0x01 },
> + { 0x3ea4, 0xfe },
> + { 0x3ea5, 0x03 },
> + { 0x3ea6, 0x06 },
> + { 0x3ea9, 0x33 },
> + { 0x3eaa, 0x00 },
> + { 0x3eab, 0x08 },
> + { 0x3eac, 0x08 },
> + { 0x3ead, 0x01 },
> + { 0x3eae, 0x08 },
> + { 0x3eaf, 0x08 },
> + { 0x3eb0, 0x00 },
> + { 0x3eb1, 0x10 },
> + { 0x3eb2, 0x10 },
> + { 0x3eb3, 0x01 },
> + { 0x3eb4, 0x10 },
> + { 0x3eb5, 0x10 },
> + { 0x3eb6, 0x00 },
> + { 0x3eb7, 0x00 },
> + { 0x3eb8, 0x00 },
> + { 0x3eb9, 0x00 },
> + { 0x3eba, 0x00 },
> + { 0x3ebb, 0x00 },
> + { 0x3ec0, 0x54 },
> + { 0x3ecc, 0x04 },
> + { 0x3ecd, 0x04 },
> + { 0x3ed0, 0xf0 },
> + { 0x3ed1, 0x20 },
> + { 0x3ed2, 0x0b },
> + { 0x3ed3, 0x04 },
> + { 0x3ed5, 0x13 },
> + { 0x3ed6, 0x00 },
> + { 0x3ed9, 0x0f },
> + { 0x3ee4, 0x02 },
> + { 0x3ee5, 0x02 },
> + { 0x3ee7, 0x00 },
> + { 0x3ef6, 0x00 },
> + { 0x3ef8, 0x10 },
> + { 0x3efa, 0x00 },
> + { 0x3efc, 0x10 },
> + { 0x3134, 0xa7 },
> + { 0x3135, 0x00 },
> + { 0x3136, 0x9f },
> + { 0x3137, 0x00 },
> + { 0x3138, 0x6f },
> + { 0x3139, 0x00 },
> + { 0x313a, 0x5f },
> + { 0x313b, 0x00 },
> + { 0x313c, 0x5f },
> + { 0x313d, 0x00 },
> + { 0x313e, 0x7f },
> + { 0x313f, 0x01 },
> + { 0x3140, 0x6f },
> + { 0x3141, 0x00 },
> + { 0x3142, 0x4f },
> + { 0x3143, 0x00 },
> + { 0x300e, 0x00 },
> + { 0x300f, 0x00 },
> + { 0x302c, 0x0c },
> + { 0x302d, 0x00 },
> + { 0x3034, 0x01 },
> + { 0x3035, 0x01 },
> + { 0x3036, 0x64 },
> + { 0x3037, 0x00 },
> + { 0x3038, 0xc8 },
> + { 0x3039, 0x00 },
> + { 0x3084, 0x4e },
> + { 0x3085, 0x04 },
> + { 0x3086, 0x4e },
> + { 0x3087, 0x04 },
> + { 0x30a9, 0xe0 },
> + { 0x30aa, 0x2e },
> + { 0x30ab, 0x00 },
> + { 0x30ac, 0x48 },
> + { 0x30ad, 0x0d },
> + { 0x30e2, 0x00 },
> + { 0x312f, 0x20 },
> + { 0x3130, 0x1c },
> + { 0x3131, 0x11 },
> + { 0x3132, 0xfc },
> + { 0x3133, 0x10 },
> + { 0x3a54, 0xf0 },
> + { 0x3a55, 0x20 },
> + { 0x3a43, 0x01 },
> + { 0x3a3b, 0x00 },
> + { 0x3042, 0x32 },
> + { 0x3092, 0x00 },
> + { 0x30dd, 0x00 },
> + { 0x30de, 0x00 },
> + { 0x30df, 0x00 },
> + { 0x30e0, 0x00 },
> + { 0x30e1, 0x00 },
> + { 0x332c, 0x00 },
> + { 0x332d, 0x00 },
> + { 0x334a, 0x00 },
> + { 0x334b, 0x00 },
> + { 0x35b6, 0x00 },
> + { 0x35b7, 0x00 },
> + { 0x35b8, 0x00 },
> + { 0x35b9, 0x00 },
> + { 0x36bc, 0x00 },
> + { 0x36bd, 0x00 },
> +};
> +
> +#endif /* __imx492_h__ */
> --
> 2.30.2
>