drm/exynos: set the active aspect ratio as per mode
Subsystems (3)
PATCH 1/1 drm/exynos: set the active aspect ratio as per mode
now that the drm_display_mode also provides aspect ratio for all resolutions, this patch adds its usage to set the active aspect ratio of AVI info frame packets as per CEA-861-D standard's Table 9.
This is also needed to abide by the 7-27 compliance test of HDMI.
--- drivers/gpu/drm/exynos/exynos_hdmi.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-)
drivers/gpu/drm/exynos/exynos_hdmi.c +27 -6
@@ -53,8 +53,6 @@/* AVI header and aspect ratio */ #define HDMI_AVI_VERSION 0x02#define HDMI_AVI_LENGTH 0x0D -#define AVI_PIC_ASPECT_RATIO_16_9 (2 << 4) -#define AVI_SAME_AS_PIC_ASPECT_RATIO 8/* AUI header info */ #define HDMI_AUI_VERSION 0x01
@@ -65,6 +63,12 @@ enum hdmi_type { HDMI_TYPE14, }; +enum active_aspect_ratio { +AVI_SAME_AS_PIC_ASPECT_RATIO =8 , + AVI_4_3_Center_RATIO, + AVI_16_9_Center_RATIO, +}; +struct hdmi_resources {struct clk *hdmi;struct clk *sclk_hdmi;
@@ -162,6 +166,7 @@ struct hdmi_v14_conf {struct hdmi_conf_regs {int pixel_clock;int cea_video_id; +enum hdmi_picture_aspect aspect_ratio;union {struct hdmi_v13_conf v13_conf;struct hdmi_v14_conf v14_conf;
@@ -668,7 +673,6 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, {u32 hdr_sum;u8 chksum; -u32 aspect_ratio;u32 mod;u32 vic;
@@ -697,10 +701,25 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,AVI_ACTIVE_FORMAT_VALID | AVI_UNDERSCANNED_DISPLAY_VALID); - aspect_ratio =AVI_PIC_ASPECT_RATIO_16_9 ; - -hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), aspect_ratio | +/* +* Set the aspect ratio as per the mode, mentioned in +* Table 9 AVI InfoFrame Data Byte 2 of CEA-861-D Standard +*/ +switch (hdata->mode_conf.aspect_ratio) { +case HDMI_PICTURE_ASPECT_4_3 : +hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), aspect_ratio | + AVI_4_3_Center_RATIO); +break ; +case HDMI_PICTURE_ASPECT_16_9 : +hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), aspect_ratio | + AVI_16_9_Center_RATIO); +break ; +case HDMI_PICTURE_ASPECT_NONE : +default : +hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), aspect_ratio |AVI_SAME_AS_PIC_ASPECT_RATIO ); +break ; + } vic = hdata->mode_conf.cea_video_id;hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (4 ), vic);
@@ -1421,6 +1440,7 @@ static void hdmi_v13_mode_set(struct hdmi_context *hdata, hdata->mode_conf.cea_video_id =drm_match_cea_mode ((struct drm_display_mode *)m); hdata->mode_conf.pixel_clock = m->clock *1000 ; + hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio;hdmi_set_reg (core->h_blank,2 , m->htotal - m->hdisplay);hdmi_set_reg (core->h_v_line,3 , (m->htotal <<12 ) | m->vtotal);
@@ -1517,6 +1537,7 @@ static void hdmi_v14_mode_set(struct hdmi_context *hdata, hdata->mode_conf.cea_video_id =drm_match_cea_mode ((struct drm_display_mode *)m); hdata->mode_conf.pixel_clock = m->clock *1000 ; + hdata->mode_conf.aspect_ratio = m->picture_aspect_ratio;hdmi_set_reg (core->h_blank,2 , m->htotal - m->hdisplay);hdmi_set_reg (core->v_line,2 , m->vtotal);
Signature · 1 line
1.7.10.4
Hi Shirish,
Quoted 27 lines · Shirish S
now that the
drm_display_modealso provides aspect ratio for all resolutions, this patch adds its usage to set the active aspect ratio of AVI info frame packets as per CEA-861-D standard's Table 9.This is also needed to abide by the 7-27 compliance test of HDMI.
Signed-off-by Shirish S <[email protected]>--- drivers/gpu/drm/exynos/exynos_hdmi.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-)drivers/gpu/drm/exynos/exynos_hdmi.c +0
-2@@ -53,8 +53,6 @@/* AVI header and aspect ratio */ #define HDMI_AVI_VERSION 0x02#define HDMI_AVI_LENGTH 0x0D -#define AVI_PIC_ASPECT_RATIO_16_9 (2 << 4) -#define AVI_SAME_AS_PIC_ASPECT_RATIO 8/* AUI header info */ #define HDMI_AUI_VERSION 0x01
drivers/gpu/drm/exynos/exynos_hdmi.c enum hdmi_type { · line 71
Quoted 9 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +6
-0@@ -65,6 +63,12 @@ enum hdmi_type { HDMI_TYPE14, }; +enum active_aspect_ratio { +AVI_SAME_AS_PIC_ASPECT_RATIO =8 , + AVI_4_3_Center_RATIO, + AVI_16_9_Center_RATIO, +}; +
CodingStyle: Please define these using preprocessor macros, since they are bitfield values. Also coding style implies using uppercase for constants.
Quoted 24 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +1
-2struct hdmi_resources {struct clk *hdmi;struct clk *sclk_hdmi;@@ -162,6 +166,7 @@ struct hdmi_v14_conf {struct hdmi_conf_regs {int pixel_clock;int cea_video_id; +enum hdmi_picture_aspect aspect_ratio;union {struct hdmi_v13_conf v13_conf;struct hdmi_v14_conf v14_conf;@@ -668,7 +673,6 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, {u32 hdr_sum;u8 chksum; -u32 aspect_ratio;u32 mod;u32 vic;@@ -697,10 +701,25 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,AVI_ACTIVE_FORMAT_VALID | AVI_UNDERSCANNED_DISPLAY_VALID); - aspect_ratio =AVI_PIC_ASPECT_RATIO_16_9 ;
drivers/gpu/drm/exynos/exynos_hdmi.c static void hdmi_reg_infoframe(struct hdmi_context *hdata, · line 711
Quoted 10 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +8
-2- - hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), aspect_ratio | +/* +* Set the aspect ratio as per the mode, mentioned in +* Table 9 AVI InfoFrame Data Byte 2 of CEA-861-D Standard +*/ +switch (hdata->mode_conf.aspect_ratio) { +case HDMI_PICTURE_ASPECT_4_3 : +hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), aspect_ratio | + AVI_4_3_Center_RATIO);
CodingStyle: Please keep wrapped function calls aligned using tabs at least to the opening parenthesis.
drivers/gpu/drm/exynos/exynos_hdmi.c static void hdmi_reg_infoframe(struct hdmi_context *hdata, · line 715
Quoted 4 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +4
-0+break ; +case HDMI_PICTURE_ASPECT_16_9 : +hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), aspect_ratio | + AVI_16_9_Center_RATIO);
Ditto.
drivers/gpu/drm/exynos/exynos_hdmi.c static void hdmi_reg_infoframe(struct hdmi_context *hdata, · line 720
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +4
-0+break ; +case HDMI_PICTURE_ASPECT_NONE : +default : +hdmi_reg_writeb (hdata,HDMI_AVI_BYTE (2 ), aspect_ratio |AVI_SAME_AS_PIC_ASPECT_RATIO );
Ditto.
Best regards,
Tomasz
Hi Tomasz,
Quoted 37 lines · Tomasz Figa
Hi Shirish,
Quoted 33 lines · Shirish S
now that the
drm_display_modealso provides aspect ratio for all resolutions, this patch adds its usage to set the active aspect ratio of AVI info frame packets as per CEA-861-D standard's Table 9.This is also needed to abide by the 7-27 compliance test of HDMI.
Signed-off-by Shirish S <[email protected]>--- drivers/gpu/drm/exynos/exynos_hdmi.c | 33 +++++++++++++++++++++++++++------ 1 file changed, 27 insertions(+), 6 deletions(-)drivers/gpu/drm/exynos/exynos_hdmi.c +0
-2@@ -53,8 +53,6 @@/* AVI header and aspect ratio */ #define HDMI_AVI_VERSION 0x02#define HDMI_AVI_LENGTH 0x0D -#define AVI_PIC_ASPECT_RATIO_16_9 (2 << 4) -#define AVI_SAME_AS_PIC_ASPECT_RATIO 8/* AUI header info */ #define HDMI_AUI_VERSION 0x01@@ -65,6 +63,12 @@ enum hdmi_type { HDMI_TYPE14, };
Quoted 12 lines
drivers/gpu/drm/exynos/exynos_hdmi.c enum hdmi_type { · line 71
Quoted 6 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +6
-0+enum active_aspect_ratio { +AVI_SAME_AS_PIC_ASPECT_RATIO =8 , + AVI_4_3_Center_RATIO, + AVI_16_9_Center_RATIO, +}; +CodingStyle: Please define these using preprocessor macros, since they are bitfield values. Also coding style implies using uppercase for constants.
Agreed, updated in the next path set.
Quoted 43 lines
Quoted 35 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +8
-4struct hdmi_resources {struct clk *hdmi;struct clk *sclk_hdmi;@@ -162,6 +166,7 @@ struct hdmi_v14_conf {struct hdmi_conf_regs {int pixel_clock;int cea_video_id; +enum hdmi_picture_aspect aspect_ratio;union {struct hdmi_v13_conf v13_conf;struct hdmi_v14_conf v14_conf;@@ -668,7 +673,6 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata, {u32 hdr_sum;u8 chksum; -u32 aspect_ratio;u32 mod;u32 vic;@@ -697,10 +701,25 @@ static void hdmi_reg_infoframe(struct hdmi_context *hdata,AVI_ACTIVE_FORMAT_VALID | AVI_UNDERSCANNED_DISPLAY_VALID); - aspect_ratio =AVI_PIC_ASPECT_RATIO_16_9 ; - - hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2), aspect_ratio | +/* +* Set the aspect ratio as per the mode, mentioned in +* Table 9 AVI InfoFrame Data Byte 2 of CEA-861-D Standard +*/ +switch (hdata->mode_conf.aspect_ratio) { +case HDMI_PICTURE_ASPECT_4_3 : + hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2),Quoted 2 lines
aspect_ratio|
+AVI_4_3_Center_RATIO);CodingStyle: Please keep wrapped function calls aligned using tabs at least to the opening parenthesis.
Quoted 9 lines
Quoted 5 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +3
-0+break ; +case HDMI_PICTURE_ASPECT_16_9 : + hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2),
aspect_ratio|
+AVI_16_9_Center_RATIO);Ditto.
Agreed, updated in next patch set.
Quoted 11 lines
Quoted 7 lines
drivers/gpu/drm/exynos/exynos_hdmi.c +4
-0+break ; +case HDMI_PICTURE_ASPECT_NONE : +default : + hdmi_reg_writeb(hdata, HDMI_AVI_BYTE(2),
aspect_ratio|AVI_SAME_AS_PIC_ASPECT_RATIO);Ditto.
Quoted 7 lines
Best regards,
Tomasz_______________________________________________
dri-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/dri-devel
Thanks & Regards,
Shirish S