From patchwork Wed Jun 22 12:48:15 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jocelyn Falempe X-Patchwork-Id: 12890604 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EEAB7C43334 for ; Wed, 22 Jun 2022 12:48:49 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54B3D1133C3; Wed, 22 Jun 2022 12:48:49 +0000 (UTC) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by gabe.freedesktop.org (Postfix) with ESMTPS id DE0C51133C3 for ; Wed, 22 Jun 2022 12:48:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1655902126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=q+Okm3W/B1ztawvjbkX7iXMIR7gv9KEFIMROaA/iF24=; b=PDZ5zOVrQVP5rJhZoP3XmA8NC2R2Jnf3iRALw1gJXX3aglNXGPPseosAZ7MrP31P1tbdCr VcROdHw6lq99ojAMkaJy9E0NGFttBsrhItSToIAH0m0KAKF7ePbl58/lPAEz1s0EfVajcS njVh5KETUnsUltxSJaEhRMsYrqFDqcs= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-573-hys263sHOHKuUxRM0eiVSg-1; Wed, 22 Jun 2022 08:48:43 -0400 X-MC-Unique: hys263sHOHKuUxRM0eiVSg-1 Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.rdu2.redhat.com [10.11.54.10]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2E0B3101AA45; Wed, 22 Jun 2022 12:48:43 +0000 (UTC) Received: from hydra.redhat.com (unknown [10.39.194.244]) by smtp.corp.redhat.com (Postfix) with ESMTP id 28ED740334D; Wed, 22 Jun 2022 12:48:41 +0000 (UTC) From: Jocelyn Falempe To: dri-devel@lists.freedesktop.org, tzimmermann@suse.de, kuohsiang_chou@aspeedtech.com Subject: [PATCH] drm/ast: Fix black screen when getting out of suspend Date: Wed, 22 Jun 2022 14:48:15 +0200 Message-Id: <20220622124815.356035-1-jfalempe@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.10 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jfalempe@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jocelyn Falempe , Venkat Tadikonda , hungju_huang@aspeedtech.com, michel@daenzer.net, charles_kuan@aspeedtech.com, luke_chen@aspeedtech.com Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" With an AST2600, the screen is garbage when going out of suspend. This is because color settings are lost, and not restored on resume. Force the color settings on DPMS_ON, to make sure the settings are correct. I didn't write this code, it comes from the out-of-tree aspeed driver v1.13 https://www.aspeedtech.com/support_driver/ Signed-off-by: Jocelyn Falempe Tested-by: Venkat Tadikonda Acked-by: Thomas Zimmermann Tested-by: Thomas Zimmermann --- drivers/gpu/drm/ast/ast_mode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/gpu/drm/ast/ast_mode.c b/drivers/gpu/drm/ast/ast_mode.c index 3eb9afecd9d4..cdddcb5c4439 100644 --- a/drivers/gpu/drm/ast/ast_mode.c +++ b/drivers/gpu/drm/ast/ast_mode.c @@ -990,6 +990,9 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) { struct ast_private *ast = to_ast_private(crtc->dev); u8 ch = AST_DPMS_VSYNC_OFF | AST_DPMS_HSYNC_OFF; + struct ast_crtc_state *ast_state; + const struct drm_format_info *format; + struct ast_vbios_mode_info *vbios_mode_info; /* TODO: Maybe control display signal generation with * Sync Enable (bit CR17.7). @@ -1007,6 +1010,16 @@ static void ast_crtc_dpms(struct drm_crtc *crtc, int mode) ast_dp_set_on_off(crtc->dev, 1); } + ast_state = to_ast_crtc_state(crtc->state); + format = ast_state->format; + + if (format){ + vbios_mode_info = &ast_state->vbios_mode_info; + + ast_set_color_reg(ast, format); + ast_set_vbios_color_reg(ast, format, vbios_mode_info); + } + ast_crtc_load_lut(ast, crtc); break; case DRM_MODE_DPMS_STANDBY: