Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp1640266pxb; Wed, 9 Feb 2022 00:53:10 -0800 (PST) X-Google-Smtp-Source: ABdhPJx6itxLMYBz2sUf54n/+4pJWMql1VXzJmr6llT4LIVTl/aMGzDRgtyYgSE+akMu63nvmsq/ X-Received: by 2002:a63:6ece:: with SMTP id j197mr1100939pgc.420.1644396789946; Wed, 09 Feb 2022 00:53:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644396789; cv=none; d=google.com; s=arc-20160816; b=W05vnl7DDzVYCmBgMWP5CbHiRzaMvgvceQNu3NrXcnqTHcI5kW4KFUUgYay4A0fCrg 01KsSiveezEQKOjJnKW8Kh9E8DlMTZKtmjYPwoCCtpeGHlUpKu4xoCYU3MhWyT8sQO0n yBChjTszpNZS1kTMVgfVcLqHa/598dC88I+C6I+twcYB7LyCYhPHm+4F8GNbGTlSOSKl bwRPb0frUs750dZqDLnBuGh56H+FboOMy/KUDapzWVVSeX4dk27D2dueujTM4y3qX6Ch 1eYobiCpUEEQqyX9k4wqck91e4X0TVXOTNsMHWYl7sYKI5Y5Eh1ldbyGjdvmIwpJRCDK Meqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=heEEdzVjDbPJb/NfWzIvt8RpIfRVfsXGN8m8wHA6tag=; b=PqNjAtz9RcEcUoXjAWSwp4wb863cD6+IkhzqSfiz+zoR5PqzRNdsBwxun/DGrvwONt i05TmxQPPK5ZSW0Xh08BQHpcnk+H8ZHcqJ7864NeD7iyF2GYj7XWCHTLqNwZJULHerCW 1mzY6gm8wJ2ekG9AHnYHWCHPMqQtck7TvU1vYzILkAWlFdJd0P2v8ISLwGVfvGxS5yBE InAKa4X5BZxsQQu0Of+KII2wZMedb5gyg2e35f9dXcvkM05ZvwcnUNuN8QpquLSSprxW 2kQwO4QhzNTdzUR/VS0la/WRtdGSoBZM6IrsMKvhSvo9VBhYlwi54FxB+M7xtc0SCGzm Uc3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="iePNPe/r"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id c24si14417477pls.475.2022.02.09.00.53.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 09 Feb 2022 00:53:09 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b="iePNPe/r"; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DD2B8DF49886; Wed, 9 Feb 2022 00:45:25 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244559AbiBHByJ (ORCPT + 99 others); Mon, 7 Feb 2022 20:54:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237747AbiBHByD (ORCPT ); Mon, 7 Feb 2022 20:54:03 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7DCD2C061A73 for ; Mon, 7 Feb 2022 17:54:02 -0800 (PST) Received: from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id D9222340; Tue, 8 Feb 2022 02:53:59 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1644285240; bh=8SOb7WY/C5MVQclIAXnV4Guf5IVY1sW+SVXDe2gIdNg=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=iePNPe/r1H9kMW1s2sbTf/eQa5OenB0l/iUlAI3czaxLmgKiL0+xcvYKUwrdAQ07Z L5G/oV688qeA8Mn1J3tk0yL+IEDaMXd7zpL0jG6maBUGKOD1tIjn76N4itvHoYhwxX zntncxoe+4wND//hkR7YzPG/LyP7wwyDCnZL0kq4= Date: Tue, 8 Feb 2022 03:53:56 +0200 From: Laurent Pinchart To: Douglas Anderson Cc: dri-devel@lists.freedesktop.org, Daniel Vetter , Javier Martinez Canillas , robert.foss@linaro.org, lschyi@chromium.org, Sam Ravnborg , jjsu@chromium.org, Andrzej Hajda , David Airlie , Jernej Skrabec , Jonas Karlman , Maarten Lankhorst , Maxime Ripard , Neil Armstrong , Thierry Reding , Thomas Zimmermann , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] drm: Plumb debugfs_init through to panels Message-ID: References: <20220205001342.3155839-1-dianders@chromium.org> <20220204161245.v2.2.Ib0bd5346135cbb0b63006b69b61d4c8af6484740@changeid> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220204161245.v2.2.Ib0bd5346135cbb0b63006b69b61d4c8af6484740@changeid> X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Douglas, Thank you for the patch. On Fri, Feb 04, 2022 at 04:13:41PM -0800, Douglas Anderson wrote: > We'd like panels to be able to add things to debugfs underneath the > connector's directory. Let's plumb it through. A panel will be able to > put things in a "panel" directory under the connector's > directory. Note that debugfs is not ABI and so it's always possible > that the location that the panel gets for its debugfs could change in > the future. > > NOTE: this currently only works if you're using a modern > architecture. Specifically the plumbing relies on _both_ > drm_bridge_connector and drm_panel_bridge. If you're not using one or > both of these things then things won't be plumbed through. > > As a side effect of this change, drm_bridges can also get callbacks to > put stuff underneath the connector's debugfs directory. At the moment > all bridges in the chain have their debugfs_init() called with the > connector's root directory. > > Signed-off-by: Douglas Anderson Reviewed-by: Laurent Pinchart > --- > > Changes in v2: > - ("drm: Plumb debugfs_init through to panels") new for v2. > > drivers/gpu/drm/bridge/panel.c | 12 ++++++++++++ > drivers/gpu/drm/drm_bridge_connector.c | 15 +++++++++++++++ > drivers/gpu/drm/drm_debugfs.c | 3 +++ > include/drm/drm_bridge.h | 7 +++++++ > include/drm/drm_connector.h | 7 +++++++ > include/drm/drm_panel.h | 8 ++++++++ > 6 files changed, 52 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c > index b32295abd9e7..5be057575183 100644 > --- a/drivers/gpu/drm/bridge/panel.c > +++ b/drivers/gpu/drm/bridge/panel.c > @@ -138,6 +138,17 @@ static int panel_bridge_get_modes(struct drm_bridge *bridge, > return drm_panel_get_modes(panel_bridge->panel, connector); > } > > +static void panel_bridge_debugfs_init(struct drm_bridge *bridge, > + struct dentry *root) > +{ > + struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); > + struct drm_panel *panel = panel_bridge->panel; > + > + root = debugfs_create_dir("panel", root); > + if (panel->funcs->debugfs_init) > + panel->funcs->debugfs_init(panel, root); > +} > + > static const struct drm_bridge_funcs panel_bridge_bridge_funcs = { > .attach = panel_bridge_attach, > .detach = panel_bridge_detach, > @@ -150,6 +161,7 @@ static const struct drm_bridge_funcs panel_bridge_bridge_funcs = { > .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, > .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, > .atomic_get_input_bus_fmts = drm_atomic_helper_bridge_propagate_bus_fmt, > + .debugfs_init = panel_bridge_debugfs_init, > }; > > /** > diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c > index 791379816837..60923cdfe8e1 100644 > --- a/drivers/gpu/drm/drm_bridge_connector.c > +++ b/drivers/gpu/drm/drm_bridge_connector.c > @@ -216,6 +216,20 @@ static void drm_bridge_connector_destroy(struct drm_connector *connector) > kfree(bridge_connector); > } > > +static void drm_bridge_connector_debugfs_init(struct drm_connector *connector, > + struct dentry *root) > +{ > + struct drm_bridge_connector *bridge_connector = > + to_drm_bridge_connector(connector); > + struct drm_encoder *encoder = bridge_connector->encoder; > + struct drm_bridge *bridge; > + > + list_for_each_entry(bridge, &encoder->bridge_chain, chain_node) { > + if (bridge->funcs->debugfs_init) > + bridge->funcs->debugfs_init(bridge, root); > + } > +} > + > static const struct drm_connector_funcs drm_bridge_connector_funcs = { > .reset = drm_atomic_helper_connector_reset, > .detect = drm_bridge_connector_detect, > @@ -223,6 +237,7 @@ static const struct drm_connector_funcs drm_bridge_connector_funcs = { > .destroy = drm_bridge_connector_destroy, > .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, > .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > + .debugfs_init = drm_bridge_connector_debugfs_init, > }; > > /* ----------------------------------------------------------------------------- > diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c > index b0a826489488..7f1b82dbaebb 100644 > --- a/drivers/gpu/drm/drm_debugfs.c > +++ b/drivers/gpu/drm/drm_debugfs.c > @@ -436,6 +436,9 @@ void drm_debugfs_connector_add(struct drm_connector *connector) > /* vrr range */ > debugfs_create_file("vrr_range", S_IRUGO, root, connector, > &vrr_range_fops); > + > + if (connector->funcs->debugfs_init) > + connector->funcs->debugfs_init(connector, root); > } > > void drm_debugfs_connector_remove(struct drm_connector *connector) > diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h > index 061d87313fac..f27b4060faa2 100644 > --- a/include/drm/drm_bridge.h > +++ b/include/drm/drm_bridge.h > @@ -649,6 +649,13 @@ struct drm_bridge_funcs { > * the DRM_BRIDGE_OP_HPD flag in their &drm_bridge->ops. > */ > void (*hpd_disable)(struct drm_bridge *bridge); > + > + /** > + * @debugfs_init: > + * > + * Allows bridges to create bridge-specific debugfs files. > + */ > + void (*debugfs_init)(struct drm_bridge *bridge, struct dentry *root); > }; > > /** > diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h > index 64cf5f88c05b..54429dde744a 100644 > --- a/include/drm/drm_connector.h > +++ b/include/drm/drm_connector.h > @@ -1142,6 +1142,13 @@ struct drm_connector_funcs { > * has been received from a source outside the display driver / device. > */ > void (*oob_hotplug_event)(struct drm_connector *connector); > + > + /** > + * @debugfs_init: > + * > + * Allows connectors to create connector-specific debugfs files. > + */ > + void (*debugfs_init)(struct drm_connector *connector, struct dentry *root); > }; > > /** > diff --git a/include/drm/drm_panel.h b/include/drm/drm_panel.h > index 4602f833eb51..1ba2d424a53f 100644 > --- a/include/drm/drm_panel.h > +++ b/include/drm/drm_panel.h > @@ -29,6 +29,7 @@ > #include > > struct backlight_device; > +struct dentry; > struct device_node; > struct drm_connector; > struct drm_device; > @@ -125,6 +126,13 @@ struct drm_panel_funcs { > */ > int (*get_timings)(struct drm_panel *panel, unsigned int num_timings, > struct display_timing *timings); > + > + /** > + * @debugfs_init: > + * > + * Allows panels to create panels-specific debugfs files. > + */ > + void (*debugfs_init)(struct drm_panel *panel, struct dentry *root); > }; > > /** -- Regards, Laurent Pinchart