Add hdmi_eotf_get_name() next to the other hdmi_*_get_name() helpers.

Assisted-by: LLM
Signed-off-by: Pranay Samala <[email protected]>
---
 drivers/video/hdmi.c | 23 +++++++++++++++++++++++
 include/linux/hdmi.h |  2 ++
 2 files changed, 25 insertions(+)

diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index 45b42f14a750..cd62afcd38d7 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -1429,6 +1429,29 @@ static void hdmi_audio_infoframe_log(const char *level,
                        frame->downmix_inhibit ? "Yes" : "No");
 }
 
+/**
+ * hdmi_eotf_get_name() - get the name of an electro-optical transfer function
+ * @eotf: electro-optical transfer function
+ *
+ * Returns: a human readable name for @eotf, or "Invalid" if @eotf is not a
+ * transfer function defined by CTA-861.
+ */
+const char *hdmi_eotf_get_name(enum hdmi_eotf eotf)
+{
+       switch (eotf) {
+       case HDMI_EOTF_TRADITIONAL_GAMMA_SDR:
+               return "Traditional gamma SDR";
+       case HDMI_EOTF_TRADITIONAL_GAMMA_HDR:
+               return "Traditional gamma HDR";
+       case HDMI_EOTF_SMPTE_ST2084:
+               return "SMPTE ST2084";
+       case HDMI_EOTF_BT_2100_HLG:
+               return "BT.2100 HLG";
+       }
+       return "Invalid";
+}
+EXPORT_SYMBOL(hdmi_eotf_get_name);
+
 static void hdmi_drm_infoframe_log(const char *level,
                                   struct device *dev,
                                   const struct hdmi_drm_infoframe *frame)
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index b80a5ee63bb2..60a9ad3677b3 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -468,4 +468,6 @@ int hdmi_infoframe_unpack(union hdmi_infoframe *frame,
 void hdmi_infoframe_log(const char *level, struct device *dev,
                        const union hdmi_infoframe *frame);
 
+const char *hdmi_eotf_get_name(enum hdmi_eotf eotf);
+
 #endif /* _DRM_HDMI_H */
-- 
2.53.0

Reply via email to