Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp5000028img; Tue, 26 Mar 2019 23:21:42 -0700 (PDT) X-Google-Smtp-Source: APXvYqz+vDr2idxd5jQ7ZdrTeLqrC9bT+VqEq348cAVwQ+n2nf7+hiyXSrY55Xjgu/aZIhXoWRSj X-Received: by 2002:a65:430a:: with SMTP id j10mr15769341pgq.143.1553667702668; Tue, 26 Mar 2019 23:21:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553667702; cv=none; d=google.com; s=arc-20160816; b=GfjrZ8Vk0kxmdF37t9RpVp4fnS+MYCqguj/xBDet9vwriNZWYFSXde0jQgN5WiAmdP Fny1MxnkUSWPtPrZhd57xi4MUqQBWWCM8iUGF8r1HeYcPsl8s/1epj+b70LvIG/jXaif dAvPbdUKOlV/FSHxMN5vHiOvPnOos38R53Iy+IlZ2e7WHIXGH4Cg5KUjnQkYiTZEXDb9 lq0LHCPuvyX7Y5x25XNLYWnw+3bSO7HkrrBF50t1dh5Jp0uX8zve8+PySEb8IGILvTbd DCcACTIkFTOhpRrrWo1DEGk/rnO++NgrdPfflfxklq+F3RWBh3vDA7su0MdaySGN5+yt u6pQ== 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=gT0CXnxSZrJIikskX8emUFFiMDMm6jCCN8OfdhWz8eg=; b=jsWdnFH6KF3jdSgK6OY1V3aRzckAPrDQU/KyKOBQQIGCZoRX+A41iV0Z7gp6p2Y1GW Tf/xcyonOEJx7WG3oebK9H+en5xlUmmtFc+VSaz23Fk59PJBsZf+dcYbi/4oYN0eR9l2 kd8M1Pc5h34GrL5EmlWwGYh0fGbo18fVWG4e5BMacoUzGxPlAV92PTHIblcwcmxLh1A6 YLLtz6wA2kLoV/SfVW54AZDvmJUaddsuZje8mTozf5dsY0RnFydCsO2cgTgf0RnIiLOn RLoGCg7vTSoS8qJ72HaHJ4AtH38C2sxn5cRFw1mtVnvtvaGTGsoW/5hsGbv04RK1A99+ kfTA== 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 u5si17909498pgh.221.2019.03.26.23.21.27; Tue, 26 Mar 2019 23:21:42 -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 S2387560AbfC0GUF (ORCPT + 99 others); Wed, 27 Mar 2019 02:20:05 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:15146 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S2387517AbfC0GUD (ORCPT ); Wed, 27 Mar 2019 02:20:03 -0400 X-UUID: 2d877554f8514ecaaa9f212110e10111-20190327 X-UUID: 2d877554f8514ecaaa9f212110e10111-20190327 Received: from mtkcas07.mediatek.inc [(172.21.101.84)] by mailgw01.mediatek.com (envelope-from ) (mhqrelay.mediatek.com ESMTP with TLS) with ESMTP id 1192126968; Wed, 27 Mar 2019 14:19:57 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs01n1.mediatek.inc (172.21.101.68) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Wed, 27 Mar 2019 14:19:50 +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:43 +0800 From: To: , , , CC: , , , , , , , , , Yongqiang Niu Subject: [PATCH v2 16/25] drm/mediatek: add ddp write register common api Date: Wed, 27 Mar 2019 14:19:12 +0800 Message-ID: <1553667561-25447-17-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-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 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 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); + 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 */ -- 1.8.1.1.dirty