From 3b003c92149b6743b1988a9d9119d6a0ccf95a81 Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Thu, 29 Sep 2011 15:22:37 +0300 Subject: [PATCH] --- yaml --- r: 270717 b: refs/heads/master c: 009d196b4755b42c02414b287889a337955f7e09 h: refs/heads/master i: 270715: 5d42f39c2a7a84c6850a73e4d3bb9138f68111de v: v3 --- [refs] | 2 +- trunk/sound/soc/codecs/twl6040.c | 38 ++++++++++++++++++-------------- 2 files changed, 23 insertions(+), 17 deletions(-) diff --git a/[refs] b/[refs] index 5db95a228c47..bb5899ce0572 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 6fbb32d175368b6ab8fb827e65cd8d18ed04c1f3 +refs/heads/master: 009d196b4755b42c02414b287889a337955f7e09 diff --git a/trunk/sound/soc/codecs/twl6040.c b/trunk/sound/soc/codecs/twl6040.c index 738d1022247c..d040905cfa9b 100644 --- a/trunk/sound/soc/codecs/twl6040.c +++ b/trunk/sound/soc/codecs/twl6040.c @@ -565,12 +565,26 @@ static int out_drv_event(struct snd_soc_dapm_widget *w, switch (w->shift) { case 2: /* Headset output driver */ out = &priv->headset; + work = &out->work; + /* + * Make sure, that we do not mess up variables for already + * executing work. + */ + cancel_delayed_work_sync(work); + out->left_step = priv->hs_left_step; out->right_step = priv->hs_right_step; out->step_delay = 5; /* 5 ms between volume ramp steps */ break; case 4: /* Handsfree output driver */ out = &priv->handsfree; + work = &out->work; + /* + * Make sure, that we do not mess up variables for already + * executing work. + */ + cancel_delayed_work_sync(work); + out->left_step = priv->hf_left_step; out->right_step = priv->hf_right_step; out->step_delay = 5; /* 5 ms between volume ramp steps */ @@ -583,39 +597,31 @@ static int out_drv_event(struct snd_soc_dapm_widget *w, return -1; } - work = &out->work; - switch (event) { case SND_SOC_DAPM_POST_PMU: if (out->active) break; /* don't use volume ramp for power-up */ + out->ramp = TWL6040_RAMP_UP; out->left_step = out->left_vol; out->right_step = out->right_vol; - if (!delayed_work_pending(work)) { - out->ramp = TWL6040_RAMP_UP; - queue_delayed_work(priv->workqueue, work, - msecs_to_jiffies(1)); - } + queue_delayed_work(priv->workqueue, work, msecs_to_jiffies(1)); break; case SND_SOC_DAPM_PRE_PMD: if (!out->active) break; - if (!delayed_work_pending(work)) { - /* use volume ramp for power-down */ - out->ramp = TWL6040_RAMP_DOWN; - INIT_COMPLETION(out->ramp_done); + /* use volume ramp for power-down */ + out->ramp = TWL6040_RAMP_DOWN; + INIT_COMPLETION(out->ramp_done); - queue_delayed_work(priv->workqueue, work, - msecs_to_jiffies(1)); + queue_delayed_work(priv->workqueue, work, msecs_to_jiffies(1)); - wait_for_completion_timeout(&out->ramp_done, - msecs_to_jiffies(2000)); - } + wait_for_completion_timeout(&out->ramp_done, + msecs_to_jiffies(2000)); break; }