Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5116749img; Wed, 27 Mar 2019 02:21:55 -0700 (PDT) X-Google-Smtp-Source: APXvYqyO8183emh7mFv8BM4r1bkNZTNFhymJGrPoOpYVbyxoL1gT5AgIvFMUI/Clsd9itcrcUgXX X-Received: by 2002:a17:902:a511:: with SMTP id s17mr35411240plq.262.1553678515544; Wed, 27 Mar 2019 02:21:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553678515; cv=none; d=google.com; s=arc-20160816; b=SuwBe+iSq9Imo/ld5xpTs4NTs7fpMpSVXDF8hragVWqEz8o8sLKNGmcNyGDCcK3czK PyP+6aD2NEuMhjzMHe75X0nCENhJ4P2B0xLF6lRv8HfzasQfUZInJ1O5U5KaxvyBSZ+M Wbhk7e/SVL14uj9ddj3AsOGgAmn8k4LyfIMEzYEAMkXdUAc1MnoaIxn5PkMNOV/mzkp7 /wkKDirbE5itI5OxINQUNZRvkvJyutaK/oP7ybG4vt5SC9z5iKX4LUQXRecDbz/RXHCa z8hiHUpX56brlXOOZy//jLgvDYhYpPq8fbRUMfm0INrZb+wyrO2gBOGwfQFSRf58gzNZ 3hZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=J6NPWslwtyIBPiyNHICokhWoXmqBWP9qdrLLKkA2Nuk=; b=fMcqhKOTKlL5lQmWvZn3xOL2xZ7DGzth79Mz9x4PduggYAEA2OFLIK8wZoJSrYogIB f2ynjNfS77ToAtU+U+Jb3LyaWADzssuFqOukxblAkjYeKeNGShVWJIwijr/ocDPnRdS4 cGxMV1TW2hi2f8bPl23N+wXX2baKBYg4/3nczv0b4COPSkrv8TTqFcr1/4vRuF5AjoGC tbU6jTJo/4Crq++C9uziEg5qcTVMz4rrEeCY7jpkbe2xTU4qqpS4KDzBnevQ1L0o4f2v 1wVzas+GGarjyehnEoY2ndg8DEXN2Z7rLTMANrXoPGYLyRGjPF41EdaG1RI5KkHUCML3 LJzw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w11si7569529pge.187.2019.03.27.02.21.40; Wed, 27 Mar 2019 02:21:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732891AbfC0JUO (ORCPT + 99 others); Wed, 27 Mar 2019 05:20:14 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:33878 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1732224AbfC0JUN (ORCPT ); Wed, 27 Mar 2019 05:20:13 -0400 X-UUID: b66a57cad7d44bb48ac11ffa5b13f976-20190327 X-UUID: b66a57cad7d44bb48ac11ffa5b13f976-20190327 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 528647066; Wed, 27 Mar 2019 17:20:10 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS33N1.mediatek.inc (172.27.4.75) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 17:20:08 +0800 Received: from mszsdclx1067.gcn.mediatek.inc (172.27.4.253) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Mar 2019 17:20:07 +0800 From: wangyan wang To: Michael Turquette , Stephen Boyd , CK Hu CC: wangyan wang , Matthias Brugger , Philipp Zabel , David Airlie , Daniel Vetter , chunhui dai , Colin Ian King , Sean Wang , Ryder Lee , , , , , , Subject: [PATCH V7 6/6] drm/mediatek: fix the rate of parent for hdmi phy in MT2701 Date: Wed, 27 Mar 2019 17:19:29 +0800 Message-ID: <20190327091929.73162-7-wangyan.wang@mediatek.com> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20190327091929.73162-1-wangyan.wang@mediatek.com> References: <20190327091929.73162-1-wangyan.wang@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: chunhui dai We should not change the rate of parent for hdmi phy when doing round_rate for this clock. The parent clock of hdmi phy must be the same as it. We change it when doing set_rate only. Signed-off-by: chunhui dai Signed-off-by: wangyan wang --- drivers/gpu/drm/mediatek/mtk_hdmi_phy.c | 19 ------------------- drivers/gpu/drm/mediatek/mtk_hdmi_phy.h | 4 ---- drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c | 7 +++++++ drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c index 370309d684ec..f753ee72971e 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c @@ -15,25 +15,6 @@ static const struct phy_ops mtk_hdmi_phy_dev_ops = { .owner = THIS_MODULE, }; -long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate) -{ - struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); - - hdmi_phy->pll_rate = rate; - if (rate <= 74250000) - *parent_rate = rate; - else - *parent_rate = rate / 2; - - return rate; -} - -u32 mtk_hdmi_phy_read(struct mtk_hdmi_phy *hdmi_phy, u32 offset) -{ - return readl(hdmi_phy->regs + offset); -} - void mtk_hdmi_phy_clear_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, u32 bits) { diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h index 446e2acd1926..4d4de4de8977 100644 --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h @@ -42,7 +42,6 @@ struct mtk_hdmi_phy { unsigned int ibias_up; }; -u32 mtk_hdmi_phy_read(struct mtk_hdmi_phy *hdmi_phy, u32 offset); void mtk_hdmi_phy_clear_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, u32 bits); void mtk_hdmi_phy_set_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, @@ -50,9 +49,6 @@ void mtk_hdmi_phy_set_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset, void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 offset, u32 val, u32 mask); struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw); -long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, - unsigned long *parent_rate); - extern struct platform_driver mtk_hdmi_phy_driver; extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf; extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf; diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c index cb0c68c94013..6fb4ca943463 100644 --- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c +++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c @@ -152,6 +152,13 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, RG_HDMITX_DRV_IBIAS_MASK); return 0; } + +static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, + unsigned long *parent_rate) +{ + return rate; +} + static unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { diff --git a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c index 63dde42521b8..3a339f516613 100644 --- a/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c +++ b/drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c @@ -285,6 +285,20 @@ static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate, return 0; } +static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate, + unsigned long *parent_rate) +{ + struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw); + + hdmi_phy->pll_rate = rate; + if (rate <= 74250000) + *parent_rate = rate; + else + *parent_rate = rate / 2; + + return rate; +} + static unsigned long mtk_hdmi_pll_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { -- 2.14.1