Re: [PATCH v7 15/16] media: atomisp: allow raw Bayer capture

From: Andy Shevchenko

Date: Thu Sep 03 2026 - 03:30:17 EST


On Wed, Sep 02, 2026 at 04:53:44PM +0200, Maurizio Casciano wrote:
> AtomISP currently rejects all raw formats and silently substitutes
> YUV420. This prevents userspace camera processing stacks from obtaining
> unprocessed sensor frames.
>
> Enumerate only the raw format matching the sensor media-bus code and
> reconcile raw requests with the code selected by the sensor. Userspace
> opts in by selecting that raw V4L2 pixel format with VIDIOC_S_FMT.
>
> Raw formats expose the full sensor transport frame so ISP2401 can use
> its copy pipeline. Processed formats retain the existing global padding
> behavior; selecting a smaller receiver crop remains a userspace pipeline
> decision.

...

> + const struct atomisp_format_bridge *format;
> struct v4l2_subdev_state *act_sd_state;

> + struct v4l2_area padding = {
> + .width = pad_w,
> + .height = pad_h,
> + };

Hmm... We use them only once. See below.

> int ret;

...

> + if (format->sh_fmt == IA_CSS_FRAME_FORMAT_RAW)
> + padding = (struct v4l2_area) { };

> fsize->type = V4L2_FRMSIZE_TYPE_DISCRETE;
> - fsize->discrete.width = fse.max_width - pad_w;
> - fsize->discrete.height = fse.max_height - pad_h;
> + fsize->discrete.width = fse.max_width - padding.width;
> + fsize->discrete.height = fse.max_height - padding.height;

padding is not used as a stuct here, so instead you can simply convert the
above to if-else

if (format->sh_fmt == IA_CSS_FRAME_FORMAT_RAW) {
fsize->discrete.width = fse.max_width;
fsize->discrete.height = fse.max_height;
} else {
fsize->discrete.width = fse.max_width - pad_w;
fsize->discrete.height = fse.max_height - pad_h;
}

--
With Best Regards,
Andy Shevchenko