Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: i2c: imx219: Simplify imx219_get_binning() function

In imx219_set_pad_format() there is now a constraint to enforce hbin ==
vbin. So, simplify the logic in imx219_get_binning() function by
removing dead code that handles the case where hbin != vbin.

Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Tested-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Jai Luthra and committed by
Hans Verkuil
3dc9770b 9ef6e4db

+3 -13
+3 -13
drivers/media/i2c/imx219.c
··· 409 409 u32 hbin = crop->width / format->width; 410 410 u32 vbin = crop->height / format->height; 411 411 412 - *bin_h = IMX219_BINNING_NONE; 413 - *bin_v = IMX219_BINNING_NONE; 414 - 415 - /* 416 - * Use analog binning only if both dimensions are binned, as it crops 417 - * the other dimension. 418 - */ 419 412 if (hbin == 2 && vbin == 2) { 420 413 *bin_h = IMX219_BINNING_X2_ANALOG; 421 414 *bin_v = IMX219_BINNING_X2_ANALOG; 422 - 423 - return; 415 + } else { 416 + *bin_h = IMX219_BINNING_NONE; 417 + *bin_v = IMX219_BINNING_NONE; 424 418 } 425 419 426 - if (hbin == 2) 427 - *bin_h = IMX219_BINNING_X2; 428 - if (vbin == 2) 429 - *bin_v = IMX219_BINNING_X2; 430 420 } 431 421 432 422 static inline u32 imx219_get_rate_factor(struct v4l2_subdev_state *state)