From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 0DE46CD98D2 for ; Thu, 11 Jun 2026 10:49:24 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8773C10EE57; Thu, 11 Jun 2026 10:49:23 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (1024-bit key; unprotected) header.d=collabora.com header.i=nicolas.frattaroli@collabora.com header.b="FdH1ez+B"; dkim-atps=neutral Received: from sender4-op-o12.zoho.com (sender4-op-o12.zoho.com [136.143.188.12]) by gabe.freedesktop.org (Postfix) with ESMTPS id 99E8510E9FF for ; Wed, 10 Jun 2026 14:43:48 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; t=1781102625; cv=none; d=zohomail.com; s=zohoarc; b=bsanrk9NKy5TxvcGlw6HrsyZhLC4851SlJJcFOpvmv/YIyB0p/Pr1HQOazBGZuJR8HeubVtQ73NV/i6Q6tLHwmB7JG0Yu5LMTP3bistR9PbgQpEUkv/N9TD4W2JbU7IBGUKq+AkF3CIOun9ivkVkPyDDUwULUpw7l+SS7/eakEs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1781102625; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:Subject:To:To:Message-Id:Reply-To; bh=WFetzH6Pm3eLufX//G5V6M8Oo0C4OPBORVC7blwGZ8E=; b=V13WZWyNROa5V3H3caE/oDngR4oIVrfIwRtM6u+37TlJO8rNc6MRZlwoW5S9EBnZRrIa6nUu3MGqML+Cz8+gbURj3m6cPeS57XIxMrdxvMGGnUUmR9kYSR3xPY8amGW3Gs9MMsupHYEdgTx1lpvZ5fLE703J7mP9HFgoVoaDNRE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=nicolas.frattaroli@collabora.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1781102625; s=zohomail; d=collabora.com; i=nicolas.frattaroli@collabora.com; h=From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:Message-ID:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Content-Type:Message-Id:Reply-To; bh=WFetzH6Pm3eLufX//G5V6M8Oo0C4OPBORVC7blwGZ8E=; b=FdH1ez+BIFahB6+J3YHy+MB/XQun4Hv+Pw60zrWIEDH97uHyMvZtCojEzsJfo5Lf WSoDHaWr/mNioXDGg5FonlbSm3bnFVsQvz3YS7Hpqg3tmwgEAfZGKyFSXqwCWu0JAoS YEFZidbgRWn0NV63B7/OeLSKweTLvK4GYDLFogI4= Received: by mx.zohomail.com with SMTPS id 1781102623251367.4871643782956; Wed, 10 Jun 2026 07:43:43 -0700 (PDT) From: Nicolas Frattaroli To: amd-gfx@lists.freedesktop.org, Chenyu Chen Cc: Harry Wentland , Leo Li , Aurabindo Pillai , Roman Li , Wayne Lin , Tom Chung , Fangzhi Zuo , Dan Wheeler , Ray Wu , Ivan Lipski , Alex Hung , James Lin , Chenyu Chen , Fangzhi Zuo , Chenyu Chen Subject: Re: [PATCH 16/32] drm/amd/display: Add Support for HDMI Compliance Automation Date: Wed, 10 Jun 2026 16:43:37 +0200 Message-ID: In-Reply-To: <20260610094639.1965367-17-chen-yu.chen@amd.com> References: <20260610094639.1965367-1-chen-yu.chen@amd.com> <20260610094639.1965367-17-chen-yu.chen@amd.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="utf-8" X-Mailman-Approved-At: Thu, 11 Jun 2026 10:49:23 +0000 X-BeenThere: amd-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion list for AMD gfx List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: amd-gfx-bounces@lists.freedesktop.org Sender: "amd-gfx" On Wednesday, 10 June 2026 11:45:00 Central European Summer Time Chenyu Chen wrote: > From: Fangzhi Zuo > > Add support to get DUT trained at FRL link rate when working with > Teledyne M41h compliance automation. > > Reviewed-by: Alex Hung > Signed-off-by: Fangzhi Zuo > Signed-off-by: Chenyu Chen > --- > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 3 + > .../display/amdgpu_dm/amdgpu_dm_connector.c | 5 ++ > .../amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 67 ++++++++++++++++++- > .../amd/display/amdgpu_dm/amdgpu_dm_helpers.c | 6 ++ > 4 files changed, 80 insertions(+), 1 deletion(-) > > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h > index 2940dd5b7348..ba1e11e144f2 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h > @@ -877,6 +877,9 @@ struct amdgpu_dm_connector { > unsigned int hdmi_hpd_debounce_delay_ms; > struct delayed_work hdmi_hpd_debounce_work; > struct dc_sink *hdmi_prev_sink; > + > + /* HDMI compliance automation */ > + bool hdmi_comp_auto; > }; > > static inline void amdgpu_dm_set_mst_status(uint8_t *status, > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c > index 6ef257622f1a..59091ee32099 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_connector.c > @@ -573,6 +573,11 @@ void amdgpu_dm_update_connector_after_detect( > amdgpu_dm_update_freesync_caps(connector, aconnector->drm_edid, true); > amdgpu_dm_update_connector_ext_caps(aconnector); > dm_set_panel_type(aconnector); > + > + if (aconnector->hdmi_comp_auto) { > + if (sink->sink_signal != SIGNAL_TYPE_HDMI_FRL) > + sink->sink_signal = SIGNAL_TYPE_HDMI_FRL; > + } > } else { > hdmi_cec_unset_edid(aconnector); > drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux); > 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 096a855a7304..95a56e39f452 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 > @@ -2982,6 +2982,64 @@ 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); > @@ -3099,6 +3157,12 @@ 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 > +}; > + I really don't understand why this can't just be a DEFINE_DEBUGFS_ATTRIBUTE, and then you can replace the overcomplicated hdmi_automation_enable() with just simple setter and getter functions that already receive the parameter of the right type. > static const struct { > char *name; > const struct file_operations *fops; > @@ -3131,7 +3195,8 @@ 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_cec_state", &hdmi_cec_state_fops}, > + {"hdmi_automation", &hdmi_automation_debugfs_fops} > }; > > /* > diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > index a2d0bb34e639..6350212b9a66 100644 > --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c > @@ -193,6 +193,12 @@ enum dc_edid_status dm_helpers_parse_edid_caps( > __func__, connector->name, edid_caps->frl_dsc_10bpc, edid_caps->frl_dsc_12bpc, \ > edid_caps->frl_dsc_all_bpp, edid_caps->frl_dsc_native_420, edid_caps->frl_dsc_max_slices, \ > edid_caps->frl_dsc_max_frl_rate, edid_caps->frl_dsc_total_chunk_kbytes); > + if (aconnector->hdmi_comp_auto) { > + edid_caps->panel_patch.hdmi_comp_auto = true; > + link->ctx->dc->debug.force_frl_max = true; > + link->ctx->dc->debug.force_frl_dsc = true; > + drm_dbg_driver(connector->dev, "%s: HDMI_FRL [%s] hdmi_comp_auto --> enabled\n", __func__, connector->name); > + } > } > > apply_edid_quirks(link, edid_buf, edid_caps); >