Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2786165yba; Sat, 18 May 2019 02:59:10 -0700 (PDT) X-Google-Smtp-Source: APXvYqz4huA8MAXdtBkZJSEGmH2x7PO0JB+8y2RzoSO13yIwlvDEigCvQDy44b8RouH5pXwt4E1D X-Received: by 2002:a17:902:5a4f:: with SMTP id f15mr27746586plm.1.1558173550013; Sat, 18 May 2019 02:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558173550; cv=none; d=google.com; s=arc-20160816; b=zzdV9XYGviHZUkSDBYiW6tgz7VP18Su/Q8MikLND0shB5/v9ODotzondu+uHVXLLSo jaoDsL53LccPM2nBXUZOStw5qTSH1tIOnVHifFhnZaWkay4YW2ucNPxYSWaBX7uRRkaH 2+9FRcwXE1XuXXnNe4ZHDiHheAcNzkgN6wVERSEZnNEN8gNI/d3kxUn4pThgz3YVg+A+ rE3pbOzJVf8KY5zuA3UYLhG+aDlGy8FuwfkBrRITvSD/EIuNIjkS+yAwZmdFBwNUO8fS o442NmmG0kMZ35/WqM0sRU0//yX0okT3cd/LiLPLxFbYa2tqasc9n6z7UNlok3riCSfj Ig0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=h6LcYriLc0sH5cyNXBHhMgeQJPw5wvMIaFwuAapY6aQ=; b=vb829H8RYJ3sQ2IprIdpxxb0QZyYTjXtiepiq5Yn9AYMPCvaIa28a8Pluuf2uIG1+9 QKGmJKC7iKHHAsCaZ/LJeidESg7YvFUAuuB0kzshablrsMGkvw7ozwT2kFuFcwqiYsyH 9nBwIlI9u/3tjpx36uatD6NunTgxji6+cUuQVzbMAuxxMGwexxRp6I8Z05K8LceiYQ2o 1ZRgt/hq4xhkh2w4iRboN/zRIX6MIgDrPOBH3BzoCvGdRFtwWpdDW991PeqjI0cGEwVh P2Qri8U2KTrbzmusJEG4sSiwfA5PNx3DMLzCeSudTqjPbXh0uZg4ktyr3bfhTlIPbPrM nEww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y10si11982577pfl.130.2019.05.18.02.58.54; Sat, 18 May 2019 02:59:09 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730000AbfERJ4w (ORCPT + 99 others); Sat, 18 May 2019 05:56:52 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:28690 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1729661AbfERJ4c (ORCPT ); Sat, 18 May 2019 05:56:32 -0400 X-UUID: b5bc3861df2b4e7b979e490bdd0d5d0e-20190518 X-UUID: b5bc3861df2b4e7b979e490bdd0d5d0e-20190518 Received: from mtkcas35.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1214317223; Sat, 18 May 2019 17:56:26 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS33DR.mediatek.inc (172.27.6.106) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Sat, 18 May 2019 17:56:24 +0800 Received: from mszsdclx1018.gcn.mediatek.inc (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Sat, 18 May 2019 17:56:23 +0800 From: Jitao Shi To: Rob Herring , Pawel Moll , Mark Rutland , Ian Campbell , Kumar Gala , , David Airlie , Matthias Brugger CC: Jitao Shi , Thierry Reding , Ajay Kumar , Inki Dae , Rahul Sharma , Sean Paul , Vincent Palatin , Andy Yan , Philipp Zabel , Russell King , , , , , , , Sascha Hauer , , , , , , Subject: [v4 2/5] drm/mediatek: dpi dual edge support Date: Sat, 18 May 2019 17:56:15 +0800 Message-ID: <20190518095618.18454-3-jitao.shi@mediatek.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190518095618.18454-1-jitao.shi@mediatek.com> References: <20190518095618.18454-1-jitao.shi@mediatek.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org DPI sample the data both rising and falling edge. It can reduce half data io pins. Signed-off-by: Jitao Shi --- drivers/gpu/drm/mediatek/mtk_dpi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index 22e68a100e7b..ccef3ac1c560 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -117,6 +117,7 @@ struct mtk_dpi_conf { unsigned int (*cal_factor)(int clock); u32 reg_h_fre_con; bool edge_sel_en; + bool dual_edge; }; static void mtk_dpi_mask(struct mtk_dpi *dpi, u32 offset, u32 val, u32 mask) @@ -353,6 +354,13 @@ static void mtk_dpi_config_disable_edge(struct mtk_dpi *dpi) mtk_dpi_mask(dpi, dpi->conf->reg_h_fre_con, 0, EDGE_SEL_EN); } +static void mtk_dpi_enable_dual_edge(struct mtk_dpi *dpi) +{ + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE, + DDR_EN | DDR_4PHASE); + mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, EDGE_SEL, EDGE_SEL); +} + static void mtk_dpi_config_color_format(struct mtk_dpi *dpi, enum mtk_dpi_out_color_format format) { @@ -444,7 +452,8 @@ 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); + clk_set_rate(dpi->pixel_clk, + vm.pixelclock * (dpi->conf->dual_edge ? 2 : 1)); vm.pixelclock = clk_get_rate(dpi->pixel_clk); dev_dbg(dpi->dev, "Got PLL %lu Hz, pixel clock %lu Hz\n", @@ -509,6 +518,8 @@ static int mtk_dpi_set_display_mode(struct mtk_dpi *dpi, mtk_dpi_config_color_format(dpi, dpi->color_format); mtk_dpi_config_2n_h_fre(dpi); mtk_dpi_config_disable_edge(dpi); + if (dpi->conf->dual_edge) + mtk_dpi_enable_dual_edge(dpi); mtk_dpi_sw_reset(dpi, false); return 0; -- 2.21.0