Re: [PATCH v7 2/2] media: i2c: add Aptina MT9M113 1.3 Mpx SoC sensor driver

From: Krzysztof Kozlowski

Date: Mon Jun 08 2026 - 03:05:50 EST


On Sun, Jun 07, 2026 at 07:34:05AM +0200, Herman van Hazendonk wrote:
> Add a V4L2 subdev driver for the Aptina MT9M113 1.3 Megapixel SoC
> image sensor (1280x1024 active pixel array) with on-chip ISP. The
> sensor exposes:
>
> - dual context operation: Context A (640x480 preview, binned) and
> Context B (1280x1024 capture) selectable at runtime;
> - single-lane MIPI CSI-2 output, YUV422 in UYVY or YUYV byte order
> (the byte order is selected via the chroma/luma swap bit in
> MODE_OUTPUT_FORMAT_{A,B});
> - I2C MCU-indirect register access through the 0x098C/0x0990 page
> indirection pair, in addition to the directly addressable
> register space;
> - V4L2 controls: H/V flip, color effects (none / mono / sepia /
> negative / solarization), power-line frequency, saturation,
> manual or auto exposure, analog gain, auto white balance, and
> a four-entry test pattern selector;
> - a 24 MHz EXTCLK and 1.8/2.8 V supplies.
>
> The MT9M113 MCU intermittently wedges on stream start (SEQ_CMD
> stuck, SEQ_STATE never reaching preview/capture; only a full power
> cycle recovers it). The driver works around this in two layers:
> runtime-PM resume always performs a full power-cycle plus init-table
> replay - matching the legacy vendor kernel's per-open behaviour -
> so a wedged MCU is recovered each session; and the s_stream(1) path
> retries a bounded number of times with a runtime-PM power cycle
> between attempts as fallback insurance for the residual failure
> rate.
>
> Found on the HP TouchPad (Tenderloin) as the front-facing camera
> and on a number of other 1280x1024 mobile/embedded boards.
>
> Assisted-by: Claude:claude-opus-4-7 Sashiko:claude-haiku-4-5 Sparse:0.6.4 Coccinelle:1.1.1
> Signed-off-by: Herman van Hazendonk <github.com@xxxxxxxxxx>
> ---
> .../bindings/media/i2c/aptina,mt9m113.yaml | 8 +
> MAINTAINERS | 8 +
> drivers/media/i2c/Kconfig | 13 +
> drivers/media/i2c/Makefile | 1 +
> drivers/media/i2c/mt9m113.c | 3394 ++++++++++++++++++++
> 5 files changed, 3424 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/media/i2c/aptina,mt9m113.yaml b/Documentation/devicetree/bindings/media/i2c/aptina,mt9m113.yaml
> index 72b827c47b1d..cfd6711e8250 100644
> --- a/Documentation/devicetree/bindings/media/i2c/aptina,mt9m113.yaml
> +++ b/Documentation/devicetree/bindings/media/i2c/aptina,mt9m113.yaml
> @@ -70,6 +70,14 @@ properties:
> const: 4
> description: MIPI CSI-2 D-PHY
>
> + data-lanes:
> + description:
> + The MT9M113 has a single CSI-2 data lane. Reject DT entries
> + that try to assign more than one lane so a misconfiguration
> + is caught at schema-validation time rather than at runtime
> + when the driver enforces num_data_lanes == 1.
> + maxItems: 1
> +

Please run scripts/checkpatch.pl on the patches and fix reported
warnings. After that, run also 'scripts/checkpatch.pl --strict' on the
patches and (probably) fix more warnings. Some warnings can be ignored,
especially from --strict run, but the code here looks like it needs a
fix. Feel free to get in touch if the warning is not clear.

Best regards,
Krzysztof