From d5dd61b0117df3803646e62335a3f641432507be Mon Sep 17 00:00:00 2001 From: Mahadevan Date: Fri, 16 Sep 2022 10:41:56 +0530 Subject: [PATCH 1/3] disp: msm: sde: fix min ib vote in mnoc and ebi_ib path This change sets proper minimum vote for lcc_mnoc and ebi_ib path. Change-Id: Idbb8667a7416e359e848d3f4dc266531979639d3 Signed-off-by: Mahadevan --- msm/sde/sde_kms.c | 6 ++++-- msm/sde_power_handle.c | 47 +++++++++++++++--------------------------- msm/sde_power_handle.h | 15 ++------------ 3 files changed, 23 insertions(+), 45 deletions(-) diff --git a/msm/sde/sde_kms.c b/msm/sde/sde_kms.c index e626561eba0d..534aafd834e2 100644 --- a/msm/sde/sde_kms.c +++ b/msm/sde/sde_kms.c @@ -1240,12 +1240,14 @@ static void _sde_kms_release_splash_resource(struct sde_kms *sde_kms, { struct msm_drm_private *priv; struct sde_splash_display *splash_display; + struct sde_power_handle *phandle; int i; if (!sde_kms || !crtc) return; priv = sde_kms->dev->dev_private; + phandle = &priv->phandle; if (!crtc->state->active || !sde_kms->splash_data.num_splash_displays) return; @@ -1272,9 +1274,9 @@ static void _sde_kms_release_splash_resource(struct sde_kms *sde_kms, /* remove the votes if all displays are done with splash */ if (!sde_kms->splash_data.num_splash_displays) { for (i = 0; i < SDE_POWER_HANDLE_DBUS_ID_MAX; i++) - sde_power_data_bus_set_quota(&priv->phandle, i, + sde_power_data_bus_set_quota(phandle, i, SDE_POWER_HANDLE_ENABLE_BUS_AB_QUOTA, - SDE_POWER_HANDLE_ENABLE_BUS_IB_QUOTA); + phandle->ib_quota[i]); pm_runtime_put_sync(sde_kms->dev->dev); } diff --git a/msm/sde_power_handle.c b/msm/sde_power_handle.c index e17000a8ee23..26c4ce67ee42 100644 --- a/msm/sde_power_handle.c +++ b/msm/sde_power_handle.c @@ -473,21 +473,24 @@ static void sde_power_parse_ib_votes(struct platform_device *pdev, if (rc) pr_err("error reading min core ib vote. rc=%d, np=%x\n", rc, pdev->dev.of_node); - phandle->min_ib_vote.min_core_ib = (!rc ? tmp*1000 : 0); + phandle->ib_quota[SDE_POWER_HANDLE_DBUS_ID_MNOC] = (!rc ? tmp*1000 : + SDE_POWER_HANDLE_ENABLE_BUS_IB_QUOTA); rc = of_property_read_u32(pdev->dev.of_node, "qcom,sde-min-llcc-ib-kbps", &tmp); if (rc) pr_err("error reading min llcc ib vote. rc=%d\n", rc); - phandle->min_ib_vote.min_llcc_ib = (!rc ? tmp*1000 : 0); + phandle->ib_quota[SDE_POWER_HANDLE_DBUS_ID_LLCC] = (!rc ? tmp*1000 : + SDE_POWER_HANDLE_ENABLE_BUS_IB_QUOTA); rc = of_property_read_u32(pdev->dev.of_node, "qcom,sde-min-dram-ib-kbps", &tmp); if (rc) pr_err("error reading min dram ib vote. rc=%d\n", rc); - phandle->min_ib_vote.min_dram_ib = (!rc ? tmp*1000 : 0); + phandle->ib_quota[SDE_POWER_HANDLE_DBUS_ID_EBI] = (!rc ? tmp*1000 : + SDE_POWER_HANDLE_ENABLE_BUS_IB_QUOTA); } static int sde_power_bus_parse(struct platform_device *pdev, @@ -732,7 +735,6 @@ int sde_power_resource_enable(struct sde_power_handle *phandle, bool enable) { int rc = 0, i = 0; struct dss_module_power *mp; - u32 bus_ib_quota = 0; if (!phandle) { pr_err("invalid input argument\n"); @@ -754,32 +756,17 @@ int sde_power_resource_enable(struct sde_power_handle *phandle, bool enable) sde_power_event_trigger_locked(phandle, SDE_POWER_EVENT_PRE_ENABLE); - for (i = 0; i < SDE_POWER_HANDLE_DBUS_ID_MAX && - phandle->data_bus_handle[i].data_paths_cnt > 0; i++) { - - bus_ib_quota = 0; - switch (i) { - case SDE_POWER_HANDLE_DBUS_ID_MNOC: - bus_ib_quota = - phandle->min_ib_vote.min_core_ib; - break; - case SDE_POWER_HANDLE_DBUS_ID_LLCC: - bus_ib_quota = - phandle->min_ib_vote.min_llcc_ib; - break; - case SDE_POWER_HANDLE_DBUS_ID_EBI: - bus_ib_quota = - phandle->min_ib_vote.min_dram_ib; - } - - rc = _sde_power_data_bus_set_quota( - &phandle->data_bus_handle[i], - SDE_POWER_HANDLE_ENABLE_BUS_AB_QUOTA, - bus_ib_quota); - if (rc) { - pr_err("failed to set data bus vote id=%d rc=%d\n", - i, rc); - goto vreg_err; + for (i = 0; i < SDE_POWER_HANDLE_DBUS_ID_MAX; i++) { + if (phandle->data_bus_handle[i].data_paths_cnt > 0) { + rc = _sde_power_data_bus_set_quota( + &phandle->data_bus_handle[i], + SDE_POWER_HANDLE_ENABLE_BUS_AB_QUOTA, + phandle->ib_quota[i]); + if (rc) { + pr_err("failed to set data bus vote id=%d rc=%d\n", + i, rc); + goto vreg_err; + } } } rc = msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg, diff --git a/msm/sde_power_handle.h b/msm/sde_power_handle.h index 5eff752dfcaf..ac8c81df7330 100644 --- a/msm/sde_power_handle.h +++ b/msm/sde_power_handle.h @@ -126,18 +126,6 @@ struct sde_power_reg_bus_handle { struct sde_power_bus_scaling_data scale_table[VOTE_INDEX_MAX]; }; -/** - * struct sde_min_ib_vote: ib votes on data bus - * @min_core_ib: ib vote on mnoc - * @min_llcc_ib: ib vote on llcc - * @min_dram_ib: ib vote on dram - */ -struct sde_min_ib_vote { - u32 min_core_ib; - u32 min_llcc_ib; - u32 min_dram_ib; -}; - /* * struct sde_power_event - local event registration structure * @client_name: name of the client registering @@ -166,6 +154,7 @@ struct sde_power_event { * @event_list: current power handle event list * @rsc_client: sde rsc client pointer * @rsc_client_init: boolean to control rsc client create + * @ib_quota: ib quota of the given bus */ struct sde_power_handle { struct dss_module_power mp; @@ -178,7 +167,7 @@ struct sde_power_handle { u32 last_event_handled; struct sde_rsc_client *rsc_client; bool rsc_client_init; - struct sde_min_ib_vote min_ib_vote; + u64 ib_quota[SDE_POWER_HANDLE_DBUS_ID_MAX]; }; /** From 25edb2950dd2ead5b0b9a30ec77cb63254f7dc48 Mon Sep 17 00:00:00 2001 From: Soutrik Mukhopadhyay Date: Fri, 6 Nov 2020 16:33:02 +0800 Subject: [PATCH 2/3] drm: msm: remove YUV format setting Remove the YUV format setting, will use the upstream code for YUV mode check. Change-Id: I24f059ff7cd4cf64f41d7f77bfa6517df0cccfde Signed-off-by: Zhao, Yuan Signed-off-by: Soutrik Mukhopadhyay --- msm/sde_edid_parser.c | 198 +----------------------------------------- 1 file changed, 1 insertion(+), 197 deletions(-) diff --git a/msm/sde_edid_parser.c b/msm/sde_edid_parser.c index 2de3ce60d17f..7903987d343a 100644 --- a/msm/sde_edid_parser.c +++ b/msm/sde_edid_parser.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2017-2020, The Linux Foundation. All rights reserved. + * Copyright (c) 2020, Qualcomm Innovation Center, Inc. All rights reserved. */ #include @@ -102,63 +103,6 @@ static bool sde_cea_db_is_hdmi_hf_vsdb(const u8 *db) return hdmi_id == HDMI_FORUM_IEEE_OUI; } -static u8 *sde_edid_find_extended_tag_block(struct edid *edid, int blk_id) -{ - u8 *db = NULL; - u8 *cea = NULL; - - if (!edid) { - SDE_ERROR("%s: invalid input\n", __func__); - return NULL; - } - - cea = sde_find_cea_extension(edid); - - if (cea && sde_cea_revision(cea) >= 3) { - int i, start, end; - - if (sde_cea_db_offsets(cea, &start, &end)) - return NULL; - - sde_for_each_cea_db(cea, i, start, end) { - db = &cea[i]; - if ((sde_cea_db_tag(db) == SDE_EXTENDED_TAG) && - (db[1] == blk_id)) - return db; - } - } - return NULL; -} - -static u8 * -sde_edid_find_block(struct edid *edid, int blk_id) -{ - u8 *db = NULL; - u8 *cea = NULL; - - if (!edid) { - SDE_ERROR("%s: invalid input\n", __func__); - return NULL; - } - - cea = sde_find_cea_extension(edid); - - if (cea && sde_cea_revision(cea) >= 3) { - int i, start, end; - - if (sde_cea_db_offsets(cea, &start, &end)) - return NULL; - - sde_for_each_cea_db(cea, i, start, end) { - db = &cea[i]; - if (sde_cea_db_tag(db) == blk_id) - return db; - } - } - return NULL; -} - - static const u8 *_sde_edid_find_block(const u8 *in_buf, u32 start_offset, u8 type, u8 *len) { @@ -219,145 +163,6 @@ static void sde_edid_extract_vendor_id(struct sde_edid_ctrl *edid_ctrl) SDE_EDID_DEBUG("%s -", __func__); } -static void sde_edid_set_y420_support(struct drm_connector *connector, -u32 video_format) -{ - u8 cea_mode = 0; - struct drm_display_mode *mode; - u32 mode_fmt_flags = 0; - - /* Need to add Y420 support flag to the modes */ - list_for_each_entry(mode, &connector->probed_modes, head) { - /* Cache the format flags before clearing */ - mode_fmt_flags = mode->flags; - /* Clear the RGB/YUV format flags before calling upstream API */ - mode->flags &= ~SDE_DRM_MODE_FLAG_FMT_MASK; - cea_mode = drm_match_cea_mode(mode); - /* Restore the format flags */ - mode->flags = mode_fmt_flags; - if ((cea_mode != 0) && (cea_mode == video_format)) { - SDE_EDID_DEBUG("%s found match for %d ", __func__, - video_format); - mode->flags |= DRM_MODE_FLAG_SUPPORTS_YUV; - } - } -} - -static void sde_edid_parse_Y420CMDB( -struct drm_connector *connector, struct sde_edid_ctrl *edid_ctrl, -const u8 *db) -{ - u32 offset = 0; - u8 cmdb_len = 0; - u8 svd_len = 0; - const u8 *svd = NULL; - u32 i = 0, j = 0; - u32 video_format = 0; - - if (!edid_ctrl) { - SDE_ERROR("%s: edid_ctrl is NULL\n", __func__); - return; - } - - if (!db) { - SDE_ERROR("%s: invalid input\n", __func__); - return; - } - SDE_EDID_DEBUG("%s +\n", __func__); - cmdb_len = db[0] & 0x1f; - - /* Byte 3 to L+1 contain SVDs */ - offset += 2; - - svd = sde_edid_find_block(edid_ctrl->edid, VIDEO_DATA_BLOCK); - - if (svd) { - /*moving to the next byte as vic info begins there*/ - svd_len = svd[0] & 0x1f; - ++svd; - } - - for (i = 0; i < svd_len; i++, j++) { - video_format = *(svd + i) & 0x7F; - if (cmdb_len == 1) { - /* If cmdb_len is 1, it means all SVDs support YUV */ - sde_edid_set_y420_support(connector, video_format); - } else if (db[offset] & (1 << j)) { - sde_edid_set_y420_support(connector, video_format); - - if (j & 0x80) { - j = j/8; - offset++; - if (offset >= cmdb_len) - break; - } - } - } - - SDE_EDID_DEBUG("%s -\n", __func__); - -} - -static void sde_edid_parse_Y420VDB( -struct drm_connector *connector, struct sde_edid_ctrl *edid_ctrl, -const u8 *db) -{ - u8 len = db[0] & 0x1f; - u32 i = 0; - u32 video_format = 0; - - if (!edid_ctrl) { - SDE_ERROR("%s: invalid input\n", __func__); - return; - } - - SDE_EDID_DEBUG("%s +\n", __func__); - - /* Offset to byte 3 */ - db += 2; - for (i = 0; i < len - 1; i++) { - video_format = *(db + i) & 0x7F; - /* - * mode was already added in get_modes() - * only need to set the Y420 support flag - */ - sde_edid_set_y420_support(connector, video_format); - } - SDE_EDID_DEBUG("%s -", __func__); -} - -static void sde_edid_set_mode_format( -struct drm_connector *connector, struct sde_edid_ctrl *edid_ctrl) -{ - const u8 *db = NULL; - struct drm_display_mode *mode; - - SDE_EDID_DEBUG("%s +\n", __func__); - /* Set YUV mode support flags for YCbcr420VDB */ - db = sde_edid_find_extended_tag_block(edid_ctrl->edid, - Y420_VIDEO_DATA_BLOCK); - if (db) - sde_edid_parse_Y420VDB(connector, edid_ctrl, db); - else - SDE_EDID_DEBUG("YCbCr420 VDB is not present\n"); - - /* Set RGB supported on all modes where YUV is not set */ - list_for_each_entry(mode, &connector->probed_modes, head) { - if (!(mode->flags & DRM_MODE_FLAG_SUPPORTS_YUV)) - mode->flags |= DRM_MODE_FLAG_SUPPORTS_RGB; - } - - - db = sde_edid_find_extended_tag_block(edid_ctrl->edid, - Y420_CAPABILITY_MAP_DATA_BLOCK); - if (db) - sde_edid_parse_Y420CMDB(connector, edid_ctrl, db); - else - SDE_EDID_DEBUG("YCbCr420 CMDB is not present\n"); - - SDE_EDID_DEBUG("%s -\n", __func__); -} - static void _sde_edid_update_dc_modes( struct drm_connector *connector, struct sde_edid_ctrl *edid_ctrl) { @@ -729,7 +534,6 @@ int _sde_edid_update_modes(struct drm_connector *connector, edid_ctrl->edid); rc = drm_add_edid_modes(connector, edid_ctrl->edid); - sde_edid_set_mode_format(connector, edid_ctrl); _sde_edid_update_dc_modes(connector, edid_ctrl); sde_edid_parse_extended_blk_info(connector, edid_ctrl->edid); From 31a6cf6c8ba74ca2eee319a4529d7cd3d388dece Mon Sep 17 00:00:00 2001 From: Srihitha Tangudu Date: Thu, 22 Sep 2022 19:18:48 +0530 Subject: [PATCH 3/3] disp: msm: dsi: clear the panel esd_recovery_pending in power on commit Currently the panel esd_recovery_pending flag is cleared for every mode set. The ESD recovery completes only after the suspend and resume. Clear the flag only during power on commit. Change-Id: I97e370feba0aad34558e4675168b4bcb7f5901ca Signed-off-by: Srihitha Tangudu --- msm/dsi/dsi_drm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/msm/dsi/dsi_drm.c b/msm/dsi/dsi_drm.c index 64549d570428..8b6db3d58d65 100644 --- a/msm/dsi/dsi_drm.c +++ b/msm/dsi/dsi_drm.c @@ -179,7 +179,8 @@ static void dsi_bridge_pre_enable(struct drm_bridge *bridge) return; } - atomic_set(&c_bridge->display->panel->esd_recovery_pending, 0); + if (bridge->encoder->crtc->state->active_changed) + atomic_set(&c_bridge->display->panel->esd_recovery_pending, 0); /* By this point mode should have been validated through mode_fixup */ rc = dsi_display_set_mode(c_bridge->display,