linux/sound/pci/hda
Takashi Iwai 7cf7d9b83d ALSA: hda: Reduce udelay() at SKL+ position reporting
[ Upstream commit 46243b85b0ec5d2cee7545e5ce18c015ce91957e ]

The position reporting on Intel Skylake and later chips via
azx_get_pos_skl() contains a udelay(20) call for the capture streams.
A call for this alone doesn't sound too harmful.  However, as the
pointer PCM ops is one of the hottest path in the PCM operations --
especially for the timer-scheduled operations like PulseAudio -- such
a delay hogs CPU usage significantly in the total performance.

The code there was taken from the original code in ASoC SST Skylake
driver blindly.  The udelay() is a workaround for the case where the
reported position is behind the period boundary at the timing
triggered from interrupts; applications often expect that the full
data is available for the whole period when returned (and also that's
the definition of the ALSA PCM period).

OTOH, HD-audio (legacy) driver has already some workarounds for the
delayed position reporting due to its relatively large FIFO, such as
the BDL position adjustment and the delayed period-elapsed call in the
work.  That said, the udelay() is almost superfluous for HD-audio
driver unlike SST, and we can drop the udelay().

Though, the current code doesn't guarantee the full period readiness
as mentioned in the above, but rather it checks the wallclock and
detects the unexpected jump.  That's one missing piece, and the drop
of udelay() needs a bit more sanity checks for the delayed handling.

This patch implements those: the drop of udelay() call in
azx_get_pos_skl() and the more proper check of hwptr in
azx_position_ok().  The latter change is applied only for the case
where the stream is running in the normal mode without
no_period_wakeup flag.  When no_period_wakeup is set, it essentially
ignores the period handling and rather concentrates only on the
current position; which implies that we don't need to care about the
period boundary at all.

Fixes: f87e7f2589 ("ALSA: hda - Improved position reporting on SKL+")
Reported-by: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20210929072934.6809-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-11-17 09:48:42 +01:00
..
Kconfig
Makefile
ca0132_regs.h
hda_auto_parser.c ALSA: hda - let hs_mic be picked ahead of hp_mic 2020-07-16 08:16:42 +02:00
hda_auto_parser.h
hda_beep.c ALSA: hda: Fix potential access overflow in beep helper 2020-04-17 10:50:07 +02:00
hda_beep.h
hda_bind.c ALSA: hda: Avoid spurious unsol event handling during S3/S4 2021-03-17 17:03:46 +01:00
hda_codec.c ALSA: hda: Fix regressions on clear and reconfig sysfs 2020-12-30 11:51:32 +01:00
hda_controller.c ALSA: hda: Drop the BATCH workaround for AMD controllers 2021-03-17 17:03:46 +01:00
hda_controller.h ALSA: hda: Separate runtime and system suspend 2020-11-18 19:20:22 +01:00
hda_controller_trace.h
hda_eld.c ALSA: hda: Use scnprintf() for printing texts for sysfs/procfs 2020-02-28 17:22:12 +01:00
hda_generic.c ALSA: hda - fix the 'Capture Switch' value change notifications 2021-08-26 08:36:20 -04:00
hda_generic.h ALSA: hda/generic: Add option to enforce preferred_dacs pairs 2020-12-11 13:23:29 +01:00
hda_hwdep.c
hda_intel.c ALSA: hda: Reduce udelay() at SKL+ position reporting 2021-11-17 09:48:42 +01:00
hda_intel.h ALSA: hda: Release resources at error in delayed probe 2020-05-02 08:48:56 +02:00
hda_intel_trace.h
hda_jack.c
hda_jack.h
hda_local.h ALSA: hda: Manage concurrent reg access more properly 2020-05-27 17:46:37 +02:00
hda_proc.c
hda_sysfs.c ALSA: hda: Fix regressions on clear and reconfig sysfs 2020-12-30 11:51:32 +01:00
hda_tegra.c ALSA: hda: Add IRQ check for platform_get_irq() 2021-07-20 16:10:46 +02:00
hp_x360_helper.c
patch_analog.c ALSA: hda - constify and cleanup static NodeID tables 2020-05-27 17:46:36 +02:00
patch_ca0110.c
patch_ca0132.c ALSA: hda/ca0132: Add Sound BlasterX AE-5 Plus support 2021-03-17 17:03:46 +01:00
patch_cirrus.c
patch_cmedia.c
patch_conexant.c ALSA: hda/conexant: Re-order CX5066 quirk table entries 2021-05-11 14:04:13 +02:00
patch_hdmi.c ALSA: hdmi: Expose all pins on MSI MS-7C94 board 2021-07-28 13:30:59 +02:00
patch_realtek.c ALSA: hda/realtek: Add quirk for HP EliteBook 840 G7 mute LED 2021-11-17 09:48:18 +01:00
patch_si3054.c
patch_sigmatel.c ALSA: pci: delete repeated words in comments 2020-09-03 11:26:41 +02:00
patch_via.c ALSA: hda/via: Apply the workaround generically for Clevo machines 2021-02-03 23:25:56 +01:00
thinkpad_helper.c