Skip to content

Commit

Permalink
ALSA: hda: cs35l41: Check runtime suspend capability at runtime_idle
Browse files Browse the repository at this point in the history
commit ae50e2a upstream.

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: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230105093531.16960-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
tiwai authored and gregkh committed Jan 14, 2023
1 parent a6d58ef commit cb9b395
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion sound/pci/hda/cs35l41_hda.c
Expand Up @@ -647,6 +647,15 @@ static int cs35l41_system_resume(struct device *dev)
return ret;
}

static int cs35l41_runtime_idle(struct device *dev)
{
struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);

if (cs35l41->hw_cfg.bst_type == CS35L41_EXT_BOOST_NO_VSPK_SWITCH)
return -EBUSY; /* suspend not supported yet on this model */
return 0;
}

static int cs35l41_runtime_suspend(struct device *dev)
{
struct cs35l41_hda *cs35l41 = dev_get_drvdata(dev);
Expand Down Expand Up @@ -1536,7 +1545,8 @@ void cs35l41_hda_remove(struct device *dev)
EXPORT_SYMBOL_NS_GPL(cs35l41_hda_remove, SND_HDA_SCODEC_CS35L41);

const struct dev_pm_ops cs35l41_hda_pm_ops = {
RUNTIME_PM_OPS(cs35l41_runtime_suspend, cs35l41_runtime_resume, NULL)
RUNTIME_PM_OPS(cs35l41_runtime_suspend, cs35l41_runtime_resume,
cs35l41_runtime_idle)
SYSTEM_SLEEP_PM_OPS(cs35l41_system_suspend, cs35l41_system_resume)
};
EXPORT_SYMBOL_NS_GPL(cs35l41_hda_pm_ops, SND_HDA_SCODEC_CS35L41);
Expand Down

0 comments on commit cb9b395

Please sign in to comment.