diff options
author | Vincent Abriou <vincent.abriou@st.com> | 2017-02-02 03:45:48 -0500 |
---|---|---|
committer | Vincent Abriou <vincent.abriou@st.com> | 2017-02-10 03:34:39 -0500 |
commit | 97d7c576302979831c65a2ae8a0ef4f3acf7f107 (patch) | |
tree | 8519049ce990720bd484ee00c42deaa2e8ba147f | |
parent | b7e05db3d1ff1adf45e2c028ea331e3a999fb56b (diff) |
drm/sti: hdmi: automatically check DVI/HDMI mode
Remove the hdmi_mode_property and use drm_detect_hdmi_monitor function
to check whether the connected monitor is HDMI capable or DVI only.
Signed-off-by: Vincent Abriou <vincent.abriou@st.com>
-rw-r--r-- | drivers/gpu/drm/sti/sti_hdmi.c | 31 | ||||
-rw-r--r-- | drivers/gpu/drm/sti/sti_hdmi.h | 17 |
2 files changed, 8 insertions, 40 deletions
diff --git a/drivers/gpu/drm/sti/sti_hdmi.c b/drivers/gpu/drm/sti/sti_hdmi.c index 6862d5911c18..ce2dcba679d5 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.c +++ b/drivers/gpu/drm/sti/sti_hdmi.c | |||
@@ -158,7 +158,6 @@ struct sti_hdmi_connector { | |||
158 | struct drm_encoder *encoder; | 158 | struct drm_encoder *encoder; |
159 | struct sti_hdmi *hdmi; | 159 | struct sti_hdmi *hdmi; |
160 | struct drm_property *colorspace_property; | 160 | struct drm_property *colorspace_property; |
161 | struct drm_property *hdmi_mode_property; | ||
162 | }; | 161 | }; |
163 | 162 | ||
164 | #define to_sti_hdmi_connector(x) \ | 163 | #define to_sti_hdmi_connector(x) \ |
@@ -265,7 +264,7 @@ static void hdmi_config(struct sti_hdmi *hdmi) | |||
265 | 264 | ||
266 | /* Select encryption type and the framing mode */ | 265 | /* Select encryption type and the framing mode */ |
267 | conf |= HDMI_CFG_ESS_NOT_OESS; | 266 | conf |= HDMI_CFG_ESS_NOT_OESS; |
268 | if (hdmi->hdmi_mode == HDMI_MODE_HDMI) | 267 | if (hdmi->hdmi_monitor) |
269 | conf |= HDMI_CFG_HDMI_NOT_DVI; | 268 | conf |= HDMI_CFG_HDMI_NOT_DVI; |
270 | 269 | ||
271 | /* Set Hsync polarity */ | 270 | /* Set Hsync polarity */ |
@@ -970,6 +969,11 @@ static int sti_hdmi_connector_get_modes(struct drm_connector *connector) | |||
970 | if (!edid) | 969 | if (!edid) |
971 | goto fail; | 970 | goto fail; |
972 | 971 | ||
972 | hdmi->hdmi_monitor = drm_detect_hdmi_monitor(edid); | ||
973 | DRM_DEBUG_KMS("%s : %dx%d cm\n", | ||
974 | (hdmi->hdmi_monitor ? "hdmi monitor" : "dvi monitor"), | ||
975 | edid->width_cm, edid->height_cm); | ||
976 | |||
973 | count = drm_add_edid_modes(connector, edid); | 977 | count = drm_add_edid_modes(connector, edid); |
974 | drm_mode_connector_update_edid_property(connector, edid); | 978 | drm_mode_connector_update_edid_property(connector, edid); |
975 | drm_edid_to_eld(connector, edid); | 979 | drm_edid_to_eld(connector, edid); |
@@ -1053,19 +1057,6 @@ static void sti_hdmi_connector_init_property(struct drm_device *drm_dev, | |||
1053 | } | 1057 | } |
1054 | hdmi_connector->colorspace_property = prop; | 1058 | hdmi_connector->colorspace_property = prop; |
1055 | drm_object_attach_property(&connector->base, prop, hdmi->colorspace); | 1059 | drm_object_attach_property(&connector->base, prop, hdmi->colorspace); |
1056 | |||
1057 | /* hdmi_mode property */ | ||
1058 | hdmi->hdmi_mode = DEFAULT_HDMI_MODE; | ||
1059 | prop = drm_property_create_enum(drm_dev, 0, "hdmi_mode", | ||
1060 | hdmi_mode_names, | ||
1061 | ARRAY_SIZE(hdmi_mode_names)); | ||
1062 | if (!prop) { | ||
1063 | DRM_ERROR("fails to create colorspace property\n"); | ||
1064 | return; | ||
1065 | } | ||
1066 | hdmi_connector->hdmi_mode_property = prop; | ||
1067 | drm_object_attach_property(&connector->base, prop, hdmi->hdmi_mode); | ||
1068 | |||
1069 | } | 1060 | } |
1070 | 1061 | ||
1071 | static int | 1062 | static int |
@@ -1083,11 +1074,6 @@ sti_hdmi_connector_set_property(struct drm_connector *connector, | |||
1083 | return 0; | 1074 | return 0; |
1084 | } | 1075 | } |
1085 | 1076 | ||
1086 | if (property == hdmi_connector->hdmi_mode_property) { | ||
1087 | hdmi->hdmi_mode = val; | ||
1088 | return 0; | ||
1089 | } | ||
1090 | |||
1091 | DRM_ERROR("failed to set hdmi connector property\n"); | 1077 | DRM_ERROR("failed to set hdmi connector property\n"); |
1092 | return -EINVAL; | 1078 | return -EINVAL; |
1093 | } | 1079 | } |
@@ -1107,11 +1093,6 @@ sti_hdmi_connector_get_property(struct drm_connector *connector, | |||
1107 | return 0; | 1093 | return 0; |
1108 | } | 1094 | } |
1109 | 1095 | ||
1110 | if (property == hdmi_connector->hdmi_mode_property) { | ||
1111 | *val = hdmi->hdmi_mode; | ||
1112 | return 0; | ||
1113 | } | ||
1114 | |||
1115 | DRM_ERROR("failed to get hdmi connector property\n"); | 1096 | DRM_ERROR("failed to get hdmi connector property\n"); |
1116 | return -EINVAL; | 1097 | return -EINVAL; |
1117 | } | 1098 | } |
diff --git a/drivers/gpu/drm/sti/sti_hdmi.h b/drivers/gpu/drm/sti/sti_hdmi.h index 119bc3582ac7..407012350f1a 100644 --- a/drivers/gpu/drm/sti/sti_hdmi.h +++ b/drivers/gpu/drm/sti/sti_hdmi.h | |||
@@ -30,19 +30,6 @@ struct hdmi_audio_params { | |||
30 | struct hdmi_audio_infoframe cea; | 30 | struct hdmi_audio_infoframe cea; |
31 | }; | 31 | }; |
32 | 32 | ||
33 | /* values for the framing mode property */ | ||
34 | enum sti_hdmi_modes { | ||
35 | HDMI_MODE_HDMI, | ||
36 | HDMI_MODE_DVI, | ||
37 | }; | ||
38 | |||
39 | static const struct drm_prop_enum_list hdmi_mode_names[] = { | ||
40 | { HDMI_MODE_HDMI, "hdmi" }, | ||
41 | { HDMI_MODE_DVI, "dvi" }, | ||
42 | }; | ||
43 | |||
44 | #define DEFAULT_HDMI_MODE HDMI_MODE_HDMI | ||
45 | |||
46 | static const struct drm_prop_enum_list colorspace_mode_names[] = { | 33 | static const struct drm_prop_enum_list colorspace_mode_names[] = { |
47 | { HDMI_COLORSPACE_RGB, "rgb" }, | 34 | { HDMI_COLORSPACE_RGB, "rgb" }, |
48 | { HDMI_COLORSPACE_YUV422, "yuv422" }, | 35 | { HDMI_COLORSPACE_YUV422, "yuv422" }, |
@@ -73,7 +60,7 @@ static const struct drm_prop_enum_list colorspace_mode_names[] = { | |||
73 | * @reset: reset control of the hdmi phy | 60 | * @reset: reset control of the hdmi phy |
74 | * @ddc_adapt: i2c ddc adapter | 61 | * @ddc_adapt: i2c ddc adapter |
75 | * @colorspace: current colorspace selected | 62 | * @colorspace: current colorspace selected |
76 | * @hdmi_mode: select framing for HDMI or DVI | 63 | * @hdmi_monitor: true if HDMI monitor detected else DVI monitor assumed |
77 | * @audio_pdev: ASoC hdmi-codec platform device | 64 | * @audio_pdev: ASoC hdmi-codec platform device |
78 | * @audio: hdmi audio parameters. | 65 | * @audio: hdmi audio parameters. |
79 | * @drm_connector: hdmi connector | 66 | * @drm_connector: hdmi connector |
@@ -98,7 +85,7 @@ struct sti_hdmi { | |||
98 | struct reset_control *reset; | 85 | struct reset_control *reset; |
99 | struct i2c_adapter *ddc_adapt; | 86 | struct i2c_adapter *ddc_adapt; |
100 | enum hdmi_colorspace colorspace; | 87 | enum hdmi_colorspace colorspace; |
101 | enum sti_hdmi_modes hdmi_mode; | 88 | bool hdmi_monitor; |
102 | struct platform_device *audio_pdev; | 89 | struct platform_device *audio_pdev; |
103 | struct hdmi_audio_params audio; | 90 | struct hdmi_audio_params audio; |
104 | struct drm_connector *drm_connector; | 91 | struct drm_connector *drm_connector; |