From patchwork Thu May 10 08:29:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajesh Yadav X-Patchwork-Id: 10391413 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 5A0F060540 for ; Thu, 10 May 2018 08:31:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4777C2894F for ; Thu, 10 May 2018 08:31:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 434362893C; Thu, 10 May 2018 08:31:19 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED, TVD_SUBJ_WIPE_DEBT, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7C77D2895F for ; Thu, 10 May 2018 08:31:17 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D34236EEA1; Thu, 10 May 2018 08:31:15 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from smtp.codeaurora.org (smtp.codeaurora.org [198.145.29.96]) by gabe.freedesktop.org (Postfix) with ESMTPS id A13D56EEA1; Thu, 10 May 2018 08:31:14 +0000 (UTC) Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 8C4A5607E1; Thu, 10 May 2018 08:31:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525941074; bh=T4AFNwfzs8zwCyyKJcQrmp4OMYCl0NyDlNz31UA/DDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=K0TitkQIgE/V9/XC0gvzfmB/MUWRQV2pyLuLRtqawzUfIh7+T1uv4thMYdiCffmW7 YETX6fYri4be4qDFNOt1gjeHhMAvKxSM5Na6VNUwvwFV3JP1QcHDorQ0zlAOTcKDrc hjrKf2iNOjX1ZYzSanFvXiV6jR2qye6lu5q61tPU= Received: from ryadav-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: ryadav@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id C012B60A00; Thu, 10 May 2018 08:31:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1525941073; bh=T4AFNwfzs8zwCyyKJcQrmp4OMYCl0NyDlNz31UA/DDk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=N5fDisYlvQvsT6Mc4OSAN7Z6KozZDnVsCapZqnMod8m0zQf9grAWyuLVHuFdu10UZ 6W0k76YgYBgs0N7OCZQk05LtcwGTqMpMkNh0AcffcZl0E8rQhf9k+5oNMv578YzPUw mzOpgDqgwFCsLthchXU+MTjdXilBZ6JlqGFc9ovs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org C012B60A00 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=ryadav@codeaurora.org From: Rajesh Yadav To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org Subject: [DPU PATCH 08/11] drm/msm/dpu: remove power management code from dpu_power_handle Date: Thu, 10 May 2018 13:59:42 +0530 Message-Id: <1525940985-30428-9-git-send-email-ryadav@codeaurora.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1525940985-30428-1-git-send-email-ryadav@codeaurora.org> References: <1525940985-30428-1-git-send-email-ryadav@codeaurora.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rajesh Yadav , hoegsberg@chromium.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Mdss main power supply (mdss_gdsc) is implemented as a generic power domain and mdss top level wrapper device manage it via runtime_pm. Remove custom power management code from dpu_power_handle. Signed-off-by: Rajesh Yadav Reviewed-by: Sean Paul --- drivers/gpu/drm/msm/dpu_power_handle.c | 190 +-------------------------------- drivers/gpu/drm/msm/dpu_power_handle.h | 2 - 2 files changed, 1 insertion(+), 191 deletions(-) diff --git a/drivers/gpu/drm/msm/dpu_power_handle.c b/drivers/gpu/drm/msm/dpu_power_handle.c index 17bae4b..909fbb8 100644 --- a/drivers/gpu/drm/msm/dpu_power_handle.c +++ b/drivers/gpu/drm/msm/dpu_power_handle.c @@ -101,150 +101,6 @@ void dpu_power_client_destroy(struct dpu_power_handle *phandle, } } -static int dpu_power_parse_dt_supply(struct platform_device *pdev, - struct dss_module_power *mp) -{ - int i = 0, rc = 0; - u32 tmp = 0; - struct device_node *of_node = NULL, *supply_root_node = NULL; - struct device_node *supply_node = NULL; - - if (!pdev || !mp) { - pr_err("invalid input param pdev:%pK mp:%pK\n", pdev, mp); - return -EINVAL; - } - - of_node = pdev->dev.of_node; - - mp->num_vreg = 0; - supply_root_node = of_get_child_by_name(of_node, - "qcom,platform-supply-entries"); - if (!supply_root_node) { - pr_debug("no supply entry present\n"); - return rc; - } - - for_each_child_of_node(supply_root_node, supply_node) - mp->num_vreg++; - - if (mp->num_vreg == 0) { - pr_debug("no vreg\n"); - return rc; - } - - pr_debug("vreg found. count=%d\n", mp->num_vreg); - mp->vreg_config = devm_kzalloc(&pdev->dev, sizeof(struct dss_vreg) * - mp->num_vreg, GFP_KERNEL); - if (!mp->vreg_config) { - rc = -ENOMEM; - return rc; - } - - for_each_child_of_node(supply_root_node, supply_node) { - - const char *st = NULL; - - rc = of_property_read_string(supply_node, - "qcom,supply-name", &st); - if (rc) { - pr_err("error reading name. rc=%d\n", rc); - goto error; - } - - strlcpy(mp->vreg_config[i].vreg_name, st, - sizeof(mp->vreg_config[i].vreg_name)); - - rc = of_property_read_u32(supply_node, - "qcom,supply-min-voltage", &tmp); - if (rc) { - pr_err("error reading min volt. rc=%d\n", rc); - goto error; - } - mp->vreg_config[i].min_voltage = tmp; - - rc = of_property_read_u32(supply_node, - "qcom,supply-max-voltage", &tmp); - if (rc) { - pr_err("error reading max volt. rc=%d\n", rc); - goto error; - } - mp->vreg_config[i].max_voltage = tmp; - - rc = of_property_read_u32(supply_node, - "qcom,supply-enable-load", &tmp); - if (rc) { - pr_err("error reading enable load. rc=%d\n", rc); - goto error; - } - mp->vreg_config[i].enable_load = tmp; - - rc = of_property_read_u32(supply_node, - "qcom,supply-disable-load", &tmp); - if (rc) { - pr_err("error reading disable load. rc=%d\n", rc); - goto error; - } - mp->vreg_config[i].disable_load = tmp; - - rc = of_property_read_u32(supply_node, - "qcom,supply-pre-on-sleep", &tmp); - if (rc) - pr_debug("error reading supply pre sleep value. rc=%d\n", - rc); - - mp->vreg_config[i].pre_on_sleep = (!rc ? tmp : 0); - - rc = of_property_read_u32(supply_node, - "qcom,supply-pre-off-sleep", &tmp); - if (rc) - pr_debug("error reading supply pre sleep value. rc=%d\n", - rc); - - mp->vreg_config[i].pre_off_sleep = (!rc ? tmp : 0); - - rc = of_property_read_u32(supply_node, - "qcom,supply-post-on-sleep", &tmp); - if (rc) - pr_debug("error reading supply post sleep value. rc=%d\n", - rc); - - mp->vreg_config[i].post_on_sleep = (!rc ? tmp : 0); - - rc = of_property_read_u32(supply_node, - "qcom,supply-post-off-sleep", &tmp); - if (rc) - pr_debug("error reading supply post sleep value. rc=%d\n", - rc); - - mp->vreg_config[i].post_off_sleep = (!rc ? tmp : 0); - - pr_debug("%s min=%d, max=%d, enable=%d, disable=%d, preonsleep=%d, postonsleep=%d, preoffsleep=%d, postoffsleep=%d\n", - mp->vreg_config[i].vreg_name, - mp->vreg_config[i].min_voltage, - mp->vreg_config[i].max_voltage, - mp->vreg_config[i].enable_load, - mp->vreg_config[i].disable_load, - mp->vreg_config[i].pre_on_sleep, - mp->vreg_config[i].post_on_sleep, - mp->vreg_config[i].pre_off_sleep, - mp->vreg_config[i].post_off_sleep); - ++i; - - rc = 0; - } - - return rc; - -error: - if (mp->vreg_config) { - devm_kfree(&pdev->dev, mp->vreg_config); - mp->vreg_config = NULL; - mp->num_vreg = 0; - } - - return rc; -} - #ifdef CONFIG_QCOM_BUS_SCALING #define MAX_AXI_PORT_COUNT 3 @@ -614,33 +470,18 @@ int dpu_power_resource_init(struct platform_device *pdev, struct dpu_power_handle *phandle) { int rc = 0, i; - struct dss_module_power *mp; if (!phandle || !pdev) { pr_err("invalid input param\n"); rc = -EINVAL; goto end; } - mp = &phandle->mp; phandle->dev = &pdev->dev; - rc = dpu_power_parse_dt_supply(pdev, mp); - if (rc) { - pr_err("device vreg supply parsing failed\n"); - goto end; - } - - rc = msm_dss_config_vreg(&pdev->dev, - mp->vreg_config, mp->num_vreg, 1); - if (rc) { - pr_err("vreg config failed rc=%d\n", rc); - goto vreg_err; - } - rc = dpu_power_reg_bus_parse(pdev, phandle); if (rc) { pr_err("register bus parse failed rc=%d\n", rc); - goto bus_err; + goto end; } for (i = DPU_POWER_HANDLE_DBUS_ID_MNOC; @@ -666,12 +507,6 @@ int dpu_power_resource_init(struct platform_device *pdev, for (i--; i >= 0; i--) dpu_power_data_bus_unregister(&phandle->data_bus_handle[i]); dpu_power_reg_bus_unregister(phandle->reg_bus_hdl); -bus_err: - msm_dss_config_vreg(&pdev->dev, mp->vreg_config, mp->num_vreg, 0); -vreg_err: - if (mp->vreg_config) - devm_kfree(&pdev->dev, mp->vreg_config); - mp->num_vreg = 0; end: return rc; } @@ -679,7 +514,6 @@ int dpu_power_resource_init(struct platform_device *pdev, void dpu_power_resource_deinit(struct platform_device *pdev, struct dpu_power_handle *phandle) { - struct dss_module_power *mp; struct dpu_power_client *curr_client, *next_client; struct dpu_power_event *curr_event, *next_event; int i; @@ -688,7 +522,6 @@ void dpu_power_resource_deinit(struct platform_device *pdev, pr_err("invalid input param\n"); return; } - mp = &phandle->mp; mutex_lock(&phandle->phandle_lock); list_for_each_entry_safe(curr_client, next_client, @@ -714,13 +547,6 @@ void dpu_power_resource_deinit(struct platform_device *pdev, dpu_power_data_bus_unregister(&phandle->data_bus_handle[i]); dpu_power_reg_bus_unregister(phandle->reg_bus_hdl); - - msm_dss_config_vreg(&pdev->dev, mp->vreg_config, mp->num_vreg, 0); - - if (mp->vreg_config) - devm_kfree(&pdev->dev, mp->vreg_config); - - mp->num_vreg = 0; } int dpu_power_resource_enable(struct dpu_power_handle *phandle, @@ -730,15 +556,12 @@ int dpu_power_resource_enable(struct dpu_power_handle *phandle, bool changed = false; u32 max_usecase_ndx = VOTE_INDEX_DISABLE, prev_usecase_ndx; struct dpu_power_client *client; - struct dss_module_power *mp; if (!phandle || !pclient) { pr_err("invalid input argument\n"); return -EINVAL; } - mp = &phandle->mp; - mutex_lock(&phandle->phandle_lock); if (enable) pclient->refcount++; @@ -783,13 +606,6 @@ int dpu_power_resource_enable(struct dpu_power_handle *phandle, } } - rc = msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg, - enable); - if (rc) { - pr_err("failed to enable vregs rc=%d\n", rc); - goto vreg_err; - } - rc = dpu_power_reg_bus_update(phandle->reg_bus_hdl, max_usecase_ndx); if (rc) { @@ -807,8 +623,6 @@ int dpu_power_resource_enable(struct dpu_power_handle *phandle, dpu_power_reg_bus_update(phandle->reg_bus_hdl, max_usecase_ndx); - msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg, - enable); for (i = 0 ; i < DPU_POWER_HANDLE_DBUS_ID_MAX; i++) dpu_power_data_bus_update(&phandle->data_bus_handle[i], enable); @@ -822,8 +636,6 @@ int dpu_power_resource_enable(struct dpu_power_handle *phandle, return rc; reg_bus_hdl_err: - msm_dss_enable_vreg(mp->vreg_config, mp->num_vreg, 0); -vreg_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: diff --git a/drivers/gpu/drm/msm/dpu_power_handle.h b/drivers/gpu/drm/msm/dpu_power_handle.h index 83f048d..9a6d4b9 100644 --- a/drivers/gpu/drm/msm/dpu_power_handle.h +++ b/drivers/gpu/drm/msm/dpu_power_handle.h @@ -147,7 +147,6 @@ struct dpu_power_event { /** * struct dpu_power_handle: power handle main struct - * @mp: module power for clock and regulator * @client_clist: master list to store all clients * @phandle_lock: lock to synchronize the enable/disable * @dev: pointer to device structure @@ -157,7 +156,6 @@ struct dpu_power_event { * @event_list: current power handle event list */ struct dpu_power_handle { - struct dss_module_power mp; struct list_head power_client_clist; struct mutex phandle_lock; struct device *dev;