Re: [Intel-gfx] [PATCH v2 20/25] drm/edid: add drm_edid helper for drm_detect_monitor_audio()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



LGTM.

Reviewed-by: Ankit Nautiyal <ankit.k.nautiyal@xxxxxxxxx>

Regards,

Ankit

On 5/9/2022 5:33 PM, Jani Nikula wrote:
We'll need to propagate drm_edid everywhere.

v2: Handle NULL EDID pointer (Ville, CI)

Signed-off-by: Jani Nikula <jani.nikula@xxxxxxxxx>
---
  drivers/gpu/drm/drm_edid.c | 37 ++++++++++++++++++++++---------------
  1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index fc74159cd426..f072cfba9dd9 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -5154,19 +5154,7 @@ bool drm_detect_hdmi_monitor(const struct edid *edid)
  }
  EXPORT_SYMBOL(drm_detect_hdmi_monitor);
-/**
- * drm_detect_monitor_audio - check monitor audio capability
- * @edid: EDID block to scan
- *
- * Monitor should have CEA extension block.
- * If monitor has 'basic audio', but no CEA audio blocks, it's 'basic
- * audio' only. If there is any audio extension block and supported
- * audio format, assume at least 'basic audio' support, even if 'basic
- * audio' is not defined in EDID.
- *
- * Return: True if the monitor supports audio, false otherwise.
- */
-bool drm_detect_monitor_audio(const struct edid *edid)
+static bool _drm_detect_monitor_audio(const struct drm_edid *drm_edid)
  {
  	struct drm_edid_iter edid_iter;
  	const struct cea_db *db;
@@ -5174,7 +5162,7 @@ bool drm_detect_monitor_audio(const struct edid *edid)
  	const u8 *edid_ext;
  	bool has_audio = false;
- drm_edid_iter_begin(edid, &edid_iter);
+	drm_edid_iter_begin(drm_edid ? drm_edid->edid : NULL, &edid_iter);
  	drm_edid_iter_for_each(edid_ext, &edid_iter) {
  		if (edid_ext[0] == CEA_EXT) {
  			has_audio = edid_ext[3] & EDID_BASIC_AUDIO;
@@ -5189,7 +5177,7 @@ bool drm_detect_monitor_audio(const struct edid *edid)
  		goto end;
  	}
- cea_db_iter_edid_begin(edid, &iter);
+	cea_db_iter_edid_begin(drm_edid ? drm_edid->edid : NULL, &iter);
  	cea_db_iter_for_each(db, &iter) {
  		if (cea_db_tag(db) == CTA_DB_AUDIO) {
  			const u8 *data = cea_db_data(db);
@@ -5207,6 +5195,25 @@ bool drm_detect_monitor_audio(const struct edid *edid)
  end:
  	return has_audio;
  }
+
+/**
+ * drm_detect_monitor_audio - check monitor audio capability
+ * @edid: EDID block to scan
+ *
+ * Monitor should have CEA extension block.
+ * If monitor has 'basic audio', but no CEA audio blocks, it's 'basic
+ * audio' only. If there is any audio extension block and supported
+ * audio format, assume at least 'basic audio' support, even if 'basic
+ * audio' is not defined in EDID.
+ *
+ * Return: True if the monitor supports audio, false otherwise.
+ */
+bool drm_detect_monitor_audio(const struct edid *edid)
+{
+	struct drm_edid drm_edid;
+
+	return _drm_detect_monitor_audio(drm_edid_legacy_init(&drm_edid, edid));
+}
  EXPORT_SYMBOL(drm_detect_monitor_audio);



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux