Openmoko Bug #1493: when press power button makes some noise during suspend time.

Openmoko Public Trac bugs at docs.openmoko.org
Tue Oct 7 13:12:59 CEST 2008


#1493: when press power button makes some noise during suspend time.
-----------------------------+----------------------------------------------
 Reporter:  regina_kim       |        Owner:  graeme at openmoko.org
     Type:  defect           |       Status:  assigned           
 Priority:  high             |    Milestone:  Om2008.8           
Component:  System Software  |      Version:                     
 Severity:  major            |   Resolution:                     
 Keywords:                   |    Blockedby:                     
 Blocking:                   |  
-----------------------------+----------------------------------------------

Comment(by ato):

 Hmm.  The click seems to occur actually quite a time after the kernel has
 finished the resume process.  I'm uncertain whether it is the amp being
 enabled, or the audio codec that is generating it.  In normal running
 state there's no "click" on turning on and off the amp, so that leads me
 to think it's the codec or something else.  You can mask it (see patch
 below) by delaying 2 seconds to turn the AMO on after ALSA finishes it's
 resume stuff, but this probably would mean we'd miss the first part of the
 ringtone on incoming call, which would be IMO even more annoying than the
 "click".

 Maybe it would be better to keep the amp turned off unless something is
 actually playing a sound stream?  That'd probably avoid this problem and
 might even save some power?  Please correct me if this assumption is
 wrong.

 {{{
 diff --git a/sound/soc/s3c24xx/neo1973_gta02_wm8753.c
 b/sound/soc/s3c24xx/neo1973_gta02_wm8753.c
 index dbc9c18..413970b 100644
 --- a/sound/soc/s3c24xx/neo1973_gta02_wm8753.c
 +++ b/sound/soc/s3c24xx/neo1973_gta02_wm8753.c
 @@ -58,6 +58,7 @@
  #define NEO_STEREO_TO_HANDSET_SPK      9

  static struct snd_soc_machine neo1973_gta02;
 +static struct timer_list lm4853_wakeup_timer;

  static int neo1973_gta02_hifi_hw_params(struct snd_pcm_substream
 *substream,
         struct snd_pcm_hw_params *params)
 @@ -576,9 +577,17 @@ static struct snd_soc_dai_link neo1973_gta02_dai[] =
 {
  },
  };

 +void lm4853_wakeup(unsigned long data)
 +{
 +       if(lm4853_state & LM4853_AMP)
 +               s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT, 0);
 +}
 +
  #ifdef CONFIG_PM
  int neo1973_gta02_suspend(struct platform_device *pdev, pm_message_t
 state)
  {
 +       del_singleshot_timer_sync(&lm4853_wakeup_timer);
 +
         s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT, 1);

         return 0;
 @@ -586,8 +595,14 @@ int neo1973_gta02_suspend(struct platform_device
 *pdev, pm_message_t state)

  int neo1973_gta02_resume(struct platform_device *pdev)
  {
 -       if(lm4853_state & LM4853_AMP)
 -               s3c2410_gpio_setpin(GTA02_GPIO_AMP_SHUT, 0);
 +       if(lm4853_state & LM4853_AMP) {
 +               /*
 +                * Lets wait a bit before turning on the amp to prevent
 the
 +                * speaker from making a "pop" noise.
 +                */
 +               lm4853_wakeup_timer.expires = jiffies +
 msecs_to_jiffies(2000);
 +               add_timer(&lm4853_wakeup_timer);
 +       }

         return 0;
  }
 @@ -639,6 +654,9 @@ static int __init neo1973_gta02_init(void)
         if (ret)
                 platform_device_put(neo1973_gta02_snd_device);

 +       init_timer(&lm4853_wakeup_timer);
 +       lm4853_wakeup_timer.function = lm4853_wakeup;
 +
         /* Initialise GPIOs used by amp */
         s3c2410_gpio_cfgpin(GTA02_GPIO_HP_IN, S3C2410_GPIO_OUTPUT);
         s3c2410_gpio_cfgpin(GTA02_GPIO_AMP_SHUT, S3C2410_GPIO_OUTPUT);
 @@ -654,6 +672,7 @@ static int __init neo1973_gta02_init(void)

  static void __exit neo1973_gta02_exit(void)
  {
 +       del_singleshot_timer_sync(&lm4853_wakeup_timer);
         platform_device_unregister(neo1973_gta02_snd_device);
  }
 }}}

-- 
Ticket URL: <https://docs.openmoko.org/trac/ticket/1493#comment:10>
docs.openmoko.org <http://docs.openmoko.org/trac/>
openmoko trac


More information about the buglog mailing list