mbox series

[0/5] media: ov2680: Add all controls required by libcamera

Message ID 20240216223237.326523-1-hdegoede@redhat.com
Headers show
Series media: ov2680: Add all controls required by libcamera | expand

Message

Hans de Goede Feb. 16, 2024, 10:32 p.m. UTC
Hi All,

This patch-series adds all controls required by libcamera to the ov2680
driver.

This has been tested together with the atomisp using the simple
pipelinehandler. This should also work in IPU3 based devices with
an ov2680.

Note the vblank control new default value after a mode-set call 
has been chosen so as to preserve the old behavior of always
running at 30 fps, so as to not change behavior for any existing
use-cases.

Regards,

Hans


Hans de Goede (5):
  media: ov2680: Stop sending more data then requested
  media: ov2680: Drop hts, vts ov2680_mode struct members
  media: ov2680: Add vblank control
  media: ov2680: Add hblank control
  media: ov2680: Add camera orientation and sensor rotation controls

 drivers/media/i2c/ov2680.c | 82 +++++++++++++++++++++++++++++---------
 1 file changed, 63 insertions(+), 19 deletions(-)

Comments

Kieran Bingham Feb. 17, 2024, 3:39 p.m. UTC | #1
Quoting Hans de Goede (2024-02-16 22:32:34)
> The hts, vts ov2680_mode struct members always contain
> OV2680_PIXELS_PER_LINE resp. OV2680_LINES_PER_FRAME,
> drop them and simply use these values directly.
> 


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>  drivers/media/i2c/ov2680.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/media/i2c/ov2680.c b/drivers/media/i2c/ov2680.c
> index 5b04c6c0554a..b4d5936dcd02 100644
> --- a/drivers/media/i2c/ov2680.c
> +++ b/drivers/media/i2c/ov2680.c
> @@ -140,8 +140,6 @@ struct ov2680_mode {
>         u16                             v_end;
>         u16                             h_output_size;
>         u16                             v_output_size;
> -       u16                             hts;
> -       u16                             vts;
>  };
>  
>  struct ov2680_dev {
> @@ -361,8 +359,6 @@ static void ov2680_calc_mode(struct ov2680_dev *sensor)
>                 min(sensor->mode.v_start + height - 1, OV2680_NATIVE_HEIGHT - 1);
>         sensor->mode.h_output_size = orig_width;
>         sensor->mode.v_output_size = orig_height;
> -       sensor->mode.hts = OV2680_PIXELS_PER_LINE;
> -       sensor->mode.vts = OV2680_LINES_PER_FRAME;
>  }
>  
>  static int ov2680_set_mode(struct ov2680_dev *sensor)
> @@ -397,9 +393,9 @@ static int ov2680_set_mode(struct ov2680_dev *sensor)
>         cci_write(sensor->regmap, OV2680_REG_VERTICAL_OUTPUT_SIZE,
>                   sensor->mode.v_output_size, &ret);
>         cci_write(sensor->regmap, OV2680_REG_TIMING_HTS,
> -                 sensor->mode.hts, &ret);
> +                 OV2680_PIXELS_PER_LINE, &ret);
>         cci_write(sensor->regmap, OV2680_REG_TIMING_VTS,
> -                 sensor->mode.vts, &ret);
> +                 OV2680_LINES_PER_FRAME, &ret);
>         cci_write(sensor->regmap, OV2680_REG_ISP_X_WIN, 0, &ret);
>         cci_write(sensor->regmap, OV2680_REG_ISP_Y_WIN, 0, &ret);
>         cci_write(sensor->regmap, OV2680_REG_X_INC, inc, &ret);
> -- 
> 2.43.0
>