Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp5712148yba; Thu, 11 Apr 2019 04:16:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqyppdP+EBBJcadyieuWjilx7OqZTz0R12BN58He3wbvtWwaFY3qYOex5garKePRdKFuVMLx X-Received: by 2002:a62:174c:: with SMTP id 73mr49365599pfx.33.1554981387475; Thu, 11 Apr 2019 04:16:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554981387; cv=none; d=google.com; s=arc-20160816; b=wEx9r1MKum8SikTGKpk/5mOIaZPPdxsyz2S4N5vQpyC/x04BVS+IpA6S0zUQrey0m4 BTJFJdfKGjgPQusEVxK1V81Ye46oAKV1bv1ynluwA09owNys40/zLyt2OPTETyJPR2DE 4IqKZCUZLSO6+YuKohCrXtg0zD7ge1/v7BAj0Z44wDH9e5HHZzxTSHX9de+luPt9Xjyu +41nNgvZAS+aIQP5Tzv7UKM+Elfi/eo2JTV4Kn92YyZLnuujKRIG6r+sv1SKz4YAXgpl iKjWLza/YN0CWMgKJgg9BKfj243ie8g6i3cX4GX+duKcVRv5fpSJywFM+Qqt2CN/WR0E +QwQ== 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=UN7hNrclw7qoEcUC7QhAgmtDEz5Db8r04LWQIhbE8hU=; b=kdmEr4XiKo3JnnRGOoscD773/foECxnBKLl/h3PzW13jqwib0B9DqF8rsjU06vFGVH VGDLvyG4H/6NWbZS7nZW0kvRmKkgYle1G0QxPu1HfJDY1kmvTfka/9Rg7t/n9PQYxNIQ LJygWQYjkqjI8VEVWtTfOI94X60NtT9vyx6/cnSJBxZytVe+ttDJ0uWCMgyw5ps8R2Z2 wBkgKVEgQJsyv7BjlluoQiXJbTzHR6YSKzNYt1JpxHDMqrPxyH3rouJtcBy52f7auh8y JF6TeuJcy/eKLN/bTVdmd0YKjAVCSSmx/4wO45Z3Tct9JQpc6w8gY9UH158tvXpe/3Ik Q8bw== 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 l1si36697707pld.210.2019.04.11.04.16.10; Thu, 11 Apr 2019 04:16:27 -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 S1726646AbfDKLPf (ORCPT + 99 others); Thu, 11 Apr 2019 07:15:35 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:45322 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1726517AbfDKLPe (ORCPT ); Thu, 11 Apr 2019 07:15:34 -0400 X-UUID: 8a95690d9ef04b0e97aaef039f788acd-20190411 X-UUID: 8a95690d9ef04b0e97aaef039f788acd-20190411 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1834034331; Thu, 11 Apr 2019 19:15:26 +0800 Received: from mtkcas08.mediatek.inc (172.21.101.126) by mtkmbs01n2.mediatek.inc (172.21.101.79) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 11 Apr 2019 19:15:19 +0800 Received: from [172.21.77.4] (172.21.77.4) by mtkcas08.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 11 Apr 2019 19:15:19 +0800 Message-ID: <1554981319.31170.2.camel@mtksdaap41> Subject: Re: [PATCH v2 16/25] drm/mediatek: add ddp write register common api From: CK Hu To: CC: , , , , , , , , , , , Date: Thu, 11 Apr 2019 19:15:19 +0800 In-Reply-To: <1553667561-25447-17-git-send-email-yongqiang.niu@mediatek.com> References: <1553667561-25447-1-git-send-email-yongqiang.niu@mediatek.com> <1553667561-25447-17-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: 4E69FC553BCEE32A74450CFBB64481A06BC9D0C54E487B007EA3E378B139BF762000: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 ddp write register common api > this is preparation patch for ovl/ovl_2l direct link > usecase. > in that case, we need this funtion to set one bit of ovl_2l > register The reason is so strange. You could grep 'readl' in mediatek drm driver, and you would find that many place need this function. > > Signed-off-by: Yongqiang Niu > --- > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c | 11 +++++++++++ > drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h | 4 ++++ > 2 files changed, 15 insertions(+) > > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c > index afd6ca2..72288b4 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.c > @@ -84,6 +84,17 @@ > #define DITHER_ADD_LSHIFT_G(x) (((x) & 0x7) << 4) > #define DITHER_ADD_RSHIFT_G(x) (((x) & 0x7) << 0) > > +void mtk_ddp_write_mask(unsigned int value, > + struct mtk_ddp_comp *comp, > + unsigned int offset, > + unsigned int mask) > +{ > + unsigned int tmp = readl(comp->regs + offset); > + > + tmp = (tmp & ~mask) | (value & mask); Why not just place this calculation into writel()? Regards, CK > + writel(tmp, comp->regs + offset); > +} > + > void mtk_dither_set(struct mtk_ddp_comp *comp, unsigned int bpc, > unsigned int CFG) > { > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h > index 20e8061..ed715ff 100644 > --- a/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h > +++ b/drivers/gpu/drm/mediatek/mtk_drm_ddp_comp.h > @@ -198,5 +198,9 @@ int mtk_ddp_comp_init(struct device *dev, struct device_node *comp_node, > void mtk_ddp_comp_unregister(struct drm_device *drm, struct mtk_ddp_comp *comp); > void mtk_dither_set(struct mtk_ddp_comp *comp, unsigned int bpc, > unsigned int CFG); > +void mtk_ddp_write_mask(unsigned int value, > + struct mtk_ddp_comp *comp, > + unsigned int offset, > + unsigned int mask); > > #endif /* MTK_DRM_DDP_COMP_H */