From patchwork Wed Aug 5 07:22:55 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Hunter X-Patchwork-Id: 6946741 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E8E9EC05AC for ; Wed, 5 Aug 2015 07:23:03 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 15F802047B for ; Wed, 5 Aug 2015 07:23:03 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 17E5420253 for ; Wed, 5 Aug 2015 07:23:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6C46672096; Wed, 5 Aug 2015 00:22:58 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from pku.edu.cn (mx13.pku.edu.cn [162.105.129.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 48CE372098 for ; Wed, 5 Aug 2015 00:22:56 -0700 (PDT) Received: from debian.localdomain (unknown [59.108.92.109]) by mailfront03 (Coremail) with SMTP id 84FpogD3qGXKucFVsbTDAA--.56129S8; Wed, 05 Aug 2015 15:22:51 +0800 (CST) From: John Hunter To: dri-devel@lists.freedesktop.org Subject: [PATCH 6/7] drm/cirrus: atomic dpms support Date: Wed, 5 Aug 2015 15:22:55 +0800 Message-Id: <1438759376-4509-7-git-send-email-zhjwpku@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1438759376-4509-1-git-send-email-zhjwpku@gmail.com> References: <1438759376-4509-1-git-send-email-zhjwpku@gmail.com> X-CM-TRANSID: 84FpogD3qGXKucFVsbTDA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GvfC2KfnxnUUI43ZEXa7IU878nUUUUUU== X-CM-SenderInfo: p2km411nx6wzxdlohudrp/ Cc: Daniel Vetter , Matthew Garrett , Dave Airlie X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,RCVD_IN_DNSWL_MED,RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Zhao Junwang Run dpms operations through the atomic interfaces. This basically removes the .dpms() callback from encoders and crtcs and use .disable and .enable to turn the crtc on and off. use drm_atomic_helper_connector_dpms for connector Cc: Daniel Vetter Cc: Gerd Hoffmann Cc: Matthew Garrett Cc: Dave Airlie Signed-off-by: Zhao Junwang --- drivers/gpu/drm/cirrus/cirrus_mode.c | 68 +++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/cirrus/cirrus_mode.c b/drivers/gpu/drm/cirrus/cirrus_mode.c index 1775864..e807cf0 100644 --- a/drivers/gpu/drm/cirrus/cirrus_mode.c +++ b/drivers/gpu/drm/cirrus/cirrus_mode.c @@ -55,37 +55,40 @@ static void cirrus_crtc_load_lut(struct drm_crtc *crtc) } } -/* - * The DRM core requires DPMS functions, but they make little sense in our - * case and so are just stubs - */ +static void cirrus_crtc_enable(struct drm_crtc *crtc) +{ + struct drm_device *dev = crtc->dev; + struct cirrus_device *cdev = dev->dev_private; + u8 sr01, gr0e; + + if (crtc->enabled) + return; -static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode) + sr01 = 0x00; + gr0e = 0x00; + + WREG8(SEQ_INDEX, 0x1); + sr01 |= RREG8(SEQ_DATA) & ~0x20; + WREG_SEQ(0x1, sr01); + + WREG8(GFX_INDEX, 0xe); + gr0e |= RREG8(GFX_DATA) & ~0x06; + WREG_GFX(0xe, gr0e); + + crtc->enabled = true; +} + +static void cirrus_crtc_disable(struct drm_crtc *crtc) { struct drm_device *dev = crtc->dev; struct cirrus_device *cdev = dev->dev_private; u8 sr01, gr0e; - switch (mode) { - case DRM_MODE_DPMS_ON: - sr01 = 0x00; - gr0e = 0x00; - break; - case DRM_MODE_DPMS_STANDBY: - sr01 = 0x20; - gr0e = 0x02; - break; - case DRM_MODE_DPMS_SUSPEND: - sr01 = 0x20; - gr0e = 0x04; - break; - case DRM_MODE_DPMS_OFF: - sr01 = 0x20; - gr0e = 0x06; - break; - default: + if (!crtc->enabled) return; - } + + sr01 = 0x20; + gr0e = 0x06; WREG8(SEQ_INDEX, 0x1); sr01 |= RREG8(SEQ_DATA) & ~0x20; @@ -94,6 +97,8 @@ static void cirrus_crtc_dpms(struct drm_crtc *crtc, int mode) WREG8(GFX_INDEX, 0xe); gr0e |= RREG8(GFX_DATA) & ~0x06; WREG_GFX(0xe, gr0e); + + crtc->enabled = false; } /* @@ -303,7 +308,8 @@ static const struct drm_crtc_funcs cirrus_crtc_funcs = { }; static const struct drm_crtc_helper_funcs cirrus_helper_funcs = { - .dpms = cirrus_crtc_dpms, + .disable = cirrus_crtc_disable, + .enable = cirrus_crtc_enable, .mode_fixup = cirrus_crtc_mode_fixup, .mode_set_nofb = cirrus_crtc_mode_set_nofb, .commit = cirrus_crtc_commit, @@ -490,9 +496,12 @@ static void cirrus_encoder_mode_set(struct drm_encoder *encoder, { } -static void cirrus_encoder_dpms(struct drm_encoder *encoder, int state) +static void cirrus_encoder_enable(struct drm_encoder *encoder) +{ +} + +static void cirrus_encoder_disable(struct drm_encoder *encoder) { - return; } static void cirrus_encoder_commit(struct drm_encoder *encoder) @@ -507,7 +516,8 @@ static void cirrus_encoder_destroy(struct drm_encoder *encoder) } static const struct drm_encoder_helper_funcs cirrus_encoder_helper_funcs = { - .dpms = cirrus_encoder_dpms, + .enable = cirrus_encoder_enable, + .disable = cirrus_encoder_disable, .mode_fixup = cirrus_encoder_mode_fixup, .mode_set = cirrus_encoder_mode_set, .commit = cirrus_encoder_commit, @@ -580,7 +590,7 @@ struct drm_connector_helper_funcs cirrus_vga_connector_helper_funcs = { }; struct drm_connector_funcs cirrus_vga_connector_funcs = { - .dpms = drm_helper_connector_dpms, + .dpms = drm_atomic_helper_connector_dpms, .detect = cirrus_vga_detect, .fill_modes = drm_helper_probe_single_connector_modes, .destroy = cirrus_connector_destroy,