[PATCH 34/41] drm/bridge: analogix_dp: Allow master driver to cleanup in unbind

Sean Paul seanpaul at chromium.org
Thu Mar 9 20:32:49 PST 2017


From: Tomasz Figa <tfiga at chromium.org>

Since we take the ownership of drvdata, the master driver does not have
any means of accessing its own data from unbind callback and all it can
do is calling the analogix unbind callback. However it might be
necessary to do some clean up in the master driver before we really
unbind the analogix part (such as PSR unregister in Rockchip case), so
this patch provides a plat_data->cleanup() callback which is called at
the beginning of analogix_dp_unbind().

Cc: Kristian H. Kristensen <hoegsberg at chromium.org>
Cc: Brian Norris <briannorris at chromium.org>
Signed-off-by: Tomasz Figa <tfiga at chromium.org>
Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 3 +++
 include/drm/bridge/analogix_dp.h                   | 1 +
 2 files changed, 4 insertions(+)

diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
index 65af5ef8ec12..6391f5da7643 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_core.c
@@ -1651,6 +1651,9 @@ void analogix_dp_unbind(struct device *dev, struct device *master,
 {
 	struct analogix_dp_device *dp = dev_get_drvdata(dev);
 
+	if (dp->plat_data->cleanup)
+		dp->plat_data->cleanup(dp->plat_data);
+
 	analogix_dp_bridge_disable(dp->bridge);
 
 	if (dp->plat_data->panel) {
diff --git a/include/drm/bridge/analogix_dp.h b/include/drm/bridge/analogix_dp.h
index 4fc0165ed3f5..414e9a7f362e 100644
--- a/include/drm/bridge/analogix_dp.h
+++ b/include/drm/bridge/analogix_dp.h
@@ -36,6 +36,7 @@ struct analogix_dp_plat_data {
 		      struct drm_connector *);
 	int (*get_modes)(struct analogix_dp_plat_data *,
 			 struct drm_connector *);
+	void (*cleanup)(struct analogix_dp_plat_data *);
 };
 
 int analogix_dp_psr_enabled(struct device *dev);
-- 
2.12.0.246.ga2ecc84866-goog




More information about the Linux-rockchip mailing list