diff --git a/msm/sde/sde_encoder_phys.h b/msm/sde/sde_encoder_phys.h index f620ba7bac..fa887a3f7f 100644 --- a/msm/sde/sde_encoder_phys.h +++ b/msm/sde/sde_encoder_phys.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2015-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2015-2020, The Linux Foundation. All rights reserved. */ #ifndef __SDE_ENCODER_PHYS_H__ @@ -693,6 +693,7 @@ static inline bool _sde_encoder_phys_is_dual_ctl( { struct sde_kms *sde_kms; enum sde_rm_topology_name topology; + const struct sde_rm_topology_def* def; if (!phys_enc) { pr_err("invalid phys_enc\n"); @@ -706,8 +707,13 @@ static inline bool _sde_encoder_phys_is_dual_ctl( } topology = sde_connector_get_topology_name(phys_enc->connector); + def = sde_rm_topology_get_topology_def(&sde_kms->rm, topology); + if (IS_ERR_OR_NULL(def)) { + pr_err("invalid topology\n"); + return false; + } - return sde_rm_topology_is_dual_ctl(&sde_kms->rm, topology); + return (def->num_ctl == 2) ? true : false; } /** diff --git a/msm/sde/sde_rm.h b/msm/sde/sde_rm.h index ea5a0e6a30..01d66dddaa 100644 --- a/msm/sde/sde_rm.h +++ b/msm/sde/sde_rm.h @@ -1,6 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* - * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ #ifndef __SDE_RM_H__ @@ -277,12 +277,15 @@ int sde_rm_update_topology(struct drm_connector_state *conn_state, struct msm_display_topology *topology); /** - * sde_rm_topology_is_dual_ctl - checks if topoloy requires two control paths + * sde_rm_topology_get_topology_def - returns the information about num + * of hw blocks used in this topology * @rm: SDE Resource Manager handle * @topology: topology selected for the display - * @return: true if two control paths are required or false + * @return: pointer to struct containing topology definition */ -static inline bool sde_rm_topology_is_dual_ctl(struct sde_rm *rm, +static inline const struct sde_rm_topology_def* + sde_rm_topology_get_topology_def( + struct sde_rm *rm, enum sde_rm_topology_name topology) { if ((!rm) || (topology <= SDE_RM_TOPOLOGY_NONE) || @@ -290,10 +293,10 @@ static inline bool sde_rm_topology_is_dual_ctl(struct sde_rm *rm, pr_err("invalid arguments: rm:%d topology:%d\n", rm == NULL, topology); - return false; + return ERR_PTR(-EINVAL); } - return rm->topology_tbl[topology].num_ctl == DUAL_CTL; + return &rm->topology_tbl[topology]; } /**