Skip to content

Commit

Permalink
firmware: tegra: bpmp: Implement suspend/resume support
Browse files Browse the repository at this point in the history
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 <treding@nvidia.com>
  • Loading branch information
Thierry Reding committed Oct 10, 2018
1 parent 5b394b2 commit 00cba11
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions drivers/firmware/tegra/bpmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <linux/of_address.h>
#include <linux/of_device.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/semaphore.h>
#include <linux/sched/clock.h>

Expand Down Expand Up @@ -843,6 +844,23 @@ static int tegra_bpmp_probe(struct platform_device *pdev)
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 = {
Expand Down Expand Up @@ -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,
};
Expand Down

0 comments on commit 00cba11

Please sign in to comment.