Re: [PATCH v4 21/32] media: ov2680: Make setting the mode algorithm based

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 2, 2023 at 8:31 PM Hans de Goede <hdegoede@xxxxxxxxxx> wrote:
>
> Instead of using a long fixed register settings list for each resolution,
> calculate the register settings based on the requested width + height.
>
> This is based on atomisp-ov2680 commit 0611888592df ("media: atomisp:
> ov2680: Make setting the modes algorithm based").
>
> This will allow future enhancements like adding hblank and vblank controls
> and adding selection support.
>
> This also adds properly programming the ISP window and setting
> the manual ISP window control bit in register 0x5708, this is
> necessary for the hflip and vflip conrols to work properly.

...

>  struct ov2680_mode {
>         struct v4l2_mbus_framefmt       fmt;
>         struct v4l2_fract               frame_interval;

> +       bool                            binning;

You might save a (few) byte(s) by moving this to be the last one.

> +       u16                             h_start;
> +       u16                             v_start;
> +       u16                             h_end;
> +       u16                             v_end;
> +       u16                             h_output_size;
> +       u16                             v_output_size;
> +       u16                             hts;
> +       u16                             vts;
>  };


> +       sensor->mode.h_start = ((OV2680_NATIVE_WIDTH - width) / 2) & ~1;
> +       sensor->mode.v_start = ((OV2680_NATIVE_HEIGHT - height) / 2) & ~1;

~BIT(0) in both cases?

...

> +       width = min_t(unsigned int, ALIGN(format->format.width, 2),
> +                     OV2680_NATIVE_WIDTH);
> +       height = min_t(unsigned int, ALIGN(format->format.height, 2),
> +                      OV2680_NATIVE_HEIGHT);

Wondering if you can switch these to use min() (with a strict type checking).
It might require adding U/UL to the respective constants.

-- 
With Best Regards,
Andy Shevchenko




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux