From 63eceba8bed7330f12e0f4137a4f7c77e9b21a8a Mon Sep 17 00:00:00 2001 From: Xing Zheng Date: Tue, 26 Mar 2024 10:40:37 +0800 Subject: [PATCH] ALSA: pcm: add support get audio boot time during suspend on Rockchip platform with NO_GKI Some products need to ensure that their audio PTS are correct after waking up from sleep, and need to use the boottime interface to maintain normal time counting during sleep. Signed-off-by: Xing Zheng Change-Id: I92a91e27ab9dee2787efb1a1119f070e51d9473a --- include/sound/pcm.h | 5 +++++ include/uapi/sound/asound.h | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/include/sound/pcm.h b/include/sound/pcm.h index 86fe18198a15..a2a64f10f3b2 100644 --- a/include/sound/pcm.h +++ b/include/sound/pcm.h @@ -1253,6 +1253,11 @@ static inline void snd_pcm_gettime(struct snd_pcm_runtime *runtime, case SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW: ktime_get_raw_ts64(tv); break; +#if defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI) + case SNDRV_PCM_TSTAMP_TYPE_BOOTTIME: + ktime_get_boottime_ts64(tv); + break; +#endif default: ktime_get_real_ts64(tv); break; diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index de6810e94abe..0641122d2298 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h @@ -606,7 +606,12 @@ enum { SNDRV_PCM_TSTAMP_TYPE_GETTIMEOFDAY = 0, /* gettimeofday equivalent */ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC, /* posix_clock_monotonic equivalent */ SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, /* monotonic_raw (no NTP) */ +#if defined(__KERNEL__) && defined(CONFIG_ARCH_ROCKCHIP) && defined(CONFIG_NO_GKI) + SNDRV_PCM_TSTAMP_TYPE_BOOTTIME, /* boot time during suspend */ + SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_BOOTTIME, +#else SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC_RAW, +#endif }; /* channel positions */