Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp4150256pxb; Mon, 4 Oct 2021 18:52:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhBhF7hHPMAk1qXKVlwqeRGGdPpgx4WStpVWQBveY3HUblKXAlvV6Q09hbZ4tHb8SQtloL X-Received: by 2002:a17:906:3859:: with SMTP id w25mr18150926ejc.550.1633398727150; Mon, 04 Oct 2021 18:52:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633398727; cv=none; d=google.com; s=arc-20160816; b=pe03O+/VVulCRl1mDL9JTC0WU56pJ/pJdovy40iscdTv5xHXpPsnJW7OQMyuEclvxL hgWYiny2eIhe5s2Nmt9sE3sdK8H3ecyT7/sOm6KCbsviwJxRJBcDjQD6csQzPmfkbLrR NFUVRnW6yZOmZtCAT87Gj9jF8EtKLJOVgz3oEqGtu0XJqYs0IdxE4vjAMZ5j/jmrQFCv tUPj0OY/5G96UDL2ue2XdOHMPI2nfzvrexEGrn4LZqhil/AnxtlRII/o18HL5bHNDcCX MVRuHii5q3Prx/jioJ+YP4MgrZgELRd5daLxJq7XxatfpFn6g/NIvaVtaQMMASIRvHsa kl2g== 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:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=gln0TUvtfntk/v2j5OU8Axp9+f/QLM3/5Mczb5vtBog=; b=TC12gG8beLR77I9+i9/WI904vvv8iWw3d0oGTiWJwTqltrnY42KdFBwExG8OFgEnxq QQrHrBybZs5EXM3DtyMQHy+7iXld/8dlzTLDPKI6saHf3yY+JyZYaW8K6ZHOiwLLHYDR 9R1rLYP7hOpARGJ03DySrf/yE5Sog1VKjDVE7W0IRaY7sTd+2QFAi0Kk0iwLE/zEHN2Q UMISbwdgDyVdgPKKHeFVtwGSY+6TlmEXW6fljCIg9WlSEzNsv6Cvs1vgJXywGiwkWQPy JqAN6qqeyrf5kVG7tGex1V0w0c4tt+vzSKFwMLtKC/RrYV16rLgshapw7LOuliWUY5cU TZWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ldgwGedc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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 vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dz15si33995134edb.601.2021.10.04.18.51.42; Mon, 04 Oct 2021 18:52:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=ldgwGedc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.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: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230097AbhJEBwQ (ORCPT + 99 others); Mon, 4 Oct 2021 21:52:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229744AbhJEBwP (ORCPT ); Mon, 4 Oct 2021 21:52:15 -0400 Received: from mail-oi1-x230.google.com (mail-oi1-x230.google.com [IPv6:2607:f8b0:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 122E4C061745 for ; Mon, 4 Oct 2021 18:50:26 -0700 (PDT) Received: by mail-oi1-x230.google.com with SMTP id v10so24078688oic.12 for ; Mon, 04 Oct 2021 18:50:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:user-agent:date:message-id :subject:to:cc; bh=gln0TUvtfntk/v2j5OU8Axp9+f/QLM3/5Mczb5vtBog=; b=ldgwGedcNpZwDatAHIrtl7FhHi1DIRJT0OxO+fUmtrDBubzir6t05tNfO0imhZfWCz fcGzuK/Mx47IRLuftgDv40yOz26MSR0RYOb7nYnEGnBuhIMrqcqOhVeshQhG1THDfOjB R3AE/7JMcmBkUQQifHgbjc8XVPZkZIB/GvLd8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from :user-agent:date:message-id:subject:to:cc; bh=gln0TUvtfntk/v2j5OU8Axp9+f/QLM3/5Mczb5vtBog=; b=eKQ0eE4yDJDSFIv9tW6HeEowGII/tB9gBek72vzi8WKYkR6R7qmvZUYtlX5j4iCrks tWkx6ZQ1IfqnGK5kRE2zf+28lpq/r0t7OvhJKPhQIwJRmqWvV2ATsCunq3H06na751x/ YEBT9SYZ39ntrvXGD3tAgQdeEQHwKeQPnNB8vclVTKBgMrcJsqBp4/Y1+XFyJ1gRtE0X iK9Lg4qfPPXJz1KltBLteOJy7/NVXRuxA9WyKi0nn17fESTuz/Bfy0OrWbD6fvU4QAGo Z+RSID/fKm6X2sXtW9jpYzAin5LGklNEt5xY2FyKIdyRPcWxenhvz5iOkatWpnv9+Kv2 lXZg== X-Gm-Message-State: AOAM53110uuJRdIyG/x4GPQjIKSec2zYiwIKx43JfqT5S0ANnYzrVg0C 6vNmJAN62sYmLSrXPDQVvqh7KQVvw7770ByuiRZMag== X-Received: by 2002:a05:6808:f8f:: with SMTP id o15mr355536oiw.164.1633398625292; Mon, 04 Oct 2021 18:50:25 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 4 Oct 2021 21:50:24 -0400 MIME-Version: 1.0 In-Reply-To: References: <20210726231351.655302-1-bjorn.andersson@linaro.org> From: Stephen Boyd User-Agent: alot/0.9.1 Date: Mon, 4 Oct 2021 21:50:24 -0400 Message-ID: Subject: Re: [RFC] drm/msm/dp: Allow attaching a drm_panel To: Bjorn Andersson , Doug Anderson Cc: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , linux-arm-msm , LKML , Abhinav Kumar , Kuogee Hsieh , dri-devel , Vara Reddy , freedreno , Chandan Uddaraju Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Quoting Bjorn Andersson (2021-10-04 18:11:11) > On Mon 04 Oct 17:36 PDT 2021, Doug Anderson wrote: > > > Hi, > > > > On Fri, Oct 1, 2021 at 2:00 PM Bjorn Andersson > > wrote: > > > > > > On Fri 27 Aug 13:52 PDT 2021, Doug Anderson wrote: > > > > > > > Hi, > > > > > > > > On Mon, Jul 26, 2021 at 4:15 PM Bjorn Andersson > > > > wrote: > > > > > > > > > > +static int dp_parser_find_panel(struct dp_parser *parser) > > > > > +{ > > > > > + struct device_node *np = parser->pdev->dev.of_node; > > > > > + int rc; > > > > > + > > > > > + rc = drm_of_find_panel_or_bridge(np, 2, 0, &parser->drm_panel, NULL); > > > > > > > > Why port 2? Shouldn't this just be port 1 always? The yaml says that > > > > port 1 is "Output endpoint of the controller". We should just use port > > > > 1 here, right? > > > > > > > > > > Finally got back to this, changed it to 1 and figured out why I left it > > > at 2. > > > > > > drm_of_find_panel_or_bridge() on a DP controller will find the of_graph > > > reference to the USB-C controller, scan through the registered panels > > > and conclude that the of_node of the USB-C controller isn't a registered > > > panel and return -EPROBE_DEFER. > > > > I'm confused, but maybe it would help if I could see something > > concrete. Is there a specific board this was happening on? > > > > Right, let's make this more concrete with a snippet from the actual > SC8180x DT. Where is this DT? Is it in the kernel tree? > > > Under the DP node in the device tree I expect: > > > > ports { > > port@1 { > > reg = <1>; > > edp_out: endpoint { > > remote-endpoint = <&edp_panel_in>; > > }; > > }; > > }; > > > > /* We got a panel */ > panel { > ... > ports { > port { > auo_b133han05_in: endpoint { > remote-endpoint = <&mdss_edp_out>; > }; > }; > }; > }; > > /* And a 2-port USB-C controller */ > type-c-controller { > ... > connector@0 { > ports { > port@0 { > reg = <0>; > ucsi_port_0_dp: endpoint { > remote-endpoint = <&dp0_mode>; > }; > }; > > port@1 { > reg = <1>; > ucsi_port_0_switch: endpoint { > remote-endpoint = <&primary_qmp_phy>; > }; > }; > }; > }; > > connector@1 { > ports { > port@0 { > reg = <0>; > ucsi_port_1_dp: endpoint { > remote-endpoint = <&dp1_mode>; > }; > }; > > port@1 { > reg = <1>; > ucsi_port_1_switch: endpoint { > remote-endpoint = <&second_qmp_phy>; > }; > }; > }; > }; > }; > > /* And then our 2 DP and single eDP controllers */ > &mdss_dp0 { > ports { > port@1 { > reg = <1>; > dp0_mode: endpoint { > remote-endpoint = <&ucsi_port_0_dp>; > }; > }; > }; > }; > > &mdss_dp1 { > ports { > port@1 { > reg = <1>; > dp1_mode: endpoint { > remote-endpoint = <&ucsi_port_1_dp>; > }; > }; > }; > }; > > &mdss_edp { > ports { > port@1 { > reg = <1>; > mdss_edp_out: endpoint { > remote-endpoint = <&auo_b133han05_in>; > }; > }; > }; > }; > > > If you have "port@1" pointing to a USB-C controller but this instance > > of the DP controller is actually hooked up straight to a panel then > > you should simply delete the "port@1" that points to the typeC and > > replace it with one that points to a panel, right? > > > > As you can see, port 1 on &mdss_dp0 and &mdss_dp1 points to the two UCSI > connectors and the eDP points to the panel, exactly like we agreed. > > So now I call: > drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, NULL); > > which for the two DP nodes will pass respective UCSI connector to > drm_find_panel() and get EPROBE_DEFER back - because they are not on > panel_list. That's "good" right? > > There's nothing indicating in the of_graph that the USB connectors > aren't panels (or bridges), so I don't see a way to distinguish the two > types remotes. > I'd like to create a bridge, not panel, for USB connectors, so that we can push sideband HPD signaling through to the DP driver. But either way this should work, right? If drm_of_find_panel_or_bridge() returns -EPROBE_DEFER, then assume the connector is DP. Otherwise if there's a valid pointer then treat it as eDP. We can't go too crazy though because once we attach a bridge we're assuming eDP which may not actually be true. If we make a bridge for type-C USB connectors then we'll be able to use the drm_bridge_connector code to automatically figure out the connector type (eDP vs. DP vs. whatever else is chained onto the end of the DP connector). That would require updating the bridge connector code to treat DP as a connector type though. And then the eDP path would need to be handled when there's no bridge really involved, like in your case where the eDP hardware is directly connected to the eDP panel. In this case I think we're supposed to make a bridge in this DP driver itself that does pretty basic stuff and assumes the connector is eDP or DP based on the hardware type it is. Then if we wire a type-c connector up to the eDP hardware the eDP bridge we make in this driver will see a type-c connector that makes a bridge saying "I'm a DP connector" and the drm_bridge_connector code will look at the last bridge in the chain to see that it's actually a DP connector.