Skip to content

ASoC: codecs: pcm3168a: Fix and updates for power management

Cezary Rojewski linux-sound 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3ASoC: codecs: pcm3168a: Prevent regulator double-disable in S4sound/soc/codecs/pcm3168a.c+1 -00 replies
2/3ASoC: codecs: pcm3168a: Drop redundant pm_runtime_idle()sound/soc/codecs/pcm3168a.c+0 -10 replies
3/3ASoC: codecs: pcm3168a: Drop CONFIG_PM-conditional preproc directivesound/soc/codecs/pcm3168a.c+7 -130 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] ASoC: codecs: pcm3168a: Fix and updates for power management

Set of changes composed of one fix and two improvements.

The fix leads the series and addresses "unbalanced disables" coming from the regulator core during S4 (hibernation) scenario.

The SLEEP_PM_OPS are unset for the driver. Hibernation (S4) causes no resume (skipped thanks to smart_suspend=true) yet still performs the suspend sequence unconditionally, see device_complete() in drivers/base/power/main.c. In essence, we end up with double suspend (double disable) and thus the warning. Exemplary stack:

unbalanced disables for regulator-dummy

WARNING: drivers/regulator/core.c:3244 at _regulator_disable+0x161/0x270, CPU#6: kworker/u64:2/120
(...)
Workqueue: pm pm_runtime_work
RIP: 0010:_regulator_disable+0x161/0x270
(...)
Call Trace:
  <TASK>
  regulator_bulk_disable+0xe4/0x220
  ? __pfx_regulator_bulk_disable+0x10/0x10
  ? pick_next_task_fair+0x36f/0x11f0
  ? __pfx_regmap_unlock_mutex+0x10/0x10
  ? regmap_unlock_mutex+0xe/0x20
  pcm3168a_rt_suspend+0x57/0x90 [snd_soc_pcm3168a]
  ? __pfx_pcm3168a_rt_suspend+0x10/0x10 [snd_soc_pcm3168a]
  __rpm_callback+0x69/0x200
  ? __pfx_pcm3168a_rt_suspend+0x10/0x10 [snd_soc_pcm3168a]
  rpm_callback+0xbc/0xd0
  rpm_suspend+0x225/0x960
  ? __pfx_rpm_suspend+0x10/0x10
  ? __kasan_check_write+0x14/0x20
  ? _raw_spin_lock_irq+0x8d/0xe0
  ? __pfx__raw_spin_lock_irq+0x10/0x10
  ? pwq_dec_nr_in_flight+0x63/0x4f0
  pm_runtime_work+0xd0/0xf0

In regard to the improvements, both aim to drop redundant operations. One targets pm_runtime_idle() - no need to fire it manually, device-driver core will do that for us - while the second replaces preprocessor directive with pm_runtime_status_suspended() check. No !CONFIG_PM dependency equals better code coverege with default kconfigs.

Cezary Rojewski (3):
ASoC: codecs: pcm3168a: Prevent regulator double-disable in S4
ASoC: codecs: pcm3168a: Drop redundant pm_runtime_idle()
ASoC: codecs: pcm3168a: Drop CONFIG_PM-conditional preproc directive

 sound/soc/codecs/pcm3168a.c | 22 ++++++++--------------
 1 file changed, 8 insertions(+), 14 deletions(-)
Signature · 1 line
2.34.1