From nobody Sun May 10 09:54:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C4443C4332F for ; Tue, 10 May 2022 19:30:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233620AbiEJTaG (ORCPT ); Tue, 10 May 2022 15:30:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232361AbiEJTaB (ORCPT ); Tue, 10 May 2022 15:30:01 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F82F2992E5 for ; Tue, 10 May 2022 12:29:59 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id x52so4101pfu.11 for ; Tue, 10 May 2022 12:29:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=zvX7gsickFQTadjtrYNgvijsVxLzBuPY+lzXCPfdMic=; b=h5NRX/t/3JyPYbL9z5iKgKKIXs3pj78+XyWNFf5wd51084g3f1xCekZsqJPUukvcPc oTOncU/sklId/q9IiCLzrfxM6K470JJ0mlX8UZlM9cPUCyuTPMJns1/sD5imD8365vZ9 WBlGpTxmL9mfRV4AAcEROMuBBaUCQSnBWsILc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zvX7gsickFQTadjtrYNgvijsVxLzBuPY+lzXCPfdMic=; b=pL9IhTG0UahZFwyDdhhq6bDQ3gIvi2CVkMwHNU3m6O6HjBEkdQLZTfhevGJkDJGzHI f8VCwXQHTp2FkRCesQ0ZxFMkQYNuw1EGQvsWCToFFrRstG2yzZ2H9zbj+O/5GrL9qBcw 3KkHdHjcSx87gxbeaN/4LI5l7rzFn43uIfl8QxUfefYtTIzXz1j0pjpucd937tNBR+wt tTvWkc4RGk2/kHpxhOewIhK/Lio0gdUhM+DbCKEO6/2+E088EbJGJ4dBsuNrhKc0aI2I D747eFL3lu+7Vp6r81JIOIpvrEcsDF73INhSAz9LNk3S3M1yZcuN+ZyAFOlY4lgGOYM1 /D7w== X-Gm-Message-State: AOAM53097fNNQ5DOG0nlwTdj6LAPYHkR9zTXh3HjQo5xZpH+WGM3P2w3 SwTvtszzy8l6Kotk33S7SwRKMg== X-Google-Smtp-Source: ABdhPJyahyDgFCU09TgF1fxSqRtJB1NMfsOwWIAdRG+4PWbHwz72o5ifalC4goK3AWXMjIro5XEw4Q== X-Received: by 2002:a65:5c48:0:b0:382:2c7:28e9 with SMTP id v8-20020a655c48000000b0038202c728e9mr18452749pgr.472.1652210999063; Tue, 10 May 2022 12:29:59 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:6f08:624c:c762:d238]) by smtp.gmail.com with ESMTPSA id s43-20020a056a001c6b00b0050dc762819dsm10786989pfw.119.2022.05.10.12.29.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 12:29:58 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Hsin-Yi Wang , Abhinav Kumar , Philip Chen , Sankeerth Billakanti , Robert Foss , freedreno@lists.freedesktop.org, Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Javier Martinez Canillas , Linus Walleij , Lyude Paul , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v3 1/4] drm/dp: Export symbol / kerneldoc fixes for DP AUX bus Date: Tue, 10 May 2022 12:29:41 -0700 Message-Id: <20220510122726.v3.1.Ia91f4849adfc5eb9da1eb37ba79aa65fb3c95a0f@changeid> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog In-Reply-To: <20220510192944.2408515-1-dianders@chromium.org> References: <20220510192944.2408515-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" While working on the DP AUX bus code I found a few small things that should be fixed. Namely the non-devm version of of_dp_aux_populate_ep_devices() was missing an export. There was also an extra blank line in a kerneldoc and a kerneldoc that incorrectly documented a return value. Fix these. Fixes: aeb33699fc2c ("drm: Introduce the DP AUX bus") Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov Reviewed-by? --- None of these seem critical, so my plan is to land this in drm-misc-next and not drm-misc-fixes. This will avoid merge conflicts with future patches. Changes in v3: - Patch ("drm/dp: Export symbol / kerneldoc fixes...") split for v3. drivers/gpu/drm/display/drm_dp_aux_bus.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_aux_bus.c b/drivers/gpu/drm/dis= play/drm_dp_aux_bus.c index dccf3e2ea323..552f949cff59 100644 --- a/drivers/gpu/drm/display/drm_dp_aux_bus.c +++ b/drivers/gpu/drm/display/drm_dp_aux_bus.c @@ -66,7 +66,6 @@ static int dp_aux_ep_probe(struct device *dev) * @dev: The device to remove. * * Calls through to the endpoint driver remove. - * */ static void dp_aux_ep_remove(struct device *dev) { @@ -120,8 +119,6 @@ ATTRIBUTE_GROUPS(dp_aux_ep_dev); /** * dp_aux_ep_dev_release() - Free memory for the dp_aux_ep device * @dev: The device to free. - * - * Return: 0 if no error or negative error code. */ static void dp_aux_ep_dev_release(struct device *dev) { @@ -256,6 +253,7 @@ int of_dp_aux_populate_ep_devices(struct drm_dp_aux *au= x) =20 return 0; } +EXPORT_SYMBOL_GPL(of_dp_aux_populate_ep_devices); =20 static void of_dp_aux_depopulate_ep_devices_void(void *data) { --=20 2.36.0.550.gb090851708-goog From nobody Sun May 10 09:54:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DD31C433F5 for ; Tue, 10 May 2022 19:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237676AbiEJTa1 (ORCPT ); Tue, 10 May 2022 15:30:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233405AbiEJTaF (ORCPT ); Tue, 10 May 2022 15:30:05 -0400 Received: from mail-pf1-x42d.google.com (mail-pf1-x42d.google.com [IPv6:2607:f8b0:4864:20::42d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 375DE2A28CA for ; Tue, 10 May 2022 12:30:01 -0700 (PDT) Received: by mail-pf1-x42d.google.com with SMTP id y41so10935156pfw.12 for ; Tue, 10 May 2022 12:30:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hX2NewzlW7IU1O5s8q9Vhm6e+LNQcR0Drq+oVtmujQU=; b=cj32nqZSsJRGZh1wN1Z0n+mCsrWiCEunfbj6m1gbZ+O3gP/NW4fhcWh972e3YkO6pS syBNPR/Wbq3utSCiOclZrKRHvGbfxe39vkPbHnQVat1S+YZA7ciMzLkVIa7ewTNm79pN 4epvL3QwK+82kBQPHssVGnKxl/e0JxpVziSA8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hX2NewzlW7IU1O5s8q9Vhm6e+LNQcR0Drq+oVtmujQU=; b=A+DrUNXLXzLyNGdF2/Utu/BQ4qZG9c+Tc6oSWSJN6hG5Zo0COYjtM7rqECdYurbOkB Prnk9mGP2n811MmuP+mrJdwWMs0BVQjDV0kOcNXWydriWkOjtiR5jUnon4p/dJ60d7TX LGbNitFbmLBLvev225JjMOsBDtcH8/rCgrDEl8b8yuB0rTuuDocQCrLB2N8K3c0RbdPT Pk1q61eqOfHXgGIyya7fL3KQdjxFsSyULEByD+bq/6cF4XyuOi5kYAZ7lmhqLjwxSo3o lfXHVhSXbIf2hQpz+HGyMqbBXbr4SBVNRVAjmkOkd1VSf5NdeixYFBEIEb6sUXS13b/D heNQ== X-Gm-Message-State: AOAM530CySQuKl+aVRyKh2p3MZvAl1Pj0P0Z6bB0NbwNP+NpEj593ZYa ruJ7I87Fge1KhymNVQo1Y1+pOw== X-Google-Smtp-Source: ABdhPJz8IHQupfUCCUpYD9mi5YoUF5MFYXxWAhPrYc7w6E3mBHGt1ig81P6c4QGtDV7+7YE6qx0CJw== X-Received: by 2002:a63:90c7:0:b0:3c6:2bba:a5c0 with SMTP id a190-20020a6390c7000000b003c62bbaa5c0mr18409517pge.3.1652211000500; Tue, 10 May 2022 12:30:00 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:6f08:624c:c762:d238]) by smtp.gmail.com with ESMTPSA id s43-20020a056a001c6b00b0050dc762819dsm10786989pfw.119.2022.05.10.12.29.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 12:30:00 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Hsin-Yi Wang , Abhinav Kumar , Philip Chen , Sankeerth Billakanti , Robert Foss , freedreno@lists.freedesktop.org, Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, Stephen Boyd , Douglas Anderson , Alex Deucher , Daniel Vetter , David Airlie , Javier Martinez Canillas , Lyude Paul , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v3 2/4] drm/dp: Add callbacks to make using DP AUX bus properly easier Date: Tue, 10 May 2022 12:29:42 -0700 Message-Id: <20220510122726.v3.2.I4182ae27e00792842cb86f1433990a0ef9c0a073@changeid> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog In-Reply-To: <20220510192944.2408515-1-dianders@chromium.org> References: <20220510192944.2408515-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" As talked about in this patch in the kerneldoc of of_dp_aux_populate_ep_device() and also in the past in commit a1e3667a9835 ("drm/bridge: ti-sn65dsi86: Promote the AUX channel to its own sub-dev"), it can be difficult for eDP controller drivers to know when the panel has finished probing when they're using of_dp_aux_populate_ep_devices(). The ti-sn65dsi86 driver managed to solve this because it was already broken up into a bunch of sub-drivers. That means we could solve the problem there by adding a new sub-driver to get the panel. We could use the traditional -EPROBE_DEFER retry mechansim to handle the case where the panel hadn't probed yet. In parade-ps8640 we didn't really solve this. The code just expects the panel to be ready right away. While reviewing the code originally I had managed to convince myself it was fine to just expect the panel right away, but additional testing has shown that not to be the case. We could fix parade-ps8640 like we did ti-sn65dsi86 but it's pretty cumbersome (since we're not already broken into multiple drivers) and requires a bunch of boilerplate code. After discussion [1] it seems like the best solution for most people is: - Accept that there's always at most one device that will probe as a result of the DP AUX bus (it may have sub-devices, but there will be one device _directly_ probed). - When that device finishes probing, we can just have a call back. This patch implements that idea. We'll now take a callback as an argument to the populate function. To make this easier to land in pieces, we'll make wrappers for the old functions. The functions with the new name (which make it clear that we only have one child) will take the callback and the functions with the old name will temporarily wrap. [1] https://lore.kernel.org/r/CAD=3DFV=3DUr3afHhsXe7a3baWEnD=3DMFKFeKRbhFU+= bt3P67G0MVzQ@mail.gmail.com Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov Reviewed-by? --- Changes in v3: - Don't call done_probing() if there are no children; return -ENODEV. - Split out EXPORT_SYMBOL and kerneldoc fixes to its own patch. - Used Dmitry's proposed name: of_dp_aux_populate_bus() Changes in v2: - Change to assume exactly one device. - Have a probe callback instead of an extra sub device. drivers/gpu/drm/display/drm_dp_aux_bus.c | 209 +++++++++++++++-------- include/drm/display/drm_dp_aux_bus.h | 34 +++- 2 files changed, 168 insertions(+), 75 deletions(-) diff --git a/drivers/gpu/drm/display/drm_dp_aux_bus.c b/drivers/gpu/drm/dis= play/drm_dp_aux_bus.c index 552f949cff59..f5741b45ca07 100644 --- a/drivers/gpu/drm/display/drm_dp_aux_bus.c +++ b/drivers/gpu/drm/display/drm_dp_aux_bus.c @@ -3,10 +3,10 @@ * Copyright 2021 Google Inc. * * The DP AUX bus is used for devices that are connected over a DisplayPort - * AUX bus. The devices on the far side of the bus are referred to as - * endpoints in this code. + * AUX bus. The device on the far side of the bus is referred to as an + * endpoint in this code. * - * Commonly there is only one device connected to the DP AUX bus: a panel. + * There is only one device connected to the DP AUX bus: an eDP panel. * Though historically panels (even DP panels) have been modeled as simple * platform devices, putting them under the DP AUX bus allows the panel dr= iver * to perform transactions on that bus. @@ -22,6 +22,11 @@ #include #include =20 +struct dp_aux_ep_device_with_data { + struct dp_aux_ep_device aux_ep; + int (*done_probing)(struct drm_dp_aux *aux); +}; + /** * dp_aux_ep_match() - The match function for the dp_aux_bus. * @dev: The device to match. @@ -48,6 +53,8 @@ static int dp_aux_ep_probe(struct device *dev) { struct dp_aux_ep_driver *aux_ep_drv =3D to_dp_aux_ep_drv(dev->driver); struct dp_aux_ep_device *aux_ep =3D to_dp_aux_ep_dev(dev); + struct dp_aux_ep_device_with_data *aux_ep_with_data =3D + container_of(aux_ep, struct dp_aux_ep_device_with_data, aux_ep); int ret; =20 ret =3D dev_pm_domain_attach(dev, true); @@ -56,7 +63,32 @@ static int dp_aux_ep_probe(struct device *dev) =20 ret =3D aux_ep_drv->probe(aux_ep); if (ret) - dev_pm_domain_detach(dev, true); + goto err_attached; + + if (aux_ep_with_data->done_probing) { + ret =3D aux_ep_with_data->done_probing(aux_ep->aux); + if (ret) { + /* + * The done_probing() callback should not return + * -EPROBE_DEFER to us. If it does, we treat it as an + * error. Passing it on as-is would cause the _panel_ + * to defer. + */ + if (ret =3D=3D -EPROBE_DEFER) { + dev_err(dev, + "DP AUX done_probing() can't defer\n"); + ret =3D -EINVAL; + } + goto err_probed; + } + } + + return 0; +err_probed: + if (aux_ep_drv->remove) + aux_ep_drv->remove(aux_ep); +err_attached: + dev_pm_domain_detach(dev, true); =20 return ret; } @@ -122,7 +154,11 @@ ATTRIBUTE_GROUPS(dp_aux_ep_dev); */ static void dp_aux_ep_dev_release(struct device *dev) { - kfree(to_dp_aux_ep_dev(dev)); + struct dp_aux_ep_device *aux_ep =3D to_dp_aux_ep_dev(dev); + struct dp_aux_ep_device_with_data *aux_ep_with_data =3D + container_of(aux_ep, struct dp_aux_ep_device_with_data, aux_ep); + + kfree(aux_ep_with_data); } =20 static struct device_type dp_aux_device_type_type =3D { @@ -136,12 +172,14 @@ static struct device_type dp_aux_device_type_type =3D= { * @dev: The device to destroy. * @data: Not used * - * This is just used as a callback by of_dp_aux_depopulate_ep_devices() and + * This is just used as a callback by of_dp_aux_depopulate_bus() and * is called for _all_ of the child devices of the device providing the AU= X bus. * We'll only act on those that are of type "dp_aux_bus_type". * - * This function is effectively an inverse of what's in the loop - * in of_dp_aux_populate_ep_devices(). + * This function is effectively an inverse of what's in + * of_dp_aux_populate_bus(). NOTE: since we only populate one child + * then it's expected that only one device will match all the "if" tests in + * this function and get to the device_unregister(). * * Return: 0 if no error or negative error code. */ @@ -164,123 +202,150 @@ static int of_dp_aux_ep_destroy(struct device *dev,= void *data) } =20 /** - * of_dp_aux_depopulate_ep_devices() - Undo of_dp_aux_populate_ep_devices - * @aux: The AUX channel whose devices we want to depopulate + * of_dp_aux_depopulate_bus() - Undo of_dp_aux_populate_bus + * @aux: The AUX channel whose device we want to depopulate * - * This will destroy all devices that were created - * by of_dp_aux_populate_ep_devices(). + * This will destroy the device that was created + * by of_dp_aux_populate_bus(). */ -void of_dp_aux_depopulate_ep_devices(struct drm_dp_aux *aux) +void of_dp_aux_depopulate_bus(struct drm_dp_aux *aux) { device_for_each_child_reverse(aux->dev, NULL, of_dp_aux_ep_destroy); } -EXPORT_SYMBOL_GPL(of_dp_aux_depopulate_ep_devices); +EXPORT_SYMBOL_GPL(of_dp_aux_depopulate_bus); =20 /** - * of_dp_aux_populate_ep_devices() - Populate the endpoint devices on the = DP AUX - * @aux: The AUX channel whose devices we want to populate. It is required= that + * of_dp_aux_populate_bus() - Populate the endpoint device on the DP AUX + * @aux: The AUX channel whose device we want to populate. It is required = that * drm_dp_aux_init() has already been called for this AUX channel. + * @done_probing: Callback functions to call after EP device finishes prob= ing. + * Will not be called if there are no EP devices and this + * function will return -ENODEV. * - * This will populate all the devices under the "aux-bus" node of the devi= ce - * providing the AUX channel (AKA aux->dev). + * This will populate the device (expected to be an eDP panel) under the + * "aux-bus" node of the device providing the AUX channel (AKA aux->dev). * * When this function finishes, it is _possible_ (but not guaranteed) that - * our sub-devices will have finished probing. It should be noted that if = our - * sub-devices return -EPROBE_DEFER that we will not return any error codes - * ourselves but our sub-devices will _not_ have actually probed successfu= lly - * yet. There may be other cases (maybe added in the future?) where sub-de= vices - * won't have been probed yet when this function returns, so it's best not= to - * rely on that. + * our sub-device will have finished probing. It should be noted that if o= ur + * sub-device returns -EPROBE_DEFER or is probing asynchronously for some + * reason that we will not return any error codes ourselves but our + * sub-device will _not_ have actually probed successfully yet. + * + * In many cases it's important for the caller of this function to be noti= fied + * when our sub device finishes probing. Our sub device is expected to be = an + * eDP panel and the caller is expected to be an eDP controller. The eDP + * controller needs to be able to get a reference to the panel when it fin= ishes + * probing. For this reason the caller can pass in a function pointer that + * will be called when our sub-device finishes probing. * * If this function succeeds you should later make sure you call - * of_dp_aux_depopulate_ep_devices() to undo it, or just use the devm vers= ion + * of_dp_aux_depopulate_bus() to undo it, or just use the devm version * of this function. * - * Return: 0 if no error or negative error code. + * Return: 0 if no error or negative error code; returns -ENODEV if there = are + * no children. The done_probing() function won't be called in that + * case. */ -int of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux) +int of_dp_aux_populate_bus(struct drm_dp_aux *aux, + int (*done_probing)(struct drm_dp_aux *aux)) { - struct device_node *bus, *np; + struct device_node *bus =3D NULL, *np =3D NULL; struct dp_aux_ep_device *aux_ep; + struct dp_aux_ep_device_with_data *aux_ep_with_data; int ret; =20 /* drm_dp_aux_init() should have been called already; warn if not */ WARN_ON_ONCE(!aux->ddc.algo); =20 if (!aux->dev->of_node) - return 0; - + return -ENODEV; bus =3D of_get_child_by_name(aux->dev->of_node, "aux-bus"); if (!bus) - return 0; + return -ENODEV; =20 - for_each_available_child_of_node(bus, np) { - if (of_node_test_and_set_flag(np, OF_POPULATED)) - continue; + np =3D of_get_next_available_child(bus, NULL); + of_node_put(bus); + if (!np) + return -ENODEV; =20 - aux_ep =3D kzalloc(sizeof(*aux_ep), GFP_KERNEL); - if (!aux_ep) - continue; - aux_ep->aux =3D aux; + if (of_node_test_and_set_flag(np, OF_POPULATED)) { + dev_err(aux->dev, "DP AUX EP device already populated\n"); + ret =3D -EINVAL; + goto err_did_get_np; + } =20 - aux_ep->dev.parent =3D aux->dev; - aux_ep->dev.bus =3D &dp_aux_bus_type; - aux_ep->dev.type =3D &dp_aux_device_type_type; - aux_ep->dev.of_node =3D of_node_get(np); - dev_set_name(&aux_ep->dev, "aux-%s", dev_name(aux->dev)); + aux_ep_with_data =3D kzalloc(sizeof(*aux_ep_with_data), GFP_KERNEL); + if (!aux_ep_with_data) { + ret =3D -ENOMEM; + goto err_did_set_populated; + } =20 - ret =3D device_register(&aux_ep->dev); - if (ret) { - dev_err(aux->dev, "Failed to create AUX EP for %pOF: %d\n", np, ret); - of_node_clear_flag(np, OF_POPULATED); - of_node_put(np); + aux_ep_with_data->done_probing =3D done_probing; =20 - /* - * As per docs of device_register(), call this instead - * of kfree() directly for error cases. - */ - put_device(&aux_ep->dev); + aux_ep =3D &aux_ep_with_data->aux_ep; + aux_ep->aux =3D aux; + aux_ep->dev.parent =3D aux->dev; + aux_ep->dev.bus =3D &dp_aux_bus_type; + aux_ep->dev.type =3D &dp_aux_device_type_type; + aux_ep->dev.of_node =3D of_node_get(np); + dev_set_name(&aux_ep->dev, "aux-%s", dev_name(aux->dev)); =20 - /* - * Following in the footsteps of of_i2c_register_devices(), - * we won't fail the whole function here--we'll just - * continue registering any other devices we find. - */ - } - } + ret =3D device_register(&aux_ep->dev); + if (ret) { + dev_err(aux->dev, "Failed to create AUX EP for %pOF: %d\n", np, ret); =20 - of_node_put(bus); + /* + * As per docs of device_register(), call this instead + * of kfree() directly for error cases. + */ + put_device(&aux_ep->dev); + + goto err_did_set_populated; + } =20 return 0; + +err_did_set_populated: + of_node_clear_flag(np, OF_POPULATED); + +err_did_get_np: + of_node_put(np); + + return ret; } -EXPORT_SYMBOL_GPL(of_dp_aux_populate_ep_devices); +EXPORT_SYMBOL_GPL(of_dp_aux_populate_bus); =20 -static void of_dp_aux_depopulate_ep_devices_void(void *data) +static void of_dp_aux_depopulate_bus_void(void *data) { - of_dp_aux_depopulate_ep_devices(data); + of_dp_aux_depopulate_bus(data); } =20 /** - * devm_of_dp_aux_populate_ep_devices() - devm wrapper for of_dp_aux_popul= ate_ep_devices() - * @aux: The AUX channel whose devices we want to populate + * devm_of_dp_aux_populate_bus() - devm wrapper for of_dp_aux_populate_bus= () + * @aux: The AUX channel whose device we want to populate + * @done_probing: Callback functions to call after EP device finishes prob= ing. + * Will not be called if there are no EP devices and this + * function will return -ENODEV. * * Handles freeing w/ devm on the device "aux->dev". * - * Return: 0 if no error or negative error code. + * Return: 0 if no error or negative error code; returns -ENODEV if there = are + * no children. The done_probing() function won't be called in that + * case. */ -int devm_of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux) +int devm_of_dp_aux_populate_bus(struct drm_dp_aux *aux, + int (*done_probing)(struct drm_dp_aux *aux)) { int ret; =20 - ret =3D of_dp_aux_populate_ep_devices(aux); + ret =3D of_dp_aux_populate_bus(aux, done_probing); if (ret) return ret; =20 return devm_add_action_or_reset(aux->dev, - of_dp_aux_depopulate_ep_devices_void, - aux); + of_dp_aux_depopulate_bus_void, aux); } -EXPORT_SYMBOL_GPL(devm_of_dp_aux_populate_ep_devices); +EXPORT_SYMBOL_GPL(devm_of_dp_aux_populate_bus); =20 int __dp_aux_dp_driver_register(struct dp_aux_ep_driver *drv, struct modul= e *owner) { diff --git a/include/drm/display/drm_dp_aux_bus.h b/include/drm/display/drm= _dp_aux_bus.h index 4f19b20b1dd6..8a0a486383c5 100644 --- a/include/drm/display/drm_dp_aux_bus.h +++ b/include/drm/display/drm_dp_aux_bus.h @@ -44,9 +44,37 @@ static inline struct dp_aux_ep_driver *to_dp_aux_ep_drv(= struct device_driver *dr return container_of(drv, struct dp_aux_ep_driver, driver); } =20 -int of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux); -void of_dp_aux_depopulate_ep_devices(struct drm_dp_aux *aux); -int devm_of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux); +int of_dp_aux_populate_bus(struct drm_dp_aux *aux, + int (*done_probing)(struct drm_dp_aux *aux)); +void of_dp_aux_depopulate_bus(struct drm_dp_aux *aux); +int devm_of_dp_aux_populate_bus(struct drm_dp_aux *aux, + int (*done_probing)(struct drm_dp_aux *aux)); + +/* Deprecated versions of the above functions. To be removed when no calle= rs. */ +static inline int of_dp_aux_populate_ep_devices(struct drm_dp_aux *aux) +{ + int ret; + + ret =3D of_dp_aux_populate_bus(aux, NULL); + + /* New API returns -ENODEV for no child case; adapt to old assumption */ + return (ret !=3D -ENODEV) ? ret : 0; +} + +static inline int devm_of_dp_aux_populate_ep_devices(struct drm_dp_aux *au= x) +{ + int ret; + + ret =3D devm_of_dp_aux_populate_bus(aux, NULL); + + /* New API returns -ENODEV for no child case; adapt to old assumption */ + return (ret !=3D -ENODEV) ? ret : 0; +} + +static inline void of_dp_aux_depopulate_ep_devices(struct drm_dp_aux *aux) +{ + of_dp_aux_depopulate_bus(aux); +} =20 #define dp_aux_dp_driver_register(aux_ep_drv) \ __dp_aux_dp_driver_register(aux_ep_drv, THIS_MODULE) --=20 2.36.0.550.gb090851708-goog From nobody Sun May 10 09:54:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id ADCD0C433F5 for ; Tue, 10 May 2022 19:30:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236887AbiEJTaO (ORCPT ); Tue, 10 May 2022 15:30:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233738AbiEJTaH (ORCPT ); Tue, 10 May 2022 15:30:07 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7116B2A2F68 for ; Tue, 10 May 2022 12:30:02 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id cx11-20020a17090afd8b00b001d9fe5965b3so2817949pjb.3 for ; Tue, 10 May 2022 12:30:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=spc3e6Lp3Smlzf38aH5fCH48i9kTiBR8/UYKG1CLueQ=; b=cz0Xr0eL1ajvZSsgLbzZbq39CiowXavZ6oKFanIVRSuNSdPrMxAI9a+lUYIybRRI8Z l9f9QgXxhrErMb0+Rw3GcIBYoSBZvvHafQIs7JEGkOMAMdASorM5GZlqQ/R8kl67yLk+ MbgQgs1sU2wNKMz62e7ITFkvv7ogeaeVCTLPs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=spc3e6Lp3Smlzf38aH5fCH48i9kTiBR8/UYKG1CLueQ=; b=UDXah5T632zXw6bxYBXGavK7+WV1tvP7X0Lmgc4ao+/kL71NTpBTfxT26jWt3Heur+ e5Iy0s1xN3dE19FUvx5xfPgX3DJvRD24i+KJbcrEgonGgdS4ES/+xeTbOOTgSHHGcEOO 4FwHGCK0fpzgzLiEMSjwKkN2cZIaaqfo8laxzKTGzaIXiiexYtph9XNm75ULkDT7y0DM n1y5iqblHv22n3fALqhjQvQee9oXC+f8qZUFC8jxI/lcLAo5tEM+Iraw13pUXGxmlDvT H8ktiuMz/cE2lL/0LX6DWP533ob82XGQP9DOQxMbP0m2C37EHCq4eGx0yCbrmBTsxx9b 2+zQ== X-Gm-Message-State: AOAM532/lXOaPO8j7QM8AjRDrJwjXk099IpKHvwrQpWggs7ynmxN4jvp GmUtXrWEQ3goa2Z/N/lLGtDALQ== X-Google-Smtp-Source: ABdhPJzOGtFQdD3JQK9OwWb3IO12+CBeitf6Rww1LcnbNvhYQovH5NU3lYy2huG1tVOn6wVcGz6pqg== X-Received: by 2002:a17:90b:1001:b0:1d8:4978:c7d5 with SMTP id gm1-20020a17090b100100b001d84978c7d5mr1405066pjb.167.1652211001798; Tue, 10 May 2022 12:30:01 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:6f08:624c:c762:d238]) by smtp.gmail.com with ESMTPSA id s43-20020a056a001c6b00b0050dc762819dsm10786989pfw.119.2022.05.10.12.30.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 12:30:01 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Hsin-Yi Wang , Abhinav Kumar , Philip Chen , Sankeerth Billakanti , Robert Foss , freedreno@lists.freedesktop.org, Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, Stephen Boyd , Douglas Anderson , Daniel Vetter , David Airlie , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: [PATCH v3 3/4] drm/bridge: Add devm_drm_bridge_add() Date: Tue, 10 May 2022 12:29:43 -0700 Message-Id: <20220510122726.v3.3.Iba4b9bf6c7a1ee5ea2835ad7bd5eaf84d7688520@changeid> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog In-Reply-To: <20220510192944.2408515-1-dianders@chromium.org> References: <20220510192944.2408515-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" This adds a devm managed version of drm_bridge_add(). Like other "devm" function listed in drm_bridge.h, this function takes an explicit "dev" to use for the lifetime management. A few notes: * In general we have a "struct device" for bridges that makes a good candidate for where the lifetime matches exactly what we want. * The "bridge->dev->dev" device appears to be the encoder device. That's not the right device to use for lifetime management. Suggested-by: Dmitry Baryshkov Signed-off-by: Douglas Anderson Reviewed-by: Daniel Vetter Reviewed-by: Dmitry Baryshkov Reviewed-by? --- Changes in v3: - Patch ("drm/bridge: Add devm_drm_bridge_add()") new for v3. drivers/gpu/drm/drm_bridge.c | 23 +++++++++++++++++++++++ include/drm/drm_bridge.h | 1 + 2 files changed, 24 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index c96847fc0ebc..e275b4ca344b 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -170,6 +170,29 @@ void drm_bridge_add(struct drm_bridge *bridge) } EXPORT_SYMBOL(drm_bridge_add); =20 +static void drm_bridge_remove_void(void *bridge) +{ + drm_bridge_remove(bridge); +} + +/** + * devm_drm_bridge_add - devm managed version of drm_bridge_add() + * + * @dev: device to tie the bridge lifetime to + * @bridge: bridge control structure + * + * This is the managed version of drm_bridge_add() which automatically + * calls drm_bridge_remove() when @dev is unbound. + * + * Return: 0 if no error or negative error code. + */ +int devm_drm_bridge_add(struct device *dev, struct drm_bridge *bridge) +{ + drm_bridge_add(bridge); + return devm_add_action_or_reset(dev, drm_bridge_remove_void, bridge); +} +EXPORT_SYMBOL(devm_drm_bridge_add); + /** * drm_bridge_remove - remove the given bridge from the global bridge list * diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index f27b4060faa2..42aec8612f37 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -796,6 +796,7 @@ drm_priv_to_bridge(struct drm_private_obj *priv) } =20 void drm_bridge_add(struct drm_bridge *bridge); +int devm_drm_bridge_add(struct device *dev, struct drm_bridge *bridge); void drm_bridge_remove(struct drm_bridge *bridge); int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *brid= ge, struct drm_bridge *previous, --=20 2.36.0.550.gb090851708-goog From nobody Sun May 10 09:54:41 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9D3AFC433EF for ; Tue, 10 May 2022 19:30:24 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235304AbiEJTaX (ORCPT ); Tue, 10 May 2022 15:30:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46734 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233796AbiEJTaH (ORCPT ); Tue, 10 May 2022 15:30:07 -0400 Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 711982A76AB for ; Tue, 10 May 2022 12:30:03 -0700 (PDT) Received: by mail-pg1-x534.google.com with SMTP id 7so15418492pga.12 for ; Tue, 10 May 2022 12:30:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aenq/+payNfc0QfJK06n0457dQA2IsFpv+YO3oHnMIs=; b=CsVaXK6RqVBe6/OondZCpIqQ7YKFDn6kpSdzq7AGRLrpvTEGfziCDVpjEcn1dGwcxG odjvGogk7T1c8MDGI1PdHVpkNBpnOVPpOPHHqR6HCq0wqMfSHNnWHqHvuYz8j7jMzWft 24EJaIJLYYXB725FpyUMI280VvP5MT0WzMCyE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=aenq/+payNfc0QfJK06n0457dQA2IsFpv+YO3oHnMIs=; b=xvFmYDeOI+6AyCITu05nuYkjITWPM4ODhRCDNDXxI2UuN/oeWvdnB/54Oqp17bo3A2 Eg2wvcyFOmEofmNWFUi0La3FKx33F1NnA9qnuhhxnPWHfGZ+u+k1OaeR3LezAWbDsOsK zD37ce21AKK5T+kDTDQQDotIBhz5X5DXebG/MKGXQiA+igKizVcJSM/PnsPGQ/KlgtCs g7S9dNcZSyOWdo7GMi5yke2sHeFkYEOoQMZMgLOzhjFTdcfvYNPnHR3fBGnU5pRhnTmm 2XSfXqKmX9VsX0qWq9OqHaNL3sGbQh4EuxfjOWkxX0p5ixwZDd/jYcuTE+4gsuVVvsMO uhrw== X-Gm-Message-State: AOAM533LIRJJZXBup+TG8OSQkFOYJE/CNuVMAoJaCtcRp4aflWb/uUEY teYJFFEMSZIInZWUSKr53g96ng== X-Google-Smtp-Source: ABdhPJyPgq9U3n6oXN3Vhj9GL6f0h6l49jG5QJ7lbqux34S+dYjO6ryIbGNnIKoQpI5HH+YnCl8/iQ== X-Received: by 2002:a63:e5d:0:b0:3aa:3c53:537e with SMTP id 29-20020a630e5d000000b003aa3c53537emr18041665pgo.622.1652211002972; Tue, 10 May 2022 12:30:02 -0700 (PDT) Received: from tictac2.mtv.corp.google.com ([2620:15c:202:201:6f08:624c:c762:d238]) by smtp.gmail.com with ESMTPSA id s43-20020a056a001c6b00b0050dc762819dsm10786989pfw.119.2022.05.10.12.30.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 May 2022 12:30:02 -0700 (PDT) From: Douglas Anderson To: dri-devel@lists.freedesktop.org Cc: Hsin-Yi Wang , Abhinav Kumar , Philip Chen , Sankeerth Billakanti , Robert Foss , freedreno@lists.freedesktop.org, Dmitry Baryshkov , linux-arm-msm@vger.kernel.org, Stephen Boyd , Douglas Anderson , Andrzej Hajda , Daniel Vetter , David Airlie , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Neil Armstrong , linux-kernel@vger.kernel.org Subject: [PATCH v3 4/4] drm/bridge: parade-ps8640: Handle DP AUX more properly Date: Tue, 10 May 2022 12:29:44 -0700 Message-Id: <20220510122726.v3.4.Ia6324ebc848cd40b4dbd3ad3289a7ffb5c197779@changeid> X-Mailer: git-send-email 2.36.0.550.gb090851708-goog In-Reply-To: <20220510192944.2408515-1-dianders@chromium.org> References: <20220510192944.2408515-1-dianders@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" While it works, for the most part, to assume that the panel has finished probing when devm_of_dp_aux_populate_ep_devices() returns, it's a bit fragile. This is talked about at length in commit a1e3667a9835 ("drm/bridge: ti-sn65dsi86: Promote the AUX channel to its own sub-dev"). When reviewing the ps8640 code, I managed to convince myself that it was OK not to worry about it there and that maybe it wasn't really _that_ fragile. However, it turns out that it really is. Simply hardcoding panel_edp_probe() to return -EPROBE_DEFER was enough to put the boot process into an infinite loop. I believe this manages to trip the same issues that we used to trip with the main MSM code where something about our actions trigger Linux to re-probe previously deferred devices right away and each time we try again we re-trigger Linux to re-probe. Let's fix this using the callback introduced in the patch ("drm/dp: Callbacks to make it easier for drivers to use DP AUX bus properly"). When using the new callback, we have to be a little careful. The probe_done() callback is no longer always called in the context of our probe routine. That means we can't rely on being able to return -EPROBE_DEFER from it. We re-jigger the order of things a bit to account for that. With this change, the device still boots (though obviously the panel doesn't come up) if I force panel-edp to always return -EPROBE_DEFER. If I fake it and make the panel probe exactly once it also works. Signed-off-by: Douglas Anderson Reviewed-by: Dmitry Baryshkov Reviewed-by? --- Changes in v3: - Adapt to v3 changes in aux bus. - Use devm_drm_bridge_add() to simplify. Changes in v2: - Rewrote atop new method introduced by patch #1. drivers/gpu/drm/bridge/parade-ps8640.c | 74 ++++++++++++++++---------- 1 file changed, 46 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridg= e/parade-ps8640.c index e2467e58b5b7..ff4227f6d800 100644 --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -537,7 +537,7 @@ static const struct drm_bridge_funcs ps8640_bridge_func= s =3D { .pre_enable =3D ps8640_pre_enable, }; =20 -static int ps8640_bridge_host_attach(struct device *dev, struct ps8640 *ps= _bridge) +static int ps8640_bridge_get_dsi_resources(struct device *dev, struct ps86= 40 *ps_bridge) { struct device_node *in_ep, *dsi_node; struct mipi_dsi_device *dsi; @@ -576,13 +576,40 @@ static int ps8640_bridge_host_attach(struct device *d= ev, struct ps8640 *ps_bridg dsi->format =3D MIPI_DSI_FMT_RGB888; dsi->lanes =3D NUM_MIPI_LANES; =20 - return devm_mipi_dsi_attach(dev, dsi); + return 0; +} + +static int ps8640_bridge_link_panel(struct drm_dp_aux *aux) +{ + struct ps8640 *ps_bridge =3D aux_to_ps8640(aux); + struct device *dev =3D aux->dev; + struct device_node *np =3D dev->of_node; + int ret; + + /* + * NOTE about returning -EPROBE_DEFER from this function: if we + * return an error (most relevant to -EPROBE_DEFER) it will only + * be passed out to ps8640_probe() if it called this directly (AKA the + * panel isn't under the "aux-bus" node). That should be fine because + * if the panel is under "aux-bus" it's guaranteed to have probed by + * the time this function has been called. + */ + + /* port@1 is ps8640 output port */ + ps_bridge->panel_bridge =3D devm_drm_of_get_bridge(dev, np, 1, 0); + if (IS_ERR(ps_bridge->panel_bridge)) + return PTR_ERR(ps_bridge->panel_bridge); + + ret =3D devm_drm_bridge_add(dev, &ps_bridge->bridge); + if (ret) + return ret; + + return devm_mipi_dsi_attach(dev, ps_bridge->dsi); } =20 static int ps8640_probe(struct i2c_client *client) { struct device *dev =3D &client->dev; - struct device_node *np =3D dev->of_node; struct ps8640 *ps_bridge; int ret; u32 i; @@ -623,6 +650,14 @@ static int ps8640_probe(struct i2c_client *client) if (!ps8640_of_panel_on_aux_bus(&client->dev)) ps_bridge->bridge.ops =3D DRM_BRIDGE_OP_EDID; =20 + /* + * Get MIPI DSI resources early. These can return -EPROBE_DEFER so + * we want to get them out of the way sooner. + */ + ret =3D ps8640_bridge_get_dsi_resources(&client->dev, ps_bridge); + if (ret) + return ret; + ps_bridge->page[PAGE0_DP_CNTL] =3D client; =20 ps_bridge->regmap[PAGE0_DP_CNTL] =3D devm_regmap_init_i2c(client, ps8640_= regmap_config); @@ -665,35 +700,19 @@ static int ps8640_probe(struct i2c_client *client) if (ret) return ret; =20 - devm_of_dp_aux_populate_ep_devices(&ps_bridge->aux); + ret =3D devm_of_dp_aux_populate_bus(&ps_bridge->aux, ps8640_bridge_link_p= anel); =20 - /* port@1 is ps8640 output port */ - ps_bridge->panel_bridge =3D devm_drm_of_get_bridge(dev, np, 1, 0); - if (IS_ERR(ps_bridge->panel_bridge)) - return PTR_ERR(ps_bridge->panel_bridge); - - drm_bridge_add(&ps_bridge->bridge); - - ret =3D ps8640_bridge_host_attach(dev, ps_bridge); - if (ret) - goto err_bridge_remove; - - return 0; + /* + * If devm_of_dp_aux_populate_bus() returns -ENODEV then it's up to + * usa to call ps8640_bridge_link_panel() directly. NOTE: in this case + * the function is allowed to -EPROBE_DEFER. + */ + if (ret =3D=3D -ENODEV) + return ps8640_bridge_link_panel(&ps_bridge->aux); =20 -err_bridge_remove: - drm_bridge_remove(&ps_bridge->bridge); return ret; } =20 -static int ps8640_remove(struct i2c_client *client) -{ - struct ps8640 *ps_bridge =3D i2c_get_clientdata(client); - - drm_bridge_remove(&ps_bridge->bridge); - - return 0; -} - static const struct of_device_id ps8640_match[] =3D { { .compatible =3D "parade,ps8640" }, { } @@ -702,7 +721,6 @@ MODULE_DEVICE_TABLE(of, ps8640_match); =20 static struct i2c_driver ps8640_driver =3D { .probe_new =3D ps8640_probe, - .remove =3D ps8640_remove, .driver =3D { .name =3D "ps8640", .of_match_table =3D ps8640_match, --=20 2.36.0.550.gb090851708-goog