Re: [PATCH v2 3/4] media: hi846: Add 6MP and 8MP modes support
From: Sebastian Krzyszkowiak
Date: Wed May 06 2026 - 09:00:40 EST
On piątek, 1 maja 2026 11:54:32 czas środkowoeuropejski letni Pengyu Luo
wrote:
> Hi846 is an 8MP sensor, but the upstream driver has only supported 2MP
> mode for years. This patch adds 6MP and 8MP modes to maximize sensor
> utilization.
>
> Note that these modes require 4-lane MIPI CSI-2, as the downstream
> driver only exposes 2MP, 6MP, and 8MP configurations in 4-lane
> operation on the target device. The register sequences are extracted
> from the downstream Windows driver.
Has this been tested in this form at all? I tried, failed and looking at the
driver I don't see how could it ever end up using these modes in its current
state. It can only cause troubles when used with 2 lanes, while 4 lanes are
completely broken.
The driver defaults to its first supported mode, which happens to be a 640x480
mode that only defines its register list for 2 lanes. hi846_set_format was
supposedly meant to check whether the mode returned by v4l2_find_nearest_size
is compatible with the used lane count, but it does so too early - it actually
checks it against the already set mode rather than the one it's about to set.
This means that you're never going to be able to set any valid mode when using
4 lanes without fixing this first.
And even if this was fixed, with 2 lanes this makes some calls from userspace
that previously succeeded now fail when v4l2_find_nearest_size happens to match
a mode that's only supported with 4 lanes. v4l2_find_nearest_size would have to
be fed with already filtered list of modes to fix that (which would actually
make the check mentioned above unnecessary).
Of course these are preexisting issues in the driver, but they make it
impossible to actually use what's being added in this patch and to add these
modes without causing regressions. So far these didn't matter as this driver
was only ever used with 2 lanes, but they have to be fixed first before adding
any actual 4 lane usage or modes that require 4 lanes.
S.