Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: hda: fix a runtime pm issue in SOF when integrated GPU is disabled
@ 2020-09-02 15:42 Kai Vehmanen
  2020-09-02 17:32 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Kai Vehmanen @ 2020-09-02 15:42 UTC (permalink / raw)
  To: alsa-devel, tiwai
  Cc: Guennadi Liakhovetski, kai.vehmanen, Pierre-Louis Bossart,
	Ranjani Sridharan, Rander Wang, Bard Liao

From: Rander Wang <rander.wang@intel.com>

In snd_hdac_device_init pm_runtime_set_active is called to
increase child_count in parent device. But when it is failed
to build connection with GPU for one case that integrated
graphic gpu is disabled, snd_hdac_ext_bus_device_exit will be
invoked to clean up a HD-audio extended codec base device. At
this time the child_count of parent is not decreased, which
makes parent device can't get suspended.

This patch calls pm_runtime_set_suspended to decrease child_count
in parent device in snd_hdac_device_exit to match with
snd_hdac_device_init. pm_runtime_set_suspended can make sure that
it will not decrease child_count if the device is already suspended.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
---
 sound/hda/hdac_device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sound/hda/hdac_device.c b/sound/hda/hdac_device.c
index 333220f0f8af..3e9e9ac804f6 100644
--- a/sound/hda/hdac_device.c
+++ b/sound/hda/hdac_device.c
@@ -127,6 +127,8 @@ EXPORT_SYMBOL_GPL(snd_hdac_device_init);
 void snd_hdac_device_exit(struct hdac_device *codec)
 {
 	pm_runtime_put_noidle(&codec->dev);
+	/* keep balance of runtime PM child_count in parent device */
+	pm_runtime_set_suspended(&codec->dev);
 	snd_hdac_bus_remove_device(codec->bus, codec);
 	kfree(codec->vendor_name);
 	kfree(codec->chip_name);
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] ALSA: hda: fix a runtime pm issue in SOF when integrated GPU is disabled
  2020-09-02 15:42 [PATCH] ALSA: hda: fix a runtime pm issue in SOF when integrated GPU is disabled Kai Vehmanen
@ 2020-09-02 17:32 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2020-09-02 17:32 UTC (permalink / raw)
  To: Kai Vehmanen
  Cc: Guennadi Liakhovetski, alsa-devel, Pierre-Louis Bossart,
	Ranjani Sridharan, Rander Wang, Bard Liao

On Wed, 02 Sep 2020 17:42:18 +0200,
Kai Vehmanen wrote:
> 
> From: Rander Wang <rander.wang@intel.com>
> 
> In snd_hdac_device_init pm_runtime_set_active is called to
> increase child_count in parent device. But when it is failed
> to build connection with GPU for one case that integrated
> graphic gpu is disabled, snd_hdac_ext_bus_device_exit will be
> invoked to clean up a HD-audio extended codec base device. At
> this time the child_count of parent is not decreased, which
> makes parent device can't get suspended.
> 
> This patch calls pm_runtime_set_suspended to decrease child_count
> in parent device in snd_hdac_device_exit to match with
> snd_hdac_device_init. pm_runtime_set_suspended can make sure that
> it will not decrease child_count if the device is already suspended.
> 
> Signed-off-by: Rander Wang <rander.wang@intel.com>
> Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
> Reviewed-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
> Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

Applied now.  Thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-02 17:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-02 15:42 [PATCH] ALSA: hda: fix a runtime pm issue in SOF when integrated GPU is disabled Kai Vehmanen
2020-09-02 17:32 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox