Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2196506iob; Thu, 5 May 2022 18:42:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwz/HPYtYfvWiowqx+a9pyB5Nlr1NBQXTvtMnuKDQZdXwdUo58CM3UU7oCRbfgcah5We8Q9 X-Received: by 2002:a05:6402:2743:b0:427:ccb0:b8d3 with SMTP id z3-20020a056402274300b00427ccb0b8d3mr1121854edd.72.1651801322643; Thu, 05 May 2022 18:42:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651801322; cv=none; d=google.com; s=arc-20160816; b=Ir1B7Whyg4Iw4pVtKRzt736H75pgmjhUhGxExGqwbIHWKIenXqFVJJu68Y0uciGwlq wN5B/a1E3pLG9wViGR7q2ezDSw9uYaXZTepuZWwTtiNJoXqAFx6xto3o3z779ftyBz/F ypOUKl2LNED+eevxLIf0cqs1/6qtYrHO3Xgx3yllSccQd5rtkehxOPBihS7y7l1cuyOS iKgFMBHlSiVIXLi/dWNC6ZKrVJh6SOQd7M9iyIag2ZGT0mrrbXUh/2GqYfNwQ5eWF7Kh 8khA8X3OMy6OTELmnpCIBm1p5+6hPueUTGXxGdNGxp4JiWH23tA5dP1ftyTo9ts+ioWk fsDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=hOBKsucs0VoUPv/ALOPSMFwlNoeZVWvVSpsNHH3v3zU=; b=hzrDgB9k7LjNICUbX5uKmI6mrBSkCYJEmWQBqx2kWD+6FaaiVv0oFNM/P/0iwqI/uH ArHMbAime/yLydWB4edK4u3uCLl6lpRGIyTzQ+Q+YIzxzUHLoDL2P8I961Ut5B8ieJj/ Q0q421qJxE/woExokr7TslnSD8OGNvKlqZz4Gvit0KLXTUHdlU5BHyR4AqWYBySQGwlR UmOgfLSokZRb4QfdyxJ2JXo+w3YufoJN94FMmJZe/qnTCX09519dsrb5jt4ch5RL2HAF lqqRUj7Erbz5UdZ8Lmvg4o4734v2H2CqF36x/4DdCcvokgpcL+yNm4cGuhXn75BEL22R 7yOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AA4C9n9/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id nc36-20020a1709071c2400b006f4fe0e5576si3103369ejc.34.2022.05.05.18.41.39; Thu, 05 May 2022 18:42:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="AA4C9n9/"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1385684AbiEEUNr (ORCPT + 99 others); Thu, 5 May 2022 16:13:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385682AbiEEUNq (ORCPT ); Thu, 5 May 2022 16:13:46 -0400 Received: from mail-yb1-xb34.google.com (mail-yb1-xb34.google.com [IPv6:2607:f8b0:4864:20::b34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2987F5F8EC for ; Thu, 5 May 2022 13:10:04 -0700 (PDT) Received: by mail-yb1-xb34.google.com with SMTP id m128so9501449ybm.5 for ; Thu, 05 May 2022 13:10:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=hOBKsucs0VoUPv/ALOPSMFwlNoeZVWvVSpsNHH3v3zU=; b=AA4C9n9/uPzc3x67Qqo7tjqnHMmEZimQVSDWh4HJZXGp7PnLD/AF78D6a6NbXnMsAT T4B0XxP2sNU9lct8SNzj++iDDnvMVCr/ERNSJuuDGVmFG7qSCu/kgLE5KSGiJeyJ9Hkm ks8Dnxeu+Gg5dJQEw9UkTbwD6BfpNHVTvEVa5IXPpnDlJyMBwyPLPKpmhDZ9a5+ISxMw x9KbYot9lU6PUU0JvPXf+LnL0t55esNfWMgLg1C2spBnj/0BuTNUAhHATjXWZDuXZVYy rtZDivqTbrX9lbY5KPQbgE1g70cdpZs6Xz36VyROHSF5JDUItQATRGBigfY3/MTP4zgL Hv8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=hOBKsucs0VoUPv/ALOPSMFwlNoeZVWvVSpsNHH3v3zU=; b=DWCtZxkPcNEhBz3aAZoBhtW/Px76mIQ75SV70plWMUcDxG9CqMTAZ1XFOJ5IAbDr9F hjIiK7TUlk294iYWVbbD1ER+aiqjlpFVFtPk7J1JylQ4TBdxKxH5H7z5EE/R7kKKXZqe I1xsh52H+ezjgPhZpxHw2bYbhGxdxnh1nHbXQ77Zvx0myICcRJGUwyaZUN4WqOhWGR3V SERMVVO3PlhZ0jt+23+MXbWuYjwPbb6Qk1FimI9FXK9c4OwDnzfAS+17akRBvJZETfiW mlvFHG1TeBpeyq75g5UmHeGmvuXy41961IglSxHTJXt4/fI4VbKqZTqHpcmP5e3Q7w+a g/aQ== X-Gm-Message-State: AOAM531qczDDbIb3Ge2ibi8SOLQOJ8NAMgE/1WXfsY1yrzAhldMJckoQ g4OBHrxp8InIT3KLOkeeJ/Ow93M0dpE3nKv4S5VdNw== X-Received: by 2002:a25:c0d7:0:b0:64a:250:996c with SMTP id c206-20020a25c0d7000000b0064a0250996cmr9154563ybf.512.1651781403278; Thu, 05 May 2022 13:10:03 -0700 (PDT) MIME-Version: 1.0 References: <20220503162033.1.Ia8651894026707e4fa61267da944ff739610d180@changeid> <1c6c9fde6e85f09cc89ea8dc6e8716fef58f3ee1.camel@redhat.com> In-Reply-To: From: Dmitry Baryshkov Date: Thu, 5 May 2022 23:09:48 +0300 Message-ID: Subject: Re: [PATCH] drm: Document that power requirements for DP AUX transfers To: Doug Anderson Cc: =?UTF-8?B?VmlsbGUgU3lyasOkbMOk?= , Lyude Paul , LKML , Thomas Zimmermann , David Airlie , Daniel Vetter , Hsin-Yi Wang , dri-devel , Stephen Boyd , Jani Nikula , Maxime Ripard , linux-arm-msm , freedreno , Robert Foss , Laurent Pinchart Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 5 May 2022 at 18:53, Doug Anderson wrote: > > Hi, > > On Thu, May 5, 2022 at 8:29 AM Ville Syrj=C3=A4l=C3=A4 > wrote: > > > > On Thu, May 05, 2022 at 08:00:20AM -0700, Doug Anderson wrote: > > > Hi, > > > > > > On Thu, May 5, 2022 at 7:46 AM Ville Syrj=C3=A4l=C3=A4 > > > wrote: > > > > > > > > On Wed, May 04, 2022 at 02:10:08PM -0400, Lyude Paul wrote: > > > > > On Wed, 2022-05-04 at 09:04 -0700, Doug Anderson wrote: > > > > > > Hi, > > > > > > > > > > > > On Wed, May 4, 2022 at 5:21 AM Ville Syrj=C3=A4l=C3=A4 > > > > > > wrote: > > > > > > > > > > > > > > On Tue, May 03, 2022 at 04:21:08PM -0700, Douglas Anderson wr= ote: > > > > > > > > When doing DP AUX transfers there are two actors that need = to be > > > > > > > > powered in order for the DP AUX transfer to work: the DP so= urce and > > > > > > > > the DP sync. Commit bacbab58f09d ("drm: Mention the power s= tate > > > > > > > > requirement on side-channel operations") added some documen= tation > > > > > > > > saying that the DP source is required to power itself up (i= f needed) > > > > > > > > to do AUX transfers. However, that commit doesn't talk anyt= hing about > > > > > > > > the DP sink. > > > > > > > > > > > > > > > > For full fledged DP the sink isn't really a problem. It's e= xpected > > > > > > > > that if an external DP monitor isn't plugged in that attemp= ting to do > > > > > > > > AUX transfers won't work. It's also expected that if a DP m= onitor is > > > > > > > > plugged in (and thus asserting HPD) that it AUX transfers w= ill work. > > > > > > > > > > > > > > > > When we're looking at eDP, however, things are less obvious= . Let's add > > > > > > > > some documentation about expectations. Here's what we'll sa= y: > > > > > > > > > > > > > > > > 1. We don't expect the DP AUX transfer function to power on= an eDP > > > > > > > > panel. If an eDP panel is physically connected but powered = off then it > > > > > > > > makes sense for the transfer to fail. > > > > > > > > > > > > > > I don't agree with this. I think the panel should just get po= wred up > > > > > > > for AUX transfers. > > > > > > > > > > > > That's definitely a fair thing to think about and I have at tim= es > > > > > > thought about trying to make it work that way. It always ends u= p > > > > > > hitting a roadblock. > > > > > > > > How do you even probe the panel initially if you can't power it on > > > > without doing some kind of full modeset/etc.? > > > > > > It's not that we can't power it on without a full modeset. It' that a= t > > > panel probe time all the DRM components haven't been hooked together > > > yet, so the bridge chain isn't available yet. The panel can power > > > itself on, though. This is why the documentation I added says: "if a > > > panel driver is initiating a DP AUX transfer it may power itself up > > > however it wants" > > > > > > > > > > > > The biggest roadblock that I recall is that to make this work t= hen > > > > > > you'd have to somehow ensure that the bridge chain's pre_enable= () call > > > > > > was made as part of the AUX transfer, right? Since the transfer > > > > > > function can be called in any context at all, we have to coordi= nate > > > > > > this with DRM. If, for instance, DRM is mid way through powerin= g the > > > > > > panel down then we need to wait for DRM to fully finish powerin= g down, > > > > > > then we need to power the panel back up. I don't believe that w= e can > > > > > > just force the panel to stay on if DRM is turning it off becaus= e of > > > > > > panel power sequencing requirements. At least I know it would h= ave the > > > > > > potential to break "samsung-atna33xc20.c" which absolutely need= s to > > > > > > see the panel power off after it's been disabled. > > > > > > > > > > > > We also, I believe, need to handle the fact that the bridge cha= in may > > > > > > not have even been created yet. We do AUX transfers to read the= EDID > > > > > > and also to setup the backlight in the probe function of panel-= edp. At > > > > > > that point the panel hasn't been linked into the chain. We had = _long_ > > > > > > discussions [1] about moving these out of probe and decided tha= t we > > > > > > could move the EDID read to be later but that it was going to r= eally > > > > > > ugly to move the AUX backlight later. The backlight would end u= p > > > > > > popping up at some point in time later (the first call to panel > > > > > > prepare() or maybe get_modes()) and that seemed weird. > > > > > > > > > > > > [1] > > > > > > https://lore.kernel.org/lkml/CAD=3DFV=3DU5-sTDLYdkeJWLAOG-0wgxR= 49VxtwUyUO7z2PuibLGsg@mail.gmail.com/ > > > > > > > > > > > > > > > > > > > Otherwise you can't trust that eg. the /dev/aux > > > > > > > stuff is actually usable. > > > > > > > > > > > > Yeah, it's been on my mind to talk more about /dev/aux. I think > > > > > > /dev/aux has some problems, at least with eDP. Specifically: > > > > > > > > > > > > 1. Even if we somehow figure out how to power the panel on as p= art of > > > > > > the aux transfer, we actually _still_ not guaranteed to be able= to > > > > > > talk to it as far as I understand. My colleague reported to me = that on > > > > > > a system he was working with that had PSR (panel self refresh) = that > > > > > > when the panel was powered on but in PSR mode that it wouldn't = talk > > > > > > over AUX. Assuming that this is correct then I guess we'd also = have to > > > > > > do even more coordination with DRM to exit PSR and block future > > > > > > transitions of PSR. (NOTE: it's always possible that my colleag= ue ran > > > > > > into some other bug and that panels are _supposed_ to be able t= o talk > > > > > > in PSR. If you think this is the case, I can always try to dig = more). > > > > > > > > > > TBH - the coordination with drm I don't think would be the diffic= ult part, as > > > > > we'd just need to add some sort of property (ideally invisible to= userspace) > > > > > that can be used in an atomic commit to disable PSR - similar to = how we enable > > > > > CRC readback from sysfs in the majority of DRM drivers. That bein= g said > > > > > though, I think we can just leave the work of solving this proble= m up to > > > > > whoever ends up needing this to work. > > > > > > > > The driver should just disable/prevent PSR when doing AUX if the ha= rdware > > > > can't guarantee the PSR and AUX won't interfere with each other. > > > > > > OK, fair enough. If we can solve the PSR problem that would be great. > > > > > > > > > > For i915 we have no problems with powering the panel on for AUX, bu= t > > > > there is still a race with PSR vs. AUX because both use the same ha= rdware > > > > internally. I've been nagging at people to fix this for i915 but I = don't > > > > think it still got done :( Originally we were supposed to get a har= dware > > > > mutex for this but that plan got scrapped for some reason. > > > > > > I haven't looked at the i915 DRM code much, but my understanding is > > > that it's more of an "all in one" approach. The one driver pretty muc= h > > > handles everything itself. That means that powering the panel up isn'= t > > > too hard. Is that right? > > > > Yeah, we don't have too many "helpful" abstractions in the way ;) > > > > > > > > for userspace to be mucking with /dev/aux. For DP's case I gues= s > > > > > > /dev/aux is essentially enabling userspace drivers to do things= like > > > > > > update firmware on DP monitors or play with the backlight. I gu= ess we > > > > > > decided that we didn't want to add drivers in the kernel to han= dle > > > > > > this type of stuff so we left it for userspace? For eDP, though= , there > > > > > > > > > > The main reason DP AUX got exposed to userspace in the first plac= e was for > > > > > usecases like fwupd, > > > > > > > > My memory says the original reason was debugging. Or at least I had > > > > no idea fwupd had started to use this until I saw some weird lookin= g > > > > DPCD addresses in some debug log. > > > > > > > > But I suppose it's possible there were already plans for firmware > > > > updates and whatnot and it just wasn't being discussed when this wa= s > > > > being developed. > > > > > > If it's just for debugging, I'd argue that leaving it as-is should be > > > fine. Someone poking around with their system can find a way to make > > > sure that the panel stays on. > > > > That could require altering the state of the system quite a bit, which > > may defeat the purpose. > > It does? In my experience you just need to make sure that the panel is > turned on. ...or are you saying that you'd use this for debugging a > case where the system isn't probing properly? > > If things are truly in bad shape, at least on boards using device tree > it's easy to tweak the device tree to force a regulator to stay on. I > suppose we could also add a "debugfs" entry for the panel that also > forces it to be powered on. > > > > At least I would not be willing to accept such > > a limitation. > > Hmm, so where does that leave us? Are you against landing this patch? > I've done a lot of cleanups recently and I just don't think I have the > time to rework all the AUX transfer functions and figure out how to > power the panel. It also seems like a lot of added complexity for a > debug path. If my 2c counts, I support landing this patch. It clearly documents current behaviour and expectations. If that helps, Acked-by: Dmitry Baryshkov As for the /dev/aux, question, I think we can make the following plan work: - Document that eDP panel power up can be handled by using the pm_runtime API (which is the case for both panel-edp and atna33xc20)). I think this is a sensible requirement anyway. And both panels show how to handle different poweron/poweroff timings. - Make drm_dp_aux_dev_get_by_minor() pm_runtime_get() the attached panel. > > > This is similar to how if you're poking > > > around with /dev/i2c it's up to you to make sure that the i2c device > > > you're poking at stays powered. --=20 With best wishes Dmitry