From 51fc780bc99a0cfe74fcfc42744d8265fcafedcb Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 16 Oct 2022 09:15:08 +0300 Subject: [PATCH] media: i2c: imx290: Drop imx290_write_buffered_reg() Upstream commit b817888a0c50. The imx290_write_buffered_reg() function wraps a register write with register hold, to enable changing multiple registers synchronously. It is used for the gain only, which is an 8-bit register, defeating its purpose. The feature is useful, but should be implemented differently. Drop the function for now, to prepare for a rework of register access. Signed-off-by: Laurent Pinchart Acked-by: Alexander Stein Signed-off-by: Sakari Ailus --- drivers/media/i2c/imx290.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) --- a/drivers/media/i2c/imx290.c +++ b/drivers/media/i2c/imx290.c @@ -413,41 +413,11 @@ static int imx290_set_register_array(str return 0; } -static int imx290_write_buffered_reg(struct imx290 *imx290, u16 address_low, - u8 nr_regs, u32 value) -{ - unsigned int i; - int ret; - - ret = imx290_write_reg(imx290, IMX290_REGHOLD, 0x01); - if (ret) { - dev_err(imx290->dev, "Error setting hold register\n"); - return ret; - } - - for (i = 0; i < nr_regs; i++) { - ret = imx290_write_reg(imx290, address_low + i, - (u8)(value >> (i * 8))); - if (ret) { - dev_err(imx290->dev, "Error writing buffered registers\n"); - return ret; - } - } - - ret = imx290_write_reg(imx290, IMX290_REGHOLD, 0x00); - if (ret) { - dev_err(imx290->dev, "Error setting hold register\n"); - return ret; - } - - return ret; -} - static int imx290_set_gain(struct imx290 *imx290, u32 value) { int ret; - ret = imx290_write_buffered_reg(imx290, IMX290_GAIN, 1, value); + ret = imx290_write_reg(imx290, IMX290_GAIN, value); if (ret) dev_err(imx290->dev, "Unable to write gain\n");