From: Harry Wentland <harry.wentland@amd.com>
To: Fangzhi Zuo <jerry.zuo@amd.com>,
amd-gfx@lists.freedesktop.org, nicolas.frattaroli@collabora.com,
krzk@kernel.org
Subject: Re: [PATCH] drm/amd/display: Simplify hdmi_automation debugfs with debugfs_create_bool
Date: Fri, 31 Jul 2026 16:14:47 -0400 [thread overview]
Message-ID: <fe4e0dba-e1c4-4e9e-bf56-3a2f83129659@amd.com> (raw)
In-Reply-To: <20260730184103.916125-1-jerry.zuo@amd.com>
On 2026-07-30 14:41, Fangzhi Zuo wrote:
> Follow-up fix for commit 442b2e9dc9e9 ("drm/amd/display: Add Support for
> HDMI Compliance Automation"), whose hdmi_automation debugfs entry
> hand-rolled the boolean parsing (scratch buffer,
> parse_write_buffer_into_params(), a switch and kfree) that the debugfs
> core already provides.
>
> hdmi_comp_auto is a plain bool, so bind it directly with
> debugfs_create_bool() and drop the custom write handler, its
> file_operations and the hdmi_debugfs_entries[] row.
>
> Fixes: 442b2e9dc9e9 ("drm/amd/display: Add Support for HDMI Compliance Automation")
> Signed-off-by: Fangzhi Zuo <jerry.zuo@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Harry
> ---
> .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 69 +------------------
> 1 file changed, 3 insertions(+), 66 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> index 830cf8da06b4..45249bebe9fb 100644
> --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
> @@ -2981,64 +2981,6 @@ static ssize_t hdmi_cec_state_write(struct file *f, const char __user *buf,
> return size;
> }
>
> -/**
> - * hdmi_automation_enable - Enable/Disable HDMI automation feature
> - * @f: file structure.
> - * @buf: userspace buffer. set to '1' to enable; '0' to disable automation feature.
> - * @size: size of buffer from userpsace.
> - * @pos: unused.
> - *
> - * Return size on success, error code on failure
> - */
> -static ssize_t hdmi_automation_enable(struct file *f, const char __user *buf,
> - size_t size, loff_t *pos)
> -{
> - struct amdgpu_dm_connector *aconnector = file_inode(f)->i_private;
> - char *wr_buf = NULL;
> - const uint32_t wr_buf_size = 40;
> - int max_param_num = 1;
> - uint8_t param_nums = 0;
> - long param[2];
> - bool hdmi_comp_auto;
> -
> - if (size == 0)
> - return -EINVAL;
> -
> - wr_buf = kcalloc(wr_buf_size, sizeof(char), GFP_KERNEL);
> - if (!wr_buf)
> - return -ENOSPC;
> -
> - if (parse_write_buffer_into_params(wr_buf, wr_buf_size,
> - (long *)param, buf,
> - max_param_num,
> - ¶m_nums)) {
> - kfree(wr_buf);
> - return -EINVAL;
> - }
> -
> - if (param_nums <= 0) {
> - kfree(wr_buf);
> - DRM_DEBUG_DRIVER("user data not be read\n");
> - return -EINVAL;
> - }
> -
> - switch (param[0]) {
> - case 0:
> - hdmi_comp_auto = false;
> - break;
> - case 1:
> - default:
> - hdmi_comp_auto = true;
> - break;
> - }
> -
> - /* Persist setting across sink re-detection/hotplug. */
> - aconnector->hdmi_comp_auto = hdmi_comp_auto;
> -
> - kfree(wr_buf);
> - return size;
> -}
> -
> DEFINE_SHOW_ATTRIBUTE(dp_dsc_fec_support);
> DEFINE_SHOW_ATTRIBUTE(dmub_fw_state);
> DEFINE_SHOW_ATTRIBUTE(dmub_tracebuffer);
> @@ -3156,12 +3098,6 @@ static const struct file_operations dp_mst_link_settings_debugfs_fops = {
> .llseek = default_llseek
> };
>
> -static const struct file_operations hdmi_automation_debugfs_fops = {
> - .owner = THIS_MODULE,
> - .write = hdmi_automation_enable,
> - .llseek = default_llseek
> -};
> -
> static const struct {
> char *name;
> const struct file_operations *fops;
> @@ -3194,8 +3130,7 @@ static const struct {
> const struct file_operations *fops;
> } hdmi_debugfs_entries[] = {
> {"hdcp_sink_capability", &hdcp_sink_capability_fops},
> - {"hdmi_cec_state", &hdmi_cec_state_fops},
> - {"hdmi_automation", &hdmi_automation_debugfs_fops}
> + {"hdmi_cec_state", &hdmi_cec_state_fops}
> };
>
> /*
> @@ -3908,6 +3843,8 @@ void connector_debugfs_init(struct amdgpu_dm_connector *connector)
> 0644, dir, connector,
> hdmi_debugfs_entries[i].fops);
> }
> +
> + debugfs_create_bool("hdmi_automation", 0644, dir, &connector->hdmi_comp_auto);
> }
> }
>
prev parent reply other threads:[~2026-07-31 20:14 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-30 18:41 [PATCH] drm/amd/display: Simplify hdmi_automation debugfs with debugfs_create_bool Fangzhi Zuo
2026-07-31 20:14 ` Harry Wentland [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fe4e0dba-e1c4-4e9e-bf56-3a2f83129659@amd.com \
--to=harry.wentland@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=jerry.zuo@amd.com \
--cc=krzk@kernel.org \
--cc=nicolas.frattaroli@collabora.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox