From patchwork Wed Mar 13 00:13:16 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13590780 Received: from mail-pl1-f170.google.com (mail-pl1-f170.google.com [209.85.214.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7AA033CE for ; Wed, 13 Mar 2024 00:13:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.170 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710288841; cv=none; b=OlJsFlnDzTizw6W21DnlbulzwO5MBeHNluWoS5W9fByOzNbmWGg3lz+Wgp3kyH4dd+2ryyHuX+cQtrND7X/AR/5jZQS9a5h1RSSUNp5oRW3j1MaQAN+MvXLCrysuXxAC3aw/DRjgHTXxJXdNUq5S7VvJR0YZdEwBJiVfjM73cA0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710288841; c=relaxed/simple; bh=YHGe8Mr61zFdFMoogYGbvzM2x9pXZrtdIwDPSx9JXC4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MThZGITuNGR9w+ew/5kNetjNrm70vqJRKK5oUd6aevqKKK4+3Qe+Swn1yYcT2JLfxP0MUTyx0YnKzuOBHw19z6SnxaoHzUWqA9KPSGnz+Po0zsskXP2lSdTKsTnSUOF18uR2WIlk81xRJ5QeSZJh2L8ESemmBbKDiXCjpJNv8Us= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=VsFCgmX5; arc=none smtp.client-ip=209.85.214.170 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="VsFCgmX5" Received: by mail-pl1-f170.google.com with SMTP id d9443c01a7336-1dc29f1956cso31473285ad.0 for ; Tue, 12 Mar 2024 17:13:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710288839; x=1710893639; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=iH7dOzHfySID1hx+dQROG4kWo57xV6ZLxO4hN1el+Bw=; b=VsFCgmX5e0UVWWk9bUXb6sherJM/1LcOI6PfqPb6GYbp3yywhbji8XK3O3fBLO/DNL DJUzIKALh0+gC9lOo09GIXV7h+AIGg3ufHtVPf3TyGkVjzXXf8jXPh1RKyDnrlcFNywy H7M8owjt+AEdIb0gYjOu5yI67QVYvveIC2Q8w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710288839; x=1710893639; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=iH7dOzHfySID1hx+dQROG4kWo57xV6ZLxO4hN1el+Bw=; b=UD5xgfADIJFXCOhHUkaHy03Hp1JCGmtmu9iBTtl8aM4S0D1mpTNe5vGEVLKaKZtU0N 361mZekKUgjBqm2v7EmVq9DsXy1k2PdSWbUOCEqsxoXdnTvWOWrzddXQ3QPNE4jN82Ne rMthO7xahcarDyQEgQ0EsXiCnH1hczqrTPgrrH0NCqsubteMmu5RgyEumCot1N230JWy L9oCfZXf/ByxJWp645Y37wwgWSoXrYq3lqBHUhrlKnoKZE46Pjsz/3+S+rgzdRNQUfbU +ouc4A6Y+v0DH+iz/aBuMk9GKoByoWoknZEv0vdKc/xu4NlE76eQLGQorVL93XcG0scE 6sLw== X-Forwarded-Encrypted: i=1; AJvYcCV1tDN1QtbBeFVLHBTpZeyFXp+cRAHdIII/VqJHNDF3Mfv7xCgiAAW9BxKg8B0QerZXjE6a13baVBKbXyIOdG/qZ/wlAA9apENUn30WQA== X-Gm-Message-State: AOJu0YwcAGKjBRZimEjb7No1VZ3qgpdzVJIq9mMBPHvfKsxtZi0wWnQw 79q2tL9XXt84bjWdyRU7SzSF2MMjHP2MklpAQvtBPO1VsSJntFELc4Q8IXTN+w== X-Google-Smtp-Source: AGHT+IF8TBuICwc1/oaTRuDykpJ3M8i0pZiDCaxf+rAiL5WJKMEjNtGSI5raH9YjmvsuRaXg9/0jPg== X-Received: by 2002:a17:902:cec1:b0:1dd:a16e:dea4 with SMTP id d1-20020a170902cec100b001dda16edea4mr8173646plg.67.1710288839081; Tue, 12 Mar 2024 17:13:59 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:f8dd:895c:e876:6edb]) by smtp.gmail.com with ESMTPSA id x8-20020a170902a38800b001dd761faec3sm7432924pla.251.2024.03.12.17.13.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 17:13:57 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov Cc: Douglas Anderson , Bjorn Andersson , Daniel Vetter , David Airlie , Guenter Roeck , Kuogee Hsieh , Marijn Suijten , Sean Paul , Tanmay Shah , Vinod Polimera , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] drm/msm/dp: Avoid a long timeout for AUX transfer if nothing connected Date: Tue, 12 Mar 2024 17:13:16 -0700 Message-ID: <20240312171305.1.I16aff881c9fe82b5e0fc06ca312da017aa7b5b3e@changeid> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240313001345.2623074-1-dianders@chromium.org> References: <20240313001345.2623074-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 As documented in the description of the transfer() function of "struct drm_dp_aux", the transfer() function can be called at any time regardless of the state of the DP port. Specifically if the kernel has the DP AUX character device enabled and userspace accesses "/dev/drm_dp_auxN" directly then the AUX transfer function will be called regardless of whether a DP device is connected. For eDP panels we have a special rule where we wait (with a 5 second timeout) for HPD to go high. This rule was important before all panels drivers were converted to call wait_hpd_asserted() and actually can be removed in a future commit. For external DP devices we never checked for HPD. That means that trying to access the DP AUX character device (AKA `hexdump -C /dev/drm_dp_auxN`) would very, very slowly timeout. Specifically on my system: $ time hexdump -C /dev/drm_dp_aux0 hexdump: /dev/drm_dp_aux0: Connection timed out real 0m8.200s Let's add a check for HPD to avoid the slow timeout. This matches what, for instance, the intel_dp_aux_xfer() function does when it calls intel_tc_port_connected_locked(). That call has a document by it explaining that it's important to avoid the long timeouts. Fixes: c943b4948b58 ("drm/msm/dp: add displayPort driver support") Signed-off-by: Douglas Anderson --- drivers/gpu/drm/msm/dp/dp_aux.c | 8 +++++++- drivers/gpu/drm/msm/dp/dp_catalog.c | 10 ++++++++++ drivers/gpu/drm/msm/dp/dp_catalog.h | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c index 03f4951c49f4..de0b0eabced9 100644 --- a/drivers/gpu/drm/msm/dp/dp_aux.c +++ b/drivers/gpu/drm/msm/dp/dp_aux.c @@ -307,7 +307,8 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, * turned on the panel and then tried to do an AUX transfer. The panel * driver has no way of knowing when the panel is ready, so it's up * to us to wait. For DP we never get into this situation so let's - * avoid ever doing the extra long wait for DP. + * avoid ever doing the extra long wait for DP and just query HPD + * directly. */ if (aux->is_edp) { ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog); @@ -315,6 +316,11 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, DRM_DEBUG_DP("Panel not ready for aux transactions\n"); goto exit; } + } else { + if (!dp_catalog_aux_is_hpd_connected(aux->catalog)) { + ret = -ENXIO; + goto exit; + } } dp_aux_update_offset_and_segment(aux, msg); diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 5142aeb705a4..93e2d413a1e7 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -266,6 +266,16 @@ int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog) 2000, 500000); } +bool dp_catalog_aux_is_hpd_connected(struct dp_catalog *dp_catalog) +{ + struct dp_catalog_private *catalog = container_of(dp_catalog, + struct dp_catalog_private, dp_catalog); + + /* poll for hpd connected status every 2ms and timeout after 500ms */ + return readl(catalog->io->dp_controller.aux.base + REG_DP_DP_HPD_INT_STATUS) & + DP_DP_HPD_STATE_STATUS_CONNECTED; +} + static void dump_regs(void __iomem *base, int len) { int i; diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index 38786e855b51..1694040c530f 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -86,6 +86,7 @@ void dp_catalog_aux_reset(struct dp_catalog *dp_catalog); void dp_catalog_aux_enable(struct dp_catalog *dp_catalog, bool enable); void dp_catalog_aux_update_cfg(struct dp_catalog *dp_catalog); int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog); +bool dp_catalog_aux_is_hpd_connected(struct dp_catalog *dp_catalog); u32 dp_catalog_aux_get_irq(struct dp_catalog *dp_catalog); /* DP Controller APIs */ From patchwork Wed Mar 13 00:13:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13590781 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C2BE04A07 for ; Wed, 13 Mar 2024 00:14:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710288843; cv=none; b=JhwGlrHFPI1xlScodypWTHSQ+tuVAHIhS99Kzk1sXwntPRe2sTAHIQpWxB76/gUNMhDmCrS6edl4U6t3VeuYY69emR0deN87oXQaSfNKgqxYxHTGdZcHMVaqboQ68cw3YR2lMO6hBceVeAFND7cKk+RVRXHv+ub3a/sRHIDL2zE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710288843; c=relaxed/simple; bh=bElXbKIJI7YYYdnLkLwCaCTRKoWU1jPMgaEDYI03NW0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=WOfPr9Jm/U/+N+UMyniyO7TuMOSbAIUxeTvNrcMyWsD6OIMLlsih/v+xtFMQcMFMZZ6KrXCjEzc3ofPRqoBo00QeSFN0XOkEK33j5R8cmsRSi3+kUmbpS46ih7BrkHbOzftEAvJKqdnbCTEcooGBxNUo3aqpJDsOqB+xokYOh4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=msnTkEpK; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="msnTkEpK" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1dd10ae77d8so46103265ad.0 for ; Tue, 12 Mar 2024 17:14:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710288841; x=1710893641; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=zguE7sLhSNq0icr0rFs1uvOVo5Tuv7IbCk7xIUt0MUw=; b=msnTkEpKtWBV/8JlK3MIjGjBS0aAYNgAZKK1nV555aIRKhtcXoVWqswRInOWlh2hYp uqC8HRH881UzixiUUeTKYhHHU0M5qQOqqtRZz5IXA3fRCt03he8JcPTaTzfJK2LBak3Y wXmQulhCty8suM9RD7m6HfCjVl8frxSaGmhPU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710288841; x=1710893641; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=zguE7sLhSNq0icr0rFs1uvOVo5Tuv7IbCk7xIUt0MUw=; b=UEMXqghFptq19Rj5nF4sEkvLUzV/14oQSObbONa10E5SUFFJ/1hLFOmogHZ74MvJoc LYPuIQ0swDB2pp8VrnQigO6RH/wgPFFKBWHDiCjrWGdIMt/nKikH/f0b3ABCLNt8PZ4K Uw3NeHq8RZsrvEc343lutCJRVd3ibT4HJjgpcuc7EMJhVV0JBHksw/zBibqBr4pAQwPy nGjyp5V4D3sGdgC9cV1Ty+Kb5mpu2f4kUB7gDUxDCgBWanYmq4Gg+4TDxVS/tYvq0nY0 CZr3hxPUC5tzO19YYpyAUhC77JeEEj4eIVgABJG8+v2CRR9sPOfwiWUlSoe+rI4WSeH5 CkDw== X-Forwarded-Encrypted: i=1; AJvYcCV26TOqc1V08K+Y+AyGmg2tUQu5jMWtkZFeYQ7cqFxo7ZSIlZ3407mHRyvLri9X3WfrvwOVINvLotBPuQwN0dskq+4GvYIBdF76DEBG8g== X-Gm-Message-State: AOJu0YxfGbi0jp4/2F1UUeHYb/3850nr2a7b2pI/MyQywGb090gHwVEQ oV3yCft9jZw4xyf9vshHJKJ3BQcUDhU5PY5odLxNCnxwIfy9AtkZ05G827Ht7Q== X-Google-Smtp-Source: AGHT+IHleWIOjQ8m91s+SNRjR+JOLwIAr+kNSjLzS6dHYmUmGlbhttPA/0GuKKQLT1S7h93MHLmwng== X-Received: by 2002:a17:903:258b:b0:1dc:728d:b1de with SMTP id jb11-20020a170903258b00b001dc728db1demr2427447plb.56.1710288841166; Tue, 12 Mar 2024 17:14:01 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:f8dd:895c:e876:6edb]) by smtp.gmail.com with ESMTPSA id x8-20020a170902a38800b001dd761faec3sm7432924pla.251.2024.03.12.17.13.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 17:13:59 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov Cc: Douglas Anderson , Daniel Vetter , David Airlie , Kuogee Hsieh , Marijn Suijten , Sankeerth Billakanti , Sean Paul , Vinod Polimera , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/3] drm/msm/dp: Account for the timeout in wait_hpd_asserted() callback Date: Tue, 12 Mar 2024 17:13:17 -0700 Message-ID: <20240312171305.2.I7758d18a1773821fa39c034b16a12ef3f18a51ee@changeid> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240313001345.2623074-1-dianders@chromium.org> References: <20240313001345.2623074-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The DP wait_hpd_asserted() callback is passed a timeout which indicates how long we should wait for HPD. This timeout was being ignored in the MSM DP implementation and instead a hardcoded 500 ms timeout was used. Fix it to use the proper timeout. As part of this we move the hardcoded 500 ms number into the AUX transfer function, which isn't given a timeout. The wait in the AUX transfer function will be removed in a future commit. Fixes: e2969ee30252 ("drm/msm/dp: move of_dp_aux_populate_bus() to eDP probe()") Signed-off-by: Douglas Anderson --- drivers/gpu/drm/msm/dp/dp_aux.c | 5 +++-- drivers/gpu/drm/msm/dp/dp_catalog.c | 7 ++++--- drivers/gpu/drm/msm/dp/dp_catalog.h | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c index de0b0eabced9..fc398e8a69a7 100644 --- a/drivers/gpu/drm/msm/dp/dp_aux.c +++ b/drivers/gpu/drm/msm/dp/dp_aux.c @@ -311,7 +311,8 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, * directly. */ if (aux->is_edp) { - ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog); + ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog, + 500000); if (ret) { DRM_DEBUG_DP("Panel not ready for aux transactions\n"); goto exit; @@ -516,7 +517,7 @@ static int dp_wait_hpd_asserted(struct drm_dp_aux *dp_aux, aux = container_of(dp_aux, struct dp_aux_private, dp_aux); pm_runtime_get_sync(aux->dev); - ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog); + ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog, wait_us); pm_runtime_put_sync(aux->dev); return ret; diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.c b/drivers/gpu/drm/msm/dp/dp_catalog.c index 93e2d413a1e7..b45cf3174aa0 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.c +++ b/drivers/gpu/drm/msm/dp/dp_catalog.c @@ -253,17 +253,18 @@ void dp_catalog_aux_update_cfg(struct dp_catalog *dp_catalog) phy_calibrate(phy); } -int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog) +int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog, + unsigned long wait_us) { u32 state; struct dp_catalog_private *catalog = container_of(dp_catalog, struct dp_catalog_private, dp_catalog); - /* poll for hpd connected status every 2ms and timeout after 500ms */ + /* poll for hpd connected status every 2ms and timeout after wait_us */ return readl_poll_timeout(catalog->io->dp_controller.aux.base + REG_DP_DP_HPD_INT_STATUS, state, state & DP_DP_HPD_STATE_STATUS_CONNECTED, - 2000, 500000); + min(wait_us, 2000), wait_us); } bool dp_catalog_aux_is_hpd_connected(struct dp_catalog *dp_catalog) diff --git a/drivers/gpu/drm/msm/dp/dp_catalog.h b/drivers/gpu/drm/msm/dp/dp_catalog.h index 1694040c530f..4248c8de5cf7 100644 --- a/drivers/gpu/drm/msm/dp/dp_catalog.h +++ b/drivers/gpu/drm/msm/dp/dp_catalog.h @@ -85,7 +85,8 @@ int dp_catalog_aux_clear_hw_interrupts(struct dp_catalog *dp_catalog); void dp_catalog_aux_reset(struct dp_catalog *dp_catalog); void dp_catalog_aux_enable(struct dp_catalog *dp_catalog, bool enable); void dp_catalog_aux_update_cfg(struct dp_catalog *dp_catalog); -int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog); +int dp_catalog_aux_wait_for_hpd_connect_state(struct dp_catalog *dp_catalog, + unsigned long wait_us); bool dp_catalog_aux_is_hpd_connected(struct dp_catalog *dp_catalog); u32 dp_catalog_aux_get_irq(struct dp_catalog *dp_catalog); From patchwork Wed Mar 13 00:13:18 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Doug Anderson X-Patchwork-Id: 13590782 Received: from mail-pl1-f175.google.com (mail-pl1-f175.google.com [209.85.214.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E5AF179EF for ; Wed, 13 Mar 2024 00:14:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710288845; cv=none; b=RohdIKpKmKuWrY3YY28VM7r4bRjElh3MzKWoxKWiniGtun3PCtid7EjG+AJVlcpuSjx7LH6KV0TtsGxe6aSQKJr1iJQkKeQwvGu3zt0/5foM6+3j4FSCEpzoSHNzz5mmObmam+nryW8ZIhKE1CBNlAOYL9LDUT1uG3/xylnUwpo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710288845; c=relaxed/simple; bh=tz/keXsa37xWJ0MEaMsuV4ypOd5lshGQXM3Y1Ue3+6w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XE1fTgANDI+yQRdwry8B7w04gPkU7lsdKvPrJUbeWPBz+FX0zQaSGw5L2FWDATjpC7cMzlVfOphO3gJsBW04ekN+oJBYEBTNzPu0T1UXlY/0wAJ5CoqpX5D19jG/fWkd0XlSeZSSBY7p1qnDE+mqXyl4+RvrAwg9M+z9PVYxFbo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org; spf=pass smtp.mailfrom=chromium.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b=WJ4cjpfe; arc=none smtp.client-ip=209.85.214.175 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chromium.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="WJ4cjpfe" Received: by mail-pl1-f175.google.com with SMTP id d9443c01a7336-1dd5df90170so3412165ad.0 for ; Tue, 12 Mar 2024 17:14:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1710288843; x=1710893643; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ojXHCUbSnEQhORVd/rWq7LKRiJH0Wv/f2AD6HriHOV4=; b=WJ4cjpfe50D2VHXM6Yn+wjZm6vTrfn9hLWLGzfotXI/LO0tJZ3AYy6qE0GQftTSyeI JCw/BdUyAPEycUAIUv5Y6Sfgdfl0DH8Gc9F4VB5Nmqq8Yp6cN8XjQ8C60iD3gLxxm100 sK+taO65aJllH3v7Pp4EWkQZPFeLu0Ppuyr18= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710288843; x=1710893643; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ojXHCUbSnEQhORVd/rWq7LKRiJH0Wv/f2AD6HriHOV4=; b=RHMqnLtGkt6WQKeR4bvOyznY4QCz1HABySkTMeR7bdk5xdTVQiqkky1jEkzoHOoDSI y3aSsUToD5W8G/yxdxl1+8o4TzbIShVapDnHWdzXumcpLANb50Yll796r/2bNKHy09Cd o7SxR5bwDznB5HkqVNdjNUo/S/Q6h0xtLWod7wsFvtHmKc1cntNeyDraEwztYxos8c3z Tt+4asCwIpbZdibrojrUWdY1JEBQVyLD475ZmooOx3cjbPRR8bHB24dn3cAiPSpjLggs 6Z446nEroAXkQLVcZDJrUN+3Pc3MIE0jeB+fwYABL8uXmDebzcXAonO+DjTEstuozV8D T8wA== X-Forwarded-Encrypted: i=1; AJvYcCXM4XL69vrOfcH4JR2nBsqkASaIMk0mOvHWBb4MyugMyee0NXuDbi9HLGfT+3UaNb7Oah6QHKTQf1PkYqrieYL4bBCmSk8KDv/mdKNOGA== X-Gm-Message-State: AOJu0Yw8VPPXU5fe9rlDzzv3GONHUmGDrKwRxnN2wlMQsNaMcpGwb4ou +hhyZeQnwJySEWJiNjj5mfSypqeBLUdNl+HIWVsNdDPMKJT7TKO9rA0xv7X6rg== X-Google-Smtp-Source: AGHT+IHg+QGPW6c7yNuVfIy4mB1qUblGBo63Tt7Q82dhAxfSHW8SU9MTfYSWrSGI9xpyWtMDyKwWUw== X-Received: by 2002:a17:903:22cb:b0:1dd:8d25:f8a0 with SMTP id y11-20020a17090322cb00b001dd8d25f8a0mr1295429plg.24.1710288843216; Tue, 12 Mar 2024 17:14:03 -0700 (PDT) Received: from dianders.sjc.corp.google.com ([2620:15c:9d:2:f8dd:895c:e876:6edb]) by smtp.gmail.com with ESMTPSA id x8-20020a170902a38800b001dd761faec3sm7432924pla.251.2024.03.12.17.14.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 17:14:01 -0700 (PDT) From: Douglas Anderson To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov Cc: Douglas Anderson , Daniel Vetter , David Airlie , Kuogee Hsieh , Marijn Suijten , Sean Paul , dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/3] drm/msm/dp: Delete the old 500 ms wait for eDP HPD in aux transfer Date: Tue, 12 Mar 2024 17:13:18 -0700 Message-ID: <20240312171305.3.I535606f6d4f7e3e5588bb75c55996f61980183cd@changeid> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog In-Reply-To: <20240313001345.2623074-1-dianders@chromium.org> References: <20240313001345.2623074-1-dianders@chromium.org> Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Before the introduction of the wait_hpd_asserted() callback in commit 841d742f094e ("drm/dp: Add wait_hpd_asserted() callback to struct drm_dp_aux") the API between panel drivers and DP AUX bus drivers was that it was up to the AUX bus driver to wait for HPD in the transfer() function. Now wait_hpd_asserted() has been added. The two panel drivers that are DP AUX endpoints use it. See commit 2327b13d6c47 ("drm/panel-edp: Take advantage of wait_hpd_asserted() in struct drm_dp_aux") and commit 3b5765df375c ("drm/panel: atna33xc20: Take advantage of wait_hpd_asserted() in struct drm_dp_aux"). We've implemented wait_hpd_asserted() in the MSM DP driver as of commit e2969ee30252 ("drm/msm/dp: move of_dp_aux_populate_bus() to eDP probe()"). There is no longer any reason for long wait in the AUX transfer() function. Remove it. NOTE: the wait_hpd_asserted() is listed as "optional". That means it's optional for the DP AUX bus to implement. In the case of the MSM DP driver we implement it so we can assume it will be called. ALSO NOTE: the wait wasn't actually _hurting_ anything and wasn't even causing long timeouts, but it's still nice to get rid of unneeded code. Specificaly it's not truly needed because to handle other DP drivers that can't power on as quickly (specifically parade-ps8640) we already avoid DP AUX transfers for eDP panels that aren't powered on. See commit 8df1ddb5bf11 ("drm/dp: Don't attempt AUX transfers when eDP panels are not powered"). Signed-off-by: Douglas Anderson --- drivers/gpu/drm/msm/dp/dp_aux.c | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) diff --git a/drivers/gpu/drm/msm/dp/dp_aux.c b/drivers/gpu/drm/msm/dp/dp_aux.c index fc398e8a69a7..dd62ad6007a6 100644 --- a/drivers/gpu/drm/msm/dp/dp_aux.c +++ b/drivers/gpu/drm/msm/dp/dp_aux.c @@ -302,26 +302,14 @@ static ssize_t dp_aux_transfer(struct drm_dp_aux *dp_aux, } /* - * For eDP it's important to give a reasonably long wait here for HPD - * to be asserted. This is because the panel driver may have _just_ - * turned on the panel and then tried to do an AUX transfer. The panel - * driver has no way of knowing when the panel is ready, so it's up - * to us to wait. For DP we never get into this situation so let's - * avoid ever doing the extra long wait for DP and just query HPD - * directly. + * If HPD isn't asserted then the transfer won't succeed. Return + * right away. If we don't do this we can end up with long timeouts + * if someone tries to access the DP AUX character device when no + * DP device is connected. */ - if (aux->is_edp) { - ret = dp_catalog_aux_wait_for_hpd_connect_state(aux->catalog, - 500000); - if (ret) { - DRM_DEBUG_DP("Panel not ready for aux transactions\n"); - goto exit; - } - } else { - if (!dp_catalog_aux_is_hpd_connected(aux->catalog)) { - ret = -ENXIO; - goto exit; - } + if (!dp_catalog_aux_is_hpd_connected(aux->catalog)) { + ret = -ENXIO; + goto exit; } dp_aux_update_offset_and_segment(aux, msg);