disable IMQ on 2.6.28 as well -- people should use IFB..
[openwrt.git] / target / linux / s3c24xx / patches / 0184-workaround-s3c24xx-i2s-stop-live-stream-stall-on-res.patch
1 From f4dac01cd9cb5b7a33fb336fbf9065dbd7e38efe Mon Sep 17 00:00:00 2001
2 From: Andy Green <andy@openmoko.com>
3 Date: Fri, 25 Jul 2008 23:06:15 +0100
4 Subject: [PATCH] workaround-s3c24xx-i2s-stop-live-stream-stall-on-resume.patch
5  Reported-by: Graeme Gregory <graeme@openmoko.org>
6  Basically-solved-by: Graeme Gregory <graeme@openmoko.org>
7
8 Graeme found a while back that on resume, IISCON register in
9 s3c2442 does not show LRCK toggling in LRINDEX bit any more,
10 causing s3c24xx_snd_lrsync() to timeout and return an error,
11 aborting restart of any live stream that was playing at
12 suspend.
13
14 I confirmed it was true, meddled around for a bit looking
15 for some magic to restart LRCK or at least the reporting of
16 it, and in the end worked around it using the method noted
17 by Graeme: just ignore LRCK sync if it timed out.  The worst
18 that could happen would be L and R swap for the duration of
19 stream that was suspended into but probably not even that.
20
21 Signed-off-by: Andy Green <andy@openmoko.com>
22 ---
23  sound/soc/s3c24xx/s3c24xx-i2s.c |   15 +++++++++------
24  1 files changed, 9 insertions(+), 6 deletions(-)
25
26 diff --git a/sound/soc/s3c24xx/s3c24xx-i2s.c b/sound/soc/s3c24xx/s3c24xx-i2s.c
27 index 1ed6afd..fce667c 100644
28 --- a/sound/soc/s3c24xx/s3c24xx-i2s.c
29 +++ b/sound/soc/s3c24xx/s3c24xx-i2s.c
30 @@ -180,7 +180,7 @@ static void s3c24xx_snd_rxctrl(int on)
31  static int s3c24xx_snd_lrsync(void)
32  {
33         u32 iiscon;
34 -       unsigned long timeout = jiffies + msecs_to_jiffies(5);
35 +       int timeout = 5; /* 500us, 125 should be enough at 8kHz */
36  
37         DBG("Entered %s\n", __func__);
38  
39 @@ -286,11 +286,14 @@ static int s3c24xx_i2s_trigger(struct snd_pcm_substream *substream, int cmd)
40         case SNDRV_PCM_TRIGGER_START:
41         case SNDRV_PCM_TRIGGER_RESUME:
42         case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
43 -               if (!s3c24xx_snd_is_clkmaster()) {
44 -                       ret = s3c24xx_snd_lrsync();
45 -                       if (ret)
46 -                               goto exit_err;
47 -               }
48 +               if (!s3c24xx_snd_is_clkmaster())
49 +                       /* we ignore the return code, if it sync'd then fine,
50 +                        * if it didn't sync, which happens after resume the
51 +                        * first time when there was a live stream at suspend,
52 +                        * just let it timeout, the stream picks up OK after
53 +                        * that and LRCK is evidently working again.
54 +                        */
55 +                       s3c24xx_snd_lrsync();
56  
57                 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
58                         s3c24xx_snd_rxctrl(1);
59 -- 
60 1.5.6.3
61