From patchwork Tue Jul 26 07:46:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: yao mark X-Patchwork-Id: 9247835 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id ADE3460757 for ; Tue, 26 Jul 2016 07:50:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92C6C1FFB9 for ; Tue, 26 Jul 2016 07:50:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 85EDC20649; Tue, 26 Jul 2016 07:50:31 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 3C39F1FFB9 for ; Tue, 26 Jul 2016 07:50:31 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bRx6v-0005Rb-Bl; Tue, 26 Jul 2016 07:49:05 +0000 Received: from regular1.263xmail.com ([211.150.99.138]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bRx5H-0002a2-Gy; Tue, 26 Jul 2016 07:47:40 +0000 Received: from mark.yao?rock-chips.com (unknown [192.168.167.159]) by regular1.263xmail.com (Postfix) with SMTP id 4FAF279A7; Tue, 26 Jul 2016 15:46:59 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 X-ADDR-CHECKED: 0 Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.263.net (Postfix) with ESMTP id 483AC3A5A; Tue, 26 Jul 2016 15:46:53 +0800 (CST) X-RL-SENDER: mark.yao@rock-chips.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: mark.yao@rock-chips.com X-UNIQUE-TAG: X-ATTACHMENT-NUM: 0 X-SENDER: yzq@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 300110VNY2I; Tue, 26 Jul 2016 15:46:57 +0800 (CST) From: Mark Yao To: David Airlie , Heiko Stuebner , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] drm/rockchip: vop: rk3288: add area plane Date: Tue, 26 Jul 2016 15:46:34 +0800 Message-Id: <1469519194-23133-3-git-send-email-mark.yao@rock-chips.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469519194-23133-1-git-send-email-mark.yao@rock-chips.com> References: <1469519194-23133-1-git-send-email-mark.yao@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160726_004724_200780_3591DD22 X-CRM114-Status: UNSURE ( 8.57 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Yao MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Change-Id: Iac8fde019020d8f1a671d52c1a4d91ad2d050d43 Signed-off-by: Mark Yao --- drivers/gpu/drm/rockchip/rockchip_vop_reg.c | 52 ++++++++++++++++++++++++----- 1 file changed, 44 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c index 919992c..0f53ebd 100644 --- a/drivers/gpu/drm/rockchip/rockchip_vop_reg.c +++ b/drivers/gpu/drm/rockchip/rockchip_vop_reg.c @@ -103,7 +103,7 @@ static const struct vop_win_phy rk3288_win01_data = { static const struct vop_win_phy rk3288_win23_data = { .data_formats = formats_win_lite, .nformats = ARRAY_SIZE(formats_win_lite), - .enable = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 0), + .enable = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 4), .format = VOP_REG(RK3288_WIN2_CTRL0, 0x7, 1), .rb_swap = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 12), .dsp_info = VOP_REG(RK3288_WIN2_DSP_INFO0, 0x0fff0fff, 0), @@ -114,6 +114,36 @@ static const struct vop_win_phy rk3288_win23_data = { .dst_alpha_ctl = VOP_REG(RK3288_WIN2_DST_ALPHA_CTRL, 0xff, 0), }; +static const struct vop_win_phy rk3288_area1_data = { + .enable = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 5), + .dsp_info = VOP_REG(RK3288_WIN2_DSP_INFO1, 0x0fff0fff, 0), + .dsp_st = VOP_REG(RK3288_WIN2_DSP_ST1, 0x1fff1fff, 0), + .yrgb_mst = VOP_REG(RK3288_WIN2_MST1, 0xffffffff, 0), + .yrgb_vir = VOP_REG(RK3288_WIN2_VIR0_1, 0x1fff, 16), +}; + +static const struct vop_win_phy rk3288_area2_data = { + .enable = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 6), + .dsp_info = VOP_REG(RK3288_WIN2_DSP_INFO2, 0x0fff0fff, 0), + .dsp_st = VOP_REG(RK3288_WIN2_DSP_ST2, 0x1fff1fff, 0), + .yrgb_mst = VOP_REG(RK3288_WIN2_MST2, 0xffffffff, 0), + .yrgb_vir = VOP_REG(RK3288_WIN2_VIR2_3, 0x1fff, 0), +}; + +static const struct vop_win_phy rk3288_area3_data = { + .enable = VOP_REG(RK3288_WIN2_CTRL0, 0x1, 7), + .dsp_info = VOP_REG(RK3288_WIN2_DSP_INFO3, 0x0fff0fff, 0), + .dsp_st = VOP_REG(RK3288_WIN2_DSP_ST3, 0x1fff1fff, 0), + .yrgb_mst = VOP_REG(RK3288_WIN2_MST3, 0xffffffff, 0), + .yrgb_vir = VOP_REG(RK3288_WIN2_VIR2_3, 0x1fff, 16), +}; + +static const struct vop_win_phy *rk3288_area_data[] = { + &rk3288_area1_data, + &rk3288_area2_data, + &rk3288_area3_data +}; + static const struct vop_ctrl rk3288_ctrl_data = { .standby = VOP_REG(RK3288_SYS_CTRL, 0x1, 22), .gate_en = VOP_REG(RK3288_SYS_CTRL, 0x1, 23), @@ -141,12 +171,14 @@ static const struct vop_reg_data rk3288_init_reg_table[] = { {RK3288_DSP_CTRL0, 0x00000000}, {RK3288_WIN0_CTRL0, 0x00000080}, {RK3288_WIN1_CTRL0, 0x00000080}, - /* TODO: Win2/3 support multiple area function, but we haven't found - * a suitable way to use it yet, so let's just use them as other windows - * with only area 0 enabled. + /* + * Bit[0] is win2/3 gate en bit, there is no power consume with this + * bit enable. the bit's function similar with area plane enable bit, + * So default enable this bit, then We can control win2/3 area plane + * with its enable bit. */ - {RK3288_WIN2_CTRL0, 0x00000010}, - {RK3288_WIN3_CTRL0, 0x00000010}, + {RK3288_WIN2_CTRL0, 0x00000001}, + {RK3288_WIN3_CTRL0, 0x00000001}, }; /* @@ -161,9 +193,13 @@ static const struct vop_win_data rk3288_vop_win_data[] = { { .base = 0x40, .phy = &rk3288_win01_data, .type = DRM_PLANE_TYPE_OVERLAY }, { .base = 0x00, .phy = &rk3288_win23_data, - .type = DRM_PLANE_TYPE_OVERLAY }, + .type = DRM_PLANE_TYPE_OVERLAY, + .area = rk3288_area_data, + .area_size = ARRAY_SIZE(rk3288_area_data), }, { .base = 0x50, .phy = &rk3288_win23_data, - .type = DRM_PLANE_TYPE_CURSOR }, + .type = DRM_PLANE_TYPE_CURSOR, + .area = rk3288_area_data, + .area_size = ARRAY_SIZE(rk3288_area_data), }, }; static const int rk3288_vop_intrs[] = {