Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp1011804rwr; Thu, 27 Apr 2023 11:02:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ74U4vgxGfb/63UsCqlANupkFnXMc2ZCTUjX4DvmZsNNv2K674DZx+4nrSiypSLIQ/D1ud5 X-Received: by 2002:a17:90b:4d10:b0:24b:6efc:166c with SMTP id mw16-20020a17090b4d1000b0024b6efc166cmr2786294pjb.2.1682618525454; Thu, 27 Apr 2023 11:02:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682618525; cv=none; d=google.com; s=arc-20160816; b=gqLxNIjckxmDV0PlBiqKln3Fhizalm/824euzfF3xR0wgsMzSGGtR2MDiMntpYEk+y t3kATwLpYb+xmm0Dvl0A5P/G3SB7/X6Uqpoi0qTOhTSuHfNa6BguY5o1LbsbLsLLsPz7 cl1fpUGhYdoZas7Sg4goX2QA3sKgyZySrQRi7uYc1AQg85q7t+W0uZCqyAV4eyBxgckp S3cn5Z1GOqPB3isCh/RbKStHmue4dMBnnG8pJxUl7HstT2Ts1IC8YzD6Im40iK0nKJlC tIUXjCOedK0/e7tKWDHFRB16KB61tTu+v8T3yLimZMBHvFSJuOLUmloTOKcW65Qn9BVb D+Qg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=T2GIu/+OnkLafZqySOKrzD8ciYv3HmQaDFMtQHfu3W8=; b=aVtwz+zlHrMTxuuYXhANDaNKis7wG0F9NinUuo5/EHR51k9IsWIre0FPV0YFFp8A02 gyq0IQTw3sm5VvxI/srG9TTC4EcCdAmJmm4JgSaK0TavhmQ0he3hNvNBnq2wNGUPj/oS mh7vuVmDPKh817XYLF5oIUpOrK8grEItsIT3Hfo7Tvq06C4wIN//3CvUrOHpDHe9FOfs SVlba8qgcaLiGbaoUZKWyZl091ircgO2mV/OIeRz758bGXImDXn9DPWkcJ8Eh6SXVgMm cPop+zdTtWTtcSwP6Msc3BLhQ44UyOHuFbJXd57YwQYrvzPJtCGpH9Ol1v6+eBHbmeQz LvPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=GNl7C2x8; 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 s190-20020a632cc7000000b00524d6d0a4acsi17686043pgs.654.2023.04.27.11.01.47; Thu, 27 Apr 2023 11:02:05 -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=GNl7C2x8; 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 S244283AbjD0SAl (ORCPT + 99 others); Thu, 27 Apr 2023 14:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39400 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243708AbjD0SAi (ORCPT ); Thu, 27 Apr 2023 14:00:38 -0400 Received: from mail-lj1-x22e.google.com (mail-lj1-x22e.google.com [IPv6:2a00:1450:4864:20::22e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B1E63A91 for ; Thu, 27 Apr 2023 11:00:37 -0700 (PDT) Received: by mail-lj1-x22e.google.com with SMTP id 38308e7fff4ca-2ab25e8a4a7so37660211fa.3 for ; Thu, 27 Apr 2023 11:00:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1682618435; x=1685210435; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=T2GIu/+OnkLafZqySOKrzD8ciYv3HmQaDFMtQHfu3W8=; b=GNl7C2x83eoYeZnyG+bDI9/h8i2odgcHYWafi46kOk7JzJjF5axhRmi0NAnbCRGi9c kPNaOydGl8zElv98sZkCKsYhuEo6q3b4bxdyYZthrpRKavVJ/zocapR0Q9VCKUJ1qZ+R GDFw8svv0wExYnBphIq+5AZWTMab0jYAR6uy/TDwFyp/zjREqiEQhEbFNYDewIUwc+IR 7v4At6FjAiTehnl41XcBRdoxVNivrzejLzKAKEAUaxzcdognTnQNsidMVg5FZqko57HK Vbz2B0VzM74DEmaQAkHl7h/ujsemRRkbnsVpD3f5S2QXJesPf5iQ2madGTTzXbN2stcb 6ukg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682618435; x=1685210435; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=T2GIu/+OnkLafZqySOKrzD8ciYv3HmQaDFMtQHfu3W8=; b=XOe9DVk/po3cN10pmxcwc+8mzLyjabzil4uu14zgSV9MmSr2U1HTyJAsp2KUc9UPfL 2bi+sWuet7MzYHf874yk9BVFc5N4nTKbp05PaL+Np1wnHhNQls+dloc0UE+y+SuIzSmh dJ0GAQYJGpTJyJI6PloKdKLnVl1wp0kKPgv1XWcYPHHqy4Z6dObrLlo51Y0RZ3EhVgOu 6Wg667FXFmuzoVgzGsOi3U+qllgElWXlAneouICgJ0nuJo2e60dOM7tbLbfGJ0VB74J6 hlLVdxKHcnuQFWlC0YsbWKfFB4ysnhXCkO1Bvfbil5SWQrZq1wJowQYzBjypMK8khrZ4 tbVA== X-Gm-Message-State: AC+VfDwmR2w5m6FBexTcVeu3UVfRtU6oRDIneoSPETve1+hdmU/bm4fC ernx5tlzoBHzUW3wrzFTwE8JbA== X-Received: by 2002:a2e:90c2:0:b0:2a8:ea22:28a6 with SMTP id o2-20020a2e90c2000000b002a8ea2228a6mr946880ljg.9.1682618435356; Thu, 27 Apr 2023 11:00:35 -0700 (PDT) Received: from [172.23.2.5] ([195.167.132.10]) by smtp.gmail.com with ESMTPSA id f14-20020a2ea0ce000000b002ab1536377fsm1443232ljm.105.2023.04.27.11.00.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 27 Apr 2023 11:00:34 -0700 (PDT) Message-ID: Date: Thu, 27 Apr 2023 21:00:33 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.9.0 Subject: Re: [PATCH 5/7] phy: qcom-qmp-combo: Introduce drm_bridge Content-Language: en-GB To: neil.armstrong@linaro.org, Bryan O'Donoghue , Bjorn Andersson Cc: Vinod Koul , Kishon Vijay Abraham I , Johan Hovold , Bjorn Andersson , Konrad Dybcio , Rob Herring , Krzysztof Kozlowski , linux-arm-msm@vger.kernel.org, linux-phy@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230425034010.3789376-1-quic_bjorande@quicinc.com> <20230425034010.3789376-6-quic_bjorande@quicinc.com> From: Dmitry Baryshkov In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 27/04/2023 16:11, Neil Armstrong wrote: > On 26/04/2023 12:33, Bryan O'Donoghue wrote: >> On Tue, Apr 25, 2023 at 4:40 AM Bjorn Andersson >> wrote: >>> >>> The QMP combo PHY sits in an of_graph connected between the DisplayPort >>> controller and a USB Type-C connector (or possibly a redriver). >>> >>> The TCPM needs to be able to convey the HPD signal to the DisplayPort >>> controller, but no directly link is provided by DeviceTree so the signal >>> needs to "pass through" the QMP combo phy. >>> >>> Handle this by introducing a drm_bridge which upon initialization finds >>> the next bridge (i.e. the usb-c-connector) and chain this together. This >>> way HPD changes in the connector will propagate to the DisplayPort >>> driver. >>> >>> The connector bridge is resolved lazily, as the TCPM is expected to be >>> able to resolve the typec mux and switch at probe time, so the QMP combo >>> phy will probe before the TCPM. >>> >>> Signed-off-by: Bjorn Andersson >>> --- >>>   drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 36 +++++++++++++++++++++++ >>>   1 file changed, 36 insertions(+) >>> >>> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c >>> b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c >>> index 5d6d6ef3944b..84bc08002537 100644 >>> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c >>> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c >>> @@ -22,6 +22,8 @@ >>>   #include >>>   #include >>> >>> +#include >>> + >>>   #include >>> >>>   #include "phy-qcom-qmp.h" >>> @@ -1332,6 +1334,8 @@ struct qmp_combo { >>>          struct clk_hw dp_link_hw; >>>          struct clk_hw dp_pixel_hw; >>> >>> +       struct drm_bridge bridge; >>> + >>>          struct typec_switch_dev *sw; >>>          enum typec_orientation orientation; >>>   }; >>> @@ -3196,6 +3200,34 @@ static int qmp_combo_register_clocks(struct >>> qmp_combo *qmp, struct device_node * >>>          return devm_add_action_or_reset(qmp->dev, >>> phy_clk_release_provider, dp_np); >>>   } >>> >>> +static int qmp_combo_bridge_attach(struct drm_bridge *bridge, >>> +                                  enum drm_bridge_attach_flags flags) >>> +{ >>> +       struct qmp_combo *qmp = container_of(bridge, struct >>> qmp_combo, bridge); >>> +       struct drm_bridge *next_bridge; >>> + >>> +       if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) >>> +               return -EINVAL; >>> + >>> +       next_bridge = devm_drm_of_get_bridge(qmp->dev, >>> qmp->dev->of_node, 0, 0); >>> +       if (IS_ERR(next_bridge)) >>> +               return dev_err_probe(qmp->dev, PTR_ERR(next_bridge), >>> "failed to acquire drm_bridge\n"); >>> + >>> +       return drm_bridge_attach(bridge->encoder, next_bridge, >>> bridge, DRM_BRIDGE_ATTACH_NO_CONNECTOR); >>> +} >>> + >>> +static const struct drm_bridge_funcs qmp_combo_bridge_funcs = { >>> +       .attach = qmp_combo_bridge_attach, >>> +}; >>> + >>> +static int qmp_combo_dp_register_bridge(struct qmp_combo *qmp) >>> +{ >>> +       qmp->bridge.funcs = &qmp_combo_bridge_funcs; >>> +       qmp->bridge.of_node = qmp->dev->of_node; >>> + >>> +       return devm_drm_bridge_add(qmp->dev, &qmp->bridge); >>> +} >>> + >>>   static int qmp_combo_parse_dt_lecacy_dp(struct qmp_combo *qmp, >>> struct device_node *np) >>>   { >>>          struct device *dev = qmp->dev; >>> @@ -3459,6 +3491,10 @@ static int qmp_combo_probe(struct >>> platform_device *pdev) >>>          if (ret) >>>                  return ret; >>> >>> +       ret = qmp_combo_dp_register_bridge(qmp); >>> +       if (ret) >>> +               return ret; > > I think the DRM part should be only built if CONFIG_DRM is enabled, I don't > have a strong opinion on this, I think Vinod could help here. > >>> + >>>          /* Check for legacy binding with child nodes. */ >>>          usb_np = of_get_child_by_name(dev->of_node, "usb3-phy"); >>>          if (usb_np) { >>> -- >>> 2.39.2 >>> >> >> You need to add some or all of these >>         select DRM_DISPLAY_DP_HELPER >>         select DRM_DISPLAY_HELPER >>         select DRM_DP_AUX_BUS >>         select DRM_KMS_HELPER >>         select DRM_MIPI_DSI >>         select DRM_PANEL >> >> >> /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: >> Unexpected GOT/PLT entries detected! >> /opt/linaro/gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu/bin/aarch64-linux-gnu-ld: >> Unexpected run-time procedure linkages detected! >> drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function >> `qmp_combo_bridge_attach': >> phy-qcom-qmp-combo.c:(.text+0xb50): undefined reference to >> `devm_drm_of_get_bridge' >> phy-qcom-qmp-combo.c:(.text+0xb6c): undefined reference to >> `drm_bridge_attach' >> drivers/phy/qualcomm/phy-qcom-qmp-combo.o: In function `qmp_combo_probe': >> phy-qcom-qmp-combo.c:(.text+0x13fc): undefined reference to >> `devm_drm_bridge_add' > > I think CONFIG_DRM_PANEL_BRIDGE in addition to CONFIG_DRM. should be > enough. > I'd say DRM_PANEL_BRIDGE || !DRM_PANEL_BRIDGE in addition to DRM. And we probably should fix the devm_drm_of_get_bridge() stub to use drm_of_find_panel_or_bridge() with panel = NULL. > With this config added and my drm-bridge hat: > > Acked-by: Neil Armstrong > > Neil > > >> >> --- >> bod > -- With best wishes Dmitry