From patchwork Wed Jan 31 07:57:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Qiang Ma X-Patchwork-Id: 194568 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1735360dyb; Wed, 31 Jan 2024 00:02:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IFrlIU7TJydwSdAa7VVdKRP2Pg8C11OeKdNgDv+WcKrLNsOVZgZi+Q6EEf4gTyX91HeQ5T/ X-Received: by 2002:aa7:d386:0:b0:55f:64ca:5a6e with SMTP id x6-20020aa7d386000000b0055f64ca5a6emr516495edq.12.1706688127812; Wed, 31 Jan 2024 00:02:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706688127; cv=pass; d=google.com; s=arc-20160816; b=C3rdwhsed7uStcE4McnLc5hRHpDmuwcOdulvjSH2BGorfIimUUYiOo6i02frH8i1mu 8p3J7qpWkEm+Dmq/XpAT0fFqs8115SIHN4H/rQNFEKUYCmAb8LEWz9XbqCzrEMXI3Cz1 +qw4Oyy5rT3UNlBkxwGdbABbuXoM0QeNEfyEZlmG/lpHl93NEbtZ7Yd8PUW7Co53+n+1 TkXcSSL6PzJ9mLsnEM6P376JM9R+dn8DaIKwOdqfJWwt97eQbuMJtOS7PjRY5E4QD4lB lCkCIQoeed/LjPhiLQEzxiMHkxfgqO58RuXcAGUbg+jKJ+T8ThEa/LfkorjPC0iuDdKb OHDg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=feedback-id:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=KZby9dQhuwRuVsEB43/nTi1ZYmt5eTTQwEyDvJwQ8aA=; fh=Im+2rJseN0z03XcLPjeqHB88ku6MRRryDE1WXbuS2p0=; b=Y1wbhCgGF1mlBegRVVxaRn9l6Mp7lvUZ5EhhbCAf5w9DaQNel6yOHBdz+wMc7aL3v/ XxhgH0qp8s0+3cj5FKc5WEawZNtbuDk0qkqSuNYDujQVxFoVc21bsmi49BfyBFPIoq7y OCaIV6EBUW4+sf2KgYV/bfJ3aKoXkWCnJgbIuvPUxFzMvJwhukoHerdj7GazUVA/SxQy DdU7bUG4YPg1TKDwHJScSIBzrEp3PLiu05LbH8c32CXrAWxZH+NZqCy4IKt3ICDvTWEO Q9xPDpF2+yz1qXr3O4c4tgwUYvgd1dbxOq0oiwTk4xpAlB1+1wJKp7kvuARa89/KcG2s +JKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=uniontech.com); spf=pass (google.com: domain of linux-kernel+bounces-45962-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45962-ouuuleilei=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCWdNgVIX/lcvD4H9RG5+oy08+r1po6K2aW1oLKIP4XATZE41Jq2ey8cF2VuPwm56F4uRGa933fM3UU4AF51t9aBgvYCpQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id cs1-20020a0564020c4100b0055d94185143si4994169edb.673.2024.01.31.00.02.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 31 Jan 2024 00:02:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45962-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=uniontech.com); spf=pass (google.com: domain of linux-kernel+bounces-45962-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45962-ouuuleilei=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 411AF1F22F64 for ; Wed, 31 Jan 2024 08:02:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4B58A60898; Wed, 31 Jan 2024 08:01:28 +0000 (UTC) Received: from bg5.exmail.qq.com (bg5.exmail.qq.com [43.154.197.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1A64F5DF25 for ; Wed, 31 Jan 2024 08:01:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=43.154.197.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706688086; cv=none; b=PgkWcuGqXwkys+AWBUpww4JSJm5tFBvtkGPKiLXUrLCmMfkU3Xsb/xYHhZo7G1jPKDbixFh2Rjt8sOj9mA+B8kgA6NYVfh3SksyUCRSw96Y3YyD3BTWWEjQB5hjLCkFTEs3fm6wB/1Awpqc3aFhofWPgDljpOJ8amrW8+xz2XE0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706688086; c=relaxed/simple; bh=dwnDmKi2D3lxOwf+xZv5RL9PmQaHEqrATOxuPq4XidQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=AVCfXeadpjwZIjgH4jU6evbK+dzqK0gs5wje0M8+HGcJSskCcFS1iwqkYYwXsdB+yTCk1euFA4GnkciF2S7Y2Yyi6dvED39v/3EjQi46WQF5L9cTEsOy6wbERL2V6Qe1pPUglTOcxIa9cYT0+/ClRkf5BtOoPxHpAZiltW6fx3g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=uniontech.com; spf=pass smtp.mailfrom=uniontech.com; arc=none smtp.client-ip=43.154.197.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=uniontech.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=uniontech.com X-QQ-mid: bizesmtp89t1706688027th56win0 X-QQ-Originating-IP: KQpK/PDyDmc54dnUtVZv7CyrvU17uca8QXqUDFp2hRU= Received: from localhost.localdomain ( [123.114.60.34]) by bizesmtp.qq.com (ESMTP) with id ; Wed, 31 Jan 2024 16:00:25 +0800 (CST) X-QQ-SSF: 01400000000000E0L000000A0000000 X-QQ-FEAT: CR3LFp2JE4mvgzHDt8GZfGezvQzfNYVF+11pE6LOuVF6n18ZsLrVMir3YiUr5 Yl11v7yw06d0eMvVAQsLOahZW5ms0a/GIJeTYOK8UOs1snl0xjnuz3qi7sIlzzNKONSiY9X lZxG/NiavXGgRJEEXqOYsBOkwHu63WNaiSfy3AlY3LgVUZ5vhtz/iMmsh0Qp/nRhRj1nL+V JD2givdVKbBy+D7fD48q2olGvEQlSKQFf+X30NKwrKYvYsko1DyFAAPUAPawdagcH+gZ5Od M16d5beHDeafVjmeb1+SwtdgsLxXEOm4MfVn91RBaRPIgBVyl3z/94BKlwg+vk/NjwH+SKH SL2G4yx9/yyKB/G37NYymu/cGCOK8TncDTD1NUhWals3BPJNVZHwfsxKZwgj5Lo7vzHK0gW lI18A5kr6tI= X-QQ-GoodBg: 1 X-BIZMAIL-ID: 11701286619557200158 From: Qiang Ma To: alexander.deucher@amd.com, christian.koenig@amd.com, Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch, srinivasan.shanmugam@amd.com, sunran001@208suo.com Cc: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Qiang Ma Subject: [PATCH v2] drm/amdgpu: Clear the hotplug interrupt ack bit before hpd initialization Date: Wed, 31 Jan 2024 15:57:03 +0800 Message-Id: <20240131075703.24600-1-maqianga@uniontech.com> X-Mailer: git-send-email 2.20.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-QQ-SENDSIZE: 520 Feedback-ID: bizesmtp:uniontech.com:qybglogicsvrsz:qybglogicsvrsz4a-0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789592210448313520 X-GMAIL-MSGID: 1789592210448313520 Problem: The computer in the bios initialization process, unplug the HDMI display, wait until the system up, plug in the HDMI display, did not enter the hotplug interrupt function, the display is not bright. Fix: After the above problem occurs, and the hpd ack interrupt bit is 1, the interrupt should be cleared during hpd_init initialization so that when the driver is ready, it can respond to the hpd interrupt normally. Signed-off-by: Qiang Ma --- v2: - Remove unused variable 'tmp' - Fixed function spelling errors drivers/gpu/drm/amd/amdgpu/dce_v10_0.c | 2 ++ drivers/gpu/drm/amd/amdgpu/dce_v11_0.c | 2 ++ drivers/gpu/drm/amd/amdgpu/dce_v6_0.c | 22 ++++++++++++++++++---- drivers/gpu/drm/amd/amdgpu/dce_v8_0.c | 22 ++++++++++++++++++---- 4 files changed, 40 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c index bb666cb7522e..12a8ba929a72 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c @@ -51,6 +51,7 @@ static void dce_v10_0_set_display_funcs(struct amdgpu_device *adev); static void dce_v10_0_set_irq_funcs(struct amdgpu_device *adev); +static void dce_v10_0_hpd_int_ack(struct amdgpu_device *adev, int hpd); static const u32 crtc_offsets[] = { CRTC0_REGISTER_OFFSET, @@ -363,6 +364,7 @@ static void dce_v10_0_hpd_init(struct amdgpu_device *adev) AMDGPU_HPD_DISCONNECT_INT_DELAY_IN_MS); WREG32(mmDC_HPD_TOGGLE_FILT_CNTL + hpd_offsets[amdgpu_connector->hpd.hpd], tmp); + dce_v10_0_hpd_int_ack(adev, amdgpu_connector->hpd.hpd); dce_v10_0_hpd_set_polarity(adev, amdgpu_connector->hpd.hpd); amdgpu_irq_get(adev, &adev->hpd_irq, amdgpu_connector->hpd.hpd); diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c index 7af277f61cca..745e4fdffade 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c @@ -51,6 +51,7 @@ static void dce_v11_0_set_display_funcs(struct amdgpu_device *adev); static void dce_v11_0_set_irq_funcs(struct amdgpu_device *adev); +static void dce_v11_0_hpd_int_ack(struct amdgpu_device *adev, int hpd); static const u32 crtc_offsets[] = { @@ -387,6 +388,7 @@ static void dce_v11_0_hpd_init(struct amdgpu_device *adev) AMDGPU_HPD_DISCONNECT_INT_DELAY_IN_MS); WREG32(mmDC_HPD_TOGGLE_FILT_CNTL + hpd_offsets[amdgpu_connector->hpd.hpd], tmp); + dce_v11_0_hpd_int_ack(adev, amdgpu_connector->hpd.hpd); dce_v11_0_hpd_set_polarity(adev, amdgpu_connector->hpd.hpd); amdgpu_irq_get(adev, &adev->hpd_irq, amdgpu_connector->hpd.hpd); } diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c index 143efc37a17f..28c4a735716b 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v6_0.c @@ -272,6 +272,21 @@ static void dce_v6_0_hpd_set_polarity(struct amdgpu_device *adev, WREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd], tmp); } +static void dce_v6_0_hpd_int_ack(struct amdgpu_device *adev, + int hpd) +{ + u32 tmp; + + if (hpd >= adev->mode_info.num_hpd) { + DRM_DEBUG("invalid hdp %d\n", hpd); + return; + } + + tmp = RREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd]); + tmp |= DC_HPD1_INT_CONTROL__DC_HPD1_INT_ACK_MASK; + WREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd], tmp); +} + /** * dce_v6_0_hpd_init - hpd setup callback. * @@ -311,6 +326,7 @@ static void dce_v6_0_hpd_init(struct amdgpu_device *adev) continue; } + dce_v6_0_hpd_int_ack(adev, amdgpu_connector->hpd.hpd); dce_v6_0_hpd_set_polarity(adev, amdgpu_connector->hpd.hpd); amdgpu_irq_get(adev, &adev->hpd_irq, amdgpu_connector->hpd.hpd); } @@ -3088,7 +3104,7 @@ static int dce_v6_0_hpd_irq(struct amdgpu_device *adev, struct amdgpu_irq_src *source, struct amdgpu_iv_entry *entry) { - uint32_t disp_int, mask, tmp; + uint32_t disp_int, mask; unsigned hpd; if (entry->src_data[0] >= adev->mode_info.num_hpd) { @@ -3101,9 +3117,7 @@ static int dce_v6_0_hpd_irq(struct amdgpu_device *adev, mask = interrupt_status_offsets[hpd].hpd; if (disp_int & mask) { - tmp = RREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd]); - tmp |= DC_HPD1_INT_CONTROL__DC_HPD1_INT_ACK_MASK; - WREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd], tmp); + dce_v6_0_hpd_int_ack(adev, hpd); schedule_delayed_work(&adev->hotplug_work, 0); DRM_DEBUG("IH: HPD%d\n", hpd + 1); } diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c index adeddfb7ff12..8ff2b5adfd95 100644 --- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c +++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c @@ -264,6 +264,21 @@ static void dce_v8_0_hpd_set_polarity(struct amdgpu_device *adev, WREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd], tmp); } +static void dce_v8_0_hpd_int_ack(struct amdgpu_device *adev, + int hpd) +{ + u32 tmp; + + if (hpd >= adev->mode_info.num_hpd) { + DRM_DEBUG("invalid hdp %d\n", hpd); + return; + } + + tmp = RREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd]); + tmp |= DC_HPD1_INT_CONTROL__DC_HPD1_INT_ACK_MASK; + WREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd], tmp); +} + /** * dce_v8_0_hpd_init - hpd setup callback. * @@ -303,6 +318,7 @@ static void dce_v8_0_hpd_init(struct amdgpu_device *adev) continue; } + dce_v8_0_hpd_int_ack(adev, amdgpu_connector->hpd.hpd); dce_v8_0_hpd_set_polarity(adev, amdgpu_connector->hpd.hpd); amdgpu_irq_get(adev, &adev->hpd_irq, amdgpu_connector->hpd.hpd); } @@ -3176,7 +3192,7 @@ static int dce_v8_0_hpd_irq(struct amdgpu_device *adev, struct amdgpu_irq_src *source, struct amdgpu_iv_entry *entry) { - uint32_t disp_int, mask, tmp; + uint32_t disp_int, mask; unsigned hpd; if (entry->src_data[0] >= adev->mode_info.num_hpd) { @@ -3189,9 +3205,7 @@ static int dce_v8_0_hpd_irq(struct amdgpu_device *adev, mask = interrupt_status_offsets[hpd].hpd; if (disp_int & mask) { - tmp = RREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd]); - tmp |= DC_HPD1_INT_CONTROL__DC_HPD1_INT_ACK_MASK; - WREG32(mmDC_HPD1_INT_CONTROL + hpd_offsets[hpd], tmp); + dce_v8_0_hpd_int_ack(adev, hpd); schedule_delayed_work(&adev->hotplug_work, 0); DRM_DEBUG("IH: HPD%d\n", hpd + 1); }