Message ID | 20230303143350.815623-6-treapking@chromium.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5915:0:0:0:0:0 with SMTP id v21csp443099wrd; Fri, 3 Mar 2023 06:37:36 -0800 (PST) X-Google-Smtp-Source: AK7set/BiVDwIbOqXmW6DH3RHR6QImI2fNPyYczkg+mTu3A7o90Z4+wmW6yJHoP0gSnuXYoRp+Wk X-Received: by 2002:a17:90b:1d88:b0:237:99b8:4eef with SMTP id pf8-20020a17090b1d8800b0023799b84eefmr2055019pjb.9.1677854256654; Fri, 03 Mar 2023 06:37:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677854256; cv=none; d=google.com; s=arc-20160816; b=PRBlhGi++Zwr2AWNFYV9CMapWrwIRMpqlJmFeENfphgB8E/CyDZ4Gcr4llY91nblEB GAWtc23daBfjUvsGa0F6Ok+Wp+1z5OjNzO/GBkDiphibwmiK0uO0JABohwQCy833IMks OzP5w8XbkqDPd3UKnTgzizjFwEiBXOiKJ3umAG2F8GfVITERwfU3SaDgPLhGk3RmXAsX BjkIszyQmH2VZ1IGYv2ay8iKkJuQQsTTdeWKisR7hCSPhOcOwUSoCe3SEMy2N+OhT5bV WUkCXIyxcW0hAtBYWH83e1Laux3+D9BI+afADueUEgu0G7UUkVAMx/0Y19NASz7Oiq2r HK9Q== 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=1mSCOEOZwzSe4923gv/lNmAI3ycw4GWSqU0gMJqiLLo=; b=rCRDekuhyvgp7eWad1K9StHvcfDL5CJcfu6kHrNxF17FpYW7ffMh4oNdrRcvgotmfk OmL93n7BvB+tIgomMop9yScRek8Ns20TcY41ewsPwQtL0zpekFos+0qPLugd9Uj4LoGF zXzsm/O/3hWuZZSCfmzTTMwCOca7SSybFUYXJNUTQ5yILrMqshatOqEtZJFDOASAKE3J DtlcQ3wT7iweCj6vYlbHm/cesEWRhKjtMarhAgMrs0bB5yp3opkcXGEE0EntRQutKFXc JzC40ksDkpqX7hs31nL686YQvpTgpvZv4X0NI2ljplqm/ijbP+Ynspo/i1LLU+jIZG7e K0VA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AGaD40do; 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 j70-20020a638049000000b005004b2acf6fsi2252233pgd.428.2023.03.03.06.37.23; Fri, 03 Mar 2023 06:37:36 -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=AGaD40do; 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 S231352AbjCCOe6 (ORCPT <rfc822;davidbtadokoro@gmail.com> + 99 others); Fri, 3 Mar 2023 09:34:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46392 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231285AbjCCOel (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 3 Mar 2023 09:34:41 -0500 Received: from mail-pl1-x62b.google.com (mail-pl1-x62b.google.com [IPv6:2607:f8b0:4864:20::62b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 430934743D for <linux-kernel@vger.kernel.org>; Fri, 3 Mar 2023 06:34:28 -0800 (PST) Received: by mail-pl1-x62b.google.com with SMTP id ky4so2865920plb.3 for <linux-kernel@vger.kernel.org>; Fri, 03 Mar 2023 06:34:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1677854067; 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=1mSCOEOZwzSe4923gv/lNmAI3ycw4GWSqU0gMJqiLLo=; b=AGaD40dojqpatUV6OK0VH7EFEQ2f8L7gm8KFO7t1tKybUfhbjsuAeBpCTIh0g8dX1C Vb8448kxRNXXDZ/M9E1FYhYlT7cdc5iKzb7INg3gHb9eEioavVt1NiNfi+h5YhGX7qMg no6zYPiori0O301ujrZ9lB+Fk/LUreDTAFyHo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677854067; 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=1mSCOEOZwzSe4923gv/lNmAI3ycw4GWSqU0gMJqiLLo=; b=rH3dKBDOohFpAHxrdpwjlY09NIZPCtkhXh/XNx9lQpHJzVIxifIQglfm5bC8QcBNgT uYJwalozmwfCy8wNUtYG2hrwlHZLY3C3UjrdKxupBlljObr8bHV45fwzDvhOQLJL/VEX eWop7RTGc0Zjbmp7yQ3hG5ycwVktmCJq8z92GUvh0tlAILSWrMxDti0gX7oVrPm5KfL7 G7t+WCuKl9SecC0Yozh9UbSlJfDozMZqpdbL0X27PIk0LLyP1tIqM1+1zwuBEyYbefGl Fkq1UX1+Zb0a9w5OCe4WHNeYJ3BSbEEW4k9UgcZCHEwTvQl26PZZ0FjkRhHHJGOExKln Hv/Q== X-Gm-Message-State: AO0yUKX48se5D6plPruCxZbDMqEynxRUYLBzzn69P3xgbDojUYyhg2ZI Pr6vRfPGLq91IvVOMtu3Tpycwg== X-Received: by 2002:a05:6a20:8f04:b0:cc:f27d:eb83 with SMTP id b4-20020a056a208f0400b000ccf27deb83mr2609226pzk.53.1677854067699; Fri, 03 Mar 2023 06:34:27 -0800 (PST) Received: from treapking.tpe.corp.google.com ([2401:fa00:1:10:55e5:8423:31ee:83dd]) by smtp.gmail.com with ESMTPSA id c18-20020aa781d2000000b005a8b4dcd21asm1767214pfn.15.2023.03.03.06.34.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:34:27 -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: Xin Ji <xji@analogixsemi.com>, Javier Martinez Canillas <javierm@redhat.com>, Lyude Paul <lyude@redhat.com>, linux-kernel@vger.kernel.org, Pin-yen Lin <treapking@chromium.org>, AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>, chrome-platform@lists.linux.dev, =?utf-8?q?N=C3=ADcolas_F_=2E_R_=2E_A_=2E_P?= =?utf-8?q?rado?= <nfraprado@collabora.com>, Marek Vasut <marex@denx.de>, Hsin-Yi Wang <hsinyi@chromium.org>, devicetree@vger.kernel.org, Allen Chen <allen.chen@ite.com.tw>, dri-devel@lists.freedesktop.org, Thomas Zimmermann <tzimmermann@suse.de>, Stephen Boyd <swboyd@chromium.org>, linux-acpi@vger.kernel.org, =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> Subject: [PATCH v13 05/10] drm/bridge: anx7625: Check for Type-C during panel registration Date: Fri, 3 Mar 2023 22:33:45 +0800 Message-Id: <20230303143350.815623-6-treapking@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog In-Reply-To: <20230303143350.815623-1-treapking@chromium.org> References: <20230303143350.815623-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=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: <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?1759357704920656196?= X-GMAIL-MSGID: =?utf-8?q?1759357704920656196?= |
Series |
Register Type-C mode-switch in DP bridge endpoints
|
|
Commit Message
Pin-yen Lin
March 3, 2023, 2:33 p.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 v13:
- Use the new typec_mode_switch_node_count helper
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 | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
Comments
On Fri, Mar 03, 2023 at 10:33:45PM +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); > + count = typec_mode_switch_node_count(&port_node->fwnode); Do you need to drop reference count here? (I don't know myself, so, please check this) If no, patch LGTM. > + if (count) > + return 0;
HI Andy, On Mon, Mar 6, 2023 at 7:52 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > On Fri, Mar 03, 2023 at 10:33:45PM +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); > > + count = typec_mode_switch_node_count(&port_node->fwnode); > > Do you need to drop reference count here? > (I don't know myself, so, please check this) > > If no, patch LGTM. The helper completes the for-loop of fwnode_for_each_child_node, which drops the reference count whenever the next node is get. So we don't need drop the reference count here. > > > + if (count) > > + return 0; > > -- > With Best Regards, > Andy Shevchenko > > Best regards, Pin-yen
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index 6846199a2ee1..3f6bf7674d32 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; + unsigned int count; int bus_type, mipi_lanes; anx7625_get_swing_setting(dev, pdata); @@ -1687,6 +1688,15 @@ 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); + count = typec_mode_switch_node_count(&port_node->fwnode); + if (count) + 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) {