Re: [PATCH v2 10/11] media: atomisp: allow raw Bayer capture

From: Andy Shevchenko

Date: Thu Aug 27 2026 - 16:25:07 EST


On Thu, Aug 27, 2026 at 08:17:55PM +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 format requests with the code selected by the sensor.
> Userspace explicitly opts into raw capture by selecting that raw V4L2
> pixel format with VIDIOC_S_FMT; no separate module parameter is needed.
>
> Also apply the per-sensor padding discovered by the CSI-2 bridge when
> enumerating and negotiating processed frame sizes. Raw formats expose
> the full sensor transport frame so ISP2401 can use its copy pipeline.
> Existing systems retain the global padding defaults.
>
> Tested on a Lenovo Yoga Book YB1-X91L with raw capture from its OV2740
> and OV8858 sensors.

...

> void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height,

> u32 min_pad_w = ISP2400_MIN_PAD_W;
> u32 min_pad_h = ISP2400_MIN_PAD_H;
> struct v4l2_mbus_framefmt *sink;
> + u32 input_padding_w = pad_w;
> + u32 input_padding_h = pad_h;

There are only three callers of this function. Can we have a preparatory patch
that converts this function from

void atomisp_get_padding(struct atomisp_device *isp, u32 width, u32 height,
u32 *padding_w, u32 *padding_h);

to

void atomisp_get_padding(struct atomisp_device *isp, struct v4l2_area size,
struct v4l2_area *pad);


(with the respective changes in the implementation of the function)?

...

> - atomisp_get_padding(isp, f->width, f->height, &padding_w, &padding_h);
> + if (fmt->sh_fmt == IA_CSS_FRAME_FORMAT_RAW) {
> + padding_w = 0;
> + padding_h = 0;

Define it as

struct v4l2_area padding;

> + } else {
> + atomisp_get_padding(isp, f->width, f->height,
> + &padding_w, &padding_h);
> + }

...

> if (!input->sensor)
> return -EINVAL;

+ blank line.

> + format = atomisp_get_format_bridge(fsize->pixel_format);
> + if (!format)
> + return -EINVAL;
>
> if (input->crop_support)
> return atomisp_enum_framesizes_crop(isp, fsize);

--
With Best Regards,
Andy Shevchenko