Add the necessary struct members and packing code to allow the
hdmi_emp_infoframe_vtem_pack function to write VTEM packets with HDMI
Quick Media Switching (QMS) data.

Co-developed-by: Derek Foreman <[email protected]>
Signed-off-by: Derek Foreman <[email protected]>
Signed-off-by: Nicolas Frattaroli <[email protected]>
---
 drivers/video/hdmi.c | 6 ++++--
 include/linux/hdmi.h | 2 ++
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/video/hdmi.c b/drivers/video/hdmi.c
index ed9abc7ad228..c164f69a646a 100644
--- a/drivers/video/hdmi.c
+++ b/drivers/video/hdmi.c
@@ -1994,7 +1994,7 @@ ssize_t hdmi_emp_infoframe_vtem_pack(struct 
hdmi_emp_infoframe_vtem *vtem,
        ptr[1] = BIT(7) | BIT(6);
        ptr[2] = 0;
 
-       ptr[3] = BIT(7) | BIT(2);
+       ptr[3] = BIT(7) | BIT(2) | (vtem->qms_en ? BIT(1) : 0);
 
        ptr[4] = 0;
        ptr[5] = 1;
@@ -2005,10 +2005,12 @@ ssize_t hdmi_emp_infoframe_vtem_pack(struct 
hdmi_emp_infoframe_vtem *vtem,
 
        /* This is where the VTEM part starts */
        ptr[10] = (vtem->fva_factor_m1 << 4) |
+                 (vtem->qms_en ? BIT(2) : 0) |
                  (vtem->m_const ? BIT(1) : 0) |
                  (vtem->game_vrr_en ? BIT(0) : 0);
        ptr[11] = vtem->base_vfront;
-       ptr[12] = vtem->base_refresh_rate >> 8 & 0x3;
+       ptr[12] = (vtem->next_tfr << 3) |
+                 (vtem->base_refresh_rate >> 8 & 0x3);
        ptr[13] = vtem->base_refresh_rate & 0xFF;
 
        return 14;
diff --git a/include/linux/hdmi.h b/include/linux/hdmi.h
index 71e2b36896af..8eaa127f0cb5 100644
--- a/include/linux/hdmi.h
+++ b/include/linux/hdmi.h
@@ -243,10 +243,12 @@ struct hdmi_emp_infoframe_vtem {
        unsigned char length;
 
        bool game_vrr_en;
+       bool qms_en;
        bool m_const;
        unsigned char fva_factor_m1;
        unsigned char base_vfront;
        u16 base_refresh_rate;
+       u8 next_tfr;
 };
 
 void hdmi_avi_infoframe_init(struct hdmi_avi_infoframe *frame);

-- 
2.55.0

Reply via email to