Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp5176038pxj; Wed, 26 May 2021 04:49:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzZfNbiL2C5mUgXVKUi2Fkt+nwVgmfVv6HR72cTSGB07UYiOS0I7OZhnRBiY8wUhZ96Ppnu X-Received: by 2002:a05:6e02:1382:: with SMTP id d2mr27372183ilo.256.1622029776338; Wed, 26 May 2021 04:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622029776; cv=none; d=google.com; s=arc-20160816; b=FvN3wLPN6QKwSQJ5+p1/AuOFnryJ72gUYsbXoU/Pe0a48rDO4Ipr6boNs2lrnNr2rU +ssPnrNZpaa7dr4Hv0cRvcvFn2nnc2g9KFpNrLM50o7WdS6G1gpsD5if+MmdbTOFBNfi 4oxwxRCR/30xv6dloiwPaVhOgOvz5cTfoV4wKFLatu/rVEdhMYsxOCsCsaWuTsOfRzhT /7V+qNdjMFZFXdS8dknuYS0pBlv/rdK7UjMesotOH4oAoyAZ5w/TOs2X1lOutBtVYWdL yKfJktaDG7yxcf//ncNhu/GI6D/y6sno+39fTbDXTjrdOsoBR15yBwJsexKEfs7aF6OB gbOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=eTR+JSni0zCKpZiMh9NgeRYTz+gQTls3RYTedu/gzV8=; b=nUauw9WcUBJex66mwxvX3+2YqUR26A3oaBtKbVEhjIMSmwedeqX0hetrF5sbqQYoaA BVN9PWp8kA5VjzW6ePXiGe2rsYz0mbfnQoPLM45ibLW8dr6m18T9laygfXG26z5daGPI ltf0oiW8ewoRp06YJw4LqV0k2vn6w+h/BCJFVAvZ1JkXzw0SvH3Wn2WuLnpnWdSy9wxK xkskcXq8W9n8M+rEi0uViZHWi4fVc6gsaslTHh7wNbaCjar3jlxZReJSl0LpddIKOogp dtUO4enp7TpT8oMifKrmCxbgU3gK/DXN54ke12ASU99K5KO9MlS5tIzIV8Z3y8mJaQap znUg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l22si21698153jad.10.2021.05.26.04.49.23; Wed, 26 May 2021 04:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233392AbhEZIyE (ORCPT + 99 others); Wed, 26 May 2021 04:54:04 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:40624 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S233103AbhEZIx7 (ORCPT ); Wed, 26 May 2021 04:53:59 -0400 X-UUID: 2bd05263fbac479287985ae67a950e6e-20210526 X-UUID: 2bd05263fbac479287985ae67a950e6e-20210526 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 294660524; Wed, 26 May 2021 16:52:21 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs05n2.mediatek.inc (172.21.101.140) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 26 May 2021 16:52:20 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 26 May 2021 16:52:20 +0800 From: Rex-BC Chen To: , CC: , , , , , Rex-BC Chen , Jitao Shi Subject: [v5,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support Date: Wed, 26 May 2021 16:52:17 +0800 Message-ID: <20210526085219.7582-2-rex-bc.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210526085219.7582-1-rex-bc.chen@mediatek.com> References: <20210526085219.7582-1-rex-bc.chen@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DPI can sample on falling, rising or both edge. When DPI sample the data both rising and falling edge. It can reduce half data io pins. Use num_output_fmts to determine whether it is dual edge mode. Signed-off-by: Jitao Shi Signed-off-by: Rex-BC Chen --- drivers/gpu/drm/mediatek/mtk_dpi.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index bea91c81626e..f034ebd12fa6 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -83,6 +83,7 @@ struct mtk_dpi { struct pinctrl *pinctrl; struct pinctrl_state *pins_gpio; struct pinctrl_state *pins_dpi; + unsigned int output_fmt; int refcount; }; @@ -381,6 +382,20 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi, } } +static void mtk_dpi_dual_edge(struct mtk_dpi *dpi) +{ + if ((dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_LE) || + (dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_BE)) { + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE, + DDR_EN | DDR_4PHASE); + mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, + dpi->output_fmt == MEDIA_BUS_FMT_RGB888_2X12_LE ? + EDGE_SEL : 0, EDGE_SEL); + } else { + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE, 0); + } +} + static void mtk_dpi_power_off(struct mtk_dpi *dpi) { if (WARN_ON(dpi->refcount == 0)) @@ -455,7 +470,13 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi, pll_rate = clk_get_rate(dpi->tvd_clk); vm.pixelclock = pll_rate / factor; - clk_set_rate(dpi->pixel_clk, vm.pixelclock); + 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); + + vm.pixelclock = clk_get_rate(dpi->pixel_clk); dev_dbg(dpi->dev, "Got PLL %lu Hz, pixel clock %lu Hz\n", @@ -519,6 +540,7 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi, mtk_dpi_config_yc_map(dpi, dpi->yc_map); mtk_dpi_config_color_format(dpi, dpi->color_format); mtk_dpi_config_2n_h_fre(dpi); + mtk_dpi_dual_edge(dpi); mtk_dpi_config_disable_edge(dpi); mtk_dpi_sw_reset(dpi, false); @@ -800,6 +822,8 @@ static int mtk_dpi_probe(struct platform_device *pdev) return ret; } + dpi->output_fmt = MEDIA_BUS_FMT_RGB888_1X24; + return 0; } -- 2.18.0