diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-03-04 09:54:40 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-03-04 09:57:09 -0500 |
commit | 1ca7578043a79d74152774acee0ed6e393134d12 (patch) | |
tree | 7ff0780d2a7dc9c7fbdcf35aeedd13f312a17d4e /sound/soc/s3c24xx/s3c-i2s-v2.c | |
parent | 913d7b4cc0d958df9f2e4bc0e6926c037d96d07e (diff) |
ASoC: Add delay information for Samsung IISv2 DAIs
Report the current FIFO depth when delay is queried. The FIFO is only
16 frames deep so the latency will be at most a couple of miliseconds
(and we tend to end up reporting zero most of the time) but it may
help some applications.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'sound/soc/s3c24xx/s3c-i2s-v2.c')
-rw-r--r-- | sound/soc/s3c24xx/s3c-i2s-v2.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/sound/soc/s3c24xx/s3c-i2s-v2.c b/sound/soc/s3c24xx/s3c-i2s-v2.c index e994d8374fe6..aa84f4cb4d8a 100644 --- a/sound/soc/s3c24xx/s3c-i2s-v2.c +++ b/sound/soc/s3c24xx/s3c-i2s-v2.c | |||
@@ -550,6 +550,21 @@ static int s3c2412_i2s_set_clkdiv(struct snd_soc_dai *cpu_dai, | |||
550 | return 0; | 550 | return 0; |
551 | } | 551 | } |
552 | 552 | ||
553 | static snd_pcm_sframes_t s3c2412_i2s_delay(struct snd_pcm_substream *substream, | ||
554 | struct snd_soc_dai *dai) | ||
555 | { | ||
556 | struct s3c_i2sv2_info *i2s = to_info(dai); | ||
557 | u32 reg = readl(i2s->regs + S3C2412_IISFIC); | ||
558 | snd_pcm_sframes_t delay; | ||
559 | |||
560 | if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) | ||
561 | delay = S3C2412_IISFIC_TXCOUNT(reg); | ||
562 | else | ||
563 | delay = S3C2412_IISFIC_RXCOUNT(reg); | ||
564 | |||
565 | return delay; | ||
566 | } | ||
567 | |||
553 | /* default table of all avaialable root fs divisors */ | 568 | /* default table of all avaialable root fs divisors */ |
554 | static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 }; | 569 | static unsigned int iis_fs_tab[] = { 256, 512, 384, 768 }; |
555 | 570 | ||
@@ -736,6 +751,10 @@ int s3c_i2sv2_register_dai(struct snd_soc_dai *dai) | |||
736 | ops->set_fmt = s3c2412_i2s_set_fmt; | 751 | ops->set_fmt = s3c2412_i2s_set_fmt; |
737 | ops->set_clkdiv = s3c2412_i2s_set_clkdiv; | 752 | ops->set_clkdiv = s3c2412_i2s_set_clkdiv; |
738 | 753 | ||
754 | /* Allow overriding by (for example) IISv4 */ | ||
755 | if (!ops->delay) | ||
756 | ops->delay = s3c2412_i2s_delay, | ||
757 | |||
739 | dai->suspend = s3c2412_i2s_suspend; | 758 | dai->suspend = s3c2412_i2s_suspend; |
740 | dai->resume = s3c2412_i2s_resume; | 759 | dai->resume = s3c2412_i2s_resume; |
741 | 760 | ||