Re: [PATCH v2 09/13] media: i2c: imx214: Extract format and crop settings

2024-12-01 Thread André Apitzsch
Hi,

I'll drop this patch for now. The changes included are not needed to
make imx214 work with libcamera. And with [1] the patch might need a
rework anyway.

Best regards,
André

[1]
https://lore.kernel.org/linux-media/20241129095142.87196-1-sakari.ai...@linux.intel.com/

Am Montag, dem 21.10.2024 um 00:13 +0200 schrieb André Apitzsch via B4
Relay:
> From: André Apitzsch 
> 
> Remove format and crop settings from register sequences and set them
> programmatically.
> 
> Signed-off-by: André Apitzsch 
> ---
>  drivers/media/i2c/imx214.c | 129 ++-
> --
>  1 file changed, 97 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
> index
> cb443d8bee6fe72dc9378b2c2d3caae09f8642c5..87a03e292e19ccd71f1b2dcee34
> 09826b2f5cb6f 100644
> --- a/drivers/media/i2c/imx214.c
> +++ b/drivers/media/i2c/imx214.c
> @@ -96,6 +96,9 @@
>  #define IMX214_REG_PREPLLCK_VT_DIV   CCI_REG8(0x0305)
>  #define IMX214_REG_PLL_VT_MPYCCI_REG16(0x0306)
>  #define IMX214_REG_OPPXCK_DIVCCI_REG8(0x0309)
> +#define IMX214_OPPXCK_DIV_COMP6  6
> +#define IMX214_OPPXCK_DIV_COMP8  8
> +#define IMX214_OPPXCK_DIV_RAW10  10
>  #define IMX214_REG_OPSYCK_DIVCCI_REG8(0x030b)
>  #define IMX214_REG_PLL_MULT_DRIV CCI_REG8(0x0310)
>  #define IMX214_PLL_SINGLE0
> @@ -132,6 +135,9 @@
>  #define IMX214_BINNING_NONE  0
>  #define IMX214_BINNING_ENABLE1
>  #define IMX214_REG_BINNING_TYPE  CCI_REG8(0x0901)
> +#define IMX214_BINNING_1X1   0
> +#define IMX214_BINNING_2X2   0x22
> +#define IMX214_BINNING_4X4   0x44
>  #define IMX214_REG_BINNING_WEIGHTING CCI_REG8(0x0902)
>  #define IMX214_BINNING_AVERAGE   0x00
>  #define IMX214_BINNING_SUMMED0x01
> @@ -211,36 +217,22 @@ static const struct cci_reg_sequence
> mode_4096x2304[] = {
>   { IMX214_REG_HDR_MODE, IMX214_HDR_MODE_OFF },
>   { IMX214_REG_HDR_RES_REDUCTION, IMX214_HDR_RES_REDU_THROUGH
> },
>   { IMX214_REG_EXPOSURE_RATIO, 1 },
> - { IMX214_REG_X_ADD_STA, 56 },
> - { IMX214_REG_Y_ADD_STA, 408 },
> - { IMX214_REG_X_ADD_END, 4151 },
> - { IMX214_REG_Y_ADD_END, 2711 },
>   { IMX214_REG_X_EVEN_INC, 1 },
>   { IMX214_REG_X_ODD_INC, 1 },
>   { IMX214_REG_Y_EVEN_INC, 1 },
>   { IMX214_REG_Y_ODD_INC, 1 },
> - { IMX214_REG_BINNING_MODE, IMX214_BINNING_NONE },
> - { IMX214_REG_BINNING_TYPE, 0 },
>   { IMX214_REG_BINNING_WEIGHTING, IMX214_BINNING_AVERAGE },
>   { CCI_REG8(0x3000), 0x35 },
>   { CCI_REG8(0x3054), 0x01 },
>   { CCI_REG8(0x305C), 0x11 },
>  
> - { IMX214_REG_CSI_DATA_FORMAT, IMX214_CSI_DATA_FORMAT_RAW10
> },
> - { IMX214_REG_X_OUTPUT_SIZE, 4096 },
> - { IMX214_REG_Y_OUTPUT_SIZE, 2304 },
>   { IMX214_REG_SCALE_MODE, IMX214_SCALE_NONE },
>   { IMX214_REG_SCALE_M, 2 },
> - { IMX214_REG_DIG_CROP_X_OFFSET, 0 },
> - { IMX214_REG_DIG_CROP_Y_OFFSET, 0 },
> - { IMX214_REG_DIG_CROP_WIDTH, 4096 },
> - { IMX214_REG_DIG_CROP_HEIGHT, 2304 },
>  
>   { IMX214_REG_VTPXCK_DIV, 5 },
>   { IMX214_REG_VTSYCK_DIV, 2 },
>   { IMX214_REG_PREPLLCK_VT_DIV, 3 },
>   { IMX214_REG_PLL_VT_MPY, 150 },
> - { IMX214_REG_OPPXCK_DIV, 10 },
>   { IMX214_REG_OPSYCK_DIV, 1 },
>   { IMX214_REG_PLL_MULT_DRIV, IMX214_PLL_SINGLE },
>  
> @@ -281,36 +273,22 @@ static const struct cci_reg_sequence
> mode_1920x1080[] = {
>   { IMX214_REG_HDR_MODE, IMX214_HDR_MODE_OFF },
>   { IMX214_REG_HDR_RES_REDUCTION, IMX214_HDR_RES_REDU_THROUGH
> },
>   { IMX214_REG_EXPOSURE_RATIO, 1 },
> - { IMX214_REG_X_ADD_STA, 1144 },
> - { IMX214_REG_Y_ADD_STA, 1020 },
> - { IMX214_REG_X_ADD_END, 3063 },
> - { IMX214_REG_Y_ADD_END, 2099 },
>   { IMX214_REG_X_EVEN_INC, 1 },
>   { IMX214_REG_X_ODD_INC, 1 },
>   { IMX214_REG_Y_EVEN_INC, 1 },
>   { IMX214_REG_Y_ODD_INC, 1 },
> - { IMX214_REG_BINNING_MODE, IMX214_BINNING_NONE },
> - { IMX214_REG_BINNING_TYPE, 0 },
>   { IMX214_REG_BINNING_WEIGHTING, IMX214_BINNING_AVERAGE },
>   { CCI_REG8(0x3000), 0x35 },
>   { CCI_REG8(0x3054), 0x01 },
>   { CCI_REG8(0x305C), 0x11 },
>  
> - { IMX214_REG_CSI_DATA_FORMAT, IMX214_CSI_DATA_FORMAT_RAW10
> },
> - { IMX214_REG_X_OUTPUT_SIZE, 1920 },
> - { IMX214_REG_Y_OUTPUT_SIZE, 1080 },
>   { IMX214_REG_SCALE_MODE, IMX214_SCALE_NONE },
>   { IMX214_REG_SCALE_M, 2 },
> - { IMX214_REG_DIG_CROP_X_OFFSET, 0 },
> - { IMX214_REG_DIG_CROP_Y_OFFSET, 0 },
> - { IMX214_REG_DIG_CROP_WIDTH, 1920 },
> - { IMX214_REG_DIG_CROP_HEIGHT, 1080 },
>  
>   { IMX214_REG_VTPXCK_DIV, 5 },
>   { IMX214_REG_VTSYCK_DIV, 2 },
>   { IMX214_REG_PREPLLCK_VT_DIV, 3 },
>   { IMX214_REG_PLL_VT_MPY, 150 },
> - { IMX214_REG_OPPXCK_DIV, 10 },
>   { IMX214_REG_OPSYCK_DIV, 1 },
>   { IMX214_REG_PLL_MULT

Re: [PATCH v2 09/13] media: i2c: imx214: Extract format and crop settings

2024-11-22 Thread Sakari Ailus
Hi Ricardo,

On Wed, Nov 20, 2024 at 10:22:54PM +0100, Ricardo Ribalda Delgado wrote:
> Hi André
> 
> On Wed, Nov 20, 2024 at 9:07 PM André Apitzsch  wrote:
> >
> > Hi Ricardo,
> >
> > Am Mittwoch, dem 30.10.2024 um 13:10 +0100 schrieb Ricardo Ribalda
> > Delgado:
> > > Hi
> > >
> > > Aren't you changing the binning mode for 1920x1080  with this patch?
> > > I think that could be considered an ABI change.
> >
> > Is the problem that the ABI changes or that it is not mentioned in the
> > commit message?
> 
> I think it is a combination of both. There will be products out there
> that after applying this change will get different frames using the
> same configuration.
> 
> @Sakari Ailus  What do we usually do in these cases?

Good question. Always when something is changed in the UAPI there's a
chance for breakages and these are a big no-no, at least in principle.
Keeping the old behaviour in place is how you generally can avoid breakages
but this has its issues, too.

We're in the process to make changes to the sensor APIs in general,
while old drivers would need to maintain current functionality. See
<20241122100633.8971-1-sakari.ai...@linux.intel.com> on LMML.

Ricardo: I'll cc you to the next version.

> 
> > >
> > > Also, if we are not letting the user change the value, I do not see
> > > much value in setting the cropping programmatically, I'd rather not
> > > take this change.
> >
> > I assume the first "value" refers to "binning value", that cannot be
> > changed by the user. Is it right, that .set_selection needs to be
> > implemented to change that?
> 
> I believe set_selection is the correct way, yes. Sakari again to keep
> me honest :)

Please see the RFC set.

-- 
Kind regards,

Sakari Ailus



Re: [PATCH v2 09/13] media: i2c: imx214: Extract format and crop settings

2024-11-20 Thread André Apitzsch
Hi Ricardo,

Am Mittwoch, dem 30.10.2024 um 13:10 +0100 schrieb Ricardo Ribalda
Delgado:
> Hi
> 
> Aren't you changing the binning mode for 1920x1080  with this patch?
> I think that could be considered an ABI change.

Is the problem that the ABI changes or that it is not mentioned in the
commit message?
> 
> Also, if we are not letting the user change the value, I do not see
> much value in setting the cropping programmatically, I'd rather not
> take this change.

I assume the first "value" refers to "binning value", that cannot be
changed by the user. Is it right, that .set_selection needs to be
implemented to change that?

The different values are set programmatically to reduce the number of
entries in the cci reg sequences to make it easier to add more modes
later.

Regards,
André

> 
> On Mon, Oct 21, 2024 at 12:14 AM André Apitzsch via B4 Relay
>  wrote:
> > 
> > From: André Apitzsch 
> > 
> > Remove format and crop settings from register sequences and set
> > them
> > programmatically.
> > 
> > Signed-off-by: André Apitzsch 
> > ---
> >  drivers/media/i2c/imx214.c | 129
> > ++---
> >  1 file changed, 97 insertions(+), 32 deletions(-)
> > 
> > diff --git a/drivers/media/i2c/imx214.c
> > b/drivers/media/i2c/imx214.c
> > index
> > cb443d8bee6fe72dc9378b2c2d3caae09f8642c5..87a03e292e19ccd71f1b2dcee
> > 3409826b2f5cb6f 100644
> > --- a/drivers/media/i2c/imx214.c
> > +++ b/drivers/media/i2c/imx214.c
> > @@ -96,6 +96,9 @@
> >  #define IMX214_REG_PREPLLCK_VT_DIV CCI_REG8(0x0305)
> >  #define IMX214_REG_PLL_VT_MPY  CCI_REG16(0x0306)
> >  #define IMX214_REG_OPPXCK_DIV  CCI_REG8(0x0309)
> > +#define IMX214_OPPXCK_DIV_COMP6    6
> > +#define IMX214_OPPXCK_DIV_COMP8    8
> > +#define IMX214_OPPXCK_DIV_RAW10    10
> >  #define IMX214_REG_OPSYCK_DIV  CCI_REG8(0x030b)
> >  #define IMX214_REG_PLL_MULT_DRIV   CCI_REG8(0x0310)
> >  #define IMX214_PLL_SINGLE  0
> > @@ -132,6 +135,9 @@
> >  #define IMX214_BINNING_NONE    0
> >  #define IMX214_BINNING_ENABLE  1
> >  #define IMX214_REG_BINNING_TYPE    CCI_REG8(0x0901)
> > +#define IMX214_BINNING_1X1 0
> > +#define IMX214_BINNING_2X2 0x22
> > +#define IMX214_BINNING_4X4 0x44
> >  #define IMX214_REG_BINNING_WEIGHTING   CCI_REG8(0x0902)
> >  #define IMX214_BINNING_AVERAGE 0x00
> >  #define IMX214_BINNING_SUMMED  0x01
> > @@ -211,36 +217,22 @@ static const struct cci_reg_sequence
> > mode_4096x2304[] = {
> >     { IMX214_REG_HDR_MODE, IMX214_HDR_MODE_OFF },
> >     { IMX214_REG_HDR_RES_REDUCTION, IMX214_HDR_RES_REDU_THROUGH
> > },
> >     { IMX214_REG_EXPOSURE_RATIO, 1 },
> > -   { IMX214_REG_X_ADD_STA, 56 },
> > -   { IMX214_REG_Y_ADD_STA, 408 },
> > -   { IMX214_REG_X_ADD_END, 4151 },
> > -   { IMX214_REG_Y_ADD_END, 2711 },
> >     { IMX214_REG_X_EVEN_INC, 1 },
> >     { IMX214_REG_X_ODD_INC, 1 },
> >     { IMX214_REG_Y_EVEN_INC, 1 },
> >     { IMX214_REG_Y_ODD_INC, 1 },
> > -   { IMX214_REG_BINNING_MODE, IMX214_BINNING_NONE },
> > -   { IMX214_REG_BINNING_TYPE, 0 },
> >     { IMX214_REG_BINNING_WEIGHTING, IMX214_BINNING_AVERAGE },
> >     { CCI_REG8(0x3000), 0x35 },
> >     { CCI_REG8(0x3054), 0x01 },
> >     { CCI_REG8(0x305C), 0x11 },
> > 
> > -   { IMX214_REG_CSI_DATA_FORMAT, IMX214_CSI_DATA_FORMAT_RAW10
> > },
> > -   { IMX214_REG_X_OUTPUT_SIZE, 4096 },
> > -   { IMX214_REG_Y_OUTPUT_SIZE, 2304 },
> >     { IMX214_REG_SCALE_MODE, IMX214_SCALE_NONE },
> >     { IMX214_REG_SCALE_M, 2 },
> > -   { IMX214_REG_DIG_CROP_X_OFFSET, 0 },
> > -   { IMX214_REG_DIG_CROP_Y_OFFSET, 0 },
> > -   { IMX214_REG_DIG_CROP_WIDTH, 4096 },
> > -   { IMX214_REG_DIG_CROP_HEIGHT, 2304 },
> > 
> >     { IMX214_REG_VTPXCK_DIV, 5 },
> >     { IMX214_REG_VTSYCK_DIV, 2 },
> >     { IMX214_REG_PREPLLCK_VT_DIV, 3 },
> >     { IMX214_REG_PLL_VT_MPY, 150 },
> > -   { IMX214_REG_OPPXCK_DIV, 10 },
> >     { IMX214_REG_OPSYCK_DIV, 1 },
> >     { IMX214_REG_PLL_MULT_DRIV, IMX214_PLL_SINGLE },
> > 
> > @@ -281,36 +273,22 @@ static const struct cci_reg_sequence
> > mode_1920x1080[] = {
> >     { IMX214_REG_HDR_MODE, IMX214_HDR_MODE_OFF },
> >     { IMX214_REG_HDR_RES_REDUCTION, IMX214_HDR_RES_REDU_THROUGH
> > },
> >     { IMX214_REG_EXPOSURE_RATIO, 1 },
> > -   { IMX214_REG_X_ADD_STA, 1144 },
> > -   { IMX214_REG_Y_ADD_STA, 1020 },
> > -   { IMX214_REG_X_ADD_END, 3063 },
> > -   { IMX214_REG_Y_ADD_END, 2099 },
> >     { IMX214_REG_X_EVEN_INC, 1 },
> >     { IMX214_REG_X_ODD_INC, 1 },
> >     { IMX214_REG_Y_EVEN_INC, 1 },
> >     { IMX214_REG_Y_ODD_INC, 1 },
> > -   { IMX214_REG_BINNING_MODE, IMX214_BINNING_NONE },
> > -   { IMX214_REG_BINNING_TYPE, 0 },
> >     { IMX214_REG_BINNING_WEIGHTING, IMX214_BINNING_AVERAGE },
> >    

Re: [PATCH v2 09/13] media: i2c: imx214: Extract format and crop settings

2024-11-20 Thread Ricardo Ribalda Delgado
Hi André

On Wed, Nov 20, 2024 at 9:07 PM André Apitzsch  wrote:
>
> Hi Ricardo,
>
> Am Mittwoch, dem 30.10.2024 um 13:10 +0100 schrieb Ricardo Ribalda
> Delgado:
> > Hi
> >
> > Aren't you changing the binning mode for 1920x1080  with this patch?
> > I think that could be considered an ABI change.
>
> Is the problem that the ABI changes or that it is not mentioned in the
> commit message?

I think it is a combination of both. There will be products out there
that after applying this change will get different frames using the
same configuration.

@Sakari Ailus  What do we usually do in these cases?

> >
> > Also, if we are not letting the user change the value, I do not see
> > much value in setting the cropping programmatically, I'd rather not
> > take this change.
>
> I assume the first "value" refers to "binning value", that cannot be
> changed by the user. Is it right, that .set_selection needs to be
> implemented to change that?

I believe set_selection is the correct way, yes. Sakari again to keep
me honest :)

>
> The different values are set programmatically to reduce the number of
> entries in the cci reg sequences to make it easier to add more modes
> later.

If it is not a huge rework: Can we start by having  the crop area
moved to imx214_mode and add all the binning logic to a different
patch?
It will be easier to discuss things that way.

>
> Regards,
> André
>
> >
> > On Mon, Oct 21, 2024 at 12:14 AM André Apitzsch via B4 Relay
> >  wrote:
> > >
> > > From: André Apitzsch 
> > >
> > > Remove format and crop settings from register sequences and set
> > > them
> > > programmatically.
> > >
> > > Signed-off-by: André Apitzsch 
> > > ---
> > >  drivers/media/i2c/imx214.c | 129
> > > ++---
> > >  1 file changed, 97 insertions(+), 32 deletions(-)
> > >
> > > diff --git a/drivers/media/i2c/imx214.c
> > > b/drivers/media/i2c/imx214.c
> > > index
> > > cb443d8bee6fe72dc9378b2c2d3caae09f8642c5..87a03e292e19ccd71f1b2dcee
> > > 3409826b2f5cb6f 100644
> > > --- a/drivers/media/i2c/imx214.c
> > > +++ b/drivers/media/i2c/imx214.c
> > > @@ -96,6 +96,9 @@
> > >  #define IMX214_REG_PREPLLCK_VT_DIV CCI_REG8(0x0305)
> > >  #define IMX214_REG_PLL_VT_MPY  CCI_REG16(0x0306)
> > >  #define IMX214_REG_OPPXCK_DIV  CCI_REG8(0x0309)
> > > +#define IMX214_OPPXCK_DIV_COMP66
> > > +#define IMX214_OPPXCK_DIV_COMP88
> > > +#define IMX214_OPPXCK_DIV_RAW1010
> > >  #define IMX214_REG_OPSYCK_DIV  CCI_REG8(0x030b)
> > >  #define IMX214_REG_PLL_MULT_DRIV   CCI_REG8(0x0310)
> > >  #define IMX214_PLL_SINGLE  0
> > > @@ -132,6 +135,9 @@
> > >  #define IMX214_BINNING_NONE0
> > >  #define IMX214_BINNING_ENABLE  1
> > >  #define IMX214_REG_BINNING_TYPECCI_REG8(0x0901)
> > > +#define IMX214_BINNING_1X1 0
> > > +#define IMX214_BINNING_2X2 0x22
> > > +#define IMX214_BINNING_4X4 0x44
> > >  #define IMX214_REG_BINNING_WEIGHTING   CCI_REG8(0x0902)
> > >  #define IMX214_BINNING_AVERAGE 0x00
> > >  #define IMX214_BINNING_SUMMED  0x01
> > > @@ -211,36 +217,22 @@ static const struct cci_reg_sequence
> > > mode_4096x2304[] = {
> > > { IMX214_REG_HDR_MODE, IMX214_HDR_MODE_OFF },
> > > { IMX214_REG_HDR_RES_REDUCTION, IMX214_HDR_RES_REDU_THROUGH
> > > },
> > > { IMX214_REG_EXPOSURE_RATIO, 1 },
> > > -   { IMX214_REG_X_ADD_STA, 56 },
> > > -   { IMX214_REG_Y_ADD_STA, 408 },
> > > -   { IMX214_REG_X_ADD_END, 4151 },
> > > -   { IMX214_REG_Y_ADD_END, 2711 },
> > > { IMX214_REG_X_EVEN_INC, 1 },
> > > { IMX214_REG_X_ODD_INC, 1 },
> > > { IMX214_REG_Y_EVEN_INC, 1 },
> > > { IMX214_REG_Y_ODD_INC, 1 },
> > > -   { IMX214_REG_BINNING_MODE, IMX214_BINNING_NONE },
> > > -   { IMX214_REG_BINNING_TYPE, 0 },
> > > { IMX214_REG_BINNING_WEIGHTING, IMX214_BINNING_AVERAGE },
> > > { CCI_REG8(0x3000), 0x35 },
> > > { CCI_REG8(0x3054), 0x01 },
> > > { CCI_REG8(0x305C), 0x11 },
> > >
> > > -   { IMX214_REG_CSI_DATA_FORMAT, IMX214_CSI_DATA_FORMAT_RAW10
> > > },
> > > -   { IMX214_REG_X_OUTPUT_SIZE, 4096 },
> > > -   { IMX214_REG_Y_OUTPUT_SIZE, 2304 },
> > > { IMX214_REG_SCALE_MODE, IMX214_SCALE_NONE },
> > > { IMX214_REG_SCALE_M, 2 },
> > > -   { IMX214_REG_DIG_CROP_X_OFFSET, 0 },
> > > -   { IMX214_REG_DIG_CROP_Y_OFFSET, 0 },
> > > -   { IMX214_REG_DIG_CROP_WIDTH, 4096 },
> > > -   { IMX214_REG_DIG_CROP_HEIGHT, 2304 },
> > >
> > > { IMX214_REG_VTPXCK_DIV, 5 },
> > > { IMX214_REG_VTSYCK_DIV, 2 },
> > > { IMX214_REG_PREPLLCK_VT_DIV, 3 },
> > > { IMX214_REG_PLL_VT_MPY, 150 },
> > > -   { IMX214_REG_OPPXCK_DIV, 10 },
> > > { IMX214_REG_OPSYCK_DIV, 1 },
> > > { IMX214_REG_PLL_MULT_DRIV, IMX214_PLL_SINGLE },
> > >
> > > @@ -281,36 +273,22 @@ static const st

Re: [PATCH v2 09/13] media: i2c: imx214: Extract format and crop settings

2024-10-30 Thread Ricardo Ribalda Delgado
Hi

Aren't you changing the binning mode for 1920x1080  with this patch? I
think that could be considered an ABI change.

Also, if we are not letting the user change the value, I do not see
much value in setting the cropping programmatically, I'd rather not
take this change.

On Mon, Oct 21, 2024 at 12:14 AM André Apitzsch via B4 Relay
 wrote:
>
> From: André Apitzsch 
>
> Remove format and crop settings from register sequences and set them
> programmatically.
>
> Signed-off-by: André Apitzsch 
> ---
>  drivers/media/i2c/imx214.c | 129 
> ++---
>  1 file changed, 97 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/media/i2c/imx214.c b/drivers/media/i2c/imx214.c
> index 
> cb443d8bee6fe72dc9378b2c2d3caae09f8642c5..87a03e292e19ccd71f1b2dcee3409826b2f5cb6f
>  100644
> --- a/drivers/media/i2c/imx214.c
> +++ b/drivers/media/i2c/imx214.c
> @@ -96,6 +96,9 @@
>  #define IMX214_REG_PREPLLCK_VT_DIV CCI_REG8(0x0305)
>  #define IMX214_REG_PLL_VT_MPY  CCI_REG16(0x0306)
>  #define IMX214_REG_OPPXCK_DIV  CCI_REG8(0x0309)
> +#define IMX214_OPPXCK_DIV_COMP66
> +#define IMX214_OPPXCK_DIV_COMP88
> +#define IMX214_OPPXCK_DIV_RAW1010
>  #define IMX214_REG_OPSYCK_DIV  CCI_REG8(0x030b)
>  #define IMX214_REG_PLL_MULT_DRIV   CCI_REG8(0x0310)
>  #define IMX214_PLL_SINGLE  0
> @@ -132,6 +135,9 @@
>  #define IMX214_BINNING_NONE0
>  #define IMX214_BINNING_ENABLE  1
>  #define IMX214_REG_BINNING_TYPECCI_REG8(0x0901)
> +#define IMX214_BINNING_1X1 0
> +#define IMX214_BINNING_2X2 0x22
> +#define IMX214_BINNING_4X4 0x44
>  #define IMX214_REG_BINNING_WEIGHTING   CCI_REG8(0x0902)
>  #define IMX214_BINNING_AVERAGE 0x00
>  #define IMX214_BINNING_SUMMED  0x01
> @@ -211,36 +217,22 @@ static const struct cci_reg_sequence mode_4096x2304[] = 
> {
> { IMX214_REG_HDR_MODE, IMX214_HDR_MODE_OFF },
> { IMX214_REG_HDR_RES_REDUCTION, IMX214_HDR_RES_REDU_THROUGH },
> { IMX214_REG_EXPOSURE_RATIO, 1 },
> -   { IMX214_REG_X_ADD_STA, 56 },
> -   { IMX214_REG_Y_ADD_STA, 408 },
> -   { IMX214_REG_X_ADD_END, 4151 },
> -   { IMX214_REG_Y_ADD_END, 2711 },
> { IMX214_REG_X_EVEN_INC, 1 },
> { IMX214_REG_X_ODD_INC, 1 },
> { IMX214_REG_Y_EVEN_INC, 1 },
> { IMX214_REG_Y_ODD_INC, 1 },
> -   { IMX214_REG_BINNING_MODE, IMX214_BINNING_NONE },
> -   { IMX214_REG_BINNING_TYPE, 0 },
> { IMX214_REG_BINNING_WEIGHTING, IMX214_BINNING_AVERAGE },
> { CCI_REG8(0x3000), 0x35 },
> { CCI_REG8(0x3054), 0x01 },
> { CCI_REG8(0x305C), 0x11 },
>
> -   { IMX214_REG_CSI_DATA_FORMAT, IMX214_CSI_DATA_FORMAT_RAW10 },
> -   { IMX214_REG_X_OUTPUT_SIZE, 4096 },
> -   { IMX214_REG_Y_OUTPUT_SIZE, 2304 },
> { IMX214_REG_SCALE_MODE, IMX214_SCALE_NONE },
> { IMX214_REG_SCALE_M, 2 },
> -   { IMX214_REG_DIG_CROP_X_OFFSET, 0 },
> -   { IMX214_REG_DIG_CROP_Y_OFFSET, 0 },
> -   { IMX214_REG_DIG_CROP_WIDTH, 4096 },
> -   { IMX214_REG_DIG_CROP_HEIGHT, 2304 },
>
> { IMX214_REG_VTPXCK_DIV, 5 },
> { IMX214_REG_VTSYCK_DIV, 2 },
> { IMX214_REG_PREPLLCK_VT_DIV, 3 },
> { IMX214_REG_PLL_VT_MPY, 150 },
> -   { IMX214_REG_OPPXCK_DIV, 10 },
> { IMX214_REG_OPSYCK_DIV, 1 },
> { IMX214_REG_PLL_MULT_DRIV, IMX214_PLL_SINGLE },
>
> @@ -281,36 +273,22 @@ static const struct cci_reg_sequence mode_1920x1080[] = 
> {
> { IMX214_REG_HDR_MODE, IMX214_HDR_MODE_OFF },
> { IMX214_REG_HDR_RES_REDUCTION, IMX214_HDR_RES_REDU_THROUGH },
> { IMX214_REG_EXPOSURE_RATIO, 1 },
> -   { IMX214_REG_X_ADD_STA, 1144 },
> -   { IMX214_REG_Y_ADD_STA, 1020 },
> -   { IMX214_REG_X_ADD_END, 3063 },
> -   { IMX214_REG_Y_ADD_END, 2099 },
> { IMX214_REG_X_EVEN_INC, 1 },
> { IMX214_REG_X_ODD_INC, 1 },
> { IMX214_REG_Y_EVEN_INC, 1 },
> { IMX214_REG_Y_ODD_INC, 1 },
> -   { IMX214_REG_BINNING_MODE, IMX214_BINNING_NONE },
> -   { IMX214_REG_BINNING_TYPE, 0 },
> { IMX214_REG_BINNING_WEIGHTING, IMX214_BINNING_AVERAGE },
> { CCI_REG8(0x3000), 0x35 },
> { CCI_REG8(0x3054), 0x01 },
> { CCI_REG8(0x305C), 0x11 },
>
> -   { IMX214_REG_CSI_DATA_FORMAT, IMX214_CSI_DATA_FORMAT_RAW10 },
> -   { IMX214_REG_X_OUTPUT_SIZE, 1920 },
> -   { IMX214_REG_Y_OUTPUT_SIZE, 1080 },
> { IMX214_REG_SCALE_MODE, IMX214_SCALE_NONE },
> { IMX214_REG_SCALE_M, 2 },
> -   { IMX214_REG_DIG_CROP_X_OFFSET, 0 },
> -   { IMX214_REG_DIG_CROP_Y_OFFSET, 0 },
> -   { IMX214_REG_DIG_CROP_WIDTH, 1920 },
> -   { IMX214_REG_DIG_CROP_HEIGHT, 1080 },
>
> { IMX214_REG_VTPXCK_DIV, 5 },
> { IMX214_REG_VTSYCK_DIV, 2 },
> { IMX214_REG_PREPLLCK_VT_DIV, 3 },
> { IMX214_REG_PLL_VT_MPY, 150 },
> -   { IM