From patchwork Tue May 2 14:50:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Tom Rix X-Patchwork-Id: 13229020 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5A081C77B73 for ; Tue, 2 May 2023 14:51:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=67CS+Wk0i/vpYsWPHhcltR5ZAhQfGOs/rjWzI5Dqz/Q=; b=crOwharv4CnSoE +093qTKyaiPuyoPdTaAYT2gbbhmexT/nn1IScn7x8iezhYYIaaKkn8FxVqfETuswOI1SIobAMmNem uvF9ZHUlEC01tMYvDHRVrNIs5opb2KuC3bbvSpouWzYqPgfa3ita7oyuuYTr4QTzx/eOCOMiwbQpq O2hVD1YGhcp/v9PIMcAxIYL9DimNVbRzOUqFMrmSAscBN7w/x9nC2CSXidubt1b1AoBo8SD36EAfF F6O/s9Va9em9W6UeikNAKcXKxauPFJiNczcFVQEX50/0QVP7BwR//Mf2MndI4Y3bmGrMumYFvLK0U NmDPYpNBbUvwKdZ5IIiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1ptrKt-001rfN-1n; Tue, 02 May 2023 14:50:35 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1ptrKp-001rdq-2r for linux-arm-kernel@lists.infradead.org; Tue, 02 May 2023 14:50:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1683039031; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=XhmeR7C2zfghm/IL/as+Y+pN51ISJ3AaRZIBkHirVVA=; b=ReogE1tRL3zCIJC15LNKjVricTSNF5CnIKFpYryB2yMXD1Pj/gECuA0V7rHrGpkJInZyby CkNOOvg0a8OFzZsc9hQn+w3+NDhuvS3Ii39G7+e8ua0b2xPpklGTL6Y9MMA+s8n6yKeiGP Q7hnKgeGjurQS3ZjCXmkMMXXZWrm4yE= Received: from mail-qt1-f200.google.com (mail-qt1-f200.google.com [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-93-8yPmrqzcOMyLC0qZiA1-7w-1; Tue, 02 May 2023 10:50:27 -0400 X-MC-Unique: 8yPmrqzcOMyLC0qZiA1-7w-1 Received: by mail-qt1-f200.google.com with SMTP id d75a77b69052e-3f060b8b39cso20888991cf.2 for ; Tue, 02 May 2023 07:50:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683039027; x=1685631027; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XhmeR7C2zfghm/IL/as+Y+pN51ISJ3AaRZIBkHirVVA=; b=jA3+5BCGPDAfXjeqtFchY1SoeO0Zqjh5eR2r5bRr2wAo1LQuxsqToVX5UFbWnuGBlm LwLs18+LjK/4/ddtlqrySsCyiLITmd+MYY/hEkeYuw6asU9nQM6BkpN06A7ESi35w/GK UoDTOCR4ZjCNaHTPFKNRl/iFVPralU1s315HCtw1dH6j3rtI3Sm35ZxIQ1HPZI4HBmcM EmbX2QQwtiTFJoMB8KG1gU3DjV5STOJm19dfYjxmFlLfB+cXubLuJQtsjTcfY8gdtg20 YeiNvRzW2yBsAEJK9d4BoKpl3X6uq+UIjFsx60FWfZ8si6Tgt6bULGXOo2ENtaGcpiI+ h0VA== X-Gm-Message-State: AC+VfDxMM5KpFEw3XmbIz5w9AFJQoJncVX/QNDsSHCRttKzOlDZdI1TQ dCvhchhj0O15vsRniHL5SPAwUIUbPzvddiGFvsaQHQOHH1W1FzNRiNVTxMH+ffcVWl5MqIUOjCb rYnoMLrx0oijkemj4njgOfQdGTj9U4dyzA6M= X-Received: by 2002:a05:622a:143:b0:3ea:bec4:ef57 with SMTP id v3-20020a05622a014300b003eabec4ef57mr28954463qtw.13.1683039027418; Tue, 02 May 2023 07:50:27 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4dHp9unnIVk0+Doy1XuqLSB0Po7DZSJ94Ylm3eZ5tLIvbR2wMADu2J7HkOiAWMy91uB3Mwgg== X-Received: by 2002:a05:622a:143:b0:3ea:bec4:ef57 with SMTP id v3-20020a05622a014300b003eabec4ef57mr28954428qtw.13.1683039027172; Tue, 02 May 2023 07:50:27 -0700 (PDT) Received: from dell-per740-01.7a2m.lab.eng.bos.redhat.com (nat-pool-bos-t.redhat.com. [66.187.233.206]) by smtp.gmail.com with ESMTPSA id g7-20020ac81247000000b003ef3bbd242asm10343812qtj.32.2023.05.02.07.50.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 May 2023 07:50:26 -0700 (PDT) From: Tom Rix To: chunkuang.hu@kernel.org, p.zabel@pengutronix.de, chunfeng.yun@mediatek.com, vkoul@kernel.org, kishon@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com Cc: dri-devel@lists.freedesktop.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, linux-kernel@vger.kernel.org, Tom Rix Subject: [PATCH v2] phy: mediatek: rework the floating point comparisons to fixed point Date: Tue, 2 May 2023 10:50:05 -0400 Message-Id: <20230502145005.2927101-1-trix@redhat.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230502_075031_996556_6253EF7E X-CRM114-Status: GOOD ( 13.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Reviewed-by: Chunfeng Yun --- 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;