Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2271620iob; Thu, 5 May 2022 21:25:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3dtq0jYozZCdjaNRSiY+Q5ZKMeu3wkzF6kAwxGqepQZmLexqsG0JnGXu0/SOYCyN9MbcR X-Received: by 2002:a05:6402:34cd:b0:428:1043:6231 with SMTP id w13-20020a05640234cd00b0042810436231mr1572751edc.274.1651811157024; Thu, 05 May 2022 21:25:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651811157; cv=none; d=google.com; s=arc-20160816; b=Bfq1UwfNMYhXOfmDrg8WA1OsG+K2kg2MNBO2fyIlBXmhMEB7MTIR/CY3GxVNA4L9uZ j7E9oLrtpy1UNnchgltvvDiZkj9WyIo29vAXIyQ2FgG3+DIDxBVVITcf1RQBddYhBSvn WvZw/P53d6+roO0D9LQfd/UwTHSmxq9HLGZmhMwYT16+JeQqEXsDp8vqSAeKPL9LvQu2 c8THDtFvC5Yq3smId3aqfpyHTWL5a9QznTGwP9alPLKvuIaOdWuftGgh7GyH4Gm6bOLC YHrlHQNIsPcYJ5JfRoHpmh9jwm7Bzlg071fwNwDrUr848+2Y3ItaCdWVAkeXdKI7Q2fZ rgCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hNKfPmO+OXr26AW2jrJVwBNiO0JoYX2NFv4hbHWnyaQ=; b=St8gY9SWEbWT0gIDUeVwTn8M1LAxt+8KA+KhpR/TcuIKJ7yAL63sWKxJfrSaoSnghL enMIHg9Xh3pJqnU8TGaYq56IIqKuxxECa/VN2RVjduT7lPj+UbQiRpSKEw4JQC46ic29 CiIVkm5DiF9sLajzlwas0BafbPyusyeowCeTrJpEzf0DVlWmEYghEFmKe6u4HjC2EMrT iRomGbsxKYD/xPeHcO68UDvLqSk0UCJkcAf9eJKIuilLvUH2x5S6fw8aFyNtmRk7e/fX IdrHZ02pSBTiwKW5PMUx06auA6zApv2C0e+iure4/JSI1zCit09bSDyTHD9ywd1Aa6fK /NtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=i+VRgrjC; 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=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a14-20020a170906684e00b006e832929deesi3832498ejs.421.2022.05.05.21.25.33; Thu, 05 May 2022 21:25:57 -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=@intel.com header.s=Intel header.b=i+VRgrjC; 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=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1346780AbiEETXT (ORCPT + 99 others); Thu, 5 May 2022 15:23:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38572 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1384980AbiEETXK (ORCPT ); Thu, 5 May 2022 15:23:10 -0400 Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77EAE5006E; Thu, 5 May 2022 12:19:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651778369; x=1683314369; h=date:from:to:cc:subject:message-id:references: mime-version:content-transfer-encoding:in-reply-to; bh=RLW+jPbp8UIwlXJsm54YUpwL2/fRiHq7imOLuAfSmdI=; b=i+VRgrjC3WyWnsFLQwQlUkqE2glimGoulvTPgUbofBE2cE4ZJSDGgnzq QPaMQ8+6aPfp7f3EUQIsBPBEA9WYnjSV3b3baGK5Wpn4kBX4N85LIuE9a dgZsI2+UnBKF+54DrsQui3X2J5F3vpCss44o1s2LhEz6RF4ZghcFa4SxZ ffVPhUI4/AUHcJkLGZxW6MPY2Nax748QDr2NPWK0PQ9cO00k1rB50AG49 PAeYcrftvx9bdKb19dwIpFVxe0GBL2Kj4hZMYf39QQ2HMy+kSX+fSDLse Ne0yYATSAP7GUxJbPtG6FWHZmqU0NtsTA/cJ9YD2wzAPugKg8Oxw0eEZM g==; X-IronPort-AV: E=McAfee;i="6400,9594,10338"; a="248761473" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="248761473" Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 May 2022 12:19:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="600191604" Received: from stinkpipe.fi.intel.com (HELO stinkbox) ([10.237.72.51]) by orsmga001.jf.intel.com with SMTP; 05 May 2022 12:19:23 -0700 Received: by stinkbox (sSMTP sendmail emulation); Thu, 05 May 2022 22:19:22 +0300 Date: Thu, 5 May 2022 22:19:22 +0300 From: Ville =?iso-8859-1?Q?Syrj=E4l=E4?= To: Doug Anderson Cc: Lyude Paul , LKML , Thomas Zimmermann , David Airlie , Daniel Vetter , Hsin-Yi Wang , dri-devel , Stephen Boyd , Jani Nikula , Maxime Ripard , linux-arm-msm , Dmitry Baryshkov , freedreno , Robert Foss , Laurent Pinchart Subject: Re: [PATCH] drm: Document that power requirements for DP AUX transfers Message-ID: References: <20220503162033.1.Ia8651894026707e4fa61267da944ff739610d180@changeid> <1c6c9fde6e85f09cc89ea8dc6e8716fef58f3ee1.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Patchwork-Hint: comment X-Spam-Status: No, score=-4.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,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, May 05, 2022 at 08:53:12AM -0700, Doug Anderson wrote: > Hi, > > On Thu, May 5, 2022 at 8:29 AM Ville Syrj?l? > 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?l? > > > 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?l? > > > > > > wrote: > > > > > > > > > > > > > > On Tue, May 03, 2022 at 04:21:08PM -0700, Douglas Anderson wrote: > > > > > > > > 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 source and > > > > > > > > the DP sync. Commit bacbab58f09d ("drm: Mention the power state > > > > > > > > requirement on side-channel operations") added some documentation > > > > > > > > saying that the DP source is required to power itself up (if needed) > > > > > > > > to do AUX transfers. However, that commit doesn't talk anything about > > > > > > > > the DP sink. > > > > > > > > > > > > > > > > For full fledged DP the sink isn't really a problem. It's expected > > > > > > > > that if an external DP monitor isn't plugged in that attempting to do > > > > > > > > AUX transfers won't work. It's also expected that if a DP monitor is > > > > > > > > plugged in (and thus asserting HPD) that it AUX transfers will work. > > > > > > > > > > > > > > > > When we're looking at eDP, however, things are less obvious. Let's add > > > > > > > > some documentation about expectations. Here's what we'll say: > > > > > > > > > > > > > > > > 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 powred up > > > > > > > for AUX transfers. > > > > > > > > > > > > That's definitely a fair thing to think about and I have at times > > > > > > thought about trying to make it work that way. It always ends up > > > > > > 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 at > > > 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 then > > > > > > 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 coordinate > > > > > > this with DRM. If, for instance, DRM is mid way through powering the > > > > > > panel down then we need to wait for DRM to fully finish powering down, > > > > > > then we need to power the panel back up. I don't believe that we can > > > > > > just force the panel to stay on if DRM is turning it off because of > > > > > > panel power sequencing requirements. At least I know it would have the > > > > > > potential to break "samsung-atna33xc20.c" which absolutely needs to > > > > > > see the panel power off after it's been disabled. > > > > > > > > > > > > We also, I believe, need to handle the fact that the bridge chain 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 that we > > > > > > could move the EDID read to be later but that it was going to really > > > > > > ugly to move the AUX backlight later. The backlight would end up > > > > > > 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=FV=U5-sTDLYdkeJWLAOG-0wgxR49VxtwUyUO7z2PuibLGsg@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 part 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 colleague ran > > > > > > into some other bug and that panels are _supposed_ to be able to 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 difficult 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 being said > > > > > though, I think we can just leave the work of solving this problem up to > > > > > whoever ends up needing this to work. > > > > > > > > The driver should just disable/prevent PSR when doing AUX if the hardware > > > > 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, but > > > > there is still a race with PSR vs. AUX because both use the same hardware > > > > 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 hardware > > > > 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 much > > > 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 guess > > > > > > /dev/aux is essentially enabling userspace drivers to do things like > > > > > > update firmware on DP monitors or play with the backlight. I guess we > > > > > > decided that we didn't want to add drivers in the kernel to handle > > > > > > 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 place 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 looking > > > > 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 was > > > > 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? I don't want to have to eg. try to set a mode on the panel to get it to reply to AUX/DDC. I want to be able to talk to it in any situation. I don't need to jump through any extra hoops to talk to external DP panels, and don't really see why eDP should be any different. > 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. Not really sure how adding a separate knob for it would be somehow easier than just turning on the power from the aux transfer hook. > > 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 people don't feel like fixing this then I have no real objection to documenting the fact that *some* drivers can't power the panel on for AUX transfers for whatever random reason. But I disagree with claims that it is the only expected/desired behaviour. -- Ville Syrj?l? Intel