From bca18b11fc03ca2f2f91c8573f188cfc4a211b7a Mon Sep 17 00:00:00 2001 From: Ajay Singh Parmar Date: Fri, 17 Oct 2014 13:16:08 -0700 Subject: [PATCH] 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 + include/uapi/video/msm_hdmi_modes.h | 78 ------------------------ 3 files changed, 46 insertions(+), 78 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 #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); diff --git a/include/uapi/video/msm_hdmi_modes.h b/include/uapi/video/msm_hdmi_modes.h index 3c6a6a07ce06..0fa0820a4e85 100644 --- a/include/uapi/video/msm_hdmi_modes.h +++ b/include/uapi/video/msm_hdmi_modes.h @@ -259,82 +259,4 @@ static inline void MSM_HDMI_MODES_SET_SUPP_TIMINGS( } } -static inline const char *msm_hdmi_mode_2string(uint32_t mode) -{ - switch (mode) { - case HDMI_VFRMT_UNKNOWN: return "Unknown"; - case HDMI_VFRMT_640x480p60_4_3: return "640x480 p60 4/3"; - case HDMI_VFRMT_720x480p60_4_3: return "720x480 p60 4/3"; - case HDMI_VFRMT_720x480p60_16_9: return "720x480 p60 16/9"; - case HDMI_VFRMT_1280x720p60_16_9: return "1280x 720 p60 16/9"; - case HDMI_VFRMT_1920x1080i60_16_9: return "1920x1080 i60 16/9"; - case HDMI_VFRMT_1440x480i60_4_3: return "1440x480 i60 4/3"; - case HDMI_VFRMT_1440x480i60_16_9: return "1440x480 i60 16/9"; - case HDMI_VFRMT_1440x240p60_4_3: return "1440x240 p60 4/3"; - case HDMI_VFRMT_1440x240p60_16_9: return "1440x240 p60 16/9"; - case HDMI_VFRMT_2880x480i60_4_3: return "2880x480 i60 4/3"; - case HDMI_VFRMT_2880x480i60_16_9: return "2880x480 i60 16/9"; - case HDMI_VFRMT_2880x240p60_4_3: return "2880x240 p60 4/3"; - case HDMI_VFRMT_2880x240p60_16_9: return "2880x240 p60 16/9"; - case HDMI_VFRMT_1440x480p60_4_3: return "1440x480 p60 4/3"; - case HDMI_VFRMT_1440x480p60_16_9: return "1440x480 p60 16/9"; - case HDMI_VFRMT_1920x1080p60_16_9: return "1920x1080 p60 16/9"; - case HDMI_VFRMT_720x576p50_4_3: return "720x576 p50 4/3"; - case HDMI_VFRMT_720x576p50_16_9: return "720x576 p50 16/9"; - case HDMI_VFRMT_1280x720p50_16_9: return "1280x720 p50 16/9"; - case HDMI_VFRMT_1920x1080i50_16_9: return "1920x1080 i50 16/9"; - case HDMI_VFRMT_1440x576i50_4_3: return "1440x576 i50 4/3"; - case HDMI_VFRMT_1440x576i50_16_9: return "1440x576 i50 16/9"; - case HDMI_VFRMT_1440x288p50_4_3: return "1440x288 p50 4/3"; - case HDMI_VFRMT_1440x288p50_16_9: return "1440x288 p50 16/9"; - case HDMI_VFRMT_2880x576i50_4_3: return "2880x576 i50 4/3"; - case HDMI_VFRMT_2880x576i50_16_9: return "2880x576 i50 16/9"; - case HDMI_VFRMT_2880x288p50_4_3: return "2880x288 p50 4/3"; - case HDMI_VFRMT_2880x288p50_16_9: return "2880x288 p50 16/9"; - case HDMI_VFRMT_1440x576p50_4_3: return "1440x576 p50 4/3"; - case HDMI_VFRMT_1440x576p50_16_9: return "1440x576 p50 16/9"; - case HDMI_VFRMT_1920x1080p50_16_9: return "1920x1080 p50 16/9"; - case HDMI_VFRMT_1920x1080p24_16_9: return "1920x1080 p24 16/9"; - case HDMI_VFRMT_1920x1080p25_16_9: return "1920x1080 p25 16/9"; - case HDMI_VFRMT_1920x1080p30_16_9: return "1920x1080 p30 16/9"; - case HDMI_VFRMT_2880x480p60_4_3: return "2880x480 p60 4/3"; - case HDMI_VFRMT_2880x480p60_16_9: return "2880x480 p60 16/9"; - case HDMI_VFRMT_2880x576p50_4_3: return "2880x576 p50 4/3"; - case HDMI_VFRMT_2880x576p50_16_9: return "2880x576 p50 16/9"; - case HDMI_VFRMT_1920x1250i50_16_9: return "1920x1250 i50 16/9"; - case HDMI_VFRMT_1920x1080i100_16_9: return "1920x1080 i100 16/9"; - case HDMI_VFRMT_1280x720p100_16_9: return "1280x720 p100 16/9"; - case HDMI_VFRMT_720x576p100_4_3: return "720x576 p100 4/3"; - case HDMI_VFRMT_720x576p100_16_9: return "720x576 p100 16/9"; - case HDMI_VFRMT_1440x576i100_4_3: return "1440x576 i100 4/3"; - case HDMI_VFRMT_1440x576i100_16_9: return "1440x576 i100 16/9"; - case HDMI_VFRMT_1920x1080i120_16_9: return "1920x1080 i120 16/9"; - case HDMI_VFRMT_1280x720p120_16_9: return "1280x720 p120 16/9"; - case HDMI_VFRMT_720x480p120_4_3: return "720x480 p120 4/3"; - case HDMI_VFRMT_720x480p120_16_9: return "720x480 p120 16/9"; - case HDMI_VFRMT_1440x480i120_4_3: return "1440x480 i120 4/3"; - case HDMI_VFRMT_1440x480i120_16_9: return "1440x480 i120 16/9"; - case HDMI_VFRMT_720x576p200_4_3: return "720x576 p200 4/3"; - case HDMI_VFRMT_720x576p200_16_9: return "720x576 p200 16/9"; - case HDMI_VFRMT_1440x576i200_4_3: return "1440x576 i200 4/3"; - case HDMI_VFRMT_1440x576i200_16_9: return "1440x576 i200 16/9"; - case HDMI_VFRMT_720x480p240_4_3: return "720x480 p240 4/3"; - case HDMI_VFRMT_720x480p240_16_9: return "720x480 p240 16/9"; - case HDMI_VFRMT_1440x480i240_4_3: return "1440x480 i240 4/3"; - case HDMI_VFRMT_1440x480i240_16_9: return "1440x480 i240 16/9"; - case HDMI_VFRMT_1280x720p24_16_9: return "1280x720 p24 16/9"; - case HDMI_VFRMT_1280x720p25_16_9: return "1280x720 p25 16/9"; - case HDMI_VFRMT_1280x720p30_16_9: return "1280x720 p30 16/9"; - case HDMI_VFRMT_1920x1080p120_16_9: return "1920x1080 p120 16/9"; - case HDMI_VFRMT_1920x1080p100_16_9: return "1920x1080 p100 16/9"; - case HDMI_VFRMT_3840x2160p30_16_9: return "3840x2160 p30 16/9"; - case HDMI_VFRMT_3840x2160p25_16_9: return "3840x2160 p25 16/9"; - case HDMI_VFRMT_3840x2160p24_16_9: return "3840x2160 p24 16/9"; - case HDMI_VFRMT_4096x2160p24_16_9: return "4096x2160 p24 16/9"; - case HDMI_VFRMT_1024x768p60_4_3: return "1024x768 p60 4/3"; - case HDMI_VFRMT_1280x1024p60_5_4: return "1280x1024 p60 5/4"; - case HDMI_VFRMT_2560x1600p60_16_9: return "2560x1600 p60 16/9"; - default: return "???"; - } -} #endif /* _UAPI_MSM_HDMI_MODES_H__ */