pmaports/device/testing/linux-postmarketos-mtk-mt8183/mt8183-kukui-jacuzzi-fix-display-resume.patch

105 lines
2.8 KiB
Diff
Raw Normal View History

from: https://patchwork.kernel.org/project/linux-mediatek/patch/20210720100553.2340425-1-pihsun@chromium.org/
[v2] drm/bridge: anx7625: Use pm_runtime_force_{suspend, resume}
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c
index 14d73fb1dd15..8325e8d0ee19 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.c
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.c
@@ -1349,6 +1349,8 @@ static void anx7625_bridge_detach(struct drm_bridge *bridge)
mipi_dsi_detach(ctx->dsi);
mipi_dsi_device_unregister(ctx->dsi);
}
+ if (ctx->link)
+ device_link_del(ctx->link);
}
static int anx7625_bridge_attach(struct drm_bridge *bridge,
@@ -1373,17 +1375,33 @@ static int anx7625_bridge_attach(struct drm_bridge *bridge,
return err;
}
+ ctx->link = device_link_add(bridge->dev->dev, dev, DL_FLAG_STATELESS);
+ if (!ctx->link) {
+ DRM_DEV_ERROR(dev, "device link creation failed");
+ err = -EINVAL;
+ goto detach_dsi;
+ }
+
if (ctx->pdata.panel_bridge) {
err = drm_bridge_attach(bridge->encoder,
ctx->pdata.panel_bridge,
&ctx->bridge, flags);
if (err)
- return err;
+ goto remove_device_link;
}
ctx->bridge_attached = 1;
return 0;
+
+remove_device_link:
+ device_link_del(ctx->link);
+detach_dsi:
+ if (ctx->dsi) {
+ mipi_dsi_detach(ctx->dsi);
+ mipi_dsi_device_unregister(ctx->dsi);
+ }
+ return err;
}
static enum drm_mode_status
@@ -1720,38 +1738,9 @@ static int __maybe_unused anx7625_runtime_pm_resume(struct device *dev)
return 0;
}
-static int __maybe_unused anx7625_resume(struct device *dev)
-{
- struct anx7625_data *ctx = dev_get_drvdata(dev);
-
- if (!ctx->pdata.intp_irq)
- return 0;
-
- if (!pm_runtime_enabled(dev) || !pm_runtime_suspended(dev)) {
- enable_irq(ctx->pdata.intp_irq);
- anx7625_runtime_pm_resume(dev);
- }
-
- return 0;
-}
-
-static int __maybe_unused anx7625_suspend(struct device *dev)
-{
- struct anx7625_data *ctx = dev_get_drvdata(dev);
-
- if (!ctx->pdata.intp_irq)
- return 0;
-
- if (!pm_runtime_enabled(dev) || !pm_runtime_suspended(dev)) {
- anx7625_runtime_pm_suspend(dev);
- disable_irq(ctx->pdata.intp_irq);
- }
-
- return 0;
-}
-
static const struct dev_pm_ops anx7625_pm_ops = {
- SET_SYSTEM_SLEEP_PM_OPS(anx7625_suspend, anx7625_resume)
+ SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
+ pm_runtime_force_resume)
SET_RUNTIME_PM_OPS(anx7625_runtime_pm_suspend,
anx7625_runtime_pm_resume, NULL)
};
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.h b/drivers/gpu/drm/bridge/analogix/anx7625.h
index edbbfe410a56..299e62df6238 100644
--- a/drivers/gpu/drm/bridge/analogix/anx7625.h
+++ b/drivers/gpu/drm/bridge/analogix/anx7625.h
@@ -473,6 +473,7 @@ struct anx7625_data {
struct drm_connector *connector;
struct mipi_dsi_device *dsi;
struct drm_dp_aux aux;
+ struct device_link *link;
};
#endif /* __ANX7625_H__ */