linux-stable/sound/pci/hda
Takashi Iwai 46243b85b0 ALSA: hda: Reduce udelay() at SKL+ position reporting
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>
2021-09-30 13:49:41 +02:00
..
ca0132_regs.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 32 2019-05-24 17:27:10 +02:00
hda_auto_parser.c ALSA: hda: Allow model option to specify PCI SSID alias 2021-08-23 10:59:13 +02:00
hda_auto_parser.h ALSA: hda/cirrus: Increase AUTO_CFG_MAX_INS from 8 to 18 2021-03-07 09:17:30 +01:00
hda_beep.c ALSA: Use fallthrough pseudo-keyword 2020-07-09 13:01:29 +02:00
hda_beep.h ALSA: hda - Use standard device registration for beep 2019-01-29 18:28:09 +01:00
hda_bind.c ALSA: hda: Suspend codec at shutdown 2021-08-14 08:39:27 +02:00
hda_codec.c ALSA: hda: Disable runtime resume at shutdown 2021-08-26 17:48:32 +02:00
hda_controller.c ALSA: memalloc: Fix pgprot for WC mmap on x86 2021-08-04 08:13:54 +02:00
hda_controller.h ALSA: memalloc: Fix pgprot for WC mmap on x86 2021-08-04 08:13:54 +02:00
hda_controller_trace.h
hda_eld.c ALSA: Convert strlcpy to strscpy when return value is unused 2021-01-08 09:30:05 +01:00
hda_generic.c Merge branch 'for-linus' into for-next 2021-08-17 09:46:27 +02:00
hda_generic.h ALSA: hda: Nuke unused reboot_notify callback 2021-08-14 08:39:38 +02:00
hda_hwdep.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 32 2019-05-24 17:27:10 +02:00
hda_intel.c ALSA: hda: Reduce udelay() at SKL+ position reporting 2021-09-30 13:49:41 +02:00
hda_intel.h ALSA: hda: Release resources at error in delayed probe 2020-04-13 18:02:36 +02:00
hda_intel_trace.h
hda_jack.c ALSA: add virtio sound driver 2021-03-07 09:16:24 +01:00
hda_jack.h ALSA: hda - bind headset buttons to the headphone jack 2021-03-05 15:18:24 +01:00
hda_local.h ALSA: hda: Suspend codec at shutdown 2021-08-14 08:39:27 +02:00
hda_proc.c ALSA: hda/proc - print DP-MST connections 2020-12-08 20:04:33 +01:00
hda_sysfs.c ALSA: hda: Fix regressions on clear and reconfig sysfs 2020-12-10 19:55:35 +01:00
hda_tegra.c ALSA: hda: Add IRQ check for platform_get_irq() 2021-06-22 16:12:03 +02:00
hp_x360_helper.c
ideapad_s740_helper.c ALSA: hda/realtek: Add quirk for Lenovo Ideapad S740 2021-04-16 10:12:50 +02:00
Kconfig ALSA: hda/cirrus: Move CS8409 HDA bridge to separate module 2021-08-12 13:41:36 +02:00
Makefile ALSA: hda/cs8409: Move arrays of configuration to a new file 2021-08-12 13:41:39 +02:00
patch_analog.c ALSA: hda/analog - Sink ad198x_shutup() and shuffle CONFIG_PM guards 2021-08-18 07:51:09 +02:00
patch_ca0110.c ALSA: hda: Unify get_response handling 2019-12-13 14:36:52 +01:00
patch_ca0132.c ALSA: hda: Nuke unused reboot_notify callback 2021-08-14 08:39:38 +02:00
patch_cirrus.c ALSA: hda/cirrus: Move CS8409 HDA bridge to separate module 2021-08-12 13:41:36 +02:00
patch_cmedia.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 32 2019-05-24 17:27:10 +02:00
patch_conexant.c ALSA: hda: Nuke unused reboot_notify callback 2021-08-14 08:39:38 +02:00
patch_cs8409-tables.c ALSA: hda/cs8409: Unmute/Mute codec when stream starts/stops 2021-08-12 13:42:01 +02:00
patch_cs8409.c ALSA: hda/cs8409: Setup Dolphin Headset Mic as Phantom Jack 2021-09-16 12:24:46 +02:00
patch_cs8409.h ALSA: hda/cs8409: Ensure Type Detection is only run on startup when necessary 2021-08-27 22:35:34 +02:00
patch_hdmi.c Merge branch 'for-linus' into for-next 2021-08-02 09:04:48 +02:00
patch_realtek.c ALSA: hda/realtek: Quirks to enable speaker output for Lenovo Legion 7i 15IMHG05, Yoga 7i 14ITL5/15ITL5, and 13s Gen2 laptops. 2021-09-14 11:09:17 +02:00
patch_si3054.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 32 2019-05-24 17:27:10 +02:00
patch_sigmatel.c ALSA: hda/sigmatel - Sink stac_shutup() into stac_suspend() 2021-08-18 07:51:02 +02:00
patch_via.c ALSA: hda/via: Apply runtime PM workaround for ASUS B23E 2021-08-17 08:02:44 +02:00
thinkpad_helper.c ALSA: HDA - remove the custom implementation for the audio LED trigger 2021-03-30 15:35:15 +02:00