From patchwork Thu Jun 28 20:53:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Paul X-Patchwork-Id: 10495215 X-Patchwork-Delegate: agross@codeaurora.org Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 65CAD60230 for ; Thu, 28 Jun 2018 20:53:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 579852A5A3 for ; Thu, 28 Jun 2018 20:53:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4C1192A5AF; Thu, 28 Jun 2018 20:53:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DDFA02A5A3 for ; Thu, 28 Jun 2018 20:53:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935180AbeF1Uxj (ORCPT ); Thu, 28 Jun 2018 16:53:39 -0400 Received: from mail-yw0-f193.google.com ([209.85.161.193]:44045 "EHLO mail-yw0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934003AbeF1Uxi (ORCPT ); Thu, 28 Jun 2018 16:53:38 -0400 Received: by mail-yw0-f193.google.com with SMTP id k18-v6so2644626ywm.11 for ; Thu, 28 Jun 2018 13:53:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZqsVJig87P4U8KYdshLzHAk1Zkd0ipX46dqxgQ6dYjU=; b=KMFoh/6C/6rz7DqEx+YlDJdl0sAvvOxqqPB7Z2AjNslsGS3TbHzepEWQbypGzqAvp3 CmhbpjLvOUukYwV/FJojhZrALdJ5gP4tcDJZJftWF9uhJdgwuNsClwknsF7PY/YjNML0 S/MvDoY39NHAeETS17dpaM6xTgzBNyfktulwg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ZqsVJig87P4U8KYdshLzHAk1Zkd0ipX46dqxgQ6dYjU=; b=miMuESclb42y0K17f/20ALzWqsq8obeFyqUP2hPIwN6IGZtf2bd75hNqwTkwJfg6Gh XCUGxQJ+nKnmJLK/AfhAFrscR+hwHQtPcQj88WMJ+NAJ0P4AbEYrPj1TW1MYDOZRpyY2 eOjQBfa2Z4vOyJRulTSBHpTG6GMpyZM9YINopSyW+T+AdNwJm5eWJRpli3ij6qn3Lql9 ANoiM49V1wnJCCLmVrCb+CKATSo3e7888gaePiHHvTcFYlYtPcHhhIYZlJ8GyZVVeFPR Avs/z0Iu9xFndSJOLNsDs5pUVcmUjHd38bc1L0fdtrSIuQgcGREFMwkeAVxTNrBRgojl e3xg== X-Gm-Message-State: APt69E2oQ7MWPUdlFlDZjhcSGWPnyDx7BTw6wOxXtFx02JYtxe42r9jK 6j2SkSfShUB0UxjeXcicDd/Mug== X-Google-Smtp-Source: AAOMgpcMEBcpWC8YNC6B9SYlFYQFc4jtkLn0exI+C2vnFZ4SBmd6vIAyxFBOHO4G6WUHxW8deYhkiA== X-Received: by 2002:a0d:f783:: with SMTP id h125-v6mr5702727ywf.272.1530219217759; Thu, 28 Jun 2018 13:53:37 -0700 (PDT) Received: from rosewood.cam.corp.google.com ([2620:0:1013:11:ad55:b1db:adfe:3b9f]) by smtp.gmail.com with ESMTPSA id 199-v6sm2982681ywh.95.2018.06.28.13.53.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 28 Jun 2018 13:53:37 -0700 (PDT) From: Sean Paul To: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Cc: robdclark@gmail.com, hoegsberg@chromium.org, jsanka@codeaurora.org, abhinavk@codeaurora.org, Sean Paul Subject: [DPU PATCH 3/6] drm/msm: Remove dpu bus scaling code Date: Thu, 28 Jun 2018 16:53:31 -0400 Message-Id: <20180628205334.158846-4-seanpaul@chromium.org> X-Mailer: git-send-email 2.18.0.399.gad0ab374a1-goog In-Reply-To: <20180628205334.158846-1-seanpaul@chromium.org> References: <20180628205334.158846-1-seanpaul@chromium.org> Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP QC bus scaling isn't upstream yet, so remove the bus scaling code until it is. Signed-off-by: Sean Paul --- drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c | 35 -- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 7 +- .../gpu/drm/msm/disp/dpu1/dpu_power_handle.c | 522 +----------------- .../gpu/drm/msm/disp/dpu1/dpu_power_handle.h | 65 +-- 4 files changed, 4 insertions(+), 625 deletions(-) diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c index 1019ce7594ff..41c5191f9056 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_core_perf.c @@ -221,7 +221,6 @@ int dpu_core_perf_crtc_check(struct drm_crtc *crtc, static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, struct drm_crtc *crtc, u32 bus_id) { - u64 bw_sum_of_intfs = 0, bus_ab_quota, bus_ib_quota; struct dpu_core_perf_params perf = { { 0 } }; enum dpu_crtc_client_type curr_client_type = dpu_crtc_get_client_type(crtc); @@ -239,45 +238,11 @@ static int _dpu_core_perf_crtc_update_bus(struct dpu_kms *kms, max(perf.max_per_pipe_ib[bus_id], dpu_cstate->new_perf.max_per_pipe_ib[bus_id]); - bw_sum_of_intfs += dpu_cstate->new_perf.bw_ctl[bus_id]; - DPU_DEBUG("crtc=%d bus_id=%d bw=%llu\n", tmp_crtc->base.id, bus_id, dpu_cstate->new_perf.bw_ctl[bus_id]); } } - - bus_ab_quota = max(bw_sum_of_intfs, kms->perf.perf_tune.min_bus_vote); - bus_ib_quota = perf.max_per_pipe_ib[bus_id]; - - if (kms->perf.perf_tune.mode == DPU_PERF_MODE_FIXED) { - bus_ab_quota = kms->perf.fix_core_ab_vote; - bus_ib_quota = kms->perf.fix_core_ib_vote; - } - - switch (curr_client_type) { - case NRT_CLIENT: - ret = dpu_power_data_bus_set_quota( - &kms->phandle, kms->core_client, - DPU_POWER_HANDLE_DATA_BUS_CLIENT_NRT, - bus_id, bus_ab_quota, bus_ib_quota); - DPU_DEBUG("client:%s bus_id=%d ab=%llu ib=%llu\n", "nrt", - bus_id, bus_ab_quota, bus_ib_quota); - break; - - case RT_CLIENT: - ret = dpu_power_data_bus_set_quota( - &kms->phandle, kms->core_client, - DPU_POWER_HANDLE_DATA_BUS_CLIENT_RT, - bus_id, bus_ab_quota, bus_ib_quota); - DPU_DEBUG("client:%s bus_id=%d ab=%llu ib=%llu\n", "rt", - bus_id, bus_ab_quota, bus_ib_quota); - break; - - default: - DPU_ERROR("invalid client type:%d\n", curr_client_type); - break; - } return ret; } diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index 3889e4a7dfbc..605da85bb53f 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -1265,11 +1265,7 @@ static int dpu_bind(struct device *dev, struct device *master, void *data) goto clk_rate_error; } - ret = dpu_power_resource_init(pdev, &dpu_kms->phandle); - if (ret) { - pr_err("dpu power resource init failed\n"); - goto power_init_fail; - } + dpu_power_resource_init(pdev, &dpu_kms->phandle); platform_set_drvdata(pdev, dpu_kms); @@ -1283,7 +1279,6 @@ static int dpu_bind(struct device *dev, struct device *master, void *data) priv->kms = &dpu_kms->base; return ret; -power_init_fail: clk_rate_error: msm_dss_put_clk(mp->clk_config, mp->num_clk); clk_get_error: diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c index f997bd9e109c..a68f1249388c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c @@ -24,132 +24,6 @@ #include "dpu_power_handle.h" #include "dpu_trace.h" -#ifdef CONFIG_QCOM_BUS_SCALING -#include -#include - -#define DPU_BUS_VECTOR_ENTRY(src_val, dst_val, ab_val, ib_val) \ - { \ - .src = src_val, \ - .dst = dst_val, \ - .ab = (ab_val), \ - .ib = (ib_val), \ - } - -static struct msm_bus_vectors dpu_reg_bus_vectors[] = { - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_FIRST, - MSM_BUS_SLAVE_DISPLAY_CFG, 0, 0), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_FIRST, - MSM_BUS_SLAVE_DISPLAY_CFG, 0, 76800000), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_FIRST, - MSM_BUS_SLAVE_DISPLAY_CFG, 0, 150000000), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_FIRST, - MSM_BUS_SLAVE_DISPLAY_CFG, 0, 300000000), -}; - -static struct msm_bus_paths dpu_reg_bus_usecases[] = { { - .num_paths = 1, - .vectors = &dpu_reg_bus_vectors[0], -}, { - .num_paths = 1, - .vectors = &dpu_reg_bus_vectors[1], -}, { - .num_paths = 1, - .vectors = &dpu_reg_bus_vectors[2], -}, { - .num_paths = 1, - .vectors = &dpu_reg_bus_vectors[3], -} }; - -static struct msm_bus_scale_pdata dpu_reg_bus_scale_table = { - .usecase = dpu_reg_bus_usecases, - .num_usecases = ARRAY_SIZE(dpu_reg_bus_usecases), - .name = "mdss_reg", -}; - -static struct msm_bus_vectors dpu_data_bus_vectors[] = { - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_MDP_PORT0, - MSM_BUS_SLAVE_MNOC_HF_MEM_NOC, 0, 0), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_MDP_PORT1, - MSM_BUS_SLAVE_MNOC_HF_MEM_NOC, 0, 0), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_MDP_PORT0, - MSM_BUS_SLAVE_MNOC_HF_MEM_NOC, 0, 6400000000), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_MDP_PORT1, - MSM_BUS_SLAVE_MNOC_HF_MEM_NOC, 0, 6400000000), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_MDP_PORT0, - MSM_BUS_SLAVE_MNOC_HF_MEM_NOC, 0, 6400000000), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_MDP_PORT1, - MSM_BUS_SLAVE_MNOC_HF_MEM_NOC, 0, 6400000000), -}; - -static struct msm_bus_paths dpu_data_bus_usecases[] = { { - .num_paths = 2, - .vectors = &dpu_data_bus_vectors[0], -}, { - .num_paths = 2, - .vectors = &dpu_data_bus_vectors[2], -}, { - .num_paths = 2, - .vectors = &dpu_data_bus_vectors[4], -} }; - -static struct msm_bus_scale_pdata dpu_data_bus_scale_table = { - .usecase = dpu_data_bus_usecases, - .num_usecases = ARRAY_SIZE(dpu_data_bus_usecases), - .name = "mdss_mnoc", -}; - -static struct msm_bus_vectors dpu_llcc_bus_vectors[] = { - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_MNOC_HF_MEM_NOC, - MSM_BUS_SLAVE_LLCC, 0, 0), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_MNOC_HF_MEM_NOC, - MSM_BUS_SLAVE_LLCC, 0, 6400000000), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_MNOC_HF_MEM_NOC, - MSM_BUS_SLAVE_LLCC, 0, 6400000000), -}; - -static struct msm_bus_paths dpu_llcc_bus_usecases[] = { { - .num_paths = 1, - .vectors = &dpu_llcc_bus_vectors[0], -}, { - .num_paths = 1, - .vectors = &dpu_llcc_bus_vectors[1], -}, { - .num_paths = 1, - .vectors = &dpu_llcc_bus_vectors[2], -} }; -static struct msm_bus_scale_pdata dpu_llcc_bus_scale_table = { - .usecase = dpu_llcc_bus_usecases, - .num_usecases = ARRAY_SIZE(dpu_llcc_bus_usecases), - .name = "mdss_llcc", -}; - -static struct msm_bus_vectors dpu_ebi_bus_vectors[] = { - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_LLCC, - MSM_BUS_SLAVE_EBI_CH0, 0, 0), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_LLCC, - MSM_BUS_SLAVE_EBI_CH0, 0, 6400000000), - DPU_BUS_VECTOR_ENTRY(MSM_BUS_MASTER_LLCC, - MSM_BUS_SLAVE_EBI_CH0, 0, 6400000000), -}; - -static struct msm_bus_paths dpu_ebi_bus_usecases[] = { { - .num_paths = 1, - .vectors = &dpu_ebi_bus_vectors[0], -}, { - .num_paths = 1, - .vectors = &dpu_ebi_bus_vectors[1], -}, { - .num_paths = 1, - .vectors = &dpu_ebi_bus_vectors[2], -} }; -static struct msm_bus_scale_pdata dpu_ebi_bus_scale_table = { - .usecase = dpu_ebi_bus_usecases, - .num_usecases = ARRAY_SIZE(dpu_ebi_bus_usecases), - .name = "mdss_ebi", -}; -#endif - static const char *data_bus_name[DPU_POWER_HANDLE_DBUS_ID_MAX] = { [DPU_POWER_HANDLE_DBUS_ID_MNOC] = "qcom,dpu-data-bus", [DPU_POWER_HANDLE_DBUS_ID_LLCC] = "qcom,dpu-llcc-bus", @@ -222,366 +96,15 @@ void dpu_power_client_destroy(struct dpu_power_handle *phandle, } } -#ifdef CONFIG_QCOM_BUS_SCALING - -#define MAX_AXI_PORT_COUNT 3 - -static int _dpu_power_data_bus_set_quota( - struct dpu_power_data_bus_handle *pdbus, - u64 ab_quota_rt, u64 ab_quota_nrt, - u64 ib_quota_rt, u64 ib_quota_nrt) -{ - int new_uc_idx; - u64 ab_quota[MAX_AXI_PORT_COUNT] = {0, 0}; - u64 ib_quota[MAX_AXI_PORT_COUNT] = {0, 0}; - int rc; - - if (pdbus->data_bus_hdl < 1) { - pr_err("invalid bus handle %d\n", pdbus->data_bus_hdl); - return -EINVAL; - } - - pdbus->ab_rt = ab_quota_rt; - pdbus->ib_rt = ib_quota_rt; - pdbus->ab_nrt = ab_quota_nrt; - pdbus->ib_nrt = ib_quota_nrt; - - if (pdbus->enable) { - ab_quota_rt = max_t(u64, ab_quota_rt, - DPU_POWER_HANDLE_ENABLE_BUS_AB_QUOTA); - ib_quota_rt = max_t(u64, ib_quota_rt, - DPU_POWER_HANDLE_ENABLE_BUS_IB_QUOTA); - ab_quota_nrt = max_t(u64, ab_quota_nrt, - DPU_POWER_HANDLE_ENABLE_BUS_AB_QUOTA); - ib_quota_nrt = max_t(u64, ib_quota_nrt, - DPU_POWER_HANDLE_ENABLE_BUS_IB_QUOTA); - } else { - ab_quota_rt = min_t(u64, ab_quota_rt, - DPU_POWER_HANDLE_DISABLE_BUS_AB_QUOTA); - ib_quota_rt = min_t(u64, ib_quota_rt, - DPU_POWER_HANDLE_DISABLE_BUS_IB_QUOTA); - ab_quota_nrt = min_t(u64, ab_quota_nrt, - DPU_POWER_HANDLE_DISABLE_BUS_AB_QUOTA); - ib_quota_nrt = min_t(u64, ib_quota_nrt, - DPU_POWER_HANDLE_DISABLE_BUS_IB_QUOTA); - } - - if (!ab_quota_rt && !ab_quota_nrt && !ib_quota_rt && !ib_quota_nrt) { - new_uc_idx = 0; - } else { - int i; - struct msm_bus_vectors *vect = NULL; - struct msm_bus_scale_pdata *bw_table = - pdbus->data_bus_scale_table; - u32 nrt_axi_port_cnt = pdbus->nrt_axi_port_cnt; - u32 total_axi_port_cnt = pdbus->axi_port_cnt; - u32 rt_axi_port_cnt = total_axi_port_cnt - nrt_axi_port_cnt; - - if (!bw_table || !total_axi_port_cnt || - total_axi_port_cnt > MAX_AXI_PORT_COUNT) { - pr_err("invalid input\n"); - return -EINVAL; - } - - if (pdbus->bus_channels) { - ib_quota_rt = div_u64(ib_quota_rt, - pdbus->bus_channels); - ib_quota_nrt = div_u64(ib_quota_nrt, - pdbus->bus_channels); - } - - if (nrt_axi_port_cnt) { - - ab_quota_rt = div_u64(ab_quota_rt, rt_axi_port_cnt); - ab_quota_nrt = div_u64(ab_quota_nrt, nrt_axi_port_cnt); - - for (i = 0; i < total_axi_port_cnt; i++) { - if (i < rt_axi_port_cnt) { - ab_quota[i] = ab_quota_rt; - ib_quota[i] = ib_quota_rt; - } else { - ab_quota[i] = ab_quota_nrt; - ib_quota[i] = ib_quota_nrt; - } - } - } else { - ab_quota[0] = div_u64(ab_quota_rt + ab_quota_nrt, - total_axi_port_cnt); - ib_quota[0] = ib_quota_rt + ib_quota_nrt; - - for (i = 1; i < total_axi_port_cnt; i++) { - ab_quota[i] = ab_quota[0]; - ib_quota[i] = ib_quota[0]; - } - } - - new_uc_idx = (pdbus->curr_bw_uc_idx % - (bw_table->num_usecases - 1)) + 1; - - for (i = 0; i < total_axi_port_cnt; i++) { - vect = &bw_table->usecase[new_uc_idx].vectors[i]; - vect->ab = ab_quota[i]; - vect->ib = ib_quota[i]; - - pr_debug( - "%s uc_idx=%d %s path idx=%d ab=%llu ib=%llu\n", - bw_table->name, - new_uc_idx, (i < rt_axi_port_cnt) ? "rt" : "nrt" - , i, vect->ab, vect->ib); - } - } - pdbus->curr_bw_uc_idx = new_uc_idx; - pdbus->ao_bw_uc_idx = new_uc_idx; - - DPU_ATRACE_BEGIN("msm_bus_scale_req"); - rc = msm_bus_scale_client_update_request(pdbus->data_bus_hdl, - new_uc_idx); - DPU_ATRACE_END("msm_bus_scale_req"); - - return rc; -} - -int dpu_power_data_bus_set_quota(struct dpu_power_handle *phandle, - struct dpu_power_client *pclient, - int bus_client, u32 bus_id, - u64 ab_quota, u64 ib_quota) -{ - int rc = 0; - int i; - u64 total_ab_rt = 0, total_ib_rt = 0; - u64 total_ab_nrt = 0, total_ib_nrt = 0; - struct dpu_power_client *client; - - if (!phandle || !pclient || - bus_client >= DPU_POWER_HANDLE_DATA_BUS_CLIENT_MAX || - bus_id >= DPU_POWER_HANDLE_DBUS_ID_MAX) { - pr_err("invalid parameters\n"); - return -EINVAL; - } - - mutex_lock(&phandle->phandle_lock); - - pclient->ab[bus_client] = ab_quota; - pclient->ib[bus_client] = ib_quota; - trace_dpu_perf_update_bus(bus_client, ab_quota, ib_quota); - - list_for_each_entry(client, &phandle->power_client_clist, list) { - for (i = 0; i < DPU_POWER_HANDLE_DATA_BUS_CLIENT_MAX; i++) { - if (i == DPU_POWER_HANDLE_DATA_BUS_CLIENT_NRT) { - total_ab_nrt += client->ab[i]; - total_ib_nrt += client->ib[i]; - } else { - total_ab_rt += client->ab[i]; - total_ib_rt = max(total_ib_rt, client->ib[i]); - } - } - } - - if (phandle->data_bus_handle[bus_id].data_bus_hdl) - rc = _dpu_power_data_bus_set_quota( - &phandle->data_bus_handle[bus_id], - total_ab_rt, total_ab_nrt, - total_ib_rt, total_ib_nrt); - - mutex_unlock(&phandle->phandle_lock); - - return rc; -} - -static void dpu_power_data_bus_unregister( - struct dpu_power_data_bus_handle *pdbus) -{ - if (pdbus->data_bus_hdl) { - msm_bus_scale_unregister_client(pdbus->data_bus_hdl); - pdbus->data_bus_hdl = 0; - } -} - -static int dpu_power_data_bus_register(struct dpu_power_handle *phandle, - int index) -{ - struct dpu_power_data_bus_handle *pdbus = &phandle->data_bus_handle[index]; - - pdbus->bus_channels = 2; - pdbus->nrt_axi_port_cnt = 0; - pdbus->axi_port_cnt = 1; - - switch (index) { - case DPU_POWER_HANDLE_DBUS_ID_MNOC: - pdbus->data_bus_scale_table = &dpu_data_bus_scale_table; - pdbus->axi_port_cnt = 2; - break; - case DPU_POWER_HANDLE_DBUS_ID_LLCC: - pdbus->data_bus_scale_table = &dpu_llcc_bus_scale_table; - break; - case DPU_POWER_HANDLE_DBUS_ID_EBI: - pdbus->data_bus_scale_table = &dpu_ebi_bus_scale_table; - break; - default: - pr_err("invalid data_bus type: %d", index); - return -EINVAL; - } - - pdbus->data_bus_hdl = msm_bus_scale_register_client( - pdbus->data_bus_scale_table); - if (!pdbus->data_bus_hdl) { - pr_err("data_bus_client register failed\n"); - return -EINVAL; - } - pr_debug("register %s data_bus_hdl=%x\n", data_bus_name[index], - pdbus->data_bus_hdl); - - return 0; -} - -static int dpu_power_reg_bus_register(struct dpu_power_handle *phandle) -{ - phandle->reg_bus_hdl = msm_bus_scale_register_client( - &dpu_reg_bus_scale_table); - if (!phandle->reg_bus_hdl) { - pr_err("reg_bus_client register failed\n"); - return -EINVAL; - } - pr_debug("register reg_bus_hdl=%x\n", phandle->reg_bus_hdl); - - return 0; -} - -static void dpu_power_reg_bus_unregister(u32 reg_bus_hdl) -{ - if (reg_bus_hdl) - msm_bus_scale_unregister_client(reg_bus_hdl); -} - -int dpu_power_data_bus_state_update(struct dpu_power_handle *phandle, - bool enable) -{ - int i; - - if (!phandle) { - pr_err("invalid param\n"); - return -EINVAL; - } - - for (i = DPU_POWER_HANDLE_DBUS_ID_MNOC; - i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) - phandle->data_bus_handle[i].enable = enable; - - return 0; -} - -static int dpu_power_data_bus_update(struct dpu_power_data_bus_handle *pdbus, - bool enable) -{ - int rc = 0; - - pdbus->enable = enable; - - if (pdbus->data_bus_hdl) - rc = _dpu_power_data_bus_set_quota(pdbus, pdbus->ab_rt, - pdbus->ab_nrt, pdbus->ib_rt, pdbus->ib_nrt); - - if (rc) - pr_err("failed to set data bus vote rc=%d enable:%d\n", - rc, enable); - - return rc; -} - -static int dpu_power_reg_bus_update(u32 reg_bus_hdl, u32 usecase_ndx) -{ - int rc = 0; - - if (reg_bus_hdl) - rc = msm_bus_scale_client_update_request(reg_bus_hdl, - usecase_ndx); - if (rc) - pr_err("failed to set reg bus vote rc=%d\n", rc); - - return rc; -} -#else -static int dpu_power_data_bus_register(struct dpu_power_handle *phandle, - int index) -{ - return 0; -} - -static void dpu_power_data_bus_unregister( - struct dpu_power_data_bus_handle *pdbus) -{ -} - -int dpu_power_data_bus_set_quota(struct dpu_power_handle *phandle, - struct dpu_power_client *pclient, - int bus_client, u32 bus_id, - u64 ab_quota, u64 ib_quota) -{ - return 0; -} - -static int dpu_power_reg_bus_register(struct dpu_power_handle *phandle) -{ - return 0; -} - -static void dpu_power_reg_bus_unregister(u32 reg_bus_hdl) -{ -} - -static int dpu_power_reg_bus_update(u32 reg_bus_hdl, u32 usecase_ndx) -{ - return 0; -} - -static int dpu_power_data_bus_update(struct dpu_power_data_bus_handle *pdbus, - bool enable) -{ - return 0; -} - -int dpu_power_data_bus_state_update(struct dpu_power_handle *phandle, - bool enable) -{ - return 0; -} -#endif - -int dpu_power_resource_init(struct platform_device *pdev, +void dpu_power_resource_init(struct platform_device *pdev, struct dpu_power_handle *phandle) { - int rc = 0, i; - phandle->dev = &pdev->dev; - rc = dpu_power_reg_bus_register(phandle); - if (rc) { - pr_err("register bus parse failed rc=%d\n", rc); - return rc; - } - - for (i = DPU_POWER_HANDLE_DBUS_ID_MNOC; - i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) { - rc = dpu_power_data_bus_register(phandle, i); - if (rc) { - pr_err("register data bus parse failed id=%d rc=%d\n", - i, rc); - goto data_bus_err; - } - } - INIT_LIST_HEAD(&phandle->power_client_clist); INIT_LIST_HEAD(&phandle->event_list); mutex_init(&phandle->phandle_lock); - - return rc; - -data_bus_err: - for (i--; i >= 0; i--) - dpu_power_data_bus_unregister(&phandle->data_bus_handle[i]); - dpu_power_reg_bus_unregister(phandle->reg_bus_hdl); - return rc; } void dpu_power_resource_deinit(struct platform_device *pdev, @@ -589,7 +112,6 @@ void dpu_power_resource_deinit(struct platform_device *pdev, { struct dpu_power_client *curr_client, *next_client; struct dpu_power_event *curr_event, *next_event; - int i; if (!phandle || !pdev) { pr_err("invalid input param\n"); @@ -615,17 +137,11 @@ void dpu_power_resource_deinit(struct platform_device *pdev, list_del(&curr_event->list); } mutex_unlock(&phandle->phandle_lock); - - for (i = 0; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) - dpu_power_data_bus_unregister(&phandle->data_bus_handle[i]); - - dpu_power_reg_bus_unregister(phandle->reg_bus_hdl); } int dpu_power_resource_enable(struct dpu_power_handle *phandle, struct dpu_power_client *pclient, bool enable) { - int rc = 0, i; bool changed = false; u32 max_usecase_ndx = VOTE_INDEX_DISABLE, prev_usecase_ndx; struct dpu_power_client *client; @@ -668,53 +184,19 @@ int dpu_power_resource_enable(struct dpu_power_handle *phandle, if (enable) { dpu_power_event_trigger_locked(phandle, DPU_POWER_EVENT_PRE_ENABLE); - - for (i = 0; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) { - rc = dpu_power_data_bus_update( - &phandle->data_bus_handle[i], enable); - if (rc) { - pr_err("failed to set data bus vote id=%d rc=%d\n", - i, rc); - goto data_bus_hdl_err; - } - } - - rc = dpu_power_reg_bus_update(phandle->reg_bus_hdl, - max_usecase_ndx); - if (rc) { - pr_err("failed to set reg bus vote rc=%d\n", rc); - goto reg_bus_hdl_err; - } - dpu_power_event_trigger_locked(phandle, DPU_POWER_EVENT_POST_ENABLE); } else { dpu_power_event_trigger_locked(phandle, DPU_POWER_EVENT_PRE_DISABLE); - - dpu_power_reg_bus_update(phandle->reg_bus_hdl, - max_usecase_ndx); - - for (i = 0 ; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) - dpu_power_data_bus_update(&phandle->data_bus_handle[i], - enable); - dpu_power_event_trigger_locked(phandle, DPU_POWER_EVENT_POST_DISABLE); } end: mutex_unlock(&phandle->phandle_lock); - return rc; - -reg_bus_hdl_err: - for (i = 0 ; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) - dpu_power_data_bus_update(&phandle->data_bus_handle[i], 0); -data_bus_hdl_err: - phandle->current_usecase_ndx = prev_usecase_ndx; - mutex_unlock(&phandle->phandle_lock); - return rc; + return 0; } struct dpu_power_event *dpu_power_handle_register_event( diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h index 193f46886bc2..344f74464eca 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h @@ -97,36 +97,6 @@ struct dpu_power_client { bool active; }; -/** - * struct dpu_power_data_handle: power handle struct for data bus - * @data_bus_scale_table: pointer to bus scaling table - * @data_bus_hdl: current data bus handle - * @axi_port_cnt: number of rt axi ports - * @nrt_axi_port_cnt: number of nrt axi ports - * @bus_channels: number of memory bus channels - * @curr_bw_uc_idx: current use case index of data bus - * @ao_bw_uc_idx: active only use case index of data bus - * @ab_rt: realtime ab quota - * @ib_rt: realtime ib quota - * @ab_nrt: non-realtime ab quota - * @ib_nrt: non-realtime ib quota - * @enable: true if bus is enabled - */ -struct dpu_power_data_bus_handle { - struct msm_bus_scale_pdata *data_bus_scale_table; - u32 data_bus_hdl; - u32 axi_port_cnt; - u32 nrt_axi_port_cnt; - u32 bus_channels; - u32 curr_bw_uc_idx; - u32 ao_bw_uc_idx; - u64 ab_rt; - u64 ib_rt; - u64 ab_nrt; - u64 ib_nrt; - bool enable; -}; - /* * struct dpu_power_event - local event registration structure * @client_name: name of the client registering @@ -151,8 +121,6 @@ struct dpu_power_event { * @phandle_lock: lock to synchronize the enable/disable * @dev: pointer to device structure * @usecase_ndx: current usecase index - * @reg_bus_hdl: current register bus handle - * @data_bus_handle: context structure for data bus control * @event_list: current power handle event list */ struct dpu_power_handle { @@ -160,9 +128,6 @@ struct dpu_power_handle { struct mutex phandle_lock; struct device *dev; u32 current_usecase_ndx; - u32 reg_bus_hdl; - struct dpu_power_data_bus_handle data_bus_handle - [DPU_POWER_HANDLE_DBUS_ID_MAX]; struct list_head event_list; }; @@ -170,10 +135,8 @@ struct dpu_power_handle { * dpu_power_resource_init() - initializes the dpu power handle * @pdev: platform device to search the power resources * @pdata: power handle to store the power resources - * - * Return: error code. */ -int dpu_power_resource_init(struct platform_device *pdev, +void dpu_power_resource_init(struct platform_device *pdev, struct dpu_power_handle *pdata); /** @@ -217,32 +180,6 @@ void dpu_power_client_destroy(struct dpu_power_handle *phandle, int dpu_power_resource_enable(struct dpu_power_handle *pdata, struct dpu_power_client *pclient, bool enable); -/** - * dpu_power_data_bus_state_update() - update data bus state - * @pdata: power handle containing the resources - * @enable: take enable vs disable path - * - * Return: error code. - */ -int dpu_power_data_bus_state_update(struct dpu_power_handle *phandle, - bool enable); - -/** - * dpu_power_data_bus_set_quota() - set data bus quota for power client - * @phandle: power handle containing the resources - * @client: client information to set quota - * @bus_client: real-time or non-real-time bus client - * @bus_id: identifier of data bus, see DPU_POWER_HANDLE_DBUS_ID - * @ab_quota: arbitrated bus bandwidth - * @ib_quota: instantaneous bus bandwidth - * - * Return: zero if success, or error code otherwise - */ -int dpu_power_data_bus_set_quota(struct dpu_power_handle *phandle, - struct dpu_power_client *pclient, - int bus_client, u32 bus_id, - u64 ab_quota, u64 ib_quota); - /** * dpu_power_data_bus_bandwidth_ctrl() - control data bus bandwidth enable * @phandle: power handle containing the resources