diff options
| author | Ajay Singh Parmar <aparmar@codeaurora.org> | 2014-10-17 13:16:08 -0700 |
|---|---|---|
| committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 20:36:12 -0700 |
| commit | bca18b11fc03ca2f2f91c8573f188cfc4a211b7a (patch) | |
| tree | 4976020943c3239e256aaf747de3c4c287fcff0b /drivers/video/fbdev | |
| parent | fbcc005c2b8934da678d6c5cd82ca323daa1a8eb (diff) | |
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 <aparmar@codeaurora.org>
Signed-off-by: Veera Sundaram Sankaran <veeras@codeaurora.org>
Diffstat (limited to 'drivers/video/fbdev')
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_hdmi_util.c | 45 | ||||
| -rw-r--r-- | drivers/video/fbdev/msm/mdss_hdmi_util.h | 1 |
2 files changed, 46 insertions, 0 deletions
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 <linux/delay.h> #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); |
