From patchwork Fri Feb 25 09:53:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WGlubGVpIExlZSAo5p2O5piV56OKKQ==?= X-Patchwork-Id: 12759999 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 CCF3CC433EF for ; Fri, 25 Feb 2022 09:55:24 +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:References:In-Reply-To: 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: List-Owner; bh=osi+5ZCSDmLV81RpDZ7mKzWv0OvKEAFFo7CL0og59J8=; b=JNlRO7zcHbrfzA eiRGHDBOl5TYRsWDcqfUCyPOL1FE7ojuyXSJBIHGL2IIFAdfdq7dO2cOQsxbZllnKfLqauG94J5DL KiqDidg+pCDJIuWqC0Z8Ol8iRE4PlRam/fvKneNwNvm6n/IkCL9f7Xcf0Cel+P1oKXzlBOCeMGSft JiwDIi9Q3jEWLAYGYdZ4i3YbDbt9eV+mNZlqjkqYHaYsPXLszJGa4/w+RE2Vg6bD8/bE97g3DWQEr Jv92Hnn8CCSBjwg+ByfWtLtPuzbRXFWQdIoxpao3XcYEbXJgaXABA88cItq1ECe9y9DaZD45myHYx tkejpaeZiT5zHRe651fQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNXIr-004EYJ-UA; Fri, 25 Feb 2022 09:54:22 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNXIf-004ESP-82; Fri, 25 Feb 2022 09:54:10 +0000 X-UUID: 652cca462ee54166ab889167ee07942b-20220225 X-UUID: 652cca462ee54166ab889167ee07942b-20220225 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1878074274; Fri, 25 Feb 2022 02:54:04 -0700 Received: from MTKMBS34N1.mediatek.inc (172.27.4.172) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 25 Feb 2022 01:54:02 -0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS34N1.mediatek.inc (172.27.4.172) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 25 Feb 2022 17:54:00 +0800 Received: from mszsdaap41.gcn.mediatek.inc (10.16.6.141) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 25 Feb 2022 17:53:58 +0800 From: To: , , , , CC: , , , , , , , , Xinlei Lee Subject: [PATCH v1, 1/3] dt-bindings: display: mediatek: dpi: Add compatible for MediaTek MT8186 Date: Fri, 25 Feb 2022 17:53:51 +0800 Message-ID: <1645782833-27875-2-git-send-email-xinlei.lee@mediatek.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1645782833-27875-1-git-send-email-xinlei.lee@mediatek.com> References: <1645782833-27875-1-git-send-email-xinlei.lee@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_015409_325385_A0BA6B0A X-CRM114-Status: UNSURE ( 6.85 ) X-CRM114-Notice: Please train this message. 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 From: Xinlei Lee Add dt-binding documentation of dpi for MediaTek MT8186 SoC. Signed-off-by: Xinlei Lee --- .../devicetree/bindings/display/mediatek/mediatek,dpi.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml index dd2896a40ff0..a73044c50b5f 100644 --- a/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml +++ b/Documentation/devicetree/bindings/display/mediatek/mediatek,dpi.yaml @@ -22,6 +22,7 @@ properties: - mediatek,mt7623-dpi - mediatek,mt8173-dpi - mediatek,mt8183-dpi + - mediatek,mt8186-dpi - mediatek,mt8192-dpi reg: From patchwork Fri Feb 25 09:53:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WGlubGVpIExlZSAo5p2O5piV56OKKQ==?= X-Patchwork-Id: 12760001 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 9A25CC433EF for ; Fri, 25 Feb 2022 09:55:36 +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:References:In-Reply-To: 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: List-Owner; bh=B0f8ggHiD11PwU3Sl/sK7LUAEdGZ+MDG9TuZdRU+XSY=; b=Qmmq5gljBSluRc bHZpd76Cdv1Cg8q0rs47vQWN2L+iQkT6hwHnyiGwd9hIh/4heX9tbNmc1/56MjRDBYHyicYg9L+RZ sVTGcqJ6/eNs4Pzu9pmUnfe9jKqBf2yC9CYF/SFQMa0WCYPlwNr3gFqB4LGxuSeuKImitInw0b/+Q 3ob0PU9zVcnBJGRuqfn2cMCDNBs2JWigQJangE10v6n0+1i0V3zSBEdkyNG/pvtbddAPH7n7rfHPV pTaWTfsRBJ4CbqMJ6KEOJRVNtHH/R0NswD0XLNCP8UFj+zZvHuFZoNbnWNuzERDnuJWsYuWqTPjYz y0Y0hqiQyJjUzan0c1/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNXJ3-004Ech-Lz; Fri, 25 Feb 2022 09:54:33 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNXIg-004ETN-1Q; Fri, 25 Feb 2022 09:54:12 +0000 X-UUID: 52a03d69b2664dcf857b42299af216d3-20220225 X-UUID: 52a03d69b2664dcf857b42299af216d3-20220225 Received: from mtkcas66.mediatek.inc [(172.29.193.44)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 950384284; Fri, 25 Feb 2022 02:54:04 -0700 Received: from MTKMBS34N1.mediatek.inc (172.27.4.172) by MTKMBS62N1.mediatek.inc (172.29.193.41) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 25 Feb 2022 01:54:03 -0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS34N1.mediatek.inc (172.27.4.172) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 25 Feb 2022 17:54:02 +0800 Received: from mszsdaap41.gcn.mediatek.inc (10.16.6.141) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 25 Feb 2022 17:54:01 +0800 From: To: , , , , CC: , , , , , , , , Xinlei Lee Subject: [PATCH v1,2/3] drm/mediatek: Add TOPCKGEN select mux control dpi_clk Date: Fri, 25 Feb 2022 17:53:52 +0800 Message-ID: <1645782833-27875-3-git-send-email-xinlei.lee@mediatek.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1645782833-27875-1-git-send-email-xinlei.lee@mediatek.com> References: <1645782833-27875-1-git-send-email-xinlei.lee@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_015410_110436_C384E260 X-CRM114-Status: GOOD ( 12.28 ) 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 From: Xinlei Lee Dpi_clk is controlled by the mux selected by TOPCKGEN and APMIXEDSYS can support small resolution. Signed-off-by: Xinlei Lee --- drivers/gpu/drm/mediatek/mtk_dpi.c | 38 ++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index 4554e2de1430..bad686817e29 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; @@ -73,6 +81,7 @@ struct mtk_dpi { struct clk *engine_clk; 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; @@ -459,6 +468,7 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi, struct videomode vm = { 0 }; unsigned long pll_rate; unsigned int factor; + struct clk *clksrc = NULL; /* let pll_rate can fix the valid range of tvdpll (1G~2GHz) */ factor = dpi->conf->cal_factor(mode->clock); @@ -473,11 +483,26 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi, vm.pixelclock = pll_rate / factor; if ((dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_LE) || - (dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_BE)) - clk_set_rate(dpi->pixel_clk, vm.pixelclock * 2); - else - clk_set_rate(dpi->pixel_clk, vm.pixelclock); + (dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_BE)) { + if (factor == 8) + clksrc = dpi->pclk_src[2]; + else if (factor == 4) + clksrc = dpi->pclk_src[1]; + else + clksrc = dpi->pclk_src[1]; + } + else { + if (factor == 8) + clksrc = dpi->pclk_src[3]; + else if (factor == 4) + clksrc = dpi->pclk_src[2]; + else + clksrc = dpi->pclk_src[2]; + } + clk_prepare_enable(dpi->pixel_clk); + clk_set_parent(dpi->pixel_clk, clksrc); + clk_disable_unprepare(dpi->pixel_clk); vm.pixelclock = clk_get_rate(dpi->pixel_clk); @@ -893,6 +918,11 @@ static int mtk_dpi_probe(struct platform_device *pdev) return ret; } + dpi->pclk_src[1] = devm_clk_get_optional(dev, "tvdpll_d2"); + dpi->pclk_src[2] = devm_clk_get_optional(dev, "tvdpll_d4"); + dpi->pclk_src[3] = devm_clk_get_optional(dev, "tvdpll_d8"); + dpi->pclk_src[4] = devm_clk_get_optional(dev, "tvdpll_d16"); + dpi->irq = platform_get_irq(pdev, 0); if (dpi->irq <= 0) return -EINVAL; From patchwork Fri Feb 25 09:53:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?WGlubGVpIExlZSAo5p2O5piV56OKKQ==?= X-Patchwork-Id: 12760002 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 28033C433F5 for ; Fri, 25 Feb 2022 09:55:47 +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:References:In-Reply-To: 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: List-Owner; bh=2507v6VthVXpRADZke77wUALSoO5NMwwlZ6ZBTxyaME=; b=dnI8ppRpqVKAuF P126zPXpdWHrGiCbJkX6g0hA+JA/wKgnwTNdsg8jKlr7NXAWzh5QM+cXQfUnipiXfZUimkzUKvWTF gG4Np43XDJCBkCmSENIBbJN3CA73p3pvr7HGvD74n/rpjF9sLjVQxLS0FB7ei7JCCaJJKy/RqIevU 0Pa9rsR/V7YhduCDqD1h+ieLPJqoyq9F4fsIiwqQCVlq9r7Zf2w/+leowdgqmDEvaNfv4wGP1aObZ X/ZnccMxBAq344OUyFy7+ikJaO8Knq2BvclxIBqY0kM8F6iMlDrOJoECj3qmZrZ7/quXl3TTynQfS ofwkbj+i+30BqmRP49bw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNXJG-004Ehz-SZ; Fri, 25 Feb 2022 09:54:47 +0000 Received: from mailgw01.mediatek.com ([216.200.240.184]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nNXIi-004ETN-AI; Fri, 25 Feb 2022 09:54:13 +0000 X-UUID: 0d0f95f3d0fe46399ec0d2b6a148080a-20220225 X-UUID: 0d0f95f3d0fe46399ec0d2b6a148080a-20220225 Received: from mtkcas68.mediatek.inc [(172.29.94.19)] by mailgw01.mediatek.com (envelope-from ) (musrelay.mediatek.com ESMTP with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1985504968; Fri, 25 Feb 2022 02:54:09 -0700 Received: from MTKMBS34N1.mediatek.inc (172.27.4.172) by MTKMBS62DR.mediatek.inc (172.29.94.18) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 25 Feb 2022 01:54:07 -0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS34N1.mediatek.inc (172.27.4.172) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 25 Feb 2022 17:54:05 +0800 Received: from mszsdaap41.gcn.mediatek.inc (10.16.6.141) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 25 Feb 2022 17:54:03 +0800 From: To: , , , , CC: , , , , , , , , Xinlei Lee Subject: [PATCH v1,3/3] drm/mediatek: Add mt8186 dpi compatible to mtk_dpi.c Date: Fri, 25 Feb 2022 17:53:53 +0800 Message-ID: <1645782833-27875-4-git-send-email-xinlei.lee@mediatek.com> X-Mailer: git-send-email 2.6.4 In-Reply-To: <1645782833-27875-1-git-send-email-xinlei.lee@mediatek.com> References: <1645782833-27875-1-git-send-email-xinlei.lee@mediatek.com> MIME-Version: 1.0 X-MTK: N X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220225_015412_427289_CAA05F9B X-CRM114-Status: UNSURE ( 9.69 ) X-CRM114-Notice: Please train this message. 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 From: Xinlei Lee Add the compatible because use different .data in mt8186. Signed-off-by: Xinlei Lee --- drivers/gpu/drm/mediatek/mtk_dpi.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index bad686817e29..5329663ab0fe 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -848,6 +848,14 @@ static const struct mtk_dpi_conf mt8192_conf = { .num_output_fmts = ARRAY_SIZE(mt8173_output_fmts), }; +static const struct mtk_dpi_conf mt8186_conf = { + .cal_factor = mt8183_calculate_factor, + .reg_h_fre_con = 0xe0, + .max_clock_khz = 150000, + .output_fmts = mt8183_output_fmts, + .num_output_fmts = ARRAY_SIZE(mt8183_output_fmts), +}; + static int mtk_dpi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -975,6 +983,9 @@ static const struct of_device_id mtk_dpi_of_ids[] = { { .compatible = "mediatek,mt8192-dpi", .data = &mt8192_conf, }, + { .compatible = "mediatek,mt8186-dpi", + .data = &mt8186_conf, + }, { }, }; MODULE_DEVICE_TABLE(of, mtk_dpi_of_ids);