Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1031462pxb; Fri, 15 Apr 2022 18:59:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTsruRxbPc5YTa9RYQDlub4MXb/KwMvfk/tWE3bbBigl7pLJ8MSv8xJMmA/9I7DI1McBeU X-Received: by 2002:a63:24d:0:b0:380:ada1:cd4b with SMTP id 74-20020a63024d000000b00380ada1cd4bmr1347642pgc.127.1650074389195; Fri, 15 Apr 2022 18:59:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650074389; cv=none; d=google.com; s=arc-20160816; b=QIS6UBU+OBoc74aAOb2CWuoIBQXT1sHAekYRS9EYPUQ3ZMGdTnYClGayzyTNssDko2 +nsgTWr8KNwHvFde7k940VcL6dt9UZNl0rDGUm11fWY5KI27WNeLLQfGPRi880KRTObi f8pYgNqUgbIsyTxpIeqXSuSMcgX+wqccB2lvIbx46SYATZ+q3meql8nbVXNXcfTn/bqM +kHfGgOPtXxsaiVJzmLwEm+zhfT6nWo0gXpSrQfzrSM3UptHsfODl/cQXZOJPNd5FsuJ OsknDI59tJ2U0G+PLu96OKdq+0Rl7ZQNt7TKpTqgg1eukHDNSw5RD7oBnO//fVimhtsQ zMuQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=y9/eIOcMzFXFy1UqdC2a9lha39G1K+4P4bzD5ljUCSQ=; b=hfCqFfQSV3vev6P512N6tF+qIa53hYVtE4cKJkT1oS1Xg7zZ5yMDkFvoKT1gFKdXbz CVJBOLal+LmxDoQJVNY4f8t0JHKDt9JRKxlb6bjTnsSFkJqSBDhVWCqu50gT77s9bYaf j3w8aJ6nxfRiMLHrBWfxVk+5GCRIeJ7IjK/Jm/dHR7BLu3VK5H9kx9w2LL3REK16mEdY HHrjdc1W1pwCIev5DdfGXgMBrIkgPs0u3EsU/Islk+ae/9cJoNeXiY6q88n7IYj+LFxx FR89Qq/BxYKltzTTLgQe9xXkDU+RC8gScbx1zmEu18rfWaVC+q/sS1y5XTTolP1jdpi5 JT+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jPU5vA6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id t16-20020a632250000000b0039d8040d8e7si2824559pgm.826.2022.04.15.18.59.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Apr 2022 18:59:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jPU5vA6Z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 29F4A1B53B3; Fri, 15 Apr 2022 18:19:55 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353639AbiDOVQR (ORCPT + 99 others); Fri, 15 Apr 2022 17:16:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353614AbiDOVP6 (ORCPT ); Fri, 15 Apr 2022 17:15:58 -0400 Received: from mail-ej1-x632.google.com (mail-ej1-x632.google.com [IPv6:2a00:1450:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 55FBDDEBA5 for ; Fri, 15 Apr 2022 14:13:29 -0700 (PDT) Received: by mail-ej1-x632.google.com with SMTP id p15so17132453ejc.7 for ; Fri, 15 Apr 2022 14:13:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=y9/eIOcMzFXFy1UqdC2a9lha39G1K+4P4bzD5ljUCSQ=; b=jPU5vA6ZbtcrunKoRNu6bC3vOFR6SeSjDk+VsAVsUKEsIvsHA/5xgsx8E5ayCjXGDF J5XGvTMhhe+hbudmYeul0I59PtZnd3nSx5rKQRf4V6GAUbv43ITNf7kY4HhZS4Of8wLj tf58+zV5OWz+71wx/OPPt0WNeilQRJX/9GpgI= 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; bh=y9/eIOcMzFXFy1UqdC2a9lha39G1K+4P4bzD5ljUCSQ=; b=0szznEl9CiYHyS97UgYQbnsVEal5DDE1WxUrl6zFBVEsJjfZ7PCyp/RwBF+wAWVGhy 7rqBPrMr5xkq6Kxu9eQzEuu+detxUcO2BaPUyoYStmQsiujwVirTniz7s4Vzgy23XlPC XApJNi85RHrgI/c9ZzoddMW7kTuA1nk58TrU808Myb9sNLX1mVLVMf3my81pl5m9ZWsj 3RSh0ynlnn+YK+juZRcABz5x3iZ22Xl3kw4q3f1ulatcWKT8tD9bLUwqyibcWWej1uLm rrQEW5q42Uv/7Sn7wybxLlmCe7S/RAdrkoWinsBaYxo1o/lY4uLzmsqHPIwkx5t7sVLw YIfw== X-Gm-Message-State: AOAM533blh36VtTyazM0aB3xbmmAerxBFEWDdNtlx2GQQTsRSaxK88iC 1chvIQyjd1ua5rukwePrqo7iHWTwffXUkw== X-Received: by 2002:a17:907:6d20:b0:6e8:bc3c:e11d with SMTP id sa32-20020a1709076d2000b006e8bc3ce11dmr723689ejc.722.1650057207379; Fri, 15 Apr 2022 14:13:27 -0700 (PDT) Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com. [209.85.221.41]) by smtp.gmail.com with ESMTPSA id m20-20020a056402431400b00419315cc3e2sm3308866edc.61.2022.04.15.14.13.26 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 15 Apr 2022 14:13:26 -0700 (PDT) Received: by mail-wr1-f41.google.com with SMTP id u3so11897147wrg.3 for ; Fri, 15 Apr 2022 14:13:26 -0700 (PDT) X-Received: by 2002:a5d:47cf:0:b0:207:ac31:c2ce with SMTP id o15-20020a5d47cf000000b00207ac31c2cemr599612wrc.422.1650057205965; Fri, 15 Apr 2022 14:13:25 -0700 (PDT) MIME-Version: 1.0 References: <20220409023628.2104952-1-dianders@chromium.org> <20220408193536.RFC.1.I4182ae27e00792842cb86f1433990a0ef9c0a073@changeid> In-Reply-To: From: Doug Anderson Date: Fri, 15 Apr 2022 14:13:12 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH 1/6] drm/dp: Helpers to make it easier for drivers to use DP AUX bus properly To: Dmitry Baryshkov Cc: dri-devel , Robert Foss , Hsin-Yi Wang , Abhinav Kumar , Sankeerth Billakanti , Philip Chen , Stephen Boyd , Daniel Vetter , David Airlie , Linus Walleij , Lyude Paul , Thomas Zimmermann , LKML Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi, On Thu, Apr 14, 2022 at 5:47 PM Dmitry Baryshkov wrote: > > On 09/04/2022 05:36, Douglas Anderson wrote: > > As talked about in the kerneldoc for "struct dp_aux_ep_client" in this > > patch and also in the past in commit a1e3667a9835 ("drm/bridge: > > ti-sn65dsi86: Promote the AUX channel to its own sub-dev"), to use the > > DP AUX bus properly we really need two "struct device"s. One "struct > > device" is in charge of providing the DP AUX bus and the other is > > where we'll try to get a reference to the newly probed endpoint > > devices. > > > > In ti-sn65dsi86 this wasn't too difficult to accomplish. That driver > > is already broken up into several "struct devices" anyway because it > > also provides a PWM and some GPIOs. Adding one more wasn't that > > difficult / ugly. > > > > When I tried to do the same solution in parade-ps8640, it felt like I > > was copying too much boilerplate code. I made the realization that I > > didn't _really_ need a separate "driver" for each person that wanted > > to do the same thing. By putting all the "driver" related code in a > > common place then we could save a bit of hassle. This change > > effectively adds a new "ep_client" driver that can be used by > > anyone. The devices instantiated by this driver will just call through > > to the probe/remove/shutdown calls provided. > > > > At the moment, the "ep_client" driver is backed by the Linux auxiliary > > bus (unfortunate naming--this has nothing to do with DP AUX). I didn't > > want to expose this to clients, though, so as far as clients are > > concerned they get a vanilla "struct device". > > I have been thinking about your approach for quite some time. I think > that enforcing a use of auxilliary device is an overkill. What do we > really need is the the set callbacks in the bus struct or a notifier. We > have to notify the aux_bus controller side that the client has been > probed successfully or that the client is going to be removed. It seems like these new callbacks would be nearly the same as the probe/remove callbacks in my proposal except: * They rely on there being exactly 1 AUX device, or we make it a rule that we wait for all AUX devices to probe (?) * We need to come up with a system for detecting when everything probes or is going to be removed, though that's probably not too hard. I guess the DP AUX bus could just replace the panel's probe function with its own and essentially "tail patch" it. I guess it could "head patch" the remove call? ...or is there some better way you were thinking of knowing when all our children probed? * The callback on the aux bus controller side would not be able to DEFER. In other words trying to acquire a reference to the panel can always be the last thing we do so we know there can be no reasons to defer after. This should be doable, but at least in the ps8640 case it will require changing the code a bit. I notice that today it actually tries to get the panel side _before_ it gets the MIPI side and it potentially can return -EPROBE_DEFER if it can't find the MIPI side. I guess I have a niggling feeling that we'll find some reason in the future that we can't be last, but we can probably ignore that. ;-) I can switch this all to normal callbacks if that's what everyone wants, but it doesn't feel significantly cleaner to me and does seem to have some (small) downsides. > And this > approach would make driver's life easier, since e.g. the bus code can > pm_get the EP device before calling callbacks/notifiers and > pm_put_autosuspend it afterwards. Not sure about doing the pm calls on behalf of the EP device. What's the goal there?