Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Pengyu Luo" <mitltlatltl@gmail.com>
Cc: robh@kernel.org, Frank.Li@kernel.org, krzk+dt@kernel.org,
	devicetree@vger.kernel.org, conor+dt@kernel.org,
	imx@lists.linux.dev
Subject: Re: [PATCH v3 5/5] arm64: dts: imx8mq-librem5: Correct link frequency list
Date: Tue, 12 May 2026 03:48:01 +0000	[thread overview]
Message-ID: <20260512034801.ECBFEC2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260511090924.269106-6-mitltlatltl@gmail.com>

Thank you for your contribution! Sashiko AI review found 3 potential issue(s) to consider:
- [High] Strict equality check failure due to integer truncation precision loss
- [Medium] Device Tree ABI / Backward Compatibility break
- [Low] Mathematical error in commit message derivation
--

commit e44214657fa2d9bae2190f57c8fa133a21051c14
Author: Pengyu Luo <mitltlatltl@gmail.com>

arm64: dts: imx8mq-librem5: Correct link frequency list

This commit updates the device tree binding for the imx8mq-librem5 board
to correct the supported link frequencies for the hi846 camera sensor.

>     According to the hi846 datasheet and the register lists, they are
>     
>     mclk / prediv * multiplier / post_div1 / post_div2 =
>     25Mhz / 3 * 90 / 1 / {1,2} = 187.5Mhz, 375Mhz

Is this calculation completely accurate?

Mathematically, 25 / 3 * 90 / 1 / 1 equals 750 MHz, not 375 MHz. To achieve
187.5 MHz and 375 MHz, does the post_div1 divisor need to be 2 instead of 1?

> diff --git a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi
> index eee390c272105..959a5c8dcd0d3 100644
> --- a/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx8mq-librem5.dtsi

[ ... ]

> @@ -1122,7 +1122,7 @@ port {
>  			camera1_ep: endpoint {
>  				data-lanes = <1 2>;
>  				link-frequencies = /bits/ 64
> -					<80000000 200000000 300000000>;
> +					<187500000 375000000>;

Could this exact value specification cause the driver probe to fail due to
integer truncation?

The hi846 driver calculates the expected link frequency using the formula 
mclk / 3 * 90 / post_div1 / post_div2. Because mclk is exactly 25,000,000, 
the C integer division 25000000 / 3 evaluates to 8,333,333. After the 
subsequent multiplications and divisions, the evaluated link frequencies are 
187,499,992 Hz and 374,999,984 Hz.

Since hi846_check_link_freqs() performs a strict equality check against the
device tree values, this mismatch could cause it to reject the frequencies
and fail probing.

Additionally, does completely removing the old values break backward
compatibility for older kernels?

Prior to the driver update that dynamically calculates link frequencies, the
hi846 driver strictly required the hardcoded frequencies 80000000 and
200000000 to be present in the device tree. Appending the new values while
keeping the old ones might preserve backward compatibility.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260511090924.269106-1-mitltlatltl@gmail.com?part=5

      reply	other threads:[~2026-05-12  3:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-11  9:09 [PATCH v3 0/5] fix and improve for Hi846 Pengyu Luo
2026-05-11  9:09 ` [PATCH v3 1/5] media: hi846: fix hi846_write_reg_16 handling Pengyu Luo
2026-05-11  9:36   ` Markus Elfring
2026-05-12  1:24   ` sashiko-bot
2026-05-11  9:09 ` [PATCH v3 2/5] media: hi846: fix link frequency handling Pengyu Luo
2026-05-11 10:42   ` Markus Elfring
2026-05-12  1:56   ` sashiko-bot
2026-05-11  9:09 ` [PATCH v3 3/5] media: hi846: fix modes handling for different lane cases Pengyu Luo
2026-05-12  2:35   ` sashiko-bot
2026-05-11  9:09 ` [PATCH v3 4/5] media: hi846: Add 6MP and 8MP modes support Pengyu Luo
2026-05-12  3:22   ` sashiko-bot
2026-05-11  9:09 ` [PATCH v3 5/5] arm64: dts: imx8mq-librem5: Correct link frequency list Pengyu Luo
2026-05-12  3:48   ` sashiko-bot [this message]

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=20260512034801.ECBFEC2BCB0@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=Frank.Li@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=imx@lists.linux.dev \
    --cc=krzk+dt@kernel.org \
    --cc=mitltlatltl@gmail.com \
    --cc=robh@kernel.org \
    --cc=sashiko@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