drm/msm: enable hpd event support for hdmi display
When HPD is enabled in DTSI for HDMI display, driver needs to poll the HPD status change and report event back to user space. Change-Id: I6dd2f3078875698ff8cfd7bdb7cfd662e85eec9b Signed-off-by: Abhinav Kumar <abhinavk@codeaurora.org>
This commit is contained in:
parent
776bf6f2f0
commit
08c7eadeec
3 changed files with 18 additions and 7 deletions
|
@ -400,7 +400,7 @@ static void _sde_hdmi_connector_irq(struct sde_hdmi *sde_hdmi)
|
||||||
|
|
||||||
if ((hpd_int_ctrl & HDMI_HPD_INT_CTRL_INT_EN) &&
|
if ((hpd_int_ctrl & HDMI_HPD_INT_CTRL_INT_EN) &&
|
||||||
(hpd_int_status & HDMI_HPD_INT_STATUS_INT)) {
|
(hpd_int_status & HDMI_HPD_INT_STATUS_INT)) {
|
||||||
bool detected = !!(hpd_int_status &
|
sde_hdmi->connected = !!(hpd_int_status &
|
||||||
HDMI_HPD_INT_STATUS_CABLE_DETECTED);
|
HDMI_HPD_INT_STATUS_CABLE_DETECTED);
|
||||||
|
|
||||||
/* ack & disable (temporarily) HPD events: */
|
/* ack & disable (temporarily) HPD events: */
|
||||||
|
@ -412,7 +412,7 @@ static void _sde_hdmi_connector_irq(struct sde_hdmi *sde_hdmi)
|
||||||
|
|
||||||
/* detect disconnect if we are connected or visa versa: */
|
/* detect disconnect if we are connected or visa versa: */
|
||||||
hpd_int_ctrl = HDMI_HPD_INT_CTRL_INT_EN;
|
hpd_int_ctrl = HDMI_HPD_INT_CTRL_INT_EN;
|
||||||
if (!detected)
|
if (!sde_hdmi->connected)
|
||||||
hpd_int_ctrl |= HDMI_HPD_INT_CTRL_INT_CONNECT;
|
hpd_int_ctrl |= HDMI_HPD_INT_CTRL_INT_CONNECT;
|
||||||
hdmi_write(hdmi, REG_HDMI_HPD_INT_CTRL, hpd_int_ctrl);
|
hdmi_write(hdmi, REG_HDMI_HPD_INT_CTRL, hpd_int_ctrl);
|
||||||
|
|
||||||
|
@ -451,6 +451,7 @@ int sde_hdmi_get_info(struct msm_display_info *info,
|
||||||
{
|
{
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
struct sde_hdmi *hdmi_display = (struct sde_hdmi *)display;
|
struct sde_hdmi *hdmi_display = (struct sde_hdmi *)display;
|
||||||
|
struct hdmi *hdmi = hdmi_display->ctrl.ctrl;
|
||||||
|
|
||||||
if (!display || !info) {
|
if (!display || !info) {
|
||||||
SDE_ERROR("display=%p or info=%p is NULL\n", display, info);
|
SDE_ERROR("display=%p or info=%p is NULL\n", display, info);
|
||||||
|
@ -463,11 +464,15 @@ int sde_hdmi_get_info(struct msm_display_info *info,
|
||||||
info->num_of_h_tiles = 1;
|
info->num_of_h_tiles = 1;
|
||||||
info->h_tile_instance[0] = 0;
|
info->h_tile_instance[0] = 0;
|
||||||
info->is_connected = true;
|
info->is_connected = true;
|
||||||
if (hdmi_display->non_pluggable)
|
if (hdmi_display->non_pluggable) {
|
||||||
info->capabilities = MSM_DISPLAY_CAP_VID_MODE;
|
info->capabilities = MSM_DISPLAY_CAP_VID_MODE;
|
||||||
else
|
hdmi_display->connected = true;
|
||||||
|
hdmi->hdmi_mode = true;
|
||||||
|
} else {
|
||||||
info->capabilities = MSM_DISPLAY_CAP_HOT_PLUG |
|
info->capabilities = MSM_DISPLAY_CAP_HOT_PLUG |
|
||||||
MSM_DISPLAY_CAP_EDID | MSM_DISPLAY_CAP_VID_MODE;
|
MSM_DISPLAY_CAP_EDID | MSM_DISPLAY_CAP_VID_MODE;
|
||||||
|
}
|
||||||
|
info->is_connected = hdmi_display->connected;
|
||||||
info->max_width = 1920;
|
info->max_width = 1920;
|
||||||
info->max_height = 1080;
|
info->max_height = 1080;
|
||||||
info->compression = MSM_DISPLAY_COMPRESS_NONE;
|
info->compression = MSM_DISPLAY_COMPRESS_NONE;
|
||||||
|
|
|
@ -71,6 +71,7 @@ struct sde_hdmi_ctrl {
|
||||||
* @non_pluggable: If HDMI display is non pluggable
|
* @non_pluggable: If HDMI display is non pluggable
|
||||||
* @num_of_modes: Number of modes supported by display if non pluggable.
|
* @num_of_modes: Number of modes supported by display if non pluggable.
|
||||||
* @mode_list: Mode list if non pluggable.
|
* @mode_list: Mode list if non pluggable.
|
||||||
|
* @connected: If HDMI display is connected.
|
||||||
* @is_tpg_enabled: TPG state.
|
* @is_tpg_enabled: TPG state.
|
||||||
* @hpd_work: HPD work structure.
|
* @hpd_work: HPD work structure.
|
||||||
* @root: Debug fs root entry.
|
* @root: Debug fs root entry.
|
||||||
|
@ -89,6 +90,7 @@ struct sde_hdmi {
|
||||||
bool non_pluggable;
|
bool non_pluggable;
|
||||||
u32 num_of_modes;
|
u32 num_of_modes;
|
||||||
struct list_head mode_list;
|
struct list_head mode_list;
|
||||||
|
bool connected;
|
||||||
bool is_tpg_enabled;
|
bool is_tpg_enabled;
|
||||||
|
|
||||||
struct work_struct hpd_work;
|
struct work_struct hpd_work;
|
||||||
|
|
|
@ -599,11 +599,12 @@ static int _sde_kms_setup_displays(struct drm_device *dev,
|
||||||
.mode_valid = sde_hdmi_mode_valid,
|
.mode_valid = sde_hdmi_mode_valid,
|
||||||
.get_info = sde_hdmi_get_info,
|
.get_info = sde_hdmi_get_info,
|
||||||
};
|
};
|
||||||
struct msm_display_info info;
|
struct msm_display_info info = {0};
|
||||||
struct drm_encoder *encoder;
|
struct drm_encoder *encoder;
|
||||||
void *display, *connector;
|
void *display, *connector;
|
||||||
int i, max_encoders;
|
int i, max_encoders;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
int connector_poll;
|
||||||
|
|
||||||
if (!dev || !priv || !sde_kms) {
|
if (!dev || !priv || !sde_kms) {
|
||||||
SDE_ERROR("invalid argument(s)\n");
|
SDE_ERROR("invalid argument(s)\n");
|
||||||
|
@ -720,7 +721,10 @@ static int _sde_kms_setup_displays(struct drm_device *dev,
|
||||||
SDE_ERROR("hdmi get_info %d failed\n", i);
|
SDE_ERROR("hdmi get_info %d failed\n", i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (info.capabilities & MSM_DISPLAY_CAP_HOT_PLUG)
|
||||||
|
connector_poll = DRM_CONNECTOR_POLL_HPD;
|
||||||
|
else
|
||||||
|
connector_poll = 0;
|
||||||
encoder = sde_encoder_init(dev, &info);
|
encoder = sde_encoder_init(dev, &info);
|
||||||
if (IS_ERR_OR_NULL(encoder)) {
|
if (IS_ERR_OR_NULL(encoder)) {
|
||||||
SDE_ERROR("encoder init failed for hdmi %d\n", i);
|
SDE_ERROR("encoder init failed for hdmi %d\n", i);
|
||||||
|
@ -739,7 +743,7 @@ static int _sde_kms_setup_displays(struct drm_device *dev,
|
||||||
0,
|
0,
|
||||||
display,
|
display,
|
||||||
&hdmi_ops,
|
&hdmi_ops,
|
||||||
DRM_CONNECTOR_POLL_HPD,
|
connector_poll,
|
||||||
DRM_MODE_CONNECTOR_HDMIA);
|
DRM_MODE_CONNECTOR_HDMIA);
|
||||||
if (connector) {
|
if (connector) {
|
||||||
priv->encoders[priv->num_encoders++] = encoder;
|
priv->encoders[priv->num_encoders++] = encoder;
|
||||||
|
|
Loading…
Add table
Reference in a new issue