Skip to content

Commit ae50e2a

Browse files
committed
ALSA: hda: cs35l41: Check runtime suspend capability at runtime_idle
The runtime PM core checks with runtime_idle callback whether it can goes to the runtime suspend or not, and we can put the boost type check there instead of runtime_suspend and _resume calls. This will reduce the unnecessary runtime_suspend() calls. Fixes: 1873ebd ("ALSA: hda: cs35l41: Support Hibernation during Suspend") Cc: <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 15a59cb commit ae50e2a

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

sound/pci/hda/cs35l41_hda.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,15 @@ static int cs35l41_system_resume(struct device *dev)
647647
return ret;
648648
}
649649

650+
static int cs35l41_runtime_idle(struct device *dev)
651+
{
652+
struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
653+
654+
if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST_NO_VSPK_SWITCH)
655+
return -EBUSY; /* suspend not supported yet on this model */
656+
return 0;
657+
}
658+
650659
static int cs35l41_runtime_suspend(struct device *dev)
651660
{
652661
struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
@@ -1536,7 +1545,8 @@ void cs35l41_hda_remove(struct device *dev)
15361545
EXPORT_SYMBOL_NS_GPL(cs35l41_hda_remove, SND_HDA_SCODEC_CS35L41);
15371546

15381547
const struct dev_pm_ops cs35l41_hda_pm_ops = {
1539-
RUNTIME_PM_OPS(cs35l41_runtime_suspend, cs35l41_runtime_resume, NULL)
1548+
RUNTIME_PM_OPS(cs35l41_runtime_suspend, cs35l41_runtime_resume,
1549+
cs35l41_runtime_idle)
15401550
SYSTEM_SLEEP_PM_OPS(cs35l41_system_suspend, cs35l41_system_resume)
15411551
};
15421552
EXPORT_SYMBOL_NS_GPL(cs35l41_hda_pm_ops, SND_HDA_SCODEC_CS35L41);

0 commit comments

Comments
 (0)