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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/display: add sysfs entry to read PSR residency from firmware

[Why]
Currently there aren't any methods to determine PSR state residency.

[How]
create a sysfs entry for reading residency and internally hook it up
to existing functionality of reading PSR residency from firmware.

[Hamza: dropped the link.h include and made checkpatch happy]

Signed-off-by: Shirish S <shirish.s@amd.com>
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Shirish S and committed by
Alex Deucher
22f1482a dcaf5000

+20
+20
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
··· 2794 2794 } 2795 2795 2796 2796 /* 2797 + * Read PSR state residency 2798 + */ 2799 + static int psr_read_residency(void *data, u64 *val) 2800 + { 2801 + struct amdgpu_dm_connector *connector = data; 2802 + struct dc_link *link = connector->dc_link; 2803 + u32 residency; 2804 + 2805 + link_get_psr_residency(link, &residency); 2806 + 2807 + *val = (u64)residency; 2808 + 2809 + return 0; 2810 + } 2811 + 2812 + /* 2797 2813 * Set dmcub trace event IRQ enable or disable. 2798 2814 * Usage to enable dmcub trace event IRQ: echo 1 > /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en 2799 2815 * Usage to disable dmcub trace event IRQ: echo 0 > /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en ··· 2844 2828 dmcub_trace_event_state_set, "%llu\n"); 2845 2829 2846 2830 DEFINE_DEBUGFS_ATTRIBUTE(psr_fops, psr_get, NULL, "%llu\n"); 2831 + DEFINE_DEBUGFS_ATTRIBUTE(psr_residency_fops, psr_read_residency, NULL, 2832 + "%llu\n"); 2847 2833 2848 2834 DEFINE_SHOW_ATTRIBUTE(current_backlight); 2849 2835 DEFINE_SHOW_ATTRIBUTE(target_backlight); ··· 3009 2991 if (connector->base.connector_type == DRM_MODE_CONNECTOR_eDP) { 3010 2992 debugfs_create_file_unsafe("psr_capability", 0444, dir, connector, &psr_capability_fops); 3011 2993 debugfs_create_file_unsafe("psr_state", 0444, dir, connector, &psr_fops); 2994 + debugfs_create_file_unsafe("psr_residency", 0444, dir, 2995 + connector, &psr_residency_fops); 3012 2996 debugfs_create_file("amdgpu_current_backlight_pwm", 0444, dir, connector, 3013 2997 &current_backlight_fops); 3014 2998 debugfs_create_file("amdgpu_target_backlight_pwm", 0444, dir, connector,