Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1895408rdb; Mon, 8 Jan 2024 14:06:20 -0800 (PST) X-Google-Smtp-Source: AGHT+IFaGTBjCTvcK+gS/mZRYGUG75ELBCw6vWnu6d6CL/9Fe29sfiduSMM7gEnR8L1TcMlhBwHs X-Received: by 2002:a05:6e02:20c4:b0:360:6ba8:e85a with SMTP id 4-20020a056e0220c400b003606ba8e85amr7578790ilq.38.1704751580717; Mon, 08 Jan 2024 14:06:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704751580; cv=none; d=google.com; s=arc-20160816; b=Pf8NDgShJ1a+JsMMYZUu7BukBoEDWb1MfVSExHkkP7yiIoONKett7y5MT0e+FuqP1l /uIsM2uv+pmqIA38rOP3EUxvO9IfIQx/A3rXcrNxVhbnNGalr3YcBzR3OMlIgigJBOak tGjY8PKaOhhB3Ml3h+kMChF8yNkLFqe2pjfKtNfsX7lpVItCIy/PaVsOMLze7zmcY+A0 3EMFzLU9vTrTwCF8fTxhirzFafUguLsHqloY+kjLNaaflcOs/IgX/dNNTJIsWc7rgDdz hJ5qAiZCc9/yR2OLdOCOy2Buuaa4+A+gxgBH/M3mLYJ+fg2imqG6EKx8x8PrzNIoIq+h P2mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:dkim-signature; bh=BozZLSfKhF+iu4AgQmtFiF6zKYlFzL7Ea5KqoWon/vw=; fh=zA3dlscoyyE3nSXr5j1s/bDsvXTRgCWJn/PYE4IG2x4=; b=G24zmhQHYnt20c7QZ7v60oc/0d3vB1NVEzR7z9eU2R3VQjofaiOlLmBa8jSbWR+sLX KsbeaVvudBHLUiFjuss5Q/L/hQHDP3NgYxdahfEZa1Ex3ut4QPVRBODbp+L4+Qf1lPcD pgTUQGJgRsK0ncaX1YveROddfMsKCK0gUBFGBpBdf3xbn+u4q9w1Lm4YRbJ49NBwcCrr qhnknIsIPFU0FT4WsYeAEfyvExz7OZoO5aPEwjMYyL71QCKKhXuwVsJOcPhIqZvOSVLK cYDqmd+7pGrfIWSA4HSNqRv74E8u7Izw4JfsSFExpftzmWhpbYBm4zYgoWcEhKrjBRll m2aA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@chromium.org header.s=google header.b=Z2MHaa3Z; spf=pass (google.com: domain of linux-kernel+bounces-20140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id h16-20020a633850000000b005ce7efd2eb5si425446pgn.266.2024.01.08.14.06.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 14:06:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-20140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@chromium.org header.s=google header.b=Z2MHaa3Z; spf=pass (google.com: domain of linux-kernel+bounces-20140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-20140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=chromium.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 1B0BF285196 for ; Mon, 8 Jan 2024 22:06:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 65F945647A; Mon, 8 Jan 2024 22:06:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="Z2MHaa3Z" Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (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 A856F56463 for ; Mon, 8 Jan 2024 22:06:04 +0000 (UTC) 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 Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-50e7d6565b5so2426678e87.0 for ; Mon, 08 Jan 2024 14:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1704751562; x=1705356362; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=OZA6MVaxiJ2A9l409ToIFuD+Lm8QfNuypGfD4+VFQBc=; b=Z2MHaa3Z5mG6Oa+aIkFVSwOmG+RAYc3Qx+JOnO+ArJdo6JqpWZgic1gir4c9S9HmAm Z/ytWsyHoyUf9tZKwYu5+2o97VP8G9Lttl4XzF4SvGQt3V99FHWvw8kZGXQjXcOmxXVd Lfhyc27d8N2x1ubH+i7e0+olcNF+idmkMwnQM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704751562; x=1705356362; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=OZA6MVaxiJ2A9l409ToIFuD+Lm8QfNuypGfD4+VFQBc=; b=Q5wN/qB6FRTWWjkzCrmbJdNr+vwJYTiziANjst9rMQte5j9tPLTeyzLib9vMnlcXEa C/vWg+y3QJD/I37jyzsRwDaB39i9QGmehUtMOMnZzxN47EnfiB/UdCM1ADIAaqwRFiQS o7d9QPIYZdRY0/WD7iPeN6Yl2wBaV546Yd17xLv71k2ClqY8ohNLVUxi0MW2/QipUTvF 9BxYLl3Qe2/a1GH/XLClZNLtJ7SG94Y8IoMz1mkuuVhI9zM+9ww/PakAcq82W/RUhoqk v7EdzofcC7JstOvWEumuCEheaEDYxa9w9I7OttmY/JqqBpTixFoJ1LxxYfbOPKYnTd1M MiFw== X-Gm-Message-State: AOJu0Yx+zEzyo/KezVz5+d4Z4rtwn+HYh56V0jny2HBQ5KxN+fMJggkO C65eIgGN/Ym6gvDhofflnYqOAyeLF4XqGHQtUNxO57AnyI8eMfc= X-Received: by 2002:a19:8c13:0:b0:50e:5a25:efbf with SMTP id o19-20020a198c13000000b0050e5a25efbfmr1582071lfd.42.1704751562458; Mon, 08 Jan 2024 14:06:02 -0800 (PST) Received: from mail-ed1-f44.google.com (mail-ed1-f44.google.com. [209.85.208.44]) by smtp.gmail.com with ESMTPSA id da11-20020a056402176b00b0055668ccd9a3sm257879edb.17.2024.01.08.14.06.02 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 08 Jan 2024 14:06:02 -0800 (PST) Received: by mail-ed1-f44.google.com with SMTP id 4fb4d7f45d1cf-5534180f0e9so1172a12.1 for ; Mon, 08 Jan 2024 14:06:02 -0800 (PST) X-Received: by 2002:a05:600c:444b:b0:40d:87df:92ca with SMTP id v11-20020a05600c444b00b0040d87df92camr1890wmn.3.1704751185061; Mon, 08 Jan 2024 13:59:45 -0800 (PST) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20231221135548.1.I10f326a9305d57ad32cee7f8d9c60518c8be20fb@changeid> In-Reply-To: From: Doug Anderson Date: Mon, 8 Jan 2024 13:59:30 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] drm/bridge: parade-ps8640: Wait for HPD when doing an AUX transfer To: Pin-yen Lin Cc: dri-devel@lists.freedesktop.org, hsinyi@chromium.org, Andrzej Hajda , Daniel Vetter , David Airlie , Dmitry Baryshkov , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Maarten Lankhorst , Maxime Ripard , Neil Armstrong , Robert Foss , Thomas Zimmermann , linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi, On Mon, Dec 25, 2023 at 1:08=E2=80=AFAM Pin-yen Lin wrote: > > Hi, > > On Fri, Dec 22, 2023 at 11:34=E2=80=AFPM Doug Anderson wrote: > > > > Hi, > > > > On Fri, Dec 22, 2023 at 2:29=E2=80=AFAM Pin-yen Lin wrote: > > > > > > Hi Douglas, > > > > > > On Fri, Dec 22, 2023 at 5:56=E2=80=AFAM Douglas Anderson wrote: > > > > > > > > Unlike what is claimed in commit f5aa7d46b0ee ("drm/bridge: > > > > parade-ps8640: Provide wait_hpd_asserted() in struct drm_dp_aux"), = if > > > > someone manually tries to do an AUX transfer (like via `i2cdump ${b= us} > > > > 0x50 i`) while the panel is off we don't just get a simple transfer > > > > error. Instead, the whole ps8640 gets thrown for a loop and goes in= to > > > > a bad state. > > > > > > > > Let's put the function to wait for the HPD (and the magical 50 ms > > > > after first reset) back in when we're doing an AUX transfer. This > > > > shouldn't actually make things much slower (assuming the panel is o= n) > > > > because we should immediately poll and see the HPD high. Mostly thi= s > > > > is just an extra i2c transfer to the bridge. > > > > > > > > Fixes: f5aa7d46b0ee ("drm/bridge: parade-ps8640: Provide wait_hpd_a= sserted() in struct drm_dp_aux") > > > > Signed-off-by: Douglas Anderson > > > > --- > > > > > > > > drivers/gpu/drm/bridge/parade-ps8640.c | 5 +++++ > > > > 1 file changed, 5 insertions(+) > > > > > > > > diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/d= rm/bridge/parade-ps8640.c > > > > index 541e4f5afc4c..fb5e9ae9ad81 100644 > > > > --- a/drivers/gpu/drm/bridge/parade-ps8640.c > > > > +++ b/drivers/gpu/drm/bridge/parade-ps8640.c > > > > @@ -346,6 +346,11 @@ static ssize_t ps8640_aux_transfer(struct drm_= dp_aux *aux, > > > > int ret; > > > > > > > > pm_runtime_get_sync(dev); > > > > + ret =3D _ps8640_wait_hpd_asserted(ps_bridge, 200 * 1000); > > > > + if (ret) { > > > > + pm_runtime_put_sync_suspend(dev); > > > > + return ret; > > > > + } > > > > ret =3D ps8640_aux_transfer_msg(aux, msg); > > > > pm_runtime_mark_last_busy(dev); > > > > pm_runtime_put_autosuspend(dev); > > > > -- > > > > 2.43.0.472.g3155946c3a-goog > > > > > > > > > > I think commit 9294914dd550 ("drm/bridge: parade-ps8640: Link device > > > to ensure suspend/resume order") is trying to address the same > > > problem, but we see this issue here because the device link is missin= g > > > DL_FLAG_PM_RUNTIME. I prefer to add DL_FLAG_PM_RUNTIME here so we > > > don't need to add a _ps8640_wait_hpd_asserted() after every > > > pm_runtime_get_*() call. > > > > I disagree. We've had several discussions on the lists about this > > topic before, though since I'm technically on vacation right now I'm > > not going to go look them up. In general "pm_runtime" is not > > sufficient for powering up DRM components. While DRM components can > > use pm_runtime themselves (as we are doing here), powering up another > > DRM component by grabbing a pm_runtime reference isn't right. There is > > a reason for the complexity of the DRM prepare/enable and all the > > current debates about the right order to call components in prepare() > > just demonstrates further that a simple pm_runtime reference isn't > > enough. > > > > It can be noted that, with ${SUBJECT} patch we _aren't_ powering up > > the panel. I actually tested two cases on sc7180-lazor. In one case I > > just closed the lid, which powered off the panel, but the touchscreen > > kept the panel power rail on. In this case with my patch I could still > > read the panel EDID. I then hacked the touchscreen off. Now when I > > closed the lid I'd get a timeout. This is different than if we tried > > to get a pm_runtime reference to the panel. > > > Okay, thanks for the detailed explanation. Then, let's go with the > approach in this patch. So, > > Tested-by: Pin-yen Lin > Reviewed-by: Pin-yen Lin Thanks for the tags. I've pushed this to drm-misc-fixes: 024b32db43a3 drm/bridge: parade-ps8640: Wait for HPD when doing an AUX tran= sfer