Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp689602rwo; Wed, 2 Aug 2023 02:33:28 -0700 (PDT) X-Google-Smtp-Source: APBJJlE9I6y+8WkvkeW1NGisKYL1JztCCNZiIzF/TslnjRHJhUtB6MPdz8c10MAGnbIRJkiSLgNR X-Received: by 2002:a05:6870:d112:b0:1be:dbd9:dd2b with SMTP id e18-20020a056870d11200b001bedbd9dd2bmr10345455oac.54.1690968808007; Wed, 02 Aug 2023 02:33:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690968807; cv=none; d=google.com; s=arc-20160816; b=uyDMT2d2LfWk29OECAUTwCZ6j5g6ZzoO2PwAIzdIYq0q1N+xSq5bVAYLxYGKfQS7rC x1JGt9il3cp1SXpASXC6vHzmQ8hMvk1T7YeGaXc8GMuJBssOHKFodTp9IWum97wCACUX c4pPkneyBHy5yDhkDV6yVKci0G/zPkOtt6yeO+nJnAL3XjuAjAWRXscKWaDZr1HoOK5b V1eM7ToUdY08XlPoGAFzPzT8MIuotedfx9f8zryQVcyC4O3d/EzV9KPOlX944kONQhVF a2AVAryJEhjJZM9jzy77h7A7z+/dwo9HfaAxGQhaIwY5tNTCZqIxlLOXp7NopUJLsIHY DeUg== 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 :organization:references:cc:to:content-language:subject:reply-to :from:user-agent:mime-version:date:message-id:dkim-signature; bh=UAFJ+rv+IE187x/FwcspFH0+iOTtGpFlE/cBuRXsXsw=; fh=myB7Xdx7CU8cPS+D3JyVoECxwyPASoO1JH5GkdQTiro=; b=ZU51vMfyRXBhN5xupzyYC7mc+g6Y5Cy2vcg5BGqzCIFAOvhw+jt2DTpXv7xCjnJTlR BIxt+GhJi/bc4wqjBu61U7srzbat+b1KcT5yGNuo9mBe64BaWjav53kNmmYd+5fi497V AYGqpz0lBuZ+8UUsLeM1diXoPit3tnaT48gIoOzgTSEd1iRxLNLHtwyyN765AQJOOzvB OsjbfVkLHFsi4yor5OKZHf4+GqX88U+HYS/LJaze5sKmKxHh7Gd48/xkei/81NrGFEbx TgwkyB0O+ObICSfhubplp5lAcnSu/R4Z/AZ9Ns+fRbf8ZHIPYrnBMuVAyhraMCzYQYq2 3maw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=n6syPma2; 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 be3-20020a656e43000000b0055c8b7f3523si10544940pgb.54.2023.08.02.02.33.14; Wed, 02 Aug 2023 02:33:27 -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=n6syPma2; 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 S232525AbjHBICu (ORCPT + 99 others); Wed, 2 Aug 2023 04:02:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232989AbjHBICd (ORCPT ); Wed, 2 Aug 2023 04:02:33 -0400 Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2D3B82689 for ; Wed, 2 Aug 2023 01:02:32 -0700 (PDT) Received: by mail-wr1-x429.google.com with SMTP id ffacd0b85a97d-31751d7d96eso5515099f8f.1 for ; Wed, 02 Aug 2023 01:02:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690963350; x=1691568150; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:from:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=UAFJ+rv+IE187x/FwcspFH0+iOTtGpFlE/cBuRXsXsw=; b=n6syPma2ESApR8RUDCbIcg+b5msMUdwamEE/iYQvwZFvFNIAVioaro4B/arOcpLdbO fDZdhx0ge1q6bbPSd+mjsXF2w8eUtp51X1K9Sk3dJYd7+JTSRclVoJpqW164kth6ukCx BloSMDZ8zglmm8Zy+mRoyU8Wfb25UummOTwsG/uD5GdlpGc2e7nB2Foou5UhYbaAu3cg 8GsnHSZlaf41ibwFtovWYpantHy8tRsib/EvHRl1htSHnz+9jIBzjgfMSehQx2YsddA/ LVXOamf2KlPp6t1IT/db7e2gMyXO5Rl7FOM3Ttzh2zMEx/wCNHCvyqmhX4YyCieN2DrV OAog== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690963350; x=1691568150; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :content-language:subject:reply-to:from:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=UAFJ+rv+IE187x/FwcspFH0+iOTtGpFlE/cBuRXsXsw=; b=fKG/fAICaKplb9UiB+PdzQO5RjLabvyG/Ypijor9ElODHFrl6FKl6+E9acVIq8TeFU mdmlUE/YC7KB1dXxXyKyphjdtmzRGwYqOJyRJUBBGUIcKKgFFB+x1uz4bfv26vS9cTkW OEMUp6u6Md72hXBvQEWtf6SaZm5FpuHE5oEXF8FPii6zIX7lxiiszBYADaDW31wCbFa6 xejF5/5AoxUgnOOmS1KX3mATItmyF7q50vAzkONm91UgzXMt0dlXu1FAUz/UxJ3aR7eM 8VbloQkNQutYyjJDAfS/mIPQBFUaLUWvmz7aZY3ip0WwDu4Z3xY9YuqWNE6ctzzWXP+3 V7lg== X-Gm-Message-State: ABy/qLaN3GKcEYkdoh+w+W92y07OLYaVwed0uygpYIwJMyxT1DnkHUZb fgnDB5EMvAiBgkejz8WbOyrtyw== X-Received: by 2002:adf:ea4b:0:b0:317:5a71:9231 with SMTP id j11-20020adfea4b000000b003175a719231mr4169246wrn.51.1690963350340; Wed, 02 Aug 2023 01:02:30 -0700 (PDT) Received: from ?IPV6:2a01:e0a:982:cbb0:c5bb:5b4:61e3:d196? ([2a01:e0a:982:cbb0:c5bb:5b4:61e3:d196]) by smtp.gmail.com with ESMTPSA id l7-20020adfe587000000b00314172ba213sm18244774wrm.108.2023.08.02.01.02.29 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 02 Aug 2023 01:02:29 -0700 (PDT) Message-ID: <33f4fbe0-5fd7-569d-dbee-f55520693373@linaro.org> Date: Wed, 2 Aug 2023 10:02:28 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 From: Neil Armstrong Reply-To: neil.armstrong@linaro.org Subject: Re: [PATCH v4] drm/bridge: Add debugfs print for bridge chains Content-Language: en-US To: Tomi Valkeinen , Andrzej Hajda , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Francesco Dolcini , Aradhya Bhatia , Alexander Stein Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, Laurent Pinchart References: <20230802-drm-bridge-chain-debugfs-v4-1-7e3ae3d137c0@ideasonboard.com> Organization: Linaro Developer Services In-Reply-To: <20230802-drm-bridge-chain-debugfs-v4-1-7e3ae3d137c0@ideasonboard.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, 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 On 02/08/2023 09:04, Tomi Valkeinen wrote: > DRM bridges are not visible to the userspace and it may not be > immediately clear if the chain is somehow constructed incorrectly. I > have had two separate instances of a bridge driver failing to do a > drm_bridge_attach() call, resulting in the bridge connector not being > part of the chain. In some situations this doesn't seem to cause issues, > but it will if DRM_BRIDGE_ATTACH_NO_CONNECTOR flag is used. > > Add a debugfs file to print the bridge chains. For me, on this TI AM62 > based platform, I get the following output: > > encoder[39] > bridge[0] type: 0, ops: 0x0 > bridge[1] type: 0, ops: 0x0, OF: /bus@f0000/i2c@20000000/dsi@e:toshiba,tc358778 > bridge[2] type: 0, ops: 0x3, OF: /bus@f0000/i2c@20010000/hdmi@48:lontium,lt8912b > bridge[3] type: 11, ops: 0x7, OF: /hdmi-connector:hdmi-connector > > Tested-by: Alexander Stein > Reviewed-by: Laurent Pinchart > Signed-off-by: Tomi Valkeinen > --- > Changes in v4: > - Move 'struct drm_minor' to be along the other declarations > - Added Tested-by and Reviewed-by > - Link to v3: https://lore.kernel.org/r/20230731-drm-bridge-chain-debugfs-v3-1-7d0739f3efa3@ideasonboard.com > > Changes in v3: > - Use drm_for_each_bridge_in_chain() > - Drop extra comment > - Fix whitespace issue > - Call drm_bridge_debugfs_init() only if the driver uses modeset > - Drop #ifdef for drm_bridge_debugfs_init() declaration > - Link to v2: https://lore.kernel.org/r/20230721-drm-bridge-chain-debugfs-v2-1-76df94347962@ideasonboard.com > > Changes in v2: > - Fixed compilation issue when !CONFIG_OF > - Link to v1: https://lore.kernel.org/r/20230721-drm-bridge-chain-debugfs-v1-1-8614ff7e890d@ideasonboard.com > --- > drivers/gpu/drm/drm_bridge.c | 46 +++++++++++++++++++++++++++++++++++++++++++ > drivers/gpu/drm/drm_debugfs.c | 2 ++ > include/drm/drm_bridge.h | 3 +++ > 3 files changed, 51 insertions(+) > > diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c > index c3d69af02e79..39e68e45bb12 100644 > --- a/drivers/gpu/drm/drm_bridge.c > +++ b/drivers/gpu/drm/drm_bridge.c > @@ -27,8 +27,10 @@ > #include > > #include > +#include > #include > #include > +#include > #include > #include > > @@ -1345,6 +1347,50 @@ struct drm_bridge *of_drm_find_bridge(struct device_node *np) > EXPORT_SYMBOL(of_drm_find_bridge); > #endif > > +#ifdef CONFIG_DEBUG_FS > +static int drm_bridge_chains_info(struct seq_file *m, void *data) > +{ > + struct drm_debugfs_entry *entry = m->private; > + struct drm_device *dev = entry->dev; > + struct drm_printer p = drm_seq_file_printer(m); > + struct drm_mode_config *config = &dev->mode_config; > + struct drm_encoder *encoder; > + unsigned int bridge_idx = 0; > + > + list_for_each_entry(encoder, &config->encoder_list, head) { > + struct drm_bridge *bridge; > + > + drm_printf(&p, "encoder[%u]\n", encoder->base.id); > + > + drm_for_each_bridge_in_chain(encoder, bridge) { > + drm_printf(&p, "\tbridge[%u] type: %u, ops: %#x", > + bridge_idx, bridge->type, bridge->ops); > + > +#ifdef CONFIG_OF > + if (bridge->of_node) > + drm_printf(&p, ", OF: %pOFfc", bridge->of_node); > +#endif > + > + drm_printf(&p, "\n"); > + > + bridge_idx++; > + } > + } > + > + return 0; > +} > + > +static const struct drm_debugfs_info drm_bridge_debugfs_list[] = { > + { "bridge_chains", drm_bridge_chains_info, 0 }, > +}; > + > +void drm_bridge_debugfs_init(struct drm_minor *minor) > +{ > + drm_debugfs_add_files(minor->dev, drm_bridge_debugfs_list, > + ARRAY_SIZE(drm_bridge_debugfs_list)); > +} > +#endif > + > MODULE_AUTHOR("Ajay Kumar "); > MODULE_DESCRIPTION("DRM bridge infrastructure"); > MODULE_LICENSE("GPL and additional rights"); > diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c > index a3a488205009..2de43ff3ce0a 100644 > --- a/drivers/gpu/drm/drm_debugfs.c > +++ b/drivers/gpu/drm/drm_debugfs.c > @@ -31,6 +31,7 @@ > > #include > #include > +#include > #include > #include > #include > @@ -274,6 +275,7 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, > > if (drm_drv_uses_atomic_modeset(dev)) { > drm_atomic_debugfs_init(minor); > + drm_bridge_debugfs_init(minor); > } > > if (drm_core_check_feature(dev, DRIVER_MODESET)) { > diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h > index bf964cdfb330..c339fc85fd07 100644 > --- a/include/drm/drm_bridge.h > +++ b/include/drm/drm_bridge.h > @@ -36,6 +36,7 @@ struct drm_bridge; > struct drm_bridge_timings; > struct drm_connector; > struct drm_display_info; > +struct drm_minor; > struct drm_panel; > struct edid; > struct i2c_adapter; > @@ -949,4 +950,6 @@ static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, > } > #endif > > +void drm_bridge_debugfs_init(struct drm_minor *minor); > + > #endif > > --- > base-commit: a0c64d153d687756c8719b8d10e609d62e1cb6fd > change-id: 20230721-drm-bridge-chain-debugfs-0bbc1522f57a > > Best regards, LGTM, thanks tomi ! Acked-by: Neil Armstrong