diff mbox

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

Message ID 20170310043305.17216-35-seanpaul@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Sean Paul March 10, 2017, 4:32 a.m. UTC
From: Tomasz Figa <tfiga@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@chromium.org>
Cc: Brian Norris <briannorris@chromium.org>
Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Signed-off-by: Sean Paul <seanpaul@chromium.org>
---
 drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 3 +++
 include/drm/bridge/analogix_dp.h                   | 1 +
 2 files changed, 4 insertions(+)

Comments

Tomasz Figa March 10, 2017, 7:09 a.m. UTC | #1
Hi Sean,

On Fri, Mar 10, 2017 at 1:32 PM, Sean Paul <seanpaul@chromium.org> wrote:
>
> From: Tomasz Figa <tfiga@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@chromium.org>
> Cc: Brian Norris <briannorris@chromium.org>
> Signed-off-by: Tomasz Figa <tfiga@chromium.org>
> Signed-off-by: Sean Paul <seanpaul@chromium.org>
> ---
>  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 3 +++
>  include/drm/bridge/analogix_dp.h                   | 1 +
>  2 files changed, 4 insertions(+)

FYI, we ended up reverting this and subsequent patches from this
series up to 37, as we found a simpler and cleaner solution. Please
see following 2 CLs for reference:
https://chromium-review.googlesource.com/442390
https://chromium-review.googlesource.com/442392
https://chromium-review.googlesource.com/442391

Anyway, thanks for sending the patches upstream, it's really helpful
given my time constraints.

Best regards,
Tomasz
Sean Paul March 10, 2017, 2:24 p.m. UTC | #2
On Fri, Mar 10, 2017 at 04:09:57PM +0900, Tomasz Figa wrote:
> Hi Sean,
> 
> On Fri, Mar 10, 2017 at 1:32 PM, Sean Paul <seanpaul@chromium.org> wrote:
> >
> > From: Tomasz Figa <tfiga@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@chromium.org>
> > Cc: Brian Norris <briannorris@chromium.org>
> > Signed-off-by: Tomasz Figa <tfiga@chromium.org>
> > Signed-off-by: Sean Paul <seanpaul@chromium.org>
> > ---
> >  drivers/gpu/drm/bridge/analogix/analogix_dp_core.c | 3 +++
> >  include/drm/bridge/analogix_dp.h                   | 1 +
> >  2 files changed, 4 insertions(+)
> 
> FYI, we ended up reverting this and subsequent patches from this
> series up to 37, as we found a simpler and cleaner solution. Please
> see following 2 CLs for reference:

Thanks, Tomasz. I'll drop these from the series. 

> https://chromium-review.googlesource.com/442390
> https://chromium-review.googlesource.com/442392
> https://chromium-review.googlesource.com/442391
> 

Looks like these haven't landed yet, and that's why I missed them. I'll pick
them up in a subsequent set.

Sean

> Anyway, thanks for sending the patches upstream, it's really helpful
> given my time constraints.
> 
> Best regards,
> Tomasz
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

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);