drm/amd/display: Add backlight pwm debugfs
[Why] ABM enablement testing can be automated if a way of reading target and current hardware backlight is available [How] Expand debugfs interface with two new entries. Hook directly into dc interface. Units are as a fraction of 0x1000 = 100% Use the built-in amdgpu function for creating read-only debugfs files Signed-off-by: David Francis <David.Francis@amd.com> Reviewed-by: Harry Wentland <Harry.Wentland@amd.com> Acked-by: Leo Li <sunpeng.li@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
This commit is contained in:
parent
04a789bef3
commit
f284975ef2
@ -783,6 +783,45 @@ static ssize_t dtn_log_write(
|
||||
return size;
|
||||
}
|
||||
|
||||
/*
|
||||
* Backlight at this moment. Read only.
|
||||
* As written to display, taking ABM and backlight lut into account.
|
||||
* Ranges from 0x0 to 0x10000 (= 100% PWM)
|
||||
*/
|
||||
static int current_backlight_read(struct seq_file *m, void *data)
|
||||
{
|
||||
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
||||
struct drm_device *dev = node->minor->dev;
|
||||
struct amdgpu_device *adev = dev->dev_private;
|
||||
struct dc *dc = adev->dm.dc;
|
||||
unsigned int backlight = dc_get_current_backlight_pwm(dc);
|
||||
|
||||
seq_printf(m, "0x%x\n", backlight);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Backlight value that is being approached. Read only.
|
||||
* As written to display, taking ABM and backlight lut into account.
|
||||
* Ranges from 0x0 to 0x10000 (= 100% PWM)
|
||||
*/
|
||||
static int target_backlight_read(struct seq_file *m, void *data)
|
||||
{
|
||||
struct drm_info_node *node = (struct drm_info_node *)m->private;
|
||||
struct drm_device *dev = node->minor->dev;
|
||||
struct amdgpu_device *adev = dev->dev_private;
|
||||
struct dc *dc = adev->dm.dc;
|
||||
unsigned int backlight = dc_get_target_backlight_pwm(dc);
|
||||
|
||||
seq_printf(m, "0x%x\n", backlight);
|
||||
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},
|
||||
};
|
||||
|
||||
int dtn_debugfs_init(struct amdgpu_device *adev)
|
||||
{
|
||||
static const struct file_operations dtn_log_fops = {
|
||||
@ -793,9 +832,15 @@ int dtn_debugfs_init(struct amdgpu_device *adev)
|
||||
};
|
||||
|
||||
struct drm_minor *minor = adev->ddev->primary;
|
||||
struct dentry *root = minor->debugfs_root;
|
||||
struct dentry *ent, *root = minor->debugfs_root;
|
||||
int ret;
|
||||
|
||||
struct dentry *ent = debugfs_create_file(
|
||||
ret = amdgpu_debugfs_add_files(adev, amdgpu_dm_debugfs_list,
|
||||
ARRAY_SIZE(amdgpu_dm_debugfs_list));
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ent = debugfs_create_file(
|
||||
"amdgpu_dm_dtn_log",
|
||||
0644,
|
||||
root,
|
||||
|
@ -1779,6 +1779,26 @@ void dc_resume(struct dc *dc)
|
||||
core_link_resume(dc->links[i]);
|
||||
}
|
||||
|
||||
unsigned int dc_get_current_backlight_pwm(struct dc *dc)
|
||||
{
|
||||
struct abm *abm = dc->res_pool->abm;
|
||||
|
||||
if (abm)
|
||||
return abm->funcs->get_current_backlight(abm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned int dc_get_target_backlight_pwm(struct dc *dc)
|
||||
{
|
||||
struct abm *abm = dc->res_pool->abm;
|
||||
|
||||
if (abm)
|
||||
return abm->funcs->get_target_backlight(abm);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool dc_is_dmcu_initialized(struct dc *dc)
|
||||
{
|
||||
struct dmcu *dmcu = dc->res_pool->dmcu;
|
||||
|
@ -749,6 +749,9 @@ void dc_set_power_state(
|
||||
struct dc *dc,
|
||||
enum dc_acpi_cm_power_state power_state);
|
||||
void dc_resume(struct dc *dc);
|
||||
unsigned int dc_get_current_backlight_pwm(struct dc *dc);
|
||||
unsigned int dc_get_target_backlight_pwm(struct dc *dc);
|
||||
|
||||
bool dc_is_dmcu_initialized(struct dc *dc);
|
||||
|
||||
#endif /* DC_INTERFACE_H_ */
|
||||
|
Loading…
x
Reference in New Issue
Block a user