From bca18b11fc03ca2f2f91c8573f188cfc4a211b7a Mon Sep 17 00:00:00 2001 From: Ajay Singh Parmar Date: Fri, 17 Oct 2014 13:16:08 -0700 Subject: msm: mdss: hdmi: remove hard-coded resolution id names Generate the HDMI resolution id names based on resolution timing details. This makes the code generic for all resolutions. Change-Id: I097f450f5a85c85c1e81b7c7b1351d9c7228ba01 (cherry picked from commit 0e21977a89c126d610763c8ed9baf013bc9fa72a) [veeras@codeaurora.org: Done as part of 3.18 upgrade Removed msm8994-fluid.dtsi, msm8994-pinctrl.dtsi from this commit] Signed-off-by: Ajay Singh Parmar Signed-off-by: Veera Sundaram Sankaran --- drivers/video/fbdev/msm/mdss_hdmi_util.c | 45 ++++++++++++++++++++++++++++++++ drivers/video/fbdev/msm/mdss_hdmi_util.h | 1 + 2 files changed, 46 insertions(+) (limited to 'drivers/video/fbdev') diff --git a/drivers/video/fbdev/msm/mdss_hdmi_util.c b/drivers/video/fbdev/msm/mdss_hdmi_util.c index 60815e80cb14..4d8105cbd147 100644 --- a/drivers/video/fbdev/msm/mdss_hdmi_util.c +++ b/drivers/video/fbdev/msm/mdss_hdmi_util.c @@ -15,9 +15,54 @@ #include #include "mdss_hdmi_util.h" +#define RESOLUTION_NAME_STR_LEN 30 + static struct msm_hdmi_mode_timing_info hdmi_supported_video_mode_lut[HDMI_VFRMT_MAX]; +static char res_buf[RESOLUTION_NAME_STR_LEN]; + +const char *msm_hdmi_mode_2string(u32 mode) +{ + static struct msm_hdmi_mode_timing_info *ri; + char *aspect_ratio; + + if (mode >= HDMI_VFRMT_MAX) + return "???"; + + ri = &hdmi_supported_video_mode_lut[mode]; + + memset(res_buf, 0, sizeof(res_buf)); + + if (!ri->supported) { + snprintf(res_buf, RESOLUTION_NAME_STR_LEN, "%d", mode); + return res_buf; + } + + switch (ri->ar) { + case HDMI_RES_AR_4_3: + aspect_ratio = "4/3"; + break; + case HDMI_RES_AR_5_4: + aspect_ratio = "5/4"; + break; + case HDMI_RES_AR_16_9: + aspect_ratio = "16/9"; + break; + case HDMI_RES_AR_16_10: + aspect_ratio = "16/10"; + break; + default: + aspect_ratio = "???"; + }; + + snprintf(res_buf, RESOLUTION_NAME_STR_LEN, "%dx%d %s%dHz %s", + ri->active_h, ri->active_v, ri->interlaced ? "i" : "p", + ri->refresh_rate / 1000, aspect_ratio); + + return res_buf; +} + void hdmi_del_supported_mode(u32 mode) { struct msm_hdmi_mode_timing_info *ret = NULL; diff --git a/drivers/video/fbdev/msm/mdss_hdmi_util.h b/drivers/video/fbdev/msm/mdss_hdmi_util.h index 1cfec593005c..cb9fb02998ad 100644 --- a/drivers/video/fbdev/msm/mdss_hdmi_util.h +++ b/drivers/video/fbdev/msm/mdss_hdmi_util.h @@ -261,6 +261,7 @@ int hdmi_get_video_id_code(struct msm_hdmi_mode_timing_info *timing_in); const struct msm_hdmi_mode_timing_info *hdmi_get_supported_mode(u32 mode); void hdmi_del_supported_mode(u32 mode); ssize_t hdmi_get_video_3d_fmt_2string(u32 format, char *buf, u32 size); +const char *msm_hdmi_mode_2string(u32 mode); /* todo: Fix this. Right now this is defined in mdss_hdmi_tx.c */ void *hdmi_get_featuredata_from_sysfs_dev(struct device *device, u32 type); -- cgit v1.2.3