Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp7194128ybi; Mon, 8 Jul 2019 16:37:46 -0700 (PDT) X-Google-Smtp-Source: APXvYqzkFPEFvpRFe0ulhR6CaV9Y0szE9zigdKrx3ORU0EGwVNJkPSakV/yj6YSPaf3EtLN8IuEi X-Received: by 2002:a63:125c:: with SMTP id 28mr26685242pgs.255.1562629066211; Mon, 08 Jul 2019 16:37:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562629066; cv=none; d=google.com; s=arc-20160816; b=yeVs5U5MMgNZLeMdtXaX9Ap+ItGNEjzE7E75D2rd0soHorS9SGoEazJ6OlZNe+U/ir +NOZEaFnKi8IYMeLwKvvLxOQEEo3y2aahPfB97WIRE73z6Wb9/KNwFrDphQJ5iHh6EoO 3Hzqvw+ZFMiDpHWFF3zTLJtg2EDGajY2R3eHs2dIoYlCo9ZWeKvoaRSVaVOzLua8sBsN 28wWxnObvPwOpo6nTGufrmOSwHrdD0Cv5QTVGQyTeanp9tZwotNuu8QK2zzc1/sCffU9 Mm5Z31y2g/GstowHmtJTVhQUaLsz2jezMFQIARVPYPgCPPXEoBUZZ1CcXZcW5skf0Npb OjWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=KF6gR67u0L4sP7B+qlO95z/jdRu1W4ayjM26Wc4cDM0=; b=p0kzKF1PmJCZV9+p8oe5tm0ifxBwK9EHEtR2y7lmXPt0B9sy+MNYTGGjp5KOJkAjyD Z06C/CufCG6wVWO8mqMaE8n8fGfpYxLqeM7QpcUNgJOCzAkZ1XM6zyGFOEiavh8Dt3bJ yPkUPILRdDO/5FJZsFyXYNZg/zVYE/iC7G8yrcRtlJoA7FsQzj/tnicVE7d1CKxgMGCY IwJSPHyfeLQz8s6G+U44/uZHpdB8uGMKGk1xM+RCt5M7qJXV6fO2rghkFmg/D1ZfG0tO c6Tpkq3HCQtAxXUQYG/fG/vL1IT0Q22gp2X9lCIbT7pM0kv+8Kyu7XPUzSZyRLzV+uVc +EiA== 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 j3si19076641pfh.178.2019.07.08.16.37.31; Mon, 08 Jul 2019 16:37:46 -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 S1728218AbfGHWgI (ORCPT + 99 others); Mon, 8 Jul 2019 18:36:08 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:29229 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727148AbfGHWem (ORCPT ); Mon, 8 Jul 2019 18:34:42 -0400 X-UUID: cbce96f35f5b498fb38dcf6ccba089ab-20190709 X-UUID: cbce96f35f5b498fb38dcf6ccba089ab-20190709 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1980034319; Tue, 09 Jul 2019 06:34:37 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 9 Jul 2019 06:34:36 +0800 Received: from localhost.localdomain (10.17.3.153) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 9 Jul 2019 06:34:35 +0800 From: To: CK Hu , Philipp Zabel , Rob Herring , Matthias Brugger CC: David Airlie , Daniel Vetter , Mark Rutland , , , , , , Yongqiang Niu Subject: [PATCH v4, 18/33] drm/mediatek: add component DITHER Date: Tue, 9 Jul 2019 06:33:58 +0800 Message-ID: <1562625253-29254-19-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1562625253-29254-1-git-send-email-yongqiang.niu@mediatek.com> References: <1562625253-29254-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yongqiang Niu This patch add component DITHER Signed-off-by: Yongqiang Niu Reviewed-by: CK Hu --- drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 32 +++++++++++++++++++++++++++++ drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 2 ++ 2 files changed, 34 insertions(+) diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c index 1aa4224..bc92a1b 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c @@ -47,6 +47,12 @@ #define CCORR_RELAY_MODE BIT(0) #define DISP_CCORR_SIZE 0x0030 +#define DISP_DITHER_EN 0x0000 +#define DITHER_EN BIT(0) +#define DISP_DITHER_CFG 0x0020 +#define DITHER_RELAY_MODE BIT(0) +#define DISP_DITHER_SIZE 0x0030 + #define DISP_GAMMA_EN 0x0000 #define DISP_GAMMA_CFG 0x0020 #define DISP_GAMMA_SIZE 0x0030 @@ -155,6 +161,24 @@ static void mtk_ccorr_stop(struct mtk_ddp_comp *comp) writel_relaxed(0x0, comp->regs + DISP_CCORR_EN); } +static void mtk_dither_config(struct mtk_ddp_comp *comp, unsigned int w, + unsigned int h, unsigned int vrefresh, + unsigned int bpc) +{ + writel(h << 16 | w, comp->regs + DISP_DITHER_SIZE); + writel(DITHER_RELAY_MODE, comp->regs + DISP_DITHER_CFG); +} + +static void mtk_dither_start(struct mtk_ddp_comp *comp) +{ + writel(DITHER_EN, comp->regs + DISP_DITHER_EN); +} + +static void mtk_dither_stop(struct mtk_ddp_comp *comp) +{ + writel_relaxed(0x0, comp->regs + DISP_DITHER_EN); +} + static void mtk_gamma_config(struct mtk_ddp_comp *comp, unsigned int w, unsigned int h, unsigned int vrefresh, unsigned int bpc) @@ -209,6 +233,12 @@ static void mtk_gamma_set(struct mtk_ddp_comp *comp, .stop = mtk_ccorr_stop, }; +static const struct mtk_ddp_comp_funcs ddp_dither = { + .config = mtk_dither_config, + .start = mtk_dither_start, + .stop = mtk_dither_stop, +}; + static const struct mtk_ddp_comp_funcs ddp_gamma = { .gamma_set = mtk_gamma_set, .config = mtk_gamma_config, @@ -234,6 +264,7 @@ static void mtk_gamma_set(struct mtk_ddp_comp *comp, [MTK_DISP_CCORR] = "ccorr", [MTK_DISP_AAL] = "aal", [MTK_DISP_GAMMA] = "gamma", + [MTK_DISP_DITHER] = "dither", [MTK_DISP_UFOE] = "ufoe", [MTK_DSI] = "dsi", [MTK_DPI] = "dpi", @@ -256,6 +287,7 @@ struct mtk_ddp_comp_match { [DDP_COMPONENT_CCORR] = { MTK_DISP_CCORR, 0, &ddp_ccorr }, [DDP_COMPONENT_COLOR0] = { MTK_DISP_COLOR, 0, NULL }, [DDP_COMPONENT_COLOR1] = { MTK_DISP_COLOR, 1, NULL }, + [DDP_COMPONENT_DITHER] = { MTK_DISP_DITHER, 0, &ddp_dither }, [DDP_COMPONENT_DPI0] = { MTK_DPI, 0, NULL }, [DDP_COMPONENT_DPI1] = { MTK_DPI, 1, NULL }, [DDP_COMPONENT_DSI0] = { MTK_DSI, 0, NULL }, diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h index 8ac9f62..a0ea8c9 100644 --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h @@ -30,6 +30,7 @@ enum mtk_ddp_comp_type { MTK_DISP_WDMA, MTK_DISP_COLOR, MTK_DISP_CCORR, + MTK_DISP_DITHER, MTK_DISP_AAL, MTK_DISP_GAMMA, MTK_DISP_UFOE, @@ -49,6 +50,7 @@ enum mtk_ddp_comp_id { DDP_COMPONENT_CCORR, DDP_COMPONENT_COLOR0, DDP_COMPONENT_COLOR1, + DDP_COMPONENT_DITHER, DDP_COMPONENT_DPI0, DDP_COMPONENT_DPI1, DDP_COMPONENT_DSI0, -- 1.8.1.1.dirty