ASoC: Make pmdown_time a per-card setting
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Fri, 12 Feb 2010 11:05:44 +0000 (11:05 +0000)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Tue, 16 Feb 2010 19:14:52 +0000 (19:14 +0000)
Make the pmdown_time a per-card setting rather than a global one,
initialised before the card initialisation runs. This allows cards
to override the default setting if it makes sense to do so (for
example, due to an unavoidable pop).

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
include/sound/soc.h
sound/soc/soc-core.c

index e6a6d10de1d3b0852ea7c7e0031c075747e76094..d9d88dd9720da7c92de1b828a5c8ab784ae63c5d 100644 (file)
@@ -521,6 +521,8 @@ struct snd_soc_card {
        int (*set_bias_level)(struct snd_soc_card *,
                              enum snd_soc_bias_level level);
 
+       int pmdown_time;
+
        /* CPU <--> Codec DAI links  */
        struct snd_soc_dai_link *dai_link;
        int num_links;
index ca89c782132df6f7fa58ed998f32ef2411d5bd96..94b9cde26139623121780e27eedb78138c52e097 100644 (file)
@@ -542,7 +542,7 @@ static int soc_codec_close(struct snd_pcm_substream *substream)
                /* start delayed pop wq here for playback streams */
                codec_dai->pop_wait = 1;
                schedule_delayed_work(&card->delayed_work,
-                       msecs_to_jiffies(pmdown_time));
+                       msecs_to_jiffies(card->pmdown_time));
        } else {
                /* capture streams can be powered down now */
                snd_soc_dapm_stream_event(codec,
@@ -1039,6 +1039,8 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
        dev_dbg(card->dev, "All components present, instantiating\n");
 
        /* Found everything, bring it up */
+       card->pmdown_time = pmdown_time;
+
        if (card->probe) {
                ret = card->probe(pdev);
                if (ret < 0)