Skip to content

Commit 03262a3

Browse files
Tom Rixvinodkoul
authored andcommitted
phy: mediatek: rework the floating point comparisons to fixed point
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 <[email protected]> Reviewed-by: Chunfeng Yun <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent e42f110 commit 03262a3

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,11 @@ static int mtk_hdmi_pll_calc(struct mtk_hdmi_phy *hdmi_phy, struct clk_hw *hw,
237237
*/
238238
if (tmds_clk < 54 * MEGA)
239239
txposdiv = 8;
240-
else if (tmds_clk >= 54 * MEGA && tmds_clk < 148.35 * MEGA)
240+
else if (tmds_clk >= 54 * MEGA && (tmds_clk * 100) < 14835 * MEGA)
241241
txposdiv = 4;
242-
else if (tmds_clk >= 148.35 * MEGA && tmds_clk < 296.7 * MEGA)
242+
else if ((tmds_clk * 100) >= 14835 * MEGA && (tmds_clk * 10) < 2967 * MEGA)
243243
txposdiv = 2;
244-
else if (tmds_clk >= 296.7 * MEGA && tmds_clk <= 594 * MEGA)
244+
else if ((tmds_clk * 10) >= 2967 * MEGA && tmds_clk <= 594 * MEGA)
245245
txposdiv = 1;
246246
else
247247
return -EINVAL;
@@ -324,12 +324,12 @@ static int mtk_hdmi_pll_drv_setting(struct clk_hw *hw)
324324
clk_channel_bias = 0x34; /* 20mA */
325325
impedance_en = 0xf;
326326
impedance = 0x36; /* 100ohm */
327-
} else if (pixel_clk >= 74.175 * MEGA && pixel_clk <= 300 * MEGA) {
327+
} else if (((u64)pixel_clk * 1000) >= 74175 * MEGA && pixel_clk <= 300 * MEGA) {
328328
data_channel_bias = 0x34; /* 20mA */
329329
clk_channel_bias = 0x2c; /* 16mA */
330330
impedance_en = 0xf;
331331
impedance = 0x36; /* 100ohm */
332-
} else if (pixel_clk >= 27 * MEGA && pixel_clk < 74.175 * MEGA) {
332+
} else if (pixel_clk >= 27 * MEGA && ((u64)pixel_clk * 1000) < 74175 * MEGA) {
333333
data_channel_bias = 0x14; /* 10mA */
334334
clk_channel_bias = 0x14; /* 10mA */
335335
impedance_en = 0x0;

0 commit comments

Comments
 (0)