No description
Find a file
Takashi Iwai 1f57a1b979 ALSA: hda: Fix unhandled register update during auto-suspend period
commit 81302b1c7c upstream.

It's reported that the recording started right after the driver probe
doesn't work properly, and it turned out that this is related with the
codec auto-suspend.  Namely, after the probe phase, the usage count
goes zero, and the auto-suspend is programmed, but the codec is kept
still active until the auto-suspend expiration.  When an application
(e.g. alsactl) updates the mixer values at this moment, the values are
cached but not actually written.  Then, starting arecord thereafter
also results in the silence because of the missing unmute.

The root cause is the handling of "lazy update" mode; when a mixer
value is updated *after* the suspend, it should update only the cache
and exits.  At the resume, the cached value is written to the device,
in turn.  The problem is that the current code misinterprets the state
of auto-suspend as if it were already suspended.

Although we can add the check of the actual device state after
pm_runtime_get_if_in_use() for catching the missing state, this won't
suffice; the second call of regmap_update_bits_check() will skip
writing the register because the cache has been already updated by the
first call.  So we'd need fixes in two different places.

OTOH, a simpler fix is to replace pm_runtime_get_if_in_use() with
pm_runtime_get_if_active() (with ign_usage_count=true).  This change
implies that the driver takes the pm refcount if the device is still
in ACTIVE state and continues the processing.  A small caveat is that
this will leave the auto-suspend timer.  But, since the timer callback
itself checks the device state and aborts gracefully when it's active,
this won't be any substantial problem.

Long story short: we address the missing register-write problem just
by replacing the pm_runtime_*() call in snd_hda_keep_power_up().

Fixes: fc4f000bf8 ("ALSA: hda - Fix unexpected resume through regmap code path")
Reported-by: Amadeusz Sławiński <amadeuszx.slawinski@linux.intel.com>
Closes: https://lore.kernel.org/r/a7478636-af11-92ab-731c-9b13c582a70d@linux.intel.com
Suggested-by: Cezary Rojewski <cezary.rojewski@intel.com>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20230518113520.15213-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2023-05-30 12:57:56 +01:00
arch ARM: dts: stm32: fix AV96 board SAI2 pin muxing on stm32mp15 2023-05-30 12:57:56 +01:00
block blk-crypto: make blk_crypto_evict_key() more robust 2023-05-17 11:47:32 +02:00
certs certs/blacklist_hashes.c: fix const confusion in certs blacklist 2022-06-22 14:13:17 +02:00
crypto crypto: drbg - Only fail when jent is unavailable in FIPS mode 2023-05-17 11:47:50 +02:00
Documentation docs: futex: Fix kernel-doc references after code split-up preparation 2023-04-26 11:27:40 +02:00
drivers spi: fsl-cpm: Use 16 bit mode for large transfers with even size 2023-05-30 12:57:56 +01:00
fs ocfs2: Switch to security_inode_init_security() 2023-05-30 12:57:56 +01:00
include net/sched: act_mirred: refactor the handle of xmit 2023-05-30 12:57:56 +01:00
init kbuild: check the minimum assembler version in Kconfig 2023-04-20 12:10:28 +02:00
io_uring io_uring: avoid null-ptr-deref in io_arm_poll_handler 2023-03-22 13:30:05 +01:00
ipc ipc/sem: Fix dangling sem_array access in semtimedop race 2022-12-08 11:24:00 +01:00
kernel bpf: Annotate data races in bpf_local_storage 2023-05-30 12:57:48 +01:00
lib lib: cpu_rmap: Avoid use after free on rmap->obj array entries 2023-05-30 12:57:49 +01:00
LICENSES
mm writeback, cgroup: remove extra percpu_ref_exit() 2023-05-30 12:57:56 +01:00
net act_mirred: use the backlog for nested calls to mirred ingress 2023-05-30 12:57:56 +01:00
samples samples/bpf: Fix fout leak in hbm's run_bpf_prog 2023-05-30 12:57:49 +01:00
scripts recordmcount: Fix memory leaks in the uwrite function 2023-05-30 12:57:50 +01:00
security selinux: ensure av_permissions.h is built when needed 2023-05-17 11:47:37 +02:00
sound ALSA: hda: Fix unhandled register update during auto-suspend period 2023-05-30 12:57:56 +01:00
tools act_mirred: use the backlog for nested calls to mirred ingress 2023-05-30 12:57:56 +01:00
usr usr/include/Makefile: add linux/nfc.h to the compile-test coverage 2022-02-01 17:25:48 +01:00
virt KVM: fix memoryleak in kvm_init() 2023-04-05 11:23:43 +02:00
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS audit: update the mailing list in MAINTAINERS 2023-02-25 11:55:04 +01:00
Makefile Linux 5.10.180 2023-05-17 11:48:20 +02:00
README

Linux kernel
============

There are several guides for kernel developers and users. These guides can
be rendered in a number of formats, like HTML and PDF. Please read
Documentation/admin-guide/README.rst first.

In order to build the documentation, use ``make htmldocs`` or
``make pdfdocs``.  The formatted documentation can also be read online at:

    https://www.kernel.org/doc/html/latest/

There are various text files in the Documentation/ subdirectory,
several of them using the Restructured Text markup notation.

Please read the Documentation/process/changes.rst file, as it contains the
requirements for building and running the kernel, and information about
the problems which may result by upgrading your kernel.