[PATCH 1/5] drm: Get supported channel from SAD
Mitul Golani
mitulkumar.ajitkumar.golani at intel.com
Wed May 31 07:01:56 UTC 2023
Add DRM helper to get supported channel values from SAD.
Supported channel value can be obtained by extracting
the first byte of SAD.
Signed-off-by: Mitul Golani <mitulkumar.ajitkumar.golani at intel.com>
---
drivers/gpu/drm/drm_edid.c | 12 ++++++++++++
include/drm/drm_edid.h | 4 ++++
2 files changed, 16 insertions(+)
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c
index 0454da505687..e99ed37fafc3 100644
--- a/drivers/gpu/drm/drm_edid.c
+++ b/drivers/gpu/drm/drm_edid.c
@@ -7309,3 +7309,15 @@ static void _drm_update_tile_info(struct drm_connector *connector,
connector->tile_group = NULL;
}
}
+
+/*
+ * drm_sad_to_channels - extract channels of an SAD
+ * @sad: pointer to an sad
+ *
+ * extract number of supported channels from byte 0 of SAD
+ */
+unsigned int drm_sad_to_channels(const u8 *sad)
+{
+ return 1 + (sad[0] & DRM_ELD_SAD_CHANNELS_MASK);
+}
+EXPORT_SYMBOL(drm_sad_to_channels);
diff --git a/include/drm/drm_edid.h b/include/drm/drm_edid.h
index 571885d32907..35f22da35fcc 100644
--- a/include/drm/drm_edid.h
+++ b/include/drm/drm_edid.h
@@ -307,6 +307,8 @@ struct detailed_timing {
# define DRM_ELD_SUPPORTS_AI (1 << 1)
# define DRM_ELD_SUPPORTS_HDCP (1 << 0)
+#define DRM_ELD_SAD_CHANNELS_MASK 0x7
+
#define DRM_ELD_AUD_SYNCH_DELAY 6 /* in units of 2 ms */
# define DRM_ELD_AUD_SYNCH_DELAY_MAX 0xfa /* 500 ms */
@@ -393,6 +395,8 @@ int drm_edid_to_speaker_allocation(const struct edid *edid, u8 **sadb);
int drm_av_sync_delay(struct drm_connector *connector,
const struct drm_display_mode *mode);
+unsigned int drm_sad_to_channels(const u8 *sad);
+
#ifdef CONFIG_DRM_LOAD_EDID_FIRMWARE
int __drm_set_edid_firmware_path(const char *path);
int __drm_get_edid_firmware_path(char *buf, size_t bufsize);
--
2.25.1
More information about the Intel-gfx-trybot
mailing list