Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amd/display: Move connector debugfs to drm

As drm_connector already have the display_info, instead of creating
"output_bpc" debugfs in vendor specific driver, move the logic to
the drm layer.

This patch will also move "Current" bpc to the crtc debugfs from
connector debugfs, since we are getting this info from crtc_state.

Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira@amd.com>
Signed-off-by: Bhanuprakash Modem <bhanuprakash.modem@intel.com>
Reported-by: kernel test robot <lkp@intel.com>
Reviewed-by: Arun R Murthy <arun.r.murthy@intel.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220519095149.3560034-4-bhanuprakash.modem@intel.com

authored by

Bhanuprakash Modem and committed by
Jani Nikula
4cd79f61 fa373eb2

+13 -31
-4
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
··· 6617 6617 return &state->base; 6618 6618 } 6619 6619 6620 - #ifdef CONFIG_DRM_AMD_SECURE_DISPLAY 6621 6620 static int amdgpu_dm_crtc_late_register(struct drm_crtc *crtc) 6622 6621 { 6623 6622 crtc_debugfs_init(crtc); 6624 6623 6625 6624 return 0; 6626 6625 } 6627 - #endif 6628 6626 6629 6627 static inline int dm_set_vupdate_irq(struct drm_crtc *crtc, bool enable) 6630 6628 { ··· 6720 6722 .enable_vblank = dm_enable_vblank, 6721 6723 .disable_vblank = dm_disable_vblank, 6722 6724 .get_vblank_timestamp = drm_crtc_vblank_helper_get_vblank_timestamp, 6723 - #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) 6724 6725 .late_register = amdgpu_dm_crtc_late_register, 6725 - #endif 6726 6726 }; 6727 6727 6728 6728 static enum drm_connector_status
+13 -25
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
··· 873 873 } 874 874 875 875 /* 876 - * Returns the current and maximum output bpc for the connector. 877 - * Example usage: cat /sys/kernel/debug/dri/0/DP-1/output_bpc 876 + * Returns the current bpc for the crtc. 877 + * Example usage: cat /sys/kernel/debug/dri/0/crtc-0/amdgpu_current_bpc 878 878 */ 879 - static int output_bpc_show(struct seq_file *m, void *data) 879 + static int amdgpu_current_bpc_show(struct seq_file *m, void *data) 880 880 { 881 - struct drm_connector *connector = m->private; 882 - struct drm_device *dev = connector->dev; 883 - struct drm_crtc *crtc = NULL; 881 + struct drm_crtc *crtc = m->private; 882 + struct drm_device *dev = crtc->dev; 884 883 struct dm_crtc_state *dm_crtc_state = NULL; 885 884 int res = -ENODEV; 886 885 unsigned int bpc; 887 886 888 887 mutex_lock(&dev->mode_config.mutex); 889 - drm_modeset_lock(&dev->mode_config.connection_mutex, NULL); 890 - 891 - if (connector->state == NULL) 892 - goto unlock; 893 - 894 - crtc = connector->state->crtc; 895 - if (crtc == NULL) 896 - goto unlock; 897 - 898 888 drm_modeset_lock(&crtc->mutex, NULL); 899 889 if (crtc->state == NULL) 900 890 goto unlock; ··· 914 924 } 915 925 916 926 seq_printf(m, "Current: %u\n", bpc); 917 - seq_printf(m, "Maximum: %u\n", connector->display_info.bpc); 918 927 res = 0; 919 928 920 929 unlock: 921 - if (crtc) 922 - drm_modeset_unlock(&crtc->mutex); 923 - 924 - drm_modeset_unlock(&dev->mode_config.connection_mutex); 930 + drm_modeset_unlock(&crtc->mutex); 925 931 mutex_unlock(&dev->mode_config.mutex); 926 932 927 933 return res; 928 934 } 935 + DEFINE_SHOW_ATTRIBUTE(amdgpu_current_bpc); 929 936 930 937 /* 931 938 * Example usage: ··· 2528 2541 DEFINE_SHOW_ATTRIBUTE(dp_dsc_fec_support); 2529 2542 DEFINE_SHOW_ATTRIBUTE(dmub_fw_state); 2530 2543 DEFINE_SHOW_ATTRIBUTE(dmub_tracebuffer); 2531 - DEFINE_SHOW_ATTRIBUTE(output_bpc); 2532 2544 DEFINE_SHOW_ATTRIBUTE(dp_lttpr_status); 2533 2545 #ifdef CONFIG_DRM_AMD_DC_HDCP 2534 2546 DEFINE_SHOW_ATTRIBUTE(hdcp_sink_capability); ··· 2774 2788 const struct file_operations *fops; 2775 2789 } connector_debugfs_entries[] = { 2776 2790 {"force_yuv420_output", &force_yuv420_output_fops}, 2777 - {"output_bpc", &output_bpc_fops}, 2778 2791 {"trigger_hotplug", &trigger_hotplug_debugfs_fops}, 2779 2792 {"internal_display", &internal_display_fops} 2780 2793 }; ··· 3157 3172 3158 3173 DEFINE_DEBUGFS_ATTRIBUTE(crc_win_update_fops, crc_win_update_get, 3159 3174 crc_win_update_set, "%llu\n"); 3160 - 3175 + #endif 3161 3176 void crtc_debugfs_init(struct drm_crtc *crtc) 3162 3177 { 3178 + #ifdef CONFIG_DRM_AMD_SECURE_DISPLAY 3163 3179 struct dentry *dir = debugfs_lookup("crc", crtc->debugfs_entry); 3164 3180 3165 3181 if (!dir) ··· 3176 3190 &crc_win_y_end_fops); 3177 3191 debugfs_create_file_unsafe("crc_win_update", 0644, dir, crtc, 3178 3192 &crc_win_update_fops); 3179 - 3180 - } 3181 3193 #endif 3194 + debugfs_create_file("amdgpu_current_bpc", 0644, crtc->debugfs_entry, 3195 + crtc, &amdgpu_current_bpc_fops); 3196 + } 3197 + 3182 3198 /* 3183 3199 * Writes DTN log state to the user supplied buffer. 3184 3200 * Example usage: cat /sys/kernel/debug/dri/0/amdgpu_dm_dtn_log
-2
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.h
··· 31 31 32 32 void connector_debugfs_init(struct amdgpu_dm_connector *connector); 33 33 void dtn_debugfs_init(struct amdgpu_device *adev); 34 - #if defined(CONFIG_DRM_AMD_SECURE_DISPLAY) 35 34 void crtc_debugfs_init(struct drm_crtc *crtc); 36 - #endif 37 35 38 36 #endif