On Mon, Apr 08, 2024 at 12:43:57PM +0300, Jani Nikula wrote: > Continue with placing debugfs next to the implementation. > > Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx> > --- > .../drm/i915/display/intel_display_debugfs.c | 27 ++-------------- > drivers/gpu/drm/i915/display/intel_pps.c | 32 +++++++++++++++++++ > drivers/gpu/drm/i915/display/intel_pps.h | 2 ++ > 3 files changed, 36 insertions(+), 25 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_display_debugfs.c b/drivers/gpu/drm/i915/display/intel_display_debugfs.c > index 5235f8758ef1..0feffe8d4e45 100644 > --- a/drivers/gpu/drm/i915/display/intel_display_debugfs.c > +++ b/drivers/gpu/drm/i915/display/intel_display_debugfs.c > @@ -31,6 +31,7 @@ > #include "intel_hdmi.h" > #include "intel_hotplug.h" > #include "intel_panel.h" > +#include "intel_pps.h" > #include "intel_psr.h" > #include "intel_psr_regs.h" > #include "intel_wm.h" > @@ -1095,27 +1096,6 @@ void intel_display_debugfs_register(struct drm_i915_private *i915) > intel_display_debugfs_params(i915); > } > > -static int i915_panel_show(struct seq_file *m, void *data) > -{ > - struct intel_connector *connector = m->private; > - struct intel_dp *intel_dp = intel_attached_dp(connector); > - > - if (connector->base.status != connector_status_connected) > - return -ENODEV; > - > - seq_printf(m, "Panel power up delay: %d\n", > - intel_dp->pps.panel_power_up_delay); > - seq_printf(m, "Panel power down delay: %d\n", > - intel_dp->pps.panel_power_down_delay); > - seq_printf(m, "Backlight on delay: %d\n", > - intel_dp->pps.backlight_on_delay); > - seq_printf(m, "Backlight off delay: %d\n", > - intel_dp->pps.backlight_off_delay); > - > - return 0; > -} > -DEFINE_SHOW_ATTRIBUTE(i915_panel); > - > static int i915_hdcp_sink_capability_show(struct seq_file *m, void *data) > { > struct intel_connector *connector = m->private; > @@ -1560,12 +1540,9 @@ void intel_connector_debugfs_add(struct intel_connector *connector) > return; > > intel_drrs_connector_debugfs_add(connector); > + intel_pps_connector_debugfs_add(connector); > intel_psr_connector_debugfs_add(connector); > > - if (connector_type == DRM_MODE_CONNECTOR_eDP) > - debugfs_create_file("i915_panel_timings", 0444, root, > - connector, &i915_panel_fops); > - > if (connector_type == DRM_MODE_CONNECTOR_DisplayPort || > connector_type == DRM_MODE_CONNECTOR_HDMIA || > connector_type == DRM_MODE_CONNECTOR_HDMIB) { > diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c > index b5d9920f8341..88a44d93f82b 100644 > --- a/drivers/gpu/drm/i915/display/intel_pps.c > +++ b/drivers/gpu/drm/i915/display/intel_pps.c > @@ -1670,6 +1670,38 @@ void intel_pps_setup(struct drm_i915_private *i915) > i915->display.pps.mmio_base = PPS_BASE; > } > > +static int intel_pps_show(struct seq_file *m, void *data) > +{ > + struct intel_connector *connector = m->private; > + struct intel_dp *intel_dp = intel_attached_dp(connector); > + > + if (connector->base.status != connector_status_connected) > + return -ENODEV; That check seems completely pointless. Could be removed as a followup. Hmm. The other question that comes to mind is whether anyone has ever used this file? I for sure have not. So I'm wondering if we could just nuke the whole thing? Anyways Reviewed-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx> > + > + seq_printf(m, "Panel power up delay: %d\n", > + intel_dp->pps.panel_power_up_delay); > + seq_printf(m, "Panel power down delay: %d\n", > + intel_dp->pps.panel_power_down_delay); > + seq_printf(m, "Backlight on delay: %d\n", > + intel_dp->pps.backlight_on_delay); > + seq_printf(m, "Backlight off delay: %d\n", > + intel_dp->pps.backlight_off_delay); > + > + return 0; > +} > +DEFINE_SHOW_ATTRIBUTE(intel_pps); > + > +void intel_pps_connector_debugfs_add(struct intel_connector *connector) > +{ > + struct dentry *root = connector->base.debugfs_entry; > + int connector_type = connector->base.connector_type; > + > + if (connector_type == DRM_MODE_CONNECTOR_eDP) > + debugfs_create_file("i915_panel_timings", 0444, root, > + connector, &intel_pps_fops); > + > +} > + > void assert_pps_unlocked(struct drm_i915_private *dev_priv, enum pipe pipe) > { > i915_reg_t pp_reg; > diff --git a/drivers/gpu/drm/i915/display/intel_pps.h b/drivers/gpu/drm/i915/display/intel_pps.h > index a2c2467e3c22..07ef96ca8da2 100644 > --- a/drivers/gpu/drm/i915/display/intel_pps.h > +++ b/drivers/gpu/drm/i915/display/intel_pps.h > @@ -51,6 +51,8 @@ void vlv_pps_init(struct intel_encoder *encoder, > void intel_pps_unlock_regs_wa(struct drm_i915_private *i915); > void intel_pps_setup(struct drm_i915_private *i915); > > +void intel_pps_connector_debugfs_add(struct intel_connector *connector); > + > void assert_pps_unlocked(struct drm_i915_private *i915, enum pipe pipe); > > #endif /* __INTEL_PPS_H__ */ > -- > 2.39.2 -- Ville Syrjälä Intel