diff --git a/msm/sde_power_handle.c b/msm/sde_power_handle.c index 88d945bc3e11..e17000a8ee23 100644 --- a/msm/sde_power_handle.c +++ b/msm/sde_power_handle.c @@ -1,5 +1,6 @@ // SPDX-License-Identifier: GPL-2.0-only /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2014-2021, The Linux Foundation. All rights reserved. */ @@ -455,6 +456,40 @@ static int sde_power_mnoc_bus_parse(struct platform_device *pdev, return rc; } +static void sde_power_parse_ib_votes(struct platform_device *pdev, + struct sde_power_handle *phandle) +{ + int rc = 0; + u32 tmp = 0; + + if (!pdev || !phandle) { + pr_err("invalid input param pdev:%pK phandle:%pK\n", pdev, + phandle); + return; + } + + rc = of_property_read_u32(pdev->dev.of_node, + "qcom,sde-min-core-ib-kbps", &tmp); + 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); + + 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); + + 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); +} + static int sde_power_bus_parse(struct platform_device *pdev, struct sde_power_handle *phandle) { @@ -599,6 +634,8 @@ int sde_power_resource_init(struct platform_device *pdev, goto bus_err; } + sde_power_parse_ib_votes(pdev, phandle); + INIT_LIST_HEAD(&phandle->event_list); phandle->rsc_client = NULL; @@ -695,6 +732,7 @@ 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"); @@ -718,10 +756,26 @@ int sde_power_resource_enable(struct sde_power_handle *phandle, bool 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, - SDE_POWER_HANDLE_ENABLE_BUS_IB_QUOTA); + bus_ib_quota); if (rc) { pr_err("failed to set data bus vote id=%d rc=%d\n", i, rc); diff --git a/msm/sde_power_handle.h b/msm/sde_power_handle.h index 4273308c9268..5eff752dfcaf 100644 --- a/msm/sde_power_handle.h +++ b/msm/sde_power_handle.h @@ -1,5 +1,6 @@ /* SPDX-License-Identifier: GPL-2.0-only */ /* + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved. * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ @@ -125,6 +126,18 @@ 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 @@ -165,6 +178,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; }; /**