Re: [PATCH v5 2/2] media: i2c: Add Samsung S5K3T2 image sensor driver

From: Sakari Ailus

Date: Thu Nov 19 2026 - 16:53:33 EST


Hi Armandas,

Thanks for the update. A few comments below...

On Tue, Nov 17, 2026 at 09:20:05PM +0100, Armandas Kvietkus via B4 Relay wrote:
> From: Armandas Kvietkus <armandas.kvietkus@xxxxxxxxx>
>
> Add a driver for the Samsung S5K3T2 20 Mpixel CMOS image sensor.
>
> The driver supports three modes. All of them are RAW10 on four D-PHY
> lanes.
>
> 5184x3880 at 15 fps, link frequency 448 MHz
> 2592x1940 at 60 fps, link frequency 448 MHz
> 1280x720 at 120 fps, link frequency 300 MHz
>
> The pixel clock does not change between modes, so the pixel rate control
> is constant. The frame rate follows from the line length and the frame
> length.
>
> The controls are exposure, analogue gain, horizontal blanking, vertical
> blanking, horizontal flip, vertical flip and test pattern. Rotation and
> orientation come from the device tree. Power is handled by runtime PM
> with autosuspend.
>
> The register tables come from the vendor camera firmware. They were
> checked on hardware.
>
> Tested on a Xiaomi POCO F3 with the Qualcomm CAMSS driver.

A lot of this should go to the cover letter.

>
> Reviewed-by: Elgin Perumbilly <elgin.perumbilly@xxxxxxxxxxxxxxxxx>
> Signed-off-by: Armandas Kvietkus <armandas.kvietkus@xxxxxxxxx>
> ---
> MAINTAINERS | 1 +
> drivers/media/i2c/Kconfig | 10 +
> drivers/media/i2c/Makefile | 1 +
> drivers/media/i2c/s5k3t2.c | 1327 ++++++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 1339 insertions(+)
>
> diff --git a/drivers/media/i2c/Makefile b/drivers/media/i2c/Makefile
> index d04bd5724552..9a25d8200b65 100644
> --- a/drivers/media/i2c/Makefile
> +++ b/drivers/media/i2c/Makefile

...

> +static int s5k3t2_check_hwcfg(struct s5k3t2 *s5k3t2)
> +{
> + struct fwnode_handle *fwnode = dev_fwnode(s5k3t2->dev), *ep;
> + struct v4l2_fwnode_endpoint bus_cfg = {
> + .bus = {
> + .mipi_csi2 = {
> + .num_data_lanes = S5K3T2_DATA_LANES,
> + },
> + },

Does the sensor support other number of active lanes than 4? Very probably.
But this isn't reflected in DT bindings (and it should be).

> + .bus_type = V4L2_MBUS_CSI2_DPHY,
> + };
> + int ret;
> +
> + ep = fwnode_graph_get_next_endpoint(fwnode, NULL);
> + ret = v4l2_fwnode_endpoint_alloc_parse(ep, &bus_cfg);
> + fwnode_handle_put(ep);
> + if (ret)
> + return ret;
> +
> + if (bus_cfg.bus.mipi_csi2.num_data_lanes != S5K3T2_DATA_LANES) {
> + dev_err(s5k3t2->dev, "invalid number of data lanes: %u\n",
> + bus_cfg.bus.mipi_csi2.num_data_lanes);
> + ret = -EINVAL;
> + goto endpoint_free;
> + }
> +
> + ret = v4l2_link_freq_to_bitmap(s5k3t2->dev, bus_cfg.link_frequencies,
> + bus_cfg.nr_of_link_frequencies,
> + s5k3t2_link_freq_menu,
> + ARRAY_SIZE(s5k3t2_link_freq_menu),
> + &s5k3t2->link_freq_bitmap);
> +
> +endpoint_free:
> + v4l2_fwnode_endpoint_free(&bus_cfg);
> +
> + return ret;
> +}

--
Regards,

Sakari Ailus