Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp505170rwb; Wed, 28 Sep 2022 05:48:37 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5d/MaYHUkJ/KwwmmDFPlwPYfmAun78l+y1N/C1NDAGBvc29ZI9NHJSj37l/rjQb/HrXCsB X-Received: by 2002:a65:498b:0:b0:412:8e4:2842 with SMTP id r11-20020a65498b000000b0041208e42842mr29271466pgs.71.1664369316718; Wed, 28 Sep 2022 05:48:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664369316; cv=none; d=google.com; s=arc-20160816; b=eGJGtlBi5qAOuJBvWkF1GsElFnq75ww2X6mxPo8pqEyukxhPA/Nc2QzSkhcFW3FAhB kQo7rpB487Wxn0MWgBoG/DZVe4KndpAHqY9uHIpsKGtE1b4ZFeY38k80A3hRrTTY3Ldo KC2Vb5Fq6luUUQpsAzrXteBdSpGCPRk/8mHRuNdwt+47VidVhA7huR8/seaNcfVWoKK1 eMfrL0icGoYLsBGASfHmmtVI3+6gWrw7pLPIVH2Hy1AFz56P729EkkRlzzz67TB/UNFK 6vhd5jhd9OeiIaMH6XRtnyxncr+V7mBtZvJ+H1OSaBsliSbNJPeUwvil+d8gfpf0oYL3 uMvA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:mime-version :in-reply-to:references:user-agent:from:dkim-signature; bh=Swb7XVMS5l4jVs+taUaFHDZniMnQe0LrNo5JVaq+smE=; b=S3ufIMZU7OkTfMzarOsBuHcFuYx97GUXqPXl5+hjE8XXyPA4WSMSs1S0cOBM7EVljL kVBW9Brk2O1fLtmoij6l9KnJICWV3eFVI9IKmGsnIuYjN6bt/HwbP/bLC5F6g2c9zYPE 0B4tG9jY0JBaOJUIXaxvKC/vFkPhO8irKLJ9BZiu0DOoLTOFPvYyYrKycsq+vBdHZmNp WVeZzKYfFoR9LVwtkDK+E1xJLkgnOnaIWlKZYT3/glyh62ZdCuLo5Chzzgon9HQAbY9/ Hv6kRfrYblFWbFjYWwpoTC7sGbvTL30rjR4eG976gUkMgRYqcad+zfDb4HnQinnv/atu nK/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=c7CWUAsf; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bd12-20020a170902830c00b001782da3312asi5063511plb.299.2022.09.28.05.48.24; Wed, 28 Sep 2022 05:48:36 -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=@baylibre-com.20210112.gappssmtp.com header.s=20210112 header.b=c7CWUAsf; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233408AbiI1MXw (ORCPT + 99 others); Wed, 28 Sep 2022 08:23:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233350AbiI1MXv (ORCPT ); Wed, 28 Sep 2022 08:23:51 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8F8E87090 for ; Wed, 28 Sep 2022 05:23:48 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id z4so2291466lft.2 for ; Wed, 28 Sep 2022 05:23:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20210112.gappssmtp.com; s=20210112; h=cc:to:subject:message-id:date:mime-version:in-reply-to:references :user-agent:from:from:to:cc:subject:date; bh=Swb7XVMS5l4jVs+taUaFHDZniMnQe0LrNo5JVaq+smE=; b=c7CWUAsfmp+EUrBbsuVwHuXZYgfW2HVC0Li9FEyeBNVz54UBKlH/LwX+eoHjrw/RhN HgS0dnWmAJwxifOaPqgR6tmTb84kzSWbrL9exeYtUY0fduYToLJfXsgj6MPghccx5j+M 455J5Z9jH0S3XuLMki862MI98Ona3zIEpM/bACfbyA19QAIoYxKwCSLRj+rD8+kAIr3o 7HxESQA5LojmCE8FnZPaLunR8pN4t1Txi2JgQDvgZFhWprO8gHUPQ4datyPbLQ9eBa35 gbCYiQHE5tolljp0ZvNeexs29IETA3U2U2YvnLz27nJDLCzvEV87zs2Bq8knrfW2sb7q tZBw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:mime-version:in-reply-to:references :user-agent:from:x-gm-message-state:from:to:cc:subject:date; bh=Swb7XVMS5l4jVs+taUaFHDZniMnQe0LrNo5JVaq+smE=; b=FManlWDjXmsJ2+WdZBI49M63v8Aq6Nyw1nD30bGMzOPU78hqcb2cfe/I7fH+VTCv+F rQSxIThxIvWaaB/H+HHkkWxCnb6FIwgAwUe7nMod7uH0okAG1McV4an0A+L6VQcUMCFI qMNTxmbxML6NpRVj4kiMecTJsCWqPmXmrp1MpgQ3wyGzOtYaIRaSTbNlOq0sDtixLKMH QLVbLpaLPxqja59uFcUI8t7ygcEuJDQoE54+wnnRG0edxSHXg93PomFq18dkFR4C9y0D ST4sT0wtfPN13NPo40d4uYYG6gmCL27uvmtxvBpf6h7nOgNLBY3lUTL7SFGSiC0qpZK5 1OBQ== X-Gm-Message-State: ACrzQf2hYTZWuuQ8hWgiDBYbqzVJAzgrg3PLPGxN4TDpOu1iHjVOjK7M 6miIRpK1lzS02qShFxJ4IEOQWLW8RfrQJn568/9gKw== X-Received: by 2002:a05:6512:5d7:b0:498:f521:e143 with SMTP id o23-20020a05651205d700b00498f521e143mr12968086lfo.617.1664367826958; Wed, 28 Sep 2022 05:23:46 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Wed, 28 Sep 2022 05:23:43 -0700 From: Guillaume Ranquet User-Agent: meli 0.7.2 References: <20220919-v1-0-4844816c9808@baylibre.com> <20220919-v1-14-4844816c9808@baylibre.com> In-Reply-To: MIME-Version: 1.0 Date: Wed, 28 Sep 2022 05:23:43 -0700 Message-ID: Subject: Re: [PATCH v1 14/17] phy: mediatek: add support for phy-mtk-hdmi-mt8195 To: Chunfeng Yun , Kishon Vijay Abraham I , 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 Cc: linux-mediatek@lists.infradead.org, dri-devel@lists.freedesktop.org, Pablo Sun , linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, Mattijs Korpershoek , linux-arm-kernel@lists.infradead.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 Wed, 28 Sep 2022 04:40, Chunfeng Yun wrote: >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 > > Hi, Thank you for the headsup, I've seen the change landed in next-20220927 on which I'm currently rebasing. Thx, Guillaume.