Commit 46a83eba authored by Leo (Hanghong) Ma's avatar Leo (Hanghong) Ma Committed by Alex Deucher

drm/amd/display: Add debugfs to control DMUB trace buffer events

[Why]
We want to have a debugfs interface to enable or disable DMCUB
trace buffer events.

[How]
Add debugfs interface to enable or disable trace buffer events.
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarLeo (Hanghong) Ma <hanghong.ma@amd.com>
Reviewed-by: default avatarHarry Wentland <Harry.Wentland@amd.com>
Acked-by: default avatarSolomon Chiu <solomon.chiu@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent ae030570
...@@ -395,6 +395,7 @@ struct amdgpu_display_manager { ...@@ -395,6 +395,7 @@ struct amdgpu_display_manager {
*/ */
struct amdgpu_encoder mst_encoders[AMDGPU_DM_MAX_CRTC]; struct amdgpu_encoder mst_encoders[AMDGPU_DM_MAX_CRTC];
bool force_timing_sync; bool force_timing_sync;
bool dmcub_trace_event_en;
/** /**
* @da_list: * @da_list:
* *
......
...@@ -34,6 +34,7 @@ ...@@ -34,6 +34,7 @@
#include "resource.h" #include "resource.h"
#include "dsc.h" #include "dsc.h"
#include "dc_link_dp.h" #include "dc_link_dp.h"
#include "dc/dc_dmub_srv.h"
struct dmub_debugfs_trace_header { struct dmub_debugfs_trace_header {
uint32_t entry_count; uint32_t entry_count;
...@@ -2490,6 +2491,39 @@ static int psr_get(void *data, u64 *val) ...@@ -2490,6 +2491,39 @@ static int psr_get(void *data, u64 *val)
return 0; return 0;
} }
/*
* Set dmcub trace event IRQ enable or disable.
* Usage to enable dmcub trace event IRQ: echo 1 > /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en
* Usage to disable dmcub trace event IRQ: echo 0 > /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en
*/
static int dmcub_trace_event_state_set(void *data, u64 val)
{
struct amdgpu_device *adev = data;
if (val == 1 || val == 0) {
dc_dmub_trace_event_control(adev->dm.dc, val);
adev->dm.dmcub_trace_event_en = (bool)val;
} else
return 0;
return 0;
}
/*
* The interface doesn't need get function, so it will return the
* value of zero
* Usage: cat /sys/kernel/debug/dri/0/amdgpu_dm_dmcub_trace_event_en
*/
static int dmcub_trace_event_state_get(void *data, u64 *val)
{
struct amdgpu_device *adev = data;
*val = adev->dm.dmcub_trace_event_en;
return 0;
}
DEFINE_DEBUGFS_ATTRIBUTE(dmcub_trace_event_state_fops, dmcub_trace_event_state_get,
dmcub_trace_event_state_set, "%llu\n");
DEFINE_DEBUGFS_ATTRIBUTE(psr_fops, psr_get, NULL, "%llu\n"); DEFINE_DEBUGFS_ATTRIBUTE(psr_fops, psr_get, NULL, "%llu\n");
...@@ -2970,4 +3004,7 @@ void dtn_debugfs_init(struct amdgpu_device *adev) ...@@ -2970,4 +3004,7 @@ void dtn_debugfs_init(struct amdgpu_device *adev)
debugfs_create_file_unsafe("amdgpu_dm_force_timing_sync", 0644, root, debugfs_create_file_unsafe("amdgpu_dm_force_timing_sync", 0644, root,
adev, &force_timing_sync_ops); adev, &force_timing_sync_ops);
debugfs_create_file_unsafe("amdgpu_dm_dmcub_trace_event_en", 0644, root,
adev, &dmcub_trace_event_state_fops);
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment