Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5533959yba; Wed, 10 Apr 2019 23:30:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqylABea4JNFysDX3xDDiVaxKUdYCfrq8Gl1ST9Ysa+1aGnL13L5tyhAmp/WnTNvE1/DeRsd X-Received: by 2002:a62:ab13:: with SMTP id p19mr48868690pff.131.1554964235447; Wed, 10 Apr 2019 23:30:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554964235; cv=none; d=google.com; s=arc-20160816; b=GIFkMwJCOGtFoy0IYvTfbBLEkvrbPASzTE/mD8hHQ9lhpeBAbLujFbVfatxXZKN0ux DSzzumsxLgJSC1iuEBW45ezz0rWgRAMskqRZ17ZJE2Z+rS1Rf3/hy5mLcl1Vrb5dYrEV ZwnNYXb9i3BWAvhUSVim4dvmBAhvxUhmM+MPeKNzkAf0ac2+wWLuQyS8ChTFIo2M+14V ilHbbHI1cqCi6QPMlZJNh8QhqCVbY1Q+sB9P8pi2V0UP5TXiM9XvGnKZZHs9QEm6EIWj 64nbkSCeATpiaSv+M/YTAfxNStji46wBsKt/tWHumGxDhoKGMeRbhFI3z1Fot7GOksHb wAdw== 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:date:cc:to:from:subject:message-id; bh=CLpQSwskDjGFhNd8AowSm5WRxLiS7kAsd5zjkRRivcg=; b=sNbKfl1ziG6lvjnI/AbvJmu3S0VUAG8GGS+g0UKYqiJWv1EBmTSv6SfAA7z7OqY3Mc SoZFRxxUf/cdGK3/XCZwmHqh9wUdiRal6Bqdfu+foJLcSSf0kKPH4HlGVrhruHOb41cb M4GLBg1xXR7Cos0rA16eeoJhkPme1s42VB+dNLP1O6mzCeMhwQgODNDN3uW0WkbcV/ho x0I0NoAeTq06mkRKftvM57Hy0nu6xeJu/puTahlk3iWvMr4YWP6GIBqGoTcpZF51Jefc ENvA/kqmY0l4gpWCliJbh/nKQsadOeXW/HIzizbsiUKOClQa/R/GBkjvFrBklYKIymS7 T5nQ== 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 z4si32545956plk.385.2019.04.10.23.30.19; Wed, 10 Apr 2019 23:30:35 -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 S1726774AbfDKG20 (ORCPT + 99 others); Thu, 11 Apr 2019 02:28:26 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:63980 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726599AbfDKG20 (ORCPT ); Thu, 11 Apr 2019 02:28:26 -0400 X-UUID: 2805bb2c02e146208e661b450cf065ab-20190411 X-UUID: 2805bb2c02e146208e661b450cf065ab-20190411 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw02.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1151822150; Thu, 11 Apr 2019 14:28:17 +0800 Received: from mtkcas07.mediatek.inc (172.21.101.84) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 11 Apr 2019 14:28:09 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas07.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 11 Apr 2019 14:28:09 +0800 Message-ID: <1554964088.4768.8.camel@mtksdaap41> Subject: Re: [PATCH v2 12/25] drm/mediatek: add component DITHER From: CK Hu To: CC: , , , , , , , , , , , Date: Thu, 11 Apr 2019 14:28:08 +0800 In-Reply-To: <1553667561-25447-13-git-send-email-yongqiang.niu@mediatek.com> References: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> <1553667561-25447-13-git-send-email-yongqiang.niu@mediatek.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-SNTS-SMTP: 40B18BF742599C71A0EB0C525026174D14FDDB534C8A4174D68F1B05D2E6DF222000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, Yongqiang: On Wed, 2019-03-27 at 14:19 +0800, yongqiang.niu@mediatek.com wrote: > From: Yongqiang Niu > > This patch add component DITHER Reviewed-by: CK Hu > > 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,