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 <zhengxing@rock-chips.com>
Change-Id: I92a91e27ab9dee2787efb1a1119f070e51d9473a
This commit is contained in:
Xing Zheng
2024-03-26 10:40:37 +08:00
committed by Tao Huang
parent d17a81499e
commit 63eceba8be
2 changed files with 10 additions and 0 deletions

View File

@@ -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;

View File

@@ -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 */