Message ID | 20220204161245.v2.2.Ib0bd5346135cbb0b63006b69b61d4c8af6484740@changeid (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm/panel-edp: Debugfs for panel-edp | expand |
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 <dianders@chromium.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > > 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 <linux/list.h> > > 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); > }; > > /**
Hello Doug, On 2/5/22 01:13, Douglas Anderson wrote: [snip] > +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); This could return a ERR_PTR(-errno) if the function doesn't succeed. I noticed that most kernel code doesn't check the return value though... > + if (panel->funcs->debugfs_init) Probably if (!(IS_ERR(root) && panel->funcs->debugfs_init) ? > + panel->funcs->debugfs_init(panel, root); > +} [snip] > @@ -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); Same here, wonder if the return value should be checked. I leave it to you to decide, but regardless of that the patch looks good to me. Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Best regards,
On 15.02.2022 23:09, Javier Martinez Canillas wrote: > Hello Doug, > > On 2/5/22 01:13, Douglas Anderson wrote: > > [snip] > >> +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); > This could return a ERR_PTR(-errno) if the function doesn't succeed. > > I noticed that most kernel code doesn't check the return value though... > >> + if (panel->funcs->debugfs_init) > Probably if (!(IS_ERR(root) && panel->funcs->debugfs_init) ? > >> + panel->funcs->debugfs_init(panel, root); >> +} > [snip] > >> @@ -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); > Same here, wonder if the return value should be checked. I've seen sometimes that file/dir was already created with the same name, reporting error in such case will be helpful. Regards Andrzej > > I leave it to you to decide, but regardless of that the patch looks good to me. > > Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> > > Best regards,
Hi, On Tue, Feb 15, 2022 at 2:20 PM Andrzej Hajda <andrzej.hajda@intel.com> wrote: > > On 15.02.2022 23:09, Javier Martinez Canillas wrote: > > Hello Doug, > > > > On 2/5/22 01:13, Douglas Anderson wrote: > > > > [snip] > > > >> +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); > > This could return a ERR_PTR(-errno) if the function doesn't succeed. > > > > I noticed that most kernel code doesn't check the return value though... > > > >> + if (panel->funcs->debugfs_init) > > Probably if (!(IS_ERR(root) && panel->funcs->debugfs_init) ? > > > >> + panel->funcs->debugfs_init(panel, root); > >> +} > > [snip] > > > >> @@ -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); > > Same here, wonder if the return value should be checked. My plan (confirmed with Javier over IRC) is to land my patches and we can address as needed with follow-up patches. I actually wrote said follow-up patches and they were ready to go, but when I was trying to come up with the right "Fixes" tag I found commit b792e64021ec ("drm: no need to check return value of debugfs_create functions"). So what's being requested is nearly the opposite of what Greg did there. I thought about perhaps only checking for directories but even that type of check was removed by Greg's patch. Further checking shows that start_creating() actually has: if (IS_ERR(parent)) return parent; ...so I guess that explains why it's fine to skip the check even for parents? Sure enough I confirmed that if I pass `ERR_PTR(-EINVAL)` as the root for `panel->funcs->debugfs_init()` that nothing bad seems to happen... > I've seen sometimes that file/dir was already created with the same > name, reporting error in such case will be helpful. It sure looks like start_creating() already handles that type of reporting... Sure enough, I tried to create the "force" file twice, adding no error checking myself, and I see: debugfs: File 'force' in directory 'eDP-1' already present! debugfs: File 'force' in directory 'DP-1' already present! So tl;dr is that I'm going to land the patches and now am _not_ planning on doing followup patches. However, if I'm confused about any of the above then please let me know and I'll dig more / can send follow-up patches. -Doug
On Tue, 15 Feb 2022, Doug Anderson <dianders@chromium.org> wrote: > Hi, > > On Tue, Feb 15, 2022 at 2:20 PM Andrzej Hajda <andrzej.hajda@intel.com> wrote: >> >> On 15.02.2022 23:09, Javier Martinez Canillas wrote: >> > Hello Doug, >> > >> > On 2/5/22 01:13, Douglas Anderson wrote: >> > >> > [snip] >> > >> >> +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); >> > This could return a ERR_PTR(-errno) if the function doesn't succeed. >> > >> > I noticed that most kernel code doesn't check the return value though... >> > >> >> + if (panel->funcs->debugfs_init) >> > Probably if (!(IS_ERR(root) && panel->funcs->debugfs_init) ? >> > >> >> + panel->funcs->debugfs_init(panel, root); >> >> +} >> > [snip] >> > >> >> @@ -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); >> > Same here, wonder if the return value should be checked. > > My plan (confirmed with Javier over IRC) is to land my patches and we > can address as needed with follow-up patches. > > I actually wrote said follow-up patches and they were ready to go, but > when I was trying to come up with the right "Fixes" tag I found commit > b792e64021ec ("drm: no need to check return value of debugfs_create > functions"). So what's being requested is nearly the opposite of what > Greg did there. > > I thought about perhaps only checking for directories but even that > type of check was removed by Greg's patch. Further checking shows that > start_creating() actually has: > > if (IS_ERR(parent)) > return parent; > > ...so I guess that explains why it's fine to skip the check even for parents? > > Sure enough I confirmed that if I pass `ERR_PTR(-EINVAL)` as the root > for `panel->funcs->debugfs_init()` that nothing bad seems to happen... Yeah, the idea is that you don't need to check for debugfs function return values and you can safely pass error pointers to debugfs functions. The worst that can happen is you don't get the debugfs, but hey, it's debugfs so you shouldn't fail anything else because of that anyway. BR, Jani. > > >> I've seen sometimes that file/dir was already created with the same >> name, reporting error in such case will be helpful. > > It sure looks like start_creating() already handles that type of > reporting... Sure enough, I tried to create the "force" file twice, > adding no error checking myself, and I see: > > debugfs: File 'force' in directory 'eDP-1' already present! > debugfs: File 'force' in directory 'DP-1' already present! > > > So tl;dr is that I'm going to land the patches and now am _not_ > planning on doing followup patches. However, if I'm confused about any > of the above then please let me know and I'll dig more / can send > follow-up patches. > > -Doug
On 2/16/22 10:25, Jani Nikula wrote: [snip] >> >> I actually wrote said follow-up patches and they were ready to go, but >> when I was trying to come up with the right "Fixes" tag I found commit >> b792e64021ec ("drm: no need to check return value of debugfs_create >> functions"). So what's being requested is nearly the opposite of what >> Greg did there. >> >> I thought about perhaps only checking for directories but even that >> type of check was removed by Greg's patch. Further checking shows that >> start_creating() actually has: >> >> if (IS_ERR(parent)) >> return parent; >> >> ...so I guess that explains why it's fine to skip the check even for parents? >> >> Sure enough I confirmed that if I pass `ERR_PTR(-EINVAL)` as the root >> for `panel->funcs->debugfs_init()` that nothing bad seems to happen... > > Yeah, the idea is that you don't need to check for debugfs function > return values and you can safely pass error pointers to debugfs > functions. The worst that can happen is you don't get the debugfs, but > hey, it's debugfs so you shouldn't fail anything else because of that > anyway. > Thanks a lot Doug and Jani for the explanations. That makes sense and it explains why most code I looked was not checking for the return value. I guess we should write something about this in the debugfs functions kernel doc so it's mentioned explicitly and people don't have to guess. Best regards,
On 16.02.2022 10:35, Javier Martinez Canillas wrote: > On 2/16/22 10:25, Jani Nikula wrote: > > [snip] > >>> I actually wrote said follow-up patches and they were ready to go, but >>> when I was trying to come up with the right "Fixes" tag I found commit >>> b792e64021ec ("drm: no need to check return value of debugfs_create >>> functions"). So what's being requested is nearly the opposite of what >>> Greg did there. >>> >>> I thought about perhaps only checking for directories but even that >>> type of check was removed by Greg's patch. Further checking shows that >>> start_creating() actually has: >>> >>> if (IS_ERR(parent)) >>> return parent; >>> >>> ...so I guess that explains why it's fine to skip the check even for parents? >>> >>> Sure enough I confirmed that if I pass `ERR_PTR(-EINVAL)` as the root >>> for `panel->funcs->debugfs_init()` that nothing bad seems to happen... >> Yeah, the idea is that you don't need to check for debugfs function >> return values and you can safely pass error pointers to debugfs >> functions. The worst that can happen is you don't get the debugfs, but >> hey, it's debugfs so you shouldn't fail anything else because of that >> anyway. >> > Thanks a lot Doug and Jani for the explanations. That makes sense and it > explains why most code I looked was not checking for the return value. > > I guess we should write something about this in the debugfs functions > kernel doc so it's mentioned explicitly and people don't have to guess. Nice, didn't know debugfs started using this pattern. I hope the pattern will be used broader, as it allows to save lot of redundant checks. Regards Andrzej > > Best regards,
Hi, On Wed, Feb 16, 2022 at 1:36 AM Javier Martinez Canillas <javierm@redhat.com> wrote: > > On 2/16/22 10:25, Jani Nikula wrote: > > [snip] > > >> > >> I actually wrote said follow-up patches and they were ready to go, but > >> when I was trying to come up with the right "Fixes" tag I found commit > >> b792e64021ec ("drm: no need to check return value of debugfs_create > >> functions"). So what's being requested is nearly the opposite of what > >> Greg did there. > >> > >> I thought about perhaps only checking for directories but even that > >> type of check was removed by Greg's patch. Further checking shows that > >> start_creating() actually has: > >> > >> if (IS_ERR(parent)) > >> return parent; > >> > >> ...so I guess that explains why it's fine to skip the check even for parents? > >> > >> Sure enough I confirmed that if I pass `ERR_PTR(-EINVAL)` as the root > >> for `panel->funcs->debugfs_init()` that nothing bad seems to happen... > > > > Yeah, the idea is that you don't need to check for debugfs function > > return values and you can safely pass error pointers to debugfs > > functions. The worst that can happen is you don't get the debugfs, but > > hey, it's debugfs so you shouldn't fail anything else because of that > > anyway. > > > > Thanks a lot Doug and Jani for the explanations. That makes sense and it > explains why most code I looked was not checking for the return value. > > I guess we should write something about this in the debugfs functions > kernel doc so it's mentioned explicitly and people don't have to guess. For anyone interested, I've taken Javier's suggestion and tried to update the docs: https://lore.kernel.org/r/20220222154555.1.I26d364db7a007f8995e8f0dac978673bc8e9f5e2@changeid
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 <linux/list.h> 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); }; /**
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 <dianders@chromium.org> --- 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(+)