Message ID | 20230221095054.1868277-6-treapking@chromium.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp1773893wrn; Tue, 21 Feb 2023 01:53:25 -0800 (PST) X-Google-Smtp-Source: AK7set8ycQGb1hJxORrkIGEDgAw58AIdvdvDZJpAWktczgWnu7GepoHB4onr9jZr7fm5pEOnkms3 X-Received: by 2002:a17:903:7cc:b0:19a:b343:d9ac with SMTP id ko12-20020a17090307cc00b0019ab343d9acmr4371788plb.65.1676973204845; Tue, 21 Feb 2023 01:53:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1676973204; cv=none; d=google.com; s=arc-20160816; b=Oe5gwBG0rYlg/A+7V4SGmhtXfAJ+/95CWKKQtAW+5XF05TkkKfauWLOCZExzeNcAhO Vu4GLftSaMX66M2KlideZycdgBUN1yHQMnEx9kBzby0i4Outs6nrcDcD+y9cOpIiTBZA qSydO8FwX0fpcCkfneNUawbskSlx+kYscTXAi1Xrt60nfD5VuZcSRatU+bySAOIMjScx pqNQnJIn9xwFvZCVZYhKVGPzGGKsA4amgsCFLGL1Rtdg0YegpXimCTYGnxKvanchnbNm GFcr1J8il2MHhQgfEStUVtDgdpFBb6XmDGD62UcRnx+6BD6phj10GH1B/ta2ZzKh6Sm0 uvYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=KG6QSJbypzUGB5xaZ21VNAzG0yHFxcV/96+5oqf9BzQ=; b=naowC6Q53tkduVXxFbebUZ9qxtegeHSNO4HUB7uoloYOL9YrrrWN2TPyAhmnyJnJmd 8gQQ973buEAkvyalaBt6wscC8PuZjYr/HN/v0axb3mghzdENMPybpGZD6z6//mCybkty GMnczXAd0VFATWhDnloPBmEdEk7tvennUUjp2znjqcVHWUbtLU3y2cxK3/dottfuh+6t XA6m9L8glYJMGpeXuVr5SoKXnlN/GOmcSzlQJiRv83JUg/9BSFdWXICAJSEApCSOQBN5 1JMFSYsAm6HKBbFZ8xOyTaetBeXBdQ6XeSilwnM+sNDdVA85GZl2SNkdGtu/s21EQkCx LZgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KuyVVTOC; 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: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a13-20020a170902710d00b00196486c4b17si10828076pll.56.2023.02.21.01.53.08; Tue, 21 Feb 2023 01:53:24 -0800 (PST) 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=KuyVVTOC; 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 S234076AbjBUJwX (ORCPT <rfc822;kautuk.consul.80@gmail.com> + 99 others); Tue, 21 Feb 2023 04:52:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234073AbjBUJwJ (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 21 Feb 2023 04:52:09 -0500 Received: from mail-pj1-x102c.google.com (mail-pj1-x102c.google.com [IPv6:2607:f8b0:4864:20::102c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D9CB25E04 for <linux-kernel@vger.kernel.org>; Tue, 21 Feb 2023 01:51:51 -0800 (PST) Received: by mail-pj1-x102c.google.com with SMTP id qi12-20020a17090b274c00b002341621377cso4117919pjb.2 for <linux-kernel@vger.kernel.org>; Tue, 21 Feb 2023 01:51:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=KG6QSJbypzUGB5xaZ21VNAzG0yHFxcV/96+5oqf9BzQ=; b=KuyVVTOClmKqZW8WOr08nnolQpZRXrV9mpvaydXdCafjx1XTd8QTNHjiB6gl3bvV25 QWfK8U/aSXWzvNTZptHA30lkxH1wnE0LxABcxEY5W4WJu6VRbDTmZeJKsL4ONKDDtqhp q0gLLqrqiv/v6yV2v9NMuou9AOS9KoGQEq8ws= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=KG6QSJbypzUGB5xaZ21VNAzG0yHFxcV/96+5oqf9BzQ=; b=aQ1419LGoRtD0BmRPyS/7yaooknz/6AbU6UI5dNo5mPHs3EQw7jeNnYkeVQR2PiNFv ye7v3u4cB5FJzyOZRqyFO87yDCAWpy3vxTJWs73Kq3bhhAP+ltyBucIEWT5dTXQVl9uP erD2/KMQlXkgVAWhfLZMBiAFBMqj6ZlObcLZ/jIBJOebDImdqgyXcbrAbP9YlbN0lqqa Ipzr9kVvhaB2BK8HICxlsGmWmYhzKKWAowFx/KW88+s70TJEgPwXX8VU2G2b2AcvanfB hXxZ9sclMBPRPF6pI1Xn48musMS57iPlfoeEXj4QrvCCOPLoj5ux9vDt6jIyd3hP0rBU yZfg== X-Gm-Message-State: AO0yUKXdNYHqOBe+YKrL2ZW1rSSTMjYB84LcoU2IQ4wY/4KtoWBMMKx5 n7KTt8rA2lCd9sB8Dp2cCrL4iQ== X-Received: by 2002:a05:6a20:914a:b0:be:d368:5c7f with SMTP id x10-20020a056a20914a00b000bed3685c7fmr15892164pzc.41.1676973105963; Tue, 21 Feb 2023 01:51:45 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:a1f5:f58d:584e:5906]) by smtp.gmail.com with ESMTPSA id t25-20020a656099000000b004eca54eab50sm3524918pgu.28.2023.02.21.01.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 01:51:45 -0800 (PST) From: Pin-yen Lin <treapking@chromium.org> To: Andrzej Hajda <andrzej.hajda@intel.com>, Neil Armstrong <neil.armstrong@linaro.org>, Robert Foss <rfoss@kernel.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Jonas Karlman <jonas@kwiboo.se>, Jernej Skrabec <jernej.skrabec@gmail.com>, David Airlie <airlied@gmail.com>, Daniel Vetter <daniel@ffwll.ch>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Andy Shevchenko <andriy.shevchenko@linux.intel.com>, Daniel Scally <djrscally@gmail.com>, Heikki Krogerus <heikki.krogerus@linux.intel.com>, Sakari Ailus <sakari.ailus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, "Rafael J . Wysocki" <rafael@kernel.org>, Prashant Malani <pmalani@chromium.org>, Benson Leung <bleung@chromium.org>, Guenter Roeck <groeck@chromium.org> Cc: Pin-yen Lin <treapking@chromium.org>, linux-kernel@vger.kernel.org, Hsin-Yi Wang <hsinyi@chromium.org>, Marek Vasut <marex@denx.de>, Thomas Zimmermann <tzimmermann@suse.de>, dri-devel@lists.freedesktop.org, Xin Ji <xji@analogixsemi.com>, Lyude Paul <lyude@redhat.com>, Allen Chen <allen.chen@ite.com.tw>, devicetree@vger.kernel.org, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_Prado?= <nfraprado@collabora.com>, chrome-platform@lists.linux.dev, Javier Martinez Canillas <javierm@redhat.com>, linux-acpi@vger.kernel.org, Stephen Boyd <swboyd@chromium.org> Subject: [PATCH v12 05/10] drm/bridge: anx7625: Check for Type-C during panel registration Date: Tue, 21 Feb 2023 17:50:49 +0800 Message-Id: <20230221095054.1868277-6-treapking@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230221095054.1868277-1-treapking@chromium.org> References: <20230221095054.1868277-1-treapking@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1758433854925537674?= X-GMAIL-MSGID: =?utf-8?q?1758433854925537674?= |
Series |
Register Type-C mode-switch in DP bridge endpoints
|
|
Commit Message
Pin-yen Lin
Feb. 21, 2023, 9:50 a.m. UTC
The output port endpoints can be connected to USB-C connectors.
Running drm_of_find_panel_or_bridge() with such endpoints leads to
a continuous return value of -EPROBE_DEFER, even though there is
no panel present.
To avoid this, check for the existence of a "mode-switch" property in
the port endpoint, and skip panel registration completely if so.
Signed-off-by: Pin-yen Lin <treapking@chromium.org>
---
Changes in v12:
- Updated to use fwnode_for_each_typec_mode_switch macro
- Dropped collected tags
Changes in v10:
- Collected Reviewed-by and Tested-by tags
Changes in v6:
- New in v6
drivers/gpu/drm/bridge/analogix/anx7625.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
Comments
On Tue, Feb 21, 2023 at 05:50:49PM +0800, Pin-yen Lin wrote: > The output port endpoints can be connected to USB-C connectors. > Running drm_of_find_panel_or_bridge() with such endpoints leads to > a continuous return value of -EPROBE_DEFER, even though there is > no panel present. > > To avoid this, check for the existence of a "mode-switch" property in > the port endpoint, and skip panel registration completely if so. ... > + port_node = of_graph_get_port_by_id(np, 1); > + fwnode_for_each_typec_mode_switch(&port_node->fwnode, fwnode) { > + fwnode_handle_put(fwnode); > + return 0; > + } With the proposed count API: unsigned int count; ... port_node = ... count = typec_mode_switch_node_count(&port_node->fwnode); if (count == 0) return 0;
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 6846199a2ee1..486b5099f5dd 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1648,7 +1648,8 @@ static int anx7625_get_swing_setting(struct device *dev, static int anx7625_parse_dt(struct device *dev, struct anx7625_platform_data *pdata) { - struct device_node *np = dev->of_node, *ep0; + struct device_node *np = dev->of_node, *ep0, *port_node; + struct fwnode_handle *fwnode; int bus_type, mipi_lanes; anx7625_get_swing_setting(dev, pdata); @@ -1687,6 +1688,16 @@ static int anx7625_parse_dt(struct device *dev, if (of_property_read_bool(np, "analogix,audio-enable")) pdata->audio_en = 1; + /* + * Don't bother finding a panel if a Type-C `mode-switch` property is + * present in one of the endpoints in the output port. + */ + port_node = of_graph_get_port_by_id(np, 1); + fwnode_for_each_typec_mode_switch(&port_node->fwnode, fwnode) { + fwnode_handle_put(fwnode); + return 0; + } + pdata->panel_bridge = devm_drm_of_get_bridge(dev, np, 1, 0); if (IS_ERR(pdata->panel_bridge)) { if (PTR_ERR(pdata->panel_bridge) == -ENODEV) {