Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp1046951pxy; Wed, 28 Apr 2021 21:22:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHGZgOAC5Fg7POfp8cD5NZ73fGc9nWXvCtWy6J3vTKHFnW2btTwc3lnY7KjJM+JLtAFpsD X-Received: by 2002:aa7:de8b:: with SMTP id j11mr15660313edv.363.1619670142883; Wed, 28 Apr 2021 21:22:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619670142; cv=none; d=google.com; s=arc-20160816; b=SoKi0xsSGUZ8tFWlMijroEfCEZU8aSD69kv19g+bnL8seXB5cgsCQyZ9CNksf2rnoo WUHFQxqlCOSB0ONi20uaAHiT57EXXYS8uwzlL2nw+TQMVYref8Gjeffn6LH/ZlC3FL/V +ZL1+CPyUWZGbYaHl2JbMZVARcIPB2HRmgxfnpkGXoKYgr8DenGSArpDF9eB5Ry3QAGU yTeSSnQDErupcGwQYRFcbTkfLOlIJTEc6LrL0j0UGVsMgmQ/7poqOEgXZoETcX4FeFzy tcWVk+RkOHkvNQ6UqvRT305GOiojWa4y2eTEm19+nhfHz0PjsLpCZXCfkWxzV4s5FUSs TeIQ== 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=/elVJyvZh/OePIUMf63rWRNNltnVLKnEjf0p2MN8v84=; b=rmv17zctIyRop8qhVdueeadxVNOKQHQFoOAoZ3cYO/xnn7oCNe6E708LuvFDqa0SGT L3D8K4LZEgmbAt6civqbXap2kcseOhc7Yhq8uO9yISoNIHz7N8KgSx65Ne4mVdo8S+1x Q2fpGeO9qzPNNJ0aZUcxsqispfGmBdAT/TVSwtoBEuwzarTTxmRM5BkOmDE+nHLRLbUR iuACW+cjOMzZ3TWMqEnk+wKl7bDa+7X/CxmCeU6O9B0PVX2kcswmSVPA5SLtA+lg5CKO MuC7q8Lf5VO9JhwYdqCqwEaRBklwscGwnkUsbGBEWNQLAikbz0bKKGrv9JFo9Au5I77R WDtg== 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 dk21si1923818ejb.134.2021.04.28.21.21.59; Wed, 28 Apr 2021 21:22:22 -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 S237081AbhD2ERp (ORCPT + 99 others); Thu, 29 Apr 2021 00:17:45 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:40858 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S233084AbhD2ERj (ORCPT ); Thu, 29 Apr 2021 00:17:39 -0400 X-UUID: 75a79fabbc7c4024bd83f364d65a8e94-20210429 X-UUID: 75a79fabbc7c4024bd83f364d65a8e94-20210429 Received: from mtkcas10.mediatek.inc [(172.21.101.39)] by mailgw01.mediatek.com (envelope-from ) (Generic MTA with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 1231070284; Thu, 29 Apr 2021 12:16:49 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs05n1.mediatek.inc (172.21.101.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 29 Apr 2021 12:16:47 +0800 Received: from mtksdccf07.mediatek.inc (172.21.84.99) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 29 Apr 2021 12:16:47 +0800 From: Rex-BC Chen To: , CC: , , , , , Rex-BC Chen , Jitao Shi Subject: [v3 RESEND,PATCH 1/3] drm/mediatek: dpi dual edge sample mode support Date: Thu, 29 Apr 2021 12:16:39 +0800 Message-ID: <20210429041641.11077-2-rex-bc.chen@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20210429041641.11077-1-rex-bc.chen@mediatek.com> References: <20210429041641.11077-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. Signed-off-by: Jitao Shi Signed-off-by: Rex-BC Chen --- drivers/gpu/drm/mediatek/mtk_dpi.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index b05f900d9322..79f3e83f40ef 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; + bool ddr_edge_sel; int refcount; }; @@ -121,6 +122,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) @@ -380,6 +382,15 @@ static void mtk_dpi_config_color_format(struct mtk_dpi *dpi, } } +static void mtk_dpi_dual_edge(struct mtk_dpi *dpi) +{ + if (dpi->conf->dual_edge) { + mtk_dpi_mask(dpi, DPI_DDR_SETTING, DDR_EN | DDR_4PHASE, + DDR_EN | DDR_4PHASE); + mtk_dpi_mask(dpi, DPI_OUTPUT_SETTING, dpi->ddr_edge_sel ? EDGE_SEL : 0, EDGE_SEL); + } +} + static void mtk_dpi_power_off(struct mtk_dpi *dpi) { if (WARN_ON(dpi->refcount == 0)) @@ -454,7 +465,7 @@ 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", @@ -518,6 +529,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); -- 2.18.0