All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Paul <sean@poorly.run>
To: dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org,
	linux-arm-msm@vger.kernel.org
Cc: robdclark@gmail.com, jsanka@codeaurora.org,
	Sean Paul <seanpaul@chromium.org>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 09/24] drm/msm: dpu: Remove dpu_power_handle
Date: Fri, 16 Nov 2018 13:42:19 -0500	[thread overview]
Message-ID: <20181116184238.170034-10-sean@poorly.run> (raw)
In-Reply-To: <20181116184238.170034-1-sean@poorly.run>

From: Sean Paul <seanpaul@chromium.org>

Now that we don't have any event handlers, remove dpu_power_handle!

Changes in v2:
- None

Reviewed-by: Jeykumar Sankaran <jsanka@codeaurora.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/msm/Makefile                  |   1 -
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c       |  11 --
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h       |   3 -
 .../gpu/drm/msm/disp/dpu1/dpu_power_handle.c  | 136 ------------------
 .../gpu/drm/msm/disp/dpu1/dpu_power_handle.h  | 113 ---------------
 5 files changed, 264 deletions(-)
 delete mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
 delete mode 100644 drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h

diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 19ab521d4c3a..7d02ef3655b5 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -72,7 +72,6 @@ msm-y := \
 	disp/dpu1/dpu_kms.o \
 	disp/dpu1/dpu_mdss.o \
 	disp/dpu1/dpu_plane.o \
-	disp/dpu1/dpu_power_handle.o \
 	disp/dpu1/dpu_rm.o \
 	disp/dpu1/dpu_vbif.o \
 	msm_atomic.o \
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index af666d917a0b..9f7da56bb453 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1060,8 +1060,6 @@ static int dpu_bind(struct device *dev, struct device *master, void *data)
 		return ret;
 	}
 
-	dpu_power_resource_init(pdev, &dpu_kms->phandle);
-
 	platform_set_drvdata(pdev, dpu_kms);
 
 	msm_kms_init(&dpu_kms->base, &kms_funcs);
@@ -1081,7 +1079,6 @@ static void dpu_unbind(struct device *dev, struct device *master, void *data)
 	struct dpu_kms *dpu_kms = platform_get_drvdata(pdev);
 	struct dss_module_power *mp = &dpu_kms->mp;
 
-	dpu_power_resource_deinit(pdev, &dpu_kms->phandle);
 	msm_dss_put_clk(mp->clk_config, mp->num_clk);
 	devm_kfree(&pdev->dev, mp->clk_config);
 	mp->num_clk = 0;
@@ -1120,10 +1117,6 @@ static int __maybe_unused dpu_runtime_suspend(struct device *dev)
 		return rc;
 	}
 
-	rc = dpu_power_resource_enable(&dpu_kms->phandle, false);
-	if (rc)
-		DPU_ERROR("resource disable failed: %d\n", rc);
-
 	rc = msm_dss_enable_clk(mp->clk_config, mp->num_clk, false);
 	if (rc)
 		DPU_ERROR("clock disable failed rc:%d\n", rc);
@@ -1157,10 +1150,6 @@ static int __maybe_unused dpu_runtime_resume(struct device *dev)
 	drm_for_each_crtc(crtc, ddev)
 		dpu_crtc_runtime_resume(crtc);
 
-	rc = dpu_power_resource_enable(&dpu_kms->phandle, true);
-	if (rc)
-		DPU_ERROR("resource enable failed: %d\n", rc);
-
 	return rc;
 }
 
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
index 4e5acacb3065..59e18e2d3c59 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h
@@ -31,7 +31,6 @@
 #include "dpu_hw_top.h"
 #include "dpu_io_util.h"
 #include "dpu_rm.h"
-#include "dpu_power_handle.h"
 #include "dpu_irq.h"
 #include "dpu_core_perf.h"
 
@@ -114,8 +113,6 @@ struct dpu_kms {
 	int core_rev;
 	struct dpu_mdss_cfg *catalog;
 
-	struct dpu_power_handle phandle;
-
 	/* directory entry for debugfs */
 	struct dentry *debugfs_root;
 	struct dentry *debugfs_danger;
diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
deleted file mode 100644
index 8e64f0a52147..000000000000
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Copyright (c) 2014-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#define pr_fmt(fmt)	"[drm:%s:%d]: " fmt, __func__, __LINE__
-
-#include <linux/kernel.h>
-#include <linux/of.h>
-#include <linux/string.h>
-#include <linux/of_address.h>
-#include <linux/slab.h>
-#include <linux/mutex.h>
-#include <linux/of_platform.h>
-
-#include "dpu_power_handle.h"
-#include "dpu_trace.h"
-
-static void dpu_power_event_trigger_locked(struct dpu_power_handle *phandle,
-		u32 event_type)
-{
-	struct dpu_power_event *event;
-
-	list_for_each_entry(event, &phandle->event_list, list) {
-		if (event->event_type & event_type)
-			event->cb_fnc(event_type, event->usr);
-	}
-}
-
-void dpu_power_resource_init(struct platform_device *pdev,
-	struct dpu_power_handle *phandle)
-{
-	phandle->dev = &pdev->dev;
-
-	INIT_LIST_HEAD(&phandle->event_list);
-
-	mutex_init(&phandle->phandle_lock);
-}
-
-void dpu_power_resource_deinit(struct platform_device *pdev,
-	struct dpu_power_handle *phandle)
-{
-	struct dpu_power_event *curr_event, *next_event;
-
-	if (!phandle || !pdev) {
-		pr_err("invalid input param\n");
-		return;
-	}
-
-	mutex_lock(&phandle->phandle_lock);
-	list_for_each_entry_safe(curr_event, next_event,
-			&phandle->event_list, list) {
-		pr_err("event:%d, client:%s still registered\n",
-				curr_event->event_type,
-				curr_event->client_name);
-		curr_event->active = false;
-		list_del(&curr_event->list);
-	}
-	mutex_unlock(&phandle->phandle_lock);
-}
-
-int dpu_power_resource_enable(struct dpu_power_handle *phandle, bool enable)
-{
-	u32 event_type;
-
-	if (!phandle) {
-		pr_err("invalid input argument\n");
-		return -EINVAL;
-	}
-
-	mutex_lock(&phandle->phandle_lock);
-
-	event_type = enable ? DPU_POWER_EVENT_ENABLE : DPU_POWER_EVENT_DISABLE;
-
-	dpu_power_event_trigger_locked(phandle,	event_type);
-
-	mutex_unlock(&phandle->phandle_lock);
-	return 0;
-}
-
-struct dpu_power_event *dpu_power_handle_register_event(
-		struct dpu_power_handle *phandle,
-		u32 event_type, void (*cb_fnc)(u32 event_type, void *usr),
-		void *usr, char *client_name)
-{
-	struct dpu_power_event *event;
-
-	if (!phandle) {
-		pr_err("invalid power handle\n");
-		return ERR_PTR(-EINVAL);
-	} else if (!cb_fnc || !event_type) {
-		pr_err("no callback fnc or event type\n");
-		return ERR_PTR(-EINVAL);
-	}
-
-	event = kzalloc(sizeof(struct dpu_power_event), GFP_KERNEL);
-	if (!event)
-		return ERR_PTR(-ENOMEM);
-
-	event->event_type = event_type;
-	event->cb_fnc = cb_fnc;
-	event->usr = usr;
-	strlcpy(event->client_name, client_name, MAX_CLIENT_NAME_LEN);
-	event->active = true;
-
-	mutex_lock(&phandle->phandle_lock);
-	list_add(&event->list, &phandle->event_list);
-	mutex_unlock(&phandle->phandle_lock);
-
-	return event;
-}
-
-void dpu_power_handle_unregister_event(
-		struct dpu_power_handle *phandle,
-		struct dpu_power_event *event)
-{
-	if (!phandle || !event) {
-		pr_err("invalid phandle or event\n");
-	} else if (!event->active) {
-		pr_err("power handle deinit already done\n");
-		kfree(event);
-	} else {
-		mutex_lock(&phandle->phandle_lock);
-		list_del_init(&event->list);
-		mutex_unlock(&phandle->phandle_lock);
-		kfree(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
deleted file mode 100644
index 7536624c8b20..000000000000
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_power_handle.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* Copyright (c) 2016-2018, The Linux Foundation. All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 and
- * only version 2 as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- */
-
-#ifndef _DPU_POWER_HANDLE_H_
-#define _DPU_POWER_HANDLE_H_
-
-#define MAX_CLIENT_NAME_LEN 128
-
-#define DPU_POWER_HANDLE_ENABLE_BUS_AB_QUOTA	0
-#define DPU_POWER_HANDLE_DISABLE_BUS_AB_QUOTA	0
-#define DPU_POWER_HANDLE_ENABLE_BUS_IB_QUOTA	1600000000
-#define DPU_POWER_HANDLE_DISABLE_BUS_IB_QUOTA	0
-
-#include "dpu_io_util.h"
-
-/* events will be triggered on power handler enable/disable */
-#define DPU_POWER_EVENT_DISABLE	BIT(0)
-#define DPU_POWER_EVENT_ENABLE	BIT(1)
-
-/*
- * struct dpu_power_event - local event registration structure
- * @client_name: name of the client registering
- * @cb_fnc: pointer to desired callback function
- * @usr: user pointer to pass to callback event trigger
- * @event: refer to DPU_POWER_HANDLE_EVENT_*
- * @list: list to attach event master list
- * @active: indicates the state of dpu power handle
- */
-struct dpu_power_event {
-	char client_name[MAX_CLIENT_NAME_LEN];
-	void (*cb_fnc)(u32 event_type, void *usr);
-	void *usr;
-	u32 event_type;
-	struct list_head list;
-	bool active;
-};
-
-/**
- * struct dpu_power_handle: power handle main struct
- * @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 mutex phandle_lock;
-	struct device *dev;
-	u32 current_usecase_ndx;
-	struct list_head event_list;
-};
-
-/**
- * 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
- */
-void dpu_power_resource_init(struct platform_device *pdev,
-	struct dpu_power_handle *pdata);
-
-/**
- * dpu_power_resource_deinit() - release the dpu power handle
- * @pdev:   platform device for power resources
- * @pdata:  power handle containing the resources
- *
- * Return: error code.
- */
-void dpu_power_resource_deinit(struct platform_device *pdev,
-	struct dpu_power_handle *pdata);
-
-/**
- * dpu_power_resource_enable() - enable/disable the power resources
- * @pdata:  power handle containing the resources
- * @enable: boolean request for enable/disable
- *
- * Return: error code.
- */
-int dpu_power_resource_enable(struct dpu_power_handle *pdata, bool enable);
-
-/**
- * dpu_power_handle_register_event - register a callback function for an event.
- *	Clients can register for multiple events with a single register.
- *	Any block with access to phandle can register for the event
- *	notification.
- * @phandle:	power handle containing the resources
- * @event_type:	event type to register; refer DPU_POWER_HANDLE_EVENT_*
- * @cb_fnc:	pointer to desired callback function
- * @usr:	user pointer to pass to callback on event trigger
- *
- * Return:	event pointer if success, or error code otherwise
- */
-struct dpu_power_event *dpu_power_handle_register_event(
-		struct dpu_power_handle *phandle,
-		u32 event_type, void (*cb_fnc)(u32 event_type, void *usr),
-		void *usr, char *client_name);
-/**
- * dpu_power_handle_unregister_event - unregister callback for event(s)
- * @phandle:	power handle containing the resources
- * @event:	event pointer returned after power handle register
- */
-void dpu_power_handle_unregister_event(struct dpu_power_handle *phandle,
-		struct dpu_power_event *event);
-
-#endif /* _DPU_POWER_HANDLE_H_ */
-- 
Sean Paul, Software Engineer, Google / Chromium OS

  parent reply	other threads:[~2018-11-16 18:42 UTC|newest]

Thread overview: 54+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-16 18:42 [PATCH v2 00/24] drm/msm: Various dpu locking and legacy cleanups Sean Paul
2018-11-16 18:42 ` [PATCH v2 01/24] drm/msm: dpu: Remove dpu_power_handle_get_dbus_name() Sean Paul
2018-11-16 18:42 ` [PATCH v2 03/24] drm/msm: dpu: Remove dpu_power_client Sean Paul
2018-11-16 18:42 ` [PATCH v2 04/24] drm/msm: dpu: Don't use power_event for vbif_init_memtypes Sean Paul
     [not found]   ` <20181116184238.170034-5-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-12-03 19:49     ` Jeykumar Sankaran
2018-11-16 18:42 ` Sean Paul [this message]
2018-11-16 18:42 ` [PATCH v2 11/24] drm/msm: dpu: Add ->enabled to dpu_encoder_virt Sean Paul
2018-12-03 19:51   ` Jeykumar Sankaran
     [not found] ` <20181116184238.170034-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-16 18:42   ` [PATCH v2 02/24] drm/msm: dpu: Remove unused trace_dpu_perf_update_bus() Sean Paul
2018-11-16 18:42   ` [PATCH v2 05/24] drm/msm: dpu: Handle crtc pm_runtime_resume() directly Sean Paul
     [not found]     ` <20181116184238.170034-6-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 19:41       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 06/24] drm/msm: dpu: Remove power_handle from core_perf Sean Paul
2018-11-16 18:42   ` [PATCH v2 07/24] drm/msm: dpu: Include dpu_io_util.h directly in dpu_kms.h Sean Paul
2018-11-16 18:42   ` [PATCH v2 08/24] drm/msm: dpu: Move DPU_POWER_HANDLE_DBUS_ID to core_perf Sean Paul
2018-11-16 18:42   ` [PATCH v2 10/24] drm/msm: dpu: Fix typo in dpu_encoder Sean Paul
2018-11-16 18:42   ` [PATCH v2 12/24] drm/msm: dpu: Move crtc runtime resume to encoder Sean Paul
     [not found]     ` <20181116184238.170034-13-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-12-03 19:52       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 13/24] drm/msm: dpu: Don't drop locks in crtc_vblank_enable Sean Paul
2018-11-19 19:43     ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 14/24] drm/msm: dpu: Grab the modeset locks in frame_event Sean Paul
2018-11-16 20:02     ` Jeykumar Sankaran
     [not found]       ` <0405e429330ba1de19d96a6918a6daae-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-16 21:18         ` Sean Paul
     [not found]     ` <20181116184238.170034-15-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-30 22:00       ` [PATCH v3 " Sean Paul
2018-12-03 19:53         ` Jeykumar Sankaran
     [not found]         ` <20181130220011.39644-1-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-12-03 21:45           ` Daniel Vetter
2018-11-16 18:42   ` [PATCH v2 15/24] drm/msm: dpu: Stop using encoder->crtc pointer Sean Paul
     [not found]     ` <20181116184238.170034-16-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-16 20:05       ` Jeykumar Sankaran
     [not found]         ` <580ced340265a3c45b31836291bfbb4c-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2018-11-16 21:14           ` Sean Paul
2018-11-19 20:03             ` Jeykumar Sankaran
2018-11-26 21:53               ` Sean Paul
2018-12-03 19:43                 ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 16/24] drm/msm: dpu: Add modeset lock checks where applicable Sean Paul
2018-11-16 20:05     ` Jeykumar Sankaran
2019-10-09 22:20     ` Daniel Vetter
2019-10-09 22:20       ` Daniel Vetter
2019-10-10 13:13       ` Sean Paul
2019-10-10 13:13         ` Sean Paul
2018-11-16 18:42   ` [PATCH v2 17/24] drm/msm: dpu: Move pm_runtime_(get|put) from vblank_enable Sean Paul
2018-11-19 20:09     ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 18/24] drm/msm: dpu: Remove crtc_lock from setup_mixers Sean Paul
     [not found]     ` <20181116184238.170034-19-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:09       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 20/24] drm/msm: dpu: Use atomic_disable for dpu_crtc_disable Sean Paul
     [not found]     ` <20181116184238.170034-21-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:12       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 21/24] drm/msm: dpu: Don't bother checking ->enabled in dpu_crtc_vblank Sean Paul
     [not found]     ` <20181116184238.170034-22-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:13       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 23/24] drm/msm: dpu: Remove vblank_requested flag from dpu_crtc Sean Paul
     [not found]     ` <20181116184238.170034-24-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:14       ` Jeykumar Sankaran
2018-11-16 18:42   ` [PATCH v2 24/24] drm/msm: dpu: Remove crtc_lock Sean Paul
     [not found]     ` <20181116184238.170034-25-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:14       ` Jeykumar Sankaran
2018-11-16 18:42 ` [PATCH v2 19/24] drm/msm: dpu: Remove vblank_callback from encoder Sean Paul
     [not found]   ` <20181116184238.170034-20-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:11     ` Jeykumar Sankaran
2018-11-16 18:42 ` [PATCH v2 22/24] drm/msm: dpu: Separate crtc assignment from vblank enable Sean Paul
     [not found]   ` <20181116184238.170034-23-sean-p7yTbzM4H96eqtR555YLDQ@public.gmane.org>
2018-11-19 20:13     ` Jeykumar Sankaran
2018-12-04 15:15 ` [PATCH v2 00/24] drm/msm: Various dpu locking and legacy cleanups 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=20181116184238.170034-10-sean@poorly.run \
    --to=sean@poorly.run \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=freedreno@lists.freedesktop.org \
    --cc=jsanka@codeaurora.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robdclark@gmail.com \
    --cc=seanpaul@chromium.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.