linux-arm-msm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rajesh Yadav <ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Cc: robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	Rajesh Yadav <ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	hoegsberg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.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	[thread overview]
Message-ID: <1525940985-30428-9-git-send-email-ryadav@codeaurora.org> (raw)
In-Reply-To: <1525940985-30428-1-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

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 <ryadav@codeaurora.org>
---
 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;
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

  parent reply	other threads:[~2018-05-10  8:29 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-10  8:29 [DPU PATCH 00/11] Refactor DPU device/driver hierarchy and add runtime_pm support Rajesh Yadav
2018-05-10  8:29 ` [DPU PATCH 01/11] drm/msm: remove redundant pm_runtime_enable call from msm_drv Rajesh Yadav
     [not found]   ` <1525940985-30428-2-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10 15:02     ` Sean Paul
2018-05-10  8:29 ` [DPU PATCH 02/11] drm/msm/mdp5: subclass msm_mdss for mdp5 Rajesh Yadav
2018-05-10 13:37   ` Sean Paul
     [not found] ` <1525940985-30428-1-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10  8:29   ` [DPU PATCH 03/11] drm/msm/dpu: add MDSS top level driver for dpu Rajesh Yadav
     [not found]     ` <1525940985-30428-4-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10 14:14       ` Sean Paul
2018-05-10 16:56       ` Jordan Crouse
2018-05-10  8:29   ` [DPU PATCH 05/11] drm/msm/dpu: update dpu sub-block offsets wrt dpu base address Rajesh Yadav
2018-05-10 15:02     ` Sean Paul
2018-05-10  8:29   ` [DPU PATCH 06/11] drm/msm/dpu: use runtime_pm calls on dpu device Rajesh Yadav
     [not found]     ` <1525940985-30428-7-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10 15:04       ` Sean Paul
2018-05-10  8:29   ` [DPU PATCH 07/11] drm/msm/dpu: remove clock management code from dpu_power_handle Rajesh Yadav
     [not found]     ` <1525940985-30428-8-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10 15:21       ` Sean Paul
2018-05-10  8:29   ` Rajesh Yadav [this message]
     [not found]     ` <1525940985-30428-9-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10 15:22       ` [DPU PATCH 08/11] drm/msm/dpu: remove power " Sean Paul
2018-05-10  8:29   ` [DPU PATCH 09/11] drm/msm/dp: remove dpu_power_handle calls from dp driver Rajesh Yadav
     [not found]     ` <1525940985-30428-10-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10 15:23       ` Sean Paul
2018-05-10  8:29 ` [DPU PATCH 04/11] drm/msm/dpu: create new platform driver for dpu device Rajesh Yadav
     [not found]   ` <1525940985-30428-5-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10 15:00     ` Sean Paul
2018-05-10 17:00     ` Jordan Crouse
2018-05-10  8:29 ` [DPU PATCH 10/11] drm/msm/dpu: use runtime_pm calls in dpu_dbg Rajesh Yadav
     [not found]   ` <1525940985-30428-11-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10 15:26     ` Sean Paul
2018-05-10  8:29 ` [DPU PATCH 11/11] drm/msm/dpu: move dpu_power_handle to dpu folder Rajesh Yadav
     [not found]   ` <1525940985-30428-12-git-send-email-ryadav-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-05-10 15:30     ` Sean Paul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1525940985-30428-9-git-send-email-ryadav@codeaurora.org \
    --to=ryadav-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
    --cc=hoegsberg-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).