Skip to content

Commit 364b40c

Browse files
committed
Merge branch 'for-6.7/firmware' into for-6.7/memory
2 parents 0bb80ec + ea608a0 commit 364b40c

3 files changed

Lines changed: 37 additions & 1 deletion

File tree

drivers/firmware/tegra/bpmp.c

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ static ssize_t tegra_bpmp_channel_write(struct tegra_bpmp_channel *channel,
313313
return __tegra_bpmp_channel_write(channel, mrq, flags, data, size);
314314
}
315315

316+
static int __maybe_unused tegra_bpmp_resume(struct device *dev);
317+
316318
int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp,
317319
struct tegra_bpmp_message *msg)
318320
{
@@ -325,6 +327,14 @@ int tegra_bpmp_transfer_atomic(struct tegra_bpmp *bpmp,
325327
if (!tegra_bpmp_message_valid(msg))
326328
return -EINVAL;
327329

330+
if (bpmp->suspended) {
331+
/* Reset BPMP IPC channels during resume based on flags passed */
332+
if (msg->flags & TEGRA_BPMP_MESSAGE_RESET)
333+
tegra_bpmp_resume(bpmp->dev);
334+
else
335+
return -EAGAIN;
336+
}
337+
328338
channel = bpmp->tx_channel;
329339

330340
spin_lock(&bpmp->atomic_tx_lock);
@@ -364,6 +374,14 @@ int tegra_bpmp_transfer(struct tegra_bpmp *bpmp,
364374
if (!tegra_bpmp_message_valid(msg))
365375
return -EINVAL;
366376

377+
if (bpmp->suspended) {
378+
/* Reset BPMP IPC channels during resume based on flags passed */
379+
if (msg->flags & TEGRA_BPMP_MESSAGE_RESET)
380+
tegra_bpmp_resume(bpmp->dev);
381+
else
382+
return -EAGAIN;
383+
}
384+
367385
channel = tegra_bpmp_write_threaded(bpmp, msg->mrq, msg->tx.data,
368386
msg->tx.size);
369387
if (IS_ERR(channel))
@@ -796,17 +814,29 @@ static int tegra_bpmp_probe(struct platform_device *pdev)
796814
return err;
797815
}
798816

817+
static int __maybe_unused tegra_bpmp_suspend(struct device *dev)
818+
{
819+
struct tegra_bpmp *bpmp = dev_get_drvdata(dev);
820+
821+
bpmp->suspended = true;
822+
823+
return 0;
824+
}
825+
799826
static int __maybe_unused tegra_bpmp_resume(struct device *dev)
800827
{
801828
struct tegra_bpmp *bpmp = dev_get_drvdata(dev);
802829

830+
bpmp->suspended = false;
831+
803832
if (bpmp->soc->ops->resume)
804833
return bpmp->soc->ops->resume(bpmp);
805834
else
806835
return 0;
807836
}
808837

809838
static const struct dev_pm_ops tegra_bpmp_pm_ops = {
839+
.suspend_noirq = tegra_bpmp_suspend,
810840
.resume_noirq = tegra_bpmp_resume,
811841
};
812842

include/soc/tegra/bpmp-abi.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1194,7 +1194,7 @@ struct cmd_clk_is_enabled_request {
11941194
*/
11951195
struct cmd_clk_is_enabled_response {
11961196
/**
1197-
* @brief The state of the clock that has been succesfully
1197+
* @brief The state of the clock that has been successfully
11981198
* requested with CMD_CLK_ENABLE or CMD_CLK_DISABLE by the
11991199
* master invoking the command earlier.
12001200
*

include/soc/tegra/bpmp.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,12 @@ struct tegra_bpmp {
102102
#ifdef CONFIG_DEBUG_FS
103103
struct dentry *debugfs_mirror;
104104
#endif
105+
106+
bool suspended;
105107
};
106108

109+
#define TEGRA_BPMP_MESSAGE_RESET BIT(0)
110+
107111
struct tegra_bpmp_message {
108112
unsigned int mrq;
109113

@@ -117,6 +121,8 @@ struct tegra_bpmp_message {
117121
size_t size;
118122
int ret;
119123
} rx;
124+
125+
unsigned long flags;
120126
};
121127

122128
#if IS_ENABLED(CONFIG_TEGRA_BPMP)

0 commit comments

Comments
 (0)