From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 42335C433F5 for ; Wed, 19 Jan 2022 09:15:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1352946AbiASJPj (ORCPT ); Wed, 19 Jan 2022 04:15:39 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:52226 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1351565AbiASJPg (ORCPT ); Wed, 19 Jan 2022 04:15:36 -0500 X-UUID: 81dcc299fc7240a2ac7cee9a2512f88e-20220119 X-UUID: 81dcc299fc7240a2ac7cee9a2512f88e-20220119 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw02.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1842463282; Wed, 19 Jan 2022 17:15:32 +0800 Received: from mtkcas10.mediatek.inc (172.21.101.39) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Jan 2022 17:15:32 +0800 Received: from mtksdccf07 (172.21.84.99) by mtkcas10.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Jan 2022 17:15:32 +0800 Message-ID: Subject: Re: [PATCH v7 5/8] drm/mediatek: dpi: Add dpintf support From: CK Hu To: Guillaume Ranquet , Chun-Kuang Hu , Philipp Zabel , "David Airlie" , Daniel Vetter , "Matthias Brugger" CC: , , "Markus Schneider-Pargmann" , , , AngeloGioacchino Del Regno Date: Wed, 19 Jan 2022 17:15:31 +0800 In-Reply-To: <20211217150854.2081-6-granquet@baylibre.com> References: <20211217150854.2081-1-granquet@baylibre.com> <20211217150854.2081-6-granquet@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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Guillaume: On Fri, 2021-12-17 at 16:08 +0100, Guillaume Ranquet wrote: > From: Markus Schneider-Pargmann > > dpintf is the displayport interface hardware unit. This unit is > similar > to dpi and can reuse most of the code. > > This patch adds support for mt8195-dpintf to this dpi driver. Main > differences are: > - Some features/functional components are not available for dpintf > which are now excluded from code execution once is_dpintf is set > - dpintf can and needs to choose between different clockdividers > based > on the clockspeed. This is done by choosing a different clock > parent. > - There are two additional clocks that need to be managed. These are > only set for dpintf and will be set to NULL if not supplied. The > clk_* calls handle these as normal clocks then. > - Some register contents differ slightly between the two components. > To > work around this I added register bits/masks with a DPINTF_ prefix > and use them where different. > > Based on a separate driver for dpintf created by > Jason-JH.Lin . > > Signed-off-by: Markus Schneider-Pargmann > Signed-off-by: Guillaume Ranquet > Reviewed-by: AngeloGioacchino Del Regno < > angelogioacchino.delregno@collabora.com> > --- > drivers/gpu/drm/mediatek/mtk_dpi.c | 304 ++++++++++++++++ > ---- > drivers/gpu/drm/mediatek/mtk_dpi_regs.h | 38 +++ > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 4 + > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 1 + > drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 +- > include/linux/soc/mediatek/mtk-mmsys.h | 2 + > 6 files changed, 299 insertions(+), 55 deletions(-) > > diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c > b/drivers/gpu/drm/mediatek/mtk_dpi.c > index 4554e2de14309..fbc43ea4049b9 100644 > --- a/drivers/gpu/drm/mediatek/mtk_dpi.c > +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c > @@ -63,6 +63,14 @@ enum mtk_dpi_out_color_format { > MTK_DPI_COLOR_FORMAT_YCBCR_422_FULL > }; > > +enum TVDPLL_CLK { > + TVDPLL_PLL = 0, > + TVDPLL_D2 = 2, > + TVDPLL_D4 = 4, > + TVDPLL_D8 = 8, > + TVDPLL_D16 = 16, > +}; > + > struct mtk_dpi { > struct drm_encoder encoder; > struct drm_bridge bridge; > @@ -71,8 +79,10 @@ struct mtk_dpi { > void __iomem *regs; > struct device *dev; > struct clk *engine_clk; > + struct clk *dpi_ck_cg; > struct clk *pixel_clk; > struct clk *tvd_clk; > + struct clk *pclk_src[5]; > int irq; > struct drm_display_mode mode; > const struct mtk_dpi_conf *conf; > @@ -125,6 +135,18 @@ struct mtk_dpi_conf { > bool edge_sel_en; > const u32 *output_fmts; > u32 num_output_fmts; > + bool is_ck_de_pol; Seperate is_ck_de_pol to an independent patch. > + bool is_dpintf; Ditto for is_dpintf. And I would like change the name to what this actually do. > + bool csc_support; Ditto for csc_support. > + bool swap_input_support; Ditto for swap_input_support. > + // Mask used for HWIDTH, HPORCH, VSYNC_WIDTH and VSYNC_PORCH /* ... */ > (no shift) > + u32 dimension_mask; Ditto for dimension_mask. > + // Mask used for HSIZE and VSIZE (no shift) > + u32 hvsize_mask; Ditto for hvsize_mask. > + u32 channel_swap_shift; Ditto for channel_swap_shift. > + u32 yuv422_en_bit; Ditto for yuv422_en_bit. > + u32 csc_enable_bit; Ditto for csc_enable_bit. > + const struct mtk_dpi_yc_limit *limit; Ditto for limit. > }; > > > + > +static const struct mtk_dpi_conf mt8195_dpintf_conf = { > + .cal_factor = mt8195_dpintf_calculate_factor, > + .output_fmts = mt8195_output_fmts, > + .num_output_fmts = ARRAY_SIZE(mt8195_output_fmts), > + .is_dpintf = true, > + .csc_support = true, For every SoC, csc_support is true. Why do we need csc_support? Regards, CK > + .dimension_mask = DPINTF_HPW_MASK, > + .hvsize_mask = DPINTF_HSIZE_MASK, > + .channel_swap_shift = DPINTF_CH_SWAP, > + .yuv422_en_bit = DPINTF_YUV422_EN, > + .csc_enable_bit = DPINTF_CSC_ENABLE, > + .limit = &mtk_dpintf_limit, > }; > >