Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Dumitru Ceclan" <dumitru.ceclan@analog.com>
Cc: media-ci@linuxtv.org, devicetree@vger.kernel.org,
	robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v18 18/23] media: i2c: maxim-serdes: add MAX96717 driver
Date: Tue, 29 Sep 2026 23:01:55 +0000	[thread overview]
Message-ID: <20260929230155.E74861F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260930-gmsl2-3_serdes-v18-18-43117818f499@analog.com>

Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] media: max96717: MIPI RX lane map and polarity are swapped and use logical indices
- [Medium] media: max96717: incorrect pinctrl offset mapping rejects valid slew-rate pins and configures wrong pins
--

commit b166b51a6d16288e98d7dffe39c310bebd68f7e0
Author: Cosmin Tanislav <demonsingur@gmail.com>

media: i2c: maxim-serdes: add MAX96717 driver

This patch introduces a new driver for the Maxim MAX96717 and related
serializers. It integrates with the common serializer framework while adding
support for features across multiple chips, receiving video over MIPI CSI-2
and outputting via GMSL2/3.

> diff --git a/drivers/media/i2c/maxim-serdes/max96717.c b/drivers/media/i2c/maxim-serdes/max96717.c
> new file mode 100644
> index 0000000000000..c87ea9e82c1ca
> --- /dev/null
> +++ b/drivers/media/i2c/maxim-serdes/max96717.c
> @@ -0,0 +1,1703 @@
[ ... ]
> +static int max96717_get_pin_config_reg(unsigned int offset, u32 param,
> +				       unsigned int *reg, unsigned int *mask,
> +				       unsigned int *val)
> +{
[ ... ]
> +	switch (param) {
> +	case PIN_CONFIG_SLEW_RATE:
> +		if (offset < 3) {
> +			*reg = MAX96717_PIO_SLEW_0;
> +			if (offset == 0)
> +				*mask = MAX96717_PIO_SLEW_0_PIO00_SLEW;
> +			else if (offset == 1)
> +				*mask = MAX96717_PIO_SLEW_0_PIO01_SLEW;
> +			else
> +				*mask = MAX96717_PIO_SLEW_0_PIO02_SLEW;
> +		} else if (offset < 5) {
> +			*reg = MAX96717_PIO_SLEW_1;
> +			if (offset == 3)
> +				*mask = MAX96717_PIO_SLEW_1_PIO05_SLEW;
> +			else
> +				*mask = MAX96717_PIO_SLEW_1_PIO06_SLEW;
> +		} else if (offset < 7) {
> +			return -EINVAL;
> +		} else if (offset < 9) {
> +			*reg  = MAX96717_PIO_SLEW_2;
> +			if (offset == 7)
> +				*mask = MAX96717_PIO_SLEW_2_PIO010_SLEW;
> +			else
> +				*mask = MAX96717_PIO_SLEW_2_PIO011_SLEW;
> +		} else {
> +			return -EINVAL;
> +		}

[Severity: Medium]
Does this logic map the correct pins for slew-rate configuration?

When offset represents the actual pin index, this sequentially maps offset 3
to PIO05_SLEW, offset 4 to PIO06_SLEW, and offsets 7 and 8 to PIO010_SLEW and
PIO011_SLEW.

This mistakenly configures PIO05 and PIO06 when pins 3 and 4 are requested.
When valid slew-capable pins like 5, 6, or 10 are passed, they fall into the
else if branches and are incorrectly rejected with -EINVAL.

[ ... ]
> +static int max96717_mux_set_rclkout(struct max96717_priv *priv, unsigned int group)
> +{
> +	unsigned long config;
> +	int ret;
> +
> +	config = pinconf_to_config_packed(PIN_CONFIG_SLEW_RATE,
> +					  MAX96717_PIO_SLEW_FASTEST);
> +	ret = max96717_conf_pin_config_set_one(priv, group, config);

[Severity: Medium]
When max96717_mux_set_rclkout() requests the fastest slew rate for
MAX96717_RCLK_MFP (pin 4), does the mapping issue mentioned above cause
it to erroneously configure PIO06's slew rate instead of the RCLK pin?

[ ... ]
> +static int max96717_init_phy(struct max_ser *ser,
> +			     struct max_ser_phy *phy)
> +{
[ ... ]
> +	/* Configure lane mapping. */
> +	val = 0;
> +	for (i = 0; i < 4; i++) {
> +		unsigned int map;
> +
> +		if (i < num_data_lanes)
> +			map = phy->mipi.data_lanes[i] - 1;
> +		else
> +			map = ffz(used_data_lanes);
> +
> +		val |= map << (i * 2);
> +		used_data_lanes |= BIT(map);
> +	}
> +
> +	ret = regmap_update_bits(priv->regmap, MAX96717_MIPI_RX3,
> +				 MAX96717_MIPI_RX3_PHY2_LANE_MAP,
> +				 FIELD_PREP(MAX96717_MIPI_RX3_PHY2_LANE_MAP, val));
> +	if (ret)
> +		return ret;
> +
> +	ret = regmap_update_bits(priv->regmap, MAX96717_MIPI_RX2,
> +				 MAX96717_MIPI_RX2_PHY1_LANE_MAP,
> +				 FIELD_PREP(MAX96717_MIPI_RX2_PHY1_LANE_MAP, val >> 4));

[Severity: High]
Are the lane assignments for PHY1 and PHY2 swapped here?

The driver constructs val with physical lane mappings for logical lanes 0-3,
where bits 0-3 correspond to lanes 0-1 and bits 4-7 correspond to lanes 2-3.

However, val (lanes 0-1) is written to MAX96717_MIPI_RX3_PHY2_LANE_MAP, and
val >> 4 (lanes 2-3) is written to MAX96717_MIPI_RX2_PHY1_LANE_MAP. PHY1
normally controls lanes 0-1 and PHY2 controls lanes 2-3.

> +	if (ret)
> +		return ret;
> +
> +	/* Configure lane polarity. */
> +	for (i = 0, val = 0; i < num_data_lanes; i++)
> +		if (phy->mipi.lane_polarities[i + 1])
> +			val |= BIT(i);

[Severity: High]
Does lane polarity configuration use the correct index?

Setting polarity using BIT(i) applies the inversion based on the logical lane
index. If the lanes are remapped, this could apply the inversion to the wrong
physical lane. Should this use the physical lane index
BIT(phy->mipi.data_lanes[i] - 1) instead?

Additionally, the same PHY1/PHY2 swap from the lane map appears to occur for
the polarity map just below this loop.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260930-gmsl2-3_serdes-v18-0-43117818f499@analog.com?part=18

  reply	other threads:[~2026-09-29 23:01 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-29 22:41 [PATCH v18 00/23] media: i2c: add Maxim GMSL2/3 serializer and deserializer drivers Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 01/23] media: mc: Add INTERNAL pad flag Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 02/23] dt-bindings: media: i2c: max96717: add support for I2C ATR Dumitru Ceclan via B4 Relay
2026-09-29 22:52   ` sashiko-bot
2026-09-29 22:41 ` [PATCH v18 03/23] dt-bindings: media: i2c: max96717: add support for pinctrl/pinconf Dumitru Ceclan via B4 Relay
2026-10-06 15:06   ` Krzysztof Kozlowski
2026-09-29 22:41 ` [PATCH v18 04/23] dt-bindings: media: i2c: max96717: add support for MAX9295A Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 05/23] dt-bindings: media: i2c: max96717: add support for MAX96793 Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 06/23] dt-bindings: media: i2c: max96712: use pattern properties for ports Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 07/23] dt-bindings: media: i2c: max96712: add support for I2C ATR Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 08/23] dt-bindings: media: i2c: max96712: add support for POC supplies Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 09/23] dt-bindings: media: i2c: max96712: add support for MAX96724F/R Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 10/23] dt-bindings: media: i2c: max96712: add control-channel-port property Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 11/23] dt-bindings: media: i2c: max96714: add support for MAX96714R Dumitru Ceclan via B4 Relay
2026-10-06 15:07   ` Krzysztof Kozlowski
2026-09-29 22:41 ` [PATCH v18 12/23] dt-bindings: media: i2c: add MAX9296A, MAX96716A, MAX96792A Dumitru Ceclan via B4 Relay
2026-09-29 22:51   ` sashiko-bot
2026-09-29 22:41 ` [PATCH v18 13/23] i2c: atr: serialize attach/detach against bus transfers Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 14/23] media: i2c: add Maxim GMSL2/3 serializer and deserializer framework Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 15/23] media: i2c: add Maxim GMSL2/3 serializer framework Dumitru Ceclan via B4 Relay
2026-09-29 22:59   ` sashiko-bot
2026-09-29 22:41 ` [PATCH v18 16/23] media: i2c: add Maxim GMSL2/3 deserializer framework Dumitru Ceclan via B4 Relay
2026-09-29 22:58   ` sashiko-bot
2026-09-29 22:41 ` [PATCH v18 17/23] media: i2c: remove MAX96717 driver Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 18/23] media: i2c: maxim-serdes: add " Dumitru Ceclan via B4 Relay
2026-09-29 23:01   ` sashiko-bot [this message]
2026-09-29 22:41 ` [PATCH v18 19/23] arm64: defconfig: disable deprecated MAX96712 driver Dumitru Ceclan via B4 Relay
2026-09-29 22:51   ` sashiko-bot
2026-09-29 22:41 ` [PATCH v18 20/23] staging: media: remove " Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 21/23] media: i2c: maxim-serdes: add MAX96724 driver Dumitru Ceclan via B4 Relay
2026-09-29 22:41 ` [PATCH v18 22/23] media: i2c: remove MAX96714 driver Dumitru Ceclan via B4 Relay
2026-09-29 22:56   ` sashiko-bot
2026-09-29 22:41 ` [PATCH v18 23/23] media: i2c: maxim-serdes: add MAX9296A driver Dumitru Ceclan via B4 Relay
2026-09-29 23:00   ` sashiko-bot
2026-09-30  9:55 ` [PATCH v18 00/23] media: i2c: add Maxim GMSL2/3 serializer and deserializer drivers Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260929230155.E74861F000FF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dumitru.ceclan@analog.com \
    --cc=media-ci@linuxtv.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox