From: "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>
To: "p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"vkoul@kernel.org" <vkoul@kernel.org>,
"trix@redhat.com" <trix@redhat.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"kishon@kernel.org" <kishon@kernel.org>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Cc: "dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] phy: mediatek: rework the floating point comparisons to fixed point
Date: Thu, 4 May 2023 07:53:33 +0000 [thread overview]
Message-ID: <f48580115b4fddf07a1dfabaf240a17d8d712ce9.camel@mediatek.com> (raw)
In-Reply-To: <20230502145005.2927101-1-trix@redhat.com>
On Tue, 2023-05-02 at 10:50 -0400, Tom Rix wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> gcc on aarch64 reports
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c: In function
> ‘mtk_hdmi_pll_set_rate’:
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:240:52: error: ‘-mgeneral-
> regs-only’
> is incompatible with the use of floating-point types
> 240 | else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 *
> MEGA)
>
> Floating point should not be used, so rework the floating point
> comparisons
> to fixed point.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> v2: silence robot by casting types to u64
>
> ---
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> index abfc077fb0a8..093c4d1da557 100644
> --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> @@ -237,11 +237,11 @@ static int mtk_hdmi_pll_calc(struct
> mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
> */
> if (tmds_clk < 54 * MEGA)
> txposdiv = 8;
> - else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 * MEGA)
> + else if (tmds_clk >= 54 * MEGA && (tmds_clk * 100) < 14835 *
> MEGA)
> txposdiv = 4;
> - else if (tmds_clk >= 148.35 * MEGA && tmds_clk < 296.7 *
> MEGA)
> + else if ((tmds_clk * 100) >= 14835 * MEGA && (tmds_clk * 10)
> < 2967 * MEGA)
> txposdiv = 2;
> - else if (tmds_clk >= 296.7 * MEGA && tmds_clk <= 594 * MEGA)
> + else if ((tmds_clk * 10) >= 2967 * MEGA && tmds_clk <= 594 *
> MEGA)
> txposdiv = 1;
> else
> return -EINVAL;
> @@ -328,12 +328,12 @@ static int mtk_hdmi_pll_drv_setting(struct
> clk_hw *hw)
> clk_channel_bias = 0x34; /* 20mA */
> impedance_en = 0xf;
> impedance = 0x36; /* 100ohm */
> - } else if (pixel_clk >= 74.175 * MEGA && pixel_clk <= 300 *
> MEGA) {
> + } else if (((u64)pixel_clk * 1000) >= 74175 * MEGA &&
> pixel_clk <= 300 * MEGA) {
> data_channel_bias = 0x34; /* 20mA */
> clk_channel_bias = 0x2c; /* 16mA */
> impedance_en = 0xf;
> impedance = 0x36; /* 100ohm */
> - } else if (pixel_clk >= 27 * MEGA && pixel_clk < 74.175 *
> MEGA) {
> + } else if (pixel_clk >= 27 * MEGA && ((u64)pixel_clk * 1000)
> < 74175 * MEGA) {
> data_channel_bias = 0x14; /* 10mA */
> clk_channel_bias = 0x14; /* 10mA */
> impedance_en = 0x0;
> --
> 2.27.0
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Thanks
>
WARNING: multiple messages have this Message-ID (diff)
From: "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>
To: "p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"vkoul@kernel.org" <vkoul@kernel.org>,
"trix@redhat.com" <trix@redhat.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"kishon@kernel.org" <kishon@kernel.org>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Cc: "dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] phy: mediatek: rework the floating point comparisons to fixed point
Date: Thu, 4 May 2023 07:53:33 +0000 [thread overview]
Message-ID: <f48580115b4fddf07a1dfabaf240a17d8d712ce9.camel@mediatek.com> (raw)
In-Reply-To: <20230502145005.2927101-1-trix@redhat.com>
On Tue, 2023-05-02 at 10:50 -0400, Tom Rix wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> gcc on aarch64 reports
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c: In function
> ‘mtk_hdmi_pll_set_rate’:
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:240:52: error: ‘-mgeneral-
> regs-only’
> is incompatible with the use of floating-point types
> 240 | else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 *
> MEGA)
>
> Floating point should not be used, so rework the floating point
> comparisons
> to fixed point.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> v2: silence robot by casting types to u64
>
> ---
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> index abfc077fb0a8..093c4d1da557 100644
> --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> @@ -237,11 +237,11 @@ static int mtk_hdmi_pll_calc(struct
> mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
> */
> if (tmds_clk < 54 * MEGA)
> txposdiv = 8;
> - else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 * MEGA)
> + else if (tmds_clk >= 54 * MEGA && (tmds_clk * 100) < 14835 *
> MEGA)
> txposdiv = 4;
> - else if (tmds_clk >= 148.35 * MEGA && tmds_clk < 296.7 *
> MEGA)
> + else if ((tmds_clk * 100) >= 14835 * MEGA && (tmds_clk * 10)
> < 2967 * MEGA)
> txposdiv = 2;
> - else if (tmds_clk >= 296.7 * MEGA && tmds_clk <= 594 * MEGA)
> + else if ((tmds_clk * 10) >= 2967 * MEGA && tmds_clk <= 594 *
> MEGA)
> txposdiv = 1;
> else
> return -EINVAL;
> @@ -328,12 +328,12 @@ static int mtk_hdmi_pll_drv_setting(struct
> clk_hw *hw)
> clk_channel_bias = 0x34; /* 20mA */
> impedance_en = 0xf;
> impedance = 0x36; /* 100ohm */
> - } else if (pixel_clk >= 74.175 * MEGA && pixel_clk <= 300 *
> MEGA) {
> + } else if (((u64)pixel_clk * 1000) >= 74175 * MEGA &&
> pixel_clk <= 300 * MEGA) {
> data_channel_bias = 0x34; /* 20mA */
> clk_channel_bias = 0x2c; /* 16mA */
> impedance_en = 0xf;
> impedance = 0x36; /* 100ohm */
> - } else if (pixel_clk >= 27 * MEGA && pixel_clk < 74.175 *
> MEGA) {
> + } else if (pixel_clk >= 27 * MEGA && ((u64)pixel_clk * 1000)
> < 74175 * MEGA) {
> data_channel_bias = 0x14; /* 10mA */
> clk_channel_bias = 0x14; /* 10mA */
> impedance_en = 0x0;
> --
> 2.27.0
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Thanks
>
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
WARNING: multiple messages have this Message-ID (diff)
From: "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>
To: "p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"vkoul@kernel.org" <vkoul@kernel.org>,
"trix@redhat.com" <trix@redhat.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"kishon@kernel.org" <kishon@kernel.org>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Cc: "dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] phy: mediatek: rework the floating point comparisons to fixed point
Date: Thu, 4 May 2023 07:53:33 +0000 [thread overview]
Message-ID: <f48580115b4fddf07a1dfabaf240a17d8d712ce9.camel@mediatek.com> (raw)
In-Reply-To: <20230502145005.2927101-1-trix@redhat.com>
On Tue, 2023-05-02 at 10:50 -0400, Tom Rix wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> gcc on aarch64 reports
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c: In function
> ‘mtk_hdmi_pll_set_rate’:
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:240:52: error: ‘-mgeneral-
> regs-only’
> is incompatible with the use of floating-point types
> 240 | else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 *
> MEGA)
>
> Floating point should not be used, so rework the floating point
> comparisons
> to fixed point.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> v2: silence robot by casting types to u64
>
> ---
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> index abfc077fb0a8..093c4d1da557 100644
> --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> @@ -237,11 +237,11 @@ static int mtk_hdmi_pll_calc(struct
> mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
> */
> if (tmds_clk < 54 * MEGA)
> txposdiv = 8;
> - else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 * MEGA)
> + else if (tmds_clk >= 54 * MEGA && (tmds_clk * 100) < 14835 *
> MEGA)
> txposdiv = 4;
> - else if (tmds_clk >= 148.35 * MEGA && tmds_clk < 296.7 *
> MEGA)
> + else if ((tmds_clk * 100) >= 14835 * MEGA && (tmds_clk * 10)
> < 2967 * MEGA)
> txposdiv = 2;
> - else if (tmds_clk >= 296.7 * MEGA && tmds_clk <= 594 * MEGA)
> + else if ((tmds_clk * 10) >= 2967 * MEGA && tmds_clk <= 594 *
> MEGA)
> txposdiv = 1;
> else
> return -EINVAL;
> @@ -328,12 +328,12 @@ static int mtk_hdmi_pll_drv_setting(struct
> clk_hw *hw)
> clk_channel_bias = 0x34; /* 20mA */
> impedance_en = 0xf;
> impedance = 0x36; /* 100ohm */
> - } else if (pixel_clk >= 74.175 * MEGA && pixel_clk <= 300 *
> MEGA) {
> + } else if (((u64)pixel_clk * 1000) >= 74175 * MEGA &&
> pixel_clk <= 300 * MEGA) {
> data_channel_bias = 0x34; /* 20mA */
> clk_channel_bias = 0x2c; /* 16mA */
> impedance_en = 0xf;
> impedance = 0x36; /* 100ohm */
> - } else if (pixel_clk >= 27 * MEGA && pixel_clk < 74.175 *
> MEGA) {
> + } else if (pixel_clk >= 27 * MEGA && ((u64)pixel_clk * 1000)
> < 74175 * MEGA) {
> data_channel_bias = 0x14; /* 10mA */
> clk_channel_bias = 0x14; /* 10mA */
> impedance_en = 0x0;
> --
> 2.27.0
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Thanks
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: "Chunfeng Yun (云春峰)" <Chunfeng.Yun@mediatek.com>
To: "p.zabel@pengutronix.de" <p.zabel@pengutronix.de>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"vkoul@kernel.org" <vkoul@kernel.org>,
"trix@redhat.com" <trix@redhat.com>,
"chunkuang.hu@kernel.org" <chunkuang.hu@kernel.org>,
"kishon@kernel.org" <kishon@kernel.org>,
"angelogioacchino.delregno@collabora.com"
<angelogioacchino.delregno@collabora.com>
Cc: "linux-phy@lists.infradead.org" <linux-phy@lists.infradead.org>,
"linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"dri-devel@lists.freedesktop.org"
<dri-devel@lists.freedesktop.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH v2] phy: mediatek: rework the floating point comparisons to fixed point
Date: Thu, 4 May 2023 07:53:33 +0000 [thread overview]
Message-ID: <f48580115b4fddf07a1dfabaf240a17d8d712ce9.camel@mediatek.com> (raw)
In-Reply-To: <20230502145005.2927101-1-trix@redhat.com>
On Tue, 2023-05-02 at 10:50 -0400, Tom Rix wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> gcc on aarch64 reports
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c: In function
> ‘mtk_hdmi_pll_set_rate’:
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c:240:52: error: ‘-mgeneral-
> regs-only’
> is incompatible with the use of floating-point types
> 240 | else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 *
> MEGA)
>
> Floating point should not be used, so rework the floating point
> comparisons
> to fixed point.
>
> Signed-off-by: Tom Rix <trix@redhat.com>
> ---
> v2: silence robot by casting types to u64
>
> ---
> drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c | 10 +++++-----
> 1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> index abfc077fb0a8..093c4d1da557 100644
> --- a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c
> @@ -237,11 +237,11 @@ static int mtk_hdmi_pll_calc(struct
> mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
> */
> if (tmds_clk < 54 * MEGA)
> txposdiv = 8;
> - else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 * MEGA)
> + else if (tmds_clk >= 54 * MEGA && (tmds_clk * 100) < 14835 *
> MEGA)
> txposdiv = 4;
> - else if (tmds_clk >= 148.35 * MEGA && tmds_clk < 296.7 *
> MEGA)
> + else if ((tmds_clk * 100) >= 14835 * MEGA && (tmds_clk * 10)
> < 2967 * MEGA)
> txposdiv = 2;
> - else if (tmds_clk >= 296.7 * MEGA && tmds_clk <= 594 * MEGA)
> + else if ((tmds_clk * 10) >= 2967 * MEGA && tmds_clk <= 594 *
> MEGA)
> txposdiv = 1;
> else
> return -EINVAL;
> @@ -328,12 +328,12 @@ static int mtk_hdmi_pll_drv_setting(struct
> clk_hw *hw)
> clk_channel_bias = 0x34; /* 20mA */
> impedance_en = 0xf;
> impedance = 0x36; /* 100ohm */
> - } else if (pixel_clk >= 74.175 * MEGA && pixel_clk <= 300 *
> MEGA) {
> + } else if (((u64)pixel_clk * 1000) >= 74175 * MEGA &&
> pixel_clk <= 300 * MEGA) {
> data_channel_bias = 0x34; /* 20mA */
> clk_channel_bias = 0x2c; /* 16mA */
> impedance_en = 0xf;
> impedance = 0x36; /* 100ohm */
> - } else if (pixel_clk >= 27 * MEGA && pixel_clk < 74.175 *
> MEGA) {
> + } else if (pixel_clk >= 27 * MEGA && ((u64)pixel_clk * 1000)
> < 74175 * MEGA) {
> data_channel_bias = 0x14; /* 10mA */
> clk_channel_bias = 0x14; /* 10mA */
> impedance_en = 0x0;
> --
> 2.27.0
Reviewed-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Thanks
>
next prev parent reply other threads:[~2023-05-04 7:53 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-02 14:50 [PATCH v2] phy: mediatek: rework the floating point comparisons to fixed point Tom Rix
2023-05-02 14:50 ` Tom Rix
2023-05-02 14:50 ` Tom Rix
2023-05-02 14:50 ` Tom Rix
2023-05-04 7:53 ` Chunfeng Yun (云春峰) [this message]
2023-05-04 7:53 ` Chunfeng Yun (云春峰)
2023-05-04 7:53 ` Chunfeng Yun (云春峰)
2023-05-04 7:53 ` Chunfeng Yun (云春峰)
2023-05-08 8:57 ` Matthias Brugger
2023-05-08 8:57 ` Matthias Brugger
2023-05-08 8:57 ` Matthias Brugger
2023-05-16 14:18 ` Vinod Koul
2023-05-16 14:18 ` Vinod Koul
2023-05-16 14:18 ` Vinod Koul
2023-05-16 14:18 ` Vinod Koul
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=f48580115b4fddf07a1dfabaf240a17d8d712ce9.camel@mediatek.com \
--to=chunfeng.yun@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=chunkuang.hu@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=kishon@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-phy@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=p.zabel@pengutronix.de \
--cc=trix@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.