Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions drivers/mfd/macsmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -646,9 +646,11 @@ static int apple_smc_probe(struct platform_device *pdev)
mutex_init(&smc->mutex);
spin_lock_init(&smc->lock);
smc->dev = &pdev->dev;
smc->saved_enabled = of_machine_is_compatible("apple,j714s") &&
smc->saved_enabled = of_machine_is_compatible("apple,t6050") &&
(of_machine_is_compatible("apple,j714s") ||
of_machine_is_compatible("apple,j716c")) &&
of_device_is_compatible(dev->of_node, "apple,t6050-smc");
if (smc->saved_enabled)
if (smc->saved_enabled && of_machine_is_compatible("apple,j714s"))
smc->wake_reasons = apple_smc_j714s_wake_reasons;
smc->sram_base = devm_platform_get_and_ioremap_resource(pdev, 1, &smc->sram);
if (IS_ERR(smc->sram_base))
Expand Down Expand Up @@ -1537,6 +1539,21 @@ static int apple_smc_suspend_noirq(struct device *dev)
static int apple_smc_resume_noirq(struct device *dev)
{
struct apple_smc *smc = dev_get_drvdata(dev);
unsigned int i;

/*
* A wake by something the SMC reports (a port's plug or unplug) brings a notification
* right behind it, and its handler's ordinary command can be in flight here: posted, its
* reply waiting in the mailbox with the interrupt still off. That is no unresolved saved
* command. Take the reply in by polling before judging the lane; refusing here left the
* SMC without its AP ON notice and ANS waiting for its topology ("timed out waiting for
* topology from SMC", ANS crashed 10 s into the wake).
*/
if (smc->saved_enabled && !smc->saved_recovery && !smc->saved_fault)
for (i = 0; i < 20000 && smp_load_acquire(&smc->saved_pending); i++) {
apple_rtkit_poll(smc->rtk);
udelay(10);
}

if (smc->saved_enabled && (smc->saved_recovery || smc->saved_pending ||
smc->saved_fault))
Expand Down
Loading