mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-14 01:49:20 -04:00
media: i2c: imx219: Only use higher LLP_MIN for binned resolutions
The LLP_MIN of 3560 is only needed to fix artefacts seen with binned resolutions. As increasing the LLP reduces the highest possible framerate by ~3%, use the old default minimum of 3448 if we are not doing 2x2 analog binning. Also restore the fll_def value for non-binned modes in the modes definition to restore the default mode framerate to 30fps. Suggested-by: Dave Stevenson <dave.stevenson@raspberrypi.com> Link: https://lore.kernel.org/linux-media/CAPY8ntC1-S6zKtDvmc6EgyxP+j6rTShuG8Dr8PKb9XQr2PeS_w@mail.gmail.com/ Signed-off-by: Jai Luthra <jai.luthra@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com> Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
This commit is contained in:
@@ -74,7 +74,8 @@
|
||||
#define IMX219_FLL_MAX 0xffff
|
||||
#define IMX219_VBLANK_MIN 32
|
||||
#define IMX219_REG_LINE_LENGTH_A CCI_REG16(0x0162)
|
||||
#define IMX219_LLP_MIN 0x0de8
|
||||
#define IMX219_LLP_MIN 0x0d78
|
||||
#define IMX219_BINNED_LLP_MIN 0x0de8
|
||||
#define IMX219_LLP_MAX 0x7ff0
|
||||
|
||||
#define IMX219_REG_X_ADD_STA_A CCI_REG16(0x0164)
|
||||
@@ -311,13 +312,13 @@ static const struct imx219_mode supported_modes[] = {
|
||||
/* 8MPix 15fps mode */
|
||||
.width = 3280,
|
||||
.height = 2464,
|
||||
.fll_def = 3415,
|
||||
.fll_def = 3526,
|
||||
},
|
||||
{
|
||||
/* 1080P 30fps cropped */
|
||||
.width = 1920,
|
||||
.height = 1080,
|
||||
.fll_def = 1707,
|
||||
.fll_def = 1763,
|
||||
},
|
||||
{
|
||||
/* 2x2 binned 60fps mode */
|
||||
@@ -865,7 +866,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
|
||||
const struct imx219_mode *mode;
|
||||
struct v4l2_mbus_framefmt *format;
|
||||
struct v4l2_rect *crop;
|
||||
unsigned int bin_h, bin_v;
|
||||
u8 bin_h, bin_v;
|
||||
u32 prev_line_len;
|
||||
|
||||
format = v4l2_subdev_state_get_format(state, 0);
|
||||
@@ -895,7 +896,7 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
|
||||
if (fmt->which == V4L2_SUBDEV_FORMAT_ACTIVE) {
|
||||
int exposure_max;
|
||||
int exposure_def;
|
||||
int hblank;
|
||||
int hblank, llp_min;
|
||||
int pixel_rate;
|
||||
|
||||
/* Update limits and set FPS to default */
|
||||
@@ -912,6 +913,19 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
|
||||
imx219->exposure->minimum,
|
||||
exposure_max, imx219->exposure->step,
|
||||
exposure_def);
|
||||
|
||||
/*
|
||||
* With analog binning the default minimum line length of 3448
|
||||
* can cause artefacts with RAW10 formats, because the ADC
|
||||
* operates on two lines together. So we switch to a higher
|
||||
* minimum of 3560.
|
||||
*/
|
||||
imx219_get_binning(state, &bin_h, &bin_v);
|
||||
llp_min = (bin_h & bin_v) == IMX219_BINNING_X2_ANALOG ?
|
||||
IMX219_BINNED_LLP_MIN : IMX219_LLP_MIN;
|
||||
__v4l2_ctrl_modify_range(imx219->hblank, llp_min - mode->width,
|
||||
IMX219_LLP_MAX - mode->width, 1,
|
||||
llp_min - mode->width);
|
||||
/*
|
||||
* Retain PPL setting from previous mode so that the
|
||||
* line time does not change on a mode change.
|
||||
@@ -920,10 +934,6 @@ static int imx219_set_pad_format(struct v4l2_subdev *sd,
|
||||
* mode width subtracted.
|
||||
*/
|
||||
hblank = prev_line_len - mode->width;
|
||||
__v4l2_ctrl_modify_range(imx219->hblank,
|
||||
IMX219_LLP_MIN - mode->width,
|
||||
IMX219_LLP_MAX - mode->width, 1,
|
||||
IMX219_LLP_MIN - mode->width);
|
||||
__v4l2_ctrl_s_ctrl(imx219->hblank, hblank);
|
||||
|
||||
/* Scale the pixel rate based on the mode specific factor */
|
||||
|
||||
Reference in New Issue
Block a user