diff options
author | Pi-Hsun Shih <pihsun@chromium.org> | 2021-05-17 14:35:29 +0800 |
---|---|---|
committer | Robert Foss <robert.foss@linaro.org> | 2021-05-18 14:51:15 +0200 |
commit | 409776fa3c42af4b008b491409fd26cd32cb3466 (patch) | |
tree | 82a1edfa367eee6ca71c113eb42ad75f8b29ed84 /drivers/gpu/drm/bridge | |
parent | 60487584a79abd763570b54d59e6aad586d64c7b (diff) |
drm/bridge: anx7625: add suspend / resume hooks
Add suspend / resume hooks for anx7625 driver, that power off the device
on suspend and power on the device on resume if it was previously
powered.
Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org>
Reviewed-by: Tzung-Bi Shih <tzungbi@google.com>
Signed-off-by: Robert Foss <robert.foss@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20210517063553.554955-2-pihsun@chromium.org
Diffstat (limited to 'drivers/gpu/drm/bridge')
-rw-r--r-- | drivers/gpu/drm/bridge/analogix/anx7625.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/gpu/drm/bridge/analogix/anx7625.c b/drivers/gpu/drm/bridge/analogix/anx7625.c index d6ad2ba1560d..29493cc2d300 100644 --- a/drivers/gpu/drm/bridge/analogix/anx7625.c +++ b/drivers/gpu/drm/bridge/analogix/anx7625.c @@ -1705,7 +1705,39 @@ 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); + flush_workqueue(ctx->workqueue); + } + + return 0; +} + static const struct dev_pm_ops anx7625_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(anx7625_suspend, anx7625_resume) SET_RUNTIME_PM_OPS(anx7625_runtime_pm_suspend, anx7625_runtime_pm_resume, NULL) }; |