Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp4999689img; Tue, 26 Mar 2019 23:21:09 -0700 (PDT) X-Google-Smtp-Source: APXvYqxr2NO6VxwIHryhhzgSocDvVF62bvE6qSx/U+ullPYNq68VXN/+8XYLkZ5LcadQrxEDUSpF X-Received: by 2002:a17:902:1c9:: with SMTP id b67mr34210489plb.176.1553667669489; Tue, 26 Mar 2019 23:21:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553667669; cv=none; d=google.com; s=arc-20160816; b=U1vMa7pH7oc4IqDTbp4nc4wR21gO3dTi8zrvKhNAM990e+SFq+/SUm5dWn4plt0bDd ljHo2rkeiyPR/wokjaqvvaxrncQ5U9mNMITd52Q4EBpjSztMMn6qsc6sedh/w+C8ZkWP Hc2HPAMumfu2qKrasWM+6GYCKxYrDUym7jtfeaol69VffR1muxdbANjdUX1Xlu+XssaF XkaFEQ13guTnGNf9sqgZ7VBvH6jH0D59L2r8cppSL+V+mUcbkXRRKmO2FOwxKKf8rLjT 2yoD4CU2jS4/FCBnZ34KAcS5RqyK5sGfgbD5k5Gq6dMqJYnHXMyHiH0BZ1WmzhKolpFN DbtA== 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=Q4TKAVeUVeX0s0CrCkwrnG6VHW15bk1NjIm8NgQolQM=; b=pnp+spMZEP3vUTAgDBWzyELX177OPbOWUmxsF29TsFhYCqYDEcI5mld6bT1aJJl9WD V5vaRgk2VQGo3sATQgIftvpr/4kMlR8ugnpFDB7sUxMsy3Cb22XUySfTQ/sz/s48BdH+ JHuWPTtt46/0gNoBKrLNEEzXf8MRJEY2857fTD7vyPGKom+SclgH1QpGma1Pqy1RBmKq 7Yl9gJW3C+miJjRbVbvLueYeTxHp2phudpksPii9ceDbe9ftNKR7yutPzNHKDx8GArYN ezILE+Q3yoWGvaLNJ6KZH5PP9JCgCrjwv0xisCI+WmeCXryu8V4Ep2uYfPQ2S++0Ts5D /Bsw== 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 61si18864873plb.162.2019.03.26.23.20.54; Tue, 26 Mar 2019 23:21: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 S2387498AbfC0GT6 (ORCPT + 99 others); Wed, 27 Mar 2019 02:19:58 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:22079 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1733002AbfC0GT5 (ORCPT ); Wed, 27 Mar 2019 02:19:57 -0400 X-UUID: 9825f1b4842642dd9e220a87e2587f74-20190327 X-UUID: 9825f1b4842642dd9e220a87e2587f74-20190327 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1757716159; Wed, 27 Mar 2019 14:19:42 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:19:40 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Wed, 27 Mar 2019 14:19:40 +0800 From: To: , , , CC: , , , , , , , , , Yongqiang Niu Subject: [PATCH v2 12/25] drm/mediatek: add component DITHER Date: Wed, 27 Mar 2019 14:19:08 +0800 Message-ID: <1553667561-25447-13-git-send-email-yongqiang.niu@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> References: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-TM-SNTS-SMTP: 2D2DA0B9BA6ACB8A5B5AFBA0D263F0CE865EA98F98C50721D2B776884E4F16BE2000:8 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 --- 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 24152e5..afd6ca2 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 2c1b006..b76b663 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