Add CCI_REG_WIDTH() macro to obtain register width in bits and similarly, CCI_REG_WIDTH_BYTES() to obtain it in bytes. Signed-off-by: Sakari Ailus <sakari.ailus@xxxxxxxxxxxxxxx> --- include/media/v4l2-cci.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/media/v4l2-cci.h b/include/media/v4l2-cci.h index b4ce0a46092c..80eaa7fdc606 100644 --- a/include/media/v4l2-cci.h +++ b/include/media/v4l2-cci.h @@ -40,6 +40,9 @@ struct cci_reg_sequence { #define CCI_REG_FLAG_PRIVATE_END 31U #define CCI_REG_PRIVATE_MASK GENMASK(CCI_REG_FLAG_PRIVATE_END, CCI_REG_FLAG_PRIVATE_START) +#define CCI_REG_WIDTH_BYTES(x) (((x) & CCI_REG_WIDTH_MASK) >> CCI_REG_WIDTH_SHIFT) +#define CCI_REG_WIDTH(x) (CCI_REG_WIDTH_BYTES(x) << 3) + #define CCI_REG8(x) ((1 << CCI_REG_WIDTH_SHIFT) | (x)) #define CCI_REG16(x) ((2 << CCI_REG_WIDTH_SHIFT) | (x)) #define CCI_REG24(x) ((3 << CCI_REG_WIDTH_SHIFT) | (x)) -- 2.39.2