disp: msm: dp: change the detect callback to detect_ctx
The connector detect function is currently implemented as a callback from the framework, and creates a context before calling the detect_port_ctx MST callback. This change updates the callflow so that the framework calls the new detect_ctx function in the MST case. This removes the need for creating a new context before calling further downstream functions. In addition, references to the mst_connector_get_info function were replaced by connector_get_info to avoid redundancy. Change-Id: I224d09e77fad4b6925a42b1bc912a05e3e4d060a Signed-off-by: Sudarsan Ramesh <sudarame@codeaurora.org>
This commit is contained in:
@@ -816,16 +816,20 @@ static bool dp_display_send_hpd_event(struct dp_display_private *dp)
|
|||||||
char name[HPD_STRING_SIZE], status[HPD_STRING_SIZE],
|
char name[HPD_STRING_SIZE], status[HPD_STRING_SIZE],
|
||||||
bpp[HPD_STRING_SIZE], pattern[HPD_STRING_SIZE];
|
bpp[HPD_STRING_SIZE], pattern[HPD_STRING_SIZE];
|
||||||
char *envp[5];
|
char *envp[5];
|
||||||
|
struct dp_display *display;
|
||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
connector = dp->dp_display.base_connector;
|
connector = dp->dp_display.base_connector;
|
||||||
|
display = &dp->dp_display;
|
||||||
|
|
||||||
if (!connector) {
|
if (!connector) {
|
||||||
DP_ERR("connector not set\n");
|
DP_ERR("connector not set\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
connector->status = connector->funcs->detect(connector, false);
|
connector->status = display->is_sst_connected ? connector_status_connected :
|
||||||
|
connector_status_disconnected;
|
||||||
|
|
||||||
if (dp->cached_connector_status == connector->status) {
|
if (dp->cached_connector_status == connector->status) {
|
||||||
DP_DEBUG("connector status (%d) unchanged, skipping uevent\n",
|
DP_DEBUG("connector status (%d) unchanged, skipping uevent\n",
|
||||||
dp->cached_connector_status);
|
dp->cached_connector_status);
|
||||||
|
@@ -889,42 +889,33 @@ void dp_mst_drm_bridge_deinit(void *display)
|
|||||||
|
|
||||||
/* DP MST Connector OPs */
|
/* DP MST Connector OPs */
|
||||||
|
|
||||||
static enum drm_connector_status
|
static int
|
||||||
dp_mst_connector_detect(struct drm_connector *connector, bool force,
|
dp_mst_connector_detect(struct drm_connector *connector,
|
||||||
|
struct drm_modeset_acquire_ctx *ctx,
|
||||||
|
bool force,
|
||||||
void *display)
|
void *display)
|
||||||
{
|
{
|
||||||
struct sde_connector *c_conn = to_sde_connector(connector);
|
struct sde_connector *c_conn = to_sde_connector(connector);
|
||||||
struct dp_display *dp_display = c_conn->display;
|
struct dp_display *dp_display = c_conn->display;
|
||||||
struct dp_mst_private *mst = dp_display->dp_mst_prv_info;
|
struct dp_mst_private *mst = dp_display->dp_mst_prv_info;
|
||||||
struct dp_panel *dp_panel;
|
struct dp_panel *dp_panel;
|
||||||
struct drm_modeset_acquire_ctx ctx;
|
|
||||||
enum drm_connector_status status;
|
enum drm_connector_status status;
|
||||||
|
|
||||||
DP_MST_DEBUG("enter:\n");
|
DP_MST_DEBUG("enter:\n");
|
||||||
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_ENTRY);
|
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_ENTRY);
|
||||||
|
|
||||||
if (!c_conn->drv_panel || !c_conn->mst_port) {
|
|
||||||
DP_DEBUG("conn %d is invalid\n");
|
|
||||||
return connector_status_disconnected;
|
|
||||||
}
|
|
||||||
|
|
||||||
dp_panel = c_conn->drv_panel;
|
dp_panel = c_conn->drv_panel;
|
||||||
|
|
||||||
if (dp_panel->mst_hide)
|
if (dp_panel->mst_hide)
|
||||||
return connector_status_disconnected;
|
return connector_status_disconnected;
|
||||||
|
|
||||||
drm_modeset_acquire_init(&ctx, 0);
|
|
||||||
|
|
||||||
status = mst->mst_fw_cbs->detect_port_ctx(connector,
|
status = mst->mst_fw_cbs->detect_port_ctx(connector,
|
||||||
&ctx, &mst->mst_mgr, c_conn->mst_port);
|
ctx, &mst->mst_mgr, c_conn->mst_port);
|
||||||
|
|
||||||
DP_MST_INFO("conn:%d status:%d\n", connector->base.id, status);
|
DP_MST_INFO("conn:%d status:%d\n", connector->base.id, status);
|
||||||
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, connector->base.id, status);
|
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, connector->base.id, status);
|
||||||
|
|
||||||
drm_modeset_drop_locks(&ctx);
|
return (int)status;
|
||||||
drm_modeset_acquire_fini(&ctx);
|
|
||||||
|
|
||||||
return status;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dp_mst_clear_edid_cache(void *dp_display) {
|
void dp_mst_clear_edid_cache(void *dp_display) {
|
||||||
@@ -1086,34 +1077,6 @@ enum drm_mode_status dp_mst_connector_mode_valid(
|
|||||||
return dp_display->validate_mode(dp_display, dp_panel, mode, avail_res);
|
return dp_display->validate_mode(dp_display, dp_panel, mode, avail_res);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dp_mst_connector_get_info(struct drm_connector *connector,
|
|
||||||
struct msm_display_info *info,
|
|
||||||
void *display)
|
|
||||||
{
|
|
||||||
int rc;
|
|
||||||
enum drm_connector_status status = connector_status_unknown;
|
|
||||||
|
|
||||||
DP_MST_DEBUG("enter:\n");
|
|
||||||
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_ENTRY, connector->base.id);
|
|
||||||
|
|
||||||
rc = dp_connector_get_info(connector, info, display);
|
|
||||||
|
|
||||||
if (!rc) {
|
|
||||||
status = dp_mst_connector_detect(connector, false, display);
|
|
||||||
|
|
||||||
if (status == connector_status_connected)
|
|
||||||
info->is_connected = true;
|
|
||||||
else
|
|
||||||
info->is_connected = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
DP_MST_INFO("mst connector:%d status:%d, rc:%d\n",
|
|
||||||
connector->base.id, status, rc);
|
|
||||||
SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, connector->base.id);
|
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
|
||||||
|
|
||||||
int dp_mst_connector_get_mode_info(struct drm_connector *connector,
|
int dp_mst_connector_get_mode_info(struct drm_connector *connector,
|
||||||
const struct drm_display_mode *drm_mode,
|
const struct drm_display_mode *drm_mode,
|
||||||
struct msm_sub_mode *sub_mode,
|
struct msm_sub_mode *sub_mode,
|
||||||
@@ -1399,10 +1362,10 @@ dp_mst_add_connector(struct drm_dp_mst_topology_mgr *mgr,
|
|||||||
{
|
{
|
||||||
static const struct sde_connector_ops dp_mst_connector_ops = {
|
static const struct sde_connector_ops dp_mst_connector_ops = {
|
||||||
.post_init = dp_mst_connector_post_init,
|
.post_init = dp_mst_connector_post_init,
|
||||||
.detect = dp_mst_connector_detect,
|
.detect_ctx = dp_mst_connector_detect,
|
||||||
.get_modes = dp_mst_connector_get_modes,
|
.get_modes = dp_mst_connector_get_modes,
|
||||||
.mode_valid = dp_mst_connector_mode_valid,
|
.mode_valid = dp_mst_connector_mode_valid,
|
||||||
.get_info = dp_mst_connector_get_info,
|
.get_info = dp_connector_get_info,
|
||||||
.get_mode_info = dp_mst_connector_get_mode_info,
|
.get_mode_info = dp_mst_connector_get_mode_info,
|
||||||
.atomic_best_encoder = dp_mst_atomic_best_encoder,
|
.atomic_best_encoder = dp_mst_atomic_best_encoder,
|
||||||
.atomic_check = dp_mst_connector_atomic_check,
|
.atomic_check = dp_mst_connector_atomic_check,
|
||||||
@@ -1477,8 +1440,10 @@ dp_mst_add_connector(struct drm_dp_mst_topology_mgr *mgr,
|
|||||||
return connector;
|
return connector;
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum drm_connector_status
|
static int
|
||||||
dp_mst_fixed_connector_detect(struct drm_connector *connector, bool force,
|
dp_mst_fixed_connector_detect(struct drm_connector *connector,
|
||||||
|
struct drm_modeset_acquire_ctx *ctx,
|
||||||
|
bool force,
|
||||||
void *display)
|
void *display)
|
||||||
{
|
{
|
||||||
struct dp_display *dp_display = display;
|
struct dp_display *dp_display = display;
|
||||||
@@ -1492,10 +1457,10 @@ dp_mst_fixed_connector_detect(struct drm_connector *connector, bool force,
|
|||||||
if (!mst->mst_bridge[i].fixed_port_added)
|
if (!mst->mst_bridge[i].fixed_port_added)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
return dp_mst_connector_detect(connector, force, display);
|
return dp_mst_connector_detect(connector, ctx, force, display);
|
||||||
}
|
}
|
||||||
|
|
||||||
return connector_status_disconnected;
|
return (int)connector_status_disconnected;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct drm_encoder *
|
static struct drm_encoder *
|
||||||
@@ -1672,10 +1637,10 @@ dp_mst_drm_fixed_connector_init(struct dp_display *dp_display,
|
|||||||
{
|
{
|
||||||
static const struct sde_connector_ops dp_mst_connector_ops = {
|
static const struct sde_connector_ops dp_mst_connector_ops = {
|
||||||
.post_init = dp_mst_connector_post_init,
|
.post_init = dp_mst_connector_post_init,
|
||||||
.detect = dp_mst_fixed_connector_detect,
|
.detect_ctx = dp_mst_fixed_connector_detect,
|
||||||
.get_modes = dp_mst_connector_get_modes,
|
.get_modes = dp_mst_connector_get_modes,
|
||||||
.mode_valid = dp_mst_connector_mode_valid,
|
.mode_valid = dp_mst_connector_mode_valid,
|
||||||
.get_info = dp_mst_connector_get_info,
|
.get_info = dp_connector_get_info,
|
||||||
.get_mode_info = dp_mst_connector_get_mode_info,
|
.get_mode_info = dp_mst_connector_get_mode_info,
|
||||||
.atomic_best_encoder = dp_mst_fixed_atomic_best_encoder,
|
.atomic_best_encoder = dp_mst_fixed_atomic_best_encoder,
|
||||||
.atomic_check = dp_mst_connector_atomic_check,
|
.atomic_check = dp_mst_connector_atomic_check,
|
||||||
|
@@ -1823,8 +1823,10 @@ static void sde_connector_update_colorspace(struct drm_connector *connector)
|
|||||||
SDE_ERROR("failed to set colorspace property for connector\n");
|
SDE_ERROR("failed to set colorspace property for connector\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
static enum drm_connector_status
|
static int
|
||||||
sde_connector_detect(struct drm_connector *connector, bool force)
|
sde_connector_detect_ctx(struct drm_connector *connector,
|
||||||
|
struct drm_modeset_acquire_ctx *ctx,
|
||||||
|
bool force)
|
||||||
{
|
{
|
||||||
enum drm_connector_status status = connector_status_unknown;
|
enum drm_connector_status status = connector_status_unknown;
|
||||||
struct sde_connector *c_conn;
|
struct sde_connector *c_conn;
|
||||||
@@ -1836,12 +1838,14 @@ sde_connector_detect(struct drm_connector *connector, bool force)
|
|||||||
|
|
||||||
c_conn = to_sde_connector(connector);
|
c_conn = to_sde_connector(connector);
|
||||||
|
|
||||||
if (c_conn->ops.detect)
|
if (c_conn->ops.detect_ctx)
|
||||||
status = c_conn->ops.detect(connector,
|
status = c_conn->ops.detect_ctx(connector, ctx, force, c_conn->display);
|
||||||
force,
|
else if (c_conn->ops.detect)
|
||||||
c_conn->display);
|
status = c_conn->ops.detect(connector, force, c_conn->display);
|
||||||
|
|
||||||
return status;
|
SDE_DEBUG("connector id: %d, connection status: %d\n", connector->base.id, status);
|
||||||
|
|
||||||
|
return (int)status;
|
||||||
}
|
}
|
||||||
|
|
||||||
int sde_connector_get_dpms(struct drm_connector *connector)
|
int sde_connector_get_dpms(struct drm_connector *connector)
|
||||||
@@ -2423,7 +2427,6 @@ static int sde_connector_fill_modes(struct drm_connector *connector,
|
|||||||
|
|
||||||
static const struct drm_connector_funcs sde_connector_ops = {
|
static const struct drm_connector_funcs sde_connector_ops = {
|
||||||
.reset = sde_connector_atomic_reset,
|
.reset = sde_connector_atomic_reset,
|
||||||
.detect = sde_connector_detect,
|
|
||||||
.destroy = sde_connector_destroy,
|
.destroy = sde_connector_destroy,
|
||||||
.fill_modes = sde_connector_fill_modes,
|
.fill_modes = sde_connector_fill_modes,
|
||||||
.atomic_duplicate_state = sde_connector_atomic_duplicate_state,
|
.atomic_duplicate_state = sde_connector_atomic_duplicate_state,
|
||||||
@@ -2689,6 +2692,7 @@ static void sde_connector_check_status_work(struct work_struct *work)
|
|||||||
|
|
||||||
static const struct drm_connector_helper_funcs sde_connector_helper_ops = {
|
static const struct drm_connector_helper_funcs sde_connector_helper_ops = {
|
||||||
.get_modes = sde_connector_get_modes,
|
.get_modes = sde_connector_get_modes,
|
||||||
|
.detect_ctx = sde_connector_detect_ctx,
|
||||||
.mode_valid = sde_connector_mode_valid,
|
.mode_valid = sde_connector_mode_valid,
|
||||||
.best_encoder = sde_connector_best_encoder,
|
.best_encoder = sde_connector_best_encoder,
|
||||||
.atomic_check = sde_connector_atomic_check,
|
.atomic_check = sde_connector_atomic_check,
|
||||||
@@ -2696,6 +2700,7 @@ static const struct drm_connector_helper_funcs sde_connector_helper_ops = {
|
|||||||
|
|
||||||
static const struct drm_connector_helper_funcs sde_connector_helper_ops_v2 = {
|
static const struct drm_connector_helper_funcs sde_connector_helper_ops_v2 = {
|
||||||
.get_modes = sde_connector_get_modes,
|
.get_modes = sde_connector_get_modes,
|
||||||
|
.detect_ctx = sde_connector_detect_ctx,
|
||||||
.mode_valid = sde_connector_mode_valid,
|
.mode_valid = sde_connector_mode_valid,
|
||||||
.best_encoder = sde_connector_best_encoder,
|
.best_encoder = sde_connector_best_encoder,
|
||||||
.atomic_best_encoder = sde_connector_atomic_best_encoder,
|
.atomic_best_encoder = sde_connector_atomic_best_encoder,
|
||||||
|
@@ -60,6 +60,19 @@ struct sde_connector_ops {
|
|||||||
bool force,
|
bool force,
|
||||||
void *display);
|
void *display);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* detect_ctx - determine if connector is connected
|
||||||
|
* @connector: Pointer to drm connector structure
|
||||||
|
* @ctx: Pointer to drm modeset acquire context structure
|
||||||
|
* @force: Force detect setting from drm framework
|
||||||
|
* @display: Pointer to private display handle
|
||||||
|
* Returns: Connector 'is connected' status
|
||||||
|
*/
|
||||||
|
int (*detect_ctx)(struct drm_connector *connector,
|
||||||
|
struct drm_modeset_acquire_ctx *ctx,
|
||||||
|
bool force,
|
||||||
|
void *display);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* get_modes - add drm modes via drm_mode_probed_add()
|
* get_modes - add drm modes via drm_mode_probed_add()
|
||||||
* @connector: Pointer to drm connector structure
|
* @connector: Pointer to drm connector structure
|
||||||
|
Reference in New Issue
Block a user