From patchwork Mon Sep 4 01:53:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720201 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D7A3EC83F2D for ; Mon, 4 Sep 2023 01:53:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237008AbjIDBxq (ORCPT ); Sun, 3 Sep 2023 21:53:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45094 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237088AbjIDBxq (ORCPT ); Sun, 3 Sep 2023 21:53:46 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46127F4 for ; Sun, 3 Sep 2023 18:53:42 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2ba1e9b1fa9so14765031fa.3 for ; Sun, 03 Sep 2023 18:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693792420; x=1694397220; darn=vger.kernel.org; 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=E45yW3bifAp1XkPk7OUkfMOU/+n3vxTZLRpPxdzCeYo=; b=fFm30pUywPkq4oaMwfI8wqX/J58ICHh5idf/Vwnf6i/nbchXyn9lLHzGnlWVlGhcGE QBOMiZuYAeSAkumgS26t8DsQYUUq2pt1vx6f98OvybhnbaW37XclFg16VysFekcCqBnY y0SCanAQOfRDW/WBddHfjAT3qvgoGR9j3Qn3n0B4EBtv5odO6/t5oa4m1D14Xdoxvo6Z MItEqsC2KkQvvEbfAvlO6FF5ZXhQWB9vJqNDe3KHhhc3WjRs22zzkSeAjhvlGsdB1klA MJFwkMbrunvLVsUmT0JtO63TPN4fpnX9S0/GdLB8hCCpVFxe3gRxoxiyojRQAAwigDoI avqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693792420; x=1694397220; 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=E45yW3bifAp1XkPk7OUkfMOU/+n3vxTZLRpPxdzCeYo=; b=lPHiTp9wbZQlS/Wn5XSZfVhxeAfLIzlS1PmS6Xg81+au6jBx7DnjAbHJ3sQoZxzqHg P9bTXdJbDUcb85gIKNPXnhz1ORuMGgO/RRnAb5X2o1stLMap4/Fra6lKOKIF6R+DYLw8 5Hz7m65oAcAal5M54/dEhcEMTk1hhUzrizJBv1sBYV5ySH9UAOh+RUPCs7s+MUCXLGmm 1g+g7edqswczqY64M3Lx/p/d+9Dr6V6+ph1/UmmLenX5gvvgOxAmPM9XMHaOsSvNGEnQ U76yLijgTRjq6OsdbQrbQF7Ev+lquAd0v7G1a/dsszSjNA3xn/Vx6Ko+IGDOk0ioVq4X vW5w== X-Gm-Message-State: AOJu0YywdAXTNzBkvj8ZanW/KrQhOGWncZ2aKg4GN0sU+bj9432qPQ1t OLba1/9OM+eQDzZT/1aizK1VYw== X-Google-Smtp-Source: AGHT+IGCJaqpDmf5lr933nTijKI5ERWTsczglSsdM7jFhGnB9wm95p8OlVpF34wTmwoq36T1Ul3ZIw== X-Received: by 2002:a2e:b16b:0:b0:2bc:da3e:3bd2 with SMTP id a11-20020a2eb16b000000b002bcda3e3bd2mr6125416ljm.29.1693792420425; Sun, 03 Sep 2023 18:53:40 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id o14-20020a2e9b4e000000b002b6d68b520esm1736657ljj.65.2023.09.03.18.53.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 18:53:40 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Sean Paul , Abhinav Kumar Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH 1/3] drm/encoder: register per-encoder debugfs dir Date: Mon, 4 Sep 2023 04:53:36 +0300 Message-Id: <20230904015338.2941417-2-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230904015338.2941417-1-dmitry.baryshkov@linaro.org> References: <20230904015338.2941417-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Each of connectors and CRTCs used by the DRM device provides debugfs directory, which is used by several standard debugfs files and can further be extended by the driver. Add such generic debugfs directories for encoder. Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong --- drivers/gpu/drm/drm_debugfs.c | 25 +++++++++++++++++++++++++ drivers/gpu/drm/drm_encoder.c | 4 ++++ drivers/gpu/drm/drm_internal.h | 9 +++++++++ include/drm/drm_encoder.h | 16 +++++++++++++++- 4 files changed, 53 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c index 2de43ff3ce0a..cf7f33bdc963 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -603,4 +603,29 @@ void drm_debugfs_crtc_remove(struct drm_crtc *crtc) crtc->debugfs_entry = NULL; } +void drm_debugfs_encoder_add(struct drm_encoder *encoder) +{ + struct drm_minor *minor = encoder->dev->primary; + struct dentry *root; + char *name; + + name = kasprintf(GFP_KERNEL, "encoder-%d", encoder->index); + if (!name) + return; + + root = debugfs_create_dir(name, minor->debugfs_root); + kfree(name); + + encoder->debugfs_entry = root; + + if (encoder->funcs->debugfs_init) + encoder->funcs->debugfs_init(encoder, root); +} + +void drm_debugfs_encoder_remove(struct drm_encoder *encoder) +{ + debugfs_remove_recursive(encoder->debugfs_entry); + encoder->debugfs_entry = NULL; +} + #endif /* CONFIG_DEBUG_FS */ diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c index 1143bc7f3252..8f2bc6a28482 100644 --- a/drivers/gpu/drm/drm_encoder.c +++ b/drivers/gpu/drm/drm_encoder.c @@ -30,6 +30,7 @@ #include #include "drm_crtc_internal.h" +#include "drm_internal.h" /** * DOC: overview @@ -74,6 +75,8 @@ int drm_encoder_register_all(struct drm_device *dev) int ret = 0; drm_for_each_encoder(encoder, dev) { + drm_debugfs_encoder_add(encoder); + if (encoder->funcs && encoder->funcs->late_register) ret = encoder->funcs->late_register(encoder); if (ret) @@ -90,6 +93,7 @@ void drm_encoder_unregister_all(struct drm_device *dev) drm_for_each_encoder(encoder, dev) { if (encoder->funcs && encoder->funcs->early_unregister) encoder->funcs->early_unregister(encoder); + drm_debugfs_encoder_remove(encoder); } } diff --git a/drivers/gpu/drm/drm_internal.h b/drivers/gpu/drm/drm_internal.h index ba12acd55139..173b4d872431 100644 --- a/drivers/gpu/drm/drm_internal.h +++ b/drivers/gpu/drm/drm_internal.h @@ -189,6 +189,8 @@ void drm_debugfs_connector_remove(struct drm_connector *connector); void drm_debugfs_crtc_add(struct drm_crtc *crtc); void drm_debugfs_crtc_remove(struct drm_crtc *crtc); void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc); +void drm_debugfs_encoder_add(struct drm_encoder *encoder); +void drm_debugfs_encoder_remove(struct drm_encoder *encoder); #else static inline int drm_debugfs_init(struct drm_minor *minor, int minor_id, struct dentry *root) @@ -222,6 +224,13 @@ static inline void drm_debugfs_crtc_crc_add(struct drm_crtc *crtc) { } +static inline void drm_debugfs_encoder_add(struct drm_encoder *encoder) +{ +} +static inline void drm_debugfs_encoder_remove(struct drm_encoder *encoder) +{ +} + #endif drm_ioctl_t drm_version; diff --git a/include/drm/drm_encoder.h b/include/drm/drm_encoder.h index 3a09682af685..977a9381c8ba 100644 --- a/include/drm/drm_encoder.h +++ b/include/drm/drm_encoder.h @@ -60,7 +60,7 @@ struct drm_encoder_funcs { * @late_register: * * This optional hook can be used to register additional userspace - * interfaces attached to the encoder like debugfs interfaces. + * interfaces attached to the encoder. * It is called late in the driver load sequence from drm_dev_register(). * Everything added from this callback should be unregistered in * the early_unregister callback. @@ -81,6 +81,13 @@ struct drm_encoder_funcs { * before data structures are torndown. */ void (*early_unregister)(struct drm_encoder *encoder); + + /** + * @debugfs_init: + * + * Allows encoders to create encoder-specific debugfs files. + */ + void (*debugfs_init)(struct drm_encoder *encoder, struct dentry *root); }; /** @@ -184,6 +191,13 @@ struct drm_encoder { const struct drm_encoder_funcs *funcs; const struct drm_encoder_helper_funcs *helper_private; + + /** + * @debugfs_entry: + * + * Debugfs directory for this CRTC. + */ + struct dentry *debugfs_entry; }; #define obj_to_encoder(x) container_of(x, struct drm_encoder, base) From patchwork Mon Sep 4 01:53:37 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720200 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F4CAC83F3E for ; Mon, 4 Sep 2023 01:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S243569AbjIDBxr (ORCPT ); Sun, 3 Sep 2023 21:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237088AbjIDBxq (ORCPT ); Sun, 3 Sep 2023 21:53:46 -0400 Received: from mail-lj1-x233.google.com (mail-lj1-x233.google.com [IPv6:2a00:1450:4864:20::233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 103CDFE for ; Sun, 3 Sep 2023 18:53:43 -0700 (PDT) Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-2bccda76fb1so14737141fa.2 for ; Sun, 03 Sep 2023 18:53:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693792421; x=1694397221; darn=vger.kernel.org; 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=CKurKpJO/W/lSqK2A4xu4KLR2HBC73PbdygNPCFcKNM=; b=mdFxTzu9p5QRBczy3C8iqh58U4T/7NcE4bA1joMVGLSbTlkuJN9sBCBxcyG04e7S1c wIpliAiuxY+iFEaQpqLQ2g32pzrPeqIwWOvabrh/vViMssC2UphcNsgbgwEe+kyzQVS9 lrmaeIYtg6pckC03aAfFP5I+ke0X2yRxk0xTpWA+NDTXX/fMl12SJHaDTbJn7SW3EvYS Cr7KYk7WaEpEVKxaSLVEz7okZm1vaZpfPrvbSM4XlrR+O2HOy69arle7bMzE/XfCO+S3 Tups1mfa8nFlaiAoyHMRjCJMNG1hyAnmm6T6MVYMLrHcUpmT7Uu+aggUq7vuVCE/+KFS 6ybQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693792421; x=1694397221; 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=CKurKpJO/W/lSqK2A4xu4KLR2HBC73PbdygNPCFcKNM=; b=KrKOIly9o3N+ipzH2OuM5jdOiRhLZYyMrZh7hi6Cl1H911q/m87TY0uG+d5TzwIKBM w6mvUgVGL4jqJt/5wRrDd0WuxxiSbqVbjOZnCfALM6/hIAlBE63fm1u7+4p4uivt2g7f 7qojy3fkqCNk1uWEjivr3c6HMPloirjqFgNkKLdTQV+rKApT07g0j5NGCF259ih2W4fv g5rFLNRnw+6aWqyQdyREDar0iv/OXMNDBLsh1p2paSCO5SV0TkDd8fS+BPo3RvObdNmt xC/Ac5bcD+hndPS+eQaz2umT9g/Z5nixRGGnFAkHUaNudmc6fur/TPCQeQWyE745hPQS Rc9g== X-Gm-Message-State: AOJu0YyfXNJjTYDFpO/IJdRgjLVo2mdHGPhDFLJf7s23q4OOnYVTVoiW 4ZWfW0XFzmMLP9eKLTJHp2YNGQ== X-Google-Smtp-Source: AGHT+IHK7V5Wxko/8bijdyJiXwTGU5SnRprshL8y7Mp97WHLUrMh/qbHHYt66uKeIOB5JA50D7k0pQ== X-Received: by 2002:a2e:9e8d:0:b0:2b6:eb5a:d377 with SMTP id f13-20020a2e9e8d000000b002b6eb5ad377mr5044166ljk.5.1693792421365; Sun, 03 Sep 2023 18:53:41 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id o14-20020a2e9b4e000000b002b6d68b520esm1736657ljj.65.2023.09.03.18.53.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 18:53:40 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Sean Paul , Abhinav Kumar Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH 2/3] drm/bridge: migrate bridge_chains to per-encoder file Date: Mon, 4 Sep 2023 04:53:37 +0300 Message-Id: <20230904015338.2941417-3-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230904015338.2941417-1-dmitry.baryshkov@linaro.org> References: <20230904015338.2941417-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Instead of having a single file with all bridge chains, list bridges under a corresponding per-encoder debugfs directory. Example of the listing: $ cat /sys/kernel/debug/dri/0/encoder-0/bridges bridge[0]: dsi_mgr_bridge_funcs type: [0] Unknown ops: [0] bridge[1]: lt9611uxc_bridge_funcs type: [11] HDMI-A OF: /soc@0/geniqup@9c0000/i2c@994000/hdmi-bridge@2b:lontium,lt9611uxc ops: [7] detect edid hpd Signed-off-by: Dmitry Baryshkov Reviewed-by: Neil Armstrong Reviewed-by: Tomi Valkeinen --- drivers/gpu/drm/drm_bridge.c | 44 ----------------------------------- drivers/gpu/drm/drm_debugfs.c | 39 ++++++++++++++++++++++++++++--- include/drm/drm_bridge.h | 2 -- 3 files changed, 36 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 39e68e45bb12..cee3188adf3d 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -1347,50 +1347,6 @@ 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 cf7f33bdc963..70913067406d 100644 --- a/drivers/gpu/drm/drm_debugfs.c +++ b/drivers/gpu/drm/drm_debugfs.c @@ -273,10 +273,8 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id, drm_debugfs_add_files(minor->dev, drm_debugfs_list, DRM_DEBUGFS_ENTRIES); - if (drm_drv_uses_atomic_modeset(dev)) { + 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)) { drm_framebuffer_debugfs_init(minor); @@ -603,6 +601,37 @@ void drm_debugfs_crtc_remove(struct drm_crtc *crtc) crtc->debugfs_entry = NULL; } +static int bridges_show(struct seq_file *m, void *data) +{ + struct drm_encoder *encoder = m->private; + struct drm_bridge *bridge; + unsigned int idx = 0; + + drm_for_each_bridge_in_chain(encoder, bridge) { + seq_printf(m, "bridge[%d]: %ps\n", idx++, bridge->funcs); + seq_printf(m, "\ttype: [%d] %s\n", + bridge->type, + drm_get_connector_type_name(bridge->type)); +#ifdef CONFIG_OF + if (bridge->of_node) + seq_printf(m, "\tOF: %pOFfc\n", bridge->of_node); +#endif + seq_printf(m, "\tops: [0x%x]", bridge->ops); + if (bridge->ops & DRM_BRIDGE_OP_DETECT) + seq_puts(m, " detect"); + if (bridge->ops & DRM_BRIDGE_OP_EDID) + seq_puts(m, " edid"); + if (bridge->ops & DRM_BRIDGE_OP_HPD) + seq_puts(m, " hpd"); + if (bridge->ops & DRM_BRIDGE_OP_MODES) + seq_puts(m, " modes"); + seq_puts(m, "\n"); + } + + return 0; +} +DEFINE_SHOW_ATTRIBUTE(bridges); + void drm_debugfs_encoder_add(struct drm_encoder *encoder) { struct drm_minor *minor = encoder->dev->primary; @@ -618,6 +647,10 @@ void drm_debugfs_encoder_add(struct drm_encoder *encoder) encoder->debugfs_entry = root; + /* bridges list */ + debugfs_create_file("bridges", 0444, root, encoder, + &bridges_fops); + if (encoder->funcs->debugfs_init) encoder->funcs->debugfs_init(encoder, root); } diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index c339fc85fd07..902bc3f99c2a 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -950,6 +950,4 @@ static inline struct drm_bridge *drmm_of_get_bridge(struct drm_device *drm, } #endif -void drm_bridge_debugfs_init(struct drm_minor *minor); - #endif From patchwork Mon Sep 4 01:53:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 720030 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 008B1CA0FE3 for ; Mon, 4 Sep 2023 01:53:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237088AbjIDBxr (ORCPT ); Sun, 3 Sep 2023 21:53:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240586AbjIDBxr (ORCPT ); Sun, 3 Sep 2023 21:53:47 -0400 Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1009E7 for ; Sun, 3 Sep 2023 18:53:43 -0700 (PDT) Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-2bcde83ce9fso14959901fa.1 for ; Sun, 03 Sep 2023 18:53:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1693792422; x=1694397222; darn=vger.kernel.org; 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=BTtKn/J1k9sfk/fyOsFRulPqHOclNW7fP9voBuBEnyk=; b=pXi/epLaf1wGRMDQFJkY7cSve9S3M2n4CDZ9v0Lkjd600V/xlycyDuVsecOdvxyk+2 dOPZPa5790jGTRoM8YfDxU4sdb7qHse4PJHVYdIrB575yDAGehzAzl5I15JxoMS7pQp/ H8ARkVadpVK5ZPNx+uGCXOaIMz7JObAlBY8iH7lf0/uHwdxhdaFjPqtn1KJEYzIc6Rbq /jBg6aBzrNqFFgz0nJOL61M38FzPzaBE1RI2ZyghJRS1O6cp4u5OwcKj+sXwdEJamg6K ZncCmPqCBeOqQ4yglsLHVnegXZFeWxPCThs5LdttBG+AufYYlGGy+hVpRSdm0zmcQ50I nwXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693792422; x=1694397222; 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=BTtKn/J1k9sfk/fyOsFRulPqHOclNW7fP9voBuBEnyk=; b=h3xlMaFDl8KTxE74l/EVMzFPNPfvVsaMUvTvT2EFYPM8A9BWs6xT2nPCzzNe7POem0 lJrr7h9P591VWGZZeIPrMGjyWT/szundnUz8vqDaEoHZykQC7FY5f0X4nRWcGeh2iFmE XA4pKnqQpUpXaL+Ez5cL06Ag2EZSe9GQPD60KI8J1QdQ80ng6XKCltrd7XuDoxup41H+ 2zygYiKZWGThyNNX7UOFJdz9BgcAZ8FUIJVOQ+wqg32INz9gheDBrNmDi8arPOSsF9kD Q71n44l8eHjafgMFaOXJI5VNvwMKQ5BIhH1YAu0Hhjh4zDpxS2dR039/qTq7eVW7AHD+ b3AA== X-Gm-Message-State: AOJu0Yxia2lMQ/riq5luRFOfu+jIPiSZ8COJ0HvSGfJEWmKryQUknqMi O5Wv2ZCUzAsNHyJb39sCGGBHQg== X-Google-Smtp-Source: AGHT+IEvwjnbDSz8/au6NJ2uDEmaZAs1o17IPKjclpVWzd/6tjjypwk2exCpVbKLsi4YDfdMLPVKyg== X-Received: by 2002:a2e:9215:0:b0:2b9:3883:a765 with SMTP id k21-20020a2e9215000000b002b93883a765mr5662698ljg.31.1693792422145; Sun, 03 Sep 2023 18:53:42 -0700 (PDT) Received: from umbar.unikie.fi ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id o14-20020a2e9b4e000000b002b6d68b520esm1736657ljj.65.2023.09.03.18.53.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Sep 2023 18:53:41 -0700 (PDT) From: Dmitry Baryshkov To: David Airlie , Daniel Vetter , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Clark , Sean Paul , Abhinav Kumar Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org Subject: [PATCH 3/3] drm/msm/dpu: move encoder status to standard encoder debugfs dir Date: Mon, 4 Sep 2023 04:53:38 +0300 Message-Id: <20230904015338.2941417-4-dmitry.baryshkov@linaro.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230904015338.2941417-1-dmitry.baryshkov@linaro.org> References: <20230904015338.2941417-1-dmitry.baryshkov@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org Now as we have standard per-encoder debugfs directory, move DPU encoder status file to that directory. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 45 +++------------------ 1 file changed, 6 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index d34e684a4178..b219382d1153 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -184,7 +184,6 @@ struct dpu_encoder_virt { struct drm_crtc *crtc; struct drm_connector *connector; - struct dentry *debugfs_root; struct mutex enc_lock; DECLARE_BITMAP(frame_busy_mask, MAX_PHYS_ENCODERS_PER_VIRTUAL); void (*crtc_frame_event_cb)(void *, u32 event); @@ -2096,7 +2095,8 @@ void dpu_encoder_helper_phys_cleanup(struct dpu_encoder_phys *phys_enc) #ifdef CONFIG_DEBUG_FS static int _dpu_encoder_status_show(struct seq_file *s, void *data) { - struct dpu_encoder_virt *dpu_enc = s->private; + struct drm_encoder *drm_enc = s->private; + struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); int i; mutex_lock(&dpu_enc->enc_lock); @@ -2118,48 +2118,16 @@ static int _dpu_encoder_status_show(struct seq_file *s, void *data) DEFINE_SHOW_ATTRIBUTE(_dpu_encoder_status); -static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc) +static void dpu_encoder_debugfs_init(struct drm_encoder *drm_enc, struct dentry *root) { - struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(drm_enc); - - char name[12]; - - if (!drm_enc->dev) { - DPU_ERROR("invalid encoder or kms\n"); - return -EINVAL; - } - - snprintf(name, sizeof(name), "encoder%u", drm_enc->base.id); - - /* create overall sub-directory for the encoder */ - dpu_enc->debugfs_root = debugfs_create_dir(name, - drm_enc->dev->primary->debugfs_root); - /* don't error check these */ debugfs_create_file("status", 0600, - dpu_enc->debugfs_root, dpu_enc, &_dpu_encoder_status_fops); - - return 0; + root, drm_enc, &_dpu_encoder_status_fops); } #else -static int _dpu_encoder_init_debugfs(struct drm_encoder *drm_enc) -{ - return 0; -} +#define dpu_encoder_debugfs_init NULL #endif -static int dpu_encoder_late_register(struct drm_encoder *encoder) -{ - return _dpu_encoder_init_debugfs(encoder); -} - -static void dpu_encoder_early_unregister(struct drm_encoder *encoder) -{ - struct dpu_encoder_virt *dpu_enc = to_dpu_encoder_virt(encoder); - - debugfs_remove_recursive(dpu_enc->debugfs_root); -} - static int dpu_encoder_virt_add_phys_encs( struct msm_display_info *disp_info, struct dpu_encoder_virt *dpu_enc, @@ -2343,8 +2311,7 @@ static const struct drm_encoder_helper_funcs dpu_encoder_helper_funcs = { static const struct drm_encoder_funcs dpu_encoder_funcs = { .destroy = dpu_encoder_destroy, - .late_register = dpu_encoder_late_register, - .early_unregister = dpu_encoder_early_unregister, + .debugfs_init = dpu_encoder_debugfs_init, }; struct drm_encoder *dpu_encoder_init(struct drm_device *dev,