From 00cba11fab58407a0017fc55476ea764161c5f07 Mon Sep 17 00:00:00 2001 From: Thierry Reding Date: Fri, 21 Sep 2018 12:08:56 +0200 Subject: firmware: tegra: bpmp: Implement suspend/resume support When returning from a system sleep state, the BPMP driver needs to reinitialize the IVC channels used to communicate with the BPMP to restore proper functionality. Signed-off-by: Thierry Reding --- drivers/firmware/tegra/bpmp.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'drivers/firmware') diff --git a/drivers/firmware/tegra/bpmp.c b/drivers/firmware/tegra/bpmp.c index 14a456afa379..a3d5b518c10e 100644 --- a/drivers/firmware/tegra/bpmp.c +++ b/drivers/firmware/tegra/bpmp.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -843,6 +844,23 @@ free_tx: return err; } +static int __maybe_unused tegra_bpmp_resume(struct device *dev) +{ + struct tegra_bpmp *bpmp = dev_get_drvdata(dev); + unsigned int i; + + /* reset message channels */ + tegra_bpmp_channel_reset(bpmp->tx_channel); + tegra_bpmp_channel_reset(bpmp->rx_channel); + + for (i = 0; i < bpmp->threaded.count; i++) + tegra_bpmp_channel_reset(&bpmp->threaded_channels[i]); + + return 0; +} + +static SIMPLE_DEV_PM_OPS(tegra_bpmp_pm_ops, NULL, tegra_bpmp_resume); + static const struct tegra_bpmp_soc tegra186_soc = { .channels = { .cpu_tx = { @@ -871,6 +889,7 @@ static struct platform_driver tegra_bpmp_driver = { .driver = { .name = "tegra-bpmp", .of_match_table = tegra_bpmp_match, + .pm = &tegra_bpmp_pm_ops, }, .probe = tegra_bpmp_probe, }; -- cgit v1.2.3-59-g8ed1b