aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2015-07-21 10:35:52 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2015-08-18 06:32:38 -0400
commit05b1342f5014b7c100834ae179dd90d1a1da7366 (patch)
treef6deceb05903e1ca07d9c712f3912596c04b8c6a
parent8add41900e2177b20c28b64d13d8da8088c9606b (diff)
drm: bridge/dw_hdmi: clean up HDMI vs DVI mode handling
The FSL kernel detects the HDMI vendor id, and uses this to set hdmi->edid_cfg.hdmi_cap, which is then used to set mdvi appropriately, rather than detecting whether we are outputting a CEA mode. Update the dw_hdmi code to use this logic, but lets eliminate the mdvi variable, prefering the more verbose "hdmi->sink_is_hdmi" instead. Use the generic drm_detect_hdmi_monitor() to detect a HDMI sink. Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/gpu/drm/bridge/dw_hdmi.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/gpu/drm/bridge/dw_hdmi.c b/drivers/gpu/drm/bridge/dw_hdmi.c
index 8edf4c31f55c..fc9536b2c407 100644
--- a/drivers/gpu/drm/bridge/dw_hdmi.c
+++ b/drivers/gpu/drm/bridge/dw_hdmi.c
@@ -82,7 +82,6 @@ static const u16 csc_coeff_rgb_in_eitu709[3][4] = {
82}; 82};
83 83
84struct hdmi_vmode { 84struct hdmi_vmode {
85 bool mdvi;
86 bool mdataenablepolarity; 85 bool mdataenablepolarity;
87 86
88 unsigned int mpixelclock; 87 unsigned int mpixelclock;
@@ -123,6 +122,7 @@ struct dw_hdmi {
123 122
124 struct i2c_adapter *ddc; 123 struct i2c_adapter *ddc;
125 void __iomem *regs; 124 void __iomem *regs;
125 bool sink_is_hdmi;
126 126
127 spinlock_t audio_lock; 127 spinlock_t audio_lock;
128 struct mutex audio_mutex; 128 struct mutex audio_mutex;
@@ -913,11 +913,10 @@ static int hdmi_phy_configure(struct dw_hdmi *hdmi, unsigned char prep,
913static int dw_hdmi_phy_init(struct dw_hdmi *hdmi) 913static int dw_hdmi_phy_init(struct dw_hdmi *hdmi)
914{ 914{
915 int i, ret; 915 int i, ret;
916 bool cscon = false; 916 bool cscon;
917 917
918 /*check csc whether needed activated in HDMI mode */ 918 /*check csc whether needed activated in HDMI mode */
919 cscon = (is_color_space_conversion(hdmi) && 919 cscon = hdmi->sink_is_hdmi && is_color_space_conversion(hdmi);
920 !hdmi->hdmi_data.video_mode.mdvi);
921 920
922 /* HDMI Phy spec says to do the phy initialization sequence twice */ 921 /* HDMI Phy spec says to do the phy initialization sequence twice */
923 for (i = 0; i < 2; i++) { 922 for (i = 0; i < 2; i++) {
@@ -1093,9 +1092,9 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
1093 HDMI_FC_INVIDCONF_IN_I_P_INTERLACED : 1092 HDMI_FC_INVIDCONF_IN_I_P_INTERLACED :
1094 HDMI_FC_INVIDCONF_IN_I_P_PROGRESSIVE; 1093 HDMI_FC_INVIDCONF_IN_I_P_PROGRESSIVE;
1095 1094
1096 inv_val |= (vmode->mdvi ? 1095 inv_val |= hdmi->sink_is_hdmi ?
1097 HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE : 1096 HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE :
1098 HDMI_FC_INVIDCONF_DVI_MODEZ_HDMI_MODE); 1097 HDMI_FC_INVIDCONF_DVI_MODEZ_DVI_MODE;
1099 1098
1100 hdmi_writeb(hdmi, inv_val, HDMI_FC_INVIDCONF); 1099 hdmi_writeb(hdmi, inv_val, HDMI_FC_INVIDCONF);
1101 1100
@@ -1222,10 +1221,8 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
1222 1221
1223 if (!hdmi->vic) { 1222 if (!hdmi->vic) {
1224 dev_dbg(hdmi->dev, "Non-CEA mode used in HDMI\n"); 1223 dev_dbg(hdmi->dev, "Non-CEA mode used in HDMI\n");
1225 hdmi->hdmi_data.video_mode.mdvi = true;
1226 } else { 1224 } else {
1227 dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic); 1225 dev_dbg(hdmi->dev, "CEA mode used vic=%d\n", hdmi->vic);
1228 hdmi->hdmi_data.video_mode.mdvi = false;
1229 } 1226 }
1230 1227
1231 if ((hdmi->vic == 6) || (hdmi->vic == 7) || 1228 if ((hdmi->vic == 6) || (hdmi->vic == 7) ||
@@ -1261,10 +1258,8 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
1261 dw_hdmi_enable_video_path(hdmi); 1258 dw_hdmi_enable_video_path(hdmi);
1262 1259
1263 /* not for DVI mode */ 1260 /* not for DVI mode */
1264 if (hdmi->hdmi_data.video_mode.mdvi) { 1261 if (hdmi->sink_is_hdmi) {
1265 dev_dbg(hdmi->dev, "%s DVI mode\n", __func__); 1262 dev_dbg(hdmi->dev, "%s HDMI mode\n", __func__);
1266 } else {
1267 dev_dbg(hdmi->dev, "%s CEA mode\n", __func__);
1268 1263
1269 /* HDMI Initialization Step E - Configure audio */ 1264 /* HDMI Initialization Step E - Configure audio */
1270 hdmi_clk_regenerator_update_pixel_clock(hdmi); 1265 hdmi_clk_regenerator_update_pixel_clock(hdmi);
@@ -1272,6 +1267,8 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
1272 1267
1273 /* HDMI Initialization Step F - Configure AVI InfoFrame */ 1268 /* HDMI Initialization Step F - Configure AVI InfoFrame */
1274 hdmi_config_AVI(hdmi, mode); 1269 hdmi_config_AVI(hdmi, mode);
1270 } else {
1271 dev_dbg(hdmi->dev, "%s DVI mode\n", __func__);
1275 } 1272 }
1276 1273
1277 hdmi_video_packetize(hdmi); 1274 hdmi_video_packetize(hdmi);
@@ -1280,7 +1277,7 @@ static int dw_hdmi_setup(struct dw_hdmi *hdmi, struct drm_display_mode *mode)
1280 hdmi_tx_hdcp_config(hdmi); 1277 hdmi_tx_hdcp_config(hdmi);
1281 1278
1282 dw_hdmi_clear_overflow(hdmi); 1279 dw_hdmi_clear_overflow(hdmi);
1283 if (hdmi->cable_plugin && !hdmi->hdmi_data.video_mode.mdvi) 1280 if (hdmi->cable_plugin && hdmi->sink_is_hdmi)
1284 hdmi_enable_overflow_interrupts(hdmi); 1281 hdmi_enable_overflow_interrupts(hdmi);
1285 1282
1286 return 0; 1283 return 0;
@@ -1430,6 +1427,7 @@ static int dw_hdmi_connector_get_modes(struct drm_connector *connector)
1430 dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n", 1427 dev_dbg(hdmi->dev, "got edid: width[%d] x height[%d]\n",
1431 edid->width_cm, edid->height_cm); 1428 edid->width_cm, edid->height_cm);
1432 1429
1430 hdmi->sink_is_hdmi = drm_detect_hdmi_monitor(edid);
1433 drm_mode_connector_update_edid_property(connector, edid); 1431 drm_mode_connector_update_edid_property(connector, edid);
1434 ret = drm_add_edid_modes(connector, edid); 1432 ret = drm_add_edid_modes(connector, edid);
1435 kfree(edid); 1433 kfree(edid);