drm/amd/display: do not use drm middle layer for debugfs
Use debugfs API directly instead of drm middle layer. v2: * checkpatch.pl: use '0444' instead of S_IRUGO. * remove S_IFREG from mode. * remove mode variable. Signed-off-by: Nirmoy Das <nirmoy.das@amd.com> Reviewed-by: Christian König <christian.koenig@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
0299bef975
commit
afd3a359c4
|
@ -1645,10 +1645,8 @@ int amdgpu_debugfs_init(struct amdgpu_device *adev)
|
||||||
DRM_ERROR("registering firmware debugfs failed (%d).\n", r);
|
DRM_ERROR("registering firmware debugfs failed (%d).\n", r);
|
||||||
|
|
||||||
#if defined(CONFIG_DRM_AMD_DC)
|
#if defined(CONFIG_DRM_AMD_DC)
|
||||||
if (amdgpu_device_has_dc_support(adev)) {
|
if (amdgpu_device_has_dc_support(adev))
|
||||||
if (dtn_debugfs_init(adev))
|
dtn_debugfs_init(adev);
|
||||||
DRM_ERROR("amdgpu: failed initialize dtn debugfs support.\n");
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
|
for (i = 0; i < AMDGPU_MAX_RINGS; ++i) {
|
||||||
|
|
|
@ -25,8 +25,6 @@
|
||||||
|
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
#include <drm/drm_debugfs.h>
|
|
||||||
|
|
||||||
#include "dc.h"
|
#include "dc.h"
|
||||||
#include "amdgpu.h"
|
#include "amdgpu.h"
|
||||||
#include "amdgpu_dm.h"
|
#include "amdgpu_dm.h"
|
||||||
|
@ -2450,11 +2448,9 @@ static ssize_t dtn_log_write(
|
||||||
* As written to display, taking ABM and backlight lut into account.
|
* As written to display, taking ABM and backlight lut into account.
|
||||||
* Ranges from 0x0 to 0x10000 (= 100% PWM)
|
* Ranges from 0x0 to 0x10000 (= 100% PWM)
|
||||||
*/
|
*/
|
||||||
static int current_backlight_read(struct seq_file *m, void *data)
|
static int current_backlight_show(struct seq_file *m, void *unused)
|
||||||
{
|
{
|
||||||
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
|
||||||
struct drm_device *dev = node->minor->dev;
|
|
||||||
struct amdgpu_device *adev = drm_to_adev(dev);
|
|
||||||
struct amdgpu_display_manager *dm = &adev->dm;
|
struct amdgpu_display_manager *dm = &adev->dm;
|
||||||
|
|
||||||
unsigned int backlight = dc_link_get_backlight_level(dm->backlight_link);
|
unsigned int backlight = dc_link_get_backlight_level(dm->backlight_link);
|
||||||
|
@ -2468,11 +2464,9 @@ static int current_backlight_read(struct seq_file *m, void *data)
|
||||||
* As written to display, taking ABM and backlight lut into account.
|
* As written to display, taking ABM and backlight lut into account.
|
||||||
* Ranges from 0x0 to 0x10000 (= 100% PWM)
|
* Ranges from 0x0 to 0x10000 (= 100% PWM)
|
||||||
*/
|
*/
|
||||||
static int target_backlight_read(struct seq_file *m, void *data)
|
static int target_backlight_show(struct seq_file *m, void *unused)
|
||||||
{
|
{
|
||||||
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
|
||||||
struct drm_device *dev = node->minor->dev;
|
|
||||||
struct amdgpu_device *adev = drm_to_adev(dev);
|
|
||||||
struct amdgpu_display_manager *dm = &adev->dm;
|
struct amdgpu_display_manager *dm = &adev->dm;
|
||||||
|
|
||||||
unsigned int backlight = dc_link_get_target_backlight_pwm(dm->backlight_link);
|
unsigned int backlight = dc_link_get_target_backlight_pwm(dm->backlight_link);
|
||||||
|
@ -2481,10 +2475,10 @@ static int target_backlight_read(struct seq_file *m, void *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int mst_topo(struct seq_file *m, void *unused)
|
static int mst_topo_show(struct seq_file *m, void *unused)
|
||||||
{
|
{
|
||||||
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
struct amdgpu_device *adev = (struct amdgpu_device *)m->private;
|
||||||
struct drm_device *dev = node->minor->dev;
|
struct drm_device *dev = adev_to_drm(adev);
|
||||||
struct drm_connector *connector;
|
struct drm_connector *connector;
|
||||||
struct drm_connector_list_iter conn_iter;
|
struct drm_connector_list_iter conn_iter;
|
||||||
struct amdgpu_dm_connector *aconnector;
|
struct amdgpu_dm_connector *aconnector;
|
||||||
|
@ -2504,12 +2498,6 @@ static int mst_topo(struct seq_file *m, void *unused)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct drm_info_list amdgpu_dm_debugfs_list[] = {
|
|
||||||
{"amdgpu_current_backlight_pwm", ¤t_backlight_read},
|
|
||||||
{"amdgpu_target_backlight_pwm", &target_backlight_read},
|
|
||||||
{"amdgpu_mst_topology", &mst_topo},
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sets the force_timing_sync debug optino from the given string.
|
* Sets the force_timing_sync debug optino from the given string.
|
||||||
* All connected displays will be force synchronized immediately.
|
* All connected displays will be force synchronized immediately.
|
||||||
|
@ -2568,10 +2556,13 @@ static int visual_confirm_get(void *data, u64 *val)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DEFINE_SHOW_ATTRIBUTE(current_backlight);
|
||||||
|
DEFINE_SHOW_ATTRIBUTE(target_backlight);
|
||||||
|
DEFINE_SHOW_ATTRIBUTE(mst_topo);
|
||||||
DEFINE_DEBUGFS_ATTRIBUTE(visual_confirm_fops, visual_confirm_get,
|
DEFINE_DEBUGFS_ATTRIBUTE(visual_confirm_fops, visual_confirm_get,
|
||||||
visual_confirm_set, "%llu\n");
|
visual_confirm_set, "%llu\n");
|
||||||
|
|
||||||
int dtn_debugfs_init(struct amdgpu_device *adev)
|
void dtn_debugfs_init(struct amdgpu_device *adev)
|
||||||
{
|
{
|
||||||
static const struct file_operations dtn_log_fops = {
|
static const struct file_operations dtn_log_fops = {
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
@ -2582,13 +2573,13 @@ int dtn_debugfs_init(struct amdgpu_device *adev)
|
||||||
|
|
||||||
struct drm_minor *minor = adev_to_drm(adev)->primary;
|
struct drm_minor *minor = adev_to_drm(adev)->primary;
|
||||||
struct dentry *root = minor->debugfs_root;
|
struct dentry *root = minor->debugfs_root;
|
||||||
int ret;
|
|
||||||
|
|
||||||
ret = amdgpu_debugfs_add_files(adev, amdgpu_dm_debugfs_list,
|
|
||||||
ARRAY_SIZE(amdgpu_dm_debugfs_list));
|
|
||||||
if (ret)
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
|
debugfs_create_file("amdgpu_current_backlight_pwm", 0444,
|
||||||
|
root, adev, ¤t_backlight_fops);
|
||||||
|
debugfs_create_file("amdgpu_target_backlight_pwm", 0444,
|
||||||
|
root, adev, &target_backlight_fops);
|
||||||
|
debugfs_create_file("amdgpu_mst_topology", 0444, root,
|
||||||
|
adev, &mst_topo_fops);
|
||||||
debugfs_create_file("amdgpu_dm_dtn_log", 0644, root, adev,
|
debugfs_create_file("amdgpu_dm_dtn_log", 0644, root, adev,
|
||||||
&dtn_log_fops);
|
&dtn_log_fops);
|
||||||
|
|
||||||
|
@ -2603,6 +2594,4 @@ int 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);
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,6 @@
|
||||||
#include "amdgpu_dm.h"
|
#include "amdgpu_dm.h"
|
||||||
|
|
||||||
void connector_debugfs_init(struct amdgpu_dm_connector *connector);
|
void connector_debugfs_init(struct amdgpu_dm_connector *connector);
|
||||||
int dtn_debugfs_init(struct amdgpu_device *adev);
|
void dtn_debugfs_init(struct amdgpu_device *adev);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in New Issue