Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp288703rwl; Tue, 11 Apr 2023 18:39:28 -0700 (PDT) X-Google-Smtp-Source: AKy350Zkoh4YD4v5BDYluBPu5pOUxaj5PHx4qV1sfE4H54R5TJym3S32idMomQHh3v3GoY/e3q4g X-Received: by 2002:a17:90b:384f:b0:23f:9d83:ad76 with SMTP id nl15-20020a17090b384f00b0023f9d83ad76mr16155051pjb.23.1681263568427; Tue, 11 Apr 2023 18:39:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681263568; cv=none; d=google.com; s=arc-20160816; b=Yy2f0gNo/h0ODcS3dgZaJu7Wz2dm834aacPzam/MVH0/zOF9jNsPUrE0xN3nQQa1Wh DBx2W5WCzEKO01c5eagEINWPkye43cwVm7rPZLzHQ0v0KGAVPuXQYf9tftgQjw0w3N45 zfwSh7ha+vj8FTFkkLbOmaZuzmXPYGIUer7DXHu3mBWDWOEQhS0zFHoME6ZqjlI3DnMd +w1Hdgc6fEJ1Q/R7oyVNm/SGLiUSDMs1/WaaZI+Ir65p53N1XanJ4jH4xRAeNwIoMyTX t2BETTNkCgrlQsZrM41s+plLK5qgcSRmXAMLoGxYbylWojMU2HG7KzjgCE5Khqyk3FWg 4bMg== 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=x4I7A7fTrqw2RjiH+FANl1pHUb1mo4v70F1ZP1YYmH0=; b=tFPiw/nJckI9dHb9U7UlNQKPaHcHJw5hKIIkkrQTcqW/5VoTkDltbe5qKNraQUIMri J4bin7sL7M1g9z11xRKyEv0VvEWShiQDMs82H44mKaLmC5mD5AWkQAfuy6cvjpKXf+C0 aG4lkdHRwfLWo9fTdNKya1TqJrA3JZ7zzCGN/VCXV34LwFjriybUhSoQtYVFw+2dW9K6 Lt70MR0CVRKy1aUjvFuBkDWwAwF68URdsJ7vIBazuqhBeehjPZNIK0dpi0ybVOVs2AbK hoOBgdDsgeGcQfrgMjG3ZRXJiFu7E0B5QCwQsnavz0REuvXhJX3huX3CExYGqgswD4Ia vNew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=eddehjax; 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=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t12-20020a17090a950c00b00246a5bec306si609731pjo.12.2023.04.11.18.39.06; Tue, 11 Apr 2023 18:39:28 -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=@chromium.org header.s=google header.b=eddehjax; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229655AbjDLBia (ORCPT + 99 others); Tue, 11 Apr 2023 21:38:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49972 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbjDLBi2 (ORCPT ); Tue, 11 Apr 2023 21:38:28 -0400 Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28F391726 for ; Tue, 11 Apr 2023 18:38:27 -0700 (PDT) Received: by mail-lj1-x22c.google.com with SMTP id z26so9877671ljq.3 for ; Tue, 11 Apr 2023 18:38:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1681263505; x=1683855505; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:from:to:cc:subject:date:message-id :reply-to; bh=x4I7A7fTrqw2RjiH+FANl1pHUb1mo4v70F1ZP1YYmH0=; b=eddehjaxa279W/YrUOmm1WgvC8vDX4Tc3sYAKlXKYyV36fw4dQ/qyq+r8+UTYIVkmA 9+nD3VH5DqzPAN3u0aJka1TzhZNJ0Mozj2KrChdbZxyRaHskhIAL2Yl4+XW3MpxGifyX TewzYAl4ZckxEtP5KKFLTI/6fnR6+sgtt05Cw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681263505; x=1683855505; h=cc:to:subject:message-id:date:user-agent:from:references :in-reply-to:mime-version:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=x4I7A7fTrqw2RjiH+FANl1pHUb1mo4v70F1ZP1YYmH0=; b=XyKDosI6NKPr4Sa6VLoMDftWROlKyk9pgCjqH5RhTsaUPItMZ4YPjDCWDZt2MlcGsq GxVoGzKSWyP2sHuC4GCdvlU8pWcd4pKKaZpMvLoHJHSIjavIB8OVJAM2/8ozk7kheqAb RP9f30Nl1xjzPeMzt7/oETSaCUPF6DzT0Hq0NMiyhobRYvAMvgQ75RWoQfZaZizpZX8H RfQLejauzt8yyS0vqLCp8G4tyUsVxbfLroi8avGYgeKk7Od39NjQuxRgzMAC85BoMnXZ Orw7WLUqMEI7uxXThyp1AiscBonWu6EY7zoPQ0SXTgHquF9E5N2vDPUy3OHuLP4EwD0O JOvw== X-Gm-Message-State: AAQBX9f/ZSuvqk8YTCJodpZI/oDjVSeuiOkNfaqYfxETW9Th0ao54+S9 38bwCcszVBry+vuxGDoM9P7qJD+rs49S9+nMlGV7mw== X-Received: by 2002:a2e:8e96:0:b0:2a7:8402:c934 with SMTP id z22-20020a2e8e96000000b002a78402c934mr1460102ljk.10.1681263505347; Tue, 11 Apr 2023 18:38:25 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 11 Apr 2023 18:38:24 -0700 MIME-Version: 1.0 In-Reply-To: <20230331091145.737305-5-treapking@chromium.org> References: <20230331091145.737305-1-treapking@chromium.org> <20230331091145.737305-5-treapking@chromium.org> From: Stephen Boyd User-Agent: alot/0.10 Date: Tue, 11 Apr 2023 18:38:24 -0700 Message-ID: Subject: Re: [PATCH v15 04/10] dt-bindings: display: bridge: anx7625: Add mode-switch support To: Andrzej Hajda , Andy Shevchenko , Benson Leung , Daniel Scally , Daniel Vetter , David Airlie , Greg Kroah-Hartman , Guenter Roeck , Heikki Krogerus , Jernej Skrabec , Jonas Karlman , Krzysztof Kozlowski , Laurent Pinchart , Neil Armstrong , Pin-yen Lin , Prashant Malani , "Rafael J . Wysocki" , Rob Herring , Robert Foss , Sakari Ailus Cc: Xin Ji , Marek Vasut , Hsin-Yi Wang , Thomas Zimmermann , AngeloGioacchino Del Regno , Lyude Paul , devicetree@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-acpi@vger.kernel.org, chrome-platform@lists.linux.dev, =?UTF-8?B?TsOtY29sYXMgRiAuIFIgLiBBIC4gUHJhZG8=?= , Javier Martinez Canillas , linux-kernel@vger.kernel.org, Krzysztof Kozlowski , Chen-Yu Tsai Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 Quoting Pin-yen Lin (2023-03-31 02:11:39) > diff --git a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml > index b42553ac505c..604c7391d74f 100644 > --- a/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml > +++ b/Documentation/devicetree/bindings/display/bridge/analogix,anx7625.yaml > @@ -12,7 +12,8 @@ maintainers: > > description: | > The ANX7625 is an ultra-low power 4K Mobile HD Transmitter > - designed for portable devices. > + designed for portable devices. Product brief is available at > + https://www.analogix.com/en/system/files/AA-002291-PB-6-ANX7625_ProductBrief.pdf > > properties: > compatible: > @@ -112,9 +113,40 @@ properties: > data-lanes: true > > port@1: > - $ref: /schemas/graph.yaml#/properties/port > + $ref: /schemas/graph.yaml#/$defs/port-base > description: > - Video port for panel or connector. > + Video port for panel or connector. Each endpoint connects to a video > + output downstream, and the "data-lanes" property is used to describe > + the pin connections. 0, 1, 2, 3 in "data-lanes" maps to SSRX1, SSTX1, > + SSRX2, SSTX2, respectively. > + > + patternProperties: > + "^endpoint@[01]$": > + $ref: /schemas/media/video-interfaces.yaml# > + properties: > + reg: true > + > + remote-endpoint: true > + > + data-lanes: > + oneOf: > + - items: > + - enum: [0, 1, 2, 3] > + > + - items: > + - const: 0 > + - const: 1 > + > + - items: > + - const: 2 > + - const: 3 > + > + mode-switch: Is it possible to not have this property? Can we have the driver for this anx device look at the remote-endpoint and if it sees that it is not a drm_bridge or panel on the other end, or a DP connector, that it should register a typec mode switch (or two depending on the number of endpoints in port@1)? Is there any case where that doesn't hold true? I see these possible scenarios: 1. DPI to DP bridge steering DP to one of two usb-c-connectors In this case, endpoint@0 is connected to one usb-c-connector and endpoint@1 is connected to another usb-c-connector. The input endpoint is only connected to DPI. The USB endpoint is not present (although I don't see this described in the binding either, so we would need a port@2, entirely optional to describe USB3 input). The driver will register two mode switches. 2. DPI to DP bridge with USB3 to one usb-c-connector In this case, endpoint@1 doesn't exist. The SSTX1/2 and SSRX1/2 pins are all connected to a usb-c-connector node. The input ports (0 and 2) are connected to both DPI and USB. The device acts as both a mode-switch and an orientation-switch. It registers both switches. I wonder if there is any benefit to describing SBU connections or CC connections? Maybe we don't register the orientation-switch if the SBU or CC connection isn't described? 3. DPI to DP bridge connected to eDP panel In this case, endpoint@1 doesn't exist. The USB endpoint is not present (port@2). Depending on how the crosspoint should be configured, we'll need to use data-lanes in the port@1 endpoint to describe which SSTRX pair to use (1 or 2). Or we'll have to use the endpoint's reg property to describe which pair to drive DP on. Presumably the default configuration is SSRX2/SSTX2 providing 2 lanes of DP to an eDP panel. The endpoint@0 in port@1 will be connected to a drm_panel, and the driver will be able to detect this properly by checking for the existence of an aux-bus node or the return value of of_dp_aux_populate_bus(). 4. DPI to DP bridge connected to DP connector This is similar to the eDP panel scenario #3. In this case, endpoint@1 doesn't exist. The USB endpoint is not present (port@2). Same story about port@1 and lane configuration, but we don't have an aux-bus node. In this case, the drivers/gpu/drm/bridge/display-connector.c driver will probe for the dp-connector node and add a drm_bridge. This anx driver will similarly add a drm_bridge, but it needs to look at the node connected on port@1:endpoint@0 with drm_of_get_bridge() and check if it is a drm_bridge (DP connector) or if it is some type-c thing (connector or orientation-switch). I think having this mode-switch property here lets us avoid calling drm_of_get_bridge() unconditionally in anx7625_parse_dt(). drm_of_get_bridge() will always return -EPROBE_DEFER when this is the last drm_bridge in the chain and the other side of the endpoint is a type-c thing (scenarios #1 and #2). Maybe we should teach drm_of_get_bridge() that a drm_bridge might be connected to a type-c device and have it not return -EPROBE_DEFER in that case. Or make some new API like drm_of_get_bridge_typec() that checks if the typec framework knows about the endpoint in question (as either a typec switch or a connector) and returns a NULL bridge pointer. If we had that then I think this property is not necessary. Hopefully the usb-c-connector can always be registered with the typec framework? I'm worried that the driver that registers the usb-c-connector node may want to form a struct typec_port with typec_register_port() and that will get stuck in a similar -EPROBE_DEFER loop waiting for this mode-switch to appear. So having this property also avoids that problem by telling typec framework to wait until this driver can register a mode-switch. TL;DR: Is this mode-switch property a workaround for probe defer? Can we figure out where the mode switch is in software and not have the property in DT? If we can it would certainly improve things because forgetting to add the property can lead to broken behavior, and we don't do anything like this for chains of drm_bridge devices. We just describe the display chain and let the kernel figure out which bridge should handle hpd, edid reading, or mode detection, etc.