From: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
To: Luis de Arquer <ldearquer@gmail.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
Conor Dooley <conor+dt@kernel.org>,
Heiko Stuebner <heiko@sntech.de>,
Johan Jonker <jbx6244@gmail.com>,
Sebastian Reichel <sebastian.reichel@collabora.com>,
Sascha Hauer <s.hauer@pengutronix.de>,
Andy Yan <andy.yan@rock-chips.com>, Vinod Koul <vkoul@kernel.org>,
Kishon Vijay Abraham I <kishon@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Algea Cao <algea.cao@rock-chips.com>
Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-phy@lists.infradead.org, kernel@collabora.com
Subject: Re: [PATCH v2 2/2] phy: rockchip: Add Samsung HDMI/eDP Combo PHY driver
Date: Mon, 12 Feb 2024 20:36:03 +0200 [thread overview]
Message-ID: <4efca2ec-b078-4421-8956-e3add15d8f62@collabora.com> (raw)
In-Reply-To: <61af7b121b23fe8ed06df5348692f862b9b125bf.camel@gmail.com>
Hi Luis,
On 2/12/24 18:44, Luis de Arquer wrote:
> Hi Cristian,
>
> On Mon, 2024-02-05 at 13:24 +0200, Cristian Ciocaltea wrote:
>> +
>> +static bool hdptx_phy_clk_pll_calc(unsigned int data_rate,
>> + struct ropll_config *cfg)
>> +{
>> + const unsigned int fout = data_rate / 2, fref = 24000;
>> + unsigned long k = 0, lc, k_sub, lc_sub;
>> + unsigned int fvco, sdc;
>> + u32 mdiv, sdiv, n = 8;
>> +
>> + for (sdiv = 16; sdiv >= 1; sdiv--) {
>> + if (sdiv % 2 && sdiv != 1)
>> + continue;
>> +
>> + fvco = fout * sdiv;
>> +
>> + if (fvco < 2000000 || fvco > 4000000)
>> + continue;
>> +
>
> What about adding a check to data_rate, maybe like
>
> if (fout > 0x0FFFFFFF)
> return false;
>
> or similar, before the for loop, to keep the multiplication safe?
>
> Right now it would be redundant, given that data_rate was, at some
> point, encoded in 28 bits within bus_width. But can prevent future pain,
> especially after changing to phy_configure_opts_hdmi.
Indeed, it makes sense to do the check, thanks for the heads up!
I was almost ready to submit v3, so this arrived just in time. :-)
Regards,
Cristian
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
prev parent reply other threads:[~2024-02-12 18:36 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-05 11:24 [PATCH v2 0/2] Add support for RK3588 HDMI/eDP Combo PHY Cristian Ciocaltea
2024-02-05 11:24 ` [PATCH v2 1/2] dt-bindings: phy: Add Rockchip HDMI/eDP Combo PHY schema Cristian Ciocaltea
2024-02-06 10:21 ` Heiko Stübner
2024-02-05 11:24 ` [PATCH v2 2/2] phy: rockchip: Add Samsung HDMI/eDP Combo PHY driver Cristian Ciocaltea
2024-02-07 10:16 ` Vinod Koul
2024-02-07 12:39 ` Cristian Ciocaltea
2024-02-07 14:06 ` Vinod Koul
2024-02-08 8:00 ` Heiko Stübner
2024-02-08 11:56 ` Cristian Ciocaltea
2024-02-12 16:44 ` Luis de Arquer
2024-02-12 18:36 ` Cristian Ciocaltea [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=4efca2ec-b078-4421-8956-e3add15d8f62@collabora.com \
--to=cristian.ciocaltea@collabora.com \
--cc=algea.cao@rock-chips.com \
--cc=andy.yan@rock-chips.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=heiko@sntech.de \
--cc=jbx6244@gmail.com \
--cc=kernel@collabora.com \
--cc=kishon@kernel.org \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=ldearquer@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=p.zabel@pengutronix.de \
--cc=robh+dt@kernel.org \
--cc=s.hauer@pengutronix.de \
--cc=sebastian.reichel@collabora.com \
--cc=vkoul@kernel.org \
/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