Commit ffc4a6a1 authored by Vincent Abriou's avatar Vincent Abriou

drm/sti: add hdmi_mode property for HDMI connector

Configures the framer of the HDMI connection.
By default starts in HDMI mode and can be swtich to DVI.
Signed-off-by: default avatarVincent Abriou <vincent.abriou@st.com>
Reviewed-by: default avatarBenjamin Gaignard <benjamin.gaignard@linaro.org>
parent 5671cefb
...@@ -129,6 +129,7 @@ struct sti_hdmi_connector { ...@@ -129,6 +129,7 @@ struct sti_hdmi_connector {
struct drm_encoder *encoder; struct drm_encoder *encoder;
struct sti_hdmi *hdmi; struct sti_hdmi *hdmi;
struct drm_property *colorspace_property; struct drm_property *colorspace_property;
struct drm_property *hdmi_mode_property;
}; };
#define to_sti_hdmi_connector(x) \ #define to_sti_hdmi_connector(x) \
...@@ -229,8 +230,10 @@ static void hdmi_config(struct sti_hdmi *hdmi) ...@@ -229,8 +230,10 @@ static void hdmi_config(struct sti_hdmi *hdmi)
/* Clear overrun and underrun fifo */ /* Clear overrun and underrun fifo */
conf = HDMI_CFG_FIFO_OVERRUN_CLR | HDMI_CFG_FIFO_UNDERRUN_CLR; conf = HDMI_CFG_FIFO_OVERRUN_CLR | HDMI_CFG_FIFO_UNDERRUN_CLR;
/* Enable HDMI mode not DVI */ /* Select encryption type and the framing mode */
conf |= HDMI_CFG_HDMI_NOT_DVI | HDMI_CFG_ESS_NOT_OESS; conf |= HDMI_CFG_ESS_NOT_OESS;
if (hdmi->hdmi_mode == HDMI_MODE_HDMI)
conf |= HDMI_CFG_HDMI_NOT_DVI;
/* Enable sink term detection */ /* Enable sink term detection */
conf |= HDMI_CFG_SINK_TERM_DET_EN; conf |= HDMI_CFG_SINK_TERM_DET_EN;
...@@ -791,6 +794,19 @@ static void sti_hdmi_connector_init_property(struct drm_device *drm_dev, ...@@ -791,6 +794,19 @@ static void sti_hdmi_connector_init_property(struct drm_device *drm_dev,
} }
hdmi_connector->colorspace_property = prop; hdmi_connector->colorspace_property = prop;
drm_object_attach_property(&connector->base, prop, hdmi->colorspace); drm_object_attach_property(&connector->base, prop, hdmi->colorspace);
/* hdmi_mode property */
hdmi->hdmi_mode = DEFAULT_HDMI_MODE;
prop = drm_property_create_enum(drm_dev, 0, "hdmi_mode",
hdmi_mode_names,
ARRAY_SIZE(hdmi_mode_names));
if (!prop) {
DRM_ERROR("fails to create colorspace property\n");
return;
}
hdmi_connector->hdmi_mode_property = prop;
drm_object_attach_property(&connector->base, prop, hdmi->hdmi_mode);
} }
static int static int
...@@ -808,6 +824,11 @@ sti_hdmi_connector_set_property(struct drm_connector *connector, ...@@ -808,6 +824,11 @@ sti_hdmi_connector_set_property(struct drm_connector *connector,
return 0; return 0;
} }
if (property == hdmi_connector->hdmi_mode_property) {
hdmi->hdmi_mode = val;
return 0;
}
DRM_ERROR("failed to set hdmi connector property\n"); DRM_ERROR("failed to set hdmi connector property\n");
return -EINVAL; return -EINVAL;
} }
...@@ -827,6 +848,11 @@ sti_hdmi_connector_get_property(struct drm_connector *connector, ...@@ -827,6 +848,11 @@ sti_hdmi_connector_get_property(struct drm_connector *connector,
return 0; return 0;
} }
if (property == hdmi_connector->hdmi_mode_property) {
*val = hdmi->hdmi_mode;
return 0;
}
DRM_ERROR("failed to get hdmi connector property\n"); DRM_ERROR("failed to get hdmi connector property\n");
return -EINVAL; return -EINVAL;
} }
......
...@@ -25,6 +25,19 @@ struct hdmi_phy_ops { ...@@ -25,6 +25,19 @@ struct hdmi_phy_ops {
void (*stop)(struct sti_hdmi *hdmi); void (*stop)(struct sti_hdmi *hdmi);
}; };
/* values for the framing mode property */
enum sti_hdmi_modes {
HDMI_MODE_HDMI,
HDMI_MODE_DVI,
};
static const struct drm_prop_enum_list hdmi_mode_names[] = {
{ HDMI_MODE_HDMI, "hdmi" },
{ HDMI_MODE_DVI, "dvi" },
};
#define DEFAULT_HDMI_MODE HDMI_MODE_HDMI
static const struct drm_prop_enum_list colorspace_mode_names[] = { static const struct drm_prop_enum_list colorspace_mode_names[] = {
{ HDMI_COLORSPACE_RGB, "rgb" }, { HDMI_COLORSPACE_RGB, "rgb" },
{ HDMI_COLORSPACE_YUV422, "yuv422" }, { HDMI_COLORSPACE_YUV422, "yuv422" },
...@@ -55,6 +68,7 @@ static const struct drm_prop_enum_list colorspace_mode_names[] = { ...@@ -55,6 +68,7 @@ static const struct drm_prop_enum_list colorspace_mode_names[] = {
* @reset: reset control of the hdmi phy * @reset: reset control of the hdmi phy
* @ddc_adapt: i2c ddc adapter * @ddc_adapt: i2c ddc adapter
* @colorspace: current colorspace selected * @colorspace: current colorspace selected
* @hdmi_mode: select framing for HDMI or DVI
*/ */
struct sti_hdmi { struct sti_hdmi {
struct device dev; struct device dev;
...@@ -76,6 +90,7 @@ struct sti_hdmi { ...@@ -76,6 +90,7 @@ struct sti_hdmi {
struct reset_control *reset; struct reset_control *reset;
struct i2c_adapter *ddc_adapt; struct i2c_adapter *ddc_adapt;
enum hdmi_colorspace colorspace; enum hdmi_colorspace colorspace;
enum sti_hdmi_modes hdmi_mode;
}; };
u32 hdmi_read(struct sti_hdmi *hdmi, int offset); u32 hdmi_read(struct sti_hdmi *hdmi, int offset);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment