Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1829904rwb; Tue, 27 Sep 2022 20:08:02 -0700 (PDT) X-Google-Smtp-Source: AMsMyM42138PBIHERD1C4OsCMSmBqKQ5KUxBLVP0NmP6K9gV0fK7QeBAdJ44VrQiHOmWvEpKhSzP X-Received: by 2002:a05:6a00:1a44:b0:52a:ecd5:bbef with SMTP id h4-20020a056a001a4400b0052aecd5bbefmr31834014pfv.28.1664334482142; Tue, 27 Sep 2022 20:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664334482; cv=none; d=google.com; s=arc-20160816; b=fXl89TwVDv7Vpl3sNebD5lvSh3oM9tmnDVjbB0sGKv5oJE6cTUFuQP+K21fIg0LN5o TY+XEFsajqUks5fcOKR3A1U1JYcZ5/OwN/InNuiLA1hiufdTn8HCXGysGv0DfMiRib+M ymlBPisUWxxKrMSiXlTehjtM60ztNGJt5VSsvQ6I4o0iMgGVMb1z5iOyu8EHuB5sbpHV 50V9SZguBz2Y5Ehvx9kpEY7PCuzE/tUPbHP2FMl0m6NXkdWNgQg7aLti+8qIoJ3DCh9q SXuBuIwh1obK46dA2iIdu4umW/u9JCeKZqjQRk2Sc8MShUlnbgK5XS9taqB7AgrOruYZ Q+oQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id :dkim-signature; bh=zoVsh+lBpo2kny9dOeVB7K/RKMo8E8eyudzqFaV/N2w=; b=CqobthUQAlZI1EuakVUOsmIafRRE9XwJAm5DuLL8MZmWUVTFI2apP8R24JvzBJzffA y8ObBax33zLfoIDL0jBkb4/UUkySpkZ1Bo2NjWSLohwn6ardZN9gc3ZJ+z0ij/iVBWqr gQLBLAjnZRqd2LyC0bxZiVWYIxrhczyOw/UVXYIC/xz2O6F49sjV2U6YG2ThYEpvY2jW WV0Aez/uqW+h/TLkSxnOgujVvCi+skQdnX9mg5cTADYGht2KBpKGXMZSA8DzkE/cIUVm BxHM7X2O+gcmKP/CkS8ShvwZOzb2XaX62t8L5/1pgFAU1/bIVJK+k2mTZG8IWHJ8rgDb og8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=HMLzuwVh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c1-20020a637241000000b00439a5dfc485si4192729pgn.357.2022.09.27.20.07.49; Tue, 27 Sep 2022 20:08:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@mediatek.com header.s=dk header.b=HMLzuwVh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231986AbiI1ClL (ORCPT + 99 others); Tue, 27 Sep 2022 22:41:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231684AbiI1ClH (ORCPT ); Tue, 27 Sep 2022 22:41:07 -0400 Received: from mailgw02.mediatek.com (unknown [210.61.82.184]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F09C10253C; Tue, 27 Sep 2022 19:41:04 -0700 (PDT) X-UUID: 0116d708030d4f4794d5bae4c99aee36-20220928 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:MIME-Version:Content-Type:References:In-Reply-To:Date:CC:To:From:Subject:Message-ID; bh=zoVsh+lBpo2kny9dOeVB7K/RKMo8E8eyudzqFaV/N2w=; b=HMLzuwVhQUv9fun+rv1k2zOt8bo+rAt3MGJQgaJsh3/LQWZY5q4MYAQK9Tb8kPs2uO7MGhsc4Ng0MfdA2/DS21g/8mypnT4pbxo7kRU9Xp2Mr90rD6eSXDhvBt0I82rYylp75lxcHcUf7JT7jb5wF4iFjbgHtS2aej+iB4jFjXw=; X-CID-P-RULE: Release_Ham X-CID-O-INFO: VERSION:1.1.11,REQID:73bf7f0f-e40b-4efc-a84c-afd2fc491e7f,IP:0,U RL:0,TC:0,Content:0,EDM:0,RT:0,SF:0,FILE:0,BULK:0,RULE:Release_Ham,ACTION: release,TS:0 X-CID-META: VersionHash:39a5ff1,CLOUDID:6faf73e4-87f9-4bb0-97b6-34957dc0fbbe,B ulkID:nil,BulkQuantity:0,Recheck:0,SF:102,TC:nil,Content:0,EDM:-3,IP:nil,U RL:11|1,File:nil,Bulk:nil,QS:nil,BEC:nil,COL:0 X-UUID: 0116d708030d4f4794d5bae4c99aee36-20220928 Received: from mtkexhb02.mediatek.inc [(172.21.101.103)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1773477499; Wed, 28 Sep 2022 10:41:01 +0800 Received: from mtkcas11.mediatek.inc (172.21.101.40) by mtkmbs11n1.mediatek.inc (172.21.101.185) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.2.792.15; Wed, 28 Sep 2022 10:41:00 +0800 Received: from mhfsdcap04 (10.17.3.154) by mtkcas11.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 28 Sep 2022 10:40:59 +0800 Message-ID: Subject: Re: [PATCH v1 14/17] phy: mediatek: add support for phy-mtk-hdmi-mt8195 From: Chunfeng Yun To: Guillaume Ranquet , Matthias Brugger , Vinod Koul , Stephen Boyd , David Airlie , Rob Herring , Philipp Zabel , "Krzysztof Kozlowski" , Daniel Vetter , CK Hu , Jitao shi , Chun-Kuang Hu , "Michael Turquette" , Kishon Vijay Abraham I CC: , , Pablo Sun , , , Mattijs Korpershoek , , , Date: Wed, 28 Sep 2022 10:40:59 +0800 In-Reply-To: References: <20220919-v1-0-4844816c9808@baylibre.com> <20220919-v1-14-4844816c9808@baylibre.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5-0ubuntu0.18.04.2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-MTK: N X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS, SPF_PASS,UNPARSEABLE_RELAY,URIBL_CSS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2022-09-27 at 06:23 -0700, Guillaume Ranquet wrote: > On Tue, 20 Sep 2022 09:46, Chunfeng Yun > wrote: > > On Mon, 2022-09-19 at 18:56 +0200, Guillaume Ranquet wrote: > > > Add basic support for the mediatek hdmi phy on MT8195 SoC > > > > > > Signed-off-by: Guillaume Ranquet > > > > > > diff --git a/drivers/gpu/drm/mediatek/mtk_mt8195_hdmi.c > > > b/drivers/gpu/drm/mediatek/mtk_mt8195_hdmi.c > > > index bb7593ea4c86..0157acdce56c 100644 > > > --- a/drivers/gpu/drm/mediatek/mtk_mt8195_hdmi.c > > > +++ b/drivers/gpu/drm/mediatek/mtk_mt8195_hdmi.c > > > @@ -1344,6 +1344,8 @@ static void mtk_hdmi_bridge_disable(struct > > > drm_bridge *bridge, > > > mtk_hdmi_disable_hdcp_encrypt(hdmi); > > > usleep_range(50000, 50050); > > > > > > + phy_power_off(hdmi->phy); > > > + > > > hdmi->enabled = false; > > > } > > > > > > diff --git a/drivers/phy/mediatek/Makefile > > > b/drivers/phy/mediatek/Makefile > > > index fb1f8edaffa7..c9a50395533e 100644 > > > --- a/drivers/phy/mediatek/Makefile > > > +++ b/drivers/phy/mediatek/Makefile > > > @@ -12,6 +12,7 @@ obj-$(CONFIG_PHY_MTK_XSPHY) += phy- > > > mtk- > > > xsphy.o > > > phy-mtk-hdmi-drv-y := phy-mtk-hdmi.o > > > phy-mtk-hdmi-drv-y += phy-mtk-hdmi- > > > mt2701.o > > > phy-mtk-hdmi-drv-y += phy-mtk-hdmi- > > > mt8173.o > > > +phy-mtk-hdmi-drv-y += phy-mtk-hdmi- > > > mt8195.o > > > obj-$(CONFIG_PHY_MTK_HDMI) += phy-mtk-hdmi-drv.o > > > > > > phy-mtk-mipi-dsi-drv-y := phy-mtk-mipi-dsi.o > > > diff --git a/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c > > > b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c > > > new file mode 100644 > > > index 000000000000..149015b64c02 > > > --- /dev/null > > > +++ b/drivers/phy/mediatek/phy-mtk-hdmi-mt8195.c > > > @@ -0,0 +1,673 @@ > > > +// SPDX-License-Identifier: GPL-2.0 > > > +/* > > > + * Copyright (c) 2021 MediaTek Inc. > > > + * Copyright (c) 2021 BayLibre, SAS > > > + */ > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > +#include > > > + > > > +#include "phy-mtk-hdmi.h" > > > +#include "phy-mtk-hdmi-mt8195.h" > > > + > > > +static void mtk_hdmi_ana_fifo_en(struct mtk_hdmi_phy *hdmi_phy) > > > +{ > > > + /* make data fifo writable for hdmi2.0 */ > > > + mtk_hdmi_phy_mask(hdmi_phy, HDMI_ANA_CTL, > > > REG_ANA_HDMI20_FIFO_EN, > > > + REG_ANA_HDMI20_FIFO_EN); > > > +} > > > + > > > +static void > > > +mtk_mt8195_phy_tmds_high_bit_clk_ratio(struct mtk_hdmi_phy > > > *hdmi_phy, > > > + bool enable) > > > +{ > > > + mtk_hdmi_ana_fifo_en(hdmi_phy); > > > + > > > + /* HDMI 2.0 specification, 3.4Gbps <= TMDS Bit Rate <= 6G, > > > + * clock bit ratio 1:40, under 3.4Gbps, clock bit ratio 1:10 > > > + */ > > > + if (enable) > > > + mtk_hdmi_phy_mask(hdmi_phy, HDMI20_CLK_CFG, > > > + 0x2 << REG_TXC_DIV_SHIFT, > > > > Use FIELD_PREP() macro, then no need define REG_TXC_DIV_SHIFT > > anymore. > > > > Didn't know about FIELD_* macros, will use them for V2. > > Thx for the suggestion. Please use helpers defined in phy-mtk-io.h, the register access helpers of mtk_hdmi_phy_* are already removed in phy next branch. Thanks a lot