lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871pzvjk2t.fsf@intel.com>
Date: Fri, 01 Nov 2024 12:59:38 +0200
From: Jani Nikula <jani.nikula@...ux.intel.com>
To: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>, Andrzej Hajda
 <andrzej.hajda@...el.com>, Neil Armstrong <neil.armstrong@...aro.org>,
 Robert Foss <rfoss@...nel.org>, Laurent Pinchart
 <Laurent.pinchart@...asonboard.com>, Jonas Karlman <jonas@...boo.se>,
 Jernej Skrabec <jernej.skrabec@...il.com>, Maarten Lankhorst
 <maarten.lankhorst@...ux.intel.com>, Maxime Ripard <mripard@...nel.org>,
 Thomas Zimmermann <tzimmermann@...e.de>, David Airlie <airlied@...il.com>,
 Simona Vetter <simona@...ll.ch>, Jaroslav Kysela <perex@...ex.cz>, Takashi
 Iwai <tiwai@...e.com>, Liam Girdwood <lgirdwood@...il.com>, Mark Brown
 <broonie@...nel.org>, Phong LE <ple@...libre.com>, Inki Dae
 <inki.dae@...sung.com>, Seung-Woo Kim <sw0312.kim@...sung.com>, Kyungmin
 Park <kyungmin.park@...sung.com>, Krzysztof Kozlowski <krzk@...nel.org>,
 Alim Akhtar <alim.akhtar@...sung.com>, Russell King
 <linux@...linux.org.uk>, Chun-Kuang Hu <chunkuang.hu@...nel.org>, Philipp
 Zabel <p.zabel@...gutronix.de>, Matthias Brugger <matthias.bgg@...il.com>,
 AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>,
 Sandy Huang <hjc@...k-chips.com>, Heiko Stübner
 <heiko@...ech.de>, Andy
 Yan <andy.yan@...k-chips.com>, Alain Volmat <alain.volmat@...s.st.com>
Cc: dri-devel@...ts.freedesktop.org, linux-kernel@...r.kernel.org,
 linux-sound@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
 linux-samsung-soc@...r.kernel.org, linux-mediatek@...ts.infradead.org,
 linux-rockchip@...ts.infradead.org
Subject: Re: [PATCH RFC v2 6/7] drm/display/hdmi: implement connector update
 functions

On Fri, 01 Nov 2024, Dmitry Baryshkov <dmitry.baryshkov@...aro.org> wrote:
> The HDMI Connectors need to perform a variety of tasks when the HDMI
> connector state changes. Such tasks include setting or invalidating CEC
> address, notifying HDMI codec driver, updating scrambler data, etc.
>
> Implementing such tasks in a driver-specific callbacks is error prone.
> Start implementing the generic helper function (currently handling only
> the HDMI Codec framework) to be used by driver utilizing HDMI Connector
> framework.
>
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@...aro.org>
> ---
>  drivers/gpu/drm/display/drm_hdmi_state_helper.c | 56 +++++++++++++++++++++++++
>  include/drm/display/drm_hdmi_state_helper.h     |  4 ++
>  2 files changed, 60 insertions(+)
>
> diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> index feb7a3a759811aed70c679be8704072093e2a79b..dc9d0cc162b2197dcbadda26686a9c5652e74107 100644
> --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c
> @@ -748,3 +748,59 @@ drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector *con
>  	return ret;
>  }
>  EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_clear_audio_infoframe);
> +
> +/**
> + * __drm_atomic_helper_connector_hdmi_update_edid - Update the HDMI Connector basing on passed EDID
> + * @connector: A pointer to the HDMI connector
> + * @drm_edid: EDID to process
> + *
> + * This function should be called as a part of the .detect() / .detect_ctx()
> + * and .force() callbacks, updating the HDMI-specific connector's data. The
> + * function consumes passed EDID, there is no need to free it afterwards. Most
> + * of the drivers should be able to use
> + * @drm_atomic_helper_connector_hdmi_update() instead.
> + *
> + * Returns:
> + * Zero on success, error code on failure.
> + */
> +int
> +__drm_atomic_helper_connector_hdmi_update_edid(struct drm_connector *connector,
> +					       const struct drm_edid *drm_edid)
> +{
> +	drm_edid_connector_update(connector, drm_edid);
> +	drm_edid_free(drm_edid);

Not fond of splitting resource management responsibilities
asymmetrically like this.

> +
> +	if (!drm_edid) {
> +		drm_connector_hdmi_codec_plugged_notify(connector, false);

Is it a good idea to tie connection status to EDID presence at the
helper level? Nearly the same, but still orthogonal.

> +
> +		// TODO: also handle CEC and scramber, HDMI sink disconnected.
> +
> +		return 0;
> +	}
> +
> +	drm_connector_hdmi_codec_plugged_notify(connector, true);
> +
> +	// TODO: also handle CEC and scramber, HDMI sink is now connected.
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(__drm_atomic_helper_connector_hdmi_update_edid);

Feels wrong to export and document double underscored functions to
actually be used.

> +
> +/**
> + * drm_atomic_helper_connector_hdmi_update - Update the HDMI Connector after reading the EDID
> + * @connector: A pointer to the HDMI connector
> + *
> + * This function should be called as a part of the .detect() / .detect_ctx()
> + * and .force() callbacks, updating the HDMI-specific connector's data.
> + *
> + * Returns:
> + * Zero on success, error code on failure.
> + */
> +int
> +drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector)
> +{
> +	const struct drm_edid *drm_edid = drm_edid_read(connector);
> +
> +	return __drm_atomic_helper_connector_hdmi_update_edid(connector, drm_edid);
> +}
> +EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_update);
> diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/display/drm_hdmi_state_helper.h
> index 2d45fcfa461985065a5e5ad67eddc0b1c556d526..ea0980aa25cbbfdd36f44201888c139b0ee943da 100644
> --- a/include/drm/display/drm_hdmi_state_helper.h
> +++ b/include/drm/display/drm_hdmi_state_helper.h
> @@ -20,4 +20,8 @@ int drm_atomic_helper_connector_hdmi_clear_audio_infoframe(struct drm_connector
>  int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *connector,
>  						       struct drm_atomic_state *state);
>  
> +int __drm_atomic_helper_connector_hdmi_update_edid(struct drm_connector *connector,
> +						   const struct drm_edid *drm_edid);
> +int drm_atomic_helper_connector_hdmi_update(struct drm_connector *connector);
> +
>  #endif // DRM_HDMI_STATE_HELPER_H_

-- 
Jani Nikula, Intel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ