From: Jeykumar Sankaran <jsanka-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Sean Paul <sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
Cc: linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Abhinav Kumar <abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
Sean Paul <seanpaul-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org>,
dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org,
freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Subject: Re: [PATCH 03/12] drm/msm: dpu: Remove dpu_power_client
Date: Mon, 12 Nov 2018 16:57:17 -0800 [thread overview]
Message-ID: <1b4f2636f7c924ff13da0e3637e4854d@codeaurora.org> (raw)
In-Reply-To: <20181112194222.193546-4-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
On 2018-11-12 11:42, Sean Paul wrote:
> From: Sean Paul <seanpaul@chromium.org>
>
> There's only one client -- core, and it's only used for runtime pm
> which
> is already refcounted.
>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
> ---
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 22 +----
> drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 1 -
> .../gpu/drm/msm/disp/dpu1/dpu_power_handle.c | 96 +------------------
> .../gpu/drm/msm/disp/dpu1/dpu_power_handle.h | 86 +----------------
> 4 files changed, 6 insertions(+), 199 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> index 985c855796ae..23094d108e81 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
> @@ -676,11 +676,6 @@ static void _dpu_kms_hw_destroy(struct dpu_kms
> *dpu_kms)
> dpu_hw_catalog_deinit(dpu_kms->catalog);
> dpu_kms->catalog = NULL;
>
> - if (dpu_kms->core_client)
> - dpu_power_client_destroy(&dpu_kms->phandle,
> - dpu_kms->core_client);
> - dpu_kms->core_client = NULL;
> -
> if (dpu_kms->vbif[VBIF_NRT])
> devm_iounmap(&dpu_kms->pdev->dev,
> dpu_kms->vbif[VBIF_NRT]);
> dpu_kms->vbif[VBIF_NRT] = NULL;
> @@ -913,17 +908,6 @@ static int dpu_kms_hw_init(struct msm_kms *kms)
> dpu_kms->reg_dma_len = dpu_iomap_size(dpu_kms->pdev,
> "regdma");
> }
>
> - dpu_kms->core_client = dpu_power_client_create(&dpu_kms->phandle,
> - "core");
> - if (IS_ERR_OR_NULL(dpu_kms->core_client)) {
> - rc = PTR_ERR(dpu_kms->core_client);
> - if (!dpu_kms->core_client)
> - rc = -EINVAL;
> - DPU_ERROR("dpu power client create failed: %d\n", rc);
> - dpu_kms->core_client = NULL;
> - goto error;
> - }
> -
> pm_runtime_get_sync(&dpu_kms->pdev->dev);
>
> _dpu_kms_core_hw_rev_init(dpu_kms);
> @@ -1157,8 +1141,7 @@ static int __maybe_unused
> dpu_runtime_suspend(struct
> device *dev)
> return rc;
> }
>
> - rc = dpu_power_resource_enable(&dpu_kms->phandle,
> - dpu_kms->core_client, false);
> + rc = dpu_power_resource_enable(&dpu_kms->phandle, false);
> if (rc)
> DPU_ERROR("resource disable failed: %d\n", rc);
>
> @@ -1189,8 +1172,7 @@ static int __maybe_unused
> dpu_runtime_resume(struct
> device *dev)
> return rc;
> }
>
> - rc = dpu_power_resource_enable(&dpu_kms->phandle,
> - dpu_kms->core_client, true);
> + rc = dpu_power_resource_enable(&dpu_kms->phandle, true);
> if (rc)
> DPU_ERROR("resource enable failed: %d\n", rc);
>
> diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> index 2a3625eef6d3..f2c78deb0854 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
> @@ -114,7 +114,6 @@ struct dpu_kms {
> struct dpu_mdss_cfg *catalog;
>
> struct dpu_power_handle phandle;
> - struct dpu_power_client *core_client;
> struct dpu_power_event *power_event;
>
> /* directory entry for debugfs */
> 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 8c6f92aaaf87..8e64f0a52147 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
> @@ -35,59 +35,11 @@ static void dpu_power_event_trigger_locked(struct
> dpu_power_handle *phandle,
> }
> }
>
> -struct dpu_power_client *dpu_power_client_create(
> - struct dpu_power_handle *phandle, char *client_name)
> -{
> - struct dpu_power_client *client;
> - static u32 id;
> -
> - if (!client_name || !phandle) {
> - pr_err("client name is null or invalid power data\n");
> - return ERR_PTR(-EINVAL);
> - }
> -
> - client = kzalloc(sizeof(struct dpu_power_client), GFP_KERNEL);
> - if (!client)
> - return ERR_PTR(-ENOMEM);
> -
> - mutex_lock(&phandle->phandle_lock);
> - strlcpy(client->name, client_name, MAX_CLIENT_NAME_LEN);
> - client->usecase_ndx = VOTE_INDEX_DISABLE;
> - client->id = id;
> - client->active = true;
> - pr_debug("client %s created:%pK id :%d\n", client_name,
> - client, id);
> - id++;
> - list_add(&client->list, &phandle->power_client_clist);
> - mutex_unlock(&phandle->phandle_lock);
> -
> - return client;
> -}
> -
> -void dpu_power_client_destroy(struct dpu_power_handle *phandle,
> - struct dpu_power_client *client)
> -{
> - if (!client || !phandle) {
> - pr_err("reg bus vote: invalid client handle\n");
> - } else if (!client->active) {
> - pr_err("dpu power deinit already done\n");
> - kfree(client);
> - } else {
> - pr_debug("bus vote client %s destroyed:%pK id:%u\n",
> - client->name, client, client->id);
> - mutex_lock(&phandle->phandle_lock);
> - list_del_init(&client->list);
> - mutex_unlock(&phandle->phandle_lock);
> - kfree(client);
> - }
> -}
> -
> void dpu_power_resource_init(struct platform_device *pdev,
> struct dpu_power_handle *phandle)
> {
> phandle->dev = &pdev->dev;
>
> - INIT_LIST_HEAD(&phandle->power_client_clist);
> INIT_LIST_HEAD(&phandle->event_list);
>
> mutex_init(&phandle->phandle_lock);
> @@ -96,7 +48,6 @@ void dpu_power_resource_init(struct platform_device
> *pdev,
> void dpu_power_resource_deinit(struct platform_device *pdev,
> struct dpu_power_handle *phandle)
> {
> - struct dpu_power_client *curr_client, *next_client;
> struct dpu_power_event *curr_event, *next_event;
>
> if (!phandle || !pdev) {
> @@ -105,15 +56,6 @@ void dpu_power_resource_deinit(struct
> platform_device
> *pdev,
> }
>
> mutex_lock(&phandle->phandle_lock);
> - list_for_each_entry_safe(curr_client, next_client,
> - &phandle->power_client_clist, list) {
> - pr_err("client:%s-%d still registered with refcount:%d\n",
> - curr_client->name, curr_client->id,
> - curr_client->refcount);
> - curr_client->active = false;
> - list_del(&curr_client->list);
> - }
> -
> list_for_each_entry_safe(curr_event, next_event,
> &phandle->event_list, list) {
> pr_err("event:%d, client:%s still registered\n",
> @@ -125,53 +67,21 @@ void dpu_power_resource_deinit(struct
> platform_device
> *pdev,
> mutex_unlock(&phandle->phandle_lock);
> }
>
> -int dpu_power_resource_enable(struct dpu_power_handle *phandle,
> - struct dpu_power_client *pclient, bool enable)
> +int dpu_power_resource_enable(struct dpu_power_handle *phandle, bool
> enable)
> {
> - bool changed = false;
> - u32 max_usecase_ndx = VOTE_INDEX_DISABLE, prev_usecase_ndx;
> - struct dpu_power_client *client;
> u32 event_type;
>
> - if (!phandle || !pclient) {
> + if (!phandle) {
> pr_err("invalid input argument\n");
> return -EINVAL;
> }
>
> mutex_lock(&phandle->phandle_lock);
> - if (enable)
> - pclient->refcount++;
> - else if (pclient->refcount)
> - pclient->refcount--;
> -
> - if (pclient->refcount)
> - pclient->usecase_ndx = VOTE_INDEX_LOW;
> - else
> - pclient->usecase_ndx = VOTE_INDEX_DISABLE;
> -
> - list_for_each_entry(client, &phandle->power_client_clist, list) {
> - if (client->usecase_ndx < VOTE_INDEX_MAX &&
> - client->usecase_ndx > max_usecase_ndx)
> - max_usecase_ndx = client->usecase_ndx;
> - }
> -
> - if (phandle->current_usecase_ndx != max_usecase_ndx) {
> - changed = true;
> - prev_usecase_ndx = phandle->current_usecase_ndx;
> - phandle->current_usecase_ndx = max_usecase_ndx;
> - }
> -
> - pr_debug("%pS: changed=%d current idx=%d request client %s id:%u
> enable:%d refcount:%d\n",
> - __builtin_return_address(0), changed, max_usecase_ndx,
> - pclient->name, pclient->id, enable, pclient->refcount);
> -
> - if (!changed)
> - goto end;
>
> event_type = enable ? DPU_POWER_EVENT_ENABLE :
> DPU_POWER_EVENT_DISABLE;
>
> dpu_power_event_trigger_locked(phandle, event_type);
> -end:
> +
> mutex_unlock(&phandle->phandle_lock);
> return 0;
> }
> 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 f627ae28ec68..124ebc93c877 100644
> --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h
> +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h
> @@ -27,30 +27,6 @@
> #define DPU_POWER_EVENT_DISABLE BIT(0)
> #define DPU_POWER_EVENT_ENABLE BIT(1)
>
> -/**
> - * mdss_bus_vote_type: register bus vote type
> - * VOTE_INDEX_DISABLE: removes the client vote
> - * VOTE_INDEX_LOW: keeps the lowest vote for register bus
> - * VOTE_INDEX_MAX: invalid
> - */
> -enum mdss_bus_vote_type {
> - VOTE_INDEX_DISABLE,
> - VOTE_INDEX_LOW,
> - VOTE_INDEX_MAX,
> -};
> -
> -/**
> - * enum dpu_power_handle_data_bus_client - type of axi bus clients
> - * @DPU_POWER_HANDLE_DATA_BUS_CLIENT_RT: core real-time bus client
> - * @DPU_POWER_HANDLE_DATA_BUS_CLIENT_NRT: core non-real-time bus
> client
> - * @DPU_POWER_HANDLE_DATA_BUS_CLIENT_MAX: maximum number of bus client
> type
> - */
> -enum dpu_power_handle_data_bus_client {
> - DPU_POWER_HANDLE_DATA_BUS_CLIENT_RT,
> - DPU_POWER_HANDLE_DATA_BUS_CLIENT_NRT,
> - DPU_POWER_HANDLE_DATA_BUS_CLIENT_MAX
> -};
> -
> /**
> * enum DPU_POWER_HANDLE_DBUS_ID - data bus identifier
> * @DPU_POWER_HANDLE_DBUS_ID_MNOC: DPU/MNOC data bus
> @@ -64,31 +40,6 @@ enum DPU_POWER_HANDLE_DBUS_ID {
> DPU_POWER_HANDLE_DBUS_ID_MAX,
> };
>
> -/**
> - * struct dpu_power_client: stores the power client for dpu driver
> - * @name: name of the client
> - * @usecase_ndx: current regs bus vote type
> - * @refcount: current refcount if multiple modules are using same
> - * same client for enable/disable. Power module will
> - * aggregate the refcount and vote accordingly for this
> - * client.
> - * @id: assigned during create. helps for debugging.
> - * @list: list to attach power handle master list
> - * @ab: arbitrated bandwidth for each bus client
> - * @ib: instantaneous bandwidth for each bus client
> - * @active: inidcates the state of dpu power handle
> - */
> -struct dpu_power_client {
> - char name[MAX_CLIENT_NAME_LEN];
> - short usecase_ndx;
> - short refcount;
> - u32 id;
> - struct list_head list;
> - u64 ab[DPU_POWER_HANDLE_DATA_BUS_CLIENT_MAX];
> - u64 ib[DPU_POWER_HANDLE_DATA_BUS_CLIENT_MAX];
> - bool active;
> -};
> -
> /*
> * struct dpu_power_event - local event registration structure
> * @client_name: name of the client registering
> @@ -109,14 +60,12 @@ struct dpu_power_event {
>
> /**
> * struct dpu_power_handle: power handle main struct
> - * @client_clist: master list to store all clients
> * @phandle_lock: lock to synchronize the enable/disable
> * @dev: pointer to device structure
> * @usecase_ndx: current usecase index
> * @event_list: current power handle event list
> */
> struct dpu_power_handle {
> - struct list_head power_client_clist;
> struct mutex phandle_lock;
> struct device *dev;
> u32 current_usecase_ndx;
> @@ -141,47 +90,14 @@ void dpu_power_resource_init(struct
> platform_device
> *pdev,
> void dpu_power_resource_deinit(struct platform_device *pdev,
> struct dpu_power_handle *pdata);
>
> -/**
> - * dpu_power_client_create() - create the client on power handle
> - * @pdata: power handle containing the resources
> - * @client_name: new client name for registration
> - *
> - * Return: error code.
> - */
> -struct dpu_power_client *dpu_power_client_create(struct
> dpu_power_handle
> *pdata,
> - char *client_name);
> -
> -/**
> - * dpu_power_client_destroy() - destroy the client on power handle
> - * @pdata: power handle containing the resources
> - * @client_name: new client name for registration
> - *
> - * Return: none
> - */
> -void dpu_power_client_destroy(struct dpu_power_handle *phandle,
> - struct dpu_power_client *client);
> -
> /**
> * dpu_power_resource_enable() - enable/disable the power resources
> * @pdata: power handle containing the resources
> - * @client: client information to enable/disable its vote
> * @enable: boolean request for enable/disable
> *
> * Return: error code.
> */
> -int dpu_power_resource_enable(struct dpu_power_handle *pdata,
> - struct dpu_power_client *pclient, bool enable);
> -
> -/**
> - * dpu_power_data_bus_bandwidth_ctrl() - control data bus bandwidth
> enable
> - * @phandle: power handle containing the resources
> - * @client: client information to bandwidth control
> - * @enable: true to enable bandwidth for data base
> - *
> - * Return: none
> - */
> -void dpu_power_data_bus_bandwidth_ctrl(struct dpu_power_handle
> *phandle,
> - struct dpu_power_client *pclient, int enable);
> +int dpu_power_resource_enable(struct dpu_power_handle *pdata, bool
> enable);
>
> /**
> * dpu_power_handle_register_event - register a callback function for
> an
> event.
--
Jeykumar S
_______________________________________________
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno
next prev parent reply other threads:[~2018-11-13 0:57 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-12 19:42 [PATCH 00/12] drm/msm: dpu: Clean up runtime power handling Sean Paul
2018-11-12 19:42 ` [PATCH 02/12] drm/msm: dpu: Remove unused trace_dpu_perf_update_bus() Sean Paul
[not found] ` <20181112194222.193546-3-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 0:48 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 04/12] drm/msm: dpu: Don't use power_event for vbif_init_memtypes Sean Paul
[not found] ` <20181112194222.193546-5-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:01 ` Jeykumar Sankaran
[not found] ` <488b7be307ca7f5db3b7c22c62a79e89-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-13 15:24 ` [PATCH v2 " Sean Paul
2018-11-13 1:06 ` [PATCH " Jeykumar Sankaran
2018-11-13 1:31 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 05/12] drm/msm: dpu: Handle crtc pm_runtime_resume() directly Sean Paul
2018-11-13 1:20 ` Jeykumar Sankaran
[not found] ` <9d648caa250f75a9870e77de283b2927-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-13 15:16 ` Sean Paul
2018-11-12 19:42 ` [PATCH 06/12] drm/msm: dpu: Remove power_handle from core_perf Sean Paul
[not found] ` <20181112194222.193546-7-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:25 ` Jeykumar Sankaran
[not found] ` <20181112194222.193546-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-12 19:42 ` [PATCH 01/12] drm/msm: dpu: Remove dpu_power_handle_get_dbus_name() Sean Paul
[not found] ` <20181112194222.193546-2-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 0:37 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 03/12] drm/msm: dpu: Remove dpu_power_client Sean Paul
[not found] ` <20181112194222.193546-4-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 0:57 ` Jeykumar Sankaran [this message]
2018-11-12 19:42 ` [PATCH 07/12] drm/msm: dpu: Include dpu_io_util.h directly in dpu_kms.h Sean Paul
[not found] ` <20181112194222.193546-8-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:26 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 10/12] drm/msm: dpu: Fix typo in dpu_encoder Sean Paul
[not found] ` <20181112194222.193546-11-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:32 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 12/12] drm/msm: dpu: Move crtc runtime resume to encoder Sean Paul
[not found] ` <20181112194222.193546-13-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:47 ` Jeykumar Sankaran
[not found] ` <883389e20cc26db9071884be7b0802e7-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-13 15:22 ` Sean Paul
2018-11-13 15:55 ` [PATCH v2 13/12] drm/msm: dpu: Don't drop locks in crtc_vblank_enable Sean Paul
2018-11-12 19:42 ` [PATCH 08/12] drm/msm: dpu: Move DPU_POWER_HANDLE_DBUS_ID to core_perf Sean Paul
2018-11-13 1:27 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 09/12] drm/msm: dpu: Remove dpu_power_handle Sean Paul
[not found] ` <20181112194222.193546-10-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:30 ` Jeykumar Sankaran
2018-11-12 19:42 ` [PATCH 11/12] drm/msm: dpu: Add ->enabled to dpu_encoder_virt Sean Paul
[not found] ` <20181112194222.193546-12-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-13 1:43 ` Jeykumar Sankaran
[not found] ` <848efa69c74b25ee0845e02dc4d19d61-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-13 15:19 ` 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=1b4f2636f7c924ff13da0e3637e4854d@codeaurora.org \
--to=jsanka-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
--cc=abhinavk-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
--cc=dri-devel-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=freedreno-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org \
--cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=robdclark-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=sean-p7yTbzM4H96eqtR555YLDQ@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.