From: sashiko-bot@kernel.org
To: "Pengyu Luo" <mitltlatltl@gmail.com>
Cc: conor+dt@kernel.org, Frank.Li@kernel.org, imx@lists.linux.dev,
robh@kernel.org, krzk+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v4 5/5] arm64: dts: imx8mq-librem5: Correct link frequency list
Date: Tue, 12 May 2026 05:45:42 +0000 [thread overview]
Message-ID: <20260512054542.DF297C2BCB0@smtp.kernel.org> (raw)
In-Reply-To: <20260511103927.279550-6-mitltlatltl@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] The exact link frequencies of 187500000 and 375000000 will fail the exact-match validation in the hi846 driver, causing the sensor probe to fail with -EINVAL.
- [Low] The arithmetic formula provided in the commit message is mathematically incorrect and misrepresents the driver's internal logic.
--
commit 1a95e1bc9a680037635b3deded93622acb02b6ed
Author: Pengyu Luo <mitltlatltl@gmail.com>
arm64: dts: imx8mq-librem5: Correct link frequency list
This commit updates the link frequencies for the hi846 camera sensor on the
imx8mq-librem5 board to match the expected values calculated from the mclk.
> 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
This isn't a bug, but is the arithmetic in the commit message correct?
Mathematically, 25 / 3 * 90 is exactly 750. Dividing 750 by 1 and then by 1
or 2 results in 750 MHz and 375 MHz. To arrive at 187.5 MHz, the division
should be / 2 / 2, which corresponds to post_div1 = 2 and post_div2 = 2 in
the driver logic.
> 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>;
Does this regression cause the sensor probe to fail with -EINVAL?
The hi846 driver dynamically calculates expected link frequencies from mclk
using the C expression: mclk / 3 * 90 / post_div1 / post_div2.
In C, operators with the same precedence are evaluated left-to-right. With
mclk configured to 25,000,000 Hz, the division 25000000 / 3 occurs first
and truncates to 8,333,333.
Subsequent multiplication by 90 and division yields 187,499,992 and
374,999,984 instead of exactly 187,500,000 and 375,000,000.
Because 187500000 != 187499992, the exact equality check in the driver:
if (link_freq == ep->link_frequencies[j])
will fail.
This rejects these mathematically ideal frequencies and aborts the probe,
breaking camera initialization.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260511103927.279550-1-mitltlatltl@gmail.com?part=5
prev parent reply other threads:[~2026-05-12 5:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-11 10:39 [PATCH v4 0/5] fix and improve for Hi846 Pengyu Luo
2026-05-11 10:39 ` [PATCH v4 1/5] media: hi846: fix hi846_write_reg_16 handling Pengyu Luo
2026-05-12 3:38 ` sashiko-bot
2026-05-11 10:39 ` [PATCH v4 2/5] media: hi846: fix link frequency handling Pengyu Luo
2026-05-12 4:08 ` sashiko-bot
2026-05-11 10:39 ` [PATCH v4 3/5] media: hi846: fix modes handling for different lane cases Pengyu Luo
2026-05-12 4:43 ` sashiko-bot
2026-05-11 10:39 ` [PATCH v4 4/5] media: hi846: Add 6MP and 8MP modes support Pengyu Luo
2026-05-12 5:13 ` sashiko-bot
2026-05-11 10:39 ` [PATCH v4 5/5] arm64: dts: imx8mq-librem5: Correct link frequency list Pengyu Luo
2026-05-12 5:45 ` 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=20260512054542.DF297C2BCB0@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